diff --git a/html/117write-int-hex.subx.html b/html/117write-int-hex.subx.html index 5408a46f..1515c6bd 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 f6b6c986..dc13cf2c 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 b547b60b..ec709f60 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 adafd09b..dedfd1f0 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 6b059b7e..6753ac54 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/312copy.subx.html b/html/312copy.subx.html index fd93cb81..a1a365f8 100644 --- a/html/312copy.subx.html +++ b/html/312copy.subx.html @@ -95,7 +95,7 @@ if ('onhashchange' in window) { 38 (lookup *eax *(eax+4)) # => eax 39 89/<- %edi 0/r32/eax 40 # -41 (copy-bytes %esi %edi %ecx) +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 diff --git a/html/314divide.subx.html b/html/314divide.subx.html new file mode 100644 index 00000000..d284f8e7 --- /dev/null +++ b/html/314divide.subx.html @@ -0,0 +1,77 @@ + + + + +Mu - 314divide.subx + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/314divide.subx +
+ 1 == code
+ 2 
+ 3 integer-divide:  # a: int, b: int -> quotient/eax: int, remainder/edx: int
+ 4     # . prologue
+ 5     55/push-ebp
+ 6     89/<- %ebp 4/r32/esp
+ 7     # eax = a
+ 8     8b/-> *(ebp+8) 0/r32/eax
+ 9     # edx = all 0s or all 1s
+10     99/sign-extend-eax-into-edx
+11     # quotient, remainder = divide eax by b
+12     f7 7/subop/divide-eax-edx-by *(ebp+0xc)
+13 $integer-divide:end:
+14     # . epilogue
+15     89/<- %esp 5/r32/ebp
+16     5d/pop-to-ebp
+17     c3/return
+
+ + + diff --git a/html/400.mu.html b/html/400.mu.html index 7502b30a..8b6aae39 100644 --- a/html/400.mu.html +++ b/html/400.mu.html @@ -232,14 +232,16 @@ if ('onhashchange' in window) { 177 178 sig stream-empty? s: (addr stream _) -> _/eax: boolean 179 sig stream-full? s: (addr stream _) -> _/eax: boolean -180 sig stream-to-array in: (addr stream _), out: (addr handle array _) -181 sig unquote-stream-to-array in: (addr stream _), out: (addr handle array _) +180 sig stream-to-array in: (addr stream _), out: (addr handle array _) +181 sig unquote-stream-to-array in: (addr stream _), out: (addr handle array _) 182 sig stream-first s: (addr stream byte) -> _/eax: byte 183 sig stream-final s: (addr stream byte) -> _/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) +188 +189 sig integer-divide a: int, b: int -> _/eax: int, _/edx: int diff --git a/html/405screen.mu.html b/html/405screen.mu.html index 21f91871..dc7c14ff 100644 --- a/html/405screen.mu.html +++ b/html/405screen.mu.html @@ -545,949 +545,960 @@ if ('onhashchange' in window) { 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" + 488 var s2: (stream byte 0x100) + 489 var s2-addr/esi: (addr stream byte) <- address s2 + 490 write-int32-decimal s2-addr, n + 491 var screen-addr/edi: (addr screen) <- copy screen + 492 { + 493 var done?/eax: boolean <- stream-empty? s2-addr + 494 compare done?, 0 + 495 break-if-!= + 496 var g/eax: grapheme <- read-grapheme s2-addr + 497 print-grapheme screen, g + 498 loop + 499 } + 500 } + 501 + 502 fn reset-formatting screen: (addr screen) { + 503 compare screen, 0 + 504 { + 505 break-if-!= + 506 reset-formatting-on-real-screen + 507 return + 508 } + 509 # fake screen + 510 var screen-addr/esi: (addr screen) <- copy screen + 511 var dest/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 512 var default-cell: screen-cell + 513 var bg/eax: (addr int) <- get default-cell, background-color + 514 copy-to *bg, 7 + 515 var default-cell-addr/eax: (addr screen-cell) <- address default-cell + 516 copy-object default-cell-addr, dest + 517 } + 518 + 519 fn start-color screen: (addr screen), fg: int, bg: int { + 520 compare screen, 0 + 521 { + 522 break-if-!= + 523 start-color-on-real-screen fg, bg + 524 return + 525 } + 526 # fake screen + 527 var screen-addr/esi: (addr screen) <- copy screen + 528 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 529 var dest/edx: (addr int) <- get attr, color + 530 var src/eax: int <- copy fg + 531 copy-to *dest, src + 532 var dest/edx: (addr int) <- get attr, background-color + 533 var src/eax: int <- copy bg + 534 copy-to *dest, src + 535 } + 536 + 537 fn start-bold screen: (addr screen) { + 538 compare screen, 0 + 539 { + 540 break-if-!= + 541 start-bold-on-real-screen + 542 return + 543 } + 544 # fake screen + 545 var screen-addr/esi: (addr screen) <- copy screen + 546 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 547 var dest/edx: (addr boolean) <- get attr, bold? + 548 copy-to *dest, 1 + 549 } + 550 + 551 fn start-underline screen: (addr screen) { + 552 compare screen, 0 + 553 { + 554 break-if-!= + 555 start-underline-on-real-screen + 556 return + 557 } + 558 # fake screen + 559 var screen-addr/esi: (addr screen) <- copy screen + 560 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 561 var dest/edx: (addr boolean) <- get attr, underline? + 562 copy-to *dest, 1 + 563 } + 564 + 565 fn start-reverse-video screen: (addr screen) { + 566 compare screen, 0 + 567 { + 568 break-if-!= + 569 start-reverse-video-on-real-screen + 570 return + 571 } + 572 # fake screen + 573 var screen-addr/esi: (addr screen) <- copy screen + 574 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 575 var dest/edx: (addr boolean) <- get attr, reverse? + 576 copy-to *dest, 1 + 577 } + 578 + 579 fn start-blinking screen: (addr screen) { + 580 compare screen, 0 + 581 { + 582 break-if-!= + 583 start-blinking-on-real-screen + 584 return + 585 } + 586 # fake screen + 587 var screen-addr/esi: (addr screen) <- copy screen + 588 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 589 var dest/edx: (addr boolean) <- get attr, blink? + 590 copy-to *dest, 1 + 591 } + 592 + 593 fn hide-cursor screen: (addr screen) { + 594 compare screen, 0 + 595 { + 596 break-if-!= + 597 hide-cursor-on-real-screen + 598 return + 599 } + 600 # fake screen + 601 var screen-addr/esi: (addr screen) <- copy screen + 602 var hide?/ecx: (addr boolean) <- get screen-addr, cursor-hide? + 603 copy-to *hide?, 1 + 604 } + 605 + 606 fn show-cursor screen: (addr screen) { + 607 compare screen, 0 + 608 { + 609 break-if-!= + 610 show-cursor-on-real-screen + 611 return + 612 } + 613 # fake screen + 614 var screen-addr/esi: (addr screen) <- copy screen + 615 var hide?/ecx: (addr boolean) <- get screen-addr, cursor-hide? + 616 copy-to *hide?, 0 + 617 } + 618 + 619 # validate data on screen regardless of attributes (color, bold, etc.) + 620 # Mu doesn't have multi-line strings, so we provide functions for rows or portions of rows. + 621 # Tab characters (that translate into multiple screen cells) not supported. + 622 + 623 fn check-screen-row screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { + 624 check-screen-row-from screen, row-idx, 1, expected, msg + 625 } + 626 + 627 fn check-screen-row-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { + 628 var screen/esi: (addr screen) <- copy screen-on-stack + 629 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx + 630 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme + 631 var e: (stream byte 0x100) + 632 var e-addr/edx: (addr stream byte) <- address e + 633 write e-addr, expected + 634 { + 635 var done?/eax: boolean <- stream-empty? e-addr + 636 compare done?, 0 + 637 break-if-!= + 638 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx + 639 var g/ebx: grapheme <- copy _g + 640 var expected-grapheme/eax: grapheme <- read-grapheme e-addr + 641 # compare graphemes + 642 $check-screen-row-from:compare-graphemes: { + 643 # if expected-grapheme is space, null grapheme is also ok + 644 { + 645 compare expected-grapheme, 0x20 + 646 break-if-!= + 647 compare g, 0 + 648 break-if-= $check-screen-row-from:compare-graphemes + 649 } + 650 # if (g == expected-grapheme) print "." + 651 compare g, expected-grapheme + 652 { + 653 break-if-!= + 654 print-string-to-real-screen "." + 655 break $check-screen-row-from:compare-graphemes + 656 } + 657 # otherwise print an error + 658 print-string-to-real-screen msg + 659 print-string-to-real-screen ": expected '" + 660 print-grapheme-to-real-screen expected-grapheme + 661 print-string-to-real-screen "' at (" + 662 print-int32-hex-to-real-screen row-idx + 663 print-string-to-real-screen ", " + 664 print-int32-hex-to-real-screen col-idx + 665 print-string-to-real-screen ") but observed '" + 666 print-grapheme-to-real-screen g + 667 print-string-to-real-screen "'\n" + 668 } + 669 idx <- increment + 670 increment col-idx + 671 loop + 672 } + 673 } + 674 + 675 # various variants by screen-cell attribute; spaces in the 'expected' data should not match the attribute + 676 + 677 fn check-screen-row-in-color screen: (addr screen), fg: int, row-idx: int, expected: (addr array byte), msg: (addr array byte) { + 678 check-screen-row-in-color-from screen, fg, row-idx, 1, expected, msg + 679 } + 680 + 681 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) { + 682 var screen/esi: (addr screen) <- copy screen-on-stack + 683 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx + 684 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme + 685 var e: (stream byte 0x100) + 686 var e-addr/edx: (addr stream byte) <- address e + 687 write e-addr, expected + 688 { + 689 var done?/eax: boolean <- stream-empty? e-addr + 690 compare done?, 0 + 691 break-if-!= + 692 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx + 693 var g/ebx: grapheme <- copy _g + 694 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr + 695 var expected-grapheme/edi: grapheme <- copy _expected-grapheme + 696 $check-screen-row-in-color-from:compare-cells: { + 697 # if expected-grapheme is space, null grapheme is also ok + 698 { + 699 compare expected-grapheme, 0x20 + 700 break-if-!= + 701 compare g, 0 + 702 break-if-= $check-screen-row-in-color-from:compare-cells + 703 } + 704 # if expected-grapheme is space, a different color is ok + 705 { + 706 compare expected-grapheme, 0x20 + 707 break-if-!= + 708 var color/eax: int <- screen-color-at-idx screen, idx + 709 compare color, fg + 710 break-if-!= $check-screen-row-in-color-from:compare-cells + 711 } + 712 # compare graphemes + 713 $check-screen-row-in-color-from:compare-graphemes: { + 714 # if (g == expected-grapheme) print "." + 715 compare g, expected-grapheme + 716 { + 717 break-if-!= + 718 print-string-to-real-screen "." + 719 break $check-screen-row-in-color-from:compare-graphemes + 720 } + 721 # otherwise print an error + 722 print-string-to-real-screen msg + 723 print-string-to-real-screen ": expected '" + 724 print-grapheme-to-real-screen expected-grapheme + 725 print-string-to-real-screen "' at (" + 726 print-int32-hex-to-real-screen row-idx + 727 print-string-to-real-screen ", " + 728 print-int32-hex-to-real-screen col-idx + 729 print-string-to-real-screen ") but observed '" + 730 print-grapheme-to-real-screen g + 731 print-string-to-real-screen "'\n" + 732 } + 733 $check-screen-row-in-color-from:compare-colors: { + 734 var color/eax: int <- screen-color-at-idx screen, idx + 735 compare fg, color + 736 { + 737 break-if-!= + 738 print-string-to-real-screen "." + 739 break $check-screen-row-in-color-from:compare-colors + 740 } + 741 # otherwise print an error + 742 print-string-to-real-screen msg + 743 print-string-to-real-screen ": expected '" + 744 print-grapheme-to-real-screen expected-grapheme + 745 print-string-to-real-screen "' at (" + 746 print-int32-hex-to-real-screen row-idx + 747 print-string-to-real-screen ", " + 748 print-int32-hex-to-real-screen col-idx + 749 print-string-to-real-screen ") in color " + 750 print-int32-hex-to-real-screen fg + 751 print-string-to-real-screen " but observed color " + 752 print-int32-hex-to-real-screen color + 753 print-string-to-real-screen "\n" + 754 } + 755 } + 756 idx <- increment + 757 increment col-idx + 758 loop + 759 } + 760 } + 761 + 762 # background color is visible even for spaces, so 'expected' behaves as an array of booleans. + 763 # non-space = given background must match; space = background must not match + 764 fn check-screen-row-in-background-color screen: (addr screen), bg: int, row-idx: int, expected: (addr array byte), msg: (addr array byte) { + 765 check-screen-row-in-background-color-from screen, bg, row-idx, 1, expected, msg + 766 } + 767 + 768 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) { + 769 var screen/esi: (addr screen) <- copy screen-on-stack + 770 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx + 771 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme + 772 var e: (stream byte 0x100) + 773 var e-addr/edx: (addr stream byte) <- address e + 774 write e-addr, expected + 775 { + 776 var done?/eax: boolean <- stream-empty? e-addr + 777 compare done?, 0 + 778 break-if-!= + 779 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx + 780 var g/ebx: grapheme <- copy _g + 781 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr + 782 var expected-grapheme/edx: grapheme <- copy _expected-grapheme + 783 $check-screen-row-in-background-color-from:compare-cells: { + 784 # if expected-grapheme is space, null grapheme is also ok + 785 { + 786 compare expected-grapheme, 0x20 + 787 break-if-!= + 788 compare g, 0 + 789 break-if-= $check-screen-row-in-background-color-from:compare-cells + 790 } + 791 # if expected-grapheme is space, a different color is ok + 792 { + 793 compare expected-grapheme, 0x20 + 794 break-if-!= + 795 var color/eax: int <- screen-background-color-at-idx screen, idx + 796 compare color, bg + 797 break-if-!= $check-screen-row-in-background-color-from:compare-cells + 798 } + 799 # compare graphemes + 800 $check-screen-row-in-background-color-from:compare-graphemes: { + 801 # if (g == expected-grapheme) print "." + 802 compare g, expected-grapheme + 803 { + 804 break-if-!= + 805 print-string-to-real-screen "." + 806 break $check-screen-row-in-background-color-from:compare-graphemes + 807 } + 808 # otherwise print an error + 809 print-string-to-real-screen msg + 810 print-string-to-real-screen ": expected '" + 811 print-grapheme-to-real-screen expected-grapheme + 812 print-string-to-real-screen "' at (" + 813 print-int32-hex-to-real-screen row-idx + 814 print-string-to-real-screen ", " + 815 print-int32-hex-to-real-screen col-idx + 816 print-string-to-real-screen ") but observed '" + 817 print-grapheme-to-real-screen g + 818 print-string-to-real-screen "'\n" + 819 } + 820 $check-screen-row-in-background-color-from:compare-colors: { + 821 var color/eax: int <- screen-background-color-at-idx screen, idx + 822 compare bg, color + 823 { + 824 break-if-!= + 825 print-string-to-real-screen "." + 826 break $check-screen-row-in-background-color-from:compare-colors + 827 } + 828 # otherwise print an error + 829 print-string-to-real-screen msg + 830 print-string-to-real-screen ": expected '" + 831 print-grapheme-to-real-screen expected-grapheme + 832 print-string-to-real-screen "' at (" + 833 print-int32-hex-to-real-screen row-idx + 834 print-string-to-real-screen ", " + 835 print-int32-hex-to-real-screen col-idx + 836 print-string-to-real-screen ") in background color " + 837 print-int32-hex-to-real-screen bg + 838 print-string-to-real-screen " but observed color " + 839 print-int32-hex-to-real-screen color + 840 print-string-to-real-screen "\n" + 841 } + 842 } + 843 idx <- increment + 844 increment col-idx + 845 loop + 846 } + 847 } + 848 + 849 fn check-screen-row-in-bold screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { + 850 check-screen-row-in-bold-from screen, row-idx, 1, expected, msg + 851 } + 852 + 853 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) { + 854 var screen/esi: (addr screen) <- copy screen-on-stack + 855 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx + 856 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme + 857 var e: (stream byte 0x100) + 858 var e-addr/edx: (addr stream byte) <- address e + 859 write e-addr, expected + 860 { + 861 var done?/eax: boolean <- stream-empty? e-addr + 862 compare done?, 0 + 863 break-if-!= + 864 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx + 865 var g/ebx: grapheme <- copy _g + 866 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr + 867 var expected-grapheme/edx: grapheme <- copy _expected-grapheme + 868 $check-screen-row-in-bold-from:compare-cells: { + 869 # if expected-grapheme is space, null grapheme is also ok + 870 { + 871 compare expected-grapheme, 0x20 + 872 break-if-!= + 873 compare g, 0 + 874 break-if-= $check-screen-row-in-bold-from:compare-cells + 875 } + 876 # if expected-grapheme is space, non-bold is ok + 877 { + 878 compare expected-grapheme, 0x20 + 879 break-if-!= + 880 var bold?/eax: boolean <- screen-bold-at-idx? screen, idx + 881 compare bold?, 1 + 882 break-if-!= $check-screen-row-in-bold-from:compare-cells + 883 } + 884 # compare graphemes + 885 $check-screen-row-in-bold-from:compare-graphemes: { + 886 # if (g == expected-grapheme) print "." + 887 compare g, expected-grapheme + 888 { + 889 break-if-!= + 890 print-string-to-real-screen "." + 891 break $check-screen-row-in-bold-from:compare-graphemes + 892 } + 893 # otherwise print an error + 894 print-string-to-real-screen msg + 895 print-string-to-real-screen ": expected '" + 896 print-grapheme-to-real-screen expected-grapheme + 897 print-string-to-real-screen "' at (" + 898 print-int32-hex-to-real-screen row-idx + 899 print-string-to-real-screen ", " + 900 print-int32-hex-to-real-screen col-idx + 901 print-string-to-real-screen ") but observed '" + 902 print-grapheme-to-real-screen g + 903 print-string-to-real-screen "'\n" + 904 } + 905 $check-screen-row-in-bold-from:compare-bold: { + 906 var bold?/eax: boolean <- screen-bold-at-idx? screen, idx + 907 compare bold?, 1 + 908 { + 909 break-if-!= + 910 print-string-to-real-screen "." + 911 break $check-screen-row-in-bold-from:compare-bold + 912 } + 913 # otherwise print an error + 914 print-string-to-real-screen msg + 915 print-string-to-real-screen ": expected '" + 916 print-grapheme-to-real-screen expected-grapheme + 917 print-string-to-real-screen "' at (" + 918 print-int32-hex-to-real-screen row-idx + 919 print-string-to-real-screen ", " + 920 print-int32-hex-to-real-screen col-idx + 921 print-string-to-real-screen ") to be in bold\n" + 922 } + 923 } + 924 idx <- increment + 925 increment col-idx + 926 loop + 927 } + 928 } + 929 + 930 fn check-screen-row-in-underline screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { + 931 check-screen-row-in-underline-from screen, row-idx, 1, expected, msg + 932 } + 933 + 934 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) { + 935 var screen/esi: (addr screen) <- copy screen-on-stack + 936 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx + 937 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme + 938 var e: (stream byte 0x100) + 939 var e-addr/edx: (addr stream byte) <- address e + 940 write e-addr, expected + 941 { + 942 var done?/eax: boolean <- stream-empty? e-addr + 943 compare done?, 0 + 944 break-if-!= + 945 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx + 946 var g/ebx: grapheme <- copy _g + 947 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr + 948 var expected-grapheme/edx: grapheme <- copy _expected-grapheme + 949 $check-screen-row-in-underline-from:compare-cells: { + 950 # if expected-grapheme is space, null grapheme is also ok + 951 { + 952 compare expected-grapheme, 0x20 + 953 break-if-!= + 954 compare g, 0 + 955 break-if-= $check-screen-row-in-underline-from:compare-cells + 956 } + 957 # if expected-grapheme is space, non-underline is ok + 958 { + 959 compare expected-grapheme, 0x20 + 960 break-if-!= + 961 var underline?/eax: boolean <- screen-underline-at-idx? screen, idx + 962 compare underline?, 1 + 963 break-if-!= $check-screen-row-in-underline-from:compare-cells + 964 } + 965 # compare graphemes + 966 $check-screen-row-in-underline-from:compare-graphemes: { + 967 # if (g == expected-grapheme) print "." + 968 compare g, expected-grapheme + 969 { + 970 break-if-!= + 971 print-string-to-real-screen "." + 972 break $check-screen-row-in-underline-from:compare-graphemes + 973 } + 974 # otherwise print an error + 975 print-string-to-real-screen msg + 976 print-string-to-real-screen ": expected '" + 977 print-grapheme-to-real-screen expected-grapheme + 978 print-string-to-real-screen "' at (" + 979 print-int32-hex-to-real-screen row-idx + 980 print-string-to-real-screen ", " + 981 print-int32-hex-to-real-screen col-idx + 982 print-string-to-real-screen ") but observed '" + 983 print-grapheme-to-real-screen g + 984 print-string-to-real-screen "'\n" + 985 } + 986 $check-screen-row-in-underline-from:compare-underline: { + 987 var underline?/eax: boolean <- screen-underline-at-idx? screen, idx + 988 compare underline?, 1 + 989 { + 990 break-if-!= + 991 print-string-to-real-screen "." + 992 break $check-screen-row-in-underline-from:compare-underline + 993 } + 994 # otherwise print an error + 995 print-string-to-real-screen msg + 996 print-string-to-real-screen ": expected '" + 997 print-grapheme-to-real-screen expected-grapheme + 998 print-string-to-real-screen "' at (" + 999 print-int32-hex-to-real-screen row-idx +1000 print-string-to-real-screen ", " +1001 print-int32-hex-to-real-screen col-idx +1002 print-string-to-real-screen ") to be underlined\n" +1003 } +1004 } +1005 idx <- increment +1006 increment col-idx +1007 loop +1008 } +1009 } +1010 +1011 fn check-screen-row-in-reverse screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { +1012 check-screen-row-in-reverse-from screen, row-idx, 1, expected, msg +1013 } +1014 +1015 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) { +1016 var screen/esi: (addr screen) <- copy screen-on-stack +1017 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx +1018 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme +1019 var e: (stream byte 0x100) +1020 var e-addr/edx: (addr stream byte) <- address e +1021 write e-addr, expected +1022 { +1023 var done?/eax: boolean <- stream-empty? e-addr +1024 compare done?, 0 +1025 break-if-!= +1026 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx +1027 var g/ebx: grapheme <- copy _g +1028 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr +1029 var expected-grapheme/edx: grapheme <- copy _expected-grapheme +1030 $check-screen-row-in-reverse-from:compare-cells: { +1031 # if expected-grapheme is space, null grapheme is also ok +1032 { +1033 compare expected-grapheme, 0x20 +1034 break-if-!= +1035 compare g, 0 +1036 break-if-= $check-screen-row-in-reverse-from:compare-cells +1037 } +1038 # if expected-grapheme is space, non-reverse is ok +1039 { +1040 compare expected-grapheme, 0x20 +1041 break-if-!= +1042 var reverse?/eax: boolean <- screen-reverse-at-idx? screen, idx +1043 compare reverse?, 1 +1044 break-if-!= $check-screen-row-in-reverse-from:compare-cells +1045 } +1046 # compare graphemes +1047 $check-screen-row-in-reverse-from:compare-graphemes: { +1048 # if (g == expected-grapheme) print "." +1049 compare g, expected-grapheme +1050 { +1051 break-if-!= +1052 print-string-to-real-screen "." +1053 break $check-screen-row-in-reverse-from:compare-graphemes +1054 } +1055 # otherwise print an error +1056 print-string-to-real-screen msg +1057 print-string-to-real-screen ": expected '" +1058 print-grapheme-to-real-screen expected-grapheme +1059 print-string-to-real-screen "' at (" +1060 print-int32-hex-to-real-screen row-idx +1061 print-string-to-real-screen ", " +1062 print-int32-hex-to-real-screen col-idx +1063 print-string-to-real-screen ") but observed '" +1064 print-grapheme-to-real-screen g +1065 print-string-to-real-screen "'\n" +1066 } +1067 $check-screen-row-in-reverse-from:compare-reverse: { +1068 var reverse?/eax: boolean <- screen-reverse-at-idx? screen, idx +1069 compare reverse?, 1 +1070 { +1071 break-if-!= +1072 print-string-to-real-screen "." +1073 break $check-screen-row-in-reverse-from:compare-reverse +1074 } +1075 # otherwise print an error +1076 print-string-to-real-screen msg +1077 print-string-to-real-screen ": expected '" +1078 print-grapheme-to-real-screen expected-grapheme +1079 print-string-to-real-screen "' at (" +1080 print-int32-hex-to-real-screen row-idx +1081 print-string-to-real-screen ", " +1082 print-int32-hex-to-real-screen col-idx +1083 print-string-to-real-screen ") to be in reverse-video\n" +1084 } +1085 } +1086 idx <- increment +1087 increment col-idx +1088 loop +1089 } +1090 } +1091 +1092 fn check-screen-row-in-blinking screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { +1093 check-screen-row-in-blinking-from screen, row-idx, 1, expected, msg +1094 } +1095 +1096 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) { +1097 var screen/esi: (addr screen) <- copy screen-on-stack +1098 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx +1099 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme +1100 var e: (stream byte 0x100) +1101 var e-addr/edx: (addr stream byte) <- address e +1102 write e-addr, expected +1103 { +1104 var done?/eax: boolean <- stream-empty? e-addr +1105 compare done?, 0 +1106 break-if-!= +1107 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx +1108 var g/ebx: grapheme <- copy _g +1109 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr +1110 var expected-grapheme/edx: grapheme <- copy _expected-grapheme +1111 $check-screen-row-in-blinking-from:compare-cells: { +1112 # if expected-grapheme is space, null grapheme is also ok +1113 { +1114 compare expected-grapheme, 0x20 +1115 break-if-!= +1116 compare g, 0 +1117 break-if-= $check-screen-row-in-blinking-from:compare-cells +1118 } +1119 # if expected-grapheme is space, non-blinking is ok +1120 { +1121 compare expected-grapheme, 0x20 +1122 break-if-!= +1123 var blinking?/eax: boolean <- screen-blink-at-idx? screen, idx +1124 compare blinking?, 1 +1125 break-if-!= $check-screen-row-in-blinking-from:compare-cells +1126 } +1127 # compare graphemes +1128 $check-screen-row-in-blinking-from:compare-graphemes: { +1129 # if (g == expected-grapheme) print "." +1130 compare g, expected-grapheme +1131 { +1132 break-if-!= +1133 print-string-to-real-screen "." +1134 break $check-screen-row-in-blinking-from:compare-graphemes +1135 } +1136 # otherwise print an error +1137 print-string-to-real-screen msg +1138 print-string-to-real-screen ": expected '" +1139 print-grapheme-to-real-screen expected-grapheme +1140 print-string-to-real-screen "' at (" +1141 print-int32-hex-to-real-screen row-idx +1142 print-string-to-real-screen ", " +1143 print-int32-hex-to-real-screen col-idx +1144 print-string-to-real-screen ") but observed '" +1145 print-grapheme-to-real-screen g +1146 print-string-to-real-screen "'\n" +1147 } +1148 $check-screen-row-in-blinking-from:compare-blinking: { +1149 var blinking?/eax: boolean <- screen-blink-at-idx? screen, idx +1150 compare blinking?, 1 +1151 { +1152 break-if-!= +1153 print-string-to-real-screen "." +1154 break $check-screen-row-in-blinking-from:compare-blinking +1155 } +1156 # otherwise print an error +1157 print-string-to-real-screen msg +1158 print-string-to-real-screen ": expected '" +1159 print-grapheme-to-real-screen expected-grapheme +1160 print-string-to-real-screen "' at (" +1161 print-int32-hex-to-real-screen row-idx +1162 print-string-to-real-screen ", " +1163 print-int32-hex-to-real-screen col-idx +1164 print-string-to-real-screen ") to be blinking\n" +1165 } +1166 } +1167 idx <- increment +1168 increment col-idx +1169 +1170 loop +1171 } +1172 } +1173 +1174 fn test-print-single-grapheme { +1175 var screen-on-stack: screen +1176 var screen/esi: (addr screen) <- address screen-on-stack +1177 initialize-screen screen, 5, 4 +1178 var c/eax: grapheme <- copy 0x61 # 'a' +1179 print-grapheme screen, c +1180 check-screen-row screen, 1, "a", "F - test-print-single-grapheme" # top-left corner of the screen +1181 } +1182 +1183 fn test-print-multiple-graphemes { +1184 var screen-on-stack: screen +1185 var screen/esi: (addr screen) <- address screen-on-stack +1186 initialize-screen screen, 5, 4 +1187 print-string screen, "Hello, 世界" +1188 check-screen-row screen, 1, "Hello, 世界", "F - test-print-multiple-graphemes" +1189 } +1190 +1191 fn test-move-cursor { +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, 1, 4 +1196 var c/eax: grapheme <- copy 0x61 # 'a' +1197 print-grapheme screen, c +1198 check-screen-row screen, 1, " a", "F - test-move-cursor" # top row +1199 } +1200 +1201 fn test-move-cursor-zeroes { +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, 0 +1206 var c/eax: grapheme <- copy 0x61 # 'a' +1207 print-grapheme screen, c +1208 check-screen-row screen, 1, "a", "F - test-move-cursor-zeroes" # top-left corner of the screen +1209 } +1210 +1211 fn test-move-cursor-zero-row { +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, 0, 2 +1216 var c/eax: grapheme <- copy 0x61 # 'a' +1217 print-grapheme screen, c +1218 check-screen-row screen, 1, " a", "F - test-move-cursor-zero-row" # top row +1219 } +1220 +1221 fn test-move-cursor-zero-column { +1222 var screen-on-stack: screen +1223 var screen/esi: (addr screen) <- address screen-on-stack +1224 initialize-screen screen, 5, 4 +1225 move-cursor screen, 4, 0 +1226 var c/eax: grapheme <- copy 0x61 # 'a' +1227 print-grapheme screen, c +1228 check-screen-row screen, 4, "a", "F - test-move-cursor-zero-column" 1229 } 1230 -1231 fn test-move-cursor-negative-column { +1231 fn test-move-cursor-negative-row { 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 +1235 move-cursor screen, -1, 2 # row -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" +1239 check-screen-row screen, 1, "a", "F - test-move-cursor-negative-row" 1240 } 1241 -1242 fn test-move-cursor-column-too-large { +1242 fn test-move-cursor-negative-column { 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) +1245 initialize-screen screen, 5, 3 +1246 move-cursor screen, 2, -1 # column -1 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" +1249 # no move +1250 check-screen-row screen, 1, "a", "F - test-move-cursor-negative-column" +1251 } +1252 +1253 fn test-move-cursor-column-too-large { +1254 var screen-on-stack: screen +1255 var screen/esi: (addr screen) <- address screen-on-stack +1256 initialize-screen screen, 5, 3 # 5 rows, 3 columns +1257 move-cursor screen, 1, 4 # row 1, column 4 (overflow) +1258 var c/eax: grapheme <- copy 0x61 # 'a' +1259 print-grapheme screen, c +1260 # top row is empty +1261 check-screen-row screen, 1, " ", "F - test-move-cursor-column-too-large" +1262 # character shows up on next row +1263 check-screen-row screen, 2, "a", "F - test-move-cursor-column-too-large" +1264 } +1265 +1266 fn test-move-cursor-column-too-large-saturates { +1267 var screen-on-stack: screen +1268 var screen/esi: (addr screen) <- address screen-on-stack +1269 initialize-screen screen, 5, 3 # 5 rows, 3 columns +1270 move-cursor screen, 1, 6 # row 1, column 6 (overflow) +1271 var c/eax: grapheme <- copy 0x61 # 'a' +1272 print-grapheme screen, c +1273 # top row is empty +1274 check-screen-row screen, 1, " ", "F - test-move-cursor-column-too-large-saturates" # top-left corner of the screen +1275 # character shows up at the start of next row +1276 check-screen-row screen, 2, "a", "F - test-move-cursor-column-too-large-saturates" # top-left corner of the screen 1277 } 1278 -1279 fn test-move-cursor-row-too-large-saturates { +1279 fn test-move-cursor-row-too-large { 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) +1283 move-cursor screen, 6, 2 # row 6 (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" +1287 check-screen-row screen, 5, " a", "F - test-move-cursor-row-too-large" 1288 } 1289 -1290 fn test-check-screen-row-from { +1290 fn test-move-cursor-row-too-large-saturates { 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 +1293 initialize-screen screen, 5, 3 # 5 rows +1294 move-cursor screen, 9, 2 # row 9 (overflow) 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" +1297 # bottom row shows the character +1298 check-screen-row screen, 5, " a", "F - test-move-cursor-row-too-large-saturates" 1299 } 1300 -1301 fn test-print-string-overflows-to-next-row { +1301 fn test-check-screen-row-from { 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 #? } +1304 initialize-screen screen, 5, 4 +1305 move-cursor screen, 1, 4 +1306 var c/eax: grapheme <- copy 0x61 # 'a' +1307 print-grapheme screen, c +1308 check-screen-row screen, 1, " a", "F - test-check-screen-row-from/baseline" +1309 check-screen-row-from screen, 1, 4, "a", "F - test-check-screen-row-from" +1310 } +1311 +1312 fn test-print-string-overflows-to-next-row { +1313 var screen-on-stack: screen +1314 var screen/esi: (addr screen) <- address screen-on-stack +1315 initialize-screen screen, 5, 4 # 5 rows, 4 columns +1316 print-string screen, "abcdefg" +1317 check-screen-row screen, 1, "abcd", "F - test-print-string-overflows-to-next-row" +1318 check-screen-row screen, 2, "efg", "F - test-print-string-overflows-to-next-row" +1319 } +1320 +1321 fn test-check-screen-scrolls-on-overflow { +1322 var screen-on-stack: screen +1323 var screen/esi: (addr screen) <- address screen-on-stack +1324 initialize-screen screen, 5, 4 +1325 # single character starting at bottom right +1326 move-cursor screen, 5, 4 +1327 var c/eax: grapheme <- copy 0x61 # 'a' +1328 print-grapheme screen, c +1329 check-screen-row-from screen, 5, 4, "a", "F - test-check-screen-scrolls-on-overflow/baseline" # bottom-right corner of the screen +1330 # multiple characters starting at bottom right +1331 move-cursor screen, 5, 4 +1332 print-string screen, "ab" +1333 # screen scrolled up one row +1334 #? check-screen-row screen, 1, " ", "F - test-check-screen-scrolls-on-overflow/x1" +1335 #? check-screen-row screen, 2, " ", "F - test-check-screen-scrolls-on-overflow/x2" +1336 #? check-screen-row screen, 3, " ", "F - test-check-screen-scrolls-on-overflow/x3" +1337 #? check-screen-row screen, 4, " a", "F - test-check-screen-scrolls-on-overflow/x4" +1338 #? check-screen-row screen, 5, "b ", "F - test-check-screen-scrolls-on-overflow/x5" +1339 check-screen-row-from screen, 4, 4, "a", "F - test-check-screen-scrolls-on-overflow/1" +1340 check-screen-row-from screen, 5, 1, "b", "F - test-check-screen-scrolls-on-overflow/2" +1341 } +1342 +1343 fn test-check-screen-color { +1344 var screen-on-stack: screen +1345 var screen/esi: (addr screen) <- address screen-on-stack +1346 initialize-screen screen, 5, 4 +1347 var c/eax: grapheme <- copy 0x61 # 'a' +1348 print-grapheme screen, c +1349 start-color screen, 1, 0 # foreground=1 +1350 c <- copy 0x62 # 'b' +1351 print-grapheme screen, c +1352 start-color screen, 0, 0 # back to default +1353 c <- copy 0x63 # 'c' +1354 print-grapheme screen, c +1355 check-screen-row-in-color screen, 0, 1, "a c", "F - test-check-screen-color" +1356 } +1357 +1358 fn test-check-screen-background-color { +1359 var screen-on-stack: screen +1360 var screen/esi: (addr screen) <- address screen-on-stack +1361 initialize-screen screen, 5, 4 +1362 var c/eax: grapheme <- copy 0x61 # 'a' +1363 print-grapheme screen, c +1364 start-color screen, 0, 1 # background=1 +1365 c <- copy 0x62 # 'b' +1366 print-grapheme screen, c +1367 start-color screen, 0, 7 # back to default +1368 c <- copy 0x63 # 'c' +1369 print-grapheme screen, c +1370 check-screen-row-in-background-color screen, 7, 1, "a c", "F - test-check-screen-background-color" +1371 } +1372 +1373 fn test-check-screen-bold { +1374 var screen-on-stack: screen +1375 var screen/esi: (addr screen) <- address screen-on-stack +1376 initialize-screen screen, 5, 4 +1377 start-bold screen +1378 var c/eax: grapheme <- copy 0x61 # 'a' +1379 print-grapheme screen, c +1380 reset-formatting screen +1381 c <- copy 0x62 # 'b' +1382 print-grapheme screen, c +1383 start-bold screen +1384 c <- copy 0x63 # 'c' +1385 print-grapheme screen, c +1386 check-screen-row-in-bold screen, 1, "a c", "F - test-check-screen-bold" +1387 } +1388 +1389 fn test-check-screen-underline { +1390 var screen-on-stack: screen +1391 var screen/esi: (addr screen) <- address screen-on-stack +1392 initialize-screen screen, 5, 4 +1393 start-underline screen +1394 var c/eax: grapheme <- copy 0x61 # 'a' +1395 print-grapheme screen, c +1396 reset-formatting screen +1397 c <- copy 0x62 # 'b' +1398 print-grapheme screen, c +1399 start-underline screen +1400 c <- copy 0x63 # 'c' +1401 print-grapheme screen, c +1402 check-screen-row-in-underline screen, 1, "a c", "F - test-check-screen-underline" +1403 } +1404 +1405 fn test-check-screen-reverse { +1406 var screen-on-stack: screen +1407 var screen/esi: (addr screen) <- address screen-on-stack +1408 initialize-screen screen, 5, 4 +1409 start-reverse-video screen +1410 var c/eax: grapheme <- copy 0x61 # 'a' +1411 print-grapheme screen, c +1412 reset-formatting screen +1413 c <- copy 0x62 # 'b' +1414 print-grapheme screen, c +1415 start-reverse-video screen +1416 c <- copy 0x63 # 'c' +1417 print-grapheme screen, c +1418 check-screen-row-in-reverse screen, 1, "a c", "F - test-check-screen-reverse" +1419 } +1420 +1421 fn test-check-screen-blinking { +1422 var screen-on-stack: screen +1423 var screen/esi: (addr screen) <- address screen-on-stack +1424 initialize-screen screen, 5, 4 +1425 start-blinking screen +1426 var c/eax: grapheme <- copy 0x61 # 'a' +1427 print-grapheme screen, c +1428 reset-formatting screen +1429 c <- copy 0x62 # 'b' +1430 print-grapheme screen, c +1431 start-blinking screen +1432 c <- copy 0x63 # 'c' +1433 print-grapheme screen, c +1434 check-screen-row-in-blinking screen, 1, "a c", "F - test-check-screen-blinking" +1435 } +1436 +1437 #? fn main -> _/ebx: int { +1438 #? #? test-check-screen-color +1439 #? run-tests +1440 #? return 0 +1441 #? } diff --git a/html/406int32.mu.html b/html/406int32.mu.html new file mode 100644 index 00000000..c6571c98 --- /dev/null +++ b/html/406int32.mu.html @@ -0,0 +1,101 @@ + + + + +Mu - 406int32.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/406int32.mu +
+ 1 # Some slow but convenient helpers
+ 2 
+ 3 # slow, iterative shift-left instruction
+ 4 # preconditions: _nr >= 0, _dr > 0
+ 5 fn repeated-shift-left nr: int, dr: int -> _/eax: int {
+ 6   var result/eax: int <- copy nr
+ 7   {
+ 8     compare dr, 0
+ 9     break-if-<=
+10     result <- shift-left 1
+11     decrement dr
+12     loop
+13   }
+14   return result
+15 }
+16 
+17 # slow, iterative shift-right instruction
+18 # preconditions: _nr >= 0, _dr > 0
+19 fn repeated-shift-right nr: int, dr: int -> _/eax: int {
+20   var result/eax: int <- copy nr
+21   {
+22     compare dr, 0
+23     break-if-<=
+24     result <- shift-right 1
+25     decrement dr
+26     loop
+27   }
+28   return result
+29 }
+30 
+31 fn abs n: int -> _/eax: int {
+32   var result/eax: int <- copy n
+33   {
+34     compare n, 0
+35     break-if->=
+36     result <- negate
+37   }
+38   return result
+39 }
+
+ + + diff --git a/html/406try-divide.mu.html b/html/406try-divide.mu.html deleted file mode 100644 index ea3d1eb9..00000000 --- a/html/406try-divide.mu.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - -Mu - 406try-divide.mu - - - - - - - - - - -https://github.com/akkartik/mu/blob/master/406try-divide.mu -
-  1 # slow, iterative divide instruction
-  2 # preconditions: _nr >= 0, _dr > 0
-  3 fn try-divide _nr: int, _dr: int -> _/eax: int {
-  4   # x = next power-of-2 multiple of _dr after _nr
-  5   var x/ecx: int <- copy 1
-  6   {
-  7 #?     print-int32-hex 0, x
-  8 #?     print-string 0, "\n"
-  9     var tmp/edx: int <- copy _dr
- 10     tmp <- multiply x
- 11     compare tmp, _nr
- 12     break-if->
- 13     x <- shift-left 1
- 14     loop
- 15   }
- 16 #?   print-string 0, "--\n"
- 17   # min, max = x/2, x
- 18   var max/ecx: int <- copy x
- 19   var min/edx: int <- copy max
- 20   min <- shift-right 1
- 21   # narrow down result between min and max
- 22   var i/eax: int <- copy min
- 23   {
- 24 #?     print-int32-hex 0, i
- 25 #?     print-string 0, "\n"
- 26     var foo/ebx: int <- copy _dr
- 27     foo <- multiply i
- 28     compare foo, _nr
- 29     break-if->
- 30     i <- increment
- 31     loop
- 32   }
- 33   var result/eax: int <- copy i
- 34   result <- decrement
- 35 #?   print-string 0, "=> "
- 36 #?   print-int32-hex 0, result
- 37 #?   print-string 0, "\n"
- 38   return result
- 39 }
- 40 
- 41 fn test-try-divide-1 {
- 42   var result/eax: int <- try-divide 0, 2
- 43   check-ints-equal result, 0, "F - try-divide-1"
- 44 }
- 45 
- 46 fn test-try-divide-2 {
- 47   var result/eax: int <- try-divide 1, 2
- 48   check-ints-equal result, 0, "F - try-divide-2"
- 49 }
- 50 
- 51 fn test-try-divide-3 {
- 52   var result/eax: int <- try-divide 2, 2
- 53   check-ints-equal result, 1, "F - try-divide-3"
- 54 }
- 55 
- 56 fn test-try-divide-4 {
- 57   var result/eax: int <- try-divide 4, 2
- 58   check-ints-equal result, 2, "F - try-divide-4"
- 59 }
- 60 
- 61 fn test-try-divide-5 {
- 62   var result/eax: int <- try-divide 6, 2
- 63   check-ints-equal result, 3, "F - try-divide-5"
- 64 }
- 65 
- 66 fn test-try-divide-6 {
- 67   var result/eax: int <- try-divide 9, 3
- 68   check-ints-equal result, 3, "F - try-divide-6"
- 69 }
- 70 
- 71 fn test-try-divide-7 {
- 72   var result/eax: int <- try-divide 0xc, 4
- 73   check-ints-equal result, 3, "F - try-divide-7"
- 74 }
- 75 
- 76 fn test-try-divide-8 {
- 77   var result/eax: int <- try-divide 0x1b, 3  # 27/3
- 78   check-ints-equal result, 9, "F - try-divide-8"
- 79 }
- 80 
- 81 fn test-try-divide-9 {
- 82   var result/eax: int <- try-divide 0x1c, 3  # 28/3
- 83   check-ints-equal result, 9, "F - try-divide-9"
- 84 }
- 85 
- 86 # only positive dr for now
- 87 fn try-modulo nr: int, dr: int -> _/eax: int {
- 88   var _positive-nr/eax: int <- abs nr
- 89   var positive-nr/ecx: int <- copy _positive-nr
- 90   var result/eax: int <- try-divide positive-nr, dr
- 91   result <- multiply dr
- 92   result <- subtract positive-nr
- 93   result <- negate
- 94   return result
- 95 }
- 96 
- 97 fn test-try-modulo-negative-nr {
- 98   var result/eax: int <- try-modulo -0xa, 7
- 99   check-ints-equal result, 3, "F - test-try-modulo-negative-nr"
-100 }
-101 
-102 fn abs n: int -> _/eax: int {
-103   var result/eax: int <- copy n
-104   {
-105     compare n, 0
-106     break-if->=
-107     result <- negate
-108   }
-109   return result
-110 }
-
- - - diff --git a/html/409float.mu.html b/html/408float.mu.html similarity index 74% rename from html/409float.mu.html rename to html/408float.mu.html index 7f7ab3c6..8b16fd5a 100644 --- a/html/409float.mu.html +++ b/html/408float.mu.html @@ -2,7 +2,7 @@ -Mu - 409float.mu +Mu - 408float.mu @@ -54,11 +54,11 @@ if ('onhashchange' in window) { -https://github.com/akkartik/mu/blob/master/409float.mu +https://github.com/akkartik/mu/blob/master/408float.mu
  1 # Some quick-n-dirty ways to create floats.
  2 
- 3 fn fill-in-rational _out: (addr float), nr: int, dr: int {
+ 3 fn fill-in-rational _out: (addr float), nr: int, dr: int {
  4   var out/edi: (addr float) <- copy _out
  5   var result/xmm0: float <- convert nr
  6   var divisor/xmm1: float <- convert dr
@@ -66,12 +66,19 @@ if ('onhashchange' in window) {
  8   copy-to *out, result
  9 }
 10 
-11 fn fill-in-sqrt _out: (addr float), n: int {
+11 fn fill-in-sqrt _out: (addr float), n: int {
 12   var out/edi: (addr float) <- copy _out
 13   var result/xmm0: float <- convert n
 14   result <- square-root result
 15   copy-to *out, result
 16 }
+17 
+18 fn rational nr: int, dr: int -> _/xmm0: float {
+19   var result/xmm0: float <- convert nr
+20   var divisor/xmm1: float <- convert dr
+21   result <- divide divisor
+22   return result
+23 }
 
diff --git a/html/408print-float.mu.html b/html/408print-float.mu.html deleted file mode 100644 index dc459b68..00000000 --- a/html/408print-float.mu.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - -Mu - 408print-float.mu - - - - - - - - - - -https://github.com/akkartik/mu/blob/master/408print-float.mu -
-  1 # quick-n-dirty way to print out floats in hex
-  2 
-  3 # examples:
-  4 #   0.5 = 0x3f000000 = 0011| 1111 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000
-  5 #                    = 0 | 01111110 | 00000000000000000000000
-  6 #                      +   exponent   mantissa
-  7 #                    = 0 | 00000000000000000000000 | 01111110
-  8 #                          mantissa                  exponent
-  9 #                    = 0 | 000000000000000000000000 | 01111110
- 10 #                          zero-pad mantissa          exponent
- 11 #                   =   +1.000000                   P -01
- 12 fn test-print-float-normal {
- 13   var screen-on-stack: screen
- 14   var screen/esi: (addr screen) <- address screen-on-stack
- 15   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
- 16   # print 0.5
- 17   var one/eax: int <- copy 1
- 18   var half/xmm0: float <- convert one
- 19   var two/eax: int <- copy 2
- 20   var two-f/xmm1: float <- convert two
- 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"
- 25 }
- 26 
- 27 fn test-print-float-zero {
- 28   var screen-on-stack: screen
- 29   var screen/esi: (addr screen) <- address screen-on-stack
- 30   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
- 31   # print 0
- 32   var zero: float
- 33   print-float screen, zero
- 34   #
- 35   check-screen-row screen, 1, "0 ", "F - test-print-float-zero"
- 36 }
- 37 
- 38 fn test-print-float-negative-zero {
- 39   var screen-on-stack: screen
- 40   var screen/esi: (addr screen) <- address screen-on-stack
- 41   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
- 42   # print 0
- 43   var n: int
- 44   copy-to n, 0x80000000
- 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"
- 49 }
- 50 
- 51 fn test-print-float-infinity {
- 52   var screen-on-stack: screen
- 53   var screen/esi: (addr screen) <- address screen-on-stack
- 54   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
- 55   # print
- 56   var n: int
- 57   #          0|11111111|00000000000000000000000
- 58   #          0111|1111|1000|0000|0000|0000|0000|0000
- 59   copy-to n, 0x7f800000
- 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"
- 64 }
- 65 
- 66 fn test-print-float-negative-infinity {
- 67   var screen-on-stack: screen
- 68   var screen/esi: (addr screen) <- address screen-on-stack
- 69   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
- 70   # print
- 71   var n: int
- 72   copy-to n, 0xff800000
- 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"
- 77 }
- 78 
- 79 fn test-print-float-not-a-number {
- 80   var screen-on-stack: screen
- 81   var screen/esi: (addr screen) <- address screen-on-stack
- 82   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
- 83   # print
- 84   var n: int
- 85   copy-to n, 0xffffffff  # exponent must be all 1's, and mantissa must be non-zero
- 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"
- 90 }
- 91 
- 92 fn print-float screen: (addr screen), n: float {
- 93 $print-float:body: {
- 94   # - special names
- 95   var bits/eax: int <- reinterpret n
- 96   compare bits, 0
- 97   {
- 98     break-if-!=
- 99     print-string screen, "0"
-100     break $print-float:body
-101   }
-102   compare bits, 0x80000000
-103   {
-104     break-if-!=
-105     print-string screen, "-0"
-106     break $print-float:body
-107   }
-108   compare bits, 0x7f800000
-109   {
-110     break-if-!=
-111     print-string screen, "Inf"
-112     break $print-float:body
-113   }
-114   compare bits, 0xff800000
-115   {
-116     break-if-!=
-117     print-string screen, "-Inf"
-118     break $print-float:body
-119   }
-120   var exponent/ecx: int <- copy bits
-121   exponent <- shift-right 0x17  # 23 bits of mantissa
-122   exponent <- and 0xff
-123   compare exponent, 0xff
-124   {
-125     break-if-!=
-126     print-string screen, "Nan"
-127     break $print-float:body
-128   }
-129   # - regular numbers
-130   var sign/edx: int <- copy bits
-131   sign <- shift-right 0x1f
-132   {
-133     compare sign, 1
-134     break-if-!=
-135     print-string screen, "-"
-136   }
-137   $print-float:leading-digit: {
-138     # check for subnormal numbers
-139     compare exponent, 0
-140     {
-141       break-if-!=
-142       print-string screen, "0."
-143       exponent <- increment
-144       break $print-float:leading-digit
-145     }
-146     # normal numbers
-147     print-string screen, "1."
-148   }
-149   var mantissa/ebx: int <- copy bits
-150   mantissa <- and 0x7fffff
-151   print-int32-hex-bits screen, mantissa, 0x18
-152   # print exponent
-153   print-string screen, "P"
-154   exponent <- subtract 0x7f
-155   compare exponent, 0
-156   {
-157     break-if->=
-158     print-string screen, "-"
-159   }
-160   var exp-magnitude/eax: int <- abs exponent
-161   print-int32-hex-bits screen, exp-magnitude, 8
-162 }
-163 }
-164 
-165 #? fn main -> _/ebx: int {
-166 #?   run-tests
-167 #? #?   test-print-float-negative-zero
-168 #? #?   print-int32-hex 0, 0
-169 #? #?   test-print-float-normal
-170 #?   return 0
-171 #? }
-
- - - diff --git a/html/409print-float-hex.mu.html b/html/409print-float-hex.mu.html new file mode 100644 index 00000000..9eb93661 --- /dev/null +++ b/html/409print-float-hex.mu.html @@ -0,0 +1,260 @@ + + + + +Mu - 409print-float-hex.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/409print-float-hex.mu +
+  1 # quick-n-dirty way to print out floats in hex
+  2 # https://www.exploringbinary.com/hexadecimal-floating-point-constants
+  3 
+  4 # example:
+  5 #   0.5 = 0x3f000000 = 0011| 1111 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000
+  6 #                    = 0 | 01111110 | 00000000000000000000000
+  7 #                      +   exponent   mantissa
+  8 #                    = 0 | 00000000000000000000000 | 01111110
+  9 #                          mantissa                  exponent
+ 10 #                    = 0 | 000000000000000000000000 | 01111110
+ 11 #                          zero-pad mantissa          exponent
+ 12 #                   =   +1.000000                   P -01
+ 13 fn test-print-float-hex-normal {
+ 14   var screen-on-stack: screen
+ 15   var screen/esi: (addr screen) <- address screen-on-stack
+ 16   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+ 17   # 0.5
+ 18   var half/xmm0: float <- rational 1, 2
+ 19   print-float-hex screen, half
+ 20   check-screen-row screen, 1, "1.000000P-01 ", "F - test-print-float-hex-normal 0.5"
+ 21   # 0.25
+ 22   clear-screen screen
+ 23   var quarter/xmm0: float <- rational 1, 4
+ 24   print-float-hex screen, quarter
+ 25   check-screen-row screen, 1, "1.000000P-02 ", "F - test-print-float-hex-normal 0.25"
+ 26   # 0.75
+ 27   clear-screen screen
+ 28   var three-quarters/xmm0: float <- rational 3, 4
+ 29   print-float-hex screen, three-quarters
+ 30   check-screen-row screen, 1, "1.800000P-01 ", "F - test-print-float-hex-normal 0.75"
+ 31   # 0.1
+ 32   clear-screen screen
+ 33   var tenth/xmm0: float <- rational 1, 0xa
+ 34   print-float-hex screen, tenth
+ 35   check-screen-row screen, 1, "1.99999aP-04 ", "F - test-print-float-hex-normal 0.1"
+ 36 }
+ 37 
+ 38 fn test-print-float-hex-integer {
+ 39   var screen-on-stack: screen
+ 40   var screen/esi: (addr screen) <- address screen-on-stack
+ 41   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+ 42   # 1
+ 43   var one-f/xmm0: float <- rational 1, 1
+ 44   print-float-hex screen, one-f
+ 45   check-screen-row screen, 1, "1.000000P00 ", "F - test-print-float-hex-integer 1"
+ 46   # 2
+ 47   clear-screen screen
+ 48   var two-f/xmm0: float <- rational 2, 1
+ 49   print-float-hex screen, two-f
+ 50   check-screen-row screen, 1, "1.000000P01 ", "F - test-print-float-hex-integer 2"
+ 51   # 10
+ 52   clear-screen screen
+ 53   var ten-f/xmm0: float <- rational 0xa, 1
+ 54   print-float-hex screen, ten-f
+ 55   check-screen-row screen, 1, "1.400000P03 ", "F - test-print-float-hex-integer 10"
+ 56   # -10
+ 57   clear-screen screen
+ 58   var minus-ten-f/xmm0: float <- rational -0xa, 1
+ 59   print-float-hex screen, minus-ten-f
+ 60   check-screen-row screen, 1, "-1.400000P03 ", "F - test-print-float-hex-integer -10"
+ 61 }
+ 62 
+ 63 fn test-print-float-hex-zero {
+ 64   var screen-on-stack: screen
+ 65   var screen/esi: (addr screen) <- address screen-on-stack
+ 66   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+ 67   var zero: float
+ 68   print-float-hex screen, zero
+ 69   check-screen-row screen, 1, "0 ", "F - test-print-float-hex-zero"
+ 70 }
+ 71 
+ 72 fn test-print-float-hex-negative-zero {
+ 73   var screen-on-stack: screen
+ 74   var screen/esi: (addr screen) <- address screen-on-stack
+ 75   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+ 76   var n: int
+ 77   copy-to n, 0x80000000
+ 78   var negative-zero/xmm0: float <- reinterpret n
+ 79   print-float-hex screen, negative-zero
+ 80   check-screen-row screen, 1, "-0 ", "F - test-print-float-hex-negative-zero"
+ 81 }
+ 82 
+ 83 fn test-print-float-hex-infinity {
+ 84   var screen-on-stack: screen
+ 85   var screen/esi: (addr screen) <- address screen-on-stack
+ 86   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+ 87   var n: int
+ 88   #          0|11111111|00000000000000000000000
+ 89   #          0111|1111|1000|0000|0000|0000|0000|0000
+ 90   copy-to n, 0x7f800000
+ 91   var infinity/xmm0: float <- reinterpret n
+ 92   print-float-hex screen, infinity
+ 93   check-screen-row screen, 1, "Inf ", "F - test-print-float-hex-infinity"
+ 94 }
+ 95 
+ 96 fn test-print-float-hex-negative-infinity {
+ 97   var screen-on-stack: screen
+ 98   var screen/esi: (addr screen) <- address screen-on-stack
+ 99   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+100   var n: int
+101   copy-to n, 0xff800000
+102   var negative-infinity/xmm0: float <- reinterpret n
+103   print-float-hex screen, negative-infinity
+104   check-screen-row screen, 1, "-Inf ", "F - test-print-float-hex-negative-infinity"
+105 }
+106 
+107 fn test-print-float-hex-not-a-number {
+108   var screen-on-stack: screen
+109   var screen/esi: (addr screen) <- address screen-on-stack
+110   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+111   var n: int
+112   copy-to n, 0xffffffff  # exponent must be all 1's, and mantissa must be non-zero
+113   var negative-infinity/xmm0: float <- reinterpret n
+114   print-float-hex screen, negative-infinity
+115   check-screen-row screen, 1, "NaN ", "F - test-print-float-hex-not-a-number"
+116 }
+117 
+118 fn print-float-hex screen: (addr screen), n: float {
+119   # - special names
+120   var bits/eax: int <- reinterpret n
+121   compare bits, 0
+122   {
+123     break-if-!=
+124     print-string screen, "0"
+125     return
+126   }
+127   compare bits, 0x80000000
+128   {
+129     break-if-!=
+130     print-string screen, "-0"
+131     return
+132   }
+133   compare bits, 0x7f800000
+134   {
+135     break-if-!=
+136     print-string screen, "Inf"
+137     return
+138   }
+139   compare bits, 0xff800000
+140   {
+141     break-if-!=
+142     print-string screen, "-Inf"
+143     return
+144   }
+145   var exponent/ecx: int <- copy bits
+146   exponent <- shift-right 0x17  # 23 bits of mantissa
+147   exponent <- and 0xff
+148   exponent <- subtract 0x7f
+149   compare exponent, 0x80
+150   {
+151     break-if-!=
+152     print-string screen, "NaN"
+153     return
+154   }
+155   # - regular numbers
+156   var sign/edx: int <- copy bits
+157   sign <- shift-right 0x1f
+158   {
+159     compare sign, 1
+160     break-if-!=
+161     print-string screen, "-"
+162   }
+163   $print-float-hex:leading-digit: {
+164     # check for subnormal numbers
+165     compare exponent, -0x7f
+166     {
+167       break-if-!=
+168       print-string screen, "0."
+169       exponent <- increment
+170       break $print-float-hex:leading-digit
+171     }
+172     # normal numbers
+173     print-string screen, "1."
+174   }
+175   var mantissa/ebx: int <- copy bits
+176   mantissa <- and 0x7fffff
+177   mantissa <- shift-left 1  # pad to whole nibbles
+178   print-int32-hex-bits screen, mantissa, 0x18
+179   # print exponent
+180   print-string screen, "P"
+181   compare exponent, 0
+182   {
+183     break-if->=
+184     print-string screen, "-"
+185   }
+186   var exp-magnitude/eax: int <- abs exponent
+187   print-int32-hex-bits screen, exp-magnitude, 8
+188 }
+189 
+190 #? fn main -> _/ebx: int {
+191 #?   run-tests
+192 #? #?   test-print-float-hex-negative-zero
+193 #? #?   print-int32-hex 0, 0
+194 #? #?   test-print-float-hex-normal
+195 #?   return 0
+196 #? }
+
+ + + diff --git a/html/410file.mu.html b/html/410file.mu.html index 51941348..da75a2fa 100644 --- a/html/410file.mu.html +++ b/html/410file.mu.html @@ -71,11 +71,11 @@ if ('onhashchange' in window) { 12 #? print-string 0, "AAA\n" 13 var h: (handle array byte) 14 var ah/eax: (addr handle array byte) <- address h -15 stream-to-array line-a, ah +15 stream-to-array line-a, ah 16 write-to-stream stream-a, ah 17 loop 18 } -19 stream-to-array stream-a, out +19 stream-to-array stream-a, out 20 } diff --git a/html/411string.mu.html b/html/411string.mu.html index bc871982..bbf392bf 100644 --- a/html/411string.mu.html +++ b/html/411string.mu.html @@ -94,7 +94,7 @@ if ('onhashchange' in window) { 34 loop 35 } 36 } - 37 stream-to-array out-stream-addr, out-ah + 37 stream-to-array out-stream-addr, out-ah 38 } 39 40 fn test-substring { @@ -165,7 +165,7 @@ if ('onhashchange' in window) { 105 # token complete; flush 106 var token: (handle array byte) 107 var token-ah/eax: (addr handle array byte) <- address token -108 stream-to-array curr-stream-addr, token-ah +108 stream-to-array curr-stream-addr, token-ah 109 write-to-stream tokens-stream-addr, token-ah 110 clear-stream curr-stream-addr 111 loop $split-string:core @@ -173,7 +173,7 @@ if ('onhashchange' in window) { 113 write-grapheme curr-stream-addr, g 114 loop 115 } -116 stream-to-array tokens-stream-addr, out +116 stream-to-array tokens-stream-addr, out 117 } 118 119 fn test-split-string { diff --git a/html/412print-float-decimal.mu.html b/html/412print-float-decimal.mu.html new file mode 100644 index 00000000..6c6d4f39 --- /dev/null +++ b/html/412print-float-decimal.mu.html @@ -0,0 +1,722 @@ + + + + +Mu - 412print-float-decimal.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/412print-float-decimal.mu +
+  1 # print out floats in decimal
+  2 # https://research.swtch.com/ftoa
+  3 #
+  4 # Basic idea:
+  5 #   Ignoring sign, floating point numbers are represented as 1.mantissa * 2^exponent
+  6 #   Therefore, to print a float in decimal, we need to:
+  7 #     - compute its value without decimal point
+  8 #     - convert to an array of decimal digits
+  9 #     - print out the array while inserting the decimal point appropriately
+ 10 #
+ 11 # Basic complication: the computation generates numbers larger than an int can
+ 12 # hold. We need a way to represent big ints.
+ 13 #
+ 14 # Key insight: use a representation for big ints that's close to what we need
+ 15 # anyway, an array of decimal digits.
+ 16 #
+ 17 # Style note: we aren't creating a big int library here. The only operations
+ 18 # we need are halving and doubling. Following the link above, it seems more
+ 19 # comprehensible to keep these operations inlined so that we can track the
+ 20 # position of the decimal point with dispatch.
+ 21 #
+ 22 # This approach turns out to be fast enough for most purposes.
+ 23 # Optimizations, however, get wildly more complex.
+ 24 
+ 25 fn test-print-float-decimal-approximate-normal {
+ 26   var screen-on-stack: screen
+ 27   var screen/esi: (addr screen) <- address screen-on-stack
+ 28   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+ 29   # 0.5
+ 30   var half/xmm0: float <- rational 1, 2
+ 31   print-float-decimal-approximate screen, half, 3
+ 32   check-screen-row screen, 1, "0.5 ", "F - test-print-float-decimal-approximate-normal 0.5"
+ 33   # 0.25
+ 34   clear-screen screen
+ 35   var quarter/xmm0: float <- rational 1, 4
+ 36   print-float-decimal-approximate screen, quarter, 3
+ 37   check-screen-row screen, 1, "0.25 ", "F - test-print-float-decimal-approximate-normal 0.25"
+ 38   # 0.75
+ 39   clear-screen screen
+ 40   var three-quarters/xmm0: float <- rational 3, 4
+ 41   print-float-decimal-approximate screen, three-quarters, 3
+ 42   check-screen-row screen, 1, "0.75 ", "F - test-print-float-decimal-approximate-normal 0.75"
+ 43   # 0.125
+ 44   clear-screen screen
+ 45   var eighth/xmm0: float <- rational 1, 8
+ 46   print-float-decimal-approximate screen, eighth, 3
+ 47   check-screen-row screen, 1, "0.125 ", "F - test-print-float-decimal-approximate-normal 0.125"
+ 48   # 0.0625; start using scientific notation
+ 49   clear-screen screen
+ 50   var sixteenth/xmm0: float <- rational 1, 0x10
+ 51   print-float-decimal-approximate screen, sixteenth, 3
+ 52   check-screen-row screen, 1, "6.25e-2 ", "F - test-print-float-decimal-approximate-normal 0.0625"
+ 53   # sqrt(2); truncate floats with lots of digits after the decimal but not too many before
+ 54   clear-screen screen
+ 55   var two-f/xmm0: float <- rational 2, 1
+ 56   var sqrt-2/xmm0: float <- square-root two-f
+ 57   print-float-decimal-approximate screen, sqrt-2, 3
+ 58   check-screen-row screen, 1, "1.414 ", "F - test-print-float-decimal-approximate-normal √2"
+ 59 }
+ 60 
+ 61 # print whole integers without decimals
+ 62 fn test-print-float-decimal-approximate-integer {
+ 63   var screen-on-stack: screen
+ 64   var screen/esi: (addr screen) <- address screen-on-stack
+ 65   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+ 66   # 1
+ 67   var one-f/xmm0: float <- rational 1, 1
+ 68   print-float-decimal-approximate screen, one-f, 3
+ 69   check-screen-row screen, 1, "1 ", "F - test-print-float-decimal-approximate-integer 1"
+ 70   # 2
+ 71   clear-screen screen
+ 72   var two-f/xmm0: float <- rational 2, 1
+ 73   print-float-decimal-approximate screen, two-f, 3
+ 74   check-screen-row screen, 1, "2 ", "F - test-print-float-decimal-approximate-integer 2"
+ 75   # 10
+ 76   clear-screen screen
+ 77   var ten-f/xmm0: float <- rational 0xa, 1
+ 78   print-float-decimal-approximate screen, ten-f, 3
+ 79   check-screen-row screen, 1, "10 ", "F - test-print-float-decimal-approximate-integer 10"
+ 80   # -10
+ 81   clear-screen screen
+ 82   var minus-ten-f/xmm0: float <- rational -0xa, 1
+ 83   print-float-decimal-approximate screen, minus-ten-f, 3
+ 84   check-screen-row screen, 1, "-10 ", "F - test-print-float-decimal-approximate-integer -10"
+ 85   # 999
+ 86   clear-screen screen
+ 87   var minus-ten-f/xmm0: float <- rational 0x3e7, 1
+ 88   print-float-decimal-approximate screen, minus-ten-f, 3
+ 89   check-screen-row screen, 1, "999 ", "F - test-print-float-decimal-approximate-integer 1000"
+ 90   # 1000 - start using scientific notation
+ 91   clear-screen screen
+ 92   var minus-ten-f/xmm0: float <- rational 0x3e8, 1
+ 93   print-float-decimal-approximate screen, minus-ten-f, 3
+ 94   check-screen-row screen, 1, "1.00e3 ", "F - test-print-float-decimal-approximate-integer 1000"
+ 95   # 100,000
+ 96   clear-screen screen
+ 97   var hundred-thousand/eax: int <- copy 0x186a0
+ 98   var hundred-thousand-f/xmm0: float <- convert hundred-thousand
+ 99   print-float-decimal-approximate screen, hundred-thousand-f, 3
+100   check-screen-row screen, 1, "1.00e5 ", "F - test-print-float-decimal-approximate-integer 100,000"
+101 }
+102 
+103 fn test-print-float-decimal-approximate-zero {
+104   var screen-on-stack: screen
+105   var screen/esi: (addr screen) <- address screen-on-stack
+106   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+107   var zero: float
+108   print-float-decimal-approximate screen, zero, 3
+109   check-screen-row screen, 1, "0 ", "F - test-print-float-decimal-approximate-zero"
+110 }
+111 
+112 fn test-print-float-decimal-approximate-negative-zero {
+113   var screen-on-stack: screen
+114   var screen/esi: (addr screen) <- address screen-on-stack
+115   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+116   var n: int
+117   copy-to n, 0x80000000
+118   var negative-zero/xmm0: float <- reinterpret n
+119   print-float-decimal-approximate screen, negative-zero, 3
+120   check-screen-row screen, 1, "-0 ", "F - test-print-float-decimal-approximate-negative-zero"
+121 }
+122 
+123 fn test-print-float-decimal-approximate-infinity {
+124   var screen-on-stack: screen
+125   var screen/esi: (addr screen) <- address screen-on-stack
+126   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+127   var n: int
+128   #          0|11111111|00000000000000000000000
+129   #          0111|1111|1000|0000|0000|0000|0000|0000
+130   copy-to n, 0x7f800000
+131   var infinity/xmm0: float <- reinterpret n
+132   print-float-decimal-approximate screen, infinity, 3
+133   check-screen-row screen, 1, "Inf ", "F - test-print-float-decimal-approximate-infinity"
+134 }
+135 
+136 fn test-print-float-decimal-approximate-negative-infinity {
+137   var screen-on-stack: screen
+138   var screen/esi: (addr screen) <- address screen-on-stack
+139   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+140   var n: int
+141   copy-to n, 0xff800000
+142   var negative-infinity/xmm0: float <- reinterpret n
+143   print-float-decimal-approximate screen, negative-infinity, 3
+144   check-screen-row screen, 1, "-Inf ", "F - test-print-float-decimal-approximate-negative-infinity"
+145 }
+146 
+147 fn test-print-float-decimal-approximate-not-a-number {
+148   var screen-on-stack: screen
+149   var screen/esi: (addr screen) <- address screen-on-stack
+150   initialize-screen screen, 5, 0x20  # 32 columns should be more than enough
+151   var n: int
+152   copy-to n, 0xffffffff  # exponent must be all 1's, and mantissa must be non-zero
+153   var negative-infinity/xmm0: float <- reinterpret n
+154   print-float-decimal-approximate screen, negative-infinity, 3
+155   check-screen-row screen, 1, "NaN ", "F - test-print-float-decimal-approximate-not-a-number"
+156 }
+157 
+158 # 'precision' controls the maximum width past which we resort to scientific notation
+159 fn print-float-decimal-approximate screen: (addr screen), in: float, precision: int {
+160   # - special names
+161   var bits/eax: int <- reinterpret in
+162   compare bits, 0
+163   {
+164     break-if-!=
+165     print-string screen, "0"
+166     return
+167   }
+168   compare bits, 0x80000000
+169   {
+170     break-if-!=
+171     print-string screen, "-0"
+172     return
+173   }
+174   compare bits, 0x7f800000
+175   {
+176     break-if-!=
+177     print-string screen, "Inf"
+178     return
+179   }
+180   compare bits, 0xff800000
+181   {
+182     break-if-!=
+183     print-string screen, "-Inf"
+184     return
+185   }
+186   var exponent/ecx: int <- copy bits
+187   exponent <- shift-right 0x17  # 23 bits of mantissa
+188   exponent <- and 0xff
+189   exponent <- subtract 0x7f
+190   compare exponent, 0x80
+191   {
+192     break-if-!=
+193     print-string screen, "NaN"
+194     return
+195   }
+196   # - regular numbers
+197   var sign/edx: int <- copy bits
+198   sign <- shift-right 0x1f
+199   {
+200     compare sign, 1
+201     break-if-!=
+202     print-string screen, "-"
+203   }
+204 
+205   # v = 1.mantissa (in base 2) << 0x17
+206   var v/ebx: int <- copy bits
+207   v <- and 0x7fffff
+208   v <- or 0x00800000  # insert implicit 1
+209   # e = exponent - 0x17
+210   var e/ecx: int <- copy exponent
+211   e <- subtract 0x17  # move decimal place from before mantissa to after
+212 
+213   # initialize buffer with decimal representation of v
+214   # unlike https://research.swtch.com/ftoa, no ascii here
+215   var buf-storage: (array byte 0x7f)
+216   var buf/edi: (addr array byte) <- address buf-storage
+217 #?   print-int32-decimal 0, v
+218 #?   print-string 0, "\n"
+219   var n/eax: int <- decimal-digits v, buf
+220 #?   dump-digits buf, n, "init"
+221   # I suspect we can do without reversing, but we'll follow https://research.swtch.com/ftoa
+222   # closely for now.
+223   reverse-digits buf, n
+224 #?   dump-digits buf, n, "reverse"
+225 
+226   # loop if e > 0
+227   {
+228     compare e, 0
+229     break-if-<=
+230     n <- double-array-of-decimal-digits buf, n
+231 #?     dump-digits buf, n, "double"
+232     e <- decrement
+233     loop
+234   }
+235 
+236   var dp/edx: int <- copy n
+237 
+238   # loop if e < 0
+239   {
+240     compare e, 0
+241     break-if->=
+242     n, dp <- halve-array-of-decimal-digits buf, n, dp
+243 #?     print-int32-decimal 0, dp
+244 #?     print-string 0, ", "
+245 #?     dump-digits buf, n, "halve"
+246     e <- increment
+247     loop
+248   }
+249 
+250   print-float-buffer screen, buf, n, dp, precision
+251 }
+252 
+253 # store the decimal digits of 'n' into 'buf', units first
+254 # n must be positive
+255 fn decimal-digits n: int, _buf: (addr array byte) -> _/eax: int {
+256   var buf/edi: (addr array byte) <- copy _buf
+257   var i/ecx: int <- copy 0
+258   var curr/eax: int <- copy n
+259   var curr-byte/edx: int <- copy 0
+260   {
+261     compare curr, 0
+262     break-if-=
+263     curr, curr-byte <- integer-divide curr, 0xa
+264     var dest/ebx: (addr byte) <- index buf, i
+265     copy-byte-to *dest, curr-byte
+266     i <- increment
+267     loop
+268   }
+269   return i
+270 }
+271 
+272 fn reverse-digits _buf: (addr array byte), n: int {
+273   var buf/esi: (addr array byte) <- copy _buf
+274   var left/ecx: int <- copy 0
+275   var right/edx: int <- copy n
+276   right <- decrement
+277   {
+278     compare left, right
+279     break-if->=
+280     {
+281       var l-a/ecx: (addr byte) <- index buf, left
+282       var r-a/edx: (addr byte) <- index buf, right
+283       var l/ebx: byte <- copy-byte *l-a
+284       var r/eax: byte <- copy-byte *r-a
+285       copy-byte-to *l-a, r
+286       copy-byte-to *r-a, l
+287     }
+288     left <- increment
+289     right <- decrement
+290     loop
+291   }
+292 }
+293 
+294 # debug helper
+295 fn dump-digits _buf: (addr array byte), count: int, msg: (addr array byte) {
+296   var buf/edi: (addr array byte) <- copy _buf
+297   var i/ecx: int <- copy 0
+298   print-string 0, msg
+299   print-string 0, ": "
+300   {
+301     compare i, count
+302     break-if->=
+303     var curr/edx: (addr byte) <- index buf, i
+304     var curr-byte/eax: byte <- copy-byte *curr
+305     var curr-int/eax: int <- copy curr-byte
+306     print-int32-decimal 0, curr-int
+307     print-string 0, " "
+308     break-if-=
+309     i <- increment
+310     loop
+311   }
+312   print-string 0, "\n"
+313 }
+314 
+315 fn double-array-of-decimal-digits _buf: (addr array byte), _n: int -> _/eax: int {
+316   var buf/edi: (addr array byte) <- copy _buf
+317   # initialize delta
+318   var delta/edx: int <- copy 0
+319   {
+320     var curr/ebx: (addr byte) <- index buf, 0
+321     var tmp/eax: byte <- copy-byte *curr
+322     compare tmp, 5
+323     break-if-<
+324     delta <- copy 1
+325   }
+326   # loop
+327   var x/eax: int <- copy 0
+328   var i/ecx: int <- copy _n
+329   i <- decrement
+330   {
+331     compare i, 0
+332     break-if-<=
+333     # x += 2*buf[i]
+334     {
+335       var tmp/ecx: (addr byte) <- index buf, i
+336       var tmp2/ecx: byte <- copy-byte *tmp
+337       x <- add tmp2
+338       x <- add tmp2
+339     }
+340     # x, buf[i+delta] = x/10, x%10
+341     {
+342       var dest-index/ecx: int <- copy i
+343       dest-index <- add delta
+344       var dest/edi: (addr byte) <- index buf, dest-index
+345       var next-digit/edx: int <- copy 0
+346       x, next-digit <- integer-divide x, 0xa
+347       copy-byte-to *dest, next-digit
+348     }
+349     #
+350     i <- decrement
+351     loop
+352   }
+353   # final patch-up
+354   var n/eax: int <- copy _n
+355   compare delta, 1
+356   {
+357     break-if-!=
+358     var curr/ebx: (addr byte) <- index buf, 0
+359     var one/edx: int <- copy 1
+360     copy-byte-to *curr, one
+361     n <- increment
+362   }
+363   return n
+364 }
+365 
+366 fn halve-array-of-decimal-digits _buf: (addr array byte), _n: int, _dp: int -> _/eax: int, _/edx: int {
+367   var buf/edi: (addr array byte) <- copy _buf
+368   var n/eax: int <- copy _n
+369   var dp/edx: int <- copy _dp
+370   # initialize one side
+371   {
+372     # if buf[n-1]%2 == 0, break
+373     var right-index/ecx: int <- copy n
+374     right-index <- decrement
+375     var right-a/ecx: (addr byte) <- index buf, right-index
+376     var right/ecx: byte <- copy-byte *right-a
+377     var right-int/ecx: int <- copy right
+378     var remainder/edx: int <- copy 0
+379     {
+380       var dummy/eax: int <- copy 0
+381       dummy, remainder <- integer-divide right-int, 2
+382     }
+383     compare remainder, 0
+384     break-if-=
+385     # buf[n] = 0
+386     var next-a/ecx: (addr byte) <- index buf, n
+387     var zero/edx: byte <- copy 0
+388     copy-byte-to *next-a, zero
+389     # n++
+390     n <- increment
+391   }
+392   # initialize the other
+393   var delta/ebx: int <- copy 0
+394   var x/esi: int <- copy 0
+395   {
+396     # if buf[0] >= 2, break
+397     var left/ecx: (addr byte) <- index buf, 0
+398     var src/ecx: byte <- copy-byte *left
+399     compare src, 2
+400     break-if->=
+401     # delta, x = 1, buf[0]
+402     delta <- copy 1
+403     x <- copy src
+404     # n--
+405     n <- decrement
+406     # dp--
+407     dp <- decrement
+408   }
+409   # loop
+410   var i/ecx: int <- copy 0
+411   {
+412     compare i, n
+413     break-if->=
+414     # x = x*10 + buf[i+delta]
+415     {
+416       var ten/edx: int <- copy 0xa
+417       x <- multiply ten
+418       var src-index/edx: int <- copy i
+419       src-index <- add delta
+420       var src-a/edx: (addr byte) <- index buf, src-index
+421       var src/edx: byte <- copy-byte *src-a
+422       x <- add src
+423     }
+424     # buf[i], x = x/2, x%2
+425     {
+426       var quotient/eax: int <- copy 0
+427       var remainder/edx: int <- copy 0
+428       quotient, remainder <- integer-divide x, 2
+429       x <- copy remainder
+430       var dest/edx: (addr byte) <- index buf, i
+431       copy-byte-to *dest, quotient
+432     }
+433     #
+434     i <- increment
+435     loop
+436   }
+437   return n, dp
+438 }
+439 
+440 fn print-float-buffer screen: (addr screen), _buf: (addr array byte), n: int, dp: int, precision: int {
+441   var buf/edi: (addr array byte) <- copy _buf
+442 #?   print-int32-hex 0, dp
+443 #?   print-string 0, "\n"
+444   {
+445     compare dp, 0
+446     break-if->=
+447     print-float-buffer-in-scientific-notation screen, buf, n, dp, precision
+448     return
+449   }
+450   {
+451     var dp2/eax: int <- copy dp
+452     compare dp2, precision
+453     break-if-<=
+454     print-float-buffer-in-scientific-notation screen, buf, n, dp, precision
+455     return
+456   }
+457   {
+458     compare dp, 0
+459     break-if-!=
+460     print-string screen, "0"
+461   }
+462   var i/eax: int <- copy 0
+463   # bounds = min(n, dp+3)
+464   var limit/edx: int <- copy dp
+465   limit <- add 3
+466   {
+467     compare limit, n
+468     break-if-<=
+469     limit <- copy n
+470   }
+471   {
+472     compare i, limit
+473     break-if->=
+474     # print '.' if necessary
+475     compare i, dp
+476     {
+477       break-if-!=
+478       print-string screen, "."
+479     }
+480     var curr-a/ecx: (addr byte) <- index buf, i
+481     var curr/ecx: byte <- copy-byte *curr-a
+482     curr <- add 0x30  # '0'
+483     var curr-grapheme/ecx: grapheme <- copy curr
+484     print-grapheme screen, curr-grapheme
+485     i <- increment
+486     loop
+487   }
+488 }
+489 
+490 fn print-float-buffer-in-scientific-notation screen: (addr screen), _buf: (addr array byte), n: int, dp: int, precision: int {
+491   var buf/edi: (addr array byte) <- copy _buf
+492   var i/eax: int <- copy 0
+493   {
+494     compare i, n
+495     break-if->=
+496     compare i, precision
+497     break-if->=
+498     compare i, 1
+499     {
+500       break-if-!=
+501       print-string screen, "."
+502     }
+503     var curr-a/ecx: (addr byte) <- index buf, i
+504     var curr/ecx: byte <- copy-byte *curr-a
+505     curr <- add 0x30  # '0'
+506     var curr-grapheme/ecx: grapheme <- copy curr
+507     print-grapheme screen, curr-grapheme
+508     #
+509     i <- increment
+510     loop
+511   }
+512   print-string screen, "e"
+513   decrement dp
+514   print-int32-decimal screen, dp
+515 }
+516 
+517 # follows the structure of print-float-decimal-approximate
+518 # 'precision' controls the maximum width past which we resort to scientific notation
+519 fn float-size in: float, precision: int -> _/eax: int {
+520   # - special names
+521   var bits/eax: int <- reinterpret in
+522   compare bits, 0
+523   {
+524     break-if-!=
+525     return 1  # "0"
+526   }
+527   compare bits, 0x80000000
+528   {
+529     break-if-!=
+530     return 2  # "-0"
+531   }
+532   compare bits, 0x7f800000
+533   {
+534     break-if-!=
+535     return 3  # "Inf"
+536   }
+537   compare bits, 0xff800000
+538   {
+539     break-if-!=
+540     return 4  # "-Inf"
+541   }
+542   var exponent/ecx: int <- copy bits
+543   exponent <- shift-right 0x17  # 23 bits of mantissa
+544   exponent <- and 0xff
+545   exponent <- subtract 0x7f
+546   compare exponent, 0x80
+547   {
+548     break-if-!=
+549     return 3  # "NaN"
+550   }
+551   # - regular numbers
+552   # v = 1.mantissa (in base 2) << 0x17
+553   var v/ebx: int <- copy bits
+554   v <- and 0x7fffff
+555   v <- or 0x00800000  # insert implicit 1
+556   # e = exponent - 0x17
+557   var e/ecx: int <- copy exponent
+558   e <- subtract 0x17  # move decimal place from before mantissa to after
+559 
+560   # initialize buffer with decimal representation of v
+561   var buf-storage: (array byte 0x7f)
+562   var buf/edi: (addr array byte) <- address buf-storage
+563   var n/eax: int <- decimal-digits v, buf
+564   reverse-digits buf, n
+565 
+566   # loop if e > 0
+567   {
+568     compare e, 0
+569     break-if-<=
+570     n <- double-array-of-decimal-digits buf, n
+571     e <- decrement
+572     loop
+573   }
+574 
+575   var dp/edx: int <- copy n
+576 
+577   # loop if e < 0
+578   {
+579     compare e, 0
+580     break-if->=
+581     n, dp <- halve-array-of-decimal-digits buf, n, dp
+582     e <- increment
+583     loop
+584   }
+585 
+586   compare dp, 0
+587   {
+588     break-if->=
+589     return 8  # hacky for scientific notation
+590   }
+591   {
+592     var dp2/eax: int <- copy dp
+593     compare dp2, precision
+594     break-if-<=
+595     return 8  # hacky for scientific notation
+596   }
+597 
+598   # result = min(n, dp+3)
+599   var result/ecx: int <- copy dp
+600   result <- add 3
+601   {
+602     compare result, n
+603     break-if-<=
+604     result <- copy n
+605   }
+606 
+607   # account for decimal point
+608   compare dp, n
+609   {
+610     break-if->=
+611     result <- increment
+612   }
+613 
+614   # account for sign
+615   var sign/edx: int <- reinterpret in
+616   sign <- shift-right 0x1f
+617   {
+618     compare sign, 1
+619     break-if-!=
+620     result <- increment
+621   }
+622   return result
+623 }
+624 
+625 ## helper
+626 
+627 # like check-strings-equal, except array sizes don't have to match
+628 fn check-buffer-contains _buf: (addr array byte), _contents: (addr array byte), msg: (addr array byte) {
+629   var buf/esi: (addr array byte) <- copy _buf
+630   var contents/edi: (addr array byte) <- copy _contents
+631   var a/eax: boolean <- string-starts-with? buf, contents
+632   check-true a, msg
+633   var len/ecx: int <- length contents
+634   var len2/eax: int <- length buf
+635   compare len, len2
+636   break-if-=
+637   var c/eax: (addr byte) <- index buf, len
+638   var d/eax: byte <- copy-byte *c
+639   var e/eax: int <- copy d
+640   check-ints-equal e, 0, msg
+641 }
+642 
+643 fn test-check-buffer-contains {
+644   var arr: (array byte 4)
+645   var a/esi: (addr array byte) <- address arr
+646   var b/eax: (addr byte) <- index a, 0
+647   var c/ecx: byte <- copy 0x61  # 'a'
+648   copy-byte-to *b, c
+649   check-buffer-contains a, "a", "F - test-check-buffer-contains"
+650   check-buffer-contains "a", "a", "F - test-check-buffer-contains/null"  # no null check when arrays have same length
+651 }
+652 
+653 #? fn main -> _/ebx: int {
+654 #?   run-tests
+655 #? #?   test-print-float-decimal-approximate-integer
+656 #? #?   test-print-float-decimal-approximate-normal
+657 #?   return 0
+658 #? }
+
+ + + diff --git a/html/apps/arith.mu.html b/html/apps/arith.mu.html index 0868da6e..6bca6493 100644 --- a/html/apps/arith.mu.html +++ b/html/apps/arith.mu.html @@ -137,7 +137,7 @@ if ('onhashchange' in window) { 78 break-if-= $expression:loop 79 } 80 # read operator - 81 var op/ecx: byte <- copy 0 + 81 var op/ecx: grapheme <- copy 0 82 op, look <- operator look 83 # read next arg 84 var second/edx: int <- copy 0 @@ -183,7 +183,7 @@ if ('onhashchange' in window) { 124 break-if-= $term:loop 125 } 126 # read operator -127 var op/ecx: byte <- copy 0 +127 var op/ecx: grapheme <- copy 0 128 op, look <- operator look 129 # read next arg 130 var second/edx: int <- copy 0 @@ -261,8 +261,8 @@ if ('onhashchange' in window) { 202 return 0 # false 203 } 204 -205 fn operator _look: grapheme -> _/ecx: byte, _/esi: grapheme { -206 var op/ecx: byte <- copy _look +205 fn operator _look: grapheme -> _/ecx: grapheme, _/esi: grapheme { +206 var op/ecx: grapheme <- copy _look 207 var look/esi: grapheme <- get-char 208 return op, look 209 } diff --git a/html/apps/assort.subx.html b/html/apps/assort.subx.html index 8f120666..cfcc9c9c 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 408c593d..2be7916c 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 0949562c..e4dbaa9a 100644 --- a/html/apps/browse/main.mu.html +++ b/html/apps/browse/main.mu.html @@ -135,9 +135,9 @@ if ('onhashchange' in window) { 76 render pg-addr, in 77 var screen-ah/eax: (addr handle screen) <- get pg, screen 78 var screen/eax: (addr screen) <- lookup *screen-ah - 79 check-screen-row screen, 1, " ", "F - test-render-multicolumn-text/row1" - 80 check-screen-row screen, 2, " ab ef", "F - test-render-multicolumn-text/row2" - 81 check-screen-row screen, 3, " cd gh", "F - test-render-multicolumn-text/row3" + 79 check-screen-row screen, 1, " ", "F - test-render-multicolumn-text/row1" + 80 check-screen-row screen, 2, " ab ef", "F - test-render-multicolumn-text/row2" + 81 check-screen-row screen, 3, " cd gh", "F - test-render-multicolumn-text/row3" 82 } 83 84 fn test-render-heading-text { @@ -154,10 +154,10 @@ if ('onhashchange' in window) { 95 render pg-addr, in 96 var screen-ah/eax: (addr handle screen) <- get pg, screen 97 var screen/eax: (addr screen) <- lookup *screen-ah - 98 check-screen-row screen, 1, " ", "F - test-render-heading-text/row1" - 99 check-screen-row-in-color screen, 0xa0, 2, " abc ", "F - test-render-heading-text/heading" -100 check-screen-row screen, 3, " ", "F - test-render-heading-text/row3" -101 check-screen-row screen, 4, " def ", "F - test-render-heading-text/row4" + 98 check-screen-row screen, 1, " ", "F - test-render-heading-text/row1" + 99 check-screen-row-in-color screen, 0xa0, 2, " abc ", "F - test-render-heading-text/heading" +100 check-screen-row screen, 3, " ", "F - test-render-heading-text/row3" +101 check-screen-row screen, 4, " def ", "F - test-render-heading-text/row4" 102 } 103 104 fn test-render-bold-text { @@ -174,8 +174,8 @@ if ('onhashchange' in window) { 115 render pg-addr, in 116 var screen-ah/eax: (addr handle screen) <- get pg, screen 117 var screen/eax: (addr screen) <- lookup *screen-ah -118 check-screen-row screen, 2, " a b c", "F - test-render-bold-text/text" -119 check-screen-row-in-bold screen, 2, " b ", "F - test-render-bold-text/bold" +118 check-screen-row screen, 2, " a b c", "F - test-render-bold-text/text" +119 check-screen-row-in-bold screen, 2, " b ", "F - test-render-bold-text/bold" 120 } 121 122 # terminals don't always support italics, so we'll just always render italics @@ -194,8 +194,8 @@ if ('onhashchange' in window) { 135 render pg-addr, in 136 var screen-ah/eax: (addr handle screen) <- get pg, screen 137 var screen/eax: (addr screen) <- lookup *screen-ah -138 check-screen-row screen, 2, " a b c", "F - test-render-pseudoitalic-text/text" -139 check-screen-row-in-bold screen, 2, " b ", "F - test-render-pseudoitalic-text/bold" +138 check-screen-row screen, 2, " a b c", "F - test-render-pseudoitalic-text/text" +139 check-screen-row-in-bold screen, 2, " b ", "F - test-render-pseudoitalic-text/bold" 140 } 141 142 fn test-render-asterisk-in-text { @@ -212,8 +212,8 @@ if ('onhashchange' in window) { 153 render pg-addr, in 154 var screen-ah/eax: (addr handle screen) <- get pg, screen 155 var screen/eax: (addr screen) <- lookup *screen-ah -156 check-screen-row screen, 2, " a*b*c", "F - test-render-bold-text/text" -157 check-screen-row-in-bold screen, 2, " ", "F - test-render-bold-text/bold" +156 check-screen-row screen, 2, " a*b*c", "F - test-render-bold-text/text" +157 check-screen-row-in-bold screen, 2, " ", "F - test-render-bold-text/bold" 158 } 159 160 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 9f282de6..2b70fe63 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 211c35f9..be585234 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 2ecfa577..4e4b2a26 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 5a08302b..5c05d5bf 100644 --- a/html/apps/mu.subx.html +++ b/html/apps/mu.subx.html @@ -573,7 +573,7 @@ if ('onhashchange' in window) { 511 # . save registers 512 50/push-eax 513 # initialize global data structures - 514 c7 0/subop/copy *Next-block-index 1/imm32 + 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 @@ -583,11 +583,11 @@ if ('onhashchange' in window) { 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)) + 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)) + 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 @@ -630,7 +630,7 @@ if ('onhashchange' in window) { 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 --------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -662,7 +662,7 @@ if ('onhashchange' in window) { 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 --------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -701,7 +701,7 @@ if ('onhashchange' in window) { 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 --------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -744,7 +744,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -783,7 +783,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -822,7 +822,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -860,7 +860,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -898,7 +898,7 @@ if ('onhashchange' in window) { 871 89/<- %edx 4/r32/esp 872 (flush _test-output-buffered-file) 873 (flush _test-error-buffered-file) - 874 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- + 874 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ 880 # check output 881 (check-stream-equal _test-output-stream "" "F - test-function-with-addr-output: output should be empty") 882 (check-next-stream-line-equal _test-error-stream "fn foo: output cannot have an addr type; that could allow unsafe addresses to escape the function" "F - test-function-with-addr-output: error message") @@ -936,7 +936,7 @@ if ('onhashchange' in window) { 914 89/<- %edx 4/r32/esp 915 (flush _test-output-buffered-file) 916 (flush _test-error-buffered-file) - 917 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- + 917 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ 923 # check output 924 (check-stream-equal _test-output-stream "" "F - test-function-with-addr-inout: output should be empty") 925 (check-next-stream-line-equal _test-error-stream "fn foo: inout 'a' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function" "F - test-function-with-addr-inout: error message") @@ -974,7 +974,7 @@ if ('onhashchange' in window) { 957 89/<- %edx 4/r32/esp 958 (flush _test-output-buffered-file) 959 (flush _test-error-buffered-file) - 960 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- + 960 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ 966 # check output 967 (check-stream-equal _test-output-stream "" "F - test-function-with-addr-inout-2: output should be empty") 968 (check-next-stream-line-equal _test-error-stream "fn foo: inout 'a' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function" "F - test-function-with-addr-inout-2: error message") @@ -1012,7 +1012,7 @@ if ('onhashchange' in window) { 1000 89/<- %edx 4/r32/esp 1001 (flush _test-output-buffered-file) 1002 (flush _test-error-buffered-file) - 1003 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- + 1003 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ 1009 # check output 1010 (check-stream-equal _test-output-stream "" "F - test-function-with-addr-inout-3: output should be empty") 1011 (check-next-stream-line-equal _test-error-stream "fn foo: inout 'a' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function" "F - test-function-with-addr-inout-3: error message") @@ -1050,7 +1050,7 @@ if ('onhashchange' in window) { 1043 89/<- %edx 4/r32/esp 1044 (flush _test-output-buffered-file) 1045 (flush _test-error-buffered-file) - 1046 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- + 1046 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ 1052 # check output 1053 (check-stream-equal _test-output-stream "" "F - test-function-with-addr-inout-4: output should be empty") 1054 (check-next-stream-line-equal _test-error-stream "fn foo: inout 'a' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function" "F - test-function-with-addr-inout-4: error message") @@ -1121,7 +1121,7 @@ if ('onhashchange' in window) { 1119 # convert 1120 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) 1121 (flush _test-output-buffered-file) - 1122 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- + 1122 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- 1128 # check output 1129 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0") 1130 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1") @@ -1157,7 +1157,7 @@ if ('onhashchange' in window) { 1160 # convert 1161 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) 1162 (flush _test-output-buffered-file) - 1163 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- + 1163 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- 1169 # check output 1170 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0") 1171 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-distinguishes-args/1") @@ -1193,7 +1193,7 @@ if ('onhashchange' in window) { 1201 # convert 1202 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) 1203 (flush _test-output-buffered-file) - 1204 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- + 1204 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- 1210 # check output 1211 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-literal/0") 1212 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-literal/1") @@ -1231,7 +1231,7 @@ if ('onhashchange' in window) { 1244 # convert 1245 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) 1246 (flush _test-output-buffered-file) - 1247 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- + 1247 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- 1253 # check output 1254 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return/0") 1255 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return/1") @@ -1254,7 +1254,7 @@ if ('onhashchange' in window) { 1272 5d/pop-to-ebp 1273 c3/return 1274 - 1275 test-convert-function-with-return-register: + 1275 test-convert-function-with-return-float: 1276 # . prologue 1277 55/push-ebp 1278 89/<- %ebp 4/r32/esp @@ -1264,172 +1264,172 @@ if ('onhashchange' in window) { 1282 (clear-stream _test-output-stream) 1283 (clear-stream $_test-output-buffered-file->buffer) 1284 # - 1285 (write _test-input-stream "fn foo -> _/eax: int {\n") - 1286 (write _test-input-stream " var y/eax: int <- copy 3\n") + 1285 (write _test-input-stream "fn foo -> _/xmm0: float {\n") + 1286 (write _test-input-stream " var y: float\n") 1287 (write _test-input-stream " return y\n") 1288 (write _test-input-stream "}\n") 1289 # convert 1290 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) 1291 (flush _test-output-buffered-file) - 1292 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- + 1292 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- 1298 # check output - 1299 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register/0") - 1300 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register/1") - 1301 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register/2") - 1302 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register/3") - 1303 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register/4") - 1304 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register/5") - 1305 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register/6") - 1306 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-register/7") - 1307 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-return-register/8") - 1308 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-return-register/9") - 1309 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-register/10") - 1310 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register/11") - 1311 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register/12") - 1312 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register/13") - 1313 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register/14") - 1314 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register/15") - 1315 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register/16") - 1316 # . epilogue - 1317 89/<- %esp 5/r32/ebp - 1318 5d/pop-to-ebp - 1319 c3/return - 1320 - 1321 test-function-with-output-without-register: - 1322 # . prologue - 1323 55/push-ebp - 1324 89/<- %ebp 4/r32/esp - 1325 # setup - 1326 (clear-stream _test-input-stream) - 1327 (clear-stream $_test-input-buffered-file->buffer) - 1328 (clear-stream _test-output-stream) - 1329 (clear-stream $_test-output-buffered-file->buffer) - 1330 (clear-stream _test-error-stream) - 1331 (clear-stream $_test-error-buffered-file->buffer) - 1332 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1333 68/push 0/imm32 - 1334 68/push 0/imm32 - 1335 89/<- %edx 4/r32/esp - 1336 (tailor-exit-descriptor %edx 0x10) - 1337 # - 1338 (write _test-input-stream "fn foo -> _: int {\n") - 1339 (write _test-input-stream "}\n") - 1340 # convert - 1341 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1342 # registers except esp clobbered at this point - 1343 # restore ed - 1344 89/<- %edx 4/r32/esp - 1345 (flush _test-output-buffered-file) - 1346 (flush _test-error-buffered-file) - 1347 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 1353 # check output - 1354 (check-stream-equal _test-output-stream "" "F - test-function-with-output-without-register: output should be empty") - 1355 (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") - 1356 # check that stop(1) was called - 1357 (check-ints-equal *(edx+4) 2 "F - test-function-with-output-without-register: exit status") - 1358 # don't restore from ebp - 1359 81 0/subop/add %esp 8/imm32 - 1360 # . epilogue - 1361 5d/pop-to-ebp - 1362 c3/return - 1363 - 1364 test-function-with-outputs-in-conflicting-registers: - 1365 # . prologue - 1366 55/push-ebp - 1367 89/<- %ebp 4/r32/esp - 1368 # setup - 1369 (clear-stream _test-input-stream) - 1370 (clear-stream $_test-input-buffered-file->buffer) - 1371 (clear-stream _test-output-stream) - 1372 (clear-stream $_test-output-buffered-file->buffer) - 1373 (clear-stream _test-error-stream) - 1374 (clear-stream $_test-error-buffered-file->buffer) - 1375 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1376 68/push 0/imm32 - 1377 68/push 0/imm32 - 1378 89/<- %edx 4/r32/esp - 1379 (tailor-exit-descriptor %edx 0x10) - 1380 # - 1381 (write _test-input-stream "fn foo -> _/eax: int, _/eax: int {\n") - 1382 (write _test-input-stream "}\n") - 1383 # convert - 1384 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1385 # registers except esp clobbered at this point - 1386 # restore ed - 1387 89/<- %edx 4/r32/esp - 1388 (flush _test-output-buffered-file) - 1389 (flush _test-error-buffered-file) - 1390 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 1396 # check output - 1397 (check-stream-equal _test-output-stream "" "F - test-function-with-outputs-in-conflicting-registers: output should be empty") - 1398 (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") - 1399 # check that stop(1) was called - 1400 (check-ints-equal *(edx+4) 2 "F - test-function-with-outputs-in-conflicting-registers: exit status") - 1401 # don't restore from ebp - 1402 81 0/subop/add %esp 8/imm32 - 1403 # . epilogue - 1404 5d/pop-to-ebp - 1405 c3/return - 1406 - 1407 test-function-with-named-output: - 1408 # . prologue - 1409 55/push-ebp - 1410 89/<- %ebp 4/r32/esp - 1411 # setup - 1412 (clear-stream _test-input-stream) - 1413 (clear-stream $_test-input-buffered-file->buffer) - 1414 (clear-stream _test-output-stream) - 1415 (clear-stream $_test-output-buffered-file->buffer) - 1416 (clear-stream _test-error-stream) - 1417 (clear-stream $_test-error-buffered-file->buffer) - 1418 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1419 68/push 0/imm32 - 1420 68/push 0/imm32 - 1421 89/<- %edx 4/r32/esp - 1422 (tailor-exit-descriptor %edx 0x10) - 1423 # - 1424 (write _test-input-stream "fn foo -> x/eax: int {\n") - 1425 (write _test-input-stream " return 0\n") - 1426 (write _test-input-stream "}\n") - 1427 # convert - 1428 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1429 # registers except esp clobbered at this point - 1430 # restore ed - 1431 89/<- %edx 4/r32/esp - 1432 (flush _test-output-buffered-file) - 1433 (flush _test-error-buffered-file) - 1434 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 1440 # check output - 1441 (check-stream-equal _test-output-stream "" "F - test-function-with-named-output: output should be empty") - 1442 (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") - 1443 # check that stop(1) was called - 1444 (check-ints-equal *(edx+4) 2 "F - test-function-with-named-output: exit status") - 1445 # don't restore from ebp - 1446 81 0/subop/add %esp 8/imm32 - 1447 # . epilogue - 1448 5d/pop-to-ebp - 1449 c3/return - 1450 - 1451 test-return-with-wrong-type: - 1452 # . prologue - 1453 55/push-ebp - 1454 89/<- %ebp 4/r32/esp - 1455 # setup - 1456 (clear-stream _test-input-stream) - 1457 (clear-stream $_test-input-buffered-file->buffer) - 1458 (clear-stream _test-output-stream) - 1459 (clear-stream $_test-output-buffered-file->buffer) - 1460 (clear-stream _test-error-stream) - 1461 (clear-stream $_test-error-buffered-file->buffer) - 1462 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1463 68/push 0/imm32 + 1299 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return/0") + 1300 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return/1") + 1301 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return/2") + 1302 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return/3") + 1303 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return/4") + 1304 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return/5") + 1305 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-return/6") # y + 1306 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *(ebp+0xfffffffc) 0x00000000/x32" "F - test-convert-function-with-return/7") + 1307 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-return/8") + 1308 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return/9") + 1309 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return/10") + 1310 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return/11") + 1311 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return/12") + 1312 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return/13") + 1313 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return/14") + 1314 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return/15") + 1315 # . epilogue + 1316 89/<- %esp 5/r32/ebp + 1317 5d/pop-to-ebp + 1318 c3/return + 1319 + 1320 test-convert-function-with-return-register: + 1321 # . prologue + 1322 55/push-ebp + 1323 89/<- %ebp 4/r32/esp + 1324 # setup + 1325 (clear-stream _test-input-stream) + 1326 (clear-stream $_test-input-buffered-file->buffer) + 1327 (clear-stream _test-output-stream) + 1328 (clear-stream $_test-output-buffered-file->buffer) + 1329 # + 1330 (write _test-input-stream "fn foo -> _/eax: int {\n") + 1331 (write _test-input-stream " var y/eax: int <- copy 3\n") + 1332 (write _test-input-stream " return y\n") + 1333 (write _test-input-stream "}\n") + 1334 # convert + 1335 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1336 (flush _test-output-buffered-file) + 1337 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1343 # check output + 1344 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register/0") + 1345 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register/1") + 1346 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register/2") + 1347 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register/3") + 1348 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register/4") + 1349 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register/5") + 1350 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register/6") + 1351 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-register/7") + 1352 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-return-register/8") + 1353 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-return-register/9") + 1354 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-register/10") + 1355 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register/11") + 1356 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register/12") + 1357 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register/13") + 1358 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register/14") + 1359 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register/15") + 1360 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register/16") + 1361 # . epilogue + 1362 89/<- %esp 5/r32/ebp + 1363 5d/pop-to-ebp + 1364 c3/return + 1365 + 1366 test-function-with-output-without-register: + 1367 # . prologue + 1368 55/push-ebp + 1369 89/<- %ebp 4/r32/esp + 1370 # setup + 1371 (clear-stream _test-input-stream) + 1372 (clear-stream $_test-input-buffered-file->buffer) + 1373 (clear-stream _test-output-stream) + 1374 (clear-stream $_test-output-buffered-file->buffer) + 1375 (clear-stream _test-error-stream) + 1376 (clear-stream $_test-error-buffered-file->buffer) + 1377 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1378 68/push 0/imm32 + 1379 68/push 0/imm32 + 1380 89/<- %edx 4/r32/esp + 1381 (tailor-exit-descriptor %edx 0x10) + 1382 # + 1383 (write _test-input-stream "fn foo -> _: int {\n") + 1384 (write _test-input-stream "}\n") + 1385 # convert + 1386 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1387 # registers except esp clobbered at this point + 1388 # restore ed + 1389 89/<- %edx 4/r32/esp + 1390 (flush _test-output-buffered-file) + 1391 (flush _test-error-buffered-file) + 1392 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1398 # check output + 1399 (check-stream-equal _test-output-stream "" "F - test-function-with-output-without-register: output should be empty") + 1400 (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") + 1401 # check that stop(1) was called + 1402 (check-ints-equal *(edx+4) 2 "F - test-function-with-output-without-register: exit status") + 1403 # don't restore from ebp + 1404 81 0/subop/add %esp 8/imm32 + 1405 # . epilogue + 1406 5d/pop-to-ebp + 1407 c3/return + 1408 + 1409 test-function-with-outputs-in-conflicting-registers: + 1410 # . prologue + 1411 55/push-ebp + 1412 89/<- %ebp 4/r32/esp + 1413 # setup + 1414 (clear-stream _test-input-stream) + 1415 (clear-stream $_test-input-buffered-file->buffer) + 1416 (clear-stream _test-output-stream) + 1417 (clear-stream $_test-output-buffered-file->buffer) + 1418 (clear-stream _test-error-stream) + 1419 (clear-stream $_test-error-buffered-file->buffer) + 1420 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1421 68/push 0/imm32 + 1422 68/push 0/imm32 + 1423 89/<- %edx 4/r32/esp + 1424 (tailor-exit-descriptor %edx 0x10) + 1425 # + 1426 (write _test-input-stream "fn foo -> _/eax: int, _/eax: int {\n") + 1427 (write _test-input-stream "}\n") + 1428 # convert + 1429 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1430 # registers except esp clobbered at this point + 1431 # restore ed + 1432 89/<- %edx 4/r32/esp + 1433 (flush _test-output-buffered-file) + 1434 (flush _test-error-buffered-file) + 1435 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1441 # check output + 1442 (check-stream-equal _test-output-stream "" "F - test-function-with-outputs-in-conflicting-registers: output should be empty") + 1443 (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") + 1444 # check that stop(1) was called + 1445 (check-ints-equal *(edx+4) 2 "F - test-function-with-outputs-in-conflicting-registers: exit status") + 1446 # don't restore from ebp + 1447 81 0/subop/add %esp 8/imm32 + 1448 # . epilogue + 1449 5d/pop-to-ebp + 1450 c3/return + 1451 + 1452 test-function-with-named-output: + 1453 # . prologue + 1454 55/push-ebp + 1455 89/<- %ebp 4/r32/esp + 1456 # setup + 1457 (clear-stream _test-input-stream) + 1458 (clear-stream $_test-input-buffered-file->buffer) + 1459 (clear-stream _test-output-stream) + 1460 (clear-stream $_test-output-buffered-file->buffer) + 1461 (clear-stream _test-error-stream) + 1462 (clear-stream $_test-error-buffered-file->buffer) + 1463 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) 1464 68/push 0/imm32 - 1465 89/<- %edx 4/r32/esp - 1466 (tailor-exit-descriptor %edx 0x10) - 1467 # - 1468 (write _test-input-stream "fn foo -> _/eax: int {\n") - 1469 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 1470 (write _test-input-stream " return x\n") + 1465 68/push 0/imm32 + 1466 89/<- %edx 4/r32/esp + 1467 (tailor-exit-descriptor %edx 0x10) + 1468 # + 1469 (write _test-input-stream "fn foo -> x/eax: int {\n") + 1470 (write _test-input-stream " return 0\n") 1471 (write _test-input-stream "}\n") 1472 # convert 1473 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) @@ -1438,19 +1438,19 @@ if ('onhashchange' in window) { 1476 89/<- %edx 4/r32/esp 1477 (flush _test-output-buffered-file) 1478 (flush _test-error-buffered-file) - 1479 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- + 1479 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ 1485 # check output - 1486 (check-stream-equal _test-output-stream "" "F - test-return-with-wrong-type: output should be empty") - 1487 (check-next-stream-line-equal _test-error-stream "fn foo: return: 'x' has the wrong type" "F - test-return-with-wrong-type: error message") + 1486 (check-stream-equal _test-output-stream "" "F - test-function-with-named-output: output should be empty") + 1487 (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") 1488 # check that stop(1) was called - 1489 (check-ints-equal *(edx+4) 2 "F - test-return-with-wrong-type: exit status") + 1489 (check-ints-equal *(edx+4) 2 "F - test-function-with-named-output: exit status") 1490 # don't restore from ebp 1491 81 0/subop/add %esp 8/imm32 1492 # . epilogue 1493 5d/pop-to-ebp 1494 c3/return 1495 - 1496 test-missing-return: + 1496 test-return-with-wrong-type: 1497 # . prologue 1498 55/push-ebp 1499 89/<- %ebp 4/r32/esp @@ -1469,46 +1469,46 @@ if ('onhashchange' in window) { 1512 # 1513 (write _test-input-stream "fn foo -> _/eax: int {\n") 1514 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 1515 (write _test-input-stream "}\n") - 1516 # convert - 1517 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1518 # registers except esp clobbered at this point - 1519 # restore ed - 1520 89/<- %edx 4/r32/esp - 1521 (flush _test-output-buffered-file) - 1522 (flush _test-error-buffered-file) - 1523 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 1529 # check output - 1530 (check-stream-equal _test-output-stream "" "F - test-missing-return: output should be empty") - 1531 (check-next-stream-line-equal _test-error-stream "fn foo: final statement should be a 'return'" "F - test-missing-return: error message") - 1532 # check that stop(1) was called - 1533 (check-ints-equal *(edx+4) 2 "F - test-missing-return: exit status") - 1534 # don't restore from ebp - 1535 81 0/subop/add %esp 8/imm32 - 1536 # . epilogue - 1537 5d/pop-to-ebp - 1538 c3/return - 1539 - 1540 test-early-exit-without-return: - 1541 # . prologue - 1542 55/push-ebp - 1543 89/<- %ebp 4/r32/esp - 1544 # setup - 1545 (clear-stream _test-input-stream) - 1546 (clear-stream $_test-input-buffered-file->buffer) - 1547 (clear-stream _test-output-stream) - 1548 (clear-stream $_test-output-buffered-file->buffer) - 1549 (clear-stream _test-error-stream) - 1550 (clear-stream $_test-error-buffered-file->buffer) - 1551 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1552 68/push 0/imm32 + 1515 (write _test-input-stream " return x\n") + 1516 (write _test-input-stream "}\n") + 1517 # convert + 1518 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1519 # registers except esp clobbered at this point + 1520 # restore ed + 1521 89/<- %edx 4/r32/esp + 1522 (flush _test-output-buffered-file) + 1523 (flush _test-error-buffered-file) + 1524 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1530 # check output + 1531 (check-stream-equal _test-output-stream "" "F - test-return-with-wrong-type: output should be empty") + 1532 (check-next-stream-line-equal _test-error-stream "fn foo: return: 'x' has the wrong type" "F - test-return-with-wrong-type: error message") + 1533 # check that stop(1) was called + 1534 (check-ints-equal *(edx+4) 2 "F - test-return-with-wrong-type: exit status") + 1535 # don't restore from ebp + 1536 81 0/subop/add %esp 8/imm32 + 1537 # . epilogue + 1538 5d/pop-to-ebp + 1539 c3/return + 1540 + 1541 test-missing-return: + 1542 # . prologue + 1543 55/push-ebp + 1544 89/<- %ebp 4/r32/esp + 1545 # setup + 1546 (clear-stream _test-input-stream) + 1547 (clear-stream $_test-input-buffered-file->buffer) + 1548 (clear-stream _test-output-stream) + 1549 (clear-stream $_test-output-buffered-file->buffer) + 1550 (clear-stream _test-error-stream) + 1551 (clear-stream $_test-error-buffered-file->buffer) + 1552 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) 1553 68/push 0/imm32 - 1554 89/<- %edx 4/r32/esp - 1555 (tailor-exit-descriptor %edx 0x10) - 1556 # - 1557 (write _test-input-stream "fn foo -> _/eax: int {\n") - 1558 (write _test-input-stream " break\n") - 1559 (write _test-input-stream " return 0\n") + 1554 68/push 0/imm32 + 1555 89/<- %edx 4/r32/esp + 1556 (tailor-exit-descriptor %edx 0x10) + 1557 # + 1558 (write _test-input-stream "fn foo -> _/eax: int {\n") + 1559 (write _test-input-stream " var x/eax: boolean <- copy 0\n") 1560 (write _test-input-stream "}\n") 1561 # convert 1562 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) @@ -1517,19 +1517,19 @@ if ('onhashchange' in window) { 1565 89/<- %edx 4/r32/esp 1566 (flush _test-output-buffered-file) 1567 (flush _test-error-buffered-file) - 1568 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- + 1568 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ 1574 # check output - 1575 (check-stream-equal _test-output-stream "" "F - test-early-exit-without-return: output should be empty") - 1576 (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") + 1575 (check-stream-equal _test-output-stream "" "F - test-missing-return: output should be empty") + 1576 (check-next-stream-line-equal _test-error-stream "fn foo: final statement should be a 'return'" "F - test-missing-return: error message") 1577 # check that stop(1) was called - 1578 (check-ints-equal *(edx+4) 2 "F - test-early-exit-without-return: exit status") + 1578 (check-ints-equal *(edx+4) 2 "F - test-missing-return: exit status") 1579 # don't restore from ebp 1580 81 0/subop/add %esp 8/imm32 1581 # . epilogue 1582 5d/pop-to-ebp 1583 c3/return 1584 - 1585 test-return-with-too-few-inouts: + 1585 test-missing-return-2: 1586 # . prologue 1587 55/push-ebp 1588 89/<- %ebp 4/r32/esp @@ -1547,46 +1547,46 @@ if ('onhashchange' in window) { 1600 (tailor-exit-descriptor %edx 0x10) 1601 # 1602 (write _test-input-stream "fn foo -> _/eax: int {\n") - 1603 (write _test-input-stream " return\n") - 1604 (write _test-input-stream "}\n") - 1605 # convert - 1606 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1607 # registers except esp clobbered at this point - 1608 # restore ed - 1609 89/<- %edx 4/r32/esp - 1610 (flush _test-output-buffered-file) - 1611 (flush _test-error-buffered-file) - 1612 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 1618 # check output - 1619 (check-stream-equal _test-output-stream "" "F - test-return-with-too-few-inouts: output should be empty") - 1620 (check-next-stream-line-equal _test-error-stream "fn foo: return: too few inouts" "F - test-return-with-too-few-inouts: error message") - 1621 # check that stop(1) was called - 1622 (check-ints-equal *(edx+4) 2 "F - test-return-with-too-few-inouts: exit status") - 1623 # don't restore from ebp - 1624 81 0/subop/add %esp 8/imm32 - 1625 # . epilogue - 1626 5d/pop-to-ebp - 1627 c3/return - 1628 - 1629 test-return-with-too-many-inouts: - 1630 # . prologue - 1631 55/push-ebp - 1632 89/<- %ebp 4/r32/esp - 1633 # setup - 1634 (clear-stream _test-input-stream) - 1635 (clear-stream $_test-input-buffered-file->buffer) - 1636 (clear-stream _test-output-stream) - 1637 (clear-stream $_test-output-buffered-file->buffer) - 1638 (clear-stream _test-error-stream) - 1639 (clear-stream $_test-error-buffered-file->buffer) - 1640 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1603 (write _test-input-stream "}\n") + 1604 # convert + 1605 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1606 # registers except esp clobbered at this point + 1607 # restore ed + 1608 89/<- %edx 4/r32/esp + 1609 (flush _test-output-buffered-file) + 1610 (flush _test-error-buffered-file) + 1611 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1617 # check output + 1618 (check-stream-equal _test-output-stream "" "F - test-missing-return-2: output should be empty") + 1619 (check-next-stream-line-equal _test-error-stream "fn foo: final statement should be a 'return'" "F - test-missing-return-2: error message") + 1620 # check that stop(1) was called + 1621 (check-ints-equal *(edx+4) 2 "F - test-missing-return-2: exit status") + 1622 # don't restore from ebp + 1623 81 0/subop/add %esp 8/imm32 + 1624 # . epilogue + 1625 5d/pop-to-ebp + 1626 c3/return + 1627 + 1628 test-early-exit-without-return: + 1629 # . prologue + 1630 55/push-ebp + 1631 89/<- %ebp 4/r32/esp + 1632 # setup + 1633 (clear-stream _test-input-stream) + 1634 (clear-stream $_test-input-buffered-file->buffer) + 1635 (clear-stream _test-output-stream) + 1636 (clear-stream $_test-output-buffered-file->buffer) + 1637 (clear-stream _test-error-stream) + 1638 (clear-stream $_test-error-buffered-file->buffer) + 1639 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1640 68/push 0/imm32 1641 68/push 0/imm32 - 1642 68/push 0/imm32 - 1643 89/<- %edx 4/r32/esp - 1644 (tailor-exit-descriptor %edx 0x10) - 1645 # - 1646 (write _test-input-stream "fn foo -> _/eax: int {\n") - 1647 (write _test-input-stream " return 0, 0\n") + 1642 89/<- %edx 4/r32/esp + 1643 (tailor-exit-descriptor %edx 0x10) + 1644 # + 1645 (write _test-input-stream "fn foo -> _/eax: int {\n") + 1646 (write _test-input-stream " break\n") + 1647 (write _test-input-stream " return 0\n") 1648 (write _test-input-stream "}\n") 1649 # convert 1650 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) @@ -1595,19 +1595,19 @@ if ('onhashchange' in window) { 1653 89/<- %edx 4/r32/esp 1654 (flush _test-output-buffered-file) 1655 (flush _test-error-buffered-file) - 1656 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- + 1656 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ 1662 # check output - 1663 (check-stream-equal _test-output-stream "" "F - test-return-with-too-many-inouts: output should be empty") - 1664 (check-next-stream-line-equal _test-error-stream "fn foo: return: too many inouts" "F - test-return-with-too-many-inouts: error message") + 1663 (check-stream-equal _test-output-stream "" "F - test-early-exit-without-return: output should be empty") + 1664 (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") 1665 # check that stop(1) was called - 1666 (check-ints-equal *(edx+4) 2 "F - test-return-with-too-many-inouts: exit status") + 1666 (check-ints-equal *(edx+4) 2 "F - test-early-exit-without-return: exit status") 1667 # don't restore from ebp 1668 81 0/subop/add %esp 8/imm32 1669 # . epilogue 1670 5d/pop-to-ebp 1671 c3/return 1672 - 1673 test-return-unavailable-value: + 1673 test-return-with-too-few-inouts: 1674 # . prologue 1675 55/push-ebp 1676 89/<- %ebp 4/r32/esp @@ -1624,232 +1624,232 @@ if ('onhashchange' in window) { 1687 89/<- %edx 4/r32/esp 1688 (tailor-exit-descriptor %edx 0x10) 1689 # - 1690 (write _test-input-stream "fn foo -> _/eax: int, _/ecx: int {\n") - 1691 (write _test-input-stream " var x/eax: int <- copy 0\n") - 1692 (write _test-input-stream " var y/ecx: int <- copy 0\n") - 1693 (write _test-input-stream " return y, x\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-return-unavailable-value: output should be empty") - 1710 (check-next-stream-line-equal _test-error-stream "fn foo: return: 'x' is no longer available" "F - test-return-unavailable-value: error message") - 1711 # check that stop(1) was called - 1712 (check-ints-equal *(edx+4) 2 "F - test-return-unavailable-value: exit status") - 1713 # don't restore from ebp - 1714 81 0/subop/add %esp 8/imm32 - 1715 # . epilogue - 1716 5d/pop-to-ebp - 1717 c3/return - 1718 - 1719 test-convert-return-with-duplicate-values: - 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 # - 1729 (write _test-input-stream "fn foo -> _/eax: int, _/ecx: int {\n") - 1730 (write _test-input-stream " var x/eax: int <- copy 0x34\n") - 1731 (write _test-input-stream " return x, x\n") - 1732 (write _test-input-stream "}\n") - 1733 # convert - 1734 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1735 (flush _test-output-buffered-file) - 1736 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 1742 # check output - 1743 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-return-with-duplicate-values/0") - 1744 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-return-with-duplicate-values/1") - 1745 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-return-with-duplicate-values/2") - 1746 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-return-with-duplicate-values/3") - 1747 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-return-with-duplicate-values/4") - 1748 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-return-with-duplicate-values/5") - 1749 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-return-with-duplicate-values/6") - 1750 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0x34/imm32" "F - test-convert-return-with-duplicate-values/7") - 1751 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-return-with-duplicate-values/8") - 1752 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000001/r32" "F - test-convert-return-with-duplicate-values/9") - 1753 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-return-with-duplicate-values/10") - 1754 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-return-with-duplicate-values/11") - 1755 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-return-with-duplicate-values/12") - 1756 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-return-with-duplicate-values/13") - 1757 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-return-with-duplicate-values/14") - 1758 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-return-with-duplicate-values/15") - 1759 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-return-with-duplicate-values/16") - 1760 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-return-with-duplicate-values/17") - 1761 # . epilogue - 1762 89/<- %esp 5/r32/ebp - 1763 5d/pop-to-ebp - 1764 c3/return - 1765 - 1766 test-convert-return-with-duplicate-values-2: - 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 foo -> _/eax: int, _/ecx: int {\n") - 1777 (write _test-input-stream " var x/ecx: int <- copy 0x34\n") - 1778 (write _test-input-stream " return x, x\n") - 1779 (write _test-input-stream "}\n") - 1780 # convert - 1781 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1782 (flush _test-output-buffered-file) - 1783 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 1789 # check output - 1790 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-return-with-duplicate-values-2/0") - 1791 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-return-with-duplicate-values-2/1") - 1792 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-return-with-duplicate-values-2/2") - 1793 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-return-with-duplicate-values-2/3") - 1794 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-return-with-duplicate-values-2/4") - 1795 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-return-with-duplicate-values-2/5") - 1796 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-return-with-duplicate-values-2/6") - 1797 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x34/imm32" "F - test-convert-return-with-duplicate-values-2/7") - 1798 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000000/r32" "F - test-convert-return-with-duplicate-values-2/8") - 1799 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000001/r32" "F - test-convert-return-with-duplicate-values-2/9") - 1800 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-return-with-duplicate-values-2/10") - 1801 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-return-with-duplicate-values-2/11") - 1802 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-return-with-duplicate-values-2/12") - 1803 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-return-with-duplicate-values-2/13") - 1804 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-return-with-duplicate-values-2/14") - 1805 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-return-with-duplicate-values-2/15") - 1806 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-return-with-duplicate-values-2/16") - 1807 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-return-with-duplicate-values-2/17") - 1808 # . epilogue - 1809 89/<- %esp 5/r32/ebp - 1810 5d/pop-to-ebp - 1811 c3/return - 1812 - 1813 test-stmt-with-unknown-var: - 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 (clear-stream _test-error-stream) - 1823 (clear-stream $_test-error-buffered-file->buffer) - 1824 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1825 68/push 0/imm32 - 1826 68/push 0/imm32 - 1827 89/<- %edx 4/r32/esp - 1828 (tailor-exit-descriptor %edx 0x10) - 1829 # - 1830 (write _test-input-stream "fn foo {\n") - 1831 (write _test-input-stream " x <- copy 0x34\n") - 1832 (write _test-input-stream "}\n") - 1833 # convert - 1834 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1835 # registers except esp clobbered at this point - 1836 # restore ed - 1837 89/<- %edx 4/r32/esp - 1838 (flush _test-output-buffered-file) - 1839 (flush _test-error-buffered-file) - 1840 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 1846 # check output - 1847 (check-stream-equal _test-output-stream "" "F - test-stmt-with-unknown-var: output should be empty") - 1848 (check-next-stream-line-equal _test-error-stream "fn foo: unknown variable 'x'" "F - test-stmt-with-unknown-var: error message") - 1849 # check that stop(1) was called - 1850 (check-ints-equal *(edx+4) 2 "F - test-stmt-with-unknown-var: exit status") - 1851 # don't restore from ebp - 1852 81 0/subop/add %esp 8/imm32 - 1853 # . epilogue - 1854 5d/pop-to-ebp - 1855 c3/return - 1856 - 1857 test-stmt-with-invalid-identifier: - 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 " 1 <- copy 0x34\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-stmt-with-invalid-identifier: output should be empty") - 1892 (check-next-stream-line-equal _test-error-stream "fn foo: invalid identifier '1'" "F - test-stmt-with-invalid-identifier: error message") - 1893 # check that stop(1) was called - 1894 (check-ints-equal *(edx+4) 2 "F - test-stmt-with-invalid-identifier: 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-stmt-with-deref-var: - 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 " *x <- copy 0x34\n") - 1920 (write _test-input-stream "}\n") - 1921 # convert - 1922 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1923 # registers except esp clobbered at this point - 1924 # restore ed - 1925 89/<- %edx 4/r32/esp - 1926 (flush _test-output-buffered-file) - 1927 (flush _test-error-buffered-file) - 1928 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 1934 # check output - 1935 (check-stream-equal _test-output-stream "" "F - test-stmt-with-deref-var: output should be empty") - 1936 (check-next-stream-line-equal _test-error-stream "fn foo: output '*x' should write to a register, and therefore cannot be dereferenced" "F - test-stmt-with-deref-var: error message") - 1937 # check that stop(1) was called - 1938 (check-ints-equal *(edx+4) 2 "F - test-stmt-with-deref-var: exit status") - 1939 # don't restore from ebp - 1940 81 0/subop/add %esp 8/imm32 - 1941 # . epilogue + 1690 (write _test-input-stream "fn foo -> _/eax: int {\n") + 1691 (write _test-input-stream " return\n") + 1692 (write _test-input-stream "}\n") + 1693 # convert + 1694 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1695 # registers except esp clobbered at this point + 1696 # restore ed + 1697 89/<- %edx 4/r32/esp + 1698 (flush _test-output-buffered-file) + 1699 (flush _test-error-buffered-file) + 1700 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1706 # check output + 1707 (check-stream-equal _test-output-stream "" "F - test-return-with-too-few-inouts: output should be empty") + 1708 (check-next-stream-line-equal _test-error-stream "fn foo: return: too few inouts" "F - test-return-with-too-few-inouts: error message") + 1709 # check that stop(1) was called + 1710 (check-ints-equal *(edx+4) 2 "F - test-return-with-too-few-inouts: exit status") + 1711 # don't restore from ebp + 1712 81 0/subop/add %esp 8/imm32 + 1713 # . epilogue + 1714 5d/pop-to-ebp + 1715 c3/return + 1716 + 1717 test-return-with-too-many-inouts: + 1718 # . prologue + 1719 55/push-ebp + 1720 89/<- %ebp 4/r32/esp + 1721 # setup + 1722 (clear-stream _test-input-stream) + 1723 (clear-stream $_test-input-buffered-file->buffer) + 1724 (clear-stream _test-output-stream) + 1725 (clear-stream $_test-output-buffered-file->buffer) + 1726 (clear-stream _test-error-stream) + 1727 (clear-stream $_test-error-buffered-file->buffer) + 1728 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1729 68/push 0/imm32 + 1730 68/push 0/imm32 + 1731 89/<- %edx 4/r32/esp + 1732 (tailor-exit-descriptor %edx 0x10) + 1733 # + 1734 (write _test-input-stream "fn foo -> _/eax: int {\n") + 1735 (write _test-input-stream " return 0, 0\n") + 1736 (write _test-input-stream "}\n") + 1737 # convert + 1738 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1739 # registers except esp clobbered at this point + 1740 # restore ed + 1741 89/<- %edx 4/r32/esp + 1742 (flush _test-output-buffered-file) + 1743 (flush _test-error-buffered-file) + 1744 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1750 # check output + 1751 (check-stream-equal _test-output-stream "" "F - test-return-with-too-many-inouts: output should be empty") + 1752 (check-next-stream-line-equal _test-error-stream "fn foo: return: too many inouts" "F - test-return-with-too-many-inouts: error message") + 1753 # check that stop(1) was called + 1754 (check-ints-equal *(edx+4) 2 "F - test-return-with-too-many-inouts: exit status") + 1755 # don't restore from ebp + 1756 81 0/subop/add %esp 8/imm32 + 1757 # . epilogue + 1758 5d/pop-to-ebp + 1759 c3/return + 1760 + 1761 test-return-unavailable-value: + 1762 # . prologue + 1763 55/push-ebp + 1764 89/<- %ebp 4/r32/esp + 1765 # setup + 1766 (clear-stream _test-input-stream) + 1767 (clear-stream $_test-input-buffered-file->buffer) + 1768 (clear-stream _test-output-stream) + 1769 (clear-stream $_test-output-buffered-file->buffer) + 1770 (clear-stream _test-error-stream) + 1771 (clear-stream $_test-error-buffered-file->buffer) + 1772 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1773 68/push 0/imm32 + 1774 68/push 0/imm32 + 1775 89/<- %edx 4/r32/esp + 1776 (tailor-exit-descriptor %edx 0x10) + 1777 # + 1778 (write _test-input-stream "fn foo -> _/eax: int, _/ecx: int {\n") + 1779 (write _test-input-stream " var x/eax: int <- copy 0\n") + 1780 (write _test-input-stream " var y/ecx: int <- copy 0\n") + 1781 (write _test-input-stream " return y, x\n") + 1782 (write _test-input-stream "}\n") + 1783 # convert + 1784 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1785 # registers except esp clobbered at this point + 1786 # restore ed + 1787 89/<- %edx 4/r32/esp + 1788 (flush _test-output-buffered-file) + 1789 (flush _test-error-buffered-file) + 1790 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1796 # check output + 1797 (check-stream-equal _test-output-stream "" "F - test-return-unavailable-value: output should be empty") + 1798 (check-next-stream-line-equal _test-error-stream "fn foo: return: 'x' is no longer available" "F - test-return-unavailable-value: error message") + 1799 # check that stop(1) was called + 1800 (check-ints-equal *(edx+4) 2 "F - test-return-unavailable-value: exit status") + 1801 # don't restore from ebp + 1802 81 0/subop/add %esp 8/imm32 + 1803 # . epilogue + 1804 5d/pop-to-ebp + 1805 c3/return + 1806 + 1807 test-return-literal-to-float: + 1808 # . prologue + 1809 55/push-ebp + 1810 89/<- %ebp 4/r32/esp + 1811 # setup + 1812 (clear-stream _test-input-stream) + 1813 (clear-stream $_test-input-buffered-file->buffer) + 1814 (clear-stream _test-output-stream) + 1815 (clear-stream $_test-output-buffered-file->buffer) + 1816 (clear-stream _test-error-stream) + 1817 (clear-stream $_test-error-buffered-file->buffer) + 1818 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1819 68/push 0/imm32 + 1820 68/push 0/imm32 + 1821 89/<- %edx 4/r32/esp + 1822 (tailor-exit-descriptor %edx 0x10) + 1823 # + 1824 (write _test-input-stream "fn foo -> _/xmm0: float {\n") + 1825 (write _test-input-stream " return 0\n") + 1826 (write _test-input-stream "}\n") + 1827 # convert + 1828 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1829 # registers except esp clobbered at this point + 1830 # restore ed + 1831 89/<- %edx 4/r32/esp + 1832 (flush _test-output-buffered-file) + 1833 (flush _test-error-buffered-file) + 1834 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1840 # check output + 1841 (check-stream-equal _test-output-stream "" "F - test-return-literal-to-float: output should be empty") + 1842 (check-next-stream-line-equal _test-error-stream "fn foo: return: cannot copy literal '0' to float" "F - test-return-literal-to-float: error message") + 1843 # check that stop(1) was called + 1844 (check-ints-equal *(edx+4) 2 "F - test-return-literal-to-float: exit status") + 1845 # don't restore from ebp + 1846 81 0/subop/add %esp 8/imm32 + 1847 # . epilogue + 1848 5d/pop-to-ebp + 1849 c3/return + 1850 + 1851 test-convert-return-with-duplicate-values: + 1852 # . prologue + 1853 55/push-ebp + 1854 89/<- %ebp 4/r32/esp + 1855 # setup + 1856 (clear-stream _test-input-stream) + 1857 (clear-stream $_test-input-buffered-file->buffer) + 1858 (clear-stream _test-output-stream) + 1859 (clear-stream $_test-output-buffered-file->buffer) + 1860 # + 1861 (write _test-input-stream "fn foo -> _/eax: int, _/ecx: int {\n") + 1862 (write _test-input-stream " var x/eax: int <- copy 0x34\n") + 1863 (write _test-input-stream " return x, x\n") + 1864 (write _test-input-stream "}\n") + 1865 # convert + 1866 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1867 (flush _test-output-buffered-file) + 1868 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1874 # check output + 1875 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-return-with-duplicate-values/0") + 1876 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-return-with-duplicate-values/1") + 1877 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-return-with-duplicate-values/2") + 1878 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-return-with-duplicate-values/3") + 1879 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-return-with-duplicate-values/4") + 1880 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-return-with-duplicate-values/5") + 1881 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-return-with-duplicate-values/6") + 1882 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0x34/imm32" "F - test-convert-return-with-duplicate-values/7") + 1883 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-return-with-duplicate-values/8") + 1884 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000001/r32" "F - test-convert-return-with-duplicate-values/9") + 1885 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-return-with-duplicate-values/10") + 1886 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-return-with-duplicate-values/11") + 1887 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-return-with-duplicate-values/12") + 1888 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-return-with-duplicate-values/13") + 1889 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-return-with-duplicate-values/14") + 1890 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-return-with-duplicate-values/15") + 1891 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-return-with-duplicate-values/16") + 1892 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-return-with-duplicate-values/17") + 1893 # . epilogue + 1894 89/<- %esp 5/r32/ebp + 1895 5d/pop-to-ebp + 1896 c3/return + 1897 + 1898 test-convert-return-with-duplicate-values-2: + 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 # + 1908 (write _test-input-stream "fn foo -> _/eax: int, _/ecx: int {\n") + 1909 (write _test-input-stream " var x/ecx: int <- copy 0x34\n") + 1910 (write _test-input-stream " return x, x\n") + 1911 (write _test-input-stream "}\n") + 1912 # convert + 1913 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1914 (flush _test-output-buffered-file) + 1915 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1921 # check output + 1922 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-return-with-duplicate-values-2/0") + 1923 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-return-with-duplicate-values-2/1") + 1924 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-return-with-duplicate-values-2/2") + 1925 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-return-with-duplicate-values-2/3") + 1926 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-return-with-duplicate-values-2/4") + 1927 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-return-with-duplicate-values-2/5") + 1928 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-return-with-duplicate-values-2/6") + 1929 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x34/imm32" "F - test-convert-return-with-duplicate-values-2/7") + 1930 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000000/r32" "F - test-convert-return-with-duplicate-values-2/8") + 1931 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000001/r32" "F - test-convert-return-with-duplicate-values-2/9") + 1932 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-return-with-duplicate-values-2/10") + 1933 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-return-with-duplicate-values-2/11") + 1934 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-return-with-duplicate-values-2/12") + 1935 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-return-with-duplicate-values-2/13") + 1936 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-return-with-duplicate-values-2/14") + 1937 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-return-with-duplicate-values-2/15") + 1938 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-return-with-duplicate-values-2/16") + 1939 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-return-with-duplicate-values-2/17") + 1940 # . epilogue + 1941 89/<- %esp 5/r32/ebp 1942 5d/pop-to-ebp 1943 c3/return 1944 - 1945 test-convert-function-with-literal-arg: + 1945 test-stmt-with-unknown-var: 1946 # . prologue 1947 55/push-ebp 1948 89/<- %ebp 4/r32/esp @@ -1858,1681 +1858,1681 @@ if ('onhashchange' in window) { 1951 (clear-stream $_test-input-buffered-file->buffer) 1952 (clear-stream _test-output-stream) 1953 (clear-stream $_test-output-buffered-file->buffer) - 1954 # - 1955 (write _test-input-stream "fn foo a: int, b: int -> _/eax: int {\n") - 1956 (write _test-input-stream " var result/eax: int <- copy a\n") - 1957 (write _test-input-stream " result <- add 1\n") - 1958 (write _test-input-stream " return result\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-literal-arg/0") - 1971 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg/1") - 1972 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg/2") - 1973 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg/3") - 1974 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg/4") - 1975 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg/5") - 1976 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-literal-arg/6") - 1977 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-with-literal-arg/7") - 1978 (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-with-literal-arg/8") - 1979 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-literal-arg/9") - 1980 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-literal-arg/10") - 1981 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-literal-arg/11") - 1982 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg/12") - 1983 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg/13") - 1984 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg/14") - 1985 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg/15") - 1986 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg/16") - 1987 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg/17") - 1988 # . epilogue - 1989 89/<- %esp 5/r32/ebp - 1990 5d/pop-to-ebp - 1991 c3/return - 1992 - 1993 test-convert-function-with-literal-arg-2: - 1994 # . prologue - 1995 55/push-ebp - 1996 89/<- %ebp 4/r32/esp - 1997 # setup - 1998 (clear-stream _test-input-stream) - 1999 (clear-stream $_test-input-buffered-file->buffer) - 2000 (clear-stream _test-output-stream) - 2001 (clear-stream $_test-output-buffered-file->buffer) - 2002 # - 2003 (write _test-input-stream "fn foo a: int, b: int -> _/ebx: int {\n") - 2004 (write _test-input-stream " var result/ebx: int <- copy a\n") - 2005 (write _test-input-stream " result <- add 1\n") - 2006 (write _test-input-stream " return result\n") - 2007 (write _test-input-stream "}\n") - 2008 # convert - 2009 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2010 (flush _test-output-buffered-file) - 2011 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 2017 # check output - 2018 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg-2/0") - 2019 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg-2/1") - 2020 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg-2/2") - 2021 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg-2/3") - 2022 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg-2/4") - 2023 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg-2/5") - 2024 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-with-literal-arg-2/6") - 2025 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/7") - 2026 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-with-literal-arg-2/8") - 2027 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/9") - 2028 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-literal-arg-2/10") - 2029 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-literal-arg-2/11") - 2030 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg-2/12") - 2031 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg-2/13") - 2032 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg-2/14") - 2033 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg-2/15") - 2034 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg-2/16") - 2035 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg-2/17") - 2036 # . epilogue - 2037 89/<- %esp 5/r32/ebp - 2038 5d/pop-to-ebp - 2039 c3/return - 2040 - 2041 test-convert-function-call-with-literal-arg: - 2042 # . prologue - 2043 55/push-ebp - 2044 89/<- %ebp 4/r32/esp - 2045 # setup - 2046 (clear-stream _test-input-stream) - 2047 (clear-stream $_test-input-buffered-file->buffer) - 2048 (clear-stream _test-output-stream) - 2049 (clear-stream $_test-output-buffered-file->buffer) - 2050 # - 2051 (write _test-input-stream "fn main -> _/ebx: int {\n") - 2052 (write _test-input-stream " var result/eax: int <- do-add 3 4\n") - 2053 (write _test-input-stream " return result\n") - 2054 (write _test-input-stream "}\n") - 2055 (write _test-input-stream "fn do-add a: int, b: int -> _/eax: int {\n") - 2056 (write _test-input-stream " var result/eax: int <- copy a\n") - 2057 (write _test-input-stream " result <- add b\n") - 2058 (write _test-input-stream " return result\n") - 2059 (write _test-input-stream "}\n") - 2060 # convert - 2061 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2062 (flush _test-output-buffered-file) - 2063 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 2069 # check output - 2070 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0") - 2071 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1") - 2072 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2") - 2073 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3") - 2074 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4") - 2075 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-literal-arg/5") - 2076 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/6") - 2077 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/7") - 2078 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") - 2079 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-local-var-in-reg/9") - 2080 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") - 2081 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/11") - 2082 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-literal-arg/12") - 2083 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/13") - 2084 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/14") - 2085 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/15") - 2086 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/16") - 2087 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/17") - 2088 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/18") - 2089 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/19") - 2090 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/20") - 2091 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/21") - 2092 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:loop:" "F - test-convert-function-call-with-literal-arg/22") - 2093 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/23") - 2094 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/24") - 2095 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/25") - 2096 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/26") - 2097 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") - 2098 (check-next-stream-line-equal _test-output-stream " e9/jump $do-add:0x00000002:break/disp32" "F - test-convert-function-call-with-literal-arg/28") - 2099 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/29") - 2100 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:break:" "F - test-convert-function-call-with-literal-arg/30") - 2101 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/31") - 2102 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/32") - 2103 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/33") - 2104 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/34") - 2105 # . epilogue - 2106 89/<- %esp 5/r32/ebp - 2107 5d/pop-to-ebp - 2108 c3/return - 2109 - 2110 test-convert-function-call-with-literal-string-arg: - 2111 # . prologue - 2112 55/push-ebp - 2113 89/<- %ebp 4/r32/esp - 2114 # setup - 2115 (clear-stream _test-input-stream) - 2116 (clear-stream $_test-input-buffered-file->buffer) - 2117 (clear-stream _test-output-stream) - 2118 (clear-stream $_test-output-buffered-file->buffer) - 2119 # - 2120 (write _test-input-stream "fn foo {\n") - 2121 (write _test-input-stream " string-func \"abc\"\n") - 2122 (write _test-input-stream "}\n") - 2123 (write _test-input-stream "sig string-func in: (addr array byte)\n") - 2124 # convert - 2125 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2126 # no errors - 2127 # not bothering checking output - 2128 # . epilogue - 2129 89/<- %esp 5/r32/ebp - 2130 5d/pop-to-ebp - 2131 c3/return - 2132 - 2133 test-convert-function-call-with-null-addr: - 2134 # . prologue - 2135 55/push-ebp - 2136 89/<- %ebp 4/r32/esp - 2137 # setup - 2138 (clear-stream _test-input-stream) - 2139 (clear-stream $_test-input-buffered-file->buffer) - 2140 (clear-stream _test-output-stream) - 2141 (clear-stream $_test-output-buffered-file->buffer) - 2142 # - 2143 (write _test-input-stream "fn foo {\n") - 2144 (write _test-input-stream " bar 0\n") - 2145 (write _test-input-stream "}\n") - 2146 (write _test-input-stream "sig bar in: (addr int)\n") - 2147 # convert - 2148 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2149 # no errors - 2150 # not bothering checking output - 2151 # . epilogue - 2152 89/<- %esp 5/r32/ebp - 2153 5d/pop-to-ebp - 2154 c3/return - 2155 - 2156 test-convert-function-call-with-signature: - 2157 # . prologue - 2158 55/push-ebp - 2159 89/<- %ebp 4/r32/esp - 2160 # setup - 2161 (clear-stream _test-input-stream) - 2162 (clear-stream $_test-input-buffered-file->buffer) - 2163 (clear-stream _test-output-stream) - 2164 (clear-stream $_test-output-buffered-file->buffer) - 2165 # - 2166 (write _test-input-stream "fn main -> _/ebx: int {\n") - 2167 (write _test-input-stream " var result/eax: int <- do-add 3 4\n") - 2168 (write _test-input-stream " return result\n") - 2169 (write _test-input-stream "}\n") - 2170 (write _test-input-stream "sig do-add a: int, b: int -> _/eax: int\n") - 2171 # convert - 2172 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2173 (flush _test-output-buffered-file) - 2174 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 2180 # check output - 2181 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-signature/0") - 2182 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-signature/1") - 2183 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-signature/2") - 2184 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-signature/3") - 2185 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-signature/4") - 2186 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-signature/5") - 2187 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/6") - 2188 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-signature/6") - 2189 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") - 2190 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-local-var-in-reg/9") - 2191 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") - 2192 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-signature/7") - 2193 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-signature/8") - 2194 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-signature/9") - 2195 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-signature/10") - 2196 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-signature/11") - 2197 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-signature/12") - 2198 # . epilogue - 2199 89/<- %esp 5/r32/ebp - 2200 5d/pop-to-ebp - 2201 c3/return - 2202 - 2203 test-convert-function-with-local-var-in-mem: - 2204 # . prologue - 2205 55/push-ebp - 2206 89/<- %ebp 4/r32/esp - 2207 # setup - 2208 (clear-stream _test-input-stream) - 2209 (clear-stream $_test-input-buffered-file->buffer) - 2210 (clear-stream _test-output-stream) - 2211 (clear-stream $_test-output-buffered-file->buffer) - 2212 # - 2213 (write _test-input-stream "fn foo {\n") - 2214 (write _test-input-stream " var x: int\n") - 2215 (write _test-input-stream " increment x\n") - 2216 (write _test-input-stream "}\n") - 2217 # convert - 2218 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2219 (flush _test-output-buffered-file) - 2220 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 2226 # check output - 2227 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0") - 2228 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1") - 2229 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2") - 2230 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3") - 2231 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4") - 2232 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem/5") - 2233 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/6") - 2234 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/7") - 2235 (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") - 2236 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/9") - 2237 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem/10") - 2238 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/11") - 2239 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/12") - 2240 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/13") - 2241 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/14") - 2242 # . epilogue - 2243 89/<- %esp 5/r32/ebp - 2244 5d/pop-to-ebp - 2245 c3/return - 2246 - 2247 test-convert-invalid-literal: - 2248 # . prologue - 2249 55/push-ebp - 2250 89/<- %ebp 4/r32/esp - 2251 # setup - 2252 (clear-stream _test-input-stream) - 2253 (clear-stream $_test-input-buffered-file->buffer) - 2254 (clear-stream _test-output-stream) - 2255 (clear-stream $_test-output-buffered-file->buffer) - 2256 (clear-stream _test-error-stream) - 2257 (clear-stream $_test-error-buffered-file->buffer) - 2258 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2259 68/push 0/imm32 - 2260 68/push 0/imm32 - 2261 89/<- %edx 4/r32/esp - 2262 (tailor-exit-descriptor %edx 0x10) - 2263 # - 2264 (write _test-input-stream "fn foo {\n") - 2265 (write _test-input-stream " increment 1n\n") - 2266 (write _test-input-stream "}\n") - 2267 # convert - 2268 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2269 # registers except esp clobbered at this point - 2270 # restore ed - 2271 89/<- %edx 4/r32/esp - 2272 (flush _test-output-buffered-file) - 2273 (flush _test-error-buffered-file) - 2274 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 2280 # check output - 2281 (check-stream-equal _test-output-stream "" "F - test-convert-invalid-literal: output should be empty") - 2282 (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") - 2283 # check that stop(1) was called - 2284 (check-ints-equal *(edx+4) 2 "F - test-convert-invalid-literal: exit status") - 2285 # don't restore from ebp - 2286 81 0/subop/add %esp 8/imm32 - 2287 # . epilogue - 2288 5d/pop-to-ebp - 2289 c3/return - 2290 - 2291 test-local-var-in-mem-has-no-initializer: - 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 foo {\n") - 2309 (write _test-input-stream " var x: int <- copy 0\n") - 2310 (write _test-input-stream " increment x\n") - 2311 (write _test-input-stream "}\n") - 2312 # convert - 2313 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2314 # registers except esp clobbered at this point - 2315 # restore ed - 2316 89/<- %edx 4/r32/esp - 2317 (flush _test-output-buffered-file) - 2318 (flush _test-error-buffered-file) - 2319 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 2325 # check output - 2326 (check-stream-equal _test-output-stream "" "F - test-var-in-mem-has-no-initializer: output should be empty") - 2327 (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") - 2328 # check that stop(1) was called - 2329 (check-ints-equal *(edx+4) 2 "F - test-var-in-mem-has-no-initializer: exit status") - 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-with-local-var-with-compound-type-in-mem: - 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 # - 2346 (write _test-input-stream "fn foo {\n") - 2347 (write _test-input-stream " var x: (addr int)\n") - 2348 (write _test-input-stream " copy-to x, 0\n") - 2349 (write _test-input-stream "}\n") - 2350 # convert - 2351 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2352 (flush _test-output-buffered-file) - 2353 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 2359 # check output - 2360 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/0") - 2361 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/1") - 2362 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/2") - 2363 (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") - 2364 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-compound-type-in-mem/4") - 2365 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/5") - 2366 (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") - 2367 (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") - 2368 (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") - 2369 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-compound-type-in-mem/9") - 2370 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/10") - 2371 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/11") - 2372 (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") - 2373 (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") - 2374 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-compound-type-in-mem/14") - 2375 # . epilogue - 2376 89/<- %esp 5/r32/ebp - 2377 5d/pop-to-ebp - 2378 c3/return - 2379 - 2380 test-convert-function-with-local-var-in-reg: - 2381 # . prologue - 2382 55/push-ebp - 2383 89/<- %ebp 4/r32/esp - 2384 # setup - 2385 (clear-stream _test-input-stream) - 2386 (clear-stream $_test-input-buffered-file->buffer) - 2387 (clear-stream _test-output-stream) - 2388 (clear-stream $_test-output-buffered-file->buffer) - 2389 # - 2390 (write _test-input-stream "fn foo {\n") - 2391 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 2392 (write _test-input-stream " x <- increment\n") - 2393 (write _test-input-stream "}\n") - 2394 # convert - 2395 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2396 (flush _test-output-buffered-file) - 2397 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 2403 # check output - 2404 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0") - 2405 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1") - 2406 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2") - 2407 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3") - 2408 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4") - 2409 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-reg/5") - 2410 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/6") - 2411 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/7") - 2412 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/8") - 2413 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/9") - 2414 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/10") - 2415 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-reg/11") - 2416 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/12") - 2417 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/13") - 2418 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/14") - 2419 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/15") - 2420 # . epilogue - 2421 89/<- %esp 5/r32/ebp - 2422 5d/pop-to-ebp - 2423 c3/return - 2424 - 2425 test-float-var-in-wrong-register: - 2426 # . prologue - 2427 55/push-ebp - 2428 89/<- %ebp 4/r32/esp - 2429 # setup - 2430 (clear-stream _test-input-stream) - 2431 (clear-stream $_test-input-buffered-file->buffer) - 2432 (clear-stream _test-output-stream) - 2433 (clear-stream $_test-output-buffered-file->buffer) - 2434 (clear-stream _test-error-stream) - 2435 (clear-stream $_test-error-buffered-file->buffer) - 2436 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2437 68/push 0/imm32 - 2438 68/push 0/imm32 - 2439 89/<- %edx 4/r32/esp - 2440 (tailor-exit-descriptor %edx 0x10) - 2441 # - 2442 (write _test-input-stream "fn foo {\n") - 2443 (write _test-input-stream " var x/eax: int <- copy 0\n") - 2444 (write _test-input-stream " var y/eax: float <- convert x\n") - 2445 (write _test-input-stream "}\n") - 2446 # convert - 2447 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2448 # registers except esp clobbered at this point - 2449 # restore ed - 2450 89/<- %edx 4/r32/esp - 2451 (flush _test-output-buffered-file) - 2452 (flush _test-error-buffered-file) - 2453 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 2459 # check output - 2460 (check-stream-equal _test-output-stream "" "F - test-float-var-in-wrong-register: output should be empty") - 2461 (check-next-stream-line-equal _test-error-stream "fn foo: float var 'y' should be in a floating-point register" "F - test-float-var-in-wrong-register: error message") - 2462 # check that stop(1) was called - 2463 (check-ints-equal *(edx+4) 2 "F - test-float-var-in-wrong-register: exit status") - 2464 # don't restore from ebp - 2465 81 0/subop/add %esp 8/imm32 - 2466 # . epilogue - 2467 5d/pop-to-ebp - 2468 c3/return - 2469 - 2470 test-non-float-var-in-wrong-register: - 2471 # . prologue - 2472 55/push-ebp - 2473 89/<- %ebp 4/r32/esp - 2474 # setup - 2475 (clear-stream _test-input-stream) - 2476 (clear-stream $_test-input-buffered-file->buffer) - 2477 (clear-stream _test-output-stream) - 2478 (clear-stream $_test-output-buffered-file->buffer) - 2479 (clear-stream _test-error-stream) - 2480 (clear-stream $_test-error-buffered-file->buffer) - 2481 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2482 68/push 0/imm32 - 2483 68/push 0/imm32 - 2484 89/<- %edx 4/r32/esp - 2485 (tailor-exit-descriptor %edx 0x10) - 2486 # - 2487 (write _test-input-stream "fn foo {\n") - 2488 (write _test-input-stream " var x/xmm5: int <- copy 0\n") - 2489 (write _test-input-stream "}\n") - 2490 # convert - 2491 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2492 # registers except esp clobbered at this point - 2493 # restore ed - 2494 89/<- %edx 4/r32/esp - 2495 (flush _test-output-buffered-file) - 2496 (flush _test-error-buffered-file) - 2497 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 2503 # check output - 2504 (check-stream-equal _test-output-stream "" "F - test-non-float-var-in-wrong-register: output should be empty") - 2505 (check-next-stream-line-equal _test-error-stream "fn foo: non-float var 'x' should be in an integer register" "F - test-non-float-var-in-wrong-register: error message") - 2506 # check that stop(1) was called - 2507 (check-ints-equal *(edx+4) 2 "F - test-non-float-var-in-wrong-register: exit status") - 2508 # don't restore from ebp - 2509 81 0/subop/add %esp 8/imm32 - 2510 # . epilogue - 2511 5d/pop-to-ebp - 2512 c3/return - 2513 - 2514 test-convert-function-with-allocate: - 2515 # . prologue - 2516 55/push-ebp - 2517 89/<- %ebp 4/r32/esp - 2518 # setup - 2519 (clear-stream _test-input-stream) - 2520 (clear-stream $_test-input-buffered-file->buffer) - 2521 (clear-stream _test-output-stream) - 2522 (clear-stream $_test-output-buffered-file->buffer) - 2523 # - 2524 (write _test-input-stream "fn foo {\n") - 2525 (write _test-input-stream " var x/ecx: (addr handle int) <- copy 0\n") - 2526 (write _test-input-stream " allocate x\n") - 2527 (write _test-input-stream "}\n") - 2528 # convert - 2529 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2530 (flush _test-output-buffered-file) - 2531 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 2537 # check output - 2538 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-allocate/0") - 2539 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-allocate/1") - 2540 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-allocate/2") - 2541 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-allocate/3") - 2542 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-allocate/4") - 2543 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-allocate/5") - 2544 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-allocate/6") - 2545 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-allocate/7") - 2546 (check-next-stream-line-equal _test-output-stream " (allocate Heap 0x00000004 %ecx)" "F - test-convert-function-with-allocate/8") # 4 = size-of(int) - 2547 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-allocate/9") - 2548 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-allocate/10") - 2549 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-allocate/11") - 2550 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-allocate/12") - 2551 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-allocate/13") - 2552 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-allocate/14") - 2553 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-allocate/15") - 2554 # . epilogue - 2555 89/<- %esp 5/r32/ebp - 2556 5d/pop-to-ebp - 2557 c3/return - 2558 - 2559 test-initializer-in-hex: - 2560 # . prologue - 2561 55/push-ebp - 2562 89/<- %ebp 4/r32/esp - 2563 # setup - 2564 (clear-stream _test-input-stream) - 2565 (clear-stream $_test-input-buffered-file->buffer) - 2566 (clear-stream _test-output-stream) - 2567 (clear-stream $_test-output-buffered-file->buffer) - 2568 (clear-stream _test-error-stream) - 2569 (clear-stream $_test-error-buffered-file->buffer) - 2570 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2571 68/push 0/imm32 - 2572 68/push 0/imm32 - 2573 89/<- %edx 4/r32/esp - 2574 (tailor-exit-descriptor %edx 0x10) - 2575 # - 2576 (write _test-input-stream "fn foo {\n") - 2577 (write _test-input-stream " var x/ecx: int <- copy 10\n") - 2578 (write _test-input-stream "}\n") - 2579 # convert - 2580 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2581 # registers except esp clobbered at this point - 2582 # restore ed - 2583 89/<- %edx 4/r32/esp - 2584 (flush _test-output-buffered-file) - 2585 (flush _test-error-buffered-file) - 2586 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 2592 # check output - 2593 (check-stream-equal _test-output-stream "" "F - test-initializer-in-hex: output should be empty") - 2594 (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") - 2595 # check that stop(1) was called - 2596 (check-ints-equal *(edx+4) 2 "F - test-initializer-in-hex: exit status") - 2597 # don't restore from ebp - 2598 81 0/subop/add %esp 8/imm32 - 2599 # . epilogue - 2600 5d/pop-to-ebp - 2601 c3/return - 2602 - 2603 test-convert-function-with-second-local-var-in-same-reg: - 2604 # . prologue - 2605 55/push-ebp - 2606 89/<- %ebp 4/r32/esp - 2607 # setup - 2608 (clear-stream _test-input-stream) - 2609 (clear-stream $_test-input-buffered-file->buffer) - 2610 (clear-stream _test-output-stream) - 2611 (clear-stream $_test-output-buffered-file->buffer) - 2612 # - 2613 (write _test-input-stream "fn foo {\n") - 2614 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 2615 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 2616 (write _test-input-stream " y <- increment\n") - 2617 (write _test-input-stream "}\n") - 2618 # convert - 2619 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2620 (flush _test-output-buffered-file) - 2621 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 2627 # check output - 2628 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-second-local-var-in-same-reg/0") - 2629 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-second-local-var-in-same-reg/1") - 2630 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/2") - 2631 (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") - 2632 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-second-local-var-in-same-reg/4") - 2633 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-second-local-var-in-same-reg/5") - 2634 (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") - 2635 (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") - 2636 (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") - 2637 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-second-local-var-in-same-reg/9") - 2638 (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") - 2639 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-second-local-var-in-same-reg/11") - 2640 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-second-local-var-in-same-reg/12") - 2641 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-second-local-var-in-same-reg/13") - 2642 (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") - 2643 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/15") - 2644 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-second-local-var-in-same-reg/16") - 2645 # . epilogue - 2646 89/<- %esp 5/r32/ebp - 2647 5d/pop-to-ebp - 2648 c3/return - 2649 - 2650 test-read-clobbered-reg-var: - 2651 # . prologue - 2652 55/push-ebp - 2653 89/<- %ebp 4/r32/esp - 2654 # setup - 2655 (clear-stream _test-input-stream) - 2656 (clear-stream $_test-input-buffered-file->buffer) - 2657 (clear-stream _test-output-stream) - 2658 (clear-stream $_test-output-buffered-file->buffer) - 2659 (clear-stream _test-error-stream) - 2660 (clear-stream $_test-error-buffered-file->buffer) - 2661 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu - 2662 68/push 0/imm32 - 2663 68/push 0/imm32 - 2664 89/<- %edx 4/r32/esp - 2665 (tailor-exit-descriptor %edx 0x10) - 2666 # - 2667 (write _test-input-stream "fn foo {\n") - 2668 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 2669 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 2670 (write _test-input-stream " x <- increment\n") - 2671 (write _test-input-stream "}\n") - 2672 # convert - 2673 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2674 # registers except esp clobbered at this point - 2675 # restore ed - 2676 89/<- %edx 4/r32/esp - 2677 (flush _test-output-buffered-file) - 2678 (flush _test-error-buffered-file) - 2679 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 2685 # check output - 2686 (check-stream-equal _test-output-stream "" "F - test-read-clobbered-reg-var: output should be empty") - 2687 (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") - 2688 # check that stop(1) was called - 2689 (check-ints-equal *(edx+4) 2 "F - test-read-clobbered-reg-var: exit status") - 2690 # don't restore from ebp - 2691 81 0/subop/add %esp 8/imm32 - 2692 # . epilogue - 2693 5d/pop-to-ebp - 2694 c3/return - 2695 - 2696 test-overlapping-int-fp-registers: - 2697 # . prologue - 2698 55/push-ebp - 2699 89/<- %ebp 4/r32/esp - 2700 # setup - 2701 (clear-stream _test-input-stream) - 2702 (clear-stream $_test-input-buffered-file->buffer) - 2703 (clear-stream _test-output-stream) - 2704 (clear-stream $_test-output-buffered-file->buffer) - 2705 (clear-stream _test-error-stream) - 2706 (clear-stream $_test-error-buffered-file->buffer) - 2707 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu - 2708 68/push 0/imm32 - 2709 68/push 0/imm32 - 2710 89/<- %edx 4/r32/esp - 2711 (tailor-exit-descriptor %edx 0x10) - 2712 # - 2713 (write _test-input-stream "fn foo {\n") - 2714 (write _test-input-stream " var x/eax: int <- copy 3\n") - 2715 (write _test-input-stream " var y/xmm0: float <- convert x\n") - 2716 (write _test-input-stream " x <- increment\n") - 2717 (write _test-input-stream "}\n") - 2718 # convert - 2719 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2720 # registers except esp clobbered at this point - 2721 # restore ed - 2722 89/<- %edx 4/r32/esp - 2723 (flush _test-output-buffered-file) - 2724 (flush _test-error-buffered-file) - 2725 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 2731 # no errors - 2732 (check-next-stream-line-equal _test-error-stream "" "F - test-overlapping-int-fp-registers: error message") - 2733 # don't bother checking the generated code - 2734 # don't restore from ebp - 2735 81 0/subop/add %esp 8/imm32 - 2736 # . epilogue - 2737 5d/pop-to-ebp - 2738 c3/return - 2739 - 2740 test-convert-function-call: - 2741 # . prologue - 2742 55/push-ebp - 2743 89/<- %ebp 4/r32/esp - 2744 # setup - 2745 (clear-stream _test-input-stream) - 2746 (clear-stream $_test-input-buffered-file->buffer) - 2747 (clear-stream _test-output-stream) - 2748 (clear-stream $_test-output-buffered-file->buffer) - 2749 # - 2750 (write _test-input-stream "fn main -> _/ebx: int {\n") - 2751 (write _test-input-stream " var result/ebx: int <- foo\n") - 2752 (write _test-input-stream " return result\n") - 2753 (write _test-input-stream "}\n") - 2754 (write _test-input-stream "fn foo -> _/ebx: int {\n") - 2755 (write _test-input-stream " var result/ebx: int <- copy 3\n") - 2756 (write _test-input-stream " return result\n") - 2757 (write _test-input-stream "}\n") - 2758 # convert - 2759 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2760 (flush _test-output-buffered-file) - 2761 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 2767 # check output - 2768 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call/0") - 2769 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call/1") - 2770 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call/2") - 2771 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call/3") - 2772 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call/4") - 2773 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call/5") - 2774 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-call-with-literal-arg/6") - 2775 (check-next-stream-line-equal _test-output-stream " (foo)" "F - test-convert-function-call/6") - 2776 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") - 2777 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") - 2778 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") - 2779 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call/7") - 2780 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call/8") - 2781 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call/9") - 2782 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call/10") - 2783 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call/11") - 2784 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call/12") - 2785 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call/13") - 2786 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call/14") - 2787 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call/15") - 2788 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call/16") - 2789 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call/17") - 2790 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-call/18") - 2791 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-call-with-literal-arg/6") - 2792 (check-next-stream-line-equal _test-output-stream " bb/copy-to-ebx 3/imm32" "F - test-convert-function-call/19") - 2793 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") - 2794 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") - 2795 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-call-with-literal-arg/10") - 2796 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call/20") - 2797 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-call/21") - 2798 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call/22") - 2799 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call/23") - 2800 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call/24") - 2801 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call/25") - 2802 # . epilogue - 2803 89/<- %esp 5/r32/ebp - 2804 5d/pop-to-ebp - 2805 c3/return - 2806 - 2807 test-convert-function-call-with-inout-with-compound-type: - 2808 # . prologue - 2809 55/push-ebp - 2810 89/<- %ebp 4/r32/esp - 2811 # setup - 2812 (clear-stream _test-input-stream) - 2813 (clear-stream $_test-input-buffered-file->buffer) - 2814 (clear-stream _test-output-stream) - 2815 (clear-stream $_test-output-buffered-file->buffer) - 2816 # - 2817 (write _test-input-stream "fn f {\n") - 2818 (write _test-input-stream " var x: (addr int)\n") - 2819 (write _test-input-stream " g x\n") - 2820 (write _test-input-stream "}\n") - 2821 (write _test-input-stream "fn g a: (addr int) {\n") - 2822 (write _test-input-stream "}\n") - 2823 # convert - 2824 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2825 (flush _test-output-buffered-file) - 2826 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 2832 # check output - 2833 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-inout-with-compound-type/0") - 2834 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-inout-with-compound-type/1") - 2835 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-inout-with-compound-type/2") - 2836 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-inout-with-compound-type/3") - 2837 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-inout-with-compound-type/4") - 2838 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-inout-with-compound-type/5") - 2839 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-inout-with-compound-type/6") - 2840 (check-next-stream-line-equal _test-output-stream " (g *(ebp+0xfffffffc))" "F - test-convert-function-call-with-inout-with-compound-type/7") - 2841 (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") - 2842 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-inout-with-compound-type/9") - 2843 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-inout-with-compound-type/10") - 2844 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-inout-with-compound-type/11") - 2845 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-inout-with-compound-type/12") - 2846 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-inout-with-compound-type/13") - 2847 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-inout-with-compound-type/14") - 2848 (check-next-stream-line-equal _test-output-stream "g:" "F - test-convert-function-call-with-inout-with-compound-type/15") - 2849 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-inout-with-compound-type/16") - 2850 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-inout-with-compound-type/17") - 2851 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-inout-with-compound-type/18") - 2852 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-inout-with-compound-type/19") - 2853 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-inout-with-compound-type/20") - 2854 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-inout-with-compound-type/21") - 2855 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-inout-with-compound-type/22") - 2856 # . epilogue - 2857 89/<- %esp 5/r32/ebp - 2858 5d/pop-to-ebp - 2859 c3/return - 2860 - 2861 test-convert-function-call-with-inout-with-type-parameter: - 2862 # . prologue - 2863 55/push-ebp - 2864 89/<- %ebp 4/r32/esp - 2865 # setup - 2866 (clear-stream _test-input-stream) - 2867 (clear-stream $_test-input-buffered-file->buffer) - 2868 (clear-stream _test-output-stream) - 2869 (clear-stream $_test-output-buffered-file->buffer) - 2870 (clear-stream _test-error-stream) - 2871 (clear-stream $_test-error-buffered-file->buffer) - 2872 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2873 68/push 0/imm32 - 2874 68/push 0/imm32 - 2875 89/<- %edx 4/r32/esp - 2876 (tailor-exit-descriptor %edx 0x10) - 2877 # - 2878 (write _test-input-stream "fn f {\n") - 2879 (write _test-input-stream " var x: (addr int)\n") - 2880 (write _test-input-stream " g x\n") - 2881 (write _test-input-stream "}\n") - 2882 (write _test-input-stream "fn g a: (addr _) {\n") - 2883 (write _test-input-stream "}\n") - 2884 # convert - 2885 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2886 # registers except esp clobbered at this point - 2887 # restore ed - 2888 89/<- %edx 4/r32/esp - 2889 (flush _test-output-buffered-file) - 2890 (flush _test-error-buffered-file) - 2891 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 2897 # no error; types matched - 2898 (check-stream-equal _test-error-stream "" "F - test-convert-function-call-with-inout-with-type-parameter: error stream should be empty") - 2899 # don't bother checking the generated code; that's in the test 'test-local-clobbered-by-fn-output' below - 2900 # don't restore from ebp - 2901 81 0/subop/add %esp 8/imm32 - 2902 # . epilogue - 2903 5d/pop-to-ebp - 2904 c3/return - 2905 - 2906 test-convert-function-call-with-incorrect-inout-type: - 2907 # . prologue - 2908 55/push-ebp - 2909 89/<- %ebp 4/r32/esp - 2910 # setup - 2911 (clear-stream _test-input-stream) - 2912 (clear-stream $_test-input-buffered-file->buffer) - 2913 (clear-stream _test-output-stream) - 2914 (clear-stream $_test-output-buffered-file->buffer) - 2915 (clear-stream _test-error-stream) - 2916 (clear-stream $_test-error-buffered-file->buffer) - 2917 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2918 68/push 0/imm32 - 2919 68/push 0/imm32 - 2920 89/<- %edx 4/r32/esp - 2921 (tailor-exit-descriptor %edx 0x10) - 2922 # - 2923 (write _test-input-stream "fn f {\n") - 2924 (write _test-input-stream " var x: int\n") - 2925 (write _test-input-stream " g x\n") - 2926 (write _test-input-stream "}\n") - 2927 (write _test-input-stream "fn g a: foo {\n") - 2928 (write _test-input-stream "}\n") - 2929 # convert - 2930 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2931 # registers except esp clobbered at this point - 2932 # restore ed - 2933 89/<- %edx 4/r32/esp - 2934 (flush _test-output-buffered-file) - 2935 (flush _test-error-buffered-file) - 2936 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 2942 # check output - 2943 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-inout-type: output should be empty") - 2944 (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") - 2945 # check that stop(1) was called - 2946 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-inout-type: exit status") - 2947 # don't restore from ebp - 2948 81 0/subop/add %esp 8/imm32 - 2949 5d/pop-to-ebp - 2950 c3/return - 2951 - 2952 test-convert-function-call-with-inout-with-incorrect-compound-type: - 2953 # . prologue - 2954 55/push-ebp - 2955 89/<- %ebp 4/r32/esp - 2956 # setup - 2957 (clear-stream _test-input-stream) - 2958 (clear-stream $_test-input-buffered-file->buffer) - 2959 (clear-stream _test-output-stream) - 2960 (clear-stream $_test-output-buffered-file->buffer) - 2961 (clear-stream _test-error-stream) - 2962 (clear-stream $_test-error-buffered-file->buffer) - 2963 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2964 68/push 0/imm32 - 2965 68/push 0/imm32 - 2966 89/<- %edx 4/r32/esp - 2967 (tailor-exit-descriptor %edx 0x10) - 2968 # - 2969 (write _test-input-stream "fn f {\n") - 2970 (write _test-input-stream " var x: (addr int)\n") - 2971 (write _test-input-stream " g x\n") - 2972 (write _test-input-stream "}\n") - 2973 (write _test-input-stream "fn g a: (addr bool) {\n") - 2974 (write _test-input-stream "}\n") - 2975 # convert - 2976 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2977 # registers except esp clobbered at this point - 2978 # restore ed - 2979 89/<- %edx 4/r32/esp - 2980 (flush _test-output-buffered-file) - 2981 (flush _test-error-buffered-file) - 2982 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 2988 # check output - 2989 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-inout-with-incorrect-compound-type: output should be empty") - 2990 (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") - 2991 # don't restore from ebp - 2992 81 0/subop/add %esp 8/imm32 - 2993 # . epilogue - 2994 5d/pop-to-ebp - 2995 c3/return - 2996 - 2997 test-convert-function-call-with-inout-with-multiple-type-parameters: - 2998 # . prologue - 2999 55/push-ebp - 3000 89/<- %ebp 4/r32/esp - 3001 # setup - 3002 (clear-stream _test-input-stream) - 3003 (clear-stream $_test-input-buffered-file->buffer) - 3004 (clear-stream _test-output-stream) - 3005 (clear-stream $_test-output-buffered-file->buffer) - 3006 (clear-stream _test-error-stream) - 3007 (clear-stream $_test-error-buffered-file->buffer) - 3008 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3009 68/push 0/imm32 - 3010 68/push 0/imm32 - 3011 89/<- %edx 4/r32/esp - 3012 (tailor-exit-descriptor %edx 0x10) - 3013 # - 3014 (write _test-input-stream "fn f {\n") - 3015 (write _test-input-stream " var x: (addr int)\n") - 3016 (write _test-input-stream " var y: (addr int)\n") - 3017 (write _test-input-stream " g x, y\n") - 3018 (write _test-input-stream "}\n") - 3019 (write _test-input-stream "fn g a: (addr _), b: (addr _) {\n") - 3020 (write _test-input-stream "}\n") - 3021 # convert - 3022 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3023 # registers except esp clobbered at this point - 3024 # restore ed - 3025 89/<- %edx 4/r32/esp - 3026 (flush _test-output-buffered-file) - 3027 (flush _test-error-buffered-file) - 3028 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3034 # no errors - 3035 (check-stream-equal _test-error-stream "" "F - test-convert-function-call-with-inout-with-multiple-type-parameters: error stream should be empty") - 3036 # don't bother checking the generated code - 3037 # don't restore from ebp - 3038 81 0/subop/add %esp 8/imm32 - 3039 # . epilogue - 3040 5d/pop-to-ebp - 3041 c3/return - 3042 - 3043 test-type-parameter-matches-rest-of-type: - 3044 # . prologue - 3045 55/push-ebp - 3046 89/<- %ebp 4/r32/esp - 3047 # setup - 3048 (clear-stream _test-input-stream) - 3049 (clear-stream $_test-input-buffered-file->buffer) - 3050 (clear-stream _test-output-stream) - 3051 (clear-stream $_test-output-buffered-file->buffer) - 3052 (clear-stream _test-error-stream) - 3053 (clear-stream $_test-error-buffered-file->buffer) - 3054 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3055 68/push 0/imm32 - 3056 68/push 0/imm32 - 3057 89/<- %edx 4/r32/esp - 3058 (tailor-exit-descriptor %edx 0x10) - 3059 # - 3060 (write _test-input-stream "fn f {\n") - 3061 (write _test-input-stream " var x: (addr array int)\n") - 3062 (write _test-input-stream " g x\n") - 3063 (write _test-input-stream "}\n") - 3064 (write _test-input-stream "fn g a: (addr _) {\n") - 3065 (write _test-input-stream "}\n") - 3066 # convert - 3067 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3068 # registers except esp clobbered at this point - 3069 # restore ed - 3070 89/<- %edx 4/r32/esp - 3071 (flush _test-output-buffered-file) - 3072 (flush _test-error-buffered-file) - 3073 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3079 # no errors - 3080 (check-stream-equal _test-error-stream "" "F - test-type-parameter-matches-rest-of-type: error stream should be empty") - 3081 # don't bother checking the generated code - 3082 # don't restore from ebp - 3083 81 0/subop/add %esp 8/imm32 - 3084 # . epilogue - 3085 5d/pop-to-ebp - 3086 c3/return - 3087 - 3088 test-convert-function-call-with-inout-with-incompatible-type-parameters: - 3089 # . prologue - 3090 55/push-ebp - 3091 89/<- %ebp 4/r32/esp - 3092 # setup - 3093 (clear-stream _test-input-stream) - 3094 (clear-stream $_test-input-buffered-file->buffer) - 3095 (clear-stream _test-output-stream) - 3096 (clear-stream $_test-output-buffered-file->buffer) - 3097 (clear-stream _test-error-stream) - 3098 (clear-stream $_test-error-buffered-file->buffer) - 3099 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3100 68/push 0/imm32 - 3101 68/push 0/imm32 - 3102 89/<- %edx 4/r32/esp - 3103 (tailor-exit-descriptor %edx 0x10) - 3104 # - 3105 (write _test-input-stream "fn f {\n") - 3106 (write _test-input-stream " var x: (addr int)\n") - 3107 (write _test-input-stream " var y: (addr boolean)\n") - 3108 (write _test-input-stream " g x, y\n") - 3109 (write _test-input-stream "}\n") - 3110 (write _test-input-stream "fn g a: (addr _T), b: (addr _T) {\n") - 3111 (write _test-input-stream "}\n") - 3112 # convert - 3113 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3114 # registers except esp clobbered at this point - 3115 # restore ed - 3116 89/<- %edx 4/r32/esp - 3117 (flush _test-output-buffered-file) - 3118 (flush _test-error-buffered-file) - 3119 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3125 # check output - 3126 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-inout-with-incompatible-type-parameters: output should be empty") - 3127 (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") - 3128 # don't restore from ebp - 3129 81 0/subop/add %esp 8/imm32 - 3130 # . epilogue - 3131 5d/pop-to-ebp - 3132 c3/return - 3133 - 3134 test-convert-function-call-with-too-few-inouts: - 3135 # . prologue - 3136 55/push-ebp - 3137 89/<- %ebp 4/r32/esp - 3138 # setup - 3139 (clear-stream _test-input-stream) - 3140 (clear-stream $_test-input-buffered-file->buffer) - 3141 (clear-stream _test-output-stream) - 3142 (clear-stream $_test-output-buffered-file->buffer) - 3143 (clear-stream _test-error-stream) - 3144 (clear-stream $_test-error-buffered-file->buffer) - 3145 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3146 68/push 0/imm32 - 3147 68/push 0/imm32 - 3148 89/<- %edx 4/r32/esp - 3149 (tailor-exit-descriptor %edx 0x10) - 3150 # - 3151 (write _test-input-stream "fn f {\n") - 3152 (write _test-input-stream " g\n") - 3153 (write _test-input-stream "}\n") - 3154 (write _test-input-stream "fn g a: int {\n") - 3155 (write _test-input-stream "}\n") - 3156 # convert - 3157 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3158 # registers except esp clobbered at this point - 3159 # restore ed - 3160 89/<- %edx 4/r32/esp - 3161 (flush _test-output-buffered-file) - 3162 (flush _test-error-buffered-file) - 3163 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3169 # check output - 3170 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-few-inouts: output should be empty") - 3171 (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") - 3172 # check that stop(1) was called - 3173 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-few-inouts: exit status") - 3174 # don't restore from ebp - 3175 81 0/subop/add %esp 8/imm32 - 3176 5d/pop-to-ebp - 3177 c3/return - 3178 - 3179 test-convert-function-call-with-too-many-inouts: - 3180 # . prologue - 3181 55/push-ebp - 3182 89/<- %ebp 4/r32/esp - 3183 # setup - 3184 (clear-stream _test-input-stream) - 3185 (clear-stream $_test-input-buffered-file->buffer) - 3186 (clear-stream _test-output-stream) - 3187 (clear-stream $_test-output-buffered-file->buffer) - 3188 (clear-stream _test-error-stream) - 3189 (clear-stream $_test-error-buffered-file->buffer) - 3190 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3191 68/push 0/imm32 - 3192 68/push 0/imm32 - 3193 89/<- %edx 4/r32/esp - 3194 (tailor-exit-descriptor %edx 0x10) - 3195 # - 3196 (write _test-input-stream "fn f {\n") - 3197 (write _test-input-stream " var x: int\n") - 3198 (write _test-input-stream " g x\n") - 3199 (write _test-input-stream "}\n") - 3200 (write _test-input-stream "fn g {\n") - 3201 (write _test-input-stream "}\n") - 3202 # convert - 3203 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3204 # registers except esp clobbered at this point - 3205 # restore ed - 3206 89/<- %edx 4/r32/esp - 3207 (flush _test-output-buffered-file) - 3208 (flush _test-error-buffered-file) - 3209 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3215 # check output - 3216 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-many-inouts: output should be empty") - 3217 (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") - 3218 # check that stop(1) was called - 3219 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-many-inouts: exit status") - 3220 # don't restore from ebp - 3221 81 0/subop/add %esp 8/imm32 - 3222 5d/pop-to-ebp - 3223 c3/return - 3224 - 3225 test-convert-function-call-with-incorrect-output-type: - 3226 # . prologue - 3227 55/push-ebp - 3228 89/<- %ebp 4/r32/esp - 3229 # setup - 3230 (clear-stream _test-input-stream) - 3231 (clear-stream $_test-input-buffered-file->buffer) - 3232 (clear-stream _test-output-stream) - 3233 (clear-stream $_test-output-buffered-file->buffer) - 3234 (clear-stream _test-error-stream) - 3235 (clear-stream $_test-error-buffered-file->buffer) - 3236 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3237 68/push 0/imm32 - 3238 68/push 0/imm32 - 3239 89/<- %edx 4/r32/esp - 3240 (tailor-exit-descriptor %edx 0x10) - 3241 # - 3242 (write _test-input-stream "fn f {\n") - 3243 (write _test-input-stream " var x/eax: int <- g\n") - 3244 (write _test-input-stream "}\n") - 3245 (write _test-input-stream "fn g -> _/eax: foo {\n") - 3246 (write _test-input-stream "}\n") - 3247 # convert - 3248 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3249 # registers except esp clobbered at this point - 3250 # restore ed - 3251 89/<- %edx 4/r32/esp - 3252 (flush _test-output-buffered-file) - 3253 (flush _test-error-buffered-file) - 3254 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3260 # check output - 3261 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-output-type: output should be empty") - 3262 (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") - 3263 # check that stop(1) was called - 3264 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-output-type: exit status") - 3265 # don't restore from ebp - 3266 81 0/subop/add %esp 8/imm32 - 3267 5d/pop-to-ebp - 3268 c3/return - 3269 - 3270 test-convert-function-call-with-too-few-outputs: - 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 (clear-stream _test-error-stream) - 3280 (clear-stream $_test-error-buffered-file->buffer) - 3281 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3282 68/push 0/imm32 - 3283 68/push 0/imm32 - 3284 89/<- %edx 4/r32/esp - 3285 (tailor-exit-descriptor %edx 0x10) - 3286 # - 3287 (write _test-input-stream "fn f {\n") - 3288 (write _test-input-stream " g\n") - 3289 (write _test-input-stream "}\n") - 3290 (write _test-input-stream "fn g -> _/eax: int {\n") - 3291 (write _test-input-stream "}\n") - 3292 # convert - 3293 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3294 # registers except esp clobbered at this point - 3295 # restore ed - 3296 89/<- %edx 4/r32/esp - 3297 (flush _test-output-buffered-file) - 3298 (flush _test-error-buffered-file) - 3299 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3305 # check output - 3306 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-few-outputs: output should be empty") - 3307 (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") - 3308 # check that stop(1) was called - 3309 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-few-outputs: exit status") - 3310 # don't restore from ebp - 3311 81 0/subop/add %esp 8/imm32 - 3312 5d/pop-to-ebp - 3313 c3/return - 3314 - 3315 test-convert-function-call-with-too-many-outputs: - 3316 # . prologue - 3317 55/push-ebp - 3318 89/<- %ebp 4/r32/esp - 3319 # setup - 3320 (clear-stream _test-input-stream) - 3321 (clear-stream $_test-input-buffered-file->buffer) - 3322 (clear-stream _test-output-stream) - 3323 (clear-stream $_test-output-buffered-file->buffer) - 3324 (clear-stream _test-error-stream) - 3325 (clear-stream $_test-error-buffered-file->buffer) - 3326 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3327 68/push 0/imm32 - 3328 68/push 0/imm32 - 3329 89/<- %edx 4/r32/esp - 3330 (tailor-exit-descriptor %edx 0x10) - 3331 # - 3332 (write _test-input-stream "fn f {\n") - 3333 (write _test-input-stream " var x/eax: int <- g\n") - 3334 (write _test-input-stream "}\n") - 3335 (write _test-input-stream "fn g {\n") - 3336 (write _test-input-stream "}\n") - 3337 # convert - 3338 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3339 # registers except esp clobbered at this point - 3340 # restore ed - 3341 89/<- %edx 4/r32/esp - 3342 (flush _test-output-buffered-file) - 3343 (flush _test-error-buffered-file) - 3344 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3350 # check output - 3351 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-many-outputs: output should be empty") - 3352 (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") - 3353 # check that stop(1) was called - 3354 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-many-outputs: exit status") - 3355 # don't restore from ebp - 3356 81 0/subop/add %esp 8/imm32 - 3357 5d/pop-to-ebp - 3358 c3/return - 3359 - 3360 test-convert-function-call-with-missing-output-register: - 3361 # . prologue - 3362 55/push-ebp - 3363 89/<- %ebp 4/r32/esp - 3364 # setup - 3365 (clear-stream _test-input-stream) - 3366 (clear-stream $_test-input-buffered-file->buffer) - 3367 (clear-stream _test-output-stream) - 3368 (clear-stream $_test-output-buffered-file->buffer) - 3369 (clear-stream _test-error-stream) - 3370 (clear-stream $_test-error-buffered-file->buffer) - 3371 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3372 68/push 0/imm32 - 3373 68/push 0/imm32 - 3374 89/<- %edx 4/r32/esp - 3375 (tailor-exit-descriptor %edx 0x10) - 3376 # - 3377 (write _test-input-stream "fn f {\n") - 3378 (write _test-input-stream " var x: int\n") - 3379 (write _test-input-stream " x <- g\n") - 3380 (write _test-input-stream "}\n") - 3381 (write _test-input-stream "fn g -> _/eax: int {\n") - 3382 (write _test-input-stream "}\n") - 3383 # convert - 3384 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3385 # registers except esp clobbered at this point - 3386 # restore ed - 3387 89/<- %edx 4/r32/esp - 3388 (flush _test-output-buffered-file) - 3389 (flush _test-error-buffered-file) - 3390 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3396 # check output - 3397 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-missing-output-register: output should be empty") - 3398 (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") - 3399 # check that stop(1) was called - 3400 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-missing-output-register: exit status") - 3401 # don't restore from ebp - 3402 81 0/subop/add %esp 8/imm32 - 3403 5d/pop-to-ebp - 3404 c3/return - 3405 - 3406 test-convert-function-call-with-incorrect-output-register: - 3407 # . prologue - 3408 55/push-ebp - 3409 89/<- %ebp 4/r32/esp - 3410 # setup - 3411 (clear-stream _test-input-stream) - 3412 (clear-stream $_test-input-buffered-file->buffer) - 3413 (clear-stream _test-output-stream) - 3414 (clear-stream $_test-output-buffered-file->buffer) - 3415 (clear-stream _test-error-stream) - 3416 (clear-stream $_test-error-buffered-file->buffer) - 3417 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3418 68/push 0/imm32 - 3419 68/push 0/imm32 - 3420 89/<- %edx 4/r32/esp - 3421 (tailor-exit-descriptor %edx 0x10) - 3422 # - 3423 (write _test-input-stream "fn f {\n") - 3424 (write _test-input-stream " var x/ecx: int <- g\n") - 3425 (write _test-input-stream "}\n") - 3426 (write _test-input-stream "fn g -> _/eax: int {\n") - 3427 (write _test-input-stream "}\n") - 3428 # convert - 3429 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3430 # registers except esp clobbered at this point - 3431 # restore ed - 3432 89/<- %edx 4/r32/esp - 3433 (flush _test-output-buffered-file) - 3434 (flush _test-error-buffered-file) - 3435 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3441 # check output - 3442 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-output-register: output should be empty") - 3443 (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") - 3444 # check that stop(1) was called - 3445 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-output-register: exit status") - 3446 # don't restore from ebp - 3447 81 0/subop/add %esp 8/imm32 - 3448 5d/pop-to-ebp - 3449 c3/return - 3450 - 3451 test-convert-function-with-local-var-dereferenced: - 3452 # . prologue - 3453 55/push-ebp - 3454 89/<- %ebp 4/r32/esp - 3455 # setup - 3456 (clear-stream _test-input-stream) - 3457 (clear-stream $_test-input-buffered-file->buffer) - 3458 (clear-stream _test-output-stream) - 3459 (clear-stream $_test-output-buffered-file->buffer) - 3460 # - 3461 (write _test-input-stream "fn foo {\n") - 3462 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n") - 3463 (write _test-input-stream " increment *x\n") - 3464 (write _test-input-stream "}\n") - 3465 # convert - 3466 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3467 (flush _test-output-buffered-file) - 3468 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 3474 # check output - 3475 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0") - 3476 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1") - 3477 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2") - 3478 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3") - 3479 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4") - 3480 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5") - 3481 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6") - 3482 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7") - 3483 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8") - 3484 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9") - 3485 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10") - 3486 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11") - 3487 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12") - 3488 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13") - 3489 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14") - 3490 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15") - 3491 # . epilogue - 3492 89/<- %esp 5/r32/ebp - 3493 5d/pop-to-ebp - 3494 c3/return - 3495 - 3496 test-dereference-of-var-on-stack: - 3497 # . prologue - 3498 55/push-ebp - 3499 89/<- %ebp 4/r32/esp - 3500 # setup - 3501 (clear-stream _test-input-stream) - 3502 (clear-stream $_test-input-buffered-file->buffer) - 3503 (clear-stream _test-output-stream) - 3504 (clear-stream $_test-output-buffered-file->buffer) - 3505 (clear-stream _test-error-stream) - 3506 (clear-stream $_test-error-buffered-file->buffer) - 3507 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3508 68/push 0/imm32 - 3509 68/push 0/imm32 - 3510 89/<- %edx 4/r32/esp - 3511 (tailor-exit-descriptor %edx 0x10) - 3512 # - 3513 (write _test-input-stream "fn foo {\n") - 3514 (write _test-input-stream " var x: (addr int)\n") - 3515 (write _test-input-stream " increment *x\n") - 3516 (write _test-input-stream "}\n") - 3517 # convert - 3518 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3519 # registers except esp clobbered at this point - 3520 # restore ed - 3521 89/<- %edx 4/r32/esp - 3522 (flush _test-output-buffered-file) - 3523 (flush _test-error-buffered-file) - 3524 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3530 # check output - 3531 (check-stream-equal _test-output-stream "" "F - test-dereference-of-var-on-stack: output should be empty") - 3532 (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") - 3533 # check that stop(1) was called - 3534 (check-ints-equal *(edx+4) 2 "F - test-dereference-of-var-on-stack: exit status") - 3535 # don't restore from ebp - 3536 81 0/subop/add %esp 8/imm32 - 3537 # . epilogue - 3538 5d/pop-to-ebp - 3539 c3/return - 3540 - 3541 test-convert-function-with-byte-operations: - 3542 # . prologue - 3543 55/push-ebp - 3544 89/<- %ebp 4/r32/esp - 3545 # setup - 3546 (clear-stream _test-input-stream) - 3547 (clear-stream $_test-input-buffered-file->buffer) - 3548 (clear-stream _test-output-stream) - 3549 (clear-stream $_test-output-buffered-file->buffer) - 3550 # - 3551 (write _test-input-stream "fn foo {\n") - 3552 (write _test-input-stream " var x/eax: byte <- copy 0\n") - 3553 (write _test-input-stream " var y/ecx: byte <- copy 0\n") - 3554 (write _test-input-stream " y <- copy-byte x\n") - 3555 (write _test-input-stream " var z/edx: (addr byte) <- copy 0\n") - 3556 (write _test-input-stream " y <- copy-byte *z\n") - 3557 (write _test-input-stream " copy-byte-to *z, x\n") - 3558 (write _test-input-stream "}\n") - 3559 # convert - 3560 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3561 (flush _test-output-buffered-file) - 3562 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 3568 # check output - 3569 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-byte-operations/0") - 3570 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-byte-operations/1") - 3571 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-byte-operations/2") - 3572 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-byte-operations/3") - 3573 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-byte-operations/4") - 3574 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-byte-operations/5") - 3575 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-byte-operations/6") - 3576 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-with-byte-operations/7") - 3577 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-byte-operations/8") - 3578 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-byte-operations/9") - 3579 (check-next-stream-line-equal _test-output-stream " 8a/byte-> %eax 0x00000001/r32" "F - test-convert-function-with-byte-operations/10") - 3580 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-convert-function-with-byte-operations/11") - 3581 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 0/imm32" "F - test-convert-function-with-byte-operations/12") - 3582 (check-next-stream-line-equal _test-output-stream " 8a/byte-> *edx 0x00000001/r32" "F - test-convert-function-with-byte-operations/13") - 3583 (check-next-stream-line-equal _test-output-stream " 88/byte<- *edx 0x00000000/r32" "F - test-convert-function-with-byte-operations/14") - 3584 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-convert-function-with-byte-operations/15") - 3585 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-byte-operations/16") - 3586 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-byte-operations/17") - 3587 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-byte-operations/18") - 3588 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-byte-operations/19") - 3589 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-byte-operations/20") - 3590 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-byte-operations/21") - 3591 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-byte-operations/22") - 3592 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-byte-operations/23") - 3593 # . epilogue - 3594 89/<- %esp 5/r32/ebp - 3595 5d/pop-to-ebp - 3596 c3/return - 3597 - 3598 # variables of type 'byte' are not allowed on the stack - 3599 test-byte-values-on-stack: - 3600 # . prologue - 3601 55/push-ebp - 3602 89/<- %ebp 4/r32/esp - 3603 # setup - 3604 (clear-stream _test-input-stream) - 3605 (clear-stream $_test-input-buffered-file->buffer) - 3606 (clear-stream _test-output-stream) - 3607 (clear-stream $_test-output-buffered-file->buffer) - 3608 (clear-stream _test-error-stream) - 3609 (clear-stream $_test-error-buffered-file->buffer) - 3610 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3611 68/push 0/imm32 - 3612 68/push 0/imm32 - 3613 89/<- %edx 4/r32/esp - 3614 (tailor-exit-descriptor %edx 0x10) - 3615 # - 3616 (write _test-input-stream "fn foo {\n") - 3617 (write _test-input-stream " var x: byte\n") - 3618 (write _test-input-stream "}\n") - 3619 # convert - 3620 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3621 # registers except esp clobbered at this point - 3622 # restore ed - 3623 89/<- %edx 4/r32/esp - 3624 (flush _test-output-buffered-file) - 3625 (flush _test-error-buffered-file) - 3626 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3632 # check output - 3633 (check-stream-equal _test-output-stream "" "F - test-byte-values-on-stack: output should be empty") - 3634 (check-next-stream-line-equal _test-error-stream "fn foo: var 'x' of type 'byte' cannot be on the stack" "F - test-byte-values-on-stack: error message") - 3635 # check that stop(1) was called - 3636 (check-ints-equal *(edx+4) 2 "F - test-byte-values-on-stack: exit status") - 3637 # don't restore from ebp - 3638 81 0/subop/add %esp 8/imm32 - 3639 # . epilogue - 3640 5d/pop-to-ebp - 3641 c3/return - 3642 - 3643 # variables of type 'byte' are not allowed in esi or edi - 3644 test-byte-values-in-unsupported-registers: - 3645 # . prologue - 3646 55/push-ebp - 3647 89/<- %ebp 4/r32/esp - 3648 # setup - 3649 (clear-stream _test-input-stream) - 3650 (clear-stream $_test-input-buffered-file->buffer) - 3651 (clear-stream _test-output-stream) - 3652 (clear-stream $_test-output-buffered-file->buffer) - 3653 (clear-stream _test-error-stream) - 3654 (clear-stream $_test-error-buffered-file->buffer) - 3655 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3656 68/push 0/imm32 - 3657 68/push 0/imm32 - 3658 89/<- %edx 4/r32/esp - 3659 (tailor-exit-descriptor %edx 0x10) - 3660 # - 3661 (write _test-input-stream "fn foo {\n") - 3662 (write _test-input-stream " var x/esi: byte <- copy 0\n") - 3663 (write _test-input-stream "}\n") - 3664 # convert - 3665 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3666 # registers except esp clobbered at this point - 3667 # restore ed - 3668 89/<- %edx 4/r32/esp - 3669 (flush _test-output-buffered-file) - 3670 (flush _test-error-buffered-file) - 3671 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3677 # check output - 3678 (check-stream-equal _test-output-stream "" "F - test-byte-values-in-unsupported-registers: output should be empty") - 3679 (check-next-stream-line-equal _test-error-stream "fn foo: var 'x' of type 'byte' cannot be in esi or edi" "F - test-byte-values-in-unsupported-registers: error message") - 3680 # check that stop(1) was called - 3681 (check-ints-equal *(edx+4) 2 "F - test-byte-values-in-unsupported-registers: exit status") - 3682 # don't restore from ebp - 3683 81 0/subop/add %esp 8/imm32 - 3684 # . epilogue - 3685 5d/pop-to-ebp - 3686 c3/return - 3687 - 3688 # variables of type 'byte' _can_ be function args. They then occupy 4 bytes. - 3689 test-copy-byte-var-from-fn-arg: - 3690 # . prologue - 3691 55/push-ebp - 3692 89/<- %ebp 4/r32/esp - 3693 # setup - 3694 (clear-stream _test-input-stream) - 3695 (clear-stream $_test-input-buffered-file->buffer) - 3696 (clear-stream _test-output-stream) - 3697 (clear-stream $_test-output-buffered-file->buffer) - 3698 # - 3699 (write _test-input-stream "fn foo x: byte, y: int {\n") - 3700 (write _test-input-stream " var a/eax: byte <- copy x\n") - 3701 (write _test-input-stream " var b/eax: int <- copy y\n") - 3702 (write _test-input-stream "}\n") - 3703 # convert - 3704 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3705 (flush _test-output-buffered-file) - 3706 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 3712 # check output - 3713 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-copy-byte-from-fn-arg/0") - 3714 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-copy-byte-from-fn-arg/1") - 3715 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-copy-byte-from-fn-arg/2") - 3716 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-copy-byte-from-fn-arg/3") - 3717 (check-next-stream-line-equal _test-output-stream " {" "F - test-copy-byte-from-fn-arg/4") - 3718 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-copy-byte-from-fn-arg/5") - 3719 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-copy-byte-from-fn-arg/6") - 3720 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/7") - 3721 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x0000000c) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/8") - 3722 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-copy-byte-from-fn-arg/9") - 3723 (check-next-stream-line-equal _test-output-stream " }" "F - test-copy-byte-from-fn-arg/10") - 3724 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-copy-byte-from-fn-arg/11") - 3725 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-copy-byte-from-fn-arg/12") - 3726 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-copy-byte-from-fn-arg/13") - 3727 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-copy-byte-from-fn-arg/14") - 3728 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-copy-byte-from-fn-arg/15") - 3729 # . epilogue - 3730 89/<- %esp 5/r32/ebp - 3731 5d/pop-to-ebp - 3732 c3/return - 3733 - 3734 test-convert-compare-register-with-literal: - 3735 # . prologue - 3736 55/push-ebp - 3737 89/<- %ebp 4/r32/esp - 3738 # setup - 3739 (clear-stream _test-input-stream) - 3740 (clear-stream $_test-input-buffered-file->buffer) - 3741 (clear-stream _test-output-stream) - 3742 (clear-stream $_test-output-buffered-file->buffer) - 3743 # - 3744 (write _test-input-stream "fn foo {\n") - 3745 (write _test-input-stream " var x/ecx: int <- copy 0\n") - 3746 (write _test-input-stream " compare x, 0\n") - 3747 (write _test-input-stream "}\n") - 3748 # convert - 3749 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3750 (flush _test-output-buffered-file) - 3751 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 3757 # check output - 3758 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0") - 3759 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1") - 3760 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2") - 3761 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3") - 3762 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4") - 3763 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5") - 3764 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") - 3765 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7") - 3766 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8") - 3767 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") - 3768 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10") - 3769 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11") - 3770 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12") - 3771 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13") - 3772 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14") - 3773 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15") - 3774 # . epilogue - 3775 89/<- %esp 5/r32/ebp - 3776 5d/pop-to-ebp - 3777 c3/return - 3778 - 3779 test-unknown-variable: - 3780 # . prologue - 3781 55/push-ebp - 3782 89/<- %ebp 4/r32/esp - 3783 # setup - 3784 (clear-stream _test-input-stream) - 3785 (clear-stream $_test-input-buffered-file->buffer) - 3786 (clear-stream _test-output-stream) - 3787 (clear-stream $_test-output-buffered-file->buffer) - 3788 (clear-stream _test-error-stream) - 3789 (clear-stream $_test-error-buffered-file->buffer) - 3790 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1954 (clear-stream _test-error-stream) + 1955 (clear-stream $_test-error-buffered-file->buffer) + 1956 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1957 68/push 0/imm32 + 1958 68/push 0/imm32 + 1959 89/<- %edx 4/r32/esp + 1960 (tailor-exit-descriptor %edx 0x10) + 1961 # + 1962 (write _test-input-stream "fn foo {\n") + 1963 (write _test-input-stream " x <- copy 0x34\n") + 1964 (write _test-input-stream "}\n") + 1965 # convert + 1966 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1967 # registers except esp clobbered at this point + 1968 # restore ed + 1969 89/<- %edx 4/r32/esp + 1970 (flush _test-output-buffered-file) + 1971 (flush _test-error-buffered-file) + 1972 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1978 # check output + 1979 (check-stream-equal _test-output-stream "" "F - test-stmt-with-unknown-var: output should be empty") + 1980 (check-next-stream-line-equal _test-error-stream "fn foo: unknown variable 'x'" "F - test-stmt-with-unknown-var: error message") + 1981 # check that stop(1) was called + 1982 (check-ints-equal *(edx+4) 2 "F - test-stmt-with-unknown-var: exit status") + 1983 # don't restore from ebp + 1984 81 0/subop/add %esp 8/imm32 + 1985 # . epilogue + 1986 5d/pop-to-ebp + 1987 c3/return + 1988 + 1989 test-stmt-with-invalid-identifier: + 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) + 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 " 1 <- copy 0x34\n") + 2008 (write _test-input-stream "}\n") + 2009 # convert + 2010 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2011 # registers except esp clobbered at this point + 2012 # restore ed + 2013 89/<- %edx 4/r32/esp + 2014 (flush _test-output-buffered-file) + 2015 (flush _test-error-buffered-file) + 2016 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 2022 # check output + 2023 (check-stream-equal _test-output-stream "" "F - test-stmt-with-invalid-identifier: output should be empty") + 2024 (check-next-stream-line-equal _test-error-stream "fn foo: invalid identifier '1'" "F - test-stmt-with-invalid-identifier: error message") + 2025 # check that stop(1) was called + 2026 (check-ints-equal *(edx+4) 2 "F - test-stmt-with-invalid-identifier: exit status") + 2027 # don't restore from ebp + 2028 81 0/subop/add %esp 8/imm32 + 2029 # . epilogue + 2030 5d/pop-to-ebp + 2031 c3/return + 2032 + 2033 test-stmt-with-deref-var: + 2034 # . prologue + 2035 55/push-ebp + 2036 89/<- %ebp 4/r32/esp + 2037 # setup + 2038 (clear-stream _test-input-stream) + 2039 (clear-stream $_test-input-buffered-file->buffer) + 2040 (clear-stream _test-output-stream) + 2041 (clear-stream $_test-output-buffered-file->buffer) + 2042 (clear-stream _test-error-stream) + 2043 (clear-stream $_test-error-buffered-file->buffer) + 2044 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 2045 68/push 0/imm32 + 2046 68/push 0/imm32 + 2047 89/<- %edx 4/r32/esp + 2048 (tailor-exit-descriptor %edx 0x10) + 2049 # + 2050 (write _test-input-stream "fn foo {\n") + 2051 (write _test-input-stream " *x <- copy 0x34\n") + 2052 (write _test-input-stream "}\n") + 2053 # convert + 2054 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2055 # registers except esp clobbered at this point + 2056 # restore ed + 2057 89/<- %edx 4/r32/esp + 2058 (flush _test-output-buffered-file) + 2059 (flush _test-error-buffered-file) + 2060 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 2066 # check output + 2067 (check-stream-equal _test-output-stream "" "F - test-stmt-with-deref-var: output should be empty") + 2068 (check-next-stream-line-equal _test-error-stream "fn foo: output '*x' should write to a register, and therefore cannot be dereferenced" "F - test-stmt-with-deref-var: error message") + 2069 # check that stop(1) was called + 2070 (check-ints-equal *(edx+4) 2 "F - test-stmt-with-deref-var: exit status") + 2071 # don't restore from ebp + 2072 81 0/subop/add %esp 8/imm32 + 2073 # . epilogue + 2074 5d/pop-to-ebp + 2075 c3/return + 2076 + 2077 test-convert-function-with-literal-arg: + 2078 # . prologue + 2079 55/push-ebp + 2080 89/<- %ebp 4/r32/esp + 2081 # setup + 2082 (clear-stream _test-input-stream) + 2083 (clear-stream $_test-input-buffered-file->buffer) + 2084 (clear-stream _test-output-stream) + 2085 (clear-stream $_test-output-buffered-file->buffer) + 2086 # + 2087 (write _test-input-stream "fn foo a: int, b: int -> _/eax: int {\n") + 2088 (write _test-input-stream " var result/eax: int <- copy a\n") + 2089 (write _test-input-stream " result <- add 1\n") + 2090 (write _test-input-stream " return result\n") + 2091 (write _test-input-stream "}\n") + 2092 # convert + 2093 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2094 (flush _test-output-buffered-file) + 2095 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2101 # check output + 2102 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg/0") + 2103 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg/1") + 2104 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg/2") + 2105 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg/3") + 2106 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg/4") + 2107 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg/5") + 2108 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-literal-arg/6") + 2109 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-with-literal-arg/7") + 2110 (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-with-literal-arg/8") + 2111 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-literal-arg/9") + 2112 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-literal-arg/10") + 2113 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-literal-arg/11") + 2114 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg/12") + 2115 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg/13") + 2116 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg/14") + 2117 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg/15") + 2118 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg/16") + 2119 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg/17") + 2120 # . epilogue + 2121 89/<- %esp 5/r32/ebp + 2122 5d/pop-to-ebp + 2123 c3/return + 2124 + 2125 test-convert-function-with-literal-arg-2: + 2126 # . prologue + 2127 55/push-ebp + 2128 89/<- %ebp 4/r32/esp + 2129 # setup + 2130 (clear-stream _test-input-stream) + 2131 (clear-stream $_test-input-buffered-file->buffer) + 2132 (clear-stream _test-output-stream) + 2133 (clear-stream $_test-output-buffered-file->buffer) + 2134 # + 2135 (write _test-input-stream "fn foo a: int, b: int -> _/ebx: int {\n") + 2136 (write _test-input-stream " var result/ebx: int <- copy a\n") + 2137 (write _test-input-stream " result <- add 1\n") + 2138 (write _test-input-stream " return result\n") + 2139 (write _test-input-stream "}\n") + 2140 # convert + 2141 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2142 (flush _test-output-buffered-file) + 2143 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2149 # check output + 2150 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg-2/0") + 2151 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg-2/1") + 2152 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg-2/2") + 2153 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg-2/3") + 2154 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg-2/4") + 2155 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg-2/5") + 2156 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-with-literal-arg-2/6") + 2157 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/7") + 2158 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-with-literal-arg-2/8") + 2159 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/9") + 2160 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-literal-arg-2/10") + 2161 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-literal-arg-2/11") + 2162 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg-2/12") + 2163 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg-2/13") + 2164 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg-2/14") + 2165 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg-2/15") + 2166 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg-2/16") + 2167 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg-2/17") + 2168 # . epilogue + 2169 89/<- %esp 5/r32/ebp + 2170 5d/pop-to-ebp + 2171 c3/return + 2172 + 2173 test-convert-function-call-with-literal-arg: + 2174 # . prologue + 2175 55/push-ebp + 2176 89/<- %ebp 4/r32/esp + 2177 # setup + 2178 (clear-stream _test-input-stream) + 2179 (clear-stream $_test-input-buffered-file->buffer) + 2180 (clear-stream _test-output-stream) + 2181 (clear-stream $_test-output-buffered-file->buffer) + 2182 # + 2183 (write _test-input-stream "fn main -> _/ebx: int {\n") + 2184 (write _test-input-stream " var result/eax: int <- do-add 3 4\n") + 2185 (write _test-input-stream " return result\n") + 2186 (write _test-input-stream "}\n") + 2187 (write _test-input-stream "fn do-add a: int, b: int -> _/eax: int {\n") + 2188 (write _test-input-stream " var result/eax: int <- copy a\n") + 2189 (write _test-input-stream " result <- add b\n") + 2190 (write _test-input-stream " return result\n") + 2191 (write _test-input-stream "}\n") + 2192 # convert + 2193 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2194 (flush _test-output-buffered-file) + 2195 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2201 # check output + 2202 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0") + 2203 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1") + 2204 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2") + 2205 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3") + 2206 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4") + 2207 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-literal-arg/5") + 2208 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/6") + 2209 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/7") + 2210 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") + 2211 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-local-var-in-reg/9") + 2212 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") + 2213 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/11") + 2214 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-literal-arg/12") + 2215 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/13") + 2216 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/14") + 2217 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/15") + 2218 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/16") + 2219 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/17") + 2220 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/18") + 2221 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/19") + 2222 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/20") + 2223 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/21") + 2224 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:loop:" "F - test-convert-function-call-with-literal-arg/22") + 2225 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/23") + 2226 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/24") + 2227 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/25") + 2228 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/26") + 2229 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") + 2230 (check-next-stream-line-equal _test-output-stream " e9/jump $do-add:0x00000002:break/disp32" "F - test-convert-function-call-with-literal-arg/28") + 2231 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/29") + 2232 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:break:" "F - test-convert-function-call-with-literal-arg/30") + 2233 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/31") + 2234 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/32") + 2235 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/33") + 2236 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/34") + 2237 # . epilogue + 2238 89/<- %esp 5/r32/ebp + 2239 5d/pop-to-ebp + 2240 c3/return + 2241 + 2242 test-convert-function-call-with-literal-string-arg: + 2243 # . prologue + 2244 55/push-ebp + 2245 89/<- %ebp 4/r32/esp + 2246 # setup + 2247 (clear-stream _test-input-stream) + 2248 (clear-stream $_test-input-buffered-file->buffer) + 2249 (clear-stream _test-output-stream) + 2250 (clear-stream $_test-output-buffered-file->buffer) + 2251 # + 2252 (write _test-input-stream "fn foo {\n") + 2253 (write _test-input-stream " string-func \"abc\"\n") + 2254 (write _test-input-stream "}\n") + 2255 (write _test-input-stream "sig string-func in: (addr array byte)\n") + 2256 # convert + 2257 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2258 # no errors + 2259 # not bothering checking output + 2260 # . epilogue + 2261 89/<- %esp 5/r32/ebp + 2262 5d/pop-to-ebp + 2263 c3/return + 2264 + 2265 test-convert-function-call-with-null-addr: + 2266 # . prologue + 2267 55/push-ebp + 2268 89/<- %ebp 4/r32/esp + 2269 # setup + 2270 (clear-stream _test-input-stream) + 2271 (clear-stream $_test-input-buffered-file->buffer) + 2272 (clear-stream _test-output-stream) + 2273 (clear-stream $_test-output-buffered-file->buffer) + 2274 # + 2275 (write _test-input-stream "fn foo {\n") + 2276 (write _test-input-stream " bar 0\n") + 2277 (write _test-input-stream "}\n") + 2278 (write _test-input-stream "sig bar in: (addr int)\n") + 2279 # convert + 2280 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2281 # no errors + 2282 # not bothering checking output + 2283 # . epilogue + 2284 89/<- %esp 5/r32/ebp + 2285 5d/pop-to-ebp + 2286 c3/return + 2287 + 2288 test-convert-function-call-with-signature: + 2289 # . prologue + 2290 55/push-ebp + 2291 89/<- %ebp 4/r32/esp + 2292 # setup + 2293 (clear-stream _test-input-stream) + 2294 (clear-stream $_test-input-buffered-file->buffer) + 2295 (clear-stream _test-output-stream) + 2296 (clear-stream $_test-output-buffered-file->buffer) + 2297 # + 2298 (write _test-input-stream "fn main -> _/ebx: int {\n") + 2299 (write _test-input-stream " var result/eax: int <- do-add 3 4\n") + 2300 (write _test-input-stream " return result\n") + 2301 (write _test-input-stream "}\n") + 2302 (write _test-input-stream "sig do-add a: int, b: int -> _/eax: int\n") + 2303 # convert + 2304 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2305 (flush _test-output-buffered-file) + 2306 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2312 # check output + 2313 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-signature/0") + 2314 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-signature/1") + 2315 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-signature/2") + 2316 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-signature/3") + 2317 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-signature/4") + 2318 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-signature/5") + 2319 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/6") + 2320 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-signature/6") + 2321 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") + 2322 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-local-var-in-reg/9") + 2323 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") + 2324 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-signature/7") + 2325 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-signature/8") + 2326 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-signature/9") + 2327 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-signature/10") + 2328 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-signature/11") + 2329 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-signature/12") + 2330 # . epilogue + 2331 89/<- %esp 5/r32/ebp + 2332 5d/pop-to-ebp + 2333 c3/return + 2334 + 2335 test-convert-function-with-local-var-in-mem: + 2336 # . prologue + 2337 55/push-ebp + 2338 89/<- %ebp 4/r32/esp + 2339 # setup + 2340 (clear-stream _test-input-stream) + 2341 (clear-stream $_test-input-buffered-file->buffer) + 2342 (clear-stream _test-output-stream) + 2343 (clear-stream $_test-output-buffered-file->buffer) + 2344 # + 2345 (write _test-input-stream "fn foo {\n") + 2346 (write _test-input-stream " var x: int\n") + 2347 (write _test-input-stream " increment x\n") + 2348 (write _test-input-stream "}\n") + 2349 # convert + 2350 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2351 (flush _test-output-buffered-file) + 2352 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2358 # check output + 2359 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0") + 2360 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1") + 2361 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2") + 2362 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3") + 2363 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4") + 2364 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem/5") + 2365 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/6") + 2366 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/7") + 2367 (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") + 2368 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/9") + 2369 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem/10") + 2370 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/11") + 2371 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/12") + 2372 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/13") + 2373 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/14") + 2374 # . epilogue + 2375 89/<- %esp 5/r32/ebp + 2376 5d/pop-to-ebp + 2377 c3/return + 2378 + 2379 test-convert-invalid-literal: + 2380 # . prologue + 2381 55/push-ebp + 2382 89/<- %ebp 4/r32/esp + 2383 # setup + 2384 (clear-stream _test-input-stream) + 2385 (clear-stream $_test-input-buffered-file->buffer) + 2386 (clear-stream _test-output-stream) + 2387 (clear-stream $_test-output-buffered-file->buffer) + 2388 (clear-stream _test-error-stream) + 2389 (clear-stream $_test-error-buffered-file->buffer) + 2390 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 2391 68/push 0/imm32 + 2392 68/push 0/imm32 + 2393 89/<- %edx 4/r32/esp + 2394 (tailor-exit-descriptor %edx 0x10) + 2395 # + 2396 (write _test-input-stream "fn foo {\n") + 2397 (write _test-input-stream " increment 1n\n") + 2398 (write _test-input-stream "}\n") + 2399 # convert + 2400 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2401 # registers except esp clobbered at this point + 2402 # restore ed + 2403 89/<- %edx 4/r32/esp + 2404 (flush _test-output-buffered-file) + 2405 (flush _test-error-buffered-file) + 2406 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 2412 # check output + 2413 (check-stream-equal _test-output-stream "" "F - test-convert-invalid-literal: output should be empty") + 2414 (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") + 2415 # check that stop(1) was called + 2416 (check-ints-equal *(edx+4) 2 "F - test-convert-invalid-literal: exit status") + 2417 # don't restore from ebp + 2418 81 0/subop/add %esp 8/imm32 + 2419 # . epilogue + 2420 5d/pop-to-ebp + 2421 c3/return + 2422 + 2423 test-local-var-in-mem-has-no-initializer: + 2424 # . prologue + 2425 55/push-ebp + 2426 89/<- %ebp 4/r32/esp + 2427 # setup + 2428 (clear-stream _test-input-stream) + 2429 (clear-stream $_test-input-buffered-file->buffer) + 2430 (clear-stream _test-output-stream) + 2431 (clear-stream $_test-output-buffered-file->buffer) + 2432 (clear-stream _test-error-stream) + 2433 (clear-stream $_test-error-buffered-file->buffer) + 2434 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 2435 68/push 0/imm32 + 2436 68/push 0/imm32 + 2437 89/<- %edx 4/r32/esp + 2438 (tailor-exit-descriptor %edx 0x10) + 2439 # + 2440 (write _test-input-stream "fn foo {\n") + 2441 (write _test-input-stream " var x: int <- copy 0\n") + 2442 (write _test-input-stream " increment x\n") + 2443 (write _test-input-stream "}\n") + 2444 # convert + 2445 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2446 # registers except esp clobbered at this point + 2447 # restore ed + 2448 89/<- %edx 4/r32/esp + 2449 (flush _test-output-buffered-file) + 2450 (flush _test-error-buffered-file) + 2451 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 2457 # check output + 2458 (check-stream-equal _test-output-stream "" "F - test-var-in-mem-has-no-initializer: output should be empty") + 2459 (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") + 2460 # check that stop(1) was called + 2461 (check-ints-equal *(edx+4) 2 "F - test-var-in-mem-has-no-initializer: exit status") + 2462 # don't restore from ebp + 2463 81 0/subop/add %esp 8/imm32 + 2464 # . epilogue + 2465 5d/pop-to-ebp + 2466 c3/return + 2467 + 2468 test-convert-function-with-local-var-with-compound-type-in-mem: + 2469 # . prologue + 2470 55/push-ebp + 2471 89/<- %ebp 4/r32/esp + 2472 # setup + 2473 (clear-stream _test-input-stream) + 2474 (clear-stream $_test-input-buffered-file->buffer) + 2475 (clear-stream _test-output-stream) + 2476 (clear-stream $_test-output-buffered-file->buffer) + 2477 # + 2478 (write _test-input-stream "fn foo {\n") + 2479 (write _test-input-stream " var x: (addr int)\n") + 2480 (write _test-input-stream " copy-to x, 0\n") + 2481 (write _test-input-stream "}\n") + 2482 # convert + 2483 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2484 (flush _test-output-buffered-file) + 2485 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2491 # check output + 2492 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/0") + 2493 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/1") + 2494 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/2") + 2495 (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") + 2496 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-compound-type-in-mem/4") + 2497 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/5") + 2498 (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") + 2499 (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") + 2500 (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") + 2501 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-compound-type-in-mem/9") + 2502 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/10") + 2503 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/11") + 2504 (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") + 2505 (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") + 2506 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-compound-type-in-mem/14") + 2507 # . epilogue + 2508 89/<- %esp 5/r32/ebp + 2509 5d/pop-to-ebp + 2510 c3/return + 2511 + 2512 test-convert-function-with-local-var-in-reg: + 2513 # . prologue + 2514 55/push-ebp + 2515 89/<- %ebp 4/r32/esp + 2516 # setup + 2517 (clear-stream _test-input-stream) + 2518 (clear-stream $_test-input-buffered-file->buffer) + 2519 (clear-stream _test-output-stream) + 2520 (clear-stream $_test-output-buffered-file->buffer) + 2521 # + 2522 (write _test-input-stream "fn foo {\n") + 2523 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 2524 (write _test-input-stream " x <- increment\n") + 2525 (write _test-input-stream "}\n") + 2526 # convert + 2527 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2528 (flush _test-output-buffered-file) + 2529 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2535 # check output + 2536 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0") + 2537 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1") + 2538 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2") + 2539 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3") + 2540 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4") + 2541 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-reg/5") + 2542 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/6") + 2543 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/7") + 2544 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/8") + 2545 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/9") + 2546 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/10") + 2547 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-reg/11") + 2548 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/12") + 2549 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/13") + 2550 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/14") + 2551 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/15") + 2552 # . epilogue + 2553 89/<- %esp 5/r32/ebp + 2554 5d/pop-to-ebp + 2555 c3/return + 2556 + 2557 test-float-var-in-wrong-register: + 2558 # . prologue + 2559 55/push-ebp + 2560 89/<- %ebp 4/r32/esp + 2561 # setup + 2562 (clear-stream _test-input-stream) + 2563 (clear-stream $_test-input-buffered-file->buffer) + 2564 (clear-stream _test-output-stream) + 2565 (clear-stream $_test-output-buffered-file->buffer) + 2566 (clear-stream _test-error-stream) + 2567 (clear-stream $_test-error-buffered-file->buffer) + 2568 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 2569 68/push 0/imm32 + 2570 68/push 0/imm32 + 2571 89/<- %edx 4/r32/esp + 2572 (tailor-exit-descriptor %edx 0x10) + 2573 # + 2574 (write _test-input-stream "fn foo {\n") + 2575 (write _test-input-stream " var x/eax: int <- copy 0\n") + 2576 (write _test-input-stream " var y/eax: float <- convert x\n") + 2577 (write _test-input-stream "}\n") + 2578 # convert + 2579 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2580 # registers except esp clobbered at this point + 2581 # restore ed + 2582 89/<- %edx 4/r32/esp + 2583 (flush _test-output-buffered-file) + 2584 (flush _test-error-buffered-file) + 2585 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 2591 # check output + 2592 (check-stream-equal _test-output-stream "" "F - test-float-var-in-wrong-register: output should be empty") + 2593 (check-next-stream-line-equal _test-error-stream "fn foo: float var 'y' should be in a floating-point register" "F - test-float-var-in-wrong-register: error message") + 2594 # check that stop(1) was called + 2595 (check-ints-equal *(edx+4) 2 "F - test-float-var-in-wrong-register: exit status") + 2596 # don't restore from ebp + 2597 81 0/subop/add %esp 8/imm32 + 2598 # . epilogue + 2599 5d/pop-to-ebp + 2600 c3/return + 2601 + 2602 test-non-float-var-in-wrong-register: + 2603 # . prologue + 2604 55/push-ebp + 2605 89/<- %ebp 4/r32/esp + 2606 # setup + 2607 (clear-stream _test-input-stream) + 2608 (clear-stream $_test-input-buffered-file->buffer) + 2609 (clear-stream _test-output-stream) + 2610 (clear-stream $_test-output-buffered-file->buffer) + 2611 (clear-stream _test-error-stream) + 2612 (clear-stream $_test-error-buffered-file->buffer) + 2613 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 2614 68/push 0/imm32 + 2615 68/push 0/imm32 + 2616 89/<- %edx 4/r32/esp + 2617 (tailor-exit-descriptor %edx 0x10) + 2618 # + 2619 (write _test-input-stream "fn foo {\n") + 2620 (write _test-input-stream " var x/xmm5: int <- copy 0\n") + 2621 (write _test-input-stream "}\n") + 2622 # convert + 2623 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2624 # registers except esp clobbered at this point + 2625 # restore ed + 2626 89/<- %edx 4/r32/esp + 2627 (flush _test-output-buffered-file) + 2628 (flush _test-error-buffered-file) + 2629 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 2635 # check output + 2636 (check-stream-equal _test-output-stream "" "F - test-non-float-var-in-wrong-register: output should be empty") + 2637 (check-next-stream-line-equal _test-error-stream "fn foo: non-float var 'x' should be in an integer register" "F - test-non-float-var-in-wrong-register: error message") + 2638 # check that stop(1) was called + 2639 (check-ints-equal *(edx+4) 2 "F - test-non-float-var-in-wrong-register: exit status") + 2640 # don't restore from ebp + 2641 81 0/subop/add %esp 8/imm32 + 2642 # . epilogue + 2643 5d/pop-to-ebp + 2644 c3/return + 2645 + 2646 test-convert-function-with-allocate: + 2647 # . prologue + 2648 55/push-ebp + 2649 89/<- %ebp 4/r32/esp + 2650 # setup + 2651 (clear-stream _test-input-stream) + 2652 (clear-stream $_test-input-buffered-file->buffer) + 2653 (clear-stream _test-output-stream) + 2654 (clear-stream $_test-output-buffered-file->buffer) + 2655 # + 2656 (write _test-input-stream "fn foo {\n") + 2657 (write _test-input-stream " var x/ecx: (addr handle int) <- copy 0\n") + 2658 (write _test-input-stream " allocate x\n") + 2659 (write _test-input-stream "}\n") + 2660 # convert + 2661 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2662 (flush _test-output-buffered-file) + 2663 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2669 # check output + 2670 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-allocate/0") + 2671 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-allocate/1") + 2672 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-allocate/2") + 2673 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-allocate/3") + 2674 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-allocate/4") + 2675 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-allocate/5") + 2676 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-allocate/6") + 2677 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-allocate/7") + 2678 (check-next-stream-line-equal _test-output-stream " (allocate Heap 0x00000004 %ecx)" "F - test-convert-function-with-allocate/8") # 4 = size-of(int) + 2679 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-allocate/9") + 2680 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-allocate/10") + 2681 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-allocate/11") + 2682 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-allocate/12") + 2683 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-allocate/13") + 2684 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-allocate/14") + 2685 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-allocate/15") + 2686 # . epilogue + 2687 89/<- %esp 5/r32/ebp + 2688 5d/pop-to-ebp + 2689 c3/return + 2690 + 2691 test-initializer-in-hex: + 2692 # . prologue + 2693 55/push-ebp + 2694 89/<- %ebp 4/r32/esp + 2695 # setup + 2696 (clear-stream _test-input-stream) + 2697 (clear-stream $_test-input-buffered-file->buffer) + 2698 (clear-stream _test-output-stream) + 2699 (clear-stream $_test-output-buffered-file->buffer) + 2700 (clear-stream _test-error-stream) + 2701 (clear-stream $_test-error-buffered-file->buffer) + 2702 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 2703 68/push 0/imm32 + 2704 68/push 0/imm32 + 2705 89/<- %edx 4/r32/esp + 2706 (tailor-exit-descriptor %edx 0x10) + 2707 # + 2708 (write _test-input-stream "fn foo {\n") + 2709 (write _test-input-stream " var x/ecx: int <- copy 10\n") + 2710 (write _test-input-stream "}\n") + 2711 # convert + 2712 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2713 # registers except esp clobbered at this point + 2714 # restore ed + 2715 89/<- %edx 4/r32/esp + 2716 (flush _test-output-buffered-file) + 2717 (flush _test-error-buffered-file) + 2718 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 2724 # check output + 2725 (check-stream-equal _test-output-stream "" "F - test-initializer-in-hex: output should be empty") + 2726 (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") + 2727 # check that stop(1) was called + 2728 (check-ints-equal *(edx+4) 2 "F - test-initializer-in-hex: exit status") + 2729 # don't restore from ebp + 2730 81 0/subop/add %esp 8/imm32 + 2731 # . epilogue + 2732 5d/pop-to-ebp + 2733 c3/return + 2734 + 2735 test-convert-function-with-second-local-var-in-same-reg: + 2736 # . prologue + 2737 55/push-ebp + 2738 89/<- %ebp 4/r32/esp + 2739 # setup + 2740 (clear-stream _test-input-stream) + 2741 (clear-stream $_test-input-buffered-file->buffer) + 2742 (clear-stream _test-output-stream) + 2743 (clear-stream $_test-output-buffered-file->buffer) + 2744 # + 2745 (write _test-input-stream "fn foo {\n") + 2746 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 2747 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 2748 (write _test-input-stream " y <- increment\n") + 2749 (write _test-input-stream "}\n") + 2750 # convert + 2751 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2752 (flush _test-output-buffered-file) + 2753 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2759 # check output + 2760 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-second-local-var-in-same-reg/0") + 2761 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-second-local-var-in-same-reg/1") + 2762 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/2") + 2763 (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") + 2764 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-second-local-var-in-same-reg/4") + 2765 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-second-local-var-in-same-reg/5") + 2766 (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") + 2767 (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") + 2768 (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") + 2769 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-second-local-var-in-same-reg/9") + 2770 (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") + 2771 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-second-local-var-in-same-reg/11") + 2772 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-second-local-var-in-same-reg/12") + 2773 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-second-local-var-in-same-reg/13") + 2774 (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") + 2775 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/15") + 2776 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-second-local-var-in-same-reg/16") + 2777 # . epilogue + 2778 89/<- %esp 5/r32/ebp + 2779 5d/pop-to-ebp + 2780 c3/return + 2781 + 2782 test-read-clobbered-reg-var: + 2783 # . prologue + 2784 55/push-ebp + 2785 89/<- %ebp 4/r32/esp + 2786 # setup + 2787 (clear-stream _test-input-stream) + 2788 (clear-stream $_test-input-buffered-file->buffer) + 2789 (clear-stream _test-output-stream) + 2790 (clear-stream $_test-output-buffered-file->buffer) + 2791 (clear-stream _test-error-stream) + 2792 (clear-stream $_test-error-buffered-file->buffer) + 2793 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu + 2794 68/push 0/imm32 + 2795 68/push 0/imm32 + 2796 89/<- %edx 4/r32/esp + 2797 (tailor-exit-descriptor %edx 0x10) + 2798 # + 2799 (write _test-input-stream "fn foo {\n") + 2800 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 2801 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 2802 (write _test-input-stream " x <- increment\n") + 2803 (write _test-input-stream "}\n") + 2804 # convert + 2805 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2806 # registers except esp clobbered at this point + 2807 # restore ed + 2808 89/<- %edx 4/r32/esp + 2809 (flush _test-output-buffered-file) + 2810 (flush _test-error-buffered-file) + 2811 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 2817 # check output + 2818 (check-stream-equal _test-output-stream "" "F - test-read-clobbered-reg-var: output should be empty") + 2819 (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") + 2820 # check that stop(1) was called + 2821 (check-ints-equal *(edx+4) 2 "F - test-read-clobbered-reg-var: exit status") + 2822 # don't restore from ebp + 2823 81 0/subop/add %esp 8/imm32 + 2824 # . epilogue + 2825 5d/pop-to-ebp + 2826 c3/return + 2827 + 2828 test-overlapping-int-fp-registers: + 2829 # . prologue + 2830 55/push-ebp + 2831 89/<- %ebp 4/r32/esp + 2832 # setup + 2833 (clear-stream _test-input-stream) + 2834 (clear-stream $_test-input-buffered-file->buffer) + 2835 (clear-stream _test-output-stream) + 2836 (clear-stream $_test-output-buffered-file->buffer) + 2837 (clear-stream _test-error-stream) + 2838 (clear-stream $_test-error-buffered-file->buffer) + 2839 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu + 2840 68/push 0/imm32 + 2841 68/push 0/imm32 + 2842 89/<- %edx 4/r32/esp + 2843 (tailor-exit-descriptor %edx 0x10) + 2844 # + 2845 (write _test-input-stream "fn foo {\n") + 2846 (write _test-input-stream " var x/eax: int <- copy 3\n") + 2847 (write _test-input-stream " var y/xmm0: float <- convert x\n") + 2848 (write _test-input-stream " x <- increment\n") + 2849 (write _test-input-stream "}\n") + 2850 # convert + 2851 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2852 # registers except esp clobbered at this point + 2853 # restore ed + 2854 89/<- %edx 4/r32/esp + 2855 (flush _test-output-buffered-file) + 2856 (flush _test-error-buffered-file) + 2857 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 2863 # no errors + 2864 (check-next-stream-line-equal _test-error-stream "" "F - test-overlapping-int-fp-registers: error message") + 2865 # don't bother checking the generated code + 2866 # don't restore from ebp + 2867 81 0/subop/add %esp 8/imm32 + 2868 # . epilogue + 2869 5d/pop-to-ebp + 2870 c3/return + 2871 + 2872 test-convert-function-call: + 2873 # . prologue + 2874 55/push-ebp + 2875 89/<- %ebp 4/r32/esp + 2876 # setup + 2877 (clear-stream _test-input-stream) + 2878 (clear-stream $_test-input-buffered-file->buffer) + 2879 (clear-stream _test-output-stream) + 2880 (clear-stream $_test-output-buffered-file->buffer) + 2881 # + 2882 (write _test-input-stream "fn main -> _/ebx: int {\n") + 2883 (write _test-input-stream " var result/ebx: int <- foo\n") + 2884 (write _test-input-stream " return result\n") + 2885 (write _test-input-stream "}\n") + 2886 (write _test-input-stream "fn foo -> _/ebx: int {\n") + 2887 (write _test-input-stream " var result/ebx: int <- copy 3\n") + 2888 (write _test-input-stream " return result\n") + 2889 (write _test-input-stream "}\n") + 2890 # convert + 2891 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2892 (flush _test-output-buffered-file) + 2893 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2899 # check output + 2900 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call/0") + 2901 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call/1") + 2902 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call/2") + 2903 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call/3") + 2904 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call/4") + 2905 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call/5") + 2906 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-call-with-literal-arg/6") + 2907 (check-next-stream-line-equal _test-output-stream " (foo)" "F - test-convert-function-call/6") + 2908 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") + 2909 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") + 2910 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") + 2911 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call/7") + 2912 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call/8") + 2913 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call/9") + 2914 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call/10") + 2915 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call/11") + 2916 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call/12") + 2917 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call/13") + 2918 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call/14") + 2919 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call/15") + 2920 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call/16") + 2921 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call/17") + 2922 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-call/18") + 2923 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-call-with-literal-arg/6") + 2924 (check-next-stream-line-equal _test-output-stream " bb/copy-to-ebx 3/imm32" "F - test-convert-function-call/19") + 2925 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") + 2926 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") + 2927 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-call-with-literal-arg/10") + 2928 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call/20") + 2929 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-call/21") + 2930 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call/22") + 2931 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call/23") + 2932 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call/24") + 2933 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call/25") + 2934 # . epilogue + 2935 89/<- %esp 5/r32/ebp + 2936 5d/pop-to-ebp + 2937 c3/return + 2938 + 2939 test-convert-function-call-with-inout-with-compound-type: + 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 f {\n") + 2950 (write _test-input-stream " var x: (addr int)\n") + 2951 (write _test-input-stream " g x\n") + 2952 (write _test-input-stream "}\n") + 2953 (write _test-input-stream "fn g a: (addr int) {\n") + 2954 (write _test-input-stream "}\n") + 2955 # convert + 2956 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2957 (flush _test-output-buffered-file) + 2958 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2964 # check output + 2965 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-inout-with-compound-type/0") + 2966 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-inout-with-compound-type/1") + 2967 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-inout-with-compound-type/2") + 2968 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-inout-with-compound-type/3") + 2969 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-inout-with-compound-type/4") + 2970 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-inout-with-compound-type/5") + 2971 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-inout-with-compound-type/6") + 2972 (check-next-stream-line-equal _test-output-stream " (g *(ebp+0xfffffffc))" "F - test-convert-function-call-with-inout-with-compound-type/7") + 2973 (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") + 2974 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-inout-with-compound-type/9") + 2975 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-inout-with-compound-type/10") + 2976 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-inout-with-compound-type/11") + 2977 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-inout-with-compound-type/12") + 2978 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-inout-with-compound-type/13") + 2979 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-inout-with-compound-type/14") + 2980 (check-next-stream-line-equal _test-output-stream "g:" "F - test-convert-function-call-with-inout-with-compound-type/15") + 2981 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-inout-with-compound-type/16") + 2982 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-inout-with-compound-type/17") + 2983 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-inout-with-compound-type/18") + 2984 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-inout-with-compound-type/19") + 2985 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-inout-with-compound-type/20") + 2986 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-inout-with-compound-type/21") + 2987 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-inout-with-compound-type/22") + 2988 # . epilogue + 2989 89/<- %esp 5/r32/ebp + 2990 5d/pop-to-ebp + 2991 c3/return + 2992 + 2993 test-convert-function-call-with-inout-with-type-parameter: + 2994 # . prologue + 2995 55/push-ebp + 2996 89/<- %ebp 4/r32/esp + 2997 # setup + 2998 (clear-stream _test-input-stream) + 2999 (clear-stream $_test-input-buffered-file->buffer) + 3000 (clear-stream _test-output-stream) + 3001 (clear-stream $_test-output-buffered-file->buffer) + 3002 (clear-stream _test-error-stream) + 3003 (clear-stream $_test-error-buffered-file->buffer) + 3004 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3005 68/push 0/imm32 + 3006 68/push 0/imm32 + 3007 89/<- %edx 4/r32/esp + 3008 (tailor-exit-descriptor %edx 0x10) + 3009 # + 3010 (write _test-input-stream "fn f {\n") + 3011 (write _test-input-stream " var x: (addr int)\n") + 3012 (write _test-input-stream " g x\n") + 3013 (write _test-input-stream "}\n") + 3014 (write _test-input-stream "fn g a: (addr _) {\n") + 3015 (write _test-input-stream "}\n") + 3016 # convert + 3017 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3018 # registers except esp clobbered at this point + 3019 # restore ed + 3020 89/<- %edx 4/r32/esp + 3021 (flush _test-output-buffered-file) + 3022 (flush _test-error-buffered-file) + 3023 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3029 # no error; types matched + 3030 (check-stream-equal _test-error-stream "" "F - test-convert-function-call-with-inout-with-type-parameter: error stream should be empty") + 3031 # don't bother checking the generated code; that's in the test 'test-local-clobbered-by-fn-output' below + 3032 # don't restore from ebp + 3033 81 0/subop/add %esp 8/imm32 + 3034 # . epilogue + 3035 5d/pop-to-ebp + 3036 c3/return + 3037 + 3038 test-convert-function-call-with-incorrect-inout-type: + 3039 # . prologue + 3040 55/push-ebp + 3041 89/<- %ebp 4/r32/esp + 3042 # setup + 3043 (clear-stream _test-input-stream) + 3044 (clear-stream $_test-input-buffered-file->buffer) + 3045 (clear-stream _test-output-stream) + 3046 (clear-stream $_test-output-buffered-file->buffer) + 3047 (clear-stream _test-error-stream) + 3048 (clear-stream $_test-error-buffered-file->buffer) + 3049 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3050 68/push 0/imm32 + 3051 68/push 0/imm32 + 3052 89/<- %edx 4/r32/esp + 3053 (tailor-exit-descriptor %edx 0x10) + 3054 # + 3055 (write _test-input-stream "fn f {\n") + 3056 (write _test-input-stream " var x: int\n") + 3057 (write _test-input-stream " g x\n") + 3058 (write _test-input-stream "}\n") + 3059 (write _test-input-stream "fn g a: foo {\n") + 3060 (write _test-input-stream "}\n") + 3061 # convert + 3062 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3063 # registers except esp clobbered at this point + 3064 # restore ed + 3065 89/<- %edx 4/r32/esp + 3066 (flush _test-output-buffered-file) + 3067 (flush _test-error-buffered-file) + 3068 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3074 # check output + 3075 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-inout-type: output should be empty") + 3076 (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") + 3077 # check that stop(1) was called + 3078 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-inout-type: exit status") + 3079 # don't restore from ebp + 3080 81 0/subop/add %esp 8/imm32 + 3081 5d/pop-to-ebp + 3082 c3/return + 3083 + 3084 test-convert-function-call-with-inout-with-incorrect-compound-type: + 3085 # . prologue + 3086 55/push-ebp + 3087 89/<- %ebp 4/r32/esp + 3088 # setup + 3089 (clear-stream _test-input-stream) + 3090 (clear-stream $_test-input-buffered-file->buffer) + 3091 (clear-stream _test-output-stream) + 3092 (clear-stream $_test-output-buffered-file->buffer) + 3093 (clear-stream _test-error-stream) + 3094 (clear-stream $_test-error-buffered-file->buffer) + 3095 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3096 68/push 0/imm32 + 3097 68/push 0/imm32 + 3098 89/<- %edx 4/r32/esp + 3099 (tailor-exit-descriptor %edx 0x10) + 3100 # + 3101 (write _test-input-stream "fn f {\n") + 3102 (write _test-input-stream " var x: (addr int)\n") + 3103 (write _test-input-stream " g x\n") + 3104 (write _test-input-stream "}\n") + 3105 (write _test-input-stream "fn g a: (addr bool) {\n") + 3106 (write _test-input-stream "}\n") + 3107 # convert + 3108 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3109 # registers except esp clobbered at this point + 3110 # restore ed + 3111 89/<- %edx 4/r32/esp + 3112 (flush _test-output-buffered-file) + 3113 (flush _test-error-buffered-file) + 3114 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3120 # check output + 3121 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-inout-with-incorrect-compound-type: output should be empty") + 3122 (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") + 3123 # don't restore from ebp + 3124 81 0/subop/add %esp 8/imm32 + 3125 # . epilogue + 3126 5d/pop-to-ebp + 3127 c3/return + 3128 + 3129 test-convert-function-call-with-inout-with-multiple-type-parameters: + 3130 # . prologue + 3131 55/push-ebp + 3132 89/<- %ebp 4/r32/esp + 3133 # setup + 3134 (clear-stream _test-input-stream) + 3135 (clear-stream $_test-input-buffered-file->buffer) + 3136 (clear-stream _test-output-stream) + 3137 (clear-stream $_test-output-buffered-file->buffer) + 3138 (clear-stream _test-error-stream) + 3139 (clear-stream $_test-error-buffered-file->buffer) + 3140 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3141 68/push 0/imm32 + 3142 68/push 0/imm32 + 3143 89/<- %edx 4/r32/esp + 3144 (tailor-exit-descriptor %edx 0x10) + 3145 # + 3146 (write _test-input-stream "fn f {\n") + 3147 (write _test-input-stream " var x: (addr int)\n") + 3148 (write _test-input-stream " var y: (addr int)\n") + 3149 (write _test-input-stream " g x, y\n") + 3150 (write _test-input-stream "}\n") + 3151 (write _test-input-stream "fn g a: (addr _), b: (addr _) {\n") + 3152 (write _test-input-stream "}\n") + 3153 # convert + 3154 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3155 # registers except esp clobbered at this point + 3156 # restore ed + 3157 89/<- %edx 4/r32/esp + 3158 (flush _test-output-buffered-file) + 3159 (flush _test-error-buffered-file) + 3160 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3166 # no errors + 3167 (check-stream-equal _test-error-stream "" "F - test-convert-function-call-with-inout-with-multiple-type-parameters: error stream should be empty") + 3168 # don't bother checking the generated code + 3169 # don't restore from ebp + 3170 81 0/subop/add %esp 8/imm32 + 3171 # . epilogue + 3172 5d/pop-to-ebp + 3173 c3/return + 3174 + 3175 test-type-parameter-matches-rest-of-type: + 3176 # . prologue + 3177 55/push-ebp + 3178 89/<- %ebp 4/r32/esp + 3179 # setup + 3180 (clear-stream _test-input-stream) + 3181 (clear-stream $_test-input-buffered-file->buffer) + 3182 (clear-stream _test-output-stream) + 3183 (clear-stream $_test-output-buffered-file->buffer) + 3184 (clear-stream _test-error-stream) + 3185 (clear-stream $_test-error-buffered-file->buffer) + 3186 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3187 68/push 0/imm32 + 3188 68/push 0/imm32 + 3189 89/<- %edx 4/r32/esp + 3190 (tailor-exit-descriptor %edx 0x10) + 3191 # + 3192 (write _test-input-stream "fn f {\n") + 3193 (write _test-input-stream " var x: (addr array int)\n") + 3194 (write _test-input-stream " g x\n") + 3195 (write _test-input-stream "}\n") + 3196 (write _test-input-stream "fn g a: (addr _) {\n") + 3197 (write _test-input-stream "}\n") + 3198 # convert + 3199 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3200 # registers except esp clobbered at this point + 3201 # restore ed + 3202 89/<- %edx 4/r32/esp + 3203 (flush _test-output-buffered-file) + 3204 (flush _test-error-buffered-file) + 3205 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3211 # no errors + 3212 (check-stream-equal _test-error-stream "" "F - test-type-parameter-matches-rest-of-type: error stream should be empty") + 3213 # don't bother checking the generated code + 3214 # don't restore from ebp + 3215 81 0/subop/add %esp 8/imm32 + 3216 # . epilogue + 3217 5d/pop-to-ebp + 3218 c3/return + 3219 + 3220 test-convert-function-call-with-inout-with-incompatible-type-parameters: + 3221 # . prologue + 3222 55/push-ebp + 3223 89/<- %ebp 4/r32/esp + 3224 # setup + 3225 (clear-stream _test-input-stream) + 3226 (clear-stream $_test-input-buffered-file->buffer) + 3227 (clear-stream _test-output-stream) + 3228 (clear-stream $_test-output-buffered-file->buffer) + 3229 (clear-stream _test-error-stream) + 3230 (clear-stream $_test-error-buffered-file->buffer) + 3231 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3232 68/push 0/imm32 + 3233 68/push 0/imm32 + 3234 89/<- %edx 4/r32/esp + 3235 (tailor-exit-descriptor %edx 0x10) + 3236 # + 3237 (write _test-input-stream "fn f {\n") + 3238 (write _test-input-stream " var x: (addr int)\n") + 3239 (write _test-input-stream " var y: (addr boolean)\n") + 3240 (write _test-input-stream " g x, y\n") + 3241 (write _test-input-stream "}\n") + 3242 (write _test-input-stream "fn g a: (addr _T), b: (addr _T) {\n") + 3243 (write _test-input-stream "}\n") + 3244 # convert + 3245 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3246 # registers except esp clobbered at this point + 3247 # restore ed + 3248 89/<- %edx 4/r32/esp + 3249 (flush _test-output-buffered-file) + 3250 (flush _test-error-buffered-file) + 3251 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3257 # check output + 3258 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-inout-with-incompatible-type-parameters: output should be empty") + 3259 (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") + 3260 # don't restore from ebp + 3261 81 0/subop/add %esp 8/imm32 + 3262 # . epilogue + 3263 5d/pop-to-ebp + 3264 c3/return + 3265 + 3266 test-convert-function-call-with-too-few-inouts: + 3267 # . prologue + 3268 55/push-ebp + 3269 89/<- %ebp 4/r32/esp + 3270 # setup + 3271 (clear-stream _test-input-stream) + 3272 (clear-stream $_test-input-buffered-file->buffer) + 3273 (clear-stream _test-output-stream) + 3274 (clear-stream $_test-output-buffered-file->buffer) + 3275 (clear-stream _test-error-stream) + 3276 (clear-stream $_test-error-buffered-file->buffer) + 3277 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3278 68/push 0/imm32 + 3279 68/push 0/imm32 + 3280 89/<- %edx 4/r32/esp + 3281 (tailor-exit-descriptor %edx 0x10) + 3282 # + 3283 (write _test-input-stream "fn f {\n") + 3284 (write _test-input-stream " g\n") + 3285 (write _test-input-stream "}\n") + 3286 (write _test-input-stream "fn g a: int {\n") + 3287 (write _test-input-stream "}\n") + 3288 # convert + 3289 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3290 # registers except esp clobbered at this point + 3291 # restore ed + 3292 89/<- %edx 4/r32/esp + 3293 (flush _test-output-buffered-file) + 3294 (flush _test-error-buffered-file) + 3295 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3301 # check output + 3302 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-few-inouts: output should be empty") + 3303 (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") + 3304 # check that stop(1) was called + 3305 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-few-inouts: exit status") + 3306 # don't restore from ebp + 3307 81 0/subop/add %esp 8/imm32 + 3308 5d/pop-to-ebp + 3309 c3/return + 3310 + 3311 test-convert-function-call-with-too-many-inouts: + 3312 # . prologue + 3313 55/push-ebp + 3314 89/<- %ebp 4/r32/esp + 3315 # setup + 3316 (clear-stream _test-input-stream) + 3317 (clear-stream $_test-input-buffered-file->buffer) + 3318 (clear-stream _test-output-stream) + 3319 (clear-stream $_test-output-buffered-file->buffer) + 3320 (clear-stream _test-error-stream) + 3321 (clear-stream $_test-error-buffered-file->buffer) + 3322 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3323 68/push 0/imm32 + 3324 68/push 0/imm32 + 3325 89/<- %edx 4/r32/esp + 3326 (tailor-exit-descriptor %edx 0x10) + 3327 # + 3328 (write _test-input-stream "fn f {\n") + 3329 (write _test-input-stream " var x: int\n") + 3330 (write _test-input-stream " g x\n") + 3331 (write _test-input-stream "}\n") + 3332 (write _test-input-stream "fn g {\n") + 3333 (write _test-input-stream "}\n") + 3334 # convert + 3335 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3336 # registers except esp clobbered at this point + 3337 # restore ed + 3338 89/<- %edx 4/r32/esp + 3339 (flush _test-output-buffered-file) + 3340 (flush _test-error-buffered-file) + 3341 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3347 # check output + 3348 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-many-inouts: output should be empty") + 3349 (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") + 3350 # check that stop(1) was called + 3351 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-many-inouts: exit status") + 3352 # don't restore from ebp + 3353 81 0/subop/add %esp 8/imm32 + 3354 5d/pop-to-ebp + 3355 c3/return + 3356 + 3357 test-convert-function-call-with-incorrect-output-type: + 3358 # . prologue + 3359 55/push-ebp + 3360 89/<- %ebp 4/r32/esp + 3361 # setup + 3362 (clear-stream _test-input-stream) + 3363 (clear-stream $_test-input-buffered-file->buffer) + 3364 (clear-stream _test-output-stream) + 3365 (clear-stream $_test-output-buffered-file->buffer) + 3366 (clear-stream _test-error-stream) + 3367 (clear-stream $_test-error-buffered-file->buffer) + 3368 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3369 68/push 0/imm32 + 3370 68/push 0/imm32 + 3371 89/<- %edx 4/r32/esp + 3372 (tailor-exit-descriptor %edx 0x10) + 3373 # + 3374 (write _test-input-stream "fn f {\n") + 3375 (write _test-input-stream " var x/eax: int <- g\n") + 3376 (write _test-input-stream "}\n") + 3377 (write _test-input-stream "fn g -> _/eax: foo {\n") + 3378 (write _test-input-stream "}\n") + 3379 # convert + 3380 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3381 # registers except esp clobbered at this point + 3382 # restore ed + 3383 89/<- %edx 4/r32/esp + 3384 (flush _test-output-buffered-file) + 3385 (flush _test-error-buffered-file) + 3386 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3392 # check output + 3393 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-output-type: output should be empty") + 3394 (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") + 3395 # check that stop(1) was called + 3396 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-output-type: exit status") + 3397 # don't restore from ebp + 3398 81 0/subop/add %esp 8/imm32 + 3399 5d/pop-to-ebp + 3400 c3/return + 3401 + 3402 test-convert-function-call-with-too-few-outputs: + 3403 # . prologue + 3404 55/push-ebp + 3405 89/<- %ebp 4/r32/esp + 3406 # setup + 3407 (clear-stream _test-input-stream) + 3408 (clear-stream $_test-input-buffered-file->buffer) + 3409 (clear-stream _test-output-stream) + 3410 (clear-stream $_test-output-buffered-file->buffer) + 3411 (clear-stream _test-error-stream) + 3412 (clear-stream $_test-error-buffered-file->buffer) + 3413 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3414 68/push 0/imm32 + 3415 68/push 0/imm32 + 3416 89/<- %edx 4/r32/esp + 3417 (tailor-exit-descriptor %edx 0x10) + 3418 # + 3419 (write _test-input-stream "fn f {\n") + 3420 (write _test-input-stream " g\n") + 3421 (write _test-input-stream "}\n") + 3422 (write _test-input-stream "fn g -> _/eax: int {\n") + 3423 (write _test-input-stream "}\n") + 3424 # convert + 3425 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3426 # registers except esp clobbered at this point + 3427 # restore ed + 3428 89/<- %edx 4/r32/esp + 3429 (flush _test-output-buffered-file) + 3430 (flush _test-error-buffered-file) + 3431 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3437 # check output + 3438 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-few-outputs: output should be empty") + 3439 (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") + 3440 # check that stop(1) was called + 3441 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-few-outputs: exit status") + 3442 # don't restore from ebp + 3443 81 0/subop/add %esp 8/imm32 + 3444 5d/pop-to-ebp + 3445 c3/return + 3446 + 3447 test-convert-function-call-with-too-many-outputs: + 3448 # . prologue + 3449 55/push-ebp + 3450 89/<- %ebp 4/r32/esp + 3451 # setup + 3452 (clear-stream _test-input-stream) + 3453 (clear-stream $_test-input-buffered-file->buffer) + 3454 (clear-stream _test-output-stream) + 3455 (clear-stream $_test-output-buffered-file->buffer) + 3456 (clear-stream _test-error-stream) + 3457 (clear-stream $_test-error-buffered-file->buffer) + 3458 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3459 68/push 0/imm32 + 3460 68/push 0/imm32 + 3461 89/<- %edx 4/r32/esp + 3462 (tailor-exit-descriptor %edx 0x10) + 3463 # + 3464 (write _test-input-stream "fn f {\n") + 3465 (write _test-input-stream " var x/eax: int <- g\n") + 3466 (write _test-input-stream "}\n") + 3467 (write _test-input-stream "fn g {\n") + 3468 (write _test-input-stream "}\n") + 3469 # convert + 3470 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3471 # registers except esp clobbered at this point + 3472 # restore ed + 3473 89/<- %edx 4/r32/esp + 3474 (flush _test-output-buffered-file) + 3475 (flush _test-error-buffered-file) + 3476 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3482 # check output + 3483 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-many-outputs: output should be empty") + 3484 (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") + 3485 # check that stop(1) was called + 3486 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-many-outputs: exit status") + 3487 # don't restore from ebp + 3488 81 0/subop/add %esp 8/imm32 + 3489 5d/pop-to-ebp + 3490 c3/return + 3491 + 3492 test-convert-function-call-with-missing-output-register: + 3493 # . prologue + 3494 55/push-ebp + 3495 89/<- %ebp 4/r32/esp + 3496 # setup + 3497 (clear-stream _test-input-stream) + 3498 (clear-stream $_test-input-buffered-file->buffer) + 3499 (clear-stream _test-output-stream) + 3500 (clear-stream $_test-output-buffered-file->buffer) + 3501 (clear-stream _test-error-stream) + 3502 (clear-stream $_test-error-buffered-file->buffer) + 3503 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3504 68/push 0/imm32 + 3505 68/push 0/imm32 + 3506 89/<- %edx 4/r32/esp + 3507 (tailor-exit-descriptor %edx 0x10) + 3508 # + 3509 (write _test-input-stream "fn f {\n") + 3510 (write _test-input-stream " var x: int\n") + 3511 (write _test-input-stream " x <- g\n") + 3512 (write _test-input-stream "}\n") + 3513 (write _test-input-stream "fn g -> _/eax: int {\n") + 3514 (write _test-input-stream "}\n") + 3515 # convert + 3516 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3517 # registers except esp clobbered at this point + 3518 # restore ed + 3519 89/<- %edx 4/r32/esp + 3520 (flush _test-output-buffered-file) + 3521 (flush _test-error-buffered-file) + 3522 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3528 # check output + 3529 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-missing-output-register: output should be empty") + 3530 (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") + 3531 # check that stop(1) was called + 3532 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-missing-output-register: exit status") + 3533 # don't restore from ebp + 3534 81 0/subop/add %esp 8/imm32 + 3535 5d/pop-to-ebp + 3536 c3/return + 3537 + 3538 test-convert-function-call-with-incorrect-output-register: + 3539 # . prologue + 3540 55/push-ebp + 3541 89/<- %ebp 4/r32/esp + 3542 # setup + 3543 (clear-stream _test-input-stream) + 3544 (clear-stream $_test-input-buffered-file->buffer) + 3545 (clear-stream _test-output-stream) + 3546 (clear-stream $_test-output-buffered-file->buffer) + 3547 (clear-stream _test-error-stream) + 3548 (clear-stream $_test-error-buffered-file->buffer) + 3549 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3550 68/push 0/imm32 + 3551 68/push 0/imm32 + 3552 89/<- %edx 4/r32/esp + 3553 (tailor-exit-descriptor %edx 0x10) + 3554 # + 3555 (write _test-input-stream "fn f {\n") + 3556 (write _test-input-stream " var x/ecx: int <- g\n") + 3557 (write _test-input-stream "}\n") + 3558 (write _test-input-stream "fn g -> _/eax: int {\n") + 3559 (write _test-input-stream "}\n") + 3560 # convert + 3561 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3562 # registers except esp clobbered at this point + 3563 # restore ed + 3564 89/<- %edx 4/r32/esp + 3565 (flush _test-output-buffered-file) + 3566 (flush _test-error-buffered-file) + 3567 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3573 # check output + 3574 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-output-register: output should be empty") + 3575 (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") + 3576 # check that stop(1) was called + 3577 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-output-register: exit status") + 3578 # don't restore from ebp + 3579 81 0/subop/add %esp 8/imm32 + 3580 5d/pop-to-ebp + 3581 c3/return + 3582 + 3583 test-convert-function-with-local-var-dereferenced: + 3584 # . prologue + 3585 55/push-ebp + 3586 89/<- %ebp 4/r32/esp + 3587 # setup + 3588 (clear-stream _test-input-stream) + 3589 (clear-stream $_test-input-buffered-file->buffer) + 3590 (clear-stream _test-output-stream) + 3591 (clear-stream $_test-output-buffered-file->buffer) + 3592 # + 3593 (write _test-input-stream "fn foo {\n") + 3594 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n") + 3595 (write _test-input-stream " increment *x\n") + 3596 (write _test-input-stream "}\n") + 3597 # convert + 3598 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3599 (flush _test-output-buffered-file) + 3600 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3606 # check output + 3607 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0") + 3608 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1") + 3609 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2") + 3610 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3") + 3611 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4") + 3612 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5") + 3613 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6") + 3614 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7") + 3615 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8") + 3616 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9") + 3617 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10") + 3618 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11") + 3619 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12") + 3620 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13") + 3621 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14") + 3622 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15") + 3623 # . epilogue + 3624 89/<- %esp 5/r32/ebp + 3625 5d/pop-to-ebp + 3626 c3/return + 3627 + 3628 test-dereference-of-var-on-stack: + 3629 # . prologue + 3630 55/push-ebp + 3631 89/<- %ebp 4/r32/esp + 3632 # setup + 3633 (clear-stream _test-input-stream) + 3634 (clear-stream $_test-input-buffered-file->buffer) + 3635 (clear-stream _test-output-stream) + 3636 (clear-stream $_test-output-buffered-file->buffer) + 3637 (clear-stream _test-error-stream) + 3638 (clear-stream $_test-error-buffered-file->buffer) + 3639 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3640 68/push 0/imm32 + 3641 68/push 0/imm32 + 3642 89/<- %edx 4/r32/esp + 3643 (tailor-exit-descriptor %edx 0x10) + 3644 # + 3645 (write _test-input-stream "fn foo {\n") + 3646 (write _test-input-stream " var x: (addr int)\n") + 3647 (write _test-input-stream " increment *x\n") + 3648 (write _test-input-stream "}\n") + 3649 # convert + 3650 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3651 # registers except esp clobbered at this point + 3652 # restore ed + 3653 89/<- %edx 4/r32/esp + 3654 (flush _test-output-buffered-file) + 3655 (flush _test-error-buffered-file) + 3656 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3662 # check output + 3663 (check-stream-equal _test-output-stream "" "F - test-dereference-of-var-on-stack: output should be empty") + 3664 (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") + 3665 # check that stop(1) was called + 3666 (check-ints-equal *(edx+4) 2 "F - test-dereference-of-var-on-stack: exit status") + 3667 # don't restore from ebp + 3668 81 0/subop/add %esp 8/imm32 + 3669 # . epilogue + 3670 5d/pop-to-ebp + 3671 c3/return + 3672 + 3673 test-convert-function-with-byte-operations: + 3674 # . prologue + 3675 55/push-ebp + 3676 89/<- %ebp 4/r32/esp + 3677 # setup + 3678 (clear-stream _test-input-stream) + 3679 (clear-stream $_test-input-buffered-file->buffer) + 3680 (clear-stream _test-output-stream) + 3681 (clear-stream $_test-output-buffered-file->buffer) + 3682 # + 3683 (write _test-input-stream "fn foo {\n") + 3684 (write _test-input-stream " var x/eax: byte <- copy 0\n") + 3685 (write _test-input-stream " var y/ecx: byte <- copy 0\n") + 3686 (write _test-input-stream " y <- copy-byte x\n") + 3687 (write _test-input-stream " var z/edx: (addr byte) <- copy 0\n") + 3688 (write _test-input-stream " y <- copy-byte *z\n") + 3689 (write _test-input-stream " copy-byte-to *z, x\n") + 3690 (write _test-input-stream "}\n") + 3691 # convert + 3692 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3693 (flush _test-output-buffered-file) + 3694 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3700 # check output + 3701 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-byte-operations/0") + 3702 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-byte-operations/1") + 3703 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-byte-operations/2") + 3704 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-byte-operations/3") + 3705 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-byte-operations/4") + 3706 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-byte-operations/5") + 3707 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-byte-operations/6") + 3708 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-with-byte-operations/7") + 3709 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-byte-operations/8") + 3710 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-byte-operations/9") + 3711 (check-next-stream-line-equal _test-output-stream " 8a/byte-> %eax 0x00000001/r32" "F - test-convert-function-with-byte-operations/10") + 3712 (check-next-stream-line-equal _test-output-stream " 81 4/subop/and %ecx 0xff/imm32" "F - test-convert-function-with-byte-operations/11") + 3713 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-convert-function-with-byte-operations/12") + 3714 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 0/imm32" "F - test-convert-function-with-byte-operations/13") + 3715 (check-next-stream-line-equal _test-output-stream " 8a/byte-> *edx 0x00000001/r32" "F - test-convert-function-with-byte-operations/14") + 3716 (check-next-stream-line-equal _test-output-stream " 81 4/subop/and %ecx 0xff/imm32" "F - test-convert-function-with-byte-operations/15") + 3717 (check-next-stream-line-equal _test-output-stream " 88/byte<- *edx 0x00000000/r32" "F - test-convert-function-with-byte-operations/16") + 3718 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-convert-function-with-byte-operations/17") + 3719 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-byte-operations/18") + 3720 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-byte-operations/19") + 3721 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-byte-operations/20") + 3722 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-byte-operations/21") + 3723 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-byte-operations/22") + 3724 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-byte-operations/23") + 3725 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-byte-operations/24") + 3726 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-byte-operations/25") + 3727 # . epilogue + 3728 89/<- %esp 5/r32/ebp + 3729 5d/pop-to-ebp + 3730 c3/return + 3731 + 3732 # variables of type 'byte' are not allowed on the stack + 3733 test-byte-values-on-stack: + 3734 # . prologue + 3735 55/push-ebp + 3736 89/<- %ebp 4/r32/esp + 3737 # setup + 3738 (clear-stream _test-input-stream) + 3739 (clear-stream $_test-input-buffered-file->buffer) + 3740 (clear-stream _test-output-stream) + 3741 (clear-stream $_test-output-buffered-file->buffer) + 3742 (clear-stream _test-error-stream) + 3743 (clear-stream $_test-error-buffered-file->buffer) + 3744 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3745 68/push 0/imm32 + 3746 68/push 0/imm32 + 3747 89/<- %edx 4/r32/esp + 3748 (tailor-exit-descriptor %edx 0x10) + 3749 # + 3750 (write _test-input-stream "fn foo {\n") + 3751 (write _test-input-stream " var x: byte\n") + 3752 (write _test-input-stream "}\n") + 3753 # convert + 3754 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3755 # registers except esp clobbered at this point + 3756 # restore ed + 3757 89/<- %edx 4/r32/esp + 3758 (flush _test-output-buffered-file) + 3759 (flush _test-error-buffered-file) + 3760 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3766 # check output + 3767 (check-stream-equal _test-output-stream "" "F - test-byte-values-on-stack: output should be empty") + 3768 (check-next-stream-line-equal _test-error-stream "fn foo: var 'x' of type 'byte' cannot be on the stack" "F - test-byte-values-on-stack: error message") + 3769 # check that stop(1) was called + 3770 (check-ints-equal *(edx+4) 2 "F - test-byte-values-on-stack: exit status") + 3771 # don't restore from ebp + 3772 81 0/subop/add %esp 8/imm32 + 3773 # . epilogue + 3774 5d/pop-to-ebp + 3775 c3/return + 3776 + 3777 # variables of type 'byte' are not allowed in esi or edi + 3778 test-byte-values-in-unsupported-registers: + 3779 # . prologue + 3780 55/push-ebp + 3781 89/<- %ebp 4/r32/esp + 3782 # setup + 3783 (clear-stream _test-input-stream) + 3784 (clear-stream $_test-input-buffered-file->buffer) + 3785 (clear-stream _test-output-stream) + 3786 (clear-stream $_test-output-buffered-file->buffer) + 3787 (clear-stream _test-error-stream) + 3788 (clear-stream $_test-error-buffered-file->buffer) + 3789 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3790 68/push 0/imm32 3791 68/push 0/imm32 - 3792 68/push 0/imm32 - 3793 89/<- %edx 4/r32/esp - 3794 (tailor-exit-descriptor %edx 0x10) - 3795 # - 3796 (write _test-input-stream "fn foo {\n") - 3797 (write _test-input-stream " compare x, 0\n") - 3798 (write _test-input-stream "}\n") - 3799 # convert - 3800 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3801 # registers except esp clobbered at this point - 3802 # restore ed - 3803 89/<- %edx 4/r32/esp - 3804 (flush _test-output-buffered-file) - 3805 (flush _test-error-buffered-file) - 3806 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 3812 # check output - 3813 (check-stream-equal _test-output-stream "" "F - test-unknown-variable: output should be empty") - 3814 (check-next-stream-line-equal _test-error-stream "fn foo: unknown variable 'x'" "F - test-unknown-variable: error message") - 3815 # check that stop(1) was called - 3816 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable: exit status") - 3817 # don't restore from ebp - 3818 81 0/subop/add %esp 8/imm32 - 3819 # . epilogue - 3820 5d/pop-to-ebp - 3821 c3/return - 3822 - 3823 test-convert-function-with-local-var-in-block: + 3792 89/<- %edx 4/r32/esp + 3793 (tailor-exit-descriptor %edx 0x10) + 3794 # + 3795 (write _test-input-stream "fn foo {\n") + 3796 (write _test-input-stream " var x/esi: byte <- copy 0\n") + 3797 (write _test-input-stream "}\n") + 3798 # convert + 3799 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3800 # registers except esp clobbered at this point + 3801 # restore ed + 3802 89/<- %edx 4/r32/esp + 3803 (flush _test-output-buffered-file) + 3804 (flush _test-error-buffered-file) + 3805 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3811 # check output + 3812 (check-stream-equal _test-output-stream "" "F - test-byte-values-in-unsupported-registers: output should be empty") + 3813 (check-next-stream-line-equal _test-error-stream "fn foo: var 'x' of type 'byte' cannot be in esi or edi" "F - test-byte-values-in-unsupported-registers: error message") + 3814 # check that stop(1) was called + 3815 (check-ints-equal *(edx+4) 2 "F - test-byte-values-in-unsupported-registers: exit status") + 3816 # don't restore from ebp + 3817 81 0/subop/add %esp 8/imm32 + 3818 # . epilogue + 3819 5d/pop-to-ebp + 3820 c3/return + 3821 + 3822 # variables of type 'byte' _can_ be function args. They then occupy 4 bytes. + 3823 test-copy-byte-var-from-fn-arg: 3824 # . prologue 3825 55/push-ebp 3826 89/<- %ebp 4/r32/esp @@ -3542,1984 +3542,1984 @@ if ('onhashchange' in window) { 3830 (clear-stream _test-output-stream) 3831 (clear-stream $_test-output-buffered-file->buffer) 3832 # - 3833 (write _test-input-stream "fn foo {\n") - 3834 (write _test-input-stream " {\n") - 3835 (write _test-input-stream " var x: int\n") - 3836 (write _test-input-stream " increment x\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-local-var-in-block/0") - 3850 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1") - 3851 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2") - 3852 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3") - 3853 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4") - 3854 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5") - 3855 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6") - 3856 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7") - 3857 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8") - 3858 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9") - 3859 (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") - 3860 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11") - 3861 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12") - 3862 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13") - 3863 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14") - 3864 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15") - 3865 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16") - 3866 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17") - 3867 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18") - 3868 # . epilogue - 3869 89/<- %esp 5/r32/ebp - 3870 5d/pop-to-ebp - 3871 c3/return - 3872 - 3873 test-convert-function-with-local-var-in-mem-after-block: - 3874 # . prologue - 3875 55/push-ebp - 3876 89/<- %ebp 4/r32/esp - 3877 # setup - 3878 (clear-stream _test-input-stream) - 3879 (clear-stream $_test-input-buffered-file->buffer) - 3880 (clear-stream _test-output-stream) - 3881 (clear-stream $_test-output-buffered-file->buffer) - 3882 # - 3883 (write _test-input-stream "fn foo {\n") - 3884 (write _test-input-stream " {\n") - 3885 (write _test-input-stream " var y: int\n") - 3886 (write _test-input-stream " }\n") - 3887 (write _test-input-stream " var x: int\n") - 3888 (write _test-input-stream " increment x\n") - 3889 (write _test-input-stream "}\n") - 3890 # convert - 3891 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3892 (flush _test-output-buffered-file) - 3893 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 3899 # check output - 3900 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem-after-block/0") - 3901 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem-after-block/1") - 3902 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem-after-block/2") - 3903 (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") - 3904 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem-after-block/4") - 3905 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem-after-block/5") - 3906 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem-after-block/6") - 3907 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-mem-after-block/7") - 3908 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/8") - 3909 (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") - 3910 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem-after-block/10") - 3911 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-mem-after-block/11") - 3912 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/12") - 3913 (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") - 3914 (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") - 3915 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem-after-block/15") - 3916 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem-after-block/16") - 3917 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem-after-block/17") - 3918 (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") - 3919 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem-after-block/19") - 3920 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem-after-block/20") - 3921 # . epilogue - 3922 89/<- %esp 5/r32/ebp - 3923 5d/pop-to-ebp - 3924 c3/return - 3925 - 3926 test-convert-function-with-local-var-in-named-block: - 3927 # . prologue - 3928 55/push-ebp - 3929 89/<- %ebp 4/r32/esp - 3930 # setup - 3931 (clear-stream _test-input-stream) - 3932 (clear-stream $_test-input-buffered-file->buffer) - 3933 (clear-stream _test-output-stream) - 3934 (clear-stream $_test-output-buffered-file->buffer) - 3935 # - 3936 (write _test-input-stream "fn foo {\n") - 3937 (write _test-input-stream " $bar: {\n") - 3938 (write _test-input-stream " var x: int\n") - 3939 (write _test-input-stream " increment x\n") - 3940 (write _test-input-stream " }\n") - 3941 (write _test-input-stream "}\n") - 3942 # convert - 3943 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3944 (flush _test-output-buffered-file) - 3945 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 3951 # check output - 3952 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0") - 3953 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1") - 3954 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2") - 3955 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3") - 3956 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4") - 3957 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5") - 3958 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6") - 3959 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7") - 3960 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8") - 3961 (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") - 3962 (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") - 3963 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11") - 3964 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12") - 3965 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13") - 3966 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14") - 3967 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15") - 3968 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16") - 3969 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17") - 3970 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18") - 3971 # . epilogue - 3972 89/<- %esp 5/r32/ebp - 3973 5d/pop-to-ebp - 3974 c3/return - 3975 - 3976 test-unknown-variable-in-named-block: - 3977 # . prologue - 3978 55/push-ebp - 3979 89/<- %ebp 4/r32/esp - 3980 # setup - 3981 (clear-stream _test-input-stream) - 3982 (clear-stream $_test-input-buffered-file->buffer) - 3983 (clear-stream _test-output-stream) - 3984 (clear-stream $_test-output-buffered-file->buffer) - 3985 (clear-stream _test-error-stream) - 3986 (clear-stream $_test-error-buffered-file->buffer) - 3987 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3988 68/push 0/imm32 - 3989 68/push 0/imm32 - 3990 89/<- %edx 4/r32/esp - 3991 (tailor-exit-descriptor %edx 0x10) - 3992 # - 3993 (write _test-input-stream "fn foo {\n") - 3994 (write _test-input-stream " $a: {\n") - 3995 (write _test-input-stream " compare x, 0\n") - 3996 (write _test-input-stream " }\n") - 3997 (write _test-input-stream "}\n") - 3998 # convert - 3999 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 4000 # registers except esp clobbered at this point - 4001 # restore ed - 4002 89/<- %edx 4/r32/esp - 4003 (flush _test-output-buffered-file) - 4004 (flush _test-error-buffered-file) - 4005 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- + 3833 (write _test-input-stream "fn foo x: byte, y: int {\n") + 3834 (write _test-input-stream " var a/eax: byte <- copy x\n") + 3835 (write _test-input-stream " var b/eax: int <- copy y\n") + 3836 (write _test-input-stream "}\n") + 3837 # convert + 3838 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3839 (flush _test-output-buffered-file) + 3840 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3846 # check output + 3847 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-copy-byte-from-fn-arg/0") + 3848 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-copy-byte-from-fn-arg/1") + 3849 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-copy-byte-from-fn-arg/2") + 3850 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-copy-byte-from-fn-arg/3") + 3851 (check-next-stream-line-equal _test-output-stream " {" "F - test-copy-byte-from-fn-arg/4") + 3852 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-copy-byte-from-fn-arg/5") + 3853 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-copy-byte-from-fn-arg/6") + 3854 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/7") + 3855 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x0000000c) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/8") + 3856 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-copy-byte-from-fn-arg/9") + 3857 (check-next-stream-line-equal _test-output-stream " }" "F - test-copy-byte-from-fn-arg/10") + 3858 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-copy-byte-from-fn-arg/11") + 3859 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-copy-byte-from-fn-arg/12") + 3860 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-copy-byte-from-fn-arg/13") + 3861 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-copy-byte-from-fn-arg/14") + 3862 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-copy-byte-from-fn-arg/15") + 3863 # . epilogue + 3864 89/<- %esp 5/r32/ebp + 3865 5d/pop-to-ebp + 3866 c3/return + 3867 + 3868 test-convert-compare-register-with-literal: + 3869 # . prologue + 3870 55/push-ebp + 3871 89/<- %ebp 4/r32/esp + 3872 # setup + 3873 (clear-stream _test-input-stream) + 3874 (clear-stream $_test-input-buffered-file->buffer) + 3875 (clear-stream _test-output-stream) + 3876 (clear-stream $_test-output-buffered-file->buffer) + 3877 # + 3878 (write _test-input-stream "fn foo {\n") + 3879 (write _test-input-stream " var x/ecx: int <- copy 0\n") + 3880 (write _test-input-stream " compare x, 0\n") + 3881 (write _test-input-stream "}\n") + 3882 # convert + 3883 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3884 (flush _test-output-buffered-file) + 3885 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3891 # check output + 3892 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0") + 3893 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1") + 3894 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2") + 3895 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3") + 3896 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4") + 3897 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5") + 3898 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") + 3899 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7") + 3900 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8") + 3901 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") + 3902 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10") + 3903 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11") + 3904 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12") + 3905 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13") + 3906 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14") + 3907 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15") + 3908 # . epilogue + 3909 89/<- %esp 5/r32/ebp + 3910 5d/pop-to-ebp + 3911 c3/return + 3912 + 3913 test-convert-compare-byte-with-literal: + 3914 # . prologue + 3915 55/push-ebp + 3916 89/<- %ebp 4/r32/esp + 3917 # setup + 3918 (clear-stream _test-input-stream) + 3919 (clear-stream $_test-input-buffered-file->buffer) + 3920 (clear-stream _test-output-stream) + 3921 (clear-stream $_test-output-buffered-file->buffer) + 3922 # + 3923 (write _test-input-stream "fn foo {\n") + 3924 (write _test-input-stream " var x/ecx: byte <- copy 0\n") + 3925 (write _test-input-stream " compare x, 0\n") + 3926 (write _test-input-stream "}\n") + 3927 # convert + 3928 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3929 (flush _test-output-buffered-file) + 3930 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3936 # no errors; output is identical to test-convert-compare-register-with-literal + 3937 # . epilogue + 3938 89/<- %esp 5/r32/ebp + 3939 5d/pop-to-ebp + 3940 c3/return + 3941 + 3942 test-unknown-variable: + 3943 # . prologue + 3944 55/push-ebp + 3945 89/<- %ebp 4/r32/esp + 3946 # setup + 3947 (clear-stream _test-input-stream) + 3948 (clear-stream $_test-input-buffered-file->buffer) + 3949 (clear-stream _test-output-stream) + 3950 (clear-stream $_test-output-buffered-file->buffer) + 3951 (clear-stream _test-error-stream) + 3952 (clear-stream $_test-error-buffered-file->buffer) + 3953 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3954 68/push 0/imm32 + 3955 68/push 0/imm32 + 3956 89/<- %edx 4/r32/esp + 3957 (tailor-exit-descriptor %edx 0x10) + 3958 # + 3959 (write _test-input-stream "fn foo {\n") + 3960 (write _test-input-stream " compare x, 0\n") + 3961 (write _test-input-stream "}\n") + 3962 # convert + 3963 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3964 # registers except esp clobbered at this point + 3965 # restore ed + 3966 89/<- %edx 4/r32/esp + 3967 (flush _test-output-buffered-file) + 3968 (flush _test-error-buffered-file) + 3969 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 3975 # check output + 3976 (check-stream-equal _test-output-stream "" "F - test-unknown-variable: output should be empty") + 3977 (check-next-stream-line-equal _test-error-stream "fn foo: unknown variable 'x'" "F - test-unknown-variable: error message") + 3978 # check that stop(1) was called + 3979 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable: exit status") + 3980 # don't restore from ebp + 3981 81 0/subop/add %esp 8/imm32 + 3982 # . epilogue + 3983 5d/pop-to-ebp + 3984 c3/return + 3985 + 3986 test-convert-function-with-local-var-in-block: + 3987 # . prologue + 3988 55/push-ebp + 3989 89/<- %ebp 4/r32/esp + 3990 # setup + 3991 (clear-stream _test-input-stream) + 3992 (clear-stream $_test-input-buffered-file->buffer) + 3993 (clear-stream _test-output-stream) + 3994 (clear-stream $_test-output-buffered-file->buffer) + 3995 # + 3996 (write _test-input-stream "fn foo {\n") + 3997 (write _test-input-stream " {\n") + 3998 (write _test-input-stream " var x: int\n") + 3999 (write _test-input-stream " increment x\n") + 4000 (write _test-input-stream " }\n") + 4001 (write _test-input-stream "}\n") + 4002 # convert + 4003 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4004 (flush _test-output-buffered-file) + 4005 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- 4011 # check output - 4012 (check-stream-equal _test-output-stream "" "F - test-unknown-variable-in-named-block: output should be empty") - 4013 (check-next-stream-line-equal _test-error-stream "fn foo: unknown variable 'x'" "F - test-unknown-variable-in-named-block: error message") - 4014 # check that stop(1) was called - 4015 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable-in-named-block: exit status") - 4016 # don't restore from ebp - 4017 81 0/subop/add %esp 8/imm32 - 4018 # . epilogue - 4019 5d/pop-to-ebp - 4020 c3/return - 4021 - 4022 test-always-shadow-outermost-reg-vars-in-function: - 4023 # . prologue - 4024 55/push-ebp - 4025 89/<- %ebp 4/r32/esp - 4026 # setup - 4027 (clear-stream _test-input-stream) - 4028 (clear-stream $_test-input-buffered-file->buffer) - 4029 (clear-stream _test-output-stream) - 4030 (clear-stream $_test-output-buffered-file->buffer) - 4031 # - 4032 (write _test-input-stream "fn foo {\n") - 4033 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 4034 (write _test-input-stream "}\n") - 4035 # convert - 4036 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4037 (flush _test-output-buffered-file) - 4038 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4044 # check output - 4045 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-always-shadow-outermost-reg-vars-in-function/0") - 4046 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-always-shadow-outermost-reg-vars-in-function/1") - 4047 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/2") - 4048 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-always-shadow-outermost-reg-vars-in-function/3") - 4049 (check-next-stream-line-equal _test-output-stream " {" "F - test-always-shadow-outermost-reg-vars-in-function/4") - 4050 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-always-shadow-outermost-reg-vars-in-function/5") - 4051 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") - 4052 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-always-shadow-outermost-reg-vars-in-function/8") - 4053 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") - 4054 (check-next-stream-line-equal _test-output-stream " }" "F - test-always-shadow-outermost-reg-vars-in-function/12") - 4055 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-always-shadow-outermost-reg-vars-in-function/13") - 4056 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-always-shadow-outermost-reg-vars-in-function/14") - 4057 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-always-shadow-outermost-reg-vars-in-function/15") - 4058 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/16") - 4059 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-always-shadow-outermost-reg-vars-in-function/17") - 4060 # . epilogue - 4061 89/<- %esp 5/r32/ebp - 4062 5d/pop-to-ebp - 4063 c3/return - 4064 - 4065 test-shadow-local: - 4066 # . prologue - 4067 55/push-ebp - 4068 89/<- %ebp 4/r32/esp - 4069 # setup - 4070 (clear-stream _test-input-stream) - 4071 (clear-stream $_test-input-buffered-file->buffer) - 4072 (clear-stream _test-output-stream) - 4073 (clear-stream $_test-output-buffered-file->buffer) - 4074 # - 4075 (write _test-input-stream "fn foo {\n") - 4076 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 4077 (write _test-input-stream " {\n") - 4078 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 4079 (write _test-input-stream " }\n") - 4080 (write _test-input-stream " x <- increment\n") - 4081 (write _test-input-stream "}\n") - 4082 # convert - 4083 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4084 (flush _test-output-buffered-file) - 4085 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4091 # check output - 4092 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-local/0") - 4093 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-local/1") - 4094 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-local/2") - 4095 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-local/3") - 4096 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-local/4") - 4097 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-local/5") - 4098 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-local/6") - 4099 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-local/7") - 4100 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-local/8") - 4101 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-local/9") - 4102 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-local/10") - 4103 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-local/11") - 4104 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-local/12") - 4105 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-local/13") - 4106 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-local/14") - 4107 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-local/15") - 4108 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-local/16") - 4109 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-local/17") - 4110 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-local/18") - 4111 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-local/19") - 4112 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-local/20") - 4113 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-local/21") - 4114 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-local/22") - 4115 # . epilogue - 4116 89/<- %esp 5/r32/ebp - 4117 5d/pop-to-ebp - 4118 c3/return - 4119 - 4120 test-shadow-name: - 4121 # . prologue - 4122 55/push-ebp - 4123 89/<- %ebp 4/r32/esp - 4124 # setup - 4125 (clear-stream _test-input-stream) - 4126 (clear-stream $_test-input-buffered-file->buffer) - 4127 (clear-stream _test-output-stream) - 4128 (clear-stream $_test-output-buffered-file->buffer) - 4129 # - 4130 (write _test-input-stream "fn foo {\n") - 4131 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 4132 (write _test-input-stream " {\n") - 4133 (write _test-input-stream " var x/edx: int <- copy 4\n") - 4134 (write _test-input-stream " }\n") - 4135 (write _test-input-stream " x <- increment\n") - 4136 (write _test-input-stream "}\n") - 4137 # convert - 4138 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4139 (flush _test-output-buffered-file) - 4140 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4146 # check output - 4147 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-name/0") - 4148 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-name/1") - 4149 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-name/2") - 4150 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-name/3") - 4151 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name/4") - 4152 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-name/5") - 4153 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name/6") - 4154 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-name/7") - 4155 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name/8") - 4156 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-name/9") - 4157 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-shadow-name/10") - 4158 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 4/imm32" "F - test-shadow-name/11") - 4159 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-shadow-name/12") - 4160 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name/13") - 4161 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-name/14") - 4162 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-name/15") - 4163 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name/16") - 4164 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name/17") - 4165 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-name/18") - 4166 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-name/19") - 4167 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-name/20") - 4168 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-name/21") - 4169 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-name/22") - 4170 # . epilogue - 4171 89/<- %esp 5/r32/ebp - 4172 5d/pop-to-ebp - 4173 c3/return - 4174 - 4175 test-shadow-name-2: - 4176 # . prologue - 4177 55/push-ebp - 4178 89/<- %ebp 4/r32/esp - 4179 # setup - 4180 (clear-stream _test-input-stream) - 4181 (clear-stream $_test-input-buffered-file->buffer) - 4182 (clear-stream _test-output-stream) - 4183 (clear-stream $_test-output-buffered-file->buffer) - 4184 # - 4185 (write _test-input-stream "fn foo {\n") - 4186 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 4187 (write _test-input-stream " {\n") - 4188 (write _test-input-stream " var x/edx: int <- copy 4\n") - 4189 (write _test-input-stream " var y/ecx: int <- copy 5\n") - 4190 (write _test-input-stream " }\n") - 4191 (write _test-input-stream " x <- increment\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-shadow-name-2/0") - 4204 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-name-2/1") - 4205 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-name-2/2") - 4206 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-name-2/3") - 4207 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name-2/4") - 4208 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-name-2/5") - 4209 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name-2/6") - 4210 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-name-2/7") - 4211 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name-2/8") - 4212 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-name-2/9") - 4213 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-shadow-name-2/10") - 4214 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 4/imm32" "F - test-shadow-name-2/11") - 4215 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name-2/12") - 4216 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 5/imm32" "F - test-shadow-name-2/13") - 4217 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name-2/14") - 4218 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-shadow-name-2/15") - 4219 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name-2/16") - 4220 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-name-2/17") - 4221 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-name-2/18") - 4222 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name-2/19") - 4223 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name-2/20") - 4224 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-name-2/21") - 4225 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-name-2/22") - 4226 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-name-2/23") - 4227 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-name-2/24") - 4228 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-name-2/25") - 4229 # . epilogue - 4230 89/<- %esp 5/r32/ebp - 4231 5d/pop-to-ebp - 4232 c3/return - 4233 - 4234 test-do-not-spill-same-register-in-block: - 4235 # . prologue - 4236 55/push-ebp - 4237 89/<- %ebp 4/r32/esp - 4238 # setup - 4239 (clear-stream _test-input-stream) - 4240 (clear-stream $_test-input-buffered-file->buffer) - 4241 (clear-stream _test-output-stream) - 4242 (clear-stream $_test-output-buffered-file->buffer) - 4243 # - 4244 (write _test-input-stream "fn foo {\n") - 4245 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 4246 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 4247 (write _test-input-stream " y <- increment\n") - 4248 (write _test-input-stream "}\n") - 4249 # convert - 4250 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4251 (flush _test-output-buffered-file) - 4252 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4258 # check output - 4259 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-do-not-spill-same-register-in-block/0") - 4260 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-do-not-spill-same-register-in-block/1") - 4261 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-do-not-spill-same-register-in-block/2") - 4262 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-do-not-spill-same-register-in-block/3") - 4263 (check-next-stream-line-equal _test-output-stream " {" "F - test-do-not-spill-same-register-in-block/4") - 4264 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-do-not-spill-same-register-in-block/5") - 4265 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-do-not-spill-same-register-in-block/6") - 4266 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-do-not-spill-same-register-in-block/7") - 4267 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-do-not-spill-same-register-in-block/8") - 4268 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-do-not-spill-same-register-in-block/9") - 4269 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-do-not-spill-same-register-in-block/10") - 4270 (check-next-stream-line-equal _test-output-stream " }" "F - test-do-not-spill-same-register-in-block/11") - 4271 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-do-not-spill-same-register-in-block/12") - 4272 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-do-not-spill-same-register-in-block/13") - 4273 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-do-not-spill-same-register-in-block/14") - 4274 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-do-not-spill-same-register-in-block/15") - 4275 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-do-not-spill-same-register-in-block/16") - 4276 # . epilogue - 4277 89/<- %esp 5/r32/ebp - 4278 5d/pop-to-ebp - 4279 c3/return - 4280 - 4281 test-spill-different-register-in-block: - 4282 # . prologue - 4283 55/push-ebp - 4284 89/<- %ebp 4/r32/esp - 4285 # setup - 4286 (clear-stream _test-input-stream) - 4287 (clear-stream $_test-input-buffered-file->buffer) - 4288 (clear-stream _test-output-stream) - 4289 (clear-stream $_test-output-buffered-file->buffer) - 4290 # - 4291 (write _test-input-stream "fn foo {\n") - 4292 (write _test-input-stream " var x/eax: int <- copy 3\n") - 4293 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 4294 (write _test-input-stream " y <- increment\n") - 4295 (write _test-input-stream "}\n") - 4296 # convert - 4297 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4298 (flush _test-output-buffered-file) - 4299 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4305 # check output - 4306 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-spill-different-register-in-block/0") - 4307 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-spill-different-register-in-block/1") - 4308 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-spill-different-register-in-block/2") - 4309 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-spill-different-register-in-block/3") - 4310 (check-next-stream-line-equal _test-output-stream " {" "F - test-spill-different-register-in-block/4") - 4311 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-spill-different-register-in-block/5") - 4312 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-spill-different-register-in-block/6") - 4313 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-spill-different-register-in-block/7") - 4314 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-spill-different-register-in-block/8") - 4315 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-spill-different-register-in-block/9") - 4316 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-spill-different-register-in-block/10") - 4317 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-spill-different-register-in-block/11") - 4318 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-spill-different-register-in-block/12") - 4319 (check-next-stream-line-equal _test-output-stream " }" "F - test-spill-different-register-in-block/13") - 4320 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-spill-different-register-in-block/14") - 4321 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-spill-different-register-in-block/15") - 4322 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-spill-different-register-in-block/16") - 4323 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-spill-different-register-in-block/17") - 4324 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-spill-different-register-in-block/18") - 4325 # . epilogue - 4326 89/<- %esp 5/r32/ebp - 4327 5d/pop-to-ebp - 4328 c3/return - 4329 - 4330 test-convert-function-with-branches-in-block: - 4331 # . prologue - 4332 55/push-ebp - 4333 89/<- %ebp 4/r32/esp - 4334 # setup - 4335 (clear-stream _test-input-stream) - 4336 (clear-stream $_test-input-buffered-file->buffer) - 4337 (clear-stream _test-output-stream) - 4338 (clear-stream $_test-output-buffered-file->buffer) - 4339 # - 4340 (write _test-input-stream "fn foo x: int {\n") - 4341 (write _test-input-stream " {\n") - 4342 (write _test-input-stream " break-if->=\n") - 4343 (write _test-input-stream " loop-if-addr<\n") - 4344 (write _test-input-stream " increment x\n") - 4345 (write _test-input-stream " loop\n") - 4346 (write _test-input-stream " }\n") - 4347 (write _test-input-stream "}\n") - 4348 # convert - 4349 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4350 (flush _test-output-buffered-file) - 4351 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4357 # check output - 4358 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") - 4359 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") - 4360 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") - 4361 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") - 4362 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") - 4363 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") - 4364 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") - 4365 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") - 4366 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") - 4367 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") - 4368 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") - 4369 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") - 4370 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") - 4371 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") - 4372 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") - 4373 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") - 4374 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") - 4375 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") - 4376 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") - 4377 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") - 4378 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") - 4379 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") - 4380 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") - 4381 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") - 4382 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") - 4383 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") - 4384 # . epilogue - 4385 89/<- %esp 5/r32/ebp - 4386 5d/pop-to-ebp - 4387 c3/return - 4388 - 4389 test-convert-function-with-branches-in-block-2: - 4390 # . prologue - 4391 55/push-ebp - 4392 89/<- %ebp 4/r32/esp - 4393 # setup - 4394 (clear-stream _test-input-stream) - 4395 (clear-stream $_test-input-buffered-file->buffer) - 4396 (clear-stream _test-output-stream) - 4397 (clear-stream $_test-output-buffered-file->buffer) - 4398 # - 4399 (write _test-input-stream "fn foo x: int {\n") - 4400 (write _test-input-stream " {\n") - 4401 (write _test-input-stream " break-if->=\n") - 4402 (write _test-input-stream " loop-if-float<\n") - 4403 (write _test-input-stream " increment x\n") - 4404 (write _test-input-stream " loop\n") - 4405 (write _test-input-stream " }\n") - 4406 (write _test-input-stream "}\n") - 4407 # convert - 4408 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4409 (flush _test-output-buffered-file) - 4410 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4416 # check output - 4417 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") - 4418 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") - 4419 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") - 4420 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") - 4421 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") - 4422 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") - 4423 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") - 4424 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") - 4425 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") - 4426 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") - 4427 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") - 4428 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") - 4429 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") - 4430 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") - 4431 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") - 4432 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") - 4433 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") - 4434 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") - 4435 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") - 4436 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") - 4437 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") - 4438 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") - 4439 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") - 4440 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") - 4441 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") - 4442 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") - 4443 # . epilogue - 4444 89/<- %esp 5/r32/ebp - 4445 5d/pop-to-ebp - 4446 c3/return - 4447 - 4448 test-convert-function-with-branches-in-named-block: - 4449 # . prologue - 4450 55/push-ebp - 4451 89/<- %ebp 4/r32/esp - 4452 # setup - 4453 (clear-stream _test-input-stream) - 4454 (clear-stream $_test-input-buffered-file->buffer) - 4455 (clear-stream _test-output-stream) - 4456 (clear-stream $_test-output-buffered-file->buffer) - 4457 # - 4458 (write _test-input-stream "fn foo x: int {\n") - 4459 (write _test-input-stream " $bar: {\n") - 4460 (write _test-input-stream " break-if->= $bar\n") - 4461 (write _test-input-stream " loop-if-addr< $bar\n") - 4462 (write _test-input-stream " increment x\n") - 4463 (write _test-input-stream " loop\n") - 4464 (write _test-input-stream " }\n") - 4465 (write _test-input-stream "}\n") - 4466 # convert - 4467 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4468 (flush _test-output-buffered-file) - 4469 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4475 # check output - 4476 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0") - 4477 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1") - 4478 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2") - 4479 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3") - 4480 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4") - 4481 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5") - 4482 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6") - 4483 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7") - 4484 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/8") - 4485 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-named-block/9") - 4486 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/10") - 4487 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/11") - 4488 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/12") - 4489 (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") - 4490 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:loop/disp32" "F - test-convert-function-with-branches-in-named-block/14") - 4491 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/15") - 4492 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/16") - 4493 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/17") - 4494 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/18") - 4495 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/19") - 4496 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/20") - 4497 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/21") - 4498 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/22") - 4499 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/23") - 4500 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/24") - 4501 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/25") - 4502 # . epilogue - 4503 89/<- %esp 5/r32/ebp - 4504 5d/pop-to-ebp - 4505 c3/return - 4506 - 4507 test-convert-function-with-var-in-nested-block: - 4508 # . prologue - 4509 55/push-ebp - 4510 89/<- %ebp 4/r32/esp - 4511 # setup - 4512 (clear-stream _test-input-stream) - 4513 (clear-stream $_test-input-buffered-file->buffer) - 4514 (clear-stream _test-output-stream) - 4515 (clear-stream $_test-output-buffered-file->buffer) - 4516 # - 4517 (write _test-input-stream "fn foo x: int {\n") - 4518 (write _test-input-stream " {\n") - 4519 (write _test-input-stream " {\n") - 4520 (write _test-input-stream " var x: int\n") - 4521 (write _test-input-stream " increment x\n") - 4522 (write _test-input-stream " }\n") - 4523 (write _test-input-stream " }\n") - 4524 (write _test-input-stream "}\n") - 4525 # convert - 4526 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4527 (flush _test-output-buffered-file) - 4528 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4534 # check output - 4535 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") - 4536 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1") - 4537 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") - 4538 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") - 4539 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4") - 4540 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5") - 4541 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6") - 4542 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7") - 4543 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8") - 4544 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9") - 4545 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10") - 4546 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11") - 4547 (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") - 4548 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13") - 4549 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14") - 4550 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15") - 4551 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16") - 4552 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17") - 4553 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18") - 4554 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19") - 4555 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20") - 4556 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21") - 4557 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22") - 4558 # . epilogue - 4559 89/<- %esp 5/r32/ebp - 4560 5d/pop-to-ebp - 4561 c3/return - 4562 - 4563 test-convert-function-with-multiple-vars-in-nested-blocks: - 4564 # . prologue - 4565 55/push-ebp - 4566 89/<- %ebp 4/r32/esp - 4567 # setup - 4568 (clear-stream _test-input-stream) - 4569 (clear-stream $_test-input-buffered-file->buffer) - 4570 (clear-stream _test-output-stream) - 4571 (clear-stream $_test-output-buffered-file->buffer) - 4572 # - 4573 (write _test-input-stream "fn foo x: int {\n") - 4574 (write _test-input-stream " {\n") - 4575 (write _test-input-stream " var x/eax: int <- copy 0\n") - 4576 (write _test-input-stream " {\n") - 4577 (write _test-input-stream " var y: int\n") - 4578 (write _test-input-stream " x <- add y\n") - 4579 (write _test-input-stream " }\n") - 4580 (write _test-input-stream " }\n") - 4581 (write _test-input-stream "}\n") - 4582 # convert - 4583 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4584 (flush _test-output-buffered-file) - 4585 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4591 # check output - 4592 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0") - 4593 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1") - 4594 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2") - 4595 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3") - 4596 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4") - 4597 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5") - 4598 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6") - 4599 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7") - 4600 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8") - 4601 (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") - 4602 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10") - 4603 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11") - 4604 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12") - 4605 (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") - 4606 (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") - 4607 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15") - 4608 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16") - 4609 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17") - 4610 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18") - 4611 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19") - 4612 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20") - 4613 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21") - 4614 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22") - 4615 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23") - 4616 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24") - 4617 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25") - 4618 # . epilogue - 4619 89/<- %esp 5/r32/ebp - 4620 5d/pop-to-ebp - 4621 c3/return - 4622 - 4623 test-convert-function-with-branches-and-local-vars: - 4624 # A conditional 'break' after a 'var' in a block is converted into a - 4625 # nested block that performs all necessary cleanup before jumping. This - 4626 # results in some ugly code duplication. - 4627 # . prologue - 4628 55/push-ebp - 4629 89/<- %ebp 4/r32/esp - 4630 # setup - 4631 (clear-stream _test-input-stream) - 4632 (clear-stream $_test-input-buffered-file->buffer) - 4633 (clear-stream _test-output-stream) - 4634 (clear-stream $_test-output-buffered-file->buffer) - 4635 # - 4636 (write _test-input-stream "fn foo {\n") - 4637 (write _test-input-stream " {\n") - 4638 (write _test-input-stream " var x: int\n") - 4639 (write _test-input-stream " break-if->=\n") - 4640 (write _test-input-stream " increment x\n") - 4641 (write _test-input-stream " }\n") - 4642 (write _test-input-stream "}\n") - 4643 # convert - 4644 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4645 (flush _test-output-buffered-file) - 4646 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4652 # check output - 4653 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0") - 4654 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1") - 4655 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2") - 4656 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3") - 4657 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4") - 4658 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5") - 4659 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6") - 4660 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7") - 4661 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8") - 4662 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9") - 4663 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10") - 4664 (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") - 4665 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12") - 4666 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13") - 4667 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14") - 4668 (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") - 4669 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16") - 4670 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17") - 4671 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18") - 4672 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19") - 4673 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20") - 4674 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21") - 4675 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22") - 4676 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23") - 4677 # . epilogue - 4678 89/<- %esp 5/r32/ebp - 4679 5d/pop-to-ebp - 4680 c3/return - 4681 - 4682 test-convert-function-with-conditional-loops-and-local-vars: - 4683 # A conditional 'loop' after a 'var' in a block is converted into a nested - 4684 # block that performs all necessary cleanup before jumping. This results - 4685 # in some ugly code duplication. - 4686 # . prologue - 4687 55/push-ebp - 4688 89/<- %ebp 4/r32/esp - 4689 # setup - 4690 (clear-stream _test-input-stream) - 4691 (clear-stream $_test-input-buffered-file->buffer) - 4692 (clear-stream _test-output-stream) - 4693 (clear-stream $_test-output-buffered-file->buffer) - 4694 # - 4695 (write _test-input-stream "fn foo {\n") - 4696 (write _test-input-stream " {\n") - 4697 (write _test-input-stream " var x: int\n") - 4698 (write _test-input-stream " loop-if->=\n") - 4699 (write _test-input-stream " increment x\n") - 4700 (write _test-input-stream " }\n") - 4701 (write _test-input-stream "}\n") - 4702 # convert - 4703 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4704 (flush _test-output-buffered-file) - 4705 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4711 # check output - 4712 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0") - 4713 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1") - 4714 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2") - 4715 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3") - 4716 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4") - 4717 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5") - 4718 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6") - 4719 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7") - 4720 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8") - 4721 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9") - 4722 (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") - 4723 (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") - 4724 (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") - 4725 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13") - 4726 (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") - 4727 (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") - 4728 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16") - 4729 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17") - 4730 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18") - 4731 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19") - 4732 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20") - 4733 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21") - 4734 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22") - 4735 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23") - 4736 # . epilogue - 4737 89/<- %esp 5/r32/ebp - 4738 5d/pop-to-ebp - 4739 c3/return - 4740 - 4741 test-convert-function-with-unconditional-loops-and-local-vars: - 4742 # An unconditional 'loop' after a 'var' in a block is emitted _after_ the - 4743 # regular block cleanup. Any instructions after 'loop' are dead and - 4744 # therefore skipped. - 4745 # . prologue - 4746 55/push-ebp - 4747 89/<- %ebp 4/r32/esp - 4748 # setup - 4749 (clear-stream _test-input-stream) - 4750 (clear-stream $_test-input-buffered-file->buffer) - 4751 (clear-stream _test-output-stream) - 4752 (clear-stream $_test-output-buffered-file->buffer) - 4753 # - 4754 (write _test-input-stream "fn foo {\n") - 4755 (write _test-input-stream " {\n") - 4756 (write _test-input-stream " var x: int\n") - 4757 (write _test-input-stream " loop\n") - 4758 (write _test-input-stream " increment x\n") - 4759 (write _test-input-stream " }\n") - 4760 (write _test-input-stream "}\n") - 4761 # convert - 4762 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4763 (flush _test-output-buffered-file) - 4764 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4770 # check output - 4771 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0") - 4772 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1") - 4773 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2") - 4774 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3") - 4775 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4") - 4776 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5") - 4777 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6") - 4778 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7") - 4779 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8") - 4780 (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") - 4781 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10") - 4782 # not emitted: ff 0/subop/increment *(ebp+0xfffffffc) - 4783 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11") - 4784 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12") - 4785 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13") - 4786 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14") - 4787 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15") - 4788 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16") - 4789 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17") - 4790 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18") - 4791 # . epilogue - 4792 89/<- %esp 5/r32/ebp - 4793 5d/pop-to-ebp - 4794 c3/return - 4795 - 4796 test-convert-function-with-branches-and-loops-and-local-vars: - 4797 # . prologue - 4798 55/push-ebp - 4799 89/<- %ebp 4/r32/esp - 4800 # setup - 4801 (clear-stream _test-input-stream) - 4802 (clear-stream $_test-input-buffered-file->buffer) - 4803 (clear-stream _test-output-stream) - 4804 (clear-stream $_test-output-buffered-file->buffer) - 4805 # - 4806 (write _test-input-stream "fn foo {\n") - 4807 (write _test-input-stream " {\n") - 4808 (write _test-input-stream " var x: int\n") - 4809 (write _test-input-stream " break-if->=\n") - 4810 (write _test-input-stream " increment x\n") - 4811 (write _test-input-stream " loop\n") - 4812 (write _test-input-stream " }\n") - 4813 (write _test-input-stream "}\n") - 4814 # convert - 4815 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4816 (flush _test-output-buffered-file) - 4817 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4823 # check output - 4824 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0") - 4825 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1") - 4826 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2") - 4827 (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") - 4828 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4") - 4829 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5") - 4830 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6") - 4831 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7") - 4832 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8") - 4833 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9") - 4834 (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") - 4835 (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") - 4836 (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") - 4837 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13") - 4838 (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") - 4839 (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") - 4840 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16") - 4841 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17") - 4842 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18") - 4843 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19") - 4844 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20") - 4845 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21") - 4846 (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") - 4847 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23") - 4848 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24") - 4849 # . epilogue - 4850 89/<- %esp 5/r32/ebp - 4851 5d/pop-to-ebp - 4852 c3/return - 4853 - 4854 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars: - 4855 # . prologue - 4856 55/push-ebp - 4857 89/<- %ebp 4/r32/esp - 4858 # setup - 4859 (clear-stream _test-input-stream) - 4860 (clear-stream $_test-input-buffered-file->buffer) - 4861 (clear-stream _test-output-stream) - 4862 (clear-stream $_test-output-buffered-file->buffer) - 4863 # - 4864 (write _test-input-stream "fn foo {\n") - 4865 (write _test-input-stream " a: {\n") - 4866 (write _test-input-stream " var x: int\n") - 4867 (write _test-input-stream " {\n") - 4868 (write _test-input-stream " var y: int\n") - 4869 (write _test-input-stream " break-if->= a\n") - 4870 (write _test-input-stream " increment x\n") - 4871 (write _test-input-stream " loop\n") - 4872 (write _test-input-stream " }\n") - 4873 (write _test-input-stream " }\n") - 4874 (write _test-input-stream "}\n") - 4875 # convert - 4876 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4877 (flush _test-output-buffered-file) - 4878 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4884 # check output - 4885 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0") - 4886 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1") - 4887 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2") - 4888 (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") - 4889 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4") - 4890 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5") - 4891 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6") - 4892 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7") - 4893 (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") - 4894 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9") - 4895 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10") - 4896 (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") - 4897 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12") - 4898 (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") - 4899 (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") - 4900 (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") - 4901 (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") - 4902 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17") - 4903 (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") - 4904 (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") - 4905 (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") - 4906 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21") - 4907 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22") - 4908 (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") - 4909 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24") - 4910 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25") - 4911 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26") - 4912 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27") - 4913 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28") - 4914 (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") - 4915 (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") - 4916 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31") - 4917 # . epilogue - 4918 89/<- %esp 5/r32/ebp - 4919 5d/pop-to-ebp - 4920 c3/return - 4921 - 4922 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2: - 4923 # . prologue - 4924 55/push-ebp - 4925 89/<- %ebp 4/r32/esp - 4926 # setup - 4927 (clear-stream _test-input-stream) - 4928 (clear-stream $_test-input-buffered-file->buffer) - 4929 (clear-stream _test-output-stream) - 4930 (clear-stream $_test-output-buffered-file->buffer) - 4931 # non-local conditional branch from a block without a local variable, - 4932 # unwinding a local on the stack - 4933 (write _test-input-stream "fn foo {\n") - 4934 (write _test-input-stream " a: {\n") - 4935 (write _test-input-stream " var x: int\n") - 4936 (write _test-input-stream " {\n") - 4937 (write _test-input-stream " break-if->= a\n") - 4938 (write _test-input-stream " }\n") - 4939 (write _test-input-stream " }\n") - 4940 (write _test-input-stream "}\n") - 4941 # convert - 4942 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4943 (flush _test-output-buffered-file) - 4944 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 4950 # check output - 4951 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/0") - 4952 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/1") - 4953 (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") - 4954 (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") - 4955 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/4") - 4956 (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") - 4957 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/6") - 4958 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/7") - 4959 (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") - 4960 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/9") - 4961 (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") - 4962 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/11") - 4963 (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") - 4964 (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") - 4965 (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") - 4966 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/15") - 4967 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/16") - 4968 (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") - 4969 (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") - 4970 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/19") - 4971 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/20") - 4972 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/21") - 4973 (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") - 4974 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/23") - 4975 (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") - 4976 (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") - 4977 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/26") - 4978 # . epilogue - 4979 89/<- %esp 5/r32/ebp - 4980 5d/pop-to-ebp - 4981 c3/return - 4982 - 4983 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3: - 4984 # . prologue - 4985 55/push-ebp - 4986 89/<- %ebp 4/r32/esp - 4987 # setup - 4988 (clear-stream _test-input-stream) - 4989 (clear-stream $_test-input-buffered-file->buffer) - 4990 (clear-stream _test-output-stream) - 4991 (clear-stream $_test-output-buffered-file->buffer) - 4992 # non-local unconditional branch from a block without a local variable, - 4993 # unwinding a local on the stack - 4994 (write _test-input-stream "fn foo {\n") - 4995 (write _test-input-stream " a: {\n") - 4996 (write _test-input-stream " var x: int\n") - 4997 (write _test-input-stream " {\n") - 4998 (write _test-input-stream " break a\n") - 4999 (write _test-input-stream " }\n") - 5000 (write _test-input-stream " }\n") - 5001 (write _test-input-stream "}\n") - 5002 # convert - 5003 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5004 (flush _test-output-buffered-file) - 5005 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5011 # check output - 5012 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/0") - 5013 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/1") - 5014 (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") - 5015 (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") - 5016 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/4") - 5017 (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") - 5018 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/6") - 5019 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/7") - 5020 (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") - 5021 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/9") - 5022 (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") - 5023 (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") - 5024 (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") - 5025 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/14") - 5026 (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") - 5027 (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") - 5028 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/17") - 5029 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/18") - 5030 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/19") - 5031 (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") - 5032 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/21") - 5033 (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") - 5034 (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") - 5035 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/24") - 5036 # . epilogue - 5037 89/<- %esp 5/r32/ebp - 5038 5d/pop-to-ebp - 5039 c3/return - 5040 - 5041 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4: - 5042 # . prologue - 5043 55/push-ebp - 5044 89/<- %ebp 4/r32/esp - 5045 # setup - 5046 (clear-stream _test-input-stream) - 5047 (clear-stream $_test-input-buffered-file->buffer) - 5048 (clear-stream _test-output-stream) - 5049 (clear-stream $_test-output-buffered-file->buffer) - 5050 # - 5051 (write _test-input-stream "fn foo {\n") - 5052 (write _test-input-stream " a: {\n") - 5053 (write _test-input-stream " var x/esi: int <- copy 0\n") - 5054 (write _test-input-stream " {\n") - 5055 (write _test-input-stream " break a\n") - 5056 (write _test-input-stream " }\n") - 5057 (write _test-input-stream " }\n") - 5058 (write _test-input-stream "}\n") - 5059 # convert - 5060 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5061 (flush _test-output-buffered-file) - 5062 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5068 # check output - 5069 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/0") - 5070 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/1") - 5071 (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") - 5072 (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") - 5073 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/4") - 5074 (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") - 5075 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/6") - 5076 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/7") - 5077 (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") - 5078 (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") - 5079 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/10") - 5080 (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") - 5081 (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") - 5082 (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") - 5083 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/14") - 5084 (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") - 5085 (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") - 5086 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/17") - 5087 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/18") - 5088 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/19") - 5089 (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") - 5090 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/21") - 5091 (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") - 5092 (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") - 5093 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/24") - 5094 # . epilogue - 5095 89/<- %esp 5/r32/ebp - 5096 5d/pop-to-ebp - 5097 c3/return - 5098 - 5099 test-convert-function-with-nonlocal-unconditional-break-and-local-vars: - 5100 # . prologue - 5101 55/push-ebp - 5102 89/<- %ebp 4/r32/esp - 5103 # setup - 5104 (clear-stream _test-input-stream) - 5105 (clear-stream $_test-input-buffered-file->buffer) - 5106 (clear-stream _test-output-stream) - 5107 (clear-stream $_test-output-buffered-file->buffer) - 5108 # - 5109 (write _test-input-stream "fn foo {\n") - 5110 (write _test-input-stream " a: {\n") - 5111 (write _test-input-stream " var x: int\n") - 5112 (write _test-input-stream " {\n") - 5113 (write _test-input-stream " var y: int\n") - 5114 (write _test-input-stream " break a\n") - 5115 (write _test-input-stream " increment x\n") - 5116 (write _test-input-stream " }\n") - 5117 (write _test-input-stream " }\n") - 5118 (write _test-input-stream "}\n") - 5119 # convert - 5120 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5121 (flush _test-output-buffered-file) - 5122 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5128 # check output - 5129 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0") - 5130 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1") - 5131 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2") - 5132 (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") - 5133 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4") - 5134 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5") - 5135 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6") - 5136 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7") - 5137 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8") - 5138 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9") - 5139 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10") - 5140 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11") - 5141 (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") - 5142 (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") - 5143 (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") - 5144 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15") - 5145 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16") - 5146 (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") - 5147 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18") - 5148 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19") - 5149 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20") - 5150 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21") - 5151 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22") - 5152 (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") - 5153 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24") - 5154 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25") - 5155 # . epilogue - 5156 89/<- %esp 5/r32/ebp - 5157 5d/pop-to-ebp - 5158 c3/return - 5159 - 5160 test-convert-function-with-unconditional-break-and-local-vars: - 5161 # . prologue - 5162 55/push-ebp - 5163 89/<- %ebp 4/r32/esp - 5164 # setup - 5165 (clear-stream _test-input-stream) - 5166 (clear-stream $_test-input-buffered-file->buffer) - 5167 (clear-stream _test-output-stream) - 5168 (clear-stream $_test-output-buffered-file->buffer) - 5169 # - 5170 (write _test-input-stream "fn foo {\n") - 5171 (write _test-input-stream " {\n") - 5172 (write _test-input-stream " var x: int\n") - 5173 (write _test-input-stream " {\n") - 5174 (write _test-input-stream " var y: int\n") - 5175 (write _test-input-stream " break\n") - 5176 (write _test-input-stream " increment x\n") - 5177 (write _test-input-stream " }\n") - 5178 (write _test-input-stream " }\n") - 5179 (write _test-input-stream "}\n") - 5180 # convert - 5181 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5182 (flush _test-output-buffered-file) - 5183 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5189 # check output - 5190 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0") - 5191 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1") - 5192 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2") - 5193 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3") - 5194 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4") - 5195 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5") - 5196 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6") - 5197 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7") - 5198 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8") - 5199 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9") - 5200 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10") - 5201 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11") - 5202 (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") - 5203 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13") - 5204 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14") - 5205 (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") - 5206 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16") - 5207 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17") - 5208 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18") - 5209 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19") - 5210 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20") - 5211 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21") - 5212 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22") - 5213 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23") - 5214 # . epilogue - 5215 89/<- %esp 5/r32/ebp - 5216 5d/pop-to-ebp - 5217 c3/return - 5218 - 5219 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars: - 5220 # . prologue - 5221 55/push-ebp - 5222 89/<- %ebp 4/r32/esp - 5223 # setup - 5224 (clear-stream _test-input-stream) - 5225 (clear-stream $_test-input-buffered-file->buffer) - 5226 (clear-stream _test-output-stream) - 5227 (clear-stream $_test-output-buffered-file->buffer) - 5228 # - 5229 (write _test-input-stream "fn foo {\n") - 5230 (write _test-input-stream " a: {\n") - 5231 (write _test-input-stream " var x: int\n") - 5232 (write _test-input-stream " {\n") - 5233 (write _test-input-stream " var y: int\n") - 5234 (write _test-input-stream " loop a\n") - 5235 (write _test-input-stream " increment x\n") - 5236 (write _test-input-stream " }\n") - 5237 (write _test-input-stream " }\n") - 5238 (write _test-input-stream "}\n") - 5239 # convert - 5240 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5241 (flush _test-output-buffered-file) - 5242 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5248 # check output - 5249 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0") - 5250 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1") - 5251 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2") - 5252 (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") - 5253 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4") - 5254 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5") - 5255 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6") - 5256 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7") - 5257 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8") - 5258 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9") - 5259 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10") - 5260 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11") - 5261 (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") - 5262 (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") - 5263 (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") - 5264 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15") - 5265 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16") - 5266 (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") - 5267 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18") - 5268 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19") - 5269 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20") - 5270 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21") - 5271 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22") - 5272 (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") - 5273 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24") - 5274 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25") - 5275 # . epilogue - 5276 89/<- %esp 5/r32/ebp - 5277 5d/pop-to-ebp - 5278 c3/return - 5279 - 5280 test-convert-function-with-local-array-var-in-mem: - 5281 # . prologue - 5282 55/push-ebp - 5283 89/<- %ebp 4/r32/esp - 5284 # setup - 5285 (clear-stream _test-input-stream) - 5286 (clear-stream $_test-input-buffered-file->buffer) - 5287 (clear-stream _test-output-stream) - 5288 (clear-stream $_test-output-buffered-file->buffer) - 5289 # - 5290 (write _test-input-stream "fn foo {\n") - 5291 (write _test-input-stream " var x: (array int 3)\n") - 5292 (write _test-input-stream "}\n") - 5293 # convert - 5294 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5295 (flush _test-output-buffered-file) - 5296 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5302 # check output - 5303 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-var-in-mem/0") - 5304 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-var-in-mem/1") - 5305 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-var-in-mem/2") - 5306 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-var-in-mem/3") - 5307 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-var-in-mem/4") - 5308 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-var-in-mem/5") - 5309 # define x - 5310 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-function-with-local-array-var-in-mem/7") - 5311 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-function-with-local-array-var-in-mem/8") - 5312 # reclaim x - 5313 (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") - 5314 # - 5315 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-var-in-mem/10") - 5316 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-var-in-mem/11") - 5317 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-var-in-mem/12") - 5318 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-var-in-mem/13") - 5319 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-var-in-mem/14") - 5320 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-var-in-mem/15") - 5321 # . epilogue - 5322 89/<- %esp 5/r32/ebp - 5323 5d/pop-to-ebp - 5324 c3/return - 5325 - 5326 test-array-size-in-hex: - 5327 # . prologue - 5328 55/push-ebp - 5329 89/<- %ebp 4/r32/esp - 5330 # setup - 5331 (clear-stream _test-input-stream) - 5332 (clear-stream $_test-input-buffered-file->buffer) - 5333 (clear-stream _test-output-stream) - 5334 (clear-stream $_test-output-buffered-file->buffer) - 5335 (clear-stream _test-error-stream) - 5336 (clear-stream $_test-error-buffered-file->buffer) - 5337 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 5338 68/push 0/imm32 - 5339 68/push 0/imm32 - 5340 89/<- %edx 4/r32/esp - 5341 (tailor-exit-descriptor %edx 0x10) - 5342 # - 5343 (write _test-input-stream "fn foo {\n") - 5344 (write _test-input-stream " var x: (array int 10)\n") - 5345 (write _test-input-stream "}\n") - 5346 # convert - 5347 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 5348 # registers except esp clobbered at this point - 5349 # restore ed - 5350 89/<- %edx 4/r32/esp - 5351 (flush _test-output-buffered-file) - 5352 (flush _test-error-buffered-file) - 5353 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 5359 # check output - 5360 (check-stream-equal _test-output-stream "" "F - test-array-size-in-hex: output should be empty") - 5361 (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") - 5362 # check that stop(1) was called - 5363 (check-ints-equal *(edx+4) 2 "F - test-array-size-in-hex: exit status") - 5364 # don't restore from ebp - 5365 81 0/subop/add %esp 8/imm32 - 5366 # . epilogue - 5367 5d/pop-to-ebp - 5368 c3/return - 5369 - 5370 test-convert-function-with-populate: - 5371 # . prologue - 5372 55/push-ebp - 5373 89/<- %ebp 4/r32/esp - 5374 # setup - 5375 (clear-stream _test-input-stream) - 5376 (clear-stream $_test-input-buffered-file->buffer) - 5377 (clear-stream _test-output-stream) - 5378 (clear-stream $_test-output-buffered-file->buffer) - 5379 # - 5380 (write _test-input-stream "fn foo {\n") - 5381 (write _test-input-stream " var x/ecx: (addr handle array int) <- copy 0\n") - 5382 (write _test-input-stream " populate x, 7\n") - 5383 (write _test-input-stream "}\n") - 5384 # convert - 5385 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5386 (flush _test-output-buffered-file) - 5387 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5393 # check output - 5394 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-populate/0") - 5395 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-populate/1") - 5396 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-populate/2") - 5397 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-populate/3") - 5398 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-populate/4") - 5399 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-populate/5") - 5400 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-populate/6") - 5401 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-populate/7") - 5402 (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) - 5403 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-populate/9") - 5404 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-populate/10") - 5405 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-populate/11") - 5406 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-populate/12") - 5407 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-populate/13") - 5408 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-populate/14") - 5409 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-populate/15") - 5410 # . epilogue - 5411 89/<- %esp 5/r32/ebp - 5412 5d/pop-to-ebp - 5413 c3/return - 5414 - 5415 # special-case for size(byte) when allocating array - 5416 test-convert-function-with-local-array-of-bytes-in-mem: - 5417 # . prologue - 5418 55/push-ebp - 5419 89/<- %ebp 4/r32/esp - 5420 # setup - 5421 (clear-stream _test-input-stream) - 5422 (clear-stream $_test-input-buffered-file->buffer) - 5423 (clear-stream _test-output-stream) - 5424 (clear-stream $_test-output-buffered-file->buffer) - 5425 # - 5426 (write _test-input-stream "fn foo {\n") - 5427 (write _test-input-stream " var x: (array byte 3)\n") - 5428 (write _test-input-stream "}\n") - 5429 # convert - 5430 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5431 (flush _test-output-buffered-file) - 5432 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5438 # check output - 5439 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-of-bytes-in-mem/0") - 5440 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-of-bytes-in-mem/1") - 5441 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/2") - 5442 (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") - 5443 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-of-bytes-in-mem/4") - 5444 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-of-bytes-in-mem/5") - 5445 # define x - 5446 (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") - 5447 (check-next-stream-line-equal _test-output-stream " 68/push 0x00000003/imm32" "F - test-convert-function-with-local-array-of-bytes-in-mem/8") - 5448 # reclaim x - 5449 (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") - 5450 # - 5451 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-of-bytes-in-mem/10") - 5452 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-of-bytes-in-mem/11") - 5453 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-of-bytes-in-mem/12") - 5454 (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") - 5455 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/14") - 5456 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-of-bytes-in-mem/15") - 5457 # . epilogue - 5458 89/<- %esp 5/r32/ebp - 5459 5d/pop-to-ebp - 5460 c3/return - 5461 - 5462 test-convert-address: - 5463 # . prologue - 5464 55/push-ebp - 5465 89/<- %ebp 4/r32/esp - 5466 # setup - 5467 (clear-stream _test-input-stream) - 5468 (clear-stream $_test-input-buffered-file->buffer) - 5469 (clear-stream _test-output-stream) - 5470 (clear-stream $_test-output-buffered-file->buffer) - 5471 # - 5472 (write _test-input-stream "fn foo {\n") - 5473 (write _test-input-stream " var a: int\n") - 5474 (write _test-input-stream " var b/eax: (addr int) <- address a\n") - 5475 (write _test-input-stream "}\n") - 5476 # convert - 5477 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5478 (flush _test-output-buffered-file) - 5479 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5485 # check output - 5486 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-address/0") - 5487 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-address/1") - 5488 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-address/2") - 5489 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-address/3") - 5490 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-address/4") - 5491 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-address/5") - 5492 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-address/6") - 5493 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-address/7") - 5494 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-address/8") - 5495 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-address/9") - 5496 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-address/10") - 5497 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-address/11") - 5498 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-address/12") - 5499 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-address/13") - 5500 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-address/14") - 5501 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-address/15") - 5502 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-address/16") - 5503 # . epilogue - 5504 89/<- %esp 5/r32/ebp - 5505 5d/pop-to-ebp - 5506 c3/return - 5507 - 5508 test-convert-floating-point-convert: - 5509 # . prologue - 5510 55/push-ebp - 5511 89/<- %ebp 4/r32/esp - 5512 # setup - 5513 (clear-stream _test-input-stream) - 5514 (clear-stream $_test-input-buffered-file->buffer) - 5515 (clear-stream _test-output-stream) - 5516 (clear-stream $_test-output-buffered-file->buffer) - 5517 # - 5518 (write _test-input-stream "fn foo {\n") - 5519 (write _test-input-stream " var a/eax: int <- copy 0\n") - 5520 (write _test-input-stream " var b/xmm1: float <- convert a\n") - 5521 (write _test-input-stream "}\n") - 5522 # convert - 5523 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5524 (flush _test-output-buffered-file) - 5525 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5531 # check output - 5532 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-floating-point-convert/0") - 5533 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-convert/1") - 5534 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-convert/2") - 5535 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-convert/3") - 5536 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-convert/4") - 5537 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-floating-point-convert/5") - 5538 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-convert/6") - 5539 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-convert/7") - 5540 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-convert/8") - 5541 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-convert/9") - 5542 (check-next-stream-line-equal _test-output-stream " f3 0f 2a/convert-to-float %eax 0x00000001/x32" "F - test-convert-floating-point-convert/10") - 5543 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-convert/11") - 5544 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-floating-point-convert/12") - 5545 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-convert/13") - 5546 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-convert/14") - 5547 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-floating-point-convert/15") - 5548 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-convert/16") - 5549 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-convert/17") - 5550 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-convert/18") - 5551 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-convert/19") - 5552 # . epilogue - 5553 89/<- %esp 5/r32/ebp - 5554 5d/pop-to-ebp - 5555 c3/return - 5556 - 5557 test-convert-floating-point-convert-2: - 5558 # . prologue - 5559 55/push-ebp - 5560 89/<- %ebp 4/r32/esp - 5561 # setup - 5562 (clear-stream _test-input-stream) - 5563 (clear-stream $_test-input-buffered-file->buffer) - 5564 (clear-stream _test-output-stream) - 5565 (clear-stream $_test-output-buffered-file->buffer) - 5566 # - 5567 (write _test-input-stream "fn foo {\n") - 5568 (write _test-input-stream " var a/eax: int <- copy 0\n") - 5569 (write _test-input-stream " var b/xmm1: float <- convert a\n") - 5570 (write _test-input-stream " a <- convert b\n") - 5571 (write _test-input-stream "}\n") - 5572 # convert - 5573 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5574 (flush _test-output-buffered-file) - 5575 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5581 # check output - 5582 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-floating-point-convert-2/0") - 5583 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-convert-2/1") - 5584 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-convert-2/2") - 5585 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-convert-2/3") - 5586 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-convert-2/4") - 5587 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-floating-point-convert-2/5") - 5588 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-convert-2/6") - 5589 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-convert-2/7") - 5590 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-convert-2/8") - 5591 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-convert-2/9") - 5592 (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") - 5593 (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") - 5594 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-convert-2/12") - 5595 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-floating-point-convert-2/13") - 5596 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-convert-2/14") - 5597 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-convert-2/15") - 5598 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-floating-point-convert-2/16") - 5599 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-convert-2/17") - 5600 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-convert-2/18") - 5601 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-convert-2/19") - 5602 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-convert-2/20") - 5603 # . epilogue - 5604 89/<- %esp 5/r32/ebp - 5605 5d/pop-to-ebp - 5606 c3/return - 5607 - 5608 test-convert-floating-point-operation: - 5609 # . prologue - 5610 55/push-ebp - 5611 89/<- %ebp 4/r32/esp - 5612 # setup - 5613 (clear-stream _test-input-stream) - 5614 (clear-stream $_test-input-buffered-file->buffer) - 5615 (clear-stream _test-output-stream) - 5616 (clear-stream $_test-output-buffered-file->buffer) - 5617 # - 5618 (write _test-input-stream "fn f {\n") - 5619 (write _test-input-stream " var m: float\n") - 5620 (write _test-input-stream " var x/xmm1: float <- copy m\n") - 5621 (write _test-input-stream " var y/xmm5: float <- copy m\n") - 5622 (write _test-input-stream " x <- copy y\n") - 5623 (write _test-input-stream " copy-to m, y\n") - 5624 (write _test-input-stream " x <- add y\n") - 5625 (write _test-input-stream " x <- add m\n") - 5626 (write _test-input-stream " x <- subtract y\n") - 5627 (write _test-input-stream " x <- subtract m\n") - 5628 (write _test-input-stream " x <- multiply y\n") - 5629 (write _test-input-stream " x <- multiply m\n") - 5630 (write _test-input-stream " x <- divide y\n") - 5631 (write _test-input-stream " x <- divide m\n") - 5632 (write _test-input-stream " x <- reciprocal y\n") - 5633 (write _test-input-stream " x <- reciprocal m\n") - 5634 (write _test-input-stream " x <- square-root y\n") - 5635 (write _test-input-stream " x <- square-root m\n") - 5636 (write _test-input-stream " x <- inverse-square-root y\n") - 5637 (write _test-input-stream " x <- inverse-square-root m\n") - 5638 (write _test-input-stream " x <- max y\n") - 5639 (write _test-input-stream " x <- max m\n") - 5640 (write _test-input-stream " x <- min y\n") - 5641 (write _test-input-stream " x <- min m\n") - 5642 (write _test-input-stream " compare x, y\n") - 5643 (write _test-input-stream " compare x, m\n") - 5644 (write _test-input-stream "}\n") - 5645 # convert - 5646 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5647 (flush _test-output-buffered-file) - 5648 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5654 # check output - 5655 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-floating-point-operation/0") - 5656 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-operation/1") - 5657 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-operation/2") - 5658 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-operation/3") - 5659 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-operation/4") - 5660 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-floating-point-operation/5") - 5661 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-floating-point-operation/6") - 5662 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-operation/7") - 5663 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-operation/8") - 5664 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/9") - 5665 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-operation/10") - 5666 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 5/x32" "F - test-convert-floating-point-operation/11") - 5667 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000005/x32" "F - test-convert-floating-point-operation/12") - 5668 (check-next-stream-line-equal _test-output-stream " f3 0f 11/copy %xmm1 0x00000005/x32" "F - test-convert-floating-point-operation/13") - 5669 (check-next-stream-line-equal _test-output-stream " f3 0f 11/copy *(ebp+0xfffffffc) 0x00000005/x32" "F - test-convert-floating-point-operation/14") - 5670 (check-next-stream-line-equal _test-output-stream " f3 0f 58/add %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/15") - 5671 (check-next-stream-line-equal _test-output-stream " f3 0f 58/add *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/16") - 5672 (check-next-stream-line-equal _test-output-stream " f3 0f 5c/subtract %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/17") - 5673 (check-next-stream-line-equal _test-output-stream " f3 0f 5c/subtract *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/18") - 5674 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/19") - 5675 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/20") - 5676 (check-next-stream-line-equal _test-output-stream " f3 0f 5e/divide %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/21") - 5677 (check-next-stream-line-equal _test-output-stream " f3 0f 5e/divide *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/22") - 5678 (check-next-stream-line-equal _test-output-stream " f3 0f 53/reciprocal %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/23") - 5679 (check-next-stream-line-equal _test-output-stream " f3 0f 53/reciprocal *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/24") - 5680 (check-next-stream-line-equal _test-output-stream " f3 0f 51/square-root %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/25") - 5681 (check-next-stream-line-equal _test-output-stream " f3 0f 51/square-root *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/26") - 5682 (check-next-stream-line-equal _test-output-stream " f3 0f 52/inverse-square-root %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/27") - 5683 (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") - 5684 (check-next-stream-line-equal _test-output-stream " f3 0f 5f/max %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/29") - 5685 (check-next-stream-line-equal _test-output-stream " f3 0f 5f/max *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/30") - 5686 (check-next-stream-line-equal _test-output-stream " f3 0f 5d/min %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/31") - 5687 (check-next-stream-line-equal _test-output-stream " f3 0f 5d/min *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/32") - 5688 (check-next-stream-line-equal _test-output-stream " 0f 2f/compare %xmm1 0x00000005/x32" "F - test-convert-floating-point-operation/33") - 5689 (check-next-stream-line-equal _test-output-stream " 0f 2f/compare *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/34") - 5690 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 5/x32" "F - test-convert-floating-point-operation/35") - 5691 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-operation/36") - 5692 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-operation/37") - 5693 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-operation/38") - 5694 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-floating-point-operation/39") - 5695 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-operation/40") - 5696 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-floating-point-operation/41") - 5697 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-operation/42") - 5698 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-operation/43") - 5699 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-operation/44") - 5700 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-operation/45") - 5701 # . epilogue - 5702 89/<- %esp 5/r32/ebp - 5703 5d/pop-to-ebp - 5704 c3/return - 5705 - 5706 test-convert-floating-point-dereferenced: - 5707 # . prologue - 5708 55/push-ebp - 5709 89/<- %ebp 4/r32/esp - 5710 # setup - 5711 (clear-stream _test-input-stream) - 5712 (clear-stream $_test-input-buffered-file->buffer) - 5713 (clear-stream _test-output-stream) - 5714 (clear-stream $_test-output-buffered-file->buffer) - 5715 # - 5716 (write _test-input-stream "fn f {\n") - 5717 (write _test-input-stream " var m: float\n") - 5718 (write _test-input-stream " var x/xmm1: float <- copy m\n") - 5719 (write _test-input-stream " var y/eax: (addr float) <- copy 0\n") - 5720 (write _test-input-stream " x <- multiply *y\n") - 5721 (write _test-input-stream "}\n") - 5722 # convert - 5723 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5724 (flush _test-output-buffered-file) - 5725 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5731 # check output - 5732 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-floating-point-dereferenced/0") - 5733 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-dereferenced/1") - 5734 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-dereferenced/2") - 5735 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-dereferenced/3") - 5736 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-dereferenced/4") - 5737 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-floating-point-dereferenced/5") - 5738 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-floating-point-dereferenced/6") - 5739 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-dereferenced/7") - 5740 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-dereferenced/8") - 5741 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-dereferenced/9") - 5742 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-dereferenced/10") - 5743 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-dereferenced/11") - 5744 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply *eax 0x00000001/x32" "F - test-convert-floating-point-dereferenced/12") - 5745 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-dereferenced/13") - 5746 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-dereferenced/14") - 5747 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/15") - 5748 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-floating-point-dereferenced/16") - 5749 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-dereferenced/17") - 5750 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-floating-point-dereferenced/18") - 5751 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-dereferenced/19") - 5752 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-dereferenced/20") - 5753 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-dereferenced/21") - 5754 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-dereferenced/22") - 5755 # . epilogue - 5756 89/<- %esp 5/r32/ebp - 5757 5d/pop-to-ebp - 5758 c3/return - 5759 - 5760 test-convert-length-of-array: - 5761 # . prologue - 5762 55/push-ebp - 5763 89/<- %ebp 4/r32/esp - 5764 # setup - 5765 (clear-stream _test-input-stream) - 5766 (clear-stream $_test-input-buffered-file->buffer) - 5767 (clear-stream _test-output-stream) - 5768 (clear-stream $_test-output-buffered-file->buffer) - 5769 # - 5770 (write _test-input-stream "fn foo a: (addr array int) {\n") - 5771 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n") - 5772 (write _test-input-stream " var c/eax: int <- length b\n") - 5773 (write _test-input-stream "}\n") - 5774 # convert - 5775 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5776 (flush _test-output-buffered-file) - 5777 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5783 # check output - 5784 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0") - 5785 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1") - 5786 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2") - 5787 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3") - 5788 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4") - 5789 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5") - 5790 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6") - 5791 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7") - 5792 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array/8") - 5793 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array/9") - 5794 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/10") - 5795 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/11") - 5796 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/12") - 5797 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/13") - 5798 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/14") - 5799 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/15") - 5800 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/16") - 5801 # . epilogue - 5802 89/<- %esp 5/r32/ebp - 5803 5d/pop-to-ebp - 5804 c3/return - 5805 - 5806 # special-case for size(byte) when computing array length - 5807 test-convert-length-of-array-of-bytes: - 5808 # . prologue - 5809 55/push-ebp - 5810 89/<- %ebp 4/r32/esp - 5811 # setup - 5812 (clear-stream _test-input-stream) - 5813 (clear-stream $_test-input-buffered-file->buffer) - 5814 (clear-stream _test-output-stream) - 5815 (clear-stream $_test-output-buffered-file->buffer) - 5816 # - 5817 (write _test-input-stream "fn foo a: (addr array byte) {\n") - 5818 (write _test-input-stream " var b/eax: (addr array byte) <- copy a\n") - 5819 (write _test-input-stream " var c/eax: int <- length b\n") - 5820 (write _test-input-stream "}\n") - 5821 # convert - 5822 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5823 (flush _test-output-buffered-file) - 5824 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5830 # check output - 5831 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-bytes/0") - 5832 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-bytes/1") - 5833 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-bytes/2") - 5834 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-bytes/3") - 5835 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-bytes/4") - 5836 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-bytes/5") - 5837 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-bytes/6") - 5838 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/7") - 5839 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/8") - 5840 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-bytes/9") - 5841 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-bytes/10") - 5842 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-bytes/11") - 5843 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-bytes/12") - 5844 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-bytes/13") - 5845 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-bytes/14") - 5846 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-bytes/15") - 5847 # . epilogue - 5848 89/<- %esp 5/r32/ebp - 5849 5d/pop-to-ebp - 5850 c3/return - 5851 - 5852 test-convert-length-of-array-on-stack: - 5853 # . prologue - 5854 55/push-ebp - 5855 89/<- %ebp 4/r32/esp - 5856 # setup - 5857 (clear-stream _test-input-stream) - 5858 (clear-stream $_test-input-buffered-file->buffer) - 5859 (clear-stream _test-output-stream) - 5860 (clear-stream $_test-output-buffered-file->buffer) - 5861 # - 5862 (write _test-input-stream "fn foo {\n") - 5863 (write _test-input-stream " var a: (array int 3)\n") - 5864 (write _test-input-stream " var b/eax: int <- length a\n") - 5865 (write _test-input-stream "}\n") - 5866 # convert - 5867 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5868 (flush _test-output-buffered-file) - 5869 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5875 # check output - 5876 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-on-stack/0") - 5877 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-on-stack/1") - 5878 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-on-stack/2") - 5879 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-on-stack/3") - 5880 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-on-stack/4") - 5881 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-on-stack/5") - 5882 # define x - 5883 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-length-of-array-on-stack/6") - 5884 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-length-of-array-on-stack/7") - 5885 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-on-stack/8") - 5886 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff0) 0x00000000/r32" "F - test-convert-length-of-array-on-stack/9") - 5887 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array-on-stack/10") - 5888 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-on-stack/11") - 5889 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-length-of-array-on-stack/12") - 5890 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-on-stack/13") - 5891 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-on-stack/14") - 5892 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-on-stack/15") - 5893 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-on-stack/16") - 5894 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-on-stack/17") - 5895 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-on-stack/18") - 5896 # . epilogue - 5897 89/<- %esp 5/r32/ebp - 5898 5d/pop-to-ebp - 5899 c3/return - 5900 - 5901 test-reg-var-def-with-read-of-same-register: - 5902 # . prologue - 5903 55/push-ebp - 5904 89/<- %ebp 4/r32/esp - 5905 # setup - 5906 (clear-stream _test-input-stream) - 5907 (clear-stream $_test-input-buffered-file->buffer) - 5908 (clear-stream _test-output-stream) - 5909 (clear-stream $_test-output-buffered-file->buffer) - 5910 (clear-stream _test-error-stream) - 5911 (clear-stream $_test-error-buffered-file->buffer) - 5912 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu - 5913 68/push 0/imm32 - 5914 68/push 0/imm32 - 5915 89/<- %edx 4/r32/esp - 5916 (tailor-exit-descriptor %edx 0x10) - 5917 # - 5918 (write _test-input-stream "fn foo {\n") - 5919 (write _test-input-stream " var x/eax: int <- copy 3\n") - 5920 (write _test-input-stream " var y/eax: int <- add x\n") - 5921 (write _test-input-stream "}\n") - 5922 # convert - 5923 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 5924 # registers except esp could be clobbered at this point (though they shouldn't be) - 5925 # restore ed - 5926 89/<- %edx 4/r32/esp - 5927 (flush _test-output-buffered-file) - 5928 (flush _test-error-buffered-file) - 5929 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5935 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 5941 (check-stream-equal _test-error-stream "" "F - test-reg-var-def-with-read-of-same-register: error stream should be empty") - 5942 # check output - 5943 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-reg-var-def-with-read-of-same-register/0") - 5944 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-reg-var-def-with-read-of-same-register/1") - 5945 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-reg-var-def-with-read-of-same-register/2") - 5946 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-reg-var-def-with-read-of-same-register/3") - 5947 (check-next-stream-line-equal _test-output-stream " {" "F - test-reg-var-def-with-read-of-same-register/4") - 5948 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-reg-var-def-with-read-of-same-register/5") - 5949 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-reg-var-def-with-read-of-same-register/6") - 5950 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-reg-var-def-with-read-of-same-register/7") - 5951 (check-next-stream-line-equal _test-output-stream " 01/add-to %eax 0x00000000/r32" "F - test-reg-var-def-with-read-of-same-register/8") - 5952 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-reg-var-def-with-read-of-same-register/9") - 5953 (check-next-stream-line-equal _test-output-stream " }" "F - test-reg-var-def-with-read-of-same-register/10") - 5954 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-reg-var-def-with-read-of-same-register/11") - 5955 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-reg-var-def-with-read-of-same-register/12") - 5956 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-reg-var-def-with-read-of-same-register/13") - 5957 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-reg-var-def-with-read-of-same-register/14") - 5958 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-reg-var-def-with-read-of-same-register/15") - 5959 # don't restore from ebp - 5960 81 0/subop/add %esp 8/imm32 - 5961 # . epilogue - 5962 5d/pop-to-ebp - 5963 c3/return - 5964 - 5965 test-convert-index-into-array: - 5966 # . prologue - 5967 55/push-ebp - 5968 89/<- %ebp 4/r32/esp - 5969 # setup - 5970 (clear-stream _test-input-stream) - 5971 (clear-stream $_test-input-buffered-file->buffer) - 5972 (clear-stream _test-output-stream) - 5973 (clear-stream $_test-output-buffered-file->buffer) - 5974 # - 5975 (write _test-input-stream "fn foo {\n") - 5976 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 5977 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 5978 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") - 5979 (write _test-input-stream "}\n") - 5980 # convert - 5981 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5982 (flush _test-output-buffered-file) - 5983 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 5989 # check output - 5990 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0") - 5991 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1") - 5992 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2") - 5993 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3") - 5994 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4") - 5995 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5") - 5996 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6") - 5997 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7") - 5998 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8") - 5999 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9") - 6000 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 0x00000004 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array/10") - 6001 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-convert-index-into-array/11") - 6002 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/12") - 6003 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/13") - 6004 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/14") - 6005 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/15") - 6006 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/16") - 6007 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/17") - 6008 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/18") - 6009 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/19") + 4012 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0") + 4013 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1") + 4014 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2") + 4015 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3") + 4016 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4") + 4017 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5") + 4018 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6") + 4019 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7") + 4020 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8") + 4021 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9") + 4022 (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") + 4023 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11") + 4024 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12") + 4025 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13") + 4026 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14") + 4027 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15") + 4028 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16") + 4029 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17") + 4030 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18") + 4031 # . epilogue + 4032 89/<- %esp 5/r32/ebp + 4033 5d/pop-to-ebp + 4034 c3/return + 4035 + 4036 test-convert-function-with-local-var-in-mem-after-block: + 4037 # . prologue + 4038 55/push-ebp + 4039 89/<- %ebp 4/r32/esp + 4040 # setup + 4041 (clear-stream _test-input-stream) + 4042 (clear-stream $_test-input-buffered-file->buffer) + 4043 (clear-stream _test-output-stream) + 4044 (clear-stream $_test-output-buffered-file->buffer) + 4045 # + 4046 (write _test-input-stream "fn foo {\n") + 4047 (write _test-input-stream " {\n") + 4048 (write _test-input-stream " var y: int\n") + 4049 (write _test-input-stream " }\n") + 4050 (write _test-input-stream " var x: int\n") + 4051 (write _test-input-stream " increment x\n") + 4052 (write _test-input-stream "}\n") + 4053 # convert + 4054 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4055 (flush _test-output-buffered-file) + 4056 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4062 # check output + 4063 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem-after-block/0") + 4064 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem-after-block/1") + 4065 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem-after-block/2") + 4066 (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") + 4067 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem-after-block/4") + 4068 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem-after-block/5") + 4069 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem-after-block/6") + 4070 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-mem-after-block/7") + 4071 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/8") + 4072 (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") + 4073 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem-after-block/10") + 4074 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-mem-after-block/11") + 4075 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/12") + 4076 (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") + 4077 (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") + 4078 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem-after-block/15") + 4079 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem-after-block/16") + 4080 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem-after-block/17") + 4081 (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") + 4082 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem-after-block/19") + 4083 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem-after-block/20") + 4084 # . epilogue + 4085 89/<- %esp 5/r32/ebp + 4086 5d/pop-to-ebp + 4087 c3/return + 4088 + 4089 test-convert-function-with-local-var-in-named-block: + 4090 # . prologue + 4091 55/push-ebp + 4092 89/<- %ebp 4/r32/esp + 4093 # setup + 4094 (clear-stream _test-input-stream) + 4095 (clear-stream $_test-input-buffered-file->buffer) + 4096 (clear-stream _test-output-stream) + 4097 (clear-stream $_test-output-buffered-file->buffer) + 4098 # + 4099 (write _test-input-stream "fn foo {\n") + 4100 (write _test-input-stream " $bar: {\n") + 4101 (write _test-input-stream " var x: int\n") + 4102 (write _test-input-stream " increment x\n") + 4103 (write _test-input-stream " }\n") + 4104 (write _test-input-stream "}\n") + 4105 # convert + 4106 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4107 (flush _test-output-buffered-file) + 4108 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4114 # check output + 4115 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0") + 4116 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1") + 4117 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2") + 4118 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3") + 4119 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4") + 4120 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5") + 4121 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6") + 4122 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7") + 4123 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8") + 4124 (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") + 4125 (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") + 4126 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11") + 4127 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12") + 4128 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13") + 4129 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14") + 4130 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15") + 4131 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16") + 4132 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17") + 4133 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18") + 4134 # . epilogue + 4135 89/<- %esp 5/r32/ebp + 4136 5d/pop-to-ebp + 4137 c3/return + 4138 + 4139 test-unknown-variable-in-named-block: + 4140 # . prologue + 4141 55/push-ebp + 4142 89/<- %ebp 4/r32/esp + 4143 # setup + 4144 (clear-stream _test-input-stream) + 4145 (clear-stream $_test-input-buffered-file->buffer) + 4146 (clear-stream _test-output-stream) + 4147 (clear-stream $_test-output-buffered-file->buffer) + 4148 (clear-stream _test-error-stream) + 4149 (clear-stream $_test-error-buffered-file->buffer) + 4150 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 4151 68/push 0/imm32 + 4152 68/push 0/imm32 + 4153 89/<- %edx 4/r32/esp + 4154 (tailor-exit-descriptor %edx 0x10) + 4155 # + 4156 (write _test-input-stream "fn foo {\n") + 4157 (write _test-input-stream " $a: {\n") + 4158 (write _test-input-stream " compare x, 0\n") + 4159 (write _test-input-stream " }\n") + 4160 (write _test-input-stream "}\n") + 4161 # convert + 4162 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 4163 # registers except esp clobbered at this point + 4164 # restore ed + 4165 89/<- %edx 4/r32/esp + 4166 (flush _test-output-buffered-file) + 4167 (flush _test-error-buffered-file) + 4168 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 4174 # check output + 4175 (check-stream-equal _test-output-stream "" "F - test-unknown-variable-in-named-block: output should be empty") + 4176 (check-next-stream-line-equal _test-error-stream "fn foo: unknown variable 'x'" "F - test-unknown-variable-in-named-block: error message") + 4177 # check that stop(1) was called + 4178 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable-in-named-block: exit status") + 4179 # don't restore from ebp + 4180 81 0/subop/add %esp 8/imm32 + 4181 # . epilogue + 4182 5d/pop-to-ebp + 4183 c3/return + 4184 + 4185 test-always-shadow-outermost-reg-vars-in-function: + 4186 # . prologue + 4187 55/push-ebp + 4188 89/<- %ebp 4/r32/esp + 4189 # setup + 4190 (clear-stream _test-input-stream) + 4191 (clear-stream $_test-input-buffered-file->buffer) + 4192 (clear-stream _test-output-stream) + 4193 (clear-stream $_test-output-buffered-file->buffer) + 4194 # + 4195 (write _test-input-stream "fn foo {\n") + 4196 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 4197 (write _test-input-stream "}\n") + 4198 # convert + 4199 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4200 (flush _test-output-buffered-file) + 4201 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4207 # check output + 4208 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-always-shadow-outermost-reg-vars-in-function/0") + 4209 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-always-shadow-outermost-reg-vars-in-function/1") + 4210 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/2") + 4211 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-always-shadow-outermost-reg-vars-in-function/3") + 4212 (check-next-stream-line-equal _test-output-stream " {" "F - test-always-shadow-outermost-reg-vars-in-function/4") + 4213 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-always-shadow-outermost-reg-vars-in-function/5") + 4214 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") + 4215 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-always-shadow-outermost-reg-vars-in-function/8") + 4216 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") + 4217 (check-next-stream-line-equal _test-output-stream " }" "F - test-always-shadow-outermost-reg-vars-in-function/12") + 4218 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-always-shadow-outermost-reg-vars-in-function/13") + 4219 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-always-shadow-outermost-reg-vars-in-function/14") + 4220 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-always-shadow-outermost-reg-vars-in-function/15") + 4221 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/16") + 4222 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-always-shadow-outermost-reg-vars-in-function/17") + 4223 # . epilogue + 4224 89/<- %esp 5/r32/ebp + 4225 5d/pop-to-ebp + 4226 c3/return + 4227 + 4228 test-shadow-local: + 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 " var x/ecx: int <- copy 3\n") + 4240 (write _test-input-stream " {\n") + 4241 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 4242 (write _test-input-stream " }\n") + 4243 (write _test-input-stream " x <- increment\n") + 4244 (write _test-input-stream "}\n") + 4245 # convert + 4246 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4247 (flush _test-output-buffered-file) + 4248 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4254 # check output + 4255 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-local/0") + 4256 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-local/1") + 4257 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-local/2") + 4258 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-local/3") + 4259 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-local/4") + 4260 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-local/5") + 4261 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-local/6") + 4262 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-local/7") + 4263 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-local/8") + 4264 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-local/9") + 4265 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-local/10") + 4266 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-local/11") + 4267 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-local/12") + 4268 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-local/13") + 4269 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-local/14") + 4270 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-local/15") + 4271 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-local/16") + 4272 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-local/17") + 4273 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-local/18") + 4274 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-local/19") + 4275 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-local/20") + 4276 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-local/21") + 4277 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-local/22") + 4278 # . epilogue + 4279 89/<- %esp 5/r32/ebp + 4280 5d/pop-to-ebp + 4281 c3/return + 4282 + 4283 test-shadow-name: + 4284 # . prologue + 4285 55/push-ebp + 4286 89/<- %ebp 4/r32/esp + 4287 # setup + 4288 (clear-stream _test-input-stream) + 4289 (clear-stream $_test-input-buffered-file->buffer) + 4290 (clear-stream _test-output-stream) + 4291 (clear-stream $_test-output-buffered-file->buffer) + 4292 # + 4293 (write _test-input-stream "fn foo {\n") + 4294 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 4295 (write _test-input-stream " {\n") + 4296 (write _test-input-stream " var x/edx: int <- copy 4\n") + 4297 (write _test-input-stream " }\n") + 4298 (write _test-input-stream " x <- increment\n") + 4299 (write _test-input-stream "}\n") + 4300 # convert + 4301 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4302 (flush _test-output-buffered-file) + 4303 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4309 # check output + 4310 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-name/0") + 4311 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-name/1") + 4312 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-name/2") + 4313 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-name/3") + 4314 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name/4") + 4315 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-name/5") + 4316 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name/6") + 4317 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-name/7") + 4318 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name/8") + 4319 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-name/9") + 4320 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-shadow-name/10") + 4321 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 4/imm32" "F - test-shadow-name/11") + 4322 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-shadow-name/12") + 4323 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name/13") + 4324 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-name/14") + 4325 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-name/15") + 4326 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name/16") + 4327 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name/17") + 4328 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-name/18") + 4329 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-name/19") + 4330 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-name/20") + 4331 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-name/21") + 4332 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-name/22") + 4333 # . epilogue + 4334 89/<- %esp 5/r32/ebp + 4335 5d/pop-to-ebp + 4336 c3/return + 4337 + 4338 test-shadow-name-2: + 4339 # . prologue + 4340 55/push-ebp + 4341 89/<- %ebp 4/r32/esp + 4342 # setup + 4343 (clear-stream _test-input-stream) + 4344 (clear-stream $_test-input-buffered-file->buffer) + 4345 (clear-stream _test-output-stream) + 4346 (clear-stream $_test-output-buffered-file->buffer) + 4347 # + 4348 (write _test-input-stream "fn foo {\n") + 4349 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 4350 (write _test-input-stream " {\n") + 4351 (write _test-input-stream " var x/edx: int <- copy 4\n") + 4352 (write _test-input-stream " var y/ecx: int <- copy 5\n") + 4353 (write _test-input-stream " }\n") + 4354 (write _test-input-stream " x <- increment\n") + 4355 (write _test-input-stream "}\n") + 4356 # convert + 4357 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4358 (flush _test-output-buffered-file) + 4359 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4365 # check output + 4366 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-name-2/0") + 4367 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-name-2/1") + 4368 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-name-2/2") + 4369 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-name-2/3") + 4370 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name-2/4") + 4371 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-name-2/5") + 4372 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name-2/6") + 4373 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-name-2/7") + 4374 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name-2/8") + 4375 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-name-2/9") + 4376 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-shadow-name-2/10") + 4377 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 4/imm32" "F - test-shadow-name-2/11") + 4378 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name-2/12") + 4379 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 5/imm32" "F - test-shadow-name-2/13") + 4380 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name-2/14") + 4381 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-shadow-name-2/15") + 4382 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name-2/16") + 4383 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-name-2/17") + 4384 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-name-2/18") + 4385 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name-2/19") + 4386 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name-2/20") + 4387 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-name-2/21") + 4388 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-name-2/22") + 4389 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-name-2/23") + 4390 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-name-2/24") + 4391 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-name-2/25") + 4392 # . epilogue + 4393 89/<- %esp 5/r32/ebp + 4394 5d/pop-to-ebp + 4395 c3/return + 4396 + 4397 test-do-not-spill-same-register-in-block: + 4398 # . prologue + 4399 55/push-ebp + 4400 89/<- %ebp 4/r32/esp + 4401 # setup + 4402 (clear-stream _test-input-stream) + 4403 (clear-stream $_test-input-buffered-file->buffer) + 4404 (clear-stream _test-output-stream) + 4405 (clear-stream $_test-output-buffered-file->buffer) + 4406 # + 4407 (write _test-input-stream "fn foo {\n") + 4408 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 4409 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 4410 (write _test-input-stream " y <- increment\n") + 4411 (write _test-input-stream "}\n") + 4412 # convert + 4413 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4414 (flush _test-output-buffered-file) + 4415 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4421 # check output + 4422 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-do-not-spill-same-register-in-block/0") + 4423 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-do-not-spill-same-register-in-block/1") + 4424 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-do-not-spill-same-register-in-block/2") + 4425 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-do-not-spill-same-register-in-block/3") + 4426 (check-next-stream-line-equal _test-output-stream " {" "F - test-do-not-spill-same-register-in-block/4") + 4427 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-do-not-spill-same-register-in-block/5") + 4428 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-do-not-spill-same-register-in-block/6") + 4429 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-do-not-spill-same-register-in-block/7") + 4430 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-do-not-spill-same-register-in-block/8") + 4431 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-do-not-spill-same-register-in-block/9") + 4432 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-do-not-spill-same-register-in-block/10") + 4433 (check-next-stream-line-equal _test-output-stream " }" "F - test-do-not-spill-same-register-in-block/11") + 4434 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-do-not-spill-same-register-in-block/12") + 4435 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-do-not-spill-same-register-in-block/13") + 4436 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-do-not-spill-same-register-in-block/14") + 4437 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-do-not-spill-same-register-in-block/15") + 4438 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-do-not-spill-same-register-in-block/16") + 4439 # . epilogue + 4440 89/<- %esp 5/r32/ebp + 4441 5d/pop-to-ebp + 4442 c3/return + 4443 + 4444 test-spill-different-register-in-block: + 4445 # . prologue + 4446 55/push-ebp + 4447 89/<- %ebp 4/r32/esp + 4448 # setup + 4449 (clear-stream _test-input-stream) + 4450 (clear-stream $_test-input-buffered-file->buffer) + 4451 (clear-stream _test-output-stream) + 4452 (clear-stream $_test-output-buffered-file->buffer) + 4453 # + 4454 (write _test-input-stream "fn foo {\n") + 4455 (write _test-input-stream " var x/eax: int <- copy 3\n") + 4456 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 4457 (write _test-input-stream " y <- increment\n") + 4458 (write _test-input-stream "}\n") + 4459 # convert + 4460 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4461 (flush _test-output-buffered-file) + 4462 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4468 # check output + 4469 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-spill-different-register-in-block/0") + 4470 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-spill-different-register-in-block/1") + 4471 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-spill-different-register-in-block/2") + 4472 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-spill-different-register-in-block/3") + 4473 (check-next-stream-line-equal _test-output-stream " {" "F - test-spill-different-register-in-block/4") + 4474 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-spill-different-register-in-block/5") + 4475 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-spill-different-register-in-block/6") + 4476 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-spill-different-register-in-block/7") + 4477 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-spill-different-register-in-block/8") + 4478 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-spill-different-register-in-block/9") + 4479 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-spill-different-register-in-block/10") + 4480 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-spill-different-register-in-block/11") + 4481 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-spill-different-register-in-block/12") + 4482 (check-next-stream-line-equal _test-output-stream " }" "F - test-spill-different-register-in-block/13") + 4483 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-spill-different-register-in-block/14") + 4484 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-spill-different-register-in-block/15") + 4485 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-spill-different-register-in-block/16") + 4486 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-spill-different-register-in-block/17") + 4487 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-spill-different-register-in-block/18") + 4488 # . epilogue + 4489 89/<- %esp 5/r32/ebp + 4490 5d/pop-to-ebp + 4491 c3/return + 4492 + 4493 test-convert-function-with-branches-in-block: + 4494 # . prologue + 4495 55/push-ebp + 4496 89/<- %ebp 4/r32/esp + 4497 # setup + 4498 (clear-stream _test-input-stream) + 4499 (clear-stream $_test-input-buffered-file->buffer) + 4500 (clear-stream _test-output-stream) + 4501 (clear-stream $_test-output-buffered-file->buffer) + 4502 # + 4503 (write _test-input-stream "fn foo x: int {\n") + 4504 (write _test-input-stream " {\n") + 4505 (write _test-input-stream " break-if->=\n") + 4506 (write _test-input-stream " loop-if-addr<\n") + 4507 (write _test-input-stream " increment x\n") + 4508 (write _test-input-stream " loop\n") + 4509 (write _test-input-stream " }\n") + 4510 (write _test-input-stream "}\n") + 4511 # convert + 4512 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4513 (flush _test-output-buffered-file) + 4514 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4520 # check output + 4521 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") + 4522 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") + 4523 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") + 4524 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") + 4525 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") + 4526 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") + 4527 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") + 4528 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") + 4529 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") + 4530 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") + 4531 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") + 4532 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") + 4533 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") + 4534 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") + 4535 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") + 4536 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") + 4537 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") + 4538 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") + 4539 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") + 4540 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") + 4541 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") + 4542 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") + 4543 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") + 4544 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") + 4545 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") + 4546 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") + 4547 # . epilogue + 4548 89/<- %esp 5/r32/ebp + 4549 5d/pop-to-ebp + 4550 c3/return + 4551 + 4552 test-convert-function-with-branches-in-block-2: + 4553 # . prologue + 4554 55/push-ebp + 4555 89/<- %ebp 4/r32/esp + 4556 # setup + 4557 (clear-stream _test-input-stream) + 4558 (clear-stream $_test-input-buffered-file->buffer) + 4559 (clear-stream _test-output-stream) + 4560 (clear-stream $_test-output-buffered-file->buffer) + 4561 # + 4562 (write _test-input-stream "fn foo x: int {\n") + 4563 (write _test-input-stream " {\n") + 4564 (write _test-input-stream " break-if->=\n") + 4565 (write _test-input-stream " loop-if-float<\n") + 4566 (write _test-input-stream " increment x\n") + 4567 (write _test-input-stream " loop\n") + 4568 (write _test-input-stream " }\n") + 4569 (write _test-input-stream "}\n") + 4570 # convert + 4571 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4572 (flush _test-output-buffered-file) + 4573 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4579 # check output + 4580 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") + 4581 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") + 4582 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") + 4583 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") + 4584 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") + 4585 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") + 4586 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") + 4587 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") + 4588 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") + 4589 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") + 4590 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") + 4591 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") + 4592 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") + 4593 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") + 4594 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") + 4595 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") + 4596 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") + 4597 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") + 4598 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") + 4599 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") + 4600 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") + 4601 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") + 4602 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") + 4603 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") + 4604 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") + 4605 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") + 4606 # . epilogue + 4607 89/<- %esp 5/r32/ebp + 4608 5d/pop-to-ebp + 4609 c3/return + 4610 + 4611 test-convert-function-with-branches-in-named-block: + 4612 # . prologue + 4613 55/push-ebp + 4614 89/<- %ebp 4/r32/esp + 4615 # setup + 4616 (clear-stream _test-input-stream) + 4617 (clear-stream $_test-input-buffered-file->buffer) + 4618 (clear-stream _test-output-stream) + 4619 (clear-stream $_test-output-buffered-file->buffer) + 4620 # + 4621 (write _test-input-stream "fn foo x: int {\n") + 4622 (write _test-input-stream " $bar: {\n") + 4623 (write _test-input-stream " break-if->= $bar\n") + 4624 (write _test-input-stream " loop-if-addr< $bar\n") + 4625 (write _test-input-stream " increment x\n") + 4626 (write _test-input-stream " loop\n") + 4627 (write _test-input-stream " }\n") + 4628 (write _test-input-stream "}\n") + 4629 # convert + 4630 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4631 (flush _test-output-buffered-file) + 4632 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4638 # check output + 4639 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0") + 4640 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1") + 4641 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2") + 4642 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3") + 4643 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4") + 4644 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5") + 4645 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6") + 4646 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7") + 4647 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/8") + 4648 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-named-block/9") + 4649 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/10") + 4650 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/11") + 4651 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/12") + 4652 (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") + 4653 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:loop/disp32" "F - test-convert-function-with-branches-in-named-block/14") + 4654 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/15") + 4655 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/16") + 4656 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/17") + 4657 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/18") + 4658 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/19") + 4659 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/20") + 4660 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/21") + 4661 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/22") + 4662 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/23") + 4663 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/24") + 4664 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/25") + 4665 # . epilogue + 4666 89/<- %esp 5/r32/ebp + 4667 5d/pop-to-ebp + 4668 c3/return + 4669 + 4670 test-convert-function-with-var-in-nested-block: + 4671 # . prologue + 4672 55/push-ebp + 4673 89/<- %ebp 4/r32/esp + 4674 # setup + 4675 (clear-stream _test-input-stream) + 4676 (clear-stream $_test-input-buffered-file->buffer) + 4677 (clear-stream _test-output-stream) + 4678 (clear-stream $_test-output-buffered-file->buffer) + 4679 # + 4680 (write _test-input-stream "fn foo x: int {\n") + 4681 (write _test-input-stream " {\n") + 4682 (write _test-input-stream " {\n") + 4683 (write _test-input-stream " var x: int\n") + 4684 (write _test-input-stream " increment x\n") + 4685 (write _test-input-stream " }\n") + 4686 (write _test-input-stream " }\n") + 4687 (write _test-input-stream "}\n") + 4688 # convert + 4689 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4690 (flush _test-output-buffered-file) + 4691 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4697 # check output + 4698 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") + 4699 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1") + 4700 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") + 4701 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") + 4702 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4") + 4703 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5") + 4704 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6") + 4705 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7") + 4706 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8") + 4707 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9") + 4708 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10") + 4709 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11") + 4710 (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") + 4711 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13") + 4712 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14") + 4713 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15") + 4714 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16") + 4715 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17") + 4716 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18") + 4717 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19") + 4718 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20") + 4719 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21") + 4720 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22") + 4721 # . epilogue + 4722 89/<- %esp 5/r32/ebp + 4723 5d/pop-to-ebp + 4724 c3/return + 4725 + 4726 test-convert-function-with-multiple-vars-in-nested-blocks: + 4727 # . prologue + 4728 55/push-ebp + 4729 89/<- %ebp 4/r32/esp + 4730 # setup + 4731 (clear-stream _test-input-stream) + 4732 (clear-stream $_test-input-buffered-file->buffer) + 4733 (clear-stream _test-output-stream) + 4734 (clear-stream $_test-output-buffered-file->buffer) + 4735 # + 4736 (write _test-input-stream "fn foo x: int {\n") + 4737 (write _test-input-stream " {\n") + 4738 (write _test-input-stream " var x/eax: int <- copy 0\n") + 4739 (write _test-input-stream " {\n") + 4740 (write _test-input-stream " var y: int\n") + 4741 (write _test-input-stream " x <- add y\n") + 4742 (write _test-input-stream " }\n") + 4743 (write _test-input-stream " }\n") + 4744 (write _test-input-stream "}\n") + 4745 # convert + 4746 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4747 (flush _test-output-buffered-file) + 4748 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4754 # check output + 4755 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0") + 4756 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1") + 4757 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2") + 4758 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3") + 4759 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4") + 4760 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5") + 4761 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6") + 4762 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7") + 4763 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8") + 4764 (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") + 4765 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10") + 4766 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11") + 4767 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12") + 4768 (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") + 4769 (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") + 4770 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15") + 4771 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16") + 4772 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17") + 4773 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18") + 4774 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19") + 4775 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20") + 4776 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21") + 4777 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22") + 4778 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23") + 4779 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24") + 4780 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25") + 4781 # . epilogue + 4782 89/<- %esp 5/r32/ebp + 4783 5d/pop-to-ebp + 4784 c3/return + 4785 + 4786 test-convert-function-with-branches-and-local-vars: + 4787 # A conditional 'break' after a 'var' in a block is converted into a + 4788 # nested block that performs all necessary cleanup before jumping. This + 4789 # results in some ugly code duplication. + 4790 # . prologue + 4791 55/push-ebp + 4792 89/<- %ebp 4/r32/esp + 4793 # setup + 4794 (clear-stream _test-input-stream) + 4795 (clear-stream $_test-input-buffered-file->buffer) + 4796 (clear-stream _test-output-stream) + 4797 (clear-stream $_test-output-buffered-file->buffer) + 4798 # + 4799 (write _test-input-stream "fn foo {\n") + 4800 (write _test-input-stream " {\n") + 4801 (write _test-input-stream " var x: int\n") + 4802 (write _test-input-stream " break-if->=\n") + 4803 (write _test-input-stream " increment x\n") + 4804 (write _test-input-stream " }\n") + 4805 (write _test-input-stream "}\n") + 4806 # convert + 4807 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4808 (flush _test-output-buffered-file) + 4809 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4815 # check output + 4816 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0") + 4817 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1") + 4818 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2") + 4819 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3") + 4820 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4") + 4821 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5") + 4822 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6") + 4823 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7") + 4824 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8") + 4825 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9") + 4826 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10") + 4827 (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") + 4828 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12") + 4829 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13") + 4830 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14") + 4831 (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") + 4832 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16") + 4833 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17") + 4834 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18") + 4835 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19") + 4836 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20") + 4837 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21") + 4838 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22") + 4839 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23") + 4840 # . epilogue + 4841 89/<- %esp 5/r32/ebp + 4842 5d/pop-to-ebp + 4843 c3/return + 4844 + 4845 test-convert-function-with-conditional-loops-and-local-vars: + 4846 # A conditional 'loop' after a 'var' in a block is converted into a nested + 4847 # block that performs all necessary cleanup before jumping. This results + 4848 # in some ugly code duplication. + 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 " {\n") + 4860 (write _test-input-stream " var x: int\n") + 4861 (write _test-input-stream " loop-if->=\n") + 4862 (write _test-input-stream " increment x\n") + 4863 (write _test-input-stream " }\n") + 4864 (write _test-input-stream "}\n") + 4865 # convert + 4866 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4867 (flush _test-output-buffered-file) + 4868 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4874 # check output + 4875 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0") + 4876 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1") + 4877 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2") + 4878 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3") + 4879 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4") + 4880 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5") + 4881 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6") + 4882 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7") + 4883 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8") + 4884 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9") + 4885 (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") + 4886 (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") + 4887 (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") + 4888 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13") + 4889 (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") + 4890 (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") + 4891 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16") + 4892 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17") + 4893 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18") + 4894 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19") + 4895 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20") + 4896 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21") + 4897 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22") + 4898 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23") + 4899 # . epilogue + 4900 89/<- %esp 5/r32/ebp + 4901 5d/pop-to-ebp + 4902 c3/return + 4903 + 4904 test-convert-function-with-unconditional-loops-and-local-vars: + 4905 # An unconditional 'loop' after a 'var' in a block is emitted _after_ the + 4906 # regular block cleanup. Any instructions after 'loop' are dead and + 4907 # therefore skipped. + 4908 # . prologue + 4909 55/push-ebp + 4910 89/<- %ebp 4/r32/esp + 4911 # setup + 4912 (clear-stream _test-input-stream) + 4913 (clear-stream $_test-input-buffered-file->buffer) + 4914 (clear-stream _test-output-stream) + 4915 (clear-stream $_test-output-buffered-file->buffer) + 4916 # + 4917 (write _test-input-stream "fn foo {\n") + 4918 (write _test-input-stream " {\n") + 4919 (write _test-input-stream " var x: int\n") + 4920 (write _test-input-stream " loop\n") + 4921 (write _test-input-stream " increment x\n") + 4922 (write _test-input-stream " }\n") + 4923 (write _test-input-stream "}\n") + 4924 # convert + 4925 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4926 (flush _test-output-buffered-file) + 4927 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4933 # check output + 4934 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0") + 4935 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1") + 4936 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2") + 4937 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3") + 4938 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4") + 4939 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5") + 4940 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6") + 4941 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7") + 4942 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8") + 4943 (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") + 4944 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10") + 4945 # not emitted: ff 0/subop/increment *(ebp+0xfffffffc) + 4946 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11") + 4947 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12") + 4948 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13") + 4949 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14") + 4950 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15") + 4951 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16") + 4952 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17") + 4953 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18") + 4954 # . epilogue + 4955 89/<- %esp 5/r32/ebp + 4956 5d/pop-to-ebp + 4957 c3/return + 4958 + 4959 test-convert-function-with-branches-and-loops-and-local-vars: + 4960 # . prologue + 4961 55/push-ebp + 4962 89/<- %ebp 4/r32/esp + 4963 # setup + 4964 (clear-stream _test-input-stream) + 4965 (clear-stream $_test-input-buffered-file->buffer) + 4966 (clear-stream _test-output-stream) + 4967 (clear-stream $_test-output-buffered-file->buffer) + 4968 # + 4969 (write _test-input-stream "fn foo {\n") + 4970 (write _test-input-stream " {\n") + 4971 (write _test-input-stream " var x: int\n") + 4972 (write _test-input-stream " break-if->=\n") + 4973 (write _test-input-stream " increment x\n") + 4974 (write _test-input-stream " loop\n") + 4975 (write _test-input-stream " }\n") + 4976 (write _test-input-stream "}\n") + 4977 # convert + 4978 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4979 (flush _test-output-buffered-file) + 4980 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4986 # check output + 4987 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0") + 4988 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1") + 4989 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2") + 4990 (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") + 4991 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4") + 4992 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5") + 4993 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6") + 4994 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7") + 4995 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8") + 4996 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9") + 4997 (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") + 4998 (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") + 4999 (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") + 5000 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13") + 5001 (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") + 5002 (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") + 5003 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16") + 5004 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17") + 5005 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18") + 5006 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19") + 5007 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20") + 5008 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21") + 5009 (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") + 5010 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23") + 5011 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24") + 5012 # . epilogue + 5013 89/<- %esp 5/r32/ebp + 5014 5d/pop-to-ebp + 5015 c3/return + 5016 + 5017 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars: + 5018 # . prologue + 5019 55/push-ebp + 5020 89/<- %ebp 4/r32/esp + 5021 # setup + 5022 (clear-stream _test-input-stream) + 5023 (clear-stream $_test-input-buffered-file->buffer) + 5024 (clear-stream _test-output-stream) + 5025 (clear-stream $_test-output-buffered-file->buffer) + 5026 # + 5027 (write _test-input-stream "fn foo {\n") + 5028 (write _test-input-stream " a: {\n") + 5029 (write _test-input-stream " var x: int\n") + 5030 (write _test-input-stream " {\n") + 5031 (write _test-input-stream " var y: int\n") + 5032 (write _test-input-stream " break-if->= a\n") + 5033 (write _test-input-stream " increment x\n") + 5034 (write _test-input-stream " loop\n") + 5035 (write _test-input-stream " }\n") + 5036 (write _test-input-stream " }\n") + 5037 (write _test-input-stream "}\n") + 5038 # convert + 5039 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5040 (flush _test-output-buffered-file) + 5041 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5047 # check output + 5048 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0") + 5049 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1") + 5050 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2") + 5051 (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") + 5052 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4") + 5053 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5") + 5054 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6") + 5055 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7") + 5056 (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") + 5057 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9") + 5058 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10") + 5059 (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") + 5060 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12") + 5061 (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") + 5062 (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") + 5063 (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") + 5064 (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") + 5065 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17") + 5066 (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") + 5067 (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") + 5068 (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") + 5069 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21") + 5070 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22") + 5071 (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") + 5072 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24") + 5073 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25") + 5074 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26") + 5075 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27") + 5076 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28") + 5077 (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") + 5078 (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") + 5079 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31") + 5080 # . epilogue + 5081 89/<- %esp 5/r32/ebp + 5082 5d/pop-to-ebp + 5083 c3/return + 5084 + 5085 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2: + 5086 # . prologue + 5087 55/push-ebp + 5088 89/<- %ebp 4/r32/esp + 5089 # setup + 5090 (clear-stream _test-input-stream) + 5091 (clear-stream $_test-input-buffered-file->buffer) + 5092 (clear-stream _test-output-stream) + 5093 (clear-stream $_test-output-buffered-file->buffer) + 5094 # non-local conditional branch from a block without a local variable, + 5095 # unwinding a local on the stack + 5096 (write _test-input-stream "fn foo {\n") + 5097 (write _test-input-stream " a: {\n") + 5098 (write _test-input-stream " var x: int\n") + 5099 (write _test-input-stream " {\n") + 5100 (write _test-input-stream " break-if->= a\n") + 5101 (write _test-input-stream " }\n") + 5102 (write _test-input-stream " }\n") + 5103 (write _test-input-stream "}\n") + 5104 # convert + 5105 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5106 (flush _test-output-buffered-file) + 5107 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5113 # check output + 5114 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/0") + 5115 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/1") + 5116 (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") + 5117 (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") + 5118 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/4") + 5119 (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") + 5120 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/6") + 5121 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/7") + 5122 (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") + 5123 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/9") + 5124 (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") + 5125 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/11") + 5126 (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") + 5127 (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") + 5128 (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") + 5129 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/15") + 5130 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/16") + 5131 (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") + 5132 (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") + 5133 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/19") + 5134 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/20") + 5135 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/21") + 5136 (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") + 5137 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/23") + 5138 (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") + 5139 (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") + 5140 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/26") + 5141 # . epilogue + 5142 89/<- %esp 5/r32/ebp + 5143 5d/pop-to-ebp + 5144 c3/return + 5145 + 5146 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3: + 5147 # . prologue + 5148 55/push-ebp + 5149 89/<- %ebp 4/r32/esp + 5150 # setup + 5151 (clear-stream _test-input-stream) + 5152 (clear-stream $_test-input-buffered-file->buffer) + 5153 (clear-stream _test-output-stream) + 5154 (clear-stream $_test-output-buffered-file->buffer) + 5155 # non-local unconditional branch from a block without a local variable, + 5156 # unwinding a local on the stack + 5157 (write _test-input-stream "fn foo {\n") + 5158 (write _test-input-stream " a: {\n") + 5159 (write _test-input-stream " var x: int\n") + 5160 (write _test-input-stream " {\n") + 5161 (write _test-input-stream " break a\n") + 5162 (write _test-input-stream " }\n") + 5163 (write _test-input-stream " }\n") + 5164 (write _test-input-stream "}\n") + 5165 # convert + 5166 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5167 (flush _test-output-buffered-file) + 5168 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5174 # check output + 5175 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/0") + 5176 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/1") + 5177 (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") + 5178 (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") + 5179 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/4") + 5180 (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") + 5181 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/6") + 5182 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/7") + 5183 (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") + 5184 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/9") + 5185 (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") + 5186 (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") + 5187 (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") + 5188 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/14") + 5189 (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") + 5190 (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") + 5191 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/17") + 5192 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/18") + 5193 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/19") + 5194 (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") + 5195 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/21") + 5196 (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") + 5197 (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") + 5198 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/24") + 5199 # . epilogue + 5200 89/<- %esp 5/r32/ebp + 5201 5d/pop-to-ebp + 5202 c3/return + 5203 + 5204 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4: + 5205 # . prologue + 5206 55/push-ebp + 5207 89/<- %ebp 4/r32/esp + 5208 # setup + 5209 (clear-stream _test-input-stream) + 5210 (clear-stream $_test-input-buffered-file->buffer) + 5211 (clear-stream _test-output-stream) + 5212 (clear-stream $_test-output-buffered-file->buffer) + 5213 # + 5214 (write _test-input-stream "fn foo {\n") + 5215 (write _test-input-stream " a: {\n") + 5216 (write _test-input-stream " var x/esi: int <- copy 0\n") + 5217 (write _test-input-stream " {\n") + 5218 (write _test-input-stream " break a\n") + 5219 (write _test-input-stream " }\n") + 5220 (write _test-input-stream " }\n") + 5221 (write _test-input-stream "}\n") + 5222 # convert + 5223 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5224 (flush _test-output-buffered-file) + 5225 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5231 # check output + 5232 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/0") + 5233 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/1") + 5234 (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") + 5235 (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") + 5236 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/4") + 5237 (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") + 5238 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/6") + 5239 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/7") + 5240 (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") + 5241 (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") + 5242 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/10") + 5243 (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") + 5244 (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") + 5245 (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") + 5246 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/14") + 5247 (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") + 5248 (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") + 5249 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/17") + 5250 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/18") + 5251 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/19") + 5252 (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") + 5253 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/21") + 5254 (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") + 5255 (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") + 5256 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/24") + 5257 # . epilogue + 5258 89/<- %esp 5/r32/ebp + 5259 5d/pop-to-ebp + 5260 c3/return + 5261 + 5262 test-convert-function-with-nonlocal-unconditional-break-and-local-vars: + 5263 # . prologue + 5264 55/push-ebp + 5265 89/<- %ebp 4/r32/esp + 5266 # setup + 5267 (clear-stream _test-input-stream) + 5268 (clear-stream $_test-input-buffered-file->buffer) + 5269 (clear-stream _test-output-stream) + 5270 (clear-stream $_test-output-buffered-file->buffer) + 5271 # + 5272 (write _test-input-stream "fn foo {\n") + 5273 (write _test-input-stream " a: {\n") + 5274 (write _test-input-stream " var x: int\n") + 5275 (write _test-input-stream " {\n") + 5276 (write _test-input-stream " var y: int\n") + 5277 (write _test-input-stream " break a\n") + 5278 (write _test-input-stream " increment x\n") + 5279 (write _test-input-stream " }\n") + 5280 (write _test-input-stream " }\n") + 5281 (write _test-input-stream "}\n") + 5282 # convert + 5283 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5284 (flush _test-output-buffered-file) + 5285 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5291 # check output + 5292 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0") + 5293 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1") + 5294 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2") + 5295 (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") + 5296 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4") + 5297 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5") + 5298 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6") + 5299 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7") + 5300 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8") + 5301 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9") + 5302 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10") + 5303 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11") + 5304 (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") + 5305 (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") + 5306 (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") + 5307 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15") + 5308 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16") + 5309 (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") + 5310 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18") + 5311 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19") + 5312 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20") + 5313 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21") + 5314 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22") + 5315 (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") + 5316 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24") + 5317 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25") + 5318 # . epilogue + 5319 89/<- %esp 5/r32/ebp + 5320 5d/pop-to-ebp + 5321 c3/return + 5322 + 5323 test-convert-function-with-unconditional-break-and-local-vars: + 5324 # . prologue + 5325 55/push-ebp + 5326 89/<- %ebp 4/r32/esp + 5327 # setup + 5328 (clear-stream _test-input-stream) + 5329 (clear-stream $_test-input-buffered-file->buffer) + 5330 (clear-stream _test-output-stream) + 5331 (clear-stream $_test-output-buffered-file->buffer) + 5332 # + 5333 (write _test-input-stream "fn foo {\n") + 5334 (write _test-input-stream " {\n") + 5335 (write _test-input-stream " var x: int\n") + 5336 (write _test-input-stream " {\n") + 5337 (write _test-input-stream " var y: int\n") + 5338 (write _test-input-stream " break\n") + 5339 (write _test-input-stream " increment x\n") + 5340 (write _test-input-stream " }\n") + 5341 (write _test-input-stream " }\n") + 5342 (write _test-input-stream "}\n") + 5343 # convert + 5344 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5345 (flush _test-output-buffered-file) + 5346 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5352 # check output + 5353 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0") + 5354 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1") + 5355 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2") + 5356 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3") + 5357 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4") + 5358 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5") + 5359 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6") + 5360 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7") + 5361 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8") + 5362 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9") + 5363 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10") + 5364 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11") + 5365 (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") + 5366 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13") + 5367 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14") + 5368 (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") + 5369 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16") + 5370 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17") + 5371 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18") + 5372 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19") + 5373 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20") + 5374 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21") + 5375 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22") + 5376 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23") + 5377 # . epilogue + 5378 89/<- %esp 5/r32/ebp + 5379 5d/pop-to-ebp + 5380 c3/return + 5381 + 5382 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars: + 5383 # . prologue + 5384 55/push-ebp + 5385 89/<- %ebp 4/r32/esp + 5386 # setup + 5387 (clear-stream _test-input-stream) + 5388 (clear-stream $_test-input-buffered-file->buffer) + 5389 (clear-stream _test-output-stream) + 5390 (clear-stream $_test-output-buffered-file->buffer) + 5391 # + 5392 (write _test-input-stream "fn foo {\n") + 5393 (write _test-input-stream " a: {\n") + 5394 (write _test-input-stream " var x: int\n") + 5395 (write _test-input-stream " {\n") + 5396 (write _test-input-stream " var y: int\n") + 5397 (write _test-input-stream " loop a\n") + 5398 (write _test-input-stream " increment x\n") + 5399 (write _test-input-stream " }\n") + 5400 (write _test-input-stream " }\n") + 5401 (write _test-input-stream "}\n") + 5402 # convert + 5403 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5404 (flush _test-output-buffered-file) + 5405 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5411 # check output + 5412 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0") + 5413 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1") + 5414 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2") + 5415 (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") + 5416 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4") + 5417 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5") + 5418 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6") + 5419 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7") + 5420 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8") + 5421 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9") + 5422 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10") + 5423 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11") + 5424 (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") + 5425 (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") + 5426 (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") + 5427 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15") + 5428 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16") + 5429 (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") + 5430 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18") + 5431 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19") + 5432 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20") + 5433 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21") + 5434 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22") + 5435 (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") + 5436 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24") + 5437 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25") + 5438 # . epilogue + 5439 89/<- %esp 5/r32/ebp + 5440 5d/pop-to-ebp + 5441 c3/return + 5442 + 5443 test-convert-function-with-local-array-var-in-mem: + 5444 # . prologue + 5445 55/push-ebp + 5446 89/<- %ebp 4/r32/esp + 5447 # setup + 5448 (clear-stream _test-input-stream) + 5449 (clear-stream $_test-input-buffered-file->buffer) + 5450 (clear-stream _test-output-stream) + 5451 (clear-stream $_test-output-buffered-file->buffer) + 5452 # + 5453 (write _test-input-stream "fn foo {\n") + 5454 (write _test-input-stream " var x: (array int 3)\n") + 5455 (write _test-input-stream "}\n") + 5456 # convert + 5457 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5458 (flush _test-output-buffered-file) + 5459 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5465 # check output + 5466 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-var-in-mem/0") + 5467 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-var-in-mem/1") + 5468 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-var-in-mem/2") + 5469 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-var-in-mem/3") + 5470 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-var-in-mem/4") + 5471 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-var-in-mem/5") + 5472 # define x + 5473 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-function-with-local-array-var-in-mem/7") + 5474 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-function-with-local-array-var-in-mem/8") + 5475 # reclaim x + 5476 (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") + 5477 # + 5478 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-var-in-mem/10") + 5479 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-var-in-mem/11") + 5480 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-var-in-mem/12") + 5481 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-var-in-mem/13") + 5482 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-var-in-mem/14") + 5483 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-var-in-mem/15") + 5484 # . epilogue + 5485 89/<- %esp 5/r32/ebp + 5486 5d/pop-to-ebp + 5487 c3/return + 5488 + 5489 test-array-size-in-hex: + 5490 # . prologue + 5491 55/push-ebp + 5492 89/<- %ebp 4/r32/esp + 5493 # setup + 5494 (clear-stream _test-input-stream) + 5495 (clear-stream $_test-input-buffered-file->buffer) + 5496 (clear-stream _test-output-stream) + 5497 (clear-stream $_test-output-buffered-file->buffer) + 5498 (clear-stream _test-error-stream) + 5499 (clear-stream $_test-error-buffered-file->buffer) + 5500 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 5501 68/push 0/imm32 + 5502 68/push 0/imm32 + 5503 89/<- %edx 4/r32/esp + 5504 (tailor-exit-descriptor %edx 0x10) + 5505 # + 5506 (write _test-input-stream "fn foo {\n") + 5507 (write _test-input-stream " var x: (array int 10)\n") + 5508 (write _test-input-stream "}\n") + 5509 # convert + 5510 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 5511 # registers except esp clobbered at this point + 5512 # restore ed + 5513 89/<- %edx 4/r32/esp + 5514 (flush _test-output-buffered-file) + 5515 (flush _test-error-buffered-file) + 5516 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 5522 # check output + 5523 (check-stream-equal _test-output-stream "" "F - test-array-size-in-hex: output should be empty") + 5524 (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") + 5525 # check that stop(1) was called + 5526 (check-ints-equal *(edx+4) 2 "F - test-array-size-in-hex: exit status") + 5527 # don't restore from ebp + 5528 81 0/subop/add %esp 8/imm32 + 5529 # . epilogue + 5530 5d/pop-to-ebp + 5531 c3/return + 5532 + 5533 test-convert-function-with-populate: + 5534 # . prologue + 5535 55/push-ebp + 5536 89/<- %ebp 4/r32/esp + 5537 # setup + 5538 (clear-stream _test-input-stream) + 5539 (clear-stream $_test-input-buffered-file->buffer) + 5540 (clear-stream _test-output-stream) + 5541 (clear-stream $_test-output-buffered-file->buffer) + 5542 # + 5543 (write _test-input-stream "fn foo {\n") + 5544 (write _test-input-stream " var x/ecx: (addr handle array int) <- copy 0\n") + 5545 (write _test-input-stream " populate x, 7\n") + 5546 (write _test-input-stream "}\n") + 5547 # convert + 5548 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5549 (flush _test-output-buffered-file) + 5550 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5556 # check output + 5557 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-populate/0") + 5558 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-populate/1") + 5559 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-populate/2") + 5560 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-populate/3") + 5561 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-populate/4") + 5562 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-populate/5") + 5563 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-populate/6") + 5564 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-populate/7") + 5565 (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) + 5566 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-populate/9") + 5567 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-populate/10") + 5568 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-populate/11") + 5569 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-populate/12") + 5570 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-populate/13") + 5571 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-populate/14") + 5572 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-populate/15") + 5573 # . epilogue + 5574 89/<- %esp 5/r32/ebp + 5575 5d/pop-to-ebp + 5576 c3/return + 5577 + 5578 # special-case for size(byte) when allocating array + 5579 test-convert-function-with-local-array-of-bytes-in-mem: + 5580 # . prologue + 5581 55/push-ebp + 5582 89/<- %ebp 4/r32/esp + 5583 # setup + 5584 (clear-stream _test-input-stream) + 5585 (clear-stream $_test-input-buffered-file->buffer) + 5586 (clear-stream _test-output-stream) + 5587 (clear-stream $_test-output-buffered-file->buffer) + 5588 # + 5589 (write _test-input-stream "fn foo {\n") + 5590 (write _test-input-stream " var x: (array byte 3)\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-function-with-local-array-of-bytes-in-mem/0") + 5603 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-of-bytes-in-mem/1") + 5604 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/2") + 5605 (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") + 5606 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-of-bytes-in-mem/4") + 5607 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-of-bytes-in-mem/5") + 5608 # define x + 5609 (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") + 5610 (check-next-stream-line-equal _test-output-stream " 68/push 0x00000003/imm32" "F - test-convert-function-with-local-array-of-bytes-in-mem/8") + 5611 # reclaim x + 5612 (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") + 5613 # + 5614 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-of-bytes-in-mem/10") + 5615 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-of-bytes-in-mem/11") + 5616 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-of-bytes-in-mem/12") + 5617 (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") + 5618 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/14") + 5619 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-of-bytes-in-mem/15") + 5620 # . epilogue + 5621 89/<- %esp 5/r32/ebp + 5622 5d/pop-to-ebp + 5623 c3/return + 5624 + 5625 test-convert-address: + 5626 # . prologue + 5627 55/push-ebp + 5628 89/<- %ebp 4/r32/esp + 5629 # setup + 5630 (clear-stream _test-input-stream) + 5631 (clear-stream $_test-input-buffered-file->buffer) + 5632 (clear-stream _test-output-stream) + 5633 (clear-stream $_test-output-buffered-file->buffer) + 5634 # + 5635 (write _test-input-stream "fn foo {\n") + 5636 (write _test-input-stream " var a: int\n") + 5637 (write _test-input-stream " var b/eax: (addr int) <- address a\n") + 5638 (write _test-input-stream "}\n") + 5639 # convert + 5640 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5641 (flush _test-output-buffered-file) + 5642 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5648 # check output + 5649 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-address/0") + 5650 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-address/1") + 5651 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-address/2") + 5652 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-address/3") + 5653 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-address/4") + 5654 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-address/5") + 5655 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-address/6") + 5656 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-address/7") + 5657 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-address/8") + 5658 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-address/9") + 5659 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-address/10") + 5660 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-address/11") + 5661 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-address/12") + 5662 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-address/13") + 5663 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-address/14") + 5664 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-address/15") + 5665 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-address/16") + 5666 # . epilogue + 5667 89/<- %esp 5/r32/ebp + 5668 5d/pop-to-ebp + 5669 c3/return + 5670 + 5671 test-convert-floating-point-convert: + 5672 # . prologue + 5673 55/push-ebp + 5674 89/<- %ebp 4/r32/esp + 5675 # setup + 5676 (clear-stream _test-input-stream) + 5677 (clear-stream $_test-input-buffered-file->buffer) + 5678 (clear-stream _test-output-stream) + 5679 (clear-stream $_test-output-buffered-file->buffer) + 5680 # + 5681 (write _test-input-stream "fn foo {\n") + 5682 (write _test-input-stream " var a/eax: int <- copy 0\n") + 5683 (write _test-input-stream " var b/xmm1: float <- convert a\n") + 5684 (write _test-input-stream "}\n") + 5685 # convert + 5686 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5687 (flush _test-output-buffered-file) + 5688 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5694 # check output + 5695 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-floating-point-convert/0") + 5696 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-convert/1") + 5697 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-convert/2") + 5698 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-convert/3") + 5699 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-convert/4") + 5700 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-floating-point-convert/5") + 5701 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-convert/6") + 5702 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-convert/7") + 5703 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-convert/8") + 5704 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-convert/9") + 5705 (check-next-stream-line-equal _test-output-stream " f3 0f 2a/convert-to-float %eax 0x00000001/x32" "F - test-convert-floating-point-convert/10") + 5706 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-convert/11") + 5707 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-floating-point-convert/12") + 5708 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-convert/13") + 5709 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-convert/14") + 5710 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-floating-point-convert/15") + 5711 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-convert/16") + 5712 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-convert/17") + 5713 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-convert/18") + 5714 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-convert/19") + 5715 # . epilogue + 5716 89/<- %esp 5/r32/ebp + 5717 5d/pop-to-ebp + 5718 c3/return + 5719 + 5720 test-convert-floating-point-convert-2: + 5721 # . prologue + 5722 55/push-ebp + 5723 89/<- %ebp 4/r32/esp + 5724 # setup + 5725 (clear-stream _test-input-stream) + 5726 (clear-stream $_test-input-buffered-file->buffer) + 5727 (clear-stream _test-output-stream) + 5728 (clear-stream $_test-output-buffered-file->buffer) + 5729 # + 5730 (write _test-input-stream "fn foo {\n") + 5731 (write _test-input-stream " var a/eax: int <- copy 0\n") + 5732 (write _test-input-stream " var b/xmm1: float <- convert a\n") + 5733 (write _test-input-stream " a <- convert b\n") + 5734 (write _test-input-stream "}\n") + 5735 # convert + 5736 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5737 (flush _test-output-buffered-file) + 5738 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5744 # check output + 5745 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-floating-point-convert-2/0") + 5746 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-convert-2/1") + 5747 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-convert-2/2") + 5748 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-convert-2/3") + 5749 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-convert-2/4") + 5750 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-floating-point-convert-2/5") + 5751 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-convert-2/6") + 5752 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-convert-2/7") + 5753 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-convert-2/8") + 5754 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-convert-2/9") + 5755 (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") + 5756 (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") + 5757 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-convert-2/12") + 5758 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-floating-point-convert-2/13") + 5759 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-convert-2/14") + 5760 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-convert-2/15") + 5761 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-floating-point-convert-2/16") + 5762 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-convert-2/17") + 5763 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-convert-2/18") + 5764 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-convert-2/19") + 5765 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-convert-2/20") + 5766 # . epilogue + 5767 89/<- %esp 5/r32/ebp + 5768 5d/pop-to-ebp + 5769 c3/return + 5770 + 5771 test-convert-floating-point-operation: + 5772 # . prologue + 5773 55/push-ebp + 5774 89/<- %ebp 4/r32/esp + 5775 # setup + 5776 (clear-stream _test-input-stream) + 5777 (clear-stream $_test-input-buffered-file->buffer) + 5778 (clear-stream _test-output-stream) + 5779 (clear-stream $_test-output-buffered-file->buffer) + 5780 # + 5781 (write _test-input-stream "fn f {\n") + 5782 (write _test-input-stream " var m: float\n") + 5783 (write _test-input-stream " var x/xmm1: float <- copy m\n") + 5784 (write _test-input-stream " var y/xmm5: float <- copy m\n") + 5785 (write _test-input-stream " x <- copy y\n") + 5786 (write _test-input-stream " copy-to m, y\n") + 5787 (write _test-input-stream " x <- add y\n") + 5788 (write _test-input-stream " x <- add m\n") + 5789 (write _test-input-stream " x <- subtract y\n") + 5790 (write _test-input-stream " x <- subtract m\n") + 5791 (write _test-input-stream " x <- multiply y\n") + 5792 (write _test-input-stream " x <- multiply m\n") + 5793 (write _test-input-stream " x <- divide y\n") + 5794 (write _test-input-stream " x <- divide m\n") + 5795 (write _test-input-stream " x <- reciprocal y\n") + 5796 (write _test-input-stream " x <- reciprocal m\n") + 5797 (write _test-input-stream " x <- square-root y\n") + 5798 (write _test-input-stream " x <- square-root m\n") + 5799 (write _test-input-stream " x <- inverse-square-root y\n") + 5800 (write _test-input-stream " x <- inverse-square-root m\n") + 5801 (write _test-input-stream " x <- max y\n") + 5802 (write _test-input-stream " x <- max m\n") + 5803 (write _test-input-stream " x <- min y\n") + 5804 (write _test-input-stream " x <- min m\n") + 5805 (write _test-input-stream " compare x, y\n") + 5806 (write _test-input-stream " compare x, m\n") + 5807 (write _test-input-stream "}\n") + 5808 # convert + 5809 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5810 (flush _test-output-buffered-file) + 5811 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5817 # check output + 5818 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-floating-point-operation/0") + 5819 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-operation/1") + 5820 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-operation/2") + 5821 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-operation/3") + 5822 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-operation/4") + 5823 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-floating-point-operation/5") + 5824 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-floating-point-operation/6") + 5825 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-operation/7") + 5826 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-operation/8") + 5827 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/9") + 5828 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-operation/10") + 5829 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 5/x32" "F - test-convert-floating-point-operation/11") + 5830 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000005/x32" "F - test-convert-floating-point-operation/12") + 5831 (check-next-stream-line-equal _test-output-stream " f3 0f 11/copy %xmm1 0x00000005/x32" "F - test-convert-floating-point-operation/13") + 5832 (check-next-stream-line-equal _test-output-stream " f3 0f 11/copy *(ebp+0xfffffffc) 0x00000005/x32" "F - test-convert-floating-point-operation/14") + 5833 (check-next-stream-line-equal _test-output-stream " f3 0f 58/add %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/15") + 5834 (check-next-stream-line-equal _test-output-stream " f3 0f 58/add *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/16") + 5835 (check-next-stream-line-equal _test-output-stream " f3 0f 5c/subtract %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/17") + 5836 (check-next-stream-line-equal _test-output-stream " f3 0f 5c/subtract *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/18") + 5837 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/19") + 5838 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/20") + 5839 (check-next-stream-line-equal _test-output-stream " f3 0f 5e/divide %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/21") + 5840 (check-next-stream-line-equal _test-output-stream " f3 0f 5e/divide *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/22") + 5841 (check-next-stream-line-equal _test-output-stream " f3 0f 53/reciprocal %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/23") + 5842 (check-next-stream-line-equal _test-output-stream " f3 0f 53/reciprocal *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/24") + 5843 (check-next-stream-line-equal _test-output-stream " f3 0f 51/square-root %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/25") + 5844 (check-next-stream-line-equal _test-output-stream " f3 0f 51/square-root *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/26") + 5845 (check-next-stream-line-equal _test-output-stream " f3 0f 52/inverse-square-root %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/27") + 5846 (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") + 5847 (check-next-stream-line-equal _test-output-stream " f3 0f 5f/max %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/29") + 5848 (check-next-stream-line-equal _test-output-stream " f3 0f 5f/max *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/30") + 5849 (check-next-stream-line-equal _test-output-stream " f3 0f 5d/min %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/31") + 5850 (check-next-stream-line-equal _test-output-stream " f3 0f 5d/min *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/32") + 5851 (check-next-stream-line-equal _test-output-stream " 0f 2f/compare %xmm1 0x00000005/x32" "F - test-convert-floating-point-operation/33") + 5852 (check-next-stream-line-equal _test-output-stream " 0f 2f/compare *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/34") + 5853 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 5/x32" "F - test-convert-floating-point-operation/35") + 5854 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-operation/36") + 5855 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-operation/37") + 5856 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-operation/38") + 5857 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-floating-point-operation/39") + 5858 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-operation/40") + 5859 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-floating-point-operation/41") + 5860 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-operation/42") + 5861 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-operation/43") + 5862 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-operation/44") + 5863 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-operation/45") + 5864 # . epilogue + 5865 89/<- %esp 5/r32/ebp + 5866 5d/pop-to-ebp + 5867 c3/return + 5868 + 5869 test-convert-floating-point-dereferenced: + 5870 # . prologue + 5871 55/push-ebp + 5872 89/<- %ebp 4/r32/esp + 5873 # setup + 5874 (clear-stream _test-input-stream) + 5875 (clear-stream $_test-input-buffered-file->buffer) + 5876 (clear-stream _test-output-stream) + 5877 (clear-stream $_test-output-buffered-file->buffer) + 5878 # + 5879 (write _test-input-stream "fn f {\n") + 5880 (write _test-input-stream " var m: float\n") + 5881 (write _test-input-stream " var x/xmm1: float <- copy m\n") + 5882 (write _test-input-stream " var y/eax: (addr float) <- copy 0\n") + 5883 (write _test-input-stream " x <- multiply *y\n") + 5884 (write _test-input-stream "}\n") + 5885 # convert + 5886 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5887 (flush _test-output-buffered-file) + 5888 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5894 # check output + 5895 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-floating-point-dereferenced/0") + 5896 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-dereferenced/1") + 5897 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-dereferenced/2") + 5898 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-dereferenced/3") + 5899 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-dereferenced/4") + 5900 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-floating-point-dereferenced/5") + 5901 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-floating-point-dereferenced/6") + 5902 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-dereferenced/7") + 5903 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-dereferenced/8") + 5904 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-dereferenced/9") + 5905 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-dereferenced/10") + 5906 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-dereferenced/11") + 5907 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply *eax 0x00000001/x32" "F - test-convert-floating-point-dereferenced/12") + 5908 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-dereferenced/13") + 5909 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-dereferenced/14") + 5910 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/15") + 5911 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-floating-point-dereferenced/16") + 5912 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-dereferenced/17") + 5913 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-floating-point-dereferenced/18") + 5914 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-dereferenced/19") + 5915 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-dereferenced/20") + 5916 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-dereferenced/21") + 5917 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-dereferenced/22") + 5918 # . epilogue + 5919 89/<- %esp 5/r32/ebp + 5920 5d/pop-to-ebp + 5921 c3/return + 5922 + 5923 test-convert-length-of-array: + 5924 # . prologue + 5925 55/push-ebp + 5926 89/<- %ebp 4/r32/esp + 5927 # setup + 5928 (clear-stream _test-input-stream) + 5929 (clear-stream $_test-input-buffered-file->buffer) + 5930 (clear-stream _test-output-stream) + 5931 (clear-stream $_test-output-buffered-file->buffer) + 5932 # + 5933 (write _test-input-stream "fn foo a: (addr array int) {\n") + 5934 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n") + 5935 (write _test-input-stream " var c/eax: int <- length b\n") + 5936 (write _test-input-stream "}\n") + 5937 # convert + 5938 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5939 (flush _test-output-buffered-file) + 5940 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5946 # check output + 5947 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0") + 5948 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1") + 5949 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2") + 5950 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3") + 5951 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4") + 5952 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5") + 5953 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6") + 5954 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7") + 5955 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array/8") + 5956 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array/9") + 5957 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/10") + 5958 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/11") + 5959 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/12") + 5960 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/13") + 5961 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/14") + 5962 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/15") + 5963 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/16") + 5964 # . epilogue + 5965 89/<- %esp 5/r32/ebp + 5966 5d/pop-to-ebp + 5967 c3/return + 5968 + 5969 # special-case for size(byte) when computing array length + 5970 test-convert-length-of-array-of-bytes: + 5971 # . prologue + 5972 55/push-ebp + 5973 89/<- %ebp 4/r32/esp + 5974 # setup + 5975 (clear-stream _test-input-stream) + 5976 (clear-stream $_test-input-buffered-file->buffer) + 5977 (clear-stream _test-output-stream) + 5978 (clear-stream $_test-output-buffered-file->buffer) + 5979 # + 5980 (write _test-input-stream "fn foo a: (addr array byte) {\n") + 5981 (write _test-input-stream " var b/eax: (addr array byte) <- copy a\n") + 5982 (write _test-input-stream " var c/eax: int <- length b\n") + 5983 (write _test-input-stream "}\n") + 5984 # convert + 5985 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5986 (flush _test-output-buffered-file) + 5987 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 5993 # check output + 5994 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-bytes/0") + 5995 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-bytes/1") + 5996 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-bytes/2") + 5997 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-bytes/3") + 5998 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-bytes/4") + 5999 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-bytes/5") + 6000 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-bytes/6") + 6001 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/7") + 6002 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/8") + 6003 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-bytes/9") + 6004 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-bytes/10") + 6005 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-bytes/11") + 6006 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-bytes/12") + 6007 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-bytes/13") + 6008 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-bytes/14") + 6009 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-bytes/15") 6010 # . epilogue 6011 89/<- %esp 5/r32/ebp 6012 5d/pop-to-ebp 6013 c3/return 6014 - 6015 test-convert-index-into-array-of-bytes: + 6015 test-convert-length-of-array-on-stack: 6016 # . prologue 6017 55/push-ebp 6018 89/<- %ebp 4/r32/esp @@ -5530,1408 +5530,1408 @@ if ('onhashchange' in window) { 6023 (clear-stream $_test-output-buffered-file->buffer) 6024 # 6025 (write _test-input-stream "fn foo {\n") - 6026 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 6027 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 6028 (write _test-input-stream " var x/eax: (addr byte) <- index arr, idx\n") - 6029 (write _test-input-stream "}\n") - 6030 # convert - 6031 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6032 (flush _test-output-buffered-file) - 6033 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6039 # check output - 6040 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes/0") - 6041 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes/1") - 6042 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes/2") - 6043 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes/3") - 6044 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes/4") - 6045 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes/5") - 6046 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes/6") - 6047 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes/7") - 6048 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes/8") - 6049 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-of-bytes/9") - 6050 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 0x00000001 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-of-bytes/10") - 6051 (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") - 6052 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes/12") - 6053 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes/13") - 6054 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes/14") - 6055 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes/15") - 6056 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes/16") - 6057 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes/17") - 6058 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes/18") - 6059 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes/19") - 6060 # . epilogue - 6061 89/<- %esp 5/r32/ebp - 6062 5d/pop-to-ebp - 6063 c3/return - 6064 - 6065 test-convert-index-into-array-with-literal: - 6066 # . prologue - 6067 55/push-ebp - 6068 89/<- %ebp 4/r32/esp - 6069 # setup - 6070 (clear-stream _test-input-stream) - 6071 (clear-stream $_test-input-buffered-file->buffer) - 6072 (clear-stream _test-output-stream) - 6073 (clear-stream $_test-output-buffered-file->buffer) - 6074 # - 6075 (write _test-input-stream "fn foo {\n") - 6076 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 6077 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") - 6078 (write _test-input-stream "}\n") - 6079 # convert - 6080 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6081 (flush _test-output-buffered-file) - 6082 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6088 # check output - 6089 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-with-literal/0") - 6090 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-with-literal/1") - 6091 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-with-literal/2") - 6092 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-with-literal/3") - 6093 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-with-literal/4") - 6094 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5") - 6095 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6") - 6096 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7") - 6097 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds 2 0x00000004 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-with-literal/8") - 6098 # 2 * 4 bytes/elem + 4 bytes for size = offset 12 - 6099 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/9") - 6100 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/10") - 6101 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/11") - 6102 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-with-literal/12") - 6103 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-with-literal/13") - 6104 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-with-literal/14") - 6105 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-with-literal/15") - 6106 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-with-literal/16") - 6107 # . epilogue - 6108 89/<- %esp 5/r32/ebp - 6109 5d/pop-to-ebp - 6110 c3/return - 6111 - 6112 test-convert-index-into-array-of-bytes-with-literal: - 6113 # . prologue - 6114 55/push-ebp - 6115 89/<- %ebp 4/r32/esp - 6116 # setup - 6117 (clear-stream _test-input-stream) - 6118 (clear-stream $_test-input-buffered-file->buffer) - 6119 (clear-stream _test-output-stream) - 6120 (clear-stream $_test-output-buffered-file->buffer) - 6121 # - 6122 (write _test-input-stream "fn foo {\n") - 6123 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 6124 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") - 6125 (write _test-input-stream "}\n") - 6126 # convert - 6127 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6128 (flush _test-output-buffered-file) - 6129 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6135 # check output - 6136 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-with-literal/0") - 6137 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-with-literal/1") - 6138 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/2") - 6139 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-with-literal/3") - 6140 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-with-literal/4") - 6141 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-with-literal/5") - 6142 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-with-literal/6") - 6143 (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") - 6144 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds 2 0x00000001 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-of-bytes-with-literal/8") - 6145 # 2 * 1 byte/elem + 4 bytes for size = offset 6 - 6146 (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") - 6147 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-with-literal/9") - 6148 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-with-literal/10") - 6149 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-with-literal/11") - 6150 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-with-literal/12") - 6151 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-with-literal/13") - 6152 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/14") - 6153 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-with-literal/15") - 6154 # . epilogue - 6155 89/<- %esp 5/r32/ebp - 6156 5d/pop-to-ebp - 6157 c3/return - 6158 - 6159 test-convert-index-into-array-on-stack: - 6160 # . prologue - 6161 55/push-ebp - 6162 89/<- %ebp 4/r32/esp - 6163 # setup - 6164 (clear-stream _test-input-stream) - 6165 (clear-stream $_test-input-buffered-file->buffer) - 6166 (clear-stream _test-output-stream) - 6167 (clear-stream $_test-output-buffered-file->buffer) - 6168 # - 6169 (write _test-input-stream "fn foo {\n") - 6170 (write _test-input-stream " var arr: (array int 3)\n") - 6171 (write _test-input-stream " var idx/eax: int <- copy 2\n") - 6172 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") - 6173 (write _test-input-stream "}\n") - 6174 # convert - 6175 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6176 (flush _test-output-buffered-file) - 6177 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6183 # check output - 6184 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack/0") - 6185 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack/1") - 6186 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack/2") - 6187 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack/3") - 6188 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack/4") - 6189 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack/5") - 6190 # var arr - 6191 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack/6") - 6192 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack/7") - 6193 # var idx - 6194 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack/8") - 6195 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 2/imm32" "F - test-convert-index-into-array-on-stack/9") - 6196 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %eax 0x00000004 *(ebp+0xfffffff0) \"foo\" \"arr\")" "F - test-convert-index-into-array-on-stack/10") - 6197 # var x is at (ebp-0x10) + idx<<2 + 4 = ebp + idx<<2 - 0xc - 6198 (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/11") - 6199 # reclaim idx - 6200 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack/12") - 6201 # reclaim arr - 6202 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack/13") - 6203 # - 6204 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack/14") - 6205 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack/15") - 6206 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack/16") - 6207 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack/17") - 6208 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack/18") - 6209 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack/19") - 6210 # . epilogue - 6211 89/<- %esp 5/r32/ebp - 6212 5d/pop-to-ebp - 6213 c3/return - 6214 - 6215 test-convert-index-into-array-on-stack-with-literal: - 6216 # . prologue - 6217 55/push-ebp - 6218 89/<- %ebp 4/r32/esp - 6219 # setup - 6220 (clear-stream _test-input-stream) - 6221 (clear-stream $_test-input-buffered-file->buffer) - 6222 (clear-stream _test-output-stream) - 6223 (clear-stream $_test-output-buffered-file->buffer) - 6224 # - 6225 (write _test-input-stream "fn foo {\n") - 6226 (write _test-input-stream " var arr: (array int 3)\n") - 6227 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") - 6228 (write _test-input-stream "}\n") - 6229 # convert - 6230 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6231 (flush _test-output-buffered-file) - 6232 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6238 # check output - 6239 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack-with-literal/0") - 6240 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack-with-literal/1") - 6241 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack-with-literal/2") - 6242 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack-with-literal/3") - 6243 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack-with-literal/4") - 6244 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack-with-literal/5") - 6245 # var arr - 6246 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack-with-literal/6") - 6247 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack-with-literal/7") - 6248 # var x - 6249 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack-with-literal/8") - 6250 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds 2 0x00000004 *(ebp+0xfffffff0) \"foo\" \"arr\")" "F - test-convert-index-into-array-on-stack-with-literal/9") - 6251 # x is at (ebp-0x10) + 4 + 2*4 = ebp-4 - 6252 (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/10") - 6253 # reclaim x - 6254 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack-with-literal/11") - 6255 # reclaim arr - 6256 (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/12") - 6257 # - 6258 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack-with-literal/13") - 6259 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack-with-literal/14") - 6260 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack-with-literal/15") - 6261 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack-with-literal/16") - 6262 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack-with-literal/17") - 6263 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack-with-literal/18") - 6264 # . epilogue - 6265 89/<- %esp 5/r32/ebp - 6266 5d/pop-to-ebp - 6267 c3/return - 6268 - 6269 test-convert-index-into-array-of-bytes-on-stack-with-literal: - 6270 # . prologue - 6271 55/push-ebp - 6272 89/<- %ebp 4/r32/esp - 6273 # setup - 6274 (clear-stream _test-input-stream) - 6275 (clear-stream $_test-input-buffered-file->buffer) - 6276 (clear-stream _test-output-stream) - 6277 (clear-stream $_test-output-buffered-file->buffer) - 6278 # - 6279 (write _test-input-stream "fn foo {\n") - 6280 (write _test-input-stream " var arr: (array byte 3)\n") - 6281 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") - 6282 (write _test-input-stream "}\n") - 6283 # convert - 6284 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6285 (flush _test-output-buffered-file) - 6286 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6292 # check output - 6293 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/0") - 6294 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/1") - 6295 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/2") - 6296 (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") - 6297 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/4") - 6298 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/5") - 6299 # var arr - 6300 (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") - 6301 (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") - 6302 # var x - 6303 (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") - 6304 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds 2 0x00000001 *(ebp+0xfffffff9) \"foo\" \"arr\")" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/9") - 6305 # x is at (ebp-7) + 4 + 2 = ebp-1 - 6306 (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/10") - 6307 # reclaim x - 6308 (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/11") - 6309 # reclaim arr - 6310 (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/12") - 6311 # - 6312 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/13") - 6313 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/14") - 6314 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/15") - 6315 (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/16") - 6316 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/17") - 6317 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/18") - 6318 # . epilogue - 6319 89/<- %esp 5/r32/ebp - 6320 5d/pop-to-ebp - 6321 c3/return - 6322 - 6323 test-convert-index-into-array-using-offset: - 6324 # . prologue - 6325 55/push-ebp - 6326 89/<- %ebp 4/r32/esp - 6327 # setup - 6328 (clear-stream _test-input-stream) - 6329 (clear-stream $_test-input-buffered-file->buffer) - 6330 (clear-stream _test-output-stream) - 6331 (clear-stream $_test-output-buffered-file->buffer) - 6332 # - 6333 (write _test-input-stream "fn foo {\n") - 6334 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 6335 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 6336 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") - 6337 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") - 6338 (write _test-input-stream "}\n") - 6339 # convert - 6340 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6341 (flush _test-output-buffered-file) - 6342 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6348 # check output - 6349 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset/0") - 6350 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset/1") - 6351 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset/2") - 6352 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset/3") - 6353 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset/4") - 6354 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset/5") - 6355 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset/6") - 6356 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset/7") - 6357 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset/8") - 6358 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-using-offset/9") - 6359 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset/10") - 6360 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 1 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-using-offset/11") - 6361 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset/12") - 6362 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset/13") - 6363 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset/14") - 6364 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset/15") - 6365 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset/16") - 6366 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset/17") - 6367 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset/18") - 6368 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset/19") - 6369 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset/20") - 6370 # . epilogue - 6371 89/<- %esp 5/r32/ebp - 6372 5d/pop-to-ebp - 6373 c3/return - 6374 - 6375 test-convert-index-into-array-of-bytes-using-offset: - 6376 # . prologue - 6377 55/push-ebp - 6378 89/<- %ebp 4/r32/esp - 6379 # setup - 6380 (clear-stream _test-input-stream) - 6381 (clear-stream $_test-input-buffered-file->buffer) - 6382 (clear-stream _test-output-stream) - 6383 (clear-stream $_test-output-buffered-file->buffer) - 6384 # - 6385 (write _test-input-stream "fn foo {\n") - 6386 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 6387 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 6388 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") - 6389 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") - 6390 (write _test-input-stream "}\n") - 6391 # convert - 6392 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6393 (flush _test-output-buffered-file) - 6394 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6400 # check output - 6401 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset/0") - 6402 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset/1") - 6403 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/2") - 6404 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-using-offset/3") - 6405 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset/4") - 6406 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset/5") - 6407 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-using-offset/6") - 6408 (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") - 6409 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/8") - 6410 (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") - 6411 (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") - 6412 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 1 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-of-bytes-using-offset/11") - 6413 (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/12") - 6414 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/13") - 6415 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-using-offset/14") - 6416 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset/15") - 6417 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset/16") - 6418 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset/17") - 6419 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-using-offset/18") - 6420 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/19") - 6421 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset/20") - 6422 # . epilogue - 6423 89/<- %esp 5/r32/ebp - 6424 5d/pop-to-ebp - 6425 c3/return - 6426 - 6427 test-convert-index-into-array-using-offset-on-stack: - 6428 # . prologue - 6429 55/push-ebp - 6430 89/<- %ebp 4/r32/esp - 6431 # setup - 6432 (clear-stream _test-input-stream) - 6433 (clear-stream $_test-input-buffered-file->buffer) - 6434 (clear-stream _test-output-stream) - 6435 (clear-stream $_test-output-buffered-file->buffer) - 6436 # - 6437 (write _test-input-stream "fn foo {\n") - 6438 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 6439 (write _test-input-stream " var idx: int\n") - 6440 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") - 6441 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") - 6442 (write _test-input-stream "}\n") - 6443 # convert - 6444 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6445 (flush _test-output-buffered-file) - 6446 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6452 # check output - 6453 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset-on-stack/0") - 6454 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset-on-stack/1") - 6455 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset-on-stack/2") - 6456 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset-on-stack/3") - 6457 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset-on-stack/4") - 6458 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset-on-stack/5") - 6459 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset-on-stack/6") - 6460 (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") - 6461 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/8") - 6462 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset-on-stack/9") - 6463 (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") - 6464 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 1 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-using-offset-on-stack/11") - 6465 (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/12") - 6466 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset-on-stack/13") - 6467 (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/14") - 6468 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset-on-stack/15") - 6469 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset-on-stack/16") - 6470 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset-on-stack/17") - 6471 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset-on-stack/18") - 6472 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset-on-stack/19") - 6473 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset-on-stack/20") - 6474 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset-on-stack/21") - 6475 # . epilogue - 6476 89/<- %esp 5/r32/ebp - 6477 5d/pop-to-ebp - 6478 c3/return - 6479 - 6480 test-convert-index-into-array-of-bytes-using-offset-on-stack: - 6481 # . prologue - 6482 55/push-ebp - 6483 89/<- %ebp 4/r32/esp - 6484 # setup - 6485 (clear-stream _test-input-stream) - 6486 (clear-stream $_test-input-buffered-file->buffer) - 6487 (clear-stream _test-output-stream) - 6488 (clear-stream $_test-output-buffered-file->buffer) - 6489 # - 6490 (write _test-input-stream "fn foo {\n") - 6491 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 6492 (write _test-input-stream " var idx: int\n") - 6493 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") - 6494 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") - 6495 (write _test-input-stream "}\n") - 6496 # convert - 6497 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6498 (flush _test-output-buffered-file) - 6499 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6505 # check output - 6506 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/0") - 6507 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/1") - 6508 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/2") - 6509 (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") - 6510 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/4") - 6511 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/5") - 6512 (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") - 6513 (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") - 6514 (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") - 6515 (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") - 6516 (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") - 6517 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 1 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/11") - 6518 (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/12") - 6519 (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/13") - 6520 (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/14") - 6521 (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/15") - 6522 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/16") - 6523 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/17") - 6524 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/18") - 6525 (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/19") - 6526 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/20") - 6527 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/21") - 6528 # . epilogue - 6529 89/<- %esp 5/r32/ebp - 6530 5d/pop-to-ebp - 6531 c3/return - 6532 - 6533 test-convert-function-and-type-definition: - 6534 # . prologue - 6535 55/push-ebp - 6536 89/<- %ebp 4/r32/esp - 6537 # setup - 6538 (clear-stream _test-input-stream) - 6539 (clear-stream $_test-input-buffered-file->buffer) - 6540 (clear-stream _test-output-stream) - 6541 (clear-stream $_test-output-buffered-file->buffer) - 6542 # - 6543 (write _test-input-stream "fn foo a: (addr t) {\n") - 6544 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n") - 6545 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n") - 6546 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n") - 6547 (write _test-input-stream "}\n") - 6548 (write _test-input-stream "type t {\n") - 6549 (write _test-input-stream " x: int\n") - 6550 (write _test-input-stream " y: int\n") - 6551 (write _test-input-stream "}\n") - 6552 # convert - 6553 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6554 (flush _test-output-buffered-file) - 6555 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6561 # check output - 6562 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0") - 6563 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1") - 6564 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2") - 6565 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3") - 6566 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4") - 6567 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5") - 6568 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6") - 6569 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7") - 6570 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8") - 6571 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9") - 6572 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11") - 6573 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13") - 6574 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14") - 6575 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15") - 6576 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16") - 6577 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17") - 6578 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18") - 6579 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19") - 6580 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20") - 6581 # . epilogue - 6582 89/<- %esp 5/r32/ebp - 6583 5d/pop-to-ebp - 6584 c3/return - 6585 - 6586 test-type-definition-with-array: - 6587 # . prologue - 6588 55/push-ebp - 6589 89/<- %ebp 4/r32/esp - 6590 # setup - 6591 (clear-stream _test-input-stream) - 6592 (clear-stream $_test-input-buffered-file->buffer) - 6593 (clear-stream _test-output-stream) - 6594 (clear-stream $_test-output-buffered-file->buffer) - 6595 (clear-stream _test-error-stream) - 6596 (clear-stream $_test-error-buffered-file->buffer) - 6597 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6598 68/push 0/imm32 - 6599 68/push 0/imm32 - 6600 89/<- %edx 4/r32/esp - 6601 (tailor-exit-descriptor %edx 0x10) - 6602 # - 6603 (write _test-input-stream "type t {\n") - 6604 (write _test-input-stream " a: (array int 3)\n") + 6026 (write _test-input-stream " var a: (array int 3)\n") + 6027 (write _test-input-stream " var b/eax: int <- length a\n") + 6028 (write _test-input-stream "}\n") + 6029 # convert + 6030 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6031 (flush _test-output-buffered-file) + 6032 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6038 # check output + 6039 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-on-stack/0") + 6040 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-on-stack/1") + 6041 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-on-stack/2") + 6042 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-on-stack/3") + 6043 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-on-stack/4") + 6044 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-on-stack/5") + 6045 # define x + 6046 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-length-of-array-on-stack/6") + 6047 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-length-of-array-on-stack/7") + 6048 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-on-stack/8") + 6049 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff0) 0x00000000/r32" "F - test-convert-length-of-array-on-stack/9") + 6050 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array-on-stack/10") + 6051 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-on-stack/11") + 6052 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-length-of-array-on-stack/12") + 6053 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-on-stack/13") + 6054 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-on-stack/14") + 6055 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-on-stack/15") + 6056 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-on-stack/16") + 6057 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-on-stack/17") + 6058 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-on-stack/18") + 6059 # . epilogue + 6060 89/<- %esp 5/r32/ebp + 6061 5d/pop-to-ebp + 6062 c3/return + 6063 + 6064 test-reg-var-def-with-read-of-same-register: + 6065 # . prologue + 6066 55/push-ebp + 6067 89/<- %ebp 4/r32/esp + 6068 # setup + 6069 (clear-stream _test-input-stream) + 6070 (clear-stream $_test-input-buffered-file->buffer) + 6071 (clear-stream _test-output-stream) + 6072 (clear-stream $_test-output-buffered-file->buffer) + 6073 (clear-stream _test-error-stream) + 6074 (clear-stream $_test-error-buffered-file->buffer) + 6075 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu + 6076 68/push 0/imm32 + 6077 68/push 0/imm32 + 6078 89/<- %edx 4/r32/esp + 6079 (tailor-exit-descriptor %edx 0x10) + 6080 # + 6081 (write _test-input-stream "fn foo {\n") + 6082 (write _test-input-stream " var x/eax: int <- copy 3\n") + 6083 (write _test-input-stream " var y/eax: int <- add x\n") + 6084 (write _test-input-stream "}\n") + 6085 # convert + 6086 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6087 # registers except esp could be clobbered at this point (though they shouldn't be) + 6088 # restore ed + 6089 89/<- %edx 4/r32/esp + 6090 (flush _test-output-buffered-file) + 6091 (flush _test-error-buffered-file) + 6092 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6098 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 6104 (check-stream-equal _test-error-stream "" "F - test-reg-var-def-with-read-of-same-register: error stream should be empty") + 6105 # check output + 6106 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-reg-var-def-with-read-of-same-register/0") + 6107 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-reg-var-def-with-read-of-same-register/1") + 6108 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-reg-var-def-with-read-of-same-register/2") + 6109 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-reg-var-def-with-read-of-same-register/3") + 6110 (check-next-stream-line-equal _test-output-stream " {" "F - test-reg-var-def-with-read-of-same-register/4") + 6111 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-reg-var-def-with-read-of-same-register/5") + 6112 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-reg-var-def-with-read-of-same-register/6") + 6113 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-reg-var-def-with-read-of-same-register/7") + 6114 (check-next-stream-line-equal _test-output-stream " 01/add-to %eax 0x00000000/r32" "F - test-reg-var-def-with-read-of-same-register/8") + 6115 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-reg-var-def-with-read-of-same-register/9") + 6116 (check-next-stream-line-equal _test-output-stream " }" "F - test-reg-var-def-with-read-of-same-register/10") + 6117 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-reg-var-def-with-read-of-same-register/11") + 6118 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-reg-var-def-with-read-of-same-register/12") + 6119 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-reg-var-def-with-read-of-same-register/13") + 6120 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-reg-var-def-with-read-of-same-register/14") + 6121 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-reg-var-def-with-read-of-same-register/15") + 6122 # don't restore from ebp + 6123 81 0/subop/add %esp 8/imm32 + 6124 # . epilogue + 6125 5d/pop-to-ebp + 6126 c3/return + 6127 + 6128 test-convert-index-into-array: + 6129 # . prologue + 6130 55/push-ebp + 6131 89/<- %ebp 4/r32/esp + 6132 # setup + 6133 (clear-stream _test-input-stream) + 6134 (clear-stream $_test-input-buffered-file->buffer) + 6135 (clear-stream _test-output-stream) + 6136 (clear-stream $_test-output-buffered-file->buffer) + 6137 # + 6138 (write _test-input-stream "fn foo {\n") + 6139 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 6140 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 6141 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") + 6142 (write _test-input-stream "}\n") + 6143 # convert + 6144 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6145 (flush _test-output-buffered-file) + 6146 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6152 # check output + 6153 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0") + 6154 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1") + 6155 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2") + 6156 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3") + 6157 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4") + 6158 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5") + 6159 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6") + 6160 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7") + 6161 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8") + 6162 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9") + 6163 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 0x00000004 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array/10") + 6164 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-convert-index-into-array/11") + 6165 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/12") + 6166 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/13") + 6167 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/14") + 6168 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/15") + 6169 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/16") + 6170 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/17") + 6171 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/18") + 6172 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/19") + 6173 # . epilogue + 6174 89/<- %esp 5/r32/ebp + 6175 5d/pop-to-ebp + 6176 c3/return + 6177 + 6178 test-convert-index-into-array-of-bytes: + 6179 # . prologue + 6180 55/push-ebp + 6181 89/<- %ebp 4/r32/esp + 6182 # setup + 6183 (clear-stream _test-input-stream) + 6184 (clear-stream $_test-input-buffered-file->buffer) + 6185 (clear-stream _test-output-stream) + 6186 (clear-stream $_test-output-buffered-file->buffer) + 6187 # + 6188 (write _test-input-stream "fn foo {\n") + 6189 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 6190 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 6191 (write _test-input-stream " var x/eax: (addr byte) <- index arr, idx\n") + 6192 (write _test-input-stream "}\n") + 6193 # convert + 6194 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6195 (flush _test-output-buffered-file) + 6196 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6202 # check output + 6203 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes/0") + 6204 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes/1") + 6205 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes/2") + 6206 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes/3") + 6207 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes/4") + 6208 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes/5") + 6209 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes/6") + 6210 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes/7") + 6211 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes/8") + 6212 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-of-bytes/9") + 6213 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 0x00000001 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-of-bytes/10") + 6214 (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") + 6215 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes/12") + 6216 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes/13") + 6217 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes/14") + 6218 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes/15") + 6219 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes/16") + 6220 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes/17") + 6221 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes/18") + 6222 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes/19") + 6223 # . epilogue + 6224 89/<- %esp 5/r32/ebp + 6225 5d/pop-to-ebp + 6226 c3/return + 6227 + 6228 test-convert-index-into-array-with-literal: + 6229 # . prologue + 6230 55/push-ebp + 6231 89/<- %ebp 4/r32/esp + 6232 # setup + 6233 (clear-stream _test-input-stream) + 6234 (clear-stream $_test-input-buffered-file->buffer) + 6235 (clear-stream _test-output-stream) + 6236 (clear-stream $_test-output-buffered-file->buffer) + 6237 # + 6238 (write _test-input-stream "fn foo {\n") + 6239 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 6240 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") + 6241 (write _test-input-stream "}\n") + 6242 # convert + 6243 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6244 (flush _test-output-buffered-file) + 6245 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6251 # check output + 6252 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-with-literal/0") + 6253 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-with-literal/1") + 6254 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-with-literal/2") + 6255 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-with-literal/3") + 6256 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-with-literal/4") + 6257 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5") + 6258 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6") + 6259 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7") + 6260 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds 2 0x00000004 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-with-literal/8") + 6261 # 2 * 4 bytes/elem + 4 bytes for size = offset 12 + 6262 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/9") + 6263 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/10") + 6264 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/11") + 6265 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-with-literal/12") + 6266 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-with-literal/13") + 6267 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-with-literal/14") + 6268 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-with-literal/15") + 6269 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-with-literal/16") + 6270 # . epilogue + 6271 89/<- %esp 5/r32/ebp + 6272 5d/pop-to-ebp + 6273 c3/return + 6274 + 6275 test-convert-index-into-array-of-bytes-with-literal: + 6276 # . prologue + 6277 55/push-ebp + 6278 89/<- %ebp 4/r32/esp + 6279 # setup + 6280 (clear-stream _test-input-stream) + 6281 (clear-stream $_test-input-buffered-file->buffer) + 6282 (clear-stream _test-output-stream) + 6283 (clear-stream $_test-output-buffered-file->buffer) + 6284 # + 6285 (write _test-input-stream "fn foo {\n") + 6286 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 6287 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") + 6288 (write _test-input-stream "}\n") + 6289 # convert + 6290 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6291 (flush _test-output-buffered-file) + 6292 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6298 # check output + 6299 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-with-literal/0") + 6300 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-with-literal/1") + 6301 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/2") + 6302 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-with-literal/3") + 6303 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-with-literal/4") + 6304 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-with-literal/5") + 6305 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-with-literal/6") + 6306 (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") + 6307 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds 2 0x00000001 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-of-bytes-with-literal/8") + 6308 # 2 * 1 byte/elem + 4 bytes for size = offset 6 + 6309 (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") + 6310 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-with-literal/9") + 6311 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-with-literal/10") + 6312 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-with-literal/11") + 6313 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-with-literal/12") + 6314 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-with-literal/13") + 6315 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/14") + 6316 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-with-literal/15") + 6317 # . epilogue + 6318 89/<- %esp 5/r32/ebp + 6319 5d/pop-to-ebp + 6320 c3/return + 6321 + 6322 test-convert-index-into-array-on-stack: + 6323 # . prologue + 6324 55/push-ebp + 6325 89/<- %ebp 4/r32/esp + 6326 # setup + 6327 (clear-stream _test-input-stream) + 6328 (clear-stream $_test-input-buffered-file->buffer) + 6329 (clear-stream _test-output-stream) + 6330 (clear-stream $_test-output-buffered-file->buffer) + 6331 # + 6332 (write _test-input-stream "fn foo {\n") + 6333 (write _test-input-stream " var arr: (array int 3)\n") + 6334 (write _test-input-stream " var idx/eax: int <- copy 2\n") + 6335 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") + 6336 (write _test-input-stream "}\n") + 6337 # convert + 6338 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6339 (flush _test-output-buffered-file) + 6340 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6346 # check output + 6347 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack/0") + 6348 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack/1") + 6349 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack/2") + 6350 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack/3") + 6351 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack/4") + 6352 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack/5") + 6353 # var arr + 6354 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack/6") + 6355 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack/7") + 6356 # var idx + 6357 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack/8") + 6358 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 2/imm32" "F - test-convert-index-into-array-on-stack/9") + 6359 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %eax 0x00000004 *(ebp+0xfffffff0) \"foo\" \"arr\")" "F - test-convert-index-into-array-on-stack/10") + 6360 # var x is at (ebp-0x10) + idx<<2 + 4 = ebp + idx<<2 - 0xc + 6361 (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/11") + 6362 # reclaim idx + 6363 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack/12") + 6364 # reclaim arr + 6365 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack/13") + 6366 # + 6367 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack/14") + 6368 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack/15") + 6369 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack/16") + 6370 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack/17") + 6371 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack/18") + 6372 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack/19") + 6373 # . epilogue + 6374 89/<- %esp 5/r32/ebp + 6375 5d/pop-to-ebp + 6376 c3/return + 6377 + 6378 test-convert-index-into-array-on-stack-with-literal: + 6379 # . prologue + 6380 55/push-ebp + 6381 89/<- %ebp 4/r32/esp + 6382 # setup + 6383 (clear-stream _test-input-stream) + 6384 (clear-stream $_test-input-buffered-file->buffer) + 6385 (clear-stream _test-output-stream) + 6386 (clear-stream $_test-output-buffered-file->buffer) + 6387 # + 6388 (write _test-input-stream "fn foo {\n") + 6389 (write _test-input-stream " var arr: (array int 3)\n") + 6390 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") + 6391 (write _test-input-stream "}\n") + 6392 # convert + 6393 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6394 (flush _test-output-buffered-file) + 6395 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6401 # check output + 6402 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack-with-literal/0") + 6403 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack-with-literal/1") + 6404 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack-with-literal/2") + 6405 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack-with-literal/3") + 6406 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack-with-literal/4") + 6407 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack-with-literal/5") + 6408 # var arr + 6409 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack-with-literal/6") + 6410 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack-with-literal/7") + 6411 # var x + 6412 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack-with-literal/8") + 6413 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds 2 0x00000004 *(ebp+0xfffffff0) \"foo\" \"arr\")" "F - test-convert-index-into-array-on-stack-with-literal/9") + 6414 # x is at (ebp-0x10) + 4 + 2*4 = ebp-4 + 6415 (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/10") + 6416 # reclaim x + 6417 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack-with-literal/11") + 6418 # reclaim arr + 6419 (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/12") + 6420 # + 6421 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack-with-literal/13") + 6422 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack-with-literal/14") + 6423 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack-with-literal/15") + 6424 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack-with-literal/16") + 6425 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack-with-literal/17") + 6426 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack-with-literal/18") + 6427 # . epilogue + 6428 89/<- %esp 5/r32/ebp + 6429 5d/pop-to-ebp + 6430 c3/return + 6431 + 6432 test-convert-index-into-array-of-bytes-on-stack-with-literal: + 6433 # . prologue + 6434 55/push-ebp + 6435 89/<- %ebp 4/r32/esp + 6436 # setup + 6437 (clear-stream _test-input-stream) + 6438 (clear-stream $_test-input-buffered-file->buffer) + 6439 (clear-stream _test-output-stream) + 6440 (clear-stream $_test-output-buffered-file->buffer) + 6441 # + 6442 (write _test-input-stream "fn foo {\n") + 6443 (write _test-input-stream " var arr: (array byte 3)\n") + 6444 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") + 6445 (write _test-input-stream "}\n") + 6446 # convert + 6447 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6448 (flush _test-output-buffered-file) + 6449 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6455 # check output + 6456 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/0") + 6457 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/1") + 6458 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/2") + 6459 (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") + 6460 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/4") + 6461 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/5") + 6462 # var arr + 6463 (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") + 6464 (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") + 6465 # var x + 6466 (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") + 6467 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds 2 0x00000001 *(ebp+0xfffffff9) \"foo\" \"arr\")" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/9") + 6468 # x is at (ebp-7) + 4 + 2 = ebp-1 + 6469 (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/10") + 6470 # reclaim x + 6471 (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/11") + 6472 # reclaim arr + 6473 (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/12") + 6474 # + 6475 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/13") + 6476 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/14") + 6477 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/15") + 6478 (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/16") + 6479 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/17") + 6480 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/18") + 6481 # . epilogue + 6482 89/<- %esp 5/r32/ebp + 6483 5d/pop-to-ebp + 6484 c3/return + 6485 + 6486 test-convert-index-into-array-using-offset: + 6487 # . prologue + 6488 55/push-ebp + 6489 89/<- %ebp 4/r32/esp + 6490 # setup + 6491 (clear-stream _test-input-stream) + 6492 (clear-stream $_test-input-buffered-file->buffer) + 6493 (clear-stream _test-output-stream) + 6494 (clear-stream $_test-output-buffered-file->buffer) + 6495 # + 6496 (write _test-input-stream "fn foo {\n") + 6497 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 6498 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 6499 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") + 6500 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") + 6501 (write _test-input-stream "}\n") + 6502 # convert + 6503 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6504 (flush _test-output-buffered-file) + 6505 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6511 # check output + 6512 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset/0") + 6513 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset/1") + 6514 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset/2") + 6515 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset/3") + 6516 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset/4") + 6517 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset/5") + 6518 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset/6") + 6519 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset/7") + 6520 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset/8") + 6521 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-using-offset/9") + 6522 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset/10") + 6523 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 1 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-using-offset/11") + 6524 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset/12") + 6525 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset/13") + 6526 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset/14") + 6527 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset/15") + 6528 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset/16") + 6529 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset/17") + 6530 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset/18") + 6531 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset/19") + 6532 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset/20") + 6533 # . epilogue + 6534 89/<- %esp 5/r32/ebp + 6535 5d/pop-to-ebp + 6536 c3/return + 6537 + 6538 test-convert-index-into-array-of-bytes-using-offset: + 6539 # . prologue + 6540 55/push-ebp + 6541 89/<- %ebp 4/r32/esp + 6542 # setup + 6543 (clear-stream _test-input-stream) + 6544 (clear-stream $_test-input-buffered-file->buffer) + 6545 (clear-stream _test-output-stream) + 6546 (clear-stream $_test-output-buffered-file->buffer) + 6547 # + 6548 (write _test-input-stream "fn foo {\n") + 6549 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 6550 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 6551 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") + 6552 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") + 6553 (write _test-input-stream "}\n") + 6554 # convert + 6555 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6556 (flush _test-output-buffered-file) + 6557 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6563 # check output + 6564 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset/0") + 6565 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset/1") + 6566 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/2") + 6567 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-using-offset/3") + 6568 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset/4") + 6569 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset/5") + 6570 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-using-offset/6") + 6571 (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") + 6572 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/8") + 6573 (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") + 6574 (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") + 6575 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 1 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-of-bytes-using-offset/11") + 6576 (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/12") + 6577 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/13") + 6578 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-using-offset/14") + 6579 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset/15") + 6580 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset/16") + 6581 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset/17") + 6582 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-using-offset/18") + 6583 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/19") + 6584 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset/20") + 6585 # . epilogue + 6586 89/<- %esp 5/r32/ebp + 6587 5d/pop-to-ebp + 6588 c3/return + 6589 + 6590 test-convert-index-into-array-using-offset-on-stack: + 6591 # . prologue + 6592 55/push-ebp + 6593 89/<- %ebp 4/r32/esp + 6594 # setup + 6595 (clear-stream _test-input-stream) + 6596 (clear-stream $_test-input-buffered-file->buffer) + 6597 (clear-stream _test-output-stream) + 6598 (clear-stream $_test-output-buffered-file->buffer) + 6599 # + 6600 (write _test-input-stream "fn foo {\n") + 6601 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 6602 (write _test-input-stream " var idx: int\n") + 6603 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") + 6604 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") 6605 (write _test-input-stream "}\n") 6606 # convert - 6607 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6608 # registers except esp clobbered at this point - 6609 # restore ed - 6610 89/<- %edx 4/r32/esp - 6611 (flush _test-output-buffered-file) - 6612 (flush _test-error-buffered-file) - 6613 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 6619 # check output - 6620 (check-stream-equal _test-output-stream "" "F - test-type-definition-with-array: output should be empty") - 6621 (check-next-stream-line-equal _test-error-stream "type t: 'array' elements not allowed for now" "F - test-type-definition-with-array: error message") - 6622 # check that stop(1) was called - 6623 (check-ints-equal *(edx+4) 2 "F - test-type-definition-with-array: exit status") - 6624 # don't restore from ebp - 6625 81 0/subop/add %esp 8/imm32 - 6626 # . epilogue - 6627 5d/pop-to-ebp - 6628 c3/return - 6629 - 6630 test-type-definition-with-addr: - 6631 # . prologue - 6632 55/push-ebp - 6633 89/<- %ebp 4/r32/esp - 6634 # setup - 6635 (clear-stream _test-input-stream) - 6636 (clear-stream $_test-input-buffered-file->buffer) - 6637 (clear-stream _test-output-stream) - 6638 (clear-stream $_test-output-buffered-file->buffer) - 6639 (clear-stream _test-error-stream) - 6640 (clear-stream $_test-error-buffered-file->buffer) - 6641 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6642 68/push 0/imm32 - 6643 68/push 0/imm32 - 6644 89/<- %edx 4/r32/esp - 6645 (tailor-exit-descriptor %edx 0x10) - 6646 # - 6647 (write _test-input-stream "type t {\n") - 6648 (write _test-input-stream " a: (addr int)\n") - 6649 (write _test-input-stream "}\n") - 6650 # convert - 6651 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6652 # registers except esp clobbered at this point - 6653 # restore ed - 6654 89/<- %edx 4/r32/esp - 6655 (flush _test-output-buffered-file) - 6656 (flush _test-error-buffered-file) - 6657 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 6663 # check output - 6664 (check-stream-equal _test-output-stream "" "F - test-type-definition-with-addr: output should be empty") - 6665 (check-next-stream-line-equal _test-error-stream "type t: 'addr' elements not allowed" "F - test-type-definition-with-addr: error message") - 6666 # check that stop(1) was called - 6667 (check-ints-equal *(edx+4) 2 "F - test-type-definition-with-addr: exit status") - 6668 # don't restore from ebp - 6669 81 0/subop/add %esp 8/imm32 - 6670 # . epilogue - 6671 5d/pop-to-ebp - 6672 c3/return - 6673 - 6674 test-convert-function-with-local-var-with-user-defined-type: - 6675 # . prologue - 6676 55/push-ebp - 6677 89/<- %ebp 4/r32/esp - 6678 # setup - 6679 (clear-stream _test-input-stream) - 6680 (clear-stream $_test-input-buffered-file->buffer) - 6681 (clear-stream _test-output-stream) - 6682 (clear-stream $_test-output-buffered-file->buffer) - 6683 # - 6684 (write _test-input-stream "fn foo {\n") - 6685 (write _test-input-stream " var a: t\n") - 6686 (write _test-input-stream "}\n") - 6687 (write _test-input-stream "type t {\n") - 6688 (write _test-input-stream " x: int\n") - 6689 (write _test-input-stream " y: int\n") - 6690 (write _test-input-stream "}\n") - 6691 # convert - 6692 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6693 (flush _test-output-buffered-file) - 6694 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6700 # check output - 6701 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0") - 6702 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1") - 6703 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2") - 6704 (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") - 6705 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4") - 6706 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5") - 6707 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6") - 6708 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7") - 6709 (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") - 6710 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9") - 6711 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10") - 6712 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11") - 6713 (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") - 6714 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13") - 6715 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14") - 6716 # . epilogue - 6717 89/<- %esp 5/r32/ebp - 6718 5d/pop-to-ebp - 6719 c3/return - 6720 - 6721 test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type: - 6722 # . prologue - 6723 55/push-ebp - 6724 89/<- %ebp 4/r32/esp - 6725 # setup - 6726 (clear-stream _test-input-stream) - 6727 (clear-stream $_test-input-buffered-file->buffer) - 6728 (clear-stream _test-output-stream) - 6729 (clear-stream $_test-output-buffered-file->buffer) - 6730 # - 6731 (write _test-input-stream "fn foo {\n") - 6732 (write _test-input-stream " var a: t\n") - 6733 (write _test-input-stream "}\n") - 6734 (write _test-input-stream "type t {\n") - 6735 (write _test-input-stream " x: s\n") - 6736 (write _test-input-stream "}\n") - 6737 (write _test-input-stream "type s {\n") - 6738 (write _test-input-stream " z: int\n") - 6739 (write _test-input-stream "}\n") - 6740 # convert - 6741 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6742 (flush _test-output-buffered-file) - 6743 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6749 # check output - 6750 (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") - 6751 (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") - 6752 (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") - 6753 (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") - 6754 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/4") - 6755 (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") - 6756 (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") - 6757 (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") - 6758 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/9") - 6759 (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") - 6760 (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") - 6761 (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") - 6762 (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") - 6763 (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") - 6764 # . epilogue - 6765 89/<- %esp 5/r32/ebp - 6766 5d/pop-to-ebp - 6767 c3/return - 6768 - 6769 test-convert-function-call-with-arg-of-user-defined-type: - 6770 # . prologue - 6771 55/push-ebp - 6772 89/<- %ebp 4/r32/esp - 6773 # setup - 6774 (clear-stream _test-input-stream) - 6775 (clear-stream $_test-input-buffered-file->buffer) - 6776 (clear-stream _test-output-stream) - 6777 (clear-stream $_test-output-buffered-file->buffer) - 6778 # - 6779 (write _test-input-stream "fn f {\n") - 6780 (write _test-input-stream " var a: t\n") - 6781 (write _test-input-stream " foo a\n") - 6782 (write _test-input-stream "}\n") - 6783 (write _test-input-stream "fn foo x: t {\n") - 6784 (write _test-input-stream "}\n") - 6785 (write _test-input-stream "type t {\n") - 6786 (write _test-input-stream " x: int\n") - 6787 (write _test-input-stream " y: int\n") - 6788 (write _test-input-stream "}\n") - 6789 # convert - 6790 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6791 (flush _test-output-buffered-file) - 6792 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6798 # check output - 6799 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") - 6800 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") - 6801 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") - 6802 (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") - 6803 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") - 6804 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") - 6805 # var a: t - 6806 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/6") - 6807 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7") - 6808 # foo a - 6809 (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") - 6810 # - 6811 (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") - 6812 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") - 6813 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") - 6814 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") - 6815 (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") - 6816 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") - 6817 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") - 6818 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") - 6819 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") - 6820 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") - 6821 (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") - 6822 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") - 6823 (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") - 6824 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") - 6825 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") - 6826 # . epilogue - 6827 89/<- %esp 5/r32/ebp - 6828 5d/pop-to-ebp - 6829 c3/return - 6830 - 6831 test-convert-function-call-with-arg-of-user-defined-type-register-indirect: - 6832 # . prologue - 6833 55/push-ebp - 6834 89/<- %ebp 4/r32/esp - 6835 # setup - 6836 (clear-stream _test-input-stream) - 6837 (clear-stream $_test-input-buffered-file->buffer) - 6838 (clear-stream _test-output-stream) - 6839 (clear-stream $_test-output-buffered-file->buffer) - 6840 # - 6841 (write _test-input-stream "fn f {\n") - 6842 (write _test-input-stream " var a/eax: (addr t) <- copy 0\n") - 6843 (write _test-input-stream " foo *a\n") - 6844 (write _test-input-stream "}\n") - 6845 (write _test-input-stream "fn foo x: t {\n") - 6846 (write _test-input-stream "}\n") - 6847 (write _test-input-stream "type t {\n") - 6848 (write _test-input-stream " x: int\n") - 6849 (write _test-input-stream " y: int\n") - 6850 (write _test-input-stream "}\n") - 6851 # convert - 6852 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6853 (flush _test-output-buffered-file) - 6854 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6860 # check output - 6861 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") - 6862 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") - 6863 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") - 6864 (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") - 6865 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") - 6866 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") - 6867 # var a - 6868 (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") - 6869 (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") - 6870 # foo a - 6871 (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") - 6872 # - 6873 (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") - 6874 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") - 6875 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") - 6876 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") - 6877 (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") - 6878 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") - 6879 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") - 6880 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") - 6881 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") - 6882 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") - 6883 (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") - 6884 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") - 6885 (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") - 6886 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") - 6887 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") - 6888 # . epilogue - 6889 89/<- %esp 5/r32/ebp - 6890 5d/pop-to-ebp - 6891 c3/return - 6892 - 6893 # we don't have special support for call-by-reference; just explicitly create - 6894 # a new variable with the address of the arg - 6895 test-convert-function-call-with-arg-of-user-defined-type-by-reference: - 6896 # . prologue - 6897 55/push-ebp - 6898 89/<- %ebp 4/r32/esp - 6899 # setup - 6900 (clear-stream _test-input-stream) - 6901 (clear-stream $_test-input-buffered-file->buffer) - 6902 (clear-stream _test-output-stream) - 6903 (clear-stream $_test-output-buffered-file->buffer) - 6904 # - 6905 (write _test-input-stream "fn f {\n") - 6906 (write _test-input-stream " var a: t\n") - 6907 (write _test-input-stream " var b/eax: (addr t) <- address a\n") - 6908 (write _test-input-stream " foo b\n") - 6909 (write _test-input-stream "}\n") - 6910 (write _test-input-stream "fn foo x: (addr t) {\n") - 6911 (write _test-input-stream " var x/ecx: (addr t) <- copy x\n") - 6912 (write _test-input-stream "}\n") - 6913 (write _test-input-stream "type t {\n") - 6914 (write _test-input-stream " x: int\n") - 6915 (write _test-input-stream " y: int\n") - 6916 (write _test-input-stream "}\n") - 6917 # convert - 6918 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6919 (flush _test-output-buffered-file) - 6920 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6926 # check output - 6927 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/0") - 6928 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/1") - 6929 (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") - 6930 (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") - 6931 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/4") - 6932 (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") - 6933 # var a: t - 6934 (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") - 6935 (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") - 6936 # var b/eax: (addr t) - 6937 (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") - 6938 (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") - 6939 # foo a - 6940 (check-next-stream-line-equal _test-output-stream " (foo %eax)" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/10") + 6607 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6608 (flush _test-output-buffered-file) + 6609 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6615 # check output + 6616 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset-on-stack/0") + 6617 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset-on-stack/1") + 6618 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset-on-stack/2") + 6619 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset-on-stack/3") + 6620 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset-on-stack/4") + 6621 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset-on-stack/5") + 6622 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset-on-stack/6") + 6623 (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") + 6624 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/8") + 6625 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset-on-stack/9") + 6626 (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") + 6627 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 1 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-using-offset-on-stack/11") + 6628 (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/12") + 6629 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset-on-stack/13") + 6630 (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/14") + 6631 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset-on-stack/15") + 6632 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset-on-stack/16") + 6633 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset-on-stack/17") + 6634 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset-on-stack/18") + 6635 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset-on-stack/19") + 6636 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset-on-stack/20") + 6637 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset-on-stack/21") + 6638 # . epilogue + 6639 89/<- %esp 5/r32/ebp + 6640 5d/pop-to-ebp + 6641 c3/return + 6642 + 6643 test-convert-index-into-array-of-bytes-using-offset-on-stack: + 6644 # . prologue + 6645 55/push-ebp + 6646 89/<- %ebp 4/r32/esp + 6647 # setup + 6648 (clear-stream _test-input-stream) + 6649 (clear-stream $_test-input-buffered-file->buffer) + 6650 (clear-stream _test-output-stream) + 6651 (clear-stream $_test-output-buffered-file->buffer) + 6652 # + 6653 (write _test-input-stream "fn foo {\n") + 6654 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 6655 (write _test-input-stream " var idx: int\n") + 6656 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") + 6657 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") + 6658 (write _test-input-stream "}\n") + 6659 # convert + 6660 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6661 (flush _test-output-buffered-file) + 6662 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6668 # check output + 6669 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/0") + 6670 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/1") + 6671 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/2") + 6672 (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") + 6673 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/4") + 6674 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/5") + 6675 (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") + 6676 (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") + 6677 (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") + 6678 (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") + 6679 (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") + 6680 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 1 *eax \"foo\" \"arr\")" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/11") + 6681 (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/12") + 6682 (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/13") + 6683 (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/14") + 6684 (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/15") + 6685 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/16") + 6686 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/17") + 6687 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/18") + 6688 (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/19") + 6689 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/20") + 6690 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/21") + 6691 # . epilogue + 6692 89/<- %esp 5/r32/ebp + 6693 5d/pop-to-ebp + 6694 c3/return + 6695 + 6696 test-convert-function-and-type-definition: + 6697 # . prologue + 6698 55/push-ebp + 6699 89/<- %ebp 4/r32/esp + 6700 # setup + 6701 (clear-stream _test-input-stream) + 6702 (clear-stream $_test-input-buffered-file->buffer) + 6703 (clear-stream _test-output-stream) + 6704 (clear-stream $_test-output-buffered-file->buffer) + 6705 # + 6706 (write _test-input-stream "fn foo a: (addr t) {\n") + 6707 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n") + 6708 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n") + 6709 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n") + 6710 (write _test-input-stream "}\n") + 6711 (write _test-input-stream "type t {\n") + 6712 (write _test-input-stream " x: int\n") + 6713 (write _test-input-stream " y: int\n") + 6714 (write _test-input-stream "}\n") + 6715 # convert + 6716 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6717 (flush _test-output-buffered-file) + 6718 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6724 # check output + 6725 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0") + 6726 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1") + 6727 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2") + 6728 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3") + 6729 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4") + 6730 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5") + 6731 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6") + 6732 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7") + 6733 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8") + 6734 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9") + 6735 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11") + 6736 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13") + 6737 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14") + 6738 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15") + 6739 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16") + 6740 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17") + 6741 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18") + 6742 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19") + 6743 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20") + 6744 # . epilogue + 6745 89/<- %esp 5/r32/ebp + 6746 5d/pop-to-ebp + 6747 c3/return + 6748 + 6749 test-type-definition-with-array: + 6750 # . prologue + 6751 55/push-ebp + 6752 89/<- %ebp 4/r32/esp + 6753 # setup + 6754 (clear-stream _test-input-stream) + 6755 (clear-stream $_test-input-buffered-file->buffer) + 6756 (clear-stream _test-output-stream) + 6757 (clear-stream $_test-output-buffered-file->buffer) + 6758 (clear-stream _test-error-stream) + 6759 (clear-stream $_test-error-buffered-file->buffer) + 6760 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6761 68/push 0/imm32 + 6762 68/push 0/imm32 + 6763 89/<- %edx 4/r32/esp + 6764 (tailor-exit-descriptor %edx 0x10) + 6765 # + 6766 (write _test-input-stream "type t {\n") + 6767 (write _test-input-stream " a: (array int 3)\n") + 6768 (write _test-input-stream "}\n") + 6769 # convert + 6770 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6771 # registers except esp clobbered at this point + 6772 # restore ed + 6773 89/<- %edx 4/r32/esp + 6774 (flush _test-output-buffered-file) + 6775 (flush _test-error-buffered-file) + 6776 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 6782 # check output + 6783 (check-stream-equal _test-output-stream "" "F - test-type-definition-with-array: output should be empty") + 6784 (check-next-stream-line-equal _test-error-stream "type t: 'array' elements not allowed for now" "F - test-type-definition-with-array: error message") + 6785 # check that stop(1) was called + 6786 (check-ints-equal *(edx+4) 2 "F - test-type-definition-with-array: exit status") + 6787 # don't restore from ebp + 6788 81 0/subop/add %esp 8/imm32 + 6789 # . epilogue + 6790 5d/pop-to-ebp + 6791 c3/return + 6792 + 6793 test-type-definition-with-addr: + 6794 # . prologue + 6795 55/push-ebp + 6796 89/<- %ebp 4/r32/esp + 6797 # setup + 6798 (clear-stream _test-input-stream) + 6799 (clear-stream $_test-input-buffered-file->buffer) + 6800 (clear-stream _test-output-stream) + 6801 (clear-stream $_test-output-buffered-file->buffer) + 6802 (clear-stream _test-error-stream) + 6803 (clear-stream $_test-error-buffered-file->buffer) + 6804 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6805 68/push 0/imm32 + 6806 68/push 0/imm32 + 6807 89/<- %edx 4/r32/esp + 6808 (tailor-exit-descriptor %edx 0x10) + 6809 # + 6810 (write _test-input-stream "type t {\n") + 6811 (write _test-input-stream " a: (addr int)\n") + 6812 (write _test-input-stream "}\n") + 6813 # convert + 6814 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6815 # registers except esp clobbered at this point + 6816 # restore ed + 6817 89/<- %edx 4/r32/esp + 6818 (flush _test-output-buffered-file) + 6819 (flush _test-error-buffered-file) + 6820 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 6826 # check output + 6827 (check-stream-equal _test-output-stream "" "F - test-type-definition-with-addr: output should be empty") + 6828 (check-next-stream-line-equal _test-error-stream "type t: 'addr' elements not allowed" "F - test-type-definition-with-addr: error message") + 6829 # check that stop(1) was called + 6830 (check-ints-equal *(edx+4) 2 "F - test-type-definition-with-addr: exit status") + 6831 # don't restore from ebp + 6832 81 0/subop/add %esp 8/imm32 + 6833 # . epilogue + 6834 5d/pop-to-ebp + 6835 c3/return + 6836 + 6837 test-convert-function-with-local-var-with-user-defined-type: + 6838 # . prologue + 6839 55/push-ebp + 6840 89/<- %ebp 4/r32/esp + 6841 # setup + 6842 (clear-stream _test-input-stream) + 6843 (clear-stream $_test-input-buffered-file->buffer) + 6844 (clear-stream _test-output-stream) + 6845 (clear-stream $_test-output-buffered-file->buffer) + 6846 # + 6847 (write _test-input-stream "fn foo {\n") + 6848 (write _test-input-stream " var a: t\n") + 6849 (write _test-input-stream "}\n") + 6850 (write _test-input-stream "type t {\n") + 6851 (write _test-input-stream " x: int\n") + 6852 (write _test-input-stream " y: int\n") + 6853 (write _test-input-stream "}\n") + 6854 # convert + 6855 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6856 (flush _test-output-buffered-file) + 6857 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6863 # check output + 6864 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0") + 6865 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1") + 6866 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2") + 6867 (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") + 6868 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4") + 6869 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5") + 6870 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6") + 6871 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7") + 6872 (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") + 6873 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9") + 6874 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10") + 6875 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11") + 6876 (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") + 6877 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13") + 6878 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14") + 6879 # . epilogue + 6880 89/<- %esp 5/r32/ebp + 6881 5d/pop-to-ebp + 6882 c3/return + 6883 + 6884 test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type: + 6885 # . prologue + 6886 55/push-ebp + 6887 89/<- %ebp 4/r32/esp + 6888 # setup + 6889 (clear-stream _test-input-stream) + 6890 (clear-stream $_test-input-buffered-file->buffer) + 6891 (clear-stream _test-output-stream) + 6892 (clear-stream $_test-output-buffered-file->buffer) + 6893 # + 6894 (write _test-input-stream "fn foo {\n") + 6895 (write _test-input-stream " var a: t\n") + 6896 (write _test-input-stream "}\n") + 6897 (write _test-input-stream "type t {\n") + 6898 (write _test-input-stream " x: s\n") + 6899 (write _test-input-stream "}\n") + 6900 (write _test-input-stream "type s {\n") + 6901 (write _test-input-stream " z: int\n") + 6902 (write _test-input-stream "}\n") + 6903 # convert + 6904 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6905 (flush _test-output-buffered-file) + 6906 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6912 # check output + 6913 (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") + 6914 (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") + 6915 (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") + 6916 (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") + 6917 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/4") + 6918 (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") + 6919 (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") + 6920 (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") + 6921 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/9") + 6922 (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") + 6923 (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") + 6924 (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") + 6925 (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") + 6926 (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") + 6927 # . epilogue + 6928 89/<- %esp 5/r32/ebp + 6929 5d/pop-to-ebp + 6930 c3/return + 6931 + 6932 test-convert-function-call-with-arg-of-user-defined-type: + 6933 # . prologue + 6934 55/push-ebp + 6935 89/<- %ebp 4/r32/esp + 6936 # setup + 6937 (clear-stream _test-input-stream) + 6938 (clear-stream $_test-input-buffered-file->buffer) + 6939 (clear-stream _test-output-stream) + 6940 (clear-stream $_test-output-buffered-file->buffer) 6941 # - 6942 (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") - 6943 (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") - 6944 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/13") - 6945 (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") - 6946 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/15") - 6947 (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") - 6948 (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") - 6949 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/18") - 6950 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/19") - 6951 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/20") - 6952 (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") - 6953 (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") - 6954 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/23") - 6955 (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") - 6956 (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") - 6957 (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") - 6958 (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") - 6959 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/28") - 6960 (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") - 6961 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/30") - 6962 (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") - 6963 (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") - 6964 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/33") - 6965 # . epilogue - 6966 89/<- %esp 5/r32/ebp - 6967 5d/pop-to-ebp - 6968 c3/return - 6969 - 6970 test-convert-get-on-local-variable: - 6971 # . prologue - 6972 55/push-ebp - 6973 89/<- %ebp 4/r32/esp - 6974 # setup - 6975 (clear-stream _test-input-stream) - 6976 (clear-stream $_test-input-buffered-file->buffer) - 6977 (clear-stream _test-output-stream) - 6978 (clear-stream $_test-output-buffered-file->buffer) - 6979 # - 6980 (write _test-input-stream "fn foo {\n") - 6981 (write _test-input-stream " var a: t\n") - 6982 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 6983 (write _test-input-stream "}\n") - 6984 (write _test-input-stream "type t {\n") - 6985 (write _test-input-stream " x: int\n") - 6986 (write _test-input-stream " y: int\n") - 6987 (write _test-input-stream "}\n") - 6988 # convert - 6989 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6990 (flush _test-output-buffered-file) - 6991 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 6997 # check output - 6998 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-local-variable/0") - 6999 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-local-variable/1") - 7000 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-local-variable/2") - 7001 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-local-variable/3") - 7002 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-local-variable/4") - 7003 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-local-variable/5") - 7004 # var a - 7005 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/6") - 7006 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/7") - 7007 # var c - 7008 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-local-variable/8") - 7009 # get - 7010 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000001/r32" "F - test-convert-get-on-local-variable/9") - 7011 # reclaim c - 7012 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-local-variable/10") - 7013 # reclaim a - 7014 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-get-on-local-variable/11") - 7015 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-local-variable/12") - 7016 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-local-variable/13") - 7017 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-local-variable/14") - 7018 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-local-variable/15") - 7019 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-local-variable/16") - 7020 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-local-variable/17") - 7021 # . epilogue - 7022 89/<- %esp 5/r32/ebp - 7023 5d/pop-to-ebp - 7024 c3/return - 7025 - 7026 test-convert-get-on-function-argument: - 7027 # . prologue - 7028 55/push-ebp - 7029 89/<- %ebp 4/r32/esp - 7030 # setup - 7031 (clear-stream _test-input-stream) - 7032 (clear-stream $_test-input-buffered-file->buffer) - 7033 (clear-stream _test-output-stream) - 7034 (clear-stream $_test-output-buffered-file->buffer) + 6942 (write _test-input-stream "fn f {\n") + 6943 (write _test-input-stream " var a: t\n") + 6944 (write _test-input-stream " foo a\n") + 6945 (write _test-input-stream "}\n") + 6946 (write _test-input-stream "fn foo x: t {\n") + 6947 (write _test-input-stream "}\n") + 6948 (write _test-input-stream "type t {\n") + 6949 (write _test-input-stream " x: int\n") + 6950 (write _test-input-stream " y: int\n") + 6951 (write _test-input-stream "}\n") + 6952 # convert + 6953 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6954 (flush _test-output-buffered-file) + 6955 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 6961 # check output + 6962 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") + 6963 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") + 6964 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") + 6965 (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") + 6966 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") + 6967 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") + 6968 # var a: t + 6969 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/6") + 6970 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7") + 6971 # foo a + 6972 (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") + 6973 # + 6974 (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") + 6975 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") + 6976 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") + 6977 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") + 6978 (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") + 6979 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") + 6980 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") + 6981 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") + 6982 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") + 6983 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") + 6984 (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") + 6985 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") + 6986 (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") + 6987 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") + 6988 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") + 6989 # . epilogue + 6990 89/<- %esp 5/r32/ebp + 6991 5d/pop-to-ebp + 6992 c3/return + 6993 + 6994 test-convert-function-call-with-arg-of-user-defined-type-register-indirect: + 6995 # . prologue + 6996 55/push-ebp + 6997 89/<- %ebp 4/r32/esp + 6998 # setup + 6999 (clear-stream _test-input-stream) + 7000 (clear-stream $_test-input-buffered-file->buffer) + 7001 (clear-stream _test-output-stream) + 7002 (clear-stream $_test-output-buffered-file->buffer) + 7003 # + 7004 (write _test-input-stream "fn f {\n") + 7005 (write _test-input-stream " var a/eax: (addr t) <- copy 0\n") + 7006 (write _test-input-stream " foo *a\n") + 7007 (write _test-input-stream "}\n") + 7008 (write _test-input-stream "fn foo x: t {\n") + 7009 (write _test-input-stream "}\n") + 7010 (write _test-input-stream "type t {\n") + 7011 (write _test-input-stream " x: int\n") + 7012 (write _test-input-stream " y: int\n") + 7013 (write _test-input-stream "}\n") + 7014 # convert + 7015 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7016 (flush _test-output-buffered-file) + 7017 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 7023 # check output + 7024 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") + 7025 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") + 7026 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") + 7027 (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") + 7028 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") + 7029 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") + 7030 # var a + 7031 (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") + 7032 (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") + 7033 # foo a + 7034 (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") 7035 # - 7036 (write _test-input-stream "fn foo a: t {\n") - 7037 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 7038 (write _test-input-stream "}\n") - 7039 (write _test-input-stream "type t {\n") - 7040 (write _test-input-stream " x: int\n") - 7041 (write _test-input-stream " y: int\n") - 7042 (write _test-input-stream "}\n") - 7043 # convert - 7044 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7045 (flush _test-output-buffered-file) - 7046 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 7052 # check output - 7053 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument/0") - 7054 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument/1") - 7055 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument/2") - 7056 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument/3") - 7057 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument/4") - 7058 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument/5") - 7059 # var c - 7060 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument/6") - 7061 # get - 7062 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0x0000000c) 0x00000001/r32" "F - test-convert-get-on-function-argument/7") - 7063 # reclaim c - 7064 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument/8") - 7065 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument/9") - 7066 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument/10") - 7067 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument/11") - 7068 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument/12") - 7069 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument/13") - 7070 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument/14") - 7071 # . epilogue - 7072 89/<- %esp 5/r32/ebp - 7073 5d/pop-to-ebp - 7074 c3/return - 7075 - 7076 test-convert-get-on-function-argument-with-known-type: - 7077 # . prologue - 7078 55/push-ebp - 7079 89/<- %ebp 4/r32/esp - 7080 # setup - 7081 (clear-stream _test-input-stream) - 7082 (clear-stream $_test-input-buffered-file->buffer) - 7083 (clear-stream _test-output-stream) - 7084 (clear-stream $_test-output-buffered-file->buffer) - 7085 # - 7086 (write _test-input-stream "type t {\n") - 7087 (write _test-input-stream " x: int\n") - 7088 (write _test-input-stream " y: int\n") - 7089 (write _test-input-stream "}\n") - 7090 (write _test-input-stream "fn foo a: t {\n") - 7091 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 7092 (write _test-input-stream "}\n") - 7093 # convert - 7094 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7095 (flush _test-output-buffered-file) - 7096 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 7102 # check output - 7103 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument-with-known-type/0") - 7104 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument-with-known-type/1") - 7105 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument-with-known-type/2") - 7106 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument-with-known-type/3") - 7107 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument-with-known-type/4") - 7108 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument-with-known-type/5") - 7109 # var c - 7110 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument-with-known-type/6") - 7111 # get - 7112 (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") - 7113 # reclaim c - 7114 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument-with-known-type/8") - 7115 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument-with-known-type/9") - 7116 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument-with-known-type/10") - 7117 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument-with-known-type/11") - 7118 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument-with-known-type/12") - 7119 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument-with-known-type/13") - 7120 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument-with-known-type/14") - 7121 # . epilogue - 7122 89/<- %esp 5/r32/ebp - 7123 5d/pop-to-ebp - 7124 c3/return - 7125 - 7126 test-add-with-too-many-inouts: - 7127 # . prologue - 7128 55/push-ebp - 7129 89/<- %ebp 4/r32/esp - 7130 # setup - 7131 (clear-stream _test-input-stream) - 7132 (clear-stream $_test-input-buffered-file->buffer) - 7133 (clear-stream _test-output-stream) - 7134 (clear-stream $_test-output-buffered-file->buffer) - 7135 (clear-stream _test-error-stream) - 7136 (clear-stream $_test-error-buffered-file->buffer) - 7137 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7138 68/push 0/imm32 - 7139 68/push 0/imm32 - 7140 89/<- %edx 4/r32/esp - 7141 (tailor-exit-descriptor %edx 0x10) + 7036 (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") + 7037 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") + 7038 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") + 7039 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") + 7040 (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") + 7041 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") + 7042 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") + 7043 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") + 7044 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") + 7045 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") + 7046 (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") + 7047 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") + 7048 (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") + 7049 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") + 7050 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") + 7051 # . epilogue + 7052 89/<- %esp 5/r32/ebp + 7053 5d/pop-to-ebp + 7054 c3/return + 7055 + 7056 # we don't have special support for call-by-reference; just explicitly create + 7057 # a new variable with the address of the arg + 7058 test-convert-function-call-with-arg-of-user-defined-type-by-reference: + 7059 # . prologue + 7060 55/push-ebp + 7061 89/<- %ebp 4/r32/esp + 7062 # setup + 7063 (clear-stream _test-input-stream) + 7064 (clear-stream $_test-input-buffered-file->buffer) + 7065 (clear-stream _test-output-stream) + 7066 (clear-stream $_test-output-buffered-file->buffer) + 7067 # + 7068 (write _test-input-stream "fn f {\n") + 7069 (write _test-input-stream " var a: t\n") + 7070 (write _test-input-stream " var b/eax: (addr t) <- address a\n") + 7071 (write _test-input-stream " foo b\n") + 7072 (write _test-input-stream "}\n") + 7073 (write _test-input-stream "fn foo x: (addr t) {\n") + 7074 (write _test-input-stream " var x/ecx: (addr t) <- copy x\n") + 7075 (write _test-input-stream "}\n") + 7076 (write _test-input-stream "type t {\n") + 7077 (write _test-input-stream " x: int\n") + 7078 (write _test-input-stream " y: int\n") + 7079 (write _test-input-stream "}\n") + 7080 # convert + 7081 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7082 (flush _test-output-buffered-file) + 7083 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 7089 # check output + 7090 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/0") + 7091 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/1") + 7092 (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") + 7093 (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") + 7094 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/4") + 7095 (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") + 7096 # var a: t + 7097 (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") + 7098 (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") + 7099 # var b/eax: (addr t) + 7100 (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") + 7101 (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") + 7102 # foo a + 7103 (check-next-stream-line-equal _test-output-stream " (foo %eax)" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/10") + 7104 # + 7105 (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") + 7106 (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") + 7107 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/13") + 7108 (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") + 7109 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/15") + 7110 (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") + 7111 (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") + 7112 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/18") + 7113 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/19") + 7114 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/20") + 7115 (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") + 7116 (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") + 7117 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/23") + 7118 (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") + 7119 (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") + 7120 (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") + 7121 (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") + 7122 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/28") + 7123 (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") + 7124 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/30") + 7125 (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") + 7126 (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") + 7127 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/33") + 7128 # . epilogue + 7129 89/<- %esp 5/r32/ebp + 7130 5d/pop-to-ebp + 7131 c3/return + 7132 + 7133 test-convert-get-on-local-variable: + 7134 # . prologue + 7135 55/push-ebp + 7136 89/<- %ebp 4/r32/esp + 7137 # setup + 7138 (clear-stream _test-input-stream) + 7139 (clear-stream $_test-input-buffered-file->buffer) + 7140 (clear-stream _test-output-stream) + 7141 (clear-stream $_test-output-buffered-file->buffer) 7142 # 7143 (write _test-input-stream "fn foo {\n") - 7144 (write _test-input-stream " var a: int\n") - 7145 (write _test-input-stream " var b/ecx: int <- add a, 0\n") + 7144 (write _test-input-stream " var a: t\n") + 7145 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") 7146 (write _test-input-stream "}\n") - 7147 # convert - 7148 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7149 # registers except esp clobbered at this point - 7150 # restore ed - 7151 89/<- %edx 4/r32/esp - 7152 (flush _test-output-buffered-file) - 7153 (flush _test-error-buffered-file) - 7154 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- + 7147 (write _test-input-stream "type t {\n") + 7148 (write _test-input-stream " x: int\n") + 7149 (write _test-input-stream " y: int\n") + 7150 (write _test-input-stream "}\n") + 7151 # convert + 7152 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7153 (flush _test-output-buffered-file) + 7154 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- 7160 # check output - 7161 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-inouts: output should be empty") - 7162 (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") - 7163 # check that stop(1) was called - 7164 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-inouts: exit status") - 7165 # don't restore from ebp - 7166 81 0/subop/add %esp 8/imm32 - 7167 # . epilogue - 7168 5d/pop-to-ebp - 7169 c3/return - 7170 - 7171 test-add-with-too-many-inouts-2: - 7172 # . prologue - 7173 55/push-ebp - 7174 89/<- %ebp 4/r32/esp - 7175 # setup - 7176 (clear-stream _test-input-stream) - 7177 (clear-stream $_test-input-buffered-file->buffer) - 7178 (clear-stream _test-output-stream) - 7179 (clear-stream $_test-output-buffered-file->buffer) - 7180 (clear-stream _test-error-stream) - 7181 (clear-stream $_test-error-buffered-file->buffer) - 7182 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7183 68/push 0/imm32 - 7184 68/push 0/imm32 - 7185 89/<- %edx 4/r32/esp - 7186 (tailor-exit-descriptor %edx 0x10) - 7187 # - 7188 (write _test-input-stream "fn foo {\n") - 7189 (write _test-input-stream " var a: int\n") - 7190 (write _test-input-stream " add-to a, 0, 1\n") - 7191 (write _test-input-stream "}\n") - 7192 # convert - 7193 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7194 # registers except esp clobbered at this point - 7195 # restore ed - 7196 89/<- %edx 4/r32/esp - 7197 (flush _test-output-buffered-file) - 7198 (flush _test-error-buffered-file) - 7199 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7205 # check output - 7206 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-inouts-2: output should be empty") - 7207 (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") - 7208 # check that stop(1) was called - 7209 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-inouts-2: exit status") - 7210 # don't restore from ebp - 7211 81 0/subop/add %esp 8/imm32 - 7212 # . epilogue - 7213 5d/pop-to-ebp - 7214 c3/return - 7215 - 7216 test-add-with-too-many-outputs: - 7217 # . prologue - 7218 55/push-ebp - 7219 89/<- %ebp 4/r32/esp - 7220 # setup - 7221 (clear-stream _test-input-stream) - 7222 (clear-stream $_test-input-buffered-file->buffer) - 7223 (clear-stream _test-output-stream) - 7224 (clear-stream $_test-output-buffered-file->buffer) - 7225 (clear-stream _test-error-stream) - 7226 (clear-stream $_test-error-buffered-file->buffer) - 7227 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7228 68/push 0/imm32 - 7229 68/push 0/imm32 - 7230 89/<- %edx 4/r32/esp - 7231 (tailor-exit-descriptor %edx 0x10) - 7232 # - 7233 (write _test-input-stream "fn foo {\n") - 7234 (write _test-input-stream " var a/eax: int <- copy 0\n") - 7235 (write _test-input-stream " var b/ebx: int <- copy 0\n") - 7236 (write _test-input-stream " var c/ecx: int <- copy 0\n") - 7237 (write _test-input-stream " c, b <- add a\n") - 7238 (write _test-input-stream "}\n") - 7239 # convert - 7240 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7241 # registers except esp clobbered at this point - 7242 # restore ed - 7243 89/<- %edx 4/r32/esp - 7244 (flush _test-output-buffered-file) - 7245 (flush _test-error-buffered-file) - 7246 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7252 # check output - 7253 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-outputs: output should be empty") - 7254 (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") - 7255 # check that stop(1) was called - 7256 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-outputs: exit status") - 7257 # don't restore from ebp - 7258 81 0/subop/add %esp 8/imm32 - 7259 # . epilogue - 7260 5d/pop-to-ebp - 7261 c3/return - 7262 - 7263 test-add-with-non-number: - 7264 # . prologue - 7265 55/push-ebp - 7266 89/<- %ebp 4/r32/esp - 7267 # setup - 7268 (clear-stream _test-input-stream) - 7269 (clear-stream $_test-input-buffered-file->buffer) - 7270 (clear-stream _test-output-stream) - 7271 (clear-stream $_test-output-buffered-file->buffer) - 7272 (clear-stream _test-error-stream) - 7273 (clear-stream $_test-error-buffered-file->buffer) - 7274 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7275 68/push 0/imm32 - 7276 68/push 0/imm32 - 7277 89/<- %edx 4/r32/esp - 7278 (tailor-exit-descriptor %edx 0x10) - 7279 # - 7280 (write _test-input-stream "fn foo {\n") - 7281 (write _test-input-stream " var a: int\n") - 7282 (write _test-input-stream " var b/ecx: (addr int) <- add a\n") - 7283 (write _test-input-stream "}\n") - 7284 # convert - 7285 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7286 # registers except esp clobbered at this point - 7287 # restore ed - 7288 89/<- %edx 4/r32/esp - 7289 (flush _test-output-buffered-file) - 7290 (flush _test-error-buffered-file) - 7291 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7297 # check output - 7298 (check-stream-equal _test-output-stream "" "F - test-add-with-non-number: output should be empty") - 7299 (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") - 7300 # check that stop(1) was called - 7301 (check-ints-equal *(edx+4) 2 "F - test-add-with-non-number: exit status") - 7302 # don't restore from ebp - 7303 81 0/subop/add %esp 8/imm32 - 7304 # . epilogue - 7305 5d/pop-to-ebp - 7306 c3/return - 7307 - 7308 test-add-with-addr-dereferenced: - 7309 # . prologue - 7310 55/push-ebp - 7311 89/<- %ebp 4/r32/esp - 7312 # setup - 7313 (clear-stream _test-input-stream) - 7314 (clear-stream $_test-input-buffered-file->buffer) - 7315 (clear-stream _test-output-stream) - 7316 (clear-stream $_test-output-buffered-file->buffer) - 7317 # - 7318 (write _test-input-stream "fn foo {\n") - 7319 (write _test-input-stream " var a/eax: (addr int) <- copy 0\n") - 7320 (write _test-input-stream " add-to *a, 1\n") - 7321 (write _test-input-stream "}\n") - 7322 # convert - 7323 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7324 (flush _test-output-buffered-file) - 7325 # no error - 7326 # . epilogue - 7327 89/<- %esp 5/r32/ebp - 7328 5d/pop-to-ebp - 7329 c3/return - 7330 - 7331 test-copy-with-no-inout: - 7332 # . prologue - 7333 55/push-ebp - 7334 89/<- %ebp 4/r32/esp - 7335 # setup - 7336 (clear-stream _test-input-stream) - 7337 (clear-stream $_test-input-buffered-file->buffer) - 7338 (clear-stream _test-output-stream) - 7339 (clear-stream $_test-output-buffered-file->buffer) - 7340 (clear-stream _test-error-stream) - 7341 (clear-stream $_test-error-buffered-file->buffer) - 7342 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7343 68/push 0/imm32 - 7344 68/push 0/imm32 - 7345 89/<- %edx 4/r32/esp - 7346 (tailor-exit-descriptor %edx 0x10) - 7347 # - 7348 (write _test-input-stream "fn foo {\n") - 7349 (write _test-input-stream " var x/eax: boolean <- copy\n") - 7350 (write _test-input-stream "}\n") - 7351 # convert - 7352 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7353 # registers except esp clobbered at this point - 7354 # restore ed - 7355 89/<- %edx 4/r32/esp - 7356 (flush _test-output-buffered-file) - 7357 (flush _test-error-buffered-file) - 7358 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7364 # check output - 7365 (check-stream-equal _test-output-stream "" "F - test-copy-with-no-inout: output should be empty") - 7366 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' expects an inout" "F - test-copy-with-no-inout: error message") - 7367 # check that stop(1) was called - 7368 (check-ints-equal *(edx+4) 2 "F - test-copy-with-no-inout: exit status") - 7369 # don't restore from ebp - 7370 81 0/subop/add %esp 8/imm32 - 7371 # . epilogue - 7372 5d/pop-to-ebp - 7373 c3/return - 7374 - 7375 test-copy-with-multiple-inouts: - 7376 # . prologue - 7377 55/push-ebp - 7378 89/<- %ebp 4/r32/esp - 7379 # setup - 7380 (clear-stream _test-input-stream) - 7381 (clear-stream $_test-input-buffered-file->buffer) - 7382 (clear-stream _test-output-stream) - 7383 (clear-stream $_test-output-buffered-file->buffer) - 7384 (clear-stream _test-error-stream) - 7385 (clear-stream $_test-error-buffered-file->buffer) - 7386 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7387 68/push 0/imm32 - 7388 68/push 0/imm32 - 7389 89/<- %edx 4/r32/esp - 7390 (tailor-exit-descriptor %edx 0x10) - 7391 # - 7392 (write _test-input-stream "fn foo {\n") - 7393 (write _test-input-stream " var x/eax: boolean <- copy 0, 0\n") - 7394 (write _test-input-stream "}\n") - 7395 # convert - 7396 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7397 # registers except esp clobbered at this point - 7398 # restore ed - 7399 89/<- %edx 4/r32/esp - 7400 (flush _test-output-buffered-file) - 7401 (flush _test-error-buffered-file) - 7402 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7408 # check output - 7409 (check-stream-equal _test-output-stream "" "F - test-copy-with-multiple-inouts: output should be empty") - 7410 (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") - 7411 # check that stop(1) was called - 7412 (check-ints-equal *(edx+4) 2 "F - test-copy-with-multiple-inouts: exit status") - 7413 # don't restore from ebp - 7414 81 0/subop/add %esp 8/imm32 - 7415 # . epilogue - 7416 5d/pop-to-ebp - 7417 c3/return - 7418 - 7419 test-copy-with-no-output: - 7420 # . prologue - 7421 55/push-ebp - 7422 89/<- %ebp 4/r32/esp - 7423 # setup - 7424 (clear-stream _test-input-stream) - 7425 (clear-stream $_test-input-buffered-file->buffer) - 7426 (clear-stream _test-output-stream) - 7427 (clear-stream $_test-output-buffered-file->buffer) - 7428 (clear-stream _test-error-stream) - 7429 (clear-stream $_test-error-buffered-file->buffer) - 7430 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7431 68/push 0/imm32 - 7432 68/push 0/imm32 - 7433 89/<- %edx 4/r32/esp - 7434 (tailor-exit-descriptor %edx 0x10) - 7435 # - 7436 (write _test-input-stream "fn foo {\n") - 7437 (write _test-input-stream " copy 0\n") - 7438 (write _test-input-stream "}\n") - 7439 # convert - 7440 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7441 # registers except esp clobbered at this point - 7442 # restore ed - 7443 89/<- %edx 4/r32/esp - 7444 (flush _test-output-buffered-file) - 7445 (flush _test-error-buffered-file) - 7446 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7452 # check output - 7453 (check-stream-equal _test-output-stream "" "F - test-copy-with-no-output: output should be empty") - 7454 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' expects an output" "F - test-copy-with-no-output: error message") - 7455 # check that stop(1) was called - 7456 (check-ints-equal *(edx+4) 2 "F - test-copy-with-no-output: exit status") - 7457 # don't restore from ebp - 7458 81 0/subop/add %esp 8/imm32 - 7459 # . epilogue - 7460 5d/pop-to-ebp - 7461 c3/return - 7462 - 7463 test-copy-with-multiple-outputs: - 7464 # . prologue - 7465 55/push-ebp - 7466 89/<- %ebp 4/r32/esp - 7467 # setup - 7468 (clear-stream _test-input-stream) - 7469 (clear-stream $_test-input-buffered-file->buffer) - 7470 (clear-stream _test-output-stream) - 7471 (clear-stream $_test-output-buffered-file->buffer) - 7472 (clear-stream _test-error-stream) - 7473 (clear-stream $_test-error-buffered-file->buffer) - 7474 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7475 68/push 0/imm32 - 7476 68/push 0/imm32 - 7477 89/<- %edx 4/r32/esp - 7478 (tailor-exit-descriptor %edx 0x10) - 7479 # - 7480 (write _test-input-stream "fn foo {\n") - 7481 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 7482 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") - 7483 (write _test-input-stream " x, y <- copy 0\n") + 7161 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-local-variable/0") + 7162 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-local-variable/1") + 7163 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-local-variable/2") + 7164 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-local-variable/3") + 7165 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-local-variable/4") + 7166 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-local-variable/5") + 7167 # var a + 7168 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/6") + 7169 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/7") + 7170 # var c + 7171 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-local-variable/8") + 7172 # get + 7173 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000001/r32" "F - test-convert-get-on-local-variable/9") + 7174 # reclaim c + 7175 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-local-variable/10") + 7176 # reclaim a + 7177 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-get-on-local-variable/11") + 7178 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-local-variable/12") + 7179 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-local-variable/13") + 7180 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-local-variable/14") + 7181 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-local-variable/15") + 7182 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-local-variable/16") + 7183 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-local-variable/17") + 7184 # . epilogue + 7185 89/<- %esp 5/r32/ebp + 7186 5d/pop-to-ebp + 7187 c3/return + 7188 + 7189 test-convert-get-on-function-argument: + 7190 # . prologue + 7191 55/push-ebp + 7192 89/<- %ebp 4/r32/esp + 7193 # setup + 7194 (clear-stream _test-input-stream) + 7195 (clear-stream $_test-input-buffered-file->buffer) + 7196 (clear-stream _test-output-stream) + 7197 (clear-stream $_test-output-buffered-file->buffer) + 7198 # + 7199 (write _test-input-stream "fn foo a: t {\n") + 7200 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 7201 (write _test-input-stream "}\n") + 7202 (write _test-input-stream "type t {\n") + 7203 (write _test-input-stream " x: int\n") + 7204 (write _test-input-stream " y: int\n") + 7205 (write _test-input-stream "}\n") + 7206 # convert + 7207 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7208 (flush _test-output-buffered-file) + 7209 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 7215 # check output + 7216 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument/0") + 7217 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument/1") + 7218 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument/2") + 7219 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument/3") + 7220 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument/4") + 7221 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument/5") + 7222 # var c + 7223 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument/6") + 7224 # get + 7225 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0x0000000c) 0x00000001/r32" "F - test-convert-get-on-function-argument/7") + 7226 # reclaim c + 7227 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument/8") + 7228 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument/9") + 7229 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument/10") + 7230 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument/11") + 7231 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument/12") + 7232 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument/13") + 7233 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument/14") + 7234 # . epilogue + 7235 89/<- %esp 5/r32/ebp + 7236 5d/pop-to-ebp + 7237 c3/return + 7238 + 7239 test-convert-get-on-function-argument-with-known-type: + 7240 # . prologue + 7241 55/push-ebp + 7242 89/<- %ebp 4/r32/esp + 7243 # setup + 7244 (clear-stream _test-input-stream) + 7245 (clear-stream $_test-input-buffered-file->buffer) + 7246 (clear-stream _test-output-stream) + 7247 (clear-stream $_test-output-buffered-file->buffer) + 7248 # + 7249 (write _test-input-stream "type t {\n") + 7250 (write _test-input-stream " x: int\n") + 7251 (write _test-input-stream " y: int\n") + 7252 (write _test-input-stream "}\n") + 7253 (write _test-input-stream "fn foo a: t {\n") + 7254 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 7255 (write _test-input-stream "}\n") + 7256 # convert + 7257 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7258 (flush _test-output-buffered-file) + 7259 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 7265 # check output + 7266 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument-with-known-type/0") + 7267 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument-with-known-type/1") + 7268 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument-with-known-type/2") + 7269 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument-with-known-type/3") + 7270 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument-with-known-type/4") + 7271 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument-with-known-type/5") + 7272 # var c + 7273 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument-with-known-type/6") + 7274 # get + 7275 (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") + 7276 # reclaim c + 7277 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument-with-known-type/8") + 7278 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument-with-known-type/9") + 7279 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument-with-known-type/10") + 7280 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument-with-known-type/11") + 7281 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument-with-known-type/12") + 7282 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument-with-known-type/13") + 7283 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument-with-known-type/14") + 7284 # . epilogue + 7285 89/<- %esp 5/r32/ebp + 7286 5d/pop-to-ebp + 7287 c3/return + 7288 + 7289 test-add-with-too-many-inouts: + 7290 # . prologue + 7291 55/push-ebp + 7292 89/<- %ebp 4/r32/esp + 7293 # setup + 7294 (clear-stream _test-input-stream) + 7295 (clear-stream $_test-input-buffered-file->buffer) + 7296 (clear-stream _test-output-stream) + 7297 (clear-stream $_test-output-buffered-file->buffer) + 7298 (clear-stream _test-error-stream) + 7299 (clear-stream $_test-error-buffered-file->buffer) + 7300 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7301 68/push 0/imm32 + 7302 68/push 0/imm32 + 7303 89/<- %edx 4/r32/esp + 7304 (tailor-exit-descriptor %edx 0x10) + 7305 # + 7306 (write _test-input-stream "fn foo {\n") + 7307 (write _test-input-stream " var a: int\n") + 7308 (write _test-input-stream " var b/ecx: int <- add a, 0\n") + 7309 (write _test-input-stream "}\n") + 7310 # convert + 7311 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7312 # registers except esp clobbered at this point + 7313 # restore ed + 7314 89/<- %edx 4/r32/esp + 7315 (flush _test-output-buffered-file) + 7316 (flush _test-error-buffered-file) + 7317 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7323 # check output + 7324 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-inouts: output should be empty") + 7325 (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") + 7326 # check that stop(1) was called + 7327 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-inouts: exit status") + 7328 # don't restore from ebp + 7329 81 0/subop/add %esp 8/imm32 + 7330 # . epilogue + 7331 5d/pop-to-ebp + 7332 c3/return + 7333 + 7334 test-add-with-too-many-inouts-2: + 7335 # . prologue + 7336 55/push-ebp + 7337 89/<- %ebp 4/r32/esp + 7338 # setup + 7339 (clear-stream _test-input-stream) + 7340 (clear-stream $_test-input-buffered-file->buffer) + 7341 (clear-stream _test-output-stream) + 7342 (clear-stream $_test-output-buffered-file->buffer) + 7343 (clear-stream _test-error-stream) + 7344 (clear-stream $_test-error-buffered-file->buffer) + 7345 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7346 68/push 0/imm32 + 7347 68/push 0/imm32 + 7348 89/<- %edx 4/r32/esp + 7349 (tailor-exit-descriptor %edx 0x10) + 7350 # + 7351 (write _test-input-stream "fn foo {\n") + 7352 (write _test-input-stream " var a: int\n") + 7353 (write _test-input-stream " add-to a, 0, 1\n") + 7354 (write _test-input-stream "}\n") + 7355 # convert + 7356 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7357 # registers except esp clobbered at this point + 7358 # restore ed + 7359 89/<- %edx 4/r32/esp + 7360 (flush _test-output-buffered-file) + 7361 (flush _test-error-buffered-file) + 7362 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7368 # check output + 7369 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-inouts-2: output should be empty") + 7370 (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") + 7371 # check that stop(1) was called + 7372 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-inouts-2: exit status") + 7373 # don't restore from ebp + 7374 81 0/subop/add %esp 8/imm32 + 7375 # . epilogue + 7376 5d/pop-to-ebp + 7377 c3/return + 7378 + 7379 test-add-with-too-many-outputs: + 7380 # . prologue + 7381 55/push-ebp + 7382 89/<- %ebp 4/r32/esp + 7383 # setup + 7384 (clear-stream _test-input-stream) + 7385 (clear-stream $_test-input-buffered-file->buffer) + 7386 (clear-stream _test-output-stream) + 7387 (clear-stream $_test-output-buffered-file->buffer) + 7388 (clear-stream _test-error-stream) + 7389 (clear-stream $_test-error-buffered-file->buffer) + 7390 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7391 68/push 0/imm32 + 7392 68/push 0/imm32 + 7393 89/<- %edx 4/r32/esp + 7394 (tailor-exit-descriptor %edx 0x10) + 7395 # + 7396 (write _test-input-stream "fn foo {\n") + 7397 (write _test-input-stream " var a/eax: int <- copy 0\n") + 7398 (write _test-input-stream " var b/ebx: int <- copy 0\n") + 7399 (write _test-input-stream " var c/ecx: int <- copy 0\n") + 7400 (write _test-input-stream " c, b <- add a\n") + 7401 (write _test-input-stream "}\n") + 7402 # convert + 7403 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7404 # registers except esp clobbered at this point + 7405 # restore ed + 7406 89/<- %edx 4/r32/esp + 7407 (flush _test-output-buffered-file) + 7408 (flush _test-error-buffered-file) + 7409 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7415 # check output + 7416 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-outputs: output should be empty") + 7417 (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") + 7418 # check that stop(1) was called + 7419 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-outputs: exit status") + 7420 # don't restore from ebp + 7421 81 0/subop/add %esp 8/imm32 + 7422 # . epilogue + 7423 5d/pop-to-ebp + 7424 c3/return + 7425 + 7426 test-add-with-non-number: + 7427 # . prologue + 7428 55/push-ebp + 7429 89/<- %ebp 4/r32/esp + 7430 # setup + 7431 (clear-stream _test-input-stream) + 7432 (clear-stream $_test-input-buffered-file->buffer) + 7433 (clear-stream _test-output-stream) + 7434 (clear-stream $_test-output-buffered-file->buffer) + 7435 (clear-stream _test-error-stream) + 7436 (clear-stream $_test-error-buffered-file->buffer) + 7437 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7438 68/push 0/imm32 + 7439 68/push 0/imm32 + 7440 89/<- %edx 4/r32/esp + 7441 (tailor-exit-descriptor %edx 0x10) + 7442 # + 7443 (write _test-input-stream "fn foo {\n") + 7444 (write _test-input-stream " var a: int\n") + 7445 (write _test-input-stream " var b/ecx: (addr int) <- add a\n") + 7446 (write _test-input-stream "}\n") + 7447 # convert + 7448 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7449 # registers except esp clobbered at this point + 7450 # restore ed + 7451 89/<- %edx 4/r32/esp + 7452 (flush _test-output-buffered-file) + 7453 (flush _test-error-buffered-file) + 7454 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7460 # check output + 7461 (check-stream-equal _test-output-stream "" "F - test-add-with-non-number: output should be empty") + 7462 (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") + 7463 # check that stop(1) was called + 7464 (check-ints-equal *(edx+4) 2 "F - test-add-with-non-number: exit status") + 7465 # don't restore from ebp + 7466 81 0/subop/add %esp 8/imm32 + 7467 # . epilogue + 7468 5d/pop-to-ebp + 7469 c3/return + 7470 + 7471 test-add-with-addr-dereferenced: + 7472 # . prologue + 7473 55/push-ebp + 7474 89/<- %ebp 4/r32/esp + 7475 # setup + 7476 (clear-stream _test-input-stream) + 7477 (clear-stream $_test-input-buffered-file->buffer) + 7478 (clear-stream _test-output-stream) + 7479 (clear-stream $_test-output-buffered-file->buffer) + 7480 # + 7481 (write _test-input-stream "fn foo {\n") + 7482 (write _test-input-stream " var a/eax: (addr int) <- copy 0\n") + 7483 (write _test-input-stream " add-to *a, 1\n") 7484 (write _test-input-stream "}\n") 7485 # convert - 7486 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7487 # registers except esp clobbered at this point - 7488 # restore ed - 7489 89/<- %edx 4/r32/esp - 7490 (flush _test-output-buffered-file) - 7491 (flush _test-error-buffered-file) - 7492 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7498 # check output - 7499 (check-stream-equal _test-output-stream "" "F - test-copy-with-multiple-outputs: output should be empty") - 7500 (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") - 7501 # check that stop(1) was called - 7502 (check-ints-equal *(edx+4) 2 "F - test-copy-with-multiple-outputs: exit status") - 7503 # don't restore from ebp - 7504 81 0/subop/add %esp 8/imm32 - 7505 # . epilogue - 7506 5d/pop-to-ebp - 7507 c3/return - 7508 - 7509 test-copy-invalid-value-to-address: - 7510 # . prologue - 7511 55/push-ebp - 7512 89/<- %ebp 4/r32/esp - 7513 # setup - 7514 (clear-stream _test-input-stream) - 7515 (clear-stream $_test-input-buffered-file->buffer) - 7516 (clear-stream _test-output-stream) - 7517 (clear-stream $_test-output-buffered-file->buffer) - 7518 (clear-stream _test-error-stream) - 7519 (clear-stream $_test-error-buffered-file->buffer) - 7520 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7521 68/push 0/imm32 - 7522 68/push 0/imm32 - 7523 89/<- %edx 4/r32/esp - 7524 (tailor-exit-descriptor %edx 0x10) - 7525 # - 7526 (write _test-input-stream "fn foo {\n") - 7527 (write _test-input-stream " var x/eax: int <- copy 0\n") - 7528 (write _test-input-stream " var y/ecx: (addr int) <- copy x\n") - 7529 (write _test-input-stream "}\n") - 7530 # convert - 7531 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7532 # registers except esp clobbered at this point - 7533 # restore ed - 7534 89/<- %edx 4/r32/esp - 7535 (flush _test-output-buffered-file) - 7536 (flush _test-error-buffered-file) - 7537 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7543 # check output - 7544 (check-stream-equal _test-output-stream "" "F - test-copy-invalid-value-to-address: output should be empty") - 7545 (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") - 7546 # check that stop(1) was called - 7547 (check-ints-equal *(edx+4) 2 "F - test-copy-invalid-value-to-address: exit status") - 7548 # don't restore from ebp - 7549 81 0/subop/add %esp 8/imm32 - 7550 # . epilogue - 7551 5d/pop-to-ebp - 7552 c3/return - 7553 - 7554 test-copy-null-value-to-addr: - 7555 # . prologue - 7556 55/push-ebp - 7557 89/<- %ebp 4/r32/esp - 7558 # setup - 7559 (clear-stream _test-input-stream) - 7560 (clear-stream $_test-input-buffered-file->buffer) - 7561 (clear-stream _test-output-stream) - 7562 (clear-stream $_test-output-buffered-file->buffer) - 7563 # - 7564 (write _test-input-stream "fn foo {\n") - 7565 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") - 7566 (write _test-input-stream "}\n") - 7567 # convert - 7568 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7569 (flush _test-output-buffered-file) - 7570 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7576 # no errors - 7577 # . epilogue - 7578 89/<- %esp 5/r32/ebp + 7486 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7487 (flush _test-output-buffered-file) + 7488 # no error + 7489 # . epilogue + 7490 89/<- %esp 5/r32/ebp + 7491 5d/pop-to-ebp + 7492 c3/return + 7493 + 7494 test-copy-with-no-inout: + 7495 # . prologue + 7496 55/push-ebp + 7497 89/<- %ebp 4/r32/esp + 7498 # setup + 7499 (clear-stream _test-input-stream) + 7500 (clear-stream $_test-input-buffered-file->buffer) + 7501 (clear-stream _test-output-stream) + 7502 (clear-stream $_test-output-buffered-file->buffer) + 7503 (clear-stream _test-error-stream) + 7504 (clear-stream $_test-error-buffered-file->buffer) + 7505 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7506 68/push 0/imm32 + 7507 68/push 0/imm32 + 7508 89/<- %edx 4/r32/esp + 7509 (tailor-exit-descriptor %edx 0x10) + 7510 # + 7511 (write _test-input-stream "fn foo {\n") + 7512 (write _test-input-stream " var x/eax: boolean <- copy\n") + 7513 (write _test-input-stream "}\n") + 7514 # convert + 7515 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7516 # registers except esp clobbered at this point + 7517 # restore ed + 7518 89/<- %edx 4/r32/esp + 7519 (flush _test-output-buffered-file) + 7520 (flush _test-error-buffered-file) + 7521 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7527 # check output + 7528 (check-stream-equal _test-output-stream "" "F - test-copy-with-no-inout: output should be empty") + 7529 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' expects an inout" "F - test-copy-with-no-inout: error message") + 7530 # check that stop(1) was called + 7531 (check-ints-equal *(edx+4) 2 "F - test-copy-with-no-inout: exit status") + 7532 # don't restore from ebp + 7533 81 0/subop/add %esp 8/imm32 + 7534 # . epilogue + 7535 5d/pop-to-ebp + 7536 c3/return + 7537 + 7538 test-copy-with-multiple-inouts: + 7539 # . prologue + 7540 55/push-ebp + 7541 89/<- %ebp 4/r32/esp + 7542 # setup + 7543 (clear-stream _test-input-stream) + 7544 (clear-stream $_test-input-buffered-file->buffer) + 7545 (clear-stream _test-output-stream) + 7546 (clear-stream $_test-output-buffered-file->buffer) + 7547 (clear-stream _test-error-stream) + 7548 (clear-stream $_test-error-buffered-file->buffer) + 7549 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7550 68/push 0/imm32 + 7551 68/push 0/imm32 + 7552 89/<- %edx 4/r32/esp + 7553 (tailor-exit-descriptor %edx 0x10) + 7554 # + 7555 (write _test-input-stream "fn foo {\n") + 7556 (write _test-input-stream " var x/eax: boolean <- copy 0, 0\n") + 7557 (write _test-input-stream "}\n") + 7558 # convert + 7559 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7560 # registers except esp clobbered at this point + 7561 # restore ed + 7562 89/<- %edx 4/r32/esp + 7563 (flush _test-output-buffered-file) + 7564 (flush _test-error-buffered-file) + 7565 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7571 # check output + 7572 (check-stream-equal _test-output-stream "" "F - test-copy-with-multiple-inouts: output should be empty") + 7573 (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") + 7574 # check that stop(1) was called + 7575 (check-ints-equal *(edx+4) 2 "F - test-copy-with-multiple-inouts: exit status") + 7576 # don't restore from ebp + 7577 81 0/subop/add %esp 8/imm32 + 7578 # . epilogue 7579 5d/pop-to-ebp 7580 c3/return 7581 - 7582 test-copy-invalid-value-to-offset: + 7582 test-copy-with-no-output: 7583 # . prologue 7584 55/push-ebp 7585 89/<- %ebp 4/r32/esp @@ -6949,4771 +6949,4806 @@ if ('onhashchange' in window) { 7597 (tailor-exit-descriptor %edx 0x10) 7598 # 7599 (write _test-input-stream "fn foo {\n") - 7600 (write _test-input-stream " var x/eax: int <- copy 0\n") - 7601 (write _test-input-stream " var y/ecx: (offset int) <- copy x\n") - 7602 (write _test-input-stream "}\n") - 7603 # convert - 7604 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7605 # registers except esp clobbered at this point - 7606 # restore ed - 7607 89/<- %edx 4/r32/esp - 7608 (flush _test-output-buffered-file) - 7609 (flush _test-error-buffered-file) - 7610 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7616 # check output - 7617 (check-stream-equal _test-output-stream "" "F - test-copy-invalid-value-to-address: output should be empty") - 7618 (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") - 7619 # check that stop(1) was called - 7620 (check-ints-equal *(edx+4) 2 "F - test-copy-invalid-value-to-offset: exit status") - 7621 # don't restore from ebp - 7622 81 0/subop/add %esp 8/imm32 - 7623 # . epilogue - 7624 5d/pop-to-ebp - 7625 c3/return - 7626 - 7627 test-copy-null-value-to-offset: - 7628 # . prologue - 7629 55/push-ebp - 7630 89/<- %ebp 4/r32/esp - 7631 # setup - 7632 (clear-stream _test-input-stream) - 7633 (clear-stream $_test-input-buffered-file->buffer) - 7634 (clear-stream _test-output-stream) - 7635 (clear-stream $_test-output-buffered-file->buffer) - 7636 # - 7637 (write _test-input-stream "fn foo {\n") - 7638 (write _test-input-stream " var y/ecx: (offset int) <- copy 0\n") - 7639 (write _test-input-stream "}\n") - 7640 # convert - 7641 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7642 (flush _test-output-buffered-file) - 7643 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7649 # no errors - 7650 # . epilogue - 7651 89/<- %esp 5/r32/ebp - 7652 5d/pop-to-ebp - 7653 c3/return - 7654 - 7655 test-copy-deref-address: - 7656 # . prologue - 7657 55/push-ebp - 7658 89/<- %ebp 4/r32/esp - 7659 # setup - 7660 (clear-stream _test-input-stream) - 7661 (clear-stream $_test-input-buffered-file->buffer) - 7662 (clear-stream _test-output-stream) - 7663 (clear-stream $_test-output-buffered-file->buffer) - 7664 # - 7665 (write _test-input-stream "fn foo {\n") - 7666 (write _test-input-stream " var x/eax: (addr addr int) <- copy 0\n") - 7667 (write _test-input-stream " var y/ecx: (addr int) <- copy *x\n") - 7668 (write _test-input-stream "}\n") - 7669 # convert - 7670 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7671 (flush _test-output-buffered-file) - 7672 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7678 # not bothering checking output - 7679 (check-next-stream-line-equal _test-error-stream "" "F - test-copy-deref-address: error message") - 7680 # . epilogue - 7681 5d/pop-to-ebp - 7682 c3/return - 7683 - 7684 test-copy-to-non-register: - 7685 # . prologue - 7686 55/push-ebp - 7687 89/<- %ebp 4/r32/esp - 7688 # setup - 7689 (clear-stream _test-input-stream) - 7690 (clear-stream $_test-input-buffered-file->buffer) - 7691 (clear-stream _test-output-stream) - 7692 (clear-stream $_test-output-buffered-file->buffer) - 7693 (clear-stream _test-error-stream) - 7694 (clear-stream $_test-error-buffered-file->buffer) - 7695 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7696 68/push 0/imm32 - 7697 68/push 0/imm32 - 7698 89/<- %edx 4/r32/esp - 7699 (tailor-exit-descriptor %edx 0x10) - 7700 # - 7701 (write _test-input-stream "fn foo {\n") - 7702 (write _test-input-stream " var x: int\n") - 7703 (write _test-input-stream " x <- copy 0\n") - 7704 (write _test-input-stream "}\n") - 7705 # convert - 7706 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7707 # registers except esp clobbered at this point - 7708 # restore ed - 7709 89/<- %edx 4/r32/esp - 7710 (flush _test-output-buffered-file) - 7711 (flush _test-error-buffered-file) - 7712 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7718 # check output - 7719 (check-stream-equal _test-output-stream "" "F - test-copy-to-non-register: output should be empty") - 7720 (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") - 7721 # check that stop(1) was called - 7722 (check-ints-equal *(edx+4) 2 "F - test-copy-to-non-register: exit status") - 7723 # don't restore from ebp - 7724 81 0/subop/add %esp 8/imm32 - 7725 # . epilogue - 7726 5d/pop-to-ebp - 7727 c3/return - 7728 - 7729 test-copy-non-scalar: - 7730 # . prologue - 7731 55/push-ebp - 7732 89/<- %ebp 4/r32/esp - 7733 # setup - 7734 (clear-stream _test-input-stream) - 7735 (clear-stream $_test-input-buffered-file->buffer) - 7736 (clear-stream _test-output-stream) - 7737 (clear-stream $_test-output-buffered-file->buffer) - 7738 (clear-stream _test-error-stream) - 7739 (clear-stream $_test-error-buffered-file->buffer) - 7740 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7741 68/push 0/imm32 - 7742 68/push 0/imm32 - 7743 89/<- %edx 4/r32/esp - 7744 (tailor-exit-descriptor %edx 0x10) - 7745 # - 7746 (write _test-input-stream "fn foo {\n") - 7747 (write _test-input-stream " var x: (handle int)\n") - 7748 (write _test-input-stream " var y/eax: int <- copy 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-copy-non-scalar: output should be empty") - 7765 (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") - 7766 # check that stop(1) was called - 7767 (check-ints-equal *(edx+4) 2 "F - test-copy-non-scalar: 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-copy-to-with-no-inout: - 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 (clear-stream _test-error-stream) - 7784 (clear-stream $_test-error-buffered-file->buffer) - 7785 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7786 68/push 0/imm32 - 7787 68/push 0/imm32 - 7788 89/<- %edx 4/r32/esp - 7789 (tailor-exit-descriptor %edx 0x10) - 7790 # - 7791 (write _test-input-stream "fn foo {\n") - 7792 (write _test-input-stream " copy-to\n") - 7793 (write _test-input-stream "}\n") - 7794 # convert - 7795 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7796 # registers except esp clobbered at this point - 7797 # restore ed - 7798 89/<- %edx 4/r32/esp + 7600 (write _test-input-stream " copy 0\n") + 7601 (write _test-input-stream "}\n") + 7602 # convert + 7603 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7604 # registers except esp clobbered at this point + 7605 # restore ed + 7606 89/<- %edx 4/r32/esp + 7607 (flush _test-output-buffered-file) + 7608 (flush _test-error-buffered-file) + 7609 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7615 # check output + 7616 (check-stream-equal _test-output-stream "" "F - test-copy-with-no-output: output should be empty") + 7617 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' expects an output" "F - test-copy-with-no-output: error message") + 7618 # check that stop(1) was called + 7619 (check-ints-equal *(edx+4) 2 "F - test-copy-with-no-output: exit status") + 7620 # don't restore from ebp + 7621 81 0/subop/add %esp 8/imm32 + 7622 # . epilogue + 7623 5d/pop-to-ebp + 7624 c3/return + 7625 + 7626 test-copy-with-multiple-outputs: + 7627 # . prologue + 7628 55/push-ebp + 7629 89/<- %ebp 4/r32/esp + 7630 # setup + 7631 (clear-stream _test-input-stream) + 7632 (clear-stream $_test-input-buffered-file->buffer) + 7633 (clear-stream _test-output-stream) + 7634 (clear-stream $_test-output-buffered-file->buffer) + 7635 (clear-stream _test-error-stream) + 7636 (clear-stream $_test-error-buffered-file->buffer) + 7637 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7638 68/push 0/imm32 + 7639 68/push 0/imm32 + 7640 89/<- %edx 4/r32/esp + 7641 (tailor-exit-descriptor %edx 0x10) + 7642 # + 7643 (write _test-input-stream "fn foo {\n") + 7644 (write _test-input-stream " var x/eax: boolean <- copy 0\n") + 7645 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") + 7646 (write _test-input-stream " x, y <- copy 0\n") + 7647 (write _test-input-stream "}\n") + 7648 # convert + 7649 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7650 # registers except esp clobbered at this point + 7651 # restore ed + 7652 89/<- %edx 4/r32/esp + 7653 (flush _test-output-buffered-file) + 7654 (flush _test-error-buffered-file) + 7655 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7661 # check output + 7662 (check-stream-equal _test-output-stream "" "F - test-copy-with-multiple-outputs: output should be empty") + 7663 (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") + 7664 # check that stop(1) was called + 7665 (check-ints-equal *(edx+4) 2 "F - test-copy-with-multiple-outputs: exit status") + 7666 # don't restore from ebp + 7667 81 0/subop/add %esp 8/imm32 + 7668 # . epilogue + 7669 5d/pop-to-ebp + 7670 c3/return + 7671 + 7672 test-copy-invalid-value-to-address: + 7673 # . prologue + 7674 55/push-ebp + 7675 89/<- %ebp 4/r32/esp + 7676 # setup + 7677 (clear-stream _test-input-stream) + 7678 (clear-stream $_test-input-buffered-file->buffer) + 7679 (clear-stream _test-output-stream) + 7680 (clear-stream $_test-output-buffered-file->buffer) + 7681 (clear-stream _test-error-stream) + 7682 (clear-stream $_test-error-buffered-file->buffer) + 7683 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7684 68/push 0/imm32 + 7685 68/push 0/imm32 + 7686 89/<- %edx 4/r32/esp + 7687 (tailor-exit-descriptor %edx 0x10) + 7688 # + 7689 (write _test-input-stream "fn foo {\n") + 7690 (write _test-input-stream " var x/eax: int <- copy 0\n") + 7691 (write _test-input-stream " var y/ecx: (addr int) <- copy x\n") + 7692 (write _test-input-stream "}\n") + 7693 # convert + 7694 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7695 # registers except esp clobbered at this point + 7696 # restore ed + 7697 89/<- %edx 4/r32/esp + 7698 (flush _test-output-buffered-file) + 7699 (flush _test-error-buffered-file) + 7700 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7706 # check output + 7707 (check-stream-equal _test-output-stream "" "F - test-copy-invalid-value-to-address: output should be empty") + 7708 (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") + 7709 # check that stop(1) was called + 7710 (check-ints-equal *(edx+4) 2 "F - test-copy-invalid-value-to-address: exit status") + 7711 # don't restore from ebp + 7712 81 0/subop/add %esp 8/imm32 + 7713 # . epilogue + 7714 5d/pop-to-ebp + 7715 c3/return + 7716 + 7717 test-copy-null-value-to-address: + 7718 # . prologue + 7719 55/push-ebp + 7720 89/<- %ebp 4/r32/esp + 7721 # setup + 7722 (clear-stream _test-input-stream) + 7723 (clear-stream $_test-input-buffered-file->buffer) + 7724 (clear-stream _test-output-stream) + 7725 (clear-stream $_test-output-buffered-file->buffer) + 7726 # + 7727 (write _test-input-stream "fn foo {\n") + 7728 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") + 7729 (write _test-input-stream "}\n") + 7730 # convert + 7731 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7732 (flush _test-output-buffered-file) + 7733 # no errors + 7734 # . epilogue + 7735 89/<- %esp 5/r32/ebp + 7736 5d/pop-to-ebp + 7737 c3/return + 7738 + 7739 test-copy-invalid-value-to-offset: + 7740 # . prologue + 7741 55/push-ebp + 7742 89/<- %ebp 4/r32/esp + 7743 # setup + 7744 (clear-stream _test-input-stream) + 7745 (clear-stream $_test-input-buffered-file->buffer) + 7746 (clear-stream _test-output-stream) + 7747 (clear-stream $_test-output-buffered-file->buffer) + 7748 (clear-stream _test-error-stream) + 7749 (clear-stream $_test-error-buffered-file->buffer) + 7750 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7751 68/push 0/imm32 + 7752 68/push 0/imm32 + 7753 89/<- %edx 4/r32/esp + 7754 (tailor-exit-descriptor %edx 0x10) + 7755 # + 7756 (write _test-input-stream "fn foo {\n") + 7757 (write _test-input-stream " var x/eax: int <- copy 0\n") + 7758 (write _test-input-stream " var y/ecx: (offset int) <- copy x\n") + 7759 (write _test-input-stream "}\n") + 7760 # convert + 7761 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7762 # registers except esp clobbered at this point + 7763 # restore ed + 7764 89/<- %edx 4/r32/esp + 7765 (flush _test-output-buffered-file) + 7766 (flush _test-error-buffered-file) + 7767 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7773 # check output + 7774 (check-stream-equal _test-output-stream "" "F - test-copy-invalid-value-to-address: output should be empty") + 7775 (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") + 7776 # check that stop(1) was called + 7777 (check-ints-equal *(edx+4) 2 "F - test-copy-invalid-value-to-offset: exit status") + 7778 # don't restore from ebp + 7779 81 0/subop/add %esp 8/imm32 + 7780 # . epilogue + 7781 5d/pop-to-ebp + 7782 c3/return + 7783 + 7784 test-copy-null-value-to-offset: + 7785 # . prologue + 7786 55/push-ebp + 7787 89/<- %ebp 4/r32/esp + 7788 # setup + 7789 (clear-stream _test-input-stream) + 7790 (clear-stream $_test-input-buffered-file->buffer) + 7791 (clear-stream _test-output-stream) + 7792 (clear-stream $_test-output-buffered-file->buffer) + 7793 # + 7794 (write _test-input-stream "fn foo {\n") + 7795 (write _test-input-stream " var y/ecx: (offset int) <- copy 0\n") + 7796 (write _test-input-stream "}\n") + 7797 # convert + 7798 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) 7799 (flush _test-output-buffered-file) - 7800 (flush _test-error-buffered-file) - 7801 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7807 # check output - 7808 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-no-inout: output should be empty") - 7809 (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") - 7810 # check that stop(1) was called - 7811 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-inout: exit status") - 7812 # don't restore from ebp - 7813 81 0/subop/add %esp 8/imm32 - 7814 # . epilogue - 7815 5d/pop-to-ebp - 7816 c3/return - 7817 - 7818 test-copy-to-with-no-input: - 7819 # . prologue - 7820 55/push-ebp - 7821 89/<- %ebp 4/r32/esp - 7822 # setup - 7823 (clear-stream _test-input-stream) - 7824 (clear-stream $_test-input-buffered-file->buffer) - 7825 (clear-stream _test-output-stream) - 7826 (clear-stream $_test-output-buffered-file->buffer) - 7827 (clear-stream _test-error-stream) - 7828 (clear-stream $_test-error-buffered-file->buffer) - 7829 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7830 68/push 0/imm32 - 7831 68/push 0/imm32 - 7832 89/<- %edx 4/r32/esp - 7833 (tailor-exit-descriptor %edx 0x10) - 7834 # - 7835 (write _test-input-stream "fn foo {\n") - 7836 (write _test-input-stream " var x: boolean\n") - 7837 (write _test-input-stream " copy-to x\n") - 7838 (write _test-input-stream "}\n") - 7839 # convert - 7840 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7841 # registers except esp clobbered at this point - 7842 # restore ed - 7843 89/<- %edx 4/r32/esp - 7844 (flush _test-output-buffered-file) - 7845 (flush _test-error-buffered-file) - 7846 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7852 # check output - 7853 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-no-input: output should be empty") - 7854 (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") - 7855 # check that stop(1) was called - 7856 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-input: exit status") - 7857 # don't restore from ebp - 7858 81 0/subop/add %esp 8/imm32 - 7859 # . epilogue - 7860 5d/pop-to-ebp - 7861 c3/return - 7862 - 7863 test-copy-to-with-no-register: - 7864 # . prologue - 7865 55/push-ebp - 7866 89/<- %ebp 4/r32/esp - 7867 # setup - 7868 (clear-stream _test-input-stream) - 7869 (clear-stream $_test-input-buffered-file->buffer) - 7870 (clear-stream _test-output-stream) - 7871 (clear-stream $_test-output-buffered-file->buffer) - 7872 (clear-stream _test-error-stream) - 7873 (clear-stream $_test-error-buffered-file->buffer) - 7874 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7875 68/push 0/imm32 - 7876 68/push 0/imm32 - 7877 89/<- %edx 4/r32/esp - 7878 (tailor-exit-descriptor %edx 0x10) - 7879 # - 7880 (write _test-input-stream "fn foo {\n") - 7881 (write _test-input-stream " var x: boolean\n") - 7882 (write _test-input-stream " copy-to x, x\n") - 7883 (write _test-input-stream "}\n") - 7884 # convert - 7885 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7886 # registers except esp clobbered at this point - 7887 # restore ed - 7888 89/<- %edx 4/r32/esp - 7889 (flush _test-output-buffered-file) - 7890 (flush _test-error-buffered-file) - 7891 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7897 # check output - 7898 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-no-register: output should be empty") - 7899 (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") - 7900 # check that stop(1) was called - 7901 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-register: exit status") - 7902 # don't restore from ebp - 7903 81 0/subop/add %esp 8/imm32 - 7904 # . epilogue - 7905 5d/pop-to-ebp - 7906 c3/return - 7907 - 7908 test-copy-to-with-too-many-inouts: - 7909 # . prologue - 7910 55/push-ebp - 7911 89/<- %ebp 4/r32/esp - 7912 # setup - 7913 (clear-stream _test-input-stream) - 7914 (clear-stream $_test-input-buffered-file->buffer) - 7915 (clear-stream _test-output-stream) - 7916 (clear-stream $_test-output-buffered-file->buffer) - 7917 (clear-stream _test-error-stream) - 7918 (clear-stream $_test-error-buffered-file->buffer) - 7919 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7920 68/push 0/imm32 - 7921 68/push 0/imm32 - 7922 89/<- %edx 4/r32/esp - 7923 (tailor-exit-descriptor %edx 0x10) - 7924 # - 7925 (write _test-input-stream "fn foo {\n") - 7926 (write _test-input-stream " var x: boolean\n") - 7927 (write _test-input-stream " copy-to x, 0, 0\n") - 7928 (write _test-input-stream "}\n") - 7929 # convert - 7930 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7931 # registers except esp clobbered at this point - 7932 # restore ed - 7933 89/<- %edx 4/r32/esp - 7934 (flush _test-output-buffered-file) - 7935 (flush _test-error-buffered-file) - 7936 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7942 # check output - 7943 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-too-many-inouts: output should be empty") - 7944 (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") - 7945 # check that stop(1) was called - 7946 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-too-many-inouts: exit status") - 7947 # don't restore from ebp - 7948 81 0/subop/add %esp 8/imm32 - 7949 # . epilogue - 7950 5d/pop-to-ebp - 7951 c3/return - 7952 - 7953 test-copy-to-with-output: - 7954 # . prologue - 7955 55/push-ebp - 7956 89/<- %ebp 4/r32/esp - 7957 # setup - 7958 (clear-stream _test-input-stream) - 7959 (clear-stream $_test-input-buffered-file->buffer) - 7960 (clear-stream _test-output-stream) - 7961 (clear-stream $_test-output-buffered-file->buffer) - 7962 (clear-stream _test-error-stream) - 7963 (clear-stream $_test-error-buffered-file->buffer) - 7964 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7965 68/push 0/imm32 - 7966 68/push 0/imm32 - 7967 89/<- %edx 4/r32/esp - 7968 (tailor-exit-descriptor %edx 0x10) - 7969 # - 7970 (write _test-input-stream "fn foo {\n") - 7971 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 7972 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") - 7973 (write _test-input-stream " x <- copy-to y, 0\n") - 7974 (write _test-input-stream "}\n") - 7975 # convert - 7976 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7977 # registers except esp clobbered at this point - 7978 # restore ed - 7979 89/<- %edx 4/r32/esp - 7980 (flush _test-output-buffered-file) - 7981 (flush _test-error-buffered-file) - 7982 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 7988 # check output - 7989 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-output: output should be empty") - 7990 (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") - 7991 # check that stop(1) was called - 7992 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-output: exit status") - 7993 # don't restore from ebp - 7994 81 0/subop/add %esp 8/imm32 - 7995 # . epilogue - 7996 5d/pop-to-ebp - 7997 c3/return - 7998 - 7999 test-copy-to-invalid-value-to-address: - 8000 # . prologue - 8001 55/push-ebp - 8002 89/<- %ebp 4/r32/esp - 8003 # setup - 8004 (clear-stream _test-input-stream) - 8005 (clear-stream $_test-input-buffered-file->buffer) - 8006 (clear-stream _test-output-stream) - 8007 (clear-stream $_test-output-buffered-file->buffer) - 8008 (clear-stream _test-error-stream) - 8009 (clear-stream $_test-error-buffered-file->buffer) - 8010 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8011 68/push 0/imm32 - 8012 68/push 0/imm32 - 8013 89/<- %edx 4/r32/esp - 8014 (tailor-exit-descriptor %edx 0x10) - 8015 # - 8016 (write _test-input-stream "fn foo {\n") - 8017 (write _test-input-stream " var x/eax: int <- copy 0\n") - 8018 (write _test-input-stream " var y: (addr int)\n") - 8019 (write _test-input-stream " copy-to y, x\n") - 8020 (write _test-input-stream "}\n") - 8021 # convert - 8022 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8023 # registers except esp clobbered at this point - 8024 # restore ed - 8025 89/<- %edx 4/r32/esp - 8026 (flush _test-output-buffered-file) - 8027 (flush _test-error-buffered-file) - 8028 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8034 # check output - 8035 (check-stream-equal _test-output-stream "" "F - test-copy-to-invalid-value-to-address: output should be empty") - 8036 (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") - 8037 # check that stop(1) was called - 8038 (check-ints-equal *(edx+4) 2 "F - test-copy-to-invalid-value-to-address: exit status") - 8039 # don't restore from ebp - 8040 81 0/subop/add %esp 8/imm32 - 8041 # . epilogue - 8042 5d/pop-to-ebp - 8043 c3/return - 8044 - 8045 test-copy-to-deref-address: - 8046 # . prologue - 8047 55/push-ebp - 8048 89/<- %ebp 4/r32/esp - 8049 # setup - 8050 (clear-stream _test-input-stream) - 8051 (clear-stream $_test-input-buffered-file->buffer) - 8052 (clear-stream _test-output-stream) - 8053 (clear-stream $_test-output-buffered-file->buffer) - 8054 # - 8055 (write _test-input-stream "fn foo {\n") - 8056 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") - 8057 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") - 8058 (write _test-input-stream " copy-to *y, x\n") - 8059 (write _test-input-stream "}\n") - 8060 # convert - 8061 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 8062 (flush _test-output-buffered-file) - 8063 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8069 # not bothering checking output - 8070 (check-next-stream-line-equal _test-error-stream "" "F - test-copy-to-deref-address: error message") - 8071 # . epilogue - 8072 5d/pop-to-ebp - 8073 c3/return - 8074 - 8075 test-copy-to-non-scalar: - 8076 # . prologue - 8077 55/push-ebp - 8078 89/<- %ebp 4/r32/esp - 8079 # setup - 8080 (clear-stream _test-input-stream) - 8081 (clear-stream $_test-input-buffered-file->buffer) - 8082 (clear-stream _test-output-stream) - 8083 (clear-stream $_test-output-buffered-file->buffer) - 8084 (clear-stream _test-error-stream) - 8085 (clear-stream $_test-error-buffered-file->buffer) - 8086 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8087 68/push 0/imm32 - 8088 68/push 0/imm32 - 8089 89/<- %edx 4/r32/esp - 8090 (tailor-exit-descriptor %edx 0x10) - 8091 # - 8092 (write _test-input-stream "fn foo {\n") - 8093 (write _test-input-stream " var x: (handle int)\n") - 8094 (write _test-input-stream " var y: int\n") - 8095 (write _test-input-stream " copy-to y, x\n") - 8096 (write _test-input-stream "}\n") - 8097 # convert - 8098 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8099 # registers except esp clobbered at this point - 8100 # restore ed - 8101 89/<- %edx 4/r32/esp - 8102 (flush _test-output-buffered-file) - 8103 (flush _test-error-buffered-file) - 8104 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8110 # check output - 8111 (check-stream-equal _test-output-stream "" "F - test-copy-to-non-scalar: output should be empty") - 8112 #? (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") - 8113 (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") - 8114 # check that stop(1) was called - 8115 (check-ints-equal *(edx+4) 2 "F - test-copy-to-non-scalar: exit status") - 8116 # don't restore from ebp - 8117 81 0/subop/add %esp 8/imm32 - 8118 # . epilogue - 8119 5d/pop-to-ebp - 8120 c3/return - 8121 - 8122 test-compare-with-no-inout: - 8123 # . prologue - 8124 55/push-ebp - 8125 89/<- %ebp 4/r32/esp - 8126 # setup - 8127 (clear-stream _test-input-stream) - 8128 (clear-stream $_test-input-buffered-file->buffer) - 8129 (clear-stream _test-output-stream) - 8130 (clear-stream $_test-output-buffered-file->buffer) - 8131 (clear-stream _test-error-stream) - 8132 (clear-stream $_test-error-buffered-file->buffer) - 8133 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8134 68/push 0/imm32 - 8135 68/push 0/imm32 - 8136 89/<- %edx 4/r32/esp - 8137 (tailor-exit-descriptor %edx 0x10) - 8138 # - 8139 (write _test-input-stream "fn foo {\n") - 8140 (write _test-input-stream " var x: boolean\n") - 8141 (write _test-input-stream " compare\n") - 8142 (write _test-input-stream "}\n") - 8143 # convert - 8144 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8145 # registers except esp clobbered at this point - 8146 # restore ed - 8147 89/<- %edx 4/r32/esp - 8148 (flush _test-output-buffered-file) - 8149 (flush _test-error-buffered-file) - 8150 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8156 # check output - 8157 (check-stream-equal _test-output-stream "" "F - test-compare-with-no-inout: output should be empty") - 8158 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must have two inouts" "F - test-compare-with-no-inout: error message") - 8159 # check that stop(1) was called - 8160 (check-ints-equal *(edx+4) 2 "F - test-compare-with-no-inout: exit status") - 8161 # don't restore from ebp - 8162 81 0/subop/add %esp 8/imm32 - 8163 # . epilogue - 8164 5d/pop-to-ebp - 8165 c3/return - 8166 - 8167 test-compare-with-no-input: - 8168 # . prologue - 8169 55/push-ebp - 8170 89/<- %ebp 4/r32/esp - 8171 # setup - 8172 (clear-stream _test-input-stream) - 8173 (clear-stream $_test-input-buffered-file->buffer) - 8174 (clear-stream _test-output-stream) - 8175 (clear-stream $_test-output-buffered-file->buffer) - 8176 (clear-stream _test-error-stream) - 8177 (clear-stream $_test-error-buffered-file->buffer) - 8178 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8179 68/push 0/imm32 - 8180 68/push 0/imm32 - 8181 89/<- %edx 4/r32/esp - 8182 (tailor-exit-descriptor %edx 0x10) - 8183 # - 8184 (write _test-input-stream "fn foo {\n") - 8185 (write _test-input-stream " var x: boolean\n") - 8186 (write _test-input-stream " compare x\n") - 8187 (write _test-input-stream "}\n") - 8188 # convert - 8189 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8190 # registers except esp clobbered at this point - 8191 # restore ed - 8192 89/<- %edx 4/r32/esp - 8193 (flush _test-output-buffered-file) - 8194 (flush _test-error-buffered-file) - 8195 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8201 # check output - 8202 (check-stream-equal _test-output-stream "" "F - test-compare-with-no-input: output should be empty") - 8203 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must have two inouts" "F - test-compare-with-no-input: error message") - 8204 # check that stop(1) was called - 8205 (check-ints-equal *(edx+4) 2 "F - test-compare-with-no-input: exit status") - 8206 # don't restore from ebp - 8207 81 0/subop/add %esp 8/imm32 - 8208 # . epilogue - 8209 5d/pop-to-ebp - 8210 c3/return - 8211 - 8212 test-compare-with-too-many-inouts: - 8213 # . prologue - 8214 55/push-ebp - 8215 89/<- %ebp 4/r32/esp - 8216 # setup - 8217 (clear-stream _test-input-stream) - 8218 (clear-stream $_test-input-buffered-file->buffer) - 8219 (clear-stream _test-output-stream) - 8220 (clear-stream $_test-output-buffered-file->buffer) - 8221 (clear-stream _test-error-stream) - 8222 (clear-stream $_test-error-buffered-file->buffer) - 8223 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8224 68/push 0/imm32 - 8225 68/push 0/imm32 - 8226 89/<- %edx 4/r32/esp - 8227 (tailor-exit-descriptor %edx 0x10) - 8228 # - 8229 (write _test-input-stream "fn foo {\n") - 8230 (write _test-input-stream " var x: boolean\n") - 8231 (write _test-input-stream " compare x, 0, 0\n") - 8232 (write _test-input-stream "}\n") - 8233 # convert - 8234 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8235 # registers except esp clobbered at this point - 8236 # restore ed - 8237 89/<- %edx 4/r32/esp - 8238 (flush _test-output-buffered-file) - 8239 (flush _test-error-buffered-file) - 8240 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8246 # check output - 8247 (check-stream-equal _test-output-stream "" "F - test-compare-with-too-many-inouts: output should be empty") - 8248 (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") - 8249 # check that stop(1) was called - 8250 (check-ints-equal *(edx+4) 2 "F - test-compare-with-too-many-inouts: exit status") - 8251 # don't restore from ebp - 8252 81 0/subop/add %esp 8/imm32 - 8253 # . epilogue - 8254 5d/pop-to-ebp - 8255 c3/return - 8256 - 8257 test-compare-with-output: - 8258 # . prologue - 8259 55/push-ebp - 8260 89/<- %ebp 4/r32/esp - 8261 # setup - 8262 (clear-stream _test-input-stream) - 8263 (clear-stream $_test-input-buffered-file->buffer) - 8264 (clear-stream _test-output-stream) - 8265 (clear-stream $_test-output-buffered-file->buffer) - 8266 (clear-stream _test-error-stream) - 8267 (clear-stream $_test-error-buffered-file->buffer) - 8268 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8269 68/push 0/imm32 - 8270 68/push 0/imm32 - 8271 89/<- %edx 4/r32/esp - 8272 (tailor-exit-descriptor %edx 0x10) - 8273 # - 8274 (write _test-input-stream "fn foo {\n") - 8275 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 8276 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") - 8277 (write _test-input-stream " x <- compare y, 0\n") - 8278 (write _test-input-stream "}\n") - 8279 # convert - 8280 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8281 # registers except esp clobbered at this point - 8282 # restore ed - 8283 89/<- %edx 4/r32/esp - 8284 (flush _test-output-buffered-file) - 8285 (flush _test-error-buffered-file) - 8286 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8292 # check output - 8293 (check-stream-equal _test-output-stream "" "F - test-compare-with-output: output should be empty") - 8294 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must not have any outputs" "F - test-compare-with-output: error message") - 8295 # check that stop(1) was called - 8296 (check-ints-equal *(edx+4) 2 "F - test-compare-with-output: exit status") - 8297 # don't restore from ebp - 8298 81 0/subop/add %esp 8/imm32 - 8299 # . epilogue - 8300 5d/pop-to-ebp - 8301 c3/return - 8302 - 8303 test-compare-invalid-value-to-address: - 8304 # . prologue - 8305 55/push-ebp - 8306 89/<- %ebp 4/r32/esp - 8307 # setup - 8308 (clear-stream _test-input-stream) - 8309 (clear-stream $_test-input-buffered-file->buffer) - 8310 (clear-stream _test-output-stream) - 8311 (clear-stream $_test-output-buffered-file->buffer) - 8312 (clear-stream _test-error-stream) - 8313 (clear-stream $_test-error-buffered-file->buffer) - 8314 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8315 68/push 0/imm32 - 8316 68/push 0/imm32 - 8317 89/<- %edx 4/r32/esp - 8318 (tailor-exit-descriptor %edx 0x10) - 8319 # - 8320 (write _test-input-stream "fn foo {\n") - 8321 (write _test-input-stream " var x/eax: int <- copy 0\n") - 8322 (write _test-input-stream " var y: (addr int)\n") - 8323 (write _test-input-stream " compare y, x\n") - 8324 (write _test-input-stream "}\n") - 8325 # convert - 8326 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8327 # registers except esp clobbered at this point - 8328 # restore ed - 8329 89/<- %edx 4/r32/esp - 8330 (flush _test-output-buffered-file) - 8331 (flush _test-error-buffered-file) - 8332 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8338 # check output - 8339 (check-stream-equal _test-output-stream "" "F - test-compare-invalid-value-to-address: output should be empty") - 8340 (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") - 8341 # check that stop(1) was called - 8342 (check-ints-equal *(edx+4) 2 "F - test-compare-invalid-value-to-address: exit status") - 8343 # don't restore from ebp - 8344 81 0/subop/add %esp 8/imm32 - 8345 # . epilogue - 8346 5d/pop-to-ebp - 8347 c3/return - 8348 - 8349 test-compare-address: - 8350 # . prologue - 8351 55/push-ebp - 8352 89/<- %ebp 4/r32/esp - 8353 # setup - 8354 (clear-stream _test-input-stream) - 8355 (clear-stream $_test-input-buffered-file->buffer) - 8356 (clear-stream _test-output-stream) - 8357 (clear-stream $_test-output-buffered-file->buffer) - 8358 # - 8359 (write _test-input-stream "fn foo {\n") - 8360 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") - 8361 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") - 8362 (write _test-input-stream " compare y, x\n") - 8363 (write _test-input-stream "}\n") - 8364 # convert - 8365 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 8366 (flush _test-output-buffered-file) - 8367 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8373 # not bothering checking output - 8374 (check-next-stream-line-equal _test-error-stream "" "F - test-compare-address: error message") - 8375 # . epilogue - 8376 5d/pop-to-ebp - 8377 c3/return - 8378 - 8379 test-compare-deref-address: - 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 # - 8389 (write _test-input-stream "fn foo {\n") - 8390 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") - 8391 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") - 8392 (write _test-input-stream " compare *y, x\n") - 8393 (write _test-input-stream "}\n") - 8394 # convert - 8395 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 8396 (flush _test-output-buffered-file) - 8397 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8403 # not bothering checking output - 8404 (check-next-stream-line-equal _test-error-stream "" "F - test-compare-deref-address: error message") - 8405 # . epilogue - 8406 5d/pop-to-ebp - 8407 c3/return - 8408 - 8409 test-compare-two-vars-in-memory: - 8410 # . prologue - 8411 55/push-ebp - 8412 89/<- %ebp 4/r32/esp - 8413 # setup - 8414 (clear-stream _test-input-stream) - 8415 (clear-stream $_test-input-buffered-file->buffer) - 8416 (clear-stream _test-output-stream) - 8417 (clear-stream $_test-output-buffered-file->buffer) - 8418 (clear-stream _test-error-stream) - 8419 (clear-stream $_test-error-buffered-file->buffer) - 8420 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8421 68/push 0/imm32 - 8422 68/push 0/imm32 - 8423 89/<- %edx 4/r32/esp - 8424 (tailor-exit-descriptor %edx 0x10) - 8425 # - 8426 (write _test-input-stream "fn foo {\n") - 8427 (write _test-input-stream " var x: boolean\n") - 8428 (write _test-input-stream " compare x, x\n") - 8429 (write _test-input-stream "}\n") - 8430 # convert - 8431 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8432 # registers except esp clobbered at this point - 8433 # restore ed - 8434 89/<- %edx 4/r32/esp - 8435 (flush _test-output-buffered-file) - 8436 (flush _test-error-buffered-file) - 8437 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8443 # check output - 8444 (check-stream-equal _test-output-stream "" "F - test-compare-two-vars-in-memory: output should be empty") - 8445 (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") - 8446 # check that stop(1) was called - 8447 (check-ints-equal *(edx+4) 2 "F - test-compare-two-vars-in-memory: exit status") - 8448 # don't restore from ebp - 8449 81 0/subop/add %esp 8/imm32 - 8450 # . epilogue - 8451 5d/pop-to-ebp - 8452 c3/return - 8453 - 8454 test-compare-non-scalar: - 8455 # . prologue - 8456 55/push-ebp - 8457 89/<- %ebp 4/r32/esp - 8458 # setup - 8459 (clear-stream _test-input-stream) - 8460 (clear-stream $_test-input-buffered-file->buffer) - 8461 (clear-stream _test-output-stream) - 8462 (clear-stream $_test-output-buffered-file->buffer) - 8463 (clear-stream _test-error-stream) - 8464 (clear-stream $_test-error-buffered-file->buffer) - 8465 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8466 68/push 0/imm32 - 8467 68/push 0/imm32 - 8468 89/<- %edx 4/r32/esp - 8469 (tailor-exit-descriptor %edx 0x10) - 8470 # - 8471 (write _test-input-stream "fn foo {\n") - 8472 (write _test-input-stream " var x: (handle int)\n") - 8473 (write _test-input-stream " var y: int\n") - 8474 (write _test-input-stream " compare y, x\n") - 8475 (write _test-input-stream "}\n") - 8476 # convert - 8477 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8478 # registers except esp clobbered at this point - 8479 # restore ed - 8480 89/<- %edx 4/r32/esp - 8481 (flush _test-output-buffered-file) - 8482 (flush _test-error-buffered-file) - 8483 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8489 # check output - 8490 (check-stream-equal _test-output-stream "" "F - test-compare-non-scalar: output should be empty") - 8491 #? (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") - 8492 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compare: both inouts are in memory" "F - test-compare-non-scalar: error message") - 8493 # check that stop(1) was called - 8494 (check-ints-equal *(edx+4) 2 "F - test-compare-non-scalar: exit status") - 8495 # don't restore from ebp - 8496 81 0/subop/add %esp 8/imm32 - 8497 # . epilogue - 8498 5d/pop-to-ebp - 8499 c3/return - 8500 - 8501 test-address-with-no-inout: - 8502 # . prologue - 8503 55/push-ebp - 8504 89/<- %ebp 4/r32/esp - 8505 # setup - 8506 (clear-stream _test-input-stream) - 8507 (clear-stream $_test-input-buffered-file->buffer) - 8508 (clear-stream _test-output-stream) - 8509 (clear-stream $_test-output-buffered-file->buffer) - 8510 (clear-stream _test-error-stream) - 8511 (clear-stream $_test-error-buffered-file->buffer) - 8512 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8513 68/push 0/imm32 - 8514 68/push 0/imm32 + 7800 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7806 # no errors + 7807 # . epilogue + 7808 89/<- %esp 5/r32/ebp + 7809 5d/pop-to-ebp + 7810 c3/return + 7811 + 7812 test-copy-non-literal-to-byte: + 7813 # . prologue + 7814 55/push-ebp + 7815 89/<- %ebp 4/r32/esp + 7816 # setup + 7817 (clear-stream _test-input-stream) + 7818 (clear-stream $_test-input-buffered-file->buffer) + 7819 (clear-stream _test-output-stream) + 7820 (clear-stream $_test-output-buffered-file->buffer) + 7821 (clear-stream _test-error-stream) + 7822 (clear-stream $_test-error-buffered-file->buffer) + 7823 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7824 68/push 0/imm32 + 7825 68/push 0/imm32 + 7826 89/<- %edx 4/r32/esp + 7827 (tailor-exit-descriptor %edx 0x10) + 7828 # + 7829 (write _test-input-stream "fn foo {\n") + 7830 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 7831 (write _test-input-stream " var y/ecx: byte <- copy x\n") + 7832 (write _test-input-stream "}\n") + 7833 # convert + 7834 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7835 # registers except esp clobbered at this point + 7836 # restore ed + 7837 89/<- %edx 4/r32/esp + 7838 (flush _test-output-buffered-file) + 7839 (flush _test-error-buffered-file) + 7840 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7846 # check output + 7847 (check-stream-equal _test-output-stream "" "F - test-copy-non-literal-to-byte: output should be empty") + 7848 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy: cannot copy non-literal to 'y' of type byte; use copy-byte" "F - test-copy-non-literal-to-byte: error message") + 7849 # check that stop(1) was called + 7850 (check-ints-equal *(edx+4) 2 "F - test-copy-non-literal-to-byte: exit status") + 7851 # don't restore from ebp + 7852 81 0/subop/add %esp 8/imm32 + 7853 # . epilogue + 7854 5d/pop-to-ebp + 7855 c3/return + 7856 + 7857 test-copy-deref-address: + 7858 # . prologue + 7859 55/push-ebp + 7860 89/<- %ebp 4/r32/esp + 7861 # setup + 7862 (clear-stream _test-input-stream) + 7863 (clear-stream $_test-input-buffered-file->buffer) + 7864 (clear-stream _test-output-stream) + 7865 (clear-stream $_test-output-buffered-file->buffer) + 7866 # + 7867 (write _test-input-stream "fn foo {\n") + 7868 (write _test-input-stream " var x/eax: (addr addr int) <- copy 0\n") + 7869 (write _test-input-stream " var y/ecx: (addr int) <- copy *x\n") + 7870 (write _test-input-stream "}\n") + 7871 # convert + 7872 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7873 (flush _test-output-buffered-file) + 7874 # no errors + 7875 # . epilogue + 7876 5d/pop-to-ebp + 7877 c3/return + 7878 + 7879 test-copy-to-non-register: + 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: int\n") + 7898 (write _test-input-stream " x <- copy 0\n") + 7899 (write _test-input-stream "}\n") + 7900 # convert + 7901 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7902 # registers except esp clobbered at this point + 7903 # restore ed + 7904 89/<- %edx 4/r32/esp + 7905 (flush _test-output-buffered-file) + 7906 (flush _test-error-buffered-file) + 7907 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7913 # check output + 7914 (check-stream-equal _test-output-stream "" "F - test-copy-to-non-register: output should be empty") + 7915 (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") + 7916 # check that stop(1) was called + 7917 (check-ints-equal *(edx+4) 2 "F - test-copy-to-non-register: exit status") + 7918 # don't restore from ebp + 7919 81 0/subop/add %esp 8/imm32 + 7920 # . epilogue + 7921 5d/pop-to-ebp + 7922 c3/return + 7923 + 7924 test-copy-from-non-scalar-inout: + 7925 # . prologue + 7926 55/push-ebp + 7927 89/<- %ebp 4/r32/esp + 7928 # setup + 7929 (clear-stream _test-input-stream) + 7930 (clear-stream $_test-input-buffered-file->buffer) + 7931 (clear-stream _test-output-stream) + 7932 (clear-stream $_test-output-buffered-file->buffer) + 7933 (clear-stream _test-error-stream) + 7934 (clear-stream $_test-error-buffered-file->buffer) + 7935 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7936 68/push 0/imm32 + 7937 68/push 0/imm32 + 7938 89/<- %edx 4/r32/esp + 7939 (tailor-exit-descriptor %edx 0x10) + 7940 # + 7941 (write _test-input-stream "fn foo {\n") + 7942 (write _test-input-stream " var x: (handle int)\n") + 7943 (write _test-input-stream " var y/eax: int <- copy x\n") + 7944 (write _test-input-stream "}\n") + 7945 # convert + 7946 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7947 # registers except esp clobbered at this point + 7948 # restore ed + 7949 89/<- %edx 4/r32/esp + 7950 (flush _test-output-buffered-file) + 7951 (flush _test-error-buffered-file) + 7952 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 7958 # check output + 7959 (check-stream-equal _test-output-stream "" "F - test-copy-from-non-scalar-inout: output should be empty") + 7960 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy: 'x' is too large to fit in a register" "F - test-copy-from-non-scalar-inout: error message") + 7961 # check that stop(1) was called + 7962 (check-ints-equal *(edx+4) 2 "F - test-copy-from-non-scalar-inout: exit status") + 7963 # don't restore from ebp + 7964 81 0/subop/add %esp 8/imm32 + 7965 # . epilogue + 7966 5d/pop-to-ebp + 7967 c3/return + 7968 + 7969 test-copy-to-with-no-inout: + 7970 # . prologue + 7971 55/push-ebp + 7972 89/<- %ebp 4/r32/esp + 7973 # setup + 7974 (clear-stream _test-input-stream) + 7975 (clear-stream $_test-input-buffered-file->buffer) + 7976 (clear-stream _test-output-stream) + 7977 (clear-stream $_test-output-buffered-file->buffer) + 7978 (clear-stream _test-error-stream) + 7979 (clear-stream $_test-error-buffered-file->buffer) + 7980 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7981 68/push 0/imm32 + 7982 68/push 0/imm32 + 7983 89/<- %edx 4/r32/esp + 7984 (tailor-exit-descriptor %edx 0x10) + 7985 # + 7986 (write _test-input-stream "fn foo {\n") + 7987 (write _test-input-stream " copy-to\n") + 7988 (write _test-input-stream "}\n") + 7989 # convert + 7990 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7991 # registers except esp clobbered at this point + 7992 # restore ed + 7993 89/<- %edx 4/r32/esp + 7994 (flush _test-output-buffered-file) + 7995 (flush _test-error-buffered-file) + 7996 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8002 # check output + 8003 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-no-inout: output should be empty") + 8004 (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") + 8005 # check that stop(1) was called + 8006 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-inout: exit status") + 8007 # don't restore from ebp + 8008 81 0/subop/add %esp 8/imm32 + 8009 # . epilogue + 8010 5d/pop-to-ebp + 8011 c3/return + 8012 + 8013 test-copy-to-with-no-source: + 8014 # . prologue + 8015 55/push-ebp + 8016 89/<- %ebp 4/r32/esp + 8017 # setup + 8018 (clear-stream _test-input-stream) + 8019 (clear-stream $_test-input-buffered-file->buffer) + 8020 (clear-stream _test-output-stream) + 8021 (clear-stream $_test-output-buffered-file->buffer) + 8022 (clear-stream _test-error-stream) + 8023 (clear-stream $_test-error-buffered-file->buffer) + 8024 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8025 68/push 0/imm32 + 8026 68/push 0/imm32 + 8027 89/<- %edx 4/r32/esp + 8028 (tailor-exit-descriptor %edx 0x10) + 8029 # + 8030 (write _test-input-stream "fn foo {\n") + 8031 (write _test-input-stream " var x: boolean\n") + 8032 (write _test-input-stream " copy-to x\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-copy-to-with-no-source: output should be empty") + 8049 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-to' must have two inouts" "F - test-copy-to-with-no-source: error message") + 8050 # check that stop(1) was called + 8051 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-source: 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-copy-to-with-no-register: + 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: boolean\n") + 8077 (write _test-input-stream " copy-to x, x\n") + 8078 (write _test-input-stream "}\n") + 8079 # convert + 8080 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8081 # registers except esp clobbered at this point + 8082 # restore ed + 8083 89/<- %edx 4/r32/esp + 8084 (flush _test-output-buffered-file) + 8085 (flush _test-error-buffered-file) + 8086 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8092 # check output + 8093 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-no-register: output should be empty") + 8094 (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") + 8095 # check that stop(1) was called + 8096 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-register: exit status") + 8097 # don't restore from ebp + 8098 81 0/subop/add %esp 8/imm32 + 8099 # . epilogue + 8100 5d/pop-to-ebp + 8101 c3/return + 8102 + 8103 test-copy-to-with-too-many-inouts: + 8104 # . prologue + 8105 55/push-ebp + 8106 89/<- %ebp 4/r32/esp + 8107 # setup + 8108 (clear-stream _test-input-stream) + 8109 (clear-stream $_test-input-buffered-file->buffer) + 8110 (clear-stream _test-output-stream) + 8111 (clear-stream $_test-output-buffered-file->buffer) + 8112 (clear-stream _test-error-stream) + 8113 (clear-stream $_test-error-buffered-file->buffer) + 8114 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8115 68/push 0/imm32 + 8116 68/push 0/imm32 + 8117 89/<- %edx 4/r32/esp + 8118 (tailor-exit-descriptor %edx 0x10) + 8119 # + 8120 (write _test-input-stream "fn foo {\n") + 8121 (write _test-input-stream " var x: boolean\n") + 8122 (write _test-input-stream " copy-to x, 0, 0\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-copy-to-with-too-many-inouts: output should be empty") + 8139 (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") + 8140 # check that stop(1) was called + 8141 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-too-many-inouts: 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-copy-to-with-output: + 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 x/eax: boolean <- copy 0\n") + 8167 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") + 8168 (write _test-input-stream " x <- copy-to y, 0\n") + 8169 (write _test-input-stream "}\n") + 8170 # convert + 8171 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8172 # registers except esp clobbered at this point + 8173 # restore ed + 8174 89/<- %edx 4/r32/esp + 8175 (flush _test-output-buffered-file) + 8176 (flush _test-error-buffered-file) + 8177 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8183 # check output + 8184 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-output: output should be empty") + 8185 (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") + 8186 # check that stop(1) was called + 8187 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-output: exit status") + 8188 # don't restore from ebp + 8189 81 0/subop/add %esp 8/imm32 + 8190 # . epilogue + 8191 5d/pop-to-ebp + 8192 c3/return + 8193 + 8194 test-copy-to-invalid-value-to-address: + 8195 # . prologue + 8196 55/push-ebp + 8197 89/<- %ebp 4/r32/esp + 8198 # setup + 8199 (clear-stream _test-input-stream) + 8200 (clear-stream $_test-input-buffered-file->buffer) + 8201 (clear-stream _test-output-stream) + 8202 (clear-stream $_test-output-buffered-file->buffer) + 8203 (clear-stream _test-error-stream) + 8204 (clear-stream $_test-error-buffered-file->buffer) + 8205 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8206 68/push 0/imm32 + 8207 68/push 0/imm32 + 8208 89/<- %edx 4/r32/esp + 8209 (tailor-exit-descriptor %edx 0x10) + 8210 # + 8211 (write _test-input-stream "fn foo {\n") + 8212 (write _test-input-stream " var x/eax: int <- copy 0\n") + 8213 (write _test-input-stream " var y: (addr int)\n") + 8214 (write _test-input-stream " copy-to y, x\n") + 8215 (write _test-input-stream "}\n") + 8216 # convert + 8217 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8218 # registers except esp clobbered at this point + 8219 # restore ed + 8220 89/<- %edx 4/r32/esp + 8221 (flush _test-output-buffered-file) + 8222 (flush _test-error-buffered-file) + 8223 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8229 # check output + 8230 (check-stream-equal _test-output-stream "" "F - test-copy-to-invalid-value-to-address: output should be empty") + 8231 (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") + 8232 # check that stop(1) was called + 8233 (check-ints-equal *(edx+4) 2 "F - test-copy-to-invalid-value-to-address: exit status") + 8234 # don't restore from ebp + 8235 81 0/subop/add %esp 8/imm32 + 8236 # . epilogue + 8237 5d/pop-to-ebp + 8238 c3/return + 8239 + 8240 test-copy-to-null-value-to-address: + 8241 # . prologue + 8242 55/push-ebp + 8243 89/<- %ebp 4/r32/esp + 8244 # setup + 8245 (clear-stream _test-input-stream) + 8246 (clear-stream $_test-input-buffered-file->buffer) + 8247 (clear-stream _test-output-stream) + 8248 (clear-stream $_test-output-buffered-file->buffer) + 8249 # + 8250 (write _test-input-stream "fn foo {\n") + 8251 (write _test-input-stream " var y: (addr int)\n") + 8252 (write _test-input-stream " copy-to y, 0\n") + 8253 (write _test-input-stream "}\n") + 8254 # convert + 8255 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 8256 (flush _test-output-buffered-file) + 8257 # no errors + 8258 # . epilogue + 8259 89/<- %esp 5/r32/ebp + 8260 5d/pop-to-ebp + 8261 c3/return + 8262 + 8263 test-copy-to-invalid-value-to-offset: + 8264 # . prologue + 8265 55/push-ebp + 8266 89/<- %ebp 4/r32/esp + 8267 # setup + 8268 (clear-stream _test-input-stream) + 8269 (clear-stream $_test-input-buffered-file->buffer) + 8270 (clear-stream _test-output-stream) + 8271 (clear-stream $_test-output-buffered-file->buffer) + 8272 (clear-stream _test-error-stream) + 8273 (clear-stream $_test-error-buffered-file->buffer) + 8274 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8275 68/push 0/imm32 + 8276 68/push 0/imm32 + 8277 89/<- %edx 4/r32/esp + 8278 (tailor-exit-descriptor %edx 0x10) + 8279 # + 8280 (write _test-input-stream "fn foo {\n") + 8281 (write _test-input-stream " var x/eax: int <- copy 0\n") + 8282 (write _test-input-stream " var y: (offset int)\n") + 8283 (write _test-input-stream " copy-to y, x\n") + 8284 (write _test-input-stream "}\n") + 8285 # convert + 8286 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8287 # registers except esp clobbered at this point + 8288 # restore ed + 8289 89/<- %edx 4/r32/esp + 8290 (flush _test-output-buffered-file) + 8291 (flush _test-error-buffered-file) + 8292 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8298 # check output + 8299 (check-stream-equal _test-output-stream "" "F - test-copy-to-invalid-value-to-offset: output should be empty") + 8300 (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-offset: error message") + 8301 # check that stop(1) was called + 8302 (check-ints-equal *(edx+4) 2 "F - test-copy-to-invalid-value-to-offset: exit status") + 8303 # don't restore from ebp + 8304 81 0/subop/add %esp 8/imm32 + 8305 # . epilogue + 8306 5d/pop-to-ebp + 8307 c3/return + 8308 + 8309 test-copy-to-null-value-to-offset: + 8310 # . prologue + 8311 55/push-ebp + 8312 89/<- %ebp 4/r32/esp + 8313 # setup + 8314 (clear-stream _test-input-stream) + 8315 (clear-stream $_test-input-buffered-file->buffer) + 8316 (clear-stream _test-output-stream) + 8317 (clear-stream $_test-output-buffered-file->buffer) + 8318 # + 8319 (write _test-input-stream "fn foo {\n") + 8320 (write _test-input-stream " var y: (offset int)\n") + 8321 (write _test-input-stream " copy-to y, 0\n") + 8322 (write _test-input-stream "}\n") + 8323 # convert + 8324 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 8325 (flush _test-output-buffered-file) + 8326 # no errors + 8327 # . epilogue + 8328 89/<- %esp 5/r32/ebp + 8329 5d/pop-to-ebp + 8330 c3/return + 8331 + 8332 test-copy-to-non-literal-to-byte: + 8333 # . prologue + 8334 55/push-ebp + 8335 89/<- %ebp 4/r32/esp + 8336 # setup + 8337 (clear-stream _test-input-stream) + 8338 (clear-stream $_test-input-buffered-file->buffer) + 8339 (clear-stream _test-output-stream) + 8340 (clear-stream $_test-output-buffered-file->buffer) + 8341 (clear-stream _test-error-stream) + 8342 (clear-stream $_test-error-buffered-file->buffer) + 8343 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8344 68/push 0/imm32 + 8345 68/push 0/imm32 + 8346 89/<- %edx 4/r32/esp + 8347 (tailor-exit-descriptor %edx 0x10) + 8348 # + 8349 (write _test-input-stream "fn foo {\n") + 8350 (write _test-input-stream " var x/ecx: byte <- copy 3\n") + 8351 (write _test-input-stream " var y/eax: (addr byte) <- copy 0\n") + 8352 (write _test-input-stream " copy-to *y, x\n") + 8353 (write _test-input-stream "}\n") + 8354 # convert + 8355 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8356 # registers except esp clobbered at this point + 8357 # restore ed + 8358 89/<- %edx 4/r32/esp + 8359 (flush _test-output-buffered-file) + 8360 (flush _test-error-buffered-file) + 8361 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8367 # check output + 8368 (check-stream-equal _test-output-stream "" "F - test-copy-to-non-literal-to-byte: output should be empty") + 8369 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-to: cannot copy non-literal to type byte; use copy-byte-to" "F - test-copy-to-non-literal-to-byte: error message") + 8370 # check that stop(1) was called + 8371 (check-ints-equal *(edx+4) 2 "F - test-copy-to-non-literal-to-byte: exit status") + 8372 # don't restore from ebp + 8373 81 0/subop/add %esp 8/imm32 + 8374 # . epilogue + 8375 5d/pop-to-ebp + 8376 c3/return + 8377 + 8378 test-copy-to-deref-address: + 8379 # . prologue + 8380 55/push-ebp + 8381 89/<- %ebp 4/r32/esp + 8382 # setup + 8383 (clear-stream _test-input-stream) + 8384 (clear-stream $_test-input-buffered-file->buffer) + 8385 (clear-stream _test-output-stream) + 8386 (clear-stream $_test-output-buffered-file->buffer) + 8387 # + 8388 (write _test-input-stream "fn foo {\n") + 8389 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") + 8390 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") + 8391 (write _test-input-stream " copy-to *y, x\n") + 8392 (write _test-input-stream "}\n") + 8393 # convert + 8394 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 8395 (flush _test-output-buffered-file) + 8396 # no errors + 8397 # . epilogue + 8398 5d/pop-to-ebp + 8399 c3/return + 8400 + 8401 test-copy-to-from-non-scalar-inout: + 8402 # . prologue + 8403 55/push-ebp + 8404 89/<- %ebp 4/r32/esp + 8405 # setup + 8406 (clear-stream _test-input-stream) + 8407 (clear-stream $_test-input-buffered-file->buffer) + 8408 (clear-stream _test-output-stream) + 8409 (clear-stream $_test-output-buffered-file->buffer) + 8410 (clear-stream _test-error-stream) + 8411 (clear-stream $_test-error-buffered-file->buffer) + 8412 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8413 68/push 0/imm32 + 8414 68/push 0/imm32 + 8415 89/<- %edx 4/r32/esp + 8416 (tailor-exit-descriptor %edx 0x10) + 8417 # + 8418 (write _test-input-stream "fn foo {\n") + 8419 (write _test-input-stream " var x: (handle int)\n") + 8420 (write _test-input-stream " var y: int\n") + 8421 (write _test-input-stream " copy-to y, x\n") + 8422 (write _test-input-stream "}\n") + 8423 # convert + 8424 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8425 # registers except esp clobbered at this point + 8426 # restore ed + 8427 89/<- %edx 4/r32/esp + 8428 (flush _test-output-buffered-file) + 8429 (flush _test-error-buffered-file) + 8430 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8436 # check output + 8437 (check-stream-equal _test-output-stream "" "F - test-copy-to-from-non-scalar-inout: output should be empty") + 8438 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-to: 'x' is too large to copy" "F - test-copy-to-from-non-scalar-inout: error message") + 8439 # check that stop(1) was called + 8440 (check-ints-equal *(edx+4) 2 "F - test-copy-to-from-non-scalar-inout: exit status") + 8441 # don't restore from ebp + 8442 81 0/subop/add %esp 8/imm32 + 8443 # . epilogue + 8444 5d/pop-to-ebp + 8445 c3/return + 8446 + 8447 test-copy-byte-with-no-inout: + 8448 # . prologue + 8449 55/push-ebp + 8450 89/<- %ebp 4/r32/esp + 8451 # setup + 8452 (clear-stream _test-input-stream) + 8453 (clear-stream $_test-input-buffered-file->buffer) + 8454 (clear-stream _test-output-stream) + 8455 (clear-stream $_test-output-buffered-file->buffer) + 8456 (clear-stream _test-error-stream) + 8457 (clear-stream $_test-error-buffered-file->buffer) + 8458 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8459 68/push 0/imm32 + 8460 68/push 0/imm32 + 8461 89/<- %edx 4/r32/esp + 8462 (tailor-exit-descriptor %edx 0x10) + 8463 # + 8464 (write _test-input-stream "fn foo {\n") + 8465 (write _test-input-stream " var x/eax: byte <- copy-byte\n") + 8466 (write _test-input-stream "}\n") + 8467 # convert + 8468 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8469 # registers except esp clobbered at this point + 8470 # restore ed + 8471 89/<- %edx 4/r32/esp + 8472 (flush _test-output-buffered-file) + 8473 (flush _test-error-buffered-file) + 8474 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8480 # check output + 8481 (check-stream-equal _test-output-stream "" "F - test-copy-byte-with-no-inout: output should be empty") + 8482 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-byte' expects an inout" "F - test-copy-byte-with-no-inout: error message") + 8483 # check that stop(1) was called + 8484 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-with-no-inout: exit status") + 8485 # don't restore from ebp + 8486 81 0/subop/add %esp 8/imm32 + 8487 # . epilogue + 8488 5d/pop-to-ebp + 8489 c3/return + 8490 + 8491 test-copy-byte-with-multiple-inouts: + 8492 # . prologue + 8493 55/push-ebp + 8494 89/<- %ebp 4/r32/esp + 8495 # setup + 8496 (clear-stream _test-input-stream) + 8497 (clear-stream $_test-input-buffered-file->buffer) + 8498 (clear-stream _test-output-stream) + 8499 (clear-stream $_test-output-buffered-file->buffer) + 8500 (clear-stream _test-error-stream) + 8501 (clear-stream $_test-error-buffered-file->buffer) + 8502 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8503 68/push 0/imm32 + 8504 68/push 0/imm32 + 8505 89/<- %edx 4/r32/esp + 8506 (tailor-exit-descriptor %edx 0x10) + 8507 # + 8508 (write _test-input-stream "fn foo {\n") + 8509 (write _test-input-stream " var x/eax: byte <- copy-byte 0, 0\n") + 8510 (write _test-input-stream "}\n") + 8511 # convert + 8512 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8513 # registers except esp clobbered at this point + 8514 # restore ed 8515 89/<- %edx 4/r32/esp - 8516 (tailor-exit-descriptor %edx 0x10) - 8517 # - 8518 (write _test-input-stream "fn foo {\n") - 8519 (write _test-input-stream " var x/eax: boolean <- address\n") - 8520 (write _test-input-stream "}\n") - 8521 # convert - 8522 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8523 # registers except esp clobbered at this point - 8524 # restore ed - 8525 89/<- %edx 4/r32/esp - 8526 (flush _test-output-buffered-file) - 8527 (flush _test-error-buffered-file) - 8528 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8534 # check output - 8535 (check-stream-equal _test-output-stream "" "F - test-address-with-no-inout: output should be empty") - 8536 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' expects an inout" "F - test-address-with-no-inout: error message") - 8537 # check that stop(1) was called - 8538 (check-ints-equal *(edx+4) 2 "F - test-address-with-no-inout: exit status") - 8539 # don't restore from ebp - 8540 81 0/subop/add %esp 8/imm32 - 8541 # . epilogue - 8542 5d/pop-to-ebp - 8543 c3/return - 8544 - 8545 test-address-with-multiple-inouts: - 8546 # . prologue - 8547 55/push-ebp - 8548 89/<- %ebp 4/r32/esp - 8549 # setup - 8550 (clear-stream _test-input-stream) - 8551 (clear-stream $_test-input-buffered-file->buffer) - 8552 (clear-stream _test-output-stream) - 8553 (clear-stream $_test-output-buffered-file->buffer) - 8554 (clear-stream _test-error-stream) - 8555 (clear-stream $_test-error-buffered-file->buffer) - 8556 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8557 68/push 0/imm32 - 8558 68/push 0/imm32 + 8516 (flush _test-output-buffered-file) + 8517 (flush _test-error-buffered-file) + 8518 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8524 # check output + 8525 (check-stream-equal _test-output-stream "" "F - test-copy-byte-with-multiple-inouts: output should be empty") + 8526 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-byte' must have just one inout" "F - test-copy-byte-with-multiple-inouts: error message") + 8527 # check that stop(1) was called + 8528 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-with-multiple-inouts: exit status") + 8529 # don't restore from ebp + 8530 81 0/subop/add %esp 8/imm32 + 8531 # . epilogue + 8532 5d/pop-to-ebp + 8533 c3/return + 8534 + 8535 test-copy-byte-with-no-output: + 8536 # . prologue + 8537 55/push-ebp + 8538 89/<- %ebp 4/r32/esp + 8539 # setup + 8540 (clear-stream _test-input-stream) + 8541 (clear-stream $_test-input-buffered-file->buffer) + 8542 (clear-stream _test-output-stream) + 8543 (clear-stream $_test-output-buffered-file->buffer) + 8544 (clear-stream _test-error-stream) + 8545 (clear-stream $_test-error-buffered-file->buffer) + 8546 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8547 68/push 0/imm32 + 8548 68/push 0/imm32 + 8549 89/<- %edx 4/r32/esp + 8550 (tailor-exit-descriptor %edx 0x10) + 8551 # + 8552 (write _test-input-stream "fn foo {\n") + 8553 (write _test-input-stream " copy-byte 0\n") + 8554 (write _test-input-stream "}\n") + 8555 # convert + 8556 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8557 # registers except esp clobbered at this point + 8558 # restore ed 8559 89/<- %edx 4/r32/esp - 8560 (tailor-exit-descriptor %edx 0x10) - 8561 # - 8562 (write _test-input-stream "fn foo {\n") - 8563 (write _test-input-stream " var x/eax: boolean <- address 0, 0\n") - 8564 (write _test-input-stream "}\n") - 8565 # convert - 8566 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8567 # registers except esp clobbered at this point - 8568 # restore ed - 8569 89/<- %edx 4/r32/esp - 8570 (flush _test-output-buffered-file) - 8571 (flush _test-error-buffered-file) - 8572 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8578 # check output - 8579 (check-stream-equal _test-output-stream "" "F - test-address-with-multiple-inouts: output should be empty") - 8580 (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") - 8581 # check that stop(1) was called - 8582 (check-ints-equal *(edx+4) 2 "F - test-address-with-multiple-inouts: exit status") - 8583 # don't restore from ebp - 8584 81 0/subop/add %esp 8/imm32 - 8585 # . epilogue - 8586 5d/pop-to-ebp - 8587 c3/return - 8588 - 8589 test-address-with-no-output: - 8590 # . prologue - 8591 55/push-ebp - 8592 89/<- %ebp 4/r32/esp - 8593 # setup - 8594 (clear-stream _test-input-stream) - 8595 (clear-stream $_test-input-buffered-file->buffer) - 8596 (clear-stream _test-output-stream) - 8597 (clear-stream $_test-output-buffered-file->buffer) - 8598 (clear-stream _test-error-stream) - 8599 (clear-stream $_test-error-buffered-file->buffer) - 8600 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8601 68/push 0/imm32 - 8602 68/push 0/imm32 - 8603 89/<- %edx 4/r32/esp - 8604 (tailor-exit-descriptor %edx 0x10) - 8605 # - 8606 (write _test-input-stream "fn foo {\n") - 8607 (write _test-input-stream " address 0\n") - 8608 (write _test-input-stream "}\n") - 8609 # convert - 8610 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8611 # registers except esp clobbered at this point - 8612 # restore ed - 8613 89/<- %edx 4/r32/esp - 8614 (flush _test-output-buffered-file) - 8615 (flush _test-error-buffered-file) - 8616 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8622 # check output - 8623 (check-stream-equal _test-output-stream "" "F - test-address-with-no-output: output should be empty") - 8624 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' expects an output" "F - test-address-with-no-output: error message") - 8625 # check that stop(1) was called - 8626 (check-ints-equal *(edx+4) 2 "F - test-address-with-no-output: exit status") - 8627 # don't restore from ebp - 8628 81 0/subop/add %esp 8/imm32 - 8629 # . epilogue - 8630 5d/pop-to-ebp - 8631 c3/return - 8632 - 8633 test-address-with-multiple-outputs: - 8634 # . prologue - 8635 55/push-ebp - 8636 89/<- %ebp 4/r32/esp - 8637 # setup - 8638 (clear-stream _test-input-stream) - 8639 (clear-stream $_test-input-buffered-file->buffer) - 8640 (clear-stream _test-output-stream) - 8641 (clear-stream $_test-output-buffered-file->buffer) - 8642 (clear-stream _test-error-stream) - 8643 (clear-stream $_test-error-buffered-file->buffer) - 8644 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8645 68/push 0/imm32 - 8646 68/push 0/imm32 - 8647 89/<- %edx 4/r32/esp - 8648 (tailor-exit-descriptor %edx 0x10) - 8649 # - 8650 (write _test-input-stream "fn foo {\n") - 8651 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 8652 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") - 8653 (write _test-input-stream " x, y <- address 0\n") - 8654 (write _test-input-stream "}\n") - 8655 # convert - 8656 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8657 # registers except esp clobbered at this point - 8658 # restore ed - 8659 89/<- %edx 4/r32/esp - 8660 (flush _test-output-buffered-file) - 8661 (flush _test-error-buffered-file) - 8662 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8668 # check output - 8669 (check-stream-equal _test-output-stream "" "F - test-address-with-multiple-outputs: output should be empty") - 8670 (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") - 8671 # check that stop(1) was called - 8672 (check-ints-equal *(edx+4) 2 "F - test-address-with-multiple-outputs: exit status") - 8673 # don't restore from ebp - 8674 81 0/subop/add %esp 8/imm32 - 8675 # . epilogue - 8676 5d/pop-to-ebp - 8677 c3/return - 8678 - 8679 # silly but it works - 8680 test-address-of-deref: - 8681 # . prologue - 8682 55/push-ebp - 8683 89/<- %ebp 4/r32/esp - 8684 # setup - 8685 (clear-stream _test-input-stream) - 8686 (clear-stream $_test-input-buffered-file->buffer) - 8687 (clear-stream _test-output-stream) - 8688 (clear-stream $_test-output-buffered-file->buffer) - 8689 # - 8690 (write _test-input-stream "fn foo {\n") - 8691 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") - 8692 (write _test-input-stream " var y/ecx: (addr int) <- address *x\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-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8703 # not bothering checking output - 8704 (check-next-stream-line-equal _test-error-stream "" "F - test-address-of-deref: error message") - 8705 # . epilogue - 8706 5d/pop-to-ebp - 8707 c3/return - 8708 - 8709 test-address-to-non-register: - 8710 # . prologue - 8711 55/push-ebp - 8712 89/<- %ebp 4/r32/esp - 8713 # setup - 8714 (clear-stream _test-input-stream) - 8715 (clear-stream $_test-input-buffered-file->buffer) - 8716 (clear-stream _test-output-stream) - 8717 (clear-stream $_test-output-buffered-file->buffer) - 8718 (clear-stream _test-error-stream) - 8719 (clear-stream $_test-error-buffered-file->buffer) - 8720 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8721 68/push 0/imm32 - 8722 68/push 0/imm32 - 8723 89/<- %edx 4/r32/esp - 8724 (tailor-exit-descriptor %edx 0x10) - 8725 # - 8726 (write _test-input-stream "fn foo {\n") - 8727 (write _test-input-stream " var x: (addr int)\n") - 8728 (write _test-input-stream " x <- address 0\n") - 8729 (write _test-input-stream "}\n") - 8730 # convert - 8731 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8732 # registers except esp clobbered at this point - 8733 # restore ed - 8734 89/<- %edx 4/r32/esp - 8735 (flush _test-output-buffered-file) - 8736 (flush _test-error-buffered-file) - 8737 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8743 # check output - 8744 (check-stream-equal _test-output-stream "" "F - test-address-to-non-register: output should be empty") - 8745 (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") - 8746 # check that stop(1) was called - 8747 (check-ints-equal *(edx+4) 2 "F - test-address-to-non-register: exit status") - 8748 # don't restore from ebp - 8749 81 0/subop/add %esp 8/imm32 - 8750 # . epilogue - 8751 5d/pop-to-ebp - 8752 c3/return - 8753 - 8754 test-address-with-wrong-type: - 8755 # . prologue - 8756 55/push-ebp - 8757 89/<- %ebp 4/r32/esp - 8758 # setup - 8759 (clear-stream _test-input-stream) - 8760 (clear-stream $_test-input-buffered-file->buffer) - 8761 (clear-stream _test-output-stream) - 8762 (clear-stream $_test-output-buffered-file->buffer) - 8763 (clear-stream _test-error-stream) - 8764 (clear-stream $_test-error-buffered-file->buffer) - 8765 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8766 68/push 0/imm32 - 8767 68/push 0/imm32 + 8560 (flush _test-output-buffered-file) + 8561 (flush _test-error-buffered-file) + 8562 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8568 # check output + 8569 (check-stream-equal _test-output-stream "" "F - test-copy-byte-with-no-output: output should be empty") + 8570 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-byte' expects an output" "F - test-copy-byte-with-no-output: error message") + 8571 # check that stop(1) was called + 8572 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-with-no-output: exit status") + 8573 # don't restore from ebp + 8574 81 0/subop/add %esp 8/imm32 + 8575 # . epilogue + 8576 5d/pop-to-ebp + 8577 c3/return + 8578 + 8579 test-copy-byte-with-multiple-outputs: + 8580 # . prologue + 8581 55/push-ebp + 8582 89/<- %ebp 4/r32/esp + 8583 # setup + 8584 (clear-stream _test-input-stream) + 8585 (clear-stream $_test-input-buffered-file->buffer) + 8586 (clear-stream _test-output-stream) + 8587 (clear-stream $_test-output-buffered-file->buffer) + 8588 (clear-stream _test-error-stream) + 8589 (clear-stream $_test-error-buffered-file->buffer) + 8590 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8591 68/push 0/imm32 + 8592 68/push 0/imm32 + 8593 89/<- %edx 4/r32/esp + 8594 (tailor-exit-descriptor %edx 0x10) + 8595 # + 8596 (write _test-input-stream "fn foo {\n") + 8597 (write _test-input-stream " var x/eax: byte <- copy 0\n") + 8598 (write _test-input-stream " var y/ecx: byte <- copy 0\n") + 8599 (write _test-input-stream " x, y <- copy-byte 0\n") + 8600 (write _test-input-stream "}\n") + 8601 # convert + 8602 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8603 # registers except esp clobbered at this point + 8604 # restore ed + 8605 89/<- %edx 4/r32/esp + 8606 (flush _test-output-buffered-file) + 8607 (flush _test-error-buffered-file) + 8608 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8614 # check output + 8615 (check-stream-equal _test-output-stream "" "F - test-copy-byte-with-multiple-outputs: output should be empty") + 8616 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-byte' must have just one output" "F - test-copy-byte-with-multiple-outputs: error message") + 8617 # check that stop(1) was called + 8618 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-with-multiple-outputs: exit status") + 8619 # don't restore from ebp + 8620 81 0/subop/add %esp 8/imm32 + 8621 # . epilogue + 8622 5d/pop-to-ebp + 8623 c3/return + 8624 + 8625 test-copy-byte-deref-address: + 8626 # . prologue + 8627 55/push-ebp + 8628 89/<- %ebp 4/r32/esp + 8629 # setup + 8630 (clear-stream _test-input-stream) + 8631 (clear-stream $_test-input-buffered-file->buffer) + 8632 (clear-stream _test-output-stream) + 8633 (clear-stream $_test-output-buffered-file->buffer) + 8634 # + 8635 (write _test-input-stream "fn foo {\n") + 8636 (write _test-input-stream " var x/eax: (addr byte) <- copy 0\n") + 8637 (write _test-input-stream " var y/ecx: byte <- copy-byte *x\n") + 8638 (write _test-input-stream "}\n") + 8639 # convert + 8640 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 8641 (flush _test-output-buffered-file) + 8642 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8648 # not bothering checking output + 8649 (check-next-stream-line-equal _test-error-stream "" "F - test-copy-byte-deref-address: error message") + 8650 # . epilogue + 8651 5d/pop-to-ebp + 8652 c3/return + 8653 + 8654 test-copy-byte-with-invalid-output-type: + 8655 # . prologue + 8656 55/push-ebp + 8657 89/<- %ebp 4/r32/esp + 8658 # setup + 8659 (clear-stream _test-input-stream) + 8660 (clear-stream $_test-input-buffered-file->buffer) + 8661 (clear-stream _test-output-stream) + 8662 (clear-stream $_test-output-buffered-file->buffer) + 8663 (clear-stream _test-error-stream) + 8664 (clear-stream $_test-error-buffered-file->buffer) + 8665 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8666 68/push 0/imm32 + 8667 68/push 0/imm32 + 8668 89/<- %edx 4/r32/esp + 8669 (tailor-exit-descriptor %edx 0x10) + 8670 # + 8671 (write _test-input-stream "fn foo {\n") + 8672 (write _test-input-stream " var x/eax: (addr byte) <- copy 0\n") + 8673 (write _test-input-stream " var y/eax: int <- copy-byte *x\n") + 8674 (write _test-input-stream "}\n") + 8675 # convert + 8676 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8677 # registers except esp clobbered at this point + 8678 # restore ed + 8679 89/<- %edx 4/r32/esp + 8680 (flush _test-output-buffered-file) + 8681 (flush _test-error-buffered-file) + 8682 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8688 # check output + 8689 (check-stream-equal _test-output-stream "" "F - test-copy-byte-with-invalid-output-type: output should be empty") + 8690 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-byte' must write to output of type byte" "F - test-copy-byte-with-invalid-output-type: error message") + 8691 # check that stop(1) was called + 8692 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-with-invalid-output-type: exit status") + 8693 # don't restore from ebp + 8694 81 0/subop/add %esp 8/imm32 + 8695 # . epilogue + 8696 5d/pop-to-ebp + 8697 c3/return + 8698 + 8699 test-copy-byte-from-non-scalar-inout: + 8700 # . prologue + 8701 55/push-ebp + 8702 89/<- %ebp 4/r32/esp + 8703 # setup + 8704 (clear-stream _test-input-stream) + 8705 (clear-stream $_test-input-buffered-file->buffer) + 8706 (clear-stream _test-output-stream) + 8707 (clear-stream $_test-output-buffered-file->buffer) + 8708 (clear-stream _test-error-stream) + 8709 (clear-stream $_test-error-buffered-file->buffer) + 8710 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8711 68/push 0/imm32 + 8712 68/push 0/imm32 + 8713 89/<- %edx 4/r32/esp + 8714 (tailor-exit-descriptor %edx 0x10) + 8715 # + 8716 (write _test-input-stream "fn foo {\n") + 8717 (write _test-input-stream " var x: (handle int)\n") + 8718 (write _test-input-stream " var y/eax: byte <- copy-byte x\n") + 8719 (write _test-input-stream "}\n") + 8720 # convert + 8721 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8722 # registers except esp clobbered at this point + 8723 # restore ed + 8724 89/<- %edx 4/r32/esp + 8725 (flush _test-output-buffered-file) + 8726 (flush _test-error-buffered-file) + 8727 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8733 # check output + 8734 (check-stream-equal _test-output-stream "" "F - test-copy-byte-from-non-scalar-inout: output should be empty") + 8735 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-byte: 'x' is too large to fit in a register" "F - test-copy-byte-from-non-scalar-inout: error message") + 8736 # check that stop(1) was called + 8737 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-from-non-scalar-inout: exit status") + 8738 # don't restore from ebp + 8739 81 0/subop/add %esp 8/imm32 + 8740 # . epilogue + 8741 5d/pop-to-ebp + 8742 c3/return + 8743 + 8744 test-copy-byte-to-with-no-inout: + 8745 # . prologue + 8746 55/push-ebp + 8747 89/<- %ebp 4/r32/esp + 8748 # setup + 8749 (clear-stream _test-input-stream) + 8750 (clear-stream $_test-input-buffered-file->buffer) + 8751 (clear-stream _test-output-stream) + 8752 (clear-stream $_test-output-buffered-file->buffer) + 8753 (clear-stream _test-error-stream) + 8754 (clear-stream $_test-error-buffered-file->buffer) + 8755 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8756 68/push 0/imm32 + 8757 68/push 0/imm32 + 8758 89/<- %edx 4/r32/esp + 8759 (tailor-exit-descriptor %edx 0x10) + 8760 # + 8761 (write _test-input-stream "fn foo {\n") + 8762 (write _test-input-stream " copy-byte-to\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 (tailor-exit-descriptor %edx 0x10) - 8770 # - 8771 (write _test-input-stream "fn foo {\n") - 8772 (write _test-input-stream " var x: int\n") - 8773 (write _test-input-stream " var y/eax: (addr boolean) <- address x\n") - 8774 (write _test-input-stream "}\n") - 8775 # convert - 8776 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8777 # registers except esp clobbered at this point - 8778 # restore ed - 8779 89/<- %edx 4/r32/esp - 8780 (flush _test-output-buffered-file) - 8781 (flush _test-error-buffered-file) - 8782 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8788 # check output - 8789 (check-stream-equal _test-output-stream "" "F - test-address-with-wrong-type: output should be empty") - 8790 (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") - 8791 # check that stop(1) was called - 8792 (check-ints-equal *(edx+4) 2 "F - test-address-with-wrong-type: exit status") - 8793 # don't restore from ebp - 8794 81 0/subop/add %esp 8/imm32 - 8795 # . epilogue - 8796 5d/pop-to-ebp - 8797 c3/return - 8798 - 8799 test-address-with-right-type-for-array: - 8800 # . prologue - 8801 55/push-ebp - 8802 89/<- %ebp 4/r32/esp - 8803 # setup - 8804 (clear-stream _test-input-stream) - 8805 (clear-stream $_test-input-buffered-file->buffer) - 8806 (clear-stream _test-output-stream) - 8807 (clear-stream $_test-output-buffered-file->buffer) - 8808 # - 8809 (write _test-input-stream "fn foo {\n") - 8810 (write _test-input-stream " var x: (array int 3)\n") - 8811 (write _test-input-stream " var y/eax: (addr array int) <- address x\n") - 8812 (write _test-input-stream "}\n") - 8813 # convert - 8814 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 8815 (flush _test-output-buffered-file) - 8816 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8822 # no error - 8823 (check-next-stream-line-equal _test-error-stream "" "F - test-address-with-right-type-for-array: error message") - 8824 # don't bother checking output - 8825 # . epilogue - 8826 89/<- %esp 5/r32/ebp - 8827 5d/pop-to-ebp - 8828 c3/return - 8829 - 8830 test-address-with-right-type-for-stream: - 8831 # . prologue - 8832 55/push-ebp - 8833 89/<- %ebp 4/r32/esp - 8834 # setup - 8835 (clear-stream _test-input-stream) - 8836 (clear-stream $_test-input-buffered-file->buffer) - 8837 (clear-stream _test-output-stream) - 8838 (clear-stream $_test-output-buffered-file->buffer) - 8839 # - 8840 (write _test-input-stream "fn foo {\n") - 8841 (write _test-input-stream " var x: (stream int 3)\n") - 8842 (write _test-input-stream " var y/eax: (addr stream int) <- address x\n") - 8843 (write _test-input-stream "}\n") - 8844 # convert - 8845 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 8846 (flush _test-output-buffered-file) - 8847 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8853 # no error - 8854 (check-next-stream-line-equal _test-error-stream "" "F - test-address-with-right-type-for-stream: error message") - 8855 # don't bother checking output - 8856 # . epilogue - 8857 89/<- %esp 5/r32/ebp - 8858 5d/pop-to-ebp - 8859 c3/return - 8860 - 8861 test-get-with-wrong-field: - 8862 # . prologue - 8863 55/push-ebp - 8864 89/<- %ebp 4/r32/esp - 8865 # setup - 8866 (clear-stream _test-input-stream) - 8867 (clear-stream $_test-input-buffered-file->buffer) - 8868 (clear-stream _test-output-stream) - 8869 (clear-stream $_test-output-buffered-file->buffer) - 8870 (clear-stream _test-error-stream) - 8871 (clear-stream $_test-error-buffered-file->buffer) - 8872 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8873 68/push 0/imm32 - 8874 68/push 0/imm32 - 8875 89/<- %edx 4/r32/esp - 8876 (tailor-exit-descriptor %edx 0x10) - 8877 # - 8878 (write _test-input-stream "fn foo {\n") - 8879 (write _test-input-stream " var a: t\n") - 8880 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 8881 (write _test-input-stream "}\n") - 8882 (write _test-input-stream "type t {\n") - 8883 (write _test-input-stream " x: int\n") - 8884 (write _test-input-stream "}\n") - 8885 # convert - 8886 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8887 # registers except esp clobbered at this point - 8888 # restore ed - 8889 89/<- %edx 4/r32/esp - 8890 (flush _test-output-buffered-file) - 8891 (flush _test-error-buffered-file) - 8892 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8898 # check output - 8899 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-field: output should be empty") - 8900 (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") - 8901 # check that stop(1) was called - 8902 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-field: exit status") - 8903 # don't restore from ebp - 8904 81 0/subop/add %esp 8/imm32 - 8905 # . epilogue - 8906 5d/pop-to-ebp - 8907 c3/return - 8908 - 8909 test-get-with-wrong-base-type: - 8910 # . prologue - 8911 55/push-ebp - 8912 89/<- %ebp 4/r32/esp - 8913 # setup - 8914 (clear-stream _test-input-stream) - 8915 (clear-stream $_test-input-buffered-file->buffer) - 8916 (clear-stream _test-output-stream) - 8917 (clear-stream $_test-output-buffered-file->buffer) - 8918 (clear-stream _test-error-stream) - 8919 (clear-stream $_test-error-buffered-file->buffer) - 8920 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8921 68/push 0/imm32 - 8922 68/push 0/imm32 - 8923 89/<- %edx 4/r32/esp - 8924 (tailor-exit-descriptor %edx 0x10) - 8925 # - 8926 (write _test-input-stream "fn foo {\n") - 8927 (write _test-input-stream " var a: int\n") - 8928 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 8929 (write _test-input-stream "}\n") - 8930 # convert - 8931 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8932 # registers except esp clobbered at this point - 8933 # restore ed - 8934 89/<- %edx 4/r32/esp - 8935 (flush _test-output-buffered-file) - 8936 (flush _test-error-buffered-file) - 8937 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8943 # check output - 8944 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-base-type: output should be empty") - 8945 (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") - 8946 # check that stop(1) was called - 8947 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-base-type: exit status") - 8948 # don't restore from ebp - 8949 81 0/subop/add %esp 8/imm32 - 8950 # . epilogue - 8951 5d/pop-to-ebp - 8952 c3/return - 8953 - 8954 test-get-with-wrong-base-type-2: - 8955 # . prologue - 8956 55/push-ebp - 8957 89/<- %ebp 4/r32/esp - 8958 # setup - 8959 (clear-stream _test-input-stream) - 8960 (clear-stream $_test-input-buffered-file->buffer) - 8961 (clear-stream _test-output-stream) - 8962 (clear-stream $_test-output-buffered-file->buffer) - 8963 (clear-stream _test-error-stream) - 8964 (clear-stream $_test-error-buffered-file->buffer) - 8965 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8966 68/push 0/imm32 - 8967 68/push 0/imm32 - 8968 89/<- %edx 4/r32/esp - 8969 (tailor-exit-descriptor %edx 0x10) - 8970 # - 8971 (write _test-input-stream "fn foo {\n") - 8972 (write _test-input-stream " var a: (addr t)\n") - 8973 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 8974 (write _test-input-stream "}\n") - 8975 (write _test-input-stream "type t {\n") - 8976 (write _test-input-stream " x: int\n") - 8977 (write _test-input-stream "}\n") - 8978 # convert - 8979 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8980 # registers except esp clobbered at this point - 8981 # restore ed - 8982 89/<- %edx 4/r32/esp - 8983 (flush _test-output-buffered-file) - 8984 (flush _test-error-buffered-file) - 8985 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 8991 # check output - 8992 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-base-type-2: output should be empty") - 8993 (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") - 8994 # check that stop(1) was called - 8995 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-base-type-2: exit status") - 8996 # don't restore from ebp - 8997 81 0/subop/add %esp 8/imm32 - 8998 # . epilogue - 8999 5d/pop-to-ebp - 9000 c3/return - 9001 - 9002 test-get-with-wrong-base-type-3: - 9003 # . prologue - 9004 55/push-ebp - 9005 89/<- %ebp 4/r32/esp - 9006 # setup - 9007 (clear-stream _test-input-stream) - 9008 (clear-stream $_test-input-buffered-file->buffer) - 9009 (clear-stream _test-output-stream) - 9010 (clear-stream $_test-output-buffered-file->buffer) - 9011 (clear-stream _test-error-stream) - 9012 (clear-stream $_test-error-buffered-file->buffer) - 9013 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9014 68/push 0/imm32 - 9015 68/push 0/imm32 - 9016 89/<- %edx 4/r32/esp - 9017 (tailor-exit-descriptor %edx 0x10) - 9018 # - 9019 (write _test-input-stream "fn foo {\n") - 9020 (write _test-input-stream " var a: (handle int)\n") - 9021 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 9022 (write _test-input-stream "}\n") - 9023 # convert - 9024 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9025 # registers except esp clobbered at this point - 9026 # restore ed - 9027 89/<- %edx 4/r32/esp - 9028 (flush _test-output-buffered-file) - 9029 (flush _test-error-buffered-file) - 9030 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9036 # check output - 9037 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-base-type-3: output should be empty") - 9038 (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") - 9039 # check that stop(1) was called - 9040 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-base-type-3: exit status") - 9041 # don't restore from ebp - 9042 81 0/subop/add %esp 8/imm32 - 9043 # . epilogue - 9044 5d/pop-to-ebp - 9045 c3/return - 9046 - 9047 test-get-with-wrong-offset-type: - 9048 # . prologue - 9049 55/push-ebp - 9050 89/<- %ebp 4/r32/esp - 9051 # setup - 9052 (clear-stream _test-input-stream) - 9053 (clear-stream $_test-input-buffered-file->buffer) - 9054 (clear-stream _test-output-stream) - 9055 (clear-stream $_test-output-buffered-file->buffer) - 9056 (clear-stream _test-error-stream) - 9057 (clear-stream $_test-error-buffered-file->buffer) - 9058 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9059 68/push 0/imm32 - 9060 68/push 0/imm32 - 9061 89/<- %edx 4/r32/esp - 9062 (tailor-exit-descriptor %edx 0x10) - 9063 # - 9064 (write _test-input-stream "fn foo {\n") - 9065 (write _test-input-stream " var a: t\n") - 9066 (write _test-input-stream " var b: int\n") - 9067 (write _test-input-stream " var c/ecx: (addr int) <- get a, b\n") - 9068 (write _test-input-stream "}\n") - 9069 (write _test-input-stream "type t {\n") - 9070 (write _test-input-stream " x: int\n") - 9071 (write _test-input-stream "}\n") - 9072 # convert - 9073 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9074 # registers except esp clobbered at this point - 9075 # restore ed - 9076 89/<- %edx 4/r32/esp - 9077 (flush _test-output-buffered-file) - 9078 (flush _test-error-buffered-file) - 9079 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9085 # check output - 9086 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-offset-type: output should be empty") - 9087 (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") - 9088 # check that stop(1) was called - 9089 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-offset-type: exit status") - 9090 # don't restore from ebp - 9091 81 0/subop/add %esp 8/imm32 - 9092 # . epilogue - 9093 5d/pop-to-ebp - 9094 c3/return - 9095 - 9096 test-get-with-wrong-output-type: - 9097 # . prologue - 9098 55/push-ebp - 9099 89/<- %ebp 4/r32/esp - 9100 # setup - 9101 (clear-stream _test-input-stream) - 9102 (clear-stream $_test-input-buffered-file->buffer) - 9103 (clear-stream _test-output-stream) - 9104 (clear-stream $_test-output-buffered-file->buffer) - 9105 (clear-stream _test-error-stream) - 9106 (clear-stream $_test-error-buffered-file->buffer) - 9107 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9108 68/push 0/imm32 - 9109 68/push 0/imm32 - 9110 89/<- %edx 4/r32/esp - 9111 (tailor-exit-descriptor %edx 0x10) - 9112 # - 9113 (write _test-input-stream "fn foo {\n") - 9114 (write _test-input-stream " var a: t\n") - 9115 (write _test-input-stream " var c: (addr int)\n") - 9116 (write _test-input-stream " c <- get a, x\n") - 9117 (write _test-input-stream "}\n") - 9118 (write _test-input-stream "type t {\n") - 9119 (write _test-input-stream " x: int\n") - 9120 (write _test-input-stream "}\n") - 9121 # convert - 9122 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9123 # registers except esp clobbered at this point - 9124 # restore ed - 9125 89/<- %edx 4/r32/esp - 9126 (flush _test-output-buffered-file) - 9127 (flush _test-error-buffered-file) - 9128 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9134 # check output - 9135 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type: output should be empty") - 9136 (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") - 9137 # check that stop(1) was called - 9138 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type: exit status") - 9139 # don't restore from ebp - 9140 81 0/subop/add %esp 8/imm32 - 9141 # . epilogue - 9142 5d/pop-to-ebp - 9143 c3/return - 9144 - 9145 test-get-with-wrong-output-type-2: - 9146 # . prologue - 9147 55/push-ebp - 9148 89/<- %ebp 4/r32/esp - 9149 # setup - 9150 (clear-stream _test-input-stream) - 9151 (clear-stream $_test-input-buffered-file->buffer) - 9152 (clear-stream _test-output-stream) - 9153 (clear-stream $_test-output-buffered-file->buffer) - 9154 (clear-stream _test-error-stream) - 9155 (clear-stream $_test-error-buffered-file->buffer) - 9156 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9157 68/push 0/imm32 - 9158 68/push 0/imm32 - 9159 89/<- %edx 4/r32/esp - 9160 (tailor-exit-descriptor %edx 0x10) - 9161 # - 9162 (write _test-input-stream "fn foo {\n") - 9163 (write _test-input-stream " var a: t\n") - 9164 (write _test-input-stream " var c/ecx: int <- get a, x\n") - 9165 (write _test-input-stream "}\n") - 9166 (write _test-input-stream "type t {\n") - 9167 (write _test-input-stream " x: int\n") - 9168 (write _test-input-stream "}\n") - 9169 # convert - 9170 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9171 # registers except esp clobbered at this point - 9172 # restore ed - 9173 89/<- %edx 4/r32/esp - 9174 (flush _test-output-buffered-file) - 9175 (flush _test-error-buffered-file) - 9176 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9182 # check output - 9183 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-2: output should be empty") - 9184 (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") - 9185 # check that stop(1) was called - 9186 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-2: exit status") - 9187 # don't restore from ebp - 9188 81 0/subop/add %esp 8/imm32 - 9189 # . epilogue - 9190 5d/pop-to-ebp - 9191 c3/return - 9192 - 9193 test-get-with-wrong-output-type-3: - 9194 # . prologue - 9195 55/push-ebp - 9196 89/<- %ebp 4/r32/esp - 9197 # setup - 9198 (clear-stream _test-input-stream) - 9199 (clear-stream $_test-input-buffered-file->buffer) - 9200 (clear-stream _test-output-stream) - 9201 (clear-stream $_test-output-buffered-file->buffer) - 9202 (clear-stream _test-error-stream) - 9203 (clear-stream $_test-error-buffered-file->buffer) - 9204 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9205 68/push 0/imm32 - 9206 68/push 0/imm32 - 9207 89/<- %edx 4/r32/esp - 9208 (tailor-exit-descriptor %edx 0x10) - 9209 # - 9210 (write _test-input-stream "fn foo {\n") - 9211 (write _test-input-stream " var a: t\n") - 9212 (write _test-input-stream " var c/ecx: (array int) <- get a, x\n") - 9213 (write _test-input-stream "}\n") - 9214 (write _test-input-stream "type t {\n") - 9215 (write _test-input-stream " x: int\n") - 9216 (write _test-input-stream "}\n") - 9217 # convert - 9218 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9219 # registers except esp clobbered at this point - 9220 # restore ed - 9221 89/<- %edx 4/r32/esp - 9222 (flush _test-output-buffered-file) - 9223 (flush _test-error-buffered-file) - 9224 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9230 # check output - 9231 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-3: output should be empty") - 9232 (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") - 9233 # check that stop(1) was called - 9234 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-3: exit status") - 9235 # don't restore from ebp - 9236 81 0/subop/add %esp 8/imm32 - 9237 # . epilogue - 9238 5d/pop-to-ebp - 9239 c3/return - 9240 - 9241 test-get-with-wrong-output-type-4: - 9242 # . prologue - 9243 55/push-ebp - 9244 89/<- %ebp 4/r32/esp - 9245 # setup - 9246 (clear-stream _test-input-stream) - 9247 (clear-stream $_test-input-buffered-file->buffer) - 9248 (clear-stream _test-output-stream) - 9249 (clear-stream $_test-output-buffered-file->buffer) - 9250 (clear-stream _test-error-stream) - 9251 (clear-stream $_test-error-buffered-file->buffer) - 9252 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9253 68/push 0/imm32 - 9254 68/push 0/imm32 - 9255 89/<- %edx 4/r32/esp - 9256 (tailor-exit-descriptor %edx 0x10) - 9257 # - 9258 (write _test-input-stream "fn foo {\n") - 9259 (write _test-input-stream " var a: t\n") - 9260 (write _test-input-stream " var c/ecx: (addr boolean) <- get a, x\n") - 9261 (write _test-input-stream "}\n") - 9262 (write _test-input-stream "type t {\n") - 9263 (write _test-input-stream " x: int\n") - 9264 (write _test-input-stream "}\n") - 9265 # convert - 9266 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9267 # registers except esp clobbered at this point - 9268 # restore ed - 9269 89/<- %edx 4/r32/esp - 9270 (flush _test-output-buffered-file) - 9271 (flush _test-error-buffered-file) - 9272 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9278 # check output - 9279 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-4: output should be empty") - 9280 (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") - 9281 # check that stop(1) was called - 9282 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-4: exit status") - 9283 # don't restore from ebp - 9284 81 0/subop/add %esp 8/imm32 - 9285 # . epilogue - 9286 5d/pop-to-ebp - 9287 c3/return - 9288 - 9289 test-get-with-wrong-output-type-5: - 9290 # . prologue - 9291 55/push-ebp - 9292 89/<- %ebp 4/r32/esp - 9293 # setup - 9294 (clear-stream _test-input-stream) - 9295 (clear-stream $_test-input-buffered-file->buffer) - 9296 (clear-stream _test-output-stream) - 9297 (clear-stream $_test-output-buffered-file->buffer) - 9298 # - 9299 (write _test-input-stream "fn foo {\n") - 9300 (write _test-input-stream " var a: t\n") - 9301 (write _test-input-stream " var c/ecx: (addr handle int) <- get a, x\n") - 9302 (write _test-input-stream "}\n") - 9303 (write _test-input-stream "type t {\n") - 9304 (write _test-input-stream " x: (handle int)\n") - 9305 (write _test-input-stream "}\n") - 9306 # convert - 9307 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 9308 (flush _test-output-buffered-file) - 9309 # no errors - 9310 # . epilogue - 9311 89/<- %esp 5/r32/ebp - 9312 5d/pop-to-ebp - 9313 c3/return - 9314 - 9315 test-get-with-too-few-inouts: - 9316 # . prologue - 9317 55/push-ebp - 9318 89/<- %ebp 4/r32/esp - 9319 # setup - 9320 (clear-stream _test-input-stream) - 9321 (clear-stream $_test-input-buffered-file->buffer) - 9322 (clear-stream _test-output-stream) - 9323 (clear-stream $_test-output-buffered-file->buffer) - 9324 (clear-stream _test-error-stream) - 9325 (clear-stream $_test-error-buffered-file->buffer) - 9326 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9327 68/push 0/imm32 - 9328 68/push 0/imm32 - 9329 89/<- %edx 4/r32/esp - 9330 (tailor-exit-descriptor %edx 0x10) - 9331 # - 9332 (write _test-input-stream "fn foo {\n") - 9333 (write _test-input-stream " var a: t\n") - 9334 (write _test-input-stream " var c/ecx: (addr int) <- get a\n") - 9335 (write _test-input-stream "}\n") - 9336 (write _test-input-stream "type t {\n") - 9337 (write _test-input-stream " x: int\n") - 9338 (write _test-input-stream "}\n") - 9339 # convert - 9340 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9341 # registers except esp clobbered at this point - 9342 # restore ed - 9343 89/<- %edx 4/r32/esp - 9344 (flush _test-output-buffered-file) - 9345 (flush _test-error-buffered-file) - 9346 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9352 # check output - 9353 (check-stream-equal _test-output-stream "" "F - test-get-with-too-few-inouts: output should be empty") - 9354 (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") - 9355 # check that stop(1) was called - 9356 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-few-inouts: exit status") - 9357 # don't restore from ebp - 9358 81 0/subop/add %esp 8/imm32 - 9359 # . epilogue - 9360 5d/pop-to-ebp - 9361 c3/return - 9362 - 9363 test-get-with-too-many-inouts: - 9364 # . prologue - 9365 55/push-ebp - 9366 89/<- %ebp 4/r32/esp - 9367 # setup - 9368 (clear-stream _test-input-stream) - 9369 (clear-stream $_test-input-buffered-file->buffer) - 9370 (clear-stream _test-output-stream) - 9371 (clear-stream $_test-output-buffered-file->buffer) - 9372 (clear-stream _test-error-stream) - 9373 (clear-stream $_test-error-buffered-file->buffer) - 9374 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9375 68/push 0/imm32 - 9376 68/push 0/imm32 - 9377 89/<- %edx 4/r32/esp - 9378 (tailor-exit-descriptor %edx 0x10) - 9379 # - 9380 (write _test-input-stream "fn foo {\n") - 9381 (write _test-input-stream " var a: t\n") - 9382 (write _test-input-stream " var c/ecx: (addr int) <- get a, x, 0\n") - 9383 (write _test-input-stream "}\n") - 9384 (write _test-input-stream "type t {\n") - 9385 (write _test-input-stream " x: int\n") - 9386 (write _test-input-stream "}\n") - 9387 # convert - 9388 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9389 # registers except esp clobbered at this point - 9390 # restore ed - 9391 89/<- %edx 4/r32/esp - 9392 (flush _test-output-buffered-file) - 9393 (flush _test-error-buffered-file) - 9394 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9400 # check output - 9401 (check-stream-equal _test-output-stream "" "F - test-get-with-too-many-inouts: output should be empty") - 9402 (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") - 9403 # check that stop(1) was called - 9404 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-many-inouts: exit status") - 9405 # don't restore from ebp - 9406 81 0/subop/add %esp 8/imm32 - 9407 # . epilogue - 9408 5d/pop-to-ebp - 9409 c3/return - 9410 - 9411 test-get-with-no-output: - 9412 # . prologue - 9413 55/push-ebp - 9414 89/<- %ebp 4/r32/esp - 9415 # setup - 9416 (clear-stream _test-input-stream) - 9417 (clear-stream $_test-input-buffered-file->buffer) - 9418 (clear-stream _test-output-stream) - 9419 (clear-stream $_test-output-buffered-file->buffer) - 9420 (clear-stream _test-error-stream) - 9421 (clear-stream $_test-error-buffered-file->buffer) - 9422 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9423 68/push 0/imm32 - 9424 68/push 0/imm32 - 9425 89/<- %edx 4/r32/esp - 9426 (tailor-exit-descriptor %edx 0x10) - 9427 # - 9428 (write _test-input-stream "fn foo {\n") - 9429 (write _test-input-stream " var a: t\n") - 9430 (write _test-input-stream " get a, x\n") - 9431 (write _test-input-stream "}\n") - 9432 (write _test-input-stream "type t {\n") - 9433 (write _test-input-stream " x: int\n") - 9434 (write _test-input-stream "}\n") - 9435 # convert - 9436 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9437 # registers except esp clobbered at this point - 9438 # restore ed - 9439 89/<- %edx 4/r32/esp - 9440 (flush _test-output-buffered-file) - 9441 (flush _test-error-buffered-file) - 9442 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9448 # check output - 9449 (check-stream-equal _test-output-stream "" "F - test-get-with-no-output: output should be empty") - 9450 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: must have an output" "F - test-get-with-no-output: error message") - 9451 # check that stop(1) was called - 9452 (check-ints-equal *(edx+4) 2 "F - test-get-with-no-output: exit status") - 9453 # don't restore from ebp - 9454 81 0/subop/add %esp 8/imm32 - 9455 # . epilogue - 9456 5d/pop-to-ebp - 9457 c3/return - 9458 - 9459 test-get-with-too-many-outputs: - 9460 # . prologue - 9461 55/push-ebp - 9462 89/<- %ebp 4/r32/esp - 9463 # setup - 9464 (clear-stream _test-input-stream) - 9465 (clear-stream $_test-input-buffered-file->buffer) - 9466 (clear-stream _test-output-stream) - 9467 (clear-stream $_test-output-buffered-file->buffer) - 9468 (clear-stream _test-error-stream) - 9469 (clear-stream $_test-error-buffered-file->buffer) - 9470 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9471 68/push 0/imm32 - 9472 68/push 0/imm32 + 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-copy-byte-to-with-no-inout: output should be empty") + 8779 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-byte-to' must have two inouts" "F - test-copy-byte-to-with-no-inout: error message") + 8780 # check that stop(1) was called + 8781 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-to-with-no-inout: 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-copy-byte-to-with-no-source: + 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 x/eax: (addr byte) <- copy 0\n") + 8807 (write _test-input-stream " copy-byte-to *x\n") + 8808 (write _test-input-stream "}\n") + 8809 # convert + 8810 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8811 # registers except esp clobbered at this point + 8812 # restore ed + 8813 89/<- %edx 4/r32/esp + 8814 (flush _test-output-buffered-file) + 8815 (flush _test-error-buffered-file) + 8816 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8822 # check output + 8823 (check-stream-equal _test-output-stream "" "F - test-copy-byte-to-with-no-source: output should be empty") + 8824 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-byte-to' must have two inouts" "F - test-copy-byte-to-with-no-source: error message") + 8825 # check that stop(1) was called + 8826 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-to-with-no-source: exit status") + 8827 # don't restore from ebp + 8828 81 0/subop/add %esp 8/imm32 + 8829 # . epilogue + 8830 5d/pop-to-ebp + 8831 c3/return + 8832 + 8833 test-copy-byte-to-with-too-many-inouts: + 8834 # . prologue + 8835 55/push-ebp + 8836 89/<- %ebp 4/r32/esp + 8837 # setup + 8838 (clear-stream _test-input-stream) + 8839 (clear-stream $_test-input-buffered-file->buffer) + 8840 (clear-stream _test-output-stream) + 8841 (clear-stream $_test-output-buffered-file->buffer) + 8842 (clear-stream _test-error-stream) + 8843 (clear-stream $_test-error-buffered-file->buffer) + 8844 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8845 68/push 0/imm32 + 8846 68/push 0/imm32 + 8847 89/<- %edx 4/r32/esp + 8848 (tailor-exit-descriptor %edx 0x10) + 8849 # + 8850 (write _test-input-stream "fn foo {\n") + 8851 (write _test-input-stream " var x/eax: (addr byte) <- copy 0\n") + 8852 (write _test-input-stream " copy-byte-to *x, 0, 0\n") + 8853 (write _test-input-stream "}\n") + 8854 # convert + 8855 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8856 # registers except esp clobbered at this point + 8857 # restore ed + 8858 89/<- %edx 4/r32/esp + 8859 (flush _test-output-buffered-file) + 8860 (flush _test-error-buffered-file) + 8861 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8867 # check output + 8868 (check-stream-equal _test-output-stream "" "F - test-copy-byte-to-with-too-many-inouts: output should be empty") + 8869 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-byte-to' must have two inouts" "F - test-copy-byte-to-with-too-many-inouts: error message") + 8870 # check that stop(1) was called + 8871 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-to-with-too-many-inouts: exit status") + 8872 # don't restore from ebp + 8873 81 0/subop/add %esp 8/imm32 + 8874 # . epilogue + 8875 5d/pop-to-ebp + 8876 c3/return + 8877 + 8878 test-copy-byte-to-with-output: + 8879 # . prologue + 8880 55/push-ebp + 8881 89/<- %ebp 4/r32/esp + 8882 # setup + 8883 (clear-stream _test-input-stream) + 8884 (clear-stream $_test-input-buffered-file->buffer) + 8885 (clear-stream _test-output-stream) + 8886 (clear-stream $_test-output-buffered-file->buffer) + 8887 (clear-stream _test-error-stream) + 8888 (clear-stream $_test-error-buffered-file->buffer) + 8889 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8890 68/push 0/imm32 + 8891 68/push 0/imm32 + 8892 89/<- %edx 4/r32/esp + 8893 (tailor-exit-descriptor %edx 0x10) + 8894 # + 8895 (write _test-input-stream "fn foo {\n") + 8896 (write _test-input-stream " var x/eax: byte <- copy 0\n") + 8897 (write _test-input-stream " var y/ecx: (addr byte) <- copy 0\n") + 8898 (write _test-input-stream " x <- copy-byte-to *y, 0\n") + 8899 (write _test-input-stream "}\n") + 8900 # convert + 8901 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8902 # registers except esp clobbered at this point + 8903 # restore ed + 8904 89/<- %edx 4/r32/esp + 8905 (flush _test-output-buffered-file) + 8906 (flush _test-error-buffered-file) + 8907 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8913 # check output + 8914 (check-stream-equal _test-output-stream "" "F - test-copy-byte-to-with-output: output should be empty") + 8915 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-byte-to' must not have any outputs" "F - test-copy-byte-to-with-output: error message") + 8916 # check that stop(1) was called + 8917 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-to-with-output: exit status") + 8918 # don't restore from ebp + 8919 81 0/subop/add %esp 8/imm32 + 8920 # . epilogue + 8921 5d/pop-to-ebp + 8922 c3/return + 8923 + 8924 test-copy-byte-to-with-invalid-output-type: + 8925 # . prologue + 8926 55/push-ebp + 8927 89/<- %ebp 4/r32/esp + 8928 # setup + 8929 (clear-stream _test-input-stream) + 8930 (clear-stream $_test-input-buffered-file->buffer) + 8931 (clear-stream _test-output-stream) + 8932 (clear-stream $_test-output-buffered-file->buffer) + 8933 (clear-stream _test-error-stream) + 8934 (clear-stream $_test-error-buffered-file->buffer) + 8935 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8936 68/push 0/imm32 + 8937 68/push 0/imm32 + 8938 89/<- %edx 4/r32/esp + 8939 (tailor-exit-descriptor %edx 0x10) + 8940 # + 8941 (write _test-input-stream "fn foo {\n") + 8942 (write _test-input-stream " var x/eax: byte <- copy 0\n") + 8943 (write _test-input-stream " var y: int\n") + 8944 (write _test-input-stream " copy-byte-to y, x\n") + 8945 (write _test-input-stream "}\n") + 8946 # convert + 8947 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8948 # registers except esp clobbered at this point + 8949 # restore ed + 8950 89/<- %edx 4/r32/esp + 8951 (flush _test-output-buffered-file) + 8952 (flush _test-error-buffered-file) + 8953 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 8959 # check output + 8960 (check-stream-equal _test-output-stream "" "F - test-copy-byte-to-with-invalid-output-type: output should be empty") + 8961 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-byte-to: 'y' must be a byte" "F - test-copy-byte-to-with-invalid-output-type: error message") + 8962 # check that stop(1) was called + 8963 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-to-with-invalid-output-type: exit status") + 8964 # don't restore from ebp + 8965 81 0/subop/add %esp 8/imm32 + 8966 # . epilogue + 8967 5d/pop-to-ebp + 8968 c3/return + 8969 + 8970 test-copy-byte-to-with-literal-inout: + 8971 # . prologue + 8972 55/push-ebp + 8973 89/<- %ebp 4/r32/esp + 8974 # setup + 8975 (clear-stream _test-input-stream) + 8976 (clear-stream $_test-input-buffered-file->buffer) + 8977 (clear-stream _test-output-stream) + 8978 (clear-stream $_test-output-buffered-file->buffer) + 8979 (clear-stream _test-error-stream) + 8980 (clear-stream $_test-error-buffered-file->buffer) + 8981 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8982 68/push 0/imm32 + 8983 68/push 0/imm32 + 8984 89/<- %edx 4/r32/esp + 8985 (tailor-exit-descriptor %edx 0x10) + 8986 # + 8987 (write _test-input-stream "fn foo {\n") + 8988 (write _test-input-stream " var x/eax: (addr byte) <- copy 0\n") + 8989 (write _test-input-stream " copy-byte-to *x, 0\n") + 8990 (write _test-input-stream "}\n") + 8991 # convert + 8992 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8993 # registers except esp clobbered at this point + 8994 # restore ed + 8995 89/<- %edx 4/r32/esp + 8996 (flush _test-output-buffered-file) + 8997 (flush _test-error-buffered-file) + 8998 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9004 # check output + 9005 (check-stream-equal _test-output-stream "" "F - test-copy-byte-to-with-literal-inout: output should be empty") + 9006 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-byte-to: source (second inout) must be in a register" "F - test-copy-byte-to-with-literal-inout: error message") + 9007 # check that stop(1) was called + 9008 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-to-with-literal-inout: exit status") + 9009 # don't restore from ebp + 9010 81 0/subop/add %esp 8/imm32 + 9011 # . epilogue + 9012 5d/pop-to-ebp + 9013 c3/return + 9014 + 9015 test-copy-byte-to-deref-address: + 9016 # . prologue + 9017 55/push-ebp + 9018 89/<- %ebp 4/r32/esp + 9019 # setup + 9020 (clear-stream _test-input-stream) + 9021 (clear-stream $_test-input-buffered-file->buffer) + 9022 (clear-stream _test-output-stream) + 9023 (clear-stream $_test-output-buffered-file->buffer) + 9024 # + 9025 (write _test-input-stream "fn foo {\n") + 9026 (write _test-input-stream " var x/eax: byte <- copy 0\n") + 9027 (write _test-input-stream " var y/ecx: (addr byte) <- copy 0\n") + 9028 (write _test-input-stream " copy-byte-to *y, x\n") + 9029 (write _test-input-stream "}\n") + 9030 # convert + 9031 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 9032 (flush _test-output-buffered-file) + 9033 # no errors + 9034 # . epilogue + 9035 5d/pop-to-ebp + 9036 c3/return + 9037 + 9038 test-copy-byte-to-from-non-scalar-inout: + 9039 # . prologue + 9040 55/push-ebp + 9041 89/<- %ebp 4/r32/esp + 9042 # setup + 9043 (clear-stream _test-input-stream) + 9044 (clear-stream $_test-input-buffered-file->buffer) + 9045 (clear-stream _test-output-stream) + 9046 (clear-stream $_test-output-buffered-file->buffer) + 9047 (clear-stream _test-error-stream) + 9048 (clear-stream $_test-error-buffered-file->buffer) + 9049 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9050 68/push 0/imm32 + 9051 68/push 0/imm32 + 9052 89/<- %edx 4/r32/esp + 9053 (tailor-exit-descriptor %edx 0x10) + 9054 # + 9055 (write _test-input-stream "fn foo {\n") + 9056 (write _test-input-stream " var x: (handle int)\n") + 9057 (write _test-input-stream " var y/eax: (addr byte) <- copy 0\n") + 9058 (write _test-input-stream " copy-byte-to *y, x\n") + 9059 (write _test-input-stream "}\n") + 9060 # convert + 9061 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9062 # registers except esp clobbered at this point + 9063 # restore ed + 9064 89/<- %edx 4/r32/esp + 9065 (flush _test-output-buffered-file) + 9066 (flush _test-error-buffered-file) + 9067 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9073 # check output + 9074 (check-stream-equal _test-output-stream "" "F - test-copy-byte-to-from-non-scalar-inout: output should be empty") + 9075 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-byte-to: 'x' is too large to copy" "F - test-copy-byte-to-from-non-scalar-inout: error message") + 9076 # check that stop(1) was called + 9077 (check-ints-equal *(edx+4) 2 "F - test-copy-byte-to-from-non-scalar-inout: exit status") + 9078 # don't restore from ebp + 9079 81 0/subop/add %esp 8/imm32 + 9080 # . epilogue + 9081 5d/pop-to-ebp + 9082 c3/return + 9083 + 9084 test-compare-with-no-inout: + 9085 # . prologue + 9086 55/push-ebp + 9087 89/<- %ebp 4/r32/esp + 9088 # setup + 9089 (clear-stream _test-input-stream) + 9090 (clear-stream $_test-input-buffered-file->buffer) + 9091 (clear-stream _test-output-stream) + 9092 (clear-stream $_test-output-buffered-file->buffer) + 9093 (clear-stream _test-error-stream) + 9094 (clear-stream $_test-error-buffered-file->buffer) + 9095 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9096 68/push 0/imm32 + 9097 68/push 0/imm32 + 9098 89/<- %edx 4/r32/esp + 9099 (tailor-exit-descriptor %edx 0x10) + 9100 # + 9101 (write _test-input-stream "fn foo {\n") + 9102 (write _test-input-stream " var x: boolean\n") + 9103 (write _test-input-stream " compare\n") + 9104 (write _test-input-stream "}\n") + 9105 # convert + 9106 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9107 # registers except esp clobbered at this point + 9108 # restore ed + 9109 89/<- %edx 4/r32/esp + 9110 (flush _test-output-buffered-file) + 9111 (flush _test-error-buffered-file) + 9112 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9118 # check output + 9119 (check-stream-equal _test-output-stream "" "F - test-compare-with-no-inout: output should be empty") + 9120 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must have two inouts" "F - test-compare-with-no-inout: error message") + 9121 # check that stop(1) was called + 9122 (check-ints-equal *(edx+4) 2 "F - test-compare-with-no-inout: exit status") + 9123 # don't restore from ebp + 9124 81 0/subop/add %esp 8/imm32 + 9125 # . epilogue + 9126 5d/pop-to-ebp + 9127 c3/return + 9128 + 9129 test-compare-with-just-one-inout: + 9130 # . prologue + 9131 55/push-ebp + 9132 89/<- %ebp 4/r32/esp + 9133 # setup + 9134 (clear-stream _test-input-stream) + 9135 (clear-stream $_test-input-buffered-file->buffer) + 9136 (clear-stream _test-output-stream) + 9137 (clear-stream $_test-output-buffered-file->buffer) + 9138 (clear-stream _test-error-stream) + 9139 (clear-stream $_test-error-buffered-file->buffer) + 9140 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9141 68/push 0/imm32 + 9142 68/push 0/imm32 + 9143 89/<- %edx 4/r32/esp + 9144 (tailor-exit-descriptor %edx 0x10) + 9145 # + 9146 (write _test-input-stream "fn foo {\n") + 9147 (write _test-input-stream " var x: boolean\n") + 9148 (write _test-input-stream " compare x\n") + 9149 (write _test-input-stream "}\n") + 9150 # convert + 9151 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9152 # registers except esp clobbered at this point + 9153 # restore ed + 9154 89/<- %edx 4/r32/esp + 9155 (flush _test-output-buffered-file) + 9156 (flush _test-error-buffered-file) + 9157 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9163 # check output + 9164 (check-stream-equal _test-output-stream "" "F - test-compare-with-just-one-inout: output should be empty") + 9165 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must have two inouts" "F - test-compare-with-just-one-inout: error message") + 9166 # check that stop(1) was called + 9167 (check-ints-equal *(edx+4) 2 "F - test-compare-with-just-one-inout: exit status") + 9168 # don't restore from ebp + 9169 81 0/subop/add %esp 8/imm32 + 9170 # . epilogue + 9171 5d/pop-to-ebp + 9172 c3/return + 9173 + 9174 test-compare-with-too-many-inouts: + 9175 # . prologue + 9176 55/push-ebp + 9177 89/<- %ebp 4/r32/esp + 9178 # setup + 9179 (clear-stream _test-input-stream) + 9180 (clear-stream $_test-input-buffered-file->buffer) + 9181 (clear-stream _test-output-stream) + 9182 (clear-stream $_test-output-buffered-file->buffer) + 9183 (clear-stream _test-error-stream) + 9184 (clear-stream $_test-error-buffered-file->buffer) + 9185 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9186 68/push 0/imm32 + 9187 68/push 0/imm32 + 9188 89/<- %edx 4/r32/esp + 9189 (tailor-exit-descriptor %edx 0x10) + 9190 # + 9191 (write _test-input-stream "fn foo {\n") + 9192 (write _test-input-stream " var x: boolean\n") + 9193 (write _test-input-stream " compare x, 0, 0\n") + 9194 (write _test-input-stream "}\n") + 9195 # convert + 9196 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9197 # registers except esp clobbered at this point + 9198 # restore ed + 9199 89/<- %edx 4/r32/esp + 9200 (flush _test-output-buffered-file) + 9201 (flush _test-error-buffered-file) + 9202 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9208 # check output + 9209 (check-stream-equal _test-output-stream "" "F - test-compare-with-too-many-inouts: output should be empty") + 9210 (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") + 9211 # check that stop(1) was called + 9212 (check-ints-equal *(edx+4) 2 "F - test-compare-with-too-many-inouts: exit status") + 9213 # don't restore from ebp + 9214 81 0/subop/add %esp 8/imm32 + 9215 # . epilogue + 9216 5d/pop-to-ebp + 9217 c3/return + 9218 + 9219 test-compare-with-output: + 9220 # . prologue + 9221 55/push-ebp + 9222 89/<- %ebp 4/r32/esp + 9223 # setup + 9224 (clear-stream _test-input-stream) + 9225 (clear-stream $_test-input-buffered-file->buffer) + 9226 (clear-stream _test-output-stream) + 9227 (clear-stream $_test-output-buffered-file->buffer) + 9228 (clear-stream _test-error-stream) + 9229 (clear-stream $_test-error-buffered-file->buffer) + 9230 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9231 68/push 0/imm32 + 9232 68/push 0/imm32 + 9233 89/<- %edx 4/r32/esp + 9234 (tailor-exit-descriptor %edx 0x10) + 9235 # + 9236 (write _test-input-stream "fn foo {\n") + 9237 (write _test-input-stream " var x/eax: boolean <- copy 0\n") + 9238 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") + 9239 (write _test-input-stream " x <- compare y, 0\n") + 9240 (write _test-input-stream "}\n") + 9241 # convert + 9242 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9243 # registers except esp clobbered at this point + 9244 # restore ed + 9245 89/<- %edx 4/r32/esp + 9246 (flush _test-output-buffered-file) + 9247 (flush _test-error-buffered-file) + 9248 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9254 # check output + 9255 (check-stream-equal _test-output-stream "" "F - test-compare-with-output: output should be empty") + 9256 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must not have any outputs" "F - test-compare-with-output: error message") + 9257 # check that stop(1) was called + 9258 (check-ints-equal *(edx+4) 2 "F - test-compare-with-output: exit status") + 9259 # don't restore from ebp + 9260 81 0/subop/add %esp 8/imm32 + 9261 # . epilogue + 9262 5d/pop-to-ebp + 9263 c3/return + 9264 + 9265 test-compare-invalid-value-to-address: + 9266 # . prologue + 9267 55/push-ebp + 9268 89/<- %ebp 4/r32/esp + 9269 # setup + 9270 (clear-stream _test-input-stream) + 9271 (clear-stream $_test-input-buffered-file->buffer) + 9272 (clear-stream _test-output-stream) + 9273 (clear-stream $_test-output-buffered-file->buffer) + 9274 (clear-stream _test-error-stream) + 9275 (clear-stream $_test-error-buffered-file->buffer) + 9276 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9277 68/push 0/imm32 + 9278 68/push 0/imm32 + 9279 89/<- %edx 4/r32/esp + 9280 (tailor-exit-descriptor %edx 0x10) + 9281 # + 9282 (write _test-input-stream "fn foo {\n") + 9283 (write _test-input-stream " var x/eax: int <- copy 0\n") + 9284 (write _test-input-stream " var y: (addr int)\n") + 9285 (write _test-input-stream " compare y, x\n") + 9286 (write _test-input-stream "}\n") + 9287 # convert + 9288 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9289 # registers except esp clobbered at this point + 9290 # restore ed + 9291 89/<- %edx 4/r32/esp + 9292 (flush _test-output-buffered-file) + 9293 (flush _test-error-buffered-file) + 9294 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9300 # check output + 9301 (check-stream-equal _test-output-stream "" "F - test-compare-invalid-value-to-address: output should be empty") + 9302 (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") + 9303 # check that stop(1) was called + 9304 (check-ints-equal *(edx+4) 2 "F - test-compare-invalid-value-to-address: exit status") + 9305 # don't restore from ebp + 9306 81 0/subop/add %esp 8/imm32 + 9307 # . epilogue + 9308 5d/pop-to-ebp + 9309 c3/return + 9310 + 9311 test-compare-address: + 9312 # . prologue + 9313 55/push-ebp + 9314 89/<- %ebp 4/r32/esp + 9315 # setup + 9316 (clear-stream _test-input-stream) + 9317 (clear-stream $_test-input-buffered-file->buffer) + 9318 (clear-stream _test-output-stream) + 9319 (clear-stream $_test-output-buffered-file->buffer) + 9320 # + 9321 (write _test-input-stream "fn foo {\n") + 9322 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") + 9323 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") + 9324 (write _test-input-stream " compare y, x\n") + 9325 (write _test-input-stream "}\n") + 9326 # convert + 9327 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 9328 (flush _test-output-buffered-file) + 9329 # no errors + 9330 # . epilogue + 9331 5d/pop-to-ebp + 9332 c3/return + 9333 + 9334 test-compare-deref-address: + 9335 # . prologue + 9336 55/push-ebp + 9337 89/<- %ebp 4/r32/esp + 9338 # setup + 9339 (clear-stream _test-input-stream) + 9340 (clear-stream $_test-input-buffered-file->buffer) + 9341 (clear-stream _test-output-stream) + 9342 (clear-stream $_test-output-buffered-file->buffer) + 9343 # + 9344 (write _test-input-stream "fn foo {\n") + 9345 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") + 9346 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") + 9347 (write _test-input-stream " compare *y, x\n") + 9348 (write _test-input-stream "}\n") + 9349 # convert + 9350 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 9351 (flush _test-output-buffered-file) + 9352 # no errors + 9353 # . epilogue + 9354 5d/pop-to-ebp + 9355 c3/return + 9356 + 9357 test-compare-two-vars-in-memory: + 9358 # . prologue + 9359 55/push-ebp + 9360 89/<- %ebp 4/r32/esp + 9361 # setup + 9362 (clear-stream _test-input-stream) + 9363 (clear-stream $_test-input-buffered-file->buffer) + 9364 (clear-stream _test-output-stream) + 9365 (clear-stream $_test-output-buffered-file->buffer) + 9366 (clear-stream _test-error-stream) + 9367 (clear-stream $_test-error-buffered-file->buffer) + 9368 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9369 68/push 0/imm32 + 9370 68/push 0/imm32 + 9371 89/<- %edx 4/r32/esp + 9372 (tailor-exit-descriptor %edx 0x10) + 9373 # + 9374 (write _test-input-stream "fn foo {\n") + 9375 (write _test-input-stream " var x: boolean\n") + 9376 (write _test-input-stream " compare x, x\n") + 9377 (write _test-input-stream "}\n") + 9378 # convert + 9379 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9380 # registers except esp clobbered at this point + 9381 # restore ed + 9382 89/<- %edx 4/r32/esp + 9383 (flush _test-output-buffered-file) + 9384 (flush _test-error-buffered-file) + 9385 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9391 # check output + 9392 (check-stream-equal _test-output-stream "" "F - test-compare-two-vars-in-memory: output should be empty") + 9393 (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") + 9394 # check that stop(1) was called + 9395 (check-ints-equal *(edx+4) 2 "F - test-compare-two-vars-in-memory: exit status") + 9396 # don't restore from ebp + 9397 81 0/subop/add %esp 8/imm32 + 9398 # . epilogue + 9399 5d/pop-to-ebp + 9400 c3/return + 9401 + 9402 test-compare-non-scalar: + 9403 # . prologue + 9404 55/push-ebp + 9405 89/<- %ebp 4/r32/esp + 9406 # setup + 9407 (clear-stream _test-input-stream) + 9408 (clear-stream $_test-input-buffered-file->buffer) + 9409 (clear-stream _test-output-stream) + 9410 (clear-stream $_test-output-buffered-file->buffer) + 9411 (clear-stream _test-error-stream) + 9412 (clear-stream $_test-error-buffered-file->buffer) + 9413 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9414 68/push 0/imm32 + 9415 68/push 0/imm32 + 9416 89/<- %edx 4/r32/esp + 9417 (tailor-exit-descriptor %edx 0x10) + 9418 # + 9419 (write _test-input-stream "fn foo {\n") + 9420 (write _test-input-stream " var x: (handle int)\n") + 9421 (write _test-input-stream " var y: int\n") + 9422 (write _test-input-stream " compare y, x\n") + 9423 (write _test-input-stream "}\n") + 9424 # convert + 9425 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9426 # registers except esp clobbered at this point + 9427 # restore ed + 9428 89/<- %edx 4/r32/esp + 9429 (flush _test-output-buffered-file) + 9430 (flush _test-error-buffered-file) + 9431 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9437 # check output + 9438 (check-stream-equal _test-output-stream "" "F - test-compare-non-scalar: output should be empty") + 9439 #? (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") + 9440 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compare: both inouts are in memory" "F - test-compare-non-scalar: error message") + 9441 # check that stop(1) was called + 9442 (check-ints-equal *(edx+4) 2 "F - test-compare-non-scalar: exit status") + 9443 # don't restore from ebp + 9444 81 0/subop/add %esp 8/imm32 + 9445 # . epilogue + 9446 5d/pop-to-ebp + 9447 c3/return + 9448 + 9449 test-address-with-no-inout: + 9450 # . prologue + 9451 55/push-ebp + 9452 89/<- %ebp 4/r32/esp + 9453 # setup + 9454 (clear-stream _test-input-stream) + 9455 (clear-stream $_test-input-buffered-file->buffer) + 9456 (clear-stream _test-output-stream) + 9457 (clear-stream $_test-output-buffered-file->buffer) + 9458 (clear-stream _test-error-stream) + 9459 (clear-stream $_test-error-buffered-file->buffer) + 9460 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9461 68/push 0/imm32 + 9462 68/push 0/imm32 + 9463 89/<- %edx 4/r32/esp + 9464 (tailor-exit-descriptor %edx 0x10) + 9465 # + 9466 (write _test-input-stream "fn foo {\n") + 9467 (write _test-input-stream " var x/eax: boolean <- address\n") + 9468 (write _test-input-stream "}\n") + 9469 # convert + 9470 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9471 # registers except esp clobbered at this point + 9472 # restore ed 9473 89/<- %edx 4/r32/esp - 9474 (tailor-exit-descriptor %edx 0x10) - 9475 # - 9476 (write _test-input-stream "fn foo {\n") - 9477 (write _test-input-stream " var a: t\n") - 9478 (write _test-input-stream " var b: int\n") - 9479 (write _test-input-stream " var c/eax: (addr int) <- copy 0\n") - 9480 (write _test-input-stream " c, b <- get a, x\n") - 9481 (write _test-input-stream "}\n") - 9482 (write _test-input-stream "type t {\n") - 9483 (write _test-input-stream " x: int\n") - 9484 (write _test-input-stream "}\n") - 9485 # convert - 9486 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9487 # registers except esp clobbered at this point - 9488 # restore ed - 9489 89/<- %edx 4/r32/esp - 9490 (flush _test-output-buffered-file) - 9491 (flush _test-error-buffered-file) - 9492 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9498 # check output - 9499 (check-stream-equal _test-output-stream "" "F - test-get-with-too-many-outputs: output should be empty") - 9500 (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") - 9501 # check that stop(1) was called - 9502 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-many-outputs: exit status") - 9503 # don't restore from ebp - 9504 81 0/subop/add %esp 8/imm32 - 9505 # . epilogue - 9506 5d/pop-to-ebp - 9507 c3/return - 9508 - 9509 test-convert-array-of-user-defined-types: - 9510 # . prologue - 9511 55/push-ebp - 9512 89/<- %ebp 4/r32/esp - 9513 # setup - 9514 (clear-stream _test-input-stream) - 9515 (clear-stream $_test-input-buffered-file->buffer) - 9516 (clear-stream _test-output-stream) - 9517 (clear-stream $_test-output-buffered-file->buffer) - 9518 # - 9519 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 - 9520 (write _test-input-stream " x: int\n") - 9521 (write _test-input-stream " y: int\n") - 9522 (write _test-input-stream "}\n") - 9523 (write _test-input-stream "fn foo {\n") - 9524 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 9525 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 9526 (write _test-input-stream " var x/eax: (addr t) <- index arr, idx\n") - 9527 (write _test-input-stream "}\n") - 9528 # convert - 9529 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 9530 (flush _test-output-buffered-file) - 9531 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 9537 # check output - 9538 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-array-of-user-defined-types/0") - 9539 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-array-of-user-defined-types/1") - 9540 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-array-of-user-defined-types/2") - 9541 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-array-of-user-defined-types/3") - 9542 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-array-of-user-defined-types/4") - 9543 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-array-of-user-defined-types/5") - 9544 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-array-of-user-defined-types/6") - 9545 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-array-of-user-defined-types/7") - 9546 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-array-of-user-defined-types/8") - 9547 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-array-of-user-defined-types/9") - 9548 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 0x00000008 *eax \"foo\" \"arr\")" "F - test-convert-array-of-user-defined-types/10") - 9549 (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") - 9550 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-array-of-user-defined-types/12") - 9551 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-array-of-user-defined-types/13") - 9552 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-array-of-user-defined-types/14") - 9553 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-array-of-user-defined-types/15") - 9554 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-array-of-user-defined-types/16") - 9555 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-array-of-user-defined-types/17") - 9556 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-array-of-user-defined-types/18") - 9557 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-array-of-user-defined-types/19") - 9558 # . epilogue - 9559 89/<- %esp 5/r32/ebp - 9560 5d/pop-to-ebp - 9561 c3/return - 9562 - 9563 test-convert-length-of-array-of-user-defined-types-to-eax: - 9564 # . prologue - 9565 55/push-ebp - 9566 89/<- %ebp 4/r32/esp - 9567 # setup - 9568 (clear-stream _test-input-stream) - 9569 (clear-stream $_test-input-buffered-file->buffer) - 9570 (clear-stream _test-output-stream) - 9571 (clear-stream $_test-output-buffered-file->buffer) - 9572 # - 9573 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 - 9574 (write _test-input-stream " x: int\n") - 9575 (write _test-input-stream " y: int\n") - 9576 (write _test-input-stream " z: int\n") - 9577 (write _test-input-stream "}\n") - 9578 (write _test-input-stream "fn foo {\n") - 9579 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 9580 (write _test-input-stream " var x/eax: int <- length arr\n") - 9581 (write _test-input-stream "}\n") - 9582 # convert - 9583 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 9584 (flush _test-output-buffered-file) - 9585 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 9591 # check output - 9592 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/0") - 9593 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/1") - 9594 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/2") - 9595 (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") - 9596 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-eax/4") - 9597 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/5") - 9598 # var arr - 9599 (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") - 9600 (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") - 9601 # length instruction - 9602 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/8") - 9603 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/9") - 9604 (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") - 9605 (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") - 9606 (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") - 9607 (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") - 9608 (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") - 9609 (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") - 9610 # reclaim arr - 9611 (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") - 9612 # - 9613 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-eax/17") - 9614 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/18") - 9615 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/19") - 9616 (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") - 9617 (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") - 9618 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-eax/22") - 9619 # . epilogue - 9620 89/<- %esp 5/r32/ebp - 9621 5d/pop-to-ebp - 9622 c3/return - 9623 - 9624 test-convert-length-of-array-of-user-defined-types-to-ecx: - 9625 # . prologue - 9626 55/push-ebp - 9627 89/<- %ebp 4/r32/esp - 9628 # setup - 9629 (clear-stream _test-input-stream) - 9630 (clear-stream $_test-input-buffered-file->buffer) - 9631 (clear-stream _test-output-stream) - 9632 (clear-stream $_test-output-buffered-file->buffer) - 9633 # - 9634 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 - 9635 (write _test-input-stream " x: int\n") - 9636 (write _test-input-stream " y: int\n") - 9637 (write _test-input-stream " z: int\n") - 9638 (write _test-input-stream "}\n") - 9639 (write _test-input-stream "fn foo {\n") - 9640 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 9641 (write _test-input-stream " var x/ecx: int <- length arr\n") - 9642 (write _test-input-stream "}\n") - 9643 # convert - 9644 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 9645 (flush _test-output-buffered-file) - 9646 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 9652 # check output - 9653 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/0") - 9654 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/1") - 9655 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/2") - 9656 (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") - 9657 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/4") - 9658 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/5") - 9659 # var a - 9660 (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") - 9661 (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") - 9662 # var x - 9663 (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") - 9664 # length instruction - 9665 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/9") - 9666 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/10") - 9667 (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") - 9668 (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") - 9669 (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") - 9670 (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") - 9671 (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") - 9672 (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") - 9673 (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") - 9674 # reclaim x - 9675 (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") - 9676 # reclaim a - 9677 (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") - 9678 # - 9679 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/20") - 9680 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/21") - 9681 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/22") - 9682 (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") - 9683 (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") - 9684 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/25") - 9685 # . epilogue - 9686 89/<- %esp 5/r32/ebp - 9687 5d/pop-to-ebp - 9688 c3/return - 9689 - 9690 test-convert-length-of-array-of-user-defined-types-to-edx: - 9691 # . prologue - 9692 55/push-ebp - 9693 89/<- %ebp 4/r32/esp - 9694 # setup - 9695 (clear-stream _test-input-stream) - 9696 (clear-stream $_test-input-buffered-file->buffer) - 9697 (clear-stream _test-output-stream) - 9698 (clear-stream $_test-output-buffered-file->buffer) - 9699 # - 9700 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 - 9701 (write _test-input-stream " x: int\n") - 9702 (write _test-input-stream " y: int\n") - 9703 (write _test-input-stream " z: int\n") - 9704 (write _test-input-stream "}\n") - 9705 (write _test-input-stream "fn foo {\n") - 9706 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 9707 (write _test-input-stream " var x/edx: int <- length arr\n") - 9708 (write _test-input-stream "}\n") - 9709 # convert - 9710 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 9711 (flush _test-output-buffered-file) - 9712 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 9718 # check output - 9719 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/0") - 9720 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/1") - 9721 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/2") - 9722 (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") - 9723 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-edx/4") - 9724 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/5") - 9725 # var a - 9726 (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") - 9727 (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") - 9728 # var x - 9729 (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") - 9730 # length instruction - 9731 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/9") - 9732 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/10") - 9733 (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") - 9734 (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") - 9735 (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") - 9736 (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") - 9737 (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") - 9738 (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") - 9739 (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") - 9740 # reclaim x - 9741 (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") - 9742 # reclaim a - 9743 (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") - 9744 # - 9745 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-edx/20") - 9746 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/21") - 9747 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/22") - 9748 (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") - 9749 (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") - 9750 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-edx/25") - 9751 # . epilogue - 9752 89/<- %esp 5/r32/ebp - 9753 5d/pop-to-ebp - 9754 c3/return - 9755 - 9756 test-convert-length-of-array-of-user-defined-types: - 9757 # . prologue - 9758 55/push-ebp - 9759 89/<- %ebp 4/r32/esp - 9760 # setup - 9761 (clear-stream _test-input-stream) - 9762 (clear-stream $_test-input-buffered-file->buffer) - 9763 (clear-stream _test-output-stream) - 9764 (clear-stream $_test-output-buffered-file->buffer) - 9765 # - 9766 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 - 9767 (write _test-input-stream " x: int\n") - 9768 (write _test-input-stream " y: int\n") - 9769 (write _test-input-stream " z: int\n") - 9770 (write _test-input-stream "}\n") - 9771 (write _test-input-stream "fn foo {\n") - 9772 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 9773 (write _test-input-stream " var x/ebx: int <- length arr\n") - 9774 (write _test-input-stream "}\n") - 9775 # convert - 9776 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 9777 (flush _test-output-buffered-file) - 9778 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- - 9784 # check output - 9785 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types/0") - 9786 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types/1") - 9787 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types/2") - 9788 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types/3") - 9789 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types/4") - 9790 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types/5") - 9791 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types/6") - 9792 (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") - 9793 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-length-of-array-of-user-defined-types/8") - 9794 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types/9") - 9795 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types/10") - 9796 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types/11") - 9797 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types/12") - 9798 (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") - 9799 (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") - 9800 (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") - 9801 (check-next-stream-line-equal _test-output-stream " 89/<- %ebx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types/16") - 9802 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types/17") - 9803 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types/18") - 9804 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types/19") - 9805 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ebx" "F - test-convert-length-of-array-of-user-defined-types/20") - 9806 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types/21") - 9807 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types/22") - 9808 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types/23") - 9809 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types/24") - 9810 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types/25") - 9811 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types/26") - 9812 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types/27") - 9813 # . epilogue - 9814 89/<- %esp 5/r32/ebp - 9815 5d/pop-to-ebp - 9816 c3/return - 9817 - 9818 test-index-with-non-array-atom-base-type: - 9819 # . prologue - 9820 55/push-ebp - 9821 89/<- %ebp 4/r32/esp - 9822 # setup - 9823 (clear-stream _test-input-stream) - 9824 (clear-stream $_test-input-buffered-file->buffer) - 9825 (clear-stream _test-output-stream) - 9826 (clear-stream $_test-output-buffered-file->buffer) - 9827 (clear-stream _test-error-stream) - 9828 (clear-stream $_test-error-buffered-file->buffer) - 9829 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9830 68/push 0/imm32 - 9831 68/push 0/imm32 - 9832 89/<- %edx 4/r32/esp - 9833 (tailor-exit-descriptor %edx 0x10) - 9834 # - 9835 (write _test-input-stream "fn foo {\n") - 9836 (write _test-input-stream " var a: int\n") - 9837 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") - 9838 (write _test-input-stream "}\n") - 9839 # convert - 9840 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9841 # registers except esp clobbered at this point - 9842 # restore ed - 9843 89/<- %edx 4/r32/esp - 9844 (flush _test-output-buffered-file) - 9845 (flush _test-error-buffered-file) - 9846 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9852 # check output - 9853 (check-stream-equal _test-output-stream "" "F - test-index-with-non-array-atom-base-type: output should be empty") - 9854 (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") - 9855 # check that stop(1) was called - 9856 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-atom-base-type: exit status") - 9857 # don't restore from ebp - 9858 81 0/subop/add %esp 8/imm32 - 9859 # . epilogue - 9860 5d/pop-to-ebp - 9861 c3/return - 9862 - 9863 test-index-with-non-array-compound-base-type: - 9864 # . prologue - 9865 55/push-ebp - 9866 89/<- %ebp 4/r32/esp - 9867 # setup - 9868 (clear-stream _test-input-stream) - 9869 (clear-stream $_test-input-buffered-file->buffer) - 9870 (clear-stream _test-output-stream) - 9871 (clear-stream $_test-output-buffered-file->buffer) - 9872 (clear-stream _test-error-stream) - 9873 (clear-stream $_test-error-buffered-file->buffer) - 9874 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9875 68/push 0/imm32 - 9876 68/push 0/imm32 - 9877 89/<- %edx 4/r32/esp - 9878 (tailor-exit-descriptor %edx 0x10) - 9879 # - 9880 (write _test-input-stream "fn foo {\n") - 9881 (write _test-input-stream " var a: (handle int)\n") - 9882 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") - 9883 (write _test-input-stream "}\n") - 9884 # convert - 9885 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9886 # registers except esp clobbered at this point - 9887 # restore ed - 9888 89/<- %edx 4/r32/esp - 9889 (flush _test-output-buffered-file) - 9890 (flush _test-error-buffered-file) - 9891 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9897 # check output - 9898 (check-stream-equal _test-output-stream "" "F - test-index-with-non-array-compound-base-type: output should be empty") - 9899 (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") - 9900 # check that stop(1) was called - 9901 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-compound-base-type: exit status") - 9902 # don't restore from ebp - 9903 81 0/subop/add %esp 8/imm32 - 9904 # . epilogue - 9905 5d/pop-to-ebp - 9906 c3/return - 9907 - 9908 test-index-with-non-array-compound-base-type-2: - 9909 # . prologue - 9910 55/push-ebp - 9911 89/<- %ebp 4/r32/esp - 9912 # setup - 9913 (clear-stream _test-input-stream) - 9914 (clear-stream $_test-input-buffered-file->buffer) - 9915 (clear-stream _test-output-stream) - 9916 (clear-stream $_test-output-buffered-file->buffer) - 9917 (clear-stream _test-error-stream) - 9918 (clear-stream $_test-error-buffered-file->buffer) - 9919 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9920 68/push 0/imm32 - 9921 68/push 0/imm32 - 9922 89/<- %edx 4/r32/esp - 9923 (tailor-exit-descriptor %edx 0x10) - 9924 # - 9925 (write _test-input-stream "fn foo {\n") - 9926 (write _test-input-stream " var a: (addr int)\n") - 9927 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") - 9928 (write _test-input-stream "}\n") - 9929 # convert - 9930 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9931 # registers except esp clobbered at this point - 9932 # restore ed - 9933 89/<- %edx 4/r32/esp - 9934 (flush _test-output-buffered-file) - 9935 (flush _test-error-buffered-file) - 9936 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9942 # check output - 9943 (check-stream-equal _test-output-stream "" "F - test-index-with-non-array-compound-base-type-2: output should be empty") - 9944 (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") - 9945 # check that stop(1) was called - 9946 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-compound-base-type-2: exit status") - 9947 # don't restore from ebp - 9948 81 0/subop/add %esp 8/imm32 - 9949 # . epilogue - 9950 5d/pop-to-ebp - 9951 c3/return - 9952 - 9953 test-index-with-array-atom-base-type: - 9954 # . prologue - 9955 55/push-ebp - 9956 89/<- %ebp 4/r32/esp - 9957 # setup - 9958 (clear-stream _test-input-stream) - 9959 (clear-stream $_test-input-buffered-file->buffer) - 9960 (clear-stream _test-output-stream) - 9961 (clear-stream $_test-output-buffered-file->buffer) - 9962 (clear-stream _test-error-stream) - 9963 (clear-stream $_test-error-buffered-file->buffer) - 9964 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9965 68/push 0/imm32 - 9966 68/push 0/imm32 - 9967 89/<- %edx 4/r32/esp - 9968 (tailor-exit-descriptor %edx 0x10) - 9969 # - 9970 (write _test-input-stream "fn foo {\n") - 9971 (write _test-input-stream " var a: array\n") - 9972 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") - 9973 (write _test-input-stream "}\n") - 9974 # convert - 9975 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9976 # registers except esp clobbered at this point - 9977 # restore ed - 9978 89/<- %edx 4/r32/esp - 9979 (flush _test-output-buffered-file) - 9980 (flush _test-error-buffered-file) - 9981 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- - 9987 # check output - 9988 (check-stream-equal _test-output-stream "" "F - test-index-with-array-atom-base-type: output should be empty") - 9989 (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") - 9990 # check that stop(1) was called - 9991 (check-ints-equal *(edx+4) 2 "F - test-index-with-array-atom-base-type: exit status") - 9992 # don't restore from ebp - 9993 81 0/subop/add %esp 8/imm32 - 9994 # . epilogue - 9995 5d/pop-to-ebp - 9996 c3/return - 9997 - 9998 test-index-with-addr-base-on-stack: - 9999 # . prologue -10000 55/push-ebp -10001 89/<- %ebp 4/r32/esp -10002 # setup -10003 (clear-stream _test-input-stream) -10004 (clear-stream $_test-input-buffered-file->buffer) -10005 (clear-stream _test-output-stream) -10006 (clear-stream $_test-output-buffered-file->buffer) -10007 (clear-stream _test-error-stream) -10008 (clear-stream $_test-error-buffered-file->buffer) -10009 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10010 68/push 0/imm32 -10011 68/push 0/imm32 -10012 89/<- %edx 4/r32/esp -10013 (tailor-exit-descriptor %edx 0x10) -10014 # -10015 (write _test-input-stream "fn foo {\n") -10016 (write _test-input-stream " var a: (addr array int)\n") -10017 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") -10018 (write _test-input-stream "}\n") -10019 # convert -10020 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10021 # registers except esp clobbered at this point -10022 # restore ed -10023 89/<- %edx 4/r32/esp -10024 (flush _test-output-buffered-file) -10025 (flush _test-error-buffered-file) -10026 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10032 # check output -10033 (check-stream-equal _test-output-stream "" "F - test-index-with-addr-base-on-stack: output should be empty") -10034 (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") -10035 # check that stop(1) was called -10036 (check-ints-equal *(edx+4) 2 "F - test-index-with-addr-base-on-stack: exit status") -10037 # don't restore from ebp -10038 81 0/subop/add %esp 8/imm32 -10039 # . epilogue -10040 5d/pop-to-ebp -10041 c3/return -10042 -10043 test-index-with-wrong-index-type: -10044 # . prologue -10045 55/push-ebp -10046 89/<- %ebp 4/r32/esp -10047 # setup -10048 (clear-stream _test-input-stream) -10049 (clear-stream $_test-input-buffered-file->buffer) -10050 (clear-stream _test-output-stream) -10051 (clear-stream $_test-output-buffered-file->buffer) -10052 (clear-stream _test-error-stream) -10053 (clear-stream $_test-error-buffered-file->buffer) -10054 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10055 68/push 0/imm32 -10056 68/push 0/imm32 -10057 89/<- %edx 4/r32/esp -10058 (tailor-exit-descriptor %edx 0x10) -10059 # -10060 (write _test-input-stream "fn foo {\n") -10061 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") -10062 (write _test-input-stream " var b: boolean\n") -10063 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") -10064 (write _test-input-stream "}\n") -10065 # convert -10066 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10067 # registers except esp clobbered at this point -10068 # restore ed -10069 89/<- %edx 4/r32/esp -10070 (flush _test-output-buffered-file) -10071 (flush _test-error-buffered-file) -10072 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10078 # check output -10079 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-index-type: output should be empty") -10080 (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") -10081 # check that stop(1) was called -10082 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-index-type: exit status") -10083 # don't restore from ebp -10084 81 0/subop/add %esp 8/imm32 -10085 # . epilogue -10086 5d/pop-to-ebp -10087 c3/return -10088 -10089 test-index-with-offset-atom-index-type: -10090 # . prologue -10091 55/push-ebp -10092 89/<- %ebp 4/r32/esp -10093 # setup -10094 (clear-stream _test-input-stream) -10095 (clear-stream $_test-input-buffered-file->buffer) -10096 (clear-stream _test-output-stream) -10097 (clear-stream $_test-output-buffered-file->buffer) -10098 (clear-stream _test-error-stream) -10099 (clear-stream $_test-error-buffered-file->buffer) -10100 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10101 68/push 0/imm32 -10102 68/push 0/imm32 -10103 89/<- %edx 4/r32/esp -10104 (tailor-exit-descriptor %edx 0x10) -10105 # -10106 (write _test-input-stream "fn foo {\n") -10107 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") -10108 (write _test-input-stream " var b: offset\n") -10109 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") -10110 (write _test-input-stream "}\n") -10111 # convert -10112 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10113 # registers except esp clobbered at this point -10114 # restore ed -10115 89/<- %edx 4/r32/esp -10116 (flush _test-output-buffered-file) -10117 (flush _test-error-buffered-file) -10118 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10124 # check output -10125 (check-stream-equal _test-output-stream "" "F - test-index-with-offset-atom-index-type: output should be empty") -10126 (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") -10127 # check that stop(1) was called -10128 (check-ints-equal *(edx+4) 2 "F - test-index-with-offset-atom-index-type: exit status") -10129 # don't restore from ebp -10130 81 0/subop/add %esp 8/imm32 -10131 # . epilogue -10132 5d/pop-to-ebp -10133 c3/return -10134 -10135 test-index-with-offset-on-stack: -10136 # . prologue -10137 55/push-ebp -10138 89/<- %ebp 4/r32/esp -10139 # setup -10140 (clear-stream _test-input-stream) -10141 (clear-stream $_test-input-buffered-file->buffer) -10142 (clear-stream _test-output-stream) -10143 (clear-stream $_test-output-buffered-file->buffer) -10144 (clear-stream _test-error-stream) -10145 (clear-stream $_test-error-buffered-file->buffer) -10146 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10147 68/push 0/imm32 -10148 68/push 0/imm32 -10149 89/<- %edx 4/r32/esp -10150 (tailor-exit-descriptor %edx 0x10) -10151 # -10152 (write _test-input-stream "fn foo {\n") -10153 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") -10154 (write _test-input-stream " var b: int\n") -10155 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") -10156 (write _test-input-stream "}\n") -10157 # convert -10158 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10159 # registers except esp clobbered at this point -10160 # restore ed -10161 89/<- %edx 4/r32/esp -10162 (flush _test-output-buffered-file) -10163 (flush _test-error-buffered-file) -10164 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10170 # check output -10171 (check-stream-equal _test-output-stream "" "F - test-index-with-offset-on-stack: output should be empty") -10172 (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") -10173 # check that stop(1) was called -10174 (check-ints-equal *(edx+4) 2 "F - test-index-with-offset-on-stack: exit status") -10175 # don't restore from ebp -10176 81 0/subop/add %esp 8/imm32 -10177 # . epilogue -10178 5d/pop-to-ebp -10179 c3/return -10180 -10181 test-index-needs-offset-type: -10182 # . prologue -10183 55/push-ebp -10184 89/<- %ebp 4/r32/esp -10185 # setup -10186 (clear-stream _test-input-stream) -10187 (clear-stream $_test-input-buffered-file->buffer) -10188 (clear-stream _test-output-stream) -10189 (clear-stream $_test-output-buffered-file->buffer) -10190 (clear-stream _test-error-stream) -10191 (clear-stream $_test-error-buffered-file->buffer) -10192 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10193 68/push 0/imm32 -10194 68/push 0/imm32 -10195 89/<- %edx 4/r32/esp -10196 (tailor-exit-descriptor %edx 0x10) -10197 # -10198 (write _test-input-stream "fn foo {\n") -10199 (write _test-input-stream " var a/eax: (addr array t) <- copy 0\n") -10200 (write _test-input-stream " var b/ebx: int <- copy 0\n") -10201 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") -10202 (write _test-input-stream "}\n") -10203 (write _test-input-stream "type t {\n") # size 12 is not a power of two -10204 (write _test-input-stream " x: int\n") -10205 (write _test-input-stream " y: int\n") -10206 (write _test-input-stream " z: int\n") -10207 (write _test-input-stream "}\n") -10208 # convert -10209 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10210 # registers except esp clobbered at this point -10211 # restore ed -10212 89/<- %edx 4/r32/esp -10213 (flush _test-output-buffered-file) -10214 (flush _test-error-buffered-file) -10215 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10221 # check output -10222 (check-stream-equal _test-output-stream "" "F - test-index-needs-offset-type: output should be empty") -10223 (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") -10224 # check that stop(1) was called -10225 (check-ints-equal *(edx+4) 2 "F - test-index-needs-offset-type: exit status") -10226 # don't restore from ebp -10227 81 0/subop/add %esp 8/imm32 -10228 # . epilogue -10229 5d/pop-to-ebp -10230 c3/return -10231 -10232 test-index-with-output-not-address: -10233 # . prologue -10234 55/push-ebp -10235 89/<- %ebp 4/r32/esp -10236 # setup -10237 (clear-stream _test-input-stream) -10238 (clear-stream $_test-input-buffered-file->buffer) -10239 (clear-stream _test-output-stream) -10240 (clear-stream $_test-output-buffered-file->buffer) -10241 (clear-stream _test-error-stream) -10242 (clear-stream $_test-error-buffered-file->buffer) -10243 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10244 68/push 0/imm32 -10245 68/push 0/imm32 -10246 89/<- %edx 4/r32/esp -10247 (tailor-exit-descriptor %edx 0x10) -10248 # -10249 (write _test-input-stream "fn foo {\n") -10250 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") -10251 (write _test-input-stream " var o/edi: int <- index a, 0\n") -10252 (write _test-input-stream "}\n") -10253 # convert -10254 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10255 # registers except esp clobbered at this point -10256 # restore ed -10257 89/<- %edx 4/r32/esp -10258 (flush _test-output-buffered-file) -10259 (flush _test-error-buffered-file) -10260 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10266 # check output -10267 (check-stream-equal _test-output-stream "" "F - test-index-with-output-not-address: output should be empty") -10268 (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") -10269 # check that stop(1) was called -10270 (check-ints-equal *(edx+4) 2 "F - test-index-with-output-not-address: exit status") -10271 # don't restore from ebp -10272 81 0/subop/add %esp 8/imm32 -10273 # . epilogue -10274 5d/pop-to-ebp -10275 c3/return -10276 -10277 test-index-with-output-not-address-2: -10278 # . prologue -10279 55/push-ebp -10280 89/<- %ebp 4/r32/esp -10281 # setup -10282 (clear-stream _test-input-stream) -10283 (clear-stream $_test-input-buffered-file->buffer) -10284 (clear-stream _test-output-stream) -10285 (clear-stream $_test-output-buffered-file->buffer) -10286 (clear-stream _test-error-stream) -10287 (clear-stream $_test-error-buffered-file->buffer) -10288 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10289 68/push 0/imm32 -10290 68/push 0/imm32 -10291 89/<- %edx 4/r32/esp -10292 (tailor-exit-descriptor %edx 0x10) -10293 # -10294 (write _test-input-stream "fn foo {\n") -10295 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") -10296 (write _test-input-stream " var o/edi: (int) <- index a, 0\n") -10297 (write _test-input-stream "}\n") -10298 # convert -10299 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10300 # registers except esp clobbered at this point -10301 # restore ed + 9474 (flush _test-output-buffered-file) + 9475 (flush _test-error-buffered-file) + 9476 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9482 # check output + 9483 (check-stream-equal _test-output-stream "" "F - test-address-with-no-inout: output should be empty") + 9484 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' expects an inout" "F - test-address-with-no-inout: error message") + 9485 # check that stop(1) was called + 9486 (check-ints-equal *(edx+4) 2 "F - test-address-with-no-inout: exit status") + 9487 # don't restore from ebp + 9488 81 0/subop/add %esp 8/imm32 + 9489 # . epilogue + 9490 5d/pop-to-ebp + 9491 c3/return + 9492 + 9493 test-address-with-multiple-inouts: + 9494 # . prologue + 9495 55/push-ebp + 9496 89/<- %ebp 4/r32/esp + 9497 # setup + 9498 (clear-stream _test-input-stream) + 9499 (clear-stream $_test-input-buffered-file->buffer) + 9500 (clear-stream _test-output-stream) + 9501 (clear-stream $_test-output-buffered-file->buffer) + 9502 (clear-stream _test-error-stream) + 9503 (clear-stream $_test-error-buffered-file->buffer) + 9504 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9505 68/push 0/imm32 + 9506 68/push 0/imm32 + 9507 89/<- %edx 4/r32/esp + 9508 (tailor-exit-descriptor %edx 0x10) + 9509 # + 9510 (write _test-input-stream "fn foo {\n") + 9511 (write _test-input-stream " var x/eax: boolean <- address 0, 0\n") + 9512 (write _test-input-stream "}\n") + 9513 # convert + 9514 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9515 # registers except esp clobbered at this point + 9516 # restore ed + 9517 89/<- %edx 4/r32/esp + 9518 (flush _test-output-buffered-file) + 9519 (flush _test-error-buffered-file) + 9520 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9526 # check output + 9527 (check-stream-equal _test-output-stream "" "F - test-address-with-multiple-inouts: output should be empty") + 9528 (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") + 9529 # check that stop(1) was called + 9530 (check-ints-equal *(edx+4) 2 "F - test-address-with-multiple-inouts: exit status") + 9531 # don't restore from ebp + 9532 81 0/subop/add %esp 8/imm32 + 9533 # . epilogue + 9534 5d/pop-to-ebp + 9535 c3/return + 9536 + 9537 test-address-with-no-output: + 9538 # . prologue + 9539 55/push-ebp + 9540 89/<- %ebp 4/r32/esp + 9541 # setup + 9542 (clear-stream _test-input-stream) + 9543 (clear-stream $_test-input-buffered-file->buffer) + 9544 (clear-stream _test-output-stream) + 9545 (clear-stream $_test-output-buffered-file->buffer) + 9546 (clear-stream _test-error-stream) + 9547 (clear-stream $_test-error-buffered-file->buffer) + 9548 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9549 68/push 0/imm32 + 9550 68/push 0/imm32 + 9551 89/<- %edx 4/r32/esp + 9552 (tailor-exit-descriptor %edx 0x10) + 9553 # + 9554 (write _test-input-stream "fn foo {\n") + 9555 (write _test-input-stream " address 0\n") + 9556 (write _test-input-stream "}\n") + 9557 # convert + 9558 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9559 # registers except esp clobbered at this point + 9560 # restore ed + 9561 89/<- %edx 4/r32/esp + 9562 (flush _test-output-buffered-file) + 9563 (flush _test-error-buffered-file) + 9564 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9570 # check output + 9571 (check-stream-equal _test-output-stream "" "F - test-address-with-no-output: output should be empty") + 9572 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' expects an output" "F - test-address-with-no-output: error message") + 9573 # check that stop(1) was called + 9574 (check-ints-equal *(edx+4) 2 "F - test-address-with-no-output: exit status") + 9575 # don't restore from ebp + 9576 81 0/subop/add %esp 8/imm32 + 9577 # . epilogue + 9578 5d/pop-to-ebp + 9579 c3/return + 9580 + 9581 test-address-with-multiple-outputs: + 9582 # . prologue + 9583 55/push-ebp + 9584 89/<- %ebp 4/r32/esp + 9585 # setup + 9586 (clear-stream _test-input-stream) + 9587 (clear-stream $_test-input-buffered-file->buffer) + 9588 (clear-stream _test-output-stream) + 9589 (clear-stream $_test-output-buffered-file->buffer) + 9590 (clear-stream _test-error-stream) + 9591 (clear-stream $_test-error-buffered-file->buffer) + 9592 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9593 68/push 0/imm32 + 9594 68/push 0/imm32 + 9595 89/<- %edx 4/r32/esp + 9596 (tailor-exit-descriptor %edx 0x10) + 9597 # + 9598 (write _test-input-stream "fn foo {\n") + 9599 (write _test-input-stream " var x/eax: boolean <- copy 0\n") + 9600 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") + 9601 (write _test-input-stream " x, y <- address 0\n") + 9602 (write _test-input-stream "}\n") + 9603 # convert + 9604 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9605 # registers except esp clobbered at this point + 9606 # restore ed + 9607 89/<- %edx 4/r32/esp + 9608 (flush _test-output-buffered-file) + 9609 (flush _test-error-buffered-file) + 9610 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9616 # check output + 9617 (check-stream-equal _test-output-stream "" "F - test-address-with-multiple-outputs: output should be empty") + 9618 (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") + 9619 # check that stop(1) was called + 9620 (check-ints-equal *(edx+4) 2 "F - test-address-with-multiple-outputs: exit status") + 9621 # don't restore from ebp + 9622 81 0/subop/add %esp 8/imm32 + 9623 # . epilogue + 9624 5d/pop-to-ebp + 9625 c3/return + 9626 + 9627 # silly but it works + 9628 test-address-of-deref: + 9629 # . prologue + 9630 55/push-ebp + 9631 89/<- %ebp 4/r32/esp + 9632 # setup + 9633 (clear-stream _test-input-stream) + 9634 (clear-stream $_test-input-buffered-file->buffer) + 9635 (clear-stream _test-output-stream) + 9636 (clear-stream $_test-output-buffered-file->buffer) + 9637 # + 9638 (write _test-input-stream "fn foo {\n") + 9639 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") + 9640 (write _test-input-stream " var y/ecx: (addr int) <- address *x\n") + 9641 (write _test-input-stream "}\n") + 9642 # convert + 9643 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 9644 (flush _test-output-buffered-file) + 9645 # no errors + 9646 # . epilogue + 9647 5d/pop-to-ebp + 9648 c3/return + 9649 + 9650 test-address-to-non-register: + 9651 # . prologue + 9652 55/push-ebp + 9653 89/<- %ebp 4/r32/esp + 9654 # setup + 9655 (clear-stream _test-input-stream) + 9656 (clear-stream $_test-input-buffered-file->buffer) + 9657 (clear-stream _test-output-stream) + 9658 (clear-stream $_test-output-buffered-file->buffer) + 9659 (clear-stream _test-error-stream) + 9660 (clear-stream $_test-error-buffered-file->buffer) + 9661 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9662 68/push 0/imm32 + 9663 68/push 0/imm32 + 9664 89/<- %edx 4/r32/esp + 9665 (tailor-exit-descriptor %edx 0x10) + 9666 # + 9667 (write _test-input-stream "fn foo {\n") + 9668 (write _test-input-stream " var x: (addr int)\n") + 9669 (write _test-input-stream " x <- address 0\n") + 9670 (write _test-input-stream "}\n") + 9671 # convert + 9672 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9673 # registers except esp clobbered at this point + 9674 # restore ed + 9675 89/<- %edx 4/r32/esp + 9676 (flush _test-output-buffered-file) + 9677 (flush _test-error-buffered-file) + 9678 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9684 # check output + 9685 (check-stream-equal _test-output-stream "" "F - test-address-to-non-register: output should be empty") + 9686 (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") + 9687 # check that stop(1) was called + 9688 (check-ints-equal *(edx+4) 2 "F - test-address-to-non-register: exit status") + 9689 # don't restore from ebp + 9690 81 0/subop/add %esp 8/imm32 + 9691 # . epilogue + 9692 5d/pop-to-ebp + 9693 c3/return + 9694 + 9695 test-address-with-wrong-type: + 9696 # . prologue + 9697 55/push-ebp + 9698 89/<- %ebp 4/r32/esp + 9699 # setup + 9700 (clear-stream _test-input-stream) + 9701 (clear-stream $_test-input-buffered-file->buffer) + 9702 (clear-stream _test-output-stream) + 9703 (clear-stream $_test-output-buffered-file->buffer) + 9704 (clear-stream _test-error-stream) + 9705 (clear-stream $_test-error-buffered-file->buffer) + 9706 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9707 68/push 0/imm32 + 9708 68/push 0/imm32 + 9709 89/<- %edx 4/r32/esp + 9710 (tailor-exit-descriptor %edx 0x10) + 9711 # + 9712 (write _test-input-stream "fn foo {\n") + 9713 (write _test-input-stream " var x: int\n") + 9714 (write _test-input-stream " var y/eax: (addr boolean) <- address x\n") + 9715 (write _test-input-stream "}\n") + 9716 # convert + 9717 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9718 # registers except esp clobbered at this point + 9719 # restore ed + 9720 89/<- %edx 4/r32/esp + 9721 (flush _test-output-buffered-file) + 9722 (flush _test-error-buffered-file) + 9723 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9729 # check output + 9730 (check-stream-equal _test-output-stream "" "F - test-address-with-wrong-type: output should be empty") + 9731 (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") + 9732 # check that stop(1) was called + 9733 (check-ints-equal *(edx+4) 2 "F - test-address-with-wrong-type: exit status") + 9734 # don't restore from ebp + 9735 81 0/subop/add %esp 8/imm32 + 9736 # . epilogue + 9737 5d/pop-to-ebp + 9738 c3/return + 9739 + 9740 test-address-with-right-type-for-array: + 9741 # . prologue + 9742 55/push-ebp + 9743 89/<- %ebp 4/r32/esp + 9744 # setup + 9745 (clear-stream _test-input-stream) + 9746 (clear-stream $_test-input-buffered-file->buffer) + 9747 (clear-stream _test-output-stream) + 9748 (clear-stream $_test-output-buffered-file->buffer) + 9749 # + 9750 (write _test-input-stream "fn foo {\n") + 9751 (write _test-input-stream " var x: (array int 3)\n") + 9752 (write _test-input-stream " var y/eax: (addr array int) <- address x\n") + 9753 (write _test-input-stream "}\n") + 9754 # convert + 9755 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 9756 (flush _test-output-buffered-file) + 9757 # no errors + 9758 # . epilogue + 9759 89/<- %esp 5/r32/ebp + 9760 5d/pop-to-ebp + 9761 c3/return + 9762 + 9763 test-address-with-right-type-for-stream: + 9764 # . prologue + 9765 55/push-ebp + 9766 89/<- %ebp 4/r32/esp + 9767 # setup + 9768 (clear-stream _test-input-stream) + 9769 (clear-stream $_test-input-buffered-file->buffer) + 9770 (clear-stream _test-output-stream) + 9771 (clear-stream $_test-output-buffered-file->buffer) + 9772 # + 9773 (write _test-input-stream "fn foo {\n") + 9774 (write _test-input-stream " var x: (stream int 3)\n") + 9775 (write _test-input-stream " var y/eax: (addr stream int) <- address x\n") + 9776 (write _test-input-stream "}\n") + 9777 # convert + 9778 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 9779 (flush _test-output-buffered-file) + 9780 # no errors + 9781 # . epilogue + 9782 89/<- %esp 5/r32/ebp + 9783 5d/pop-to-ebp + 9784 c3/return + 9785 + 9786 test-get-with-wrong-field: + 9787 # . prologue + 9788 55/push-ebp + 9789 89/<- %ebp 4/r32/esp + 9790 # setup + 9791 (clear-stream _test-input-stream) + 9792 (clear-stream $_test-input-buffered-file->buffer) + 9793 (clear-stream _test-output-stream) + 9794 (clear-stream $_test-output-buffered-file->buffer) + 9795 (clear-stream _test-error-stream) + 9796 (clear-stream $_test-error-buffered-file->buffer) + 9797 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9798 68/push 0/imm32 + 9799 68/push 0/imm32 + 9800 89/<- %edx 4/r32/esp + 9801 (tailor-exit-descriptor %edx 0x10) + 9802 # + 9803 (write _test-input-stream "fn foo {\n") + 9804 (write _test-input-stream " var a: t\n") + 9805 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 9806 (write _test-input-stream "}\n") + 9807 (write _test-input-stream "type t {\n") + 9808 (write _test-input-stream " x: int\n") + 9809 (write _test-input-stream "}\n") + 9810 # convert + 9811 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9812 # registers except esp clobbered at this point + 9813 # restore ed + 9814 89/<- %edx 4/r32/esp + 9815 (flush _test-output-buffered-file) + 9816 (flush _test-error-buffered-file) + 9817 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9823 # check output + 9824 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-field: output should be empty") + 9825 (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") + 9826 # check that stop(1) was called + 9827 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-field: exit status") + 9828 # don't restore from ebp + 9829 81 0/subop/add %esp 8/imm32 + 9830 # . epilogue + 9831 5d/pop-to-ebp + 9832 c3/return + 9833 + 9834 test-get-with-wrong-base-type: + 9835 # . prologue + 9836 55/push-ebp + 9837 89/<- %ebp 4/r32/esp + 9838 # setup + 9839 (clear-stream _test-input-stream) + 9840 (clear-stream $_test-input-buffered-file->buffer) + 9841 (clear-stream _test-output-stream) + 9842 (clear-stream $_test-output-buffered-file->buffer) + 9843 (clear-stream _test-error-stream) + 9844 (clear-stream $_test-error-buffered-file->buffer) + 9845 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9846 68/push 0/imm32 + 9847 68/push 0/imm32 + 9848 89/<- %edx 4/r32/esp + 9849 (tailor-exit-descriptor %edx 0x10) + 9850 # + 9851 (write _test-input-stream "fn foo {\n") + 9852 (write _test-input-stream " var a: int\n") + 9853 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 9854 (write _test-input-stream "}\n") + 9855 # convert + 9856 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9857 # registers except esp clobbered at this point + 9858 # restore ed + 9859 89/<- %edx 4/r32/esp + 9860 (flush _test-output-buffered-file) + 9861 (flush _test-error-buffered-file) + 9862 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9868 # check output + 9869 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-base-type: output should be empty") + 9870 (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") + 9871 # check that stop(1) was called + 9872 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-base-type: exit status") + 9873 # don't restore from ebp + 9874 81 0/subop/add %esp 8/imm32 + 9875 # . epilogue + 9876 5d/pop-to-ebp + 9877 c3/return + 9878 + 9879 test-get-with-wrong-base-type-2: + 9880 # . prologue + 9881 55/push-ebp + 9882 89/<- %ebp 4/r32/esp + 9883 # setup + 9884 (clear-stream _test-input-stream) + 9885 (clear-stream $_test-input-buffered-file->buffer) + 9886 (clear-stream _test-output-stream) + 9887 (clear-stream $_test-output-buffered-file->buffer) + 9888 (clear-stream _test-error-stream) + 9889 (clear-stream $_test-error-buffered-file->buffer) + 9890 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9891 68/push 0/imm32 + 9892 68/push 0/imm32 + 9893 89/<- %edx 4/r32/esp + 9894 (tailor-exit-descriptor %edx 0x10) + 9895 # + 9896 (write _test-input-stream "fn foo {\n") + 9897 (write _test-input-stream " var a: (addr t)\n") + 9898 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 9899 (write _test-input-stream "}\n") + 9900 (write _test-input-stream "type t {\n") + 9901 (write _test-input-stream " x: int\n") + 9902 (write _test-input-stream "}\n") + 9903 # convert + 9904 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9905 # registers except esp clobbered at this point + 9906 # restore ed + 9907 89/<- %edx 4/r32/esp + 9908 (flush _test-output-buffered-file) + 9909 (flush _test-error-buffered-file) + 9910 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9916 # check output + 9917 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-base-type-2: output should be empty") + 9918 (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") + 9919 # check that stop(1) was called + 9920 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-base-type-2: exit status") + 9921 # don't restore from ebp + 9922 81 0/subop/add %esp 8/imm32 + 9923 # . epilogue + 9924 5d/pop-to-ebp + 9925 c3/return + 9926 + 9927 test-get-with-wrong-base-type-3: + 9928 # . prologue + 9929 55/push-ebp + 9930 89/<- %ebp 4/r32/esp + 9931 # setup + 9932 (clear-stream _test-input-stream) + 9933 (clear-stream $_test-input-buffered-file->buffer) + 9934 (clear-stream _test-output-stream) + 9935 (clear-stream $_test-output-buffered-file->buffer) + 9936 (clear-stream _test-error-stream) + 9937 (clear-stream $_test-error-buffered-file->buffer) + 9938 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9939 68/push 0/imm32 + 9940 68/push 0/imm32 + 9941 89/<- %edx 4/r32/esp + 9942 (tailor-exit-descriptor %edx 0x10) + 9943 # + 9944 (write _test-input-stream "fn foo {\n") + 9945 (write _test-input-stream " var a: (handle int)\n") + 9946 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 9947 (write _test-input-stream "}\n") + 9948 # convert + 9949 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9950 # registers except esp clobbered at this point + 9951 # restore ed + 9952 89/<- %edx 4/r32/esp + 9953 (flush _test-output-buffered-file) + 9954 (flush _test-error-buffered-file) + 9955 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 9961 # check output + 9962 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-base-type-3: output should be empty") + 9963 (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") + 9964 # check that stop(1) was called + 9965 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-base-type-3: exit status") + 9966 # don't restore from ebp + 9967 81 0/subop/add %esp 8/imm32 + 9968 # . epilogue + 9969 5d/pop-to-ebp + 9970 c3/return + 9971 + 9972 test-get-with-wrong-offset-type: + 9973 # . prologue + 9974 55/push-ebp + 9975 89/<- %ebp 4/r32/esp + 9976 # setup + 9977 (clear-stream _test-input-stream) + 9978 (clear-stream $_test-input-buffered-file->buffer) + 9979 (clear-stream _test-output-stream) + 9980 (clear-stream $_test-output-buffered-file->buffer) + 9981 (clear-stream _test-error-stream) + 9982 (clear-stream $_test-error-buffered-file->buffer) + 9983 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9984 68/push 0/imm32 + 9985 68/push 0/imm32 + 9986 89/<- %edx 4/r32/esp + 9987 (tailor-exit-descriptor %edx 0x10) + 9988 # + 9989 (write _test-input-stream "fn foo {\n") + 9990 (write _test-input-stream " var a: t\n") + 9991 (write _test-input-stream " var b: int\n") + 9992 (write _test-input-stream " var c/ecx: (addr int) <- get a, b\n") + 9993 (write _test-input-stream "}\n") + 9994 (write _test-input-stream "type t {\n") + 9995 (write _test-input-stream " x: int\n") + 9996 (write _test-input-stream "}\n") + 9997 # convert + 9998 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9999 # registers except esp clobbered at this point +10000 # restore ed +10001 89/<- %edx 4/r32/esp +10002 (flush _test-output-buffered-file) +10003 (flush _test-error-buffered-file) +10004 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10010 # check output +10011 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-offset-type: output should be empty") +10012 (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") +10013 # check that stop(1) was called +10014 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-offset-type: exit status") +10015 # don't restore from ebp +10016 81 0/subop/add %esp 8/imm32 +10017 # . epilogue +10018 5d/pop-to-ebp +10019 c3/return +10020 +10021 test-get-with-wrong-output-type: +10022 # . prologue +10023 55/push-ebp +10024 89/<- %ebp 4/r32/esp +10025 # setup +10026 (clear-stream _test-input-stream) +10027 (clear-stream $_test-input-buffered-file->buffer) +10028 (clear-stream _test-output-stream) +10029 (clear-stream $_test-output-buffered-file->buffer) +10030 (clear-stream _test-error-stream) +10031 (clear-stream $_test-error-buffered-file->buffer) +10032 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10033 68/push 0/imm32 +10034 68/push 0/imm32 +10035 89/<- %edx 4/r32/esp +10036 (tailor-exit-descriptor %edx 0x10) +10037 # +10038 (write _test-input-stream "fn foo {\n") +10039 (write _test-input-stream " var a: t\n") +10040 (write _test-input-stream " var c: (addr int)\n") +10041 (write _test-input-stream " c <- get a, x\n") +10042 (write _test-input-stream "}\n") +10043 (write _test-input-stream "type t {\n") +10044 (write _test-input-stream " x: int\n") +10045 (write _test-input-stream "}\n") +10046 # convert +10047 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10048 # registers except esp clobbered at this point +10049 # restore ed +10050 89/<- %edx 4/r32/esp +10051 (flush _test-output-buffered-file) +10052 (flush _test-error-buffered-file) +10053 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10059 # check output +10060 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type: output should be empty") +10061 (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") +10062 # check that stop(1) was called +10063 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type: exit status") +10064 # don't restore from ebp +10065 81 0/subop/add %esp 8/imm32 +10066 # . epilogue +10067 5d/pop-to-ebp +10068 c3/return +10069 +10070 test-get-with-wrong-output-type-2: +10071 # . prologue +10072 55/push-ebp +10073 89/<- %ebp 4/r32/esp +10074 # setup +10075 (clear-stream _test-input-stream) +10076 (clear-stream $_test-input-buffered-file->buffer) +10077 (clear-stream _test-output-stream) +10078 (clear-stream $_test-output-buffered-file->buffer) +10079 (clear-stream _test-error-stream) +10080 (clear-stream $_test-error-buffered-file->buffer) +10081 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10082 68/push 0/imm32 +10083 68/push 0/imm32 +10084 89/<- %edx 4/r32/esp +10085 (tailor-exit-descriptor %edx 0x10) +10086 # +10087 (write _test-input-stream "fn foo {\n") +10088 (write _test-input-stream " var a: t\n") +10089 (write _test-input-stream " var c/ecx: int <- get a, x\n") +10090 (write _test-input-stream "}\n") +10091 (write _test-input-stream "type t {\n") +10092 (write _test-input-stream " x: int\n") +10093 (write _test-input-stream "}\n") +10094 # convert +10095 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10096 # registers except esp clobbered at this point +10097 # restore ed +10098 89/<- %edx 4/r32/esp +10099 (flush _test-output-buffered-file) +10100 (flush _test-error-buffered-file) +10101 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10107 # check output +10108 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-2: output should be empty") +10109 (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") +10110 # check that stop(1) was called +10111 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-2: exit status") +10112 # don't restore from ebp +10113 81 0/subop/add %esp 8/imm32 +10114 # . epilogue +10115 5d/pop-to-ebp +10116 c3/return +10117 +10118 test-get-with-wrong-output-type-3: +10119 # . prologue +10120 55/push-ebp +10121 89/<- %ebp 4/r32/esp +10122 # setup +10123 (clear-stream _test-input-stream) +10124 (clear-stream $_test-input-buffered-file->buffer) +10125 (clear-stream _test-output-stream) +10126 (clear-stream $_test-output-buffered-file->buffer) +10127 (clear-stream _test-error-stream) +10128 (clear-stream $_test-error-buffered-file->buffer) +10129 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10130 68/push 0/imm32 +10131 68/push 0/imm32 +10132 89/<- %edx 4/r32/esp +10133 (tailor-exit-descriptor %edx 0x10) +10134 # +10135 (write _test-input-stream "fn foo {\n") +10136 (write _test-input-stream " var a: t\n") +10137 (write _test-input-stream " var c/ecx: (array int) <- get a, x\n") +10138 (write _test-input-stream "}\n") +10139 (write _test-input-stream "type t {\n") +10140 (write _test-input-stream " x: int\n") +10141 (write _test-input-stream "}\n") +10142 # convert +10143 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10144 # registers except esp clobbered at this point +10145 # restore ed +10146 89/<- %edx 4/r32/esp +10147 (flush _test-output-buffered-file) +10148 (flush _test-error-buffered-file) +10149 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10155 # check output +10156 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-3: output should be empty") +10157 (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") +10158 # check that stop(1) was called +10159 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-3: exit status") +10160 # don't restore from ebp +10161 81 0/subop/add %esp 8/imm32 +10162 # . epilogue +10163 5d/pop-to-ebp +10164 c3/return +10165 +10166 test-get-with-wrong-output-type-4: +10167 # . prologue +10168 55/push-ebp +10169 89/<- %ebp 4/r32/esp +10170 # setup +10171 (clear-stream _test-input-stream) +10172 (clear-stream $_test-input-buffered-file->buffer) +10173 (clear-stream _test-output-stream) +10174 (clear-stream $_test-output-buffered-file->buffer) +10175 (clear-stream _test-error-stream) +10176 (clear-stream $_test-error-buffered-file->buffer) +10177 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10178 68/push 0/imm32 +10179 68/push 0/imm32 +10180 89/<- %edx 4/r32/esp +10181 (tailor-exit-descriptor %edx 0x10) +10182 # +10183 (write _test-input-stream "fn foo {\n") +10184 (write _test-input-stream " var a: t\n") +10185 (write _test-input-stream " var c/ecx: (addr boolean) <- get a, x\n") +10186 (write _test-input-stream "}\n") +10187 (write _test-input-stream "type t {\n") +10188 (write _test-input-stream " x: int\n") +10189 (write _test-input-stream "}\n") +10190 # convert +10191 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10192 # registers except esp clobbered at this point +10193 # restore ed +10194 89/<- %edx 4/r32/esp +10195 (flush _test-output-buffered-file) +10196 (flush _test-error-buffered-file) +10197 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10203 # check output +10204 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-4: output should be empty") +10205 (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") +10206 # check that stop(1) was called +10207 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-4: exit status") +10208 # don't restore from ebp +10209 81 0/subop/add %esp 8/imm32 +10210 # . epilogue +10211 5d/pop-to-ebp +10212 c3/return +10213 +10214 test-get-with-wrong-output-type-5: +10215 # . prologue +10216 55/push-ebp +10217 89/<- %ebp 4/r32/esp +10218 # setup +10219 (clear-stream _test-input-stream) +10220 (clear-stream $_test-input-buffered-file->buffer) +10221 (clear-stream _test-output-stream) +10222 (clear-stream $_test-output-buffered-file->buffer) +10223 # +10224 (write _test-input-stream "fn foo {\n") +10225 (write _test-input-stream " var a: t\n") +10226 (write _test-input-stream " var c/ecx: (addr handle int) <- get a, x\n") +10227 (write _test-input-stream "}\n") +10228 (write _test-input-stream "type t {\n") +10229 (write _test-input-stream " x: (handle int)\n") +10230 (write _test-input-stream "}\n") +10231 # convert +10232 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +10233 (flush _test-output-buffered-file) +10234 # no errors +10235 # . epilogue +10236 89/<- %esp 5/r32/ebp +10237 5d/pop-to-ebp +10238 c3/return +10239 +10240 test-get-with-too-few-inouts: +10241 # . prologue +10242 55/push-ebp +10243 89/<- %ebp 4/r32/esp +10244 # setup +10245 (clear-stream _test-input-stream) +10246 (clear-stream $_test-input-buffered-file->buffer) +10247 (clear-stream _test-output-stream) +10248 (clear-stream $_test-output-buffered-file->buffer) +10249 (clear-stream _test-error-stream) +10250 (clear-stream $_test-error-buffered-file->buffer) +10251 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10252 68/push 0/imm32 +10253 68/push 0/imm32 +10254 89/<- %edx 4/r32/esp +10255 (tailor-exit-descriptor %edx 0x10) +10256 # +10257 (write _test-input-stream "fn foo {\n") +10258 (write _test-input-stream " var a: t\n") +10259 (write _test-input-stream " var c/ecx: (addr int) <- get a\n") +10260 (write _test-input-stream "}\n") +10261 (write _test-input-stream "type t {\n") +10262 (write _test-input-stream " x: int\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-get-with-too-few-inouts: output should be empty") +10279 (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") +10280 # check that stop(1) was called +10281 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-few-inouts: 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-get-with-too-many-inouts: +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 (flush _test-output-buffered-file) -10304 (flush _test-error-buffered-file) -10305 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10311 # check output -10312 (check-stream-equal _test-output-stream "" "F - test-index-with-output-not-address-2: output should be empty") -10313 (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") -10314 # check that stop(1) was called -10315 (check-ints-equal *(edx+4) 2 "F - test-index-with-output-not-address-2: exit status") -10316 # don't restore from ebp -10317 81 0/subop/add %esp 8/imm32 -10318 # . epilogue -10319 5d/pop-to-ebp -10320 c3/return -10321 -10322 test-index-with-wrong-output-type: -10323 # . prologue -10324 55/push-ebp -10325 89/<- %ebp 4/r32/esp -10326 # setup -10327 (clear-stream _test-input-stream) -10328 (clear-stream $_test-input-buffered-file->buffer) -10329 (clear-stream _test-output-stream) -10330 (clear-stream $_test-output-buffered-file->buffer) -10331 (clear-stream _test-error-stream) -10332 (clear-stream $_test-error-buffered-file->buffer) -10333 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10334 68/push 0/imm32 -10335 68/push 0/imm32 -10336 89/<- %edx 4/r32/esp -10337 (tailor-exit-descriptor %edx 0x10) -10338 # -10339 (write _test-input-stream "fn foo {\n") -10340 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") -10341 (write _test-input-stream " var o/edi: (addr int) <- index a, 0\n") -10342 (write _test-input-stream "}\n") -10343 # convert -10344 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10345 # registers except esp clobbered at this point -10346 # restore ed -10347 89/<- %edx 4/r32/esp -10348 (flush _test-output-buffered-file) -10349 (flush _test-error-buffered-file) -10350 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10356 # check output -10357 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-output-type: output should be empty") -10358 (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") -10359 # check that stop(1) was called -10360 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-output-type: exit status") -10361 # don't restore from ebp -10362 81 0/subop/add %esp 8/imm32 -10363 # . epilogue -10364 5d/pop-to-ebp -10365 c3/return -10366 -10367 test-index-with-wrong-output-compound-type: -10368 # . prologue -10369 55/push-ebp -10370 89/<- %ebp 4/r32/esp -10371 # setup -10372 (clear-stream _test-input-stream) -10373 (clear-stream $_test-input-buffered-file->buffer) -10374 (clear-stream _test-output-stream) -10375 (clear-stream $_test-output-buffered-file->buffer) -10376 (clear-stream _test-error-stream) -10377 (clear-stream $_test-error-buffered-file->buffer) -10378 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10379 68/push 0/imm32 -10380 68/push 0/imm32 -10381 89/<- %edx 4/r32/esp -10382 (tailor-exit-descriptor %edx 0x10) -10383 # -10384 (write _test-input-stream "fn foo {\n") -10385 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") -10386 (write _test-input-stream " var o/edi: (addr handle int) <- index a, 0\n") -10387 (write _test-input-stream "}\n") -10388 # convert -10389 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10390 # registers except esp clobbered at this point -10391 # restore ed -10392 89/<- %edx 4/r32/esp -10393 (flush _test-output-buffered-file) -10394 (flush _test-error-buffered-file) -10395 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10401 # check output -10402 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-output-compound-type: output should be empty") -10403 (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") -10404 # check that stop(1) was called -10405 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-output-compound-type: exit status") -10406 # don't restore from ebp -10407 81 0/subop/add %esp 8/imm32 -10408 # . epilogue -10409 5d/pop-to-ebp -10410 c3/return -10411 -10412 test-index-with-no-inouts: -10413 # . prologue -10414 55/push-ebp -10415 89/<- %ebp 4/r32/esp -10416 # setup -10417 (clear-stream _test-input-stream) -10418 (clear-stream $_test-input-buffered-file->buffer) -10419 (clear-stream _test-output-stream) -10420 (clear-stream $_test-output-buffered-file->buffer) -10421 (clear-stream _test-error-stream) -10422 (clear-stream $_test-error-buffered-file->buffer) -10423 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10424 68/push 0/imm32 -10425 68/push 0/imm32 -10426 89/<- %edx 4/r32/esp -10427 (tailor-exit-descriptor %edx 0x10) -10428 # -10429 (write _test-input-stream "fn foo {\n") -10430 (write _test-input-stream " var c/ecx: (addr int) <- index\n") -10431 (write _test-input-stream "}\n") -10432 # convert -10433 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10434 # registers except esp clobbered at this point -10435 # restore ed -10436 89/<- %edx 4/r32/esp -10437 (flush _test-output-buffered-file) -10438 (flush _test-error-buffered-file) -10439 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10445 # check output -10446 (check-stream-equal _test-output-stream "" "F - test-index-with-no-inouts: output should be empty") -10447 (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") -10448 # check that stop(1) was called -10449 (check-ints-equal *(edx+4) 2 "F - test-index-with-no-inouts: exit status") -10450 # don't restore from ebp -10451 81 0/subop/add %esp 8/imm32 -10452 # . epilogue -10453 5d/pop-to-ebp -10454 c3/return -10455 -10456 test-index-with-too-few-inouts: -10457 # . prologue -10458 55/push-ebp -10459 89/<- %ebp 4/r32/esp -10460 # setup -10461 (clear-stream _test-input-stream) -10462 (clear-stream $_test-input-buffered-file->buffer) -10463 (clear-stream _test-output-stream) -10464 (clear-stream $_test-output-buffered-file->buffer) -10465 (clear-stream _test-error-stream) -10466 (clear-stream $_test-error-buffered-file->buffer) -10467 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10468 68/push 0/imm32 -10469 68/push 0/imm32 -10470 89/<- %edx 4/r32/esp -10471 (tailor-exit-descriptor %edx 0x10) -10472 # -10473 (write _test-input-stream "fn foo {\n") -10474 (write _test-input-stream " var a: (array int 3)\n") -10475 (write _test-input-stream " var c/ecx: (addr int) <- index a\n") -10476 (write _test-input-stream "}\n") -10477 # convert -10478 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10479 # registers except esp clobbered at this point -10480 # restore ed -10481 89/<- %edx 4/r32/esp -10482 (flush _test-output-buffered-file) -10483 (flush _test-error-buffered-file) -10484 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10490 # check output -10491 (check-stream-equal _test-output-stream "" "F - test-index-with-too-few-inouts: output should be empty") -10492 (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") -10493 # check that stop(1) was called -10494 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-few-inouts: exit status") -10495 # don't restore from ebp -10496 81 0/subop/add %esp 8/imm32 -10497 # . epilogue -10498 5d/pop-to-ebp -10499 c3/return -10500 -10501 test-index-with-too-many-inouts: -10502 # . prologue -10503 55/push-ebp -10504 89/<- %ebp 4/r32/esp -10505 # setup -10506 (clear-stream _test-input-stream) -10507 (clear-stream $_test-input-buffered-file->buffer) -10508 (clear-stream _test-output-stream) -10509 (clear-stream $_test-output-buffered-file->buffer) -10510 (clear-stream _test-error-stream) -10511 (clear-stream $_test-error-buffered-file->buffer) -10512 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10513 68/push 0/imm32 -10514 68/push 0/imm32 -10515 89/<- %edx 4/r32/esp -10516 (tailor-exit-descriptor %edx 0x10) -10517 # -10518 (write _test-input-stream "fn foo {\n") -10519 (write _test-input-stream " var a: (array int 3)\n") -10520 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0, 0\n") -10521 (write _test-input-stream "}\n") -10522 # convert -10523 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10524 # registers except esp clobbered at this point -10525 # restore ed -10526 89/<- %edx 4/r32/esp -10527 (flush _test-output-buffered-file) -10528 (flush _test-error-buffered-file) -10529 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10535 # check output -10536 (check-stream-equal _test-output-stream "" "F - test-index-with-too-many-inouts: output should be empty") -10537 (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") -10538 # check that stop(1) was called -10539 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-many-inouts: exit status") -10540 # don't restore from ebp -10541 81 0/subop/add %esp 8/imm32 -10542 # . epilogue -10543 5d/pop-to-ebp -10544 c3/return -10545 -10546 test-index-with-no-output: -10547 # . prologue -10548 55/push-ebp -10549 89/<- %ebp 4/r32/esp -10550 # setup -10551 (clear-stream _test-input-stream) -10552 (clear-stream $_test-input-buffered-file->buffer) -10553 (clear-stream _test-output-stream) -10554 (clear-stream $_test-output-buffered-file->buffer) -10555 (clear-stream _test-error-stream) -10556 (clear-stream $_test-error-buffered-file->buffer) -10557 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10558 68/push 0/imm32 -10559 68/push 0/imm32 -10560 89/<- %edx 4/r32/esp -10561 (tailor-exit-descriptor %edx 0x10) -10562 # -10563 (write _test-input-stream "fn foo {\n") -10564 (write _test-input-stream " var a: (array int 3)\n") -10565 (write _test-input-stream " index a, 0\n") -10566 (write _test-input-stream "}\n") -10567 # convert -10568 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10569 # registers except esp clobbered at this point -10570 # restore ed -10571 89/<- %edx 4/r32/esp -10572 (flush _test-output-buffered-file) -10573 (flush _test-error-buffered-file) -10574 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10580 # check output -10581 (check-stream-equal _test-output-stream "" "F - test-index-with-no-output: output should be empty") -10582 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: must have an output" "F - test-index-with-no-output: error message") -10583 # check that stop(1) was called -10584 (check-ints-equal *(edx+4) 2 "F - test-index-with-no-output: exit status") -10585 # don't restore from ebp -10586 81 0/subop/add %esp 8/imm32 -10587 # . epilogue -10588 5d/pop-to-ebp -10589 c3/return -10590 -10591 test-index-with-too-many-outputs: -10592 # . prologue -10593 55/push-ebp -10594 89/<- %ebp 4/r32/esp -10595 # setup -10596 (clear-stream _test-input-stream) -10597 (clear-stream $_test-input-buffered-file->buffer) -10598 (clear-stream _test-output-stream) -10599 (clear-stream $_test-output-buffered-file->buffer) -10600 (clear-stream _test-error-stream) -10601 (clear-stream $_test-error-buffered-file->buffer) -10602 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10603 68/push 0/imm32 -10604 68/push 0/imm32 -10605 89/<- %edx 4/r32/esp -10606 (tailor-exit-descriptor %edx 0x10) -10607 # -10608 (write _test-input-stream "fn foo {\n") -10609 (write _test-input-stream " var a: (array int 3)\n") -10610 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") -10611 (write _test-input-stream " var c/ecx: (addr int) <- copy 0\n") -10612 (write _test-input-stream " b, c <- index a, 0\n") -10613 (write _test-input-stream "}\n") -10614 # convert -10615 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10616 # registers except esp clobbered at this point -10617 # restore ed -10618 89/<- %edx 4/r32/esp -10619 (flush _test-output-buffered-file) -10620 (flush _test-error-buffered-file) -10621 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10627 # check output -10628 (check-stream-equal _test-output-stream "" "F - test-index-with-too-many-outputs: output should be empty") -10629 (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") -10630 # check that stop(1) was called -10631 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-many-outputs: exit status") -10632 # don't restore from ebp -10633 81 0/subop/add %esp 8/imm32 -10634 # . epilogue -10635 5d/pop-to-ebp -10636 c3/return -10637 -10638 test-compute-offset-with-non-array-atom-base-type: -10639 # . prologue -10640 55/push-ebp -10641 89/<- %ebp 4/r32/esp -10642 # setup -10643 (clear-stream _test-input-stream) -10644 (clear-stream $_test-input-buffered-file->buffer) -10645 (clear-stream _test-output-stream) -10646 (clear-stream $_test-output-buffered-file->buffer) -10647 (clear-stream _test-error-stream) -10648 (clear-stream $_test-error-buffered-file->buffer) -10649 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10650 68/push 0/imm32 -10651 68/push 0/imm32 -10652 89/<- %edx 4/r32/esp -10653 (tailor-exit-descriptor %edx 0x10) -10654 # -10655 (write _test-input-stream "fn foo {\n") -10656 (write _test-input-stream " var a: int\n") -10657 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") -10658 (write _test-input-stream "}\n") -10659 # convert -10660 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10661 # registers except esp clobbered at this point -10662 # restore ed -10663 89/<- %edx 4/r32/esp -10664 (flush _test-output-buffered-file) -10665 (flush _test-error-buffered-file) -10666 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10672 # check output -10673 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-atom-base-type: output should be empty") -10674 (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") -10675 # check that stop(1) was called -10676 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-atom-base-type: exit status") -10677 # don't restore from ebp -10678 81 0/subop/add %esp 8/imm32 -10679 # . epilogue -10680 5d/pop-to-ebp -10681 c3/return -10682 -10683 test-compute-offset-with-non-array-compound-base-type: -10684 # . prologue -10685 55/push-ebp -10686 89/<- %ebp 4/r32/esp -10687 # setup -10688 (clear-stream _test-input-stream) -10689 (clear-stream $_test-input-buffered-file->buffer) -10690 (clear-stream _test-output-stream) -10691 (clear-stream $_test-output-buffered-file->buffer) -10692 (clear-stream _test-error-stream) -10693 (clear-stream $_test-error-buffered-file->buffer) -10694 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10695 68/push 0/imm32 -10696 68/push 0/imm32 -10697 89/<- %edx 4/r32/esp -10698 (tailor-exit-descriptor %edx 0x10) -10699 # -10700 (write _test-input-stream "fn foo {\n") -10701 (write _test-input-stream " var a: (handle int)\n") -10702 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") -10703 (write _test-input-stream "}\n") -10704 # convert -10705 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10706 # registers except esp clobbered at this point -10707 # restore ed -10708 89/<- %edx 4/r32/esp -10709 (flush _test-output-buffered-file) -10710 (flush _test-error-buffered-file) -10711 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10717 # check output -10718 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-compound-base-type: output should be empty") -10719 (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") -10720 # check that stop(1) was called -10721 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-compound-base-type: exit status") -10722 # don't restore from ebp -10723 81 0/subop/add %esp 8/imm32 -10724 # . epilogue -10725 5d/pop-to-ebp -10726 c3/return -10727 -10728 test-compute-offset-with-non-array-compound-base-type-2: -10729 # . prologue -10730 55/push-ebp -10731 89/<- %ebp 4/r32/esp -10732 # setup -10733 (clear-stream _test-input-stream) -10734 (clear-stream $_test-input-buffered-file->buffer) -10735 (clear-stream _test-output-stream) -10736 (clear-stream $_test-output-buffered-file->buffer) -10737 (clear-stream _test-error-stream) -10738 (clear-stream $_test-error-buffered-file->buffer) -10739 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10740 68/push 0/imm32 -10741 68/push 0/imm32 -10742 89/<- %edx 4/r32/esp -10743 (tailor-exit-descriptor %edx 0x10) -10744 # -10745 (write _test-input-stream "fn foo {\n") -10746 (write _test-input-stream " var a: (addr int)\n") -10747 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") -10748 (write _test-input-stream "}\n") -10749 # convert -10750 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10751 # registers except esp clobbered at this point -10752 # restore ed -10753 89/<- %edx 4/r32/esp -10754 (flush _test-output-buffered-file) -10755 (flush _test-error-buffered-file) -10756 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10762 # check output -10763 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-compound-base-type-2: output should be empty") -10764 (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") -10765 # check that stop(1) was called -10766 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-compound-base-type-2: exit status") -10767 # don't restore from ebp -10768 81 0/subop/add %esp 8/imm32 -10769 # . epilogue -10770 5d/pop-to-ebp -10771 c3/return -10772 -10773 test-compute-offset-with-array-atom-base-type: -10774 # . prologue -10775 55/push-ebp -10776 89/<- %ebp 4/r32/esp -10777 # setup -10778 (clear-stream _test-input-stream) -10779 (clear-stream $_test-input-buffered-file->buffer) -10780 (clear-stream _test-output-stream) -10781 (clear-stream $_test-output-buffered-file->buffer) -10782 (clear-stream _test-error-stream) -10783 (clear-stream $_test-error-buffered-file->buffer) -10784 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10785 68/push 0/imm32 -10786 68/push 0/imm32 -10787 89/<- %edx 4/r32/esp -10788 (tailor-exit-descriptor %edx 0x10) -10789 # -10790 (write _test-input-stream "fn foo {\n") -10791 (write _test-input-stream " var a: array\n") -10792 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") -10793 (write _test-input-stream "}\n") -10794 # convert -10795 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10796 # registers except esp clobbered at this point -10797 # restore ed -10798 89/<- %edx 4/r32/esp -10799 (flush _test-output-buffered-file) -10800 (flush _test-error-buffered-file) -10801 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10807 # check output -10808 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-array-atom-base-type: output should be empty") -10809 (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") -10810 # check that stop(1) was called -10811 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-array-atom-base-type: exit status") -10812 # don't restore from ebp -10813 81 0/subop/add %esp 8/imm32 -10814 # . epilogue -10815 5d/pop-to-ebp -10816 c3/return -10817 -10818 test-compute-offset-with-wrong-index-type: -10819 # . prologue -10820 55/push-ebp -10821 89/<- %ebp 4/r32/esp -10822 # setup -10823 (clear-stream _test-input-stream) -10824 (clear-stream $_test-input-buffered-file->buffer) -10825 (clear-stream _test-output-stream) -10826 (clear-stream $_test-output-buffered-file->buffer) -10827 (clear-stream _test-error-stream) -10828 (clear-stream $_test-error-buffered-file->buffer) -10829 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10830 68/push 0/imm32 -10831 68/push 0/imm32 -10832 89/<- %edx 4/r32/esp -10833 (tailor-exit-descriptor %edx 0x10) -10834 # -10835 (write _test-input-stream "fn foo {\n") -10836 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") -10837 (write _test-input-stream " var b: boolean\n") -10838 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, b\n") -10839 (write _test-input-stream "}\n") -10840 # convert -10841 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10842 # registers except esp clobbered at this point -10843 # restore ed -10844 89/<- %edx 4/r32/esp -10845 (flush _test-output-buffered-file) -10846 (flush _test-error-buffered-file) -10847 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10853 # check output -10854 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-index-type: output should be empty") -10855 (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") -10856 # check that stop(1) was called -10857 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-index-type: exit status") -10858 # don't restore from ebp -10859 81 0/subop/add %esp 8/imm32 -10860 # . epilogue -10861 5d/pop-to-ebp -10862 c3/return -10863 -10864 test-compute-offset-with-output-not-offset: -10865 # . prologue -10866 55/push-ebp -10867 89/<- %ebp 4/r32/esp -10868 # setup -10869 (clear-stream _test-input-stream) -10870 (clear-stream $_test-input-buffered-file->buffer) -10871 (clear-stream _test-output-stream) -10872 (clear-stream $_test-output-buffered-file->buffer) -10873 (clear-stream _test-error-stream) -10874 (clear-stream $_test-error-buffered-file->buffer) -10875 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10876 68/push 0/imm32 -10877 68/push 0/imm32 -10878 89/<- %edx 4/r32/esp -10879 (tailor-exit-descriptor %edx 0x10) -10880 # -10881 (write _test-input-stream "fn foo {\n") -10882 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") -10883 (write _test-input-stream " var o/edi: int <- compute-offset a, 0\n") -10884 (write _test-input-stream "}\n") -10885 # convert -10886 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10887 # registers except esp clobbered at this point -10888 # restore ed -10889 89/<- %edx 4/r32/esp -10890 (flush _test-output-buffered-file) -10891 (flush _test-error-buffered-file) -10892 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10898 # check output -10899 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-output-not-offset: output should be empty") -10900 (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") -10901 # check that stop(1) was called -10902 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-output-not-offset: exit status") -10903 # don't restore from ebp -10904 81 0/subop/add %esp 8/imm32 -10905 # . epilogue -10906 5d/pop-to-ebp -10907 c3/return -10908 -10909 test-compute-offset-with-output-not-address-2: -10910 # . prologue -10911 55/push-ebp -10912 89/<- %ebp 4/r32/esp -10913 # setup -10914 (clear-stream _test-input-stream) -10915 (clear-stream $_test-input-buffered-file->buffer) -10916 (clear-stream _test-output-stream) -10917 (clear-stream $_test-output-buffered-file->buffer) -10918 (clear-stream _test-error-stream) -10919 (clear-stream $_test-error-buffered-file->buffer) -10920 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10921 68/push 0/imm32 -10922 68/push 0/imm32 -10923 89/<- %edx 4/r32/esp -10924 (tailor-exit-descriptor %edx 0x10) -10925 # -10926 (write _test-input-stream "fn foo {\n") -10927 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") -10928 (write _test-input-stream " var o/edi: (int) <- compute-offset a, 0\n") -10929 (write _test-input-stream "}\n") -10930 # convert -10931 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10932 # registers except esp clobbered at this point -10933 # restore ed -10934 89/<- %edx 4/r32/esp -10935 (flush _test-output-buffered-file) -10936 (flush _test-error-buffered-file) -10937 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10943 # check output -10944 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-output-not-address-2: output should be empty") -10945 (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") -10946 # check that stop(1) was called -10947 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-output-not-address-2: exit status") -10948 # don't restore from ebp -10949 81 0/subop/add %esp 8/imm32 -10950 # . epilogue -10951 5d/pop-to-ebp -10952 c3/return -10953 -10954 test-compute-offset-with-wrong-output-type: -10955 # . prologue -10956 55/push-ebp -10957 89/<- %ebp 4/r32/esp -10958 # setup -10959 (clear-stream _test-input-stream) -10960 (clear-stream $_test-input-buffered-file->buffer) -10961 (clear-stream _test-output-stream) -10962 (clear-stream $_test-output-buffered-file->buffer) -10963 (clear-stream _test-error-stream) -10964 (clear-stream $_test-error-buffered-file->buffer) -10965 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10966 68/push 0/imm32 -10967 68/push 0/imm32 -10968 89/<- %edx 4/r32/esp -10969 (tailor-exit-descriptor %edx 0x10) -10970 # -10971 (write _test-input-stream "fn foo {\n") -10972 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") -10973 (write _test-input-stream " var o/edi: (offset int) <- compute-offset a, 0\n") -10974 (write _test-input-stream "}\n") -10975 # convert -10976 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10977 # registers except esp clobbered at this point -10978 # restore ed -10979 89/<- %edx 4/r32/esp -10980 (flush _test-output-buffered-file) -10981 (flush _test-error-buffered-file) -10982 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -10988 # check output -10989 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-output-type: output should be empty") -10990 (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") -10991 # check that stop(1) was called -10992 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-output-type: exit status") -10993 # don't restore from ebp -10994 81 0/subop/add %esp 8/imm32 -10995 # . epilogue -10996 5d/pop-to-ebp -10997 c3/return -10998 -10999 test-compute-offset-with-wrong-output-compound-type: -11000 # . prologue -11001 55/push-ebp -11002 89/<- %ebp 4/r32/esp -11003 # setup -11004 (clear-stream _test-input-stream) -11005 (clear-stream $_test-input-buffered-file->buffer) -11006 (clear-stream _test-output-stream) -11007 (clear-stream $_test-output-buffered-file->buffer) -11008 (clear-stream _test-error-stream) -11009 (clear-stream $_test-error-buffered-file->buffer) -11010 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11011 68/push 0/imm32 -11012 68/push 0/imm32 -11013 89/<- %edx 4/r32/esp -11014 (tailor-exit-descriptor %edx 0x10) -11015 # -11016 (write _test-input-stream "fn foo {\n") -11017 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") -11018 (write _test-input-stream " var o/edi: (offset handle int) <- compute-offset a, 0\n") -11019 (write _test-input-stream "}\n") -11020 # convert -11021 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11022 # registers except esp clobbered at this point -11023 # restore ed -11024 89/<- %edx 4/r32/esp -11025 (flush _test-output-buffered-file) -11026 (flush _test-error-buffered-file) -11027 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11033 # check output -11034 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-output-compound-type: output should be empty") -11035 (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") -11036 # check that stop(1) was called -11037 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-output-compound-type: exit status") -11038 # don't restore from ebp -11039 81 0/subop/add %esp 8/imm32 -11040 # . epilogue -11041 5d/pop-to-ebp -11042 c3/return -11043 -11044 test-compute-offset-with-no-inouts: -11045 # . prologue -11046 55/push-ebp -11047 89/<- %ebp 4/r32/esp -11048 # setup -11049 (clear-stream _test-input-stream) -11050 (clear-stream $_test-input-buffered-file->buffer) -11051 (clear-stream _test-output-stream) -11052 (clear-stream $_test-output-buffered-file->buffer) -11053 (clear-stream _test-error-stream) -11054 (clear-stream $_test-error-buffered-file->buffer) -11055 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11056 68/push 0/imm32 -11057 68/push 0/imm32 -11058 89/<- %edx 4/r32/esp -11059 (tailor-exit-descriptor %edx 0x10) -11060 # -11061 (write _test-input-stream "fn foo {\n") -11062 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset\n") -11063 (write _test-input-stream "}\n") -11064 # convert -11065 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11066 # registers except esp clobbered at this point -11067 # restore ed -11068 89/<- %edx 4/r32/esp -11069 (flush _test-output-buffered-file) -11070 (flush _test-error-buffered-file) -11071 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11077 # check output -11078 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-no-inouts: output should be empty") -11079 (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") -11080 # check that stop(1) was called -11081 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-no-inouts: exit status") -11082 # don't restore from ebp -11083 81 0/subop/add %esp 8/imm32 -11084 # . epilogue -11085 5d/pop-to-ebp -11086 c3/return -11087 -11088 test-compute-offset-with-too-few-inouts: -11089 # . prologue -11090 55/push-ebp -11091 89/<- %ebp 4/r32/esp -11092 # setup -11093 (clear-stream _test-input-stream) -11094 (clear-stream $_test-input-buffered-file->buffer) -11095 (clear-stream _test-output-stream) -11096 (clear-stream $_test-output-buffered-file->buffer) -11097 (clear-stream _test-error-stream) -11098 (clear-stream $_test-error-buffered-file->buffer) -11099 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11100 68/push 0/imm32 -11101 68/push 0/imm32 -11102 89/<- %edx 4/r32/esp -11103 (tailor-exit-descriptor %edx 0x10) -11104 # -11105 (write _test-input-stream "fn foo {\n") -11106 (write _test-input-stream " var a: (array int 3)\n") -11107 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a\n") -11108 (write _test-input-stream "}\n") -11109 # convert -11110 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11111 # registers except esp clobbered at this point -11112 # restore ed -11113 89/<- %edx 4/r32/esp -11114 (flush _test-output-buffered-file) -11115 (flush _test-error-buffered-file) -11116 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11122 # check output -11123 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-few-inouts: output should be empty") -11124 (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") -11125 # check that stop(1) was called -11126 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-few-inouts: exit status") -11127 # don't restore from ebp -11128 81 0/subop/add %esp 8/imm32 -11129 # . epilogue -11130 5d/pop-to-ebp -11131 c3/return -11132 -11133 test-compute-offset-with-too-many-inouts: -11134 # . prologue -11135 55/push-ebp -11136 89/<- %ebp 4/r32/esp -11137 # setup -11138 (clear-stream _test-input-stream) -11139 (clear-stream $_test-input-buffered-file->buffer) -11140 (clear-stream _test-output-stream) -11141 (clear-stream $_test-output-buffered-file->buffer) -11142 (clear-stream _test-error-stream) -11143 (clear-stream $_test-error-buffered-file->buffer) -11144 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11145 68/push 0/imm32 -11146 68/push 0/imm32 -11147 89/<- %edx 4/r32/esp -11148 (tailor-exit-descriptor %edx 0x10) -11149 # -11150 (write _test-input-stream "fn foo {\n") -11151 (write _test-input-stream " var a: (array int 3)\n") -11152 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0, 0\n") -11153 (write _test-input-stream "}\n") -11154 # convert -11155 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11156 # registers except esp clobbered at this point -11157 # restore ed -11158 89/<- %edx 4/r32/esp -11159 (flush _test-output-buffered-file) -11160 (flush _test-error-buffered-file) -11161 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11167 # check output -11168 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-many-inouts: output should be empty") -11169 (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") -11170 # check that stop(1) was called -11171 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-many-inouts: exit status") -11172 # don't restore from ebp -11173 81 0/subop/add %esp 8/imm32 -11174 # . epilogue -11175 5d/pop-to-ebp -11176 c3/return -11177 -11178 test-compute-offset-with-no-output: -11179 # . prologue -11180 55/push-ebp -11181 89/<- %ebp 4/r32/esp -11182 # setup -11183 (clear-stream _test-input-stream) -11184 (clear-stream $_test-input-buffered-file->buffer) -11185 (clear-stream _test-output-stream) -11186 (clear-stream $_test-output-buffered-file->buffer) -11187 (clear-stream _test-error-stream) -11188 (clear-stream $_test-error-buffered-file->buffer) -11189 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11190 68/push 0/imm32 -11191 68/push 0/imm32 -11192 89/<- %edx 4/r32/esp -11193 (tailor-exit-descriptor %edx 0x10) -11194 # -11195 (write _test-input-stream "fn foo {\n") -11196 (write _test-input-stream " var a: (array int 3)\n") -11197 (write _test-input-stream " compute-offset a, 0\n") -11198 (write _test-input-stream "}\n") -11199 # convert -11200 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11201 # registers except esp clobbered at this point -11202 # restore ed -11203 89/<- %edx 4/r32/esp -11204 (flush _test-output-buffered-file) -11205 (flush _test-error-buffered-file) -11206 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11212 # check output -11213 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-no-output: output should be empty") -11214 (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") -11215 # check that stop(1) was called -11216 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-no-output: exit status") -11217 # don't restore from ebp -11218 81 0/subop/add %esp 8/imm32 -11219 # . epilogue -11220 5d/pop-to-ebp -11221 c3/return -11222 -11223 test-compute-offset-with-too-many-outputs: -11224 # . prologue -11225 55/push-ebp -11226 89/<- %ebp 4/r32/esp -11227 # setup -11228 (clear-stream _test-input-stream) -11229 (clear-stream $_test-input-buffered-file->buffer) -11230 (clear-stream _test-output-stream) -11231 (clear-stream $_test-output-buffered-file->buffer) -11232 (clear-stream _test-error-stream) -11233 (clear-stream $_test-error-buffered-file->buffer) -11234 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11235 68/push 0/imm32 -11236 68/push 0/imm32 -11237 89/<- %edx 4/r32/esp -11238 (tailor-exit-descriptor %edx 0x10) -11239 # -11240 (write _test-input-stream "fn foo {\n") -11241 (write _test-input-stream " var a: (array int 3)\n") -11242 (write _test-input-stream " var b/eax: (offset int) <- compute-offset a, 0\n") -11243 (write _test-input-stream " var c/ecx: (addr int) <- copy 0\n") -11244 (write _test-input-stream " b, c <- compute-offset a, 0\n") -11245 (write _test-input-stream "}\n") -11246 # convert -11247 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11248 # registers except esp clobbered at this point -11249 # restore ed -11250 89/<- %edx 4/r32/esp -11251 (flush _test-output-buffered-file) -11252 (flush _test-error-buffered-file) -11253 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11259 # check output -11260 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-many-outputs: output should be empty") -11261 (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") -11262 # check that stop(1) was called -11263 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-many-outputs: exit status") -11264 # don't restore from ebp -11265 81 0/subop/add %esp 8/imm32 -11266 # . epilogue -11267 5d/pop-to-ebp -11268 c3/return -11269 -11270 test-convert-read-from-stream: -11271 # . prologue -11272 55/push-ebp -11273 89/<- %ebp 4/r32/esp -11274 # setup -11275 (clear-stream _test-input-stream) -11276 (clear-stream $_test-input-buffered-file->buffer) -11277 (clear-stream _test-output-stream) -11278 (clear-stream $_test-output-buffered-file->buffer) -11279 # -11280 (write _test-input-stream "fn foo {\n") -11281 (write _test-input-stream " var s/esi: (addr stream int) <- copy 0\n") -11282 (write _test-input-stream " var o/ecx: (addr int) <- copy 0\n") -11283 (write _test-input-stream " read-from-stream s, o\n") -11284 (write _test-input-stream "}\n") -11285 # convert -11286 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -11287 # registers except esp clobbered at this point -11288 # restore ed -11289 89/<- %edx 4/r32/esp -11290 (flush _test-output-buffered-file) -11291 (flush _test-error-buffered-file) -11292 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -11298 # check output -11299 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-read-from-stream/0") -11300 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-read-from-stream/1") -11301 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-read-from-stream/2") -11302 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-read-from-stream/3") -11303 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-read-from-stream/4") -11304 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-read-from-stream/5") -11305 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-read-from-stream/6") -11306 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-read-from-stream/7") -11307 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-read-from-stream/8") -11308 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-read-from-stream/9") -11309 (check-next-stream-line-equal _test-output-stream " (read-from-stream %esi %ecx 0x00000004)" "F - test-convert-read-from-stream/10") -11310 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-read-from-stream/11") -11311 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-read-from-stream/12") -11312 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-read-from-stream/13") -11313 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-read-from-stream/14") -11314 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-read-from-stream/15") -11315 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-read-from-stream/16") -11316 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-read-from-stream/17") -11317 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-read-from-stream/18") -11318 # . epilogue -11319 89/<- %esp 5/r32/ebp -11320 5d/pop-to-ebp -11321 c3/return -11322 -11323 test-convert-read-from-stream-with-correct-payload-size: -11324 # . prologue -11325 55/push-ebp -11326 89/<- %ebp 4/r32/esp -11327 # setup -11328 (clear-stream _test-input-stream) -11329 (clear-stream $_test-input-buffered-file->buffer) -11330 (clear-stream _test-output-stream) -11331 (clear-stream $_test-output-buffered-file->buffer) -11332 # -11333 (write _test-input-stream "fn foo {\n") -11334 (write _test-input-stream " var s/esi: (addr stream handle int) <- copy 0\n") -11335 (write _test-input-stream " var o/ecx: (addr handle int) <- copy 0\n") -11336 (write _test-input-stream " read-from-stream s, o\n") -11337 (write _test-input-stream "}\n") -11338 # convert -11339 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -11340 # registers except esp clobbered at this point -11341 # restore ed -11342 89/<- %edx 4/r32/esp -11343 (flush _test-output-buffered-file) -11344 (flush _test-error-buffered-file) -11345 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -11351 # check output -11352 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-read-from-stream-with-correct-payload-size/0") -11353 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-read-from-stream-with-correct-payload-size/1") -11354 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-read-from-stream-with-correct-payload-size/2") -11355 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-read-from-stream-with-correct-payload-size/3") -11356 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-read-from-stream-with-correct-payload-size/4") -11357 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-read-from-stream-with-correct-payload-size/5") -11358 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-read-from-stream-with-correct-payload-size/6") -11359 (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") -11360 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-read-from-stream-with-correct-payload-size/8") -11361 (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") -11362 (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") -11363 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-read-from-stream-with-correct-payload-size/11") -11364 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-read-from-stream-with-correct-payload-size/12") -11365 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-read-from-stream-with-correct-payload-size/13") -11366 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-read-from-stream-with-correct-payload-size/14") -11367 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-read-from-stream-with-correct-payload-size/15") -11368 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-read-from-stream-with-correct-payload-size/16") -11369 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-read-from-stream-with-correct-payload-size/17") -11370 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-read-from-stream-with-correct-payload-size/18") -11371 # . epilogue -11372 89/<- %esp 5/r32/ebp -11373 5d/pop-to-ebp -11374 c3/return -11375 -11376 test-read-from-stream-with-non-stream-atom-base-type: -11377 # . prologue -11378 55/push-ebp -11379 89/<- %ebp 4/r32/esp -11380 # setup -11381 (clear-stream _test-input-stream) -11382 (clear-stream $_test-input-buffered-file->buffer) -11383 (clear-stream _test-output-stream) -11384 (clear-stream $_test-output-buffered-file->buffer) -11385 (clear-stream _test-error-stream) -11386 (clear-stream $_test-error-buffered-file->buffer) -11387 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11388 68/push 0/imm32 -11389 68/push 0/imm32 -11390 89/<- %edx 4/r32/esp -11391 (tailor-exit-descriptor %edx 0x10) -11392 # -11393 (write _test-input-stream "fn foo {\n") -11394 (write _test-input-stream " var a: int\n") -11395 (write _test-input-stream " read-from-stream a, 0\n") -11396 (write _test-input-stream "}\n") -11397 # convert -11398 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11399 # registers except esp clobbered at this point -11400 # restore ed -11401 89/<- %edx 4/r32/esp -11402 (flush _test-output-buffered-file) -11403 (flush _test-error-buffered-file) -11404 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11410 # check output -11411 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-atom-base-type: output should be empty") -11412 (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") -11413 # check that stop(1) was called -11414 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-atom-base-type: exit status") -11415 # don't restore from ebp -11416 81 0/subop/add %esp 8/imm32 -11417 # . epilogue -11418 5d/pop-to-ebp -11419 c3/return -11420 -11421 test-read-from-stream-with-non-stream-compound-base-type: -11422 # . prologue -11423 55/push-ebp -11424 89/<- %ebp 4/r32/esp -11425 # setup -11426 (clear-stream _test-input-stream) -11427 (clear-stream $_test-input-buffered-file->buffer) -11428 (clear-stream _test-output-stream) -11429 (clear-stream $_test-output-buffered-file->buffer) -11430 (clear-stream _test-error-stream) -11431 (clear-stream $_test-error-buffered-file->buffer) -11432 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11433 68/push 0/imm32 -11434 68/push 0/imm32 -11435 89/<- %edx 4/r32/esp -11436 (tailor-exit-descriptor %edx 0x10) -11437 # -11438 (write _test-input-stream "fn foo {\n") -11439 (write _test-input-stream " var a: (handle int)\n") -11440 (write _test-input-stream " read-from-stream a, 0\n") -11441 (write _test-input-stream "}\n") -11442 # convert -11443 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11444 # registers except esp clobbered at this point -11445 # restore ed -11446 89/<- %edx 4/r32/esp -11447 (flush _test-output-buffered-file) -11448 (flush _test-error-buffered-file) -11449 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11455 # check output -11456 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-compound-base-type: output should be empty") -11457 (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") -11458 # check that stop(1) was called -11459 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-compound-base-type: exit status") -11460 # don't restore from ebp -11461 81 0/subop/add %esp 8/imm32 -11462 # . epilogue -11463 5d/pop-to-ebp -11464 c3/return -11465 -11466 test-read-from-stream-with-non-stream-compound-base-type-2: -11467 # . prologue -11468 55/push-ebp -11469 89/<- %ebp 4/r32/esp -11470 # setup -11471 (clear-stream _test-input-stream) -11472 (clear-stream $_test-input-buffered-file->buffer) -11473 (clear-stream _test-output-stream) -11474 (clear-stream $_test-output-buffered-file->buffer) -11475 (clear-stream _test-error-stream) -11476 (clear-stream $_test-error-buffered-file->buffer) -11477 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11478 68/push 0/imm32 -11479 68/push 0/imm32 -11480 89/<- %edx 4/r32/esp -11481 (tailor-exit-descriptor %edx 0x10) -11482 # -11483 (write _test-input-stream "fn foo {\n") -11484 (write _test-input-stream " var a: (addr int)\n") -11485 (write _test-input-stream " read-from-stream a, 0\n") -11486 (write _test-input-stream "}\n") -11487 # convert -11488 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11489 # registers except esp clobbered at this point -11490 # restore ed -11491 89/<- %edx 4/r32/esp -11492 (flush _test-output-buffered-file) -11493 (flush _test-error-buffered-file) -11494 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11500 # check output -11501 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-compound-base-type-2: output should be empty") -11502 (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") -11503 # check that stop(1) was called -11504 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-compound-base-type-2: exit status") -11505 # don't restore from ebp -11506 81 0/subop/add %esp 8/imm32 -11507 # . epilogue -11508 5d/pop-to-ebp -11509 c3/return -11510 -11511 test-read-from-stream-with-stream-atom-base-type: -11512 # . prologue -11513 55/push-ebp -11514 89/<- %ebp 4/r32/esp -11515 # setup -11516 (clear-stream _test-input-stream) -11517 (clear-stream $_test-input-buffered-file->buffer) -11518 (clear-stream _test-output-stream) -11519 (clear-stream $_test-output-buffered-file->buffer) -11520 (clear-stream _test-error-stream) -11521 (clear-stream $_test-error-buffered-file->buffer) -11522 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11523 68/push 0/imm32 -11524 68/push 0/imm32 -11525 89/<- %edx 4/r32/esp -11526 (tailor-exit-descriptor %edx 0x10) -11527 # -11528 (write _test-input-stream "fn foo {\n") -11529 (write _test-input-stream " var a: stream\n") -11530 (write _test-input-stream " read-from-stream a, 0\n") -11531 (write _test-input-stream "}\n") -11532 # convert -11533 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11534 # registers except esp clobbered at this point -11535 # restore ed -11536 89/<- %edx 4/r32/esp -11537 (flush _test-output-buffered-file) -11538 (flush _test-error-buffered-file) -11539 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11545 # check output -11546 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-stream-atom-base-type: output should be empty") -11547 (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") -11548 # check that stop(1) was called -11549 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-stream-atom-base-type: exit status") -11550 # don't restore from ebp -11551 81 0/subop/add %esp 8/imm32 -11552 # . epilogue -11553 5d/pop-to-ebp -11554 c3/return -11555 -11556 test-read-from-stream-with-wrong-index-type: -11557 # . prologue -11558 55/push-ebp -11559 89/<- %ebp 4/r32/esp -11560 # setup -11561 (clear-stream _test-input-stream) -11562 (clear-stream $_test-input-buffered-file->buffer) -11563 (clear-stream _test-output-stream) -11564 (clear-stream $_test-output-buffered-file->buffer) -11565 (clear-stream _test-error-stream) -11566 (clear-stream $_test-error-buffered-file->buffer) -11567 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11568 68/push 0/imm32 -11569 68/push 0/imm32 -11570 89/<- %edx 4/r32/esp -11571 (tailor-exit-descriptor %edx 0x10) -11572 # -11573 (write _test-input-stream "fn foo {\n") -11574 (write _test-input-stream " var a/eax: (addr stream int) <- copy 0\n") -11575 (write _test-input-stream " var b: boolean\n") -11576 (write _test-input-stream " read-from-stream a, b\n") -11577 (write _test-input-stream "}\n") -11578 # convert -11579 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11580 # registers except esp clobbered at this point -11581 # restore ed -11582 89/<- %edx 4/r32/esp -11583 (flush _test-output-buffered-file) -11584 (flush _test-error-buffered-file) -11585 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11591 # check output -11592 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-wrong-index-type: output should be empty") -11593 (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") -11594 # check that stop(1) was called -11595 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-wrong-index-type: exit status") -11596 # don't restore from ebp -11597 81 0/subop/add %esp 8/imm32 -11598 # . epilogue -11599 5d/pop-to-ebp -11600 c3/return -11601 -11602 test-read-from-stream-with-no-inouts: -11603 # . prologue -11604 55/push-ebp -11605 89/<- %ebp 4/r32/esp -11606 # setup -11607 (clear-stream _test-input-stream) -11608 (clear-stream $_test-input-buffered-file->buffer) -11609 (clear-stream _test-output-stream) -11610 (clear-stream $_test-output-buffered-file->buffer) -11611 (clear-stream _test-error-stream) -11612 (clear-stream $_test-error-buffered-file->buffer) -11613 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11614 68/push 0/imm32 -11615 68/push 0/imm32 -11616 89/<- %edx 4/r32/esp -11617 (tailor-exit-descriptor %edx 0x10) -11618 # -11619 (write _test-input-stream "fn foo {\n") -11620 (write _test-input-stream " read-from-stream\n") -11621 (write _test-input-stream "}\n") -11622 # convert -11623 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11624 # registers except esp clobbered at this point -11625 # restore ed -11626 89/<- %edx 4/r32/esp -11627 (flush _test-output-buffered-file) -11628 (flush _test-error-buffered-file) -11629 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11635 # check output -11636 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-no-inouts: output should be empty") -11637 (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") -11638 # check that stop(1) was called -11639 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-no-inouts: exit status") -11640 # don't restore from ebp -11641 81 0/subop/add %esp 8/imm32 -11642 # . epilogue -11643 5d/pop-to-ebp -11644 c3/return -11645 -11646 test-read-from-stream-with-too-few-inouts: -11647 # . prologue -11648 55/push-ebp -11649 89/<- %ebp 4/r32/esp -11650 # setup -11651 (clear-stream _test-input-stream) -11652 (clear-stream $_test-input-buffered-file->buffer) -11653 (clear-stream _test-output-stream) -11654 (clear-stream $_test-output-buffered-file->buffer) -11655 (clear-stream _test-error-stream) -11656 (clear-stream $_test-error-buffered-file->buffer) -11657 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11658 68/push 0/imm32 -11659 68/push 0/imm32 -11660 89/<- %edx 4/r32/esp -11661 (tailor-exit-descriptor %edx 0x10) -11662 # -11663 (write _test-input-stream "fn foo {\n") -11664 (write _test-input-stream " var a: (addr stream int)\n") -11665 (write _test-input-stream " read-from-stream a\n") -11666 (write _test-input-stream "}\n") -11667 # convert -11668 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11669 # registers except esp clobbered at this point -11670 # restore ed -11671 89/<- %edx 4/r32/esp -11672 (flush _test-output-buffered-file) -11673 (flush _test-error-buffered-file) -11674 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11680 # check output -11681 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-too-few-inouts: output should be empty") -11682 (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") -11683 # check that stop(1) was called -11684 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-too-few-inouts: exit status") -11685 # don't restore from ebp -11686 81 0/subop/add %esp 8/imm32 -11687 # . epilogue -11688 5d/pop-to-ebp -11689 c3/return -11690 -11691 test-read-from-stream-with-too-many-inouts: -11692 # . prologue -11693 55/push-ebp -11694 89/<- %ebp 4/r32/esp -11695 # setup -11696 (clear-stream _test-input-stream) -11697 (clear-stream $_test-input-buffered-file->buffer) -11698 (clear-stream _test-output-stream) -11699 (clear-stream $_test-output-buffered-file->buffer) -11700 (clear-stream _test-error-stream) -11701 (clear-stream $_test-error-buffered-file->buffer) -11702 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11703 68/push 0/imm32 -11704 68/push 0/imm32 -11705 89/<- %edx 4/r32/esp -11706 (tailor-exit-descriptor %edx 0x10) -11707 # -11708 (write _test-input-stream "fn foo {\n") -11709 (write _test-input-stream " var a: (addr stream int)\n") -11710 (write _test-input-stream " var b: (addr int)\n") -11711 (write _test-input-stream " read-from-stream a, b, 0\n") -11712 (write _test-input-stream "}\n") -11713 # convert -11714 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11715 # registers except esp clobbered at this point -11716 # restore ed -11717 89/<- %edx 4/r32/esp -11718 (flush _test-output-buffered-file) -11719 (flush _test-error-buffered-file) -11720 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11726 # check output -11727 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-too-many-inouts: output should be empty") -11728 (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") -11729 # check that stop(1) was called -11730 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-too-many-inouts: exit status") -11731 # don't restore from ebp -11732 81 0/subop/add %esp 8/imm32 -11733 # . epilogue -11734 5d/pop-to-ebp -11735 c3/return -11736 -11737 test-read-from-stream-with-output: -11738 # . prologue -11739 55/push-ebp -11740 89/<- %ebp 4/r32/esp -11741 # setup -11742 (clear-stream _test-input-stream) -11743 (clear-stream $_test-input-buffered-file->buffer) -11744 (clear-stream _test-output-stream) -11745 (clear-stream $_test-output-buffered-file->buffer) -11746 (clear-stream _test-error-stream) -11747 (clear-stream $_test-error-buffered-file->buffer) -11748 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11749 68/push 0/imm32 -11750 68/push 0/imm32 -11751 89/<- %edx 4/r32/esp -11752 (tailor-exit-descriptor %edx 0x10) -11753 # -11754 (write _test-input-stream "fn foo {\n") -11755 (write _test-input-stream " var a: (addr stream int)\n") -11756 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") -11757 (write _test-input-stream " b <- read-from-stream a, b\n") -11758 (write _test-input-stream "}\n") -11759 # convert -11760 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11761 # registers except esp clobbered at this point -11762 # restore ed -11763 89/<- %edx 4/r32/esp -11764 (flush _test-output-buffered-file) -11765 (flush _test-error-buffered-file) -11766 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11772 # check output -11773 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-output: output should be empty") -11774 (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") -11775 # check that stop(1) was called -11776 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-output: exit status") -11777 # don't restore from ebp -11778 81 0/subop/add %esp 8/imm32 -11779 # . epilogue -11780 5d/pop-to-ebp -11781 c3/return -11782 -11783 test-convert-write-to-stream: -11784 # . prologue -11785 55/push-ebp -11786 89/<- %ebp 4/r32/esp -11787 # setup -11788 (clear-stream _test-input-stream) -11789 (clear-stream $_test-input-buffered-file->buffer) -11790 (clear-stream _test-output-stream) -11791 (clear-stream $_test-output-buffered-file->buffer) -11792 # -11793 (write _test-input-stream "fn foo {\n") -11794 (write _test-input-stream " var s/esi: (addr stream int) <- copy 0\n") -11795 (write _test-input-stream " var o/ecx: (addr int) <- copy 0\n") -11796 (write _test-input-stream " write-to-stream s, o\n") -11797 (write _test-input-stream "}\n") -11798 # convert -11799 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -11800 # registers except esp clobbered at this point -11801 # restore ed -11802 89/<- %edx 4/r32/esp -11803 (flush _test-output-buffered-file) -11804 (flush _test-error-buffered-file) -11805 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -11811 # check output -11812 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-write-to-stream/0") -11813 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-write-to-stream/1") -11814 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-write-to-stream/2") -11815 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-write-to-stream/3") -11816 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-write-to-stream/4") -11817 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-write-to-stream/5") -11818 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-write-to-stream/6") -11819 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-write-to-stream/7") -11820 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-write-to-stream/8") -11821 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-write-to-stream/9") -11822 (check-next-stream-line-equal _test-output-stream " (write-to-stream %esi %ecx 0x00000004)" "F - test-convert-write-to-stream/10") -11823 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-write-to-stream/11") -11824 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-write-to-stream/12") -11825 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-write-to-stream/13") -11826 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-write-to-stream/14") -11827 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-write-to-stream/15") -11828 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-write-to-stream/16") -11829 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-write-to-stream/17") -11830 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-write-to-stream/18") -11831 # . epilogue -11832 89/<- %esp 5/r32/ebp -11833 5d/pop-to-ebp -11834 c3/return -11835 -11836 test-convert-write-to-stream-with-correct-payload-size: -11837 # . prologue -11838 55/push-ebp -11839 89/<- %ebp 4/r32/esp -11840 # setup -11841 (clear-stream _test-input-stream) -11842 (clear-stream $_test-input-buffered-file->buffer) -11843 (clear-stream _test-output-stream) -11844 (clear-stream $_test-output-buffered-file->buffer) -11845 # -11846 (write _test-input-stream "fn foo {\n") -11847 (write _test-input-stream " var s/esi: (addr stream handle int) <- copy 0\n") -11848 (write _test-input-stream " var o/ecx: (addr handle int) <- copy 0\n") -11849 (write _test-input-stream " write-to-stream s, o\n") -11850 (write _test-input-stream "}\n") -11851 # convert -11852 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -11853 # registers except esp clobbered at this point -11854 # restore ed -11855 89/<- %edx 4/r32/esp -11856 (flush _test-output-buffered-file) -11857 (flush _test-error-buffered-file) -11858 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -11864 # check output -11865 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-write-to-stream-with-correct-payload-size/0") -11866 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-write-to-stream-with-correct-payload-size/1") -11867 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-write-to-stream-with-correct-payload-size/2") -11868 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-write-to-stream-with-correct-payload-size/3") -11869 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-write-to-stream-with-correct-payload-size/4") -11870 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-write-to-stream-with-correct-payload-size/5") -11871 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-write-to-stream-with-correct-payload-size/6") -11872 (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") -11873 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-write-to-stream-with-correct-payload-size/8") -11874 (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") -11875 (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") -11876 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-write-to-stream-with-correct-payload-size/11") -11877 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-write-to-stream-with-correct-payload-size/12") -11878 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-write-to-stream-with-correct-payload-size/13") -11879 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-write-to-stream-with-correct-payload-size/14") -11880 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-write-to-stream-with-correct-payload-size/15") -11881 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-write-to-stream-with-correct-payload-size/16") -11882 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-write-to-stream-with-correct-payload-size/17") -11883 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-write-to-stream-with-correct-payload-size/18") -11884 # . epilogue -11885 89/<- %esp 5/r32/ebp -11886 5d/pop-to-ebp -11887 c3/return -11888 -11889 test-write-to-stream-with-non-stream-atom-base-type: -11890 # . prologue -11891 55/push-ebp -11892 89/<- %ebp 4/r32/esp -11893 # setup -11894 (clear-stream _test-input-stream) -11895 (clear-stream $_test-input-buffered-file->buffer) -11896 (clear-stream _test-output-stream) -11897 (clear-stream $_test-output-buffered-file->buffer) -11898 (clear-stream _test-error-stream) -11899 (clear-stream $_test-error-buffered-file->buffer) -11900 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11901 68/push 0/imm32 -11902 68/push 0/imm32 -11903 89/<- %edx 4/r32/esp -11904 (tailor-exit-descriptor %edx 0x10) -11905 # -11906 (write _test-input-stream "fn foo {\n") -11907 (write _test-input-stream " var a: int\n") -11908 (write _test-input-stream " write-to-stream a, 0\n") -11909 (write _test-input-stream "}\n") -11910 # convert -11911 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11912 # registers except esp clobbered at this point -11913 # restore ed -11914 89/<- %edx 4/r32/esp -11915 (flush _test-output-buffered-file) -11916 (flush _test-error-buffered-file) -11917 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11923 # check output -11924 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-atom-base-type: output should be empty") -11925 (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") -11926 # check that stop(1) was called -11927 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-atom-base-type: exit status") -11928 # don't restore from ebp -11929 81 0/subop/add %esp 8/imm32 -11930 # . epilogue -11931 5d/pop-to-ebp -11932 c3/return -11933 -11934 test-write-to-stream-with-non-stream-compound-base-type: -11935 # . prologue -11936 55/push-ebp -11937 89/<- %ebp 4/r32/esp -11938 # setup -11939 (clear-stream _test-input-stream) -11940 (clear-stream $_test-input-buffered-file->buffer) -11941 (clear-stream _test-output-stream) -11942 (clear-stream $_test-output-buffered-file->buffer) -11943 (clear-stream _test-error-stream) -11944 (clear-stream $_test-error-buffered-file->buffer) -11945 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11946 68/push 0/imm32 -11947 68/push 0/imm32 -11948 89/<- %edx 4/r32/esp -11949 (tailor-exit-descriptor %edx 0x10) -11950 # -11951 (write _test-input-stream "fn foo {\n") -11952 (write _test-input-stream " var a: (handle int)\n") -11953 (write _test-input-stream " write-to-stream a, 0\n") -11954 (write _test-input-stream "}\n") -11955 # convert -11956 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11957 # registers except esp clobbered at this point -11958 # restore ed -11959 89/<- %edx 4/r32/esp -11960 (flush _test-output-buffered-file) -11961 (flush _test-error-buffered-file) -11962 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -11968 # check output -11969 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-compound-base-type: output should be empty") -11970 (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") -11971 # check that stop(1) was called -11972 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-compound-base-type: exit status") -11973 # don't restore from ebp -11974 81 0/subop/add %esp 8/imm32 -11975 # . epilogue -11976 5d/pop-to-ebp -11977 c3/return -11978 -11979 test-write-to-stream-with-non-stream-compound-base-type-2: -11980 # . prologue -11981 55/push-ebp -11982 89/<- %ebp 4/r32/esp -11983 # setup -11984 (clear-stream _test-input-stream) -11985 (clear-stream $_test-input-buffered-file->buffer) -11986 (clear-stream _test-output-stream) -11987 (clear-stream $_test-output-buffered-file->buffer) -11988 (clear-stream _test-error-stream) -11989 (clear-stream $_test-error-buffered-file->buffer) -11990 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11991 68/push 0/imm32 -11992 68/push 0/imm32 +10303 (tailor-exit-descriptor %edx 0x10) +10304 # +10305 (write _test-input-stream "fn foo {\n") +10306 (write _test-input-stream " var a: t\n") +10307 (write _test-input-stream " var c/ecx: (addr int) <- get a, x, 0\n") +10308 (write _test-input-stream "}\n") +10309 (write _test-input-stream "type t {\n") +10310 (write _test-input-stream " x: int\n") +10311 (write _test-input-stream "}\n") +10312 # convert +10313 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10314 # registers except esp clobbered at this point +10315 # restore ed +10316 89/<- %edx 4/r32/esp +10317 (flush _test-output-buffered-file) +10318 (flush _test-error-buffered-file) +10319 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10325 # check output +10326 (check-stream-equal _test-output-stream "" "F - test-get-with-too-many-inouts: output should be empty") +10327 (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") +10328 # check that stop(1) was called +10329 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-many-inouts: exit status") +10330 # don't restore from ebp +10331 81 0/subop/add %esp 8/imm32 +10332 # . epilogue +10333 5d/pop-to-ebp +10334 c3/return +10335 +10336 test-get-with-no-output: +10337 # . prologue +10338 55/push-ebp +10339 89/<- %ebp 4/r32/esp +10340 # setup +10341 (clear-stream _test-input-stream) +10342 (clear-stream $_test-input-buffered-file->buffer) +10343 (clear-stream _test-output-stream) +10344 (clear-stream $_test-output-buffered-file->buffer) +10345 (clear-stream _test-error-stream) +10346 (clear-stream $_test-error-buffered-file->buffer) +10347 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10348 68/push 0/imm32 +10349 68/push 0/imm32 +10350 89/<- %edx 4/r32/esp +10351 (tailor-exit-descriptor %edx 0x10) +10352 # +10353 (write _test-input-stream "fn foo {\n") +10354 (write _test-input-stream " var a: t\n") +10355 (write _test-input-stream " get a, x\n") +10356 (write _test-input-stream "}\n") +10357 (write _test-input-stream "type t {\n") +10358 (write _test-input-stream " x: int\n") +10359 (write _test-input-stream "}\n") +10360 # convert +10361 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10362 # registers except esp clobbered at this point +10363 # restore ed +10364 89/<- %edx 4/r32/esp +10365 (flush _test-output-buffered-file) +10366 (flush _test-error-buffered-file) +10367 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10373 # check output +10374 (check-stream-equal _test-output-stream "" "F - test-get-with-no-output: output should be empty") +10375 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: must have an output" "F - test-get-with-no-output: error message") +10376 # check that stop(1) was called +10377 (check-ints-equal *(edx+4) 2 "F - test-get-with-no-output: exit status") +10378 # don't restore from ebp +10379 81 0/subop/add %esp 8/imm32 +10380 # . epilogue +10381 5d/pop-to-ebp +10382 c3/return +10383 +10384 test-get-with-too-many-outputs: +10385 # . prologue +10386 55/push-ebp +10387 89/<- %ebp 4/r32/esp +10388 # setup +10389 (clear-stream _test-input-stream) +10390 (clear-stream $_test-input-buffered-file->buffer) +10391 (clear-stream _test-output-stream) +10392 (clear-stream $_test-output-buffered-file->buffer) +10393 (clear-stream _test-error-stream) +10394 (clear-stream $_test-error-buffered-file->buffer) +10395 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10396 68/push 0/imm32 +10397 68/push 0/imm32 +10398 89/<- %edx 4/r32/esp +10399 (tailor-exit-descriptor %edx 0x10) +10400 # +10401 (write _test-input-stream "fn foo {\n") +10402 (write _test-input-stream " var a: t\n") +10403 (write _test-input-stream " var b: int\n") +10404 (write _test-input-stream " var c/eax: (addr int) <- copy 0\n") +10405 (write _test-input-stream " c, b <- get a, x\n") +10406 (write _test-input-stream "}\n") +10407 (write _test-input-stream "type t {\n") +10408 (write _test-input-stream " x: int\n") +10409 (write _test-input-stream "}\n") +10410 # convert +10411 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10412 # registers except esp clobbered at this point +10413 # restore ed +10414 89/<- %edx 4/r32/esp +10415 (flush _test-output-buffered-file) +10416 (flush _test-error-buffered-file) +10417 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10423 # check output +10424 (check-stream-equal _test-output-stream "" "F - test-get-with-too-many-outputs: output should be empty") +10425 (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") +10426 # check that stop(1) was called +10427 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-many-outputs: exit status") +10428 # don't restore from ebp +10429 81 0/subop/add %esp 8/imm32 +10430 # . epilogue +10431 5d/pop-to-ebp +10432 c3/return +10433 +10434 test-convert-array-of-user-defined-types: +10435 # . prologue +10436 55/push-ebp +10437 89/<- %ebp 4/r32/esp +10438 # setup +10439 (clear-stream _test-input-stream) +10440 (clear-stream $_test-input-buffered-file->buffer) +10441 (clear-stream _test-output-stream) +10442 (clear-stream $_test-output-buffered-file->buffer) +10443 # +10444 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 +10445 (write _test-input-stream " x: int\n") +10446 (write _test-input-stream " y: int\n") +10447 (write _test-input-stream "}\n") +10448 (write _test-input-stream "fn foo {\n") +10449 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") +10450 (write _test-input-stream " var idx/ecx: int <- copy 3\n") +10451 (write _test-input-stream " var x/eax: (addr t) <- index arr, idx\n") +10452 (write _test-input-stream "}\n") +10453 # convert +10454 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +10455 (flush _test-output-buffered-file) +10456 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +10462 # check output +10463 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-array-of-user-defined-types/0") +10464 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-array-of-user-defined-types/1") +10465 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-array-of-user-defined-types/2") +10466 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-array-of-user-defined-types/3") +10467 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-array-of-user-defined-types/4") +10468 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-array-of-user-defined-types/5") +10469 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-array-of-user-defined-types/6") +10470 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-array-of-user-defined-types/7") +10471 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-array-of-user-defined-types/8") +10472 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-array-of-user-defined-types/9") +10473 (check-next-stream-line-equal _test-output-stream " (__check-mu-array-bounds %ecx 0x00000008 *eax \"foo\" \"arr\")" "F - test-convert-array-of-user-defined-types/10") +10474 (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") +10475 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-array-of-user-defined-types/12") +10476 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-array-of-user-defined-types/13") +10477 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-array-of-user-defined-types/14") +10478 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-array-of-user-defined-types/15") +10479 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-array-of-user-defined-types/16") +10480 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-array-of-user-defined-types/17") +10481 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-array-of-user-defined-types/18") +10482 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-array-of-user-defined-types/19") +10483 # . epilogue +10484 89/<- %esp 5/r32/ebp +10485 5d/pop-to-ebp +10486 c3/return +10487 +10488 test-convert-length-of-array-of-user-defined-types-to-eax: +10489 # . prologue +10490 55/push-ebp +10491 89/<- %ebp 4/r32/esp +10492 # setup +10493 (clear-stream _test-input-stream) +10494 (clear-stream $_test-input-buffered-file->buffer) +10495 (clear-stream _test-output-stream) +10496 (clear-stream $_test-output-buffered-file->buffer) +10497 # +10498 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 +10499 (write _test-input-stream " x: int\n") +10500 (write _test-input-stream " y: int\n") +10501 (write _test-input-stream " z: int\n") +10502 (write _test-input-stream "}\n") +10503 (write _test-input-stream "fn foo {\n") +10504 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") +10505 (write _test-input-stream " var x/eax: int <- length arr\n") +10506 (write _test-input-stream "}\n") +10507 # convert +10508 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +10509 (flush _test-output-buffered-file) +10510 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +10516 # check output +10517 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/0") +10518 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/1") +10519 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/2") +10520 (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") +10521 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-eax/4") +10522 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/5") +10523 # var arr +10524 (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") +10525 (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") +10526 # length instruction +10527 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/8") +10528 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/9") +10529 (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") +10530 (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") +10531 (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") +10532 (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") +10533 (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") +10534 (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") +10535 # reclaim arr +10536 (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") +10537 # +10538 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-eax/17") +10539 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/18") +10540 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/19") +10541 (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") +10542 (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") +10543 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-eax/22") +10544 # . epilogue +10545 89/<- %esp 5/r32/ebp +10546 5d/pop-to-ebp +10547 c3/return +10548 +10549 test-convert-length-of-array-of-user-defined-types-to-ecx: +10550 # . prologue +10551 55/push-ebp +10552 89/<- %ebp 4/r32/esp +10553 # setup +10554 (clear-stream _test-input-stream) +10555 (clear-stream $_test-input-buffered-file->buffer) +10556 (clear-stream _test-output-stream) +10557 (clear-stream $_test-output-buffered-file->buffer) +10558 # +10559 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 +10560 (write _test-input-stream " x: int\n") +10561 (write _test-input-stream " y: int\n") +10562 (write _test-input-stream " z: int\n") +10563 (write _test-input-stream "}\n") +10564 (write _test-input-stream "fn foo {\n") +10565 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") +10566 (write _test-input-stream " var x/ecx: int <- length arr\n") +10567 (write _test-input-stream "}\n") +10568 # convert +10569 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +10570 (flush _test-output-buffered-file) +10571 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +10577 # check output +10578 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/0") +10579 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/1") +10580 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/2") +10581 (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") +10582 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/4") +10583 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/5") +10584 # var a +10585 (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") +10586 (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") +10587 # var x +10588 (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") +10589 # length instruction +10590 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/9") +10591 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/10") +10592 (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") +10593 (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") +10594 (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") +10595 (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") +10596 (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") +10597 (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") +10598 (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") +10599 # reclaim x +10600 (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") +10601 # reclaim a +10602 (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") +10603 # +10604 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/20") +10605 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/21") +10606 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/22") +10607 (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") +10608 (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") +10609 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/25") +10610 # . epilogue +10611 89/<- %esp 5/r32/ebp +10612 5d/pop-to-ebp +10613 c3/return +10614 +10615 test-convert-length-of-array-of-user-defined-types-to-edx: +10616 # . prologue +10617 55/push-ebp +10618 89/<- %ebp 4/r32/esp +10619 # setup +10620 (clear-stream _test-input-stream) +10621 (clear-stream $_test-input-buffered-file->buffer) +10622 (clear-stream _test-output-stream) +10623 (clear-stream $_test-output-buffered-file->buffer) +10624 # +10625 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 +10626 (write _test-input-stream " x: int\n") +10627 (write _test-input-stream " y: int\n") +10628 (write _test-input-stream " z: int\n") +10629 (write _test-input-stream "}\n") +10630 (write _test-input-stream "fn foo {\n") +10631 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") +10632 (write _test-input-stream " var x/edx: int <- length arr\n") +10633 (write _test-input-stream "}\n") +10634 # convert +10635 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +10636 (flush _test-output-buffered-file) +10637 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +10643 # check output +10644 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/0") +10645 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/1") +10646 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/2") +10647 (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") +10648 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-edx/4") +10649 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/5") +10650 # var a +10651 (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") +10652 (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") +10653 # var x +10654 (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") +10655 # length instruction +10656 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/9") +10657 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/10") +10658 (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") +10659 (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") +10660 (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") +10661 (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") +10662 (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") +10663 (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") +10664 (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") +10665 # reclaim x +10666 (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") +10667 # reclaim a +10668 (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") +10669 # +10670 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-edx/20") +10671 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/21") +10672 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/22") +10673 (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") +10674 (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") +10675 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-edx/25") +10676 # . epilogue +10677 89/<- %esp 5/r32/ebp +10678 5d/pop-to-ebp +10679 c3/return +10680 +10681 test-convert-length-of-array-of-user-defined-types: +10682 # . prologue +10683 55/push-ebp +10684 89/<- %ebp 4/r32/esp +10685 # setup +10686 (clear-stream _test-input-stream) +10687 (clear-stream $_test-input-buffered-file->buffer) +10688 (clear-stream _test-output-stream) +10689 (clear-stream $_test-output-buffered-file->buffer) +10690 # +10691 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 +10692 (write _test-input-stream " x: int\n") +10693 (write _test-input-stream " y: int\n") +10694 (write _test-input-stream " z: int\n") +10695 (write _test-input-stream "}\n") +10696 (write _test-input-stream "fn foo {\n") +10697 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") +10698 (write _test-input-stream " var x/ebx: int <- length arr\n") +10699 (write _test-input-stream "}\n") +10700 # convert +10701 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +10702 (flush _test-output-buffered-file) +10703 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +10709 # check output +10710 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types/0") +10711 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types/1") +10712 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types/2") +10713 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types/3") +10714 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types/4") +10715 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types/5") +10716 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types/6") +10717 (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") +10718 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-length-of-array-of-user-defined-types/8") +10719 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types/9") +10720 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types/10") +10721 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types/11") +10722 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types/12") +10723 (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") +10724 (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") +10725 (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") +10726 (check-next-stream-line-equal _test-output-stream " 89/<- %ebx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types/16") +10727 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types/17") +10728 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types/18") +10729 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types/19") +10730 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ebx" "F - test-convert-length-of-array-of-user-defined-types/20") +10731 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types/21") +10732 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types/22") +10733 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types/23") +10734 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types/24") +10735 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types/25") +10736 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types/26") +10737 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types/27") +10738 # . epilogue +10739 89/<- %esp 5/r32/ebp +10740 5d/pop-to-ebp +10741 c3/return +10742 +10743 test-index-with-non-array-atom-base-type: +10744 # . prologue +10745 55/push-ebp +10746 89/<- %ebp 4/r32/esp +10747 # setup +10748 (clear-stream _test-input-stream) +10749 (clear-stream $_test-input-buffered-file->buffer) +10750 (clear-stream _test-output-stream) +10751 (clear-stream $_test-output-buffered-file->buffer) +10752 (clear-stream _test-error-stream) +10753 (clear-stream $_test-error-buffered-file->buffer) +10754 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10755 68/push 0/imm32 +10756 68/push 0/imm32 +10757 89/<- %edx 4/r32/esp +10758 (tailor-exit-descriptor %edx 0x10) +10759 # +10760 (write _test-input-stream "fn foo {\n") +10761 (write _test-input-stream " var a: int\n") +10762 (write _test-input-stream " var c/ecx: (addr int) <- index a, 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-index-with-non-array-atom-base-type: output should be empty") +10779 (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") +10780 # check that stop(1) was called +10781 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-atom-base-type: 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-index-with-non-array-compound-base-type: +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: (handle int)\n") +10807 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") +10808 (write _test-input-stream "}\n") +10809 # convert +10810 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10811 # registers except esp clobbered at this point +10812 # restore ed +10813 89/<- %edx 4/r32/esp +10814 (flush _test-output-buffered-file) +10815 (flush _test-error-buffered-file) +10816 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10822 # check output +10823 (check-stream-equal _test-output-stream "" "F - test-index-with-non-array-compound-base-type: output should be empty") +10824 (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") +10825 # check that stop(1) was called +10826 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-compound-base-type: exit status") +10827 # don't restore from ebp +10828 81 0/subop/add %esp 8/imm32 +10829 # . epilogue +10830 5d/pop-to-ebp +10831 c3/return +10832 +10833 test-index-with-non-array-compound-base-type-2: +10834 # . prologue +10835 55/push-ebp +10836 89/<- %ebp 4/r32/esp +10837 # setup +10838 (clear-stream _test-input-stream) +10839 (clear-stream $_test-input-buffered-file->buffer) +10840 (clear-stream _test-output-stream) +10841 (clear-stream $_test-output-buffered-file->buffer) +10842 (clear-stream _test-error-stream) +10843 (clear-stream $_test-error-buffered-file->buffer) +10844 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10845 68/push 0/imm32 +10846 68/push 0/imm32 +10847 89/<- %edx 4/r32/esp +10848 (tailor-exit-descriptor %edx 0x10) +10849 # +10850 (write _test-input-stream "fn foo {\n") +10851 (write _test-input-stream " var a: (addr int)\n") +10852 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") +10853 (write _test-input-stream "}\n") +10854 # convert +10855 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10856 # registers except esp clobbered at this point +10857 # restore ed +10858 89/<- %edx 4/r32/esp +10859 (flush _test-output-buffered-file) +10860 (flush _test-error-buffered-file) +10861 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10867 # check output +10868 (check-stream-equal _test-output-stream "" "F - test-index-with-non-array-compound-base-type-2: output should be empty") +10869 (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") +10870 # check that stop(1) was called +10871 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-compound-base-type-2: exit status") +10872 # don't restore from ebp +10873 81 0/subop/add %esp 8/imm32 +10874 # . epilogue +10875 5d/pop-to-ebp +10876 c3/return +10877 +10878 test-index-with-array-atom-base-type: +10879 # . prologue +10880 55/push-ebp +10881 89/<- %ebp 4/r32/esp +10882 # setup +10883 (clear-stream _test-input-stream) +10884 (clear-stream $_test-input-buffered-file->buffer) +10885 (clear-stream _test-output-stream) +10886 (clear-stream $_test-output-buffered-file->buffer) +10887 (clear-stream _test-error-stream) +10888 (clear-stream $_test-error-buffered-file->buffer) +10889 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10890 68/push 0/imm32 +10891 68/push 0/imm32 +10892 89/<- %edx 4/r32/esp +10893 (tailor-exit-descriptor %edx 0x10) +10894 # +10895 (write _test-input-stream "fn foo {\n") +10896 (write _test-input-stream " var a: array\n") +10897 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") +10898 (write _test-input-stream "}\n") +10899 # convert +10900 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10901 # registers except esp clobbered at this point +10902 # restore ed +10903 89/<- %edx 4/r32/esp +10904 (flush _test-output-buffered-file) +10905 (flush _test-error-buffered-file) +10906 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10912 # check output +10913 (check-stream-equal _test-output-stream "" "F - test-index-with-array-atom-base-type: output should be empty") +10914 (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") +10915 # check that stop(1) was called +10916 (check-ints-equal *(edx+4) 2 "F - test-index-with-array-atom-base-type: exit status") +10917 # don't restore from ebp +10918 81 0/subop/add %esp 8/imm32 +10919 # . epilogue +10920 5d/pop-to-ebp +10921 c3/return +10922 +10923 test-index-with-addr-base-on-stack: +10924 # . prologue +10925 55/push-ebp +10926 89/<- %ebp 4/r32/esp +10927 # setup +10928 (clear-stream _test-input-stream) +10929 (clear-stream $_test-input-buffered-file->buffer) +10930 (clear-stream _test-output-stream) +10931 (clear-stream $_test-output-buffered-file->buffer) +10932 (clear-stream _test-error-stream) +10933 (clear-stream $_test-error-buffered-file->buffer) +10934 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10935 68/push 0/imm32 +10936 68/push 0/imm32 +10937 89/<- %edx 4/r32/esp +10938 (tailor-exit-descriptor %edx 0x10) +10939 # +10940 (write _test-input-stream "fn foo {\n") +10941 (write _test-input-stream " var a: (addr array int)\n") +10942 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") +10943 (write _test-input-stream "}\n") +10944 # convert +10945 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10946 # registers except esp clobbered at this point +10947 # restore ed +10948 89/<- %edx 4/r32/esp +10949 (flush _test-output-buffered-file) +10950 (flush _test-error-buffered-file) +10951 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +10957 # check output +10958 (check-stream-equal _test-output-stream "" "F - test-index-with-addr-base-on-stack: output should be empty") +10959 (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") +10960 # check that stop(1) was called +10961 (check-ints-equal *(edx+4) 2 "F - test-index-with-addr-base-on-stack: exit status") +10962 # don't restore from ebp +10963 81 0/subop/add %esp 8/imm32 +10964 # . epilogue +10965 5d/pop-to-ebp +10966 c3/return +10967 +10968 test-index-with-wrong-index-type: +10969 # . prologue +10970 55/push-ebp +10971 89/<- %ebp 4/r32/esp +10972 # setup +10973 (clear-stream _test-input-stream) +10974 (clear-stream $_test-input-buffered-file->buffer) +10975 (clear-stream _test-output-stream) +10976 (clear-stream $_test-output-buffered-file->buffer) +10977 (clear-stream _test-error-stream) +10978 (clear-stream $_test-error-buffered-file->buffer) +10979 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10980 68/push 0/imm32 +10981 68/push 0/imm32 +10982 89/<- %edx 4/r32/esp +10983 (tailor-exit-descriptor %edx 0x10) +10984 # +10985 (write _test-input-stream "fn foo {\n") +10986 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") +10987 (write _test-input-stream " var b: boolean\n") +10988 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") +10989 (write _test-input-stream "}\n") +10990 # convert +10991 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10992 # registers except esp clobbered at this point +10993 # restore ed +10994 89/<- %edx 4/r32/esp +10995 (flush _test-output-buffered-file) +10996 (flush _test-error-buffered-file) +10997 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11003 # check output +11004 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-index-type: output should be empty") +11005 (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") +11006 # check that stop(1) was called +11007 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-index-type: exit status") +11008 # don't restore from ebp +11009 81 0/subop/add %esp 8/imm32 +11010 # . epilogue +11011 5d/pop-to-ebp +11012 c3/return +11013 +11014 test-index-with-offset-atom-index-type: +11015 # . prologue +11016 55/push-ebp +11017 89/<- %ebp 4/r32/esp +11018 # setup +11019 (clear-stream _test-input-stream) +11020 (clear-stream $_test-input-buffered-file->buffer) +11021 (clear-stream _test-output-stream) +11022 (clear-stream $_test-output-buffered-file->buffer) +11023 (clear-stream _test-error-stream) +11024 (clear-stream $_test-error-buffered-file->buffer) +11025 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11026 68/push 0/imm32 +11027 68/push 0/imm32 +11028 89/<- %edx 4/r32/esp +11029 (tailor-exit-descriptor %edx 0x10) +11030 # +11031 (write _test-input-stream "fn foo {\n") +11032 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") +11033 (write _test-input-stream " var b: offset\n") +11034 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") +11035 (write _test-input-stream "}\n") +11036 # convert +11037 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11038 # registers except esp clobbered at this point +11039 # restore ed +11040 89/<- %edx 4/r32/esp +11041 (flush _test-output-buffered-file) +11042 (flush _test-error-buffered-file) +11043 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11049 # check output +11050 (check-stream-equal _test-output-stream "" "F - test-index-with-offset-atom-index-type: output should be empty") +11051 (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") +11052 # check that stop(1) was called +11053 (check-ints-equal *(edx+4) 2 "F - test-index-with-offset-atom-index-type: exit status") +11054 # don't restore from ebp +11055 81 0/subop/add %esp 8/imm32 +11056 # . epilogue +11057 5d/pop-to-ebp +11058 c3/return +11059 +11060 test-index-with-offset-on-stack: +11061 # . prologue +11062 55/push-ebp +11063 89/<- %ebp 4/r32/esp +11064 # setup +11065 (clear-stream _test-input-stream) +11066 (clear-stream $_test-input-buffered-file->buffer) +11067 (clear-stream _test-output-stream) +11068 (clear-stream $_test-output-buffered-file->buffer) +11069 (clear-stream _test-error-stream) +11070 (clear-stream $_test-error-buffered-file->buffer) +11071 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11072 68/push 0/imm32 +11073 68/push 0/imm32 +11074 89/<- %edx 4/r32/esp +11075 (tailor-exit-descriptor %edx 0x10) +11076 # +11077 (write _test-input-stream "fn foo {\n") +11078 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") +11079 (write _test-input-stream " var b: int\n") +11080 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") +11081 (write _test-input-stream "}\n") +11082 # convert +11083 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11084 # registers except esp clobbered at this point +11085 # restore ed +11086 89/<- %edx 4/r32/esp +11087 (flush _test-output-buffered-file) +11088 (flush _test-error-buffered-file) +11089 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11095 # check output +11096 (check-stream-equal _test-output-stream "" "F - test-index-with-offset-on-stack: output should be empty") +11097 (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") +11098 # check that stop(1) was called +11099 (check-ints-equal *(edx+4) 2 "F - test-index-with-offset-on-stack: exit status") +11100 # don't restore from ebp +11101 81 0/subop/add %esp 8/imm32 +11102 # . epilogue +11103 5d/pop-to-ebp +11104 c3/return +11105 +11106 test-index-needs-offset-type: +11107 # . prologue +11108 55/push-ebp +11109 89/<- %ebp 4/r32/esp +11110 # setup +11111 (clear-stream _test-input-stream) +11112 (clear-stream $_test-input-buffered-file->buffer) +11113 (clear-stream _test-output-stream) +11114 (clear-stream $_test-output-buffered-file->buffer) +11115 (clear-stream _test-error-stream) +11116 (clear-stream $_test-error-buffered-file->buffer) +11117 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11118 68/push 0/imm32 +11119 68/push 0/imm32 +11120 89/<- %edx 4/r32/esp +11121 (tailor-exit-descriptor %edx 0x10) +11122 # +11123 (write _test-input-stream "fn foo {\n") +11124 (write _test-input-stream " var a/eax: (addr array t) <- copy 0\n") +11125 (write _test-input-stream " var b/ebx: int <- copy 0\n") +11126 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") +11127 (write _test-input-stream "}\n") +11128 (write _test-input-stream "type t {\n") # size 12 is not a power of two +11129 (write _test-input-stream " x: int\n") +11130 (write _test-input-stream " y: int\n") +11131 (write _test-input-stream " z: int\n") +11132 (write _test-input-stream "}\n") +11133 # convert +11134 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11135 # registers except esp clobbered at this point +11136 # restore ed +11137 89/<- %edx 4/r32/esp +11138 (flush _test-output-buffered-file) +11139 (flush _test-error-buffered-file) +11140 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11146 # check output +11147 (check-stream-equal _test-output-stream "" "F - test-index-needs-offset-type: output should be empty") +11148 (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") +11149 # check that stop(1) was called +11150 (check-ints-equal *(edx+4) 2 "F - test-index-needs-offset-type: exit status") +11151 # don't restore from ebp +11152 81 0/subop/add %esp 8/imm32 +11153 # . epilogue +11154 5d/pop-to-ebp +11155 c3/return +11156 +11157 test-index-with-output-not-address: +11158 # . prologue +11159 55/push-ebp +11160 89/<- %ebp 4/r32/esp +11161 # setup +11162 (clear-stream _test-input-stream) +11163 (clear-stream $_test-input-buffered-file->buffer) +11164 (clear-stream _test-output-stream) +11165 (clear-stream $_test-output-buffered-file->buffer) +11166 (clear-stream _test-error-stream) +11167 (clear-stream $_test-error-buffered-file->buffer) +11168 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11169 68/push 0/imm32 +11170 68/push 0/imm32 +11171 89/<- %edx 4/r32/esp +11172 (tailor-exit-descriptor %edx 0x10) +11173 # +11174 (write _test-input-stream "fn foo {\n") +11175 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") +11176 (write _test-input-stream " var o/edi: int <- index a, 0\n") +11177 (write _test-input-stream "}\n") +11178 # convert +11179 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11180 # registers except esp clobbered at this point +11181 # restore ed +11182 89/<- %edx 4/r32/esp +11183 (flush _test-output-buffered-file) +11184 (flush _test-error-buffered-file) +11185 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11191 # check output +11192 (check-stream-equal _test-output-stream "" "F - test-index-with-output-not-address: output should be empty") +11193 (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") +11194 # check that stop(1) was called +11195 (check-ints-equal *(edx+4) 2 "F - test-index-with-output-not-address: exit status") +11196 # don't restore from ebp +11197 81 0/subop/add %esp 8/imm32 +11198 # . epilogue +11199 5d/pop-to-ebp +11200 c3/return +11201 +11202 test-index-with-output-not-address-2: +11203 # . prologue +11204 55/push-ebp +11205 89/<- %ebp 4/r32/esp +11206 # setup +11207 (clear-stream _test-input-stream) +11208 (clear-stream $_test-input-buffered-file->buffer) +11209 (clear-stream _test-output-stream) +11210 (clear-stream $_test-output-buffered-file->buffer) +11211 (clear-stream _test-error-stream) +11212 (clear-stream $_test-error-buffered-file->buffer) +11213 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11214 68/push 0/imm32 +11215 68/push 0/imm32 +11216 89/<- %edx 4/r32/esp +11217 (tailor-exit-descriptor %edx 0x10) +11218 # +11219 (write _test-input-stream "fn foo {\n") +11220 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") +11221 (write _test-input-stream " var o/edi: (int) <- index a, 0\n") +11222 (write _test-input-stream "}\n") +11223 # convert +11224 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11225 # registers except esp clobbered at this point +11226 # restore ed +11227 89/<- %edx 4/r32/esp +11228 (flush _test-output-buffered-file) +11229 (flush _test-error-buffered-file) +11230 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11236 # check output +11237 (check-stream-equal _test-output-stream "" "F - test-index-with-output-not-address-2: output should be empty") +11238 (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") +11239 # check that stop(1) was called +11240 (check-ints-equal *(edx+4) 2 "F - test-index-with-output-not-address-2: exit status") +11241 # don't restore from ebp +11242 81 0/subop/add %esp 8/imm32 +11243 # . epilogue +11244 5d/pop-to-ebp +11245 c3/return +11246 +11247 test-index-with-wrong-output-type: +11248 # . prologue +11249 55/push-ebp +11250 89/<- %ebp 4/r32/esp +11251 # setup +11252 (clear-stream _test-input-stream) +11253 (clear-stream $_test-input-buffered-file->buffer) +11254 (clear-stream _test-output-stream) +11255 (clear-stream $_test-output-buffered-file->buffer) +11256 (clear-stream _test-error-stream) +11257 (clear-stream $_test-error-buffered-file->buffer) +11258 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11259 68/push 0/imm32 +11260 68/push 0/imm32 +11261 89/<- %edx 4/r32/esp +11262 (tailor-exit-descriptor %edx 0x10) +11263 # +11264 (write _test-input-stream "fn foo {\n") +11265 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") +11266 (write _test-input-stream " var o/edi: (addr int) <- index a, 0\n") +11267 (write _test-input-stream "}\n") +11268 # convert +11269 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11270 # registers except esp clobbered at this point +11271 # restore ed +11272 89/<- %edx 4/r32/esp +11273 (flush _test-output-buffered-file) +11274 (flush _test-error-buffered-file) +11275 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11281 # check output +11282 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-output-type: output should be empty") +11283 (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") +11284 # check that stop(1) was called +11285 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-output-type: exit status") +11286 # don't restore from ebp +11287 81 0/subop/add %esp 8/imm32 +11288 # . epilogue +11289 5d/pop-to-ebp +11290 c3/return +11291 +11292 test-index-with-wrong-output-compound-type: +11293 # . prologue +11294 55/push-ebp +11295 89/<- %ebp 4/r32/esp +11296 # setup +11297 (clear-stream _test-input-stream) +11298 (clear-stream $_test-input-buffered-file->buffer) +11299 (clear-stream _test-output-stream) +11300 (clear-stream $_test-output-buffered-file->buffer) +11301 (clear-stream _test-error-stream) +11302 (clear-stream $_test-error-buffered-file->buffer) +11303 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11304 68/push 0/imm32 +11305 68/push 0/imm32 +11306 89/<- %edx 4/r32/esp +11307 (tailor-exit-descriptor %edx 0x10) +11308 # +11309 (write _test-input-stream "fn foo {\n") +11310 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") +11311 (write _test-input-stream " var o/edi: (addr handle int) <- index a, 0\n") +11312 (write _test-input-stream "}\n") +11313 # convert +11314 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11315 # registers except esp clobbered at this point +11316 # restore ed +11317 89/<- %edx 4/r32/esp +11318 (flush _test-output-buffered-file) +11319 (flush _test-error-buffered-file) +11320 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11326 # check output +11327 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-output-compound-type: output should be empty") +11328 (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") +11329 # check that stop(1) was called +11330 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-output-compound-type: exit status") +11331 # don't restore from ebp +11332 81 0/subop/add %esp 8/imm32 +11333 # . epilogue +11334 5d/pop-to-ebp +11335 c3/return +11336 +11337 test-index-with-no-inouts: +11338 # . prologue +11339 55/push-ebp +11340 89/<- %ebp 4/r32/esp +11341 # setup +11342 (clear-stream _test-input-stream) +11343 (clear-stream $_test-input-buffered-file->buffer) +11344 (clear-stream _test-output-stream) +11345 (clear-stream $_test-output-buffered-file->buffer) +11346 (clear-stream _test-error-stream) +11347 (clear-stream $_test-error-buffered-file->buffer) +11348 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11349 68/push 0/imm32 +11350 68/push 0/imm32 +11351 89/<- %edx 4/r32/esp +11352 (tailor-exit-descriptor %edx 0x10) +11353 # +11354 (write _test-input-stream "fn foo {\n") +11355 (write _test-input-stream " var c/ecx: (addr int) <- index\n") +11356 (write _test-input-stream "}\n") +11357 # convert +11358 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11359 # registers except esp clobbered at this point +11360 # restore ed +11361 89/<- %edx 4/r32/esp +11362 (flush _test-output-buffered-file) +11363 (flush _test-error-buffered-file) +11364 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11370 # check output +11371 (check-stream-equal _test-output-stream "" "F - test-index-with-no-inouts: output should be empty") +11372 (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") +11373 # check that stop(1) was called +11374 (check-ints-equal *(edx+4) 2 "F - test-index-with-no-inouts: exit status") +11375 # don't restore from ebp +11376 81 0/subop/add %esp 8/imm32 +11377 # . epilogue +11378 5d/pop-to-ebp +11379 c3/return +11380 +11381 test-index-with-too-few-inouts: +11382 # . prologue +11383 55/push-ebp +11384 89/<- %ebp 4/r32/esp +11385 # setup +11386 (clear-stream _test-input-stream) +11387 (clear-stream $_test-input-buffered-file->buffer) +11388 (clear-stream _test-output-stream) +11389 (clear-stream $_test-output-buffered-file->buffer) +11390 (clear-stream _test-error-stream) +11391 (clear-stream $_test-error-buffered-file->buffer) +11392 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11393 68/push 0/imm32 +11394 68/push 0/imm32 +11395 89/<- %edx 4/r32/esp +11396 (tailor-exit-descriptor %edx 0x10) +11397 # +11398 (write _test-input-stream "fn foo {\n") +11399 (write _test-input-stream " var a: (array int 3)\n") +11400 (write _test-input-stream " var c/ecx: (addr int) <- index a\n") +11401 (write _test-input-stream "}\n") +11402 # convert +11403 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11404 # registers except esp clobbered at this point +11405 # restore ed +11406 89/<- %edx 4/r32/esp +11407 (flush _test-output-buffered-file) +11408 (flush _test-error-buffered-file) +11409 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11415 # check output +11416 (check-stream-equal _test-output-stream "" "F - test-index-with-too-few-inouts: output should be empty") +11417 (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") +11418 # check that stop(1) was called +11419 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-few-inouts: exit status") +11420 # don't restore from ebp +11421 81 0/subop/add %esp 8/imm32 +11422 # . epilogue +11423 5d/pop-to-ebp +11424 c3/return +11425 +11426 test-index-with-too-many-inouts: +11427 # . prologue +11428 55/push-ebp +11429 89/<- %ebp 4/r32/esp +11430 # setup +11431 (clear-stream _test-input-stream) +11432 (clear-stream $_test-input-buffered-file->buffer) +11433 (clear-stream _test-output-stream) +11434 (clear-stream $_test-output-buffered-file->buffer) +11435 (clear-stream _test-error-stream) +11436 (clear-stream $_test-error-buffered-file->buffer) +11437 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11438 68/push 0/imm32 +11439 68/push 0/imm32 +11440 89/<- %edx 4/r32/esp +11441 (tailor-exit-descriptor %edx 0x10) +11442 # +11443 (write _test-input-stream "fn foo {\n") +11444 (write _test-input-stream " var a: (array int 3)\n") +11445 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0, 0\n") +11446 (write _test-input-stream "}\n") +11447 # convert +11448 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11449 # registers except esp clobbered at this point +11450 # restore ed +11451 89/<- %edx 4/r32/esp +11452 (flush _test-output-buffered-file) +11453 (flush _test-error-buffered-file) +11454 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11460 # check output +11461 (check-stream-equal _test-output-stream "" "F - test-index-with-too-many-inouts: output should be empty") +11462 (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") +11463 # check that stop(1) was called +11464 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-many-inouts: exit status") +11465 # don't restore from ebp +11466 81 0/subop/add %esp 8/imm32 +11467 # . epilogue +11468 5d/pop-to-ebp +11469 c3/return +11470 +11471 test-index-with-no-output: +11472 # . prologue +11473 55/push-ebp +11474 89/<- %ebp 4/r32/esp +11475 # setup +11476 (clear-stream _test-input-stream) +11477 (clear-stream $_test-input-buffered-file->buffer) +11478 (clear-stream _test-output-stream) +11479 (clear-stream $_test-output-buffered-file->buffer) +11480 (clear-stream _test-error-stream) +11481 (clear-stream $_test-error-buffered-file->buffer) +11482 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11483 68/push 0/imm32 +11484 68/push 0/imm32 +11485 89/<- %edx 4/r32/esp +11486 (tailor-exit-descriptor %edx 0x10) +11487 # +11488 (write _test-input-stream "fn foo {\n") +11489 (write _test-input-stream " var a: (array int 3)\n") +11490 (write _test-input-stream " index a, 0\n") +11491 (write _test-input-stream "}\n") +11492 # convert +11493 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11494 # registers except esp clobbered at this point +11495 # restore ed +11496 89/<- %edx 4/r32/esp +11497 (flush _test-output-buffered-file) +11498 (flush _test-error-buffered-file) +11499 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11505 # check output +11506 (check-stream-equal _test-output-stream "" "F - test-index-with-no-output: output should be empty") +11507 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: must have an output" "F - test-index-with-no-output: error message") +11508 # check that stop(1) was called +11509 (check-ints-equal *(edx+4) 2 "F - test-index-with-no-output: exit status") +11510 # don't restore from ebp +11511 81 0/subop/add %esp 8/imm32 +11512 # . epilogue +11513 5d/pop-to-ebp +11514 c3/return +11515 +11516 test-index-with-too-many-outputs: +11517 # . prologue +11518 55/push-ebp +11519 89/<- %ebp 4/r32/esp +11520 # setup +11521 (clear-stream _test-input-stream) +11522 (clear-stream $_test-input-buffered-file->buffer) +11523 (clear-stream _test-output-stream) +11524 (clear-stream $_test-output-buffered-file->buffer) +11525 (clear-stream _test-error-stream) +11526 (clear-stream $_test-error-buffered-file->buffer) +11527 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11528 68/push 0/imm32 +11529 68/push 0/imm32 +11530 89/<- %edx 4/r32/esp +11531 (tailor-exit-descriptor %edx 0x10) +11532 # +11533 (write _test-input-stream "fn foo {\n") +11534 (write _test-input-stream " var a: (array int 3)\n") +11535 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") +11536 (write _test-input-stream " var c/ecx: (addr int) <- copy 0\n") +11537 (write _test-input-stream " b, c <- index a, 0\n") +11538 (write _test-input-stream "}\n") +11539 # convert +11540 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11541 # registers except esp clobbered at this point +11542 # restore ed +11543 89/<- %edx 4/r32/esp +11544 (flush _test-output-buffered-file) +11545 (flush _test-error-buffered-file) +11546 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11552 # check output +11553 (check-stream-equal _test-output-stream "" "F - test-index-with-too-many-outputs: output should be empty") +11554 (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") +11555 # check that stop(1) was called +11556 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-many-outputs: exit status") +11557 # don't restore from ebp +11558 81 0/subop/add %esp 8/imm32 +11559 # . epilogue +11560 5d/pop-to-ebp +11561 c3/return +11562 +11563 test-compute-offset-with-non-array-atom-base-type: +11564 # . prologue +11565 55/push-ebp +11566 89/<- %ebp 4/r32/esp +11567 # setup +11568 (clear-stream _test-input-stream) +11569 (clear-stream $_test-input-buffered-file->buffer) +11570 (clear-stream _test-output-stream) +11571 (clear-stream $_test-output-buffered-file->buffer) +11572 (clear-stream _test-error-stream) +11573 (clear-stream $_test-error-buffered-file->buffer) +11574 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11575 68/push 0/imm32 +11576 68/push 0/imm32 +11577 89/<- %edx 4/r32/esp +11578 (tailor-exit-descriptor %edx 0x10) +11579 # +11580 (write _test-input-stream "fn foo {\n") +11581 (write _test-input-stream " var a: int\n") +11582 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") +11583 (write _test-input-stream "}\n") +11584 # convert +11585 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11586 # registers except esp clobbered at this point +11587 # restore ed +11588 89/<- %edx 4/r32/esp +11589 (flush _test-output-buffered-file) +11590 (flush _test-error-buffered-file) +11591 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11597 # check output +11598 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-atom-base-type: output should be empty") +11599 (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") +11600 # check that stop(1) was called +11601 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-atom-base-type: exit status") +11602 # don't restore from ebp +11603 81 0/subop/add %esp 8/imm32 +11604 # . epilogue +11605 5d/pop-to-ebp +11606 c3/return +11607 +11608 test-compute-offset-with-non-array-compound-base-type: +11609 # . prologue +11610 55/push-ebp +11611 89/<- %ebp 4/r32/esp +11612 # setup +11613 (clear-stream _test-input-stream) +11614 (clear-stream $_test-input-buffered-file->buffer) +11615 (clear-stream _test-output-stream) +11616 (clear-stream $_test-output-buffered-file->buffer) +11617 (clear-stream _test-error-stream) +11618 (clear-stream $_test-error-buffered-file->buffer) +11619 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11620 68/push 0/imm32 +11621 68/push 0/imm32 +11622 89/<- %edx 4/r32/esp +11623 (tailor-exit-descriptor %edx 0x10) +11624 # +11625 (write _test-input-stream "fn foo {\n") +11626 (write _test-input-stream " var a: (handle int)\n") +11627 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") +11628 (write _test-input-stream "}\n") +11629 # convert +11630 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11631 # registers except esp clobbered at this point +11632 # restore ed +11633 89/<- %edx 4/r32/esp +11634 (flush _test-output-buffered-file) +11635 (flush _test-error-buffered-file) +11636 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11642 # check output +11643 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-compound-base-type: output should be empty") +11644 (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") +11645 # check that stop(1) was called +11646 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-compound-base-type: exit status") +11647 # don't restore from ebp +11648 81 0/subop/add %esp 8/imm32 +11649 # . epilogue +11650 5d/pop-to-ebp +11651 c3/return +11652 +11653 test-compute-offset-with-non-array-compound-base-type-2: +11654 # . prologue +11655 55/push-ebp +11656 89/<- %ebp 4/r32/esp +11657 # setup +11658 (clear-stream _test-input-stream) +11659 (clear-stream $_test-input-buffered-file->buffer) +11660 (clear-stream _test-output-stream) +11661 (clear-stream $_test-output-buffered-file->buffer) +11662 (clear-stream _test-error-stream) +11663 (clear-stream $_test-error-buffered-file->buffer) +11664 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11665 68/push 0/imm32 +11666 68/push 0/imm32 +11667 89/<- %edx 4/r32/esp +11668 (tailor-exit-descriptor %edx 0x10) +11669 # +11670 (write _test-input-stream "fn foo {\n") +11671 (write _test-input-stream " var a: (addr int)\n") +11672 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") +11673 (write _test-input-stream "}\n") +11674 # convert +11675 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11676 # registers except esp clobbered at this point +11677 # restore ed +11678 89/<- %edx 4/r32/esp +11679 (flush _test-output-buffered-file) +11680 (flush _test-error-buffered-file) +11681 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11687 # check output +11688 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-compound-base-type-2: output should be empty") +11689 (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") +11690 # check that stop(1) was called +11691 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-compound-base-type-2: exit status") +11692 # don't restore from ebp +11693 81 0/subop/add %esp 8/imm32 +11694 # . epilogue +11695 5d/pop-to-ebp +11696 c3/return +11697 +11698 test-compute-offset-with-array-atom-base-type: +11699 # . prologue +11700 55/push-ebp +11701 89/<- %ebp 4/r32/esp +11702 # setup +11703 (clear-stream _test-input-stream) +11704 (clear-stream $_test-input-buffered-file->buffer) +11705 (clear-stream _test-output-stream) +11706 (clear-stream $_test-output-buffered-file->buffer) +11707 (clear-stream _test-error-stream) +11708 (clear-stream $_test-error-buffered-file->buffer) +11709 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11710 68/push 0/imm32 +11711 68/push 0/imm32 +11712 89/<- %edx 4/r32/esp +11713 (tailor-exit-descriptor %edx 0x10) +11714 # +11715 (write _test-input-stream "fn foo {\n") +11716 (write _test-input-stream " var a: array\n") +11717 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") +11718 (write _test-input-stream "}\n") +11719 # convert +11720 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11721 # registers except esp clobbered at this point +11722 # restore ed +11723 89/<- %edx 4/r32/esp +11724 (flush _test-output-buffered-file) +11725 (flush _test-error-buffered-file) +11726 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11732 # check output +11733 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-array-atom-base-type: output should be empty") +11734 (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") +11735 # check that stop(1) was called +11736 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-array-atom-base-type: exit status") +11737 # don't restore from ebp +11738 81 0/subop/add %esp 8/imm32 +11739 # . epilogue +11740 5d/pop-to-ebp +11741 c3/return +11742 +11743 test-compute-offset-with-wrong-index-type: +11744 # . prologue +11745 55/push-ebp +11746 89/<- %ebp 4/r32/esp +11747 # setup +11748 (clear-stream _test-input-stream) +11749 (clear-stream $_test-input-buffered-file->buffer) +11750 (clear-stream _test-output-stream) +11751 (clear-stream $_test-output-buffered-file->buffer) +11752 (clear-stream _test-error-stream) +11753 (clear-stream $_test-error-buffered-file->buffer) +11754 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11755 68/push 0/imm32 +11756 68/push 0/imm32 +11757 89/<- %edx 4/r32/esp +11758 (tailor-exit-descriptor %edx 0x10) +11759 # +11760 (write _test-input-stream "fn foo {\n") +11761 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") +11762 (write _test-input-stream " var b: boolean\n") +11763 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, b\n") +11764 (write _test-input-stream "}\n") +11765 # convert +11766 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11767 # registers except esp clobbered at this point +11768 # restore ed +11769 89/<- %edx 4/r32/esp +11770 (flush _test-output-buffered-file) +11771 (flush _test-error-buffered-file) +11772 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11778 # check output +11779 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-index-type: output should be empty") +11780 (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") +11781 # check that stop(1) was called +11782 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-index-type: exit status") +11783 # don't restore from ebp +11784 81 0/subop/add %esp 8/imm32 +11785 # . epilogue +11786 5d/pop-to-ebp +11787 c3/return +11788 +11789 test-compute-offset-with-output-not-offset: +11790 # . prologue +11791 55/push-ebp +11792 89/<- %ebp 4/r32/esp +11793 # setup +11794 (clear-stream _test-input-stream) +11795 (clear-stream $_test-input-buffered-file->buffer) +11796 (clear-stream _test-output-stream) +11797 (clear-stream $_test-output-buffered-file->buffer) +11798 (clear-stream _test-error-stream) +11799 (clear-stream $_test-error-buffered-file->buffer) +11800 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11801 68/push 0/imm32 +11802 68/push 0/imm32 +11803 89/<- %edx 4/r32/esp +11804 (tailor-exit-descriptor %edx 0x10) +11805 # +11806 (write _test-input-stream "fn foo {\n") +11807 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") +11808 (write _test-input-stream " var o/edi: int <- compute-offset a, 0\n") +11809 (write _test-input-stream "}\n") +11810 # convert +11811 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11812 # registers except esp clobbered at this point +11813 # restore ed +11814 89/<- %edx 4/r32/esp +11815 (flush _test-output-buffered-file) +11816 (flush _test-error-buffered-file) +11817 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11823 # check output +11824 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-output-not-offset: output should be empty") +11825 (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") +11826 # check that stop(1) was called +11827 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-output-not-offset: exit status") +11828 # don't restore from ebp +11829 81 0/subop/add %esp 8/imm32 +11830 # . epilogue +11831 5d/pop-to-ebp +11832 c3/return +11833 +11834 test-compute-offset-with-output-not-address-2: +11835 # . prologue +11836 55/push-ebp +11837 89/<- %ebp 4/r32/esp +11838 # setup +11839 (clear-stream _test-input-stream) +11840 (clear-stream $_test-input-buffered-file->buffer) +11841 (clear-stream _test-output-stream) +11842 (clear-stream $_test-output-buffered-file->buffer) +11843 (clear-stream _test-error-stream) +11844 (clear-stream $_test-error-buffered-file->buffer) +11845 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11846 68/push 0/imm32 +11847 68/push 0/imm32 +11848 89/<- %edx 4/r32/esp +11849 (tailor-exit-descriptor %edx 0x10) +11850 # +11851 (write _test-input-stream "fn foo {\n") +11852 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") +11853 (write _test-input-stream " var o/edi: (int) <- compute-offset a, 0\n") +11854 (write _test-input-stream "}\n") +11855 # convert +11856 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11857 # registers except esp clobbered at this point +11858 # restore ed +11859 89/<- %edx 4/r32/esp +11860 (flush _test-output-buffered-file) +11861 (flush _test-error-buffered-file) +11862 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11868 # check output +11869 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-output-not-address-2: output should be empty") +11870 (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") +11871 # check that stop(1) was called +11872 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-output-not-address-2: exit status") +11873 # don't restore from ebp +11874 81 0/subop/add %esp 8/imm32 +11875 # . epilogue +11876 5d/pop-to-ebp +11877 c3/return +11878 +11879 test-compute-offset-with-wrong-output-type: +11880 # . prologue +11881 55/push-ebp +11882 89/<- %ebp 4/r32/esp +11883 # setup +11884 (clear-stream _test-input-stream) +11885 (clear-stream $_test-input-buffered-file->buffer) +11886 (clear-stream _test-output-stream) +11887 (clear-stream $_test-output-buffered-file->buffer) +11888 (clear-stream _test-error-stream) +11889 (clear-stream $_test-error-buffered-file->buffer) +11890 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11891 68/push 0/imm32 +11892 68/push 0/imm32 +11893 89/<- %edx 4/r32/esp +11894 (tailor-exit-descriptor %edx 0x10) +11895 # +11896 (write _test-input-stream "fn foo {\n") +11897 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") +11898 (write _test-input-stream " var o/edi: (offset int) <- compute-offset a, 0\n") +11899 (write _test-input-stream "}\n") +11900 # convert +11901 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11902 # registers except esp clobbered at this point +11903 # restore ed +11904 89/<- %edx 4/r32/esp +11905 (flush _test-output-buffered-file) +11906 (flush _test-error-buffered-file) +11907 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11913 # check output +11914 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-output-type: output should be empty") +11915 (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") +11916 # check that stop(1) was called +11917 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-output-type: exit status") +11918 # don't restore from ebp +11919 81 0/subop/add %esp 8/imm32 +11920 # . epilogue +11921 5d/pop-to-ebp +11922 c3/return +11923 +11924 test-compute-offset-with-wrong-output-compound-type: +11925 # . prologue +11926 55/push-ebp +11927 89/<- %ebp 4/r32/esp +11928 # setup +11929 (clear-stream _test-input-stream) +11930 (clear-stream $_test-input-buffered-file->buffer) +11931 (clear-stream _test-output-stream) +11932 (clear-stream $_test-output-buffered-file->buffer) +11933 (clear-stream _test-error-stream) +11934 (clear-stream $_test-error-buffered-file->buffer) +11935 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11936 68/push 0/imm32 +11937 68/push 0/imm32 +11938 89/<- %edx 4/r32/esp +11939 (tailor-exit-descriptor %edx 0x10) +11940 # +11941 (write _test-input-stream "fn foo {\n") +11942 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") +11943 (write _test-input-stream " var o/edi: (offset handle int) <- compute-offset a, 0\n") +11944 (write _test-input-stream "}\n") +11945 # convert +11946 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11947 # registers except esp clobbered at this point +11948 # restore ed +11949 89/<- %edx 4/r32/esp +11950 (flush _test-output-buffered-file) +11951 (flush _test-error-buffered-file) +11952 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +11958 # check output +11959 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-output-compound-type: output should be empty") +11960 (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") +11961 # check that stop(1) was called +11962 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-output-compound-type: exit status") +11963 # don't restore from ebp +11964 81 0/subop/add %esp 8/imm32 +11965 # . epilogue +11966 5d/pop-to-ebp +11967 c3/return +11968 +11969 test-compute-offset-with-no-inouts: +11970 # . prologue +11971 55/push-ebp +11972 89/<- %ebp 4/r32/esp +11973 # setup +11974 (clear-stream _test-input-stream) +11975 (clear-stream $_test-input-buffered-file->buffer) +11976 (clear-stream _test-output-stream) +11977 (clear-stream $_test-output-buffered-file->buffer) +11978 (clear-stream _test-error-stream) +11979 (clear-stream $_test-error-buffered-file->buffer) +11980 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11981 68/push 0/imm32 +11982 68/push 0/imm32 +11983 89/<- %edx 4/r32/esp +11984 (tailor-exit-descriptor %edx 0x10) +11985 # +11986 (write _test-input-stream "fn foo {\n") +11987 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset\n") +11988 (write _test-input-stream "}\n") +11989 # convert +11990 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11991 # registers except esp clobbered at this point +11992 # restore ed 11993 89/<- %edx 4/r32/esp -11994 (tailor-exit-descriptor %edx 0x10) -11995 # -11996 (write _test-input-stream "fn foo {\n") -11997 (write _test-input-stream " var a: (addr int)\n") -11998 (write _test-input-stream " write-to-stream a, 0\n") -11999 (write _test-input-stream "}\n") -12000 # convert -12001 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12002 # registers except esp clobbered at this point -12003 # restore ed -12004 89/<- %edx 4/r32/esp -12005 (flush _test-output-buffered-file) -12006 (flush _test-error-buffered-file) -12007 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12013 # check output -12014 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-compound-base-type-2: output should be empty") -12015 (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") -12016 # check that stop(1) was called -12017 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-compound-base-type-2: exit status") -12018 # don't restore from ebp -12019 81 0/subop/add %esp 8/imm32 -12020 # . epilogue -12021 5d/pop-to-ebp -12022 c3/return -12023 -12024 test-write-to-stream-with-stream-atom-base-type: -12025 # . prologue -12026 55/push-ebp -12027 89/<- %ebp 4/r32/esp -12028 # setup -12029 (clear-stream _test-input-stream) -12030 (clear-stream $_test-input-buffered-file->buffer) -12031 (clear-stream _test-output-stream) -12032 (clear-stream $_test-output-buffered-file->buffer) -12033 (clear-stream _test-error-stream) -12034 (clear-stream $_test-error-buffered-file->buffer) -12035 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12036 68/push 0/imm32 -12037 68/push 0/imm32 +11994 (flush _test-output-buffered-file) +11995 (flush _test-error-buffered-file) +11996 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12002 # check output +12003 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-no-inouts: output should be empty") +12004 (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") +12005 # check that stop(1) was called +12006 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-no-inouts: exit status") +12007 # don't restore from ebp +12008 81 0/subop/add %esp 8/imm32 +12009 # . epilogue +12010 5d/pop-to-ebp +12011 c3/return +12012 +12013 test-compute-offset-with-too-few-inouts: +12014 # . prologue +12015 55/push-ebp +12016 89/<- %ebp 4/r32/esp +12017 # setup +12018 (clear-stream _test-input-stream) +12019 (clear-stream $_test-input-buffered-file->buffer) +12020 (clear-stream _test-output-stream) +12021 (clear-stream $_test-output-buffered-file->buffer) +12022 (clear-stream _test-error-stream) +12023 (clear-stream $_test-error-buffered-file->buffer) +12024 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12025 68/push 0/imm32 +12026 68/push 0/imm32 +12027 89/<- %edx 4/r32/esp +12028 (tailor-exit-descriptor %edx 0x10) +12029 # +12030 (write _test-input-stream "fn foo {\n") +12031 (write _test-input-stream " var a: (array int 3)\n") +12032 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a\n") +12033 (write _test-input-stream "}\n") +12034 # convert +12035 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12036 # registers except esp clobbered at this point +12037 # restore ed 12038 89/<- %edx 4/r32/esp -12039 (tailor-exit-descriptor %edx 0x10) -12040 # -12041 (write _test-input-stream "fn foo {\n") -12042 (write _test-input-stream " var a: stream\n") -12043 (write _test-input-stream " write-to-stream a, 0\n") -12044 (write _test-input-stream "}\n") -12045 # convert -12046 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12047 # registers except esp clobbered at this point -12048 # restore ed -12049 89/<- %edx 4/r32/esp -12050 (flush _test-output-buffered-file) -12051 (flush _test-error-buffered-file) -12052 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12058 # check output -12059 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-stream-atom-base-type: output should be empty") -12060 (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") -12061 # check that stop(1) was called -12062 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-stream-atom-base-type: exit status") -12063 # don't restore from ebp -12064 81 0/subop/add %esp 8/imm32 -12065 # . epilogue -12066 5d/pop-to-ebp -12067 c3/return -12068 -12069 test-write-to-stream-with-wrong-index-type: -12070 # . prologue -12071 55/push-ebp -12072 89/<- %ebp 4/r32/esp -12073 # setup -12074 (clear-stream _test-input-stream) -12075 (clear-stream $_test-input-buffered-file->buffer) -12076 (clear-stream _test-output-stream) -12077 (clear-stream $_test-output-buffered-file->buffer) -12078 (clear-stream _test-error-stream) -12079 (clear-stream $_test-error-buffered-file->buffer) -12080 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12081 68/push 0/imm32 -12082 68/push 0/imm32 +12039 (flush _test-output-buffered-file) +12040 (flush _test-error-buffered-file) +12041 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12047 # check output +12048 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-few-inouts: output should be empty") +12049 (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") +12050 # check that stop(1) was called +12051 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-few-inouts: exit status") +12052 # don't restore from ebp +12053 81 0/subop/add %esp 8/imm32 +12054 # . epilogue +12055 5d/pop-to-ebp +12056 c3/return +12057 +12058 test-compute-offset-with-too-many-inouts: +12059 # . prologue +12060 55/push-ebp +12061 89/<- %ebp 4/r32/esp +12062 # setup +12063 (clear-stream _test-input-stream) +12064 (clear-stream $_test-input-buffered-file->buffer) +12065 (clear-stream _test-output-stream) +12066 (clear-stream $_test-output-buffered-file->buffer) +12067 (clear-stream _test-error-stream) +12068 (clear-stream $_test-error-buffered-file->buffer) +12069 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12070 68/push 0/imm32 +12071 68/push 0/imm32 +12072 89/<- %edx 4/r32/esp +12073 (tailor-exit-descriptor %edx 0x10) +12074 # +12075 (write _test-input-stream "fn foo {\n") +12076 (write _test-input-stream " var a: (array int 3)\n") +12077 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0, 0\n") +12078 (write _test-input-stream "}\n") +12079 # convert +12080 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12081 # registers except esp clobbered at this point +12082 # restore ed 12083 89/<- %edx 4/r32/esp -12084 (tailor-exit-descriptor %edx 0x10) -12085 # -12086 (write _test-input-stream "fn foo {\n") -12087 (write _test-input-stream " var a/eax: (addr stream int) <- copy 0\n") -12088 (write _test-input-stream " var b: boolean\n") -12089 (write _test-input-stream " write-to-stream a, b\n") -12090 (write _test-input-stream "}\n") -12091 # convert -12092 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12093 # registers except esp clobbered at this point -12094 # restore ed -12095 89/<- %edx 4/r32/esp -12096 (flush _test-output-buffered-file) -12097 (flush _test-error-buffered-file) -12098 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12104 # check output -12105 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-wrong-index-type: output should be empty") -12106 (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") -12107 # check that stop(1) was called -12108 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-wrong-index-type: exit status") -12109 # don't restore from ebp -12110 81 0/subop/add %esp 8/imm32 -12111 # . epilogue -12112 5d/pop-to-ebp -12113 c3/return -12114 -12115 test-write-to-stream-with-no-inouts: -12116 # . prologue -12117 55/push-ebp -12118 89/<- %ebp 4/r32/esp -12119 # setup -12120 (clear-stream _test-input-stream) -12121 (clear-stream $_test-input-buffered-file->buffer) -12122 (clear-stream _test-output-stream) -12123 (clear-stream $_test-output-buffered-file->buffer) -12124 (clear-stream _test-error-stream) -12125 (clear-stream $_test-error-buffered-file->buffer) -12126 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12127 68/push 0/imm32 -12128 68/push 0/imm32 -12129 89/<- %edx 4/r32/esp -12130 (tailor-exit-descriptor %edx 0x10) -12131 # -12132 (write _test-input-stream "fn foo {\n") -12133 (write _test-input-stream " write-to-stream\n") -12134 (write _test-input-stream "}\n") -12135 # convert -12136 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12137 # registers except esp clobbered at this point -12138 # restore ed -12139 89/<- %edx 4/r32/esp -12140 (flush _test-output-buffered-file) -12141 (flush _test-error-buffered-file) -12142 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12148 # check output -12149 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-no-inouts: output should be empty") -12150 (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") -12151 # check that stop(1) was called -12152 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-no-inouts: exit status") -12153 # don't restore from ebp -12154 81 0/subop/add %esp 8/imm32 -12155 # . epilogue -12156 5d/pop-to-ebp -12157 c3/return -12158 -12159 test-write-to-stream-with-too-few-inouts: -12160 # . prologue -12161 55/push-ebp -12162 89/<- %ebp 4/r32/esp -12163 # setup -12164 (clear-stream _test-input-stream) -12165 (clear-stream $_test-input-buffered-file->buffer) -12166 (clear-stream _test-output-stream) -12167 (clear-stream $_test-output-buffered-file->buffer) -12168 (clear-stream _test-error-stream) -12169 (clear-stream $_test-error-buffered-file->buffer) -12170 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12171 68/push 0/imm32 -12172 68/push 0/imm32 -12173 89/<- %edx 4/r32/esp -12174 (tailor-exit-descriptor %edx 0x10) -12175 # -12176 (write _test-input-stream "fn foo {\n") -12177 (write _test-input-stream " var a: (addr stream int)\n") -12178 (write _test-input-stream " write-to-stream a\n") -12179 (write _test-input-stream "}\n") -12180 # convert -12181 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12182 # registers except esp clobbered at this point -12183 # restore ed -12184 89/<- %edx 4/r32/esp -12185 (flush _test-output-buffered-file) -12186 (flush _test-error-buffered-file) -12187 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12193 # check output -12194 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-too-few-inouts: output should be empty") -12195 (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") -12196 # check that stop(1) was called -12197 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-too-few-inouts: exit status") -12198 # don't restore from ebp -12199 81 0/subop/add %esp 8/imm32 -12200 # . epilogue -12201 5d/pop-to-ebp -12202 c3/return -12203 -12204 test-write-to-stream-with-too-many-inouts: -12205 # . prologue -12206 55/push-ebp -12207 89/<- %ebp 4/r32/esp -12208 # setup -12209 (clear-stream _test-input-stream) -12210 (clear-stream $_test-input-buffered-file->buffer) -12211 (clear-stream _test-output-stream) -12212 (clear-stream $_test-output-buffered-file->buffer) -12213 (clear-stream _test-error-stream) -12214 (clear-stream $_test-error-buffered-file->buffer) -12215 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12216 68/push 0/imm32 -12217 68/push 0/imm32 -12218 89/<- %edx 4/r32/esp -12219 (tailor-exit-descriptor %edx 0x10) -12220 # -12221 (write _test-input-stream "fn foo {\n") -12222 (write _test-input-stream " var a: (addr stream int)\n") -12223 (write _test-input-stream " var b: (addr int)\n") -12224 (write _test-input-stream " write-to-stream a, b, 0\n") -12225 (write _test-input-stream "}\n") -12226 # convert -12227 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12228 # registers except esp clobbered at this point -12229 # restore ed -12230 89/<- %edx 4/r32/esp -12231 (flush _test-output-buffered-file) -12232 (flush _test-error-buffered-file) -12233 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12239 # check output -12240 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-too-many-inouts: output should be empty") -12241 (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") -12242 # check that stop(1) was called -12243 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-too-many-inouts: exit status") -12244 # don't restore from ebp -12245 81 0/subop/add %esp 8/imm32 -12246 # . epilogue -12247 5d/pop-to-ebp -12248 c3/return -12249 -12250 test-write-to-stream-with-output: -12251 # . prologue -12252 55/push-ebp -12253 89/<- %ebp 4/r32/esp -12254 # setup -12255 (clear-stream _test-input-stream) -12256 (clear-stream $_test-input-buffered-file->buffer) -12257 (clear-stream _test-output-stream) -12258 (clear-stream $_test-output-buffered-file->buffer) -12259 (clear-stream _test-error-stream) -12260 (clear-stream $_test-error-buffered-file->buffer) -12261 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12262 68/push 0/imm32 -12263 68/push 0/imm32 -12264 89/<- %edx 4/r32/esp -12265 (tailor-exit-descriptor %edx 0x10) -12266 # -12267 (write _test-input-stream "fn foo {\n") -12268 (write _test-input-stream " var a: (addr stream int)\n") -12269 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") -12270 (write _test-input-stream " b <- write-to-stream a, b\n") -12271 (write _test-input-stream "}\n") -12272 # convert -12273 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12274 # registers except esp clobbered at this point -12275 # restore ed -12276 89/<- %edx 4/r32/esp -12277 (flush _test-output-buffered-file) -12278 (flush _test-error-buffered-file) -12279 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12285 # check output -12286 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-output: output should be empty") -12287 (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") -12288 # check that stop(1) was called -12289 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-output: exit status") -12290 # don't restore from ebp -12291 81 0/subop/add %esp 8/imm32 -12292 # . epilogue -12293 5d/pop-to-ebp -12294 c3/return -12295 -12296 test-length-with-non-array-atom-base-type: -12297 # . prologue -12298 55/push-ebp -12299 89/<- %ebp 4/r32/esp -12300 # setup -12301 (clear-stream _test-input-stream) -12302 (clear-stream $_test-input-buffered-file->buffer) -12303 (clear-stream _test-output-stream) -12304 (clear-stream $_test-output-buffered-file->buffer) -12305 (clear-stream _test-error-stream) -12306 (clear-stream $_test-error-buffered-file->buffer) -12307 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12308 68/push 0/imm32 -12309 68/push 0/imm32 -12310 89/<- %edx 4/r32/esp -12311 (tailor-exit-descriptor %edx 0x10) -12312 # -12313 (write _test-input-stream "fn foo {\n") -12314 (write _test-input-stream " var a: int\n") -12315 (write _test-input-stream " var c/ecx: int <- length a\n") -12316 (write _test-input-stream "}\n") -12317 # convert -12318 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12319 # registers except esp clobbered at this point -12320 # restore ed -12321 89/<- %edx 4/r32/esp -12322 (flush _test-output-buffered-file) -12323 (flush _test-error-buffered-file) -12324 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12330 # check output -12331 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-atom-base-type: output should be empty") -12332 (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") -12333 # check that stop(1) was called -12334 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-atom-base-type: exit status") -12335 # don't restore from ebp -12336 81 0/subop/add %esp 8/imm32 -12337 # . epilogue -12338 5d/pop-to-ebp -12339 c3/return -12340 -12341 test-length-with-non-array-compound-base-type: -12342 # . prologue -12343 55/push-ebp -12344 89/<- %ebp 4/r32/esp -12345 # setup -12346 (clear-stream _test-input-stream) -12347 (clear-stream $_test-input-buffered-file->buffer) -12348 (clear-stream _test-output-stream) -12349 (clear-stream $_test-output-buffered-file->buffer) -12350 (clear-stream _test-error-stream) -12351 (clear-stream $_test-error-buffered-file->buffer) -12352 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12353 68/push 0/imm32 -12354 68/push 0/imm32 -12355 89/<- %edx 4/r32/esp -12356 (tailor-exit-descriptor %edx 0x10) -12357 # -12358 (write _test-input-stream "fn foo {\n") -12359 (write _test-input-stream " var a: (handle int)\n") -12360 (write _test-input-stream " var c/ecx: (addr int) <- length a, 0\n") -12361 (write _test-input-stream "}\n") -12362 # convert -12363 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12364 # registers except esp clobbered at this point -12365 # restore ed -12366 89/<- %edx 4/r32/esp -12367 (flush _test-output-buffered-file) -12368 (flush _test-error-buffered-file) -12369 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12375 # check output -12376 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-compound-base-type: output should be empty") -12377 (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") -12378 # check that stop(1) was called -12379 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-compound-base-type: exit status") -12380 # don't restore from ebp -12381 81 0/subop/add %esp 8/imm32 -12382 # . epilogue -12383 5d/pop-to-ebp -12384 c3/return -12385 -12386 test-length-with-non-array-compound-base-type-2: -12387 # . prologue -12388 55/push-ebp -12389 89/<- %ebp 4/r32/esp -12390 # setup -12391 (clear-stream _test-input-stream) -12392 (clear-stream $_test-input-buffered-file->buffer) -12393 (clear-stream _test-output-stream) -12394 (clear-stream $_test-output-buffered-file->buffer) -12395 (clear-stream _test-error-stream) -12396 (clear-stream $_test-error-buffered-file->buffer) -12397 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12398 68/push 0/imm32 -12399 68/push 0/imm32 -12400 89/<- %edx 4/r32/esp -12401 (tailor-exit-descriptor %edx 0x10) -12402 # -12403 (write _test-input-stream "fn foo {\n") -12404 (write _test-input-stream " var a: (addr int)\n") -12405 (write _test-input-stream " var c/ecx: (addr int) <- length a, 0\n") -12406 (write _test-input-stream "}\n") -12407 # convert -12408 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12409 # registers except esp clobbered at this point -12410 # restore ed -12411 89/<- %edx 4/r32/esp -12412 (flush _test-output-buffered-file) -12413 (flush _test-error-buffered-file) -12414 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12420 # check output -12421 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-compound-base-type-2: output should be empty") -12422 (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") -12423 # check that stop(1) was called -12424 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-compound-base-type-2: exit status") -12425 # don't restore from ebp -12426 81 0/subop/add %esp 8/imm32 -12427 # . epilogue -12428 5d/pop-to-ebp -12429 c3/return -12430 -12431 test-length-with-array-atom-base-type: -12432 # . prologue -12433 55/push-ebp -12434 89/<- %ebp 4/r32/esp -12435 # setup -12436 (clear-stream _test-input-stream) -12437 (clear-stream $_test-input-buffered-file->buffer) -12438 (clear-stream _test-output-stream) -12439 (clear-stream $_test-output-buffered-file->buffer) -12440 (clear-stream _test-error-stream) -12441 (clear-stream $_test-error-buffered-file->buffer) -12442 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12443 68/push 0/imm32 -12444 68/push 0/imm32 -12445 89/<- %edx 4/r32/esp -12446 (tailor-exit-descriptor %edx 0x10) -12447 # -12448 (write _test-input-stream "fn foo {\n") -12449 (write _test-input-stream " var a: array\n") -12450 (write _test-input-stream " var c/ecx: (addr int) <- length a\n") -12451 (write _test-input-stream "}\n") -12452 # convert -12453 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12454 # registers except esp clobbered at this point -12455 # restore ed -12456 89/<- %edx 4/r32/esp -12457 (flush _test-output-buffered-file) -12458 (flush _test-error-buffered-file) -12459 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12465 # check output -12466 (check-stream-equal _test-output-stream "" "F - test-length-with-array-atom-base-type: output should be empty") -12467 (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") -12468 # check that stop(1) was called -12469 (check-ints-equal *(edx+4) 2 "F - test-length-with-array-atom-base-type: exit status") -12470 # don't restore from ebp -12471 81 0/subop/add %esp 8/imm32 -12472 # . epilogue -12473 5d/pop-to-ebp -12474 c3/return -12475 -12476 test-length-with-addr-base-on-stack: -12477 # . prologue -12478 55/push-ebp -12479 89/<- %ebp 4/r32/esp -12480 # setup -12481 (clear-stream _test-input-stream) -12482 (clear-stream $_test-input-buffered-file->buffer) -12483 (clear-stream _test-output-stream) -12484 (clear-stream $_test-output-buffered-file->buffer) -12485 (clear-stream _test-error-stream) -12486 (clear-stream $_test-error-buffered-file->buffer) -12487 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12488 68/push 0/imm32 -12489 68/push 0/imm32 -12490 89/<- %edx 4/r32/esp -12491 (tailor-exit-descriptor %edx 0x10) -12492 # -12493 (write _test-input-stream "fn foo {\n") -12494 (write _test-input-stream " var a: (addr array int)\n") -12495 (write _test-input-stream " var c/ecx: (addr int) <- length a\n") -12496 (write _test-input-stream "}\n") -12497 # convert -12498 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12499 # registers except esp clobbered at this point -12500 # restore ed -12501 89/<- %edx 4/r32/esp -12502 (flush _test-output-buffered-file) -12503 (flush _test-error-buffered-file) -12504 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12510 # check output -12511 (check-stream-equal _test-output-stream "" "F - test-length-with-addr-base-on-stack: output should be empty") -12512 (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") -12513 # check that stop(1) was called -12514 (check-ints-equal *(edx+4) 2 "F - test-length-with-addr-base-on-stack: exit status") -12515 # don't restore from ebp -12516 81 0/subop/add %esp 8/imm32 -12517 # . epilogue -12518 5d/pop-to-ebp -12519 c3/return -12520 -12521 test-length-with-wrong-output-type: -12522 # . prologue -12523 55/push-ebp -12524 89/<- %ebp 4/r32/esp -12525 # setup -12526 (clear-stream _test-input-stream) -12527 (clear-stream $_test-input-buffered-file->buffer) -12528 (clear-stream _test-output-stream) -12529 (clear-stream $_test-output-buffered-file->buffer) -12530 (clear-stream _test-error-stream) -12531 (clear-stream $_test-error-buffered-file->buffer) -12532 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12533 68/push 0/imm32 -12534 68/push 0/imm32 -12535 89/<- %edx 4/r32/esp -12536 (tailor-exit-descriptor %edx 0x10) -12537 # -12538 (write _test-input-stream "fn foo {\n") -12539 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") -12540 (write _test-input-stream " var o/edi: (addr int) <- length a\n") -12541 (write _test-input-stream "}\n") -12542 # convert -12543 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12544 # registers except esp clobbered at this point -12545 # restore ed -12546 89/<- %edx 4/r32/esp -12547 (flush _test-output-buffered-file) -12548 (flush _test-error-buffered-file) -12549 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12555 # check output -12556 (check-stream-equal _test-output-stream "" "F - test-length-with-wrong-output-type: output should be empty") -12557 (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") -12558 # check that stop(1) was called -12559 (check-ints-equal *(edx+4) 2 "F - test-length-with-wrong-output-type: exit status") -12560 # don't restore from ebp -12561 81 0/subop/add %esp 8/imm32 -12562 # . epilogue -12563 5d/pop-to-ebp -12564 c3/return -12565 -12566 test-length-with-wrong-output-compound-type: -12567 # . prologue -12568 55/push-ebp -12569 89/<- %ebp 4/r32/esp -12570 # setup -12571 (clear-stream _test-input-stream) -12572 (clear-stream $_test-input-buffered-file->buffer) -12573 (clear-stream _test-output-stream) -12574 (clear-stream $_test-output-buffered-file->buffer) -12575 (clear-stream _test-error-stream) -12576 (clear-stream $_test-error-buffered-file->buffer) -12577 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12578 68/push 0/imm32 -12579 68/push 0/imm32 -12580 89/<- %edx 4/r32/esp -12581 (tailor-exit-descriptor %edx 0x10) -12582 # -12583 (write _test-input-stream "fn foo {\n") -12584 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") -12585 (write _test-input-stream " var o/edi: (addr handle int) <- length a\n") -12586 (write _test-input-stream "}\n") -12587 # convert -12588 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12589 # registers except esp clobbered at this point -12590 # restore ed -12591 89/<- %edx 4/r32/esp -12592 (flush _test-output-buffered-file) -12593 (flush _test-error-buffered-file) -12594 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12600 # check output -12601 (check-stream-equal _test-output-stream "" "F - test-length-with-wrong-output-compound-type: output should be empty") -12602 (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") -12603 # check that stop(1) was called -12604 (check-ints-equal *(edx+4) 2 "F - test-length-with-wrong-output-compound-type: exit status") -12605 # don't restore from ebp -12606 81 0/subop/add %esp 8/imm32 -12607 # . epilogue -12608 5d/pop-to-ebp -12609 c3/return -12610 -12611 test-length-with-no-inouts: -12612 # . prologue -12613 55/push-ebp -12614 89/<- %ebp 4/r32/esp -12615 # setup -12616 (clear-stream _test-input-stream) -12617 (clear-stream $_test-input-buffered-file->buffer) -12618 (clear-stream _test-output-stream) -12619 (clear-stream $_test-output-buffered-file->buffer) -12620 (clear-stream _test-error-stream) -12621 (clear-stream $_test-error-buffered-file->buffer) -12622 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12623 68/push 0/imm32 -12624 68/push 0/imm32 -12625 89/<- %edx 4/r32/esp -12626 (tailor-exit-descriptor %edx 0x10) -12627 # -12628 (write _test-input-stream "fn foo {\n") -12629 (write _test-input-stream " var c/ecx: int <- length\n") -12630 (write _test-input-stream "}\n") -12631 # convert -12632 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12633 # registers except esp clobbered at this point -12634 # restore ed -12635 89/<- %edx 4/r32/esp -12636 (flush _test-output-buffered-file) -12637 (flush _test-error-buffered-file) -12638 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12644 # check output -12645 (check-stream-equal _test-output-stream "" "F - test-length-with-no-inouts: output should be empty") -12646 (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") -12647 # check that stop(1) was called -12648 (check-ints-equal *(edx+4) 2 "F - test-length-with-no-inouts: exit status") -12649 # don't restore from ebp -12650 81 0/subop/add %esp 8/imm32 -12651 # . epilogue -12652 5d/pop-to-ebp -12653 c3/return -12654 -12655 test-length-with-too-many-inouts: -12656 # . prologue -12657 55/push-ebp -12658 89/<- %ebp 4/r32/esp -12659 # setup -12660 (clear-stream _test-input-stream) -12661 (clear-stream $_test-input-buffered-file->buffer) -12662 (clear-stream _test-output-stream) -12663 (clear-stream $_test-output-buffered-file->buffer) -12664 (clear-stream _test-error-stream) -12665 (clear-stream $_test-error-buffered-file->buffer) -12666 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12667 68/push 0/imm32 -12668 68/push 0/imm32 -12669 89/<- %edx 4/r32/esp -12670 (tailor-exit-descriptor %edx 0x10) -12671 # -12672 (write _test-input-stream "fn foo {\n") -12673 (write _test-input-stream " var a: (array int 3)\n") -12674 (write _test-input-stream " var c/ecx: int <- length a, 0, 0\n") -12675 (write _test-input-stream "}\n") -12676 # convert -12677 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12678 # registers except esp clobbered at this point -12679 # restore ed -12680 89/<- %edx 4/r32/esp -12681 (flush _test-output-buffered-file) -12682 (flush _test-error-buffered-file) -12683 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12689 # check output -12690 (check-stream-equal _test-output-stream "" "F - test-length-with-too-many-inouts: output should be empty") -12691 (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") -12692 # check that stop(1) was called -12693 (check-ints-equal *(edx+4) 2 "F - test-length-with-too-many-inouts: exit status") -12694 # don't restore from ebp -12695 81 0/subop/add %esp 8/imm32 -12696 # . epilogue -12697 5d/pop-to-ebp -12698 c3/return -12699 -12700 test-length-with-no-output: -12701 # . prologue -12702 55/push-ebp -12703 89/<- %ebp 4/r32/esp -12704 # setup -12705 (clear-stream _test-input-stream) -12706 (clear-stream $_test-input-buffered-file->buffer) -12707 (clear-stream _test-output-stream) -12708 (clear-stream $_test-output-buffered-file->buffer) -12709 (clear-stream _test-error-stream) -12710 (clear-stream $_test-error-buffered-file->buffer) -12711 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12712 68/push 0/imm32 -12713 68/push 0/imm32 -12714 89/<- %edx 4/r32/esp -12715 (tailor-exit-descriptor %edx 0x10) -12716 # -12717 (write _test-input-stream "fn foo {\n") -12718 (write _test-input-stream " var a: (array int 3)\n") -12719 (write _test-input-stream " length a\n") -12720 (write _test-input-stream "}\n") -12721 # convert -12722 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12723 # registers except esp clobbered at this point -12724 # restore ed -12725 89/<- %edx 4/r32/esp -12726 (flush _test-output-buffered-file) -12727 (flush _test-error-buffered-file) -12728 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12734 # check output -12735 (check-stream-equal _test-output-stream "" "F - test-length-with-no-output: output should be empty") -12736 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: must have an output" "F - test-length-with-no-output: error message") -12737 # check that stop(1) was called -12738 (check-ints-equal *(edx+4) 2 "F - test-length-with-no-output: exit status") -12739 # don't restore from ebp -12740 81 0/subop/add %esp 8/imm32 -12741 # . epilogue -12742 5d/pop-to-ebp -12743 c3/return -12744 -12745 test-length-with-too-many-outputs: -12746 # . prologue -12747 55/push-ebp -12748 89/<- %ebp 4/r32/esp -12749 # setup -12750 (clear-stream _test-input-stream) -12751 (clear-stream $_test-input-buffered-file->buffer) -12752 (clear-stream _test-output-stream) -12753 (clear-stream $_test-output-buffered-file->buffer) -12754 (clear-stream _test-error-stream) -12755 (clear-stream $_test-error-buffered-file->buffer) -12756 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12757 68/push 0/imm32 -12758 68/push 0/imm32 -12759 89/<- %edx 4/r32/esp -12760 (tailor-exit-descriptor %edx 0x10) -12761 # -12762 (write _test-input-stream "fn foo {\n") -12763 (write _test-input-stream " var a: (array int 3)\n") -12764 (write _test-input-stream " var b/eax: int <- copy 0\n") -12765 (write _test-input-stream " var c/ecx: int <- copy 0\n") -12766 (write _test-input-stream " b, c <- length a\n") -12767 (write _test-input-stream "}\n") -12768 # convert -12769 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12770 # registers except esp clobbered at this point -12771 # restore ed -12772 89/<- %edx 4/r32/esp -12773 (flush _test-output-buffered-file) -12774 (flush _test-error-buffered-file) -12775 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -12781 # check output -12782 (check-stream-equal _test-output-stream "" "F - test-length-with-too-many-outputs: output should be empty") -12783 (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") -12784 # check that stop(1) was called -12785 (check-ints-equal *(edx+4) 2 "F - test-length-with-too-many-outputs: exit status") -12786 # don't restore from ebp -12787 81 0/subop/add %esp 8/imm32 -12788 # . epilogue -12789 5d/pop-to-ebp -12790 c3/return -12791 -12792 test-convert-function-with-return-register-and-local: -12793 # . prologue -12794 55/push-ebp -12795 89/<- %ebp 4/r32/esp -12796 # setup -12797 (clear-stream _test-input-stream) -12798 (clear-stream $_test-input-buffered-file->buffer) -12799 (clear-stream _test-output-stream) -12800 (clear-stream $_test-output-buffered-file->buffer) -12801 # -12802 (write _test-input-stream "fn foo -> _/eax: int {\n") -12803 (write _test-input-stream " var y/eax: int <- copy 3\n") -12804 (write _test-input-stream " var z/ecx: int <- copy 4\n") -12805 (write _test-input-stream " return y\n") -12806 (write _test-input-stream "}\n") -12807 # convert -12808 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -12809 (flush _test-output-buffered-file) -12810 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -12816 # check output -12817 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register-and-local/0") -12818 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register-and-local/1") -12819 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register-and-local/2") -12820 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register-and-local/3") -12821 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register-and-local/4") -12822 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register-and-local/5") -12823 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register-and-local/6") -12824 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-register-and-local/7") -12825 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-return-register-and-local/8") -12826 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-convert-function-with-return-register-and-local/9") -12827 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-return-register-and-local/10") -12828 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-return-register-and-local/11") -12829 (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") -12830 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-register-and-local/13") -12831 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register-and-local/14") -12832 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register-and-local/15") -12833 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register-and-local/16") -12834 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register-and-local/17") -12835 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register-and-local/18") -12836 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register-and-local/19") -12837 # . epilogue -12838 89/<- %esp 5/r32/ebp -12839 5d/pop-to-ebp -12840 c3/return -12841 -12842 test-convert-function-with-return-register-and-local-2: -12843 # . prologue -12844 55/push-ebp -12845 89/<- %ebp 4/r32/esp -12846 # setup -12847 (clear-stream _test-input-stream) -12848 (clear-stream $_test-input-buffered-file->buffer) -12849 (clear-stream _test-output-stream) -12850 (clear-stream $_test-output-buffered-file->buffer) -12851 # -12852 (write _test-input-stream "fn foo -> _/eax: int {\n") -12853 (write _test-input-stream " var y/eax: int <- copy 3\n") -12854 (write _test-input-stream " var z/ecx: int <- copy 4\n") -12855 (write _test-input-stream " return z\n") -12856 (write _test-input-stream "}\n") -12857 # convert -12858 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -12859 (flush _test-output-buffered-file) -12860 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -12866 # check output -12867 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register-and-local-2/0") -12868 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register-and-local-2/1") -12869 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register-and-local-2/2") -12870 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register-and-local-2/3") -12871 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register-and-local-2/4") -12872 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register-and-local-2/5") -12873 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register-and-local-2/6") -12874 (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") -12875 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-return-register-and-local-2/8") -12876 (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") -12877 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000000/r32" "F - test-convert-function-with-return-register-and-local-2/10") -12878 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-return-register-and-local-2/11") -12879 (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") -12880 (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") -12881 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register-and-local-2/14") -12882 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register-and-local-2/15") -12883 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register-and-local-2/16") -12884 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register-and-local-2/17") -12885 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register-and-local-2/18") -12886 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register-and-local-2/19") -12887 # . epilogue -12888 89/<- %esp 5/r32/ebp -12889 5d/pop-to-ebp -12890 c3/return -12891 -12892 test-convert-function-with-return-float-register-and-local: -12893 # . prologue -12894 55/push-ebp -12895 89/<- %ebp 4/r32/esp -12896 # setup -12897 (clear-stream _test-input-stream) -12898 (clear-stream $_test-input-buffered-file->buffer) -12899 (clear-stream _test-output-stream) -12900 (clear-stream $_test-output-buffered-file->buffer) -12901 # -12902 (write _test-input-stream "fn foo -> _/xmm1: float {\n") -12903 (write _test-input-stream " var y/eax: int <- copy 3\n") -12904 (write _test-input-stream " var g/xmm0: float <- convert y\n") -12905 (write _test-input-stream " var h/xmm1: float <- convert y\n") -12906 (write _test-input-stream " return g\n") -12907 (write _test-input-stream "}\n") -12908 # convert -12909 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -12910 (flush _test-output-buffered-file) -12911 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -12917 # check output -12918 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-float-register-and-local/0") -12919 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-float-register-and-local/1") -12920 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-float-register-and-local/2") -12921 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-float-register-and-local/3") -12922 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-float-register-and-local/4") -12923 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-float-register-and-local/5") -12924 (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 -12925 (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") -12926 (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 -12927 (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") -12928 (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") -12929 (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 -12930 (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") -12931 (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") -12932 (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 -12933 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/15") # reclaim h -12934 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 0/x32" "F - test-convert-floating-point-dereferenced/16") # reclaim g -12935 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/17") -12936 (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 -12937 (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") -12938 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-float-register-and-local/20") -12939 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-float-register-and-local/21") -12940 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-float-register-and-local/22") -12941 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-float-register-and-local/23") -12942 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-float-register-and-local/24") -12943 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-float-register-and-local/25") -12944 # . epilogue -12945 89/<- %esp 5/r32/ebp +12084 (flush _test-output-buffered-file) +12085 (flush _test-error-buffered-file) +12086 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12092 # check output +12093 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-many-inouts: output should be empty") +12094 (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") +12095 # check that stop(1) was called +12096 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-many-inouts: exit status") +12097 # don't restore from ebp +12098 81 0/subop/add %esp 8/imm32 +12099 # . epilogue +12100 5d/pop-to-ebp +12101 c3/return +12102 +12103 test-compute-offset-with-no-output: +12104 # . prologue +12105 55/push-ebp +12106 89/<- %ebp 4/r32/esp +12107 # setup +12108 (clear-stream _test-input-stream) +12109 (clear-stream $_test-input-buffered-file->buffer) +12110 (clear-stream _test-output-stream) +12111 (clear-stream $_test-output-buffered-file->buffer) +12112 (clear-stream _test-error-stream) +12113 (clear-stream $_test-error-buffered-file->buffer) +12114 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12115 68/push 0/imm32 +12116 68/push 0/imm32 +12117 89/<- %edx 4/r32/esp +12118 (tailor-exit-descriptor %edx 0x10) +12119 # +12120 (write _test-input-stream "fn foo {\n") +12121 (write _test-input-stream " var a: (array int 3)\n") +12122 (write _test-input-stream " compute-offset a, 0\n") +12123 (write _test-input-stream "}\n") +12124 # convert +12125 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12126 # registers except esp clobbered at this point +12127 # restore ed +12128 89/<- %edx 4/r32/esp +12129 (flush _test-output-buffered-file) +12130 (flush _test-error-buffered-file) +12131 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12137 # check output +12138 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-no-output: output should be empty") +12139 (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") +12140 # check that stop(1) was called +12141 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-no-output: exit status") +12142 # don't restore from ebp +12143 81 0/subop/add %esp 8/imm32 +12144 # . epilogue +12145 5d/pop-to-ebp +12146 c3/return +12147 +12148 test-compute-offset-with-too-many-outputs: +12149 # . prologue +12150 55/push-ebp +12151 89/<- %ebp 4/r32/esp +12152 # setup +12153 (clear-stream _test-input-stream) +12154 (clear-stream $_test-input-buffered-file->buffer) +12155 (clear-stream _test-output-stream) +12156 (clear-stream $_test-output-buffered-file->buffer) +12157 (clear-stream _test-error-stream) +12158 (clear-stream $_test-error-buffered-file->buffer) +12159 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12160 68/push 0/imm32 +12161 68/push 0/imm32 +12162 89/<- %edx 4/r32/esp +12163 (tailor-exit-descriptor %edx 0x10) +12164 # +12165 (write _test-input-stream "fn foo {\n") +12166 (write _test-input-stream " var a: (array int 3)\n") +12167 (write _test-input-stream " var b/eax: (offset int) <- compute-offset a, 0\n") +12168 (write _test-input-stream " var c/ecx: (addr int) <- copy 0\n") +12169 (write _test-input-stream " b, c <- compute-offset a, 0\n") +12170 (write _test-input-stream "}\n") +12171 # convert +12172 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12173 # registers except esp clobbered at this point +12174 # restore ed +12175 89/<- %edx 4/r32/esp +12176 (flush _test-output-buffered-file) +12177 (flush _test-error-buffered-file) +12178 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12184 # check output +12185 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-many-outputs: output should be empty") +12186 (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") +12187 # check that stop(1) was called +12188 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-many-outputs: exit status") +12189 # don't restore from ebp +12190 81 0/subop/add %esp 8/imm32 +12191 # . epilogue +12192 5d/pop-to-ebp +12193 c3/return +12194 +12195 test-convert-read-from-stream: +12196 # . prologue +12197 55/push-ebp +12198 89/<- %ebp 4/r32/esp +12199 # setup +12200 (clear-stream _test-input-stream) +12201 (clear-stream $_test-input-buffered-file->buffer) +12202 (clear-stream _test-output-stream) +12203 (clear-stream $_test-output-buffered-file->buffer) +12204 # +12205 (write _test-input-stream "fn foo {\n") +12206 (write _test-input-stream " var s/esi: (addr stream int) <- copy 0\n") +12207 (write _test-input-stream " var o/ecx: (addr int) <- copy 0\n") +12208 (write _test-input-stream " read-from-stream s, o\n") +12209 (write _test-input-stream "}\n") +12210 # convert +12211 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +12212 # registers except esp clobbered at this point +12213 # restore ed +12214 89/<- %edx 4/r32/esp +12215 (flush _test-output-buffered-file) +12216 (flush _test-error-buffered-file) +12217 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +12223 # check output +12224 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-read-from-stream/0") +12225 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-read-from-stream/1") +12226 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-read-from-stream/2") +12227 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-read-from-stream/3") +12228 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-read-from-stream/4") +12229 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-read-from-stream/5") +12230 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-read-from-stream/6") +12231 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-read-from-stream/7") +12232 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-read-from-stream/8") +12233 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-read-from-stream/9") +12234 (check-next-stream-line-equal _test-output-stream " (read-from-stream %esi %ecx 0x00000004)" "F - test-convert-read-from-stream/10") +12235 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-read-from-stream/11") +12236 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-read-from-stream/12") +12237 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-read-from-stream/13") +12238 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-read-from-stream/14") +12239 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-read-from-stream/15") +12240 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-read-from-stream/16") +12241 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-read-from-stream/17") +12242 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-read-from-stream/18") +12243 # . epilogue +12244 89/<- %esp 5/r32/ebp +12245 5d/pop-to-ebp +12246 c3/return +12247 +12248 test-convert-read-from-stream-with-correct-payload-size: +12249 # . prologue +12250 55/push-ebp +12251 89/<- %ebp 4/r32/esp +12252 # setup +12253 (clear-stream _test-input-stream) +12254 (clear-stream $_test-input-buffered-file->buffer) +12255 (clear-stream _test-output-stream) +12256 (clear-stream $_test-output-buffered-file->buffer) +12257 # +12258 (write _test-input-stream "fn foo {\n") +12259 (write _test-input-stream " var s/esi: (addr stream handle int) <- copy 0\n") +12260 (write _test-input-stream " var o/ecx: (addr handle int) <- copy 0\n") +12261 (write _test-input-stream " read-from-stream s, o\n") +12262 (write _test-input-stream "}\n") +12263 # convert +12264 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +12265 # registers except esp clobbered at this point +12266 # restore ed +12267 89/<- %edx 4/r32/esp +12268 (flush _test-output-buffered-file) +12269 (flush _test-error-buffered-file) +12270 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +12276 # check output +12277 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-read-from-stream-with-correct-payload-size/0") +12278 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-read-from-stream-with-correct-payload-size/1") +12279 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-read-from-stream-with-correct-payload-size/2") +12280 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-read-from-stream-with-correct-payload-size/3") +12281 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-read-from-stream-with-correct-payload-size/4") +12282 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-read-from-stream-with-correct-payload-size/5") +12283 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-read-from-stream-with-correct-payload-size/6") +12284 (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") +12285 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-read-from-stream-with-correct-payload-size/8") +12286 (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") +12287 (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") +12288 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-read-from-stream-with-correct-payload-size/11") +12289 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-read-from-stream-with-correct-payload-size/12") +12290 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-read-from-stream-with-correct-payload-size/13") +12291 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-read-from-stream-with-correct-payload-size/14") +12292 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-read-from-stream-with-correct-payload-size/15") +12293 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-read-from-stream-with-correct-payload-size/16") +12294 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-read-from-stream-with-correct-payload-size/17") +12295 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-read-from-stream-with-correct-payload-size/18") +12296 # . epilogue +12297 89/<- %esp 5/r32/ebp +12298 5d/pop-to-ebp +12299 c3/return +12300 +12301 test-read-from-stream-with-non-stream-atom-base-type: +12302 # . prologue +12303 55/push-ebp +12304 89/<- %ebp 4/r32/esp +12305 # setup +12306 (clear-stream _test-input-stream) +12307 (clear-stream $_test-input-buffered-file->buffer) +12308 (clear-stream _test-output-stream) +12309 (clear-stream $_test-output-buffered-file->buffer) +12310 (clear-stream _test-error-stream) +12311 (clear-stream $_test-error-buffered-file->buffer) +12312 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12313 68/push 0/imm32 +12314 68/push 0/imm32 +12315 89/<- %edx 4/r32/esp +12316 (tailor-exit-descriptor %edx 0x10) +12317 # +12318 (write _test-input-stream "fn foo {\n") +12319 (write _test-input-stream " var a: int\n") +12320 (write _test-input-stream " read-from-stream a, 0\n") +12321 (write _test-input-stream "}\n") +12322 # convert +12323 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12324 # registers except esp clobbered at this point +12325 # restore ed +12326 89/<- %edx 4/r32/esp +12327 (flush _test-output-buffered-file) +12328 (flush _test-error-buffered-file) +12329 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12335 # check output +12336 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-atom-base-type: output should be empty") +12337 (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") +12338 # check that stop(1) was called +12339 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-atom-base-type: exit status") +12340 # don't restore from ebp +12341 81 0/subop/add %esp 8/imm32 +12342 # . epilogue +12343 5d/pop-to-ebp +12344 c3/return +12345 +12346 test-read-from-stream-with-non-stream-compound-base-type: +12347 # . prologue +12348 55/push-ebp +12349 89/<- %ebp 4/r32/esp +12350 # setup +12351 (clear-stream _test-input-stream) +12352 (clear-stream $_test-input-buffered-file->buffer) +12353 (clear-stream _test-output-stream) +12354 (clear-stream $_test-output-buffered-file->buffer) +12355 (clear-stream _test-error-stream) +12356 (clear-stream $_test-error-buffered-file->buffer) +12357 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12358 68/push 0/imm32 +12359 68/push 0/imm32 +12360 89/<- %edx 4/r32/esp +12361 (tailor-exit-descriptor %edx 0x10) +12362 # +12363 (write _test-input-stream "fn foo {\n") +12364 (write _test-input-stream " var a: (handle int)\n") +12365 (write _test-input-stream " read-from-stream a, 0\n") +12366 (write _test-input-stream "}\n") +12367 # convert +12368 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12369 # registers except esp clobbered at this point +12370 # restore ed +12371 89/<- %edx 4/r32/esp +12372 (flush _test-output-buffered-file) +12373 (flush _test-error-buffered-file) +12374 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12380 # check output +12381 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-compound-base-type: output should be empty") +12382 (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") +12383 # check that stop(1) was called +12384 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-compound-base-type: exit status") +12385 # don't restore from ebp +12386 81 0/subop/add %esp 8/imm32 +12387 # . epilogue +12388 5d/pop-to-ebp +12389 c3/return +12390 +12391 test-read-from-stream-with-non-stream-compound-base-type-2: +12392 # . prologue +12393 55/push-ebp +12394 89/<- %ebp 4/r32/esp +12395 # setup +12396 (clear-stream _test-input-stream) +12397 (clear-stream $_test-input-buffered-file->buffer) +12398 (clear-stream _test-output-stream) +12399 (clear-stream $_test-output-buffered-file->buffer) +12400 (clear-stream _test-error-stream) +12401 (clear-stream $_test-error-buffered-file->buffer) +12402 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12403 68/push 0/imm32 +12404 68/push 0/imm32 +12405 89/<- %edx 4/r32/esp +12406 (tailor-exit-descriptor %edx 0x10) +12407 # +12408 (write _test-input-stream "fn foo {\n") +12409 (write _test-input-stream " var a: (addr int)\n") +12410 (write _test-input-stream " read-from-stream a, 0\n") +12411 (write _test-input-stream "}\n") +12412 # convert +12413 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12414 # registers except esp clobbered at this point +12415 # restore ed +12416 89/<- %edx 4/r32/esp +12417 (flush _test-output-buffered-file) +12418 (flush _test-error-buffered-file) +12419 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12425 # check output +12426 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-compound-base-type-2: output should be empty") +12427 (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") +12428 # check that stop(1) was called +12429 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-compound-base-type-2: exit status") +12430 # don't restore from ebp +12431 81 0/subop/add %esp 8/imm32 +12432 # . epilogue +12433 5d/pop-to-ebp +12434 c3/return +12435 +12436 test-read-from-stream-with-stream-atom-base-type: +12437 # . prologue +12438 55/push-ebp +12439 89/<- %ebp 4/r32/esp +12440 # setup +12441 (clear-stream _test-input-stream) +12442 (clear-stream $_test-input-buffered-file->buffer) +12443 (clear-stream _test-output-stream) +12444 (clear-stream $_test-output-buffered-file->buffer) +12445 (clear-stream _test-error-stream) +12446 (clear-stream $_test-error-buffered-file->buffer) +12447 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12448 68/push 0/imm32 +12449 68/push 0/imm32 +12450 89/<- %edx 4/r32/esp +12451 (tailor-exit-descriptor %edx 0x10) +12452 # +12453 (write _test-input-stream "fn foo {\n") +12454 (write _test-input-stream " var a: stream\n") +12455 (write _test-input-stream " read-from-stream a, 0\n") +12456 (write _test-input-stream "}\n") +12457 # convert +12458 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12459 # registers except esp clobbered at this point +12460 # restore ed +12461 89/<- %edx 4/r32/esp +12462 (flush _test-output-buffered-file) +12463 (flush _test-error-buffered-file) +12464 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12470 # check output +12471 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-stream-atom-base-type: output should be empty") +12472 (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") +12473 # check that stop(1) was called +12474 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-stream-atom-base-type: exit status") +12475 # don't restore from ebp +12476 81 0/subop/add %esp 8/imm32 +12477 # . epilogue +12478 5d/pop-to-ebp +12479 c3/return +12480 +12481 test-read-from-stream-with-wrong-index-type: +12482 # . prologue +12483 55/push-ebp +12484 89/<- %ebp 4/r32/esp +12485 # setup +12486 (clear-stream _test-input-stream) +12487 (clear-stream $_test-input-buffered-file->buffer) +12488 (clear-stream _test-output-stream) +12489 (clear-stream $_test-output-buffered-file->buffer) +12490 (clear-stream _test-error-stream) +12491 (clear-stream $_test-error-buffered-file->buffer) +12492 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12493 68/push 0/imm32 +12494 68/push 0/imm32 +12495 89/<- %edx 4/r32/esp +12496 (tailor-exit-descriptor %edx 0x10) +12497 # +12498 (write _test-input-stream "fn foo {\n") +12499 (write _test-input-stream " var a/eax: (addr stream int) <- copy 0\n") +12500 (write _test-input-stream " var b: boolean\n") +12501 (write _test-input-stream " read-from-stream a, b\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-read-from-stream-with-wrong-index-type: output should be empty") +12518 (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") +12519 # check that stop(1) was called +12520 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-wrong-index-type: 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-read-from-stream-with-no-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 " read-from-stream\n") +12546 (write _test-input-stream "}\n") +12547 # convert +12548 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12549 # registers except esp clobbered at this point +12550 # restore ed +12551 89/<- %edx 4/r32/esp +12552 (flush _test-output-buffered-file) +12553 (flush _test-error-buffered-file) +12554 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12560 # check output +12561 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-no-inouts: output should be empty") +12562 (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") +12563 # check that stop(1) was called +12564 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-no-inouts: exit status") +12565 # don't restore from ebp +12566 81 0/subop/add %esp 8/imm32 +12567 # . epilogue +12568 5d/pop-to-ebp +12569 c3/return +12570 +12571 test-read-from-stream-with-too-few-inouts: +12572 # . prologue +12573 55/push-ebp +12574 89/<- %ebp 4/r32/esp +12575 # setup +12576 (clear-stream _test-input-stream) +12577 (clear-stream $_test-input-buffered-file->buffer) +12578 (clear-stream _test-output-stream) +12579 (clear-stream $_test-output-buffered-file->buffer) +12580 (clear-stream _test-error-stream) +12581 (clear-stream $_test-error-buffered-file->buffer) +12582 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12583 68/push 0/imm32 +12584 68/push 0/imm32 +12585 89/<- %edx 4/r32/esp +12586 (tailor-exit-descriptor %edx 0x10) +12587 # +12588 (write _test-input-stream "fn foo {\n") +12589 (write _test-input-stream " var a: (addr stream int)\n") +12590 (write _test-input-stream " read-from-stream a\n") +12591 (write _test-input-stream "}\n") +12592 # convert +12593 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12594 # registers except esp clobbered at this point +12595 # restore ed +12596 89/<- %edx 4/r32/esp +12597 (flush _test-output-buffered-file) +12598 (flush _test-error-buffered-file) +12599 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12605 # check output +12606 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-too-few-inouts: output should be empty") +12607 (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") +12608 # check that stop(1) was called +12609 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-too-few-inouts: exit status") +12610 # don't restore from ebp +12611 81 0/subop/add %esp 8/imm32 +12612 # . epilogue +12613 5d/pop-to-ebp +12614 c3/return +12615 +12616 test-read-from-stream-with-too-many-inouts: +12617 # . prologue +12618 55/push-ebp +12619 89/<- %ebp 4/r32/esp +12620 # setup +12621 (clear-stream _test-input-stream) +12622 (clear-stream $_test-input-buffered-file->buffer) +12623 (clear-stream _test-output-stream) +12624 (clear-stream $_test-output-buffered-file->buffer) +12625 (clear-stream _test-error-stream) +12626 (clear-stream $_test-error-buffered-file->buffer) +12627 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12628 68/push 0/imm32 +12629 68/push 0/imm32 +12630 89/<- %edx 4/r32/esp +12631 (tailor-exit-descriptor %edx 0x10) +12632 # +12633 (write _test-input-stream "fn foo {\n") +12634 (write _test-input-stream " var a: (addr stream int)\n") +12635 (write _test-input-stream " var b: (addr int)\n") +12636 (write _test-input-stream " read-from-stream a, b, 0\n") +12637 (write _test-input-stream "}\n") +12638 # convert +12639 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12640 # registers except esp clobbered at this point +12641 # restore ed +12642 89/<- %edx 4/r32/esp +12643 (flush _test-output-buffered-file) +12644 (flush _test-error-buffered-file) +12645 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12651 # check output +12652 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-too-many-inouts: output should be empty") +12653 (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") +12654 # check that stop(1) was called +12655 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-too-many-inouts: exit status") +12656 # don't restore from ebp +12657 81 0/subop/add %esp 8/imm32 +12658 # . epilogue +12659 5d/pop-to-ebp +12660 c3/return +12661 +12662 test-read-from-stream-with-output: +12663 # . prologue +12664 55/push-ebp +12665 89/<- %ebp 4/r32/esp +12666 # setup +12667 (clear-stream _test-input-stream) +12668 (clear-stream $_test-input-buffered-file->buffer) +12669 (clear-stream _test-output-stream) +12670 (clear-stream $_test-output-buffered-file->buffer) +12671 (clear-stream _test-error-stream) +12672 (clear-stream $_test-error-buffered-file->buffer) +12673 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12674 68/push 0/imm32 +12675 68/push 0/imm32 +12676 89/<- %edx 4/r32/esp +12677 (tailor-exit-descriptor %edx 0x10) +12678 # +12679 (write _test-input-stream "fn foo {\n") +12680 (write _test-input-stream " var a: (addr stream int)\n") +12681 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") +12682 (write _test-input-stream " b <- read-from-stream a, b\n") +12683 (write _test-input-stream "}\n") +12684 # convert +12685 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12686 # registers except esp clobbered at this point +12687 # restore ed +12688 89/<- %edx 4/r32/esp +12689 (flush _test-output-buffered-file) +12690 (flush _test-error-buffered-file) +12691 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12697 # check output +12698 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-output: output should be empty") +12699 (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") +12700 # check that stop(1) was called +12701 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-output: exit status") +12702 # don't restore from ebp +12703 81 0/subop/add %esp 8/imm32 +12704 # . epilogue +12705 5d/pop-to-ebp +12706 c3/return +12707 +12708 test-convert-write-to-stream: +12709 # . prologue +12710 55/push-ebp +12711 89/<- %ebp 4/r32/esp +12712 # setup +12713 (clear-stream _test-input-stream) +12714 (clear-stream $_test-input-buffered-file->buffer) +12715 (clear-stream _test-output-stream) +12716 (clear-stream $_test-output-buffered-file->buffer) +12717 # +12718 (write _test-input-stream "fn foo {\n") +12719 (write _test-input-stream " var s/esi: (addr stream int) <- copy 0\n") +12720 (write _test-input-stream " var o/ecx: (addr int) <- copy 0\n") +12721 (write _test-input-stream " write-to-stream s, o\n") +12722 (write _test-input-stream "}\n") +12723 # convert +12724 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +12725 # registers except esp clobbered at this point +12726 # restore ed +12727 89/<- %edx 4/r32/esp +12728 (flush _test-output-buffered-file) +12729 (flush _test-error-buffered-file) +12730 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +12736 # check output +12737 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-write-to-stream/0") +12738 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-write-to-stream/1") +12739 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-write-to-stream/2") +12740 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-write-to-stream/3") +12741 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-write-to-stream/4") +12742 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-write-to-stream/5") +12743 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-write-to-stream/6") +12744 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-write-to-stream/7") +12745 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-write-to-stream/8") +12746 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-write-to-stream/9") +12747 (check-next-stream-line-equal _test-output-stream " (write-to-stream %esi %ecx 0x00000004)" "F - test-convert-write-to-stream/10") +12748 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-write-to-stream/11") +12749 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-write-to-stream/12") +12750 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-write-to-stream/13") +12751 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-write-to-stream/14") +12752 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-write-to-stream/15") +12753 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-write-to-stream/16") +12754 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-write-to-stream/17") +12755 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-write-to-stream/18") +12756 # . epilogue +12757 89/<- %esp 5/r32/ebp +12758 5d/pop-to-ebp +12759 c3/return +12760 +12761 test-convert-write-to-stream-with-correct-payload-size: +12762 # . prologue +12763 55/push-ebp +12764 89/<- %ebp 4/r32/esp +12765 # setup +12766 (clear-stream _test-input-stream) +12767 (clear-stream $_test-input-buffered-file->buffer) +12768 (clear-stream _test-output-stream) +12769 (clear-stream $_test-output-buffered-file->buffer) +12770 # +12771 (write _test-input-stream "fn foo {\n") +12772 (write _test-input-stream " var s/esi: (addr stream handle int) <- copy 0\n") +12773 (write _test-input-stream " var o/ecx: (addr handle int) <- copy 0\n") +12774 (write _test-input-stream " write-to-stream s, o\n") +12775 (write _test-input-stream "}\n") +12776 # convert +12777 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +12778 # registers except esp clobbered at this point +12779 # restore ed +12780 89/<- %edx 4/r32/esp +12781 (flush _test-output-buffered-file) +12782 (flush _test-error-buffered-file) +12783 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +12789 # check output +12790 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-write-to-stream-with-correct-payload-size/0") +12791 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-write-to-stream-with-correct-payload-size/1") +12792 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-write-to-stream-with-correct-payload-size/2") +12793 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-write-to-stream-with-correct-payload-size/3") +12794 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-write-to-stream-with-correct-payload-size/4") +12795 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-write-to-stream-with-correct-payload-size/5") +12796 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-write-to-stream-with-correct-payload-size/6") +12797 (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") +12798 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-write-to-stream-with-correct-payload-size/8") +12799 (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") +12800 (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") +12801 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-write-to-stream-with-correct-payload-size/11") +12802 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-write-to-stream-with-correct-payload-size/12") +12803 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-write-to-stream-with-correct-payload-size/13") +12804 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-write-to-stream-with-correct-payload-size/14") +12805 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-write-to-stream-with-correct-payload-size/15") +12806 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-write-to-stream-with-correct-payload-size/16") +12807 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-write-to-stream-with-correct-payload-size/17") +12808 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-write-to-stream-with-correct-payload-size/18") +12809 # . epilogue +12810 89/<- %esp 5/r32/ebp +12811 5d/pop-to-ebp +12812 c3/return +12813 +12814 test-write-to-stream-with-non-stream-atom-base-type: +12815 # . prologue +12816 55/push-ebp +12817 89/<- %ebp 4/r32/esp +12818 # setup +12819 (clear-stream _test-input-stream) +12820 (clear-stream $_test-input-buffered-file->buffer) +12821 (clear-stream _test-output-stream) +12822 (clear-stream $_test-output-buffered-file->buffer) +12823 (clear-stream _test-error-stream) +12824 (clear-stream $_test-error-buffered-file->buffer) +12825 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12826 68/push 0/imm32 +12827 68/push 0/imm32 +12828 89/<- %edx 4/r32/esp +12829 (tailor-exit-descriptor %edx 0x10) +12830 # +12831 (write _test-input-stream "fn foo {\n") +12832 (write _test-input-stream " var a: int\n") +12833 (write _test-input-stream " write-to-stream a, 0\n") +12834 (write _test-input-stream "}\n") +12835 # convert +12836 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12837 # registers except esp clobbered at this point +12838 # restore ed +12839 89/<- %edx 4/r32/esp +12840 (flush _test-output-buffered-file) +12841 (flush _test-error-buffered-file) +12842 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12848 # check output +12849 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-atom-base-type: output should be empty") +12850 (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") +12851 # check that stop(1) was called +12852 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-atom-base-type: exit status") +12853 # don't restore from ebp +12854 81 0/subop/add %esp 8/imm32 +12855 # . epilogue +12856 5d/pop-to-ebp +12857 c3/return +12858 +12859 test-write-to-stream-with-non-stream-compound-base-type: +12860 # . prologue +12861 55/push-ebp +12862 89/<- %ebp 4/r32/esp +12863 # setup +12864 (clear-stream _test-input-stream) +12865 (clear-stream $_test-input-buffered-file->buffer) +12866 (clear-stream _test-output-stream) +12867 (clear-stream $_test-output-buffered-file->buffer) +12868 (clear-stream _test-error-stream) +12869 (clear-stream $_test-error-buffered-file->buffer) +12870 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12871 68/push 0/imm32 +12872 68/push 0/imm32 +12873 89/<- %edx 4/r32/esp +12874 (tailor-exit-descriptor %edx 0x10) +12875 # +12876 (write _test-input-stream "fn foo {\n") +12877 (write _test-input-stream " var a: (handle int)\n") +12878 (write _test-input-stream " write-to-stream a, 0\n") +12879 (write _test-input-stream "}\n") +12880 # convert +12881 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12882 # registers except esp clobbered at this point +12883 # restore ed +12884 89/<- %edx 4/r32/esp +12885 (flush _test-output-buffered-file) +12886 (flush _test-error-buffered-file) +12887 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12893 # check output +12894 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-compound-base-type: output should be empty") +12895 (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") +12896 # check that stop(1) was called +12897 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-compound-base-type: exit status") +12898 # don't restore from ebp +12899 81 0/subop/add %esp 8/imm32 +12900 # . epilogue +12901 5d/pop-to-ebp +12902 c3/return +12903 +12904 test-write-to-stream-with-non-stream-compound-base-type-2: +12905 # . prologue +12906 55/push-ebp +12907 89/<- %ebp 4/r32/esp +12908 # setup +12909 (clear-stream _test-input-stream) +12910 (clear-stream $_test-input-buffered-file->buffer) +12911 (clear-stream _test-output-stream) +12912 (clear-stream $_test-output-buffered-file->buffer) +12913 (clear-stream _test-error-stream) +12914 (clear-stream $_test-error-buffered-file->buffer) +12915 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12916 68/push 0/imm32 +12917 68/push 0/imm32 +12918 89/<- %edx 4/r32/esp +12919 (tailor-exit-descriptor %edx 0x10) +12920 # +12921 (write _test-input-stream "fn foo {\n") +12922 (write _test-input-stream " var a: (addr int)\n") +12923 (write _test-input-stream " write-to-stream a, 0\n") +12924 (write _test-input-stream "}\n") +12925 # convert +12926 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12927 # registers except esp clobbered at this point +12928 # restore ed +12929 89/<- %edx 4/r32/esp +12930 (flush _test-output-buffered-file) +12931 (flush _test-error-buffered-file) +12932 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12938 # check output +12939 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-compound-base-type-2: output should be empty") +12940 (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") +12941 # check that stop(1) was called +12942 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-compound-base-type-2: exit status") +12943 # don't restore from ebp +12944 81 0/subop/add %esp 8/imm32 +12945 # . epilogue 12946 5d/pop-to-ebp 12947 c3/return 12948 -12949 test-convert-function-with-return-and-local-vars: +12949 test-write-to-stream-with-stream-atom-base-type: 12950 # . prologue 12951 55/push-ebp 12952 89/<- %ebp 4/r32/esp @@ -11722,23309 +11757,24628 @@ if ('onhashchange' in window) { 12955 (clear-stream $_test-input-buffered-file->buffer) 12956 (clear-stream _test-output-stream) 12957 (clear-stream $_test-output-buffered-file->buffer) -12958 # -12959 (write _test-input-stream "fn foo -> _/eax: int {\n") -12960 (write _test-input-stream " {\n") -12961 (write _test-input-stream " var x: int\n") -12962 (write _test-input-stream " {\n") -12963 (write _test-input-stream " var y: int\n") -12964 (write _test-input-stream " return y\n") -12965 (write _test-input-stream " increment x\n") -12966 (write _test-input-stream " }\n") -12967 (write _test-input-stream " }\n") -12968 (write _test-input-stream " return 0\n") +12958 (clear-stream _test-error-stream) +12959 (clear-stream $_test-error-buffered-file->buffer) +12960 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12961 68/push 0/imm32 +12962 68/push 0/imm32 +12963 89/<- %edx 4/r32/esp +12964 (tailor-exit-descriptor %edx 0x10) +12965 # +12966 (write _test-input-stream "fn foo {\n") +12967 (write _test-input-stream " var a: stream\n") +12968 (write _test-input-stream " write-to-stream a, 0\n") 12969 (write _test-input-stream "}\n") 12970 # convert -12971 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -12972 (flush _test-output-buffered-file) -12973 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -12979 # check output -12980 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-and-local-vars/0") -12981 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-and-local-vars/1") -12982 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-and-local-vars/2") -12983 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-and-local-vars/3") -12984 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/4") -12985 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-and-local-vars/5") -12986 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/6") -12987 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-return-and-local-vars/7") -12988 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-return-and-local-vars/8") # var x -12989 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/9") -12990 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-return-and-local-vars/10") -12991 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-return-and-local-vars/11") # var y -12992 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-with-return-and-local-vars/12") -12993 (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") -12994 (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") -12995 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-and-local-vars/15") -12996 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/16") -12997 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-return-and-local-vars/17") -12998 (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") -12999 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/19") -13000 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-return-and-local-vars/20") -13001 (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") -13002 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-and-local-vars/21") -13003 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/21") -13004 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-and-local-vars/22") -13005 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-and-local-vars/23") -13006 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-and-local-vars/24") -13007 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-and-local-vars/25") -13008 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-and-local-vars/26") -13009 # . epilogue -13010 89/<- %esp 5/r32/ebp -13011 5d/pop-to-ebp -13012 c3/return -13013 -13014 test-copy-object-with-no-inout: -13015 # . prologue -13016 55/push-ebp -13017 89/<- %ebp 4/r32/esp -13018 # setup -13019 (clear-stream _test-input-stream) -13020 (clear-stream $_test-input-buffered-file->buffer) -13021 (clear-stream _test-output-stream) -13022 (clear-stream $_test-output-buffered-file->buffer) -13023 (clear-stream _test-error-stream) -13024 (clear-stream $_test-error-buffered-file->buffer) -13025 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13026 68/push 0/imm32 -13027 68/push 0/imm32 -13028 89/<- %edx 4/r32/esp -13029 (tailor-exit-descriptor %edx 0x10) -13030 # -13031 (write _test-input-stream "fn foo {\n") -13032 (write _test-input-stream " copy-object\n") -13033 (write _test-input-stream "}\n") -13034 # convert -13035 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13036 # registers except esp clobbered at this point -13037 # restore ed -13038 89/<- %edx 4/r32/esp -13039 (flush _test-output-buffered-file) -13040 (flush _test-error-buffered-file) -13041 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13047 # check output -13048 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-no-inout: output should be empty") -13049 (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") -13050 # check that stop(1) was called -13051 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-no-inout: exit status") -13052 # don't restore from ebp -13053 81 0/subop/add %esp 8/imm32 -13054 # . epilogue -13055 5d/pop-to-ebp -13056 c3/return -13057 -13058 test-copy-object-with-no-input: -13059 # . prologue -13060 55/push-ebp -13061 89/<- %ebp 4/r32/esp -13062 # setup -13063 (clear-stream _test-input-stream) -13064 (clear-stream $_test-input-buffered-file->buffer) -13065 (clear-stream _test-output-stream) -13066 (clear-stream $_test-output-buffered-file->buffer) -13067 (clear-stream _test-error-stream) -13068 (clear-stream $_test-error-buffered-file->buffer) -13069 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13070 68/push 0/imm32 -13071 68/push 0/imm32 -13072 89/<- %edx 4/r32/esp -13073 (tailor-exit-descriptor %edx 0x10) -13074 # -13075 (write _test-input-stream "fn foo {\n") -13076 (write _test-input-stream " var x: (addr int)\n") -13077 (write _test-input-stream " copy-object x\n") -13078 (write _test-input-stream "}\n") -13079 # convert -13080 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13081 # registers except esp clobbered at this point -13082 # restore ed -13083 89/<- %edx 4/r32/esp -13084 (flush _test-output-buffered-file) -13085 (flush _test-error-buffered-file) -13086 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13092 # check output -13093 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-no-input: output should be empty") -13094 (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") -13095 # check that stop(1) was called -13096 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-no-input: exit status") -13097 # don't restore from ebp -13098 81 0/subop/add %esp 8/imm32 -13099 # . epilogue -13100 5d/pop-to-ebp -13101 c3/return -13102 -13103 test-copy-object-with-too-many-inouts: -13104 # . prologue -13105 55/push-ebp -13106 89/<- %ebp 4/r32/esp -13107 # setup -13108 (clear-stream _test-input-stream) -13109 (clear-stream $_test-input-buffered-file->buffer) -13110 (clear-stream _test-output-stream) -13111 (clear-stream $_test-output-buffered-file->buffer) -13112 (clear-stream _test-error-stream) -13113 (clear-stream $_test-error-buffered-file->buffer) -13114 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13115 68/push 0/imm32 -13116 68/push 0/imm32 -13117 89/<- %edx 4/r32/esp -13118 (tailor-exit-descriptor %edx 0x10) -13119 # -13120 (write _test-input-stream "fn foo {\n") -13121 (write _test-input-stream " var x: (addr boolean)\n") -13122 (write _test-input-stream " copy-object x, x, x\n") -13123 (write _test-input-stream "}\n") -13124 # convert -13125 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13126 # registers except esp clobbered at this point -13127 # restore ed -13128 89/<- %edx 4/r32/esp -13129 (flush _test-output-buffered-file) -13130 (flush _test-error-buffered-file) -13131 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13137 # check output -13138 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-too-many-inouts: output should be empty") -13139 (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") -13140 # check that stop(1) was called -13141 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-too-many-inouts: exit status") -13142 # don't restore from ebp -13143 81 0/subop/add %esp 8/imm32 -13144 # . epilogue -13145 5d/pop-to-ebp -13146 c3/return -13147 -13148 test-copy-object-with-output: -13149 # . prologue -13150 55/push-ebp -13151 89/<- %ebp 4/r32/esp -13152 # setup -13153 (clear-stream _test-input-stream) -13154 (clear-stream $_test-input-buffered-file->buffer) -13155 (clear-stream _test-output-stream) -13156 (clear-stream $_test-output-buffered-file->buffer) -13157 (clear-stream _test-error-stream) -13158 (clear-stream $_test-error-buffered-file->buffer) -13159 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13160 68/push 0/imm32 -13161 68/push 0/imm32 -13162 89/<- %edx 4/r32/esp -13163 (tailor-exit-descriptor %edx 0x10) -13164 # -13165 (write _test-input-stream "fn foo {\n") -13166 (write _test-input-stream " var x/eax: (addr boolean) <- copy 0\n") -13167 (write _test-input-stream " var y/ecx: (addr boolean) <- copy 0\n") -13168 (write _test-input-stream " x <- copy-object x, y\n") -13169 (write _test-input-stream "}\n") -13170 # convert -13171 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13172 # registers except esp clobbered at this point -13173 # restore ed -13174 89/<- %edx 4/r32/esp -13175 (flush _test-output-buffered-file) -13176 (flush _test-error-buffered-file) -13177 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13183 # check output -13184 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-output: output should be empty") -13185 (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") -13186 # check that stop(1) was called -13187 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-output: exit status") -13188 # don't restore from ebp -13189 81 0/subop/add %esp 8/imm32 -13190 # . epilogue -13191 5d/pop-to-ebp -13192 c3/return -13193 -13194 test-copy-object-deref-address: -13195 # . prologue -13196 55/push-ebp -13197 89/<- %ebp 4/r32/esp -13198 # setup -13199 (clear-stream _test-input-stream) -13200 (clear-stream $_test-input-buffered-file->buffer) -13201 (clear-stream _test-output-stream) -13202 (clear-stream $_test-output-buffered-file->buffer) -13203 # -13204 (write _test-input-stream "fn foo {\n") -13205 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") -13206 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") -13207 (write _test-input-stream " copy-object *y, x\n") -13208 (write _test-input-stream "}\n") -13209 # convert -13210 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -13211 (flush _test-output-buffered-file) -13212 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13218 # not bothering checking output -13219 (check-next-stream-line-equal _test-error-stream "" "F - test-copy-object-deref-address: error message") -13220 # . epilogue -13221 5d/pop-to-ebp -13222 c3/return -13223 -13224 test-copy-object-non-addr: -13225 # . prologue -13226 55/push-ebp -13227 89/<- %ebp 4/r32/esp -13228 # setup -13229 (clear-stream _test-input-stream) -13230 (clear-stream $_test-input-buffered-file->buffer) -13231 (clear-stream _test-output-stream) -13232 (clear-stream $_test-output-buffered-file->buffer) -13233 (clear-stream _test-error-stream) -13234 (clear-stream $_test-error-buffered-file->buffer) -13235 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13236 68/push 0/imm32 -13237 68/push 0/imm32 -13238 89/<- %edx 4/r32/esp -13239 (tailor-exit-descriptor %edx 0x10) -13240 # -13241 (write _test-input-stream "fn foo {\n") -13242 (write _test-input-stream " var x: int\n") -13243 (write _test-input-stream " var y: int\n") -13244 (write _test-input-stream " copy-object y, x\n") -13245 (write _test-input-stream "}\n") -13246 # convert -13247 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13248 # registers except esp clobbered at this point -13249 # restore ed -13250 89/<- %edx 4/r32/esp -13251 (flush _test-output-buffered-file) -13252 (flush _test-error-buffered-file) -13253 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13259 # check output -13260 (check-stream-equal _test-output-stream "" "F - test-copy-object-non-addr: output should be empty") -13261 (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") -13262 # check that stop(1) was called -13263 (check-ints-equal *(edx+4) 2 "F - test-copy-object-non-addr: exit status") -13264 # don't restore from ebp -13265 81 0/subop/add %esp 8/imm32 -13266 # . epilogue -13267 5d/pop-to-ebp -13268 c3/return -13269 -13270 test-copy-object-non-equal: -13271 # . prologue -13272 55/push-ebp -13273 89/<- %ebp 4/r32/esp -13274 # setup -13275 (clear-stream _test-input-stream) -13276 (clear-stream $_test-input-buffered-file->buffer) -13277 (clear-stream _test-output-stream) -13278 (clear-stream $_test-output-buffered-file->buffer) -13279 (clear-stream _test-error-stream) -13280 (clear-stream $_test-error-buffered-file->buffer) -13281 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13282 68/push 0/imm32 -13283 68/push 0/imm32 -13284 89/<- %edx 4/r32/esp -13285 (tailor-exit-descriptor %edx 0x10) -13286 # -13287 (write _test-input-stream "fn foo {\n") -13288 (write _test-input-stream " var x: (addr int)\n") -13289 (write _test-input-stream " var y: (addr boolean)\n") -13290 (write _test-input-stream " copy-object y, x\n") -13291 (write _test-input-stream "}\n") -13292 # convert -13293 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13294 # registers except esp clobbered at this point -13295 # restore ed -13296 89/<- %edx 4/r32/esp -13297 (flush _test-output-buffered-file) -13298 (flush _test-error-buffered-file) -13299 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13305 # check output -13306 (check-stream-equal _test-output-stream "" "F - test-copy-object-non-equal: output should be empty") -13307 (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") -13308 # check that stop(1) was called -13309 (check-ints-equal *(edx+4) 2 "F - test-copy-object-non-equal: exit status") -13310 # don't restore from ebp -13311 81 0/subop/add %esp 8/imm32 -13312 # . epilogue -13313 5d/pop-to-ebp -13314 c3/return -13315 -13316 test-allocate-with-no-inout: -13317 # . prologue -13318 55/push-ebp -13319 89/<- %ebp 4/r32/esp -13320 # setup -13321 (clear-stream _test-input-stream) -13322 (clear-stream $_test-input-buffered-file->buffer) -13323 (clear-stream _test-output-stream) -13324 (clear-stream $_test-output-buffered-file->buffer) -13325 (clear-stream _test-error-stream) -13326 (clear-stream $_test-error-buffered-file->buffer) -13327 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13328 68/push 0/imm32 -13329 68/push 0/imm32 -13330 89/<- %edx 4/r32/esp -13331 (tailor-exit-descriptor %edx 0x10) -13332 # -13333 (write _test-input-stream "fn foo {\n") -13334 (write _test-input-stream " allocate\n") -13335 (write _test-input-stream "}\n") -13336 # convert -13337 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13338 # registers except esp clobbered at this point -13339 # restore ed -13340 89/<- %edx 4/r32/esp -13341 (flush _test-output-buffered-file) -13342 (flush _test-error-buffered-file) -13343 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13349 # check output -13350 (check-stream-equal _test-output-stream "" "F - test-allocate-with-no-inout: output should be empty") -13351 (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") -13352 # check that stop(1) was called -13353 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-no-inout: exit status") -13354 # don't restore from ebp -13355 81 0/subop/add %esp 8/imm32 -13356 # . epilogue -13357 5d/pop-to-ebp -13358 c3/return -13359 -13360 test-allocate-with-too-many-inouts: -13361 # . prologue -13362 55/push-ebp -13363 89/<- %ebp 4/r32/esp -13364 # setup -13365 (clear-stream _test-input-stream) -13366 (clear-stream $_test-input-buffered-file->buffer) -13367 (clear-stream _test-output-stream) -13368 (clear-stream $_test-output-buffered-file->buffer) -13369 (clear-stream _test-error-stream) -13370 (clear-stream $_test-error-buffered-file->buffer) -13371 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13372 68/push 0/imm32 -13373 68/push 0/imm32 -13374 89/<- %edx 4/r32/esp -13375 (tailor-exit-descriptor %edx 0x10) -13376 # -13377 (write _test-input-stream "fn foo {\n") -13378 (write _test-input-stream " var x: (addr handle int)\n") -13379 (write _test-input-stream " allocate x, 0\n") -13380 (write _test-input-stream "}\n") -13381 # convert -13382 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13383 # registers except esp clobbered at this point -13384 # restore ed -13385 89/<- %edx 4/r32/esp -13386 (flush _test-output-buffered-file) -13387 (flush _test-error-buffered-file) -13388 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13394 # check output -13395 (check-stream-equal _test-output-stream "" "F - test-allocate-with-too-many-inouts: output should be empty") -13396 (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") -13397 # check that stop(1) was called -13398 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-too-many-inouts: exit status") -13399 # don't restore from ebp -13400 81 0/subop/add %esp 8/imm32 -13401 # . epilogue -13402 5d/pop-to-ebp -13403 c3/return -13404 -13405 test-allocate-with-output: -13406 # . prologue -13407 55/push-ebp -13408 89/<- %ebp 4/r32/esp -13409 # setup -13410 (clear-stream _test-input-stream) -13411 (clear-stream $_test-input-buffered-file->buffer) -13412 (clear-stream _test-output-stream) -13413 (clear-stream $_test-output-buffered-file->buffer) -13414 (clear-stream _test-error-stream) -13415 (clear-stream $_test-error-buffered-file->buffer) -13416 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13417 68/push 0/imm32 -13418 68/push 0/imm32 -13419 89/<- %edx 4/r32/esp -13420 (tailor-exit-descriptor %edx 0x10) -13421 # -13422 (write _test-input-stream "fn foo {\n") -13423 (write _test-input-stream " var x/eax: boolean <- copy 0\n") -13424 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") -13425 (write _test-input-stream " x <- allocate y\n") -13426 (write _test-input-stream "}\n") -13427 # convert -13428 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13429 # registers except esp clobbered at this point -13430 # restore ed -13431 89/<- %edx 4/r32/esp -13432 (flush _test-output-buffered-file) -13433 (flush _test-error-buffered-file) -13434 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13440 # check output -13441 (check-stream-equal _test-output-stream "" "F - test-allocate-with-output: output should be empty") -13442 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'allocate' must not have any outputs" "F - test-allocate-with-output: error message") -13443 # check that stop(1) was called -13444 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-output: exit status") -13445 # don't restore from ebp -13446 81 0/subop/add %esp 8/imm32 -13447 # . epilogue -13448 5d/pop-to-ebp -13449 c3/return -13450 -13451 test-allocate-non-addr: -13452 # . prologue -13453 55/push-ebp -13454 89/<- %ebp 4/r32/esp -13455 # setup -13456 (clear-stream _test-input-stream) -13457 (clear-stream $_test-input-buffered-file->buffer) -13458 (clear-stream _test-output-stream) -13459 (clear-stream $_test-output-buffered-file->buffer) -13460 (clear-stream _test-error-stream) -13461 (clear-stream $_test-error-buffered-file->buffer) -13462 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13463 68/push 0/imm32 -13464 68/push 0/imm32 -13465 89/<- %edx 4/r32/esp -13466 (tailor-exit-descriptor %edx 0x10) -13467 # -13468 (write _test-input-stream "fn foo {\n") -13469 (write _test-input-stream " var y: (handle int)\n") -13470 (write _test-input-stream " allocate y\n") -13471 (write _test-input-stream "}\n") -13472 # convert -13473 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13474 # registers except esp clobbered at this point -13475 # restore ed -13476 89/<- %edx 4/r32/esp -13477 (flush _test-output-buffered-file) -13478 (flush _test-error-buffered-file) -13479 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13485 # check output -13486 (check-stream-equal _test-output-stream "" "F - test-allocate-non-addr: output must be empty") -13487 (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") -13488 # check that stop(1) was called -13489 (check-ints-equal *(edx+4) 2 "F - test-allocate-non-addr: exit status") -13490 # don't restore from ebp -13491 81 0/subop/add %esp 8/imm32 -13492 # . epilogue -13493 5d/pop-to-ebp -13494 c3/return -13495 -13496 test-allocate-non-addr-handle: -13497 # . prologue -13498 55/push-ebp -13499 89/<- %ebp 4/r32/esp -13500 # setup -13501 (clear-stream _test-input-stream) -13502 (clear-stream $_test-input-buffered-file->buffer) -13503 (clear-stream _test-output-stream) -13504 (clear-stream $_test-output-buffered-file->buffer) -13505 (clear-stream _test-error-stream) -13506 (clear-stream $_test-error-buffered-file->buffer) -13507 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13508 68/push 0/imm32 -13509 68/push 0/imm32 -13510 89/<- %edx 4/r32/esp -13511 (tailor-exit-descriptor %edx 0x10) -13512 # -13513 (write _test-input-stream "fn foo {\n") -13514 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") -13515 (write _test-input-stream " allocate y\n") -13516 (write _test-input-stream "}\n") -13517 # convert -13518 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13519 # registers except esp clobbered at this point -13520 # restore ed -13521 89/<- %edx 4/r32/esp -13522 (flush _test-output-buffered-file) -13523 (flush _test-error-buffered-file) -13524 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13530 # check output -13531 (check-stream-equal _test-output-stream "" "F - test-allocate-non-addr-handle: output should be empty") -13532 (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") -13533 # check that stop(1) was called -13534 (check-ints-equal *(edx+4) 2 "F - test-allocate-non-addr-handle: exit status") -13535 # don't restore from ebp -13536 81 0/subop/add %esp 8/imm32 -13537 # . epilogue -13538 5d/pop-to-ebp -13539 c3/return -13540 -13541 test-allocate-deref-address: -13542 # . prologue -13543 55/push-ebp -13544 89/<- %ebp 4/r32/esp -13545 # setup -13546 (clear-stream _test-input-stream) -13547 (clear-stream $_test-input-buffered-file->buffer) -13548 (clear-stream _test-output-stream) -13549 (clear-stream $_test-output-buffered-file->buffer) -13550 # -13551 (write _test-input-stream "fn foo {\n") -13552 (write _test-input-stream " var y/ecx: (addr addr handle int) <- copy 0\n") -13553 (write _test-input-stream " allocate *y\n") -13554 (write _test-input-stream "}\n") -13555 # convert -13556 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -13557 (flush _test-output-buffered-file) -13558 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13564 # not bothering checking output -13565 (check-next-stream-line-equal _test-error-stream "" "F - test-allocate-deref-address: error message") -13566 # . epilogue -13567 5d/pop-to-ebp -13568 c3/return -13569 -13570 test-populate-with-no-inout: -13571 # . prologue -13572 55/push-ebp -13573 89/<- %ebp 4/r32/esp -13574 # setup -13575 (clear-stream _test-input-stream) -13576 (clear-stream $_test-input-buffered-file->buffer) -13577 (clear-stream _test-output-stream) -13578 (clear-stream $_test-output-buffered-file->buffer) -13579 (clear-stream _test-error-stream) -13580 (clear-stream $_test-error-buffered-file->buffer) -13581 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13582 68/push 0/imm32 -13583 68/push 0/imm32 -13584 89/<- %edx 4/r32/esp -13585 (tailor-exit-descriptor %edx 0x10) -13586 # -13587 (write _test-input-stream "fn foo {\n") -13588 (write _test-input-stream " populate\n") -13589 (write _test-input-stream "}\n") -13590 # convert -13591 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13592 # registers except esp clobbered at this point -13593 # restore ed +12971 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12972 # registers except esp clobbered at this point +12973 # restore ed +12974 89/<- %edx 4/r32/esp +12975 (flush _test-output-buffered-file) +12976 (flush _test-error-buffered-file) +12977 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +12983 # check output +12984 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-stream-atom-base-type: output should be empty") +12985 (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") +12986 # check that stop(1) was called +12987 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-stream-atom-base-type: exit status") +12988 # don't restore from ebp +12989 81 0/subop/add %esp 8/imm32 +12990 # . epilogue +12991 5d/pop-to-ebp +12992 c3/return +12993 +12994 test-write-to-stream-with-wrong-index-type: +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 " var a/eax: (addr stream int) <- copy 0\n") +13013 (write _test-input-stream " var b: boolean\n") +13014 (write _test-input-stream " write-to-stream a, b\n") +13015 (write _test-input-stream "}\n") +13016 # convert +13017 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13018 # registers except esp clobbered at this point +13019 # restore ed +13020 89/<- %edx 4/r32/esp +13021 (flush _test-output-buffered-file) +13022 (flush _test-error-buffered-file) +13023 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13029 # check output +13030 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-wrong-index-type: output should be empty") +13031 (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") +13032 # check that stop(1) was called +13033 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-wrong-index-type: exit status") +13034 # don't restore from ebp +13035 81 0/subop/add %esp 8/imm32 +13036 # . epilogue +13037 5d/pop-to-ebp +13038 c3/return +13039 +13040 test-write-to-stream-with-no-inouts: +13041 # . prologue +13042 55/push-ebp +13043 89/<- %ebp 4/r32/esp +13044 # setup +13045 (clear-stream _test-input-stream) +13046 (clear-stream $_test-input-buffered-file->buffer) +13047 (clear-stream _test-output-stream) +13048 (clear-stream $_test-output-buffered-file->buffer) +13049 (clear-stream _test-error-stream) +13050 (clear-stream $_test-error-buffered-file->buffer) +13051 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13052 68/push 0/imm32 +13053 68/push 0/imm32 +13054 89/<- %edx 4/r32/esp +13055 (tailor-exit-descriptor %edx 0x10) +13056 # +13057 (write _test-input-stream "fn foo {\n") +13058 (write _test-input-stream " write-to-stream\n") +13059 (write _test-input-stream "}\n") +13060 # convert +13061 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13062 # registers except esp clobbered at this point +13063 # restore ed +13064 89/<- %edx 4/r32/esp +13065 (flush _test-output-buffered-file) +13066 (flush _test-error-buffered-file) +13067 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13073 # check output +13074 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-no-inouts: output should be empty") +13075 (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") +13076 # check that stop(1) was called +13077 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-no-inouts: exit status") +13078 # don't restore from ebp +13079 81 0/subop/add %esp 8/imm32 +13080 # . epilogue +13081 5d/pop-to-ebp +13082 c3/return +13083 +13084 test-write-to-stream-with-too-few-inouts: +13085 # . prologue +13086 55/push-ebp +13087 89/<- %ebp 4/r32/esp +13088 # setup +13089 (clear-stream _test-input-stream) +13090 (clear-stream $_test-input-buffered-file->buffer) +13091 (clear-stream _test-output-stream) +13092 (clear-stream $_test-output-buffered-file->buffer) +13093 (clear-stream _test-error-stream) +13094 (clear-stream $_test-error-buffered-file->buffer) +13095 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13096 68/push 0/imm32 +13097 68/push 0/imm32 +13098 89/<- %edx 4/r32/esp +13099 (tailor-exit-descriptor %edx 0x10) +13100 # +13101 (write _test-input-stream "fn foo {\n") +13102 (write _test-input-stream " var a: (addr stream int)\n") +13103 (write _test-input-stream " write-to-stream a\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-write-to-stream-with-too-few-inouts: output should be empty") +13120 (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") +13121 # check that stop(1) was called +13122 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-too-few-inouts: 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-write-to-stream-with-too-many-inouts: +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 a: (addr stream int)\n") +13148 (write _test-input-stream " var b: (addr int)\n") +13149 (write _test-input-stream " write-to-stream a, b, 0\n") +13150 (write _test-input-stream "}\n") +13151 # convert +13152 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13153 # registers except esp clobbered at this point +13154 # restore ed +13155 89/<- %edx 4/r32/esp +13156 (flush _test-output-buffered-file) +13157 (flush _test-error-buffered-file) +13158 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13164 # check output +13165 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-too-many-inouts: output should be empty") +13166 (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") +13167 # check that stop(1) was called +13168 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-too-many-inouts: exit status") +13169 # don't restore from ebp +13170 81 0/subop/add %esp 8/imm32 +13171 # . epilogue +13172 5d/pop-to-ebp +13173 c3/return +13174 +13175 test-write-to-stream-with-output: +13176 # . prologue +13177 55/push-ebp +13178 89/<- %ebp 4/r32/esp +13179 # setup +13180 (clear-stream _test-input-stream) +13181 (clear-stream $_test-input-buffered-file->buffer) +13182 (clear-stream _test-output-stream) +13183 (clear-stream $_test-output-buffered-file->buffer) +13184 (clear-stream _test-error-stream) +13185 (clear-stream $_test-error-buffered-file->buffer) +13186 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13187 68/push 0/imm32 +13188 68/push 0/imm32 +13189 89/<- %edx 4/r32/esp +13190 (tailor-exit-descriptor %edx 0x10) +13191 # +13192 (write _test-input-stream "fn foo {\n") +13193 (write _test-input-stream " var a: (addr stream int)\n") +13194 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") +13195 (write _test-input-stream " b <- write-to-stream a, b\n") +13196 (write _test-input-stream "}\n") +13197 # convert +13198 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13199 # registers except esp clobbered at this point +13200 # restore ed +13201 89/<- %edx 4/r32/esp +13202 (flush _test-output-buffered-file) +13203 (flush _test-error-buffered-file) +13204 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13210 # check output +13211 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-output: output should be empty") +13212 (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") +13213 # check that stop(1) was called +13214 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-output: exit status") +13215 # don't restore from ebp +13216 81 0/subop/add %esp 8/imm32 +13217 # . epilogue +13218 5d/pop-to-ebp +13219 c3/return +13220 +13221 test-length-with-non-array-atom-base-type: +13222 # . prologue +13223 55/push-ebp +13224 89/<- %ebp 4/r32/esp +13225 # setup +13226 (clear-stream _test-input-stream) +13227 (clear-stream $_test-input-buffered-file->buffer) +13228 (clear-stream _test-output-stream) +13229 (clear-stream $_test-output-buffered-file->buffer) +13230 (clear-stream _test-error-stream) +13231 (clear-stream $_test-error-buffered-file->buffer) +13232 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13233 68/push 0/imm32 +13234 68/push 0/imm32 +13235 89/<- %edx 4/r32/esp +13236 (tailor-exit-descriptor %edx 0x10) +13237 # +13238 (write _test-input-stream "fn foo {\n") +13239 (write _test-input-stream " var a: int\n") +13240 (write _test-input-stream " var c/ecx: int <- length a\n") +13241 (write _test-input-stream "}\n") +13242 # convert +13243 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13244 # registers except esp clobbered at this point +13245 # restore ed +13246 89/<- %edx 4/r32/esp +13247 (flush _test-output-buffered-file) +13248 (flush _test-error-buffered-file) +13249 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13255 # check output +13256 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-atom-base-type: output should be empty") +13257 (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") +13258 # check that stop(1) was called +13259 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-atom-base-type: exit status") +13260 # don't restore from ebp +13261 81 0/subop/add %esp 8/imm32 +13262 # . epilogue +13263 5d/pop-to-ebp +13264 c3/return +13265 +13266 test-length-with-non-array-compound-base-type: +13267 # . prologue +13268 55/push-ebp +13269 89/<- %ebp 4/r32/esp +13270 # setup +13271 (clear-stream _test-input-stream) +13272 (clear-stream $_test-input-buffered-file->buffer) +13273 (clear-stream _test-output-stream) +13274 (clear-stream $_test-output-buffered-file->buffer) +13275 (clear-stream _test-error-stream) +13276 (clear-stream $_test-error-buffered-file->buffer) +13277 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13278 68/push 0/imm32 +13279 68/push 0/imm32 +13280 89/<- %edx 4/r32/esp +13281 (tailor-exit-descriptor %edx 0x10) +13282 # +13283 (write _test-input-stream "fn foo {\n") +13284 (write _test-input-stream " var a: (handle int)\n") +13285 (write _test-input-stream " var c/ecx: (addr int) <- length a, 0\n") +13286 (write _test-input-stream "}\n") +13287 # convert +13288 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13289 # registers except esp clobbered at this point +13290 # restore ed +13291 89/<- %edx 4/r32/esp +13292 (flush _test-output-buffered-file) +13293 (flush _test-error-buffered-file) +13294 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13300 # check output +13301 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-compound-base-type: output should be empty") +13302 (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") +13303 # check that stop(1) was called +13304 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-compound-base-type: exit status") +13305 # don't restore from ebp +13306 81 0/subop/add %esp 8/imm32 +13307 # . epilogue +13308 5d/pop-to-ebp +13309 c3/return +13310 +13311 test-length-with-non-array-compound-base-type-2: +13312 # . prologue +13313 55/push-ebp +13314 89/<- %ebp 4/r32/esp +13315 # setup +13316 (clear-stream _test-input-stream) +13317 (clear-stream $_test-input-buffered-file->buffer) +13318 (clear-stream _test-output-stream) +13319 (clear-stream $_test-output-buffered-file->buffer) +13320 (clear-stream _test-error-stream) +13321 (clear-stream $_test-error-buffered-file->buffer) +13322 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13323 68/push 0/imm32 +13324 68/push 0/imm32 +13325 89/<- %edx 4/r32/esp +13326 (tailor-exit-descriptor %edx 0x10) +13327 # +13328 (write _test-input-stream "fn foo {\n") +13329 (write _test-input-stream " var a: (addr int)\n") +13330 (write _test-input-stream " var c/ecx: (addr int) <- length a, 0\n") +13331 (write _test-input-stream "}\n") +13332 # convert +13333 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13334 # registers except esp clobbered at this point +13335 # restore ed +13336 89/<- %edx 4/r32/esp +13337 (flush _test-output-buffered-file) +13338 (flush _test-error-buffered-file) +13339 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13345 # check output +13346 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-compound-base-type-2: output should be empty") +13347 (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") +13348 # check that stop(1) was called +13349 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-compound-base-type-2: exit status") +13350 # don't restore from ebp +13351 81 0/subop/add %esp 8/imm32 +13352 # . epilogue +13353 5d/pop-to-ebp +13354 c3/return +13355 +13356 test-length-with-array-atom-base-type: +13357 # . prologue +13358 55/push-ebp +13359 89/<- %ebp 4/r32/esp +13360 # setup +13361 (clear-stream _test-input-stream) +13362 (clear-stream $_test-input-buffered-file->buffer) +13363 (clear-stream _test-output-stream) +13364 (clear-stream $_test-output-buffered-file->buffer) +13365 (clear-stream _test-error-stream) +13366 (clear-stream $_test-error-buffered-file->buffer) +13367 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13368 68/push 0/imm32 +13369 68/push 0/imm32 +13370 89/<- %edx 4/r32/esp +13371 (tailor-exit-descriptor %edx 0x10) +13372 # +13373 (write _test-input-stream "fn foo {\n") +13374 (write _test-input-stream " var a: array\n") +13375 (write _test-input-stream " var c/ecx: (addr int) <- length a\n") +13376 (write _test-input-stream "}\n") +13377 # convert +13378 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13379 # registers except esp clobbered at this point +13380 # restore ed +13381 89/<- %edx 4/r32/esp +13382 (flush _test-output-buffered-file) +13383 (flush _test-error-buffered-file) +13384 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13390 # check output +13391 (check-stream-equal _test-output-stream "" "F - test-length-with-array-atom-base-type: output should be empty") +13392 (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") +13393 # check that stop(1) was called +13394 (check-ints-equal *(edx+4) 2 "F - test-length-with-array-atom-base-type: exit status") +13395 # don't restore from ebp +13396 81 0/subop/add %esp 8/imm32 +13397 # . epilogue +13398 5d/pop-to-ebp +13399 c3/return +13400 +13401 test-length-with-addr-base-on-stack: +13402 # . prologue +13403 55/push-ebp +13404 89/<- %ebp 4/r32/esp +13405 # setup +13406 (clear-stream _test-input-stream) +13407 (clear-stream $_test-input-buffered-file->buffer) +13408 (clear-stream _test-output-stream) +13409 (clear-stream $_test-output-buffered-file->buffer) +13410 (clear-stream _test-error-stream) +13411 (clear-stream $_test-error-buffered-file->buffer) +13412 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13413 68/push 0/imm32 +13414 68/push 0/imm32 +13415 89/<- %edx 4/r32/esp +13416 (tailor-exit-descriptor %edx 0x10) +13417 # +13418 (write _test-input-stream "fn foo {\n") +13419 (write _test-input-stream " var a: (addr array int)\n") +13420 (write _test-input-stream " var c/ecx: (addr int) <- length a\n") +13421 (write _test-input-stream "}\n") +13422 # convert +13423 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13424 # registers except esp clobbered at this point +13425 # restore ed +13426 89/<- %edx 4/r32/esp +13427 (flush _test-output-buffered-file) +13428 (flush _test-error-buffered-file) +13429 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13435 # check output +13436 (check-stream-equal _test-output-stream "" "F - test-length-with-addr-base-on-stack: output should be empty") +13437 (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") +13438 # check that stop(1) was called +13439 (check-ints-equal *(edx+4) 2 "F - test-length-with-addr-base-on-stack: exit status") +13440 # don't restore from ebp +13441 81 0/subop/add %esp 8/imm32 +13442 # . epilogue +13443 5d/pop-to-ebp +13444 c3/return +13445 +13446 test-length-with-wrong-output-type: +13447 # . prologue +13448 55/push-ebp +13449 89/<- %ebp 4/r32/esp +13450 # setup +13451 (clear-stream _test-input-stream) +13452 (clear-stream $_test-input-buffered-file->buffer) +13453 (clear-stream _test-output-stream) +13454 (clear-stream $_test-output-buffered-file->buffer) +13455 (clear-stream _test-error-stream) +13456 (clear-stream $_test-error-buffered-file->buffer) +13457 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13458 68/push 0/imm32 +13459 68/push 0/imm32 +13460 89/<- %edx 4/r32/esp +13461 (tailor-exit-descriptor %edx 0x10) +13462 # +13463 (write _test-input-stream "fn foo {\n") +13464 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") +13465 (write _test-input-stream " var o/edi: (addr int) <- length a\n") +13466 (write _test-input-stream "}\n") +13467 # convert +13468 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13469 # registers except esp clobbered at this point +13470 # restore ed +13471 89/<- %edx 4/r32/esp +13472 (flush _test-output-buffered-file) +13473 (flush _test-error-buffered-file) +13474 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13480 # check output +13481 (check-stream-equal _test-output-stream "" "F - test-length-with-wrong-output-type: output should be empty") +13482 (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") +13483 # check that stop(1) was called +13484 (check-ints-equal *(edx+4) 2 "F - test-length-with-wrong-output-type: exit status") +13485 # don't restore from ebp +13486 81 0/subop/add %esp 8/imm32 +13487 # . epilogue +13488 5d/pop-to-ebp +13489 c3/return +13490 +13491 test-length-with-wrong-output-compound-type: +13492 # . prologue +13493 55/push-ebp +13494 89/<- %ebp 4/r32/esp +13495 # setup +13496 (clear-stream _test-input-stream) +13497 (clear-stream $_test-input-buffered-file->buffer) +13498 (clear-stream _test-output-stream) +13499 (clear-stream $_test-output-buffered-file->buffer) +13500 (clear-stream _test-error-stream) +13501 (clear-stream $_test-error-buffered-file->buffer) +13502 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13503 68/push 0/imm32 +13504 68/push 0/imm32 +13505 89/<- %edx 4/r32/esp +13506 (tailor-exit-descriptor %edx 0x10) +13507 # +13508 (write _test-input-stream "fn foo {\n") +13509 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") +13510 (write _test-input-stream " var o/edi: (addr handle int) <- length a\n") +13511 (write _test-input-stream "}\n") +13512 # convert +13513 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13514 # registers except esp clobbered at this point +13515 # restore ed +13516 89/<- %edx 4/r32/esp +13517 (flush _test-output-buffered-file) +13518 (flush _test-error-buffered-file) +13519 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13525 # check output +13526 (check-stream-equal _test-output-stream "" "F - test-length-with-wrong-output-compound-type: output should be empty") +13527 (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") +13528 # check that stop(1) was called +13529 (check-ints-equal *(edx+4) 2 "F - test-length-with-wrong-output-compound-type: exit status") +13530 # don't restore from ebp +13531 81 0/subop/add %esp 8/imm32 +13532 # . epilogue +13533 5d/pop-to-ebp +13534 c3/return +13535 +13536 test-length-with-no-inouts: +13537 # . prologue +13538 55/push-ebp +13539 89/<- %ebp 4/r32/esp +13540 # setup +13541 (clear-stream _test-input-stream) +13542 (clear-stream $_test-input-buffered-file->buffer) +13543 (clear-stream _test-output-stream) +13544 (clear-stream $_test-output-buffered-file->buffer) +13545 (clear-stream _test-error-stream) +13546 (clear-stream $_test-error-buffered-file->buffer) +13547 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13548 68/push 0/imm32 +13549 68/push 0/imm32 +13550 89/<- %edx 4/r32/esp +13551 (tailor-exit-descriptor %edx 0x10) +13552 # +13553 (write _test-input-stream "fn foo {\n") +13554 (write _test-input-stream " var c/ecx: int <- length\n") +13555 (write _test-input-stream "}\n") +13556 # convert +13557 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13558 # registers except esp clobbered at this point +13559 # restore ed +13560 89/<- %edx 4/r32/esp +13561 (flush _test-output-buffered-file) +13562 (flush _test-error-buffered-file) +13563 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13569 # check output +13570 (check-stream-equal _test-output-stream "" "F - test-length-with-no-inouts: output should be empty") +13571 (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") +13572 # check that stop(1) was called +13573 (check-ints-equal *(edx+4) 2 "F - test-length-with-no-inouts: exit status") +13574 # don't restore from ebp +13575 81 0/subop/add %esp 8/imm32 +13576 # . epilogue +13577 5d/pop-to-ebp +13578 c3/return +13579 +13580 test-length-with-too-many-inouts: +13581 # . prologue +13582 55/push-ebp +13583 89/<- %ebp 4/r32/esp +13584 # setup +13585 (clear-stream _test-input-stream) +13586 (clear-stream $_test-input-buffered-file->buffer) +13587 (clear-stream _test-output-stream) +13588 (clear-stream $_test-output-buffered-file->buffer) +13589 (clear-stream _test-error-stream) +13590 (clear-stream $_test-error-buffered-file->buffer) +13591 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13592 68/push 0/imm32 +13593 68/push 0/imm32 13594 89/<- %edx 4/r32/esp -13595 (flush _test-output-buffered-file) -13596 (flush _test-error-buffered-file) -13597 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13603 # check output -13604 (check-stream-equal _test-output-stream "" "F - test-populate-with-no-inout: output should be empty") -13605 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate' must have two inouts" "F - test-populate-with-no-inout: error message") -13606 # check that stop(1) was called -13607 (check-ints-equal *(edx+4) 2 "F - test-populate-with-no-inout: exit status") -13608 # don't restore from ebp -13609 81 0/subop/add %esp 8/imm32 -13610 # . epilogue -13611 5d/pop-to-ebp -13612 c3/return -13613 -13614 test-populate-with-too-many-inouts: -13615 # . prologue -13616 55/push-ebp -13617 89/<- %ebp 4/r32/esp -13618 # setup -13619 (clear-stream _test-input-stream) -13620 (clear-stream $_test-input-buffered-file->buffer) -13621 (clear-stream _test-output-stream) -13622 (clear-stream $_test-output-buffered-file->buffer) -13623 (clear-stream _test-error-stream) -13624 (clear-stream $_test-error-buffered-file->buffer) -13625 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13626 68/push 0/imm32 -13627 68/push 0/imm32 -13628 89/<- %edx 4/r32/esp -13629 (tailor-exit-descriptor %edx 0x10) -13630 # -13631 (write _test-input-stream "fn foo {\n") -13632 (write _test-input-stream " var x: (addr handle int)\n") -13633 (write _test-input-stream " populate x, 3, 0\n") -13634 (write _test-input-stream "}\n") -13635 # convert -13636 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13637 # registers except esp clobbered at this point -13638 # restore ed +13595 (tailor-exit-descriptor %edx 0x10) +13596 # +13597 (write _test-input-stream "fn foo {\n") +13598 (write _test-input-stream " var a: (array int 3)\n") +13599 (write _test-input-stream " var c/ecx: int <- length a, 0, 0\n") +13600 (write _test-input-stream "}\n") +13601 # convert +13602 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13603 # registers except esp clobbered at this point +13604 # restore ed +13605 89/<- %edx 4/r32/esp +13606 (flush _test-output-buffered-file) +13607 (flush _test-error-buffered-file) +13608 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13614 # check output +13615 (check-stream-equal _test-output-stream "" "F - test-length-with-too-many-inouts: output should be empty") +13616 (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") +13617 # check that stop(1) was called +13618 (check-ints-equal *(edx+4) 2 "F - test-length-with-too-many-inouts: exit status") +13619 # don't restore from ebp +13620 81 0/subop/add %esp 8/imm32 +13621 # . epilogue +13622 5d/pop-to-ebp +13623 c3/return +13624 +13625 test-length-with-no-output: +13626 # . prologue +13627 55/push-ebp +13628 89/<- %ebp 4/r32/esp +13629 # setup +13630 (clear-stream _test-input-stream) +13631 (clear-stream $_test-input-buffered-file->buffer) +13632 (clear-stream _test-output-stream) +13633 (clear-stream $_test-output-buffered-file->buffer) +13634 (clear-stream _test-error-stream) +13635 (clear-stream $_test-error-buffered-file->buffer) +13636 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13637 68/push 0/imm32 +13638 68/push 0/imm32 13639 89/<- %edx 4/r32/esp -13640 (flush _test-output-buffered-file) -13641 (flush _test-error-buffered-file) -13642 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13648 # check output -13649 (check-stream-equal _test-output-stream "" "F - test-populate-with-too-many-inouts: output should be empty") -13650 (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") -13651 # check that stop(1) was called -13652 (check-ints-equal *(edx+4) 2 "F - test-populate-with-too-many-inouts: exit status") -13653 # don't restore from ebp -13654 81 0/subop/add %esp 8/imm32 -13655 # . epilogue -13656 5d/pop-to-ebp -13657 c3/return -13658 -13659 test-populate-with-output: -13660 # . prologue -13661 55/push-ebp -13662 89/<- %ebp 4/r32/esp -13663 # setup -13664 (clear-stream _test-input-stream) -13665 (clear-stream $_test-input-buffered-file->buffer) -13666 (clear-stream _test-output-stream) -13667 (clear-stream $_test-output-buffered-file->buffer) -13668 (clear-stream _test-error-stream) -13669 (clear-stream $_test-error-buffered-file->buffer) -13670 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13671 68/push 0/imm32 -13672 68/push 0/imm32 -13673 89/<- %edx 4/r32/esp -13674 (tailor-exit-descriptor %edx 0x10) -13675 # -13676 (write _test-input-stream "fn foo {\n") -13677 (write _test-input-stream " var x/eax: boolean <- copy 0\n") -13678 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") -13679 (write _test-input-stream " x <- populate y\n") -13680 (write _test-input-stream "}\n") -13681 # convert -13682 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13683 # registers except esp clobbered at this point -13684 # restore ed -13685 89/<- %edx 4/r32/esp -13686 (flush _test-output-buffered-file) -13687 (flush _test-error-buffered-file) -13688 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13694 # check output -13695 (check-stream-equal _test-output-stream "" "F - test-populate-with-output: output should be empty") -13696 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate' must not have any outputs" "F - test-populate-with-output: error message") -13697 # check that stop(1) was called -13698 (check-ints-equal *(edx+4) 2 "F - test-populate-with-output: exit status") -13699 # don't restore from ebp -13700 81 0/subop/add %esp 8/imm32 -13701 # . epilogue -13702 5d/pop-to-ebp -13703 c3/return -13704 -13705 test-populate-non-addr: -13706 # . prologue -13707 55/push-ebp -13708 89/<- %ebp 4/r32/esp -13709 # setup -13710 (clear-stream _test-input-stream) -13711 (clear-stream $_test-input-buffered-file->buffer) -13712 (clear-stream _test-output-stream) -13713 (clear-stream $_test-output-buffered-file->buffer) -13714 (clear-stream _test-error-stream) -13715 (clear-stream $_test-error-buffered-file->buffer) -13716 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13717 68/push 0/imm32 -13718 68/push 0/imm32 -13719 89/<- %edx 4/r32/esp -13720 (tailor-exit-descriptor %edx 0x10) -13721 # -13722 (write _test-input-stream "fn foo {\n") -13723 (write _test-input-stream " var y: (handle int)\n") -13724 (write _test-input-stream " populate y, 3\n") -13725 (write _test-input-stream "}\n") -13726 # convert -13727 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13728 # registers except esp clobbered at this point -13729 # restore ed -13730 89/<- %edx 4/r32/esp -13731 (flush _test-output-buffered-file) -13732 (flush _test-error-buffered-file) -13733 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13739 # check output -13740 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr: output must be empty") -13741 (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") -13742 # check that stop(1) was called -13743 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr: exit status") -13744 # don't restore from ebp -13745 81 0/subop/add %esp 8/imm32 -13746 # . epilogue -13747 5d/pop-to-ebp -13748 c3/return -13749 -13750 test-populate-non-addr-handle: -13751 # . prologue -13752 55/push-ebp -13753 89/<- %ebp 4/r32/esp -13754 # setup -13755 (clear-stream _test-input-stream) -13756 (clear-stream $_test-input-buffered-file->buffer) -13757 (clear-stream _test-output-stream) -13758 (clear-stream $_test-output-buffered-file->buffer) -13759 (clear-stream _test-error-stream) -13760 (clear-stream $_test-error-buffered-file->buffer) -13761 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13762 68/push 0/imm32 -13763 68/push 0/imm32 -13764 89/<- %edx 4/r32/esp -13765 (tailor-exit-descriptor %edx 0x10) -13766 # -13767 (write _test-input-stream "fn foo {\n") -13768 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") -13769 (write _test-input-stream " populate y, 3\n") -13770 (write _test-input-stream "}\n") -13771 # convert -13772 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13773 # registers except esp clobbered at this point -13774 # restore ed -13775 89/<- %edx 4/r32/esp -13776 (flush _test-output-buffered-file) -13777 (flush _test-error-buffered-file) -13778 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13784 # check output -13785 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr-handle: output should be empty") -13786 (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") -13787 # check that stop(1) was called -13788 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr-handle: exit status") -13789 # don't restore from ebp -13790 81 0/subop/add %esp 8/imm32 -13791 # . epilogue -13792 5d/pop-to-ebp -13793 c3/return -13794 -13795 test-populate-non-addr-handle-array: -13796 # . prologue -13797 55/push-ebp -13798 89/<- %ebp 4/r32/esp -13799 # setup -13800 (clear-stream _test-input-stream) -13801 (clear-stream $_test-input-buffered-file->buffer) -13802 (clear-stream _test-output-stream) -13803 (clear-stream $_test-output-buffered-file->buffer) -13804 (clear-stream _test-error-stream) -13805 (clear-stream $_test-error-buffered-file->buffer) -13806 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13807 68/push 0/imm32 -13808 68/push 0/imm32 -13809 89/<- %edx 4/r32/esp -13810 (tailor-exit-descriptor %edx 0x10) -13811 # -13812 (write _test-input-stream "fn foo {\n") -13813 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") -13814 (write _test-input-stream " populate y, 3\n") -13815 (write _test-input-stream "}\n") -13816 # convert -13817 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13818 # registers except esp clobbered at this point -13819 # restore ed -13820 89/<- %edx 4/r32/esp -13821 (flush _test-output-buffered-file) -13822 (flush _test-error-buffered-file) -13823 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13829 # check output -13830 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr-handle-array: output should be empty") -13831 (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") -13832 # check that stop(1) was called -13833 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr-handle-array: exit status") -13834 # don't restore from ebp -13835 81 0/subop/add %esp 8/imm32 -13836 # . epilogue -13837 5d/pop-to-ebp -13838 c3/return -13839 -13840 test-populate-deref-address: -13841 # . prologue -13842 55/push-ebp -13843 89/<- %ebp 4/r32/esp -13844 # setup -13845 (clear-stream _test-input-stream) -13846 (clear-stream $_test-input-buffered-file->buffer) -13847 (clear-stream _test-output-stream) -13848 (clear-stream $_test-output-buffered-file->buffer) -13849 # -13850 (write _test-input-stream "fn foo {\n") -13851 (write _test-input-stream " var y/ecx: (addr addr handle array int) <- copy 0\n") -13852 (write _test-input-stream " populate *y, 3\n") -13853 (write _test-input-stream "}\n") -13854 # convert -13855 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -13856 (flush _test-output-buffered-file) -13857 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13863 # not bothering checking output -13864 (check-next-stream-line-equal _test-error-stream "" "F - test-populate-deref-address: error message") -13865 # . epilogue -13866 5d/pop-to-ebp -13867 c3/return -13868 -13869 test-populate-stream-with-no-inout: -13870 # . prologue -13871 55/push-ebp -13872 89/<- %ebp 4/r32/esp -13873 # setup -13874 (clear-stream _test-input-stream) -13875 (clear-stream $_test-input-buffered-file->buffer) -13876 (clear-stream _test-output-stream) -13877 (clear-stream $_test-output-buffered-file->buffer) -13878 (clear-stream _test-error-stream) -13879 (clear-stream $_test-error-buffered-file->buffer) -13880 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13881 68/push 0/imm32 -13882 68/push 0/imm32 -13883 89/<- %edx 4/r32/esp -13884 (tailor-exit-descriptor %edx 0x10) -13885 # -13886 (write _test-input-stream "fn foo {\n") -13887 (write _test-input-stream " populate-stream\n") -13888 (write _test-input-stream "}\n") -13889 # convert -13890 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13891 # registers except esp clobbered at this point -13892 # restore ed -13893 89/<- %edx 4/r32/esp -13894 (flush _test-output-buffered-file) -13895 (flush _test-error-buffered-file) -13896 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13902 # check output -13903 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-no-inout: output should be empty") -13904 (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") -13905 # check that stop(1) was called -13906 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-no-inout: exit status") -13907 # don't restore from ebp -13908 81 0/subop/add %esp 8/imm32 -13909 # . epilogue -13910 5d/pop-to-ebp -13911 c3/return -13912 -13913 test-populate-stream-with-too-many-inouts: -13914 # . prologue -13915 55/push-ebp -13916 89/<- %ebp 4/r32/esp -13917 # setup -13918 (clear-stream _test-input-stream) -13919 (clear-stream $_test-input-buffered-file->buffer) -13920 (clear-stream _test-output-stream) -13921 (clear-stream $_test-output-buffered-file->buffer) -13922 (clear-stream _test-error-stream) -13923 (clear-stream $_test-error-buffered-file->buffer) -13924 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13925 68/push 0/imm32 -13926 68/push 0/imm32 -13927 89/<- %edx 4/r32/esp -13928 (tailor-exit-descriptor %edx 0x10) -13929 # -13930 (write _test-input-stream "fn foo {\n") -13931 (write _test-input-stream " var x: (addr handle int)\n") -13932 (write _test-input-stream " populate-stream x, 3, 0\n") -13933 (write _test-input-stream "}\n") -13934 # convert -13935 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13936 # registers except esp clobbered at this point -13937 # restore ed -13938 89/<- %edx 4/r32/esp -13939 (flush _test-output-buffered-file) -13940 (flush _test-error-buffered-file) -13941 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13947 # check output -13948 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-too-many-inouts: output should be empty") -13949 (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") -13950 # check that stop(1) was called -13951 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-too-many-inouts: exit status") -13952 # don't restore from ebp -13953 81 0/subop/add %esp 8/imm32 -13954 # . epilogue -13955 5d/pop-to-ebp -13956 c3/return -13957 -13958 test-populate-stream-with-output: -13959 # . prologue -13960 55/push-ebp -13961 89/<- %ebp 4/r32/esp -13962 # setup -13963 (clear-stream _test-input-stream) -13964 (clear-stream $_test-input-buffered-file->buffer) -13965 (clear-stream _test-output-stream) -13966 (clear-stream $_test-output-buffered-file->buffer) -13967 (clear-stream _test-error-stream) -13968 (clear-stream $_test-error-buffered-file->buffer) -13969 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13970 68/push 0/imm32 -13971 68/push 0/imm32 -13972 89/<- %edx 4/r32/esp -13973 (tailor-exit-descriptor %edx 0x10) -13974 # -13975 (write _test-input-stream "fn foo {\n") -13976 (write _test-input-stream " var x/eax: boolean <- copy 0\n") -13977 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") -13978 (write _test-input-stream " x <- populate-stream y\n") -13979 (write _test-input-stream "}\n") -13980 # convert -13981 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13982 # registers except esp clobbered at this point -13983 # restore ed -13984 89/<- %edx 4/r32/esp -13985 (flush _test-output-buffered-file) -13986 (flush _test-error-buffered-file) -13987 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -13993 # check output -13994 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-output: output should be empty") -13995 (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") -13996 # check that stop(1) was called -13997 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-output: exit status") -13998 # don't restore from ebp -13999 81 0/subop/add %esp 8/imm32 -14000 # . epilogue -14001 5d/pop-to-ebp -14002 c3/return -14003 -14004 test-populate-stream-non-addr: -14005 # . prologue -14006 55/push-ebp -14007 89/<- %ebp 4/r32/esp -14008 # setup -14009 (clear-stream _test-input-stream) -14010 (clear-stream $_test-input-buffered-file->buffer) -14011 (clear-stream _test-output-stream) -14012 (clear-stream $_test-output-buffered-file->buffer) -14013 (clear-stream _test-error-stream) -14014 (clear-stream $_test-error-buffered-file->buffer) -14015 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14016 68/push 0/imm32 -14017 68/push 0/imm32 -14018 89/<- %edx 4/r32/esp -14019 (tailor-exit-descriptor %edx 0x10) -14020 # -14021 (write _test-input-stream "fn foo {\n") -14022 (write _test-input-stream " var y: (handle int)\n") -14023 (write _test-input-stream " populate-stream y, 3\n") -14024 (write _test-input-stream "}\n") -14025 # convert -14026 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14027 # registers except esp clobbered at this point -14028 # restore ed -14029 89/<- %edx 4/r32/esp -14030 (flush _test-output-buffered-file) -14031 (flush _test-error-buffered-file) -14032 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14038 # check output -14039 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr: output must be empty") -14040 (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") -14041 # check that stop(1) was called -14042 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr: exit status") -14043 # don't restore from ebp -14044 81 0/subop/add %esp 8/imm32 -14045 # . epilogue -14046 5d/pop-to-ebp -14047 c3/return -14048 -14049 test-populate-stream-non-addr-handle: -14050 # . prologue -14051 55/push-ebp -14052 89/<- %ebp 4/r32/esp -14053 # setup -14054 (clear-stream _test-input-stream) -14055 (clear-stream $_test-input-buffered-file->buffer) -14056 (clear-stream _test-output-stream) -14057 (clear-stream $_test-output-buffered-file->buffer) -14058 (clear-stream _test-error-stream) -14059 (clear-stream $_test-error-buffered-file->buffer) -14060 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14061 68/push 0/imm32 -14062 68/push 0/imm32 -14063 89/<- %edx 4/r32/esp -14064 (tailor-exit-descriptor %edx 0x10) -14065 # -14066 (write _test-input-stream "fn foo {\n") -14067 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") -14068 (write _test-input-stream " populate-stream y, 3\n") -14069 (write _test-input-stream "}\n") -14070 # convert -14071 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14072 # registers except esp clobbered at this point -14073 # restore ed -14074 89/<- %edx 4/r32/esp -14075 (flush _test-output-buffered-file) -14076 (flush _test-error-buffered-file) -14077 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14083 # check output -14084 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr-handle: output should be empty") -14085 (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") -14086 # check that stop(1) was called -14087 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr-handle: exit status") -14088 # don't restore from ebp -14089 81 0/subop/add %esp 8/imm32 -14090 # . epilogue -14091 5d/pop-to-ebp -14092 c3/return -14093 -14094 test-populate-stream-non-addr-handle-stream: -14095 # . prologue -14096 55/push-ebp -14097 89/<- %ebp 4/r32/esp -14098 # setup -14099 (clear-stream _test-input-stream) -14100 (clear-stream $_test-input-buffered-file->buffer) -14101 (clear-stream _test-output-stream) -14102 (clear-stream $_test-output-buffered-file->buffer) -14103 (clear-stream _test-error-stream) -14104 (clear-stream $_test-error-buffered-file->buffer) -14105 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14106 68/push 0/imm32 -14107 68/push 0/imm32 -14108 89/<- %edx 4/r32/esp -14109 (tailor-exit-descriptor %edx 0x10) -14110 # -14111 (write _test-input-stream "fn foo {\n") -14112 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") -14113 (write _test-input-stream " populate-stream y, 3\n") -14114 (write _test-input-stream "}\n") -14115 # convert -14116 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14117 # registers except esp clobbered at this point -14118 # restore ed -14119 89/<- %edx 4/r32/esp -14120 (flush _test-output-buffered-file) -14121 (flush _test-error-buffered-file) -14122 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14128 # check output -14129 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr-handle-stream: output should be empty") -14130 (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") -14131 # check that stop(1) was called -14132 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr-handle-stream: exit status") -14133 # don't restore from ebp -14134 81 0/subop/add %esp 8/imm32 -14135 # . epilogue -14136 5d/pop-to-ebp -14137 c3/return -14138 -14139 test-populate-stream-deref-address: -14140 # . prologue -14141 55/push-ebp -14142 89/<- %ebp 4/r32/esp -14143 # setup -14144 (clear-stream _test-input-stream) -14145 (clear-stream $_test-input-buffered-file->buffer) -14146 (clear-stream _test-output-stream) -14147 (clear-stream $_test-output-buffered-file->buffer) -14148 # -14149 (write _test-input-stream "fn foo {\n") -14150 (write _test-input-stream " var y/ecx: (addr addr handle stream int) <- copy 0\n") -14151 (write _test-input-stream " populate-stream *y, 3\n") -14152 (write _test-input-stream "}\n") -14153 # convert -14154 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -14155 (flush _test-output-buffered-file) -14156 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14162 # not bothering checking output -14163 (check-next-stream-line-equal _test-error-stream "" "F - test-populate-stream-deref-address: error message") -14164 # . epilogue -14165 5d/pop-to-ebp -14166 c3/return -14167 -14168 test-convert-with-no-inout: -14169 # . prologue -14170 55/push-ebp -14171 89/<- %ebp 4/r32/esp -14172 # setup -14173 (clear-stream _test-input-stream) -14174 (clear-stream $_test-input-buffered-file->buffer) -14175 (clear-stream _test-output-stream) -14176 (clear-stream $_test-output-buffered-file->buffer) -14177 (clear-stream _test-error-stream) -14178 (clear-stream $_test-error-buffered-file->buffer) -14179 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14180 68/push 0/imm32 -14181 68/push 0/imm32 -14182 89/<- %edx 4/r32/esp -14183 (tailor-exit-descriptor %edx 0x10) -14184 # -14185 (write _test-input-stream "fn foo {\n") -14186 (write _test-input-stream " var x/eax: int <- convert\n") -14187 (write _test-input-stream "}\n") -14188 # convert -14189 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14190 # registers except esp clobbered at this point -14191 # restore ed -14192 89/<- %edx 4/r32/esp -14193 (flush _test-output-buffered-file) -14194 (flush _test-error-buffered-file) -14195 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14201 # check output -14202 (check-stream-equal _test-output-stream "" "F - test-convert-with-no-inout: output should be empty") -14203 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' expects an inout" "F - test-convert-with-no-inout: error message") -14204 # check that stop(1) was called -14205 (check-ints-equal *(edx+4) 2 "F - test-convert-with-no-inout: exit status") -14206 # don't restore from ebp -14207 81 0/subop/add %esp 8/imm32 -14208 # . epilogue -14209 5d/pop-to-ebp -14210 c3/return -14211 -14212 test-convert-with-multiple-inouts: -14213 # . prologue -14214 55/push-ebp -14215 89/<- %ebp 4/r32/esp -14216 # setup -14217 (clear-stream _test-input-stream) -14218 (clear-stream $_test-input-buffered-file->buffer) -14219 (clear-stream _test-output-stream) -14220 (clear-stream $_test-output-buffered-file->buffer) -14221 (clear-stream _test-error-stream) -14222 (clear-stream $_test-error-buffered-file->buffer) -14223 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14224 68/push 0/imm32 -14225 68/push 0/imm32 -14226 89/<- %edx 4/r32/esp -14227 (tailor-exit-descriptor %edx 0x10) -14228 # -14229 (write _test-input-stream "fn foo {\n") -14230 (write _test-input-stream " var x/eax: int <- convert 0, 0\n") -14231 (write _test-input-stream "}\n") -14232 # convert -14233 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14234 # registers except esp clobbered at this point -14235 # restore ed -14236 89/<- %edx 4/r32/esp -14237 (flush _test-output-buffered-file) -14238 (flush _test-error-buffered-file) -14239 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14245 # check output -14246 (check-stream-equal _test-output-stream "" "F - test-convert-with-multiple-inouts: output should be empty") -14247 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' must have just one inout" "F - test-convert-with-multiple-inouts: error message") -14248 # check that stop(1) was called -14249 (check-ints-equal *(edx+4) 2 "F - test-convert-with-multiple-inouts: exit status") -14250 # don't restore from ebp -14251 81 0/subop/add %esp 8/imm32 -14252 # . epilogue -14253 5d/pop-to-ebp -14254 c3/return -14255 -14256 test-convert-with-no-output: -14257 # . prologue -14258 55/push-ebp -14259 89/<- %ebp 4/r32/esp -14260 # setup -14261 (clear-stream _test-input-stream) -14262 (clear-stream $_test-input-buffered-file->buffer) -14263 (clear-stream _test-output-stream) -14264 (clear-stream $_test-output-buffered-file->buffer) -14265 (clear-stream _test-error-stream) -14266 (clear-stream $_test-error-buffered-file->buffer) -14267 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14268 68/push 0/imm32 -14269 68/push 0/imm32 -14270 89/<- %edx 4/r32/esp -14271 (tailor-exit-descriptor %edx 0x10) -14272 # -14273 (write _test-input-stream "fn foo {\n") -14274 (write _test-input-stream " convert 0\n") -14275 (write _test-input-stream "}\n") -14276 # convert -14277 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14278 # registers except esp clobbered at this point -14279 # restore ed -14280 89/<- %edx 4/r32/esp -14281 (flush _test-output-buffered-file) -14282 (flush _test-error-buffered-file) -14283 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14289 # check output -14290 (check-stream-equal _test-output-stream "" "F - test-convert-with-no-output: output should be empty") -14291 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' expects an output" "F - test-convert-with-no-output: error message") -14292 # check that stop(1) was called -14293 (check-ints-equal *(edx+4) 2 "F - test-convert-with-no-output: exit status") -14294 # don't restore from ebp -14295 81 0/subop/add %esp 8/imm32 -14296 # . epilogue -14297 5d/pop-to-ebp -14298 c3/return -14299 -14300 test-convert-with-multiple-outputs: -14301 # . prologue -14302 55/push-ebp -14303 89/<- %ebp 4/r32/esp -14304 # setup -14305 (clear-stream _test-input-stream) -14306 (clear-stream $_test-input-buffered-file->buffer) -14307 (clear-stream _test-output-stream) -14308 (clear-stream $_test-output-buffered-file->buffer) -14309 (clear-stream _test-error-stream) -14310 (clear-stream $_test-error-buffered-file->buffer) -14311 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14312 68/push 0/imm32 -14313 68/push 0/imm32 -14314 89/<- %edx 4/r32/esp -14315 (tailor-exit-descriptor %edx 0x10) -14316 # -14317 (write _test-input-stream "fn foo {\n") -14318 (write _test-input-stream " var x/eax: int <- copy 0\n") -14319 (write _test-input-stream " var y/ecx: int <- copy 0\n") -14320 (write _test-input-stream " x, y <- convert 0\n") -14321 (write _test-input-stream "}\n") -14322 # convert -14323 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14324 # registers except esp clobbered at this point -14325 # restore ed -14326 89/<- %edx 4/r32/esp -14327 (flush _test-output-buffered-file) -14328 (flush _test-error-buffered-file) -14329 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14335 # check output -14336 (check-stream-equal _test-output-stream "" "F - test-convert-with-multiple-outputs: output should be empty") -14337 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' must have just one output" "F - test-convert-with-multiple-outputs: error message") -14338 # check that stop(1) was called -14339 (check-ints-equal *(edx+4) 2 "F - test-convert-with-multiple-outputs: exit status") -14340 # don't restore from ebp -14341 81 0/subop/add %esp 8/imm32 -14342 # . epilogue -14343 5d/pop-to-ebp -14344 c3/return -14345 -14346 test-convert-deref-address: -14347 # . prologue -14348 55/push-ebp -14349 89/<- %ebp 4/r32/esp -14350 # setup -14351 (clear-stream _test-input-stream) -14352 (clear-stream $_test-input-buffered-file->buffer) -14353 (clear-stream _test-output-stream) -14354 (clear-stream $_test-output-buffered-file->buffer) -14355 # -14356 (write _test-input-stream "fn foo {\n") -14357 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") -14358 (write _test-input-stream " var y/xmm4: float <- convert *x\n") -14359 (write _test-input-stream "}\n") -14360 # convert -14361 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -14362 (flush _test-output-buffered-file) -14363 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14369 # not bothering checking output -14370 (check-next-stream-line-equal _test-error-stream "" "F - test-convert-deref-address: error message") -14371 # . epilogue -14372 5d/pop-to-ebp -14373 c3/return -14374 -14375 test-convert-to-non-register: -14376 # . prologue -14377 55/push-ebp -14378 89/<- %ebp 4/r32/esp -14379 # setup -14380 (clear-stream _test-input-stream) -14381 (clear-stream $_test-input-buffered-file->buffer) -14382 (clear-stream _test-output-stream) -14383 (clear-stream $_test-output-buffered-file->buffer) -14384 (clear-stream _test-error-stream) -14385 (clear-stream $_test-error-buffered-file->buffer) -14386 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14387 68/push 0/imm32 -14388 68/push 0/imm32 -14389 89/<- %edx 4/r32/esp -14390 (tailor-exit-descriptor %edx 0x10) -14391 # -14392 (write _test-input-stream "fn foo {\n") -14393 (write _test-input-stream " var x: float\n") -14394 (write _test-input-stream " var y: int\n") -14395 (write _test-input-stream " x <- convert y\n") -14396 (write _test-input-stream "}\n") -14397 # convert -14398 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14399 # registers except esp clobbered at this point -14400 # restore ed -14401 89/<- %edx 4/r32/esp -14402 (flush _test-output-buffered-file) -14403 (flush _test-error-buffered-file) -14404 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14410 # check output -14411 (check-stream-equal _test-output-stream "" "F - test-convert-to-non-register: output should be empty") -14412 (check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: output 'x' not in a register" "F - test-convert-to-non-register: error message") -14413 # check that stop(1) was called -14414 (check-ints-equal *(edx+4) 2 "F - test-convert-to-non-register: exit status") -14415 # don't restore from ebp -14416 81 0/subop/add %esp 8/imm32 -14417 # . epilogue -14418 5d/pop-to-ebp -14419 c3/return -14420 -14421 test-convert-invalid-inout-type: -14422 # . prologue -14423 55/push-ebp -14424 89/<- %ebp 4/r32/esp -14425 # setup -14426 (clear-stream _test-input-stream) -14427 (clear-stream $_test-input-buffered-file->buffer) -14428 (clear-stream _test-output-stream) -14429 (clear-stream $_test-output-buffered-file->buffer) -14430 (clear-stream _test-error-stream) -14431 (clear-stream $_test-error-buffered-file->buffer) -14432 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14433 68/push 0/imm32 -14434 68/push 0/imm32 -14435 89/<- %edx 4/r32/esp -14436 (tailor-exit-descriptor %edx 0x10) -14437 # -14438 (write _test-input-stream "fn foo {\n") -14439 (write _test-input-stream " var x: boolean\n") -14440 (write _test-input-stream " var y/xmm1: float <- convert x\n") -14441 (write _test-input-stream "}\n") -14442 # convert -14443 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14444 # registers except esp clobbered at this point -14445 # restore ed -14446 89/<- %edx 4/r32/esp -14447 (flush _test-output-buffered-file) -14448 (flush _test-error-buffered-file) -14449 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14455 # check output -14456 (check-stream-equal _test-output-stream "" "F - test-convert-invalid-inout-type: output should be empty") -14457 (check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: inout 'x' must be an int or float" "F - test-convert-invalid-inout-type: error message") -14458 # check that stop(1) was called -14459 (check-ints-equal *(edx+4) 2 "F - test-convert-invalid-inout-type: exit status") -14460 # don't restore from ebp -14461 81 0/subop/add %esp 8/imm32 -14462 # . epilogue -14463 5d/pop-to-ebp -14464 c3/return -14465 -14466 test-convert-invalid-output-type: -14467 # . prologue -14468 55/push-ebp -14469 89/<- %ebp 4/r32/esp -14470 # setup -14471 (clear-stream _test-input-stream) -14472 (clear-stream $_test-input-buffered-file->buffer) -14473 (clear-stream _test-output-stream) -14474 (clear-stream $_test-output-buffered-file->buffer) -14475 (clear-stream _test-error-stream) -14476 (clear-stream $_test-error-buffered-file->buffer) -14477 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14478 68/push 0/imm32 -14479 68/push 0/imm32 -14480 89/<- %edx 4/r32/esp -14481 (tailor-exit-descriptor %edx 0x10) -14482 # -14483 (write _test-input-stream "fn foo {\n") -14484 (write _test-input-stream " var x: float\n") -14485 (write _test-input-stream " var y/eax: boolean <- convert x\n") -14486 (write _test-input-stream "}\n") -14487 # convert -14488 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14489 # registers except esp clobbered at this point -14490 # restore ed -14491 89/<- %edx 4/r32/esp -14492 (flush _test-output-buffered-file) -14493 (flush _test-error-buffered-file) -14494 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14500 # check output -14501 (check-stream-equal _test-output-stream "" "F - test-convert-invalid-output-type: output should be empty") -14502 (check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: output 'y' must be an int or float" "F - test-convert-invalid-output-type: error message") -14503 # check that stop(1) was called -14504 (check-ints-equal *(edx+4) 2 "F - test-convert-invalid-output-type: exit status") -14505 # don't restore from ebp -14506 81 0/subop/add %esp 8/imm32 -14507 # . epilogue -14508 5d/pop-to-ebp -14509 c3/return -14510 -14511 test-convert-int-to-int: -14512 # . prologue -14513 55/push-ebp -14514 89/<- %ebp 4/r32/esp -14515 # setup -14516 (clear-stream _test-input-stream) -14517 (clear-stream $_test-input-buffered-file->buffer) -14518 (clear-stream _test-output-stream) -14519 (clear-stream $_test-output-buffered-file->buffer) -14520 (clear-stream _test-error-stream) -14521 (clear-stream $_test-error-buffered-file->buffer) -14522 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14523 68/push 0/imm32 -14524 68/push 0/imm32 -14525 89/<- %edx 4/r32/esp -14526 (tailor-exit-descriptor %edx 0x10) -14527 # -14528 (write _test-input-stream "fn foo {\n") -14529 (write _test-input-stream " var x: int\n") -14530 (write _test-input-stream " var y/eax: int <- convert x\n") -14531 (write _test-input-stream "}\n") -14532 # convert -14533 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14534 # registers except esp clobbered at this point -14535 # restore ed -14536 89/<- %edx 4/r32/esp -14537 (flush _test-output-buffered-file) -14538 (flush _test-error-buffered-file) -14539 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14545 # check output -14546 (check-stream-equal _test-output-stream "" "F - test-convert-int-to-int: output should be empty") -14547 (check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: no need to convert int to int" "F - test-convert-int-to-int: error message") -14548 # check that stop(1) was called -14549 (check-ints-equal *(edx+4) 2 "F - test-convert-int-to-int: exit status") -14550 # don't restore from ebp -14551 81 0/subop/add %esp 8/imm32 -14552 # . epilogue -14553 5d/pop-to-ebp -14554 c3/return -14555 -14556 test-convert-float-to-float: -14557 # . prologue -14558 55/push-ebp -14559 89/<- %ebp 4/r32/esp -14560 # setup -14561 (clear-stream _test-input-stream) -14562 (clear-stream $_test-input-buffered-file->buffer) -14563 (clear-stream _test-output-stream) -14564 (clear-stream $_test-output-buffered-file->buffer) -14565 (clear-stream _test-error-stream) -14566 (clear-stream $_test-error-buffered-file->buffer) -14567 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -14568 68/push 0/imm32 -14569 68/push 0/imm32 -14570 89/<- %edx 4/r32/esp -14571 (tailor-exit-descriptor %edx 0x10) -14572 # -14573 (write _test-input-stream "fn foo {\n") -14574 (write _test-input-stream " var x: float\n") -14575 (write _test-input-stream " var y/xmm6: float <- convert x\n") -14576 (write _test-input-stream "}\n") -14577 # convert -14578 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -14579 # registers except esp clobbered at this point -14580 # restore ed -14581 89/<- %edx 4/r32/esp -14582 (flush _test-output-buffered-file) -14583 (flush _test-error-buffered-file) -14584 +-- 6 lines: #? # dump _test-error-stream ---------------------------------------------------------------------------------------------------------------------------------------- -14590 # check output -14591 (check-stream-equal _test-output-stream "" "F - test-convert-float-to-float: output should be empty") -14592 (check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: no need to convert float to float" "F - test-convert-float-to-float: error message") -14593 # check that stop(1) was called -14594 (check-ints-equal *(edx+4) 2 "F - test-convert-float-to-float: exit status") -14595 # don't restore from ebp -14596 81 0/subop/add %esp 8/imm32 -14597 # . epilogue -14598 5d/pop-to-ebp -14599 c3/return -14600 -14601 ####################################################### -14602 # Parsing -14603 ####################################################### -14604 -14605 == data -14606 -14607 # Global state added to each var record when parsing a function -14608 Next-block-index: # (addr int) -14609 1/imm32 -14610 -14611 Curr-block-depth: # (addr int) -14612 1/imm32 -14613 -14614 == code +13640 (tailor-exit-descriptor %edx 0x10) +13641 # +13642 (write _test-input-stream "fn foo {\n") +13643 (write _test-input-stream " var a: (array int 3)\n") +13644 (write _test-input-stream " length a\n") +13645 (write _test-input-stream "}\n") +13646 # convert +13647 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13648 # registers except esp clobbered at this point +13649 # restore ed +13650 89/<- %edx 4/r32/esp +13651 (flush _test-output-buffered-file) +13652 (flush _test-error-buffered-file) +13653 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13659 # check output +13660 (check-stream-equal _test-output-stream "" "F - test-length-with-no-output: output should be empty") +13661 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: must have an output" "F - test-length-with-no-output: error message") +13662 # check that stop(1) was called +13663 (check-ints-equal *(edx+4) 2 "F - test-length-with-no-output: exit status") +13664 # don't restore from ebp +13665 81 0/subop/add %esp 8/imm32 +13666 # . epilogue +13667 5d/pop-to-ebp +13668 c3/return +13669 +13670 test-length-with-too-many-outputs: +13671 # . prologue +13672 55/push-ebp +13673 89/<- %ebp 4/r32/esp +13674 # setup +13675 (clear-stream _test-input-stream) +13676 (clear-stream $_test-input-buffered-file->buffer) +13677 (clear-stream _test-output-stream) +13678 (clear-stream $_test-output-buffered-file->buffer) +13679 (clear-stream _test-error-stream) +13680 (clear-stream $_test-error-buffered-file->buffer) +13681 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13682 68/push 0/imm32 +13683 68/push 0/imm32 +13684 89/<- %edx 4/r32/esp +13685 (tailor-exit-descriptor %edx 0x10) +13686 # +13687 (write _test-input-stream "fn foo {\n") +13688 (write _test-input-stream " var a: (array int 3)\n") +13689 (write _test-input-stream " var b/eax: int <- copy 0\n") +13690 (write _test-input-stream " var c/ecx: int <- copy 0\n") +13691 (write _test-input-stream " b, c <- length a\n") +13692 (write _test-input-stream "}\n") +13693 # convert +13694 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13695 # registers except esp clobbered at this point +13696 # restore ed +13697 89/<- %edx 4/r32/esp +13698 (flush _test-output-buffered-file) +13699 (flush _test-error-buffered-file) +13700 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13706 # check output +13707 (check-stream-equal _test-output-stream "" "F - test-length-with-too-many-outputs: output should be empty") +13708 (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") +13709 # check that stop(1) was called +13710 (check-ints-equal *(edx+4) 2 "F - test-length-with-too-many-outputs: exit status") +13711 # don't restore from ebp +13712 81 0/subop/add %esp 8/imm32 +13713 # . epilogue +13714 5d/pop-to-ebp +13715 c3/return +13716 +13717 test-convert-function-with-return-register-and-local: +13718 # . prologue +13719 55/push-ebp +13720 89/<- %ebp 4/r32/esp +13721 # setup +13722 (clear-stream _test-input-stream) +13723 (clear-stream $_test-input-buffered-file->buffer) +13724 (clear-stream _test-output-stream) +13725 (clear-stream $_test-output-buffered-file->buffer) +13726 # +13727 (write _test-input-stream "fn foo -> _/eax: int {\n") +13728 (write _test-input-stream " var y/eax: int <- copy 3\n") +13729 (write _test-input-stream " var z/ecx: int <- copy 4\n") +13730 (write _test-input-stream " return y\n") +13731 (write _test-input-stream "}\n") +13732 # convert +13733 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +13734 (flush _test-output-buffered-file) +13735 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +13741 # check output +13742 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register-and-local/0") +13743 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register-and-local/1") +13744 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register-and-local/2") +13745 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register-and-local/3") +13746 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register-and-local/4") +13747 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register-and-local/5") +13748 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register-and-local/6") +13749 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-register-and-local/7") +13750 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-return-register-and-local/8") +13751 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-convert-function-with-return-register-and-local/9") +13752 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-return-register-and-local/10") +13753 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-return-register-and-local/11") +13754 (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") +13755 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-register-and-local/13") +13756 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register-and-local/14") +13757 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register-and-local/15") +13758 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register-and-local/16") +13759 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register-and-local/17") +13760 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register-and-local/18") +13761 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register-and-local/19") +13762 # . epilogue +13763 89/<- %esp 5/r32/ebp +13764 5d/pop-to-ebp +13765 c3/return +13766 +13767 test-convert-function-with-return-register-and-local-2: +13768 # . prologue +13769 55/push-ebp +13770 89/<- %ebp 4/r32/esp +13771 # setup +13772 (clear-stream _test-input-stream) +13773 (clear-stream $_test-input-buffered-file->buffer) +13774 (clear-stream _test-output-stream) +13775 (clear-stream $_test-output-buffered-file->buffer) +13776 # +13777 (write _test-input-stream "fn foo -> _/eax: int {\n") +13778 (write _test-input-stream " var y/eax: int <- copy 3\n") +13779 (write _test-input-stream " var z/ecx: int <- copy 4\n") +13780 (write _test-input-stream " return z\n") +13781 (write _test-input-stream "}\n") +13782 # convert +13783 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +13784 (flush _test-output-buffered-file) +13785 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +13791 # check output +13792 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register-and-local-2/0") +13793 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register-and-local-2/1") +13794 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register-and-local-2/2") +13795 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register-and-local-2/3") +13796 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register-and-local-2/4") +13797 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register-and-local-2/5") +13798 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register-and-local-2/6") +13799 (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") +13800 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-return-register-and-local-2/8") +13801 (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") +13802 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000000/r32" "F - test-convert-function-with-return-register-and-local-2/10") +13803 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-return-register-and-local-2/11") +13804 (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") +13805 (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") +13806 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register-and-local-2/14") +13807 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register-and-local-2/15") +13808 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register-and-local-2/16") +13809 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register-and-local-2/17") +13810 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register-and-local-2/18") +13811 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register-and-local-2/19") +13812 # . epilogue +13813 89/<- %esp 5/r32/ebp +13814 5d/pop-to-ebp +13815 c3/return +13816 +13817 test-convert-function-with-return-float-register-and-local: +13818 # . prologue +13819 55/push-ebp +13820 89/<- %ebp 4/r32/esp +13821 # setup +13822 (clear-stream _test-input-stream) +13823 (clear-stream $_test-input-buffered-file->buffer) +13824 (clear-stream _test-output-stream) +13825 (clear-stream $_test-output-buffered-file->buffer) +13826 # +13827 (write _test-input-stream "fn foo -> _/xmm1: float {\n") +13828 (write _test-input-stream " var y/eax: int <- copy 3\n") +13829 (write _test-input-stream " var g/xmm0: float <- convert y\n") +13830 (write _test-input-stream " var h/xmm1: float <- convert y\n") +13831 (write _test-input-stream " return g\n") +13832 (write _test-input-stream "}\n") +13833 # convert +13834 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +13835 (flush _test-output-buffered-file) +13836 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +13842 # check output +13843 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-float-register-and-local/0") +13844 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-float-register-and-local/1") +13845 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-float-register-and-local/2") +13846 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-float-register-and-local/3") +13847 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-float-register-and-local/4") +13848 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-float-register-and-local/5") +13849 (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 +13850 (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") +13851 (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 +13852 (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") +13853 (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") +13854 (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 +13855 (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") +13856 (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") +13857 (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 +13858 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/15") # reclaim h +13859 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 0/x32" "F - test-convert-floating-point-dereferenced/16") # reclaim g +13860 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/17") +13861 (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 +13862 (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") +13863 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-float-register-and-local/20") +13864 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-float-register-and-local/21") +13865 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-float-register-and-local/22") +13866 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-float-register-and-local/23") +13867 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-float-register-and-local/24") +13868 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-float-register-and-local/25") +13869 # . epilogue +13870 89/<- %esp 5/r32/ebp +13871 5d/pop-to-ebp +13872 c3/return +13873 +13874 test-convert-function-with-return-and-local-vars: +13875 # . prologue +13876 55/push-ebp +13877 89/<- %ebp 4/r32/esp +13878 # setup +13879 (clear-stream _test-input-stream) +13880 (clear-stream $_test-input-buffered-file->buffer) +13881 (clear-stream _test-output-stream) +13882 (clear-stream $_test-output-buffered-file->buffer) +13883 # +13884 (write _test-input-stream "fn foo -> _/eax: int {\n") +13885 (write _test-input-stream " {\n") +13886 (write _test-input-stream " var x: int\n") +13887 (write _test-input-stream " {\n") +13888 (write _test-input-stream " var y: int\n") +13889 (write _test-input-stream " return y\n") +13890 (write _test-input-stream " increment x\n") +13891 (write _test-input-stream " }\n") +13892 (write _test-input-stream " }\n") +13893 (write _test-input-stream " return 0\n") +13894 (write _test-input-stream "}\n") +13895 # convert +13896 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +13897 (flush _test-output-buffered-file) +13898 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +13904 # check output +13905 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-and-local-vars/0") +13906 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-and-local-vars/1") +13907 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-and-local-vars/2") +13908 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-and-local-vars/3") +13909 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/4") +13910 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-and-local-vars/5") +13911 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/6") +13912 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-return-and-local-vars/7") +13913 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-return-and-local-vars/8") # var x +13914 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/9") +13915 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-return-and-local-vars/10") +13916 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-return-and-local-vars/11") # var y +13917 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-with-return-and-local-vars/12") +13918 (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") +13919 (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") +13920 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-and-local-vars/15") +13921 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/16") +13922 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-return-and-local-vars/17") +13923 (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") +13924 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/19") +13925 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-return-and-local-vars/20") +13926 (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") +13927 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-and-local-vars/21") +13928 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/21") +13929 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-and-local-vars/22") +13930 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-and-local-vars/23") +13931 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-and-local-vars/24") +13932 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-and-local-vars/25") +13933 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-and-local-vars/26") +13934 # . epilogue +13935 89/<- %esp 5/r32/ebp +13936 5d/pop-to-ebp +13937 c3/return +13938 +13939 test-copy-object-with-no-inout: +13940 # . prologue +13941 55/push-ebp +13942 89/<- %ebp 4/r32/esp +13943 # setup +13944 (clear-stream _test-input-stream) +13945 (clear-stream $_test-input-buffered-file->buffer) +13946 (clear-stream _test-output-stream) +13947 (clear-stream $_test-output-buffered-file->buffer) +13948 (clear-stream _test-error-stream) +13949 (clear-stream $_test-error-buffered-file->buffer) +13950 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13951 68/push 0/imm32 +13952 68/push 0/imm32 +13953 89/<- %edx 4/r32/esp +13954 (tailor-exit-descriptor %edx 0x10) +13955 # +13956 (write _test-input-stream "fn foo {\n") +13957 (write _test-input-stream " copy-object\n") +13958 (write _test-input-stream "}\n") +13959 # convert +13960 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13961 # registers except esp clobbered at this point +13962 # restore ed +13963 89/<- %edx 4/r32/esp +13964 (flush _test-output-buffered-file) +13965 (flush _test-error-buffered-file) +13966 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +13972 # check output +13973 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-no-inout: output should be empty") +13974 (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") +13975 # check that stop(1) was called +13976 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-no-inout: exit status") +13977 # don't restore from ebp +13978 81 0/subop/add %esp 8/imm32 +13979 # . epilogue +13980 5d/pop-to-ebp +13981 c3/return +13982 +13983 test-copy-object-with-no-source: +13984 # . prologue +13985 55/push-ebp +13986 89/<- %ebp 4/r32/esp +13987 # setup +13988 (clear-stream _test-input-stream) +13989 (clear-stream $_test-input-buffered-file->buffer) +13990 (clear-stream _test-output-stream) +13991 (clear-stream $_test-output-buffered-file->buffer) +13992 (clear-stream _test-error-stream) +13993 (clear-stream $_test-error-buffered-file->buffer) +13994 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13995 68/push 0/imm32 +13996 68/push 0/imm32 +13997 89/<- %edx 4/r32/esp +13998 (tailor-exit-descriptor %edx 0x10) +13999 # +14000 (write _test-input-stream "fn foo {\n") +14001 (write _test-input-stream " var x: (addr int)\n") +14002 (write _test-input-stream " copy-object x\n") +14003 (write _test-input-stream "}\n") +14004 # convert +14005 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14006 # registers except esp clobbered at this point +14007 # restore ed +14008 89/<- %edx 4/r32/esp +14009 (flush _test-output-buffered-file) +14010 (flush _test-error-buffered-file) +14011 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14017 # check output +14018 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-no-source: output should be empty") +14019 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-object' must have two inouts" "F - test-copy-object-with-no-source: error message") +14020 # check that stop(1) was called +14021 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-no-source: exit status") +14022 # don't restore from ebp +14023 81 0/subop/add %esp 8/imm32 +14024 # . epilogue +14025 5d/pop-to-ebp +14026 c3/return +14027 +14028 test-copy-object-with-too-many-inouts: +14029 # . prologue +14030 55/push-ebp +14031 89/<- %ebp 4/r32/esp +14032 # setup +14033 (clear-stream _test-input-stream) +14034 (clear-stream $_test-input-buffered-file->buffer) +14035 (clear-stream _test-output-stream) +14036 (clear-stream $_test-output-buffered-file->buffer) +14037 (clear-stream _test-error-stream) +14038 (clear-stream $_test-error-buffered-file->buffer) +14039 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14040 68/push 0/imm32 +14041 68/push 0/imm32 +14042 89/<- %edx 4/r32/esp +14043 (tailor-exit-descriptor %edx 0x10) +14044 # +14045 (write _test-input-stream "fn foo {\n") +14046 (write _test-input-stream " var x: (addr boolean)\n") +14047 (write _test-input-stream " copy-object x, x, x\n") +14048 (write _test-input-stream "}\n") +14049 # convert +14050 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14051 # registers except esp clobbered at this point +14052 # restore ed +14053 89/<- %edx 4/r32/esp +14054 (flush _test-output-buffered-file) +14055 (flush _test-error-buffered-file) +14056 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14062 # check output +14063 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-too-many-inouts: output should be empty") +14064 (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") +14065 # check that stop(1) was called +14066 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-too-many-inouts: exit status") +14067 # don't restore from ebp +14068 81 0/subop/add %esp 8/imm32 +14069 # . epilogue +14070 5d/pop-to-ebp +14071 c3/return +14072 +14073 test-copy-object-with-output: +14074 # . prologue +14075 55/push-ebp +14076 89/<- %ebp 4/r32/esp +14077 # setup +14078 (clear-stream _test-input-stream) +14079 (clear-stream $_test-input-buffered-file->buffer) +14080 (clear-stream _test-output-stream) +14081 (clear-stream $_test-output-buffered-file->buffer) +14082 (clear-stream _test-error-stream) +14083 (clear-stream $_test-error-buffered-file->buffer) +14084 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14085 68/push 0/imm32 +14086 68/push 0/imm32 +14087 89/<- %edx 4/r32/esp +14088 (tailor-exit-descriptor %edx 0x10) +14089 # +14090 (write _test-input-stream "fn foo {\n") +14091 (write _test-input-stream " var x/eax: (addr boolean) <- copy 0\n") +14092 (write _test-input-stream " var y/ecx: (addr boolean) <- copy 0\n") +14093 (write _test-input-stream " x <- copy-object x, y\n") +14094 (write _test-input-stream "}\n") +14095 # convert +14096 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14097 # registers except esp clobbered at this point +14098 # restore ed +14099 89/<- %edx 4/r32/esp +14100 (flush _test-output-buffered-file) +14101 (flush _test-error-buffered-file) +14102 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14108 # check output +14109 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-output: output should be empty") +14110 (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") +14111 # check that stop(1) was called +14112 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-output: exit status") +14113 # don't restore from ebp +14114 81 0/subop/add %esp 8/imm32 +14115 # . epilogue +14116 5d/pop-to-ebp +14117 c3/return +14118 +14119 test-copy-object-deref-address: +14120 # . prologue +14121 55/push-ebp +14122 89/<- %ebp 4/r32/esp +14123 # setup +14124 (clear-stream _test-input-stream) +14125 (clear-stream $_test-input-buffered-file->buffer) +14126 (clear-stream _test-output-stream) +14127 (clear-stream $_test-output-buffered-file->buffer) +14128 # +14129 (write _test-input-stream "fn foo {\n") +14130 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") +14131 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") +14132 (write _test-input-stream " copy-object *y, x\n") +14133 (write _test-input-stream "}\n") +14134 # convert +14135 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +14136 (flush _test-output-buffered-file) +14137 # no errors +14138 # . epilogue +14139 5d/pop-to-ebp +14140 c3/return +14141 +14142 test-copy-object-non-addr: +14143 # . prologue +14144 55/push-ebp +14145 89/<- %ebp 4/r32/esp +14146 # setup +14147 (clear-stream _test-input-stream) +14148 (clear-stream $_test-input-buffered-file->buffer) +14149 (clear-stream _test-output-stream) +14150 (clear-stream $_test-output-buffered-file->buffer) +14151 (clear-stream _test-error-stream) +14152 (clear-stream $_test-error-buffered-file->buffer) +14153 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14154 68/push 0/imm32 +14155 68/push 0/imm32 +14156 89/<- %edx 4/r32/esp +14157 (tailor-exit-descriptor %edx 0x10) +14158 # +14159 (write _test-input-stream "fn foo {\n") +14160 (write _test-input-stream " var x: int\n") +14161 (write _test-input-stream " var y: int\n") +14162 (write _test-input-stream " copy-object y, x\n") +14163 (write _test-input-stream "}\n") +14164 # convert +14165 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14166 # registers except esp clobbered at this point +14167 # restore ed +14168 89/<- %edx 4/r32/esp +14169 (flush _test-output-buffered-file) +14170 (flush _test-error-buffered-file) +14171 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14177 # check output +14178 (check-stream-equal _test-output-stream "" "F - test-copy-object-non-addr: output should be empty") +14179 (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") +14180 # check that stop(1) was called +14181 (check-ints-equal *(edx+4) 2 "F - test-copy-object-non-addr: exit status") +14182 # don't restore from ebp +14183 81 0/subop/add %esp 8/imm32 +14184 # . epilogue +14185 5d/pop-to-ebp +14186 c3/return +14187 +14188 test-copy-object-non-equal: +14189 # . prologue +14190 55/push-ebp +14191 89/<- %ebp 4/r32/esp +14192 # setup +14193 (clear-stream _test-input-stream) +14194 (clear-stream $_test-input-buffered-file->buffer) +14195 (clear-stream _test-output-stream) +14196 (clear-stream $_test-output-buffered-file->buffer) +14197 (clear-stream _test-error-stream) +14198 (clear-stream $_test-error-buffered-file->buffer) +14199 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14200 68/push 0/imm32 +14201 68/push 0/imm32 +14202 89/<- %edx 4/r32/esp +14203 (tailor-exit-descriptor %edx 0x10) +14204 # +14205 (write _test-input-stream "fn foo {\n") +14206 (write _test-input-stream " var x: (addr int)\n") +14207 (write _test-input-stream " var y: (addr boolean)\n") +14208 (write _test-input-stream " copy-object y, x\n") +14209 (write _test-input-stream "}\n") +14210 # convert +14211 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14212 # registers except esp clobbered at this point +14213 # restore ed +14214 89/<- %edx 4/r32/esp +14215 (flush _test-output-buffered-file) +14216 (flush _test-error-buffered-file) +14217 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14223 # check output +14224 (check-stream-equal _test-output-stream "" "F - test-copy-object-non-equal: output should be empty") +14225 (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") +14226 # check that stop(1) was called +14227 (check-ints-equal *(edx+4) 2 "F - test-copy-object-non-equal: exit status") +14228 # don't restore from ebp +14229 81 0/subop/add %esp 8/imm32 +14230 # . epilogue +14231 5d/pop-to-ebp +14232 c3/return +14233 +14234 test-allocate-with-no-inout: +14235 # . prologue +14236 55/push-ebp +14237 89/<- %ebp 4/r32/esp +14238 # setup +14239 (clear-stream _test-input-stream) +14240 (clear-stream $_test-input-buffered-file->buffer) +14241 (clear-stream _test-output-stream) +14242 (clear-stream $_test-output-buffered-file->buffer) +14243 (clear-stream _test-error-stream) +14244 (clear-stream $_test-error-buffered-file->buffer) +14245 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14246 68/push 0/imm32 +14247 68/push 0/imm32 +14248 89/<- %edx 4/r32/esp +14249 (tailor-exit-descriptor %edx 0x10) +14250 # +14251 (write _test-input-stream "fn foo {\n") +14252 (write _test-input-stream " allocate\n") +14253 (write _test-input-stream "}\n") +14254 # convert +14255 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14256 # registers except esp clobbered at this point +14257 # restore ed +14258 89/<- %edx 4/r32/esp +14259 (flush _test-output-buffered-file) +14260 (flush _test-error-buffered-file) +14261 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14267 # check output +14268 (check-stream-equal _test-output-stream "" "F - test-allocate-with-no-inout: output should be empty") +14269 (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") +14270 # check that stop(1) was called +14271 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-no-inout: exit status") +14272 # don't restore from ebp +14273 81 0/subop/add %esp 8/imm32 +14274 # . epilogue +14275 5d/pop-to-ebp +14276 c3/return +14277 +14278 test-allocate-with-too-many-inouts: +14279 # . prologue +14280 55/push-ebp +14281 89/<- %ebp 4/r32/esp +14282 # setup +14283 (clear-stream _test-input-stream) +14284 (clear-stream $_test-input-buffered-file->buffer) +14285 (clear-stream _test-output-stream) +14286 (clear-stream $_test-output-buffered-file->buffer) +14287 (clear-stream _test-error-stream) +14288 (clear-stream $_test-error-buffered-file->buffer) +14289 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14290 68/push 0/imm32 +14291 68/push 0/imm32 +14292 89/<- %edx 4/r32/esp +14293 (tailor-exit-descriptor %edx 0x10) +14294 # +14295 (write _test-input-stream "fn foo {\n") +14296 (write _test-input-stream " var x: (addr handle int)\n") +14297 (write _test-input-stream " allocate x, 0\n") +14298 (write _test-input-stream "}\n") +14299 # convert +14300 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14301 # registers except esp clobbered at this point +14302 # restore ed +14303 89/<- %edx 4/r32/esp +14304 (flush _test-output-buffered-file) +14305 (flush _test-error-buffered-file) +14306 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14312 # check output +14313 (check-stream-equal _test-output-stream "" "F - test-allocate-with-too-many-inouts: output should be empty") +14314 (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") +14315 # check that stop(1) was called +14316 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-too-many-inouts: exit status") +14317 # don't restore from ebp +14318 81 0/subop/add %esp 8/imm32 +14319 # . epilogue +14320 5d/pop-to-ebp +14321 c3/return +14322 +14323 test-allocate-with-output: +14324 # . prologue +14325 55/push-ebp +14326 89/<- %ebp 4/r32/esp +14327 # setup +14328 (clear-stream _test-input-stream) +14329 (clear-stream $_test-input-buffered-file->buffer) +14330 (clear-stream _test-output-stream) +14331 (clear-stream $_test-output-buffered-file->buffer) +14332 (clear-stream _test-error-stream) +14333 (clear-stream $_test-error-buffered-file->buffer) +14334 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14335 68/push 0/imm32 +14336 68/push 0/imm32 +14337 89/<- %edx 4/r32/esp +14338 (tailor-exit-descriptor %edx 0x10) +14339 # +14340 (write _test-input-stream "fn foo {\n") +14341 (write _test-input-stream " var x/eax: boolean <- copy 0\n") +14342 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") +14343 (write _test-input-stream " x <- allocate y\n") +14344 (write _test-input-stream "}\n") +14345 # convert +14346 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14347 # registers except esp clobbered at this point +14348 # restore ed +14349 89/<- %edx 4/r32/esp +14350 (flush _test-output-buffered-file) +14351 (flush _test-error-buffered-file) +14352 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14358 # check output +14359 (check-stream-equal _test-output-stream "" "F - test-allocate-with-output: output should be empty") +14360 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'allocate' must not have any outputs" "F - test-allocate-with-output: error message") +14361 # check that stop(1) was called +14362 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-output: exit status") +14363 # don't restore from ebp +14364 81 0/subop/add %esp 8/imm32 +14365 # . epilogue +14366 5d/pop-to-ebp +14367 c3/return +14368 +14369 test-allocate-non-addr: +14370 # . prologue +14371 55/push-ebp +14372 89/<- %ebp 4/r32/esp +14373 # setup +14374 (clear-stream _test-input-stream) +14375 (clear-stream $_test-input-buffered-file->buffer) +14376 (clear-stream _test-output-stream) +14377 (clear-stream $_test-output-buffered-file->buffer) +14378 (clear-stream _test-error-stream) +14379 (clear-stream $_test-error-buffered-file->buffer) +14380 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14381 68/push 0/imm32 +14382 68/push 0/imm32 +14383 89/<- %edx 4/r32/esp +14384 (tailor-exit-descriptor %edx 0x10) +14385 # +14386 (write _test-input-stream "fn foo {\n") +14387 (write _test-input-stream " var y: (handle int)\n") +14388 (write _test-input-stream " allocate y\n") +14389 (write _test-input-stream "}\n") +14390 # convert +14391 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14392 # registers except esp clobbered at this point +14393 # restore ed +14394 89/<- %edx 4/r32/esp +14395 (flush _test-output-buffered-file) +14396 (flush _test-error-buffered-file) +14397 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14403 # check output +14404 (check-stream-equal _test-output-stream "" "F - test-allocate-non-addr: output must be empty") +14405 (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") +14406 # check that stop(1) was called +14407 (check-ints-equal *(edx+4) 2 "F - test-allocate-non-addr: exit status") +14408 # don't restore from ebp +14409 81 0/subop/add %esp 8/imm32 +14410 # . epilogue +14411 5d/pop-to-ebp +14412 c3/return +14413 +14414 test-allocate-non-addr-handle: +14415 # . prologue +14416 55/push-ebp +14417 89/<- %ebp 4/r32/esp +14418 # setup +14419 (clear-stream _test-input-stream) +14420 (clear-stream $_test-input-buffered-file->buffer) +14421 (clear-stream _test-output-stream) +14422 (clear-stream $_test-output-buffered-file->buffer) +14423 (clear-stream _test-error-stream) +14424 (clear-stream $_test-error-buffered-file->buffer) +14425 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14426 68/push 0/imm32 +14427 68/push 0/imm32 +14428 89/<- %edx 4/r32/esp +14429 (tailor-exit-descriptor %edx 0x10) +14430 # +14431 (write _test-input-stream "fn foo {\n") +14432 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") +14433 (write _test-input-stream " allocate y\n") +14434 (write _test-input-stream "}\n") +14435 # convert +14436 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14437 # registers except esp clobbered at this point +14438 # restore ed +14439 89/<- %edx 4/r32/esp +14440 (flush _test-output-buffered-file) +14441 (flush _test-error-buffered-file) +14442 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14448 # check output +14449 (check-stream-equal _test-output-stream "" "F - test-allocate-non-addr-handle: output should be empty") +14450 (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") +14451 # check that stop(1) was called +14452 (check-ints-equal *(edx+4) 2 "F - test-allocate-non-addr-handle: exit status") +14453 # don't restore from ebp +14454 81 0/subop/add %esp 8/imm32 +14455 # . epilogue +14456 5d/pop-to-ebp +14457 c3/return +14458 +14459 test-allocate-deref-address: +14460 # . prologue +14461 55/push-ebp +14462 89/<- %ebp 4/r32/esp +14463 # setup +14464 (clear-stream _test-input-stream) +14465 (clear-stream $_test-input-buffered-file->buffer) +14466 (clear-stream _test-output-stream) +14467 (clear-stream $_test-output-buffered-file->buffer) +14468 # +14469 (write _test-input-stream "fn foo {\n") +14470 (write _test-input-stream " var y/ecx: (addr addr handle int) <- copy 0\n") +14471 (write _test-input-stream " allocate *y\n") +14472 (write _test-input-stream "}\n") +14473 # convert +14474 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +14475 (flush _test-output-buffered-file) +14476 # no errors +14477 # . epilogue +14478 5d/pop-to-ebp +14479 c3/return +14480 +14481 test-populate-with-no-inout: +14482 # . prologue +14483 55/push-ebp +14484 89/<- %ebp 4/r32/esp +14485 # setup +14486 (clear-stream _test-input-stream) +14487 (clear-stream $_test-input-buffered-file->buffer) +14488 (clear-stream _test-output-stream) +14489 (clear-stream $_test-output-buffered-file->buffer) +14490 (clear-stream _test-error-stream) +14491 (clear-stream $_test-error-buffered-file->buffer) +14492 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14493 68/push 0/imm32 +14494 68/push 0/imm32 +14495 89/<- %edx 4/r32/esp +14496 (tailor-exit-descriptor %edx 0x10) +14497 # +14498 (write _test-input-stream "fn foo {\n") +14499 (write _test-input-stream " populate\n") +14500 (write _test-input-stream "}\n") +14501 # convert +14502 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14503 # registers except esp clobbered at this point +14504 # restore ed +14505 89/<- %edx 4/r32/esp +14506 (flush _test-output-buffered-file) +14507 (flush _test-error-buffered-file) +14508 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14514 # check output +14515 (check-stream-equal _test-output-stream "" "F - test-populate-with-no-inout: output should be empty") +14516 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate' must have two inouts" "F - test-populate-with-no-inout: error message") +14517 # check that stop(1) was called +14518 (check-ints-equal *(edx+4) 2 "F - test-populate-with-no-inout: exit status") +14519 # don't restore from ebp +14520 81 0/subop/add %esp 8/imm32 +14521 # . epilogue +14522 5d/pop-to-ebp +14523 c3/return +14524 +14525 test-populate-with-too-many-inouts: +14526 # . prologue +14527 55/push-ebp +14528 89/<- %ebp 4/r32/esp +14529 # setup +14530 (clear-stream _test-input-stream) +14531 (clear-stream $_test-input-buffered-file->buffer) +14532 (clear-stream _test-output-stream) +14533 (clear-stream $_test-output-buffered-file->buffer) +14534 (clear-stream _test-error-stream) +14535 (clear-stream $_test-error-buffered-file->buffer) +14536 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14537 68/push 0/imm32 +14538 68/push 0/imm32 +14539 89/<- %edx 4/r32/esp +14540 (tailor-exit-descriptor %edx 0x10) +14541 # +14542 (write _test-input-stream "fn foo {\n") +14543 (write _test-input-stream " var x: (addr handle int)\n") +14544 (write _test-input-stream " populate x, 3, 0\n") +14545 (write _test-input-stream "}\n") +14546 # convert +14547 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14548 # registers except esp clobbered at this point +14549 # restore ed +14550 89/<- %edx 4/r32/esp +14551 (flush _test-output-buffered-file) +14552 (flush _test-error-buffered-file) +14553 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14559 # check output +14560 (check-stream-equal _test-output-stream "" "F - test-populate-with-too-many-inouts: output should be empty") +14561 (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") +14562 # check that stop(1) was called +14563 (check-ints-equal *(edx+4) 2 "F - test-populate-with-too-many-inouts: exit status") +14564 # don't restore from ebp +14565 81 0/subop/add %esp 8/imm32 +14566 # . epilogue +14567 5d/pop-to-ebp +14568 c3/return +14569 +14570 test-populate-with-output: +14571 # . prologue +14572 55/push-ebp +14573 89/<- %ebp 4/r32/esp +14574 # setup +14575 (clear-stream _test-input-stream) +14576 (clear-stream $_test-input-buffered-file->buffer) +14577 (clear-stream _test-output-stream) +14578 (clear-stream $_test-output-buffered-file->buffer) +14579 (clear-stream _test-error-stream) +14580 (clear-stream $_test-error-buffered-file->buffer) +14581 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14582 68/push 0/imm32 +14583 68/push 0/imm32 +14584 89/<- %edx 4/r32/esp +14585 (tailor-exit-descriptor %edx 0x10) +14586 # +14587 (write _test-input-stream "fn foo {\n") +14588 (write _test-input-stream " var x/eax: boolean <- copy 0\n") +14589 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") +14590 (write _test-input-stream " x <- populate y\n") +14591 (write _test-input-stream "}\n") +14592 # convert +14593 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14594 # registers except esp clobbered at this point +14595 # restore ed +14596 89/<- %edx 4/r32/esp +14597 (flush _test-output-buffered-file) +14598 (flush _test-error-buffered-file) +14599 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14605 # check output +14606 (check-stream-equal _test-output-stream "" "F - test-populate-with-output: output should be empty") +14607 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate' must not have any outputs" "F - test-populate-with-output: error message") +14608 # check that stop(1) was called +14609 (check-ints-equal *(edx+4) 2 "F - test-populate-with-output: exit status") +14610 # don't restore from ebp +14611 81 0/subop/add %esp 8/imm32 +14612 # . epilogue +14613 5d/pop-to-ebp +14614 c3/return 14615 -14616 parse-mu: # in: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) -14617 # pseudocode -14618 # var curr-function: (addr handle function) = Program->functions -14619 # var curr-signature: (addr handle function) = Program->signatures -14620 # var curr-type: (addr handle typeinfo) = Program->types -14621 # var line: (stream byte 512) -14622 # var word-slice: slice -14623 # while true # line loop -14624 # clear-stream(line) -14625 # read-line-buffered(in, line) -14626 # if (line->write == 0) break # end of file -14627 # word-slice = next-mu-token(line) -14628 # if slice-empty?(word-slice) # end of line -14629 # continue -14630 # else if slice-starts-with?(word-slice, "#") # comment -14631 # continue # end of line -14632 # else if slice-equal?(word-slice, "fn") -14633 # var new-function: (handle function) = allocate(function) -14634 # var vars: (stack live-var 256) -14635 # populate-mu-function-header(line, new-function, vars) -14636 # populate-mu-function-body(in, new-function, vars) -14637 # assert(vars->top == 0) -14638 # *curr-function = new-function -14639 # curr-function = &new-function->next -14640 # else if slice-equal?(word-slice, "sig") -14641 # var new-function: (handle function) = allocate(function) -14642 # populate-mu-function-signature(line, new-function) -14643 # *curr-signature = new-function -14644 # curr-signature = &new-function->next -14645 # else if slice-equal?(word-slice, "type") -14646 # word-slice = next-mu-token(line) -14647 # type-id = pos-or-insert-slice(Type-id, word-slice) -14648 # var new-type: (handle typeinfo) = find-or-create-typeinfo(type-id) -14649 # assert(next-word(line) == "{") -14650 # populate-mu-type(in, new-type) -14651 # else -14652 # abort() -14653 # -14654 # . prologue -14655 55/push-ebp -14656 89/<- %ebp 4/r32/esp -14657 # var curr-signature: (addr handle function) at *(ebp-4) -14658 68/push _Program-signatures/imm32 -14659 # . save registers -14660 50/push-eax -14661 51/push-ecx -14662 52/push-edx -14663 53/push-ebx -14664 56/push-esi -14665 57/push-edi -14666 # var line/ecx: (stream byte 512) -14667 81 5/subop/subtract %esp 0x200/imm32 -14668 68/push 0x200/imm32/size -14669 68/push 0/imm32/read -14670 68/push 0/imm32/write -14671 89/<- %ecx 4/r32/esp -14672 # var word-slice/edx: slice -14673 68/push 0/imm32/end -14674 68/push 0/imm32/start +14616 test-populate-non-addr: +14617 # . prologue +14618 55/push-ebp +14619 89/<- %ebp 4/r32/esp +14620 # setup +14621 (clear-stream _test-input-stream) +14622 (clear-stream $_test-input-buffered-file->buffer) +14623 (clear-stream _test-output-stream) +14624 (clear-stream $_test-output-buffered-file->buffer) +14625 (clear-stream _test-error-stream) +14626 (clear-stream $_test-error-buffered-file->buffer) +14627 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14628 68/push 0/imm32 +14629 68/push 0/imm32 +14630 89/<- %edx 4/r32/esp +14631 (tailor-exit-descriptor %edx 0x10) +14632 # +14633 (write _test-input-stream "fn foo {\n") +14634 (write _test-input-stream " var y: (handle int)\n") +14635 (write _test-input-stream " populate y, 3\n") +14636 (write _test-input-stream "}\n") +14637 # convert +14638 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14639 # registers except esp clobbered at this point +14640 # restore ed +14641 89/<- %edx 4/r32/esp +14642 (flush _test-output-buffered-file) +14643 (flush _test-error-buffered-file) +14644 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14650 # check output +14651 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr: output must be empty") +14652 (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") +14653 # check that stop(1) was called +14654 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr: exit status") +14655 # don't restore from ebp +14656 81 0/subop/add %esp 8/imm32 +14657 # . epilogue +14658 5d/pop-to-ebp +14659 c3/return +14660 +14661 test-populate-non-addr-handle: +14662 # . prologue +14663 55/push-ebp +14664 89/<- %ebp 4/r32/esp +14665 # setup +14666 (clear-stream _test-input-stream) +14667 (clear-stream $_test-input-buffered-file->buffer) +14668 (clear-stream _test-output-stream) +14669 (clear-stream $_test-output-buffered-file->buffer) +14670 (clear-stream _test-error-stream) +14671 (clear-stream $_test-error-buffered-file->buffer) +14672 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14673 68/push 0/imm32 +14674 68/push 0/imm32 14675 89/<- %edx 4/r32/esp -14676 # var curr-function/edi: (addr handle function) -14677 bf/copy-to-edi _Program-functions/imm32 -14678 # var vars/ebx: (stack live-var 256) -14679 81 5/subop/subtract %esp 0xc00/imm32 -14680 68/push 0xc00/imm32/size -14681 68/push 0/imm32/top -14682 89/<- %ebx 4/r32/esp -14683 { -14684 $parse-mu:line-loop: -14685 (clear-stream %ecx) -14686 (read-line-buffered *(ebp+8) %ecx) -14687 # if (line->write == 0) break -14688 81 7/subop/compare *ecx 0/imm32 -14689 0f 84/jump-if-= break/disp32 -14690 +-- 6 lines: #? # dump line ---------------------------------------------------------------------------------------------------------------------------------------------------- -14696 (next-mu-token %ecx %edx) -14697 # if slice-empty?(word-slice) continue -14698 (slice-empty? %edx) # => eax -14699 3d/compare-eax-and 0/imm32/false -14700 0f 85/jump-if-!= loop/disp32 -14701 # if (*word-slice->start == "#") continue -14702 # . eax = *word-slice->start -14703 8b/-> *edx 0/r32/eax -14704 8a/copy-byte *eax 0/r32/AL -14705 81 4/subop/and %eax 0xff/imm32 -14706 # . if (eax == '#') continue -14707 3d/compare-eax-and 0x23/imm32/hash -14708 0f 84/jump-if-= loop/disp32 -14709 # if (slice-equal?(word-slice, "fn")) parse a function -14710 { -14711 $parse-mu:fn: -14712 (slice-equal? %edx "fn") # => eax -14713 3d/compare-eax-and 0/imm32/false -14714 0f 84/jump-if-= break/disp32 -14715 # var new-function/esi: (handle function) -14716 68/push 0/imm32 -14717 68/push 0/imm32 -14718 89/<- %esi 4/r32/esp -14719 # populate-mu-function(line, in, vars, new-function) -14720 (allocate Heap *Function-size %esi) -14721 # var new-function-addr/eax: (addr function) -14722 (lookup *esi *(esi+4)) # => eax -14723 # initialize vars -14724 (clear-stack %ebx) -14725 # -14726 (populate-mu-function-header %ecx %eax %ebx *(ebp+0xc) *(ebp+0x10)) -14727 (populate-mu-function-body *(ebp+8) %eax %ebx *(ebp+0xc) *(ebp+0x10)) -14728 # *curr-function = new-function -14729 8b/-> *esi 0/r32/eax -14730 89/<- *edi 0/r32/eax -14731 8b/-> *(esi+4) 0/r32/eax -14732 89/<- *(edi+4) 0/r32/eax -14733 # curr-function = &new-function->next -14734 # . var tmp/eax: (addr function) = lookup(new-function) -14735 (lookup *esi *(esi+4)) # => eax -14736 # . curr-function = &tmp->next -14737 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next -14738 # reclaim new-function -14739 81 0/subop/add %esp 8/imm32 -14740 # -14741 e9/jump $parse-mu:line-loop/disp32 -14742 } -14743 # if (slice-equal?(word-slice, "sig")) parse a function signature -14744 # Function signatures are for providing types to SubX functions. -14745 { -14746 $parse-mu:sig: -14747 (slice-equal? %edx "sig") # => eax -14748 3d/compare-eax-and 0/imm32/false -14749 0f 84/jump-if-= break/disp32 -14750 # edi = curr-function -14751 57/push-edi -14752 8b/-> *(ebp-4) 7/r32/edi -14753 # var new-function/esi: (handle function) -14754 68/push 0/imm32 -14755 68/push 0/imm32 -14756 89/<- %esi 4/r32/esp -14757 # populate-mu-function(line, in, vars, new-function) -14758 (allocate Heap *Function-size %esi) -14759 # var new-function-addr/eax: (addr function) -14760 (lookup *esi *(esi+4)) # => eax -14761 # -14762 (populate-mu-function-signature %ecx %eax *(ebp+0xc) *(ebp+0x10)) -14763 # *curr-signature = new-function -14764 8b/-> *esi 0/r32/eax -14765 89/<- *edi 0/r32/eax -14766 8b/-> *(esi+4) 0/r32/eax -14767 89/<- *(edi+4) 0/r32/eax -14768 # curr-signature = &new-function->next -14769 # . var tmp/eax: (addr function) = lookup(new-function) -14770 (lookup *esi *(esi+4)) # => eax -14771 # . curr-function = &tmp->next -14772 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next -14773 # reclaim new-function -14774 81 0/subop/add %esp 8/imm32 -14775 # save curr-function -14776 89/<- *(ebp-4) 7/r32/edi -14777 # restore edi -14778 5f/pop-to-edi -14779 # -14780 e9/jump $parse-mu:line-loop/disp32 -14781 } -14782 # if (slice-equal?(word-slice, "type")) parse a type (struct/record) definition -14783 { -14784 $parse-mu:type: -14785 (slice-equal? %edx "type") # => eax -14786 3d/compare-eax-and 0/imm32 -14787 0f 84/jump-if-= break/disp32 -14788 (next-mu-token %ecx %edx) -14789 # var type-id/eax: int -14790 (pos-or-insert-slice Type-id %edx) # => eax -14791 # spill -14792 51/push-ecx -14793 # var new-type/ecx: (handle typeinfo) -14794 68/push 0/imm32 -14795 68/push 0/imm32 -14796 89/<- %ecx 4/r32/esp -14797 (find-or-create-typeinfo %eax %ecx) -14798 # -14799 (lookup *ecx *(ecx+4)) # => eax -14800 # TODO: ensure that 'line' has nothing else but '{' -14801 #? (dump-typeinfos "=== aaa\n") -14802 (populate-mu-type *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) # => eax -14803 #? (dump-typeinfos "=== zzz\n") -14804 # reclaim new-type -14805 81 0/subop/add %esp 8/imm32 -14806 # restore -14807 59/pop-to-ecx -14808 e9/jump $parse-mu:line-loop/disp32 -14809 } -14810 # otherwise abort -14811 e9/jump $parse-mu:error1/disp32 -14812 } # end line loop -14813 $parse-mu:end: -14814 # . reclaim locals -14815 81 0/subop/add %esp 0x20c/imm32 # line -14816 81 0/subop/add %esp 0xc08/imm32 # vars -14817 81 0/subop/add %esp 8/imm32 -14818 # . restore registers -14819 5f/pop-to-edi -14820 5e/pop-to-esi -14821 5b/pop-to-ebx -14822 5a/pop-to-edx -14823 59/pop-to-ecx -14824 58/pop-to-eax -14825 # . reclaim local -14826 81 0/subop/add %esp 4/imm32 -14827 # . epilogue -14828 89/<- %esp 5/r32/ebp -14829 5d/pop-to-ebp -14830 c3/return -14831 -14832 $parse-mu:error1: -14833 # error("unexpected top-level command: " word-slice "\n") -14834 (write-buffered *(ebp+0xc) "unexpected top-level command: ") -14835 (write-slice-buffered *(ebp+0xc) %edx) -14836 (write-buffered *(ebp+0xc) "\n") -14837 (flush *(ebp+0xc)) -14838 (stop *(ebp+0x10) 1) -14839 # never gets here -14840 -14841 $parse-mu:error2: -14842 # error(vars->top " vars not reclaimed after fn '" new-function->name "'\n") -14843 (write-int32-hex-buffered *(ebp+0xc) *ebx) -14844 (write-buffered *(ebp+0xc) " vars not reclaimed after fn '") -14845 (write-slice-buffered *(ebp+0xc) *eax) # Function-name -14846 (write-buffered *(ebp+0xc) "'\n") -14847 (flush *(ebp+0xc)) -14848 (stop *(ebp+0x10) 1) -14849 # never gets here -14850 -14851 # scenarios considered: -14852 # ✗ fn foo # no block -14853 # ✓ fn foo { -14854 # ✗ fn foo { { -14855 # ✗ fn foo { } -14856 # ✗ fn foo { } { -14857 # ✗ fn foo x { -14858 # ✗ fn foo x: { -14859 # ✓ fn foo x: int { -14860 # ✓ fn foo x: int { -14861 # ✓ fn foo x: int -> _/eax: int { -14862 # TODO: -14863 # disallow outputs of type `(... addr ...)` -14864 # disallow inputs of type `(... addr ... addr ...)` -14865 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) -14866 # pseudocode: -14867 # var word-slice: slice -14868 # next-mu-token(first-line, word-slice) -14869 # if slice-empty?(word-slice) abort -14870 # assert(word-slice not in '{' '}' '->') -14871 # out->name = slice-to-string(word-slice) -14872 # ## inouts -14873 # while true -14874 # word-slice = next-mu-token(first-line) -14875 # if slice-empty?(word-slice) abort -14876 # if (word-slice == '{') goto done -14877 # if (word-slice == '->') break -14878 # assert(word-slice != '}') -14879 # var v: (handle var) = parse-var-with-type(word-slice, first-line) -14880 # assert(v->register == null) -14881 # # v->block-depth is implicitly 0 -14882 # out->inouts = append(v, out->inouts) -14883 # push(vars, {v, false}) -14884 # ## outputs -14885 # while true -14886 # word-slice = next-mu-token(first-line) -14887 # if slice-empty?(word-slice) abort -14888 # if (word-slice == '{') break -14889 # assert(word-slice not in '}' '->') -14890 # var v: (handle var) = parse-var-with-type(word-slice, first-line) -14891 # assert(v->register != null) -14892 # assert(v->name == "_") -14893 # out->outputs = append(v, out->outputs) -14894 # done: -14895 # -14896 # . prologue -14897 55/push-ebp -14898 89/<- %ebp 4/r32/esp -14899 # . save registers -14900 50/push-eax -14901 51/push-ecx -14902 52/push-edx -14903 53/push-ebx -14904 57/push-edi -14905 # edi = out -14906 8b/-> *(ebp+0xc) 7/r32/edi -14907 # var word-slice/ecx: slice -14908 68/push 0/imm32/end -14909 68/push 0/imm32/start -14910 89/<- %ecx 4/r32/esp -14911 # var v/ebx: (handle var) -14912 68/push 0/imm32 -14913 68/push 0/imm32 -14914 89/<- %ebx 4/r32/esp -14915 # read function name -14916 (next-mu-token *(ebp+8) %ecx) -14917 # error checking -14918 # if slice-empty?(word-slice) abort -14919 (slice-empty? %ecx) # => eax -14920 3d/compare-eax-and 0/imm32/false -14921 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -14922 # if (word-slice == '{') abort -14923 (slice-equal? %ecx "{") # => eax -14924 3d/compare-eax-and 0/imm32/false -14925 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -14926 # if (word-slice == '->') abort -14927 (slice-equal? %ecx "->") # => eax -14928 3d/compare-eax-and 0/imm32/false -14929 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -14930 # if (word-slice == '}') abort -14931 (slice-equal? %ecx "}") # => eax -14932 3d/compare-eax-and 0/imm32/false -14933 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -14934 # if word-slice already defined, abort -14935 (function-exists? %ecx) # => eax -14936 3d/compare-eax-and 0/imm32/false -14937 0f 85/jump-if-!= $populate-mu-function-header:error-duplicate/disp32 -14938 # -14939 (slice-starts-with? %ecx "break") # => eax -14940 3d/compare-eax-and 0/imm32/false -14941 0f 85/jump-if-!= $populate-mu-function-header:error-break/disp32 -14942 (slice-starts-with? %ecx "loop") # => eax -14943 3d/compare-eax-and 0/imm32/false -14944 0f 85/jump-if-!= $populate-mu-function-header:error-loop/disp32 -14945 (slice-equal? %ecx "lookup") # => eax -14946 3d/compare-eax-and 0/imm32/false -14947 0f 85/jump-if-!= $populate-mu-function-header:error-lookup/disp32 -14948 # save function name -14949 (slice-to-string Heap %ecx %edi) # Function-name -14950 # save function inouts -14951 { -14952 $populate-mu-function-header:check-for-inout: -14953 (next-mu-token *(ebp+8) %ecx) -14954 # if slice-empty?(word-slice) abort -14955 (slice-empty? %ecx) # => eax -14956 3d/compare-eax-and 0/imm32/false -14957 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -14958 # if (word-slice == '{') goto done -14959 (slice-equal? %ecx "{") # => eax -14960 3d/compare-eax-and 0/imm32/false -14961 0f 85/jump-if-!= $populate-mu-function-header:done/disp32 -14962 # if (word-slice == '->') break -14963 (slice-equal? %ecx "->") # => eax -14964 3d/compare-eax-and 0/imm32/false -14965 0f 85/jump-if-!= break/disp32 -14966 # if (word-slice == '}') abort -14967 (slice-equal? %ecx "}") # => eax -14968 3d/compare-eax-and 0/imm32/false -14969 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -14970 # v = parse-var-with-type(word-slice, first-line) -14971 (lookup *edi *(edi+4)) # Function-name Function-name => eax -14972 (parse-var-with-type %ecx *(ebp+8) %ebx %eax *(ebp+0x14) *(ebp+0x18)) -14973 # if (v->register != null) abort -14974 # . eax: (addr var) = lookup(v) -14975 (lookup *ebx *(ebx+4)) # => eax -14976 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -14977 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32 -14978 # if function name is not "main" -14979 # and v->type contains an 'addr' anywhere except the start, abort -14980 { -14981 (lookup *edi *(edi+4)) # Function-name Function-name => eax -14982 (string-equal? %eax "main") # => eax -14983 3d/compare-eax-and 0/imm32/false -14984 75/jump-if-!= break/disp8 -14985 (lookup *ebx *(ebx+4)) # => eax -14986 (addr-payload-contains-addr? %eax) # => eax -14987 3d/compare-eax-and 0/imm32/false -14988 0f 85/jump-if-!= $populate-mu-function-header:error-nested-addr-inout/disp32 -14989 } -14990 # v->block-depth is implicitly 0 -14991 # -14992 # out->inouts = append(v, out->inouts) -14993 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts -14994 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts -14995 # push(vars, {v, false}) -14996 (push *(ebp+0x10) *ebx) -14997 (push *(ebp+0x10) *(ebx+4)) -14998 (push *(ebp+0x10) 0) # false -14999 # -15000 e9/jump loop/disp32 -15001 } -15002 # save function outputs -15003 { -15004 $populate-mu-function-header:check-for-out: -15005 (next-mu-token *(ebp+8) %ecx) -15006 # if slice-empty?(word-slice) abort -15007 (slice-empty? %ecx) # => eax -15008 3d/compare-eax-and 0/imm32/false -15009 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -15010 # if (word-slice == '{') break -15011 (slice-equal? %ecx "{") # => eax -15012 3d/compare-eax-and 0/imm32/false -15013 0f 85/jump-if-!= break/disp32 -15014 # if (word-slice == '->') abort -15015 (slice-equal? %ecx "->") # => eax -15016 3d/compare-eax-and 0/imm32/false -15017 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -15018 # if (word-slice == '}') abort -15019 (slice-equal? %ecx "}") # => eax -15020 3d/compare-eax-and 0/imm32/false -15021 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -15022 # v = parse-var-with-type(word-slice, first-line) -15023 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15024 (parse-var-with-type %ecx *(ebp+8) %ebx %eax *(ebp+0x14) *(ebp+0x18)) -15025 # assert(var->register != null) -15026 # . eax: (addr var) = lookup(v) -15027 (lookup *ebx *(ebx+4)) # => eax -15028 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -15029 0f 84/jump-if-= $populate-mu-function-header:error3/disp32 -15030 # if (var->name != "_") abort -15031 (lookup *eax *(eax+4)) # Var-name Var-name => eax -15032 (string-equal? %eax "_") # => eax -15033 3d/compare-eax-and 0/imm32/false -15034 0f 84/jump-if-= $populate-mu-function-header:error4/disp32 -15035 # if v->type is an addr, abort -15036 (lookup *ebx *(ebx+4)) # => eax -15037 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -15038 (is-mu-addr-type? %eax) # => eax -15039 3d/compare-eax-and 0/imm32/false -15040 0f 85/jump-if-!= $populate-mu-function-header:error-addr-output/disp32 -15041 # out->outputs = append(v, out->outputs) -15042 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs -15043 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs -15044 # -15045 e9/jump loop/disp32 -15046 } -15047 $populate-mu-function-header:done: -15048 (check-no-tokens-left *(ebp+8)) -15049 $populate-mu-function-header:end: -15050 # . reclaim locals -15051 81 0/subop/add %esp 0x10/imm32 -15052 # . restore registers -15053 5f/pop-to-edi -15054 5b/pop-to-ebx -15055 5a/pop-to-edx -15056 59/pop-to-ecx -15057 58/pop-to-eax -15058 # . epilogue -15059 89/<- %esp 5/r32/ebp -15060 5d/pop-to-ebp -15061 c3/return -15062 -15063 $populate-mu-function-header:error1: -15064 # error("function header not in form 'fn <name> {'") -15065 (write-buffered *(ebp+0x14) "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '") -15066 (flush *(ebp+0x14)) -15067 (rewind-stream *(ebp+8)) -15068 (write-stream-data *(ebp+0x14) *(ebp+8)) -15069 (write-buffered *(ebp+0x14) "'\n") -15070 (flush *(ebp+0x14)) -15071 (stop *(ebp+0x18) 1) -15072 # never gets here -15073 -15074 $populate-mu-function-header:error2: -15075 # error("fn " fn ": function inout '" var "' cannot be in a register") -15076 (write-buffered *(ebp+0x14) "fn ") -15077 50/push-eax -15078 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15079 (write-buffered *(ebp+0x14) %eax) -15080 58/pop-to-eax -15081 (write-buffered *(ebp+0x14) ": function inout '") -15082 (lookup *eax *(eax+4)) # Var-name Var-name => eax -15083 (write-buffered *(ebp+0x14) %eax) -15084 (write-buffered *(ebp+0x14) "' cannot be in a register") -15085 (flush *(ebp+0x14)) -15086 (stop *(ebp+0x18) 1) -15087 # never gets here -15088 -15089 $populate-mu-function-header:error3: -15090 # error("fn " fn ": function output '" var "' must be in a register") -15091 (write-buffered *(ebp+0x14) "fn ") -15092 50/push-eax -15093 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15094 (write-buffered *(ebp+0x14) %eax) -15095 58/pop-to-eax -15096 (write-buffered *(ebp+0x14) ": function output '") -15097 (lookup *ebx *(ebx+4)) # => eax -15098 (lookup *eax *(eax+4)) # Var-name Var-name => eax -15099 (write-buffered *(ebp+0x14) %eax) -15100 (write-buffered *(ebp+0x14) "' must be in a register, in instruction '") -15101 (rewind-stream *(ebp+8)) -15102 (write-stream-data *(ebp+0x14) *(ebp+8)) -15103 (write-buffered *(ebp+0x14) "'\n") -15104 (flush *(ebp+0x14)) -15105 (stop *(ebp+0x18) 1) -15106 # never gets here -15107 -15108 $populate-mu-function-header:error4: -15109 # error("fn " fn ": function outputs cannot be named; rename '" var "' in the header to '_'") -15110 (write-buffered *(ebp+0x14) "fn ") -15111 50/push-eax -15112 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15113 (write-buffered *(ebp+0x14) %eax) -15114 58/pop-to-eax -15115 (write-buffered *(ebp+0x14) ": function outputs cannot be named; rename '") -15116 (lookup *ebx *(ebx+4)) # => eax -15117 (lookup *eax *(eax+4)) # Var-name Var-name => eax -15118 (write-buffered *(ebp+0x14) %eax) -15119 (write-buffered *(ebp+0x14) "' in the header to '_'\n") -15120 (flush *(ebp+0x14)) -15121 (stop *(ebp+0x18) 1) -15122 # never gets here -15123 -15124 $populate-mu-function-header:error-duplicate: -15125 (write-buffered *(ebp+0x14) "fn ") -15126 (write-slice-buffered *(ebp+0x14) %ecx) -15127 (write-buffered *(ebp+0x14) " defined more than once\n") -15128 (flush *(ebp+0x14)) -15129 (stop *(ebp+0x18) 1) -15130 # never gets here -15131 -15132 $populate-mu-function-header:error-break: -15133 (write-buffered *(ebp+0x14) "Sorry, I've reserved all function names starting with 'break' for now. Please contact mu@akkartik.com.\n") -15134 (flush *(ebp+0x14)) -15135 (stop *(ebp+0x18) 1) -15136 # never gets here -15137 -15138 $populate-mu-function-header:error-loop: -15139 (write-buffered *(ebp+0x14) "Sorry, I've reserved all function names starting with 'loop' for now. Please contact mu@akkartik.com.\n") -15140 (flush *(ebp+0x14)) -15141 (stop *(ebp+0x18) 1) -15142 # never gets here -15143 -15144 $populate-mu-function-header:error-lookup: -15145 (write-buffered *(ebp+0x14) "cannot define a function called 'lookup'\n") -15146 (flush *(ebp+0x14)) -15147 (stop *(ebp+0x18) 1) -15148 # never gets here -15149 -15150 $populate-mu-function-header:error-addr-output: -15151 # error("fn " fn ": output cannot have an addr type; that could allow unsafe addresses to escape the function") -15152 (write-buffered *(ebp+0x14) "fn ") -15153 50/push-eax -15154 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15155 (write-buffered *(ebp+0x14) %eax) -15156 58/pop-to-eax -15157 (write-buffered *(ebp+0x14) ": output cannot have an addr type; that could allow unsafe addresses to escape the function\n") -15158 (flush *(ebp+0x14)) -15159 (stop *(ebp+0x18) 1) -15160 # never gets here -15161 -15162 $populate-mu-function-header:error-nested-addr-inout: -15163 # error("fn " fn ": inout '" var "' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function") -15164 (write-buffered *(ebp+0x14) "fn ") -15165 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15166 (write-buffered *(ebp+0x14) %eax) -15167 (write-buffered *(ebp+0x14) ": inout '") -15168 (lookup *ebx *(ebx+4)) # => eax -15169 (lookup *eax *(eax+4)) # Var-name Var-name => eax -15170 (write-buffered *(ebp+0x14) %eax) -15171 (write-buffered *(ebp+0x14) "' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function\n") -15172 (flush *(ebp+0x14)) -15173 (stop *(ebp+0x18) 1) -15174 # never gets here -15175 -15176 # scenarios considered: -15177 # ✓ fn foo -15178 # ✗ fn foo { -15179 # ✓ fn foo x -15180 # ✓ fn foo x: int -15181 # ✓ fn foo x: int -> _/eax: int -15182 # TODO: -15183 # disallow outputs of type `(... addr ...)` -15184 # disallow inputs of type `(... addr ... addr ...)` -15185 populate-mu-function-signature: # first-line: (addr stream byte), out: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -15186 # pseudocode: -15187 # var word-slice: slice -15188 # next-mu-token(first-line, word-slice) -15189 # assert(word-slice not in '{' '}' '->') -15190 # out->name = slice-to-string(word-slice) -15191 # ## inouts -15192 # while true -15193 # word-slice = next-mu-token(first-line) -15194 # if slice-empty?(word-slice) break -15195 # if (word-slice == '->') break -15196 # assert(word-slice not in '{' '}') -15197 # var v: (handle var) = parse-var-with-type(word-slice, first-line) -15198 # assert(v->register == null) -15199 # # v->block-depth is implicitly 0 -15200 # out->inouts = append(v, out->inouts) -15201 # ## outputs -15202 # while true -15203 # word-slice = next-mu-token(first-line) -15204 # if slice-empty?(word-slice) break -15205 # assert(word-slice not in '{' '}' '->') -15206 # var v: (handle var) = parse-var-with-type(word-slice, first-line) -15207 # assert(v->register != null) -15208 # out->outputs = append(v, out->outputs) -15209 # -15210 # . prologue -15211 55/push-ebp -15212 89/<- %ebp 4/r32/esp -15213 # . save registers -15214 50/push-eax -15215 51/push-ecx -15216 52/push-edx -15217 53/push-ebx -15218 57/push-edi -15219 # edi = out -15220 8b/-> *(ebp+0xc) 7/r32/edi -15221 # var word-slice/ecx: slice -15222 68/push 0/imm32/end -15223 68/push 0/imm32/start -15224 89/<- %ecx 4/r32/esp -15225 # var v/ebx: (handle var) -15226 68/push 0/imm32 -15227 68/push 0/imm32 -15228 89/<- %ebx 4/r32/esp -15229 # read function name -15230 (next-mu-token *(ebp+8) %ecx) -15231 # error checking -15232 # if (word-slice == '{') abort -15233 (slice-equal? %ecx "{") # => eax -15234 3d/compare-eax-and 0/imm32/false -15235 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -15236 # if (word-slice == '->') abort -15237 (slice-equal? %ecx "->") # => eax -15238 3d/compare-eax-and 0/imm32/false -15239 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -15240 # if (word-slice == '}') abort -15241 (slice-equal? %ecx "}") # => eax -15242 3d/compare-eax-and 0/imm32/false -15243 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -15244 # if word-slice already defined, abort -15245 (function-exists? %ecx) # => eax -15246 3d/compare-eax-and 0/imm32/false -15247 0f 85/jump-if-!= $populate-mu-function-signature:error-duplicate/disp32 -15248 # -15249 (slice-starts-with? %ecx "break") # => eax -15250 3d/compare-eax-and 0/imm32/false -15251 0f 85/jump-if-!= $populate-mu-function-signature:error-break/disp32 -15252 (slice-starts-with? %ecx "loop") # => eax -15253 3d/compare-eax-and 0/imm32/false -15254 0f 85/jump-if-!= $populate-mu-function-signature:error-loop/disp32 -15255 # save function name -15256 (slice-to-string Heap %ecx %edi) # Function-name -15257 # save function inouts -15258 { -15259 $populate-mu-function-signature:check-for-inout: -15260 (next-mu-token *(ebp+8) %ecx) -15261 (slice-empty? %ecx) # => eax -15262 3d/compare-eax-and 0/imm32/false -15263 0f 85/jump-if-!= break/disp32 -15264 # if (word-slice == '->') break -15265 (slice-equal? %ecx "->") # => eax -15266 3d/compare-eax-and 0/imm32/false -15267 0f 85/jump-if-!= break/disp32 -15268 # if (word-slice == '{') abort -15269 (slice-equal? %ecx "{") # => eax -15270 3d/compare-eax-and 0/imm32/false -15271 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -15272 # if (word-slice == '}') abort -15273 (slice-equal? %ecx "}") # => eax -15274 3d/compare-eax-and 0/imm32/false -15275 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -15276 # v = parse-var-with-type(word-slice, first-line) -15277 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15278 (parse-var-with-type %ecx *(ebp+8) %ebx %eax *(ebp+0x10) *(ebp+0x14)) -15279 # if (v->register != null) abort -15280 # . eax: (addr var) = lookup(v) -15281 (lookup *ebx *(ebx+4)) # => eax -15282 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -15283 0f 85/jump-if-!= $populate-mu-function-signature:error2/disp32 -15284 # if function name is not "main" -15285 # and v->type contains an 'addr' anywhere except the start, abort -15286 { -15287 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15288 (string-equal? %eax "main") # => eax -15289 3d/compare-eax-and 0/imm32/false -15290 75/jump-if-!= break/disp8 -15291 (lookup *ebx *(ebx+4)) # => eax -15292 (addr-payload-contains-addr? %eax) # => eax -15293 3d/compare-eax-and 0/imm32/false -15294 0f 85/jump-if-!= $populate-mu-function-signature:error-nested-addr-inout/disp32 -15295 } -15296 # assert(v->register == null) -15297 # . eax: (addr var) = lookup(v) -15298 (lookup *ebx *(ebx+4)) # => eax -15299 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -15300 0f 85/jump-if-!= $populate-mu-function-signature:error2/disp32 -15301 # v->block-depth is implicitly 0 -15302 # -15303 # out->inouts = append(v, out->inouts) -15304 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts -15305 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts -15306 # -15307 e9/jump loop/disp32 -15308 } -15309 # save function outputs -15310 { -15311 $populate-mu-function-signature:check-for-out: -15312 (next-mu-token *(ebp+8) %ecx) -15313 (slice-empty? %ecx) # => eax -15314 3d/compare-eax-and 0/imm32/false -15315 0f 85/jump-if-!= break/disp32 -15316 # if (word-slice == '{') abort -15317 (slice-equal? %ecx "{") # => eax -15318 3d/compare-eax-and 0/imm32/false -15319 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -15320 # if (word-slice == '->') abort -15321 (slice-equal? %ecx "->") # => eax -15322 3d/compare-eax-and 0/imm32/false -15323 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -15324 # if (word-slice == '}') abort -15325 (slice-equal? %ecx "}") # => eax -15326 3d/compare-eax-and 0/imm32/false -15327 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -15328 # v = parse-var-with-type(word-slice, first-line) -15329 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15330 (parse-var-with-type %ecx *(ebp+8) %ebx %eax *(ebp+0x10) *(ebp+0x14)) -15331 # assert(var->register != null) -15332 # . eax: (addr var) = lookup(v) -15333 (lookup *ebx *(ebx+4)) # => eax -15334 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -15335 0f 84/jump-if-= $populate-mu-function-signature:error3/disp32 -15336 # if (var->name != "_") abort -15337 (lookup *eax *(eax+4)) # Var-name Var-name => eax -15338 (string-equal? %eax "_") # => eax -15339 3d/compare-eax-and 0/imm32/false -15340 0f 84/jump-if-= $populate-mu-function-signature:error4/disp32 -15341 # if function name is not "lookup" -15342 # and v->type is an addr, abort -15343 { -15344 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15345 (string-equal? %eax "lookup") # => eax -15346 3d/compare-eax-and 0/imm32/false -15347 75/jump-if-!= break/disp8 -15348 (lookup *ebx *(ebx+4)) # => eax -15349 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -15350 (is-mu-addr-type? %eax) # => eax -15351 3d/compare-eax-and 0/imm32/false -15352 0f 85/jump-if-!= $populate-mu-function-signature:error-addr-output/disp32 -15353 } -15354 # out->outputs = append(v, out->outputs) -15355 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs -15356 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs -15357 # -15358 e9/jump loop/disp32 -15359 } -15360 $populate-mu-function-signature:done: -15361 (check-no-tokens-left *(ebp+8)) -15362 $populate-mu-function-signature:end: -15363 # . reclaim locals -15364 81 0/subop/add %esp 0x10/imm32 -15365 # . restore registers -15366 5f/pop-to-edi -15367 5b/pop-to-ebx -15368 5a/pop-to-edx -15369 59/pop-to-ecx -15370 58/pop-to-eax -15371 # . epilogue -15372 89/<- %esp 5/r32/ebp -15373 5d/pop-to-ebp -15374 c3/return -15375 -15376 $populate-mu-function-signature:error1: -15377 # error("function signature not in form 'fn <name> {'") -15378 (write-buffered *(ebp+0x10) "function signature not in form 'fn <name> [inouts] [-> outputs] {' -- '") -15379 (flush *(ebp+0x10)) -15380 (rewind-stream *(ebp+8)) -15381 (write-stream-data *(ebp+0x10) *(ebp+8)) -15382 (write-buffered *(ebp+0x10) "'\n") -15383 (flush *(ebp+0x10)) -15384 (stop *(ebp+0x14) 1) -15385 # never gets here -15386 -15387 $populate-mu-function-signature:error2: -15388 # error("fn " fn ": function inout '" var "' cannot be in a register") -15389 (write-buffered *(ebp+0x10) "fn ") -15390 50/push-eax -15391 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15392 (write-buffered *(ebp+0x10) %eax) -15393 58/pop-to-eax -15394 (write-buffered *(ebp+0x10) ": function inout '") -15395 (lookup *eax *(eax+4)) # Var-name Var-name => eax -15396 (write-buffered *(ebp+0x10) %eax) -15397 (write-buffered *(ebp+0x10) "' cannot be in a register") -15398 (flush *(ebp+0x10)) -15399 (stop *(ebp+0x14) 1) -15400 # never gets here -15401 -15402 $populate-mu-function-signature:error3: -15403 # error("fn " fn ": function output '" var "' must be in a register") -15404 (write-buffered *(ebp+0x10) "fn ") -15405 50/push-eax -15406 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15407 (write-buffered *(ebp+0x10) %eax) -15408 58/pop-to-eax -15409 (write-buffered *(ebp+0x10) ": function output '") -15410 (lookup *ebx *(ebx+4)) # => eax -15411 (lookup *eax *(eax+4)) # Var-name Var-name => eax -15412 (write-buffered *(ebp+0x10) %eax) -15413 (write-buffered *(ebp+0x10) "' must be in a register, in instruction '") -15414 (rewind-stream *(ebp+8)) -15415 (write-stream-data *(ebp+0x10) *(ebp+8)) -15416 (write-buffered *(ebp+0x10) "'\n") -15417 (flush *(ebp+0x10)) -15418 (stop *(ebp+0x14) 1) -15419 # never gets here -15420 -15421 $populate-mu-function-signature:error4: -15422 # error("fn " fn ": function outputs cannot be named; rename '" var "' in the header to '_'") -15423 (write-buffered *(ebp+0x10) "fn ") -15424 50/push-eax -15425 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15426 (write-buffered *(ebp+0x10) %eax) -15427 58/pop-to-eax -15428 (write-buffered *(ebp+0x10) ": function outputs cannot be named; rename '") -15429 (lookup *ebx *(ebx+4)) # => eax -15430 (lookup *eax *(eax+4)) # Var-name Var-name => eax -15431 (write-buffered *(ebp+0x10) %eax) -15432 (write-buffered *(ebp+0x10) "' in the header to '_'\n") -15433 (flush *(ebp+0x10)) -15434 (stop *(ebp+0x14) 1) -15435 # never gets here -15436 -15437 $populate-mu-function-signature:error-duplicate: -15438 (write-buffered *(ebp+0x10) "fn ") -15439 (write-slice-buffered *(ebp+0x10) %ecx) -15440 (write-buffered *(ebp+0x10) " defined more than once\n") -15441 (flush *(ebp+0x10)) -15442 (stop *(ebp+0x14) 1) -15443 # never gets here -15444 -15445 $populate-mu-function-signature:error-break: -15446 (write-buffered *(ebp+0x10) "Sorry, I've reserved all function names starting with 'break' for now. Please contact mu@akkartik.com.\n") -15447 (flush *(ebp+0x10)) -15448 (stop *(ebp+0x14) 1) -15449 # never gets here -15450 -15451 $populate-mu-function-signature:error-loop: -15452 (write-buffered *(ebp+0x10) "Sorry, I've reserved all function names starting with 'loop' for now. Please contact mu@akkartik.com.\n") -15453 (flush *(ebp+0x10)) -15454 (stop *(ebp+0x14) 1) -15455 # never gets here -15456 -15457 $populate-mu-function-signature:error-addr-output: -15458 # error("fn " fn ": output cannot have an addr type; that could allow unsafe addresses to escape the function") -15459 (write-buffered *(ebp+0x10) "fn ") -15460 50/push-eax -15461 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15462 (write-buffered *(ebp+0x10) %eax) -15463 58/pop-to-eax -15464 (write-buffered *(ebp+0x10) ": output cannot have an addr type; that could allow unsafe addresses to escape the function\n") -15465 (flush *(ebp+0x10)) -15466 (stop *(ebp+0x14) 1) -15467 # never gets here -15468 -15469 $populate-mu-function-signature:error-nested-addr-inout: -15470 # error("fn " fn ": inout '" var "' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function") -15471 (write-buffered *(ebp+0x10) "fn ") -15472 (lookup *edi *(edi+4)) # Function-name Function-name => eax -15473 (write-buffered *(ebp+0x10) %eax) -15474 (write-buffered *(ebp+0x10) ": inout '") -15475 (lookup *ebx *(ebx+4)) # => eax -15476 (lookup *eax *(eax+4)) # Var-name Var-name => eax -15477 (write-buffered *(ebp+0x10) %eax) -15478 (write-buffered *(ebp+0x10) "' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function\n") -15479 (flush *(ebp+0x10)) -15480 (stop *(ebp+0x14) 1) -15481 # never gets here -15482 -15483 addr-payload-contains-addr?: # v: (addr var) -> result/eax: boolean -15484 # . prologue -15485 55/push-ebp -15486 89/<- %ebp 4/r32/esp -15487 # var t/eax: (addr type-tree) = v->type -15488 8b/-> *(ebp+8) 0/r32/eax -15489 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -15490 # if t->right contains addr, return true -15491 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -15492 (type-tree-contains? %eax 2) # addr => eax -15493 # we don't have to look at t->left as long as it's guaranteed to be an atom -15494 $addr-payload-contains-addr?:end: -15495 # . epilogue -15496 89/<- %esp 5/r32/ebp -15497 5d/pop-to-ebp -15498 c3/return -15499 -15500 type-tree-contains?: # t: (addr type-tree), n: type-id -> result/eax: boolean -15501 # . prologue -15502 55/push-ebp -15503 89/<- %ebp 4/r32/esp -15504 # . save registers -15505 51/push-ecx -15506 # if t is null, return false -15507 8b/-> *(ebp+8) 0/r32/eax -15508 3d/compare-eax-and 0/imm32 -15509 0f 84/jump-if-= $type-tree-contains?:end/disp32 # eax changes type -15510 # if t is an atom, return (t->value == n) -15511 81 7/subop/compare *eax 0/imm32/false -15512 { -15513 74/jump-if-= break/disp8 -15514 8b/-> *(ebp+0xc) 1/r32/ecx -15515 39/compare *(eax+4) 1/r32/ecx # Type-tree-value -15516 0f 94/set-if-= %al -15517 81 4/subop/and %eax 0xff/imm32 -15518 eb/jump $type-tree-contains?:end/disp8 -15519 } -15520 # if t->left contains n, return true -15521 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -15522 (type-tree-contains? %eax *(ebp+0xc)) # => eax -15523 3d/compare-eax-and 0/imm32/false -15524 75/jump-if-!= $type-tree-contains?:end/disp8 -15525 # otherwise return whether t->right contains n -15526 8b/-> *(ebp+8) 0/r32/eax -15527 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -15528 (type-tree-contains? %eax *(ebp+0xc)) # => eax -15529 $type-tree-contains?:end: -15530 # . restore registers -15531 59/pop-to-ecx -15532 # . epilogue -15533 89/<- %esp 5/r32/ebp -15534 5d/pop-to-ebp -15535 c3/return -15536 -15537 function-exists?: # s: (addr slice) -> result/eax: boolean -15538 # . prologue -15539 55/push-ebp -15540 89/<- %ebp 4/r32/esp -15541 # . save registers -15542 51/push-ecx -15543 # var curr/ecx: (addr function) = functions -15544 (lookup *_Program-functions *_Program-functions->payload) # => eax -15545 89/<- %ecx 0/r32/eax -15546 { -15547 # if (curr == null) break -15548 81 7/subop/compare %ecx 0/imm32 -15549 74/jump-if-= break/disp8 -15550 # if (curr->name == s) return true -15551 { -15552 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax -15553 (slice-equal? *(ebp+8) %eax) # => eax -15554 3d/compare-eax-and 0/imm32/false -15555 74/jump-if-= break/disp8 -15556 b8/copy-to-eax 1/imm32/true -15557 e9/jump $function-exists?:end/disp32 -15558 } -15559 # curr = curr->next -15560 (lookup *(ecx+0x20) *(ecx+0x24)) # Function-next Function-next => eax -15561 89/<- %ecx 0/r32/eax -15562 # -15563 eb/jump loop/disp8 -15564 } -15565 # var curr/ecx: (addr function) = signatures -15566 (lookup *_Program-signatures *_Program-signatures->payload) # => eax -15567 89/<- %ecx 0/r32/eax -15568 { -15569 # if (curr == null) break -15570 81 7/subop/compare %ecx 0/imm32 -15571 74/jump-if-= break/disp8 -15572 # if (curr->name == s) return true -15573 { -15574 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax -15575 (slice-equal? *(ebp+8) %eax) # => eax -15576 3d/compare-eax-and 0/imm32/false -15577 74/jump-if-= break/disp8 -15578 b8/copy-to-eax 1/imm32/true -15579 eb/jump $function-exists?:end/disp8 -15580 } -15581 # curr = curr->next -15582 (lookup *(ecx+0x20) *(ecx+0x24)) # Function-next Function-next => eax -15583 89/<- %ecx 0/r32/eax -15584 # -15585 eb/jump loop/disp8 -15586 } -15587 # return false -15588 b8/copy-to-eax 0/imm32/false -15589 $function-exists?:end: -15590 # . restore registers -15591 59/pop-to-ecx -15592 # . epilogue -15593 89/<- %esp 5/r32/ebp -15594 5d/pop-to-ebp -15595 c3/return -15596 -15597 test-function-header-with-arg: -15598 # . prologue -15599 55/push-ebp -15600 89/<- %ebp 4/r32/esp -15601 # setup -15602 8b/-> *Primitive-type-ids 0/r32/eax -15603 89/<- *Type-id 0/r32/eax # stream-write -15604 c7 0/subop/copy *_Program-functions 0/imm32 -15605 c7 0/subop/copy *_Program-functions->payload 0/imm32 -15606 c7 0/subop/copy *_Program-types 0/imm32 -15607 c7 0/subop/copy *_Program-types->payload 0/imm32 -15608 c7 0/subop/copy *_Program-signatures 0/imm32 -15609 c7 0/subop/copy *_Program-signatures->payload 0/imm32 -15610 (clear-stream _test-input-stream) -15611 (write _test-input-stream "foo n: int {\n") -15612 # var result/ecx: function -15613 2b/subtract *Function-size 4/r32/esp -15614 89/<- %ecx 4/r32/esp -15615 (zero-out %ecx *Function-size) -15616 # var vars/ebx: (stack live-var 16) -15617 81 5/subop/subtract %esp 0xc0/imm32 -15618 68/push 0xc0/imm32/size -15619 68/push 0/imm32/top -15620 89/<- %ebx 4/r32/esp -15621 # convert -15622 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) -15623 # check result->name -15624 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax -15625 (check-strings-equal %eax "foo" "F - test-function-header-with-arg/name") -15626 # var v/edx: (addr var) = result->inouts->value -15627 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax -15628 (lookup *eax *(eax+4)) # List-value List-value => eax -15629 89/<- %edx 0/r32/eax -15630 # check v->name -15631 (lookup *edx *(edx+4)) # Var-name Var-name => eax -15632 (check-strings-equal %eax "n" "F - test-function-header-with-arg/inout:0") -15633 # check v->type -15634 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -15635 (check-ints-equal *eax 1 "F - test-function-header-with-arg/inout:0/type:0") # Type-tree-is-atom -15636 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-arg/inout:0/type:1") # Type-tree-value -15637 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-arg/inout:0/type:2") # Type-tree-right -15638 # . epilogue -15639 89/<- %esp 5/r32/ebp -15640 5d/pop-to-ebp -15641 c3/return -15642 -15643 test-function-header-with-multiple-args: -15644 # . prologue -15645 55/push-ebp -15646 89/<- %ebp 4/r32/esp -15647 # setup -15648 8b/-> *Primitive-type-ids 0/r32/eax -15649 89/<- *Type-id 0/r32/eax # stream-write -15650 c7 0/subop/copy *_Program-functions 0/imm32 -15651 c7 0/subop/copy *_Program-functions->payload 0/imm32 -15652 c7 0/subop/copy *_Program-types 0/imm32 -15653 c7 0/subop/copy *_Program-types->payload 0/imm32 -15654 c7 0/subop/copy *_Program-signatures 0/imm32 -15655 c7 0/subop/copy *_Program-signatures->payload 0/imm32 -15656 (clear-stream _test-input-stream) -15657 (write _test-input-stream "foo a: int, b: int c: int {\n") -15658 # result/ecx: function -15659 2b/subtract *Function-size 4/r32/esp -15660 89/<- %ecx 4/r32/esp -15661 (zero-out %ecx *Function-size) -15662 # var vars/ebx: (stack live-var 16) -15663 81 5/subop/subtract %esp 0xc0/imm32 -15664 68/push 0xc0/imm32/size -15665 68/push 0/imm32/top -15666 89/<- %ebx 4/r32/esp -15667 # convert -15668 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) -15669 # check result->name -15670 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax -15671 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args/name") -15672 # var inouts/edx: (addr list var) = lookup(result->inouts) -15673 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax -15674 89/<- %edx 0/r32/eax -15675 $test-function-header-with-multiple-args:inout0: -15676 # var v/ebx: (addr var) = lookup(inouts->value) -15677 (lookup *edx *(edx+4)) # List-value List-value => eax -15678 89/<- %ebx 0/r32/eax -15679 # check v->name -15680 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -15681 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args/inout:0") # Var-name -15682 # check v->type -15683 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -15684 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:0/type:0") # Type-tree-is-atom -15685 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:0/type:1") # Type-tree-value -15686 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:0/type:2") # Type-tree-right -15687 $test-function-header-with-multiple-args:inout1: -15688 # inouts = lookup(inouts->next) -15689 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -15690 89/<- %edx 0/r32/eax -15691 # v = lookup(inouts->value) -15692 (lookup *edx *(edx+4)) # List-value List-value => eax -15693 89/<- %ebx 0/r32/eax -15694 # check v->name -15695 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -15696 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args/inout:1") # Var-name -15697 # check v->type -15698 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -15699 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:1/type:0") # Type-tree-is-atom -15700 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:1/type:1") # Type-tree-value -15701 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:1/type:2") # Type-tree-right -15702 $test-function-header-with-multiple-args:inout2: -15703 # inouts = lookup(inouts->next) -15704 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -15705 89/<- %edx 0/r32/eax -15706 # v = lookup(inouts->value) -15707 (lookup *edx *(edx+4)) # List-value List-value => eax -15708 89/<- %ebx 0/r32/eax -15709 # check v->name -15710 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -15711 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args/inout:2") # Var-name -15712 # check v->type -15713 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -15714 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:2/type:0") # Type-tree-is-atom -15715 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:2/type:1") # Type-tree-value -15716 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:2/type:2") # Type-tree-right +14676 (tailor-exit-descriptor %edx 0x10) +14677 # +14678 (write _test-input-stream "fn foo {\n") +14679 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") +14680 (write _test-input-stream " populate y, 3\n") +14681 (write _test-input-stream "}\n") +14682 # convert +14683 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14684 # registers except esp clobbered at this point +14685 # restore ed +14686 89/<- %edx 4/r32/esp +14687 (flush _test-output-buffered-file) +14688 (flush _test-error-buffered-file) +14689 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14695 # check output +14696 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr-handle: output should be empty") +14697 (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") +14698 # check that stop(1) was called +14699 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr-handle: exit status") +14700 # don't restore from ebp +14701 81 0/subop/add %esp 8/imm32 +14702 # . epilogue +14703 5d/pop-to-ebp +14704 c3/return +14705 +14706 test-populate-non-addr-handle-array: +14707 # . prologue +14708 55/push-ebp +14709 89/<- %ebp 4/r32/esp +14710 # setup +14711 (clear-stream _test-input-stream) +14712 (clear-stream $_test-input-buffered-file->buffer) +14713 (clear-stream _test-output-stream) +14714 (clear-stream $_test-output-buffered-file->buffer) +14715 (clear-stream _test-error-stream) +14716 (clear-stream $_test-error-buffered-file->buffer) +14717 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14718 68/push 0/imm32 +14719 68/push 0/imm32 +14720 89/<- %edx 4/r32/esp +14721 (tailor-exit-descriptor %edx 0x10) +14722 # +14723 (write _test-input-stream "fn foo {\n") +14724 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") +14725 (write _test-input-stream " populate y, 3\n") +14726 (write _test-input-stream "}\n") +14727 # convert +14728 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14729 # registers except esp clobbered at this point +14730 # restore ed +14731 89/<- %edx 4/r32/esp +14732 (flush _test-output-buffered-file) +14733 (flush _test-error-buffered-file) +14734 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14740 # check output +14741 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr-handle-array: output should be empty") +14742 (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") +14743 # check that stop(1) was called +14744 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr-handle-array: exit status") +14745 # don't restore from ebp +14746 81 0/subop/add %esp 8/imm32 +14747 # . epilogue +14748 5d/pop-to-ebp +14749 c3/return +14750 +14751 test-populate-deref-address: +14752 # . prologue +14753 55/push-ebp +14754 89/<- %ebp 4/r32/esp +14755 # setup +14756 (clear-stream _test-input-stream) +14757 (clear-stream $_test-input-buffered-file->buffer) +14758 (clear-stream _test-output-stream) +14759 (clear-stream $_test-output-buffered-file->buffer) +14760 # +14761 (write _test-input-stream "fn foo {\n") +14762 (write _test-input-stream " var y/ecx: (addr addr handle array int) <- copy 0\n") +14763 (write _test-input-stream " populate *y, 3\n") +14764 (write _test-input-stream "}\n") +14765 # convert +14766 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +14767 (flush _test-output-buffered-file) +14768 # no errors +14769 # . epilogue +14770 5d/pop-to-ebp +14771 c3/return +14772 +14773 test-populate-stream-with-no-inout: +14774 # . prologue +14775 55/push-ebp +14776 89/<- %ebp 4/r32/esp +14777 # setup +14778 (clear-stream _test-input-stream) +14779 (clear-stream $_test-input-buffered-file->buffer) +14780 (clear-stream _test-output-stream) +14781 (clear-stream $_test-output-buffered-file->buffer) +14782 (clear-stream _test-error-stream) +14783 (clear-stream $_test-error-buffered-file->buffer) +14784 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14785 68/push 0/imm32 +14786 68/push 0/imm32 +14787 89/<- %edx 4/r32/esp +14788 (tailor-exit-descriptor %edx 0x10) +14789 # +14790 (write _test-input-stream "fn foo {\n") +14791 (write _test-input-stream " populate-stream\n") +14792 (write _test-input-stream "}\n") +14793 # convert +14794 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14795 # registers except esp clobbered at this point +14796 # restore ed +14797 89/<- %edx 4/r32/esp +14798 (flush _test-output-buffered-file) +14799 (flush _test-error-buffered-file) +14800 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14806 # check output +14807 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-no-inout: output should be empty") +14808 (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") +14809 # check that stop(1) was called +14810 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-no-inout: exit status") +14811 # don't restore from ebp +14812 81 0/subop/add %esp 8/imm32 +14813 # . epilogue +14814 5d/pop-to-ebp +14815 c3/return +14816 +14817 test-populate-stream-with-too-many-inouts: +14818 # . prologue +14819 55/push-ebp +14820 89/<- %ebp 4/r32/esp +14821 # setup +14822 (clear-stream _test-input-stream) +14823 (clear-stream $_test-input-buffered-file->buffer) +14824 (clear-stream _test-output-stream) +14825 (clear-stream $_test-output-buffered-file->buffer) +14826 (clear-stream _test-error-stream) +14827 (clear-stream $_test-error-buffered-file->buffer) +14828 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14829 68/push 0/imm32 +14830 68/push 0/imm32 +14831 89/<- %edx 4/r32/esp +14832 (tailor-exit-descriptor %edx 0x10) +14833 # +14834 (write _test-input-stream "fn foo {\n") +14835 (write _test-input-stream " var x: (addr handle int)\n") +14836 (write _test-input-stream " populate-stream x, 3, 0\n") +14837 (write _test-input-stream "}\n") +14838 # convert +14839 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14840 # registers except esp clobbered at this point +14841 # restore ed +14842 89/<- %edx 4/r32/esp +14843 (flush _test-output-buffered-file) +14844 (flush _test-error-buffered-file) +14845 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14851 # check output +14852 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-too-many-inouts: output should be empty") +14853 (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") +14854 # check that stop(1) was called +14855 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-too-many-inouts: exit status") +14856 # don't restore from ebp +14857 81 0/subop/add %esp 8/imm32 +14858 # . epilogue +14859 5d/pop-to-ebp +14860 c3/return +14861 +14862 test-populate-stream-with-output: +14863 # . prologue +14864 55/push-ebp +14865 89/<- %ebp 4/r32/esp +14866 # setup +14867 (clear-stream _test-input-stream) +14868 (clear-stream $_test-input-buffered-file->buffer) +14869 (clear-stream _test-output-stream) +14870 (clear-stream $_test-output-buffered-file->buffer) +14871 (clear-stream _test-error-stream) +14872 (clear-stream $_test-error-buffered-file->buffer) +14873 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14874 68/push 0/imm32 +14875 68/push 0/imm32 +14876 89/<- %edx 4/r32/esp +14877 (tailor-exit-descriptor %edx 0x10) +14878 # +14879 (write _test-input-stream "fn foo {\n") +14880 (write _test-input-stream " var x/eax: boolean <- copy 0\n") +14881 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") +14882 (write _test-input-stream " x <- populate-stream y\n") +14883 (write _test-input-stream "}\n") +14884 # convert +14885 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14886 # registers except esp clobbered at this point +14887 # restore ed +14888 89/<- %edx 4/r32/esp +14889 (flush _test-output-buffered-file) +14890 (flush _test-error-buffered-file) +14891 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14897 # check output +14898 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-output: output should be empty") +14899 (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") +14900 # check that stop(1) was called +14901 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-output: exit status") +14902 # don't restore from ebp +14903 81 0/subop/add %esp 8/imm32 +14904 # . epilogue +14905 5d/pop-to-ebp +14906 c3/return +14907 +14908 test-populate-stream-non-addr: +14909 # . prologue +14910 55/push-ebp +14911 89/<- %ebp 4/r32/esp +14912 # setup +14913 (clear-stream _test-input-stream) +14914 (clear-stream $_test-input-buffered-file->buffer) +14915 (clear-stream _test-output-stream) +14916 (clear-stream $_test-output-buffered-file->buffer) +14917 (clear-stream _test-error-stream) +14918 (clear-stream $_test-error-buffered-file->buffer) +14919 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14920 68/push 0/imm32 +14921 68/push 0/imm32 +14922 89/<- %edx 4/r32/esp +14923 (tailor-exit-descriptor %edx 0x10) +14924 # +14925 (write _test-input-stream "fn foo {\n") +14926 (write _test-input-stream " var y: (handle int)\n") +14927 (write _test-input-stream " populate-stream y, 3\n") +14928 (write _test-input-stream "}\n") +14929 # convert +14930 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14931 # registers except esp clobbered at this point +14932 # restore ed +14933 89/<- %edx 4/r32/esp +14934 (flush _test-output-buffered-file) +14935 (flush _test-error-buffered-file) +14936 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14942 # check output +14943 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr: output must be empty") +14944 (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") +14945 # check that stop(1) was called +14946 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr: exit status") +14947 # don't restore from ebp +14948 81 0/subop/add %esp 8/imm32 +14949 # . epilogue +14950 5d/pop-to-ebp +14951 c3/return +14952 +14953 test-populate-stream-non-addr-handle: +14954 # . prologue +14955 55/push-ebp +14956 89/<- %ebp 4/r32/esp +14957 # setup +14958 (clear-stream _test-input-stream) +14959 (clear-stream $_test-input-buffered-file->buffer) +14960 (clear-stream _test-output-stream) +14961 (clear-stream $_test-output-buffered-file->buffer) +14962 (clear-stream _test-error-stream) +14963 (clear-stream $_test-error-buffered-file->buffer) +14964 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +14965 68/push 0/imm32 +14966 68/push 0/imm32 +14967 89/<- %edx 4/r32/esp +14968 (tailor-exit-descriptor %edx 0x10) +14969 # +14970 (write _test-input-stream "fn foo {\n") +14971 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") +14972 (write _test-input-stream " populate-stream y, 3\n") +14973 (write _test-input-stream "}\n") +14974 # convert +14975 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +14976 # registers except esp clobbered at this point +14977 # restore ed +14978 89/<- %edx 4/r32/esp +14979 (flush _test-output-buffered-file) +14980 (flush _test-error-buffered-file) +14981 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +14987 # check output +14988 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr-handle: output should be empty") +14989 (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") +14990 # check that stop(1) was called +14991 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr-handle: exit status") +14992 # don't restore from ebp +14993 81 0/subop/add %esp 8/imm32 +14994 # . epilogue +14995 5d/pop-to-ebp +14996 c3/return +14997 +14998 test-populate-stream-non-addr-handle-stream: +14999 # . prologue +15000 55/push-ebp +15001 89/<- %ebp 4/r32/esp +15002 # setup +15003 (clear-stream _test-input-stream) +15004 (clear-stream $_test-input-buffered-file->buffer) +15005 (clear-stream _test-output-stream) +15006 (clear-stream $_test-output-buffered-file->buffer) +15007 (clear-stream _test-error-stream) +15008 (clear-stream $_test-error-buffered-file->buffer) +15009 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +15010 68/push 0/imm32 +15011 68/push 0/imm32 +15012 89/<- %edx 4/r32/esp +15013 (tailor-exit-descriptor %edx 0x10) +15014 # +15015 (write _test-input-stream "fn foo {\n") +15016 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") +15017 (write _test-input-stream " populate-stream y, 3\n") +15018 (write _test-input-stream "}\n") +15019 # convert +15020 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +15021 # registers except esp clobbered at this point +15022 # restore ed +15023 89/<- %edx 4/r32/esp +15024 (flush _test-output-buffered-file) +15025 (flush _test-error-buffered-file) +15026 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +15032 # check output +15033 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr-handle-stream: output should be empty") +15034 (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") +15035 # check that stop(1) was called +15036 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr-handle-stream: exit status") +15037 # don't restore from ebp +15038 81 0/subop/add %esp 8/imm32 +15039 # . epilogue +15040 5d/pop-to-ebp +15041 c3/return +15042 +15043 test-populate-stream-deref-address: +15044 # . prologue +15045 55/push-ebp +15046 89/<- %ebp 4/r32/esp +15047 # setup +15048 (clear-stream _test-input-stream) +15049 (clear-stream $_test-input-buffered-file->buffer) +15050 (clear-stream _test-output-stream) +15051 (clear-stream $_test-output-buffered-file->buffer) +15052 # +15053 (write _test-input-stream "fn foo {\n") +15054 (write _test-input-stream " var y/ecx: (addr addr handle stream int) <- copy 0\n") +15055 (write _test-input-stream " populate-stream *y, 3\n") +15056 (write _test-input-stream "}\n") +15057 # convert +15058 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +15059 (flush _test-output-buffered-file) +15060 # no errors +15061 # . epilogue +15062 5d/pop-to-ebp +15063 c3/return +15064 +15065 test-convert-with-no-inout: +15066 # . prologue +15067 55/push-ebp +15068 89/<- %ebp 4/r32/esp +15069 # setup +15070 (clear-stream _test-input-stream) +15071 (clear-stream $_test-input-buffered-file->buffer) +15072 (clear-stream _test-output-stream) +15073 (clear-stream $_test-output-buffered-file->buffer) +15074 (clear-stream _test-error-stream) +15075 (clear-stream $_test-error-buffered-file->buffer) +15076 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +15077 68/push 0/imm32 +15078 68/push 0/imm32 +15079 89/<- %edx 4/r32/esp +15080 (tailor-exit-descriptor %edx 0x10) +15081 # +15082 (write _test-input-stream "fn foo {\n") +15083 (write _test-input-stream " var x/eax: int <- convert\n") +15084 (write _test-input-stream "}\n") +15085 # convert +15086 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +15087 # registers except esp clobbered at this point +15088 # restore ed +15089 89/<- %edx 4/r32/esp +15090 (flush _test-output-buffered-file) +15091 (flush _test-error-buffered-file) +15092 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +15098 # check output +15099 (check-stream-equal _test-output-stream "" "F - test-convert-with-no-inout: output should be empty") +15100 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' expects an inout" "F - test-convert-with-no-inout: error message") +15101 # check that stop(1) was called +15102 (check-ints-equal *(edx+4) 2 "F - test-convert-with-no-inout: exit status") +15103 # don't restore from ebp +15104 81 0/subop/add %esp 8/imm32 +15105 # . epilogue +15106 5d/pop-to-ebp +15107 c3/return +15108 +15109 test-convert-with-multiple-inouts: +15110 # . prologue +15111 55/push-ebp +15112 89/<- %ebp 4/r32/esp +15113 # setup +15114 (clear-stream _test-input-stream) +15115 (clear-stream $_test-input-buffered-file->buffer) +15116 (clear-stream _test-output-stream) +15117 (clear-stream $_test-output-buffered-file->buffer) +15118 (clear-stream _test-error-stream) +15119 (clear-stream $_test-error-buffered-file->buffer) +15120 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +15121 68/push 0/imm32 +15122 68/push 0/imm32 +15123 89/<- %edx 4/r32/esp +15124 (tailor-exit-descriptor %edx 0x10) +15125 # +15126 (write _test-input-stream "fn foo {\n") +15127 (write _test-input-stream " var x/eax: int <- convert 0, 0\n") +15128 (write _test-input-stream "}\n") +15129 # convert +15130 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +15131 # registers except esp clobbered at this point +15132 # restore ed +15133 89/<- %edx 4/r32/esp +15134 (flush _test-output-buffered-file) +15135 (flush _test-error-buffered-file) +15136 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +15142 # check output +15143 (check-stream-equal _test-output-stream "" "F - test-convert-with-multiple-inouts: output should be empty") +15144 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' must have just one inout" "F - test-convert-with-multiple-inouts: error message") +15145 # check that stop(1) was called +15146 (check-ints-equal *(edx+4) 2 "F - test-convert-with-multiple-inouts: exit status") +15147 # don't restore from ebp +15148 81 0/subop/add %esp 8/imm32 +15149 # . epilogue +15150 5d/pop-to-ebp +15151 c3/return +15152 +15153 test-convert-with-no-output: +15154 # . prologue +15155 55/push-ebp +15156 89/<- %ebp 4/r32/esp +15157 # setup +15158 (clear-stream _test-input-stream) +15159 (clear-stream $_test-input-buffered-file->buffer) +15160 (clear-stream _test-output-stream) +15161 (clear-stream $_test-output-buffered-file->buffer) +15162 (clear-stream _test-error-stream) +15163 (clear-stream $_test-error-buffered-file->buffer) +15164 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +15165 68/push 0/imm32 +15166 68/push 0/imm32 +15167 89/<- %edx 4/r32/esp +15168 (tailor-exit-descriptor %edx 0x10) +15169 # +15170 (write _test-input-stream "fn foo {\n") +15171 (write _test-input-stream " convert 0\n") +15172 (write _test-input-stream "}\n") +15173 # convert +15174 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +15175 # registers except esp clobbered at this point +15176 # restore ed +15177 89/<- %edx 4/r32/esp +15178 (flush _test-output-buffered-file) +15179 (flush _test-error-buffered-file) +15180 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +15186 # check output +15187 (check-stream-equal _test-output-stream "" "F - test-convert-with-no-output: output should be empty") +15188 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' expects an output" "F - test-convert-with-no-output: error message") +15189 # check that stop(1) was called +15190 (check-ints-equal *(edx+4) 2 "F - test-convert-with-no-output: exit status") +15191 # don't restore from ebp +15192 81 0/subop/add %esp 8/imm32 +15193 # . epilogue +15194 5d/pop-to-ebp +15195 c3/return +15196 +15197 test-convert-with-multiple-outputs: +15198 # . prologue +15199 55/push-ebp +15200 89/<- %ebp 4/r32/esp +15201 # setup +15202 (clear-stream _test-input-stream) +15203 (clear-stream $_test-input-buffered-file->buffer) +15204 (clear-stream _test-output-stream) +15205 (clear-stream $_test-output-buffered-file->buffer) +15206 (clear-stream _test-error-stream) +15207 (clear-stream $_test-error-buffered-file->buffer) +15208 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +15209 68/push 0/imm32 +15210 68/push 0/imm32 +15211 89/<- %edx 4/r32/esp +15212 (tailor-exit-descriptor %edx 0x10) +15213 # +15214 (write _test-input-stream "fn foo {\n") +15215 (write _test-input-stream " var x/eax: int <- copy 0\n") +15216 (write _test-input-stream " var y/ecx: int <- copy 0\n") +15217 (write _test-input-stream " x, y <- convert 0\n") +15218 (write _test-input-stream "}\n") +15219 # convert +15220 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +15221 # registers except esp clobbered at this point +15222 # restore ed +15223 89/<- %edx 4/r32/esp +15224 (flush _test-output-buffered-file) +15225 (flush _test-error-buffered-file) +15226 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +15232 # check output +15233 (check-stream-equal _test-output-stream "" "F - test-convert-with-multiple-outputs: output should be empty") +15234 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' must have just one output" "F - test-convert-with-multiple-outputs: error message") +15235 # check that stop(1) was called +15236 (check-ints-equal *(edx+4) 2 "F - test-convert-with-multiple-outputs: exit status") +15237 # don't restore from ebp +15238 81 0/subop/add %esp 8/imm32 +15239 # . epilogue +15240 5d/pop-to-ebp +15241 c3/return +15242 +15243 test-convert-deref-address: +15244 # . prologue +15245 55/push-ebp +15246 89/<- %ebp 4/r32/esp +15247 # setup +15248 (clear-stream _test-input-stream) +15249 (clear-stream $_test-input-buffered-file->buffer) +15250 (clear-stream _test-output-stream) +15251 (clear-stream $_test-output-buffered-file->buffer) +15252 # +15253 (write _test-input-stream "fn foo {\n") +15254 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") +15255 (write _test-input-stream " var y/xmm4: float <- convert *x\n") +15256 (write _test-input-stream "}\n") +15257 # convert +15258 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +15259 (flush _test-output-buffered-file) +15260 # no errors +15261 # . epilogue +15262 5d/pop-to-ebp +15263 c3/return +15264 +15265 test-convert-to-non-register: +15266 # . prologue +15267 55/push-ebp +15268 89/<- %ebp 4/r32/esp +15269 # setup +15270 (clear-stream _test-input-stream) +15271 (clear-stream $_test-input-buffered-file->buffer) +15272 (clear-stream _test-output-stream) +15273 (clear-stream $_test-output-buffered-file->buffer) +15274 (clear-stream _test-error-stream) +15275 (clear-stream $_test-error-buffered-file->buffer) +15276 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +15277 68/push 0/imm32 +15278 68/push 0/imm32 +15279 89/<- %edx 4/r32/esp +15280 (tailor-exit-descriptor %edx 0x10) +15281 # +15282 (write _test-input-stream "fn foo {\n") +15283 (write _test-input-stream " var x: float\n") +15284 (write _test-input-stream " var y: int\n") +15285 (write _test-input-stream " x <- convert y\n") +15286 (write _test-input-stream "}\n") +15287 # convert +15288 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +15289 # registers except esp clobbered at this point +15290 # restore ed +15291 89/<- %edx 4/r32/esp +15292 (flush _test-output-buffered-file) +15293 (flush _test-error-buffered-file) +15294 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +15300 # check output +15301 (check-stream-equal _test-output-stream "" "F - test-convert-to-non-register: output should be empty") +15302 (check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: output 'x' not in a register" "F - test-convert-to-non-register: error message") +15303 # check that stop(1) was called +15304 (check-ints-equal *(edx+4) 2 "F - test-convert-to-non-register: exit status") +15305 # don't restore from ebp +15306 81 0/subop/add %esp 8/imm32 +15307 # . epilogue +15308 5d/pop-to-ebp +15309 c3/return +15310 +15311 test-convert-invalid-inout-type: +15312 # . prologue +15313 55/push-ebp +15314 89/<- %ebp 4/r32/esp +15315 # setup +15316 (clear-stream _test-input-stream) +15317 (clear-stream $_test-input-buffered-file->buffer) +15318 (clear-stream _test-output-stream) +15319 (clear-stream $_test-output-buffered-file->buffer) +15320 (clear-stream _test-error-stream) +15321 (clear-stream $_test-error-buffered-file->buffer) +15322 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +15323 68/push 0/imm32 +15324 68/push 0/imm32 +15325 89/<- %edx 4/r32/esp +15326 (tailor-exit-descriptor %edx 0x10) +15327 # +15328 (write _test-input-stream "fn foo {\n") +15329 (write _test-input-stream " var x: boolean\n") +15330 (write _test-input-stream " var y/xmm1: float <- convert x\n") +15331 (write _test-input-stream "}\n") +15332 # convert +15333 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +15334 # registers except esp clobbered at this point +15335 # restore ed +15336 89/<- %edx 4/r32/esp +15337 (flush _test-output-buffered-file) +15338 (flush _test-error-buffered-file) +15339 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +15345 # check output +15346 (check-stream-equal _test-output-stream "" "F - test-convert-invalid-inout-type: output should be empty") +15347 (check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: inout 'x' must be an int or float" "F - test-convert-invalid-inout-type: error message") +15348 # check that stop(1) was called +15349 (check-ints-equal *(edx+4) 2 "F - test-convert-invalid-inout-type: exit status") +15350 # don't restore from ebp +15351 81 0/subop/add %esp 8/imm32 +15352 # . epilogue +15353 5d/pop-to-ebp +15354 c3/return +15355 +15356 test-convert-invalid-output-type: +15357 # . prologue +15358 55/push-ebp +15359 89/<- %ebp 4/r32/esp +15360 # setup +15361 (clear-stream _test-input-stream) +15362 (clear-stream $_test-input-buffered-file->buffer) +15363 (clear-stream _test-output-stream) +15364 (clear-stream $_test-output-buffered-file->buffer) +15365 (clear-stream _test-error-stream) +15366 (clear-stream $_test-error-buffered-file->buffer) +15367 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +15368 68/push 0/imm32 +15369 68/push 0/imm32 +15370 89/<- %edx 4/r32/esp +15371 (tailor-exit-descriptor %edx 0x10) +15372 # +15373 (write _test-input-stream "fn foo {\n") +15374 (write _test-input-stream " var x: float\n") +15375 (write _test-input-stream " var y/eax: boolean <- convert x\n") +15376 (write _test-input-stream "}\n") +15377 # convert +15378 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +15379 # registers except esp clobbered at this point +15380 # restore ed +15381 89/<- %edx 4/r32/esp +15382 (flush _test-output-buffered-file) +15383 (flush _test-error-buffered-file) +15384 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +15390 # check output +15391 (check-stream-equal _test-output-stream "" "F - test-convert-invalid-output-type: output should be empty") +15392 (check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: output 'y' must be an int or float" "F - test-convert-invalid-output-type: error message") +15393 # check that stop(1) was called +15394 (check-ints-equal *(edx+4) 2 "F - test-convert-invalid-output-type: exit status") +15395 # don't restore from ebp +15396 81 0/subop/add %esp 8/imm32 +15397 # . epilogue +15398 5d/pop-to-ebp +15399 c3/return +15400 +15401 test-convert-int-to-int: +15402 # . prologue +15403 55/push-ebp +15404 89/<- %ebp 4/r32/esp +15405 # setup +15406 (clear-stream _test-input-stream) +15407 (clear-stream $_test-input-buffered-file->buffer) +15408 (clear-stream _test-output-stream) +15409 (clear-stream $_test-output-buffered-file->buffer) +15410 (clear-stream _test-error-stream) +15411 (clear-stream $_test-error-buffered-file->buffer) +15412 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +15413 68/push 0/imm32 +15414 68/push 0/imm32 +15415 89/<- %edx 4/r32/esp +15416 (tailor-exit-descriptor %edx 0x10) +15417 # +15418 (write _test-input-stream "fn foo {\n") +15419 (write _test-input-stream " var x: int\n") +15420 (write _test-input-stream " var y/eax: int <- convert x\n") +15421 (write _test-input-stream "}\n") +15422 # convert +15423 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +15424 # registers except esp clobbered at this point +15425 # restore ed +15426 89/<- %edx 4/r32/esp +15427 (flush _test-output-buffered-file) +15428 (flush _test-error-buffered-file) +15429 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +15435 # check output +15436 (check-stream-equal _test-output-stream "" "F - test-convert-int-to-int: output should be empty") +15437 (check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: no need to convert int to int" "F - test-convert-int-to-int: error message") +15438 # check that stop(1) was called +15439 (check-ints-equal *(edx+4) 2 "F - test-convert-int-to-int: exit status") +15440 # don't restore from ebp +15441 81 0/subop/add %esp 8/imm32 +15442 # . epilogue +15443 5d/pop-to-ebp +15444 c3/return +15445 +15446 test-convert-float-to-float: +15447 # . prologue +15448 55/push-ebp +15449 89/<- %ebp 4/r32/esp +15450 # setup +15451 (clear-stream _test-input-stream) +15452 (clear-stream $_test-input-buffered-file->buffer) +15453 (clear-stream _test-output-stream) +15454 (clear-stream $_test-output-buffered-file->buffer) +15455 (clear-stream _test-error-stream) +15456 (clear-stream $_test-error-buffered-file->buffer) +15457 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +15458 68/push 0/imm32 +15459 68/push 0/imm32 +15460 89/<- %edx 4/r32/esp +15461 (tailor-exit-descriptor %edx 0x10) +15462 # +15463 (write _test-input-stream "fn foo {\n") +15464 (write _test-input-stream " var x: float\n") +15465 (write _test-input-stream " var y/xmm6: float <- convert x\n") +15466 (write _test-input-stream "}\n") +15467 # convert +15468 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +15469 # registers except esp clobbered at this point +15470 # restore ed +15471 89/<- %edx 4/r32/esp +15472 (flush _test-output-buffered-file) +15473 (flush _test-error-buffered-file) +15474 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ +15480 # check output +15481 (check-stream-equal _test-output-stream "" "F - test-convert-float-to-float: output should be empty") +15482 (check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: no need to convert float to float" "F - test-convert-float-to-float: error message") +15483 # check that stop(1) was called +15484 (check-ints-equal *(edx+4) 2 "F - test-convert-float-to-float: exit status") +15485 # don't restore from ebp +15486 81 0/subop/add %esp 8/imm32 +15487 # . epilogue +15488 5d/pop-to-ebp +15489 c3/return +15490 +15491 ####################################################### +15492 # Parsing +15493 ####################################################### +15494 +15495 == data +15496 +15497 # Global state added to each var record when parsing a function +15498 Next-block-index: # (addr int) +15499 1/imm32 +15500 +15501 Curr-block-depth: # (addr int) +15502 1/imm32 +15503 +15504 == code +15505 +15506 parse-mu: # in: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) +15507 # pseudocode +15508 # var curr-function: (addr handle function) = Program->functions +15509 # var curr-signature: (addr handle function) = Program->signatures +15510 # var curr-type: (addr handle typeinfo) = Program->types +15511 # var line: (stream byte 512) +15512 # var word-slice: slice +15513 # while true # line loop +15514 # clear-stream(line) +15515 # read-line-buffered(in, line) +15516 # if (line->write == 0) break # end of file +15517 # word-slice = next-mu-token(line) +15518 # if slice-empty?(word-slice) # end of line +15519 # continue +15520 # else if slice-starts-with?(word-slice, "#") # comment +15521 # continue # end of line +15522 # else if slice-equal?(word-slice, "fn") +15523 # var new-function: (handle function) = allocate(function) +15524 # var vars: (stack live-var 256) +15525 # populate-mu-function-header(line, new-function, vars) +15526 # populate-mu-function-body(in, new-function, vars) +15527 # assert(vars->top == 0) +15528 # *curr-function = new-function +15529 # curr-function = &new-function->next +15530 # else if slice-equal?(word-slice, "sig") +15531 # var new-function: (handle function) = allocate(function) +15532 # populate-mu-function-signature(line, new-function) +15533 # *curr-signature = new-function +15534 # curr-signature = &new-function->next +15535 # else if slice-equal?(word-slice, "type") +15536 # word-slice = next-mu-token(line) +15537 # type-id = pos-or-insert-slice(Type-id, word-slice) +15538 # var new-type: (handle typeinfo) = find-or-create-typeinfo(type-id) +15539 # assert(next-word(line) == "{") +15540 # populate-mu-type(in, new-type) +15541 # else +15542 # abort() +15543 # +15544 # . prologue +15545 55/push-ebp +15546 89/<- %ebp 4/r32/esp +15547 # var curr-signature: (addr handle function) at *(ebp-4) +15548 68/push _Program-signatures/imm32 +15549 # . save registers +15550 50/push-eax +15551 51/push-ecx +15552 52/push-edx +15553 53/push-ebx +15554 56/push-esi +15555 57/push-edi +15556 # var line/ecx: (stream byte 512) +15557 81 5/subop/subtract %esp 0x200/imm32 +15558 68/push 0x200/imm32/size +15559 68/push 0/imm32/read +15560 68/push 0/imm32/write +15561 89/<- %ecx 4/r32/esp +15562 # var word-slice/edx: slice +15563 68/push 0/imm32/end +15564 68/push 0/imm32/start +15565 89/<- %edx 4/r32/esp +15566 # var curr-function/edi: (addr handle function) +15567 bf/copy-to-edi _Program-functions/imm32 +15568 # var vars/ebx: (stack live-var 256) +15569 81 5/subop/subtract %esp 0xc00/imm32 +15570 68/push 0xc00/imm32/size +15571 68/push 0/imm32/top +15572 89/<- %ebx 4/r32/esp +15573 { +15574 $parse-mu:line-loop: +15575 (clear-stream %ecx) +15576 (read-line-buffered *(ebp+8) %ecx) +15577 # if (line->write == 0) break +15578 81 7/subop/compare *ecx 0/imm32 +15579 0f 84/jump-if-= break/disp32 +15580 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------ +15586 (next-mu-token %ecx %edx) +15587 # if slice-empty?(word-slice) continue +15588 (slice-empty? %edx) # => eax +15589 3d/compare-eax-and 0/imm32/false +15590 0f 85/jump-if-!= loop/disp32 +15591 # if (*word-slice->start == "#") continue +15592 # . eax = *word-slice->start +15593 8b/-> *edx 0/r32/eax +15594 8a/copy-byte *eax 0/r32/AL +15595 81 4/subop/and %eax 0xff/imm32 +15596 # . if (eax == '#') continue +15597 3d/compare-eax-and 0x23/imm32/hash +15598 0f 84/jump-if-= loop/disp32 +15599 # if (slice-equal?(word-slice, "fn")) parse a function +15600 { +15601 $parse-mu:fn: +15602 (slice-equal? %edx "fn") # => eax +15603 3d/compare-eax-and 0/imm32/false +15604 0f 84/jump-if-= break/disp32 +15605 # var new-function/esi: (handle function) +15606 68/push 0/imm32 +15607 68/push 0/imm32 +15608 89/<- %esi 4/r32/esp +15609 # populate-mu-function(line, in, vars, new-function) +15610 (allocate Heap *Function-size %esi) +15611 # var new-function-addr/eax: (addr function) +15612 (lookup *esi *(esi+4)) # => eax +15613 # initialize vars +15614 (clear-stack %ebx) +15615 # +15616 (populate-mu-function-header %ecx %eax %ebx *(ebp+0xc) *(ebp+0x10)) +15617 (populate-mu-function-body *(ebp+8) %eax %ebx *(ebp+0xc) *(ebp+0x10)) +15618 # *curr-function = new-function +15619 8b/-> *esi 0/r32/eax +15620 89/<- *edi 0/r32/eax +15621 8b/-> *(esi+4) 0/r32/eax +15622 89/<- *(edi+4) 0/r32/eax +15623 # curr-function = &new-function->next +15624 # . var tmp/eax: (addr function) = lookup(new-function) +15625 (lookup *esi *(esi+4)) # => eax +15626 # . curr-function = &tmp->next +15627 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next +15628 # reclaim new-function +15629 81 0/subop/add %esp 8/imm32 +15630 # +15631 e9/jump $parse-mu:line-loop/disp32 +15632 } +15633 # if (slice-equal?(word-slice, "sig")) parse a function signature +15634 # Function signatures are for providing types to SubX functions. +15635 { +15636 $parse-mu:sig: +15637 (slice-equal? %edx "sig") # => eax +15638 3d/compare-eax-and 0/imm32/false +15639 0f 84/jump-if-= break/disp32 +15640 # edi = curr-function +15641 57/push-edi +15642 8b/-> *(ebp-4) 7/r32/edi +15643 # var new-function/esi: (handle function) +15644 68/push 0/imm32 +15645 68/push 0/imm32 +15646 89/<- %esi 4/r32/esp +15647 # populate-mu-function(line, in, vars, new-function) +15648 (allocate Heap *Function-size %esi) +15649 # var new-function-addr/eax: (addr function) +15650 (lookup *esi *(esi+4)) # => eax +15651 # +15652 (populate-mu-function-signature %ecx %eax *(ebp+0xc) *(ebp+0x10)) +15653 # *curr-signature = new-function +15654 8b/-> *esi 0/r32/eax +15655 89/<- *edi 0/r32/eax +15656 8b/-> *(esi+4) 0/r32/eax +15657 89/<- *(edi+4) 0/r32/eax +15658 # curr-signature = &new-function->next +15659 # . var tmp/eax: (addr function) = lookup(new-function) +15660 (lookup *esi *(esi+4)) # => eax +15661 # . curr-function = &tmp->next +15662 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next +15663 # reclaim new-function +15664 81 0/subop/add %esp 8/imm32 +15665 # save curr-function +15666 89/<- *(ebp-4) 7/r32/edi +15667 # restore edi +15668 5f/pop-to-edi +15669 # +15670 e9/jump $parse-mu:line-loop/disp32 +15671 } +15672 # if (slice-equal?(word-slice, "type")) parse a type (struct/record) definition +15673 { +15674 $parse-mu:type: +15675 (slice-equal? %edx "type") # => eax +15676 3d/compare-eax-and 0/imm32 +15677 0f 84/jump-if-= break/disp32 +15678 (next-mu-token %ecx %edx) +15679 # var type-id/eax: int +15680 (pos-or-insert-slice Type-id %edx) # => eax +15681 # spill +15682 51/push-ecx +15683 # var new-type/ecx: (handle typeinfo) +15684 68/push 0/imm32 +15685 68/push 0/imm32 +15686 89/<- %ecx 4/r32/esp +15687 (find-or-create-typeinfo %eax %ecx) +15688 # +15689 (lookup *ecx *(ecx+4)) # => eax +15690 # TODO: ensure that 'line' has nothing else but '{' +15691 #? (dump-typeinfos "=== aaa\n") +15692 (populate-mu-type *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) # => eax +15693 #? (dump-typeinfos "=== zzz\n") +15694 # reclaim new-type +15695 81 0/subop/add %esp 8/imm32 +15696 # restore +15697 59/pop-to-ecx +15698 e9/jump $parse-mu:line-loop/disp32 +15699 } +15700 # otherwise abort +15701 e9/jump $parse-mu:error1/disp32 +15702 } # end line loop +15703 $parse-mu:end: +15704 # . reclaim locals +15705 81 0/subop/add %esp 0x20c/imm32 # line +15706 81 0/subop/add %esp 0xc08/imm32 # vars +15707 81 0/subop/add %esp 8/imm32 +15708 # . restore registers +15709 5f/pop-to-edi +15710 5e/pop-to-esi +15711 5b/pop-to-ebx +15712 5a/pop-to-edx +15713 59/pop-to-ecx +15714 58/pop-to-eax +15715 # . reclaim local +15716 81 0/subop/add %esp 4/imm32 15717 # . epilogue 15718 89/<- %esp 5/r32/ebp 15719 5d/pop-to-ebp 15720 c3/return 15721 -15722 test-function-header-with-multiple-args-and-outputs: -15723 # . prologue -15724 55/push-ebp -15725 89/<- %ebp 4/r32/esp -15726 # setup -15727 8b/-> *Primitive-type-ids 0/r32/eax -15728 89/<- *Type-id 0/r32/eax # stream-write -15729 c7 0/subop/copy *_Program-functions 0/imm32 -15730 c7 0/subop/copy *_Program-functions->payload 0/imm32 -15731 c7 0/subop/copy *_Program-types 0/imm32 -15732 c7 0/subop/copy *_Program-types->payload 0/imm32 -15733 c7 0/subop/copy *_Program-signatures 0/imm32 -15734 c7 0/subop/copy *_Program-signatures->payload 0/imm32 -15735 (clear-stream _test-input-stream) -15736 (write _test-input-stream "foo a: int, b: int, c: int -> _/ecx: int _/edx: int {\n") -15737 # result/ecx: function -15738 2b/subtract *Function-size 4/r32/esp -15739 89/<- %ecx 4/r32/esp -15740 (zero-out %ecx *Function-size) -15741 # var vars/ebx: (stack live-var 16) -15742 81 5/subop/subtract %esp 0xc0/imm32 -15743 68/push 0xc0/imm32/size -15744 68/push 0/imm32/top -15745 89/<- %ebx 4/r32/esp -15746 # convert -15747 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) -15748 # check result->name -15749 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax -15750 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args-and-outputs/name") -15751 # var inouts/edx: (addr list var) = lookup(result->inouts) -15752 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax -15753 89/<- %edx 0/r32/eax -15754 $test-function-header-with-multiple-args-and-outputs:inout0: -15755 # var v/ebx: (addr var) = lookup(inouts->value) -15756 (lookup *edx *(edx+4)) # List-value List-value => eax -15757 89/<- %ebx 0/r32/eax -15758 # check v->name -15759 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -15760 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0") -15761 # check v->type -15762 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -15763 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0") # Type-tree-is-atom -15764 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1") # Type-tree-value -15765 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:2") # Type-tree-right -15766 $test-function-header-with-multiple-args-and-outputs:inout1: -15767 # inouts = lookup(inouts->next) -15768 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -15769 89/<- %edx 0/r32/eax -15770 # v = lookup(inouts->value) -15771 (lookup *edx *(edx+4)) # List-value List-value => eax -15772 89/<- %ebx 0/r32/eax -15773 # check v->name -15774 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -15775 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1") -15776 # check v->type -15777 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -15778 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0") # Type-tree-is-atom -15779 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1") # Type-tree-value -15780 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:2") # Type-tree-right -15781 $test-function-header-with-multiple-args-and-outputs:inout2: -15782 # inouts = lookup(inouts->next) -15783 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -15784 89/<- %edx 0/r32/eax -15785 # v = lookup(inouts->value) -15786 (lookup *edx *(edx+4)) # List-value List-value => eax -15787 89/<- %ebx 0/r32/eax -15788 # check v->name -15789 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -15790 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2") -15791 # check v->type -15792 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -15793 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0") # Type-tree-is-atom -15794 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1") # Type-tree-value -15795 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:2") # Type-tree-right -15796 $test-function-header-with-multiple-args-and-outputs:out0: -15797 # var outputs/edx: (addr list var) = lookup(result->outputs) -15798 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax -15799 89/<- %edx 0/r32/eax -15800 # v = lookup(outputs->value) -15801 (lookup *edx *(edx+4)) # List-value List-value => eax -15802 89/<- %ebx 0/r32/eax -15803 # check v->name -15804 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -15805 (check-strings-equal %eax "_" "F - test-function-header-with-multiple-args-and-outputs/output:0") -15806 # check v->register -15807 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -15808 (check-strings-equal %eax "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register") -15809 # check v->type -15810 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -15811 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:0") # Type-tree-is-atom -15812 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1") # Type-tree-value -15813 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:2") # Type-tree-right -15814 $test-function-header-with-multiple-args-and-outputs:out1: -15815 # outputs = lookup(outputs->next) -15816 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -15817 89/<- %edx 0/r32/eax -15818 # v = lookup(inouts->value) -15819 (lookup *edx *(edx+4)) # List-value List-value => eax -15820 89/<- %ebx 0/r32/eax -15821 # check v->name -15822 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -15823 (check-strings-equal %eax "_" "F - test-function-header-with-multiple-args-and-outputs/output:1") -15824 # check v->register -15825 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -15826 (check-strings-equal %eax "edx" "F - test-function-header-with-multiple-args-and-outputs/output:1/register") -15827 # check v->type -15828 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -15829 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:0") # Type-tree-is-atom -15830 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1") # Type-tree-value -15831 (check-ints-equal *(eax+0c) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:2") # Type-tree-right -15832 # . epilogue -15833 89/<- %esp 5/r32/ebp -15834 5d/pop-to-ebp -15835 c3/return -15836 -15837 # format for variables with types -15838 # x: int -15839 # x: int, -15840 # x/eax: int -15841 # x/eax: int, -15842 # ignores at most one trailing comma -15843 # WARNING: modifies name -15844 parse-var-with-type: # name: (addr slice), first-line: (addr stream byte), out: (addr handle var), fn-name: (addr array byte), err: (addr buffered-file), ed: (addr exit-descriptor) -15845 # pseudocode: -15846 # var s: slice -15847 # if (!slice-ends-with(name, ":")) -15848 # abort -15849 # --name->end to skip ':' -15850 # next-token-from-slice(name->start, name->end, '/', s) -15851 # new-var-from-slice(s, out) -15852 # ## register -15853 # next-token-from-slice(s->end, name->end, '/', s) -15854 # if (!slice-empty?(s)) -15855 # out->register = slice-to-string(s) -15856 # ## type -15857 # var type: (handle type-tree) = parse-type(first-line) -15858 # out->type = type -15859 # -15860 # . prologue -15861 55/push-ebp -15862 89/<- %ebp 4/r32/esp -15863 # . save registers -15864 50/push-eax -15865 51/push-ecx -15866 52/push-edx -15867 53/push-ebx -15868 56/push-esi -15869 57/push-edi -15870 # esi = name -15871 8b/-> *(ebp+8) 6/r32/esi -15872 # if (!slice-ends-with?(name, ":")) abort -15873 8b/-> *(esi+4) 1/r32/ecx # Slice-end -15874 49/decrement-ecx -15875 8a/copy-byte *ecx 1/r32/CL -15876 81 4/subop/and %ecx 0xff/imm32 -15877 81 7/subop/compare %ecx 0x3a/imm32/colon -15878 0f 85/jump-if-!= $parse-var-with-type:abort/disp32 -15879 # --name->end to skip ':' -15880 ff 1/subop/decrement *(esi+4) -15881 # var s/ecx: slice -15882 68/push 0/imm32/end -15883 68/push 0/imm32/start -15884 89/<- %ecx 4/r32/esp -15885 $parse-var-with-type:parse-name: -15886 (next-token-from-slice *esi *(esi+4) 0x2f %ecx) # Slice-start, Slice-end, '/' -15887 $parse-var-with-type:create-var: -15888 # new-var-from-slice(s, out) -15889 (new-var-from-slice Heap %ecx *(ebp+0x10)) -15890 # save out->register -15891 $parse-var-with-type:save-register: -15892 # . var out-addr/edi: (addr var) = lookup(*out) -15893 8b/-> *(ebp+0x10) 7/r32/edi -15894 (lookup *edi *(edi+4)) # => eax -15895 89/<- %edi 0/r32/eax -15896 # . s = next-token(...) -15897 (next-token-from-slice *(ecx+4) *(esi+4) 0x2f %ecx) # s->end, name->end, '/' -15898 # . if (!slice-empty?(s)) out->register = slice-to-string(s) -15899 { -15900 $parse-var-with-type:write-register: -15901 (slice-empty? %ecx) # => eax +15722 $parse-mu:error1: +15723 # error("unexpected top-level command: " word-slice "\n") +15724 (write-buffered *(ebp+0xc) "unexpected top-level command: ") +15725 (write-slice-buffered *(ebp+0xc) %edx) +15726 (write-buffered *(ebp+0xc) "\n") +15727 (flush *(ebp+0xc)) +15728 (stop *(ebp+0x10) 1) +15729 # never gets here +15730 +15731 $parse-mu:error2: +15732 # error(vars->top " vars not reclaimed after fn '" new-function->name "'\n") +15733 (write-int32-hex-buffered *(ebp+0xc) *ebx) +15734 (write-buffered *(ebp+0xc) " vars not reclaimed after fn '") +15735 (write-slice-buffered *(ebp+0xc) *eax) # Function-name +15736 (write-buffered *(ebp+0xc) "'\n") +15737 (flush *(ebp+0xc)) +15738 (stop *(ebp+0x10) 1) +15739 # never gets here +15740 +15741 # scenarios considered: +15742 # ✗ fn foo # no block +15743 # ✓ fn foo { +15744 # ✗ fn foo { { +15745 # ✗ fn foo { } +15746 # ✗ fn foo { } { +15747 # ✗ fn foo x { +15748 # ✗ fn foo x: { +15749 # ✓ fn foo x: int { +15750 # ✓ fn foo x: int { +15751 # ✓ fn foo x: int -> _/eax: int { +15752 # TODO: +15753 # disallow outputs of type `(... addr ...)` +15754 # disallow inputs of type `(... addr ... addr ...)` +15755 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) +15756 # pseudocode: +15757 # var word-slice: slice +15758 # next-mu-token(first-line, word-slice) +15759 # if slice-empty?(word-slice) abort +15760 # assert(word-slice not in '{' '}' '->') +15761 # out->name = slice-to-string(word-slice) +15762 # ## inouts +15763 # while true +15764 # word-slice = next-mu-token(first-line) +15765 # if slice-empty?(word-slice) abort +15766 # if (word-slice == '{') goto done +15767 # if (word-slice == '->') break +15768 # assert(word-slice != '}') +15769 # var v: (handle var) = parse-var-with-type(word-slice, first-line) +15770 # assert(v->register == null) +15771 # # v->block-depth is implicitly 0 +15772 # out->inouts = append(v, out->inouts) +15773 # push(vars, {v, false}) +15774 # ## outputs +15775 # while true +15776 # word-slice = next-mu-token(first-line) +15777 # if slice-empty?(word-slice) abort +15778 # if (word-slice == '{') break +15779 # assert(word-slice not in '}' '->') +15780 # var v: (handle var) = parse-var-with-type(word-slice, first-line) +15781 # assert(v->register != null) +15782 # assert(v->name == "_") +15783 # out->outputs = append(v, out->outputs) +15784 # done: +15785 # +15786 # . prologue +15787 55/push-ebp +15788 89/<- %ebp 4/r32/esp +15789 # . save registers +15790 50/push-eax +15791 51/push-ecx +15792 52/push-edx +15793 53/push-ebx +15794 57/push-edi +15795 # edi = out +15796 8b/-> *(ebp+0xc) 7/r32/edi +15797 # var word-slice/ecx: slice +15798 68/push 0/imm32/end +15799 68/push 0/imm32/start +15800 89/<- %ecx 4/r32/esp +15801 # var v/ebx: (handle var) +15802 68/push 0/imm32 +15803 68/push 0/imm32 +15804 89/<- %ebx 4/r32/esp +15805 # read function name +15806 (next-mu-token *(ebp+8) %ecx) +15807 # error checking +15808 # if slice-empty?(word-slice) abort +15809 (slice-empty? %ecx) # => eax +15810 3d/compare-eax-and 0/imm32/false +15811 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +15812 # if (word-slice == '{') abort +15813 (slice-equal? %ecx "{") # => eax +15814 3d/compare-eax-and 0/imm32/false +15815 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +15816 # if (word-slice == '->') abort +15817 (slice-equal? %ecx "->") # => eax +15818 3d/compare-eax-and 0/imm32/false +15819 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +15820 # if (word-slice == '}') abort +15821 (slice-equal? %ecx "}") # => eax +15822 3d/compare-eax-and 0/imm32/false +15823 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +15824 # if word-slice already defined, abort +15825 (function-exists? %ecx) # => eax +15826 3d/compare-eax-and 0/imm32/false +15827 0f 85/jump-if-!= $populate-mu-function-header:error-duplicate/disp32 +15828 # +15829 (slice-starts-with? %ecx "break") # => eax +15830 3d/compare-eax-and 0/imm32/false +15831 0f 85/jump-if-!= $populate-mu-function-header:error-break/disp32 +15832 (slice-starts-with? %ecx "loop") # => eax +15833 3d/compare-eax-and 0/imm32/false +15834 0f 85/jump-if-!= $populate-mu-function-header:error-loop/disp32 +15835 (slice-equal? %ecx "lookup") # => eax +15836 3d/compare-eax-and 0/imm32/false +15837 0f 85/jump-if-!= $populate-mu-function-header:error-lookup/disp32 +15838 # save function name +15839 (slice-to-string Heap %ecx %edi) # Function-name +15840 # save function inouts +15841 { +15842 $populate-mu-function-header:check-for-inout: +15843 (next-mu-token *(ebp+8) %ecx) +15844 # if slice-empty?(word-slice) abort +15845 (slice-empty? %ecx) # => eax +15846 3d/compare-eax-and 0/imm32/false +15847 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +15848 # if (word-slice == '{') goto done +15849 (slice-equal? %ecx "{") # => eax +15850 3d/compare-eax-and 0/imm32/false +15851 0f 85/jump-if-!= $populate-mu-function-header:done/disp32 +15852 # if (word-slice == '->') break +15853 (slice-equal? %ecx "->") # => eax +15854 3d/compare-eax-and 0/imm32/false +15855 0f 85/jump-if-!= break/disp32 +15856 # if (word-slice == '}') abort +15857 (slice-equal? %ecx "}") # => eax +15858 3d/compare-eax-and 0/imm32/false +15859 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +15860 # v = parse-var-with-type(word-slice, first-line) +15861 (lookup *edi *(edi+4)) # Function-name Function-name => eax +15862 (parse-var-with-type %ecx *(ebp+8) %ebx %eax *(ebp+0x14) *(ebp+0x18)) +15863 # if (v->register != null) abort +15864 # . eax: (addr var) = lookup(v) +15865 (lookup *ebx *(ebx+4)) # => eax +15866 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +15867 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32 +15868 # if function name is not "main" +15869 # and v->type contains an 'addr' anywhere except the start, abort +15870 { +15871 (lookup *edi *(edi+4)) # Function-name Function-name => eax +15872 (string-equal? %eax "main") # => eax +15873 3d/compare-eax-and 0/imm32/false +15874 75/jump-if-!= break/disp8 +15875 (lookup *ebx *(ebx+4)) # => eax +15876 (addr-payload-contains-addr? %eax) # => eax +15877 3d/compare-eax-and 0/imm32/false +15878 0f 85/jump-if-!= $populate-mu-function-header:error-nested-addr-inout/disp32 +15879 } +15880 # v->block-depth is implicitly 0 +15881 # +15882 # out->inouts = append(v, out->inouts) +15883 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts +15884 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts +15885 # push(vars, {v, false}) +15886 (push *(ebp+0x10) *ebx) +15887 (push *(ebp+0x10) *(ebx+4)) +15888 (push *(ebp+0x10) 0) # false +15889 # +15890 e9/jump loop/disp32 +15891 } +15892 # save function outputs +15893 { +15894 $populate-mu-function-header:check-for-out: +15895 (next-mu-token *(ebp+8) %ecx) +15896 # if slice-empty?(word-slice) abort +15897 (slice-empty? %ecx) # => eax +15898 3d/compare-eax-and 0/imm32/false +15899 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +15900 # if (word-slice == '{') break +15901 (slice-equal? %ecx "{") # => eax 15902 3d/compare-eax-and 0/imm32/false -15903 75/jump-if-!= break/disp8 -15904 # out->register = slice-to-string(s) -15905 8d/copy-address *(edi+0x18) 0/r32/eax # Var-register -15906 (slice-to-string Heap %ecx %eax) -15907 } -15908 $parse-var-with-type:save-type: -15909 8d/copy-address *(edi+8) 0/r32/eax # Var-type -15910 (parse-type Heap *(ebp+0xc) %eax *(ebp+0x18) *(ebp+0x1c)) -15911 $parse-var-with-type:check-register: -15912 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax -15913 3d/compare-eax-and 0/imm32 -15914 74/jump-if-= $parse-var-with-type:end/disp8 -15915 (is-float-register? %eax) # => eax -15916 { -15917 3d/compare-eax-and 0/imm32/false -15918 74/jump-if-= break/disp8 -15919 # var is in a float register; ensure type is float -15920 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -15921 (is-simple-mu-type? %eax 0xf) # float => eax -15922 3d/compare-eax-and 0/imm32/false -15923 0f 84/jump-if-= $parse-var-with-type:error-non-float-in-floating-point-register/disp32 -15924 eb/jump $parse-var-with-type:end/disp8 -15925 } -15926 # var is not in a float register; ensure type is not float -15927 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -15928 (is-simple-mu-type? %eax 0xf) # float => eax -15929 3d/compare-eax-and 0/imm32/false -15930 0f 85/jump-if-!= $parse-var-with-type:error-float-in-integer-register/disp32 -15931 $parse-var-with-type:end: -15932 # . reclaim locals -15933 81 0/subop/add %esp 8/imm32 -15934 # . restore registers -15935 5f/pop-to-edi -15936 5e/pop-to-esi -15937 5b/pop-to-ebx -15938 5a/pop-to-edx -15939 59/pop-to-ecx -15940 58/pop-to-eax -15941 # . epilogue -15942 89/<- %esp 5/r32/ebp -15943 5d/pop-to-ebp -15944 c3/return -15945 -15946 $parse-var-with-type:abort: -15947 # error("fn " fn ": var should have form 'name: type' in '" line "'\n") -15948 (write-buffered *(ebp+0x18) "fn ") -15949 (write-buffered *(ebp+0x18) *(ebp+0x14)) -15950 (write-buffered *(ebp+0x18) ": var should have form 'name: type' in '") -15951 (flush *(ebp+0x18)) -15952 (rewind-stream *(ebp+0xc)) -15953 (write-stream-data *(ebp+0x18) *(ebp+0xc)) -15954 (write-buffered *(ebp+0x18) "'\n") -15955 (flush *(ebp+0x18)) -15956 (stop *(ebp+0x1c) 1) -15957 # never gets here -15958 -15959 $parse-var-with-type:error-float-in-integer-register: -15960 # error("fn " fn ": float var '" var "' should be in a floating-point register\n") -15961 (write-buffered *(ebp+0x18) "fn ") -15962 (write-buffered *(ebp+0x18) *(ebp+0x14)) -15963 (write-buffered *(ebp+0x18) ": float var '") -15964 (lookup *edi *(edi+4)) # Var-name Var-name => eax -15965 (write-buffered *(ebp+0x18) %eax) -15966 (write-buffered *(ebp+0x18) "' should be in a floating-point register\n") -15967 (flush *(ebp+0x18)) -15968 (stop *(ebp+0x1c) 1) -15969 # never gets here -15970 -15971 $parse-var-with-type:error-non-float-in-floating-point-register: -15972 # error("fn " fn ": non-float var '" var "' should be in an integer register\n") -15973 (write-buffered *(ebp+0x18) "fn ") -15974 (write-buffered *(ebp+0x18) *(ebp+0x14)) -15975 (write-buffered *(ebp+0x18) ": non-float var '") -15976 (lookup *edi *(edi+4)) # Var-name Var-name => eax -15977 (write-buffered *(ebp+0x18) %eax) -15978 (write-buffered *(ebp+0x18) "' should be in an integer register\n") -15979 (flush *(ebp+0x18)) -15980 (stop *(ebp+0x1c) 1) -15981 # never gets here -15982 -15983 is-float-register?: # r: (addr array byte) -> result/eax: boolean -15984 # . prologue -15985 55/push-ebp -15986 89/<- %ebp 4/r32/esp -15987 # -15988 (get Mu-registers-unique *(ebp+8) 0xc "Mu-registers-unique") # => eax -15989 81 7/subop/compare *eax 8/imm32/start-of-floating-point-registers -15990 0f 9d/set-if->= %al -15991 81 4/subop/and %eax 0xff/imm32 -15992 $is-float-register?:end: -15993 # . epilogue -15994 89/<- %esp 5/r32/ebp -15995 5d/pop-to-ebp -15996 c3/return +15903 0f 85/jump-if-!= break/disp32 +15904 # if (word-slice == '->') abort +15905 (slice-equal? %ecx "->") # => eax +15906 3d/compare-eax-and 0/imm32/false +15907 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +15908 # if (word-slice == '}') abort +15909 (slice-equal? %ecx "}") # => eax +15910 3d/compare-eax-and 0/imm32/false +15911 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +15912 # v = parse-var-with-type(word-slice, first-line) +15913 (lookup *edi *(edi+4)) # Function-name Function-name => eax +15914 (parse-var-with-type %ecx *(ebp+8) %ebx %eax *(ebp+0x14) *(ebp+0x18)) +15915 # assert(var->register != null) +15916 # . eax: (addr var) = lookup(v) +15917 (lookup *ebx *(ebx+4)) # => eax +15918 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +15919 0f 84/jump-if-= $populate-mu-function-header:error3/disp32 +15920 # if (var->name != "_") abort +15921 (lookup *eax *(eax+4)) # Var-name Var-name => eax +15922 (string-equal? %eax "_") # => eax +15923 3d/compare-eax-and 0/imm32/false +15924 0f 84/jump-if-= $populate-mu-function-header:error4/disp32 +15925 # if v->type is an addr, abort +15926 (lookup *ebx *(ebx+4)) # => eax +15927 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +15928 (is-mu-addr-type? %eax) # => eax +15929 3d/compare-eax-and 0/imm32/false +15930 0f 85/jump-if-!= $populate-mu-function-header:error-addr-output/disp32 +15931 # out->outputs = append(v, out->outputs) +15932 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs +15933 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs +15934 # +15935 e9/jump loop/disp32 +15936 } +15937 $populate-mu-function-header:done: +15938 (check-no-tokens-left *(ebp+8)) +15939 $populate-mu-function-header:end: +15940 # . reclaim locals +15941 81 0/subop/add %esp 0x10/imm32 +15942 # . restore registers +15943 5f/pop-to-edi +15944 5b/pop-to-ebx +15945 5a/pop-to-edx +15946 59/pop-to-ecx +15947 58/pop-to-eax +15948 # . epilogue +15949 89/<- %esp 5/r32/ebp +15950 5d/pop-to-ebp +15951 c3/return +15952 +15953 $populate-mu-function-header:error1: +15954 # error("function header not in form 'fn <name> {'") +15955 (write-buffered *(ebp+0x14) "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '") +15956 (flush *(ebp+0x14)) +15957 (rewind-stream *(ebp+8)) +15958 (write-stream-data *(ebp+0x14) *(ebp+8)) +15959 (write-buffered *(ebp+0x14) "'\n") +15960 (flush *(ebp+0x14)) +15961 (stop *(ebp+0x18) 1) +15962 # never gets here +15963 +15964 $populate-mu-function-header:error2: +15965 # error("fn " fn ": function inout '" var "' cannot be in a register") +15966 (write-buffered *(ebp+0x14) "fn ") +15967 50/push-eax +15968 (lookup *edi *(edi+4)) # Function-name Function-name => eax +15969 (write-buffered *(ebp+0x14) %eax) +15970 58/pop-to-eax +15971 (write-buffered *(ebp+0x14) ": function inout '") +15972 (lookup *eax *(eax+4)) # Var-name Var-name => eax +15973 (write-buffered *(ebp+0x14) %eax) +15974 (write-buffered *(ebp+0x14) "' cannot be in a register") +15975 (flush *(ebp+0x14)) +15976 (stop *(ebp+0x18) 1) +15977 # never gets here +15978 +15979 $populate-mu-function-header:error3: +15980 # error("fn " fn ": function output '" var "' must be in a register") +15981 (write-buffered *(ebp+0x14) "fn ") +15982 50/push-eax +15983 (lookup *edi *(edi+4)) # Function-name Function-name => eax +15984 (write-buffered *(ebp+0x14) %eax) +15985 58/pop-to-eax +15986 (write-buffered *(ebp+0x14) ": function output '") +15987 (lookup *ebx *(ebx+4)) # => eax +15988 (lookup *eax *(eax+4)) # Var-name Var-name => eax +15989 (write-buffered *(ebp+0x14) %eax) +15990 (write-buffered *(ebp+0x14) "' must be in a register, in instruction '") +15991 (rewind-stream *(ebp+8)) +15992 (write-stream-data *(ebp+0x14) *(ebp+8)) +15993 (write-buffered *(ebp+0x14) "'\n") +15994 (flush *(ebp+0x14)) +15995 (stop *(ebp+0x18) 1) +15996 # never gets here 15997 -15998 parse-type: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle type-tree), err: (addr buffered-file), ed: (addr exit-descriptor) -15999 # pseudocode: -16000 # var s: slice = next-mu-token(in) -16001 # assert s != "" -16002 # assert s != "->" -16003 # assert s != "{" -16004 # assert s != "}" -16005 # if s == ")" -16006 # return -16007 # out = allocate(Type-tree) -16008 # if s != "(" -16009 # HACK: if s is an int, parse and return it -16010 # out->is-atom? = true -16011 # if (s[0] == "_") -16012 # out->value = type-parameter -16013 # out->parameter-name = slice-to-string(ad, s) -16014 # else -16015 # out->value = pos-or-insert-slice(Type-id, s) -16016 # return -16017 # out->left = parse-type(ad, in) -16018 # out->right = parse-type-tree(ad, in) -16019 # -16020 # . prologue -16021 55/push-ebp -16022 89/<- %ebp 4/r32/esp -16023 # . save registers -16024 50/push-eax -16025 51/push-ecx -16026 52/push-edx -16027 # clear out -16028 (zero-out *(ebp+0x10) *Handle-size) -16029 # var s/ecx: slice -16030 68/push 0/imm32 -16031 68/push 0/imm32 -16032 89/<- %ecx 4/r32/esp -16033 # s = next-mu-token(in) -16034 (next-mu-token *(ebp+0xc) %ecx) -16035 #? (write-buffered Stderr "tok: ") -16036 #? (write-slice-buffered Stderr %ecx) -16037 #? (write-buffered Stderr "$\n") -16038 #? (flush Stderr) -16039 # assert s != "" -16040 (slice-equal? %ecx "") # => eax -16041 3d/compare-eax-and 0/imm32/false -16042 0f 85/jump-if-!= $parse-type:abort/disp32 -16043 # assert s != "{" -16044 (slice-equal? %ecx "{") # => eax -16045 3d/compare-eax-and 0/imm32/false -16046 0f 85/jump-if-!= $parse-type:abort/disp32 -16047 # assert s != "}" -16048 (slice-equal? %ecx "}") # => eax -16049 3d/compare-eax-and 0/imm32/false -16050 0f 85/jump-if-!= $parse-type:abort/disp32 -16051 # assert s != "->" -16052 (slice-equal? %ecx "->") # => eax -16053 3d/compare-eax-and 0/imm32/false -16054 0f 85/jump-if-!= $parse-type:abort/disp32 -16055 # if (s == ")") return -16056 (slice-equal? %ecx ")") # => eax -16057 3d/compare-eax-and 0/imm32/false -16058 0f 85/jump-if-!= $parse-type:end/disp32 -16059 # out = new tree -16060 (allocate *(ebp+8) *Type-tree-size *(ebp+0x10)) -16061 # var out-addr/edx: (addr type-tree) = lookup(*out) -16062 8b/-> *(ebp+0x10) 2/r32/edx -16063 (lookup *edx *(edx+4)) # => eax -16064 89/<- %edx 0/r32/eax -16065 { -16066 # if (s != "(") break -16067 (slice-equal? %ecx "(") # => eax -16068 3d/compare-eax-and 0/imm32/false -16069 0f 85/jump-if-!= break/disp32 -16070 # if s is a number, store it in the type's size field -16071 { -16072 $parse-type:check-for-int: -16073 # var tmp/eax: byte = *s->slice -16074 8b/-> *ecx 0/r32/eax -16075 8a/copy-byte *eax 0/r32/AL -16076 81 4/subop/and %eax 0xff/imm32 -16077 # TODO: raise an error on `var x: (array int a)` -16078 (is-decimal-digit? %eax) # => eax -16079 3d/compare-eax-and 0/imm32/false -16080 74/jump-if-= break/disp8 -16081 # -16082 (is-hex-int? %ecx) # => eax -16083 3d/compare-eax-and 0/imm32/false -16084 74/jump-if-= break/disp8 -16085 $parse-type:int: -16086 (check-mu-hex-int %ecx *(ebp+0x14) *(ebp+0x18)) -16087 (parse-hex-int-from-slice %ecx) # => eax -16088 c7 0/subop/copy *(edx+4) 9/imm32/type-id-array-capacity # Type-tree-value -16089 89/<- *(edx+8) 0/r32/eax # Type-tree-value-size -16090 e9/jump $parse-type:end/disp32 -16091 } -16092 $parse-type:atom: -16093 # out->is-atom? = true -16094 c7 0/subop/copy *edx 1/imm32/true # Type-tree-is-atom -16095 { -16096 $parse-type:check-for-type-parameter: -16097 # var tmp/eax: byte = *s->slice -16098 8b/-> *ecx 0/r32/eax -16099 8a/copy-byte *eax 0/r32/AL -16100 81 4/subop/and %eax 0xff/imm32 -16101 # if (tmp != '_') break -16102 3d/compare-eax-and 0x5f/imm32/_ -16103 75/jump-if-!= break/disp8 -16104 $parse-type:type-parameter: -16105 # out->value = type-parameter -16106 c7 0/subop/copy *(edx+4) 0xa/imm32/type-parameter # Type-tree-value -16107 # out->parameter-name = slice-to-string(ad, s) -16108 8d/copy-address *(edx+8) 0/r32/eax # Type-tree-parameter-name -16109 (slice-to-string *(ebp+8) %ecx %eax) -16110 e9/jump $parse-type:end/disp32 -16111 } -16112 $parse-type:non-type-parameter: -16113 # out->value = pos-or-insert-slice(Type-id, s) -16114 (pos-or-insert-slice Type-id %ecx) # => eax -16115 89/<- *(edx+4) 0/r32/eax # Type-tree-value -16116 e9/jump $parse-type:end/disp32 -16117 } -16118 $parse-type:non-atom: -16119 # otherwise s == "(" -16120 # out->left = parse-type(ad, in) -16121 8d/copy-address *(edx+4) 0/r32/eax # Type-tree-left -16122 (parse-type *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) -16123 # out->right = parse-type-tree(ad, in) -16124 8d/copy-address *(edx+0xc) 0/r32/eax # Type-tree-right -16125 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) -16126 $parse-type:end: -16127 # . reclaim locals -16128 81 0/subop/add %esp 8/imm32 -16129 # . restore registers -16130 5a/pop-to-edx -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-type:abort: -16139 # error("unexpected token when parsing type: '" s "'\n") -16140 (write-buffered *(ebp+0x14) "unexpected token when parsing type: '") -16141 (write-slice-buffered *(ebp+0x14) %ecx) -16142 (write-buffered *(ebp+0x14) "'\n") -16143 (flush *(ebp+0x14)) -16144 (stop *(ebp+0x18) 1) -16145 # never gets here -16146 -16147 parse-type-tree: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle type-tree), err: (addr buffered-file), ed: (addr exit-descriptor) -16148 # pseudocode: -16149 # var tmp: (handle type-tree) = parse-type(ad, in) -16150 # if tmp == 0 -16151 # return 0 -16152 # out = allocate(Type-tree) -16153 # out->left = tmp -16154 # out->right = parse-type-tree(ad, in) -16155 # -16156 # . prologue -16157 55/push-ebp -16158 89/<- %ebp 4/r32/esp -16159 # . save registers -16160 50/push-eax -16161 51/push-ecx -16162 52/push-edx -16163 # -16164 (zero-out *(ebp+0x10) *Handle-size) -16165 # var tmp/ecx: (handle type-tree) -16166 68/push 0/imm32 -16167 68/push 0/imm32 -16168 89/<- %ecx 4/r32/esp -16169 # tmp = parse-type(ad, in) -16170 (parse-type *(ebp+8) *(ebp+0xc) %ecx *(ebp+0x14) *(ebp+0x18)) -16171 # if (tmp == 0) return -16172 81 7/subop/compare *ecx 0/imm32 -16173 74/jump-if-= $parse-type-tree:end/disp8 -16174 # out = new tree -16175 (allocate *(ebp+8) *Type-tree-size *(ebp+0x10)) -16176 # var out-addr/edx: (addr tree) = lookup(*out) -16177 8b/-> *(ebp+0x10) 2/r32/edx -16178 (lookup *edx *(edx+4)) # => eax -16179 89/<- %edx 0/r32/eax -16180 # out->left = tmp -16181 8b/-> *ecx 0/r32/eax -16182 89/<- *(edx+4) 0/r32/eax # Type-tree-left -16183 8b/-> *(ecx+4) 0/r32/eax -16184 89/<- *(edx+8) 0/r32/eax # Type-tree-left -16185 # out->right = parse-type-tree(ad, in) -16186 8d/copy-address *(edx+0xc) 0/r32/eax # Type-tree-right -16187 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) -16188 $parse-type-tree:end: -16189 # . reclaim locals -16190 81 0/subop/add %esp 8/imm32 -16191 # . restore registers -16192 5a/pop-to-edx -16193 59/pop-to-ecx -16194 58/pop-to-eax -16195 # . epilogue -16196 89/<- %esp 5/r32/ebp -16197 5d/pop-to-ebp -16198 c3/return -16199 -16200 next-mu-token: # in: (addr stream byte), out: (addr slice) -16201 # pseudocode: -16202 # start: -16203 # skip-chars-matching-whitespace(in) -16204 # if in->read >= in->write # end of in -16205 # out = {0, 0} -16206 # return -16207 # out->start = &in->data[in->read] -16208 # var curr-byte/eax: byte = in->data[in->read] -16209 # if curr->byte == ',' # comment token -16210 # ++in->read -16211 # goto start -16212 # if curr-byte == '#' # comment -16213 # goto done # treat as eof -16214 # if curr-byte == '"' # string literal -16215 # skip-string(in) -16216 # goto done # no metadata -16217 # if curr-byte == '(' -16218 # ++in->read -16219 # goto done -16220 # if curr-byte == ')' -16221 # ++in->read -16222 # goto done -16223 # # read a word -16224 # while true -16225 # if in->read >= in->write -16226 # break -16227 # curr-byte = in->data[in->read] -16228 # if curr-byte == ' ' -16229 # break -16230 # if curr-byte == '\r' -16231 # break -16232 # if curr-byte == '\n' -16233 # break -16234 # if curr-byte == '(' -16235 # break -16236 # if curr-byte == ')' -16237 # break -16238 # if curr-byte == ',' -16239 # break -16240 # ++in->read -16241 # done: -16242 # out->end = &in->data[in->read] -16243 # -16244 # . prologue -16245 55/push-ebp -16246 89/<- %ebp 4/r32/esp -16247 # . save registers -16248 50/push-eax -16249 51/push-ecx -16250 56/push-esi -16251 57/push-edi -16252 # esi = in -16253 8b/-> *(ebp+8) 6/r32/esi -16254 # edi = out -16255 8b/-> *(ebp+0xc) 7/r32/edi -16256 $next-mu-token:start: -16257 (skip-chars-matching-whitespace %esi) -16258 $next-mu-token:check0: -16259 # if (in->read >= in->write) return out = {0, 0} -16260 # . ecx = in->read -16261 8b/-> *(esi+4) 1/r32/ecx -16262 # . if (ecx >= in->write) return out = {0, 0} -16263 3b/compare<- *esi 1/r32/ecx -16264 c7 0/subop/copy *edi 0/imm32 -16265 c7 0/subop/copy *(edi+4) 0/imm32 -16266 0f 8d/jump-if->= $next-mu-token:end/disp32 -16267 # out->start = &in->data[in->read] -16268 8d/copy-address *(esi+ecx+0xc) 0/r32/eax -16269 89/<- *edi 0/r32/eax -16270 # var curr-byte/eax: byte = in->data[in->read] -16271 31/xor-with %eax 0/r32/eax -16272 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL -16273 { -16274 $next-mu-token:check-for-comma: -16275 # if (curr-byte != ',') break -16276 3d/compare-eax-and 0x2c/imm32/comma -16277 75/jump-if-!= break/disp8 -16278 # ++in->read -16279 ff 0/subop/increment *(esi+4) -16280 # restart -16281 e9/jump $next-mu-token:start/disp32 -16282 } -16283 { -16284 $next-mu-token:check-for-comment: -16285 # if (curr-byte != '#') break -16286 3d/compare-eax-and 0x23/imm32/pound -16287 75/jump-if-!= break/disp8 -16288 # return eof -16289 e9/jump $next-mu-token:done/disp32 -16290 } -16291 { -16292 $next-mu-token:check-for-string-literal: -16293 # if (curr-byte != '"') break -16294 3d/compare-eax-and 0x22/imm32/dquote -16295 75/jump-if-!= break/disp8 -16296 (skip-string %esi) -16297 # return -16298 e9/jump $next-mu-token:done/disp32 -16299 } -16300 { -16301 $next-mu-token:check-for-open-paren: -16302 # if (curr-byte != '(') break -16303 3d/compare-eax-and 0x28/imm32/open-paren -16304 75/jump-if-!= break/disp8 -16305 # ++in->read -16306 ff 0/subop/increment *(esi+4) -16307 # return -16308 e9/jump $next-mu-token:done/disp32 -16309 } -16310 { -16311 $next-mu-token:check-for-close-paren: -16312 # if (curr-byte != ')') break -16313 3d/compare-eax-and 0x29/imm32/close-paren -16314 75/jump-if-!= break/disp8 -16315 # ++in->read -16316 ff 0/subop/increment *(esi+4) -16317 # return -16318 e9/jump $next-mu-token:done/disp32 -16319 } -16320 { -16321 $next-mu-token:regular-word-without-metadata: -16322 # if (in->read >= in->write) break -16323 # . ecx = in->read -16324 8b/-> *(esi+4) 1/r32/ecx -16325 # . if (ecx >= in->write) break -16326 3b/compare<- *esi 1/r32/ecx -16327 7d/jump-if->= break/disp8 -16328 # var c/eax: byte = in->data[in->read] -16329 31/xor-with %eax 0/r32/eax -16330 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL -16331 # if (c == ' ') break -16332 3d/compare-eax-and 0x20/imm32/space -16333 74/jump-if-= break/disp8 -16334 # if (c == '\r') break -16335 3d/compare-eax-and 0xd/imm32/carriage-return -16336 74/jump-if-= break/disp8 -16337 # if (c == '\n') break -16338 3d/compare-eax-and 0xa/imm32/newline -16339 74/jump-if-= break/disp8 -16340 # if (c == '(') break -16341 3d/compare-eax-and 0x28/imm32/open-paren -16342 0f 84/jump-if-= break/disp32 -16343 # if (c == ')') break -16344 3d/compare-eax-and 0x29/imm32/close-paren -16345 0f 84/jump-if-= break/disp32 -16346 # if (c == ',') break -16347 3d/compare-eax-and 0x2c/imm32/comma -16348 0f 84/jump-if-= break/disp32 -16349 # ++in->read -16350 ff 0/subop/increment *(esi+4) -16351 # -16352 e9/jump loop/disp32 -16353 } -16354 $next-mu-token:done: -16355 # out->end = &in->data[in->read] -16356 8b/-> *(esi+4) 1/r32/ecx -16357 8d/copy-address *(esi+ecx+0xc) 0/r32/eax -16358 89/<- *(edi+4) 0/r32/eax -16359 $next-mu-token:end: -16360 # . restore registers -16361 5f/pop-to-edi -16362 5e/pop-to-esi -16363 59/pop-to-ecx -16364 58/pop-to-eax -16365 # . epilogue -16366 89/<- %esp 5/r32/ebp -16367 5d/pop-to-ebp -16368 c3/return -16369 -16370 pos-or-insert-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int -16371 # . prologue -16372 55/push-ebp -16373 89/<- %ebp 4/r32/esp -16374 # if (pos-slice(arr, s) != -1) return it -16375 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax -16376 3d/compare-eax-and -1/imm32 -16377 75/jump-if-!= $pos-or-insert-slice:end/disp8 -16378 $pos-or-insert-slice:insert: -16379 # var s2/eax: (handle array byte) -16380 68/push 0/imm32 -16381 68/push 0/imm32 -16382 89/<- %eax 4/r32/esp -16383 (slice-to-string Heap *(ebp+0xc) %eax) -16384 # throw away alloc-id -16385 (lookup *eax *(eax+4)) # => eax -16386 (write-int *(ebp+8) %eax) -16387 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax -16388 $pos-or-insert-slice:end: -16389 # . reclaim locals -16390 81 0/subop/add %esp 8/imm32 -16391 # . epilogue -16392 89/<- %esp 5/r32/ebp -16393 5d/pop-to-ebp -16394 c3/return -16395 -16396 # return the index in an array of strings matching 's', -1 if not found -16397 # index is denominated in elements, not bytes -16398 pos-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int -16399 # . prologue -16400 55/push-ebp -16401 89/<- %ebp 4/r32/esp -16402 # . save registers -16403 51/push-ecx -16404 52/push-edx -16405 53/push-ebx -16406 56/push-esi -16407 #? (write-buffered Stderr "pos-slice: ") -16408 #? (write-slice-buffered Stderr *(ebp+0xc)) -16409 #? (write-buffered Stderr "\n") -16410 #? (flush Stderr) -16411 # esi = arr -16412 8b/-> *(ebp+8) 6/r32/esi -16413 # var index/ecx: int = 0 -16414 b9/copy-to-ecx 0/imm32 -16415 # var curr/edx: (addr (addr array byte)) = arr->data -16416 8d/copy-address *(esi+0xc) 2/r32/edx -16417 # var max/ebx: (addr (addr array byte)) = &arr->data[arr->write] -16418 8b/-> *esi 3/r32/ebx -16419 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx -16420 { -16421 #? (write-buffered Stderr " ") -16422 #? (write-int32-hex-buffered Stderr %ecx) -16423 #? (write-buffered Stderr "\n") -16424 #? (flush Stderr) -16425 # if (curr >= max) return -1 -16426 39/compare %edx 3/r32/ebx -16427 b8/copy-to-eax -1/imm32 -16428 73/jump-if-addr>= $pos-slice:end/disp8 -16429 # if (slice-equal?(s, *curr)) break -16430 (slice-equal? *(ebp+0xc) *edx) # => eax -16431 3d/compare-eax-and 0/imm32/false -16432 75/jump-if-!= break/disp8 -16433 # ++index -16434 41/increment-ecx -16435 # curr += 4 -16436 81 0/subop/add %edx 4/imm32 -16437 # -16438 eb/jump loop/disp8 -16439 } -16440 # return index -16441 89/<- %eax 1/r32/ecx -16442 $pos-slice:end: -16443 #? (write-buffered Stderr "=> ") -16444 #? (write-int32-hex-buffered Stderr %eax) -16445 #? (write-buffered Stderr "\n") -16446 # . restore registers -16447 5e/pop-to-esi -16448 5b/pop-to-ebx -16449 5a/pop-to-edx -16450 59/pop-to-ecx -16451 # . epilogue -16452 89/<- %esp 5/r32/ebp -16453 5d/pop-to-ebp -16454 c3/return -16455 -16456 test-parse-var-with-type: -16457 # . prologue -16458 55/push-ebp -16459 89/<- %ebp 4/r32/esp -16460 # setup -16461 8b/-> *Primitive-type-ids 0/r32/eax -16462 89/<- *Type-id 0/r32/eax # stream-write -16463 # (eax..ecx) = "x:" -16464 b8/copy-to-eax "x:"/imm32 -16465 8b/-> *eax 1/r32/ecx -16466 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16467 05/add-to-eax 4/imm32 -16468 # var slice/ecx: slice = {eax, ecx} -16469 51/push-ecx -16470 50/push-eax -16471 89/<- %ecx 4/r32/esp -16472 # _test-input-stream contains "int" -16473 (clear-stream _test-input-stream) -16474 (write _test-input-stream "int") -16475 # var v/edx: (handle var) -16476 68/push 0/imm32 -16477 68/push 0/imm32 -16478 89/<- %edx 4/r32/esp -16479 # -16480 (parse-var-with-type %ecx _test-input-stream %edx 0 Stderr 0) -16481 # var v-addr/edx: (addr var) = lookup(v) -16482 (lookup *edx *(edx+4)) # => eax -16483 89/<- %edx 0/r32/eax -16484 # check v-addr->name -16485 (lookup *edx *(edx+4)) # Var-name Var-name => eax -16486 (check-strings-equal %eax "x" "F - test-parse-var-with-type/name") -16487 # check v-addr->type -16488 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -16489 (check-ints-equal *eax 1 "F - test-parse-var-with-type/type:0") # Type-tree-is-atom -16490 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type/type:1") # Type-tree-value -16491 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type/type:2") # Type-tree-right -16492 # . epilogue -16493 89/<- %esp 5/r32/ebp -16494 5d/pop-to-ebp -16495 c3/return -16496 -16497 test-parse-var-with-type-and-register: -16498 # . prologue -16499 55/push-ebp -16500 89/<- %ebp 4/r32/esp -16501 # setup -16502 8b/-> *Primitive-type-ids 0/r32/eax -16503 89/<- *Type-id 0/r32/eax # stream-write -16504 # (eax..ecx) = "x/eax:" -16505 b8/copy-to-eax "x/eax:"/imm32 -16506 8b/-> *eax 1/r32/ecx -16507 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16508 05/add-to-eax 4/imm32 -16509 # var slice/ecx: slice = {eax, ecx} -16510 51/push-ecx -16511 50/push-eax -16512 89/<- %ecx 4/r32/esp -16513 # _test-input-stream contains "int" -16514 (clear-stream _test-input-stream) -16515 (write _test-input-stream "int") -16516 # var v/edx: (handle var) -16517 68/push 0/imm32 -16518 68/push 0/imm32 -16519 89/<- %edx 4/r32/esp -16520 # -16521 (parse-var-with-type %ecx _test-input-stream %edx 0 Stderr 0) -16522 # var v-addr/edx: (addr var) = lookup(v) -16523 (lookup *edx *(edx+4)) # => eax -16524 89/<- %edx 0/r32/eax -16525 # check v-addr->name -16526 (lookup *edx *(edx+4)) # Var-name Var-name => eax -16527 (check-strings-equal %eax "x" "F - test-parse-var-with-type-and-register/name") -16528 # check v-addr->register -16529 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -16530 (check-strings-equal %eax "eax" "F - test-parse-var-with-type-and-register/register") -16531 # check v-addr->type -16532 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -16533 (check-ints-equal *eax 1 "F - test-parse-var-with-type-and-register/type:0") # Type-tree-is-atom -16534 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type-and-register/type:1") # Type-tree-left -16535 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type-and-register/type:2") # Type-tree-right -16536 # . epilogue -16537 89/<- %esp 5/r32/ebp -16538 5d/pop-to-ebp -16539 c3/return -16540 -16541 test-parse-var-with-trailing-characters: -16542 # . prologue -16543 55/push-ebp -16544 89/<- %ebp 4/r32/esp -16545 # setup -16546 8b/-> *Primitive-type-ids 0/r32/eax -16547 89/<- *Type-id 0/r32/eax # stream-write -16548 # (eax..ecx) = "x:" -16549 b8/copy-to-eax "x:"/imm32 -16550 8b/-> *eax 1/r32/ecx -16551 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16552 05/add-to-eax 4/imm32 -16553 # var slice/ecx: slice = {eax, ecx} -16554 51/push-ecx -16555 50/push-eax -16556 89/<- %ecx 4/r32/esp -16557 # _test-input-stream contains "int," -16558 (clear-stream _test-input-stream) -16559 (write _test-input-stream "int,") -16560 # var v/edx: (handle var) -16561 68/push 0/imm32 -16562 68/push 0/imm32 -16563 89/<- %edx 4/r32/esp -16564 # -16565 (parse-var-with-type %ecx _test-input-stream %edx 0 Stderr 0) -16566 # var v-addr/edx: (addr var) = lookup(v) -16567 (lookup *edx *(edx+4)) # => eax -16568 89/<- %edx 0/r32/eax -16569 # check v-addr->name -16570 (lookup *edx *(edx+4)) # Var-name Var-name => eax -16571 (check-strings-equal %eax "x" "F - test-parse-var-with-trailing-characters/name") -16572 # check v-addr->register -16573 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-trailing-characters/register") # Var-register -16574 # check v-addr->type -16575 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -16576 (check-ints-equal *eax 1 "F - test-parse-var-with-trailing-characters/type:0") # Type-tree-is-atom -16577 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-trailing-characters/type:1") # Type-tree-left -16578 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-trailing-characters/type:1") # Type-tree-right -16579 # . epilogue -16580 89/<- %esp 5/r32/ebp -16581 5d/pop-to-ebp -16582 c3/return -16583 -16584 test-parse-var-with-register-and-trailing-characters: -16585 # . prologue -16586 55/push-ebp -16587 89/<- %ebp 4/r32/esp -16588 # setup -16589 8b/-> *Primitive-type-ids 0/r32/eax -16590 89/<- *Type-id 0/r32/eax # stream-write -16591 # (eax..ecx) = "x/eax:" -16592 b8/copy-to-eax "x/eax:"/imm32 -16593 8b/-> *eax 1/r32/ecx -16594 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16595 05/add-to-eax 4/imm32 -16596 # var slice/ecx: slice = {eax, ecx} -16597 51/push-ecx -16598 50/push-eax -16599 89/<- %ecx 4/r32/esp -16600 # _test-input-stream contains "int," -16601 (clear-stream _test-input-stream) -16602 (write _test-input-stream "int,") -16603 # var v/edx: (handle var) -16604 68/push 0/imm32 -16605 68/push 0/imm32 -16606 89/<- %edx 4/r32/esp -16607 # -16608 (parse-var-with-type %ecx _test-input-stream %edx 0 Stderr 0) -16609 # var v-addr/edx: (addr var) = lookup(v) -16610 (lookup *edx *(edx+4)) # => eax -16611 89/<- %edx 0/r32/eax -16612 # check v-addr->name -16613 (lookup *edx *(edx+4)) # Var-name Var-name => eax -16614 (check-strings-equal %eax "x" "F - test-parse-var-with-register-and-trailing-characters/name") -16615 # check v-addr->register -16616 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -16617 (check-strings-equal %eax "eax" "F - test-parse-var-with-register-and-trailing-characters/register") -16618 # check v-addr->type -16619 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -16620 (check-ints-equal *eax 1 "F - test-parse-var-with-register-and-trailing-characters/type:0") # Type-tree-is-atom -16621 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-register-and-trailing-characters/type:1") # Type-tree-left -16622 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-register-and-trailing-characters/type:2") # Type-tree-right -16623 # . epilogue -16624 89/<- %esp 5/r32/ebp -16625 5d/pop-to-ebp -16626 c3/return -16627 -16628 test-parse-var-with-compound-type: -16629 # . prologue -16630 55/push-ebp -16631 89/<- %ebp 4/r32/esp -16632 # setup -16633 8b/-> *Primitive-type-ids 0/r32/eax -16634 89/<- *Type-id 0/r32/eax # stream-write -16635 # (eax..ecx) = "x:" -16636 b8/copy-to-eax "x:"/imm32 -16637 8b/-> *eax 1/r32/ecx -16638 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16639 05/add-to-eax 4/imm32 -16640 # var slice/ecx: slice = {eax, ecx} -16641 51/push-ecx -16642 50/push-eax -16643 89/<- %ecx 4/r32/esp -16644 # _test-input-stream contains "(addr int)" -16645 (clear-stream _test-input-stream) -16646 (write _test-input-stream "(addr int)") -16647 # var v/edx: (handle var) -16648 68/push 0/imm32 -16649 68/push 0/imm32 -16650 89/<- %edx 4/r32/esp -16651 # -16652 (parse-var-with-type %ecx _test-input-stream %edx 0 Stderr 0) -16653 # var v-addr/edx: (addr var) = lookup(v) -16654 (lookup *edx *(edx+4)) # => eax -16655 89/<- %edx 0/r32/eax -16656 # check v-addr->name -16657 (lookup *edx *(edx+4)) # Var-name Var-name => eax -16658 (check-strings-equal %eax "x" "F - test-parse-var-with-compound-type/name") -16659 # check v-addr->register -16660 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-compound-type/register") # Var-register -16661 # - check v-addr->type -16662 # var type/edx: (addr type-tree) = var->type -16663 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -16664 89/<- %edx 0/r32/eax -16665 # type is a non-atom -16666 (check-ints-equal *edx 0 "F - test-parse-var-with-compound-type/type:0") # Type-tree-is-atom -16667 # type->left == atom(addr) -16668 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -16669 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:1") # Type-tree-is-atom -16670 (check-ints-equal *(eax+4) 2 "F - test-parse-var-with-compound-type/type:2") # Type-tree-value -16671 # type->right->left == atom(int) -16672 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax -16673 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -16674 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:3") # Type-tree-is-atom -16675 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-compound-type/type:4") # Type-tree-value -16676 # type->right->right == null -16677 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-compound-type/type:5") # Type-tree-right -16678 # . epilogue -16679 89/<- %esp 5/r32/ebp -16680 5d/pop-to-ebp -16681 c3/return -16682 -16683 # identifier starts with a letter or '$' or '_' -16684 # no constraints at the moment on later letters -16685 # all we really want to do so far is exclude '{', '}' and '->' -16686 is-identifier?: # in: (addr slice) -> result/eax: boolean -16687 # . prologue -16688 55/push-ebp -16689 89/<- %ebp 4/r32/esp -16690 # if (slice-empty?(in)) return false -16691 (slice-empty? *(ebp+8)) # => eax -16692 3d/compare-eax-and 0/imm32/false -16693 75/jump-if-!= $is-identifier?:false/disp8 -16694 # var c/eax: byte = *in->start -16695 8b/-> *(ebp+8) 0/r32/eax -16696 8b/-> *eax 0/r32/eax -16697 8a/copy-byte *eax 0/r32/AL -16698 81 4/subop/and %eax 0xff/imm32 -16699 # if (c == '$') return true -16700 3d/compare-eax-and 0x24/imm32/$ -16701 74/jump-if-= $is-identifier?:true/disp8 -16702 # if (c == '_') return true -16703 3d/compare-eax-and 0x5f/imm32/_ -16704 74/jump-if-= $is-identifier?:true/disp8 -16705 # drop case -16706 25/and-eax-with 0x5f/imm32 -16707 # if (c < 'A') return false -16708 3d/compare-eax-and 0x41/imm32/A -16709 7c/jump-if-< $is-identifier?:false/disp8 -16710 # if (c > 'Z') return false -16711 3d/compare-eax-and 0x5a/imm32/Z -16712 7f/jump-if-> $is-identifier?:false/disp8 -16713 # otherwise return true -16714 $is-identifier?:true: -16715 b8/copy-to-eax 1/imm32/true -16716 eb/jump $is-identifier?:end/disp8 -16717 $is-identifier?:false: -16718 b8/copy-to-eax 0/imm32/false -16719 $is-identifier?:end: -16720 # . epilogue -16721 89/<- %esp 5/r32/ebp -16722 5d/pop-to-ebp -16723 c3/return -16724 -16725 test-is-identifier-dollar: -16726 # . prologue -16727 55/push-ebp -16728 89/<- %ebp 4/r32/esp -16729 # (eax..ecx) = "$a" -16730 b8/copy-to-eax "$a"/imm32 -16731 8b/-> *eax 1/r32/ecx -16732 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16733 05/add-to-eax 4/imm32 -16734 # var slice/ecx: slice = {eax, ecx} -16735 51/push-ecx -16736 50/push-eax -16737 89/<- %ecx 4/r32/esp -16738 # -16739 (is-identifier? %ecx) -16740 (check-ints-equal %eax 1 "F - test-is-identifier-dollar") -16741 # . epilogue -16742 89/<- %esp 5/r32/ebp -16743 5d/pop-to-ebp -16744 c3/return -16745 -16746 test-is-identifier-underscore: -16747 # . prologue -16748 55/push-ebp -16749 89/<- %ebp 4/r32/esp -16750 # (eax..ecx) = "_a" -16751 b8/copy-to-eax "_a"/imm32 -16752 8b/-> *eax 1/r32/ecx -16753 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16754 05/add-to-eax 4/imm32 -16755 # var slice/ecx: slice = {eax, ecx} -16756 51/push-ecx -16757 50/push-eax -16758 89/<- %ecx 4/r32/esp -16759 # -16760 (is-identifier? %ecx) -16761 (check-ints-equal %eax 1 "F - test-is-identifier-underscore") -16762 # . epilogue -16763 89/<- %esp 5/r32/ebp -16764 5d/pop-to-ebp -16765 c3/return -16766 -16767 test-is-identifier-a: -16768 # . prologue -16769 55/push-ebp -16770 89/<- %ebp 4/r32/esp -16771 # (eax..ecx) = "a$" -16772 b8/copy-to-eax "a$"/imm32 -16773 8b/-> *eax 1/r32/ecx -16774 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16775 05/add-to-eax 4/imm32 -16776 # var slice/ecx: slice = {eax, ecx} -16777 51/push-ecx -16778 50/push-eax -16779 89/<- %ecx 4/r32/esp -16780 # -16781 (is-identifier? %ecx) -16782 (check-ints-equal %eax 1 "F - test-is-identifier-a") -16783 # . epilogue -16784 89/<- %esp 5/r32/ebp -16785 5d/pop-to-ebp -16786 c3/return -16787 -16788 test-is-identifier-z: -16789 # . prologue -16790 55/push-ebp -16791 89/<- %ebp 4/r32/esp -16792 # (eax..ecx) = "z$" -16793 b8/copy-to-eax "z$"/imm32 -16794 8b/-> *eax 1/r32/ecx -16795 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16796 05/add-to-eax 4/imm32 -16797 # var slice/ecx: slice = {eax, ecx} -16798 51/push-ecx -16799 50/push-eax -16800 89/<- %ecx 4/r32/esp -16801 # -16802 (is-identifier? %ecx) -16803 (check-ints-equal %eax 1 "F - test-is-identifier-z") -16804 # . epilogue -16805 89/<- %esp 5/r32/ebp -16806 5d/pop-to-ebp -16807 c3/return -16808 -16809 test-is-identifier-A: -16810 # . prologue -16811 55/push-ebp -16812 89/<- %ebp 4/r32/esp -16813 # (eax..ecx) = "A$" -16814 b8/copy-to-eax "A$"/imm32 -16815 8b/-> *eax 1/r32/ecx -16816 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16817 05/add-to-eax 4/imm32 -16818 # var slice/ecx: slice = {eax, ecx} -16819 51/push-ecx -16820 50/push-eax -16821 89/<- %ecx 4/r32/esp -16822 # -16823 (is-identifier? %ecx) -16824 (check-ints-equal %eax 1 "F - test-is-identifier-A") -16825 # . epilogue -16826 89/<- %esp 5/r32/ebp -16827 5d/pop-to-ebp -16828 c3/return -16829 -16830 test-is-identifier-Z: -16831 # . prologue -16832 55/push-ebp -16833 89/<- %ebp 4/r32/esp -16834 # (eax..ecx) = "Z$" -16835 b8/copy-to-eax "Z$"/imm32 -16836 8b/-> *eax 1/r32/ecx -16837 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16838 05/add-to-eax 4/imm32 -16839 # var slice/ecx: slice = {eax, ecx} -16840 51/push-ecx -16841 50/push-eax -16842 89/<- %ecx 4/r32/esp -16843 # -16844 (is-identifier? %ecx) -16845 (check-ints-equal %eax 1 "F - test-is-identifier-Z") -16846 # . epilogue -16847 89/<- %esp 5/r32/ebp -16848 5d/pop-to-ebp -16849 c3/return -16850 -16851 test-is-identifier-at: -16852 # character before 'A' is invalid -16853 # . prologue -16854 55/push-ebp -16855 89/<- %ebp 4/r32/esp -16856 # (eax..ecx) = "@a" -16857 b8/copy-to-eax "@a"/imm32 -16858 8b/-> *eax 1/r32/ecx -16859 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16860 05/add-to-eax 4/imm32 -16861 # var slice/ecx: slice = {eax, ecx} -16862 51/push-ecx -16863 50/push-eax -16864 89/<- %ecx 4/r32/esp -16865 # -16866 (is-identifier? %ecx) -16867 (check-ints-equal %eax 0 "F - test-is-identifier-@") -16868 # . epilogue -16869 89/<- %esp 5/r32/ebp -16870 5d/pop-to-ebp -16871 c3/return +15998 $populate-mu-function-header:error4: +15999 # error("fn " fn ": function outputs cannot be named; rename '" var "' in the header to '_'") +16000 (write-buffered *(ebp+0x14) "fn ") +16001 50/push-eax +16002 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16003 (write-buffered *(ebp+0x14) %eax) +16004 58/pop-to-eax +16005 (write-buffered *(ebp+0x14) ": function outputs cannot be named; rename '") +16006 (lookup *ebx *(ebx+4)) # => eax +16007 (lookup *eax *(eax+4)) # Var-name Var-name => eax +16008 (write-buffered *(ebp+0x14) %eax) +16009 (write-buffered *(ebp+0x14) "' in the header to '_'\n") +16010 (flush *(ebp+0x14)) +16011 (stop *(ebp+0x18) 1) +16012 # never gets here +16013 +16014 $populate-mu-function-header:error-duplicate: +16015 (write-buffered *(ebp+0x14) "fn ") +16016 (write-slice-buffered *(ebp+0x14) %ecx) +16017 (write-buffered *(ebp+0x14) " defined more than once\n") +16018 (flush *(ebp+0x14)) +16019 (stop *(ebp+0x18) 1) +16020 # never gets here +16021 +16022 $populate-mu-function-header:error-break: +16023 (write-buffered *(ebp+0x14) "Sorry, I've reserved all function names starting with 'break' for now. Please contact mu@akkartik.com.\n") +16024 (flush *(ebp+0x14)) +16025 (stop *(ebp+0x18) 1) +16026 # never gets here +16027 +16028 $populate-mu-function-header:error-loop: +16029 (write-buffered *(ebp+0x14) "Sorry, I've reserved all function names starting with 'loop' for now. Please contact mu@akkartik.com.\n") +16030 (flush *(ebp+0x14)) +16031 (stop *(ebp+0x18) 1) +16032 # never gets here +16033 +16034 $populate-mu-function-header:error-lookup: +16035 (write-buffered *(ebp+0x14) "cannot define a function called 'lookup'\n") +16036 (flush *(ebp+0x14)) +16037 (stop *(ebp+0x18) 1) +16038 # never gets here +16039 +16040 $populate-mu-function-header:error-addr-output: +16041 # error("fn " fn ": output cannot have an addr type; that could allow unsafe addresses to escape the function") +16042 (write-buffered *(ebp+0x14) "fn ") +16043 50/push-eax +16044 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16045 (write-buffered *(ebp+0x14) %eax) +16046 58/pop-to-eax +16047 (write-buffered *(ebp+0x14) ": output cannot have an addr type; that could allow unsafe addresses to escape the function\n") +16048 (flush *(ebp+0x14)) +16049 (stop *(ebp+0x18) 1) +16050 # never gets here +16051 +16052 $populate-mu-function-header:error-nested-addr-inout: +16053 # error("fn " fn ": inout '" var "' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function") +16054 (write-buffered *(ebp+0x14) "fn ") +16055 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16056 (write-buffered *(ebp+0x14) %eax) +16057 (write-buffered *(ebp+0x14) ": inout '") +16058 (lookup *ebx *(ebx+4)) # => eax +16059 (lookup *eax *(eax+4)) # Var-name Var-name => eax +16060 (write-buffered *(ebp+0x14) %eax) +16061 (write-buffered *(ebp+0x14) "' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function\n") +16062 (flush *(ebp+0x14)) +16063 (stop *(ebp+0x18) 1) +16064 # never gets here +16065 +16066 # scenarios considered: +16067 # ✓ fn foo +16068 # ✗ fn foo { +16069 # ✓ fn foo x +16070 # ✓ fn foo x: int +16071 # ✓ fn foo x: int -> _/eax: int +16072 # TODO: +16073 # disallow outputs of type `(... addr ...)` +16074 # disallow inputs of type `(... addr ... addr ...)` +16075 populate-mu-function-signature: # first-line: (addr stream byte), out: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +16076 # pseudocode: +16077 # var word-slice: slice +16078 # next-mu-token(first-line, word-slice) +16079 # assert(word-slice not in '{' '}' '->') +16080 # out->name = slice-to-string(word-slice) +16081 # ## inouts +16082 # while true +16083 # word-slice = next-mu-token(first-line) +16084 # if slice-empty?(word-slice) break +16085 # if (word-slice == '->') break +16086 # assert(word-slice not in '{' '}') +16087 # var v: (handle var) = parse-var-with-type(word-slice, first-line) +16088 # assert(v->register == null) +16089 # # v->block-depth is implicitly 0 +16090 # out->inouts = append(v, out->inouts) +16091 # ## outputs +16092 # while true +16093 # word-slice = next-mu-token(first-line) +16094 # if slice-empty?(word-slice) break +16095 # assert(word-slice not in '{' '}' '->') +16096 # var v: (handle var) = parse-var-with-type(word-slice, first-line) +16097 # assert(v->register != null) +16098 # out->outputs = append(v, out->outputs) +16099 # +16100 # . prologue +16101 55/push-ebp +16102 89/<- %ebp 4/r32/esp +16103 # . save registers +16104 50/push-eax +16105 51/push-ecx +16106 52/push-edx +16107 53/push-ebx +16108 57/push-edi +16109 # edi = out +16110 8b/-> *(ebp+0xc) 7/r32/edi +16111 # var word-slice/ecx: slice +16112 68/push 0/imm32/end +16113 68/push 0/imm32/start +16114 89/<- %ecx 4/r32/esp +16115 # var v/ebx: (handle var) +16116 68/push 0/imm32 +16117 68/push 0/imm32 +16118 89/<- %ebx 4/r32/esp +16119 # read function name +16120 (next-mu-token *(ebp+8) %ecx) +16121 # error checking +16122 # if (word-slice == '{') abort +16123 (slice-equal? %ecx "{") # => eax +16124 3d/compare-eax-and 0/imm32/false +16125 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +16126 # if (word-slice == '->') abort +16127 (slice-equal? %ecx "->") # => eax +16128 3d/compare-eax-and 0/imm32/false +16129 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +16130 # if (word-slice == '}') abort +16131 (slice-equal? %ecx "}") # => eax +16132 3d/compare-eax-and 0/imm32/false +16133 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +16134 # if word-slice already defined, abort +16135 (function-exists? %ecx) # => eax +16136 3d/compare-eax-and 0/imm32/false +16137 0f 85/jump-if-!= $populate-mu-function-signature:error-duplicate/disp32 +16138 # +16139 (slice-starts-with? %ecx "break") # => eax +16140 3d/compare-eax-and 0/imm32/false +16141 0f 85/jump-if-!= $populate-mu-function-signature:error-break/disp32 +16142 (slice-starts-with? %ecx "loop") # => eax +16143 3d/compare-eax-and 0/imm32/false +16144 0f 85/jump-if-!= $populate-mu-function-signature:error-loop/disp32 +16145 # save function name +16146 (slice-to-string Heap %ecx %edi) # Function-name +16147 # save function inouts +16148 { +16149 $populate-mu-function-signature:check-for-inout: +16150 (next-mu-token *(ebp+8) %ecx) +16151 (slice-empty? %ecx) # => eax +16152 3d/compare-eax-and 0/imm32/false +16153 0f 85/jump-if-!= break/disp32 +16154 # if (word-slice == '->') break +16155 (slice-equal? %ecx "->") # => eax +16156 3d/compare-eax-and 0/imm32/false +16157 0f 85/jump-if-!= break/disp32 +16158 # if (word-slice == '{') abort +16159 (slice-equal? %ecx "{") # => eax +16160 3d/compare-eax-and 0/imm32/false +16161 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +16162 # if (word-slice == '}') abort +16163 (slice-equal? %ecx "}") # => eax +16164 3d/compare-eax-and 0/imm32/false +16165 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +16166 # v = parse-var-with-type(word-slice, first-line) +16167 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16168 (parse-var-with-type %ecx *(ebp+8) %ebx %eax *(ebp+0x10) *(ebp+0x14)) +16169 # if (v->register != null) abort +16170 # . eax: (addr var) = lookup(v) +16171 (lookup *ebx *(ebx+4)) # => eax +16172 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +16173 0f 85/jump-if-!= $populate-mu-function-signature:error2/disp32 +16174 # if function name is not "main" +16175 # and v->type contains an 'addr' anywhere except the start, abort +16176 { +16177 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16178 (string-equal? %eax "main") # => eax +16179 3d/compare-eax-and 0/imm32/false +16180 75/jump-if-!= break/disp8 +16181 (lookup *ebx *(ebx+4)) # => eax +16182 (addr-payload-contains-addr? %eax) # => eax +16183 3d/compare-eax-and 0/imm32/false +16184 0f 85/jump-if-!= $populate-mu-function-signature:error-nested-addr-inout/disp32 +16185 } +16186 # assert(v->register == null) +16187 # . eax: (addr var) = lookup(v) +16188 (lookup *ebx *(ebx+4)) # => eax +16189 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +16190 0f 85/jump-if-!= $populate-mu-function-signature:error2/disp32 +16191 # v->block-depth is implicitly 0 +16192 # +16193 # out->inouts = append(v, out->inouts) +16194 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts +16195 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts +16196 # +16197 e9/jump loop/disp32 +16198 } +16199 # save function outputs +16200 { +16201 $populate-mu-function-signature:check-for-out: +16202 (next-mu-token *(ebp+8) %ecx) +16203 (slice-empty? %ecx) # => eax +16204 3d/compare-eax-and 0/imm32/false +16205 0f 85/jump-if-!= break/disp32 +16206 # if (word-slice == '{') abort +16207 (slice-equal? %ecx "{") # => eax +16208 3d/compare-eax-and 0/imm32/false +16209 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +16210 # if (word-slice == '->') abort +16211 (slice-equal? %ecx "->") # => eax +16212 3d/compare-eax-and 0/imm32/false +16213 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +16214 # if (word-slice == '}') abort +16215 (slice-equal? %ecx "}") # => eax +16216 3d/compare-eax-and 0/imm32/false +16217 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +16218 # v = parse-var-with-type(word-slice, first-line) +16219 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16220 (parse-var-with-type %ecx *(ebp+8) %ebx %eax *(ebp+0x10) *(ebp+0x14)) +16221 # assert(var->register != null) +16222 # . eax: (addr var) = lookup(v) +16223 (lookup *ebx *(ebx+4)) # => eax +16224 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +16225 0f 84/jump-if-= $populate-mu-function-signature:error3/disp32 +16226 # if (var->name != "_") abort +16227 (lookup *eax *(eax+4)) # Var-name Var-name => eax +16228 (string-equal? %eax "_") # => eax +16229 3d/compare-eax-and 0/imm32/false +16230 0f 84/jump-if-= $populate-mu-function-signature:error4/disp32 +16231 # if function name is not "lookup" +16232 # and v->type is an addr, abort +16233 { +16234 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16235 (string-equal? %eax "lookup") # => eax +16236 3d/compare-eax-and 0/imm32/false +16237 75/jump-if-!= break/disp8 +16238 (lookup *ebx *(ebx+4)) # => eax +16239 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +16240 (is-mu-addr-type? %eax) # => eax +16241 3d/compare-eax-and 0/imm32/false +16242 0f 85/jump-if-!= $populate-mu-function-signature:error-addr-output/disp32 +16243 } +16244 # out->outputs = append(v, out->outputs) +16245 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs +16246 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs +16247 # +16248 e9/jump loop/disp32 +16249 } +16250 $populate-mu-function-signature:done: +16251 (check-no-tokens-left *(ebp+8)) +16252 $populate-mu-function-signature:end: +16253 # . reclaim locals +16254 81 0/subop/add %esp 0x10/imm32 +16255 # . restore registers +16256 5f/pop-to-edi +16257 5b/pop-to-ebx +16258 5a/pop-to-edx +16259 59/pop-to-ecx +16260 58/pop-to-eax +16261 # . epilogue +16262 89/<- %esp 5/r32/ebp +16263 5d/pop-to-ebp +16264 c3/return +16265 +16266 $populate-mu-function-signature:error1: +16267 # error("function signature not in form 'fn <name> {'") +16268 (write-buffered *(ebp+0x10) "function signature not in form 'fn <name> [inouts] [-> outputs] {' -- '") +16269 (flush *(ebp+0x10)) +16270 (rewind-stream *(ebp+8)) +16271 (write-stream-data *(ebp+0x10) *(ebp+8)) +16272 (write-buffered *(ebp+0x10) "'\n") +16273 (flush *(ebp+0x10)) +16274 (stop *(ebp+0x14) 1) +16275 # never gets here +16276 +16277 $populate-mu-function-signature:error2: +16278 # error("fn " fn ": function inout '" var "' cannot be in a register") +16279 (write-buffered *(ebp+0x10) "fn ") +16280 50/push-eax +16281 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16282 (write-buffered *(ebp+0x10) %eax) +16283 58/pop-to-eax +16284 (write-buffered *(ebp+0x10) ": function inout '") +16285 (lookup *eax *(eax+4)) # Var-name Var-name => eax +16286 (write-buffered *(ebp+0x10) %eax) +16287 (write-buffered *(ebp+0x10) "' cannot be in a register") +16288 (flush *(ebp+0x10)) +16289 (stop *(ebp+0x14) 1) +16290 # never gets here +16291 +16292 $populate-mu-function-signature:error3: +16293 # error("fn " fn ": function output '" var "' must be in a register") +16294 (write-buffered *(ebp+0x10) "fn ") +16295 50/push-eax +16296 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16297 (write-buffered *(ebp+0x10) %eax) +16298 58/pop-to-eax +16299 (write-buffered *(ebp+0x10) ": function output '") +16300 (lookup *ebx *(ebx+4)) # => eax +16301 (lookup *eax *(eax+4)) # Var-name Var-name => eax +16302 (write-buffered *(ebp+0x10) %eax) +16303 (write-buffered *(ebp+0x10) "' must be in a register, in instruction '") +16304 (rewind-stream *(ebp+8)) +16305 (write-stream-data *(ebp+0x10) *(ebp+8)) +16306 (write-buffered *(ebp+0x10) "'\n") +16307 (flush *(ebp+0x10)) +16308 (stop *(ebp+0x14) 1) +16309 # never gets here +16310 +16311 $populate-mu-function-signature:error4: +16312 # error("fn " fn ": function outputs cannot be named; rename '" var "' in the header to '_'") +16313 (write-buffered *(ebp+0x10) "fn ") +16314 50/push-eax +16315 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16316 (write-buffered *(ebp+0x10) %eax) +16317 58/pop-to-eax +16318 (write-buffered *(ebp+0x10) ": function outputs cannot be named; rename '") +16319 (lookup *ebx *(ebx+4)) # => eax +16320 (lookup *eax *(eax+4)) # Var-name Var-name => eax +16321 (write-buffered *(ebp+0x10) %eax) +16322 (write-buffered *(ebp+0x10) "' in the header to '_'\n") +16323 (flush *(ebp+0x10)) +16324 (stop *(ebp+0x14) 1) +16325 # never gets here +16326 +16327 $populate-mu-function-signature:error-duplicate: +16328 (write-buffered *(ebp+0x10) "fn ") +16329 (write-slice-buffered *(ebp+0x10) %ecx) +16330 (write-buffered *(ebp+0x10) " defined more than once\n") +16331 (flush *(ebp+0x10)) +16332 (stop *(ebp+0x14) 1) +16333 # never gets here +16334 +16335 $populate-mu-function-signature:error-break: +16336 (write-buffered *(ebp+0x10) "Sorry, I've reserved all function names starting with 'break' for now. Please contact mu@akkartik.com.\n") +16337 (flush *(ebp+0x10)) +16338 (stop *(ebp+0x14) 1) +16339 # never gets here +16340 +16341 $populate-mu-function-signature:error-loop: +16342 (write-buffered *(ebp+0x10) "Sorry, I've reserved all function names starting with 'loop' for now. Please contact mu@akkartik.com.\n") +16343 (flush *(ebp+0x10)) +16344 (stop *(ebp+0x14) 1) +16345 # never gets here +16346 +16347 $populate-mu-function-signature:error-addr-output: +16348 # error("fn " fn ": output cannot have an addr type; that could allow unsafe addresses to escape the function") +16349 (write-buffered *(ebp+0x10) "fn ") +16350 50/push-eax +16351 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16352 (write-buffered *(ebp+0x10) %eax) +16353 58/pop-to-eax +16354 (write-buffered *(ebp+0x10) ": output cannot have an addr type; that could allow unsafe addresses to escape the function\n") +16355 (flush *(ebp+0x10)) +16356 (stop *(ebp+0x14) 1) +16357 # never gets here +16358 +16359 $populate-mu-function-signature:error-nested-addr-inout: +16360 # error("fn " fn ": inout '" var "' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function") +16361 (write-buffered *(ebp+0x10) "fn ") +16362 (lookup *edi *(edi+4)) # Function-name Function-name => eax +16363 (write-buffered *(ebp+0x10) %eax) +16364 (write-buffered *(ebp+0x10) ": inout '") +16365 (lookup *ebx *(ebx+4)) # => eax +16366 (lookup *eax *(eax+4)) # Var-name Var-name => eax +16367 (write-buffered *(ebp+0x10) %eax) +16368 (write-buffered *(ebp+0x10) "' cannot contain 'addr' anywhere in the type except the first word; that could allow unsafe addresses to escape the function\n") +16369 (flush *(ebp+0x10)) +16370 (stop *(ebp+0x14) 1) +16371 # never gets here +16372 +16373 addr-payload-contains-addr?: # v: (addr var) -> result/eax: boolean +16374 # . prologue +16375 55/push-ebp +16376 89/<- %ebp 4/r32/esp +16377 # var t/eax: (addr type-tree) = v->type +16378 8b/-> *(ebp+8) 0/r32/eax +16379 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +16380 # if t->right contains addr, return true +16381 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +16382 (type-tree-contains? %eax 2) # addr => eax +16383 # we don't have to look at t->left as long as it's guaranteed to be an atom +16384 $addr-payload-contains-addr?:end: +16385 # . epilogue +16386 89/<- %esp 5/r32/ebp +16387 5d/pop-to-ebp +16388 c3/return +16389 +16390 type-tree-contains?: # t: (addr type-tree), n: type-id -> result/eax: boolean +16391 # . prologue +16392 55/push-ebp +16393 89/<- %ebp 4/r32/esp +16394 # . save registers +16395 51/push-ecx +16396 # if t is null, return false +16397 8b/-> *(ebp+8) 0/r32/eax +16398 3d/compare-eax-and 0/imm32 +16399 0f 84/jump-if-= $type-tree-contains?:end/disp32 # eax changes type +16400 # if t is an atom, return (t->value == n) +16401 81 7/subop/compare *eax 0/imm32/false +16402 { +16403 74/jump-if-= break/disp8 +16404 8b/-> *(ebp+0xc) 1/r32/ecx +16405 39/compare *(eax+4) 1/r32/ecx # Type-tree-value +16406 0f 94/set-if-= %al +16407 81 4/subop/and %eax 0xff/imm32 +16408 eb/jump $type-tree-contains?:end/disp8 +16409 } +16410 # if t->left contains n, return true +16411 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +16412 (type-tree-contains? %eax *(ebp+0xc)) # => eax +16413 3d/compare-eax-and 0/imm32/false +16414 75/jump-if-!= $type-tree-contains?:end/disp8 +16415 # otherwise return whether t->right contains n +16416 8b/-> *(ebp+8) 0/r32/eax +16417 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +16418 (type-tree-contains? %eax *(ebp+0xc)) # => eax +16419 $type-tree-contains?:end: +16420 # . restore registers +16421 59/pop-to-ecx +16422 # . epilogue +16423 89/<- %esp 5/r32/ebp +16424 5d/pop-to-ebp +16425 c3/return +16426 +16427 function-exists?: # s: (addr slice) -> result/eax: boolean +16428 # . prologue +16429 55/push-ebp +16430 89/<- %ebp 4/r32/esp +16431 # . save registers +16432 51/push-ecx +16433 # var curr/ecx: (addr function) = functions +16434 (lookup *_Program-functions *_Program-functions->payload) # => eax +16435 89/<- %ecx 0/r32/eax +16436 { +16437 # if (curr == null) break +16438 81 7/subop/compare %ecx 0/imm32 +16439 74/jump-if-= break/disp8 +16440 # if (curr->name == s) return true +16441 { +16442 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +16443 (slice-equal? *(ebp+8) %eax) # => eax +16444 3d/compare-eax-and 0/imm32/false +16445 74/jump-if-= break/disp8 +16446 b8/copy-to-eax 1/imm32/true +16447 e9/jump $function-exists?:end/disp32 +16448 } +16449 # curr = curr->next +16450 (lookup *(ecx+0x20) *(ecx+0x24)) # Function-next Function-next => eax +16451 89/<- %ecx 0/r32/eax +16452 # +16453 eb/jump loop/disp8 +16454 } +16455 # var curr/ecx: (addr function) = signatures +16456 (lookup *_Program-signatures *_Program-signatures->payload) # => eax +16457 89/<- %ecx 0/r32/eax +16458 { +16459 # if (curr == null) break +16460 81 7/subop/compare %ecx 0/imm32 +16461 74/jump-if-= break/disp8 +16462 # if (curr->name == s) return true +16463 { +16464 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +16465 (slice-equal? *(ebp+8) %eax) # => eax +16466 3d/compare-eax-and 0/imm32/false +16467 74/jump-if-= break/disp8 +16468 b8/copy-to-eax 1/imm32/true +16469 eb/jump $function-exists?:end/disp8 +16470 } +16471 # curr = curr->next +16472 (lookup *(ecx+0x20) *(ecx+0x24)) # Function-next Function-next => eax +16473 89/<- %ecx 0/r32/eax +16474 # +16475 eb/jump loop/disp8 +16476 } +16477 # return false +16478 b8/copy-to-eax 0/imm32/false +16479 $function-exists?:end: +16480 # . restore registers +16481 59/pop-to-ecx +16482 # . epilogue +16483 89/<- %esp 5/r32/ebp +16484 5d/pop-to-ebp +16485 c3/return +16486 +16487 test-function-header-with-arg: +16488 # . prologue +16489 55/push-ebp +16490 89/<- %ebp 4/r32/esp +16491 # setup +16492 8b/-> *Primitive-type-ids 0/r32/eax +16493 89/<- *Type-id 0/r32/eax # stream-write +16494 c7 0/subop/copy *_Program-functions 0/imm32 +16495 c7 0/subop/copy *_Program-functions->payload 0/imm32 +16496 c7 0/subop/copy *_Program-types 0/imm32 +16497 c7 0/subop/copy *_Program-types->payload 0/imm32 +16498 c7 0/subop/copy *_Program-signatures 0/imm32 +16499 c7 0/subop/copy *_Program-signatures->payload 0/imm32 +16500 (clear-stream _test-input-stream) +16501 (write _test-input-stream "foo n: int {\n") +16502 # var result/ecx: function +16503 2b/subtract *Function-size 4/r32/esp +16504 89/<- %ecx 4/r32/esp +16505 (zero-out %ecx *Function-size) +16506 # var vars/ebx: (stack live-var 16) +16507 81 5/subop/subtract %esp 0xc0/imm32 +16508 68/push 0xc0/imm32/size +16509 68/push 0/imm32/top +16510 89/<- %ebx 4/r32/esp +16511 # convert +16512 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) +16513 # check result->name +16514 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +16515 (check-strings-equal %eax "foo" "F - test-function-header-with-arg/name") +16516 # var v/edx: (addr var) = result->inouts->value +16517 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax +16518 (lookup *eax *(eax+4)) # List-value List-value => eax +16519 89/<- %edx 0/r32/eax +16520 # check v->name +16521 (lookup *edx *(edx+4)) # Var-name Var-name => eax +16522 (check-strings-equal %eax "n" "F - test-function-header-with-arg/inout:0") +16523 # check v->type +16524 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +16525 (check-ints-equal *eax 1 "F - test-function-header-with-arg/inout:0/type:0") # Type-tree-is-atom +16526 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-arg/inout:0/type:1") # Type-tree-value +16527 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-arg/inout:0/type:2") # Type-tree-right +16528 # . epilogue +16529 89/<- %esp 5/r32/ebp +16530 5d/pop-to-ebp +16531 c3/return +16532 +16533 test-function-header-with-multiple-args: +16534 # . prologue +16535 55/push-ebp +16536 89/<- %ebp 4/r32/esp +16537 # setup +16538 8b/-> *Primitive-type-ids 0/r32/eax +16539 89/<- *Type-id 0/r32/eax # stream-write +16540 c7 0/subop/copy *_Program-functions 0/imm32 +16541 c7 0/subop/copy *_Program-functions->payload 0/imm32 +16542 c7 0/subop/copy *_Program-types 0/imm32 +16543 c7 0/subop/copy *_Program-types->payload 0/imm32 +16544 c7 0/subop/copy *_Program-signatures 0/imm32 +16545 c7 0/subop/copy *_Program-signatures->payload 0/imm32 +16546 (clear-stream _test-input-stream) +16547 (write _test-input-stream "foo a: int, b: int c: int {\n") +16548 # result/ecx: function +16549 2b/subtract *Function-size 4/r32/esp +16550 89/<- %ecx 4/r32/esp +16551 (zero-out %ecx *Function-size) +16552 # var vars/ebx: (stack live-var 16) +16553 81 5/subop/subtract %esp 0xc0/imm32 +16554 68/push 0xc0/imm32/size +16555 68/push 0/imm32/top +16556 89/<- %ebx 4/r32/esp +16557 # convert +16558 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) +16559 # check result->name +16560 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +16561 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args/name") +16562 # var inouts/edx: (addr list var) = lookup(result->inouts) +16563 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax +16564 89/<- %edx 0/r32/eax +16565 $test-function-header-with-multiple-args:inout0: +16566 # var v/ebx: (addr var) = lookup(inouts->value) +16567 (lookup *edx *(edx+4)) # List-value List-value => eax +16568 89/<- %ebx 0/r32/eax +16569 # check v->name +16570 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +16571 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args/inout:0") # Var-name +16572 # check v->type +16573 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +16574 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:0/type:0") # Type-tree-is-atom +16575 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:0/type:1") # Type-tree-value +16576 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:0/type:2") # Type-tree-right +16577 $test-function-header-with-multiple-args:inout1: +16578 # inouts = lookup(inouts->next) +16579 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +16580 89/<- %edx 0/r32/eax +16581 # v = lookup(inouts->value) +16582 (lookup *edx *(edx+4)) # List-value List-value => eax +16583 89/<- %ebx 0/r32/eax +16584 # check v->name +16585 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +16586 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args/inout:1") # Var-name +16587 # check v->type +16588 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +16589 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:1/type:0") # Type-tree-is-atom +16590 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:1/type:1") # Type-tree-value +16591 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:1/type:2") # Type-tree-right +16592 $test-function-header-with-multiple-args:inout2: +16593 # inouts = lookup(inouts->next) +16594 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +16595 89/<- %edx 0/r32/eax +16596 # v = lookup(inouts->value) +16597 (lookup *edx *(edx+4)) # List-value List-value => eax +16598 89/<- %ebx 0/r32/eax +16599 # check v->name +16600 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +16601 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args/inout:2") # Var-name +16602 # check v->type +16603 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +16604 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:2/type:0") # Type-tree-is-atom +16605 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:2/type:1") # Type-tree-value +16606 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:2/type:2") # Type-tree-right +16607 # . epilogue +16608 89/<- %esp 5/r32/ebp +16609 5d/pop-to-ebp +16610 c3/return +16611 +16612 test-function-header-with-multiple-args-and-outputs: +16613 # . prologue +16614 55/push-ebp +16615 89/<- %ebp 4/r32/esp +16616 # setup +16617 8b/-> *Primitive-type-ids 0/r32/eax +16618 89/<- *Type-id 0/r32/eax # stream-write +16619 c7 0/subop/copy *_Program-functions 0/imm32 +16620 c7 0/subop/copy *_Program-functions->payload 0/imm32 +16621 c7 0/subop/copy *_Program-types 0/imm32 +16622 c7 0/subop/copy *_Program-types->payload 0/imm32 +16623 c7 0/subop/copy *_Program-signatures 0/imm32 +16624 c7 0/subop/copy *_Program-signatures->payload 0/imm32 +16625 (clear-stream _test-input-stream) +16626 (write _test-input-stream "foo a: int, b: int, c: int -> _/ecx: int _/edx: int {\n") +16627 # result/ecx: function +16628 2b/subtract *Function-size 4/r32/esp +16629 89/<- %ecx 4/r32/esp +16630 (zero-out %ecx *Function-size) +16631 # var vars/ebx: (stack live-var 16) +16632 81 5/subop/subtract %esp 0xc0/imm32 +16633 68/push 0xc0/imm32/size +16634 68/push 0/imm32/top +16635 89/<- %ebx 4/r32/esp +16636 # convert +16637 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) +16638 # check result->name +16639 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +16640 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args-and-outputs/name") +16641 # var inouts/edx: (addr list var) = lookup(result->inouts) +16642 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax +16643 89/<- %edx 0/r32/eax +16644 $test-function-header-with-multiple-args-and-outputs:inout0: +16645 # var v/ebx: (addr var) = lookup(inouts->value) +16646 (lookup *edx *(edx+4)) # List-value List-value => eax +16647 89/<- %ebx 0/r32/eax +16648 # check v->name +16649 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +16650 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0") +16651 # check v->type +16652 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +16653 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0") # Type-tree-is-atom +16654 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1") # Type-tree-value +16655 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:2") # Type-tree-right +16656 $test-function-header-with-multiple-args-and-outputs:inout1: +16657 # inouts = lookup(inouts->next) +16658 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +16659 89/<- %edx 0/r32/eax +16660 # v = lookup(inouts->value) +16661 (lookup *edx *(edx+4)) # List-value List-value => eax +16662 89/<- %ebx 0/r32/eax +16663 # check v->name +16664 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +16665 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1") +16666 # check v->type +16667 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +16668 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0") # Type-tree-is-atom +16669 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1") # Type-tree-value +16670 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:2") # Type-tree-right +16671 $test-function-header-with-multiple-args-and-outputs:inout2: +16672 # inouts = lookup(inouts->next) +16673 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +16674 89/<- %edx 0/r32/eax +16675 # v = lookup(inouts->value) +16676 (lookup *edx *(edx+4)) # List-value List-value => eax +16677 89/<- %ebx 0/r32/eax +16678 # check v->name +16679 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +16680 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2") +16681 # check v->type +16682 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +16683 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0") # Type-tree-is-atom +16684 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1") # Type-tree-value +16685 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:2") # Type-tree-right +16686 $test-function-header-with-multiple-args-and-outputs:out0: +16687 # var outputs/edx: (addr list var) = lookup(result->outputs) +16688 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax +16689 89/<- %edx 0/r32/eax +16690 # v = lookup(outputs->value) +16691 (lookup *edx *(edx+4)) # List-value List-value => eax +16692 89/<- %ebx 0/r32/eax +16693 # check v->name +16694 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +16695 (check-strings-equal %eax "_" "F - test-function-header-with-multiple-args-and-outputs/output:0") +16696 # check v->register +16697 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +16698 (check-strings-equal %eax "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register") +16699 # check v->type +16700 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +16701 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:0") # Type-tree-is-atom +16702 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1") # Type-tree-value +16703 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:2") # Type-tree-right +16704 $test-function-header-with-multiple-args-and-outputs:out1: +16705 # outputs = lookup(outputs->next) +16706 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +16707 89/<- %edx 0/r32/eax +16708 # v = lookup(inouts->value) +16709 (lookup *edx *(edx+4)) # List-value List-value => eax +16710 89/<- %ebx 0/r32/eax +16711 # check v->name +16712 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +16713 (check-strings-equal %eax "_" "F - test-function-header-with-multiple-args-and-outputs/output:1") +16714 # check v->register +16715 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +16716 (check-strings-equal %eax "edx" "F - test-function-header-with-multiple-args-and-outputs/output:1/register") +16717 # check v->type +16718 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +16719 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:0") # Type-tree-is-atom +16720 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1") # Type-tree-value +16721 (check-ints-equal *(eax+0c) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:2") # Type-tree-right +16722 # . epilogue +16723 89/<- %esp 5/r32/ebp +16724 5d/pop-to-ebp +16725 c3/return +16726 +16727 # format for variables with types +16728 # x: int +16729 # x: int, +16730 # x/eax: int +16731 # x/eax: int, +16732 # ignores at most one trailing comma +16733 # WARNING: modifies name +16734 parse-var-with-type: # name: (addr slice), first-line: (addr stream byte), out: (addr handle var), fn-name: (addr array byte), err: (addr buffered-file), ed: (addr exit-descriptor) +16735 # pseudocode: +16736 # var s: slice +16737 # if (!slice-ends-with(name, ":")) +16738 # abort +16739 # --name->end to skip ':' +16740 # next-token-from-slice(name->start, name->end, '/', s) +16741 # new-var-from-slice(s, out) +16742 # ## register +16743 # next-token-from-slice(s->end, name->end, '/', s) +16744 # if (!slice-empty?(s)) +16745 # out->register = slice-to-string(s) +16746 # ## type +16747 # var type: (handle type-tree) = parse-type(first-line) +16748 # out->type = type +16749 # +16750 # . prologue +16751 55/push-ebp +16752 89/<- %ebp 4/r32/esp +16753 # . save registers +16754 50/push-eax +16755 51/push-ecx +16756 52/push-edx +16757 53/push-ebx +16758 56/push-esi +16759 57/push-edi +16760 # esi = name +16761 8b/-> *(ebp+8) 6/r32/esi +16762 # if (!slice-ends-with?(name, ":")) abort +16763 8b/-> *(esi+4) 1/r32/ecx # Slice-end +16764 49/decrement-ecx +16765 8a/copy-byte *ecx 1/r32/CL +16766 81 4/subop/and %ecx 0xff/imm32 +16767 81 7/subop/compare %ecx 0x3a/imm32/colon +16768 0f 85/jump-if-!= $parse-var-with-type:abort/disp32 +16769 # --name->end to skip ':' +16770 ff 1/subop/decrement *(esi+4) +16771 # var s/ecx: slice +16772 68/push 0/imm32/end +16773 68/push 0/imm32/start +16774 89/<- %ecx 4/r32/esp +16775 $parse-var-with-type:parse-name: +16776 (next-token-from-slice *esi *(esi+4) 0x2f %ecx) # Slice-start, Slice-end, '/' +16777 $parse-var-with-type:create-var: +16778 # new-var-from-slice(s, out) +16779 (new-var-from-slice Heap %ecx *(ebp+0x10)) +16780 # save out->register +16781 $parse-var-with-type:save-register: +16782 # . var out-addr/edi: (addr var) = lookup(*out) +16783 8b/-> *(ebp+0x10) 7/r32/edi +16784 (lookup *edi *(edi+4)) # => eax +16785 89/<- %edi 0/r32/eax +16786 # . s = next-token(...) +16787 (next-token-from-slice *(ecx+4) *(esi+4) 0x2f %ecx) # s->end, name->end, '/' +16788 # . if (!slice-empty?(s)) out->register = slice-to-string(s) +16789 { +16790 $parse-var-with-type:write-register: +16791 (slice-empty? %ecx) # => eax +16792 3d/compare-eax-and 0/imm32/false +16793 75/jump-if-!= break/disp8 +16794 # out->register = slice-to-string(s) +16795 8d/copy-address *(edi+0x18) 0/r32/eax # Var-register +16796 (slice-to-string Heap %ecx %eax) +16797 } +16798 $parse-var-with-type:save-type: +16799 8d/copy-address *(edi+8) 0/r32/eax # Var-type +16800 (parse-type Heap *(ebp+0xc) %eax *(ebp+0x18) *(ebp+0x1c)) +16801 $parse-var-with-type:check-register: +16802 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax +16803 3d/compare-eax-and 0/imm32 +16804 74/jump-if-= $parse-var-with-type:end/disp8 +16805 (is-float-register? %eax) # => eax +16806 { +16807 3d/compare-eax-and 0/imm32/false +16808 74/jump-if-= break/disp8 +16809 # var is in a float register; ensure type is float +16810 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +16811 (is-simple-mu-type? %eax 0xf) # float => eax +16812 3d/compare-eax-and 0/imm32/false +16813 0f 84/jump-if-= $parse-var-with-type:error-non-float-in-floating-point-register/disp32 +16814 eb/jump $parse-var-with-type:end/disp8 +16815 } +16816 # var is not in a float register; ensure type is not float +16817 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +16818 (is-simple-mu-type? %eax 0xf) # float => eax +16819 3d/compare-eax-and 0/imm32/false +16820 0f 85/jump-if-!= $parse-var-with-type:error-float-in-integer-register/disp32 +16821 $parse-var-with-type:end: +16822 # . reclaim locals +16823 81 0/subop/add %esp 8/imm32 +16824 # . restore registers +16825 5f/pop-to-edi +16826 5e/pop-to-esi +16827 5b/pop-to-ebx +16828 5a/pop-to-edx +16829 59/pop-to-ecx +16830 58/pop-to-eax +16831 # . epilogue +16832 89/<- %esp 5/r32/ebp +16833 5d/pop-to-ebp +16834 c3/return +16835 +16836 $parse-var-with-type:abort: +16837 # error("fn " fn ": var should have form 'name: type' in '" line "'\n") +16838 (write-buffered *(ebp+0x18) "fn ") +16839 (write-buffered *(ebp+0x18) *(ebp+0x14)) +16840 (write-buffered *(ebp+0x18) ": var should have form 'name: type' in '") +16841 (flush *(ebp+0x18)) +16842 (rewind-stream *(ebp+0xc)) +16843 (write-stream-data *(ebp+0x18) *(ebp+0xc)) +16844 (write-buffered *(ebp+0x18) "'\n") +16845 (flush *(ebp+0x18)) +16846 (stop *(ebp+0x1c) 1) +16847 # never gets here +16848 +16849 $parse-var-with-type:error-float-in-integer-register: +16850 # error("fn " fn ": float var '" var "' should be in a floating-point register\n") +16851 (write-buffered *(ebp+0x18) "fn ") +16852 (write-buffered *(ebp+0x18) *(ebp+0x14)) +16853 (write-buffered *(ebp+0x18) ": float var '") +16854 (lookup *edi *(edi+4)) # Var-name Var-name => eax +16855 (write-buffered *(ebp+0x18) %eax) +16856 (write-buffered *(ebp+0x18) "' should be in a floating-point register\n") +16857 (flush *(ebp+0x18)) +16858 (stop *(ebp+0x1c) 1) +16859 # never gets here +16860 +16861 $parse-var-with-type:error-non-float-in-floating-point-register: +16862 # error("fn " fn ": non-float var '" var "' should be in an integer register\n") +16863 (write-buffered *(ebp+0x18) "fn ") +16864 (write-buffered *(ebp+0x18) *(ebp+0x14)) +16865 (write-buffered *(ebp+0x18) ": non-float var '") +16866 (lookup *edi *(edi+4)) # Var-name Var-name => eax +16867 (write-buffered *(ebp+0x18) %eax) +16868 (write-buffered *(ebp+0x18) "' should be in an integer register\n") +16869 (flush *(ebp+0x18)) +16870 (stop *(ebp+0x1c) 1) +16871 # never gets here 16872 -16873 test-is-identifier-square-bracket: -16874 # character after 'Z' is invalid -16875 # . prologue -16876 55/push-ebp -16877 89/<- %ebp 4/r32/esp -16878 # (eax..ecx) = "[a" -16879 b8/copy-to-eax "[a"/imm32 -16880 8b/-> *eax 1/r32/ecx -16881 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16882 05/add-to-eax 4/imm32 -16883 # var slice/ecx: slice = {eax, ecx} -16884 51/push-ecx -16885 50/push-eax -16886 89/<- %ecx 4/r32/esp -16887 # -16888 (is-identifier? %ecx) -16889 (check-ints-equal %eax 0 "F - test-is-identifier-@") -16890 # . epilogue -16891 89/<- %esp 5/r32/ebp -16892 5d/pop-to-ebp -16893 c3/return -16894 -16895 test-is-identifier-backtick: -16896 # character before 'a' is invalid -16897 # . prologue -16898 55/push-ebp -16899 89/<- %ebp 4/r32/esp -16900 # (eax..ecx) = "`a" -16901 b8/copy-to-eax "`a"/imm32 -16902 8b/-> *eax 1/r32/ecx -16903 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16904 05/add-to-eax 4/imm32 -16905 # var slice/ecx: slice = {eax, ecx} -16906 51/push-ecx -16907 50/push-eax -16908 89/<- %ecx 4/r32/esp +16873 is-float-register?: # r: (addr array byte) -> result/eax: boolean +16874 # . prologue +16875 55/push-ebp +16876 89/<- %ebp 4/r32/esp +16877 # +16878 (get Mu-registers-unique *(ebp+8) 0xc "Mu-registers-unique") # => eax +16879 81 7/subop/compare *eax 8/imm32/start-of-floating-point-registers +16880 0f 9d/set-if->= %al +16881 81 4/subop/and %eax 0xff/imm32 +16882 $is-float-register?:end: +16883 # . epilogue +16884 89/<- %esp 5/r32/ebp +16885 5d/pop-to-ebp +16886 c3/return +16887 +16888 parse-type: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle type-tree), err: (addr buffered-file), ed: (addr exit-descriptor) +16889 # pseudocode: +16890 # var s: slice = next-mu-token(in) +16891 # assert s != "" +16892 # assert s != "->" +16893 # assert s != "{" +16894 # assert s != "}" +16895 # if s == ")" +16896 # return +16897 # out = allocate(Type-tree) +16898 # if s != "(" +16899 # HACK: if s is an int, parse and return it +16900 # out->is-atom? = true +16901 # if (s[0] == "_") +16902 # out->value = type-parameter +16903 # out->parameter-name = slice-to-string(ad, s) +16904 # else +16905 # out->value = pos-or-insert-slice(Type-id, s) +16906 # return +16907 # out->left = parse-type(ad, in) +16908 # out->right = parse-type-tree(ad, in) 16909 # -16910 (is-identifier? %ecx) -16911 (check-ints-equal %eax 0 "F - test-is-identifier-backtick") -16912 # . epilogue -16913 89/<- %esp 5/r32/ebp -16914 5d/pop-to-ebp -16915 c3/return -16916 -16917 test-is-identifier-curly-brace-open: -16918 # character after 'z' is invalid; also used for blocks -16919 # . prologue -16920 55/push-ebp -16921 89/<- %ebp 4/r32/esp -16922 # (eax..ecx) = "{a" -16923 b8/copy-to-eax "{a"/imm32 -16924 8b/-> *eax 1/r32/ecx -16925 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16926 05/add-to-eax 4/imm32 -16927 # var slice/ecx: slice = {eax, ecx} -16928 51/push-ecx -16929 50/push-eax -16930 89/<- %ecx 4/r32/esp -16931 # -16932 (is-identifier? %ecx) -16933 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open") -16934 # . epilogue -16935 89/<- %esp 5/r32/ebp -16936 5d/pop-to-ebp -16937 c3/return -16938 -16939 test-is-identifier-curly-brace-close: -16940 # . prologue -16941 55/push-ebp -16942 89/<- %ebp 4/r32/esp -16943 # (eax..ecx) = "}a" -16944 b8/copy-to-eax "}a"/imm32 -16945 8b/-> *eax 1/r32/ecx -16946 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16947 05/add-to-eax 4/imm32 -16948 # var slice/ecx: slice = {eax, ecx} -16949 51/push-ecx -16950 50/push-eax -16951 89/<- %ecx 4/r32/esp -16952 # -16953 (is-identifier? %ecx) -16954 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close") -16955 # . epilogue -16956 89/<- %esp 5/r32/ebp -16957 5d/pop-to-ebp -16958 c3/return -16959 -16960 test-is-identifier-hyphen: -16961 # disallow leading '-' since '->' has special meaning -16962 # . prologue -16963 55/push-ebp -16964 89/<- %ebp 4/r32/esp -16965 # (eax..ecx) = "-a" -16966 b8/copy-to-eax "-a"/imm32 -16967 8b/-> *eax 1/r32/ecx -16968 8d/copy-address *(eax+ecx+4) 1/r32/ecx -16969 05/add-to-eax 4/imm32 -16970 # var slice/ecx: slice = {eax, ecx} -16971 51/push-ecx -16972 50/push-eax -16973 89/<- %ecx 4/r32/esp -16974 # -16975 (is-identifier? %ecx) -16976 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen") -16977 # . epilogue -16978 89/<- %esp 5/r32/ebp -16979 5d/pop-to-ebp -16980 c3/return -16981 -16982 populate-mu-function-body: # in: (addr buffered-file), out: (addr function), vars: (addr stack live-var), err: (addr buffered-file), ed: (addr exit-descriptor) -16983 # . prologue -16984 55/push-ebp -16985 89/<- %ebp 4/r32/esp -16986 # . save registers -16987 50/push-eax -16988 56/push-esi -16989 57/push-edi -16990 # esi = in -16991 8b/-> *(ebp+8) 6/r32/esi -16992 # edi = out -16993 8b/-> *(ebp+0xc) 7/r32/edi -16994 # initialize some global state -16995 c7 0/subop/copy *Curr-block-depth 1/imm32 -16996 # parse-mu-block(in, vars, out, out->body) -16997 8d/copy-address *(edi+0x18) 0/r32/eax # Function-body -16998 (parse-mu-block %esi *(ebp+0x10) %edi %eax *(ebp+0x14) *(ebp+0x18)) -16999 $populate-mu-function-body:end: -17000 # . restore registers -17001 5f/pop-to-edi -17002 5e/pop-to-esi -17003 58/pop-to-eax -17004 # . epilogue -17005 89/<- %esp 5/r32/ebp -17006 5d/pop-to-ebp -17007 c3/return -17008 -17009 # parses a block, assuming that the leading '{' has already been read by the caller -17010 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) -17011 # pseudocode: -17012 # var line: (stream byte 512) -17013 # var word-slice: slice -17014 # allocate(Heap, Stmt-size, out) -17015 # var out-addr: (addr block) = lookup(*out) -17016 # out-addr->tag = 0/block -17017 # out-addr->var = some unique name -17018 # push(vars, {out-addr->var, false}) -17019 # while true # line loop -17020 # clear-stream(line) -17021 # read-line-buffered(in, line) -17022 # if (line->write == 0) break # end of file -17023 # word-slice = next-mu-token(line) -17024 # if slice-empty?(word-slice) # end of line -17025 # continue -17026 # else if slice-starts-with?(word-slice, "#") -17027 # continue -17028 # else if slice-equal?(word-slice, "{") -17029 # assert(no-tokens-in(line)) -17030 # block = parse-mu-block(in, vars, fn) -17031 # append-to-block(out-addr, block) -17032 # else if slice-equal?(word-slice, "}") -17033 # break -17034 # else if slice-ends-with?(word-slice, ":") -17035 # # TODO: error-check the rest of 'line' -17036 # --word-slice->end to skip ':' -17037 # named-block = parse-mu-named-block(word-slice, in, vars, fn) -17038 # append-to-block(out-addr, named-block) -17039 # else if slice-equal?(word-slice, "var") -17040 # var-def = parse-mu-var-def(line, vars, fn) -17041 # append-to-block(out-addr, var-def) -17042 # else -17043 # stmt = parse-mu-stmt(line, vars, fn) -17044 # append-to-block(out-addr, stmt) -17045 # pop(vars) -17046 # -17047 # . prologue -17048 55/push-ebp -17049 89/<- %ebp 4/r32/esp -17050 # . save registers -17051 50/push-eax -17052 51/push-ecx -17053 52/push-edx -17054 53/push-ebx -17055 57/push-edi -17056 # var line/ecx: (stream byte 512) -17057 81 5/subop/subtract %esp 0x200/imm32 -17058 68/push 0x200/imm32/size -17059 68/push 0/imm32/read -17060 68/push 0/imm32/write -17061 89/<- %ecx 4/r32/esp -17062 # var word-slice/edx: slice -17063 68/push 0/imm32/end -17064 68/push 0/imm32/start -17065 89/<- %edx 4/r32/esp -17066 # allocate into out -17067 (allocate Heap *Stmt-size *(ebp+0x14)) -17068 # var out-addr/edi: (addr block) = lookup(*out) -17069 8b/-> *(ebp+0x14) 7/r32/edi -17070 (lookup *edi *(edi+4)) # => eax -17071 89/<- %edi 0/r32/eax -17072 # out-addr->tag is 0 (block) by default -17073 # set out-addr->var -17074 8d/copy-address *(edi+0xc) 0/r32/eax # Block-var -17075 (new-block-name *(ebp+0x10) %eax) -17076 # push(vars, out-addr->var) -17077 (push *(ebp+0xc) *(edi+0xc)) # Block-var -17078 (push *(ebp+0xc) *(edi+0x10)) # Block-var -17079 (push *(ebp+0xc) 0) # false -17080 # increment *Curr-block-depth -17081 ff 0/subop/increment *Curr-block-depth -17082 { -17083 $parse-mu-block:line-loop: -17084 # line = read-line-buffered(in) -17085 (clear-stream %ecx) -17086 (read-line-buffered *(ebp+8) %ecx) -17087 #? (write-buffered Stderr "line: ") -17088 #? (write-stream-data Stderr %ecx) -17089 #? #? (write-buffered Stderr Newline) # line has its own newline -17090 #? (flush Stderr) -17091 #? (rewind-stream %ecx) -17092 # if (line->write == 0) break -17093 81 7/subop/compare *ecx 0/imm32 -17094 0f 84/jump-if-= break/disp32 -17095 #? (write-buffered Stderr "vars:\n") -17096 #? (dump-vars *(ebp+0xc)) -17097 # word-slice = next-mu-token(line) -17098 (next-mu-token %ecx %edx) -17099 #? (write-buffered Stderr "word: ") -17100 #? (write-slice-buffered Stderr %edx) -17101 #? (write-buffered Stderr Newline) -17102 #? (flush Stderr) -17103 # if slice-empty?(word-slice) continue -17104 (slice-empty? %edx) -17105 3d/compare-eax-and 0/imm32/false -17106 0f 85/jump-if-!= loop/disp32 -17107 # if (slice-starts-with?(word-slice, '#') continue -17108 # . eax = *word-slice->start -17109 8b/-> *edx 0/r32/eax -17110 8a/copy-byte *eax 0/r32/AL -17111 81 4/subop/and %eax 0xff/imm32 -17112 # . if (eax == '#') continue -17113 3d/compare-eax-and 0x23/imm32/hash -17114 0f 84/jump-if-= loop/disp32 -17115 # if slice-equal?(word-slice, "{") -17116 { -17117 $parse-mu-block:check-for-block: -17118 (slice-equal? %edx "{") -17119 3d/compare-eax-and 0/imm32/false -17120 74/jump-if-= break/disp8 -17121 (check-no-tokens-left %ecx) -17122 # parse new block and append -17123 # . var tmp/eax: (handle block) -17124 68/push 0/imm32 -17125 68/push 0/imm32 -17126 89/<- %eax 4/r32/esp -17127 # . -17128 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) -17129 (append-to-block Heap %edi *eax *(eax+4)) -17130 # . reclaim tmp -17131 81 0/subop/add %esp 8/imm32 -17132 # . -17133 e9/jump $parse-mu-block:line-loop/disp32 -17134 } -17135 # if slice-equal?(word-slice, "}") break -17136 $parse-mu-block:check-for-end: -17137 (slice-equal? %edx "}") -17138 3d/compare-eax-and 0/imm32/false -17139 0f 85/jump-if-!= break/disp32 -17140 # if slice-ends-with?(word-slice, ":") parse named block and append -17141 { -17142 $parse-mu-block:check-for-named-block: -17143 # . eax = *(word-slice->end-1) -17144 8b/-> *(edx+4) 0/r32/eax -17145 48/decrement-eax -17146 8a/copy-byte *eax 0/r32/AL -17147 81 4/subop/and %eax 0xff/imm32 -17148 # . if (eax != ':') break -17149 3d/compare-eax-and 0x3a/imm32/colon -17150 0f 85/jump-if-!= break/disp32 -17151 # TODO: error-check the rest of 'line' -17152 # -17153 # skip ':' -17154 ff 1/subop/decrement *(edx+4) # Slice-end -17155 # var tmp/eax: (handle block) -17156 68/push 0/imm32 -17157 68/push 0/imm32 -17158 89/<- %eax 4/r32/esp -17159 # -17160 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) -17161 (append-to-block Heap %edi *eax *(eax+4)) -17162 # reclaim tmp -17163 81 0/subop/add %esp 8/imm32 -17164 # -17165 e9/jump $parse-mu-block:line-loop/disp32 -17166 } -17167 # if slice-equal?(word-slice, "var") -17168 { -17169 $parse-mu-block:check-for-var: -17170 (slice-equal? %edx "var") -17171 3d/compare-eax-and 0/imm32/false -17172 74/jump-if-= break/disp8 -17173 # var tmp/eax: (handle block) -17174 68/push 0/imm32 -17175 68/push 0/imm32 -17176 89/<- %eax 4/r32/esp -17177 # -17178 (parse-mu-var-def %ecx *(ebp+0xc) %eax *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) -17179 (append-to-block Heap %edi *eax *(eax+4)) -17180 # reclaim tmp -17181 81 0/subop/add %esp 8/imm32 -17182 # -17183 e9/jump $parse-mu-block:line-loop/disp32 -17184 } -17185 $parse-mu-block:regular-stmt: -17186 # otherwise -17187 # var tmp/eax: (handle block) -17188 68/push 0/imm32 -17189 68/push 0/imm32 -17190 89/<- %eax 4/r32/esp -17191 # -17192 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) -17193 (append-to-block Heap %edi *eax *(eax+4)) -17194 # reclaim tmp -17195 81 0/subop/add %esp 8/imm32 -17196 # -17197 e9/jump loop/disp32 -17198 } # end line loop -17199 (clean-up-blocks *(ebp+0xc) *Curr-block-depth *(ebp+0x10)) -17200 # decrement *Curr-block-depth -17201 ff 1/subop/decrement *Curr-block-depth -17202 # pop(vars) -17203 (pop *(ebp+0xc)) # => eax -17204 (pop *(ebp+0xc)) # => eax -17205 (pop *(ebp+0xc)) # => eax -17206 $parse-mu-block:end: -17207 # . reclaim locals -17208 81 0/subop/add %esp 0x214/imm32 -17209 # . restore registers -17210 5f/pop-to-edi -17211 5b/pop-to-ebx -17212 5a/pop-to-edx -17213 59/pop-to-ecx -17214 58/pop-to-eax -17215 # . epilogue -17216 89/<- %esp 5/r32/ebp -17217 5d/pop-to-ebp -17218 c3/return -17219 -17220 $parse-mu-block:abort: -17221 # error("'{' or '}' should be on its own line, but got '") -17222 (write-buffered *(ebp+0x18) "'{' or '}' should be on its own line, but got '") -17223 (rewind-stream %ecx) -17224 (write-stream-data *(ebp+0x18) %ecx) -17225 (write-buffered *(ebp+0x18) "'\n") -17226 (flush *(ebp+0x18)) -17227 (stop *(ebp+0x1c) 1) -17228 # never gets here -17229 -17230 new-block-name: # fn: (addr function), out: (addr handle var) -17231 # . prologue -17232 55/push-ebp -17233 89/<- %ebp 4/r32/esp -17234 # . save registers -17235 50/push-eax -17236 51/push-ecx -17237 52/push-edx -17238 # var n/ecx: int = len(fn->name) + 10 for an int + 2 for '$:' -17239 8b/-> *(ebp+8) 0/r32/eax -17240 (lookup *eax *(eax+4)) # Function-name Function-name => eax -17241 8b/-> *eax 0/r32/eax # String-size -17242 05/add-to-eax 0xd/imm32 # 10 + 2 for '$:' -17243 89/<- %ecx 0/r32/eax -17244 # var name/edx: (stream byte n) -17245 29/subtract-from %esp 1/r32/ecx -17246 ff 6/subop/push %ecx -17247 68/push 0/imm32/read -17248 68/push 0/imm32/write -17249 89/<- %edx 4/r32/esp -17250 (clear-stream %edx) -17251 # eax = fn->name -17252 8b/-> *(ebp+8) 0/r32/eax -17253 (lookup *eax *(eax+4)) # Function-name Function-name => eax -17254 # construct result using Next-block-index (and increment it) -17255 (write %edx "$") -17256 (write %edx %eax) -17257 (write %edx ":") -17258 (write-int32-hex %edx *Next-block-index) -17259 ff 0/subop/increment *Next-block-index -17260 # var s/eax: slice = {name->data, name->data + name->write} (clobbering edx) -17261 # . eax = name->write -17262 8b/-> *edx 0/r32/eax -17263 # . edx = name->data -17264 8d/copy-address *(edx+0xc) 2/r32/edx -17265 # . eax = name->write + name->data -17266 01/add-to %eax 2/r32/edx -17267 # . push {edx, eax} -17268 ff 6/subop/push %eax -17269 ff 6/subop/push %edx -17270 89/<- %eax 4/r32/esp -17271 # out = new literal(s) -17272 (new-literal Heap %eax *(ebp+0xc)) -17273 #? 8b/-> *(ebp+0xc) 0/r32/eax -17274 #? (write-buffered Stderr "type allocid in caller after new-literal: ") -17275 #? (write-int32-hex-buffered Stderr *(eax+8)) -17276 #? (write-buffered Stderr " for var ") -17277 #? (write-int32-hex-buffered Stderr %eax) -17278 #? (write-buffered Stderr Newline) -17279 #? (flush Stderr) -17280 $new-block-name:end: -17281 # . reclaim locals -17282 81 0/subop/add %ecx 0xc/imm32 # name.{read/write/len} -17283 81 0/subop/add %ecx 8/imm32 # slice -17284 01/add-to %esp 1/r32/ecx -17285 # . restore registers -17286 5a/pop-to-edx -17287 59/pop-to-ecx -17288 58/pop-to-eax -17289 # . epilogue -17290 89/<- %esp 5/r32/ebp -17291 5d/pop-to-ebp -17292 c3/return -17293 -17294 check-no-tokens-left: # line: (addr stream byte) -17295 # . prologue -17296 55/push-ebp -17297 89/<- %ebp 4/r32/esp -17298 # . save registers -17299 50/push-eax -17300 51/push-ecx -17301 # var s/ecx: slice -17302 68/push 0/imm32/end -17303 68/push 0/imm32/start -17304 89/<- %ecx 4/r32/esp -17305 # -17306 (next-mu-token *(ebp+8) %ecx) -17307 # if slice-empty?(s) return -17308 (slice-empty? %ecx) -17309 3d/compare-eax-and 0/imm32/false -17310 75/jump-if-!= $check-no-tokens-left:end/disp8 -17311 # if (slice-starts-with?(s, '#') return -17312 # . eax = *s->start -17313 8b/-> *edx 0/r32/eax -17314 8a/copy-byte *eax 0/r32/AL -17315 81 4/subop/and %eax 0xff/imm32 -17316 # . if (eax == '#') continue -17317 3d/compare-eax-and 0x23/imm32/hash -17318 74/jump-if-= $check-no-tokens-left:end/disp8 -17319 # abort -17320 (write-buffered Stderr "'{' or '}' should be on its own line, but got '") -17321 (rewind-stream %ecx) -17322 (write-stream 2 %ecx) -17323 (write-buffered Stderr "'\n") -17324 (flush Stderr) -17325 # . syscall(exit, 1) -17326 bb/copy-to-ebx 1/imm32 -17327 e8/call syscall_exit/disp32 -17328 # never gets here -17329 $check-no-tokens-left:end: -17330 # . reclaim locals -17331 81 0/subop/add %esp 8/imm32 -17332 # . restore registers -17333 59/pop-to-ecx -17334 58/pop-to-eax -17335 # . epilogue -17336 89/<- %esp 5/r32/ebp -17337 5d/pop-to-ebp -17338 c3/return -17339 -17340 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) -17341 # pseudocode: -17342 # var v: (handle var) -17343 # new-literal(name, v) -17344 # push(vars, {v, false}) -17345 # parse-mu-block(in, vars, fn, out) -17346 # pop(vars) -17347 # out->tag = block -17348 # out->var = v -17349 # -17350 # . prologue -17351 55/push-ebp -17352 89/<- %ebp 4/r32/esp -17353 # . save registers -17354 50/push-eax -17355 51/push-ecx -17356 57/push-edi -17357 # var v/ecx: (handle var) -17358 68/push 0/imm32 -17359 68/push 0/imm32 -17360 89/<- %ecx 4/r32/esp -17361 # -17362 (new-literal Heap *(ebp+8) %ecx) -17363 # push(vars, v) -17364 (push *(ebp+0x10) *ecx) -17365 (push *(ebp+0x10) *(ecx+4)) -17366 (push *(ebp+0x10) 0) # false -17367 # -17368 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20)) -17369 # pop v off vars -17370 (pop *(ebp+0x10)) # => eax -17371 (pop *(ebp+0x10)) # => eax -17372 (pop *(ebp+0x10)) # => eax -17373 # var out-addr/edi: (addr stmt) = lookup(*out) -17374 8b/-> *(ebp+0x18) 7/r32/edi -17375 (lookup *edi *(edi+4)) # => eax -17376 89/<- %edi 0/r32/eax -17377 # out-addr->tag = named-block -17378 c7 0/subop/copy *edi 0/imm32/block # Stmt-tag -17379 # out-addr->var = v -17380 8b/-> *ecx 0/r32/eax -17381 89/<- *(edi+0xc) 0/r32/eax # Block-var -17382 8b/-> *(ecx+4) 0/r32/eax -17383 89/<- *(edi+0x10) 0/r32/eax # Block-var -17384 $parse-mu-named-block:end: -17385 # . reclaim locals -17386 81 0/subop/add %esp 8/imm32 -17387 # . restore registers -17388 5f/pop-to-edi -17389 59/pop-to-ecx -17390 58/pop-to-eax -17391 # . epilogue -17392 89/<- %esp 5/r32/ebp -17393 5d/pop-to-ebp -17394 c3/return -17395 -17396 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) -17397 # . prologue -17398 55/push-ebp -17399 89/<- %ebp 4/r32/esp -17400 # . save registers +16910 # . prologue +16911 55/push-ebp +16912 89/<- %ebp 4/r32/esp +16913 # . save registers +16914 50/push-eax +16915 51/push-ecx +16916 52/push-edx +16917 # clear out +16918 (zero-out *(ebp+0x10) *Handle-size) +16919 # var s/ecx: slice +16920 68/push 0/imm32 +16921 68/push 0/imm32 +16922 89/<- %ecx 4/r32/esp +16923 # s = next-mu-token(in) +16924 (next-mu-token *(ebp+0xc) %ecx) +16925 #? (write-buffered Stderr "tok: ") +16926 #? (write-slice-buffered Stderr %ecx) +16927 #? (write-buffered Stderr "$\n") +16928 #? (flush Stderr) +16929 # assert s != "" +16930 (slice-equal? %ecx "") # => eax +16931 3d/compare-eax-and 0/imm32/false +16932 0f 85/jump-if-!= $parse-type:abort/disp32 +16933 # assert s != "{" +16934 (slice-equal? %ecx "{") # => eax +16935 3d/compare-eax-and 0/imm32/false +16936 0f 85/jump-if-!= $parse-type:abort/disp32 +16937 # assert s != "}" +16938 (slice-equal? %ecx "}") # => eax +16939 3d/compare-eax-and 0/imm32/false +16940 0f 85/jump-if-!= $parse-type:abort/disp32 +16941 # assert s != "->" +16942 (slice-equal? %ecx "->") # => eax +16943 3d/compare-eax-and 0/imm32/false +16944 0f 85/jump-if-!= $parse-type:abort/disp32 +16945 # if (s == ")") return +16946 (slice-equal? %ecx ")") # => eax +16947 3d/compare-eax-and 0/imm32/false +16948 0f 85/jump-if-!= $parse-type:end/disp32 +16949 # out = new tree +16950 (allocate *(ebp+8) *Type-tree-size *(ebp+0x10)) +16951 # var out-addr/edx: (addr type-tree) = lookup(*out) +16952 8b/-> *(ebp+0x10) 2/r32/edx +16953 (lookup *edx *(edx+4)) # => eax +16954 89/<- %edx 0/r32/eax +16955 { +16956 # if (s != "(") break +16957 (slice-equal? %ecx "(") # => eax +16958 3d/compare-eax-and 0/imm32/false +16959 0f 85/jump-if-!= break/disp32 +16960 # if s is a number, store it in the type's size field +16961 { +16962 $parse-type:check-for-int: +16963 # var tmp/eax: byte = *s->slice +16964 8b/-> *ecx 0/r32/eax +16965 8a/copy-byte *eax 0/r32/AL +16966 81 4/subop/and %eax 0xff/imm32 +16967 # TODO: raise an error on `var x: (array int a)` +16968 (is-decimal-digit? %eax) # => eax +16969 3d/compare-eax-and 0/imm32/false +16970 74/jump-if-= break/disp8 +16971 # +16972 (is-hex-int? %ecx) # => eax +16973 3d/compare-eax-and 0/imm32/false +16974 74/jump-if-= break/disp8 +16975 $parse-type:int: +16976 (check-mu-hex-int %ecx *(ebp+0x14) *(ebp+0x18)) +16977 (parse-hex-int-from-slice %ecx) # => eax +16978 c7 0/subop/copy *(edx+4) 9/imm32/type-id-array-capacity # Type-tree-value +16979 89/<- *(edx+8) 0/r32/eax # Type-tree-value-size +16980 e9/jump $parse-type:end/disp32 +16981 } +16982 $parse-type:atom: +16983 # out->is-atom? = true +16984 c7 0/subop/copy *edx 1/imm32/true # Type-tree-is-atom +16985 { +16986 $parse-type:check-for-type-parameter: +16987 # var tmp/eax: byte = *s->slice +16988 8b/-> *ecx 0/r32/eax +16989 8a/copy-byte *eax 0/r32/AL +16990 81 4/subop/and %eax 0xff/imm32 +16991 # if (tmp != '_') break +16992 3d/compare-eax-and 0x5f/imm32/_ +16993 75/jump-if-!= break/disp8 +16994 $parse-type:type-parameter: +16995 # out->value = type-parameter +16996 c7 0/subop/copy *(edx+4) 0xa/imm32/type-parameter # Type-tree-value +16997 # out->parameter-name = slice-to-string(ad, s) +16998 8d/copy-address *(edx+8) 0/r32/eax # Type-tree-parameter-name +16999 (slice-to-string *(ebp+8) %ecx %eax) +17000 e9/jump $parse-type:end/disp32 +17001 } +17002 $parse-type:non-type-parameter: +17003 # out->value = pos-or-insert-slice(Type-id, s) +17004 (pos-or-insert-slice Type-id %ecx) # => eax +17005 89/<- *(edx+4) 0/r32/eax # Type-tree-value +17006 e9/jump $parse-type:end/disp32 +17007 } +17008 $parse-type:non-atom: +17009 # otherwise s == "(" +17010 # out->left = parse-type(ad, in) +17011 8d/copy-address *(edx+4) 0/r32/eax # Type-tree-left +17012 (parse-type *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) +17013 # out->right = parse-type-tree(ad, in) +17014 8d/copy-address *(edx+0xc) 0/r32/eax # Type-tree-right +17015 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) +17016 $parse-type:end: +17017 # . reclaim locals +17018 81 0/subop/add %esp 8/imm32 +17019 # . restore registers +17020 5a/pop-to-edx +17021 59/pop-to-ecx +17022 58/pop-to-eax +17023 # . epilogue +17024 89/<- %esp 5/r32/ebp +17025 5d/pop-to-ebp +17026 c3/return +17027 +17028 $parse-type:abort: +17029 # error("unexpected token when parsing type: '" s "'\n") +17030 (write-buffered *(ebp+0x14) "unexpected token when parsing type: '") +17031 (write-slice-buffered *(ebp+0x14) %ecx) +17032 (write-buffered *(ebp+0x14) "'\n") +17033 (flush *(ebp+0x14)) +17034 (stop *(ebp+0x18) 1) +17035 # never gets here +17036 +17037 parse-type-tree: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle type-tree), err: (addr buffered-file), ed: (addr exit-descriptor) +17038 # pseudocode: +17039 # var tmp: (handle type-tree) = parse-type(ad, in) +17040 # if tmp == 0 +17041 # return 0 +17042 # out = allocate(Type-tree) +17043 # out->left = tmp +17044 # out->right = parse-type-tree(ad, in) +17045 # +17046 # . prologue +17047 55/push-ebp +17048 89/<- %ebp 4/r32/esp +17049 # . save registers +17050 50/push-eax +17051 51/push-ecx +17052 52/push-edx +17053 # +17054 (zero-out *(ebp+0x10) *Handle-size) +17055 # var tmp/ecx: (handle type-tree) +17056 68/push 0/imm32 +17057 68/push 0/imm32 +17058 89/<- %ecx 4/r32/esp +17059 # tmp = parse-type(ad, in) +17060 (parse-type *(ebp+8) *(ebp+0xc) %ecx *(ebp+0x14) *(ebp+0x18)) +17061 # if (tmp == 0) return +17062 81 7/subop/compare *ecx 0/imm32 +17063 74/jump-if-= $parse-type-tree:end/disp8 +17064 # out = new tree +17065 (allocate *(ebp+8) *Type-tree-size *(ebp+0x10)) +17066 # var out-addr/edx: (addr tree) = lookup(*out) +17067 8b/-> *(ebp+0x10) 2/r32/edx +17068 (lookup *edx *(edx+4)) # => eax +17069 89/<- %edx 0/r32/eax +17070 # out->left = tmp +17071 8b/-> *ecx 0/r32/eax +17072 89/<- *(edx+4) 0/r32/eax # Type-tree-left +17073 8b/-> *(ecx+4) 0/r32/eax +17074 89/<- *(edx+8) 0/r32/eax # Type-tree-left +17075 # out->right = parse-type-tree(ad, in) +17076 8d/copy-address *(edx+0xc) 0/r32/eax # Type-tree-right +17077 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) +17078 $parse-type-tree:end: +17079 # . reclaim locals +17080 81 0/subop/add %esp 8/imm32 +17081 # . restore registers +17082 5a/pop-to-edx +17083 59/pop-to-ecx +17084 58/pop-to-eax +17085 # . epilogue +17086 89/<- %esp 5/r32/ebp +17087 5d/pop-to-ebp +17088 c3/return +17089 +17090 next-mu-token: # in: (addr stream byte), out: (addr slice) +17091 # pseudocode: +17092 # start: +17093 # skip-chars-matching-whitespace(in) +17094 # if in->read >= in->write # end of in +17095 # out = {0, 0} +17096 # return +17097 # out->start = &in->data[in->read] +17098 # var curr-byte/eax: byte = in->data[in->read] +17099 # if curr->byte == ',' # comment token +17100 # ++in->read +17101 # goto start +17102 # if curr-byte == '#' # comment +17103 # goto done # treat as eof +17104 # if curr-byte == '"' # string literal +17105 # skip-string(in) +17106 # goto done # no metadata +17107 # if curr-byte == '(' +17108 # ++in->read +17109 # goto done +17110 # if curr-byte == ')' +17111 # ++in->read +17112 # goto done +17113 # # read a word +17114 # while true +17115 # if in->read >= in->write +17116 # break +17117 # curr-byte = in->data[in->read] +17118 # if curr-byte == ' ' +17119 # break +17120 # if curr-byte == '\r' +17121 # break +17122 # if curr-byte == '\n' +17123 # break +17124 # if curr-byte == '(' +17125 # break +17126 # if curr-byte == ')' +17127 # break +17128 # if curr-byte == ',' +17129 # break +17130 # ++in->read +17131 # done: +17132 # out->end = &in->data[in->read] +17133 # +17134 # . prologue +17135 55/push-ebp +17136 89/<- %ebp 4/r32/esp +17137 # . save registers +17138 50/push-eax +17139 51/push-ecx +17140 56/push-esi +17141 57/push-edi +17142 # esi = in +17143 8b/-> *(ebp+8) 6/r32/esi +17144 # edi = out +17145 8b/-> *(ebp+0xc) 7/r32/edi +17146 $next-mu-token:start: +17147 (skip-chars-matching-whitespace %esi) +17148 $next-mu-token:check0: +17149 # if (in->read >= in->write) return out = {0, 0} +17150 # . ecx = in->read +17151 8b/-> *(esi+4) 1/r32/ecx +17152 # . if (ecx >= in->write) return out = {0, 0} +17153 3b/compare<- *esi 1/r32/ecx +17154 c7 0/subop/copy *edi 0/imm32 +17155 c7 0/subop/copy *(edi+4) 0/imm32 +17156 0f 8d/jump-if->= $next-mu-token:end/disp32 +17157 # out->start = &in->data[in->read] +17158 8d/copy-address *(esi+ecx+0xc) 0/r32/eax +17159 89/<- *edi 0/r32/eax +17160 # var curr-byte/eax: byte = in->data[in->read] +17161 31/xor-with %eax 0/r32/eax +17162 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL +17163 { +17164 $next-mu-token:check-for-comma: +17165 # if (curr-byte != ',') break +17166 3d/compare-eax-and 0x2c/imm32/comma +17167 75/jump-if-!= break/disp8 +17168 # ++in->read +17169 ff 0/subop/increment *(esi+4) +17170 # restart +17171 e9/jump $next-mu-token:start/disp32 +17172 } +17173 { +17174 $next-mu-token:check-for-comment: +17175 # if (curr-byte != '#') break +17176 3d/compare-eax-and 0x23/imm32/pound +17177 75/jump-if-!= break/disp8 +17178 # return eof +17179 e9/jump $next-mu-token:done/disp32 +17180 } +17181 { +17182 $next-mu-token:check-for-string-literal: +17183 # if (curr-byte != '"') break +17184 3d/compare-eax-and 0x22/imm32/dquote +17185 75/jump-if-!= break/disp8 +17186 (skip-string %esi) +17187 # return +17188 e9/jump $next-mu-token:done/disp32 +17189 } +17190 { +17191 $next-mu-token:check-for-open-paren: +17192 # if (curr-byte != '(') break +17193 3d/compare-eax-and 0x28/imm32/open-paren +17194 75/jump-if-!= break/disp8 +17195 # ++in->read +17196 ff 0/subop/increment *(esi+4) +17197 # return +17198 e9/jump $next-mu-token:done/disp32 +17199 } +17200 { +17201 $next-mu-token:check-for-close-paren: +17202 # if (curr-byte != ')') break +17203 3d/compare-eax-and 0x29/imm32/close-paren +17204 75/jump-if-!= break/disp8 +17205 # ++in->read +17206 ff 0/subop/increment *(esi+4) +17207 # return +17208 e9/jump $next-mu-token:done/disp32 +17209 } +17210 { +17211 $next-mu-token:regular-word-without-metadata: +17212 # if (in->read >= in->write) break +17213 # . ecx = in->read +17214 8b/-> *(esi+4) 1/r32/ecx +17215 # . if (ecx >= in->write) break +17216 3b/compare<- *esi 1/r32/ecx +17217 7d/jump-if->= break/disp8 +17218 # var c/eax: byte = in->data[in->read] +17219 31/xor-with %eax 0/r32/eax +17220 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL +17221 # if (c == ' ') break +17222 3d/compare-eax-and 0x20/imm32/space +17223 74/jump-if-= break/disp8 +17224 # if (c == '\r') break +17225 3d/compare-eax-and 0xd/imm32/carriage-return +17226 74/jump-if-= break/disp8 +17227 # if (c == '\n') break +17228 3d/compare-eax-and 0xa/imm32/newline +17229 74/jump-if-= break/disp8 +17230 # if (c == '(') break +17231 3d/compare-eax-and 0x28/imm32/open-paren +17232 0f 84/jump-if-= break/disp32 +17233 # if (c == ')') break +17234 3d/compare-eax-and 0x29/imm32/close-paren +17235 0f 84/jump-if-= break/disp32 +17236 # if (c == ',') break +17237 3d/compare-eax-and 0x2c/imm32/comma +17238 0f 84/jump-if-= break/disp32 +17239 # ++in->read +17240 ff 0/subop/increment *(esi+4) +17241 # +17242 e9/jump loop/disp32 +17243 } +17244 $next-mu-token:done: +17245 # out->end = &in->data[in->read] +17246 8b/-> *(esi+4) 1/r32/ecx +17247 8d/copy-address *(esi+ecx+0xc) 0/r32/eax +17248 89/<- *(edi+4) 0/r32/eax +17249 $next-mu-token:end: +17250 # . restore registers +17251 5f/pop-to-edi +17252 5e/pop-to-esi +17253 59/pop-to-ecx +17254 58/pop-to-eax +17255 # . epilogue +17256 89/<- %esp 5/r32/ebp +17257 5d/pop-to-ebp +17258 c3/return +17259 +17260 pos-or-insert-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int +17261 # . prologue +17262 55/push-ebp +17263 89/<- %ebp 4/r32/esp +17264 # if (pos-slice(arr, s) != -1) return it +17265 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax +17266 3d/compare-eax-and -1/imm32 +17267 75/jump-if-!= $pos-or-insert-slice:end/disp8 +17268 $pos-or-insert-slice:insert: +17269 # var s2/eax: (handle array byte) +17270 68/push 0/imm32 +17271 68/push 0/imm32 +17272 89/<- %eax 4/r32/esp +17273 (slice-to-string Heap *(ebp+0xc) %eax) +17274 # throw away alloc-id +17275 (lookup *eax *(eax+4)) # => eax +17276 (write-int *(ebp+8) %eax) +17277 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax +17278 $pos-or-insert-slice:end: +17279 # . reclaim locals +17280 81 0/subop/add %esp 8/imm32 +17281 # . epilogue +17282 89/<- %esp 5/r32/ebp +17283 5d/pop-to-ebp +17284 c3/return +17285 +17286 # return the index in an array of strings matching 's', -1 if not found +17287 # index is denominated in elements, not bytes +17288 pos-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int +17289 # . prologue +17290 55/push-ebp +17291 89/<- %ebp 4/r32/esp +17292 # . save registers +17293 51/push-ecx +17294 52/push-edx +17295 53/push-ebx +17296 56/push-esi +17297 #? (write-buffered Stderr "pos-slice: ") +17298 #? (write-slice-buffered Stderr *(ebp+0xc)) +17299 #? (write-buffered Stderr "\n") +17300 #? (flush Stderr) +17301 # esi = arr +17302 8b/-> *(ebp+8) 6/r32/esi +17303 # var index/ecx: int = 0 +17304 b9/copy-to-ecx 0/imm32 +17305 # var curr/edx: (addr (addr array byte)) = arr->data +17306 8d/copy-address *(esi+0xc) 2/r32/edx +17307 # var max/ebx: (addr (addr array byte)) = &arr->data[arr->write] +17308 8b/-> *esi 3/r32/ebx +17309 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx +17310 { +17311 #? (write-buffered Stderr " ") +17312 #? (write-int32-hex-buffered Stderr %ecx) +17313 #? (write-buffered Stderr "\n") +17314 #? (flush Stderr) +17315 # if (curr >= max) return -1 +17316 39/compare %edx 3/r32/ebx +17317 b8/copy-to-eax -1/imm32 +17318 73/jump-if-addr>= $pos-slice:end/disp8 +17319 # if (slice-equal?(s, *curr)) break +17320 (slice-equal? *(ebp+0xc) *edx) # => eax +17321 3d/compare-eax-and 0/imm32/false +17322 75/jump-if-!= break/disp8 +17323 # ++index +17324 41/increment-ecx +17325 # curr += 4 +17326 81 0/subop/add %edx 4/imm32 +17327 # +17328 eb/jump loop/disp8 +17329 } +17330 # return index +17331 89/<- %eax 1/r32/ecx +17332 $pos-slice:end: +17333 #? (write-buffered Stderr "=> ") +17334 #? (write-int32-hex-buffered Stderr %eax) +17335 #? (write-buffered Stderr "\n") +17336 # . restore registers +17337 5e/pop-to-esi +17338 5b/pop-to-ebx +17339 5a/pop-to-edx +17340 59/pop-to-ecx +17341 # . epilogue +17342 89/<- %esp 5/r32/ebp +17343 5d/pop-to-ebp +17344 c3/return +17345 +17346 test-parse-var-with-type: +17347 # . prologue +17348 55/push-ebp +17349 89/<- %ebp 4/r32/esp +17350 # setup +17351 8b/-> *Primitive-type-ids 0/r32/eax +17352 89/<- *Type-id 0/r32/eax # stream-write +17353 # (eax..ecx) = "x:" +17354 b8/copy-to-eax "x:"/imm32 +17355 8b/-> *eax 1/r32/ecx +17356 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17357 05/add-to-eax 4/imm32 +17358 # var slice/ecx: slice = {eax, ecx} +17359 51/push-ecx +17360 50/push-eax +17361 89/<- %ecx 4/r32/esp +17362 # _test-input-stream contains "int" +17363 (clear-stream _test-input-stream) +17364 (write _test-input-stream "int") +17365 # var v/edx: (handle var) +17366 68/push 0/imm32 +17367 68/push 0/imm32 +17368 89/<- %edx 4/r32/esp +17369 # +17370 (parse-var-with-type %ecx _test-input-stream %edx 0 Stderr 0) +17371 # var v-addr/edx: (addr var) = lookup(v) +17372 (lookup *edx *(edx+4)) # => eax +17373 89/<- %edx 0/r32/eax +17374 # check v-addr->name +17375 (lookup *edx *(edx+4)) # Var-name Var-name => eax +17376 (check-strings-equal %eax "x" "F - test-parse-var-with-type/name") +17377 # check v-addr->type +17378 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +17379 (check-ints-equal *eax 1 "F - test-parse-var-with-type/type:0") # Type-tree-is-atom +17380 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type/type:1") # Type-tree-value +17381 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type/type:2") # Type-tree-right +17382 # . epilogue +17383 89/<- %esp 5/r32/ebp +17384 5d/pop-to-ebp +17385 c3/return +17386 +17387 test-parse-var-with-type-and-register: +17388 # . prologue +17389 55/push-ebp +17390 89/<- %ebp 4/r32/esp +17391 # setup +17392 8b/-> *Primitive-type-ids 0/r32/eax +17393 89/<- *Type-id 0/r32/eax # stream-write +17394 # (eax..ecx) = "x/eax:" +17395 b8/copy-to-eax "x/eax:"/imm32 +17396 8b/-> *eax 1/r32/ecx +17397 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17398 05/add-to-eax 4/imm32 +17399 # var slice/ecx: slice = {eax, ecx} +17400 51/push-ecx 17401 50/push-eax -17402 51/push-ecx -17403 52/push-edx -17404 56/push-esi -17405 57/push-edi -17406 # edi = out -17407 8b/-> *(ebp+0x10) 7/r32/edi -17408 # var word-slice/ecx: slice -17409 68/push 0/imm32/end -17410 68/push 0/imm32/start -17411 89/<- %ecx 4/r32/esp -17412 # var v/edx: (handle var) -17413 68/push 0/imm32 -17414 68/push 0/imm32 -17415 89/<- %edx 4/r32/esp -17416 # v = parse-var-with-type(next-mu-token(line)) -17417 (next-mu-token *(ebp+8) %ecx) -17418 { -17419 # just for tests, support null fn -17420 8b/-> *(ebp+0x14) 0/r32/eax -17421 3d/compare-eax-and 0/imm32 -17422 74/jump-if-= break/disp8 -17423 (lookup *eax *(eax+4)) # Var-name Var-name => eax -17424 } -17425 (parse-var-with-type %ecx *(ebp+8) %edx %eax *(ebp+0x18) *(ebp+0x1c)) -17426 # var v-addr/esi: (addr var) -17427 (lookup *edx *(edx+4)) # => eax -17428 89/<- %esi 0/r32/eax -17429 # v->block-depth = *Curr-block-depth -17430 8b/-> *Curr-block-depth 0/r32/eax -17431 89/<- *(esi+0x10) 0/r32/eax # Var-block-depth -17432 # either v has no register and there's no more to this line -17433 81 7/subop/compare *(esi+0x18) 0/imm32 -17434 { -17435 75/jump-if-!= break/disp8 -17436 # if v-addr->type == byte, abort -17437 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax -17438 (is-simple-mu-type? %eax 8) # byte => eax -17439 3d/compare-eax-and 0/imm32/false -17440 0f 85/jump-if-!= $parse-mu-var-def:error-byte-on-stack/disp32 -17441 # ensure that there's nothing else on this line -17442 (next-mu-token *(ebp+8) %ecx) -17443 (slice-empty? %ecx) # => eax -17444 3d/compare-eax-and 0/imm32/false -17445 0f 84/jump-if-= $parse-mu-var-def:error2/disp32 -17446 # -17447 (new-var-def Heap *edx *(edx+4) %edi) -17448 e9/jump $parse-mu-var-def:update-vars/disp32 -17449 } -17450 # or v has a register and there's more to this line -17451 { -17452 0f 84/jump-if-= break/disp32 -17453 # if v-addr->type == byte, check for unsupported registers -17454 { -17455 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax -17456 (is-simple-mu-type? %eax 8) # byte => eax -17457 3d/compare-eax-and 0/imm32/false -17458 74/jump-if-= break/disp8 -17459 (lookup *(esi+0x18) *(esi+0x1c)) # => eax -17460 (string-equal? %eax "esi") # => eax -17461 3d/compare-eax-and 0/imm32/false -17462 0f 85/jump-if-!= $parse-mu-var-def:error-byte-registers/disp32 -17463 (lookup *(esi+0x18) *(esi+0x1c)) # => eax -17464 (string-equal? %eax "edi") # => eax -17465 3d/compare-eax-and 0/imm32/false -17466 0f 85/jump-if-!= $parse-mu-var-def:error-byte-registers/disp32 -17467 } -17468 # TODO: vars of type 'byte' should only be initialized by clearing to 0 -17469 # ensure that the next word is '<-' -17470 (next-mu-token *(ebp+8) %ecx) -17471 (slice-equal? %ecx "<-") # => eax -17472 3d/compare-eax-and 0/imm32/false -17473 0f 84/jump-if-= $parse-mu-var-def:error1/disp32 -17474 # -17475 (new-reg-var-def Heap *edx *(edx+4) %edi) -17476 (lookup *edi *(edi+4)) # => eax -17477 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -17478 } -17479 $parse-mu-var-def:update-vars: -17480 # push 'v' at end of function -17481 (push *(ebp+0xc) *edx) -17482 (push *(ebp+0xc) *(edx+4)) -17483 (push *(ebp+0xc) 0) # Live-var-register-spilled is unused during parsing -17484 $parse-mu-var-def:end: -17485 # . reclaim locals -17486 81 0/subop/add %esp 0x10/imm32 -17487 # . restore registers -17488 5f/pop-to-edi -17489 5e/pop-to-esi -17490 5a/pop-to-edx -17491 59/pop-to-ecx -17492 58/pop-to-eax -17493 # . epilogue -17494 89/<- %esp 5/r32/ebp -17495 5d/pop-to-ebp -17496 c3/return -17497 -17498 $parse-mu-var-def:error1: -17499 (rewind-stream *(ebp+8)) -17500 # error("register variable requires a valid instruction to initialize but got '" line "'\n") -17501 (write-buffered *(ebp+0x18) "register variable requires a valid instruction to initialize but got '") -17502 (flush *(ebp+0x18)) -17503 (write-stream-data *(ebp+0x18) *(ebp+8)) -17504 (write-buffered *(ebp+0x18) "'\n") -17505 (flush *(ebp+0x18)) -17506 (stop *(ebp+0x1c) 1) -17507 # never gets here -17508 -17509 $parse-mu-var-def:error2: -17510 # error("fn " fn ": var " var ": variables on the stack can't take an initializer\n") -17511 (write-buffered *(ebp+0x18) "fn ") -17512 8b/-> *(ebp+0x14) 0/r32/eax -17513 (lookup *eax *(eax+4)) # Function-name Function-name => eax -17514 (write-buffered *(ebp+0x18) %eax) -17515 (write-buffered *(ebp+0x18) ": var ") -17516 # var v-addr/eax: (addr var) = lookup(v) -17517 (lookup *edx *(edx+4)) # => eax -17518 (lookup *eax *(eax+4)) # Var-name Var-name => eax -17519 (write-buffered *(ebp+0x18) %eax) -17520 (write-buffered *(ebp+0x18) ": variables on the stack can't take an initializer\n") -17521 (flush *(ebp+0x18)) -17522 (stop *(ebp+0x1c) 1) -17523 # never gets here -17524 -17525 $parse-mu-var-def:error-byte-on-stack: -17526 # error("fn " fn ": var '" var "' of type 'byte' cannot be on the stack\n") -17527 (write-buffered *(ebp+0x18) "fn ") -17528 8b/-> *(ebp+0x14) 0/r32/eax -17529 (lookup *eax *(eax+4)) # Function-name Function-name => eax -17530 (write-buffered *(ebp+0x18) %eax) -17531 (write-buffered *(ebp+0x18) ": var '") -17532 # var v-addr/eax: (addr var) = lookup(v) -17533 (lookup *edx *(edx+4)) # => eax -17534 (lookup *eax *(eax+4)) # Var-name Var-name => eax -17535 (write-buffered *(ebp+0x18) %eax) -17536 (write-buffered *(ebp+0x18) "' of type 'byte' cannot be on the stack\n") -17537 (flush *(ebp+0x18)) -17538 (stop *(ebp+0x1c) 1) -17539 # never gets here -17540 -17541 $parse-mu-var-def:error-byte-registers: -17542 # error("fn " fn ": var '" var "' of type 'byte' cannot be in esi or edi\n") -17543 (write-buffered *(ebp+0x18) "fn ") -17544 8b/-> *(ebp+0x14) 0/r32/eax -17545 (lookup *eax *(eax+4)) # Function-name Function-name => eax -17546 (write-buffered *(ebp+0x18) %eax) -17547 (write-buffered *(ebp+0x18) ": var '") -17548 # var v-addr/eax: (addr var) = lookup(v) -17549 (lookup *edx *(edx+4)) # => eax -17550 (lookup *eax *(eax+4)) # Var-name Var-name => eax -17551 (write-buffered *(ebp+0x18) %eax) -17552 (write-buffered *(ebp+0x18) "' of type 'byte' cannot be in esi or edi\n") -17553 (flush *(ebp+0x18)) -17554 (stop *(ebp+0x1c) 1) -17555 # never gets here -17556 -17557 test-parse-mu-var-def: -17558 # 'var n: int' -17559 # . prologue -17560 55/push-ebp -17561 89/<- %ebp 4/r32/esp -17562 # setup -17563 8b/-> *Primitive-type-ids 0/r32/eax -17564 89/<- *Type-id 0/r32/eax # stream-write -17565 (clear-stream _test-input-stream) -17566 (write _test-input-stream "n: int\n") # caller has consumed the 'var' -17567 c7 0/subop/copy *Curr-block-depth 1/imm32 -17568 # var out/esi: (handle stmt) -17569 68/push 0/imm32 -17570 68/push 0/imm32 -17571 89/<- %esi 4/r32/esp -17572 # var vars/ecx: (stack (addr var) 16) -17573 81 5/subop/subtract %esp 0xc0/imm32 -17574 68/push 0xc0/imm32/size -17575 68/push 0/imm32/top -17576 89/<- %ecx 4/r32/esp -17577 (clear-stack %ecx) -17578 # convert -17579 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) -17580 # var out-addr/esi: (addr stmt) -17581 (lookup *esi *(esi+4)) # => eax -17582 89/<- %esi 0/r32/eax -17583 # -17584 (check-ints-equal *esi 2 "F - test-parse-mu-var-def/tag") # Stmt-tag is var-def -17585 # var v/ecx: (addr var) = lookup(out->var) -17586 (lookup *(esi+4) *(esi+8)) # Vardef-var Vardef-var => eax -17587 89/<- %ecx 0/r32/eax -17588 # v->name -17589 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -17590 (check-strings-equal %eax "n" "F - test-parse-mu-var-def/var-name") -17591 # v->register -17592 (check-ints-equal *(ecx+0x18) 0 "F - test-parse-mu-var-def/var-register") # Var-register -17593 # v->block-depth -17594 (check-ints-equal *(ecx+0x10) 1 "F - test-parse-mu-var-def/output-block-depth") # Var-block-depth -17595 # v->type == int -17596 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -17597 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0") # Type-tree-is-atom -17598 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-var-def/var-type:1") # Type-tree-value -17599 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-var-def/var-type:2") # Type-tree-right -17600 # . epilogue -17601 89/<- %esp 5/r32/ebp -17602 5d/pop-to-ebp -17603 c3/return -17604 -17605 test-parse-mu-reg-var-def: -17606 # 'var n/eax: int <- copy 0' -17607 # . prologue -17608 55/push-ebp -17609 89/<- %ebp 4/r32/esp -17610 # setup -17611 8b/-> *Primitive-type-ids 0/r32/eax -17612 89/<- *Type-id 0/r32/eax # stream-write -17613 (clear-stream _test-input-stream) -17614 (write _test-input-stream "n/eax: int <- copy 0\n") # caller has consumed the 'var' -17615 c7 0/subop/copy *Curr-block-depth 1/imm32 -17616 # var out/esi: (handle stmt) -17617 68/push 0/imm32 -17618 68/push 0/imm32 -17619 89/<- %esi 4/r32/esp -17620 # var vars/ecx: (stack (addr var) 16) -17621 81 5/subop/subtract %esp 0xc0/imm32 -17622 68/push 0xc0/imm32/size -17623 68/push 0/imm32/top -17624 89/<- %ecx 4/r32/esp -17625 (clear-stack %ecx) -17626 # convert -17627 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) -17628 # var out-addr/esi: (addr stmt) -17629 (lookup *esi *(esi+4)) # => eax -17630 89/<- %esi 0/r32/eax -17631 # -17632 (check-ints-equal *esi 3 "F - test-parse-mu-reg-var-def/tag") # Stmt-tag is reg-var-def -17633 # var v/ecx: (addr var) = lookup(out->outputs->value) -17634 # . eax: (addr stmt-var) = lookup(out->outputs) -17635 (lookup *(esi+0x14) *(esi+0x18)) # Regvardef-outputs Regvardef-outputs => eax -17636 # . -17637 (check-ints-equal *(eax+8) 0 "F - test-parse-mu-reg-var-def/single-output") # Stmt-var-next -17638 # . eax: (addr var) = lookup(eax->value) -17639 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -17640 # . ecx = eax -17641 89/<- %ecx 0/r32/eax -17642 # v->name -17643 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -17644 (check-strings-equal %eax "n" "F - test-parse-mu-reg-var-def/output-name") # Var-name -17645 # v->register -17646 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -17647 (check-strings-equal %eax "eax" "F - test-parse-mu-reg-var-def/output-register") -17648 # v->block-depth -17649 (check-ints-equal *(ecx+0x10) 1 "F - test-parse-mu-reg-var-def/output-block-depth") # Var-block-depth -17650 # v->type == int -17651 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -17652 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0") # Type-tree-is-atom -17653 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-reg-var-def/output-type:1") # Type-tree-value -17654 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-reg-var-def/output-type:2") # Type-tree-right -17655 # . epilogue -17656 89/<- %esp 5/r32/ebp -17657 5d/pop-to-ebp -17658 c3/return -17659 -17660 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) -17661 # pseudocode: -17662 # var name: slice -17663 # allocate(Heap, Stmt-size, out) -17664 # var out-addr: (addr stmt) = lookup(*out) -17665 # out-addr->tag = stmt -17666 # if stmt-has-outputs?(line) -17667 # while true -17668 # name = next-mu-token(line) -17669 # if (name == '<-') break -17670 # assert(is-identifier?(name)) -17671 # var v: (handle var) = lookup-var(name, vars) -17672 # out-addr->outputs = append(v, out-addr->outputs) -17673 # add-operation-and-inputs-to-stmt(out-addr, line, vars) -17674 # -17675 # . prologue -17676 55/push-ebp -17677 89/<- %ebp 4/r32/esp -17678 # . save registers -17679 50/push-eax -17680 51/push-ecx -17681 52/push-edx -17682 53/push-ebx -17683 57/push-edi -17684 # var name/ecx: slice -17685 68/push 0/imm32/end -17686 68/push 0/imm32/start -17687 89/<- %ecx 4/r32/esp -17688 # var is-deref?/edx: boolean = false -17689 ba/copy-to-edx 0/imm32/false -17690 # var v: (handle var) -17691 68/push 0/imm32 -17692 68/push 0/imm32 -17693 89/<- %ebx 4/r32/esp -17694 # -17695 (allocate Heap *Stmt-size *(ebp+0x14)) -17696 # var out-addr/edi: (addr stmt) = lookup(*out) -17697 8b/-> *(ebp+0x14) 7/r32/edi -17698 (lookup *edi *(edi+4)) # => eax -17699 89/<- %edi 0/r32/eax -17700 # out-addr->tag = 1/stmt -17701 c7 0/subop/copy *edi 1/imm32/stmt1 # Stmt-tag -17702 { -17703 (stmt-has-outputs? *(ebp+8)) -17704 3d/compare-eax-and 0/imm32/false -17705 0f 84/jump-if-= break/disp32 -17706 { -17707 $parse-mu-stmt:read-outputs: -17708 # name = next-mu-token(line) -17709 (next-mu-token *(ebp+8) %ecx) -17710 # if slice-empty?(word-slice) break -17711 (slice-empty? %ecx) # => eax -17712 3d/compare-eax-and 0/imm32/false -17713 0f 85/jump-if-!= break/disp32 -17714 # if (name == "<-") break -17715 (slice-equal? %ecx "<-") # => eax -17716 3d/compare-eax-and 0/imm32/false -17717 0f 85/jump-if-!= break/disp32 -17718 # if slice-starts-with?(name, "*") abort -17719 8b/-> *ecx 0/r32/eax # Slice-start -17720 8a/copy-byte *eax 0/r32/AL -17721 81 4/subop/and %eax 0xff/imm32 -17722 3d/compare-eax-and 0x2a/imm32/asterisk -17723 0f 84/jump-if-= $parse-mu-stmt:error-output-dereferenced/disp32 -17724 # assert(is-identifier?(name)) -17725 (is-identifier? %ecx) # => eax -17726 3d/compare-eax-and 0/imm32/false -17727 0f 84/jump-if-= $parse-mu-stmt:abort/disp32 -17728 # -17729 (lookup-var %ecx *(ebp+0xc) %ebx *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) -17730 8d/copy-address *(edi+0x14) 0/r32/eax # Stmt1-outputs -17731 (append-stmt-var Heap *ebx *(ebx+4) *(edi+0x14) *(edi+0x18) 0 %eax) # Stmt1-outputs -17732 # -17733 e9/jump loop/disp32 -17734 } -17735 } -17736 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) -17737 $parse-mu-stmt:end: -17738 # . reclaim locals -17739 81 0/subop/add %esp 0x10/imm32 -17740 # . restore registers -17741 5f/pop-to-edi -17742 5b/pop-to-ebx -17743 5a/pop-to-edx -17744 59/pop-to-ecx -17745 58/pop-to-eax -17746 # . epilogue -17747 89/<- %esp 5/r32/ebp -17748 5d/pop-to-ebp -17749 c3/return -17750 -17751 $parse-mu-stmt:abort: -17752 # error("invalid identifier '" name "'\n") -17753 (write-buffered *(ebp+0x18) "fn ") -17754 8b/-> *(ebp+0x10) 0/r32/eax -17755 (lookup *eax *(eax+4)) # Function-name Function-name => eax -17756 (write-buffered *(ebp+0x18) %eax) -17757 (write-buffered *(ebp+0x18) ": invalid identifier '") -17758 (write-slice-buffered *(ebp+0x18) %ecx) -17759 (write-buffered *(ebp+0x18) "'\n") -17760 (flush *(ebp+0x18)) -17761 (stop *(ebp+0x1c) 1) -17762 # never gets here -17763 -17764 $parse-mu-stmt:error-output-dereferenced: -17765 # error("invalid identifier '" name "'\n") -17766 (write-buffered *(ebp+0x18) "fn ") -17767 8b/-> *(ebp+0x10) 0/r32/eax -17768 (lookup *eax *(eax+4)) # Function-name Function-name => eax -17769 (write-buffered *(ebp+0x18) %eax) -17770 (write-buffered *(ebp+0x18) ": output '") -17771 (write-slice-buffered *(ebp+0x18) %ecx) -17772 (write-buffered *(ebp+0x18) "' should write to a register, and therefore cannot be dereferenced\n") -17773 (flush *(ebp+0x18)) -17774 (stop *(ebp+0x1c) 1) -17775 # never gets here -17776 -17777 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) -17778 # pseudocode: -17779 # stmt->name = slice-to-string(next-mu-token(line)) -17780 # while true -17781 # name = next-mu-token(line) -17782 # v = lookup-var-or-literal(name) -17783 # stmt->inouts = append(v, stmt->inouts) -17784 # -17785 # . prologue -17786 55/push-ebp -17787 89/<- %ebp 4/r32/esp -17788 # . save registers -17789 50/push-eax -17790 51/push-ecx -17791 52/push-edx -17792 53/push-ebx -17793 56/push-esi -17794 57/push-edi -17795 # edi = stmt -17796 8b/-> *(ebp+8) 7/r32/edi -17797 # var name/ecx: slice -17798 68/push 0/imm32/end -17799 68/push 0/imm32/start -17800 89/<- %ecx 4/r32/esp -17801 # var is-deref?/edx: boolean = false -17802 ba/copy-to-edx 0/imm32/false -17803 # var v/esi: (handle var) -17804 68/push 0/imm32 -17805 68/push 0/imm32 -17806 89/<- %esi 4/r32/esp -17807 $add-operation-and-inputs-to-stmt:read-operation: -17808 (next-mu-token *(ebp+0xc) %ecx) -17809 8d/copy-address *(edi+4) 0/r32/eax # Stmt1-operation or Regvardef-operationStmt1-operation or Regvardef-operation -17810 (slice-to-string Heap %ecx %eax) -17811 # var is-get?/ebx: boolean = (name == "get") -17812 (slice-equal? %ecx "get") # => eax -17813 89/<- %ebx 0/r32/eax -17814 { -17815 $add-operation-and-inputs-to-stmt:read-inouts: -17816 # name = next-mu-token(line) -17817 (next-mu-token *(ebp+0xc) %ecx) -17818 # if slice-empty?(word-slice) break -17819 (slice-empty? %ecx) # => eax -17820 3d/compare-eax-and 0/imm32/false -17821 0f 85/jump-if-!= break/disp32 -17822 # if (name == "<-") abort -17823 (slice-equal? %ecx "<-") -17824 3d/compare-eax-and 0/imm32/false -17825 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32 -17826 # if (is-get? && second operand) lookup or create offset -17827 { -17828 81 7/subop/compare %ebx 0/imm32/false -17829 74/jump-if-= break/disp8 -17830 (lookup *(edi+0xc) *(edi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -17831 3d/compare-eax-and 0/imm32 -17832 74/jump-if-= break/disp8 -17833 (lookup-or-create-constant %eax %ecx %esi) -17834 #? (lookup *esi *(esi+4)) -17835 #? (write-buffered Stderr "creating new output var ") -17836 #? (write-int32-hex-buffered Stderr %eax) -17837 #? (write-buffered Stderr " for field called ") -17838 #? (write-slice-buffered Stderr %ecx) -17839 #? (write-buffered Stderr "; var name ") -17840 #? (lookup *eax *(eax+4)) # Var-name -17841 #? (write-buffered Stderr %eax) -17842 #? (write-buffered Stderr Newline) -17843 #? (flush Stderr) -17844 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32 -17845 } -17846 # is-deref? = false -17847 ba/copy-to-edx 0/imm32/false -17848 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? -17849 8b/-> *ecx 0/r32/eax # Slice-start -17850 8a/copy-byte *eax 0/r32/AL -17851 81 4/subop/and %eax 0xff/imm32 -17852 3d/compare-eax-and 0x2a/imm32/asterisk -17853 { -17854 75/jump-if-!= break/disp8 -17855 $add-operation-and-inputs-to-stmt:inout-is-deref: -17856 ff 0/subop/increment *ecx -17857 ba/copy-to-edx 1/imm32/true -17858 } -17859 (lookup-var-or-literal %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -17860 # if (is-deref?) some additional checks -17861 81 7/subop/compare %edx 0/imm32/false -17862 { -17863 74/jump-if-= break/disp8 -17864 # if var is not in register, abort -17865 (lookup *esi *(esi+4)) # => eax -17866 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -17867 0f 84/jump-if-= $add-operation-and-inputs-to-stmt:error-deref-on-stack/disp32 -17868 # if var is not an address, abort -17869 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -17870 (is-mu-addr-type? %eax) # => eax -17871 3d/compare-eax-and 0/imm32/false -17872 0f 84/jump-if-= $add-operation-and-inputs-to-stmt:error-deref-non-addr/disp32 -17873 } -17874 $add-operation-and-inputs-to-stmt:save-var: -17875 8d/copy-address *(edi+0xc) 0/r32/eax -17876 (append-stmt-var Heap *esi *(esi+4) *(edi+0xc) *(edi+0x10) %edx %eax) # Stmt1-inouts or Regvardef-inouts -17877 # -17878 e9/jump loop/disp32 -17879 } -17880 $add-operation-and-inputs-to-stmt:end: -17881 # . reclaim locals -17882 81 0/subop/add %esp 0x10/imm32 -17883 # . restore registers -17884 5f/pop-to-edi -17885 5e/pop-to-esi -17886 5b/pop-to-ebx -17887 5a/pop-to-edx -17888 59/pop-to-ecx -17889 58/pop-to-eax -17890 # . epilogue -17891 89/<- %esp 5/r32/ebp -17892 5d/pop-to-ebp -17893 c3/return -17894 -17895 $add-operation-and-inputs-to-stmt:abort: -17896 # error("fn ___: invalid identifier in '" line "'\n") -17897 (write-buffered *(ebp+0x18) "fn ") -17898 8b/-> *(ebp+0x14) 0/r32/eax -17899 (lookup *eax *(eax+4)) # Function-name Function-name => eax -17900 (write-buffered *(ebp+0x18) %eax) -17901 (rewind-stream *(ebp+0xc)) -17902 (write-buffered *(ebp+0x18) ": invalid identifier in '") -17903 (write-stream-data *(ebp+0x18) *(ebp+0xc)) -17904 (write-buffered *(ebp+0x18) "'\n") -17905 (flush *(ebp+0x18)) -17906 (stop *(ebp+0x1c) 1) -17907 # never gets here -17908 -17909 $add-operation-and-inputs-to-stmt:error-deref-on-stack: -17910 # error("fn ___: cannot dereference var ___ on stack\n") -17911 (write-buffered *(ebp+0x18) "fn ") -17912 8b/-> *(ebp+0x14) 0/r32/eax -17913 (lookup *eax *(eax+4)) # Function-name Function-name => eax -17914 (write-buffered *(ebp+0x18) %eax) -17915 (rewind-stream *(ebp+0xc)) -17916 (write-buffered *(ebp+0x18) ": cannot dereference var '") -17917 (lookup *esi *(esi+4)) # => eax -17918 (lookup *eax *(eax+4)) # Var-name Var-name => eax -17919 (write-buffered *(ebp+0x18) %eax) -17920 (write-buffered *(ebp+0x18) "' on stack\n") -17921 (flush *(ebp+0x18)) -17922 (stop *(ebp+0x1c) 1) -17923 # never gets here -17924 -17925 $add-operation-and-inputs-to-stmt:error-deref-non-addr: -17926 # error("fn ___: cannot dereference non-addr var ___\n") -17927 (write-buffered *(ebp+0x18) "fn ") -17928 8b/-> *(ebp+0x14) 0/r32/eax -17929 (lookup *eax *(eax+4)) # Function-name Function-name => eax -17930 (write-buffered *(ebp+0x18) %eax) -17931 (rewind-stream *(ebp+0xc)) -17932 (write-buffered *(ebp+0x18) ": cannot dereference non-addr var '") -17933 (lookup *esi *(esi+4)) # => eax -17934 (lookup *eax *(eax+4)) # Var-name Var-name => eax -17935 (write-buffered *(ebp+0x18) %eax) -17936 (write-buffered *(ebp+0x18) "'\n") -17937 (flush *(ebp+0x18)) -17938 (stop *(ebp+0x1c) 1) -17939 # never gets here -17940 -17941 stmt-has-outputs?: # line: (addr stream byte) -> result/eax: boolean -17942 # . prologue -17943 55/push-ebp -17944 89/<- %ebp 4/r32/esp -17945 # . save registers -17946 51/push-ecx -17947 # var word-slice/ecx: slice -17948 68/push 0/imm32/end -17949 68/push 0/imm32/start -17950 89/<- %ecx 4/r32/esp -17951 # result = false -17952 b8/copy-to-eax 0/imm32/false -17953 (rewind-stream *(ebp+8)) -17954 { -17955 (next-mu-token *(ebp+8) %ecx) -17956 # if slice-empty?(word-slice) break -17957 (slice-empty? %ecx) -17958 3d/compare-eax-and 0/imm32/false -17959 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) -17960 0f 85/jump-if-!= break/disp32 -17961 # if slice-starts-with?(word-slice, '#') break -17962 # . eax = *word-slice->start -17963 8b/-> *ecx 0/r32/eax -17964 8a/copy-byte *eax 0/r32/AL -17965 81 4/subop/and %eax 0xff/imm32 -17966 # . if (eax == '#') break -17967 3d/compare-eax-and 0x23/imm32/hash -17968 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) -17969 0f 84/jump-if-= break/disp32 -17970 # if slice-equal?(word-slice, '<-') return true -17971 (slice-equal? %ecx "<-") -17972 3d/compare-eax-and 0/imm32/false -17973 74/jump-if-= loop/disp8 -17974 b8/copy-to-eax 1/imm32/true -17975 } -17976 $stmt-has-outputs:end: -17977 (rewind-stream *(ebp+8)) -17978 # . reclaim locals -17979 81 0/subop/add %esp 8/imm32 -17980 # . restore registers -17981 59/pop-to-ecx -17982 # . epilogue -17983 89/<- %esp 5/r32/ebp -17984 5d/pop-to-ebp -17985 c3/return -17986 -17987 # if 'name' starts with a digit, create a new literal var for it -17988 # otherwise return first 'name' from the top (back) of 'vars' and abort if not found -17989 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) -17990 # . prologue -17991 55/push-ebp -17992 89/<- %ebp 4/r32/esp -17993 # . save registers -17994 50/push-eax -17995 51/push-ecx -17996 56/push-esi -17997 # esi = name -17998 8b/-> *(ebp+8) 6/r32/esi -17999 # if slice-empty?(name) abort -18000 (slice-empty? %esi) # => eax -18001 3d/compare-eax-and 0/imm32/false -18002 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32 -18003 # var c/ecx: byte = *name->start -18004 8b/-> *esi 1/r32/ecx -18005 8a/copy-byte *ecx 1/r32/CL -18006 81 4/subop/and %ecx 0xff/imm32 -18007 # if (is-decimal-digit?(c) || c == '-') return new var(name) -18008 { -18009 81 7/subop/compare %ecx 0x2d/imm32/dash -18010 74/jump-if-= $lookup-var-or-literal:literal/disp8 -18011 (is-decimal-digit? %ecx) # => eax -18012 3d/compare-eax-and 0/imm32/false -18013 74/jump-if-= break/disp8 -18014 $lookup-var-or-literal:literal: -18015 (new-literal-integer Heap %esi *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -18016 eb/jump $lookup-var-or-literal:end/disp8 -18017 } -18018 # else if (c == '"') return new var(name) -18019 { -18020 81 7/subop/compare %ecx 0x22/imm32/dquote -18021 75/jump-if-!= break/disp8 -18022 $lookup-var-or-literal:literal-string: -18023 (new-literal-string Heap %esi *(ebp+0x10)) -18024 eb/jump $lookup-var-or-literal:end/disp8 -18025 } -18026 # otherwise return lookup-var(name, vars) -18027 { -18028 $lookup-var-or-literal:var: -18029 (lookup-var %esi *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -18030 } -18031 $lookup-var-or-literal:end: -18032 # . restore registers -18033 5e/pop-to-esi -18034 59/pop-to-ecx -18035 58/pop-to-eax -18036 # . epilogue -18037 89/<- %esp 5/r32/ebp -18038 5d/pop-to-ebp -18039 c3/return -18040 -18041 $lookup-var-or-literal:abort: -18042 (write-buffered *(ebp+0x18) "fn ") -18043 8b/-> *(ebp+0x14) 0/r32/eax -18044 (lookup *eax *(eax+4)) # Function-name Function-name => eax -18045 (write-buffered *(ebp+0x18) %eax) -18046 (write-buffered *(ebp+0x18) ": empty variable!") -18047 (flush *(ebp+0x18)) -18048 (stop *(ebp+0x1c) 1) -18049 # never gets here -18050 -18051 # return first 'name' from the top (back) of 'vars' and abort if not found -18052 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) -18053 # . prologue -18054 55/push-ebp -18055 89/<- %ebp 4/r32/esp -18056 # . save registers -18057 50/push-eax -18058 # -18059 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -18060 # if (*out == 0) abort -18061 8b/-> *(ebp+0x10) 0/r32/eax -18062 81 7/subop/compare *eax 0/imm32 -18063 74/jump-if-= $lookup-var:abort/disp8 -18064 $lookup-var:end: -18065 # . restore registers -18066 58/pop-to-eax -18067 # . epilogue -18068 89/<- %esp 5/r32/ebp -18069 5d/pop-to-ebp -18070 c3/return -18071 -18072 $lookup-var:abort: -18073 (write-buffered *(ebp+0x18) "fn ") -18074 8b/-> *(ebp+0x14) 0/r32/eax -18075 (lookup *eax *(eax+4)) # Function-name Function-name => eax -18076 (write-buffered *(ebp+0x18) %eax) -18077 (write-buffered *(ebp+0x18) ": unknown variable '") -18078 (write-slice-buffered *(ebp+0x18) *(ebp+8)) -18079 (write-buffered *(ebp+0x18) "'\n") -18080 (flush *(ebp+0x18)) -18081 (stop *(ebp+0x1c) 1) -18082 # never gets here -18083 -18084 # return first 'name' from the top (back) of 'vars', and 0/null if not found -18085 # ensure that 'name' if in a register is the topmost variable in that register -18086 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) -18087 # pseudocode: -18088 # var curr: (addr handle var) = &vars->data[vars->top - 12] -18089 # var min = vars->data -18090 # while curr >= min -18091 # var v: (handle var) = *curr -18092 # if v->name == name -18093 # return -18094 # curr -= 12 -18095 # -18096 # . prologue -18097 55/push-ebp -18098 89/<- %ebp 4/r32/esp -18099 # . save registers -18100 50/push-eax -18101 51/push-ecx -18102 52/push-edx -18103 53/push-ebx -18104 56/push-esi -18105 57/push-edi -18106 # clear out -18107 (zero-out *(ebp+0x10) *Handle-size) -18108 # esi = vars -18109 8b/-> *(ebp+0xc) 6/r32/esi -18110 # ebx = vars->top -18111 8b/-> *esi 3/r32/ebx -18112 # if (vars->top > vars->size) abort -18113 3b/compare<- *(esi+4) 0/r32/eax -18114 0f 8f/jump-if-> $lookup-var-helper:error1/disp32 -18115 # var min/edx: (addr handle var) = vars->data -18116 8d/copy-address *(esi+8) 2/r32/edx -18117 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] -18118 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 -18119 # var var-in-reg/edi: 16 addrs -18120 68/push 0/imm32 -18121 68/push 0/imm32 -18122 68/push 0/imm32 -18123 68/push 0/imm32 -18124 68/push 0/imm32 -18125 68/push 0/imm32 -18126 68/push 0/imm32 -18127 68/push 0/imm32 -18128 68/push 0/imm32 -18129 68/push 0/imm32 -18130 68/push 0/imm32 -18131 68/push 0/imm32 -18132 68/push 0/imm32 -18133 68/push 0/imm32 -18134 68/push 0/imm32 -18135 68/push 0/imm32 -18136 89/<- %edi 4/r32/esp -18137 { -18138 $lookup-var-helper:loop: -18139 # if (curr < min) return -18140 39/compare %ebx 2/r32/edx -18141 0f 82/jump-if-addr< break/disp32 -18142 # var v/ecx: (addr var) = lookup(*curr) -18143 (lookup *ebx *(ebx+4)) # => eax -18144 89/<- %ecx 0/r32/eax -18145 # var vn/eax: (addr array byte) = lookup(v->name) -18146 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -18147 # if (vn == name) return curr -18148 (slice-equal? *(ebp+8) %eax) # => eax -18149 3d/compare-eax-and 0/imm32/false -18150 { -18151 74/jump-if-= break/disp8 -18152 $lookup-var-helper:found: -18153 # var vr/eax: (addr array byte) = lookup(v->register) -18154 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -18155 3d/compare-eax-and 0/imm32 -18156 { -18157 74/jump-if-= break/disp8 -18158 $lookup-var-helper:found-register: -18159 # var reg/eax: int = get(Registers, vr) -18160 (get Mu-registers-unique %eax 0xc "Mu-registers-unique") # => eax -18161 8b/-> *eax 0/r32/eax -18162 # if (var-in-reg[reg]) error -18163 8b/-> *(edi+eax<<2) 0/r32/eax -18164 3d/compare-eax-and 0/imm32 -18165 0f 85/jump-if-!= $lookup-var-helper:error2/disp32 -18166 } -18167 $lookup-var-helper:return: -18168 # esi = out -18169 8b/-> *(ebp+0x10) 6/r32/esi -18170 # *out = *curr -18171 8b/-> *ebx 0/r32/eax -18172 89/<- *esi 0/r32/eax -18173 8b/-> *(ebx+4) 0/r32/eax -18174 89/<- *(esi+4) 0/r32/eax -18175 # return -18176 eb/jump $lookup-var-helper:end/disp8 -18177 } -18178 # 'name' not yet found; update var-in-reg if v in register -18179 # . var vr/eax: (addr array byte) = lookup(v->register) -18180 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -18181 # . if (vr == 0) continue -18182 3d/compare-eax-and 0/imm32 -18183 74/jump-if-= $lookup-var-helper:continue/disp8 -18184 # . var reg/eax: int = get(Registers, vr) -18185 (get Mu-registers-unique %eax 0xc "Mu-registers-unique") # => eax -18186 8b/-> *eax 0/r32/eax -18187 # . var-in-reg[reg] = v -18188 89/<- *(edi+eax<<2) 1/r32/ecx -18189 $lookup-var-helper:continue: -18190 # curr -= 12 -18191 81 5/subop/subtract %ebx 0xc/imm32 -18192 e9/jump loop/disp32 -18193 } -18194 $lookup-var-helper:end: -18195 # . reclaim locals -18196 81 0/subop/add %esp 0x40/imm32 -18197 # . restore registers -18198 5f/pop-to-edi -18199 5e/pop-to-esi -18200 5b/pop-to-ebx -18201 5a/pop-to-edx -18202 59/pop-to-ecx -18203 58/pop-to-eax -18204 # . epilogue -18205 89/<- %esp 5/r32/ebp -18206 5d/pop-to-ebp -18207 c3/return -18208 -18209 $lookup-var-helper:error1: -18210 (write-buffered *(ebp+0x18) "fn ") -18211 8b/-> *(ebp+0x14) 0/r32/eax -18212 (lookup *eax *(eax+4)) # Function-name Function-name => eax -18213 (write-buffered *(ebp+0x18) %eax) -18214 (write-buffered *(ebp+0x18) ": malformed stack when looking up '") -18215 (write-slice-buffered *(ebp+0x18) *(ebp+8)) -18216 (write-buffered *(ebp+0x18) "'\n") -18217 (flush *(ebp+0x18)) -18218 (stop *(ebp+0x1c) 1) -18219 # never gets here -18220 -18221 $lookup-var-helper:error2: -18222 # eax contains the conflicting var at this point -18223 (write-buffered *(ebp+0x18) "fn ") -18224 50/push-eax -18225 8b/-> *(ebp+0x14) 0/r32/eax -18226 (lookup *eax *(eax+4)) # Function-name Function-name => eax -18227 (write-buffered *(ebp+0x18) %eax) -18228 58/pop-eax -18229 (write-buffered *(ebp+0x18) ": register ") -18230 50/push-eax -18231 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -18232 (write-buffered *(ebp+0x18) %eax) -18233 58/pop-to-eax -18234 (write-buffered *(ebp+0x18) " reads var '") -18235 (write-slice-buffered *(ebp+0x18) *(ebp+8)) -18236 (write-buffered *(ebp+0x18) "' after writing var '") -18237 (lookup *eax *(eax+4)) # Var-name Var-name => eax -18238 (write-buffered *(ebp+0x18) %eax) -18239 (write-buffered *(ebp+0x18) "'\n") -18240 (flush *(ebp+0x18)) -18241 (stop *(ebp+0x1c) 1) -18242 # never gets here -18243 -18244 dump-vars: # vars: (addr stack live-var) -18245 # pseudocode: -18246 # var curr: (addr handle var) = &vars->data[vars->top - 12] -18247 # var min = vars->data -18248 # while curr >= min -18249 # var v: (handle var) = *curr -18250 # print v -18251 # curr -= 12 -18252 # -18253 # . prologue -18254 55/push-ebp -18255 89/<- %ebp 4/r32/esp -18256 # . save registers -18257 52/push-edx -18258 53/push-ebx -18259 56/push-esi -18260 # esi = vars -18261 8b/-> *(ebp+8) 6/r32/esi -18262 # ebx = vars->top -18263 8b/-> *esi 3/r32/ebx -18264 # var min/edx: (addr handle var) = vars->data -18265 8d/copy-address *(esi+8) 2/r32/edx -18266 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] -18267 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 -18268 { -18269 $dump-vars:loop: -18270 # if (curr < min) return -18271 39/compare %ebx 2/r32/edx -18272 0f 82/jump-if-addr< break/disp32 -18273 # -18274 (write-buffered Stderr " var@") -18275 (dump-var 2 %ebx) -18276 # curr -= 12 -18277 81 5/subop/subtract %ebx 0xc/imm32 -18278 e9/jump loop/disp32 -18279 } -18280 $dump-vars:end: -18281 # . restore registers -18282 5e/pop-to-esi -18283 5b/pop-to-ebx -18284 5a/pop-to-edx -18285 # . epilogue -18286 89/<- %esp 5/r32/ebp -18287 5d/pop-to-ebp -18288 c3/return -18289 -18290 == data -18291 # Like Registers, but no esp or ebp -18292 Mu-registers: # (addr stream {(handle array byte), int}) -18293 # a table is a stream -18294 0xa8/imm32/write -18295 0/imm32/read -18296 0xa8/imm32/length -18297 # data -18298 # general-purpose registers -18299 # it is perfectly ok to use fake alloc-ids -- as long as you never try to reclaim them -18300 0x11/imm32/alloc-id $Mu-register-eax/imm32 0/imm32 -18301 0x11/imm32/alloc-id $Mu-register-ecx/imm32 1/imm32 -18302 0x11/imm32/alloc-id $Mu-register-edx/imm32 2/imm32 -18303 0x11/imm32/alloc-id $Mu-register-ebx/imm32 3/imm32 -18304 0x11/imm32/alloc-id $Mu-register-esi/imm32 6/imm32 -18305 0x11/imm32/alloc-id $Mu-register-edi/imm32 7/imm32 -18306 # floating-point registers -18307 0x11/imm32/alloc-id $Mu-register-xmm0/imm32 0/imm32 -18308 0x11/imm32/alloc-id $Mu-register-xmm1/imm32 1/imm32 -18309 0x11/imm32/alloc-id $Mu-register-xmm2/imm32 2/imm32 -18310 0x11/imm32/alloc-id $Mu-register-xmm3/imm32 3/imm32 -18311 0x11/imm32/alloc-id $Mu-register-xmm4/imm32 4/imm32 -18312 0x11/imm32/alloc-id $Mu-register-xmm5/imm32 5/imm32 -18313 0x11/imm32/alloc-id $Mu-register-xmm6/imm32 6/imm32 -18314 0x11/imm32/alloc-id $Mu-register-xmm7/imm32 7/imm32 -18315 -18316 # Like Mu-registers, but with unique codes for integer and floating-point -18317 # registers. -18318 # Don't use this for code-generation, only for checking. -18319 Mu-registers-unique: # (addr stream {(handle array byte), int}) -18320 # a table is a stream -18321 0xa8/imm32/write -18322 0/imm32/read -18323 0xa8/imm32/length -18324 # data -18325 # general-purpose registers -18326 0x11/imm32/alloc-id $Mu-register-eax/imm32 0/imm32 -18327 0x11/imm32/alloc-id $Mu-register-ecx/imm32 1/imm32 -18328 0x11/imm32/alloc-id $Mu-register-edx/imm32 2/imm32 -18329 0x11/imm32/alloc-id $Mu-register-ebx/imm32 3/imm32 -18330 0x11/imm32/alloc-id $Mu-register-esi/imm32 6/imm32 -18331 0x11/imm32/alloc-id $Mu-register-edi/imm32 7/imm32 -18332 # floating-point registers -18333 0x11/imm32/alloc-id $Mu-register-xmm0/imm32 8/imm32 -18334 0x11/imm32/alloc-id $Mu-register-xmm1/imm32 9/imm32 -18335 0x11/imm32/alloc-id $Mu-register-xmm2/imm32 0xa/imm32 -18336 0x11/imm32/alloc-id $Mu-register-xmm3/imm32 0xb/imm32 -18337 0x11/imm32/alloc-id $Mu-register-xmm4/imm32 0xc/imm32 -18338 0x11/imm32/alloc-id $Mu-register-xmm5/imm32 0xd/imm32 -18339 0x11/imm32/alloc-id $Mu-register-xmm6/imm32 0xe/imm32 -18340 0x11/imm32/alloc-id $Mu-register-xmm7/imm32 0xf/imm32 -18341 -18342 $Mu-register-eax: -18343 0x11/imm32/alloc-id -18344 3/imm32/size -18345 0x65/e 0x61/a 0x78/x -18346 -18347 $Mu-register-ecx: -18348 0x11/imm32/alloc-id -18349 3/imm32/size -18350 0x65/e 0x63/c 0x78/x -18351 -18352 $Mu-register-edx: -18353 0x11/imm32/alloc-id -18354 3/imm32/size -18355 0x65/e 0x64/d 0x78/x -18356 -18357 $Mu-register-ebx: -18358 0x11/imm32/alloc-id -18359 3/imm32/size -18360 0x65/e 0x62/b 0x78/x -18361 -18362 $Mu-register-esi: -18363 0x11/imm32/alloc-id -18364 3/imm32/size -18365 0x65/e 0x73/s 0x69/i -18366 -18367 $Mu-register-edi: -18368 0x11/imm32/alloc-id -18369 3/imm32/size -18370 0x65/e 0x64/d 0x69/i -18371 -18372 $Mu-register-xmm0: -18373 0x11/imm32/alloc-id:fake:payload -18374 # "xmm0" -18375 0x4/imm32/size -18376 0x78/x 0x6d/m 0x6d/m 0x30/0 -18377 -18378 $Mu-register-xmm1: -18379 0x11/imm32/alloc-id:fake:payload -18380 # "xmm1" -18381 0x4/imm32/size -18382 0x78/x 0x6d/m 0x6d/m 0x31/1 -18383 -18384 $Mu-register-xmm2: -18385 0x11/imm32/alloc-id:fake:payload -18386 # "xmm2" -18387 0x4/imm32/size -18388 0x78/x 0x6d/m 0x6d/m 0x32/2 -18389 -18390 $Mu-register-xmm3: -18391 0x11/imm32/alloc-id:fake:payload -18392 # "xmm3" -18393 0x4/imm32/size -18394 0x78/x 0x6d/m 0x6d/m 0x33/3 -18395 -18396 $Mu-register-xmm4: -18397 0x11/imm32/alloc-id:fake:payload -18398 # "xmm4" -18399 0x4/imm32/size -18400 0x78/x 0x6d/m 0x6d/m 0x34/4 -18401 -18402 $Mu-register-xmm5: -18403 0x11/imm32/alloc-id:fake:payload -18404 # "xmm5" -18405 0x4/imm32/size -18406 0x78/x 0x6d/m 0x6d/m 0x35/5 -18407 -18408 $Mu-register-xmm6: -18409 0x11/imm32/alloc-id:fake:payload -18410 # "xmm6" -18411 0x4/imm32/size -18412 0x78/x 0x6d/m 0x6d/m 0x36/6 -18413 -18414 $Mu-register-xmm7: -18415 0x11/imm32/alloc-id:fake:payload -18416 # "xmm7" -18417 0x4/imm32/size -18418 0x78/x 0x6d/m 0x6d/m 0x37/7 -18419 -18420 == code -18421 -18422 # push 'out' to 'vars' if not already there; it's assumed to be a fn output -18423 maybe-define-var: # out: (handle var), vars: (addr stack live-var) -18424 # . prologue -18425 55/push-ebp -18426 89/<- %ebp 4/r32/esp -18427 # . save registers -18428 50/push-eax -18429 # var out-addr/eax: (addr var) -18430 (lookup *(ebp+8) *(ebp+0xc)) # => eax -18431 # -18432 (binding-exists? %eax *(ebp+0x10)) # => eax -18433 3d/compare-eax-and 0/imm32/false -18434 75/jump-if-!= $maybe-define-var:end/disp8 -18435 # otherwise update vars -18436 (push *(ebp+0x10) *(ebp+8)) -18437 (push *(ebp+0x10) *(ebp+0xc)) -18438 (push *(ebp+0x10) 0) # 'out' is always a fn output; never spill it -18439 $maybe-define-var:end: -18440 # . restore registers -18441 58/pop-to-eax -18442 # . epilogue -18443 89/<- %esp 5/r32/ebp -18444 5d/pop-to-ebp -18445 c3/return +17402 89/<- %ecx 4/r32/esp +17403 # _test-input-stream contains "int" +17404 (clear-stream _test-input-stream) +17405 (write _test-input-stream "int") +17406 # var v/edx: (handle var) +17407 68/push 0/imm32 +17408 68/push 0/imm32 +17409 89/<- %edx 4/r32/esp +17410 # +17411 (parse-var-with-type %ecx _test-input-stream %edx 0 Stderr 0) +17412 # var v-addr/edx: (addr var) = lookup(v) +17413 (lookup *edx *(edx+4)) # => eax +17414 89/<- %edx 0/r32/eax +17415 # check v-addr->name +17416 (lookup *edx *(edx+4)) # Var-name Var-name => eax +17417 (check-strings-equal %eax "x" "F - test-parse-var-with-type-and-register/name") +17418 # check v-addr->register +17419 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +17420 (check-strings-equal %eax "eax" "F - test-parse-var-with-type-and-register/register") +17421 # check v-addr->type +17422 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +17423 (check-ints-equal *eax 1 "F - test-parse-var-with-type-and-register/type:0") # Type-tree-is-atom +17424 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type-and-register/type:1") # Type-tree-left +17425 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type-and-register/type:2") # Type-tree-right +17426 # . epilogue +17427 89/<- %esp 5/r32/ebp +17428 5d/pop-to-ebp +17429 c3/return +17430 +17431 test-parse-var-with-trailing-characters: +17432 # . prologue +17433 55/push-ebp +17434 89/<- %ebp 4/r32/esp +17435 # setup +17436 8b/-> *Primitive-type-ids 0/r32/eax +17437 89/<- *Type-id 0/r32/eax # stream-write +17438 # (eax..ecx) = "x:" +17439 b8/copy-to-eax "x:"/imm32 +17440 8b/-> *eax 1/r32/ecx +17441 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17442 05/add-to-eax 4/imm32 +17443 # var slice/ecx: slice = {eax, ecx} +17444 51/push-ecx +17445 50/push-eax +17446 89/<- %ecx 4/r32/esp +17447 # _test-input-stream contains "int," +17448 (clear-stream _test-input-stream) +17449 (write _test-input-stream "int,") +17450 # var v/edx: (handle var) +17451 68/push 0/imm32 +17452 68/push 0/imm32 +17453 89/<- %edx 4/r32/esp +17454 # +17455 (parse-var-with-type %ecx _test-input-stream %edx 0 Stderr 0) +17456 # var v-addr/edx: (addr var) = lookup(v) +17457 (lookup *edx *(edx+4)) # => eax +17458 89/<- %edx 0/r32/eax +17459 # check v-addr->name +17460 (lookup *edx *(edx+4)) # Var-name Var-name => eax +17461 (check-strings-equal %eax "x" "F - test-parse-var-with-trailing-characters/name") +17462 # check v-addr->register +17463 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-trailing-characters/register") # Var-register +17464 # check v-addr->type +17465 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +17466 (check-ints-equal *eax 1 "F - test-parse-var-with-trailing-characters/type:0") # Type-tree-is-atom +17467 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-trailing-characters/type:1") # Type-tree-left +17468 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-trailing-characters/type:1") # Type-tree-right +17469 # . epilogue +17470 89/<- %esp 5/r32/ebp +17471 5d/pop-to-ebp +17472 c3/return +17473 +17474 test-parse-var-with-register-and-trailing-characters: +17475 # . prologue +17476 55/push-ebp +17477 89/<- %ebp 4/r32/esp +17478 # setup +17479 8b/-> *Primitive-type-ids 0/r32/eax +17480 89/<- *Type-id 0/r32/eax # stream-write +17481 # (eax..ecx) = "x/eax:" +17482 b8/copy-to-eax "x/eax:"/imm32 +17483 8b/-> *eax 1/r32/ecx +17484 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17485 05/add-to-eax 4/imm32 +17486 # var slice/ecx: slice = {eax, ecx} +17487 51/push-ecx +17488 50/push-eax +17489 89/<- %ecx 4/r32/esp +17490 # _test-input-stream contains "int," +17491 (clear-stream _test-input-stream) +17492 (write _test-input-stream "int,") +17493 # var v/edx: (handle var) +17494 68/push 0/imm32 +17495 68/push 0/imm32 +17496 89/<- %edx 4/r32/esp +17497 # +17498 (parse-var-with-type %ecx _test-input-stream %edx 0 Stderr 0) +17499 # var v-addr/edx: (addr var) = lookup(v) +17500 (lookup *edx *(edx+4)) # => eax +17501 89/<- %edx 0/r32/eax +17502 # check v-addr->name +17503 (lookup *edx *(edx+4)) # Var-name Var-name => eax +17504 (check-strings-equal %eax "x" "F - test-parse-var-with-register-and-trailing-characters/name") +17505 # check v-addr->register +17506 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +17507 (check-strings-equal %eax "eax" "F - test-parse-var-with-register-and-trailing-characters/register") +17508 # check v-addr->type +17509 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +17510 (check-ints-equal *eax 1 "F - test-parse-var-with-register-and-trailing-characters/type:0") # Type-tree-is-atom +17511 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-register-and-trailing-characters/type:1") # Type-tree-left +17512 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-register-and-trailing-characters/type:2") # Type-tree-right +17513 # . epilogue +17514 89/<- %esp 5/r32/ebp +17515 5d/pop-to-ebp +17516 c3/return +17517 +17518 test-parse-var-with-compound-type: +17519 # . prologue +17520 55/push-ebp +17521 89/<- %ebp 4/r32/esp +17522 # setup +17523 8b/-> *Primitive-type-ids 0/r32/eax +17524 89/<- *Type-id 0/r32/eax # stream-write +17525 # (eax..ecx) = "x:" +17526 b8/copy-to-eax "x:"/imm32 +17527 8b/-> *eax 1/r32/ecx +17528 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17529 05/add-to-eax 4/imm32 +17530 # var slice/ecx: slice = {eax, ecx} +17531 51/push-ecx +17532 50/push-eax +17533 89/<- %ecx 4/r32/esp +17534 # _test-input-stream contains "(addr int)" +17535 (clear-stream _test-input-stream) +17536 (write _test-input-stream "(addr int)") +17537 # var v/edx: (handle var) +17538 68/push 0/imm32 +17539 68/push 0/imm32 +17540 89/<- %edx 4/r32/esp +17541 # +17542 (parse-var-with-type %ecx _test-input-stream %edx 0 Stderr 0) +17543 # var v-addr/edx: (addr var) = lookup(v) +17544 (lookup *edx *(edx+4)) # => eax +17545 89/<- %edx 0/r32/eax +17546 # check v-addr->name +17547 (lookup *edx *(edx+4)) # Var-name Var-name => eax +17548 (check-strings-equal %eax "x" "F - test-parse-var-with-compound-type/name") +17549 # check v-addr->register +17550 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-compound-type/register") # Var-register +17551 # - check v-addr->type +17552 # var type/edx: (addr type-tree) = var->type +17553 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +17554 89/<- %edx 0/r32/eax +17555 # type is a non-atom +17556 (check-ints-equal *edx 0 "F - test-parse-var-with-compound-type/type:0") # Type-tree-is-atom +17557 # type->left == atom(addr) +17558 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +17559 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:1") # Type-tree-is-atom +17560 (check-ints-equal *(eax+4) 2 "F - test-parse-var-with-compound-type/type:2") # Type-tree-value +17561 # type->right->left == atom(int) +17562 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax +17563 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +17564 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:3") # Type-tree-is-atom +17565 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-compound-type/type:4") # Type-tree-value +17566 # type->right->right == null +17567 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-compound-type/type:5") # Type-tree-right +17568 # . epilogue +17569 89/<- %esp 5/r32/ebp +17570 5d/pop-to-ebp +17571 c3/return +17572 +17573 # identifier starts with a letter or '$' or '_' +17574 # no constraints at the moment on later letters +17575 # all we really want to do so far is exclude '{', '}' and '->' +17576 is-identifier?: # in: (addr slice) -> result/eax: boolean +17577 # . prologue +17578 55/push-ebp +17579 89/<- %ebp 4/r32/esp +17580 # if (slice-empty?(in)) return false +17581 (slice-empty? *(ebp+8)) # => eax +17582 3d/compare-eax-and 0/imm32/false +17583 75/jump-if-!= $is-identifier?:false/disp8 +17584 # var c/eax: byte = *in->start +17585 8b/-> *(ebp+8) 0/r32/eax +17586 8b/-> *eax 0/r32/eax +17587 8a/copy-byte *eax 0/r32/AL +17588 81 4/subop/and %eax 0xff/imm32 +17589 # if (c == '$') return true +17590 3d/compare-eax-and 0x24/imm32/$ +17591 74/jump-if-= $is-identifier?:true/disp8 +17592 # if (c == '_') return true +17593 3d/compare-eax-and 0x5f/imm32/_ +17594 74/jump-if-= $is-identifier?:true/disp8 +17595 # drop case +17596 25/and-eax-with 0x5f/imm32 +17597 # if (c < 'A') return false +17598 3d/compare-eax-and 0x41/imm32/A +17599 7c/jump-if-< $is-identifier?:false/disp8 +17600 # if (c > 'Z') return false +17601 3d/compare-eax-and 0x5a/imm32/Z +17602 7f/jump-if-> $is-identifier?:false/disp8 +17603 # otherwise return true +17604 $is-identifier?:true: +17605 b8/copy-to-eax 1/imm32/true +17606 eb/jump $is-identifier?:end/disp8 +17607 $is-identifier?:false: +17608 b8/copy-to-eax 0/imm32/false +17609 $is-identifier?:end: +17610 # . epilogue +17611 89/<- %esp 5/r32/ebp +17612 5d/pop-to-ebp +17613 c3/return +17614 +17615 test-is-identifier-dollar: +17616 # . prologue +17617 55/push-ebp +17618 89/<- %ebp 4/r32/esp +17619 # (eax..ecx) = "$a" +17620 b8/copy-to-eax "$a"/imm32 +17621 8b/-> *eax 1/r32/ecx +17622 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17623 05/add-to-eax 4/imm32 +17624 # var slice/ecx: slice = {eax, ecx} +17625 51/push-ecx +17626 50/push-eax +17627 89/<- %ecx 4/r32/esp +17628 # +17629 (is-identifier? %ecx) +17630 (check-ints-equal %eax 1 "F - test-is-identifier-dollar") +17631 # . epilogue +17632 89/<- %esp 5/r32/ebp +17633 5d/pop-to-ebp +17634 c3/return +17635 +17636 test-is-identifier-underscore: +17637 # . prologue +17638 55/push-ebp +17639 89/<- %ebp 4/r32/esp +17640 # (eax..ecx) = "_a" +17641 b8/copy-to-eax "_a"/imm32 +17642 8b/-> *eax 1/r32/ecx +17643 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17644 05/add-to-eax 4/imm32 +17645 # var slice/ecx: slice = {eax, ecx} +17646 51/push-ecx +17647 50/push-eax +17648 89/<- %ecx 4/r32/esp +17649 # +17650 (is-identifier? %ecx) +17651 (check-ints-equal %eax 1 "F - test-is-identifier-underscore") +17652 # . epilogue +17653 89/<- %esp 5/r32/ebp +17654 5d/pop-to-ebp +17655 c3/return +17656 +17657 test-is-identifier-a: +17658 # . prologue +17659 55/push-ebp +17660 89/<- %ebp 4/r32/esp +17661 # (eax..ecx) = "a$" +17662 b8/copy-to-eax "a$"/imm32 +17663 8b/-> *eax 1/r32/ecx +17664 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17665 05/add-to-eax 4/imm32 +17666 # var slice/ecx: slice = {eax, ecx} +17667 51/push-ecx +17668 50/push-eax +17669 89/<- %ecx 4/r32/esp +17670 # +17671 (is-identifier? %ecx) +17672 (check-ints-equal %eax 1 "F - test-is-identifier-a") +17673 # . epilogue +17674 89/<- %esp 5/r32/ebp +17675 5d/pop-to-ebp +17676 c3/return +17677 +17678 test-is-identifier-z: +17679 # . prologue +17680 55/push-ebp +17681 89/<- %ebp 4/r32/esp +17682 # (eax..ecx) = "z$" +17683 b8/copy-to-eax "z$"/imm32 +17684 8b/-> *eax 1/r32/ecx +17685 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17686 05/add-to-eax 4/imm32 +17687 # var slice/ecx: slice = {eax, ecx} +17688 51/push-ecx +17689 50/push-eax +17690 89/<- %ecx 4/r32/esp +17691 # +17692 (is-identifier? %ecx) +17693 (check-ints-equal %eax 1 "F - test-is-identifier-z") +17694 # . epilogue +17695 89/<- %esp 5/r32/ebp +17696 5d/pop-to-ebp +17697 c3/return +17698 +17699 test-is-identifier-A: +17700 # . prologue +17701 55/push-ebp +17702 89/<- %ebp 4/r32/esp +17703 # (eax..ecx) = "A$" +17704 b8/copy-to-eax "A$"/imm32 +17705 8b/-> *eax 1/r32/ecx +17706 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17707 05/add-to-eax 4/imm32 +17708 # var slice/ecx: slice = {eax, ecx} +17709 51/push-ecx +17710 50/push-eax +17711 89/<- %ecx 4/r32/esp +17712 # +17713 (is-identifier? %ecx) +17714 (check-ints-equal %eax 1 "F - test-is-identifier-A") +17715 # . epilogue +17716 89/<- %esp 5/r32/ebp +17717 5d/pop-to-ebp +17718 c3/return +17719 +17720 test-is-identifier-Z: +17721 # . prologue +17722 55/push-ebp +17723 89/<- %ebp 4/r32/esp +17724 # (eax..ecx) = "Z$" +17725 b8/copy-to-eax "Z$"/imm32 +17726 8b/-> *eax 1/r32/ecx +17727 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17728 05/add-to-eax 4/imm32 +17729 # var slice/ecx: slice = {eax, ecx} +17730 51/push-ecx +17731 50/push-eax +17732 89/<- %ecx 4/r32/esp +17733 # +17734 (is-identifier? %ecx) +17735 (check-ints-equal %eax 1 "F - test-is-identifier-Z") +17736 # . epilogue +17737 89/<- %esp 5/r32/ebp +17738 5d/pop-to-ebp +17739 c3/return +17740 +17741 test-is-identifier-at: +17742 # character before 'A' is invalid +17743 # . prologue +17744 55/push-ebp +17745 89/<- %ebp 4/r32/esp +17746 # (eax..ecx) = "@a" +17747 b8/copy-to-eax "@a"/imm32 +17748 8b/-> *eax 1/r32/ecx +17749 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17750 05/add-to-eax 4/imm32 +17751 # var slice/ecx: slice = {eax, ecx} +17752 51/push-ecx +17753 50/push-eax +17754 89/<- %ecx 4/r32/esp +17755 # +17756 (is-identifier? %ecx) +17757 (check-ints-equal %eax 0 "F - test-is-identifier-@") +17758 # . epilogue +17759 89/<- %esp 5/r32/ebp +17760 5d/pop-to-ebp +17761 c3/return +17762 +17763 test-is-identifier-square-bracket: +17764 # character after 'Z' is invalid +17765 # . prologue +17766 55/push-ebp +17767 89/<- %ebp 4/r32/esp +17768 # (eax..ecx) = "[a" +17769 b8/copy-to-eax "[a"/imm32 +17770 8b/-> *eax 1/r32/ecx +17771 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17772 05/add-to-eax 4/imm32 +17773 # var slice/ecx: slice = {eax, ecx} +17774 51/push-ecx +17775 50/push-eax +17776 89/<- %ecx 4/r32/esp +17777 # +17778 (is-identifier? %ecx) +17779 (check-ints-equal %eax 0 "F - test-is-identifier-@") +17780 # . epilogue +17781 89/<- %esp 5/r32/ebp +17782 5d/pop-to-ebp +17783 c3/return +17784 +17785 test-is-identifier-backtick: +17786 # character before 'a' is invalid +17787 # . prologue +17788 55/push-ebp +17789 89/<- %ebp 4/r32/esp +17790 # (eax..ecx) = "`a" +17791 b8/copy-to-eax "`a"/imm32 +17792 8b/-> *eax 1/r32/ecx +17793 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17794 05/add-to-eax 4/imm32 +17795 # var slice/ecx: slice = {eax, ecx} +17796 51/push-ecx +17797 50/push-eax +17798 89/<- %ecx 4/r32/esp +17799 # +17800 (is-identifier? %ecx) +17801 (check-ints-equal %eax 0 "F - test-is-identifier-backtick") +17802 # . epilogue +17803 89/<- %esp 5/r32/ebp +17804 5d/pop-to-ebp +17805 c3/return +17806 +17807 test-is-identifier-curly-brace-open: +17808 # character after 'z' is invalid; also used for blocks +17809 # . prologue +17810 55/push-ebp +17811 89/<- %ebp 4/r32/esp +17812 # (eax..ecx) = "{a" +17813 b8/copy-to-eax "{a"/imm32 +17814 8b/-> *eax 1/r32/ecx +17815 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17816 05/add-to-eax 4/imm32 +17817 # var slice/ecx: slice = {eax, ecx} +17818 51/push-ecx +17819 50/push-eax +17820 89/<- %ecx 4/r32/esp +17821 # +17822 (is-identifier? %ecx) +17823 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open") +17824 # . epilogue +17825 89/<- %esp 5/r32/ebp +17826 5d/pop-to-ebp +17827 c3/return +17828 +17829 test-is-identifier-curly-brace-close: +17830 # . prologue +17831 55/push-ebp +17832 89/<- %ebp 4/r32/esp +17833 # (eax..ecx) = "}a" +17834 b8/copy-to-eax "}a"/imm32 +17835 8b/-> *eax 1/r32/ecx +17836 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17837 05/add-to-eax 4/imm32 +17838 # var slice/ecx: slice = {eax, ecx} +17839 51/push-ecx +17840 50/push-eax +17841 89/<- %ecx 4/r32/esp +17842 # +17843 (is-identifier? %ecx) +17844 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close") +17845 # . epilogue +17846 89/<- %esp 5/r32/ebp +17847 5d/pop-to-ebp +17848 c3/return +17849 +17850 test-is-identifier-hyphen: +17851 # disallow leading '-' since '->' has special meaning +17852 # . prologue +17853 55/push-ebp +17854 89/<- %ebp 4/r32/esp +17855 # (eax..ecx) = "-a" +17856 b8/copy-to-eax "-a"/imm32 +17857 8b/-> *eax 1/r32/ecx +17858 8d/copy-address *(eax+ecx+4) 1/r32/ecx +17859 05/add-to-eax 4/imm32 +17860 # var slice/ecx: slice = {eax, ecx} +17861 51/push-ecx +17862 50/push-eax +17863 89/<- %ecx 4/r32/esp +17864 # +17865 (is-identifier? %ecx) +17866 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen") +17867 # . epilogue +17868 89/<- %esp 5/r32/ebp +17869 5d/pop-to-ebp +17870 c3/return +17871 +17872 populate-mu-function-body: # in: (addr buffered-file), out: (addr function), vars: (addr stack live-var), err: (addr buffered-file), ed: (addr exit-descriptor) +17873 # . prologue +17874 55/push-ebp +17875 89/<- %ebp 4/r32/esp +17876 # . save registers +17877 50/push-eax +17878 56/push-esi +17879 57/push-edi +17880 # esi = in +17881 8b/-> *(ebp+8) 6/r32/esi +17882 # edi = out +17883 8b/-> *(ebp+0xc) 7/r32/edi +17884 # initialize some global state +17885 c7 0/subop/copy *Curr-block-depth 1/imm32 +17886 # parse-mu-block(in, vars, out, out->body) +17887 8d/copy-address *(edi+0x18) 0/r32/eax # Function-body +17888 (parse-mu-block %esi *(ebp+0x10) %edi %eax *(ebp+0x14) *(ebp+0x18)) +17889 $populate-mu-function-body:end: +17890 # . restore registers +17891 5f/pop-to-edi +17892 5e/pop-to-esi +17893 58/pop-to-eax +17894 # . epilogue +17895 89/<- %esp 5/r32/ebp +17896 5d/pop-to-ebp +17897 c3/return +17898 +17899 # parses a block, assuming that the leading '{' has already been read by the caller +17900 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) +17901 # pseudocode: +17902 # var line: (stream byte 512) +17903 # var word-slice: slice +17904 # allocate(Heap, Stmt-size, out) +17905 # var out-addr: (addr block) = lookup(*out) +17906 # out-addr->tag = 0/block +17907 # out-addr->var = some unique name +17908 # push(vars, {out-addr->var, false}) +17909 # while true # line loop +17910 # clear-stream(line) +17911 # read-line-buffered(in, line) +17912 # if (line->write == 0) break # end of file +17913 # word-slice = next-mu-token(line) +17914 # if slice-empty?(word-slice) # end of line +17915 # continue +17916 # else if slice-starts-with?(word-slice, "#") +17917 # continue +17918 # else if slice-equal?(word-slice, "{") +17919 # assert(no-tokens-in(line)) +17920 # block = parse-mu-block(in, vars, fn) +17921 # append-to-block(out-addr, block) +17922 # else if slice-equal?(word-slice, "}") +17923 # break +17924 # else if slice-ends-with?(word-slice, ":") +17925 # # TODO: error-check the rest of 'line' +17926 # --word-slice->end to skip ':' +17927 # named-block = parse-mu-named-block(word-slice, in, vars, fn) +17928 # append-to-block(out-addr, named-block) +17929 # else if slice-equal?(word-slice, "var") +17930 # var-def = parse-mu-var-def(line, vars, fn) +17931 # append-to-block(out-addr, var-def) +17932 # else +17933 # stmt = parse-mu-stmt(line, vars, fn) +17934 # append-to-block(out-addr, stmt) +17935 # pop(vars) +17936 # +17937 # . prologue +17938 55/push-ebp +17939 89/<- %ebp 4/r32/esp +17940 # . save registers +17941 50/push-eax +17942 51/push-ecx +17943 52/push-edx +17944 53/push-ebx +17945 57/push-edi +17946 # var line/ecx: (stream byte 512) +17947 81 5/subop/subtract %esp 0x200/imm32 +17948 68/push 0x200/imm32/size +17949 68/push 0/imm32/read +17950 68/push 0/imm32/write +17951 89/<- %ecx 4/r32/esp +17952 # var word-slice/edx: slice +17953 68/push 0/imm32/end +17954 68/push 0/imm32/start +17955 89/<- %edx 4/r32/esp +17956 # allocate into out +17957 (allocate Heap *Stmt-size *(ebp+0x14)) +17958 # var out-addr/edi: (addr block) = lookup(*out) +17959 8b/-> *(ebp+0x14) 7/r32/edi +17960 (lookup *edi *(edi+4)) # => eax +17961 89/<- %edi 0/r32/eax +17962 # out-addr->tag is 0 (block) by default +17963 # set out-addr->var +17964 8d/copy-address *(edi+0xc) 0/r32/eax # Block-var +17965 (new-block-name *(ebp+0x10) %eax) +17966 # push(vars, out-addr->var) +17967 (push *(ebp+0xc) *(edi+0xc)) # Block-var +17968 (push *(ebp+0xc) *(edi+0x10)) # Block-var +17969 (push *(ebp+0xc) 0) # false +17970 # increment *Curr-block-depth +17971 ff 0/subop/increment *Curr-block-depth +17972 { +17973 $parse-mu-block:line-loop: +17974 # line = read-line-buffered(in) +17975 (clear-stream %ecx) +17976 (read-line-buffered *(ebp+8) %ecx) +17977 #? (write-buffered Stderr "line: ") +17978 #? (write-stream-data Stderr %ecx) +17979 #? #? (write-buffered Stderr Newline) # line has its own newline +17980 #? (flush Stderr) +17981 #? (rewind-stream %ecx) +17982 # if (line->write == 0) break +17983 81 7/subop/compare *ecx 0/imm32 +17984 0f 84/jump-if-= break/disp32 +17985 #? (write-buffered Stderr "vars:\n") +17986 #? (dump-vars *(ebp+0xc)) +17987 # word-slice = next-mu-token(line) +17988 (next-mu-token %ecx %edx) +17989 #? (write-buffered Stderr "word: ") +17990 #? (write-slice-buffered Stderr %edx) +17991 #? (write-buffered Stderr Newline) +17992 #? (flush Stderr) +17993 # if slice-empty?(word-slice) continue +17994 (slice-empty? %edx) +17995 3d/compare-eax-and 0/imm32/false +17996 0f 85/jump-if-!= loop/disp32 +17997 # if (slice-starts-with?(word-slice, '#') continue +17998 # . eax = *word-slice->start +17999 8b/-> *edx 0/r32/eax +18000 8a/copy-byte *eax 0/r32/AL +18001 81 4/subop/and %eax 0xff/imm32 +18002 # . if (eax == '#') continue +18003 3d/compare-eax-and 0x23/imm32/hash +18004 0f 84/jump-if-= loop/disp32 +18005 # if slice-equal?(word-slice, "{") +18006 { +18007 $parse-mu-block:check-for-block: +18008 (slice-equal? %edx "{") +18009 3d/compare-eax-and 0/imm32/false +18010 74/jump-if-= break/disp8 +18011 (check-no-tokens-left %ecx) +18012 # parse new block and append +18013 # . var tmp/eax: (handle block) +18014 68/push 0/imm32 +18015 68/push 0/imm32 +18016 89/<- %eax 4/r32/esp +18017 # . +18018 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) +18019 (append-to-block Heap %edi *eax *(eax+4)) +18020 # . reclaim tmp +18021 81 0/subop/add %esp 8/imm32 +18022 # . +18023 e9/jump $parse-mu-block:line-loop/disp32 +18024 } +18025 # if slice-equal?(word-slice, "}") break +18026 $parse-mu-block:check-for-end: +18027 (slice-equal? %edx "}") +18028 3d/compare-eax-and 0/imm32/false +18029 0f 85/jump-if-!= break/disp32 +18030 # if slice-ends-with?(word-slice, ":") parse named block and append +18031 { +18032 $parse-mu-block:check-for-named-block: +18033 # . eax = *(word-slice->end-1) +18034 8b/-> *(edx+4) 0/r32/eax +18035 48/decrement-eax +18036 8a/copy-byte *eax 0/r32/AL +18037 81 4/subop/and %eax 0xff/imm32 +18038 # . if (eax != ':') break +18039 3d/compare-eax-and 0x3a/imm32/colon +18040 0f 85/jump-if-!= break/disp32 +18041 # TODO: error-check the rest of 'line' +18042 # +18043 # skip ':' +18044 ff 1/subop/decrement *(edx+4) # Slice-end +18045 # var tmp/eax: (handle block) +18046 68/push 0/imm32 +18047 68/push 0/imm32 +18048 89/<- %eax 4/r32/esp +18049 # +18050 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) +18051 (append-to-block Heap %edi *eax *(eax+4)) +18052 # reclaim tmp +18053 81 0/subop/add %esp 8/imm32 +18054 # +18055 e9/jump $parse-mu-block:line-loop/disp32 +18056 } +18057 # if slice-equal?(word-slice, "var") +18058 { +18059 $parse-mu-block:check-for-var: +18060 (slice-equal? %edx "var") +18061 3d/compare-eax-and 0/imm32/false +18062 74/jump-if-= break/disp8 +18063 # var tmp/eax: (handle block) +18064 68/push 0/imm32 +18065 68/push 0/imm32 +18066 89/<- %eax 4/r32/esp +18067 # +18068 (parse-mu-var-def %ecx *(ebp+0xc) %eax *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) +18069 (append-to-block Heap %edi *eax *(eax+4)) +18070 # reclaim tmp +18071 81 0/subop/add %esp 8/imm32 +18072 # +18073 e9/jump $parse-mu-block:line-loop/disp32 +18074 } +18075 $parse-mu-block:regular-stmt: +18076 # otherwise +18077 # var tmp/eax: (handle block) +18078 68/push 0/imm32 +18079 68/push 0/imm32 +18080 89/<- %eax 4/r32/esp +18081 # +18082 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) +18083 (append-to-block Heap %edi *eax *(eax+4)) +18084 # reclaim tmp +18085 81 0/subop/add %esp 8/imm32 +18086 # +18087 e9/jump loop/disp32 +18088 } # end line loop +18089 (clean-up-blocks *(ebp+0xc) *Curr-block-depth *(ebp+0x10)) +18090 # decrement *Curr-block-depth +18091 ff 1/subop/decrement *Curr-block-depth +18092 # pop(vars) +18093 (pop *(ebp+0xc)) # => eax +18094 (pop *(ebp+0xc)) # => eax +18095 (pop *(ebp+0xc)) # => eax +18096 $parse-mu-block:end: +18097 # . reclaim locals +18098 81 0/subop/add %esp 0x214/imm32 +18099 # . restore registers +18100 5f/pop-to-edi +18101 5b/pop-to-ebx +18102 5a/pop-to-edx +18103 59/pop-to-ecx +18104 58/pop-to-eax +18105 # . epilogue +18106 89/<- %esp 5/r32/ebp +18107 5d/pop-to-ebp +18108 c3/return +18109 +18110 $parse-mu-block:abort: +18111 # error("'{' or '}' should be on its own line, but got '") +18112 (write-buffered *(ebp+0x18) "'{' or '}' should be on its own line, but got '") +18113 (rewind-stream %ecx) +18114 (write-stream-data *(ebp+0x18) %ecx) +18115 (write-buffered *(ebp+0x18) "'\n") +18116 (flush *(ebp+0x18)) +18117 (stop *(ebp+0x1c) 1) +18118 # never gets here +18119 +18120 new-block-name: # fn: (addr function), out: (addr handle var) +18121 # . prologue +18122 55/push-ebp +18123 89/<- %ebp 4/r32/esp +18124 # . save registers +18125 50/push-eax +18126 51/push-ecx +18127 52/push-edx +18128 # var n/ecx: int = len(fn->name) + 10 for an int + 2 for '$:' +18129 8b/-> *(ebp+8) 0/r32/eax +18130 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18131 8b/-> *eax 0/r32/eax # String-size +18132 05/add-to-eax 0xd/imm32 # 10 + 2 for '$:' +18133 89/<- %ecx 0/r32/eax +18134 # var name/edx: (stream byte n) +18135 29/subtract-from %esp 1/r32/ecx +18136 ff 6/subop/push %ecx +18137 68/push 0/imm32/read +18138 68/push 0/imm32/write +18139 89/<- %edx 4/r32/esp +18140 (clear-stream %edx) +18141 # eax = fn->name +18142 8b/-> *(ebp+8) 0/r32/eax +18143 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18144 # construct result using Next-block-index (and increment it) +18145 (write %edx "$") +18146 (write %edx %eax) +18147 (write %edx ":") +18148 (write-int32-hex %edx *Next-block-index) +18149 ff 0/subop/increment *Next-block-index +18150 # var s/eax: slice = {name->data, name->data + name->write} (clobbering edx) +18151 # . eax = name->write +18152 8b/-> *edx 0/r32/eax +18153 # . edx = name->data +18154 8d/copy-address *(edx+0xc) 2/r32/edx +18155 # . eax = name->write + name->data +18156 01/add-to %eax 2/r32/edx +18157 # . push {edx, eax} +18158 ff 6/subop/push %eax +18159 ff 6/subop/push %edx +18160 89/<- %eax 4/r32/esp +18161 # out = new literal(s) +18162 (new-literal Heap %eax *(ebp+0xc)) +18163 #? 8b/-> *(ebp+0xc) 0/r32/eax +18164 #? (write-buffered Stderr "type allocid in caller after new-literal: ") +18165 #? (write-int32-hex-buffered Stderr *(eax+8)) +18166 #? (write-buffered Stderr " for var ") +18167 #? (write-int32-hex-buffered Stderr %eax) +18168 #? (write-buffered Stderr Newline) +18169 #? (flush Stderr) +18170 $new-block-name:end: +18171 # . reclaim locals +18172 81 0/subop/add %ecx 0xc/imm32 # name.{read/write/len} +18173 81 0/subop/add %ecx 8/imm32 # slice +18174 01/add-to %esp 1/r32/ecx +18175 # . restore registers +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 check-no-tokens-left: # line: (addr stream byte) +18185 # . prologue +18186 55/push-ebp +18187 89/<- %ebp 4/r32/esp +18188 # . save registers +18189 50/push-eax +18190 51/push-ecx +18191 # var s/ecx: slice +18192 68/push 0/imm32/end +18193 68/push 0/imm32/start +18194 89/<- %ecx 4/r32/esp +18195 # +18196 (next-mu-token *(ebp+8) %ecx) +18197 # if slice-empty?(s) return +18198 (slice-empty? %ecx) +18199 3d/compare-eax-and 0/imm32/false +18200 75/jump-if-!= $check-no-tokens-left:end/disp8 +18201 # if (slice-starts-with?(s, '#') return +18202 # . eax = *s->start +18203 8b/-> *edx 0/r32/eax +18204 8a/copy-byte *eax 0/r32/AL +18205 81 4/subop/and %eax 0xff/imm32 +18206 # . if (eax == '#') continue +18207 3d/compare-eax-and 0x23/imm32/hash +18208 74/jump-if-= $check-no-tokens-left:end/disp8 +18209 # abort +18210 (write-buffered Stderr "'{' or '}' should be on its own line, but got '") +18211 (rewind-stream %ecx) +18212 (write-stream 2 %ecx) +18213 (write-buffered Stderr "'\n") +18214 (flush Stderr) +18215 # . syscall(exit, 1) +18216 bb/copy-to-ebx 1/imm32 +18217 e8/call syscall_exit/disp32 +18218 # never gets here +18219 $check-no-tokens-left:end: +18220 # . reclaim locals +18221 81 0/subop/add %esp 8/imm32 +18222 # . restore registers +18223 59/pop-to-ecx +18224 58/pop-to-eax +18225 # . epilogue +18226 89/<- %esp 5/r32/ebp +18227 5d/pop-to-ebp +18228 c3/return +18229 +18230 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) +18231 # pseudocode: +18232 # var v: (handle var) +18233 # new-literal(name, v) +18234 # push(vars, {v, false}) +18235 # parse-mu-block(in, vars, fn, out) +18236 # pop(vars) +18237 # out->tag = block +18238 # out->var = v +18239 # +18240 # . prologue +18241 55/push-ebp +18242 89/<- %ebp 4/r32/esp +18243 # . save registers +18244 50/push-eax +18245 51/push-ecx +18246 57/push-edi +18247 # var v/ecx: (handle var) +18248 68/push 0/imm32 +18249 68/push 0/imm32 +18250 89/<- %ecx 4/r32/esp +18251 # +18252 (new-literal Heap *(ebp+8) %ecx) +18253 # push(vars, v) +18254 (push *(ebp+0x10) *ecx) +18255 (push *(ebp+0x10) *(ecx+4)) +18256 (push *(ebp+0x10) 0) # false +18257 # +18258 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20)) +18259 # pop v off vars +18260 (pop *(ebp+0x10)) # => eax +18261 (pop *(ebp+0x10)) # => eax +18262 (pop *(ebp+0x10)) # => eax +18263 # var out-addr/edi: (addr stmt) = lookup(*out) +18264 8b/-> *(ebp+0x18) 7/r32/edi +18265 (lookup *edi *(edi+4)) # => eax +18266 89/<- %edi 0/r32/eax +18267 # out-addr->tag = named-block +18268 c7 0/subop/copy *edi 0/imm32/block # Stmt-tag +18269 # out-addr->var = v +18270 8b/-> *ecx 0/r32/eax +18271 89/<- *(edi+0xc) 0/r32/eax # Block-var +18272 8b/-> *(ecx+4) 0/r32/eax +18273 89/<- *(edi+0x10) 0/r32/eax # Block-var +18274 $parse-mu-named-block:end: +18275 # . reclaim locals +18276 81 0/subop/add %esp 8/imm32 +18277 # . restore registers +18278 5f/pop-to-edi +18279 59/pop-to-ecx +18280 58/pop-to-eax +18281 # . epilogue +18282 89/<- %esp 5/r32/ebp +18283 5d/pop-to-ebp +18284 c3/return +18285 +18286 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) +18287 # . prologue +18288 55/push-ebp +18289 89/<- %ebp 4/r32/esp +18290 # . save registers +18291 50/push-eax +18292 51/push-ecx +18293 52/push-edx +18294 56/push-esi +18295 57/push-edi +18296 # edi = out +18297 8b/-> *(ebp+0x10) 7/r32/edi +18298 # var word-slice/ecx: slice +18299 68/push 0/imm32/end +18300 68/push 0/imm32/start +18301 89/<- %ecx 4/r32/esp +18302 # var v/edx: (handle var) +18303 68/push 0/imm32 +18304 68/push 0/imm32 +18305 89/<- %edx 4/r32/esp +18306 # v = parse-var-with-type(next-mu-token(line)) +18307 (next-mu-token *(ebp+8) %ecx) +18308 { +18309 # just for tests, support null fn +18310 8b/-> *(ebp+0x14) 0/r32/eax +18311 3d/compare-eax-and 0/imm32 +18312 74/jump-if-= break/disp8 +18313 (lookup *eax *(eax+4)) # Var-name Var-name => eax +18314 } +18315 (parse-var-with-type %ecx *(ebp+8) %edx %eax *(ebp+0x18) *(ebp+0x1c)) +18316 # var v-addr/esi: (addr var) +18317 (lookup *edx *(edx+4)) # => eax +18318 89/<- %esi 0/r32/eax +18319 # v->block-depth = *Curr-block-depth +18320 8b/-> *Curr-block-depth 0/r32/eax +18321 89/<- *(esi+0x10) 0/r32/eax # Var-block-depth +18322 # either v has no register and there's no more to this line +18323 81 7/subop/compare *(esi+0x18) 0/imm32 +18324 { +18325 75/jump-if-!= break/disp8 +18326 # if v-addr->type == byte, abort +18327 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +18328 (is-simple-mu-type? %eax 8) # byte => eax +18329 3d/compare-eax-and 0/imm32/false +18330 0f 85/jump-if-!= $parse-mu-var-def:error-byte-on-stack/disp32 +18331 # ensure that there's nothing else on this line +18332 (next-mu-token *(ebp+8) %ecx) +18333 (slice-empty? %ecx) # => eax +18334 3d/compare-eax-and 0/imm32/false +18335 0f 84/jump-if-= $parse-mu-var-def:error2/disp32 +18336 # +18337 (new-var-def Heap *edx *(edx+4) %edi) +18338 e9/jump $parse-mu-var-def:update-vars/disp32 +18339 } +18340 # or v has a register and there's more to this line +18341 { +18342 0f 84/jump-if-= break/disp32 +18343 # if v-addr->type == byte, check for unsupported registers +18344 { +18345 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +18346 (is-simple-mu-type? %eax 8) # byte => eax +18347 3d/compare-eax-and 0/imm32/false +18348 74/jump-if-= break/disp8 +18349 (lookup *(esi+0x18) *(esi+0x1c)) # => eax +18350 (string-equal? %eax "esi") # => eax +18351 3d/compare-eax-and 0/imm32/false +18352 0f 85/jump-if-!= $parse-mu-var-def:error-byte-registers/disp32 +18353 (lookup *(esi+0x18) *(esi+0x1c)) # => eax +18354 (string-equal? %eax "edi") # => eax +18355 3d/compare-eax-and 0/imm32/false +18356 0f 85/jump-if-!= $parse-mu-var-def:error-byte-registers/disp32 +18357 } +18358 # TODO: vars of type 'byte' should only be initialized by clearing to 0 +18359 # ensure that the next word is '<-' +18360 (next-mu-token *(ebp+8) %ecx) +18361 (slice-equal? %ecx "<-") # => eax +18362 3d/compare-eax-and 0/imm32/false +18363 0f 84/jump-if-= $parse-mu-var-def:error1/disp32 +18364 # +18365 (new-reg-var-def Heap *edx *(edx+4) %edi) +18366 (lookup *edi *(edi+4)) # => eax +18367 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +18368 } +18369 $parse-mu-var-def:update-vars: +18370 # push 'v' at end of function +18371 (push *(ebp+0xc) *edx) +18372 (push *(ebp+0xc) *(edx+4)) +18373 (push *(ebp+0xc) 0) # Live-var-register-spilled is unused during parsing +18374 $parse-mu-var-def:end: +18375 # . reclaim locals +18376 81 0/subop/add %esp 0x10/imm32 +18377 # . restore registers +18378 5f/pop-to-edi +18379 5e/pop-to-esi +18380 5a/pop-to-edx +18381 59/pop-to-ecx +18382 58/pop-to-eax +18383 # . epilogue +18384 89/<- %esp 5/r32/ebp +18385 5d/pop-to-ebp +18386 c3/return +18387 +18388 $parse-mu-var-def:error1: +18389 (rewind-stream *(ebp+8)) +18390 # error("register variable requires a valid instruction to initialize but got '" line "'\n") +18391 (write-buffered *(ebp+0x18) "register variable requires a valid instruction to initialize but got '") +18392 (flush *(ebp+0x18)) +18393 (write-stream-data *(ebp+0x18) *(ebp+8)) +18394 (write-buffered *(ebp+0x18) "'\n") +18395 (flush *(ebp+0x18)) +18396 (stop *(ebp+0x1c) 1) +18397 # never gets here +18398 +18399 $parse-mu-var-def:error2: +18400 # error("fn " fn ": var " var ": variables on the stack can't take an initializer\n") +18401 (write-buffered *(ebp+0x18) "fn ") +18402 8b/-> *(ebp+0x14) 0/r32/eax +18403 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18404 (write-buffered *(ebp+0x18) %eax) +18405 (write-buffered *(ebp+0x18) ": var ") +18406 # var v-addr/eax: (addr var) = lookup(v) +18407 (lookup *edx *(edx+4)) # => eax +18408 (lookup *eax *(eax+4)) # Var-name Var-name => eax +18409 (write-buffered *(ebp+0x18) %eax) +18410 (write-buffered *(ebp+0x18) ": variables on the stack can't take an initializer\n") +18411 (flush *(ebp+0x18)) +18412 (stop *(ebp+0x1c) 1) +18413 # never gets here +18414 +18415 $parse-mu-var-def:error-byte-on-stack: +18416 # error("fn " fn ": var '" var "' of type 'byte' cannot be on the stack\n") +18417 (write-buffered *(ebp+0x18) "fn ") +18418 8b/-> *(ebp+0x14) 0/r32/eax +18419 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18420 (write-buffered *(ebp+0x18) %eax) +18421 (write-buffered *(ebp+0x18) ": var '") +18422 # var v-addr/eax: (addr var) = lookup(v) +18423 (lookup *edx *(edx+4)) # => eax +18424 (lookup *eax *(eax+4)) # Var-name Var-name => eax +18425 (write-buffered *(ebp+0x18) %eax) +18426 (write-buffered *(ebp+0x18) "' of type 'byte' cannot be on the stack\n") +18427 (flush *(ebp+0x18)) +18428 (stop *(ebp+0x1c) 1) +18429 # never gets here +18430 +18431 $parse-mu-var-def:error-byte-registers: +18432 # error("fn " fn ": var '" var "' of type 'byte' cannot be in esi or edi\n") +18433 (write-buffered *(ebp+0x18) "fn ") +18434 8b/-> *(ebp+0x14) 0/r32/eax +18435 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18436 (write-buffered *(ebp+0x18) %eax) +18437 (write-buffered *(ebp+0x18) ": var '") +18438 # var v-addr/eax: (addr var) = lookup(v) +18439 (lookup *edx *(edx+4)) # => eax +18440 (lookup *eax *(eax+4)) # Var-name Var-name => eax +18441 (write-buffered *(ebp+0x18) %eax) +18442 (write-buffered *(ebp+0x18) "' of type 'byte' cannot be in esi or edi\n") +18443 (flush *(ebp+0x18)) +18444 (stop *(ebp+0x1c) 1) +18445 # never gets here 18446 -18447 # simpler version of lookup-var-helper -18448 binding-exists?: # target: (addr var), vars: (addr stack live-var) -> result/eax: boolean -18449 # pseudocode: -18450 # var curr: (addr handle var) = &vars->data[vars->top - 12] -18451 # var min = vars->data -18452 # while curr >= min -18453 # var v: (handle var) = *curr -18454 # if v->name == target->name -18455 # return true -18456 # curr -= 12 -18457 # return false -18458 # -18459 # . prologue -18460 55/push-ebp -18461 89/<- %ebp 4/r32/esp -18462 # . save registers -18463 51/push-ecx -18464 52/push-edx -18465 56/push-esi -18466 # var target-name/ecx: (addr array byte) = lookup(target->name) -18467 8b/-> *(ebp+8) 0/r32/eax -18468 (lookup *eax *(eax+4)) # Var-name Var-name => eax -18469 89/<- %ecx 0/r32/eax -18470 # esi = vars -18471 8b/-> *(ebp+0xc) 6/r32/esi -18472 # eax = vars->top -18473 8b/-> *esi 0/r32/eax -18474 # var min/edx: (addr handle var) = vars->data -18475 8d/copy-address *(esi+8) 2/r32/edx -18476 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] -18477 8d/copy-address *(esi+eax-4) 6/r32/esi # vars + 8 + vars->type - 12 -18478 { -18479 $binding-exists?:loop: -18480 # if (curr < min) return -18481 39/compare %esi 2/r32/edx -18482 0f 82/jump-if-addr< break/disp32 -18483 # var v/eax: (addr var) = lookup(*curr) -18484 (lookup *esi *(esi+4)) # => eax -18485 # var vn/eax: (addr array byte) = lookup(v->name) -18486 (lookup *eax *(eax+4)) # Var-name Var-name => eax -18487 # if (vn == target-name) return true -18488 (string-equal? %ecx %eax) # => eax -18489 3d/compare-eax-and 0/imm32/false -18490 75/jump-if-!= $binding-exists?:end/disp8 # eax already contains true -18491 # curr -= 12 -18492 81 5/subop/subtract %esi 0xc/imm32 -18493 e9/jump loop/disp32 -18494 } -18495 b8/copy-to-eax 0/imm32/false -18496 $binding-exists?:end: -18497 # . restore registers -18498 5e/pop-to-esi -18499 5a/pop-to-edx -18500 59/pop-to-ecx -18501 # . epilogue -18502 89/<- %esp 5/r32/ebp -18503 5d/pop-to-ebp -18504 c3/return -18505 -18506 test-parse-mu-stmt: -18507 # . prologue -18508 55/push-ebp -18509 89/<- %ebp 4/r32/esp -18510 # setup -18511 8b/-> *Primitive-type-ids 0/r32/eax -18512 89/<- *Type-id 0/r32/eax # stream-write -18513 (clear-stream _test-input-stream) -18514 (write _test-input-stream "increment n\n") -18515 # var vars/ecx: (stack (addr var) 16) -18516 81 5/subop/subtract %esp 0xc0/imm32 -18517 68/push 0xc0/imm32/size -18518 68/push 0/imm32/top -18519 89/<- %ecx 4/r32/esp -18520 (clear-stack %ecx) -18521 # var v/edx: (handle var) -18522 68/push 0/imm32 -18523 68/push 0/imm32 -18524 89/<- %edx 4/r32/esp -18525 # var s/eax: (handle array byte) -18526 68/push 0/imm32 -18527 68/push 0/imm32 -18528 89/<- %eax 4/r32/esp -18529 # v = new var("n") -18530 (copy-array Heap "n" %eax) -18531 (new-var Heap *eax *(eax+4) %edx) -18532 # -18533 (push %ecx *edx) -18534 (push %ecx *(edx+4)) -18535 (push %ecx 0) -18536 # var out/eax: (handle stmt) -18537 68/push 0/imm32 -18538 68/push 0/imm32 -18539 89/<- %eax 4/r32/esp -18540 # convert -18541 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) -18542 # var out-addr/edx: (addr stmt) = lookup(*out) -18543 (lookup *eax *(eax+4)) # => eax -18544 89/<- %edx 0/r32/eax -18545 # out->tag -18546 (check-ints-equal *edx 1 "F - test-parse-mu-stmt/tag") # Stmt-tag is Stmt1 -18547 # out->operation -18548 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax -18549 (check-strings-equal %eax "increment" "F - test-parse-mu-stmt/name") # Stmt1-operation -18550 # out->inouts->value->name -18551 # . eax = out->inouts -18552 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -18553 # . eax = out->inouts->value -18554 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -18555 # . eax = out->inouts->value->name -18556 (lookup *eax *(eax+4)) # Var-name Var-name => eax -18557 # . -18558 (check-strings-equal %eax "n" "F - test-parse-mu-stmt/inout:0") -18559 # . epilogue -18560 89/<- %esp 5/r32/ebp -18561 5d/pop-to-ebp -18562 c3/return -18563 -18564 test-parse-mu-stmt-with-comma: +18447 test-parse-mu-var-def: +18448 # 'var n: int' +18449 # . prologue +18450 55/push-ebp +18451 89/<- %ebp 4/r32/esp +18452 # setup +18453 8b/-> *Primitive-type-ids 0/r32/eax +18454 89/<- *Type-id 0/r32/eax # stream-write +18455 (clear-stream _test-input-stream) +18456 (write _test-input-stream "n: int\n") # caller has consumed the 'var' +18457 c7 0/subop/copy *Curr-block-depth 1/imm32 +18458 # var out/esi: (handle stmt) +18459 68/push 0/imm32 +18460 68/push 0/imm32 +18461 89/<- %esi 4/r32/esp +18462 # var vars/ecx: (stack (addr var) 16) +18463 81 5/subop/subtract %esp 0xc0/imm32 +18464 68/push 0xc0/imm32/size +18465 68/push 0/imm32/top +18466 89/<- %ecx 4/r32/esp +18467 (clear-stack %ecx) +18468 # convert +18469 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) +18470 # var out-addr/esi: (addr stmt) +18471 (lookup *esi *(esi+4)) # => eax +18472 89/<- %esi 0/r32/eax +18473 # +18474 (check-ints-equal *esi 2 "F - test-parse-mu-var-def/tag") # Stmt-tag is var-def +18475 # var v/ecx: (addr var) = lookup(out->var) +18476 (lookup *(esi+4) *(esi+8)) # Vardef-var Vardef-var => eax +18477 89/<- %ecx 0/r32/eax +18478 # v->name +18479 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +18480 (check-strings-equal %eax "n" "F - test-parse-mu-var-def/var-name") +18481 # v->register +18482 (check-ints-equal *(ecx+0x18) 0 "F - test-parse-mu-var-def/var-register") # Var-register +18483 # v->block-depth +18484 (check-ints-equal *(ecx+0x10) 1 "F - test-parse-mu-var-def/output-block-depth") # Var-block-depth +18485 # v->type == int +18486 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +18487 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0") # Type-tree-is-atom +18488 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-var-def/var-type:1") # Type-tree-value +18489 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-var-def/var-type:2") # Type-tree-right +18490 # . epilogue +18491 89/<- %esp 5/r32/ebp +18492 5d/pop-to-ebp +18493 c3/return +18494 +18495 test-parse-mu-reg-var-def: +18496 # 'var n/eax: int <- copy 0' +18497 # . prologue +18498 55/push-ebp +18499 89/<- %ebp 4/r32/esp +18500 # setup +18501 8b/-> *Primitive-type-ids 0/r32/eax +18502 89/<- *Type-id 0/r32/eax # stream-write +18503 (clear-stream _test-input-stream) +18504 (write _test-input-stream "n/eax: int <- copy 0\n") # caller has consumed the 'var' +18505 c7 0/subop/copy *Curr-block-depth 1/imm32 +18506 # var out/esi: (handle stmt) +18507 68/push 0/imm32 +18508 68/push 0/imm32 +18509 89/<- %esi 4/r32/esp +18510 # var vars/ecx: (stack (addr var) 16) +18511 81 5/subop/subtract %esp 0xc0/imm32 +18512 68/push 0xc0/imm32/size +18513 68/push 0/imm32/top +18514 89/<- %ecx 4/r32/esp +18515 (clear-stack %ecx) +18516 # convert +18517 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) +18518 # var out-addr/esi: (addr stmt) +18519 (lookup *esi *(esi+4)) # => eax +18520 89/<- %esi 0/r32/eax +18521 # +18522 (check-ints-equal *esi 3 "F - test-parse-mu-reg-var-def/tag") # Stmt-tag is reg-var-def +18523 # var v/ecx: (addr var) = lookup(out->outputs->value) +18524 # . eax: (addr stmt-var) = lookup(out->outputs) +18525 (lookup *(esi+0x14) *(esi+0x18)) # Regvardef-outputs Regvardef-outputs => eax +18526 # . +18527 (check-ints-equal *(eax+8) 0 "F - test-parse-mu-reg-var-def/single-output") # Stmt-var-next +18528 # . eax: (addr var) = lookup(eax->value) +18529 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +18530 # . ecx = eax +18531 89/<- %ecx 0/r32/eax +18532 # v->name +18533 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +18534 (check-strings-equal %eax "n" "F - test-parse-mu-reg-var-def/output-name") # Var-name +18535 # v->register +18536 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +18537 (check-strings-equal %eax "eax" "F - test-parse-mu-reg-var-def/output-register") +18538 # v->block-depth +18539 (check-ints-equal *(ecx+0x10) 1 "F - test-parse-mu-reg-var-def/output-block-depth") # Var-block-depth +18540 # v->type == int +18541 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +18542 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0") # Type-tree-is-atom +18543 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-reg-var-def/output-type:1") # Type-tree-value +18544 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-reg-var-def/output-type:2") # Type-tree-right +18545 # . epilogue +18546 89/<- %esp 5/r32/ebp +18547 5d/pop-to-ebp +18548 c3/return +18549 +18550 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) +18551 # pseudocode: +18552 # var name: slice +18553 # allocate(Heap, Stmt-size, out) +18554 # var out-addr: (addr stmt) = lookup(*out) +18555 # out-addr->tag = stmt +18556 # if stmt-has-outputs?(line) +18557 # while true +18558 # name = next-mu-token(line) +18559 # if (name == '<-') break +18560 # assert(is-identifier?(name)) +18561 # var v: (handle var) = lookup-var(name, vars) +18562 # out-addr->outputs = append(v, out-addr->outputs) +18563 # add-operation-and-inputs-to-stmt(out-addr, line, vars) +18564 # 18565 # . prologue 18566 55/push-ebp 18567 89/<- %ebp 4/r32/esp -18568 # setup -18569 8b/-> *Primitive-type-ids 0/r32/eax -18570 89/<- *Type-id 0/r32/eax # stream-write -18571 (clear-stream _test-input-stream) -18572 (write _test-input-stream "copy-to n, 3\n") -18573 # var vars/ecx: (stack (addr var) 16) -18574 81 5/subop/subtract %esp 0xc0/imm32 -18575 68/push 0xc0/imm32/size -18576 68/push 0/imm32/top +18568 # . save registers +18569 50/push-eax +18570 51/push-ecx +18571 52/push-edx +18572 53/push-ebx +18573 57/push-edi +18574 # var name/ecx: slice +18575 68/push 0/imm32/end +18576 68/push 0/imm32/start 18577 89/<- %ecx 4/r32/esp -18578 (clear-stack %ecx) -18579 # var v/edx: (handle var) -18580 68/push 0/imm32 +18578 # var is-deref?/edx: boolean = false +18579 ba/copy-to-edx 0/imm32/false +18580 # var v: (handle var) 18581 68/push 0/imm32 -18582 89/<- %edx 4/r32/esp -18583 # var s/eax: (handle array byte) -18584 68/push 0/imm32 -18585 68/push 0/imm32 -18586 89/<- %eax 4/r32/esp -18587 # v = new var("n") -18588 (copy-array Heap "n" %eax) -18589 (new-var Heap *eax *(eax+4) %edx) -18590 # -18591 (push %ecx *edx) -18592 (push %ecx *(edx+4)) -18593 (push %ecx 0) -18594 # var out/eax: (handle stmt) -18595 68/push 0/imm32 -18596 68/push 0/imm32 -18597 89/<- %eax 4/r32/esp -18598 # convert -18599 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) -18600 # var out-addr/edx: (addr stmt) = lookup(*out) -18601 (lookup *eax *(eax+4)) # => eax -18602 89/<- %edx 0/r32/eax -18603 # out->tag -18604 (check-ints-equal *edx 1 "F - test-parse-mu-stmt-with-comma/tag") # Stmt-tag is Stmt1 -18605 # out->operation -18606 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax -18607 (check-strings-equal %eax "copy-to" "F - test-parse-mu-stmt-with-comma/name") # Stmt1-operation -18608 # out->inouts->value->name -18609 # . eax = out->inouts -18610 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -18611 # . eax = out->inouts->value -18612 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -18613 # . eax = out->inouts->value->name -18614 (lookup *eax *(eax+4)) # Var-name Var-name => eax -18615 # . -18616 (check-strings-equal %eax "n" "F - test-parse-mu-stmt-with-comma/inout:0") -18617 # . epilogue -18618 89/<- %esp 5/r32/ebp -18619 5d/pop-to-ebp -18620 c3/return -18621 -18622 new-var: # ad: (addr allocation-descriptor), name: (handle array byte), out: (addr handle var) -18623 # . prologue -18624 55/push-ebp -18625 89/<- %ebp 4/r32/esp -18626 # . save registers -18627 50/push-eax -18628 51/push-ecx -18629 # ecx = out -18630 8b/-> *(ebp+0x14) 1/r32/ecx -18631 # -18632 (allocate *(ebp+8) *Var-size %ecx) -18633 # var out-addr/eax: (addr var) -18634 (lookup *ecx *(ecx+4)) # => eax -18635 # out-addr->name = name -18636 8b/-> *(ebp+0xc) 1/r32/ecx -18637 89/<- *eax 1/r32/ecx # Var-name -18638 8b/-> *(ebp+0x10) 1/r32/ecx -18639 89/<- *(eax+4) 1/r32/ecx # Var-name -18640 #? (write-buffered Stderr "var ") -18641 #? (lookup *(ebp+0xc) *(ebp+0x10)) -18642 #? (write-buffered Stderr %eax) -18643 #? (write-buffered Stderr " at ") -18644 #? 8b/-> *(ebp+0x14) 1/r32/ecx -18645 #? (lookup *ecx *(ecx+4)) # => eax -18646 #? (write-int32-hex-buffered Stderr %eax) -18647 #? (write-buffered Stderr Newline) -18648 #? (flush Stderr) -18649 $new-var:end: -18650 # . restore registers -18651 59/pop-to-ecx -18652 58/pop-to-eax -18653 # . epilogue -18654 89/<- %esp 5/r32/ebp -18655 5d/pop-to-ebp -18656 c3/return -18657 -18658 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) -18659 # . prologue -18660 55/push-ebp -18661 89/<- %ebp 4/r32/esp -18662 # . save registers -18663 50/push-eax -18664 51/push-ecx -18665 # if (!is-hex-int?(name)) abort -18666 (is-hex-int? *(ebp+0xc)) # => eax -18667 3d/compare-eax-and 0/imm32/false -18668 0f 84/jump-if-= $new-literal-integer:abort/disp32 -18669 # a little more error-checking -18670 (check-mu-hex-int *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) -18671 # out = new var(s) -18672 (new-var-from-slice *(ebp+8) *(ebp+0xc) *(ebp+0x10)) -18673 # var out-addr/ecx: (addr var) = lookup(*out) -18674 8b/-> *(ebp+0x10) 0/r32/eax -18675 (lookup *eax *(eax+4)) # => eax -18676 89/<- %ecx 0/r32/eax -18677 # out-addr->block-depth = *Curr-block-depth -18678 8b/-> *Curr-block-depth 0/r32/eax -18679 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth -18680 # out-addr->type = new tree() -18681 8d/copy-address *(ecx+8) 0/r32/eax # Var-type -18682 (allocate *(ebp+8) *Type-tree-size %eax) -18683 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -18684 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom -18685 # nothing else to do; default type is 'literal' -18686 $new-literal-integer:end: -18687 # . reclaim locals -18688 81 0/subop/add %esp 8/imm32 -18689 # . restore registers -18690 59/pop-to-ecx -18691 58/pop-to-eax -18692 # . epilogue -18693 89/<- %esp 5/r32/ebp -18694 5d/pop-to-ebp -18695 c3/return -18696 -18697 $new-literal-integer:abort: -18698 (write-buffered *(ebp+0x18) "fn ") -18699 8b/-> *(ebp+0x14) 0/r32/eax -18700 (lookup *eax *(eax+4)) # Function-name Function-name => eax -18701 (write-buffered *(ebp+0x18) %eax) -18702 (write-buffered *(ebp+0x18) ": variable '") -18703 (write-slice-buffered *(ebp+0x18) *(ebp+0xc)) -18704 (write-buffered *(ebp+0x18) "' cannot begin with a digit (or do you have a typo in a number?)\n") -18705 (flush *(ebp+0x18)) -18706 (stop *(ebp+0x1c) 1) -18707 # never gets here -18708 -18709 # precondition: name is a valid hex integer; require a '0x' prefix -18710 check-mu-hex-int: # name: (addr slice), err: (addr buffered-file), ed: (addr exit-descriptor) -18711 # . prologue -18712 55/push-ebp -18713 89/<- %ebp 4/r32/esp -18714 # . save registers -18715 50/push-eax -18716 51/push-ecx -18717 52/push-edx -18718 # ecx = name -18719 8b/-> *(ebp+8) 1/r32/ecx -18720 # var start/edx: (addr byte) = name->start -18721 8b/-> *ecx 2/r32/edx -18722 # if (*start == '-') ++start -18723 b8/copy-to-eax 0/imm32 -18724 8a/copy-byte *edx 0/r32/AL -18725 3d/compare-eax-and 0x2d/imm32/dash -18726 { -18727 75/jump-if-!= break/disp8 -18728 42/increment-edx -18729 } -18730 # var end/ecx: (addr byte) = name->end -18731 8b/-> *(ecx+4) 1/r32/ecx -18732 # var len/eax: int = name->end - name->start -18733 89/<- %eax 1/r32/ecx -18734 29/subtract-from %eax 2/r32/edx -18735 # if (len <= 1) return -18736 3d/compare-eax-with 1/imm32 -18737 0f 8e/jump-if-<= $check-mu-hex-int:end/disp32 -18738 $check-mu-hex-int:length->-1: -18739 # if slice-starts-with?({start, end}, "0x") return -18740 # . var tmp = {start, end} -18741 51/push-ecx -18742 52/push-edx -18743 89/<- %eax 4/r32/esp -18744 # . -18745 (slice-starts-with? %eax "0x") # => eax -18746 # . reclaim tmp -18747 81 0/subop/add %esp 8/imm32 -18748 # . -18749 3d/compare-eax-with 0/imm32/false -18750 75/jump-if-!= $check-mu-hex-int:end/disp8 -18751 $check-mu-hex-int:abort: -18752 # otherwise abort -18753 (write-buffered *(ebp+0xc) "literal integers are always hex in Mu; start '") -18754 (write-slice-buffered *(ebp+0xc) *(ebp+8)) -18755 (write-buffered *(ebp+0xc) "' with a '0x' to be unambiguous, converting it to hexadecimal as necessary.\n") -18756 (flush *(ebp+0xc)) -18757 (stop *(ebp+0x10) 1) -18758 $check-mu-hex-int:end: -18759 # . restore registers -18760 5a/pop-to-edx -18761 59/pop-to-ecx -18762 58/pop-to-eax -18763 # . epilogue -18764 89/<- %esp 5/r32/ebp -18765 5d/pop-to-ebp -18766 c3/return -18767 -18768 new-literal: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) -18769 # . prologue -18770 55/push-ebp -18771 89/<- %ebp 4/r32/esp -18772 # . save registers -18773 50/push-eax -18774 51/push-ecx -18775 # var s/ecx: (handle array byte) -18776 68/push 0/imm32 -18777 68/push 0/imm32 -18778 89/<- %ecx 4/r32/esp -18779 # s = slice-to-string(name) -18780 (slice-to-string Heap *(ebp+0xc) %ecx) -18781 # allocate to out -18782 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) -18783 # var out-addr/ecx: (addr var) = lookup(*out) -18784 8b/-> *(ebp+0x10) 1/r32/ecx -18785 (lookup *ecx *(ecx+4)) # => eax -18786 89/<- %ecx 0/r32/eax -18787 # out-addr->block-depth = *Curr-block-depth -18788 8b/-> *Curr-block-depth 0/r32/eax -18789 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth -18790 # out-addr->type/eax = new type -18791 8d/copy-address *(ecx+8) 0/r32/eax # Var-type -18792 (allocate *(ebp+8) *Type-tree-size %eax) -18793 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -18794 # nothing else to do; default type is 'literal' -18795 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom -18796 $new-literal:end: -18797 # . reclaim locals -18798 81 0/subop/add %esp 8/imm32 -18799 # . restore registers -18800 59/pop-to-ecx -18801 58/pop-to-eax -18802 # . epilogue -18803 89/<- %esp 5/r32/ebp -18804 5d/pop-to-ebp -18805 c3/return -18806 -18807 new-literal-string: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) -18808 # . prologue -18809 55/push-ebp -18810 89/<- %ebp 4/r32/esp -18811 # . save registers -18812 50/push-eax -18813 51/push-ecx -18814 # var s/ecx: (handle array byte) -18815 68/push 0/imm32 -18816 68/push 0/imm32 -18817 89/<- %ecx 4/r32/esp -18818 # s = slice-to-string(name) -18819 (slice-to-string Heap *(ebp+0xc) %ecx) -18820 # allocate to out -18821 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) -18822 # var out-addr/ecx: (addr var) = lookup(*out) -18823 8b/-> *(ebp+0x10) 1/r32/ecx -18824 (lookup *ecx *(ecx+4)) # => eax -18825 89/<- %ecx 0/r32/eax -18826 # out-addr->block-depth = *Curr-block-depth -18827 8b/-> *Curr-block-depth 0/r32/eax -18828 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth -18829 # out-addr->type/eax = new type -18830 8d/copy-address *(ecx+8) 0/r32/eax # Var-type -18831 (allocate *(ebp+8) *Type-tree-size %eax) -18832 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -18833 # out-addr->type->value = literal-string -18834 c7 0/subop/copy *(eax+4) 0x10/imm32/type-id-string-literal # Type-tree-value -18835 # out-addr->type->is-atom? = true -18836 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom -18837 $new-literal-string:end: -18838 # . reclaim locals -18839 81 0/subop/add %esp 8/imm32 -18840 # . restore registers -18841 59/pop-to-ecx -18842 58/pop-to-eax -18843 # . epilogue -18844 89/<- %esp 5/r32/ebp -18845 5d/pop-to-ebp -18846 c3/return -18847 -18848 new-var-from-slice: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) -18849 # . prologue -18850 55/push-ebp -18851 89/<- %ebp 4/r32/esp -18852 # . save registers -18853 51/push-ecx -18854 # var tmp/ecx: (handle array byte) -18855 68/push 0/imm32 -18856 68/push 0/imm32 -18857 89/<- %ecx 4/r32/esp -18858 # tmp = slice-to-string(name) -18859 (slice-to-string Heap *(ebp+0xc) %ecx) -18860 # out = new-var(tmp) -18861 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) -18862 $new-var-from-slice:end: -18863 # . reclaim locals -18864 81 0/subop/add %esp 8/imm32 -18865 # . restore registers -18866 59/pop-to-ecx -18867 # . epilogue -18868 89/<- %esp 5/r32/ebp -18869 5d/pop-to-ebp -18870 c3/return -18871 -18872 new-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) -18873 # . prologue -18874 55/push-ebp -18875 89/<- %ebp 4/r32/esp -18876 # . save registers -18877 50/push-eax -18878 51/push-ecx -18879 # -18880 (allocate *(ebp+8) *Stmt-size *(ebp+0x14)) -18881 # var out-addr/eax: (addr stmt) = lookup(*out) -18882 8b/-> *(ebp+0x14) 0/r32/eax -18883 (lookup *eax *(eax+4)) # => eax -18884 # out-addr->tag = stmt -18885 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack # Stmt-tag -18886 # result->var = var -18887 8b/-> *(ebp+0xc) 1/r32/ecx -18888 89/<- *(eax+4) 1/r32/ecx # Vardef-var -18889 8b/-> *(ebp+0x10) 1/r32/ecx -18890 89/<- *(eax+8) 1/r32/ecx # Vardef-var -18891 $new-var-def:end: -18892 # . restore registers -18893 59/pop-to-ecx -18894 58/pop-to-eax -18895 # . epilogue -18896 89/<- %esp 5/r32/ebp -18897 5d/pop-to-ebp -18898 c3/return -18899 -18900 new-reg-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) -18901 # . prologue -18902 55/push-ebp -18903 89/<- %ebp 4/r32/esp -18904 # . save registers -18905 50/push-eax -18906 # eax = out -18907 8b/-> *(ebp+0x14) 0/r32/eax -18908 # -18909 (allocate *(ebp+8) *Stmt-size %eax) -18910 # var out-addr/eax: (addr stmt) = lookup(*out) -18911 (lookup *eax *(eax+4)) # => eax -18912 # set tag -18913 c7 0/subop/copy *eax 3/imm32/tag/var-in-register # Stmt-tag -18914 # set output -18915 8d/copy-address *(eax+0x14) 0/r32/eax # Regvardef-outputs -18916 (append-stmt-var Heap *(ebp+0xc) *(ebp+0x10) 0 0 0 %eax) -18917 $new-reg-var-def:end: -18918 # . restore registers -18919 58/pop-to-eax -18920 # . epilogue -18921 89/<- %esp 5/r32/ebp -18922 5d/pop-to-ebp -18923 c3/return -18924 -18925 append-list: # ad: (addr allocation-descriptor), value: (handle _type), list: (handle list _type), out: (addr handle list _type) -18926 # . prologue -18927 55/push-ebp -18928 89/<- %ebp 4/r32/esp -18929 # . save registers -18930 50/push-eax -18931 51/push-ecx -18932 57/push-edi -18933 # edi = out -18934 8b/-> *(ebp+0x1c) 7/r32/edi -18935 # *out = new list -18936 (allocate *(ebp+8) *List-size %edi) -18937 # var out-addr/edi: (addr list _type) = lookup(*out) -18938 (lookup *edi *(edi+4)) # => eax -18939 89/<- %edi 0/r32/eax -18940 # out-addr->value = value -18941 8b/-> *(ebp+0xc) 0/r32/eax -18942 89/<- *edi 0/r32/eax # List-value -18943 8b/-> *(ebp+0x10) 0/r32/eax -18944 89/<- *(edi+4) 0/r32/eax # List-value -18945 # if (list == null) return -18946 81 7/subop/compare *(ebp+0x14) 0/imm32 -18947 74/jump-if-= $append-list:end/disp8 -18948 # otherwise append -18949 $append-list:non-empty-list: -18950 # var curr/eax: (addr list _type) = lookup(list) -18951 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax -18952 # while (curr->next != null) curr = curr->next -18953 { -18954 81 7/subop/compare *(eax+8) 0/imm32 # List-next -18955 74/jump-if-= break/disp8 -18956 # curr = lookup(curr->next) -18957 (lookup *(eax+8) *(eax+0xc)) # List-next, List-next => eax -18958 # -18959 eb/jump loop/disp8 -18960 } -18961 # edi = out -18962 8b/-> *(ebp+0x1c) 7/r32/edi -18963 # curr->next = out -18964 8b/-> *edi 1/r32/ecx -18965 89/<- *(eax+8) 1/r32/ecx # List-next -18966 8b/-> *(edi+4) 1/r32/ecx -18967 89/<- *(eax+0xc) 1/r32/ecx # List-next -18968 # out = list -18969 8b/-> *(ebp+0x14) 1/r32/ecx -18970 89/<- *edi 1/r32/ecx -18971 8b/-> *(ebp+0x18) 1/r32/ecx -18972 89/<- *(edi+4) 1/r32/ecx -18973 $append-list:end: -18974 # . restore registers -18975 5f/pop-to-edi -18976 59/pop-to-ecx -18977 58/pop-to-eax -18978 # . epilogue -18979 89/<- %esp 5/r32/ebp -18980 5d/pop-to-ebp -18981 c3/return -18982 -18983 append-stmt-var: # ad: (addr allocation-descriptor), v: (handle var), vars: (handle stmt-var), is-deref?: boolean, out: (addr handle stmt-var) -18984 # . prologue -18985 55/push-ebp -18986 89/<- %ebp 4/r32/esp -18987 # . save registers -18988 50/push-eax -18989 51/push-ecx -18990 57/push-edi -18991 # edi = out -18992 8b/-> *(ebp+0x20) 7/r32/edi -18993 # out = new stmt-var -18994 (allocate *(ebp+8) *Stmt-var-size %edi) -18995 # var out-addr/ecx: (addr stmt-var) = lookup(*out) -18996 (lookup *edi *(edi+4)) # => eax -18997 89/<- %ecx 0/r32/eax -18998 # out-addr->value = v -18999 8b/-> *(ebp+0xc) 0/r32/eax -19000 89/<- *ecx 0/r32/eax # Stmt-var-value -19001 8b/-> *(ebp+0x10) 0/r32/eax -19002 89/<- *(ecx+4) 0/r32/eax # Stmt-var-value -19003 # out-addr->is-deref? = is-deref? -19004 8b/-> *(ebp+0x1c) 0/r32/eax -19005 89/<- *(ecx+0x10) 0/r32/eax # Stmt-var-is-deref -19006 # if (vars == null) return result -19007 81 7/subop/compare *(ebp+0x14) 0/imm32/null -19008 74/jump-if-= $append-stmt-var:end/disp8 -19009 # otherwise append -19010 # var curr/eax: (addr stmt-var) = lookup(vars) -19011 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax -19012 # while (curr->next != null) curr = curr->next -19013 { -19014 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next -19015 74/jump-if-= break/disp8 -19016 # curr = lookup(curr->next) -19017 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next, Stmt-var-next => eax -19018 # -19019 eb/jump loop/disp8 -19020 } -19021 # curr->next = out -19022 8b/-> *edi 1/r32/ecx -19023 89/<- *(eax+8) 1/r32/ecx # Stmt-var-next -19024 8b/-> *(edi+4) 1/r32/ecx -19025 89/<- *(eax+0xc) 1/r32/ecx # Stmt-var-next -19026 # out = vars -19027 8b/-> *(ebp+0x14) 1/r32/ecx -19028 89/<- *edi 1/r32/ecx -19029 8b/-> *(ebp+0x18) 1/r32/ecx -19030 89/<- *(edi+4) 1/r32/ecx -19031 $append-stmt-var:end: -19032 # . restore registers -19033 5f/pop-to-edi -19034 59/pop-to-ecx -19035 58/pop-to-eax -19036 # . epilogue -19037 89/<- %esp 5/r32/ebp -19038 5d/pop-to-ebp -19039 c3/return -19040 -19041 append-to-block: # ad: (addr allocation-descriptor), block: (addr block), x: (handle stmt) -19042 # . prologue -19043 55/push-ebp -19044 89/<- %ebp 4/r32/esp -19045 # . save registers -19046 50/push-eax -19047 56/push-esi -19048 # esi = block -19049 8b/-> *(ebp+0xc) 6/r32/esi -19050 # block->stmts = append(x, block->stmts) -19051 8d/copy-address *(esi+4) 0/r32/eax # Block-stmts -19052 (append-list *(ebp+8) *(ebp+0x10) *(ebp+0x14) *(esi+4) *(esi+8) %eax) # ad, x, x, Block-stmts, Block-stmts -19053 $append-to-block:end: -19054 # . restore registers -19055 5e/pop-to-esi -19056 58/pop-to-eax -19057 # . epilogue -19058 89/<- %esp 5/r32/ebp -19059 5d/pop-to-ebp -19060 c3/return -19061 -19062 ## Parsing types -19063 # We need to create metadata on user-defined types, and we need to use this -19064 # metadata as we parse instructions. -19065 # However, we also want to allow types to be used before their definitions. -19066 # This means we can't ever assume any type data structures exist. -19067 -19068 lookup-or-create-constant: # container: (addr stmt-var), field-name: (addr slice), out: (addr handle var) -19069 # . prologue -19070 55/push-ebp -19071 89/<- %ebp 4/r32/esp -19072 # . save registers -19073 50/push-eax -19074 56/push-esi -19075 # var container-type/esi: type-id -19076 (container-type *(ebp+8)) # => eax -19077 89/<- %esi 0/r32/eax -19078 # var tmp/eax: (handle typeinfo) = find-or-create-typeinfo(container-type) -19079 68/push 0/imm32 -19080 68/push 0/imm32 -19081 89/<- %eax 4/r32/esp -19082 (find-or-create-typeinfo %esi %eax) -19083 # var tmp-addr/eax: (addr typeinfo) = lookup(tmp) -19084 (lookup *eax *(eax+4)) # => eax -19085 # result = find-or-create-typeinfo-output-var(typeinfo, field-name) -19086 #? (write-buffered Stderr "constant: ") -19087 #? (write-slice-buffered Stderr *(ebp+0xc)) -19088 #? (write-buffered Stderr Newline) -19089 #? (flush Stderr) -19090 (find-or-create-typeinfo-output-var %eax *(ebp+0xc) *(ebp+0x10)) -19091 #? 8b/-> *(ebp+0x10) 0/r32/eax -19092 #? (write-buffered Stderr "@") -19093 #? (lookup *eax *(eax+4)) -19094 #? (write-int32-hex-buffered Stderr %eax) -19095 #? (lookup *eax *(eax+4)) -19096 #? (write-buffered Stderr %eax) -19097 #? (write-buffered Stderr Newline) -19098 #? (flush Stderr) -19099 #? (write-buffered Stderr "offset: ") -19100 #? 8b/-> *(eax+0x14) 0/r32/eax -19101 #? (write-int32-hex-buffered Stderr %eax) -19102 #? (write-buffered Stderr Newline) -19103 #? (flush Stderr) -19104 $lookup-or-create-constant:end: -19105 # . reclaim locals -19106 81 0/subop/add %esp 8/imm32 -19107 # . restore registers -19108 5e/pop-to-esi -19109 58/pop-to-eax -19110 # . epilogue -19111 89/<- %esp 5/r32/ebp -19112 5d/pop-to-ebp -19113 c3/return -19114 -19115 # if addr var: -19116 # container->var->type->right->left->value -19117 # otherwise -19118 # container->var->type->value -19119 container-type: # container: (addr stmt-var) -> result/eax: type-id -19120 # . prologue -19121 55/push-ebp -19122 89/<- %ebp 4/r32/esp -19123 # -19124 8b/-> *(ebp+8) 0/r32/eax -19125 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -19126 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19127 { -19128 81 7/subop/compare *(eax+8) 0/imm32 # Type-tree-right -19129 74/jump-if-= break/disp8 -19130 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -19131 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -19132 } -19133 8b/-> *(eax+4) 0/r32/eax # Type-tree-value -19134 $container-type:end: -19135 # . epilogue -19136 89/<- %esp 5/r32/ebp -19137 5d/pop-to-ebp -19138 c3/return -19139 -19140 is-container?: # t: type-id -> result/eax: boolean -19141 # . prologue -19142 55/push-ebp -19143 89/<- %ebp 4/r32/esp -19144 # -19145 8b/-> *(ebp+8) 0/r32/eax -19146 c1/shift 4/subop/left %eax 2/imm8 -19147 3b/compare 0/r32/eax *Primitive-type-ids -19148 0f 9d/set-if->= %al -19149 81 4/subop/and %eax 0xff/imm32 -19150 $is-container?:end: -19151 # . epilogue -19152 89/<- %esp 5/r32/ebp -19153 5d/pop-to-ebp -19154 c3/return -19155 -19156 find-or-create-typeinfo: # t: type-id, out: (addr handle typeinfo) -19157 # . prologue -19158 55/push-ebp -19159 89/<- %ebp 4/r32/esp -19160 # . save registers -19161 50/push-eax -19162 51/push-ecx -19163 52/push-edx -19164 57/push-edi -19165 # edi = out -19166 8b/-> *(ebp+0xc) 7/r32/edi -19167 # var fields/ecx: (handle table (handle array byte) (handle typeinfo-entry)) -19168 68/push 0/imm32 -19169 68/push 0/imm32 -19170 89/<- %ecx 4/r32/esp -19171 # find-typeinfo(t, out) -19172 (find-typeinfo *(ebp+8) %edi) -19173 { -19174 # if (*out != 0) break -19175 81 7/subop/compare *edi 0/imm32 -19176 0f 85/jump-if-!= break/disp32 -19177 $find-or-create-typeinfo:create: -19178 # *out = allocate -19179 (allocate Heap *Typeinfo-size %edi) -19180 # var tmp/eax: (addr typeinfo) = lookup(*out) -19181 (lookup *edi *(edi+4)) # => eax -19182 #? (write-buffered Stderr "created typeinfo at ") -19183 #? (write-int32-hex-buffered Stderr %eax) -19184 #? (write-buffered Stderr " for type-id ") -19185 #? (write-int32-hex-buffered Stderr *(ebp+8)) -19186 #? (write-buffered Stderr Newline) -19187 #? (flush Stderr) -19188 # tmp->id = t -19189 8b/-> *(ebp+8) 2/r32/edx -19190 89/<- *eax 2/r32/edx # Typeinfo-id -19191 # tmp->fields = new table -19192 # . fields = new table -19193 (new-stream Heap 0x40 *Typeinfo-fields-row-size %ecx) -19194 # . tmp->fields = fields -19195 8b/-> *ecx 2/r32/edx -19196 89/<- *(eax+4) 2/r32/edx # Typeinfo-fields -19197 8b/-> *(ecx+4) 2/r32/edx -19198 89/<- *(eax+8) 2/r32/edx # Typeinfo-fields -19199 # tmp->next = Program->types -19200 8b/-> *_Program-types 1/r32/ecx -19201 89/<- *(eax+0x10) 1/r32/ecx # Typeinfo-next -19202 8b/-> *_Program-types->payload 1/r32/ecx -19203 89/<- *(eax+0x14) 1/r32/ecx # Typeinfo-next -19204 # Program->types = out -19205 8b/-> *edi 1/r32/ecx -19206 89/<- *_Program-types 1/r32/ecx -19207 8b/-> *(edi+4) 1/r32/ecx -19208 89/<- *_Program-types->payload 1/r32/ecx -19209 } -19210 $find-or-create-typeinfo:end: -19211 # . reclaim locals -19212 81 0/subop/add %esp 8/imm32 -19213 # . restore registers -19214 5f/pop-to-edi -19215 5a/pop-to-edx -19216 59/pop-to-ecx -19217 58/pop-to-eax -19218 # . epilogue -19219 89/<- %esp 5/r32/ebp -19220 5d/pop-to-ebp -19221 c3/return -19222 -19223 find-typeinfo: # t: type-id, out: (addr handle typeinfo) -19224 # . prologue -19225 55/push-ebp -19226 89/<- %ebp 4/r32/esp -19227 # . save registers -19228 50/push-eax -19229 51/push-ecx -19230 52/push-edx -19231 57/push-edi -19232 # ecx = t -19233 8b/-> *(ebp+8) 1/r32/ecx -19234 # edi = out -19235 8b/-> *(ebp+0xc) 7/r32/edi -19236 # *out = Program->types -19237 8b/-> *_Program-types 0/r32/eax -19238 89/<- *edi 0/r32/eax -19239 8b/-> *_Program-types->payload 0/r32/eax -19240 89/<- *(edi+4) 0/r32/eax -19241 { -19242 $find-typeinfo:loop: -19243 # if (*out == 0) break -19244 81 7/subop/compare *edi 0/imm32 -19245 74/jump-if-= break/disp8 -19246 $find-typeinfo:check: -19247 # var tmp/eax: (addr typeinfo) = lookup(*out) -19248 (lookup *edi *(edi+4)) # => eax -19249 # if (tmp->id == t) break -19250 39/compare *eax 1/r32/ecx # Typeinfo-id -19251 74/jump-if-= break/disp8 -19252 $find-typeinfo:continue: -19253 # *out = tmp->next -19254 8b/-> *(eax+0x10) 2/r32/edx # Typeinfo-next -19255 89/<- *edi 2/r32/edx -19256 8b/-> *(eax+0x14) 2/r32/edx # Typeinfo-next -19257 89/<- *(edi+4) 2/r32/edx -19258 # -19259 eb/jump loop/disp8 -19260 } -19261 $find-typeinfo:end: -19262 # . restore registers -19263 5f/pop-to-edi -19264 5a/pop-to-edx -19265 59/pop-to-ecx -19266 58/pop-to-eax -19267 # . epilogue -19268 89/<- %esp 5/r32/ebp -19269 5d/pop-to-ebp -19270 c3/return -19271 -19272 find-or-create-typeinfo-output-var: # T: (addr typeinfo), f: (addr slice), out: (addr handle var) -19273 # . prologue -19274 55/push-ebp -19275 89/<- %ebp 4/r32/esp -19276 # . save registers -19277 50/push-eax -19278 52/push-edx -19279 57/push-edi -19280 # var dest/edi: (handle typeinfo-entry) -19281 68/push 0/imm32 -19282 68/push 0/imm32 -19283 89/<- %edi 4/r32/esp -19284 # find-or-create-typeinfo-fields(T, f, dest) -19285 (find-or-create-typeinfo-fields *(ebp+8) *(ebp+0xc) %edi) -19286 # var dest-addr/edi: (addr typeinfo-entry) = lookup(dest) -19287 (lookup *edi *(edi+4)) # => eax -19288 89/<- %edi 0/r32/eax -19289 # if dest-addr->output-var doesn't exist, create it -19290 { -19291 81 7/subop/compare *(edi+0xc) 0/imm32 # Typeinfo-entry-output-var -19292 0f 85/jump-if-!= break/disp32 -19293 # dest-addr->output-var = new var(dummy name, type, -1 offset) -19294 # . var name/eax: (handle array byte) = "field" -19295 68/push 0/imm32 -19296 68/push 0/imm32 -19297 89/<- %eax 4/r32/esp -19298 (slice-to-string Heap *(ebp+0xc) %eax) -19299 # . new var -19300 8d/copy-address *(edi+0xc) 2/r32/edx -19301 (new-var Heap *eax *(eax+4) %edx) -19302 # . reclaim name -19303 81 0/subop/add %esp 8/imm32 -19304 # var result/edx: (addr var) = lookup(dest-addr->output-var) -19305 (lookup *(edi+0xc) *(edi+0x10)) # => eax -19306 89/<- %edx 0/r32/eax -19307 # result->type = new constant type -19308 8d/copy-address *(edx+8) 0/r32/eax # Var-type -19309 (allocate Heap *Type-tree-size %eax) -19310 (lookup *(edx+8) *(edx+0xc)) # => eax -19311 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom -19312 c7 0/subop/copy *(eax+4) 6/imm32/constant # Type-tree-value -19313 c7 0/subop/copy *(eax+8) 0/imm32 # Type-tree-left -19314 c7 0/subop/copy *(eax+0xc) 0/imm32 # Type-tree-right -19315 c7 0/subop/copy *(eax+0x10) 0/imm32 # Type-tree-right -19316 # result->offset isn't filled out yet -19317 c7 0/subop/copy *(edx+0x14) -1/imm32/uninitialized # Var-offset -19318 } -19319 # out = dest-addr->output-var -19320 8b/-> *(ebp+0x10) 2/r32/edx -19321 8b/-> *(edi+0xc) 0/r32/eax # Typeinfo-entry-output-var -19322 89/<- *edx 0/r32/eax -19323 8b/-> *(edi+0x10) 0/r32/eax # Typeinfo-entry-output-var -19324 89/<- *(edx+4) 0/r32/eax -19325 $find-or-create-typeinfo-output-var:end: -19326 # . reclaim locals -19327 81 0/subop/add %esp 8/imm32 -19328 # . restore registers -19329 5f/pop-to-edi -19330 5a/pop-to-edx +18582 68/push 0/imm32 +18583 89/<- %ebx 4/r32/esp +18584 # +18585 (allocate Heap *Stmt-size *(ebp+0x14)) +18586 # var out-addr/edi: (addr stmt) = lookup(*out) +18587 8b/-> *(ebp+0x14) 7/r32/edi +18588 (lookup *edi *(edi+4)) # => eax +18589 89/<- %edi 0/r32/eax +18590 # out-addr->tag = 1/stmt +18591 c7 0/subop/copy *edi 1/imm32/stmt1 # Stmt-tag +18592 { +18593 (stmt-has-outputs? *(ebp+8)) +18594 3d/compare-eax-and 0/imm32/false +18595 0f 84/jump-if-= break/disp32 +18596 { +18597 $parse-mu-stmt:read-outputs: +18598 # name = next-mu-token(line) +18599 (next-mu-token *(ebp+8) %ecx) +18600 # if slice-empty?(word-slice) break +18601 (slice-empty? %ecx) # => eax +18602 3d/compare-eax-and 0/imm32/false +18603 0f 85/jump-if-!= break/disp32 +18604 # if (name == "<-") break +18605 (slice-equal? %ecx "<-") # => eax +18606 3d/compare-eax-and 0/imm32/false +18607 0f 85/jump-if-!= break/disp32 +18608 # if slice-starts-with?(name, "*") abort +18609 8b/-> *ecx 0/r32/eax # Slice-start +18610 8a/copy-byte *eax 0/r32/AL +18611 81 4/subop/and %eax 0xff/imm32 +18612 3d/compare-eax-and 0x2a/imm32/asterisk +18613 0f 84/jump-if-= $parse-mu-stmt:error-output-dereferenced/disp32 +18614 # assert(is-identifier?(name)) +18615 (is-identifier? %ecx) # => eax +18616 3d/compare-eax-and 0/imm32/false +18617 0f 84/jump-if-= $parse-mu-stmt:abort/disp32 +18618 # +18619 (lookup-var %ecx *(ebp+0xc) %ebx *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) +18620 8d/copy-address *(edi+0x14) 0/r32/eax # Stmt1-outputs +18621 (append-stmt-var Heap *ebx *(ebx+4) *(edi+0x14) *(edi+0x18) 0 %eax) # Stmt1-outputs +18622 # +18623 e9/jump loop/disp32 +18624 } +18625 } +18626 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) +18627 $parse-mu-stmt:end: +18628 # . reclaim locals +18629 81 0/subop/add %esp 0x10/imm32 +18630 # . restore registers +18631 5f/pop-to-edi +18632 5b/pop-to-ebx +18633 5a/pop-to-edx +18634 59/pop-to-ecx +18635 58/pop-to-eax +18636 # . epilogue +18637 89/<- %esp 5/r32/ebp +18638 5d/pop-to-ebp +18639 c3/return +18640 +18641 $parse-mu-stmt:abort: +18642 # error("invalid identifier '" name "'\n") +18643 (write-buffered *(ebp+0x18) "fn ") +18644 8b/-> *(ebp+0x10) 0/r32/eax +18645 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18646 (write-buffered *(ebp+0x18) %eax) +18647 (write-buffered *(ebp+0x18) ": invalid identifier '") +18648 (write-slice-buffered *(ebp+0x18) %ecx) +18649 (write-buffered *(ebp+0x18) "'\n") +18650 (flush *(ebp+0x18)) +18651 (stop *(ebp+0x1c) 1) +18652 # never gets here +18653 +18654 $parse-mu-stmt:error-output-dereferenced: +18655 # error("invalid identifier '" name "'\n") +18656 (write-buffered *(ebp+0x18) "fn ") +18657 8b/-> *(ebp+0x10) 0/r32/eax +18658 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18659 (write-buffered *(ebp+0x18) %eax) +18660 (write-buffered *(ebp+0x18) ": output '") +18661 (write-slice-buffered *(ebp+0x18) %ecx) +18662 (write-buffered *(ebp+0x18) "' should write to a register, and therefore cannot be dereferenced\n") +18663 (flush *(ebp+0x18)) +18664 (stop *(ebp+0x1c) 1) +18665 # never gets here +18666 +18667 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) +18668 # pseudocode: +18669 # stmt->name = slice-to-string(next-mu-token(line)) +18670 # while true +18671 # name = next-mu-token(line) +18672 # v = lookup-var-or-literal(name) +18673 # stmt->inouts = append(v, stmt->inouts) +18674 # +18675 # . prologue +18676 55/push-ebp +18677 89/<- %ebp 4/r32/esp +18678 # . save registers +18679 50/push-eax +18680 51/push-ecx +18681 52/push-edx +18682 53/push-ebx +18683 56/push-esi +18684 57/push-edi +18685 # edi = stmt +18686 8b/-> *(ebp+8) 7/r32/edi +18687 # var name/ecx: slice +18688 68/push 0/imm32/end +18689 68/push 0/imm32/start +18690 89/<- %ecx 4/r32/esp +18691 # var is-deref?/edx: boolean = false +18692 ba/copy-to-edx 0/imm32/false +18693 # var v/esi: (handle var) +18694 68/push 0/imm32 +18695 68/push 0/imm32 +18696 89/<- %esi 4/r32/esp +18697 $add-operation-and-inputs-to-stmt:read-operation: +18698 (next-mu-token *(ebp+0xc) %ecx) +18699 8d/copy-address *(edi+4) 0/r32/eax # Stmt1-operation or Regvardef-operationStmt1-operation or Regvardef-operation +18700 (slice-to-string Heap %ecx %eax) +18701 # var is-get?/ebx: boolean = (name == "get") +18702 (slice-equal? %ecx "get") # => eax +18703 89/<- %ebx 0/r32/eax +18704 { +18705 $add-operation-and-inputs-to-stmt:read-inouts: +18706 # name = next-mu-token(line) +18707 (next-mu-token *(ebp+0xc) %ecx) +18708 # if slice-empty?(word-slice) break +18709 (slice-empty? %ecx) # => eax +18710 3d/compare-eax-and 0/imm32/false +18711 0f 85/jump-if-!= break/disp32 +18712 # if (name == "<-") abort +18713 (slice-equal? %ecx "<-") +18714 3d/compare-eax-and 0/imm32/false +18715 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32 +18716 # if (is-get? && second operand) lookup or create offset +18717 { +18718 81 7/subop/compare %ebx 0/imm32/false +18719 74/jump-if-= break/disp8 +18720 (lookup *(edi+0xc) *(edi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +18721 3d/compare-eax-and 0/imm32 +18722 74/jump-if-= break/disp8 +18723 (lookup-or-create-constant %eax %ecx %esi) +18724 #? (lookup *esi *(esi+4)) +18725 #? (write-buffered Stderr "creating new output var ") +18726 #? (write-int32-hex-buffered Stderr %eax) +18727 #? (write-buffered Stderr " for field called ") +18728 #? (write-slice-buffered Stderr %ecx) +18729 #? (write-buffered Stderr "; var name ") +18730 #? (lookup *eax *(eax+4)) # Var-name +18731 #? (write-buffered Stderr %eax) +18732 #? (write-buffered Stderr Newline) +18733 #? (flush Stderr) +18734 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32 +18735 } +18736 # is-deref? = false +18737 ba/copy-to-edx 0/imm32/false +18738 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? +18739 8b/-> *ecx 0/r32/eax # Slice-start +18740 8a/copy-byte *eax 0/r32/AL +18741 81 4/subop/and %eax 0xff/imm32 +18742 3d/compare-eax-and 0x2a/imm32/asterisk +18743 { +18744 75/jump-if-!= break/disp8 +18745 $add-operation-and-inputs-to-stmt:inout-is-deref: +18746 ff 0/subop/increment *ecx +18747 ba/copy-to-edx 1/imm32/true +18748 } +18749 (lookup-var-or-literal %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +18750 # if (is-deref?) some additional checks +18751 81 7/subop/compare %edx 0/imm32/false +18752 { +18753 74/jump-if-= break/disp8 +18754 # if var is not in register, abort +18755 (lookup *esi *(esi+4)) # => eax +18756 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +18757 0f 84/jump-if-= $add-operation-and-inputs-to-stmt:error-deref-on-stack/disp32 +18758 # if var is not an address, abort +18759 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +18760 (is-mu-addr-type? %eax) # => eax +18761 3d/compare-eax-and 0/imm32/false +18762 0f 84/jump-if-= $add-operation-and-inputs-to-stmt:error-deref-non-addr/disp32 +18763 } +18764 $add-operation-and-inputs-to-stmt:save-var: +18765 8d/copy-address *(edi+0xc) 0/r32/eax +18766 (append-stmt-var Heap *esi *(esi+4) *(edi+0xc) *(edi+0x10) %edx %eax) # Stmt1-inouts or Regvardef-inouts +18767 # +18768 e9/jump loop/disp32 +18769 } +18770 $add-operation-and-inputs-to-stmt:end: +18771 # . reclaim locals +18772 81 0/subop/add %esp 0x10/imm32 +18773 # . restore registers +18774 5f/pop-to-edi +18775 5e/pop-to-esi +18776 5b/pop-to-ebx +18777 5a/pop-to-edx +18778 59/pop-to-ecx +18779 58/pop-to-eax +18780 # . epilogue +18781 89/<- %esp 5/r32/ebp +18782 5d/pop-to-ebp +18783 c3/return +18784 +18785 $add-operation-and-inputs-to-stmt:abort: +18786 # error("fn ___: invalid identifier in '" line "'\n") +18787 (write-buffered *(ebp+0x18) "fn ") +18788 8b/-> *(ebp+0x14) 0/r32/eax +18789 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18790 (write-buffered *(ebp+0x18) %eax) +18791 (rewind-stream *(ebp+0xc)) +18792 (write-buffered *(ebp+0x18) ": invalid identifier in '") +18793 (write-stream-data *(ebp+0x18) *(ebp+0xc)) +18794 (write-buffered *(ebp+0x18) "'\n") +18795 (flush *(ebp+0x18)) +18796 (stop *(ebp+0x1c) 1) +18797 # never gets here +18798 +18799 $add-operation-and-inputs-to-stmt:error-deref-on-stack: +18800 # error("fn ___: cannot dereference var ___ on stack\n") +18801 (write-buffered *(ebp+0x18) "fn ") +18802 8b/-> *(ebp+0x14) 0/r32/eax +18803 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18804 (write-buffered *(ebp+0x18) %eax) +18805 (rewind-stream *(ebp+0xc)) +18806 (write-buffered *(ebp+0x18) ": cannot dereference var '") +18807 (lookup *esi *(esi+4)) # => eax +18808 (lookup *eax *(eax+4)) # Var-name Var-name => eax +18809 (write-buffered *(ebp+0x18) %eax) +18810 (write-buffered *(ebp+0x18) "' on stack\n") +18811 (flush *(ebp+0x18)) +18812 (stop *(ebp+0x1c) 1) +18813 # never gets here +18814 +18815 $add-operation-and-inputs-to-stmt:error-deref-non-addr: +18816 # error("fn ___: cannot dereference non-addr var ___\n") +18817 (write-buffered *(ebp+0x18) "fn ") +18818 8b/-> *(ebp+0x14) 0/r32/eax +18819 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18820 (write-buffered *(ebp+0x18) %eax) +18821 (rewind-stream *(ebp+0xc)) +18822 (write-buffered *(ebp+0x18) ": cannot dereference non-addr var '") +18823 (lookup *esi *(esi+4)) # => eax +18824 (lookup *eax *(eax+4)) # Var-name Var-name => eax +18825 (write-buffered *(ebp+0x18) %eax) +18826 (write-buffered *(ebp+0x18) "'\n") +18827 (flush *(ebp+0x18)) +18828 (stop *(ebp+0x1c) 1) +18829 # never gets here +18830 +18831 stmt-has-outputs?: # line: (addr stream byte) -> result/eax: boolean +18832 # . prologue +18833 55/push-ebp +18834 89/<- %ebp 4/r32/esp +18835 # . save registers +18836 51/push-ecx +18837 # var word-slice/ecx: slice +18838 68/push 0/imm32/end +18839 68/push 0/imm32/start +18840 89/<- %ecx 4/r32/esp +18841 # result = false +18842 b8/copy-to-eax 0/imm32/false +18843 (rewind-stream *(ebp+8)) +18844 { +18845 (next-mu-token *(ebp+8) %ecx) +18846 # if slice-empty?(word-slice) break +18847 (slice-empty? %ecx) +18848 3d/compare-eax-and 0/imm32/false +18849 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) +18850 0f 85/jump-if-!= break/disp32 +18851 # if slice-starts-with?(word-slice, '#') break +18852 # . eax = *word-slice->start +18853 8b/-> *ecx 0/r32/eax +18854 8a/copy-byte *eax 0/r32/AL +18855 81 4/subop/and %eax 0xff/imm32 +18856 # . if (eax == '#') break +18857 3d/compare-eax-and 0x23/imm32/hash +18858 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) +18859 0f 84/jump-if-= break/disp32 +18860 # if slice-equal?(word-slice, '<-') return true +18861 (slice-equal? %ecx "<-") +18862 3d/compare-eax-and 0/imm32/false +18863 74/jump-if-= loop/disp8 +18864 b8/copy-to-eax 1/imm32/true +18865 } +18866 $stmt-has-outputs:end: +18867 (rewind-stream *(ebp+8)) +18868 # . reclaim locals +18869 81 0/subop/add %esp 8/imm32 +18870 # . restore registers +18871 59/pop-to-ecx +18872 # . epilogue +18873 89/<- %esp 5/r32/ebp +18874 5d/pop-to-ebp +18875 c3/return +18876 +18877 # if 'name' starts with a digit, create a new literal var for it +18878 # otherwise return first 'name' from the top (back) of 'vars' and abort if not found +18879 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) +18880 # . prologue +18881 55/push-ebp +18882 89/<- %ebp 4/r32/esp +18883 # . save registers +18884 50/push-eax +18885 51/push-ecx +18886 56/push-esi +18887 # esi = name +18888 8b/-> *(ebp+8) 6/r32/esi +18889 # if slice-empty?(name) abort +18890 (slice-empty? %esi) # => eax +18891 3d/compare-eax-and 0/imm32/false +18892 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32 +18893 # var c/ecx: byte = *name->start +18894 8b/-> *esi 1/r32/ecx +18895 8a/copy-byte *ecx 1/r32/CL +18896 81 4/subop/and %ecx 0xff/imm32 +18897 # if (is-decimal-digit?(c) || c == '-') return new var(name) +18898 { +18899 81 7/subop/compare %ecx 0x2d/imm32/dash +18900 74/jump-if-= $lookup-var-or-literal:literal/disp8 +18901 (is-decimal-digit? %ecx) # => eax +18902 3d/compare-eax-and 0/imm32/false +18903 74/jump-if-= break/disp8 +18904 $lookup-var-or-literal:literal: +18905 (new-literal-integer Heap %esi *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +18906 eb/jump $lookup-var-or-literal:end/disp8 +18907 } +18908 # else if (c == '"') return new var(name) +18909 { +18910 81 7/subop/compare %ecx 0x22/imm32/dquote +18911 75/jump-if-!= break/disp8 +18912 $lookup-var-or-literal:literal-string: +18913 (new-literal-string Heap %esi *(ebp+0x10)) +18914 eb/jump $lookup-var-or-literal:end/disp8 +18915 } +18916 # otherwise return lookup-var(name, vars) +18917 { +18918 $lookup-var-or-literal:var: +18919 (lookup-var %esi *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +18920 } +18921 $lookup-var-or-literal:end: +18922 # . restore registers +18923 5e/pop-to-esi +18924 59/pop-to-ecx +18925 58/pop-to-eax +18926 # . epilogue +18927 89/<- %esp 5/r32/ebp +18928 5d/pop-to-ebp +18929 c3/return +18930 +18931 $lookup-var-or-literal:abort: +18932 (write-buffered *(ebp+0x18) "fn ") +18933 8b/-> *(ebp+0x14) 0/r32/eax +18934 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18935 (write-buffered *(ebp+0x18) %eax) +18936 (write-buffered *(ebp+0x18) ": empty variable!") +18937 (flush *(ebp+0x18)) +18938 (stop *(ebp+0x1c) 1) +18939 # never gets here +18940 +18941 # return first 'name' from the top (back) of 'vars' and abort if not found +18942 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) +18943 # . prologue +18944 55/push-ebp +18945 89/<- %ebp 4/r32/esp +18946 # . save registers +18947 50/push-eax +18948 # +18949 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +18950 # if (*out == 0) abort +18951 8b/-> *(ebp+0x10) 0/r32/eax +18952 81 7/subop/compare *eax 0/imm32 +18953 74/jump-if-= $lookup-var:abort/disp8 +18954 $lookup-var:end: +18955 # . restore registers +18956 58/pop-to-eax +18957 # . epilogue +18958 89/<- %esp 5/r32/ebp +18959 5d/pop-to-ebp +18960 c3/return +18961 +18962 $lookup-var:abort: +18963 (write-buffered *(ebp+0x18) "fn ") +18964 8b/-> *(ebp+0x14) 0/r32/eax +18965 (lookup *eax *(eax+4)) # Function-name Function-name => eax +18966 (write-buffered *(ebp+0x18) %eax) +18967 (write-buffered *(ebp+0x18) ": unknown variable '") +18968 (write-slice-buffered *(ebp+0x18) *(ebp+8)) +18969 (write-buffered *(ebp+0x18) "'\n") +18970 (flush *(ebp+0x18)) +18971 (stop *(ebp+0x1c) 1) +18972 # never gets here +18973 +18974 # return first 'name' from the top (back) of 'vars', and 0/null if not found +18975 # ensure that 'name' if in a register is the topmost variable in that register +18976 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) +18977 # pseudocode: +18978 # var curr: (addr handle var) = &vars->data[vars->top - 12] +18979 # var min = vars->data +18980 # while curr >= min +18981 # var v: (handle var) = *curr +18982 # if v->name == name +18983 # return +18984 # curr -= 12 +18985 # +18986 # . prologue +18987 55/push-ebp +18988 89/<- %ebp 4/r32/esp +18989 # . save registers +18990 50/push-eax +18991 51/push-ecx +18992 52/push-edx +18993 53/push-ebx +18994 56/push-esi +18995 57/push-edi +18996 # clear out +18997 (zero-out *(ebp+0x10) *Handle-size) +18998 # esi = vars +18999 8b/-> *(ebp+0xc) 6/r32/esi +19000 # ebx = vars->top +19001 8b/-> *esi 3/r32/ebx +19002 # if (vars->top > vars->size) abort +19003 3b/compare<- *(esi+4) 0/r32/eax +19004 0f 8f/jump-if-> $lookup-var-helper:error1/disp32 +19005 # var min/edx: (addr handle var) = vars->data +19006 8d/copy-address *(esi+8) 2/r32/edx +19007 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] +19008 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 +19009 # var var-in-reg/edi: 16 addrs +19010 68/push 0/imm32 +19011 68/push 0/imm32 +19012 68/push 0/imm32 +19013 68/push 0/imm32 +19014 68/push 0/imm32 +19015 68/push 0/imm32 +19016 68/push 0/imm32 +19017 68/push 0/imm32 +19018 68/push 0/imm32 +19019 68/push 0/imm32 +19020 68/push 0/imm32 +19021 68/push 0/imm32 +19022 68/push 0/imm32 +19023 68/push 0/imm32 +19024 68/push 0/imm32 +19025 68/push 0/imm32 +19026 89/<- %edi 4/r32/esp +19027 { +19028 $lookup-var-helper:loop: +19029 # if (curr < min) return +19030 39/compare %ebx 2/r32/edx +19031 0f 82/jump-if-addr< break/disp32 +19032 # var v/ecx: (addr var) = lookup(*curr) +19033 (lookup *ebx *(ebx+4)) # => eax +19034 89/<- %ecx 0/r32/eax +19035 # var vn/eax: (addr array byte) = lookup(v->name) +19036 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +19037 # if (vn == name) return curr +19038 (slice-equal? *(ebp+8) %eax) # => eax +19039 3d/compare-eax-and 0/imm32/false +19040 { +19041 74/jump-if-= break/disp8 +19042 $lookup-var-helper:found: +19043 # var vr/eax: (addr array byte) = lookup(v->register) +19044 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +19045 3d/compare-eax-and 0/imm32 +19046 { +19047 74/jump-if-= break/disp8 +19048 $lookup-var-helper:found-register: +19049 # var reg/eax: int = get(Registers, vr) +19050 (get Mu-registers-unique %eax 0xc "Mu-registers-unique") # => eax +19051 8b/-> *eax 0/r32/eax +19052 # if (var-in-reg[reg]) error +19053 8b/-> *(edi+eax<<2) 0/r32/eax +19054 3d/compare-eax-and 0/imm32 +19055 0f 85/jump-if-!= $lookup-var-helper:error2/disp32 +19056 } +19057 $lookup-var-helper:return: +19058 # esi = out +19059 8b/-> *(ebp+0x10) 6/r32/esi +19060 # *out = *curr +19061 8b/-> *ebx 0/r32/eax +19062 89/<- *esi 0/r32/eax +19063 8b/-> *(ebx+4) 0/r32/eax +19064 89/<- *(esi+4) 0/r32/eax +19065 # return +19066 eb/jump $lookup-var-helper:end/disp8 +19067 } +19068 # 'name' not yet found; update var-in-reg if v in register +19069 # . var vr/eax: (addr array byte) = lookup(v->register) +19070 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +19071 # . if (vr == 0) continue +19072 3d/compare-eax-and 0/imm32 +19073 74/jump-if-= $lookup-var-helper:continue/disp8 +19074 # . var reg/eax: int = get(Registers, vr) +19075 (get Mu-registers-unique %eax 0xc "Mu-registers-unique") # => eax +19076 8b/-> *eax 0/r32/eax +19077 # . var-in-reg[reg] = v +19078 89/<- *(edi+eax<<2) 1/r32/ecx +19079 $lookup-var-helper:continue: +19080 # curr -= 12 +19081 81 5/subop/subtract %ebx 0xc/imm32 +19082 e9/jump loop/disp32 +19083 } +19084 $lookup-var-helper:end: +19085 # . reclaim locals +19086 81 0/subop/add %esp 0x40/imm32 +19087 # . restore registers +19088 5f/pop-to-edi +19089 5e/pop-to-esi +19090 5b/pop-to-ebx +19091 5a/pop-to-edx +19092 59/pop-to-ecx +19093 58/pop-to-eax +19094 # . epilogue +19095 89/<- %esp 5/r32/ebp +19096 5d/pop-to-ebp +19097 c3/return +19098 +19099 $lookup-var-helper:error1: +19100 (write-buffered *(ebp+0x18) "fn ") +19101 8b/-> *(ebp+0x14) 0/r32/eax +19102 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19103 (write-buffered *(ebp+0x18) %eax) +19104 (write-buffered *(ebp+0x18) ": malformed stack when looking up '") +19105 (write-slice-buffered *(ebp+0x18) *(ebp+8)) +19106 (write-buffered *(ebp+0x18) "'\n") +19107 (flush *(ebp+0x18)) +19108 (stop *(ebp+0x1c) 1) +19109 # never gets here +19110 +19111 $lookup-var-helper:error2: +19112 # eax contains the conflicting var at this point +19113 (write-buffered *(ebp+0x18) "fn ") +19114 50/push-eax +19115 8b/-> *(ebp+0x14) 0/r32/eax +19116 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19117 (write-buffered *(ebp+0x18) %eax) +19118 58/pop-eax +19119 (write-buffered *(ebp+0x18) ": register ") +19120 50/push-eax +19121 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +19122 (write-buffered *(ebp+0x18) %eax) +19123 58/pop-to-eax +19124 (write-buffered *(ebp+0x18) " reads var '") +19125 (write-slice-buffered *(ebp+0x18) *(ebp+8)) +19126 (write-buffered *(ebp+0x18) "' after writing var '") +19127 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19128 (write-buffered *(ebp+0x18) %eax) +19129 (write-buffered *(ebp+0x18) "'\n") +19130 (flush *(ebp+0x18)) +19131 (stop *(ebp+0x1c) 1) +19132 # never gets here +19133 +19134 dump-vars: # vars: (addr stack live-var) +19135 # pseudocode: +19136 # var curr: (addr handle var) = &vars->data[vars->top - 12] +19137 # var min = vars->data +19138 # while curr >= min +19139 # var v: (handle var) = *curr +19140 # print v +19141 # curr -= 12 +19142 # +19143 # . prologue +19144 55/push-ebp +19145 89/<- %ebp 4/r32/esp +19146 # . save registers +19147 52/push-edx +19148 53/push-ebx +19149 56/push-esi +19150 # esi = vars +19151 8b/-> *(ebp+8) 6/r32/esi +19152 # ebx = vars->top +19153 8b/-> *esi 3/r32/ebx +19154 # var min/edx: (addr handle var) = vars->data +19155 8d/copy-address *(esi+8) 2/r32/edx +19156 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] +19157 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 +19158 { +19159 $dump-vars:loop: +19160 # if (curr < min) return +19161 39/compare %ebx 2/r32/edx +19162 0f 82/jump-if-addr< break/disp32 +19163 # +19164 (write-buffered Stderr " var@") +19165 (dump-var 2 %ebx) +19166 # curr -= 12 +19167 81 5/subop/subtract %ebx 0xc/imm32 +19168 e9/jump loop/disp32 +19169 } +19170 $dump-vars:end: +19171 # . restore registers +19172 5e/pop-to-esi +19173 5b/pop-to-ebx +19174 5a/pop-to-edx +19175 # . epilogue +19176 89/<- %esp 5/r32/ebp +19177 5d/pop-to-ebp +19178 c3/return +19179 +19180 == data +19181 # Like Registers, but no esp or ebp +19182 Mu-registers: # (addr stream {(handle array byte), int}) +19183 # a table is a stream +19184 0xa8/imm32/write +19185 0/imm32/read +19186 0xa8/imm32/length +19187 # data +19188 # general-purpose registers +19189 # it is perfectly ok to use fake alloc-ids -- as long as you never try to reclaim them +19190 0x11/imm32/alloc-id $Mu-register-eax/imm32 0/imm32 +19191 0x11/imm32/alloc-id $Mu-register-ecx/imm32 1/imm32 +19192 0x11/imm32/alloc-id $Mu-register-edx/imm32 2/imm32 +19193 0x11/imm32/alloc-id $Mu-register-ebx/imm32 3/imm32 +19194 0x11/imm32/alloc-id $Mu-register-esi/imm32 6/imm32 +19195 0x11/imm32/alloc-id $Mu-register-edi/imm32 7/imm32 +19196 # floating-point registers +19197 0x11/imm32/alloc-id $Mu-register-xmm0/imm32 0/imm32 +19198 0x11/imm32/alloc-id $Mu-register-xmm1/imm32 1/imm32 +19199 0x11/imm32/alloc-id $Mu-register-xmm2/imm32 2/imm32 +19200 0x11/imm32/alloc-id $Mu-register-xmm3/imm32 3/imm32 +19201 0x11/imm32/alloc-id $Mu-register-xmm4/imm32 4/imm32 +19202 0x11/imm32/alloc-id $Mu-register-xmm5/imm32 5/imm32 +19203 0x11/imm32/alloc-id $Mu-register-xmm6/imm32 6/imm32 +19204 0x11/imm32/alloc-id $Mu-register-xmm7/imm32 7/imm32 +19205 +19206 # Like Mu-registers, but with unique codes for integer and floating-point +19207 # registers. +19208 # Don't use this for code-generation, only for checking. +19209 Mu-registers-unique: # (addr stream {(handle array byte), int}) +19210 # a table is a stream +19211 0xa8/imm32/write +19212 0/imm32/read +19213 0xa8/imm32/length +19214 # data +19215 # general-purpose registers +19216 0x11/imm32/alloc-id $Mu-register-eax/imm32 0/imm32 +19217 0x11/imm32/alloc-id $Mu-register-ecx/imm32 1/imm32 +19218 0x11/imm32/alloc-id $Mu-register-edx/imm32 2/imm32 +19219 0x11/imm32/alloc-id $Mu-register-ebx/imm32 3/imm32 +19220 0x11/imm32/alloc-id $Mu-register-esi/imm32 6/imm32 +19221 0x11/imm32/alloc-id $Mu-register-edi/imm32 7/imm32 +19222 # floating-point registers +19223 0x11/imm32/alloc-id $Mu-register-xmm0/imm32 8/imm32 +19224 0x11/imm32/alloc-id $Mu-register-xmm1/imm32 9/imm32 +19225 0x11/imm32/alloc-id $Mu-register-xmm2/imm32 0xa/imm32 +19226 0x11/imm32/alloc-id $Mu-register-xmm3/imm32 0xb/imm32 +19227 0x11/imm32/alloc-id $Mu-register-xmm4/imm32 0xc/imm32 +19228 0x11/imm32/alloc-id $Mu-register-xmm5/imm32 0xd/imm32 +19229 0x11/imm32/alloc-id $Mu-register-xmm6/imm32 0xe/imm32 +19230 0x11/imm32/alloc-id $Mu-register-xmm7/imm32 0xf/imm32 +19231 +19232 $Mu-register-eax: +19233 0x11/imm32/alloc-id +19234 3/imm32/size +19235 0x65/e 0x61/a 0x78/x +19236 +19237 $Mu-register-ecx: +19238 0x11/imm32/alloc-id +19239 3/imm32/size +19240 0x65/e 0x63/c 0x78/x +19241 +19242 $Mu-register-edx: +19243 0x11/imm32/alloc-id +19244 3/imm32/size +19245 0x65/e 0x64/d 0x78/x +19246 +19247 $Mu-register-ebx: +19248 0x11/imm32/alloc-id +19249 3/imm32/size +19250 0x65/e 0x62/b 0x78/x +19251 +19252 $Mu-register-esi: +19253 0x11/imm32/alloc-id +19254 3/imm32/size +19255 0x65/e 0x73/s 0x69/i +19256 +19257 $Mu-register-edi: +19258 0x11/imm32/alloc-id +19259 3/imm32/size +19260 0x65/e 0x64/d 0x69/i +19261 +19262 $Mu-register-xmm0: +19263 0x11/imm32/alloc-id:fake:payload +19264 # "xmm0" +19265 0x4/imm32/size +19266 0x78/x 0x6d/m 0x6d/m 0x30/0 +19267 +19268 $Mu-register-xmm1: +19269 0x11/imm32/alloc-id:fake:payload +19270 # "xmm1" +19271 0x4/imm32/size +19272 0x78/x 0x6d/m 0x6d/m 0x31/1 +19273 +19274 $Mu-register-xmm2: +19275 0x11/imm32/alloc-id:fake:payload +19276 # "xmm2" +19277 0x4/imm32/size +19278 0x78/x 0x6d/m 0x6d/m 0x32/2 +19279 +19280 $Mu-register-xmm3: +19281 0x11/imm32/alloc-id:fake:payload +19282 # "xmm3" +19283 0x4/imm32/size +19284 0x78/x 0x6d/m 0x6d/m 0x33/3 +19285 +19286 $Mu-register-xmm4: +19287 0x11/imm32/alloc-id:fake:payload +19288 # "xmm4" +19289 0x4/imm32/size +19290 0x78/x 0x6d/m 0x6d/m 0x34/4 +19291 +19292 $Mu-register-xmm5: +19293 0x11/imm32/alloc-id:fake:payload +19294 # "xmm5" +19295 0x4/imm32/size +19296 0x78/x 0x6d/m 0x6d/m 0x35/5 +19297 +19298 $Mu-register-xmm6: +19299 0x11/imm32/alloc-id:fake:payload +19300 # "xmm6" +19301 0x4/imm32/size +19302 0x78/x 0x6d/m 0x6d/m 0x36/6 +19303 +19304 $Mu-register-xmm7: +19305 0x11/imm32/alloc-id:fake:payload +19306 # "xmm7" +19307 0x4/imm32/size +19308 0x78/x 0x6d/m 0x6d/m 0x37/7 +19309 +19310 == code +19311 +19312 # push 'out' to 'vars' if not already there; it's assumed to be a fn output +19313 maybe-define-var: # out: (handle var), vars: (addr stack live-var) +19314 # . prologue +19315 55/push-ebp +19316 89/<- %ebp 4/r32/esp +19317 # . save registers +19318 50/push-eax +19319 # var out-addr/eax: (addr var) +19320 (lookup *(ebp+8) *(ebp+0xc)) # => eax +19321 # +19322 (binding-exists? %eax *(ebp+0x10)) # => eax +19323 3d/compare-eax-and 0/imm32/false +19324 75/jump-if-!= $maybe-define-var:end/disp8 +19325 # otherwise update vars +19326 (push *(ebp+0x10) *(ebp+8)) +19327 (push *(ebp+0x10) *(ebp+0xc)) +19328 (push *(ebp+0x10) 0) # 'out' is always a fn output; never spill it +19329 $maybe-define-var:end: +19330 # . restore registers 19331 58/pop-to-eax 19332 # . epilogue 19333 89/<- %esp 5/r32/ebp 19334 5d/pop-to-ebp 19335 c3/return 19336 -19337 find-or-create-typeinfo-fields: # T: (addr typeinfo), f: (addr slice), out: (addr handle typeinfo-entry) -19338 # . prologue -19339 55/push-ebp -19340 89/<- %ebp 4/r32/esp -19341 # . save registers -19342 50/push-eax -19343 56/push-esi -19344 57/push-edi -19345 # eax = lookup(T->fields) -19346 8b/-> *(ebp+8) 0/r32/eax -19347 (lookup *(eax+4) *(eax+8)) # Typeinfo-fields Typeinfo-fields => eax -19348 # edi = out -19349 8b/-> *(ebp+0x10) 7/r32/edi -19350 # var src/esi: (addr handle typeinfo-entry) = get-or-insert-slice(T->fields, f) -19351 (get-or-insert-slice %eax *(ebp+0xc) *Typeinfo-fields-row-size Heap) # => eax -19352 89/<- %esi 0/r32/eax -19353 # if src doesn't exist, allocate it -19354 { -19355 81 7/subop/compare *esi 0/imm32 -19356 75/jump-if-!= break/disp8 -19357 (allocate Heap *Typeinfo-entry-size %esi) -19358 #? (write-buffered Stderr "handle at ") -19359 #? (write-int32-hex-buffered Stderr %esi) -19360 #? (write-buffered Stderr ": ") -19361 #? (write-int32-hex-buffered Stderr *esi) -19362 #? (write-buffered Stderr " ") -19363 #? (write-int32-hex-buffered Stderr *(esi+4)) -19364 #? (write-buffered Stderr Newline) -19365 #? (flush Stderr) -19366 #? (lookup *esi *(esi+4)) -19367 #? (write-buffered Stderr "created typeinfo fields at ") -19368 #? (write-int32-hex-buffered Stderr %esi) -19369 #? (write-buffered Stderr " for ") -19370 #? (write-int32-hex-buffered Stderr *(ebp+8)) -19371 #? (write-buffered Stderr Newline) -19372 #? (flush Stderr) -19373 } -19374 # *out = src -19375 # . *edi = *src -19376 8b/-> *esi 0/r32/eax -19377 89/<- *edi 0/r32/eax -19378 8b/-> *(esi+4) 0/r32/eax -19379 89/<- *(edi+4) 0/r32/eax -19380 $find-or-create-typeinfo-fields:end: -19381 # . restore registers -19382 5f/pop-to-edi -19383 5e/pop-to-esi -19384 58/pop-to-eax -19385 # . epilogue -19386 89/<- %esp 5/r32/ebp -19387 5d/pop-to-ebp -19388 c3/return -19389 -19390 populate-mu-type: # in: (addr stream byte), t: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) -19391 # pseudocode: -19392 # var line: (stream byte 512) -19393 # curr-index = 0 -19394 # while true -19395 # clear-stream(line) -19396 # read-line-buffered(in, line) -19397 # if line->write == 0 -19398 # abort -19399 # word-slice = next-mu-token(line) -19400 # if slice-empty?(word-slice) # end of line -19401 # continue -19402 # if slice-equal?(word-slice, "}") -19403 # break -19404 # var v: (handle var) = parse-var-with-type(word-slice, line) -19405 # var r: (handle typeinfo-fields) = find-or-create-typeinfo-fields(t, word-slice/v->name) -19406 # TODO: ensure that r->first is null -19407 # r->index = curr-index -19408 # curr-index++ -19409 # r->input-var = v -19410 # if r->output-var == 0 -19411 # r->output-var = new literal -19412 # TODO: ensure nothing else in line -19413 # t->total-size-in-bytes = -2 (not yet initialized) -19414 # -19415 # . prologue -19416 55/push-ebp -19417 89/<- %ebp 4/r32/esp -19418 # var curr-index: int at *(ebp-4) -19419 68/push 0/imm32 -19420 # . save registers -19421 50/push-eax -19422 51/push-ecx -19423 52/push-edx -19424 53/push-ebx -19425 56/push-esi -19426 57/push-edi -19427 # edi = t -19428 8b/-> *(ebp+0xc) 7/r32/edi -19429 # var line/ecx: (stream byte 512) -19430 81 5/subop/subtract %esp 0x200/imm32 -19431 68/push 0x200/imm32/size -19432 68/push 0/imm32/read -19433 68/push 0/imm32/write -19434 89/<- %ecx 4/r32/esp -19435 # var word-slice/edx: slice -19436 68/push 0/imm32/end -19437 68/push 0/imm32/start -19438 89/<- %edx 4/r32/esp -19439 # var v/esi: (handle var) -19440 68/push 0/imm32 -19441 68/push 0/imm32 -19442 89/<- %esi 4/r32/esp -19443 # var r/ebx: (handle typeinfo-entry) -19444 68/push 0/imm32 -19445 68/push 0/imm32 -19446 89/<- %ebx 4/r32/esp -19447 { -19448 $populate-mu-type:line-loop: -19449 (clear-stream %ecx) -19450 (read-line-buffered *(ebp+8) %ecx) -19451 # if (line->write == 0) abort -19452 81 7/subop/compare *ecx 0/imm32 -19453 0f 84/jump-if-= $populate-mu-type:error1/disp32 -19454 +-- 6 lines: #? # dump line ---------------------------------------------------------------------------------------------------------------------------------------------------- -19460 (next-mu-token %ecx %edx) -19461 # if slice-empty?(word-slice) continue -19462 (slice-empty? %edx) # => eax -19463 3d/compare-eax-and 0/imm32 -19464 0f 85/jump-if-!= loop/disp32 -19465 # if slice-equal?(word-slice, "}") break -19466 (slice-equal? %edx "}") -19467 3d/compare-eax-and 0/imm32 -19468 0f 85/jump-if-!= break/disp32 -19469 $populate-mu-type:parse-element: -19470 # v = parse-var-with-type(word-slice, first-line) -19471 # must do this first to strip the trailing ':' from word-slice before -19472 # using it in find-or-create-typeinfo-fields below -19473 # TODO: clean up that mutation in parse-var-with-type -19474 (type-name *edi) # Typeinfo-id => eax -19475 (parse-var-with-type %edx %ecx %esi %eax *(ebp+0x10) *(ebp+0x14)) -19476 # if v is an addr, abort -19477 (lookup *esi *(esi+4)) # => eax -19478 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19479 (is-mu-addr-type? %eax) # => eax -19480 3d/compare-eax-and 0/imm32/false -19481 0f 85/jump-if-!= $populate-mu-type:error2/disp32 -19482 # if v is an array, abort (we could support it, but initialization gets complex) -19483 (lookup *esi *(esi+4)) # => eax -19484 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19485 (is-mu-array-type? %eax) # => eax -19486 3d/compare-eax-and 0/imm32/false -19487 0f 85/jump-if-!= $populate-mu-type:error3/disp32 -19488 # if v is a byte, abort -19489 (lookup *esi *(esi+4)) # => eax -19490 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19491 (is-simple-mu-type? %eax 8) # byte => eax -19492 3d/compare-eax-and 0/imm32/false -19493 0f 85/jump-if-!= $populate-mu-type:error4/disp32 -19494 # if v is a slice, abort -19495 (lookup *esi *(esi+4)) # => eax -19496 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19497 (is-simple-mu-type? %eax 0xc) # slice => eax -19498 3d/compare-eax-and 0/imm32/false -19499 0f 85/jump-if-!= $populate-mu-type:error5/disp32 -19500 # if v is a stream, abort (we could support it, but initialization gets even more complex) -19501 (lookup *esi *(esi+4)) # => eax -19502 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19503 (is-mu-stream-type? %eax) # => eax -19504 3d/compare-eax-and 0/imm32/false -19505 0f 85/jump-if-!= $populate-mu-type:error6/disp32 -19506 # var tmp/ecx -19507 51/push-ecx -19508 $populate-mu-type:create-typeinfo-fields: -19509 # var r/ebx: (handle typeinfo-entry) -19510 (find-or-create-typeinfo-fields %edi %edx %ebx) -19511 # r->index = curr-index -19512 (lookup *ebx *(ebx+4)) # => eax -19513 8b/-> *(ebp-4) 1/r32/ecx -19514 #? (write-buffered Stderr "saving index ") -19515 #? (write-int32-hex-buffered Stderr %ecx) -19516 #? (write-buffered Stderr " at ") -19517 #? (write-int32-hex-buffered Stderr %edi) -19518 #? (write-buffered Stderr Newline) -19519 #? (flush Stderr) -19520 89/<- *(eax+8) 1/r32/ecx # Typeinfo-entry-index -19521 # ++curr-index -19522 ff 0/subop/increment *(ebp-4) -19523 $populate-mu-type:set-input-type: -19524 # r->input-var = v -19525 8b/-> *esi 1/r32/ecx -19526 89/<- *eax 1/r32/ecx # Typeinfo-entry-input-var -19527 8b/-> *(esi+4) 1/r32/ecx -19528 89/<- *(eax+4) 1/r32/ecx # Typeinfo-entry-input-var -19529 # restore line -19530 59/pop-to-ecx -19531 { -19532 $populate-mu-type:create-output-type: -19533 # if (r->output-var == 0) create a new var with some placeholder data -19534 81 7/subop/compare *(eax+0xc) 0/imm32 # Typeinfo-entry-output-var -19535 75/jump-if-!= break/disp8 -19536 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var -19537 (new-literal Heap %edx %eax) -19538 } -19539 e9/jump loop/disp32 -19540 } -19541 $populate-mu-type:invalidate-total-size-in-bytes: -19542 # Offsets and total size may not be accurate here since we may not yet -19543 # have encountered the element types. -19544 # We'll recompute them separately after parsing the entire program. -19545 c7 0/subop/copy *(edi+0xc) -2/imm32/uninitialized # Typeinfo-total-size-in-bytes -19546 $populate-mu-type:end: -19547 # . reclaim locals -19548 81 0/subop/add %esp 0x224/imm32 -19549 # . restore registers -19550 5f/pop-to-edi -19551 5e/pop-to-esi -19552 5b/pop-to-ebx -19553 5a/pop-to-edx -19554 59/pop-to-ecx -19555 58/pop-to-eax -19556 # reclaim curr-index -19557 81 0/subop/add %esp 4/imm32 -19558 # . epilogue -19559 89/<- %esp 5/r32/ebp -19560 5d/pop-to-ebp -19561 c3/return -19562 -19563 $populate-mu-type:error1: -19564 # error("incomplete type definition '" t->name "'\n") -19565 (write-buffered *(ebp+0x10) "incomplete type definition '") -19566 (type-name *edi) # Typeinfo-id => eax -19567 (write-buffered *(ebp+0x10) %eax) -19568 (write-buffered *(ebp+0x10) "\n") -19569 (flush *(ebp+0x10)) -19570 (stop *(ebp+0x14) 1) -19571 # never gets here -19572 -19573 $populate-mu-type:error2: -19574 (write-buffered *(ebp+0x10) "type ") -19575 (type-name *edi) # Typeinfo-id => eax -19576 (write-buffered *(ebp+0x10) %eax) -19577 (write-buffered *(ebp+0x10) ": 'addr' elements not allowed\n") -19578 (flush *(ebp+0x10)) -19579 (stop *(ebp+0x14) 1) -19580 # never gets here -19581 -19582 $populate-mu-type:error3: -19583 (write-buffered *(ebp+0x10) "type ") -19584 (type-name *edi) # Typeinfo-id => eax -19585 (write-buffered *(ebp+0x10) %eax) -19586 (write-buffered *(ebp+0x10) ": 'array' elements not allowed for now\n") -19587 (flush *(ebp+0x10)) -19588 (stop *(ebp+0x14) 1) -19589 # never gets here -19590 -19591 $populate-mu-type:error4: -19592 (write-buffered *(ebp+0x10) "type ") -19593 (type-name *edi) # Typeinfo-id => eax -19594 (write-buffered *(ebp+0x10) %eax) -19595 (write-buffered *(ebp+0x10) ": 'byte' elements not allowed\n") -19596 (flush *(ebp+0x10)) -19597 (stop *(ebp+0x14) 1) -19598 # never gets here -19599 -19600 $populate-mu-type:error5: -19601 (write-buffered *(ebp+0x10) "type ") -19602 (type-name *edi) # Typeinfo-id => eax -19603 (write-buffered *(ebp+0x10) %eax) -19604 (write-buffered *(ebp+0x10) ": 'slice' elements not allowed\n") -19605 (flush *(ebp+0x10)) -19606 (stop *(ebp+0x14) 1) -19607 # never gets here -19608 -19609 $populate-mu-type:error6: -19610 (write-buffered *(ebp+0x10) "type ") -19611 (type-name *edi) # Typeinfo-id => eax -19612 (write-buffered *(ebp+0x10) %eax) -19613 (write-buffered *(ebp+0x10) ": 'stream' elements not allowed for now\n") -19614 (flush *(ebp+0x10)) -19615 (stop *(ebp+0x14) 1) -19616 # never gets here -19617 -19618 type-name: # index: int -> result/eax: (addr array byte) -19619 # . prologue -19620 55/push-ebp -19621 89/<- %ebp 4/r32/esp -19622 # -19623 (index Type-id *(ebp+8)) -19624 $type-name:end: -19625 # . epilogue -19626 89/<- %esp 5/r32/ebp -19627 5d/pop-to-ebp -19628 c3/return -19629 -19630 index: # arr: (addr stream (handle array byte)), index: int -> result/eax: (addr array byte) -19631 # . prologue -19632 55/push-ebp -19633 89/<- %ebp 4/r32/esp -19634 # . save registers -19635 56/push-esi -19636 # TODO: bounds-check index -19637 # esi = arr -19638 8b/-> *(ebp+8) 6/r32/esi -19639 # eax = index -19640 8b/-> *(ebp+0xc) 0/r32/eax -19641 # eax = *(arr + 12 + index) -19642 8b/-> *(esi+eax<<2+0xc) 0/r32/eax -19643 $index:end: -19644 # . restore registers -19645 5e/pop-to-esi -19646 # . epilogue -19647 89/<- %esp 5/r32/ebp -19648 5d/pop-to-ebp -19649 c3/return -19650 -19651 ####################################################### -19652 # Compute type sizes -19653 ####################################################### -19654 -19655 # Compute the sizes of all user-defined types. -19656 # We'll need the sizes of their elements, which may be other user-defined -19657 # types, which we will compute as needed. -19658 -19659 # Initially, all user-defined types have their sizes set to -2 (invalid) -19660 populate-mu-type-sizes: # err: (addr buffered-file), ed: (addr exit-descriptor) -19661 # . prologue -19662 55/push-ebp -19663 89/<- %ebp 4/r32/esp -19664 $populate-mu-type-sizes:total-sizes: -19665 # var curr/eax: (addr typeinfo) = lookup(Program->types) -19666 (lookup *_Program-types *_Program-types->payload) # => eax -19667 { -19668 # if (curr == null) break -19669 3d/compare-eax-and 0/imm32/null -19670 74/jump-if-= break/disp8 -19671 (populate-mu-type-sizes-in-type %eax *(ebp+8) *(ebp+0xc)) -19672 # curr = lookup(curr->next) -19673 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax -19674 eb/jump loop/disp8 -19675 } -19676 $populate-mu-type-sizes:offsets: -19677 # curr = *Program->types -19678 (lookup *_Program-types *_Program-types->payload) # => eax -19679 { -19680 # if (curr == null) break -19681 3d/compare-eax-and 0/imm32/null -19682 74/jump-if-= break/disp8 -19683 (populate-mu-type-offsets %eax *(ebp+8) *(ebp+0xc)) -19684 # curr = curr->next -19685 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax -19686 eb/jump loop/disp8 -19687 } -19688 $populate-mu-type-sizes:end: -19689 # . epilogue -19690 89/<- %esp 5/r32/ebp -19691 5d/pop-to-ebp -19692 c3/return -19693 -19694 # compute sizes of all fields, recursing as necessary -19695 # sum up all their sizes to arrive at total size -19696 # fields may be out of order, but that doesn't affect the answer -19697 populate-mu-type-sizes-in-type: # T: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) +19337 # simpler version of lookup-var-helper +19338 binding-exists?: # target: (addr var), vars: (addr stack live-var) -> result/eax: boolean +19339 # pseudocode: +19340 # var curr: (addr handle var) = &vars->data[vars->top - 12] +19341 # var min = vars->data +19342 # while curr >= min +19343 # var v: (handle var) = *curr +19344 # if v->name == target->name +19345 # return true +19346 # curr -= 12 +19347 # return false +19348 # +19349 # . prologue +19350 55/push-ebp +19351 89/<- %ebp 4/r32/esp +19352 # . save registers +19353 51/push-ecx +19354 52/push-edx +19355 56/push-esi +19356 # var target-name/ecx: (addr array byte) = lookup(target->name) +19357 8b/-> *(ebp+8) 0/r32/eax +19358 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19359 89/<- %ecx 0/r32/eax +19360 # esi = vars +19361 8b/-> *(ebp+0xc) 6/r32/esi +19362 # eax = vars->top +19363 8b/-> *esi 0/r32/eax +19364 # var min/edx: (addr handle var) = vars->data +19365 8d/copy-address *(esi+8) 2/r32/edx +19366 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +19367 8d/copy-address *(esi+eax-4) 6/r32/esi # vars + 8 + vars->type - 12 +19368 { +19369 $binding-exists?:loop: +19370 # if (curr < min) return +19371 39/compare %esi 2/r32/edx +19372 0f 82/jump-if-addr< break/disp32 +19373 # var v/eax: (addr var) = lookup(*curr) +19374 (lookup *esi *(esi+4)) # => eax +19375 # var vn/eax: (addr array byte) = lookup(v->name) +19376 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19377 # if (vn == target-name) return true +19378 (string-equal? %ecx %eax) # => eax +19379 3d/compare-eax-and 0/imm32/false +19380 75/jump-if-!= $binding-exists?:end/disp8 # eax already contains true +19381 # curr -= 12 +19382 81 5/subop/subtract %esi 0xc/imm32 +19383 e9/jump loop/disp32 +19384 } +19385 b8/copy-to-eax 0/imm32/false +19386 $binding-exists?:end: +19387 # . restore registers +19388 5e/pop-to-esi +19389 5a/pop-to-edx +19390 59/pop-to-ecx +19391 # . epilogue +19392 89/<- %esp 5/r32/ebp +19393 5d/pop-to-ebp +19394 c3/return +19395 +19396 test-parse-mu-stmt: +19397 # . prologue +19398 55/push-ebp +19399 89/<- %ebp 4/r32/esp +19400 # setup +19401 8b/-> *Primitive-type-ids 0/r32/eax +19402 89/<- *Type-id 0/r32/eax # stream-write +19403 (clear-stream _test-input-stream) +19404 (write _test-input-stream "increment n\n") +19405 # var vars/ecx: (stack (addr var) 16) +19406 81 5/subop/subtract %esp 0xc0/imm32 +19407 68/push 0xc0/imm32/size +19408 68/push 0/imm32/top +19409 89/<- %ecx 4/r32/esp +19410 (clear-stack %ecx) +19411 # var v/edx: (handle var) +19412 68/push 0/imm32 +19413 68/push 0/imm32 +19414 89/<- %edx 4/r32/esp +19415 # var s/eax: (handle array byte) +19416 68/push 0/imm32 +19417 68/push 0/imm32 +19418 89/<- %eax 4/r32/esp +19419 # v = new var("n") +19420 (copy-array Heap "n" %eax) +19421 (new-var Heap *eax *(eax+4) %edx) +19422 # +19423 (push %ecx *edx) +19424 (push %ecx *(edx+4)) +19425 (push %ecx 0) +19426 # var out/eax: (handle stmt) +19427 68/push 0/imm32 +19428 68/push 0/imm32 +19429 89/<- %eax 4/r32/esp +19430 # convert +19431 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) +19432 # var out-addr/edx: (addr stmt) = lookup(*out) +19433 (lookup *eax *(eax+4)) # => eax +19434 89/<- %edx 0/r32/eax +19435 # out->tag +19436 (check-ints-equal *edx 1 "F - test-parse-mu-stmt/tag") # Stmt-tag is Stmt1 +19437 # out->operation +19438 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax +19439 (check-strings-equal %eax "increment" "F - test-parse-mu-stmt/name") # Stmt1-operation +19440 # out->inouts->value->name +19441 # . eax = out->inouts +19442 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +19443 # . eax = out->inouts->value +19444 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +19445 # . eax = out->inouts->value->name +19446 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19447 # . +19448 (check-strings-equal %eax "n" "F - test-parse-mu-stmt/inout:0") +19449 # . epilogue +19450 89/<- %esp 5/r32/ebp +19451 5d/pop-to-ebp +19452 c3/return +19453 +19454 test-parse-mu-stmt-with-comma: +19455 # . prologue +19456 55/push-ebp +19457 89/<- %ebp 4/r32/esp +19458 # setup +19459 8b/-> *Primitive-type-ids 0/r32/eax +19460 89/<- *Type-id 0/r32/eax # stream-write +19461 (clear-stream _test-input-stream) +19462 (write _test-input-stream "copy-to n, 3\n") +19463 # var vars/ecx: (stack (addr var) 16) +19464 81 5/subop/subtract %esp 0xc0/imm32 +19465 68/push 0xc0/imm32/size +19466 68/push 0/imm32/top +19467 89/<- %ecx 4/r32/esp +19468 (clear-stack %ecx) +19469 # var v/edx: (handle var) +19470 68/push 0/imm32 +19471 68/push 0/imm32 +19472 89/<- %edx 4/r32/esp +19473 # var s/eax: (handle array byte) +19474 68/push 0/imm32 +19475 68/push 0/imm32 +19476 89/<- %eax 4/r32/esp +19477 # v = new var("n") +19478 (copy-array Heap "n" %eax) +19479 (new-var Heap *eax *(eax+4) %edx) +19480 # +19481 (push %ecx *edx) +19482 (push %ecx *(edx+4)) +19483 (push %ecx 0) +19484 # var out/eax: (handle stmt) +19485 68/push 0/imm32 +19486 68/push 0/imm32 +19487 89/<- %eax 4/r32/esp +19488 # convert +19489 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) +19490 # var out-addr/edx: (addr stmt) = lookup(*out) +19491 (lookup *eax *(eax+4)) # => eax +19492 89/<- %edx 0/r32/eax +19493 # out->tag +19494 (check-ints-equal *edx 1 "F - test-parse-mu-stmt-with-comma/tag") # Stmt-tag is Stmt1 +19495 # out->operation +19496 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax +19497 (check-strings-equal %eax "copy-to" "F - test-parse-mu-stmt-with-comma/name") # Stmt1-operation +19498 # out->inouts->value->name +19499 # . eax = out->inouts +19500 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +19501 # . eax = out->inouts->value +19502 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +19503 # . eax = out->inouts->value->name +19504 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19505 # . +19506 (check-strings-equal %eax "n" "F - test-parse-mu-stmt-with-comma/inout:0") +19507 # . epilogue +19508 89/<- %esp 5/r32/ebp +19509 5d/pop-to-ebp +19510 c3/return +19511 +19512 new-var: # ad: (addr allocation-descriptor), name: (handle array byte), out: (addr handle var) +19513 # . prologue +19514 55/push-ebp +19515 89/<- %ebp 4/r32/esp +19516 # . save registers +19517 50/push-eax +19518 51/push-ecx +19519 # ecx = out +19520 8b/-> *(ebp+0x14) 1/r32/ecx +19521 # +19522 (allocate *(ebp+8) *Var-size %ecx) +19523 # var out-addr/eax: (addr var) +19524 (lookup *ecx *(ecx+4)) # => eax +19525 # out-addr->name = name +19526 8b/-> *(ebp+0xc) 1/r32/ecx +19527 89/<- *eax 1/r32/ecx # Var-name +19528 8b/-> *(ebp+0x10) 1/r32/ecx +19529 89/<- *(eax+4) 1/r32/ecx # Var-name +19530 #? (write-buffered Stderr "var ") +19531 #? (lookup *(ebp+0xc) *(ebp+0x10)) +19532 #? (write-buffered Stderr %eax) +19533 #? (write-buffered Stderr " at ") +19534 #? 8b/-> *(ebp+0x14) 1/r32/ecx +19535 #? (lookup *ecx *(ecx+4)) # => eax +19536 #? (write-int32-hex-buffered Stderr %eax) +19537 #? (write-buffered Stderr Newline) +19538 #? (flush Stderr) +19539 $new-var:end: +19540 # . restore registers +19541 59/pop-to-ecx +19542 58/pop-to-eax +19543 # . epilogue +19544 89/<- %esp 5/r32/ebp +19545 5d/pop-to-ebp +19546 c3/return +19547 +19548 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) +19549 # . prologue +19550 55/push-ebp +19551 89/<- %ebp 4/r32/esp +19552 # . save registers +19553 50/push-eax +19554 51/push-ecx +19555 # if (!is-hex-int?(name)) abort +19556 (is-hex-int? *(ebp+0xc)) # => eax +19557 3d/compare-eax-and 0/imm32/false +19558 0f 84/jump-if-= $new-literal-integer:abort/disp32 +19559 # a little more error-checking +19560 (check-mu-hex-int *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +19561 # out = new var(s) +19562 (new-var-from-slice *(ebp+8) *(ebp+0xc) *(ebp+0x10)) +19563 # var out-addr/ecx: (addr var) = lookup(*out) +19564 8b/-> *(ebp+0x10) 0/r32/eax +19565 (lookup *eax *(eax+4)) # => eax +19566 89/<- %ecx 0/r32/eax +19567 # out-addr->block-depth = *Curr-block-depth +19568 8b/-> *Curr-block-depth 0/r32/eax +19569 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +19570 # out-addr->type = new tree() +19571 8d/copy-address *(ecx+8) 0/r32/eax # Var-type +19572 (allocate *(ebp+8) *Type-tree-size %eax) +19573 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +19574 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom +19575 # nothing else to do; default type is 'literal' +19576 $new-literal-integer:end: +19577 # . reclaim locals +19578 81 0/subop/add %esp 8/imm32 +19579 # . restore registers +19580 59/pop-to-ecx +19581 58/pop-to-eax +19582 # . epilogue +19583 89/<- %esp 5/r32/ebp +19584 5d/pop-to-ebp +19585 c3/return +19586 +19587 $new-literal-integer:abort: +19588 (write-buffered *(ebp+0x18) "fn ") +19589 8b/-> *(ebp+0x14) 0/r32/eax +19590 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19591 (write-buffered *(ebp+0x18) %eax) +19592 (write-buffered *(ebp+0x18) ": variable '") +19593 (write-slice-buffered *(ebp+0x18) *(ebp+0xc)) +19594 (write-buffered *(ebp+0x18) "' cannot begin with a digit (or do you have a typo in a number?)\n") +19595 (flush *(ebp+0x18)) +19596 (stop *(ebp+0x1c) 1) +19597 # never gets here +19598 +19599 # precondition: name is a valid hex integer; require a '0x' prefix +19600 check-mu-hex-int: # name: (addr slice), err: (addr buffered-file), ed: (addr exit-descriptor) +19601 # . prologue +19602 55/push-ebp +19603 89/<- %ebp 4/r32/esp +19604 # . save registers +19605 50/push-eax +19606 51/push-ecx +19607 52/push-edx +19608 # ecx = name +19609 8b/-> *(ebp+8) 1/r32/ecx +19610 # var start/edx: (addr byte) = name->start +19611 8b/-> *ecx 2/r32/edx +19612 # if (*start == '-') ++start +19613 b8/copy-to-eax 0/imm32 +19614 8a/copy-byte *edx 0/r32/AL +19615 3d/compare-eax-and 0x2d/imm32/dash +19616 { +19617 75/jump-if-!= break/disp8 +19618 42/increment-edx +19619 } +19620 # var end/ecx: (addr byte) = name->end +19621 8b/-> *(ecx+4) 1/r32/ecx +19622 # var len/eax: int = name->end - name->start +19623 89/<- %eax 1/r32/ecx +19624 29/subtract-from %eax 2/r32/edx +19625 # if (len <= 1) return +19626 3d/compare-eax-with 1/imm32 +19627 0f 8e/jump-if-<= $check-mu-hex-int:end/disp32 +19628 $check-mu-hex-int:length->-1: +19629 # if slice-starts-with?({start, end}, "0x") return +19630 # . var tmp = {start, end} +19631 51/push-ecx +19632 52/push-edx +19633 89/<- %eax 4/r32/esp +19634 # . +19635 (slice-starts-with? %eax "0x") # => eax +19636 # . reclaim tmp +19637 81 0/subop/add %esp 8/imm32 +19638 # . +19639 3d/compare-eax-with 0/imm32/false +19640 75/jump-if-!= $check-mu-hex-int:end/disp8 +19641 $check-mu-hex-int:abort: +19642 # otherwise abort +19643 (write-buffered *(ebp+0xc) "literal integers are always hex in Mu; start '") +19644 (write-slice-buffered *(ebp+0xc) *(ebp+8)) +19645 (write-buffered *(ebp+0xc) "' with a '0x' to be unambiguous, converting it to hexadecimal as necessary.\n") +19646 (flush *(ebp+0xc)) +19647 (stop *(ebp+0x10) 1) +19648 $check-mu-hex-int:end: +19649 # . restore registers +19650 5a/pop-to-edx +19651 59/pop-to-ecx +19652 58/pop-to-eax +19653 # . epilogue +19654 89/<- %esp 5/r32/ebp +19655 5d/pop-to-ebp +19656 c3/return +19657 +19658 new-literal: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) +19659 # . prologue +19660 55/push-ebp +19661 89/<- %ebp 4/r32/esp +19662 # . save registers +19663 50/push-eax +19664 51/push-ecx +19665 # var s/ecx: (handle array byte) +19666 68/push 0/imm32 +19667 68/push 0/imm32 +19668 89/<- %ecx 4/r32/esp +19669 # s = slice-to-string(name) +19670 (slice-to-string Heap *(ebp+0xc) %ecx) +19671 # allocate to out +19672 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) +19673 # var out-addr/ecx: (addr var) = lookup(*out) +19674 8b/-> *(ebp+0x10) 1/r32/ecx +19675 (lookup *ecx *(ecx+4)) # => eax +19676 89/<- %ecx 0/r32/eax +19677 # out-addr->block-depth = *Curr-block-depth +19678 8b/-> *Curr-block-depth 0/r32/eax +19679 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +19680 # out-addr->type/eax = new type +19681 8d/copy-address *(ecx+8) 0/r32/eax # Var-type +19682 (allocate *(ebp+8) *Type-tree-size %eax) +19683 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +19684 # nothing else to do; default type is 'literal' +19685 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom +19686 $new-literal:end: +19687 # . reclaim locals +19688 81 0/subop/add %esp 8/imm32 +19689 # . restore registers +19690 59/pop-to-ecx +19691 58/pop-to-eax +19692 # . epilogue +19693 89/<- %esp 5/r32/ebp +19694 5d/pop-to-ebp +19695 c3/return +19696 +19697 new-literal-string: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) 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 56/push-esi -19706 57/push-edi -19707 # esi = T -19708 8b/-> *(ebp+8) 6/r32/esi -19709 # if T is already computed, return -19710 81 7/subop/compare *(esi+0xc) 0/imm32 # Typeinfo-total-size-in-bytes -19711 0f 8d/jump-if->= $populate-mu-type-sizes-in-type:end/disp32 -19712 # if T is being computed, abort -19713 81 7/subop/compare *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes -19714 0f 84/jump-if-= $populate-mu-type-sizes-in-type:abort/disp32 -19715 # tag T (-2 to -1) to avoid infinite recursion -19716 c7 0/subop/copy *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes -19717 # var total-size/edi: int = 0 -19718 bf/copy-to-edi 0/imm32 -19719 # - for every field, if it's a user-defined type, compute its size -19720 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) -19721 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax -19722 89/<- %ecx 0/r32/eax -19723 # var table-size/edx: int = table->write -19724 8b/-> *ecx 2/r32/edx # stream-write -19725 # var curr/ecx: (addr table_row) = table->data -19726 8d/copy-address *(ecx+0xc) 1/r32/ecx -19727 # var max/edx: (addr table_row) = table->data + table->write -19728 8d/copy-address *(ecx+edx) 2/r32/edx -19729 { -19730 $populate-mu-type-sizes-in-type:loop: -19731 # if (curr >= max) break -19732 39/compare %ecx 2/r32/edx -19733 73/jump-if-addr>= break/disp8 -19734 # var t/eax: (addr typeinfo-entry) = lookup(curr->value) -19735 (lookup *(ecx+8) *(ecx+0xc)) # => eax -19736 # if (t->input-var == 0) silently ignore it; we'll emit a nice error message while type-checking -19737 81 7/subop/compare *eax 0/imm32 # Typeinfo-entry-input-var -19738 74/jump-if-= $populate-mu-type-sizes-in-type:end/disp8 -19739 # compute size of t->input-var -19740 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax -19741 (compute-size-of-var %eax *(ebp+0xc) *(ebp+0x10)) # => eax -19742 # result += eax -19743 01/add-to %edi 0/r32/eax -19744 # curr += row-size -19745 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size -19746 # -19747 eb/jump loop/disp8 -19748 } -19749 # - save result -19750 89/<- *(esi+0xc) 7/r32/edi # Typeinfo-total-size-in-bytes -19751 $populate-mu-type-sizes-in-type:end: -19752 # . restore registers -19753 5f/pop-to-edi -19754 5e/pop-to-esi -19755 5a/pop-to-edx +19704 # var s/ecx: (handle array byte) +19705 68/push 0/imm32 +19706 68/push 0/imm32 +19707 89/<- %ecx 4/r32/esp +19708 # s = slice-to-string(name) +19709 (slice-to-string Heap *(ebp+0xc) %ecx) +19710 # allocate to out +19711 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) +19712 # var out-addr/ecx: (addr var) = lookup(*out) +19713 8b/-> *(ebp+0x10) 1/r32/ecx +19714 (lookup *ecx *(ecx+4)) # => eax +19715 89/<- %ecx 0/r32/eax +19716 # out-addr->block-depth = *Curr-block-depth +19717 8b/-> *Curr-block-depth 0/r32/eax +19718 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +19719 # out-addr->type/eax = new type +19720 8d/copy-address *(ecx+8) 0/r32/eax # Var-type +19721 (allocate *(ebp+8) *Type-tree-size %eax) +19722 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +19723 # out-addr->type->value = literal-string +19724 c7 0/subop/copy *(eax+4) 0x10/imm32/type-id-string-literal # Type-tree-value +19725 # out-addr->type->is-atom? = true +19726 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom +19727 $new-literal-string:end: +19728 # . reclaim locals +19729 81 0/subop/add %esp 8/imm32 +19730 # . restore registers +19731 59/pop-to-ecx +19732 58/pop-to-eax +19733 # . epilogue +19734 89/<- %esp 5/r32/ebp +19735 5d/pop-to-ebp +19736 c3/return +19737 +19738 new-var-from-slice: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) +19739 # . prologue +19740 55/push-ebp +19741 89/<- %ebp 4/r32/esp +19742 # . save registers +19743 51/push-ecx +19744 # var tmp/ecx: (handle array byte) +19745 68/push 0/imm32 +19746 68/push 0/imm32 +19747 89/<- %ecx 4/r32/esp +19748 # tmp = slice-to-string(name) +19749 (slice-to-string Heap *(ebp+0xc) %ecx) +19750 # out = new-var(tmp) +19751 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) +19752 $new-var-from-slice:end: +19753 # . reclaim locals +19754 81 0/subop/add %esp 8/imm32 +19755 # . restore registers 19756 59/pop-to-ecx -19757 58/pop-to-eax -19758 # . epilogue -19759 89/<- %esp 5/r32/ebp -19760 5d/pop-to-ebp -19761 c3/return -19762 -19763 $populate-mu-type-sizes-in-type:abort: -19764 (write-buffered *(ebp+0xc) "cycle in type definitions\n") -19765 (flush *(ebp+0xc)) -19766 (stop *(ebp+0x10) 1) -19767 # never gets here -19768 -19769 # Analogous to size-of, except we need to compute what size-of can just read -19770 # off the right data structures. -19771 compute-size-of-var: # in: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -19772 # . prologue -19773 55/push-ebp -19774 89/<- %ebp 4/r32/esp -19775 # . push registers -19776 51/push-ecx -19777 # var t/ecx: (addr type-tree) = lookup(v->type) -19778 8b/-> *(ebp+8) 1/r32/ecx -19779 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -19780 89/<- %ecx 0/r32/eax -19781 # if (t->is-atom == false) t = lookup(t->left) -19782 { -19783 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -19784 75/jump-if-!= break/disp8 -19785 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -19786 89/<- %ecx 0/r32/eax -19787 } -19788 # TODO: ensure t is an atom -19789 (compute-size-of-type-id *(ecx+4) *(ebp+0xc) *(ebp+0x10)) # Type-tree-value => eax -19790 $compute-size-of-var:end: -19791 # . restore registers -19792 59/pop-to-ecx -19793 # . epilogue -19794 89/<- %esp 5/r32/ebp -19795 5d/pop-to-ebp -19796 c3/return -19797 -19798 compute-size-of-type-id: # t: type-id, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -19799 # . prologue -19800 55/push-ebp -19801 89/<- %ebp 4/r32/esp -19802 # . save registers -19803 51/push-ecx -19804 # var out/ecx: (handle typeinfo) -19805 68/push 0/imm32 -19806 68/push 0/imm32 -19807 89/<- %ecx 4/r32/esp -19808 # eax = t -19809 8b/-> *(ebp+8) 0/r32/eax -19810 # if t is a literal, return 0 -19811 3d/compare-eax-and 0/imm32/literal -19812 0f 84/jump-if-= $compute-size-of-type-id:end/disp32 # eax changes type from type-id to int -19813 # if t is a byte, return 4 (because we don't really support non-multiples of 4) -19814 3d/compare-eax-and 8/imm32/byte -19815 { -19816 75/jump-if-!= break/disp8 -19817 b8/copy-to-eax 4/imm32 -19818 eb/jump $compute-size-of-type-id:end/disp8 -19819 } -19820 # if t is a handle, return 8 -19821 3d/compare-eax-and 4/imm32/handle -19822 { -19823 75/jump-if-!= break/disp8 -19824 b8/copy-to-eax 8/imm32 -19825 eb/jump $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int -19826 } -19827 # if t is a slice, return 8 -19828 3d/compare-eax-and 0xc/imm32/slice -19829 { -19830 75/jump-if-!= break/disp8 -19831 b8/copy-to-eax 8/imm32 -19832 eb/jump $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int -19833 } -19834 # if t is a user-defined type, compute its size -19835 # TODO: support non-atom type -19836 (find-typeinfo %eax %ecx) -19837 { -19838 81 7/subop/compare *ecx 0/imm32 -19839 74/jump-if-= break/disp8 -19840 $compute-size-of-type-id:user-defined: -19841 (lookup *ecx *(ecx+4)) # => eax -19842 (populate-mu-type-sizes-in-type %eax *(ebp+0xc) *(ebp+0x10)) -19843 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes -19844 eb/jump $compute-size-of-type-id:end/disp8 -19845 } -19846 # otherwise return the word size -19847 b8/copy-to-eax 4/imm32 -19848 $compute-size-of-type-id:end: -19849 # . reclaim locals -19850 81 0/subop/add %esp 8/imm32 -19851 # . restore registers -19852 59/pop-to-ecx -19853 # . epilogue -19854 89/<- %esp 5/r32/ebp -19855 5d/pop-to-ebp -19856 c3/return -19857 -19858 # at this point we have total sizes for all user-defined types -19859 # compute offsets for each element -19860 # complication: fields may be out of order -19861 populate-mu-type-offsets: # in: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) -19862 # . prologue -19863 55/push-ebp -19864 89/<- %ebp 4/r32/esp -19865 # . save registers -19866 50/push-eax -19867 51/push-ecx -19868 52/push-edx -19869 53/push-ebx -19870 56/push-esi -19871 57/push-edi -19872 #? (dump-typeinfos "aaa\n") -19873 # var curr-offset/edi: int = 0 -19874 bf/copy-to-edi 0/imm32 -19875 # var table/ecx: (addr table string_key (handle typeinfo-entry)) = lookup(in->fields) -19876 8b/-> *(ebp+8) 1/r32/ecx -19877 (lookup *(ecx+4) *(ecx+8)) # Typeinfo-fields Typeinfo-fields => eax -19878 89/<- %ecx 0/r32/eax -19879 # var num-elems/edx: int = table->write / Typeinfo-fields-row-size -19880 8b/-> *ecx 2/r32/edx # stream-write -19881 c1 5/subop/shift-right-logical %edx 4/imm8 -19882 # var i/ebx: int = 0 -19883 bb/copy-to-ebx 0/imm32 -19884 { -19885 $populate-mu-type-offsets:loop: -19886 39/compare %ebx 2/r32/edx -19887 0f 8d/jump-if->= break/disp32 -19888 #? (write-buffered Stderr "looking up index ") -19889 #? (write-int32-hex-buffered Stderr %ebx) -19890 #? (write-buffered Stderr " in ") -19891 #? (write-int32-hex-buffered Stderr *(ebp+8)) -19892 #? (write-buffered Stderr Newline) -19893 #? (flush Stderr) -19894 # var v/esi: (addr typeinfo-entry) -19895 (locate-typeinfo-entry-with-index %ecx %ebx *(ebp+0xc) *(ebp+0x10)) # => eax -19896 89/<- %esi 0/r32/eax -19897 # if v is null, silently move on; we'll emit a nice error message while type-checking -19898 81 7/subop/compare %esi 0/imm32 # Typeinfo-entry-input-var -19899 74/jump-if-= $populate-mu-type-offsets:end/disp8 -19900 # if (v->input-var == 0) silently ignore v; we'll emit a nice error message while type-checking -19901 81 7/subop/compare *esi 0/imm32 # Typeinfo-entry-input-var -19902 74/jump-if-= $populate-mu-type-offsets:end/disp8 -19903 # v->output-var->offset = curr-offset -19904 # . eax: (addr var) -19905 (lookup *(esi+0xc) *(esi+0x10)) # Typeinfo-entry-output-var Typeinfo-entry-output-var => eax -19906 89/<- *(eax+0x14) 7/r32/edi # Var-offset -19907 # curr-offset += size-of(v->input-var) -19908 (lookup *esi *(esi+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax -19909 (size-of %eax) # => eax -19910 01/add-to %edi 0/r32/eax -19911 # ++i -19912 43/increment-ebx -19913 e9/jump loop/disp32 -19914 } -19915 $populate-mu-type-offsets:end: -19916 # . restore registers -19917 5f/pop-to-edi -19918 5e/pop-to-esi -19919 5b/pop-to-ebx -19920 5a/pop-to-edx -19921 59/pop-to-ecx -19922 58/pop-to-eax -19923 # . epilogue -19924 89/<- %esp 5/r32/ebp -19925 5d/pop-to-ebp -19926 c3/return -19927 -19928 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) -19929 # . prologue -19930 55/push-ebp -19931 89/<- %ebp 4/r32/esp -19932 # . save registers -19933 51/push-ecx -19934 52/push-edx -19935 53/push-ebx -19936 56/push-esi -19937 57/push-edi -19938 # esi = table -19939 8b/-> *(ebp+8) 6/r32/esi -19940 # var curr/ecx: (addr row (handle array byte) (handle typeinfo-entry)) = table->data -19941 8d/copy-address *(esi+0xc) 1/r32/ecx -19942 # var max/edx: (addr byte) = &table->data[table->write] -19943 8b/-> *esi 2/r32/edx -19944 8d/copy-address *(ecx+edx) 2/r32/edx -19945 { -19946 $locate-typeinfo-entry-with-index:loop: -19947 39/compare %ecx 2/r32/edx -19948 73/jump-if-addr>= break/disp8 -19949 # var v/eax: (addr typeinfo-entry) -19950 (lookup *(ecx+8) *(ecx+0xc)) # => eax -19951 # if (v->index == idx) return v -19952 8b/-> *(eax+8) 3/r32/ebx # Typeinfo-entry-index -19953 #? (write-buffered Stderr "comparing ") -19954 #? (write-int32-hex-buffered Stderr %ebx) -19955 #? (write-buffered Stderr " and ") -19956 #? (write-int32-hex-buffered Stderr *(ebp+0xc)) -19957 #? (write-buffered Stderr Newline) -19958 #? (flush Stderr) -19959 39/compare *(ebp+0xc) 3/r32/ebx -19960 74/jump-if-= $locate-typeinfo-entry-with-index:end/disp8 -19961 # curr += Typeinfo-entry-size -19962 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-entry-size -19963 # -19964 eb/jump loop/disp8 -19965 } -19966 # return 0 -19967 b8/copy-to-eax 0/imm32 -19968 $locate-typeinfo-entry-with-index:end: -19969 #? (write-buffered Stderr "returning ") -19970 #? (write-int32-hex-buffered Stderr %eax) -19971 #? (write-buffered Stderr Newline) -19972 #? (flush Stderr) -19973 # . restore registers -19974 5f/pop-to-edi -19975 5e/pop-to-esi -19976 5b/pop-to-ebx -19977 5a/pop-to-edx -19978 59/pop-to-ecx -19979 # . epilogue -19980 89/<- %esp 5/r32/ebp -19981 5d/pop-to-ebp -19982 c3/return -19983 -19984 dump-typeinfos: # hdr: (addr array byte) -19985 # . prologue -19986 55/push-ebp -19987 89/<- %ebp 4/r32/esp -19988 # . save registers -19989 50/push-eax -19990 # -19991 (write-buffered Stderr *(ebp+8)) -19992 (flush Stderr) -19993 # var curr/eax: (addr typeinfo) = lookup(Program->types) -19994 (lookup *_Program-types *_Program-types->payload) # => eax -19995 { -19996 # if (curr == null) break -19997 3d/compare-eax-and 0/imm32 -19998 74/jump-if-= break/disp8 -19999 (write-buffered Stderr "---\n") -20000 (flush Stderr) -20001 (dump-typeinfo %eax) -20002 # curr = lookup(curr->next) -20003 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax -20004 eb/jump loop/disp8 -20005 } -20006 $dump-typeinfos:end: -20007 # . restore registers -20008 58/pop-to-eax -20009 # . epilogue -20010 89/<- %esp 5/r32/ebp -20011 5d/pop-to-ebp -20012 c3/return -20013 -20014 dump-typeinfo: # in: (addr typeinfo) -20015 # . prologue -20016 55/push-ebp -20017 89/<- %ebp 4/r32/esp -20018 # . save registers -20019 50/push-eax -20020 51/push-ecx -20021 52/push-edx -20022 53/push-ebx -20023 56/push-esi -20024 57/push-edi -20025 # esi = in -20026 8b/-> *(ebp+8) 6/r32/esi -20027 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) -20028 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax -20029 89/<- %ecx 0/r32/eax -20030 (write-buffered Stderr "id:") -20031 (write-int32-hex-buffered Stderr *esi) -20032 (write-buffered Stderr "\n") -20033 (write-buffered Stderr "fields @ ") -20034 (write-int32-hex-buffered Stderr %ecx) -20035 (write-buffered Stderr Newline) -20036 (flush Stderr) -20037 (write-buffered Stderr " write: ") -20038 (write-int32-hex-buffered Stderr *ecx) -20039 (write-buffered Stderr Newline) -20040 (flush Stderr) -20041 (write-buffered Stderr " read: ") -20042 (write-int32-hex-buffered Stderr *(ecx+4)) -20043 (write-buffered Stderr Newline) -20044 (flush Stderr) -20045 (write-buffered Stderr " size: ") -20046 (write-int32-hex-buffered Stderr *(ecx+8)) -20047 (write-buffered Stderr Newline) -20048 (flush Stderr) -20049 # var table-size/edx: int = table->write -20050 8b/-> *ecx 2/r32/edx # stream-write -20051 # var curr/ecx: (addr table_row) = table->data -20052 8d/copy-address *(ecx+0xc) 1/r32/ecx -20053 # var max/edx: (addr table_row) = table->data + table->write -20054 8d/copy-address *(ecx+edx) 2/r32/edx -20055 { -20056 $dump-typeinfo:loop: -20057 # if (curr >= max) break -20058 39/compare %ecx 2/r32/edx -20059 0f 83/jump-if-addr>= break/disp32 -20060 (write-buffered Stderr " row:\n") -20061 (write-buffered Stderr " key: ") -20062 (write-int32-hex-buffered Stderr *ecx) -20063 (write-buffered Stderr ",") -20064 (write-int32-hex-buffered Stderr *(ecx+4)) -20065 (write-buffered Stderr " = '") -20066 (lookup *ecx *(ecx+4)) -20067 (write-buffered Stderr %eax) -20068 (write-buffered Stderr "' @ ") -20069 (write-int32-hex-buffered Stderr %eax) -20070 (write-buffered Stderr Newline) -20071 (flush Stderr) -20072 (write-buffered Stderr " value: ") -20073 (write-int32-hex-buffered Stderr *(ecx+8)) -20074 (write-buffered Stderr ",") -20075 (write-int32-hex-buffered Stderr *(ecx+0xc)) -20076 (write-buffered Stderr " = typeinfo-entry@") -20077 (lookup *(ecx+8) *(ecx+0xc)) -20078 (write-int32-hex-buffered Stderr %eax) -20079 (write-buffered Stderr Newline) -20080 (flush Stderr) -20081 (write-buffered Stderr " input var@") -20082 (dump-var 5 %eax) -20083 (lookup *(ecx+8) *(ecx+0xc)) -20084 (write-buffered Stderr " index: ") -20085 (write-int32-hex-buffered Stderr *(eax+8)) -20086 (write-buffered Stderr Newline) -20087 (flush Stderr) -20088 (write-buffered Stderr " output var@") -20089 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var -20090 (dump-var 5 %eax) -20091 (flush Stderr) -20092 # curr += row-size -20093 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size -20094 # -20095 e9/jump loop/disp32 -20096 } -20097 $dump-typeinfo:end: -20098 # . restore registers -20099 5f/pop-to-edi -20100 5e/pop-to-esi -20101 5b/pop-to-ebx -20102 5a/pop-to-edx -20103 59/pop-to-ecx -20104 58/pop-to-eax -20105 # . epilogue -20106 89/<- %esp 5/r32/ebp -20107 5d/pop-to-ebp -20108 c3/return -20109 -20110 dump-var: # indent: int, v: (addr handle var) -20111 # . prologue -20112 55/push-ebp -20113 89/<- %ebp 4/r32/esp -20114 # . save registers -20115 50/push-eax -20116 53/push-ebx -20117 # eax = v -20118 8b/-> *(ebp+0xc) 0/r32/eax -20119 # -20120 (write-int32-hex-buffered Stderr *eax) -20121 (write-buffered Stderr ",") -20122 (write-int32-hex-buffered Stderr *(eax+4)) -20123 (write-buffered Stderr "->") -20124 (lookup *eax *(eax+4)) -20125 (write-int32-hex-buffered Stderr %eax) -20126 (write-buffered Stderr Newline) -20127 (flush Stderr) -20128 { -20129 3d/compare-eax-and 0/imm32 -20130 0f 84/jump-if-= break/disp32 -20131 (emit-indent Stderr *(ebp+8)) -20132 (write-buffered Stderr "name: ") -20133 89/<- %ebx 0/r32/eax -20134 (write-int32-hex-buffered Stderr *ebx) # Var-name -20135 (write-buffered Stderr ",") -20136 (write-int32-hex-buffered Stderr *(ebx+4)) # Var-name -20137 (write-buffered Stderr "->") -20138 (lookup *ebx *(ebx+4)) # Var-name -20139 (write-int32-hex-buffered Stderr %eax) -20140 { -20141 3d/compare-eax-and 0/imm32 -20142 74/jump-if-= break/disp8 -20143 (write-buffered Stderr Space) -20144 (write-buffered Stderr %eax) -20145 } -20146 (write-buffered Stderr Newline) -20147 (flush Stderr) -20148 (emit-indent Stderr *(ebp+8)) -20149 (write-buffered Stderr "block depth: ") -20150 (write-int32-hex-buffered Stderr *(ebx+0x10)) # Var-block-depth -20151 (write-buffered Stderr Newline) -20152 (flush Stderr) -20153 (emit-indent Stderr *(ebp+8)) -20154 (write-buffered Stderr "stack offset: ") -20155 (write-int32-hex-buffered Stderr *(ebx+0x14)) # Var-offset -20156 (write-buffered Stderr Newline) -20157 (flush Stderr) -20158 (emit-indent Stderr *(ebp+8)) -20159 (write-buffered Stderr "reg: ") -20160 (write-int32-hex-buffered Stderr *(ebx+0x18)) # Var-register -20161 (write-buffered Stderr ",") -20162 (write-int32-hex-buffered Stderr *(ebx+0x1c)) # Var-register -20163 (write-buffered Stderr "->") -20164 (flush Stderr) -20165 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register -20166 (write-int32-hex-buffered Stderr %eax) -20167 { -20168 3d/compare-eax-and 0/imm32 -20169 74/jump-if-= break/disp8 -20170 (write-buffered Stderr Space) -20171 (write-buffered Stderr %eax) -20172 } -20173 (write-buffered Stderr Newline) -20174 (flush Stderr) -20175 } -20176 $dump-var:end: -20177 # . restore registers -20178 5b/pop-to-ebx -20179 58/pop-to-eax -20180 # . epilogue -20181 89/<- %esp 5/r32/ebp -20182 5d/pop-to-ebp -20183 c3/return -20184 -20185 ####################################################### -20186 # Type-checking -20187 ####################################################### -20188 -20189 check-mu-types: # err: (addr buffered-file), ed: (addr exit-descriptor) -20190 # . prologue -20191 55/push-ebp -20192 89/<- %ebp 4/r32/esp -20193 # . save registers -20194 50/push-eax -20195 # var curr/eax: (addr function) = lookup(Program->functions) -20196 (lookup *_Program-functions *_Program-functions->payload) # => eax -20197 { -20198 $check-mu-types:loop: -20199 # if (curr == null) break -20200 3d/compare-eax-and 0/imm32 -20201 0f 84/jump-if-= break/disp32 -20202 +-- 8 lines: #? # dump curr->name ---------------------------------------------------------------------------------------------------------------------------------------------- -20210 (check-mu-function %eax *(ebp+8) *(ebp+0xc)) -20211 # curr = lookup(curr->next) -20212 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax -20213 e9/jump loop/disp32 -20214 } -20215 $check-mu-types:end: -20216 # . restore registers -20217 58/pop-to-eax -20218 # . epilogue -20219 89/<- %esp 5/r32/ebp -20220 5d/pop-to-ebp -20221 c3/return -20222 -20223 check-mu-function: # fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20224 # . prologue -20225 55/push-ebp -20226 89/<- %ebp 4/r32/esp -20227 # . save registers -20228 50/push-eax -20229 56/push-esi -20230 # esi = f -20231 8b/-> *(ebp+8) 6/r32/esi -20232 # outputs -20233 (lookup *(esi+0x10) *(esi+0x14)) # Function-outputs Function-outputs => eax -20234 (check-all-unique-registers %eax %esi *(ebp+0xc) *(ebp+0x10)) -20235 # body -20236 (lookup *(esi+0x18) *(esi+0x1c)) # Function-body Function-body => eax -20237 (check-mu-block %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10)) -20238 # if function has no outputs, we're done -20239 81 7/subop/compare *(esi+0x10) 0/imm32 -20240 74/jump-if-= $check-mu-function:end/disp8 -20241 # some final checks on body -20242 (check-final-stmt-is-return %eax %esi *(ebp+0xc) *(ebp+0x10)) -20243 (check-no-breaks %eax %esi *(ebp+0xc) *(ebp+0x10)) -20244 $check-mu-function:end: -20245 # . restore registers -20246 5e/pop-to-esi -20247 58/pop-to-eax -20248 # . epilogue -20249 89/<- %esp 5/r32/ebp -20250 5d/pop-to-ebp -20251 c3/return -20252 -20253 check-mu-block: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20254 # . prologue -20255 55/push-ebp -20256 89/<- %ebp 4/r32/esp -20257 # . save registers -20258 50/push-eax -20259 # eax = block -20260 8b/-> *(ebp+8) 0/r32/eax -20261 # var stmts/eax: (addr list stmt) = lookup(block->statements) -20262 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax -20263 # -20264 { -20265 $check-mu-block:check-empty: -20266 3d/compare-eax-and 0/imm32 -20267 0f 84/jump-if-= break/disp32 -20268 # emit block->statements -20269 (check-mu-stmt-list %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20270 } -20271 $check-mu-block:end: -20272 # . restore registers -20273 58/pop-to-eax -20274 # . epilogue -20275 89/<- %esp 5/r32/ebp -20276 5d/pop-to-ebp -20277 c3/return -20278 -20279 check-mu-stmt-list: # stmts: (addr list stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20280 # . prologue -20281 55/push-ebp -20282 89/<- %ebp 4/r32/esp -20283 # . save registers -20284 50/push-eax -20285 56/push-esi -20286 # esi = stmts -20287 8b/-> *(ebp+8) 6/r32/esi -20288 { -20289 $check-mu-stmt-list:loop: -20290 81 7/subop/compare %esi 0/imm32 -20291 0f 84/jump-if-= break/disp32 -20292 # var curr-stmt/eax: (addr stmt) = lookup(stmts->value) -20293 (lookup *esi *(esi+4)) # List-value List-value => eax -20294 { -20295 $check-mu-stmt-list:check-for-block: -20296 81 7/subop/compare *eax 0/imm32/block # Stmt-tag -20297 75/jump-if-!= break/disp8 -20298 $check-mu-stmt-list:block: -20299 (check-mu-block %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20300 eb/jump $check-mu-stmt-list:continue/disp8 -20301 } -20302 { -20303 $check-mu-stmt-list:check-for-stmt1: -20304 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag -20305 0f 85/jump-if-!= break/disp32 -20306 $check-mu-stmt-list:stmt1: -20307 (check-mu-stmt %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20308 eb/jump $check-mu-stmt-list:continue/disp8 -20309 } -20310 { -20311 $check-mu-stmt-list:check-for-reg-var-def: -20312 81 7/subop/compare *eax 3/imm32/reg-var-def # Stmt-tag -20313 0f 85/jump-if-!= break/disp32 -20314 $check-mu-stmt-list:reg-var-def: -20315 (check-mu-stmt %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20316 eb/jump $check-mu-stmt-list:continue/disp8 -20317 } -20318 $check-mu-stmt-list:continue: -20319 # TODO: raise an error on unrecognized Stmt-tag -20320 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax -20321 89/<- %esi 0/r32/eax -20322 e9/jump loop/disp32 -20323 } -20324 $check-mu-stmt-list:end: -20325 # . restore registers -20326 5e/pop-to-esi -20327 58/pop-to-eax -20328 # . epilogue -20329 89/<- %esp 5/r32/ebp -20330 5d/pop-to-ebp -20331 c3/return -20332 -20333 check-mu-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20334 # . prologue -20335 55/push-ebp -20336 89/<- %ebp 4/r32/esp -20337 # . save registers -20338 50/push-eax -20339 # - if stmt's operation matches a primitive, check against it -20340 (has-primitive-name? *(ebp+8)) # => eax -20341 3d/compare-eax-and 0/imm32/false -20342 { -20343 74/jump-if-= break/disp8 -20344 (check-mu-primitive *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20345 e9/jump $check-mu-stmt:end/disp32 -20346 } -20347 # - otherwise find a function to check against -20348 # var f/eax: (addr function) = lookup(*Program->functions) -20349 (lookup *_Program-functions *_Program-functions->payload) # => eax -20350 (find-matching-function %eax *(ebp+8)) # => eax -20351 3d/compare-eax-and 0/imm32 -20352 { -20353 74/jump-if-= break/disp8 -20354 (check-mu-call *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20355 eb/jump $check-mu-stmt:end/disp8 -20356 } -20357 # var f/eax: (addr function) = lookup(*Program->signatures) -20358 (lookup *_Program-signatures *_Program-signatures->payload) # => eax -20359 (find-matching-function %eax *(ebp+8)) # => eax -20360 3d/compare-eax-and 0/imm32 -20361 { -20362 74/jump-if-= break/disp8 -20363 (check-mu-call *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20364 eb/jump $check-mu-stmt:end/disp8 -20365 } -20366 # - otherwise abort -20367 e9/jump $check-mu-stmt:unknown-call/disp32 -20368 $check-mu-stmt:end: -20369 # . restore registers -20370 58/pop-to-eax -20371 # . epilogue -20372 89/<- %esp 5/r32/ebp -20373 5d/pop-to-ebp -20374 c3/return -20375 -20376 $check-mu-stmt:unknown-call: -20377 (write-buffered *(ebp+0x10) "unknown function '") -20378 8b/-> *(ebp+8) 0/r32/eax -20379 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -20380 (write-buffered *(ebp+0x10) %eax) -20381 (write-buffered *(ebp+0x10) "'\n") -20382 (flush *(ebp+0x10)) -20383 (stop *(ebp+0x14) 1) -20384 # never gets here -20385 -20386 has-primitive-name?: # stmt: (addr stmt) -> result/eax: boolean -20387 # . prologue -20388 55/push-ebp -20389 89/<- %ebp 4/r32/esp -20390 # . save registers -20391 51/push-ecx -20392 56/push-esi -20393 # var name/esi: (addr array byte) = lookup(stmt->operation) -20394 8b/-> *(ebp+8) 6/r32/esi -20395 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax -20396 89/<- %esi 0/r32/eax -20397 # if (name == "return") return true -20398 (string-equal? %esi "return") # => eax -20399 3d/compare-eax-and 0/imm32/false -20400 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20401 # if (name == "get") return true -20402 (string-equal? %esi "get") # => eax -20403 3d/compare-eax-and 0/imm32/false -20404 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20405 # if (name == "index") return true -20406 (string-equal? %esi "index") # => eax -20407 3d/compare-eax-and 0/imm32/false -20408 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20409 # if (name == "length") return true -20410 (string-equal? %esi "length") # => eax -20411 3d/compare-eax-and 0/imm32/false -20412 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20413 # if (name == "compute-offset") return true -20414 (string-equal? %esi "compute-offset") # => eax -20415 3d/compare-eax-and 0/imm32/false -20416 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20417 # if (name == "copy-object") return true -20418 (string-equal? %esi "copy-object") # => eax -20419 3d/compare-eax-and 0/imm32/false -20420 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20421 # if (name == "clear-object") return true -20422 (string-equal? %esi "clear-object") # => eax -20423 3d/compare-eax-and 0/imm32/false -20424 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20425 # if (name == "allocate") return true -20426 (string-equal? %esi "allocate") # => eax -20427 3d/compare-eax-and 0/imm32/false -20428 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20429 # if (name == "populate") return true -20430 (string-equal? %esi "populate") # => eax -20431 3d/compare-eax-and 0/imm32/false -20432 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20433 # if (name == "populate-stream") return true -20434 (string-equal? %esi "populate-stream") # => eax -20435 3d/compare-eax-and 0/imm32/false -20436 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20437 # if (name == "read-from-stream") return true -20438 (string-equal? %esi "read-from-stream") # => eax -20439 3d/compare-eax-and 0/imm32/false -20440 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20441 # if (name == "write-to-stream") return true -20442 (string-equal? %esi "write-to-stream") # => eax -20443 3d/compare-eax-and 0/imm32/false -20444 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -20445 # var curr/ecx: (addr primitive) = Primitives -20446 b9/copy-to-ecx Primitives/imm32 -20447 { -20448 $has-primitive-name?:loop: -20449 # if (curr == null) break -20450 81 7/subop/compare %ecx 0/imm32 -20451 74/jump-if-= break/disp8 -20452 # if (primitive->name == name) return true -20453 (lookup *ecx *(ecx+4)) # Primitive-name Primitive-name => eax -20454 #? (write-buffered Stderr %eax) -20455 #? (write-buffered Stderr Newline) -20456 #? (flush Stderr) -20457 (string-equal? %esi %eax) # => eax -20458 3d/compare-eax-and 0/imm32/false -20459 75/jump-if-!= $has-primitive-name?:end/disp8 -20460 $has-primitive-name?:next-primitive: -20461 # curr = curr->next -20462 (lookup *(ecx+0x3c) *(ecx+0x40)) # Primitive-next Primitive-next => eax -20463 89/<- %ecx 0/r32/eax -20464 # -20465 e9/jump loop/disp32 -20466 } -20467 # return null -20468 b8/copy-to-eax 0/imm32 -20469 $has-primitive-name?:end: -20470 # . restore registers -20471 5e/pop-to-esi -20472 59/pop-to-ecx -20473 # . epilogue -20474 89/<- %esp 5/r32/ebp -20475 5d/pop-to-ebp -20476 c3/return -20477 -20478 check-mu-primitive: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20479 # . prologue -20480 55/push-ebp -20481 89/<- %ebp 4/r32/esp -20482 # . save registers -20483 50/push-eax -20484 51/push-ecx -20485 # var op/ecx: (addr array byte) = lookup(stmt->operation) -20486 8b/-> *(ebp+8) 0/r32/eax -20487 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -20488 89/<- %ecx 0/r32/eax -20489 # if (op == "copy") check-mu-copy-stmt -20490 { -20491 (string-equal? %ecx "copy") # => eax -20492 3d/compare-eax-and 0/imm32/false -20493 74/jump-if-= break/disp8 -20494 (check-mu-copy-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20495 e9/jump $check-mu-primitive:end/disp32 -20496 } -20497 # if (op == "copy-to") check-mu-copy-to-stmt -20498 { -20499 (string-equal? %ecx "copy-to") # => eax -20500 3d/compare-eax-and 0/imm32/false -20501 74/jump-if-= break/disp8 -20502 (check-mu-copy-to-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20503 e9/jump $check-mu-primitive:end/disp32 -20504 } -20505 # if (op == "compare") check-mu-compare-stmt -20506 { -20507 (string-equal? %ecx "compare") # => eax -20508 3d/compare-eax-and 0/imm32/false -20509 74/jump-if-= break/disp8 -20510 (check-mu-compare-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20511 e9/jump $check-mu-primitive:end/disp32 -20512 } -20513 # if (op == "address") check-mu-address-stmt -20514 { -20515 (string-equal? %ecx "address") # => eax -20516 3d/compare-eax-and 0/imm32/false -20517 74/jump-if-= break/disp8 -20518 (check-mu-address-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20519 e9/jump $check-mu-primitive:end/disp32 -20520 } -20521 # if (op == "return") check-mu-return-stmt -20522 { -20523 (string-equal? %ecx "return") # => eax -20524 3d/compare-eax-and 0/imm32/false -20525 74/jump-if-= break/disp8 -20526 (check-mu-return-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20527 e9/jump $check-mu-primitive:end/disp32 -20528 } -20529 # if (op == "get") check-mu-get-stmt -20530 { -20531 (string-equal? %ecx "get") # => eax -20532 3d/compare-eax-and 0/imm32/false -20533 74/jump-if-= break/disp8 -20534 (check-mu-get-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20535 e9/jump $check-mu-primitive:end/disp32 -20536 } -20537 # if (op == "index") check-mu-index-stmt -20538 { -20539 (string-equal? %ecx "index") # => eax -20540 3d/compare-eax-and 0/imm32/false -20541 74/jump-if-= break/disp8 -20542 (check-mu-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20543 e9/jump $check-mu-primitive:end/disp32 -20544 } -20545 # if (op == "length") check-mu-length-stmt -20546 { -20547 (string-equal? %ecx "length") # => eax -20548 3d/compare-eax-and 0/imm32/false -20549 74/jump-if-= break/disp8 -20550 (check-mu-length-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20551 e9/jump $check-mu-primitive:end/disp32 -20552 } -20553 # if (op == "compute-offset") check-mu-compute-offset-stmt -20554 { -20555 (string-equal? %ecx "compute-offset") # => eax -20556 3d/compare-eax-and 0/imm32/false -20557 74/jump-if-= break/disp8 -20558 (check-mu-compute-offset-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20559 e9/jump $check-mu-primitive:end/disp32 -20560 } -20561 # if (op == "copy-object") check-mu-copy-object-stmt -20562 { -20563 (string-equal? %ecx "copy-object") # => eax -20564 3d/compare-eax-and 0/imm32/false -20565 74/jump-if-= break/disp8 -20566 (check-mu-copy-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20567 e9/jump $check-mu-primitive:end/disp32 -20568 } -20569 # if (op == "clear-object") check-mu-clear-object-stmt -20570 { -20571 (string-equal? %ecx "clear-object") # => eax -20572 3d/compare-eax-and 0/imm32/false -20573 74/jump-if-= break/disp8 -20574 (check-mu-clear-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20575 e9/jump $check-mu-primitive:end/disp32 -20576 } -20577 # if (op == "allocate") check-mu-allocate-stmt -20578 { -20579 (string-equal? %ecx "allocate") # => eax -20580 3d/compare-eax-and 0/imm32/false -20581 74/jump-if-= break/disp8 -20582 (check-mu-allocate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20583 e9/jump $check-mu-primitive:end/disp32 -20584 } -20585 # if (op == "populate") check-mu-populate-stmt -20586 { -20587 (string-equal? %ecx "populate") # => eax -20588 3d/compare-eax-and 0/imm32/false -20589 74/jump-if-= break/disp8 -20590 (check-mu-populate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20591 e9/jump $check-mu-primitive:end/disp32 -20592 } -20593 # if (op == "populate-stream") check-mu-populate-stream-stmt -20594 { -20595 (string-equal? %ecx "populate-stream") # => eax -20596 3d/compare-eax-and 0/imm32/false -20597 74/jump-if-= break/disp8 -20598 (check-mu-populate-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20599 e9/jump $check-mu-primitive:end/disp32 -20600 } -20601 # if (op == "read-from-stream") check-mu-read-from-stream-stmt -20602 { -20603 (string-equal? %ecx "read-from-stream") # => eax -20604 3d/compare-eax-and 0/imm32/false -20605 74/jump-if-= break/disp8 -20606 (check-mu-read-from-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20607 e9/jump $check-mu-primitive:end/disp32 -20608 } -20609 # if (op == "write-to-stream") check-mu-write-to-stream-stmt -20610 { -20611 (string-equal? %ecx "write-to-stream") # => eax -20612 3d/compare-eax-and 0/imm32/false -20613 74/jump-if-= break/disp8 -20614 (check-mu-write-to-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20615 e9/jump $check-mu-primitive:end/disp32 -20616 } -20617 # if (op == "convert") check-mu-convert-stmt -20618 { -20619 (string-equal? %ecx "convert") # => eax -20620 3d/compare-eax-and 0/imm32/false -20621 74/jump-if-= break/disp8 -20622 (check-mu-convert-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20623 e9/jump $check-mu-primitive:end/disp32 -20624 } -20625 # otherwise check-numberlike-stmt -20626 (check-mu-numberlike-primitive *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20627 $check-mu-primitive:end: -20628 # . restore registers -20629 59/pop-to-ecx -20630 58/pop-to-eax -20631 # . epilogue -20632 89/<- %esp 5/r32/ebp -20633 5d/pop-to-ebp -20634 c3/return -20635 -20636 # by default, Mu primitives should only operate on 'number-like' types -20637 check-mu-numberlike-primitive: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20638 # . prologue -20639 55/push-ebp -20640 89/<- %ebp 4/r32/esp -20641 # . save registers -20642 50/push-eax -20643 51/push-ecx -20644 56/push-esi -20645 # esi = stmt -20646 8b/-> *(ebp+8) 6/r32/esi -20647 # var gas/ecx: int = 2 -20648 b9/copy-to-ecx 2/imm32 -20649 # - check at most 1 output -20650 # var output/eax: (addr stmt-var) = stmt->outputs -20651 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -20652 { -20653 3d/compare-eax-and 0/imm32 -20654 74/jump-if-= break/disp8 -20655 $check-mu-numberlike-primitive:output: -20656 (check-mu-numberlike-output %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20657 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20658 3d/compare-eax-and 0/imm32 -20659 0f 85/jump-if-!= $check-mu-numberlike-primitive:error-too-many-outputs/disp32 -20660 # check output is in a register -20661 # --gas -20662 49/decrement-ecx -20663 } -20664 # - check first inout -20665 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20666 { -20667 3d/compare-eax-and 0/imm32 -20668 0f 84/jump-if-= $check-mu-numberlike-primitive:end/disp32 -20669 $check-mu-numberlike-primitive:first-inout: -20670 (check-mu-numberlike-arg %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20671 # --gas -20672 49/decrement-ecx -20673 } -20674 # - check second inout -20675 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20676 { -20677 3d/compare-eax-and 0/imm32 -20678 74/jump-if-= $check-mu-numberlike-primitive:end/disp8 -20679 $check-mu-numberlike-primitive:second-inout: -20680 # is a second inout allowed? -20681 81 7/subop/compare %ecx 0/imm32 -20682 0f 84/jump-if-= $check-mu-numberlike-primitive:error-too-many-inouts/disp32 -20683 $check-mu-numberlike-primitive:second-inout-permitted: -20684 (check-mu-numberlike-arg %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20685 } -20686 $check-mu-numberlike-primitive:third-inout: -20687 # if there's a third arg, raise an error -20688 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next -20689 0f 85/jump-if-!= $check-mu-numberlike-primitive:error-too-many-inouts/disp32 -20690 $check-mu-numberlike-primitive:end: -20691 # . restore registers -20692 5e/pop-to-esi -20693 59/pop-to-ecx -20694 58/pop-to-eax -20695 # . epilogue -20696 89/<- %esp 5/r32/ebp -20697 5d/pop-to-ebp -20698 c3/return -20699 -20700 $check-mu-numberlike-primitive:error-too-many-inouts: -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 ") -20706 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax -20707 (write-buffered *(ebp+0x10) %eax) -20708 (write-buffered *(ebp+0x10) ": too many inouts; most primitives support at most two arguments, across inouts and outputs\n") -20709 (flush *(ebp+0x10)) -20710 (stop *(ebp+0x14) 1) -20711 # never gets here -20712 -20713 $check-mu-numberlike-primitive:error-too-many-outputs: -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 ") -20719 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax -20720 (write-buffered *(ebp+0x10) %eax) -20721 (write-buffered *(ebp+0x10) ": too many outputs; most primitives support at most one output\n") -20722 (flush *(ebp+0x10)) -20723 (stop *(ebp+0x14) 1) -20724 # never gets here -20725 -20726 check-mu-numberlike-arg: # v: (addr stmt-var), stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20727 # . prologue -20728 55/push-ebp -20729 89/<- %ebp 4/r32/esp -20730 # . save registers -20731 50/push-eax -20732 56/push-esi -20733 # var t/esi: (addr type-tree) = lookup(v->value->type) -20734 8b/-> *(ebp+8) 0/r32/eax -20735 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20736 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -20737 89/<- %esi 0/r32/eax -20738 $check-mu-numberlike-arg:check-literal: -20739 # if t is an int, return -20740 (is-simple-mu-type? %esi 0) # literal => eax -20741 3d/compare-eax-and 0/imm32/false -20742 0f 85/jump-if-!= $check-mu-numberlike-arg:end/disp32 -20743 $check-mu-numberlike-arg:check-addr: -20744 # if t is an addr and v is dereferenced, return whether t->payload is an addr -20745 { -20746 (is-mu-addr-type? %esi) # => eax -20747 3d/compare-eax-and 0/imm32/false -20748 74/jump-if-= break/disp8 -20749 8b/-> *(ebp+8) 0/r32/eax -20750 8b/-> *(eax+0x10) 0/r32/eax # Stmt-var-is-deref -20751 3d/compare-eax-and 0/imm32/false -20752 { -20753 74/jump-if-= break/disp8 -20754 (lookup *(esi+0xc) *(esi+0x10)) # Type-tree-right Type-tree-right => eax -20755 # if t->right is null, t = t->left -20756 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -20757 { -20758 75/jump-if-!= break/disp8 -20759 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -20760 } -20761 (is-mu-addr-type? %eax) # => eax -20762 3d/compare-eax-and 0/imm32/false -20763 74/jump-if-= $check-mu-numberlike-arg:end/disp8 -20764 } -20765 } -20766 $check-mu-numberlike-arg:output-checks: -20767 (check-mu-numberlike-output *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) -20768 $check-mu-numberlike-arg:end: -20769 # . restore registers -20770 5e/pop-to-esi -20771 58/pop-to-eax -20772 # . epilogue -20773 89/<- %esp 5/r32/ebp -20774 5d/pop-to-ebp -20775 c3/return -20776 -20777 check-mu-numberlike-output: # v: (addr stmt-var), stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20778 # . prologue -20779 55/push-ebp -20780 89/<- %ebp 4/r32/esp -20781 # . save registers -20782 50/push-eax -20783 # -20784 (is-mu-numberlike-output-var? *(ebp+8)) # => eax -20785 3d/compare-eax-and 0/imm32/false -20786 0f 84/jump-if-= $check-mu-numberlike-output:fail/disp32 -20787 $check-mu-numberlike-output:end: -20788 # . restore registers -20789 58/pop-to-eax -20790 # . epilogue -20791 89/<- %esp 5/r32/ebp -20792 5d/pop-to-ebp -20793 c3/return -20794 -20795 $check-mu-numberlike-output:fail: -20796 # otherwise raise an error -20797 (write-buffered *(ebp+0x14) "fn ") -20798 8b/-> *(ebp+0x10) 0/r32/eax -20799 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20800 (write-buffered *(ebp+0x14) %eax) -20801 (write-buffered *(ebp+0x14) ": stmt ") -20802 8b/-> *(ebp+0xc) 0/r32/eax -20803 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -20804 (write-buffered *(ebp+0x14) %eax) -20805 (write-buffered *(ebp+0x14) ": '") -20806 8b/-> *(ebp+8) 0/r32/eax -20807 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20808 (lookup *eax *(eax+4)) # Var-name Var-name => eax -20809 (write-buffered *(ebp+0x14) %eax) -20810 (write-buffered *(ebp+0x14) "' must be a non-addr non-offset scalar\n") -20811 (flush *(ebp+0x14)) -20812 (stop *(ebp+0x18) 1) -20813 # never gets here -20814 -20815 is-mu-numberlike-output-var?: # v: (addr stmt-var) -> result/eax: boolean -20816 # . prologue -20817 55/push-ebp -20818 89/<- %ebp 4/r32/esp -20819 # -20820 8b/-> *(ebp+8) 0/r32/eax -20821 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20822 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -20823 (is-mu-numberlike-output? %eax) # => eax -20824 $is-mu-numberlike-output-var?:end: -20825 # . epilogue -20826 89/<- %esp 5/r32/ebp -20827 5d/pop-to-ebp -20828 c3/return -20829 -20830 is-mu-numberlike-output?: # v: (addr type-tree) -> result/eax: boolean -20831 # . prologue -20832 55/push-ebp -20833 89/<- %ebp 4/r32/esp -20834 # . save registers -20835 56/push-esi -20836 # var t/esi: (addr type-tree) = lookup(v->value->type) -20837 8b/-> *(ebp+8) 6/r32/esi -20838 $is-mu-numberlike-output?:check-int: -20839 # if t is an int, return -20840 (is-simple-mu-type? %esi 1) # int => eax -20841 3d/compare-eax-and 0/imm32/false -20842 0f 85/jump-if-!= $is-mu-numberlike-output?:return-true/disp32 -20843 $is-mu-numberlike-output?:check-float: -20844 # if t is a float, return -20845 (is-simple-mu-type? %esi 0xf) # float => eax -20846 3d/compare-eax-and 0/imm32/false -20847 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 -20848 $is-mu-numberlike-output?:check-boolean: -20849 # if t is a boolean, return -20850 (is-simple-mu-type? %esi 5) # boolean => eax -20851 3d/compare-eax-and 0/imm32/false -20852 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 -20853 $is-mu-numberlike-output?:check-byte: -20854 # if t is a byte, return -20855 (is-simple-mu-type? %esi 8) # byte => eax -20856 3d/compare-eax-and 0/imm32/false -20857 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 -20858 $is-mu-numberlike-output?:check-code-point: -20859 # if t is a code-point, return -20860 (is-simple-mu-type? %esi 0xd) # code-point => eax -20861 3d/compare-eax-and 0/imm32/false -20862 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 -20863 $is-mu-numberlike-output?:check-grapheme: -20864 # if t is a grapheme, return -20865 (is-simple-mu-type? %esi 0xe) # grapheme => eax -20866 3d/compare-eax-and 0/imm32/false -20867 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 -20868 $is-mu-numberlike-output?:return-false: -20869 b8/copy-to-eax 0/imm32/false -20870 eb/jump $is-mu-numberlike-output?:end/disp8 -20871 $is-mu-numberlike-output?:return-true: -20872 b8/copy-to-eax 1/imm32/true -20873 $is-mu-numberlike-output?:end: -20874 # . restore registers -20875 5e/pop-to-esi -20876 # . epilogue -20877 89/<- %esp 5/r32/ebp -20878 5d/pop-to-ebp -20879 c3/return -20880 -20881 check-mu-copy-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20882 # . prologue -20883 55/push-ebp -20884 89/<- %ebp 4/r32/esp -20885 # . save registers -20886 50/push-eax -20887 51/push-ecx -20888 52/push-edx -20889 56/push-esi -20890 57/push-edi -20891 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) -20892 81 5/subop/subtract %esp 0x60/imm32 -20893 68/push 0x60/imm32/size -20894 68/push 0/imm32/read -20895 68/push 0/imm32/write -20896 89/<- %edx 4/r32/esp -20897 $check-mu-copy-stmt:get-output: -20898 # esi = stmt -20899 8b/-> *(ebp+8) 6/r32/esi -20900 # var output/edi: (addr stmt-var) = stmt->outputs -20901 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -20902 89/<- %edi 0/r32/eax -20903 # zero outputs -20904 3d/compare-eax-and 0/imm32 -20905 0f 84/jump-if-= $check-mu-copy-stmt:error-no-output/disp32 -20906 # > 1 output -20907 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -20908 3d/compare-eax-and 0/imm32 -20909 0f 85/jump-if-!= $check-mu-copy-stmt:error-too-many-outputs/disp32 -20910 $check-mu-copy-stmt:get-inout: -20911 # var inout/esi: (addr stmt-var) = stmt->inouts -20912 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20913 89/<- %esi 0/r32/eax -20914 # zero inouts -20915 3d/compare-eax-and 0/imm32 -20916 0f 84/jump-if-= $check-mu-copy-stmt:error-no-inout/disp32 -20917 # > 1 inout -20918 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -20919 3d/compare-eax-and 0/imm32 -20920 0f 85/jump-if-!= $check-mu-copy-stmt:error-too-many-inouts/disp32 -20921 $check-mu-copy-stmt:types: -20922 # var inout-type/ecx: (addr type-tree) = inout->value->type -20923 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -20924 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -20925 89/<- %ecx 0/r32/eax -20926 # if (inout->is-deref?) inout-type = inout-type->payload -20927 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref -20928 3d/compare-eax-and 0/imm32/false -20929 { -20930 74/jump-if-= break/disp8 -20931 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -20932 # if inout-type->right is null, t = inout-type->left -20933 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -20934 { -20935 75/jump-if-!= break/disp8 -20936 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -20937 } -20938 89/<- %ecx 0/r32/eax -20939 } -20940 # if output not in register, abort -20941 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -20942 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -20943 3d/compare-eax-and 0/imm32 -20944 0f 84/jump-if-= $check-mu-copy-stmt:error-output-not-in-register/disp32 -20945 # if inout is not a scalar, abort -20946 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -20947 (size-of %eax) # => eax -20948 3d/compare-eax-and 4/imm32 -20949 0f 8f/jump-if-> $check-mu-copy-stmt:error-inout-too-large/disp32 -20950 # var output-type/eax: (addr type-tree) = output->value->type -20951 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -20952 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -20953 # if (inout-type == output-type) return -20954 (type-match? %eax %ecx %edx) # => eax -20955 3d/compare-eax-and 0/imm32 -20956 0f 85/jump-if-!= $check-mu-copy-stmt:end/disp32 -20957 # if output is an addr and inout is 0, return -20958 { -20959 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -20960 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -20961 (is-mu-addr-type? %eax) # => eax -20962 3d/compare-eax-and 0/imm32/false -20963 74/jump-if-= break/disp8 -20964 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -20965 (lookup *eax *(eax+4)) # Var-name Var-name => eax -20966 (string-equal? %eax "0") # => eax -20967 3d/compare-eax-and 0/imm32/false -20968 74/jump-if-= break/disp8 -20969 e9/jump $check-mu-copy-stmt:end/disp32 -20970 } -20971 # if output is an offset and inout is 0, return -20972 { -20973 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -20974 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -20975 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -20976 75/jump-if-!= break/disp8 -20977 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -20978 (is-simple-mu-type? %eax 7) # offset => eax -20979 3d/compare-eax-and 0/imm32/false -20980 74/jump-if-= break/disp8 -20981 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -20982 (lookup *eax *(eax+4)) # Var-name Var-name => eax -20983 (string-equal? %eax "0") # => eax -20984 3d/compare-eax-and 0/imm32/false -20985 74/jump-if-= break/disp8 -20986 eb/jump $check-mu-copy-stmt:end/disp8 -20987 } -20988 # if output is not number-like, abort -20989 (check-mu-numberlike-output %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -20990 $check-mu-copy-stmt:end: -20991 # . reclaim locals -20992 81 0/subop/add %esp 0x6c/imm32 -20993 # . restore registers -20994 5f/pop-to-edi -20995 5e/pop-to-esi -20996 5a/pop-to-edx -20997 59/pop-to-ecx -20998 58/pop-to-eax -20999 # . epilogue -21000 89/<- %esp 5/r32/ebp -21001 5d/pop-to-ebp -21002 c3/return -21003 -21004 $check-mu-copy-stmt:error-no-inout: -21005 (write-buffered *(ebp+0x10) "fn ") -21006 8b/-> *(ebp+0xc) 0/r32/eax -21007 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21008 (write-buffered *(ebp+0x10) %eax) -21009 (write-buffered *(ebp+0x10) ": stmt 'copy' expects an inout\n") -21010 (flush *(ebp+0x10)) -21011 (stop *(ebp+0x14) 1) -21012 # never gets here -21013 -21014 $check-mu-copy-stmt:error-too-many-inouts: -21015 (write-buffered *(ebp+0x10) "fn ") -21016 8b/-> *(ebp+0xc) 0/r32/eax -21017 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21018 (write-buffered *(ebp+0x10) %eax) -21019 (write-buffered *(ebp+0x10) ": stmt 'copy' must have just one inout\n") -21020 (flush *(ebp+0x10)) -21021 (stop *(ebp+0x14) 1) -21022 # never gets here -21023 -21024 $check-mu-copy-stmt:error-no-output: -21025 (write-buffered *(ebp+0x10) "fn ") -21026 8b/-> *(ebp+0xc) 0/r32/eax -21027 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21028 (write-buffered *(ebp+0x10) %eax) -21029 (write-buffered *(ebp+0x10) ": stmt 'copy' expects an output\n") -21030 (flush *(ebp+0x10)) -21031 (stop *(ebp+0x14) 1) -21032 # never gets here -21033 -21034 $check-mu-copy-stmt:error-output-not-in-register: -21035 (write-buffered *(ebp+0x10) "fn ") -21036 8b/-> *(ebp+0xc) 0/r32/eax -21037 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21038 (write-buffered *(ebp+0x10) %eax) -21039 (write-buffered *(ebp+0x10) ": stmt copy: output '") -21040 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21041 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21042 (write-buffered *(ebp+0x10) %eax) -21043 (write-buffered *(ebp+0x10) "' not in a register\n") -21044 (flush *(ebp+0x10)) -21045 (stop *(ebp+0x14) 1) -21046 # never gets here -21047 -21048 $check-mu-copy-stmt:error-too-many-outputs: -21049 (write-buffered *(ebp+0x10) "fn ") -21050 8b/-> *(ebp+0xc) 0/r32/eax -21051 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21052 (write-buffered *(ebp+0x10) %eax) -21053 (write-buffered *(ebp+0x10) ": stmt 'copy' must have just one output\n") -21054 (flush *(ebp+0x10)) -21055 (stop *(ebp+0x14) 1) -21056 # never gets here -21057 -21058 $check-mu-copy-stmt:error-inout-too-large: -21059 (write-buffered *(ebp+0x10) "fn ") -21060 8b/-> *(ebp+0xc) 0/r32/eax -21061 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21062 (write-buffered *(ebp+0x10) %eax) -21063 (write-buffered *(ebp+0x10) ": stmt copy: '") -21064 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21065 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21066 (write-buffered *(ebp+0x10) %eax) -21067 (write-buffered *(ebp+0x10) "' is too large to fit in a register\n") -21068 (flush *(ebp+0x10)) -21069 (stop *(ebp+0x14) 1) -21070 # never gets here -21071 -21072 check-mu-copy-to-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -21073 # . prologue -21074 55/push-ebp -21075 89/<- %ebp 4/r32/esp -21076 # . save registers -21077 50/push-eax -21078 51/push-ecx -21079 52/push-edx -21080 53/push-ebx -21081 56/push-esi -21082 57/push-edi -21083 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) -21084 81 5/subop/subtract %esp 0x60/imm32 -21085 68/push 0x60/imm32/size -21086 68/push 0/imm32/read -21087 68/push 0/imm32/write -21088 89/<- %edx 4/r32/esp -21089 # esi = stmt -21090 8b/-> *(ebp+8) 6/r32/esi -21091 $check-mu-copy-to-stmt:check-for-output: -21092 # if stmt->outputs abort -21093 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -21094 3d/compare-eax-and 0/imm32 -21095 0f 85/jump-if-!= $check-mu-copy-to-stmt:error-too-many-outputs/disp32 -21096 $check-mu-copy-to-stmt:get-dest: -21097 # var dest/edi: (addr stmt-var) = stmt->inouts -21098 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21099 89/<- %edi 0/r32/eax -21100 # zero inouts -21101 3d/compare-eax-and 0/imm32 -21102 0f 84/jump-if-= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 -21103 $check-mu-copy-to-stmt:get-src: -21104 # var src/esi: (addr stmt-var) = dest->next -21105 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -21106 89/<- %esi 0/r32/eax -21107 # 1 inout -21108 3d/compare-eax-and 0/imm32 -21109 0f 84/jump-if-= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 -21110 # > 2 inouts -21111 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -21112 3d/compare-eax-and 0/imm32 -21113 0f 85/jump-if-!= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 -21114 $check-mu-copy-to-stmt:types: -21115 # var src-type/ecx: (addr type-tree) = src->value->type -21116 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21117 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21118 89/<- %ecx 0/r32/eax -21119 # if src not in register or literal, abort -21120 # (we can't use stack-offset because it hasn't been computed yet) -21121 { -21122 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21123 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax -21124 (is-simple-mu-type? %eax 0) # => eax -21125 3d/compare-eax-and 0/imm32 -21126 75/jump-if-!= break/disp8 -21127 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21128 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -21129 3d/compare-eax-and 0/imm32 -21130 75/jump-if-!= break/disp8 -21131 e9/jump $check-mu-copy-to-stmt:error-src-not-literal-or-in-register/disp32 -21132 } -21133 # if src is not a scalar, abort -21134 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21135 (size-of %eax) # => eax -21136 3d/compare-eax-and 4/imm32 -21137 0f 8f/jump-if-> $check-mu-copy-to-stmt:error-src-too-large/disp32 -21138 # var dest-type/ebx: (addr type-tree) = dest->value->type -21139 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21140 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21141 89/<- %ebx 0/r32/eax -21142 # if (dest->is-deref?) dest-type = dest-type->payload -21143 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -21144 3d/compare-eax-and 0/imm32/false -21145 { -21146 74/jump-if-= break/disp8 -21147 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21148 # if dest-type->right is null, dest-type = dest-type->left -21149 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -21150 { -21151 75/jump-if-!= break/disp8 -21152 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21153 } -21154 89/<- %ebx 0/r32/eax -21155 } -21156 # if (src-type == dest-type) return -21157 (type-match? %ebx %ecx %edx) # => eax -21158 3d/compare-eax-and 0/imm32 -21159 0f 85/jump-if-!= $check-mu-copy-to-stmt:end/disp32 -21160 # if dest is an addr and src is 0, return -21161 { -21162 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21163 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21164 (is-mu-addr-type? %eax) # => eax -21165 3d/compare-eax-and 0/imm32/false -21166 74/jump-if-= break/disp8 -21167 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21168 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21169 (string-equal? %eax "0") # => eax -21170 3d/compare-eax-and 0/imm32/false -21171 74/jump-if-= break/disp8 -21172 eb/jump $check-mu-copy-to-stmt:end/disp8 -21173 } -21174 # if dest is not number-like, abort -21175 (check-mu-numberlike-arg %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -21176 $check-mu-copy-to-stmt:end: -21177 # . reclaim locals -21178 81 0/subop/add %esp 0x6c/imm32 -21179 # . restore registers -21180 5f/pop-to-edi -21181 5e/pop-to-esi -21182 5b/pop-to-ebx -21183 5a/pop-to-edx -21184 59/pop-to-ecx -21185 58/pop-to-eax -21186 # . epilogue -21187 89/<- %esp 5/r32/ebp -21188 5d/pop-to-ebp -21189 c3/return -21190 -21191 $check-mu-copy-to-stmt:error-incorrect-inouts: -21192 (write-buffered *(ebp+0x10) "fn ") -21193 8b/-> *(ebp+0xc) 0/r32/eax -21194 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21195 (write-buffered *(ebp+0x10) %eax) -21196 (write-buffered *(ebp+0x10) ": stmt 'copy-to' must have two inouts\n") -21197 (flush *(ebp+0x10)) -21198 (stop *(ebp+0x14) 1) -21199 # never gets here -21200 -21201 $check-mu-copy-to-stmt:error-too-many-outputs: -21202 (write-buffered *(ebp+0x10) "fn ") -21203 8b/-> *(ebp+0xc) 0/r32/eax -21204 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21205 (write-buffered *(ebp+0x10) %eax) -21206 (write-buffered *(ebp+0x10) ": stmt 'copy-to' must not have any outputs\n") -21207 (flush *(ebp+0x10)) -21208 (stop *(ebp+0x14) 1) -21209 # never gets here -21210 -21211 $check-mu-copy-to-stmt:error-src-not-literal-or-in-register: -21212 (write-buffered *(ebp+0x10) "fn ") -21213 8b/-> *(ebp+0xc) 0/r32/eax -21214 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21215 (write-buffered *(ebp+0x10) %eax) -21216 (write-buffered *(ebp+0x10) ": stmt copy-to: source (second inout) is in memory\n") -21217 (flush *(ebp+0x10)) -21218 (stop *(ebp+0x14) 1) -21219 # never gets here -21220 -21221 $check-mu-copy-to-stmt:error-src-too-large: -21222 (write-buffered *(ebp+0x10) "fn ") -21223 8b/-> *(ebp+0xc) 0/r32/eax -21224 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21225 (write-buffered *(ebp+0x10) %eax) -21226 (write-buffered *(ebp+0x10) ": stmt copy-to: '") -21227 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21228 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21229 (write-buffered *(ebp+0x10) %eax) -21230 (write-buffered *(ebp+0x10) "' is too large to copy\n") -21231 (flush *(ebp+0x10)) -21232 (stop *(ebp+0x14) 1) -21233 # never gets here -21234 -21235 check-mu-compare-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -21236 # . prologue -21237 55/push-ebp -21238 89/<- %ebp 4/r32/esp -21239 # . save registers -21240 50/push-eax -21241 51/push-ecx -21242 52/push-edx -21243 53/push-ebx -21244 56/push-esi -21245 57/push-edi -21246 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) -21247 81 5/subop/subtract %esp 0x60/imm32 -21248 68/push 0x60/imm32/size -21249 68/push 0/imm32/read -21250 68/push 0/imm32/write -21251 89/<- %edx 4/r32/esp -21252 # esi = stmt -21253 8b/-> *(ebp+8) 6/r32/esi -21254 $check-mu-compare-stmt:check-for-output: -21255 # if stmt->outputs abort -21256 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -21257 3d/compare-eax-and 0/imm32 -21258 0f 85/jump-if-!= $check-mu-compare-stmt:error-too-many-outputs/disp32 -21259 $check-mu-compare-stmt:get-left: -21260 # var left/edi: (addr stmt-var) = stmt->inouts -21261 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21262 89/<- %edi 0/r32/eax -21263 # zero inouts -21264 3d/compare-eax-and 0/imm32 -21265 0f 84/jump-if-= $check-mu-compare-stmt:error-incorrect-inouts/disp32 -21266 $check-mu-compare-stmt:get-right: -21267 # var right/esi: (addr stmt-var) = left->next -21268 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -21269 89/<- %esi 0/r32/eax -21270 # 1 inout -21271 3d/compare-eax-and 0/imm32 -21272 0f 84/jump-if-= $check-mu-compare-stmt:error-incorrect-inouts/disp32 -21273 # > 2 inouts -21274 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -21275 3d/compare-eax-and 0/imm32 -21276 0f 85/jump-if-!= $check-mu-compare-stmt:error-incorrect-inouts/disp32 -21277 # if both inouts are in memory, abort -21278 { -21279 $check-mu-compare-stmt:both-in-mem: -21280 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21281 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax -21282 (is-simple-mu-type? %eax 0) # => eax -21283 3d/compare-eax-and 0/imm32 -21284 0f 85/jump-if-!= break/disp32 -21285 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21286 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -21287 3d/compare-eax-and 0/imm32 -21288 75/jump-if-!= break/disp8 -21289 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21290 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax -21291 (is-simple-mu-type? %eax 0) # => eax -21292 3d/compare-eax-and 0/imm32 -21293 75/jump-if-!= break/disp8 -21294 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21295 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -21296 3d/compare-eax-and 0/imm32 -21297 75/jump-if-!= break/disp8 -21298 e9/jump $check-mu-compare-stmt:error-both-in-memory/disp32 -21299 } -21300 $check-mu-compare-stmt:types: -21301 # var right-type/ecx: (addr type-tree) = right->value->type -21302 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21303 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21304 89/<- %ecx 0/r32/eax -21305 # if (right->is-deref?) right-type = right-type->payload -21306 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref -21307 3d/compare-eax-and 0/imm32/false -21308 { -21309 74/jump-if-= break/disp8 -21310 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -21311 # if right-type->right is null, right-type = right-type->left -21312 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -21313 { -21314 75/jump-if-!= break/disp8 -21315 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21316 } -21317 89/<- %ecx 0/r32/eax -21318 } -21319 # if right is not a scalar, abort -21320 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21321 (size-of %eax) # => eax -21322 3d/compare-eax-and 4/imm32 -21323 0f 8f/jump-if-> $check-mu-compare-stmt:error-right-too-large/disp32 -21324 # if left is not a scalar, abort -21325 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21326 (size-of %eax) # => eax -21327 3d/compare-eax-and 4/imm32 -21328 0f 8f/jump-if-> $check-mu-compare-stmt:error-left-too-large/disp32 -21329 # var left-type/ebx: (addr type-tree) = left->value->type -21330 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21331 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21332 89/<- %ebx 0/r32/eax -21333 # if (left->is-deref?) left-type = left-type->payload -21334 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -21335 3d/compare-eax-and 0/imm32/false -21336 { -21337 74/jump-if-= break/disp8 -21338 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21339 # if left-type->right is null, left-type = left-type->left -21340 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -21341 { -21342 75/jump-if-!= break/disp8 -21343 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21344 } -21345 89/<- %ebx 0/r32/eax -21346 } -21347 # if (left-type == right-type) return -21348 (type-match? %ebx %ecx %edx) # => eax -21349 3d/compare-eax-and 0/imm32 -21350 0f 85/jump-if-!= $check-mu-compare-stmt:end/disp32 -21351 # if left is an addr and right is 0, return -21352 { -21353 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21354 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21355 (is-mu-addr-type? %eax) # => eax -21356 3d/compare-eax-and 0/imm32/false -21357 74/jump-if-= break/disp8 -21358 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21359 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21360 (string-equal? %eax "0") # => eax -21361 3d/compare-eax-and 0/imm32/false -21362 74/jump-if-= break/disp8 -21363 eb/jump $check-mu-compare-stmt:end/disp8 -21364 } -21365 # if left is not number-like, abort -21366 (check-mu-numberlike-arg %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -21367 $check-mu-compare-stmt:end: -21368 # . reclaim locals -21369 81 0/subop/add %esp 0x6c/imm32 -21370 # . restore registers -21371 5f/pop-to-edi -21372 5e/pop-to-esi -21373 5b/pop-to-ebx -21374 5a/pop-to-edx -21375 59/pop-to-ecx -21376 58/pop-to-eax -21377 # . epilogue -21378 89/<- %esp 5/r32/ebp -21379 5d/pop-to-ebp -21380 c3/return -21381 -21382 $check-mu-compare-stmt:error-incorrect-inouts: -21383 (write-buffered *(ebp+0x10) "fn ") -21384 8b/-> *(ebp+0xc) 0/r32/eax -21385 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21386 (write-buffered *(ebp+0x10) %eax) -21387 (write-buffered *(ebp+0x10) ": stmt 'compare' must have two inouts\n") -21388 (flush *(ebp+0x10)) -21389 (stop *(ebp+0x14) 1) -21390 # never gets here -21391 -21392 $check-mu-compare-stmt:error-too-many-outputs: -21393 (write-buffered *(ebp+0x10) "fn ") -21394 8b/-> *(ebp+0xc) 0/r32/eax -21395 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21396 (write-buffered *(ebp+0x10) %eax) -21397 (write-buffered *(ebp+0x10) ": stmt 'compare' must not have any outputs\n") -21398 (flush *(ebp+0x10)) -21399 (stop *(ebp+0x14) 1) -21400 # never gets here -21401 -21402 $check-mu-compare-stmt:error-both-in-memory: -21403 (write-buffered *(ebp+0x10) "fn ") -21404 8b/-> *(ebp+0xc) 0/r32/eax -21405 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21406 (write-buffered *(ebp+0x10) %eax) -21407 (write-buffered *(ebp+0x10) ": stmt compare: both inouts are in memory\n") -21408 (flush *(ebp+0x10)) -21409 (stop *(ebp+0x14) 1) -21410 # never gets here -21411 -21412 $check-mu-compare-stmt:error-left-too-large: -21413 (write-buffered *(ebp+0x10) "fn ") -21414 8b/-> *(ebp+0xc) 0/r32/eax -21415 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21416 (write-buffered *(ebp+0x10) %eax) -21417 (write-buffered *(ebp+0x10) ": stmt compare: '") -21418 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21419 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21420 (write-buffered *(ebp+0x10) %eax) -21421 (write-buffered *(ebp+0x10) "' is too large to compare\n") -21422 (flush *(ebp+0x10)) -21423 (stop *(ebp+0x14) 1) -21424 # never gets here -21425 -21426 $check-mu-compare-stmt:error-right-too-large: -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 compare: '") -21432 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21433 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21434 (write-buffered *(ebp+0x10) %eax) -21435 (write-buffered *(ebp+0x10) "' is too large to compare\n") -21436 (flush *(ebp+0x10)) -21437 (stop *(ebp+0x14) 1) -21438 # never gets here -21439 -21440 check-mu-address-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -21441 # . prologue -21442 55/push-ebp -21443 89/<- %ebp 4/r32/esp -21444 # . save registers -21445 50/push-eax -21446 51/push-ecx -21447 52/push-edx -21448 56/push-esi -21449 57/push-edi -21450 $check-mu-address-stmt:get-output: -21451 # esi = stmt -21452 8b/-> *(ebp+8) 6/r32/esi -21453 # var output/edi: (addr stmt-var) = stmt->outputs -21454 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -21455 89/<- %edi 0/r32/eax -21456 # zero outputs -21457 3d/compare-eax-and 0/imm32 -21458 0f 84/jump-if-= $check-mu-address-stmt:error-no-output/disp32 -21459 # > 1 output -21460 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -21461 3d/compare-eax-and 0/imm32 -21462 0f 85/jump-if-!= $check-mu-address-stmt:error-too-many-outputs/disp32 -21463 $check-mu-address-stmt:get-inout: -21464 # var inout/esi: (addr stmt-var) = stmt->inouts -21465 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21466 89/<- %esi 0/r32/eax -21467 # zero inouts -21468 3d/compare-eax-and 0/imm32 -21469 0f 84/jump-if-= $check-mu-address-stmt:error-no-inout/disp32 -21470 # > 1 inout -21471 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -21472 3d/compare-eax-and 0/imm32 -21473 0f 85/jump-if-!= $check-mu-address-stmt:error-too-many-inouts/disp32 -21474 $check-mu-address-stmt:types: -21475 # if output not in register, abort -21476 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21477 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -21478 3d/compare-eax-and 0/imm32 -21479 0f 84/jump-if-= $check-mu-address-stmt:error-output-not-in-register/disp32 -21480 # var output-type/edx: (addr type-tree) = output->value->type -21481 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21482 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21483 89/<- %edx 0/r32/eax -21484 # if output-type not an addr, abort -21485 (is-mu-addr-type? %edx) # => eax -21486 3d/compare-eax-and 0/imm32/false -21487 0f 84/jump-if-= $check-mu-address-stmt:error-output-not-address/disp32 -21488 # output-type = output-type->right -21489 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax -21490 # if output-type->right is null, output-type = output-type->left -21491 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +19757 # . epilogue +19758 89/<- %esp 5/r32/ebp +19759 5d/pop-to-ebp +19760 c3/return +19761 +19762 new-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) +19763 # . prologue +19764 55/push-ebp +19765 89/<- %ebp 4/r32/esp +19766 # . save registers +19767 50/push-eax +19768 51/push-ecx +19769 # +19770 (allocate *(ebp+8) *Stmt-size *(ebp+0x14)) +19771 # var out-addr/eax: (addr stmt) = lookup(*out) +19772 8b/-> *(ebp+0x14) 0/r32/eax +19773 (lookup *eax *(eax+4)) # => eax +19774 # out-addr->tag = stmt +19775 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack # Stmt-tag +19776 # result->var = var +19777 8b/-> *(ebp+0xc) 1/r32/ecx +19778 89/<- *(eax+4) 1/r32/ecx # Vardef-var +19779 8b/-> *(ebp+0x10) 1/r32/ecx +19780 89/<- *(eax+8) 1/r32/ecx # Vardef-var +19781 $new-var-def:end: +19782 # . restore registers +19783 59/pop-to-ecx +19784 58/pop-to-eax +19785 # . epilogue +19786 89/<- %esp 5/r32/ebp +19787 5d/pop-to-ebp +19788 c3/return +19789 +19790 new-reg-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) +19791 # . prologue +19792 55/push-ebp +19793 89/<- %ebp 4/r32/esp +19794 # . save registers +19795 50/push-eax +19796 # eax = out +19797 8b/-> *(ebp+0x14) 0/r32/eax +19798 # +19799 (allocate *(ebp+8) *Stmt-size %eax) +19800 # var out-addr/eax: (addr stmt) = lookup(*out) +19801 (lookup *eax *(eax+4)) # => eax +19802 # set tag +19803 c7 0/subop/copy *eax 3/imm32/tag/var-in-register # Stmt-tag +19804 # set output +19805 8d/copy-address *(eax+0x14) 0/r32/eax # Regvardef-outputs +19806 (append-stmt-var Heap *(ebp+0xc) *(ebp+0x10) 0 0 0 %eax) +19807 $new-reg-var-def:end: +19808 # . restore registers +19809 58/pop-to-eax +19810 # . epilogue +19811 89/<- %esp 5/r32/ebp +19812 5d/pop-to-ebp +19813 c3/return +19814 +19815 append-list: # ad: (addr allocation-descriptor), value: (handle _type), list: (handle list _type), out: (addr handle list _type) +19816 # . prologue +19817 55/push-ebp +19818 89/<- %ebp 4/r32/esp +19819 # . save registers +19820 50/push-eax +19821 51/push-ecx +19822 57/push-edi +19823 # edi = out +19824 8b/-> *(ebp+0x1c) 7/r32/edi +19825 # *out = new list +19826 (allocate *(ebp+8) *List-size %edi) +19827 # var out-addr/edi: (addr list _type) = lookup(*out) +19828 (lookup *edi *(edi+4)) # => eax +19829 89/<- %edi 0/r32/eax +19830 # out-addr->value = value +19831 8b/-> *(ebp+0xc) 0/r32/eax +19832 89/<- *edi 0/r32/eax # List-value +19833 8b/-> *(ebp+0x10) 0/r32/eax +19834 89/<- *(edi+4) 0/r32/eax # List-value +19835 # if (list == null) return +19836 81 7/subop/compare *(ebp+0x14) 0/imm32 +19837 74/jump-if-= $append-list:end/disp8 +19838 # otherwise append +19839 $append-list:non-empty-list: +19840 # var curr/eax: (addr list _type) = lookup(list) +19841 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax +19842 # while (curr->next != null) curr = curr->next +19843 { +19844 81 7/subop/compare *(eax+8) 0/imm32 # List-next +19845 74/jump-if-= break/disp8 +19846 # curr = lookup(curr->next) +19847 (lookup *(eax+8) *(eax+0xc)) # List-next, List-next => eax +19848 # +19849 eb/jump loop/disp8 +19850 } +19851 # edi = out +19852 8b/-> *(ebp+0x1c) 7/r32/edi +19853 # curr->next = out +19854 8b/-> *edi 1/r32/ecx +19855 89/<- *(eax+8) 1/r32/ecx # List-next +19856 8b/-> *(edi+4) 1/r32/ecx +19857 89/<- *(eax+0xc) 1/r32/ecx # List-next +19858 # out = list +19859 8b/-> *(ebp+0x14) 1/r32/ecx +19860 89/<- *edi 1/r32/ecx +19861 8b/-> *(ebp+0x18) 1/r32/ecx +19862 89/<- *(edi+4) 1/r32/ecx +19863 $append-list:end: +19864 # . restore registers +19865 5f/pop-to-edi +19866 59/pop-to-ecx +19867 58/pop-to-eax +19868 # . epilogue +19869 89/<- %esp 5/r32/ebp +19870 5d/pop-to-ebp +19871 c3/return +19872 +19873 append-stmt-var: # ad: (addr allocation-descriptor), v: (handle var), vars: (handle stmt-var), is-deref?: boolean, out: (addr handle stmt-var) +19874 # . prologue +19875 55/push-ebp +19876 89/<- %ebp 4/r32/esp +19877 # . save registers +19878 50/push-eax +19879 51/push-ecx +19880 57/push-edi +19881 # edi = out +19882 8b/-> *(ebp+0x20) 7/r32/edi +19883 # out = new stmt-var +19884 (allocate *(ebp+8) *Stmt-var-size %edi) +19885 # var out-addr/ecx: (addr stmt-var) = lookup(*out) +19886 (lookup *edi *(edi+4)) # => eax +19887 89/<- %ecx 0/r32/eax +19888 # out-addr->value = v +19889 8b/-> *(ebp+0xc) 0/r32/eax +19890 89/<- *ecx 0/r32/eax # Stmt-var-value +19891 8b/-> *(ebp+0x10) 0/r32/eax +19892 89/<- *(ecx+4) 0/r32/eax # Stmt-var-value +19893 # out-addr->is-deref? = is-deref? +19894 8b/-> *(ebp+0x1c) 0/r32/eax +19895 89/<- *(ecx+0x10) 0/r32/eax # Stmt-var-is-deref +19896 # if (vars == null) return result +19897 81 7/subop/compare *(ebp+0x14) 0/imm32/null +19898 74/jump-if-= $append-stmt-var:end/disp8 +19899 # otherwise append +19900 # var curr/eax: (addr stmt-var) = lookup(vars) +19901 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax +19902 # while (curr->next != null) curr = curr->next +19903 { +19904 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next +19905 74/jump-if-= break/disp8 +19906 # curr = lookup(curr->next) +19907 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next, Stmt-var-next => eax +19908 # +19909 eb/jump loop/disp8 +19910 } +19911 # curr->next = out +19912 8b/-> *edi 1/r32/ecx +19913 89/<- *(eax+8) 1/r32/ecx # Stmt-var-next +19914 8b/-> *(edi+4) 1/r32/ecx +19915 89/<- *(eax+0xc) 1/r32/ecx # Stmt-var-next +19916 # out = vars +19917 8b/-> *(ebp+0x14) 1/r32/ecx +19918 89/<- *edi 1/r32/ecx +19919 8b/-> *(ebp+0x18) 1/r32/ecx +19920 89/<- *(edi+4) 1/r32/ecx +19921 $append-stmt-var:end: +19922 # . restore registers +19923 5f/pop-to-edi +19924 59/pop-to-ecx +19925 58/pop-to-eax +19926 # . epilogue +19927 89/<- %esp 5/r32/ebp +19928 5d/pop-to-ebp +19929 c3/return +19930 +19931 append-to-block: # ad: (addr allocation-descriptor), block: (addr block), x: (handle stmt) +19932 # . prologue +19933 55/push-ebp +19934 89/<- %ebp 4/r32/esp +19935 # . save registers +19936 50/push-eax +19937 56/push-esi +19938 # esi = block +19939 8b/-> *(ebp+0xc) 6/r32/esi +19940 # block->stmts = append(x, block->stmts) +19941 8d/copy-address *(esi+4) 0/r32/eax # Block-stmts +19942 (append-list *(ebp+8) *(ebp+0x10) *(ebp+0x14) *(esi+4) *(esi+8) %eax) # ad, x, x, Block-stmts, Block-stmts +19943 $append-to-block:end: +19944 # . restore registers +19945 5e/pop-to-esi +19946 58/pop-to-eax +19947 # . epilogue +19948 89/<- %esp 5/r32/ebp +19949 5d/pop-to-ebp +19950 c3/return +19951 +19952 ## Parsing types +19953 # We need to create metadata on user-defined types, and we need to use this +19954 # metadata as we parse instructions. +19955 # However, we also want to allow types to be used before their definitions. +19956 # This means we can't ever assume any type data structures exist. +19957 +19958 lookup-or-create-constant: # container: (addr stmt-var), field-name: (addr slice), out: (addr handle var) +19959 # . prologue +19960 55/push-ebp +19961 89/<- %ebp 4/r32/esp +19962 # . save registers +19963 50/push-eax +19964 56/push-esi +19965 # var container-type/esi: type-id +19966 (container-type *(ebp+8)) # => eax +19967 89/<- %esi 0/r32/eax +19968 # var tmp/eax: (handle typeinfo) = find-or-create-typeinfo(container-type) +19969 68/push 0/imm32 +19970 68/push 0/imm32 +19971 89/<- %eax 4/r32/esp +19972 (find-or-create-typeinfo %esi %eax) +19973 # var tmp-addr/eax: (addr typeinfo) = lookup(tmp) +19974 (lookup *eax *(eax+4)) # => eax +19975 # result = find-or-create-typeinfo-output-var(typeinfo, field-name) +19976 #? (write-buffered Stderr "constant: ") +19977 #? (write-slice-buffered Stderr *(ebp+0xc)) +19978 #? (write-buffered Stderr Newline) +19979 #? (flush Stderr) +19980 (find-or-create-typeinfo-output-var %eax *(ebp+0xc) *(ebp+0x10)) +19981 #? 8b/-> *(ebp+0x10) 0/r32/eax +19982 #? (write-buffered Stderr "@") +19983 #? (lookup *eax *(eax+4)) +19984 #? (write-int32-hex-buffered Stderr %eax) +19985 #? (lookup *eax *(eax+4)) +19986 #? (write-buffered Stderr %eax) +19987 #? (write-buffered Stderr Newline) +19988 #? (flush Stderr) +19989 #? (write-buffered Stderr "offset: ") +19990 #? 8b/-> *(eax+0x14) 0/r32/eax +19991 #? (write-int32-hex-buffered Stderr %eax) +19992 #? (write-buffered Stderr Newline) +19993 #? (flush Stderr) +19994 $lookup-or-create-constant:end: +19995 # . reclaim locals +19996 81 0/subop/add %esp 8/imm32 +19997 # . restore registers +19998 5e/pop-to-esi +19999 58/pop-to-eax +20000 # . epilogue +20001 89/<- %esp 5/r32/ebp +20002 5d/pop-to-ebp +20003 c3/return +20004 +20005 # if addr var: +20006 # container->var->type->right->left->value +20007 # otherwise +20008 # container->var->type->value +20009 container-type: # container: (addr stmt-var) -> result/eax: type-id +20010 # . prologue +20011 55/push-ebp +20012 89/<- %ebp 4/r32/esp +20013 # +20014 8b/-> *(ebp+8) 0/r32/eax +20015 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +20016 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20017 { +20018 81 7/subop/compare *(eax+8) 0/imm32 # Type-tree-right +20019 74/jump-if-= break/disp8 +20020 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +20021 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20022 } +20023 8b/-> *(eax+4) 0/r32/eax # Type-tree-value +20024 $container-type:end: +20025 # . epilogue +20026 89/<- %esp 5/r32/ebp +20027 5d/pop-to-ebp +20028 c3/return +20029 +20030 is-container?: # t: type-id -> result/eax: boolean +20031 # . prologue +20032 55/push-ebp +20033 89/<- %ebp 4/r32/esp +20034 # +20035 8b/-> *(ebp+8) 0/r32/eax +20036 c1/shift 4/subop/left %eax 2/imm8 +20037 3b/compare 0/r32/eax *Primitive-type-ids +20038 0f 9d/set-if->= %al +20039 81 4/subop/and %eax 0xff/imm32 +20040 $is-container?:end: +20041 # . epilogue +20042 89/<- %esp 5/r32/ebp +20043 5d/pop-to-ebp +20044 c3/return +20045 +20046 find-or-create-typeinfo: # t: type-id, out: (addr handle typeinfo) +20047 # . prologue +20048 55/push-ebp +20049 89/<- %ebp 4/r32/esp +20050 # . save registers +20051 50/push-eax +20052 51/push-ecx +20053 52/push-edx +20054 57/push-edi +20055 # edi = out +20056 8b/-> *(ebp+0xc) 7/r32/edi +20057 # var fields/ecx: (handle table (handle array byte) (handle typeinfo-entry)) +20058 68/push 0/imm32 +20059 68/push 0/imm32 +20060 89/<- %ecx 4/r32/esp +20061 # find-typeinfo(t, out) +20062 (find-typeinfo *(ebp+8) %edi) +20063 { +20064 # if (*out != 0) break +20065 81 7/subop/compare *edi 0/imm32 +20066 0f 85/jump-if-!= break/disp32 +20067 $find-or-create-typeinfo:create: +20068 # *out = allocate +20069 (allocate Heap *Typeinfo-size %edi) +20070 # var tmp/eax: (addr typeinfo) = lookup(*out) +20071 (lookup *edi *(edi+4)) # => eax +20072 #? (write-buffered Stderr "created typeinfo at ") +20073 #? (write-int32-hex-buffered Stderr %eax) +20074 #? (write-buffered Stderr " for type-id ") +20075 #? (write-int32-hex-buffered Stderr *(ebp+8)) +20076 #? (write-buffered Stderr Newline) +20077 #? (flush Stderr) +20078 # tmp->id = t +20079 8b/-> *(ebp+8) 2/r32/edx +20080 89/<- *eax 2/r32/edx # Typeinfo-id +20081 # tmp->fields = new table +20082 # . fields = new table +20083 (new-stream Heap 0x40 *Typeinfo-fields-row-size %ecx) +20084 # . tmp->fields = fields +20085 8b/-> *ecx 2/r32/edx +20086 89/<- *(eax+4) 2/r32/edx # Typeinfo-fields +20087 8b/-> *(ecx+4) 2/r32/edx +20088 89/<- *(eax+8) 2/r32/edx # Typeinfo-fields +20089 # tmp->next = Program->types +20090 8b/-> *_Program-types 1/r32/ecx +20091 89/<- *(eax+0x10) 1/r32/ecx # Typeinfo-next +20092 8b/-> *_Program-types->payload 1/r32/ecx +20093 89/<- *(eax+0x14) 1/r32/ecx # Typeinfo-next +20094 # Program->types = out +20095 8b/-> *edi 1/r32/ecx +20096 89/<- *_Program-types 1/r32/ecx +20097 8b/-> *(edi+4) 1/r32/ecx +20098 89/<- *_Program-types->payload 1/r32/ecx +20099 } +20100 $find-or-create-typeinfo:end: +20101 # . reclaim locals +20102 81 0/subop/add %esp 8/imm32 +20103 # . restore registers +20104 5f/pop-to-edi +20105 5a/pop-to-edx +20106 59/pop-to-ecx +20107 58/pop-to-eax +20108 # . epilogue +20109 89/<- %esp 5/r32/ebp +20110 5d/pop-to-ebp +20111 c3/return +20112 +20113 find-typeinfo: # t: type-id, out: (addr handle typeinfo) +20114 # . prologue +20115 55/push-ebp +20116 89/<- %ebp 4/r32/esp +20117 # . save registers +20118 50/push-eax +20119 51/push-ecx +20120 52/push-edx +20121 57/push-edi +20122 # ecx = t +20123 8b/-> *(ebp+8) 1/r32/ecx +20124 # edi = out +20125 8b/-> *(ebp+0xc) 7/r32/edi +20126 # *out = Program->types +20127 8b/-> *_Program-types 0/r32/eax +20128 89/<- *edi 0/r32/eax +20129 8b/-> *_Program-types->payload 0/r32/eax +20130 89/<- *(edi+4) 0/r32/eax +20131 { +20132 $find-typeinfo:loop: +20133 # if (*out == 0) break +20134 81 7/subop/compare *edi 0/imm32 +20135 74/jump-if-= break/disp8 +20136 $find-typeinfo:check: +20137 # var tmp/eax: (addr typeinfo) = lookup(*out) +20138 (lookup *edi *(edi+4)) # => eax +20139 # if (tmp->id == t) break +20140 39/compare *eax 1/r32/ecx # Typeinfo-id +20141 74/jump-if-= break/disp8 +20142 $find-typeinfo:continue: +20143 # *out = tmp->next +20144 8b/-> *(eax+0x10) 2/r32/edx # Typeinfo-next +20145 89/<- *edi 2/r32/edx +20146 8b/-> *(eax+0x14) 2/r32/edx # Typeinfo-next +20147 89/<- *(edi+4) 2/r32/edx +20148 # +20149 eb/jump loop/disp8 +20150 } +20151 $find-typeinfo:end: +20152 # . restore registers +20153 5f/pop-to-edi +20154 5a/pop-to-edx +20155 59/pop-to-ecx +20156 58/pop-to-eax +20157 # . epilogue +20158 89/<- %esp 5/r32/ebp +20159 5d/pop-to-ebp +20160 c3/return +20161 +20162 find-or-create-typeinfo-output-var: # T: (addr typeinfo), f: (addr slice), out: (addr handle var) +20163 # . prologue +20164 55/push-ebp +20165 89/<- %ebp 4/r32/esp +20166 # . save registers +20167 50/push-eax +20168 52/push-edx +20169 57/push-edi +20170 # var dest/edi: (handle typeinfo-entry) +20171 68/push 0/imm32 +20172 68/push 0/imm32 +20173 89/<- %edi 4/r32/esp +20174 # find-or-create-typeinfo-fields(T, f, dest) +20175 (find-or-create-typeinfo-fields *(ebp+8) *(ebp+0xc) %edi) +20176 # var dest-addr/edi: (addr typeinfo-entry) = lookup(dest) +20177 (lookup *edi *(edi+4)) # => eax +20178 89/<- %edi 0/r32/eax +20179 # if dest-addr->output-var doesn't exist, create it +20180 { +20181 81 7/subop/compare *(edi+0xc) 0/imm32 # Typeinfo-entry-output-var +20182 0f 85/jump-if-!= break/disp32 +20183 # dest-addr->output-var = new var(dummy name, type, -1 offset) +20184 # . var name/eax: (handle array byte) = "field" +20185 68/push 0/imm32 +20186 68/push 0/imm32 +20187 89/<- %eax 4/r32/esp +20188 (slice-to-string Heap *(ebp+0xc) %eax) +20189 # . new var +20190 8d/copy-address *(edi+0xc) 2/r32/edx +20191 (new-var Heap *eax *(eax+4) %edx) +20192 # . reclaim name +20193 81 0/subop/add %esp 8/imm32 +20194 # var result/edx: (addr var) = lookup(dest-addr->output-var) +20195 (lookup *(edi+0xc) *(edi+0x10)) # => eax +20196 89/<- %edx 0/r32/eax +20197 # result->type = new constant type +20198 8d/copy-address *(edx+8) 0/r32/eax # Var-type +20199 (allocate Heap *Type-tree-size %eax) +20200 (lookup *(edx+8) *(edx+0xc)) # => eax +20201 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom +20202 c7 0/subop/copy *(eax+4) 6/imm32/constant # Type-tree-value +20203 c7 0/subop/copy *(eax+8) 0/imm32 # Type-tree-left +20204 c7 0/subop/copy *(eax+0xc) 0/imm32 # Type-tree-right +20205 c7 0/subop/copy *(eax+0x10) 0/imm32 # Type-tree-right +20206 # result->offset isn't filled out yet +20207 c7 0/subop/copy *(edx+0x14) -1/imm32/uninitialized # Var-offset +20208 } +20209 # out = dest-addr->output-var +20210 8b/-> *(ebp+0x10) 2/r32/edx +20211 8b/-> *(edi+0xc) 0/r32/eax # Typeinfo-entry-output-var +20212 89/<- *edx 0/r32/eax +20213 8b/-> *(edi+0x10) 0/r32/eax # Typeinfo-entry-output-var +20214 89/<- *(edx+4) 0/r32/eax +20215 $find-or-create-typeinfo-output-var:end: +20216 # . reclaim locals +20217 81 0/subop/add %esp 8/imm32 +20218 # . restore registers +20219 5f/pop-to-edi +20220 5a/pop-to-edx +20221 58/pop-to-eax +20222 # . epilogue +20223 89/<- %esp 5/r32/ebp +20224 5d/pop-to-ebp +20225 c3/return +20226 +20227 find-or-create-typeinfo-fields: # T: (addr typeinfo), f: (addr slice), out: (addr handle typeinfo-entry) +20228 # . prologue +20229 55/push-ebp +20230 89/<- %ebp 4/r32/esp +20231 # . save registers +20232 50/push-eax +20233 56/push-esi +20234 57/push-edi +20235 # eax = lookup(T->fields) +20236 8b/-> *(ebp+8) 0/r32/eax +20237 (lookup *(eax+4) *(eax+8)) # Typeinfo-fields Typeinfo-fields => eax +20238 # edi = out +20239 8b/-> *(ebp+0x10) 7/r32/edi +20240 # var src/esi: (addr handle typeinfo-entry) = get-or-insert-slice(T->fields, f) +20241 (get-or-insert-slice %eax *(ebp+0xc) *Typeinfo-fields-row-size Heap) # => eax +20242 89/<- %esi 0/r32/eax +20243 # if src doesn't exist, allocate it +20244 { +20245 81 7/subop/compare *esi 0/imm32 +20246 75/jump-if-!= break/disp8 +20247 (allocate Heap *Typeinfo-entry-size %esi) +20248 #? (write-buffered Stderr "handle at ") +20249 #? (write-int32-hex-buffered Stderr %esi) +20250 #? (write-buffered Stderr ": ") +20251 #? (write-int32-hex-buffered Stderr *esi) +20252 #? (write-buffered Stderr " ") +20253 #? (write-int32-hex-buffered Stderr *(esi+4)) +20254 #? (write-buffered Stderr Newline) +20255 #? (flush Stderr) +20256 #? (lookup *esi *(esi+4)) +20257 #? (write-buffered Stderr "created typeinfo fields at ") +20258 #? (write-int32-hex-buffered Stderr %esi) +20259 #? (write-buffered Stderr " for ") +20260 #? (write-int32-hex-buffered Stderr *(ebp+8)) +20261 #? (write-buffered Stderr Newline) +20262 #? (flush Stderr) +20263 } +20264 # *out = src +20265 # . *edi = *src +20266 8b/-> *esi 0/r32/eax +20267 89/<- *edi 0/r32/eax +20268 8b/-> *(esi+4) 0/r32/eax +20269 89/<- *(edi+4) 0/r32/eax +20270 $find-or-create-typeinfo-fields:end: +20271 # . restore registers +20272 5f/pop-to-edi +20273 5e/pop-to-esi +20274 58/pop-to-eax +20275 # . epilogue +20276 89/<- %esp 5/r32/ebp +20277 5d/pop-to-ebp +20278 c3/return +20279 +20280 populate-mu-type: # in: (addr stream byte), t: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) +20281 # pseudocode: +20282 # var line: (stream byte 512) +20283 # curr-index = 0 +20284 # while true +20285 # clear-stream(line) +20286 # read-line-buffered(in, line) +20287 # if line->write == 0 +20288 # abort +20289 # word-slice = next-mu-token(line) +20290 # if slice-empty?(word-slice) # end of line +20291 # continue +20292 # if slice-equal?(word-slice, "}") +20293 # break +20294 # var v: (handle var) = parse-var-with-type(word-slice, line) +20295 # var r: (handle typeinfo-fields) = find-or-create-typeinfo-fields(t, word-slice/v->name) +20296 # TODO: ensure that r->first is null +20297 # r->index = curr-index +20298 # curr-index++ +20299 # r->input-var = v +20300 # if r->output-var == 0 +20301 # r->output-var = new literal +20302 # TODO: ensure nothing else in line +20303 # t->total-size-in-bytes = -2 (not yet initialized) +20304 # +20305 # . prologue +20306 55/push-ebp +20307 89/<- %ebp 4/r32/esp +20308 # var curr-index: int at *(ebp-4) +20309 68/push 0/imm32 +20310 # . save registers +20311 50/push-eax +20312 51/push-ecx +20313 52/push-edx +20314 53/push-ebx +20315 56/push-esi +20316 57/push-edi +20317 # edi = t +20318 8b/-> *(ebp+0xc) 7/r32/edi +20319 # var line/ecx: (stream byte 512) +20320 81 5/subop/subtract %esp 0x200/imm32 +20321 68/push 0x200/imm32/size +20322 68/push 0/imm32/read +20323 68/push 0/imm32/write +20324 89/<- %ecx 4/r32/esp +20325 # var word-slice/edx: slice +20326 68/push 0/imm32/end +20327 68/push 0/imm32/start +20328 89/<- %edx 4/r32/esp +20329 # var v/esi: (handle var) +20330 68/push 0/imm32 +20331 68/push 0/imm32 +20332 89/<- %esi 4/r32/esp +20333 # var r/ebx: (handle typeinfo-entry) +20334 68/push 0/imm32 +20335 68/push 0/imm32 +20336 89/<- %ebx 4/r32/esp +20337 { +20338 $populate-mu-type:line-loop: +20339 (clear-stream %ecx) +20340 (read-line-buffered *(ebp+8) %ecx) +20341 # if (line->write == 0) abort +20342 81 7/subop/compare *ecx 0/imm32 +20343 0f 84/jump-if-= $populate-mu-type:error1/disp32 +20344 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------ +20350 (next-mu-token %ecx %edx) +20351 # if slice-empty?(word-slice) continue +20352 (slice-empty? %edx) # => eax +20353 3d/compare-eax-and 0/imm32 +20354 0f 85/jump-if-!= loop/disp32 +20355 # if slice-equal?(word-slice, "}") break +20356 (slice-equal? %edx "}") +20357 3d/compare-eax-and 0/imm32 +20358 0f 85/jump-if-!= break/disp32 +20359 $populate-mu-type:parse-element: +20360 # v = parse-var-with-type(word-slice, first-line) +20361 # must do this first to strip the trailing ':' from word-slice before +20362 # using it in find-or-create-typeinfo-fields below +20363 # TODO: clean up that mutation in parse-var-with-type +20364 (type-name *edi) # Typeinfo-id => eax +20365 (parse-var-with-type %edx %ecx %esi %eax *(ebp+0x10) *(ebp+0x14)) +20366 # if v is an addr, abort +20367 (lookup *esi *(esi+4)) # => eax +20368 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20369 (is-mu-addr-type? %eax) # => eax +20370 3d/compare-eax-and 0/imm32/false +20371 0f 85/jump-if-!= $populate-mu-type:error2/disp32 +20372 # if v is an array, abort (we could support it, but initialization gets complex) +20373 (lookup *esi *(esi+4)) # => eax +20374 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20375 (is-mu-array-type? %eax) # => eax +20376 3d/compare-eax-and 0/imm32/false +20377 0f 85/jump-if-!= $populate-mu-type:error3/disp32 +20378 # if v is a byte, abort +20379 (lookup *esi *(esi+4)) # => eax +20380 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20381 (is-simple-mu-type? %eax 8) # byte => eax +20382 3d/compare-eax-and 0/imm32/false +20383 0f 85/jump-if-!= $populate-mu-type:error4/disp32 +20384 # if v is a slice, abort +20385 (lookup *esi *(esi+4)) # => eax +20386 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20387 (is-simple-mu-type? %eax 0xc) # slice => eax +20388 3d/compare-eax-and 0/imm32/false +20389 0f 85/jump-if-!= $populate-mu-type:error5/disp32 +20390 # if v is a stream, abort (we could support it, but initialization gets even more complex) +20391 (lookup *esi *(esi+4)) # => eax +20392 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20393 (is-mu-stream-type? %eax) # => eax +20394 3d/compare-eax-and 0/imm32/false +20395 0f 85/jump-if-!= $populate-mu-type:error6/disp32 +20396 # var tmp/ecx +20397 51/push-ecx +20398 $populate-mu-type:create-typeinfo-fields: +20399 # var r/ebx: (handle typeinfo-entry) +20400 (find-or-create-typeinfo-fields %edi %edx %ebx) +20401 # r->index = curr-index +20402 (lookup *ebx *(ebx+4)) # => eax +20403 8b/-> *(ebp-4) 1/r32/ecx +20404 #? (write-buffered Stderr "saving index ") +20405 #? (write-int32-hex-buffered Stderr %ecx) +20406 #? (write-buffered Stderr " at ") +20407 #? (write-int32-hex-buffered Stderr %edi) +20408 #? (write-buffered Stderr Newline) +20409 #? (flush Stderr) +20410 89/<- *(eax+8) 1/r32/ecx # Typeinfo-entry-index +20411 # ++curr-index +20412 ff 0/subop/increment *(ebp-4) +20413 $populate-mu-type:set-input-type: +20414 # r->input-var = v +20415 8b/-> *esi 1/r32/ecx +20416 89/<- *eax 1/r32/ecx # Typeinfo-entry-input-var +20417 8b/-> *(esi+4) 1/r32/ecx +20418 89/<- *(eax+4) 1/r32/ecx # Typeinfo-entry-input-var +20419 # restore line +20420 59/pop-to-ecx +20421 { +20422 $populate-mu-type:create-output-type: +20423 # if (r->output-var == 0) create a new var with some placeholder data +20424 81 7/subop/compare *(eax+0xc) 0/imm32 # Typeinfo-entry-output-var +20425 75/jump-if-!= break/disp8 +20426 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var +20427 (new-literal Heap %edx %eax) +20428 } +20429 e9/jump loop/disp32 +20430 } +20431 $populate-mu-type:invalidate-total-size-in-bytes: +20432 # Offsets and total size may not be accurate here since we may not yet +20433 # have encountered the element types. +20434 # We'll recompute them separately after parsing the entire program. +20435 c7 0/subop/copy *(edi+0xc) -2/imm32/uninitialized # Typeinfo-total-size-in-bytes +20436 $populate-mu-type:end: +20437 # . reclaim locals +20438 81 0/subop/add %esp 0x224/imm32 +20439 # . restore registers +20440 5f/pop-to-edi +20441 5e/pop-to-esi +20442 5b/pop-to-ebx +20443 5a/pop-to-edx +20444 59/pop-to-ecx +20445 58/pop-to-eax +20446 # reclaim curr-index +20447 81 0/subop/add %esp 4/imm32 +20448 # . epilogue +20449 89/<- %esp 5/r32/ebp +20450 5d/pop-to-ebp +20451 c3/return +20452 +20453 $populate-mu-type:error1: +20454 # error("incomplete type definition '" t->name "'\n") +20455 (write-buffered *(ebp+0x10) "incomplete type definition '") +20456 (type-name *edi) # Typeinfo-id => eax +20457 (write-buffered *(ebp+0x10) %eax) +20458 (write-buffered *(ebp+0x10) "\n") +20459 (flush *(ebp+0x10)) +20460 (stop *(ebp+0x14) 1) +20461 # never gets here +20462 +20463 $populate-mu-type:error2: +20464 (write-buffered *(ebp+0x10) "type ") +20465 (type-name *edi) # Typeinfo-id => eax +20466 (write-buffered *(ebp+0x10) %eax) +20467 (write-buffered *(ebp+0x10) ": 'addr' elements not allowed\n") +20468 (flush *(ebp+0x10)) +20469 (stop *(ebp+0x14) 1) +20470 # never gets here +20471 +20472 $populate-mu-type:error3: +20473 (write-buffered *(ebp+0x10) "type ") +20474 (type-name *edi) # Typeinfo-id => eax +20475 (write-buffered *(ebp+0x10) %eax) +20476 (write-buffered *(ebp+0x10) ": 'array' elements not allowed for now\n") +20477 (flush *(ebp+0x10)) +20478 (stop *(ebp+0x14) 1) +20479 # never gets here +20480 +20481 $populate-mu-type:error4: +20482 (write-buffered *(ebp+0x10) "type ") +20483 (type-name *edi) # Typeinfo-id => eax +20484 (write-buffered *(ebp+0x10) %eax) +20485 (write-buffered *(ebp+0x10) ": 'byte' elements not allowed\n") +20486 (flush *(ebp+0x10)) +20487 (stop *(ebp+0x14) 1) +20488 # never gets here +20489 +20490 $populate-mu-type:error5: +20491 (write-buffered *(ebp+0x10) "type ") +20492 (type-name *edi) # Typeinfo-id => eax +20493 (write-buffered *(ebp+0x10) %eax) +20494 (write-buffered *(ebp+0x10) ": 'slice' elements not allowed\n") +20495 (flush *(ebp+0x10)) +20496 (stop *(ebp+0x14) 1) +20497 # never gets here +20498 +20499 $populate-mu-type:error6: +20500 (write-buffered *(ebp+0x10) "type ") +20501 (type-name *edi) # Typeinfo-id => eax +20502 (write-buffered *(ebp+0x10) %eax) +20503 (write-buffered *(ebp+0x10) ": 'stream' elements not allowed for now\n") +20504 (flush *(ebp+0x10)) +20505 (stop *(ebp+0x14) 1) +20506 # never gets here +20507 +20508 type-name: # index: int -> result/eax: (addr array byte) +20509 # . prologue +20510 55/push-ebp +20511 89/<- %ebp 4/r32/esp +20512 # +20513 (index Type-id *(ebp+8)) +20514 $type-name:end: +20515 # . epilogue +20516 89/<- %esp 5/r32/ebp +20517 5d/pop-to-ebp +20518 c3/return +20519 +20520 index: # arr: (addr stream (handle array byte)), index: int -> result/eax: (addr array byte) +20521 # . prologue +20522 55/push-ebp +20523 89/<- %ebp 4/r32/esp +20524 # . save registers +20525 56/push-esi +20526 # TODO: bounds-check index +20527 # esi = arr +20528 8b/-> *(ebp+8) 6/r32/esi +20529 # eax = index +20530 8b/-> *(ebp+0xc) 0/r32/eax +20531 # eax = *(arr + 12 + index) +20532 8b/-> *(esi+eax<<2+0xc) 0/r32/eax +20533 $index:end: +20534 # . restore registers +20535 5e/pop-to-esi +20536 # . epilogue +20537 89/<- %esp 5/r32/ebp +20538 5d/pop-to-ebp +20539 c3/return +20540 +20541 ####################################################### +20542 # Compute type sizes +20543 ####################################################### +20544 +20545 # Compute the sizes of all user-defined types. +20546 # We'll need the sizes of their elements, which may be other user-defined +20547 # types, which we will compute as needed. +20548 +20549 # Initially, all user-defined types have their sizes set to -2 (invalid) +20550 populate-mu-type-sizes: # err: (addr buffered-file), ed: (addr exit-descriptor) +20551 # . prologue +20552 55/push-ebp +20553 89/<- %ebp 4/r32/esp +20554 $populate-mu-type-sizes:total-sizes: +20555 # var curr/eax: (addr typeinfo) = lookup(Program->types) +20556 (lookup *_Program-types *_Program-types->payload) # => eax +20557 { +20558 # if (curr == null) break +20559 3d/compare-eax-and 0/imm32/null +20560 74/jump-if-= break/disp8 +20561 (populate-mu-type-sizes-in-type %eax *(ebp+8) *(ebp+0xc)) +20562 # curr = lookup(curr->next) +20563 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax +20564 eb/jump loop/disp8 +20565 } +20566 $populate-mu-type-sizes:offsets: +20567 # curr = *Program->types +20568 (lookup *_Program-types *_Program-types->payload) # => eax +20569 { +20570 # if (curr == null) break +20571 3d/compare-eax-and 0/imm32/null +20572 74/jump-if-= break/disp8 +20573 (populate-mu-type-offsets %eax *(ebp+8) *(ebp+0xc)) +20574 # curr = curr->next +20575 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax +20576 eb/jump loop/disp8 +20577 } +20578 $populate-mu-type-sizes:end: +20579 # . epilogue +20580 89/<- %esp 5/r32/ebp +20581 5d/pop-to-ebp +20582 c3/return +20583 +20584 # compute sizes of all fields, recursing as necessary +20585 # sum up all their sizes to arrive at total size +20586 # fields may be out of order, but that doesn't affect the answer +20587 populate-mu-type-sizes-in-type: # T: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) +20588 # . prologue +20589 55/push-ebp +20590 89/<- %ebp 4/r32/esp +20591 # . save registers +20592 50/push-eax +20593 51/push-ecx +20594 52/push-edx +20595 56/push-esi +20596 57/push-edi +20597 # esi = T +20598 8b/-> *(ebp+8) 6/r32/esi +20599 # if T is already computed, return +20600 81 7/subop/compare *(esi+0xc) 0/imm32 # Typeinfo-total-size-in-bytes +20601 0f 8d/jump-if->= $populate-mu-type-sizes-in-type:end/disp32 +20602 # if T is being computed, abort +20603 81 7/subop/compare *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes +20604 0f 84/jump-if-= $populate-mu-type-sizes-in-type:abort/disp32 +20605 # tag T (-2 to -1) to avoid infinite recursion +20606 c7 0/subop/copy *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes +20607 # var total-size/edi: int = 0 +20608 bf/copy-to-edi 0/imm32 +20609 # - for every field, if it's a user-defined type, compute its size +20610 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) +20611 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax +20612 89/<- %ecx 0/r32/eax +20613 # var table-size/edx: int = table->write +20614 8b/-> *ecx 2/r32/edx # stream-write +20615 # var curr/ecx: (addr table_row) = table->data +20616 8d/copy-address *(ecx+0xc) 1/r32/ecx +20617 # var max/edx: (addr table_row) = table->data + table->write +20618 8d/copy-address *(ecx+edx) 2/r32/edx +20619 { +20620 $populate-mu-type-sizes-in-type:loop: +20621 # if (curr >= max) break +20622 39/compare %ecx 2/r32/edx +20623 73/jump-if-addr>= break/disp8 +20624 # var t/eax: (addr typeinfo-entry) = lookup(curr->value) +20625 (lookup *(ecx+8) *(ecx+0xc)) # => eax +20626 # if (t->input-var == 0) silently ignore it; we'll emit a nice error message while type-checking +20627 81 7/subop/compare *eax 0/imm32 # Typeinfo-entry-input-var +20628 74/jump-if-= $populate-mu-type-sizes-in-type:end/disp8 +20629 # compute size of t->input-var +20630 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax +20631 (compute-size-of-var %eax *(ebp+0xc) *(ebp+0x10)) # => eax +20632 # result += eax +20633 01/add-to %edi 0/r32/eax +20634 # curr += row-size +20635 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size +20636 # +20637 eb/jump loop/disp8 +20638 } +20639 # - save result +20640 89/<- *(esi+0xc) 7/r32/edi # Typeinfo-total-size-in-bytes +20641 $populate-mu-type-sizes-in-type:end: +20642 # . restore registers +20643 5f/pop-to-edi +20644 5e/pop-to-esi +20645 5a/pop-to-edx +20646 59/pop-to-ecx +20647 58/pop-to-eax +20648 # . epilogue +20649 89/<- %esp 5/r32/ebp +20650 5d/pop-to-ebp +20651 c3/return +20652 +20653 $populate-mu-type-sizes-in-type:abort: +20654 (write-buffered *(ebp+0xc) "cycle in type definitions\n") +20655 (flush *(ebp+0xc)) +20656 (stop *(ebp+0x10) 1) +20657 # never gets here +20658 +20659 # Analogous to size-of, except we need to compute what size-of can just read +20660 # off the right data structures. +20661 compute-size-of-var: # in: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +20662 # . prologue +20663 55/push-ebp +20664 89/<- %ebp 4/r32/esp +20665 # . push registers +20666 51/push-ecx +20667 # var t/ecx: (addr type-tree) = lookup(v->type) +20668 8b/-> *(ebp+8) 1/r32/ecx +20669 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +20670 89/<- %ecx 0/r32/eax +20671 # if (t->is-atom == false) t = lookup(t->left) +20672 { +20673 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +20674 75/jump-if-!= break/disp8 +20675 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +20676 89/<- %ecx 0/r32/eax +20677 } +20678 # TODO: ensure t is an atom +20679 (compute-size-of-type-id *(ecx+4) *(ebp+0xc) *(ebp+0x10)) # Type-tree-value => eax +20680 $compute-size-of-var:end: +20681 # . restore registers +20682 59/pop-to-ecx +20683 # . epilogue +20684 89/<- %esp 5/r32/ebp +20685 5d/pop-to-ebp +20686 c3/return +20687 +20688 compute-size-of-type-id: # t: type-id, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +20689 # . prologue +20690 55/push-ebp +20691 89/<- %ebp 4/r32/esp +20692 # . save registers +20693 51/push-ecx +20694 # var out/ecx: (handle typeinfo) +20695 68/push 0/imm32 +20696 68/push 0/imm32 +20697 89/<- %ecx 4/r32/esp +20698 # eax = t +20699 8b/-> *(ebp+8) 0/r32/eax +20700 # if t is a literal, return 0 +20701 3d/compare-eax-and 0/imm32/literal +20702 0f 84/jump-if-= $compute-size-of-type-id:end/disp32 # eax changes type from type-id to int +20703 # if t is a byte, return 4 (because we don't really support non-multiples of 4) +20704 3d/compare-eax-and 8/imm32/byte +20705 { +20706 75/jump-if-!= break/disp8 +20707 b8/copy-to-eax 4/imm32 +20708 eb/jump $compute-size-of-type-id:end/disp8 +20709 } +20710 # if t is a handle, return 8 +20711 3d/compare-eax-and 4/imm32/handle +20712 { +20713 75/jump-if-!= break/disp8 +20714 b8/copy-to-eax 8/imm32 +20715 eb/jump $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int +20716 } +20717 # if t is a slice, return 8 +20718 3d/compare-eax-and 0xc/imm32/slice +20719 { +20720 75/jump-if-!= break/disp8 +20721 b8/copy-to-eax 8/imm32 +20722 eb/jump $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int +20723 } +20724 # if t is a user-defined type, compute its size +20725 # TODO: support non-atom type +20726 (find-typeinfo %eax %ecx) +20727 { +20728 81 7/subop/compare *ecx 0/imm32 +20729 74/jump-if-= break/disp8 +20730 $compute-size-of-type-id:user-defined: +20731 (lookup *ecx *(ecx+4)) # => eax +20732 (populate-mu-type-sizes-in-type %eax *(ebp+0xc) *(ebp+0x10)) +20733 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes +20734 eb/jump $compute-size-of-type-id:end/disp8 +20735 } +20736 # otherwise return the word size +20737 b8/copy-to-eax 4/imm32 +20738 $compute-size-of-type-id:end: +20739 # . reclaim locals +20740 81 0/subop/add %esp 8/imm32 +20741 # . restore registers +20742 59/pop-to-ecx +20743 # . epilogue +20744 89/<- %esp 5/r32/ebp +20745 5d/pop-to-ebp +20746 c3/return +20747 +20748 # at this point we have total sizes for all user-defined types +20749 # compute offsets for each element +20750 # complication: fields may be out of order +20751 populate-mu-type-offsets: # in: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) +20752 # . prologue +20753 55/push-ebp +20754 89/<- %ebp 4/r32/esp +20755 # . save registers +20756 50/push-eax +20757 51/push-ecx +20758 52/push-edx +20759 53/push-ebx +20760 56/push-esi +20761 57/push-edi +20762 #? (dump-typeinfos "aaa\n") +20763 # var curr-offset/edi: int = 0 +20764 bf/copy-to-edi 0/imm32 +20765 # var table/ecx: (addr table string_key (handle typeinfo-entry)) = lookup(in->fields) +20766 8b/-> *(ebp+8) 1/r32/ecx +20767 (lookup *(ecx+4) *(ecx+8)) # Typeinfo-fields Typeinfo-fields => eax +20768 89/<- %ecx 0/r32/eax +20769 # var num-elems/edx: int = table->write / Typeinfo-fields-row-size +20770 8b/-> *ecx 2/r32/edx # stream-write +20771 c1 5/subop/shift-right-logical %edx 4/imm8 +20772 # var i/ebx: int = 0 +20773 bb/copy-to-ebx 0/imm32 +20774 { +20775 $populate-mu-type-offsets:loop: +20776 39/compare %ebx 2/r32/edx +20777 0f 8d/jump-if->= break/disp32 +20778 #? (write-buffered Stderr "looking up index ") +20779 #? (write-int32-hex-buffered Stderr %ebx) +20780 #? (write-buffered Stderr " in ") +20781 #? (write-int32-hex-buffered Stderr *(ebp+8)) +20782 #? (write-buffered Stderr Newline) +20783 #? (flush Stderr) +20784 # var v/esi: (addr typeinfo-entry) +20785 (locate-typeinfo-entry-with-index %ecx %ebx *(ebp+0xc) *(ebp+0x10)) # => eax +20786 89/<- %esi 0/r32/eax +20787 # if v is null, silently move on; we'll emit a nice error message while type-checking +20788 81 7/subop/compare %esi 0/imm32 # Typeinfo-entry-input-var +20789 74/jump-if-= $populate-mu-type-offsets:end/disp8 +20790 # if (v->input-var == 0) silently ignore v; we'll emit a nice error message while type-checking +20791 81 7/subop/compare *esi 0/imm32 # Typeinfo-entry-input-var +20792 74/jump-if-= $populate-mu-type-offsets:end/disp8 +20793 # v->output-var->offset = curr-offset +20794 # . eax: (addr var) +20795 (lookup *(esi+0xc) *(esi+0x10)) # Typeinfo-entry-output-var Typeinfo-entry-output-var => eax +20796 89/<- *(eax+0x14) 7/r32/edi # Var-offset +20797 # curr-offset += size-of(v->input-var) +20798 (lookup *esi *(esi+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax +20799 (size-of %eax) # => eax +20800 01/add-to %edi 0/r32/eax +20801 # ++i +20802 43/increment-ebx +20803 e9/jump loop/disp32 +20804 } +20805 $populate-mu-type-offsets:end: +20806 # . restore registers +20807 5f/pop-to-edi +20808 5e/pop-to-esi +20809 5b/pop-to-ebx +20810 5a/pop-to-edx +20811 59/pop-to-ecx +20812 58/pop-to-eax +20813 # . epilogue +20814 89/<- %esp 5/r32/ebp +20815 5d/pop-to-ebp +20816 c3/return +20817 +20818 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) +20819 # . prologue +20820 55/push-ebp +20821 89/<- %ebp 4/r32/esp +20822 # . save registers +20823 51/push-ecx +20824 52/push-edx +20825 53/push-ebx +20826 56/push-esi +20827 57/push-edi +20828 # esi = table +20829 8b/-> *(ebp+8) 6/r32/esi +20830 # var curr/ecx: (addr row (handle array byte) (handle typeinfo-entry)) = table->data +20831 8d/copy-address *(esi+0xc) 1/r32/ecx +20832 # var max/edx: (addr byte) = &table->data[table->write] +20833 8b/-> *esi 2/r32/edx +20834 8d/copy-address *(ecx+edx) 2/r32/edx +20835 { +20836 $locate-typeinfo-entry-with-index:loop: +20837 39/compare %ecx 2/r32/edx +20838 73/jump-if-addr>= break/disp8 +20839 # var v/eax: (addr typeinfo-entry) +20840 (lookup *(ecx+8) *(ecx+0xc)) # => eax +20841 # if (v->index == idx) return v +20842 8b/-> *(eax+8) 3/r32/ebx # Typeinfo-entry-index +20843 #? (write-buffered Stderr "comparing ") +20844 #? (write-int32-hex-buffered Stderr %ebx) +20845 #? (write-buffered Stderr " and ") +20846 #? (write-int32-hex-buffered Stderr *(ebp+0xc)) +20847 #? (write-buffered Stderr Newline) +20848 #? (flush Stderr) +20849 39/compare *(ebp+0xc) 3/r32/ebx +20850 74/jump-if-= $locate-typeinfo-entry-with-index:end/disp8 +20851 # curr += Typeinfo-entry-size +20852 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-entry-size +20853 # +20854 eb/jump loop/disp8 +20855 } +20856 # return 0 +20857 b8/copy-to-eax 0/imm32 +20858 $locate-typeinfo-entry-with-index:end: +20859 #? (write-buffered Stderr "returning ") +20860 #? (write-int32-hex-buffered Stderr %eax) +20861 #? (write-buffered Stderr Newline) +20862 #? (flush Stderr) +20863 # . restore registers +20864 5f/pop-to-edi +20865 5e/pop-to-esi +20866 5b/pop-to-ebx +20867 5a/pop-to-edx +20868 59/pop-to-ecx +20869 # . epilogue +20870 89/<- %esp 5/r32/ebp +20871 5d/pop-to-ebp +20872 c3/return +20873 +20874 dump-typeinfos: # hdr: (addr array byte) +20875 # . prologue +20876 55/push-ebp +20877 89/<- %ebp 4/r32/esp +20878 # . save registers +20879 50/push-eax +20880 # +20881 (write-buffered Stderr *(ebp+8)) +20882 (flush Stderr) +20883 # var curr/eax: (addr typeinfo) = lookup(Program->types) +20884 (lookup *_Program-types *_Program-types->payload) # => eax +20885 { +20886 # if (curr == null) break +20887 3d/compare-eax-and 0/imm32 +20888 74/jump-if-= break/disp8 +20889 (write-buffered Stderr "---\n") +20890 (flush Stderr) +20891 (dump-typeinfo %eax) +20892 # curr = lookup(curr->next) +20893 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax +20894 eb/jump loop/disp8 +20895 } +20896 $dump-typeinfos:end: +20897 # . restore registers +20898 58/pop-to-eax +20899 # . epilogue +20900 89/<- %esp 5/r32/ebp +20901 5d/pop-to-ebp +20902 c3/return +20903 +20904 dump-typeinfo: # in: (addr typeinfo) +20905 # . prologue +20906 55/push-ebp +20907 89/<- %ebp 4/r32/esp +20908 # . save registers +20909 50/push-eax +20910 51/push-ecx +20911 52/push-edx +20912 53/push-ebx +20913 56/push-esi +20914 57/push-edi +20915 # esi = in +20916 8b/-> *(ebp+8) 6/r32/esi +20917 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) +20918 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax +20919 89/<- %ecx 0/r32/eax +20920 (write-buffered Stderr "id:") +20921 (write-int32-hex-buffered Stderr *esi) +20922 (write-buffered Stderr "\n") +20923 (write-buffered Stderr "fields @ ") +20924 (write-int32-hex-buffered Stderr %ecx) +20925 (write-buffered Stderr Newline) +20926 (flush Stderr) +20927 (write-buffered Stderr " write: ") +20928 (write-int32-hex-buffered Stderr *ecx) +20929 (write-buffered Stderr Newline) +20930 (flush Stderr) +20931 (write-buffered Stderr " read: ") +20932 (write-int32-hex-buffered Stderr *(ecx+4)) +20933 (write-buffered Stderr Newline) +20934 (flush Stderr) +20935 (write-buffered Stderr " size: ") +20936 (write-int32-hex-buffered Stderr *(ecx+8)) +20937 (write-buffered Stderr Newline) +20938 (flush Stderr) +20939 # var table-size/edx: int = table->write +20940 8b/-> *ecx 2/r32/edx # stream-write +20941 # var curr/ecx: (addr table_row) = table->data +20942 8d/copy-address *(ecx+0xc) 1/r32/ecx +20943 # var max/edx: (addr table_row) = table->data + table->write +20944 8d/copy-address *(ecx+edx) 2/r32/edx +20945 { +20946 $dump-typeinfo:loop: +20947 # if (curr >= max) break +20948 39/compare %ecx 2/r32/edx +20949 0f 83/jump-if-addr>= break/disp32 +20950 (write-buffered Stderr " row:\n") +20951 (write-buffered Stderr " key: ") +20952 (write-int32-hex-buffered Stderr *ecx) +20953 (write-buffered Stderr ",") +20954 (write-int32-hex-buffered Stderr *(ecx+4)) +20955 (write-buffered Stderr " = '") +20956 (lookup *ecx *(ecx+4)) +20957 (write-buffered Stderr %eax) +20958 (write-buffered Stderr "' @ ") +20959 (write-int32-hex-buffered Stderr %eax) +20960 (write-buffered Stderr Newline) +20961 (flush Stderr) +20962 (write-buffered Stderr " value: ") +20963 (write-int32-hex-buffered Stderr *(ecx+8)) +20964 (write-buffered Stderr ",") +20965 (write-int32-hex-buffered Stderr *(ecx+0xc)) +20966 (write-buffered Stderr " = typeinfo-entry@") +20967 (lookup *(ecx+8) *(ecx+0xc)) +20968 (write-int32-hex-buffered Stderr %eax) +20969 (write-buffered Stderr Newline) +20970 (flush Stderr) +20971 (write-buffered Stderr " input var@") +20972 (dump-var 5 %eax) +20973 (lookup *(ecx+8) *(ecx+0xc)) +20974 (write-buffered Stderr " index: ") +20975 (write-int32-hex-buffered Stderr *(eax+8)) +20976 (write-buffered Stderr Newline) +20977 (flush Stderr) +20978 (write-buffered Stderr " output var@") +20979 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var +20980 (dump-var 5 %eax) +20981 (flush Stderr) +20982 # curr += row-size +20983 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size +20984 # +20985 e9/jump loop/disp32 +20986 } +20987 $dump-typeinfo:end: +20988 # . restore registers +20989 5f/pop-to-edi +20990 5e/pop-to-esi +20991 5b/pop-to-ebx +20992 5a/pop-to-edx +20993 59/pop-to-ecx +20994 58/pop-to-eax +20995 # . epilogue +20996 89/<- %esp 5/r32/ebp +20997 5d/pop-to-ebp +20998 c3/return +20999 +21000 dump-var: # indent: int, v: (addr handle var) +21001 # . prologue +21002 55/push-ebp +21003 89/<- %ebp 4/r32/esp +21004 # . save registers +21005 50/push-eax +21006 53/push-ebx +21007 # eax = v +21008 8b/-> *(ebp+0xc) 0/r32/eax +21009 # +21010 (write-int32-hex-buffered Stderr *eax) +21011 (write-buffered Stderr ",") +21012 (write-int32-hex-buffered Stderr *(eax+4)) +21013 (write-buffered Stderr "->") +21014 (lookup *eax *(eax+4)) +21015 (write-int32-hex-buffered Stderr %eax) +21016 (write-buffered Stderr Newline) +21017 (flush Stderr) +21018 { +21019 3d/compare-eax-and 0/imm32 +21020 0f 84/jump-if-= break/disp32 +21021 (emit-indent Stderr *(ebp+8)) +21022 (write-buffered Stderr "name: ") +21023 89/<- %ebx 0/r32/eax +21024 (write-int32-hex-buffered Stderr *ebx) # Var-name +21025 (write-buffered Stderr ",") +21026 (write-int32-hex-buffered Stderr *(ebx+4)) # Var-name +21027 (write-buffered Stderr "->") +21028 (lookup *ebx *(ebx+4)) # Var-name +21029 (write-int32-hex-buffered Stderr %eax) +21030 { +21031 3d/compare-eax-and 0/imm32 +21032 74/jump-if-= break/disp8 +21033 (write-buffered Stderr Space) +21034 (write-buffered Stderr %eax) +21035 } +21036 (write-buffered Stderr Newline) +21037 (flush Stderr) +21038 (emit-indent Stderr *(ebp+8)) +21039 (write-buffered Stderr "block depth: ") +21040 (write-int32-hex-buffered Stderr *(ebx+0x10)) # Var-block-depth +21041 (write-buffered Stderr Newline) +21042 (flush Stderr) +21043 (emit-indent Stderr *(ebp+8)) +21044 (write-buffered Stderr "stack offset: ") +21045 (write-int32-hex-buffered Stderr *(ebx+0x14)) # Var-offset +21046 (write-buffered Stderr Newline) +21047 (flush Stderr) +21048 (emit-indent Stderr *(ebp+8)) +21049 (write-buffered Stderr "reg: ") +21050 (write-int32-hex-buffered Stderr *(ebx+0x18)) # Var-register +21051 (write-buffered Stderr ",") +21052 (write-int32-hex-buffered Stderr *(ebx+0x1c)) # Var-register +21053 (write-buffered Stderr "->") +21054 (flush Stderr) +21055 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register +21056 (write-int32-hex-buffered Stderr %eax) +21057 { +21058 3d/compare-eax-and 0/imm32 +21059 74/jump-if-= break/disp8 +21060 (write-buffered Stderr Space) +21061 (write-buffered Stderr %eax) +21062 } +21063 (write-buffered Stderr Newline) +21064 (flush Stderr) +21065 } +21066 $dump-var:end: +21067 # . restore registers +21068 5b/pop-to-ebx +21069 58/pop-to-eax +21070 # . epilogue +21071 89/<- %esp 5/r32/ebp +21072 5d/pop-to-ebp +21073 c3/return +21074 +21075 ####################################################### +21076 # Type-checking +21077 ####################################################### +21078 +21079 check-mu-types: # err: (addr buffered-file), ed: (addr exit-descriptor) +21080 # . prologue +21081 55/push-ebp +21082 89/<- %ebp 4/r32/esp +21083 # . save registers +21084 50/push-eax +21085 # var curr/eax: (addr function) = lookup(Program->functions) +21086 (lookup *_Program-functions *_Program-functions->payload) # => eax +21087 { +21088 $check-mu-types:loop: +21089 # if (curr == null) break +21090 3d/compare-eax-and 0/imm32 +21091 0f 84/jump-if-= break/disp32 +21092 +-- 8 lines: #? # dump curr->name ------------------------------------------------------------------------------------------------------------------------------------------------ +21100 (check-mu-function %eax *(ebp+8) *(ebp+0xc)) +21101 # curr = lookup(curr->next) +21102 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax +21103 e9/jump loop/disp32 +21104 } +21105 $check-mu-types:end: +21106 # . restore registers +21107 58/pop-to-eax +21108 # . epilogue +21109 89/<- %esp 5/r32/ebp +21110 5d/pop-to-ebp +21111 c3/return +21112 +21113 check-mu-function: # fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21114 # . prologue +21115 55/push-ebp +21116 89/<- %ebp 4/r32/esp +21117 # . save registers +21118 50/push-eax +21119 56/push-esi +21120 # esi = f +21121 8b/-> *(ebp+8) 6/r32/esi +21122 # outputs +21123 (lookup *(esi+0x10) *(esi+0x14)) # Function-outputs Function-outputs => eax +21124 (check-all-unique-registers %eax %esi *(ebp+0xc) *(ebp+0x10)) +21125 # body +21126 (lookup *(esi+0x18) *(esi+0x1c)) # Function-body Function-body => eax +21127 (check-mu-block %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10)) +21128 # if function has no outputs, we're done +21129 81 7/subop/compare *(esi+0x10) 0/imm32 +21130 74/jump-if-= $check-mu-function:end/disp8 +21131 # some final checks on body +21132 (check-final-stmt-is-return %eax %esi *(ebp+0xc) *(ebp+0x10)) +21133 (check-no-breaks %eax %esi *(ebp+0xc) *(ebp+0x10)) +21134 $check-mu-function:end: +21135 # . restore registers +21136 5e/pop-to-esi +21137 58/pop-to-eax +21138 # . epilogue +21139 89/<- %esp 5/r32/ebp +21140 5d/pop-to-ebp +21141 c3/return +21142 +21143 check-mu-block: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21144 # . prologue +21145 55/push-ebp +21146 89/<- %ebp 4/r32/esp +21147 # . save registers +21148 50/push-eax +21149 # eax = block +21150 8b/-> *(ebp+8) 0/r32/eax +21151 # var stmts/eax: (addr list stmt) = lookup(block->statements) +21152 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax +21153 # +21154 { +21155 $check-mu-block:check-empty: +21156 3d/compare-eax-and 0/imm32 +21157 0f 84/jump-if-= break/disp32 +21158 # emit block->statements +21159 (check-mu-stmt-list %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21160 } +21161 $check-mu-block:end: +21162 # . restore registers +21163 58/pop-to-eax +21164 # . epilogue +21165 89/<- %esp 5/r32/ebp +21166 5d/pop-to-ebp +21167 c3/return +21168 +21169 check-mu-stmt-list: # stmts: (addr list stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21170 # . prologue +21171 55/push-ebp +21172 89/<- %ebp 4/r32/esp +21173 # . save registers +21174 50/push-eax +21175 56/push-esi +21176 # esi = stmts +21177 8b/-> *(ebp+8) 6/r32/esi +21178 { +21179 $check-mu-stmt-list:loop: +21180 81 7/subop/compare %esi 0/imm32 +21181 0f 84/jump-if-= break/disp32 +21182 # var curr-stmt/eax: (addr stmt) = lookup(stmts->value) +21183 (lookup *esi *(esi+4)) # List-value List-value => eax +21184 { +21185 $check-mu-stmt-list:check-for-block: +21186 81 7/subop/compare *eax 0/imm32/block # Stmt-tag +21187 75/jump-if-!= break/disp8 +21188 $check-mu-stmt-list:block: +21189 (check-mu-block %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21190 eb/jump $check-mu-stmt-list:continue/disp8 +21191 } +21192 { +21193 $check-mu-stmt-list:check-for-stmt1: +21194 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag +21195 0f 85/jump-if-!= break/disp32 +21196 $check-mu-stmt-list:stmt1: +21197 (check-mu-stmt %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21198 eb/jump $check-mu-stmt-list:continue/disp8 +21199 } +21200 { +21201 $check-mu-stmt-list:check-for-reg-var-def: +21202 81 7/subop/compare *eax 3/imm32/reg-var-def # Stmt-tag +21203 0f 85/jump-if-!= break/disp32 +21204 $check-mu-stmt-list:reg-var-def: +21205 (check-mu-stmt %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21206 eb/jump $check-mu-stmt-list:continue/disp8 +21207 } +21208 $check-mu-stmt-list:continue: +21209 # TODO: raise an error on unrecognized Stmt-tag +21210 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax +21211 89/<- %esi 0/r32/eax +21212 e9/jump loop/disp32 +21213 } +21214 $check-mu-stmt-list:end: +21215 # . restore registers +21216 5e/pop-to-esi +21217 58/pop-to-eax +21218 # . epilogue +21219 89/<- %esp 5/r32/ebp +21220 5d/pop-to-ebp +21221 c3/return +21222 +21223 check-mu-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21224 # . prologue +21225 55/push-ebp +21226 89/<- %ebp 4/r32/esp +21227 # . save registers +21228 50/push-eax +21229 # - if stmt's operation matches a primitive, check against it +21230 (has-primitive-name? *(ebp+8)) # => eax +21231 3d/compare-eax-and 0/imm32/false +21232 { +21233 74/jump-if-= break/disp8 +21234 (check-mu-primitive *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21235 e9/jump $check-mu-stmt:end/disp32 +21236 } +21237 # - otherwise find a function to check against +21238 # var f/eax: (addr function) = lookup(*Program->functions) +21239 (lookup *_Program-functions *_Program-functions->payload) # => eax +21240 (find-matching-function %eax *(ebp+8)) # => eax +21241 3d/compare-eax-and 0/imm32 +21242 { +21243 74/jump-if-= break/disp8 +21244 (check-mu-call *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21245 eb/jump $check-mu-stmt:end/disp8 +21246 } +21247 # var f/eax: (addr function) = lookup(*Program->signatures) +21248 (lookup *_Program-signatures *_Program-signatures->payload) # => eax +21249 (find-matching-function %eax *(ebp+8)) # => eax +21250 3d/compare-eax-and 0/imm32 +21251 { +21252 74/jump-if-= break/disp8 +21253 (check-mu-call *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21254 eb/jump $check-mu-stmt:end/disp8 +21255 } +21256 # - otherwise abort +21257 e9/jump $check-mu-stmt:unknown-call/disp32 +21258 $check-mu-stmt:end: +21259 # . restore registers +21260 58/pop-to-eax +21261 # . epilogue +21262 89/<- %esp 5/r32/ebp +21263 5d/pop-to-ebp +21264 c3/return +21265 +21266 $check-mu-stmt:unknown-call: +21267 (write-buffered *(ebp+0x10) "unknown function '") +21268 8b/-> *(ebp+8) 0/r32/eax +21269 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +21270 (write-buffered *(ebp+0x10) %eax) +21271 (write-buffered *(ebp+0x10) "'\n") +21272 (flush *(ebp+0x10)) +21273 (stop *(ebp+0x14) 1) +21274 # never gets here +21275 +21276 has-primitive-name?: # stmt: (addr stmt) -> result/eax: boolean +21277 # . prologue +21278 55/push-ebp +21279 89/<- %ebp 4/r32/esp +21280 # . save registers +21281 51/push-ecx +21282 56/push-esi +21283 # var name/esi: (addr array byte) = lookup(stmt->operation) +21284 8b/-> *(ebp+8) 6/r32/esi +21285 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax +21286 89/<- %esi 0/r32/eax +21287 # if (name == "return") return true +21288 (string-equal? %esi "return") # => eax +21289 3d/compare-eax-and 0/imm32/false +21290 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21291 # if (name == "get") return true +21292 (string-equal? %esi "get") # => eax +21293 3d/compare-eax-and 0/imm32/false +21294 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21295 # if (name == "index") return true +21296 (string-equal? %esi "index") # => eax +21297 3d/compare-eax-and 0/imm32/false +21298 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21299 # if (name == "length") return true +21300 (string-equal? %esi "length") # => eax +21301 3d/compare-eax-and 0/imm32/false +21302 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21303 # if (name == "compute-offset") return true +21304 (string-equal? %esi "compute-offset") # => eax +21305 3d/compare-eax-and 0/imm32/false +21306 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21307 # if (name == "copy-object") return true +21308 (string-equal? %esi "copy-object") # => eax +21309 3d/compare-eax-and 0/imm32/false +21310 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21311 # if (name == "clear-object") return true +21312 (string-equal? %esi "clear-object") # => eax +21313 3d/compare-eax-and 0/imm32/false +21314 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21315 # if (name == "allocate") return true +21316 (string-equal? %esi "allocate") # => eax +21317 3d/compare-eax-and 0/imm32/false +21318 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21319 # if (name == "populate") return true +21320 (string-equal? %esi "populate") # => eax +21321 3d/compare-eax-and 0/imm32/false +21322 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21323 # if (name == "populate-stream") return true +21324 (string-equal? %esi "populate-stream") # => eax +21325 3d/compare-eax-and 0/imm32/false +21326 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21327 # if (name == "read-from-stream") return true +21328 (string-equal? %esi "read-from-stream") # => eax +21329 3d/compare-eax-and 0/imm32/false +21330 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21331 # if (name == "write-to-stream") return true +21332 (string-equal? %esi "write-to-stream") # => eax +21333 3d/compare-eax-and 0/imm32/false +21334 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +21335 # var curr/ecx: (addr primitive) = Primitives +21336 b9/copy-to-ecx Primitives/imm32 +21337 { +21338 $has-primitive-name?:loop: +21339 # if (curr == null) break +21340 81 7/subop/compare %ecx 0/imm32 +21341 74/jump-if-= break/disp8 +21342 # if (primitive->name == name) return true +21343 (lookup *ecx *(ecx+4)) # Primitive-name Primitive-name => eax +21344 #? (write-buffered Stderr %eax) +21345 #? (write-buffered Stderr Newline) +21346 #? (flush Stderr) +21347 (string-equal? %esi %eax) # => eax +21348 3d/compare-eax-and 0/imm32/false +21349 75/jump-if-!= $has-primitive-name?:end/disp8 +21350 $has-primitive-name?:next-primitive: +21351 # curr = curr->next +21352 (lookup *(ecx+0x3c) *(ecx+0x40)) # Primitive-next Primitive-next => eax +21353 89/<- %ecx 0/r32/eax +21354 # +21355 e9/jump loop/disp32 +21356 } +21357 # return null +21358 b8/copy-to-eax 0/imm32 +21359 $has-primitive-name?:end: +21360 # . restore registers +21361 5e/pop-to-esi +21362 59/pop-to-ecx +21363 # . epilogue +21364 89/<- %esp 5/r32/ebp +21365 5d/pop-to-ebp +21366 c3/return +21367 +21368 check-mu-primitive: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21369 # . prologue +21370 55/push-ebp +21371 89/<- %ebp 4/r32/esp +21372 # . save registers +21373 50/push-eax +21374 51/push-ecx +21375 # var op/ecx: (addr array byte) = lookup(stmt->operation) +21376 8b/-> *(ebp+8) 0/r32/eax +21377 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +21378 89/<- %ecx 0/r32/eax +21379 # if (op == "copy") check-mu-copy-stmt +21380 { +21381 (string-equal? %ecx "copy") # => eax +21382 3d/compare-eax-and 0/imm32/false +21383 74/jump-if-= break/disp8 +21384 (check-mu-copy-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21385 e9/jump $check-mu-primitive:end/disp32 +21386 } +21387 # if (op == "copy-to") check-mu-copy-to-stmt +21388 { +21389 (string-equal? %ecx "copy-to") # => eax +21390 3d/compare-eax-and 0/imm32/false +21391 74/jump-if-= break/disp8 +21392 (check-mu-copy-to-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21393 e9/jump $check-mu-primitive:end/disp32 +21394 } +21395 # if (op == "copy-byte") check-mu-copy-byte-stmt +21396 { +21397 (string-equal? %ecx "copy-byte") # => eax +21398 3d/compare-eax-and 0/imm32/false +21399 74/jump-if-= break/disp8 +21400 (check-mu-copy-byte-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21401 e9/jump $check-mu-primitive:end/disp32 +21402 } +21403 # if (op == "copy-byte-to") check-mu-copy-byte-to-stmt +21404 { +21405 (string-equal? %ecx "copy-byte-to") # => eax +21406 3d/compare-eax-and 0/imm32/false +21407 74/jump-if-= break/disp8 +21408 (check-mu-copy-byte-to-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21409 e9/jump $check-mu-primitive:end/disp32 +21410 } +21411 # if (op == "compare") check-mu-compare-stmt +21412 { +21413 (string-equal? %ecx "compare") # => eax +21414 3d/compare-eax-and 0/imm32/false +21415 74/jump-if-= break/disp8 +21416 (check-mu-compare-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21417 e9/jump $check-mu-primitive:end/disp32 +21418 } +21419 # if (op == "address") check-mu-address-stmt +21420 { +21421 (string-equal? %ecx "address") # => eax +21422 3d/compare-eax-and 0/imm32/false +21423 74/jump-if-= break/disp8 +21424 (check-mu-address-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21425 e9/jump $check-mu-primitive:end/disp32 +21426 } +21427 # if (op == "return") check-mu-return-stmt +21428 { +21429 (string-equal? %ecx "return") # => eax +21430 3d/compare-eax-and 0/imm32/false +21431 74/jump-if-= break/disp8 +21432 (check-mu-return-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21433 e9/jump $check-mu-primitive:end/disp32 +21434 } +21435 # if (op == "get") check-mu-get-stmt +21436 { +21437 (string-equal? %ecx "get") # => eax +21438 3d/compare-eax-and 0/imm32/false +21439 74/jump-if-= break/disp8 +21440 (check-mu-get-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21441 e9/jump $check-mu-primitive:end/disp32 +21442 } +21443 # if (op == "index") check-mu-index-stmt +21444 { +21445 (string-equal? %ecx "index") # => eax +21446 3d/compare-eax-and 0/imm32/false +21447 74/jump-if-= break/disp8 +21448 (check-mu-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21449 e9/jump $check-mu-primitive:end/disp32 +21450 } +21451 # if (op == "length") check-mu-length-stmt +21452 { +21453 (string-equal? %ecx "length") # => eax +21454 3d/compare-eax-and 0/imm32/false +21455 74/jump-if-= break/disp8 +21456 (check-mu-length-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21457 e9/jump $check-mu-primitive:end/disp32 +21458 } +21459 # if (op == "compute-offset") check-mu-compute-offset-stmt +21460 { +21461 (string-equal? %ecx "compute-offset") # => eax +21462 3d/compare-eax-and 0/imm32/false +21463 74/jump-if-= break/disp8 +21464 (check-mu-compute-offset-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21465 e9/jump $check-mu-primitive:end/disp32 +21466 } +21467 # if (op == "copy-object") check-mu-copy-object-stmt +21468 { +21469 (string-equal? %ecx "copy-object") # => eax +21470 3d/compare-eax-and 0/imm32/false +21471 74/jump-if-= break/disp8 +21472 (check-mu-copy-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21473 e9/jump $check-mu-primitive:end/disp32 +21474 } +21475 # if (op == "clear-object") check-mu-clear-object-stmt +21476 { +21477 (string-equal? %ecx "clear-object") # => eax +21478 3d/compare-eax-and 0/imm32/false +21479 74/jump-if-= break/disp8 +21480 (check-mu-clear-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21481 e9/jump $check-mu-primitive:end/disp32 +21482 } +21483 # if (op == "allocate") check-mu-allocate-stmt +21484 { +21485 (string-equal? %ecx "allocate") # => eax +21486 3d/compare-eax-and 0/imm32/false +21487 74/jump-if-= break/disp8 +21488 (check-mu-allocate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21489 e9/jump $check-mu-primitive:end/disp32 +21490 } +21491 # if (op == "populate") check-mu-populate-stmt 21492 { -21493 75/jump-if-!= break/disp8 -21494 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21495 } -21496 89/<- %edx 0/r32/eax -21497 # var inout-type/ecx: (addr type-tree) = inout->value->type -21498 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21499 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21500 89/<- %ecx 0/r32/eax -21501 # if (inout->is-deref?) inout-type = inout-type->payload -21502 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref -21503 3d/compare-eax-and 0/imm32/false -21504 { -21505 74/jump-if-= break/disp8 -21506 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -21507 # if inout-type->right is null, t = inout-type->left -21508 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -21509 { -21510 75/jump-if-!= break/disp8 -21511 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21512 } -21513 89/<- %ecx 0/r32/eax +21493 (string-equal? %ecx "populate") # => eax +21494 3d/compare-eax-and 0/imm32/false +21495 74/jump-if-= break/disp8 +21496 (check-mu-populate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21497 e9/jump $check-mu-primitive:end/disp32 +21498 } +21499 # if (op == "populate-stream") check-mu-populate-stream-stmt +21500 { +21501 (string-equal? %ecx "populate-stream") # => eax +21502 3d/compare-eax-and 0/imm32/false +21503 74/jump-if-= break/disp8 +21504 (check-mu-populate-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21505 e9/jump $check-mu-primitive:end/disp32 +21506 } +21507 # if (op == "read-from-stream") check-mu-read-from-stream-stmt +21508 { +21509 (string-equal? %ecx "read-from-stream") # => eax +21510 3d/compare-eax-and 0/imm32/false +21511 74/jump-if-= break/disp8 +21512 (check-mu-read-from-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21513 e9/jump $check-mu-primitive:end/disp32 21514 } -21515 # if (inout-type != output-type) abort -21516 (type-equal-ignoring-capacity? %edx %ecx) # => eax -21517 3d/compare-eax-and 0/imm32 -21518 0f 84/jump-if-= $check-mu-address-stmt:error-type-mismatch/disp32 -21519 $check-mu-address-stmt:end: -21520 # . restore registers -21521 5f/pop-to-edi -21522 5e/pop-to-esi -21523 5a/pop-to-edx -21524 59/pop-to-ecx -21525 58/pop-to-eax -21526 # . epilogue -21527 89/<- %esp 5/r32/ebp -21528 5d/pop-to-ebp -21529 c3/return -21530 -21531 $check-mu-address-stmt:error-no-inout: -21532 (write-buffered *(ebp+0x10) "fn ") -21533 8b/-> *(ebp+0xc) 0/r32/eax -21534 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21535 (write-buffered *(ebp+0x10) %eax) -21536 (write-buffered *(ebp+0x10) ": stmt 'address' expects an inout\n") -21537 (flush *(ebp+0x10)) -21538 (stop *(ebp+0x14) 1) -21539 # never gets here -21540 -21541 $check-mu-address-stmt:error-too-many-inouts: -21542 (write-buffered *(ebp+0x10) "fn ") -21543 8b/-> *(ebp+0xc) 0/r32/eax -21544 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21545 (write-buffered *(ebp+0x10) %eax) -21546 (write-buffered *(ebp+0x10) ": stmt 'address' must have just one inout\n") -21547 (flush *(ebp+0x10)) -21548 (stop *(ebp+0x14) 1) -21549 # never gets here -21550 -21551 $check-mu-address-stmt:error-no-output: -21552 (write-buffered *(ebp+0x10) "fn ") -21553 8b/-> *(ebp+0xc) 0/r32/eax -21554 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21555 (write-buffered *(ebp+0x10) %eax) -21556 (write-buffered *(ebp+0x10) ": stmt 'address' expects an output\n") -21557 (flush *(ebp+0x10)) -21558 (stop *(ebp+0x14) 1) -21559 # never gets here -21560 -21561 $check-mu-address-stmt:error-output-not-in-register: -21562 (write-buffered *(ebp+0x10) "fn ") -21563 8b/-> *(ebp+0xc) 0/r32/eax -21564 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21565 (write-buffered *(ebp+0x10) %eax) -21566 (write-buffered *(ebp+0x10) ": stmt address: output '") -21567 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21568 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21569 (write-buffered *(ebp+0x10) %eax) -21570 (write-buffered *(ebp+0x10) "' not in a register\n") -21571 (flush *(ebp+0x10)) -21572 (stop *(ebp+0x14) 1) -21573 # never gets here -21574 -21575 $check-mu-address-stmt:error-too-many-outputs: -21576 (write-buffered *(ebp+0x10) "fn ") -21577 8b/-> *(ebp+0xc) 0/r32/eax -21578 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21579 (write-buffered *(ebp+0x10) %eax) -21580 (write-buffered *(ebp+0x10) ": stmt 'address' must have just one output\n") -21581 (flush *(ebp+0x10)) -21582 (stop *(ebp+0x14) 1) -21583 # never gets here -21584 -21585 $check-mu-address-stmt:error-output-not-address: -21586 (write-buffered *(ebp+0x10) "fn ") -21587 8b/-> *(ebp+0xc) 0/r32/eax -21588 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21589 (write-buffered *(ebp+0x10) %eax) -21590 (write-buffered *(ebp+0x10) ": stmt address: output '") -21591 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21592 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21593 (write-buffered *(ebp+0x10) %eax) -21594 (write-buffered *(ebp+0x10) "' is not an addr\n") -21595 (flush *(ebp+0x10)) -21596 (stop *(ebp+0x14) 1) -21597 # never gets here -21598 -21599 $check-mu-address-stmt:error-type-mismatch: -21600 (write-buffered *(ebp+0x10) "fn ") -21601 8b/-> *(ebp+0xc) 0/r32/eax -21602 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21603 (write-buffered *(ebp+0x10) %eax) -21604 (write-buffered *(ebp+0x10) ": stmt address: output '") -21605 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21606 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21607 (write-buffered *(ebp+0x10) %eax) -21608 (write-buffered *(ebp+0x10) "' cannot hold address of '") -21609 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21610 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21611 (write-buffered *(ebp+0x10) %eax) -21612 (write-buffered *(ebp+0x10) "'\n") -21613 (flush *(ebp+0x10)) -21614 (stop *(ebp+0x14) 1) -21615 # never gets here -21616 -21617 type-equal-ignoring-capacity?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean -21618 # . prologue -21619 55/push-ebp -21620 89/<- %ebp 4/r32/esp -21621 # . save registers -21622 51/push-ecx -21623 52/push-edx -21624 53/push-ebx -21625 # var curr-a/ecx: (addr type-tree) = a -21626 8b/-> *(ebp+8) 1/r32/ecx -21627 # var curr-b/ebx: (addr type-tree) = b -21628 8b/-> *(ebp+0xc) 3/r32/ebx -21629 # if (curr-a->is-atom?) fall back to regular equality -21630 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -21631 0f 85/jump-if-!= $type-equal-ignoring-capacity?:base-case/disp32 -21632 # if (curr-a->left != curr-b->left) return false -21633 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -21634 89/<- %edx 0/r32/eax -21635 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -21636 (type-equal? %edx %eax) # => eax -21637 3d/compare-eax-and 0/imm32/false -21638 0f 84/jump-if-= $type-equal-ignoring-capacity?:end/disp32 # eax switches meaning -21639 # if (curr-a->left == "array") curr-a = curr-a->element-type -21640 { -21641 (is-mu-array? %edx) # => eax -21642 3d/compare-eax-and 0/imm32/false -21643 75/jump-if-!= break/disp8 -21644 $type-equal-ignoring-capacity?:array: -21645 # curr-a = curr-a->right->left -21646 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -21647 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21648 89/<- %ecx 0/r32/eax -21649 # curr-b = curr-b->right->left -21650 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21651 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21652 89/<- %ebx 0/r32/eax -21653 eb/jump $type-equal-ignoring-capacity?:base-case/disp8 -21654 } -21655 # if (curr-a->left == "stream") curr-a = curr-a->element-type -21656 { -21657 (is-mu-stream? %edx) # => eax -21658 3d/compare-eax-and 0/imm32/false -21659 75/jump-if-!= break/disp8 -21660 $type-equal-ignoring-capacity?:stream: -21661 # curr-a = curr-a->right->left -21662 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -21663 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21664 89/<- %ecx 0/r32/eax -21665 # curr-b = curr-b->right->left -21666 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21667 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21668 89/<- %ebx 0/r32/eax -21669 eb/jump $type-equal-ignoring-capacity?:base-case/disp8 -21670 } -21671 $type-equal-ignoring-capacity?:base-case: -21672 # return type-equal?(curr-a, curr-b) -21673 (type-equal? %ecx %ebx) # => eax -21674 $type-equal-ignoring-capacity?:end: +21515 # if (op == "write-to-stream") check-mu-write-to-stream-stmt +21516 { +21517 (string-equal? %ecx "write-to-stream") # => eax +21518 3d/compare-eax-and 0/imm32/false +21519 74/jump-if-= break/disp8 +21520 (check-mu-write-to-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21521 e9/jump $check-mu-primitive:end/disp32 +21522 } +21523 # if (op == "convert") check-mu-convert-stmt +21524 { +21525 (string-equal? %ecx "convert") # => eax +21526 3d/compare-eax-and 0/imm32/false +21527 74/jump-if-= break/disp8 +21528 (check-mu-convert-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21529 e9/jump $check-mu-primitive:end/disp32 +21530 } +21531 # otherwise check-numberlike-stmt +21532 (check-mu-numberlike-primitive *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21533 $check-mu-primitive:end: +21534 # . restore registers +21535 59/pop-to-ecx +21536 58/pop-to-eax +21537 # . epilogue +21538 89/<- %esp 5/r32/ebp +21539 5d/pop-to-ebp +21540 c3/return +21541 +21542 # by default, Mu primitives should only operate on 'number-like' types +21543 check-mu-numberlike-primitive: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21544 # . prologue +21545 55/push-ebp +21546 89/<- %ebp 4/r32/esp +21547 # . save registers +21548 50/push-eax +21549 51/push-ecx +21550 56/push-esi +21551 # esi = stmt +21552 8b/-> *(ebp+8) 6/r32/esi +21553 # var gas/ecx: int = 2 +21554 b9/copy-to-ecx 2/imm32 +21555 # - check at most 1 output +21556 # var output/eax: (addr stmt-var) = stmt->outputs +21557 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +21558 { +21559 3d/compare-eax-and 0/imm32 +21560 74/jump-if-= break/disp8 +21561 $check-mu-numberlike-primitive:output: +21562 (check-mu-numberlike-output %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21563 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21564 3d/compare-eax-and 0/imm32 +21565 0f 85/jump-if-!= $check-mu-numberlike-primitive:error-too-many-outputs/disp32 +21566 # check output is in a register +21567 # --gas +21568 49/decrement-ecx +21569 } +21570 # - check first inout +21571 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21572 { +21573 3d/compare-eax-and 0/imm32 +21574 0f 84/jump-if-= $check-mu-numberlike-primitive:end/disp32 +21575 $check-mu-numberlike-primitive:first-inout: +21576 (check-mu-numberlike-arg %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21577 # --gas +21578 49/decrement-ecx +21579 } +21580 # - check second inout +21581 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21582 { +21583 3d/compare-eax-and 0/imm32 +21584 74/jump-if-= $check-mu-numberlike-primitive:end/disp8 +21585 $check-mu-numberlike-primitive:second-inout: +21586 # is a second inout allowed? +21587 81 7/subop/compare %ecx 0/imm32 +21588 0f 84/jump-if-= $check-mu-numberlike-primitive:error-too-many-inouts/disp32 +21589 $check-mu-numberlike-primitive:second-inout-permitted: +21590 (check-mu-numberlike-arg %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21591 } +21592 $check-mu-numberlike-primitive:third-inout: +21593 # if there's a third arg, raise an error +21594 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next +21595 0f 85/jump-if-!= $check-mu-numberlike-primitive:error-too-many-inouts/disp32 +21596 $check-mu-numberlike-primitive:end: +21597 # . restore registers +21598 5e/pop-to-esi +21599 59/pop-to-ecx +21600 58/pop-to-eax +21601 # . epilogue +21602 89/<- %esp 5/r32/ebp +21603 5d/pop-to-ebp +21604 c3/return +21605 +21606 $check-mu-numberlike-primitive:error-too-many-inouts: +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 ") +21612 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax +21613 (write-buffered *(ebp+0x10) %eax) +21614 (write-buffered *(ebp+0x10) ": too many inouts; most primitives support at most two arguments, across inouts and outputs\n") +21615 (flush *(ebp+0x10)) +21616 (stop *(ebp+0x14) 1) +21617 # never gets here +21618 +21619 $check-mu-numberlike-primitive:error-too-many-outputs: +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 ") +21625 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax +21626 (write-buffered *(ebp+0x10) %eax) +21627 (write-buffered *(ebp+0x10) ": too many outputs; most primitives support at most one output\n") +21628 (flush *(ebp+0x10)) +21629 (stop *(ebp+0x14) 1) +21630 # never gets here +21631 +21632 check-mu-numberlike-arg: # v: (addr stmt-var), stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21633 # . prologue +21634 55/push-ebp +21635 89/<- %ebp 4/r32/esp +21636 # . save registers +21637 50/push-eax +21638 56/push-esi +21639 # var t/esi: (addr type-tree) = lookup(v->value->type) +21640 8b/-> *(ebp+8) 0/r32/eax +21641 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21642 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +21643 89/<- %esi 0/r32/eax +21644 $check-mu-numberlike-arg:check-literal: +21645 # if t is an int, return +21646 (is-simple-mu-type? %esi 0) # literal => eax +21647 3d/compare-eax-and 0/imm32/false +21648 0f 85/jump-if-!= $check-mu-numberlike-arg:end/disp32 +21649 $check-mu-numberlike-arg:check-addr: +21650 # if t is an addr and v is dereferenced, return whether t->payload is an addr +21651 { +21652 (is-mu-addr-type? %esi) # => eax +21653 3d/compare-eax-and 0/imm32/false +21654 74/jump-if-= break/disp8 +21655 8b/-> *(ebp+8) 0/r32/eax +21656 8b/-> *(eax+0x10) 0/r32/eax # Stmt-var-is-deref +21657 3d/compare-eax-and 0/imm32/false +21658 { +21659 74/jump-if-= break/disp8 +21660 (lookup *(esi+0xc) *(esi+0x10)) # Type-tree-right Type-tree-right => eax +21661 # if t->right is null, t = t->left +21662 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +21663 { +21664 75/jump-if-!= break/disp8 +21665 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +21666 } +21667 (is-mu-addr-type? %eax) # => eax +21668 3d/compare-eax-and 0/imm32/false +21669 74/jump-if-= $check-mu-numberlike-arg:end/disp8 +21670 } +21671 } +21672 $check-mu-numberlike-arg:output-checks: +21673 (check-mu-numberlike-output *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) +21674 $check-mu-numberlike-arg:end: 21675 # . restore registers -21676 5b/pop-to-ebx -21677 5a/pop-to-edx -21678 59/pop-to-ecx -21679 # . epilogue -21680 89/<- %esp 5/r32/ebp -21681 5d/pop-to-ebp -21682 c3/return -21683 -21684 check-mu-return-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -21685 # . prologue -21686 55/push-ebp -21687 89/<- %ebp 4/r32/esp -21688 # . save registers -21689 50/push-eax -21690 51/push-ecx -21691 52/push-edx -21692 53/push-ebx -21693 56/push-esi -21694 57/push-edi -21695 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) -21696 81 5/subop/subtract %esp 0x60/imm32 -21697 68/push 0x60/imm32/size -21698 68/push 0/imm32/read -21699 68/push 0/imm32/write -21700 89/<- %edx 4/r32/esp -21701 # var template/esi: (addr list var) = fn->outputs -21702 8b/-> *(ebp+0xc) 0/r32/eax -21703 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax -21704 89/<- %esi 0/r32/eax -21705 # var curr-template/ebx: (addr list var) = fn->outputs -21706 89/<- %ebx 0/r32/eax -21707 # var curr/edi: (addr stmt-var) = stmt->inouts -21708 8b/-> *(ebp+8) 0/r32/eax -21709 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21710 89/<- %edi 0/r32/eax -21711 { -21712 # if template is null, break -21713 81 7/subop/compare %ebx 0/imm32 -21714 0f 84/jump-if-= break/disp32 -21715 # if curr is null, abort -21716 81 7/subop/compare %edi 0/imm32 -21717 0f 84/jump-if-= $check-mu-return-stmt:error-too-few-inouts/disp32 -21718 # var template-type/ecx: (addr type-tree) = template->value->type -21719 (lookup *ebx *(ebx+4)) # List-value List-value => eax -21720 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21721 89/<- %ecx 0/r32/eax -21722 # var curr-type/eax: (addr type-tree) = curr->value->type -21723 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21724 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21725 # if (curr->is-deref?) curr-type = payload of curr-type -21726 81 7/subop/compare *(edi+0x10) 0/imm32/false # Stmt-var-is-deref -21727 { -21728 74/jump-if-= break/disp8 -21729 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -21730 # if t->right is null, t = t->left -21731 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -21732 75/jump-if-!= break/disp8 -21733 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21734 } -21735 # if (curr-type != template-type) abort -21736 (type-match? %ecx %eax %edx) # => eax -21737 3d/compare-eax-and 0/imm32/false -21738 0f 84/jump-if-= $check-mu-return-stmt:error1/disp32 -21739 # if register-within-list-with-conflict?(curr, original template, curr-template, stmt) abort -21740 (register-within-list-with-conflict? %edi %esi %ebx *(ebp+8)) # => eax -21741 3d/compare-eax-and 0/imm32/false -21742 0f 85/jump-if-!= $check-mu-return-stmt:error2/disp32 -21743 # template = template->next -21744 (lookup *(ebx+8) *(ebx+0xc)) # List-next List-next => eax -21745 89/<- %ebx 0/r32/eax -21746 # curr = curr->next -21747 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -21748 89/<- %edi 0/r32/eax -21749 # -21750 e9/jump loop/disp32 -21751 } -21752 # if curr is not null, abort -21753 81 7/subop/compare %edi 0/imm32 -21754 0f 85/jump-if-!= $check-mu-return-stmt:error-too-many-inouts/disp32 -21755 $check-mu-return-stmt:end: -21756 # . reclaim locals -21757 81 0/subop/add %esp 0x6c/imm32 -21758 # . restore registers -21759 5f/pop-to-edi -21760 5e/pop-to-esi -21761 5b/pop-to-ebx -21762 5a/pop-to-edx -21763 59/pop-to-ecx -21764 58/pop-to-eax -21765 # . epilogue -21766 89/<- %esp 5/r32/ebp -21767 5d/pop-to-ebp -21768 c3/return -21769 -21770 $check-mu-return-stmt:error1: -21771 (write-buffered *(ebp+0x10) "fn ") -21772 8b/-> *(ebp+0xc) 0/r32/eax -21773 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21774 (write-buffered *(ebp+0x10) %eax) -21775 (write-buffered *(ebp+0x10) ": return: '") -21776 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21777 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21778 (write-buffered *(ebp+0x10) %eax) -21779 (write-buffered *(ebp+0x10) "' has the wrong type\n") -21780 (flush *(ebp+0x10)) -21781 (stop *(ebp+0x14) 1) -21782 # never gets here -21783 -21784 $check-mu-return-stmt:error2: -21785 (write-buffered *(ebp+0x10) "fn ") -21786 8b/-> *(ebp+0xc) 0/r32/eax -21787 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21788 (write-buffered *(ebp+0x10) %eax) -21789 (write-buffered *(ebp+0x10) ": return: '") -21790 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21791 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21792 (write-buffered *(ebp+0x10) %eax) -21793 (write-buffered *(ebp+0x10) "' is no longer available\n") -21794 (flush *(ebp+0x10)) -21795 (stop *(ebp+0x14) 1) -21796 # never gets here -21797 -21798 $check-mu-return-stmt:error-too-few-inouts: -21799 (write-buffered *(ebp+0x10) "fn ") -21800 8b/-> *(ebp+0xc) 0/r32/eax -21801 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21802 (write-buffered *(ebp+0x10) %eax) -21803 (write-buffered *(ebp+0x10) ": return: too few inouts\n") -21804 (flush *(ebp+0x10)) -21805 (stop *(ebp+0x14) 1) -21806 # never gets here -21807 -21808 $check-mu-return-stmt:error-too-many-inouts: -21809 (write-buffered *(ebp+0x10) "fn ") -21810 8b/-> *(ebp+0xc) 0/r32/eax -21811 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21812 (write-buffered *(ebp+0x10) %eax) -21813 (write-buffered *(ebp+0x10) ": return: too many inouts\n") -21814 (flush *(ebp+0x10)) -21815 (stop *(ebp+0x14) 1) -21816 # never gets here -21817 -21818 check-all-unique-registers: # outputs: (addr list var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -21819 # . prologue -21820 55/push-ebp -21821 89/<- %ebp 4/r32/esp -21822 # . save registers -21823 50/push-eax -21824 51/push-ecx -21825 56/push-esi -21826 # var table/esi: (addr table (handle array byte) int 8) -21827 81 5/subop/subtract %esp 0x60/imm32 -21828 68/push 0x60/imm32/size -21829 68/push 0/imm32/read -21830 68/push 0/imm32/write -21831 89/<- %esi 4/r32/esp -21832 # var curr/ecx: (addr list var) = outputs -21833 8b/-> *(ebp+8) 1/r32/ecx -21834 { -21835 # if (curr == 0) break -21836 81 7/subop/compare %ecx 0/imm32 -21837 0f 84/jump-if-= break/disp32 -21838 # var reg/eax: (addr array byte) = curr->value->register # guaranteed to exist -21839 (lookup *ecx *(ecx+4)) # List-value List-value => eax -21840 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -21841 # if reg exists in table, abort -21842 (maybe-get %esi %eax 0xc) # => eax -21843 3d/compare-eax-and 0/imm32 -21844 0f 85/jump-if-!= $check-all-unique-registers:abort/disp32 -21845 # insert reg in table -21846 (lookup *ecx *(ecx+4)) # List-value List-value => eax -21847 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -21848 (get-or-insert %esi %eax 0xc Heap) -21849 # curr = curr->next -21850 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -21851 89/<- %ecx 0/r32/eax -21852 e9/jump loop/disp32 -21853 } -21854 $check-all-unique-registers:end: -21855 # . reclaim locals -21856 81 0/subop/add %esp 0x6c/imm32 -21857 # . restore registers -21858 5e/pop-to-esi -21859 59/pop-to-ecx -21860 58/pop-to-eax -21861 # . epilogue -21862 89/<- %esp 5/r32/ebp -21863 5d/pop-to-ebp -21864 c3/return -21865 -21866 $check-all-unique-registers:abort: -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) ": outputs must be in unique registers\n") -21872 (flush *(ebp+0x10)) -21873 (stop *(ebp+0x14) 1) -21874 # never gets here -21875 -21876 # return false if s's register is not between start (inclusive) and end (exclusive) -21877 # return false if the positionally corresponding register in stmt->inouts (where s comes from) is also s's register -21878 # otherwise return true -21879 register-within-list-with-conflict?: # s: (addr stmt-var), start: (addr list var), end: (addr list var), stmt: (addr stmt) -> result/eax: boolean -21880 # . prologue -21881 55/push-ebp -21882 89/<- %ebp 4/r32/esp -21883 # . save registers -21884 51/push-ecx -21885 52/push-edx -21886 53/push-ebx -21887 56/push-esi -21888 57/push-edi -21889 # var target/ebx: (addr array byte) = s->value->register -21890 8b/-> *(ebp+8) 0/r32/eax -21891 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -21892 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -21893 #? (write-buffered Stderr "AA: ") -21894 #? (write-buffered Stderr %eax) -21895 #? (write-buffered Stderr Newline) -21896 #? (flush Stderr) -21897 # if (var->register == 0) return false -21898 3d/compare-eax-and 0/imm32 -21899 0f 84/jump-if-= $register-within-list-with-conflict?:end/disp32 # eax turns into result -21900 89/<- %ebx 0/r32/eax -21901 # var curr/ecx: (addr list var) = start -21902 8b/-> *(ebp+0xc) 1/r32/ecx -21903 # edx = end -21904 8b/-> *(ebp+0x10) 2/r32/edx -21905 { -21906 # if (curr == 0) break -21907 81 7/subop/compare %edi 0/imm32 -21908 0f 84/jump-if-= break/disp32 -21909 # if (curr == end) break -21910 39/compare %ecx 2/r32/edx -21911 0f 84/jump-if-= break/disp32 -21912 # var curr-reg/eax: (addr array byte) = curr->value->register -21913 (lookup *ecx *(ecx+4)) # List-value List-value => eax -21914 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -21915 # if (curr-reg == 0) continue -21916 3d/compare-eax-and 0/imm32 -21917 74/jump-if-= $register-within-list-with-conflict?:continue/disp8 -21918 # if (curr-reg == target) check for conflict -21919 (string-equal? %eax %ebx) # => eax -21920 3d/compare-eax-and 0/imm32/false -21921 { -21922 74/jump-if-= break/disp8 -21923 #? (write-buffered Stderr "conflict?\n") -21924 #? (flush Stderr) -21925 # var return-inouts/eax: (addr stmt-var) = stmt->inouts -21926 8b/-> *(ebp+0x14) 0/r32/eax -21927 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21928 (register-conflict? %ebx %eax *(ebp+0xc)) # => eax -21929 eb/jump $register-within-list-with-conflict?:end/disp8 -21930 } -21931 $register-within-list-with-conflict?:continue: -21932 # curr = curr->next -21933 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -21934 89/<- %ecx 0/r32/eax -21935 e9/jump loop/disp32 -21936 } -21937 # return false -21938 b8/copy-to-eax 0/imm32/false -21939 $register-within-list-with-conflict?:end: -21940 # . restore registers -21941 5f/pop-to-edi -21942 5e/pop-to-esi -21943 5b/pop-to-ebx -21944 5a/pop-to-edx -21945 59/pop-to-ecx -21946 # . epilogue -21947 89/<- %esp 5/r32/ebp -21948 5d/pop-to-ebp -21949 c3/return -21950 -21951 # At the first occurrence of register 'reg' in fn-outputs, -21952 # check if the corresponding element of return-inouts has a different register. -21953 # This hacky helper is intended to be called in one specific place. Don't -21954 # reuse it as is. -21955 register-conflict?: # reg: (addr array byte), return-inouts: (addr stmt-var), fn-outputs: (addr list var) => result/eax: boolean -21956 # . prologue -21957 55/push-ebp -21958 89/<- %ebp 4/r32/esp -21959 # . save registers -21960 51/push-ecx -21961 52/push-edx -21962 53/push-ebx -21963 56/push-esi -21964 57/push-edi -21965 #? (write-buffered Stderr "BB: ") -21966 #? (write-buffered Stderr *(ebp+8)) -21967 #? (write-buffered Stderr Newline) -21968 #? (flush Stderr) -21969 # var curr-output/edi: (addr list var) = fn-outputs -21970 8b/-> *(ebp+0x10) 7/r32/edi -21971 # var curr-inout/esi: (addr stmt-var) = return-inouts -21972 8b/-> *(ebp+0xc) 6/r32/esi -21973 { -21974 # if (curr-output == 0) abort -21975 81 7/subop/compare %edi 0/imm32 -21976 0f 84/jump-if-= break/disp32 -21977 # if (curr-output->value->register != reg) continue -21978 (lookup *edi *(edi+4)) # List-value List-value => eax -21979 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -21980 (string-equal? %eax *(ebp+8)) # => eax -21981 3d/compare-eax-and 0/imm32/false -21982 0f 84/jump-if= $register-conflict?:continue/disp32 -21983 #? (write-buffered Stderr "rescan\n") -21984 #? (flush Stderr) -21985 # var curr-reg/eax: (addr array byte) = curr-inout->value->register -21986 (lookup *esi *(esi+4)) # List-value List-value => eax -21987 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -21988 # if (curr-reg == 0) return true -21989 3d/compare-eax-and 0/imm32 -21990 { -21991 75/jump-if-!= break/disp8 -21992 #? (write-buffered Stderr "no register\n") -21993 #? (flush Stderr) -21994 b8/copy-to-eax 1/imm32/true -21995 e9/jump $register-conflict?:end/disp32 -21996 } -21997 # return (curr-reg != reg) -21998 (string-equal? %eax *(ebp+8)) # => eax -21999 3d/compare-eax-and 0/imm32/false -22000 0f 94/set-if-= %al -22001 #? (write-buffered Stderr "final: ") -22002 #? (write-int32-hex-buffered Stderr %eax) -22003 #? (write-buffered Stderr Newline) -22004 #? (flush Stderr) -22005 eb/jump $register-conflict?:end/disp8 -22006 $register-conflict?:continue: -22007 # curr-output = curr-output->next -22008 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -22009 89/<- %edi 0/r32/eax -22010 # curr-inout = curr-inout->next -22011 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -22012 89/<- %esi 0/r32/eax -22013 e9/jump loop/disp32 -22014 } -22015 # should never get here -22016 (write-buffered Stderr "register-conflict? misused\n") -22017 (flush Stderr) -22018 e8/call syscall_exit/disp32 -22019 $register-conflict?:end: -22020 # . restore registers -22021 5f/pop-to-edi -22022 5e/pop-to-esi -22023 5b/pop-to-ebx -22024 5a/pop-to-edx -22025 59/pop-to-ecx -22026 # . epilogue -22027 89/<- %esp 5/r32/ebp -22028 5d/pop-to-ebp -22029 c3/return -22030 -22031 check-final-stmt-is-return: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -22032 # . prologue -22033 55/push-ebp -22034 89/<- %ebp 4/r32/esp -22035 # . save registers -22036 50/push-eax -22037 51/push-ecx -22038 # var curr/ecx: (addr list stmt) = block->stmts -22039 8b/-> *(ebp+8) 0/r32/eax -22040 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax -22041 3d/compare-eax-and 0/imm32 -22042 74/jump-if-= $check-final-stmt-is-return:end/disp8 -22043 89/<- %ecx 0/r32/eax -22044 { -22045 # if curr->next == 0, break -22046 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -22047 3d/compare-eax-and 0/imm32 -22048 74/jump-if-= break/disp8 -22049 # curr = curr->next -22050 89/<- %ecx 0/r32/eax -22051 e9/jump loop/disp32 -22052 } -22053 $check-final-stmt-is-return:check-tag: -22054 # if curr->value->tag != Stmt1, abort -22055 (lookup *ecx *(ecx+4)) # List-value List-value => eax -22056 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag -22057 75/jump-if-!= $check-final-stmt-is-return:error/disp8 -22058 $check-final-stmt-is-return:check-operation: -22059 # if curr->operation != "return", abort -22060 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -22061 (string-equal? %eax "return") -22062 3d/compare-eax-and 0/imm32/false -22063 74/jump-if-= $check-final-stmt-is-return:error/disp8 -22064 $check-final-stmt-is-return:end: -22065 # . restore registers -22066 59/pop-to-ecx -22067 58/pop-to-eax -22068 # . epilogue -22069 89/<- %esp 5/r32/ebp -22070 5d/pop-to-ebp -22071 c3/return -22072 -22073 $check-final-stmt-is-return:error: -22074 (write-buffered *(ebp+0x10) "fn ") -22075 8b/-> *(ebp+0xc) 0/r32/eax -22076 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22077 (write-buffered *(ebp+0x10) %eax) -22078 (write-buffered *(ebp+0x10) ": final statement should be a 'return'\n") -22079 (flush *(ebp+0x10)) -22080 (stop *(ebp+0x14) 1) -22081 # never gets here -22082 -22083 check-no-breaks: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -22084 # . prologue -22085 55/push-ebp -22086 89/<- %ebp 4/r32/esp -22087 # . save registers -22088 50/push-eax -22089 51/push-ecx -22090 # var curr/ecx: (addr list stmt) = block->stmts -22091 8b/-> *(ebp+8) 0/r32/eax -22092 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax -22093 3d/compare-eax-and 0/imm32 -22094 0f 84/jump-if-= $check-no-breaks:end/disp32 -22095 89/<- %ecx 0/r32/eax -22096 { -22097 # if curr->next == 0, break -22098 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -22099 3d/compare-eax-and 0/imm32 -22100 74/jump-if-= break/disp8 -22101 # if curr->value->tag != Stmt1, continue -22102 (lookup *ecx *(ecx+4)) # List-value List-value => eax -22103 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag -22104 75/jump-if-!= $check-no-breaks:continue/disp8 -22105 # if curr->value->operation starts with "break", abort -22106 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -22107 (string-starts-with? %eax "break") # => eax -22108 3d/compare-eax-and 0/imm32/false -22109 75/jump-if-!= $check-no-breaks:error/disp8 -22110 $check-no-breaks:continue: -22111 # curr = curr->next -22112 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -22113 89/<- %ecx 0/r32/eax -22114 e9/jump loop/disp32 -22115 } -22116 $check-no-breaks:end: -22117 # . restore registers -22118 59/pop-to-ecx -22119 58/pop-to-eax -22120 # . epilogue -22121 89/<- %esp 5/r32/ebp -22122 5d/pop-to-ebp -22123 c3/return -22124 -22125 $check-no-breaks:error: -22126 (write-buffered *(ebp+0x10) "fn ") -22127 8b/-> *(ebp+0xc) 0/r32/eax -22128 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22129 (write-buffered *(ebp+0x10) %eax) -22130 (write-buffered *(ebp+0x10) " has outputs, so you cannot 'break' out of the outermost block. Use 'return'.\n") -22131 (flush *(ebp+0x10)) -22132 (stop *(ebp+0x14) 1) -22133 # never gets here -22134 -22135 check-mu-get-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -22136 # . prologue -22137 55/push-ebp -22138 89/<- %ebp 4/r32/esp -22139 # . save registers -22140 50/push-eax -22141 51/push-ecx -22142 52/push-edx -22143 53/push-ebx -22144 56/push-esi -22145 57/push-edi -22146 # esi = stmt -22147 8b/-> *(ebp+8) 6/r32/esi -22148 # - check for 0 inouts -22149 # var base/ecx: (addr var) = stmt->inouts->value -22150 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22151 3d/compare-eax-and 0/imm32/false -22152 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-inouts/disp32 -22153 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22154 89/<- %ecx 0/r32/eax -22155 $check-mu-get-stmt:check-base: -22156 # - check base type -22157 # if it's an 'addr', check that it's in a register -22158 # var base-type/ebx: (addr type-tree) = lookup(base->type) -22159 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -22160 89/<- %ebx 0/r32/eax -22161 { -22162 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -22163 0f 85/jump-if-!= break/disp32 -22164 $check-mu-get-stmt:base-is-compound: -22165 # if (type->left != addr) break -22166 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22167 (is-simple-mu-type? %eax 2) # addr => eax -22168 3d/compare-eax-and 0/imm32/false -22169 74/jump-if-= break/disp8 -22170 $check-mu-get-stmt:base-is-addr: -22171 # now check for register -22172 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -22173 0f 84/jump-if-= $check-mu-get-stmt:error-base-type-addr-but-not-register/disp32 -22174 $check-mu-get-stmt:base-is-addr-in-register: -22175 # type->left is now an addr; skip it -22176 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -22177 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -22178 0f 85/jump-if-!= $check-mu-get-stmt:error-bad-base/disp32 -22179 $check-mu-get-stmt:base-is-addr-to-atom-in-register: -22180 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -22181 89/<- %ebx 0/r32/eax -22182 } -22183 $check-mu-get-stmt:check-base-typeinfo: -22184 # ensure type is a container -22185 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -22186 { -22187 75/jump-if-!= break/disp8 -22188 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22189 89/<- %ebx 0/r32/eax -22190 } -22191 # var base-type-id/ebx: type-id = base-type->value -22192 8b/-> *(ebx+4) 3/r32/ebx # Type-tree-value -22193 (is-container? %ebx) # => eax -22194 3d/compare-eax-and 0/imm32/false -22195 0f 84/jump-if-= $check-mu-get-stmt:error-bad-base/disp32 -22196 # var base-typeinfo/edx: (addr typeinfo) = find-typeinfo(base-type-id) -22197 # . var container/ecx: (handle typeinfo) -22198 68/push 0/imm32 -22199 68/push 0/imm32 -22200 89/<- %ecx 4/r32/esp -22201 # . -22202 (find-typeinfo %ebx %ecx) -22203 (lookup *ecx *(ecx+4)) # => eax -22204 # . reclaim container -22205 81 0/subop/add %esp 8/imm32 -22206 # . -22207 89/<- %edx 0/r32/eax -22208 # var offset/ecx: (addr stmt-var) = stmt->inouts->next -22209 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22210 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22211 89/<- %ecx 0/r32/eax -22212 # - check for 1 inout -22213 3d/compare-eax-and 0/imm32/false -22214 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-inouts/disp32 -22215 # var offset/ecx: (addr var) = lookup(offset->value) -22216 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -22217 89/<- %ecx 0/r32/eax -22218 # - check for valid field -22219 81 7/subop/compare *(ecx+0x14) -1/imm32/uninitialized # Var-offset -22220 0f 84/jump-if-= $check-mu-get-stmt:error-bad-field/disp32 -22221 # - check for too many inouts -22222 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22223 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22224 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22225 3d/compare-eax-and 0/imm32/false -22226 0f 85/jump-if-!= $check-mu-get-stmt:error-too-many-inouts/disp32 -22227 # var output/edi: (addr var) = stmt->outputs->value -22228 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -22229 # - check for 0 outputs -22230 3d/compare-eax-and 0/imm32/false -22231 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-outputs/disp32 -22232 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22233 89/<- %edi 0/r32/eax -22234 $check-mu-get-stmt:check-output-type: -22235 # - check output type -22236 # must be in register -22237 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax -22238 3d/compare-eax-and 0/imm32 -22239 0f 84/jump-if-= $check-mu-get-stmt:error-output-not-in-register/disp32 -22240 # must have a non-atomic type -22241 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -22242 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -22243 0f 85/jump-if-!= $check-mu-get-stmt:error-output-type-not-address/disp32 -22244 # type must start with (addr ...) -22245 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -22246 (is-simple-mu-type? %eax 2) # => eax -22247 3d/compare-eax-and 0/imm32/false -22248 0f 84/jump-if-= $check-mu-get-stmt:error-output-type-not-address/disp32 -22249 $check-mu-get-stmt:check-output-type-match: -22250 # payload of addr type must match 'type' definition -22251 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -22252 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -22253 # if (payload->right == null) payload = payload->left -22254 81 7/subop/compare *(eax+0xc) 0/imm32/null # Type-tree-right -22255 { -22256 75/jump-if-!= break/disp8 -22257 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -22258 } -22259 89/<- %edi 0/r32/eax -22260 # . var output-name/ecx: (addr array byte) -22261 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22262 89/<- %ecx 0/r32/eax -22263 # . var base-typeinfo-entry/eax: (addr handle typeinfo-entry) -22264 (lookup *(edx+4) *(edx+8)) # Typeinfo-fields Typeinfo-fields => eax -22265 (get %eax %ecx 0x10) # => eax -22266 # . -22267 (lookup *eax *(eax+4)) # => eax -22268 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax -22269 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -22270 # . -22271 (type-equal? %edi %eax) # => eax -22272 3d/compare-eax-and 0/imm32/false -22273 0f 84/jump-if-= $check-mu-get-stmt:error-bad-output-type/disp32 -22274 # - check for too many outputs -22275 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -22276 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22277 3d/compare-eax-and 0/imm32/false -22278 0f 85/jump-if-!= $check-mu-get-stmt:error-too-many-outputs/disp32 -22279 $check-mu-get-stmt:end: -22280 # . restore registers -22281 5f/pop-to-edi -22282 5e/pop-to-esi -22283 5b/pop-to-ebx -22284 5a/pop-to-edx -22285 59/pop-to-ecx -22286 58/pop-to-eax -22287 # . epilogue -22288 89/<- %esp 5/r32/ebp -22289 5d/pop-to-ebp -22290 c3/return -22291 -22292 $check-mu-get-stmt:error-too-few-inouts: -22293 (write-buffered *(ebp+0x10) "fn ") -22294 8b/-> *(ebp+0xc) 0/r32/eax -22295 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22296 (write-buffered *(ebp+0x10) %eax) -22297 (write-buffered *(ebp+0x10) ": stmt get: too few inouts (2 required)\n") -22298 (flush *(ebp+0x10)) -22299 (stop *(ebp+0x14) 1) -22300 # never gets here -22301 -22302 $check-mu-get-stmt:error-too-many-inouts: -22303 (write-buffered *(ebp+0x10) "fn ") -22304 8b/-> *(ebp+0xc) 0/r32/eax -22305 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22306 (write-buffered *(ebp+0x10) %eax) -22307 (write-buffered *(ebp+0x10) ": stmt get: too many inouts (2 required)\n") -22308 (flush *(ebp+0x10)) -22309 (stop *(ebp+0x14) 1) -22310 # never gets here -22311 -22312 $check-mu-get-stmt:error-too-few-outputs: -22313 (write-buffered *(ebp+0x10) "fn ") -22314 8b/-> *(ebp+0xc) 0/r32/eax -22315 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22316 (write-buffered *(ebp+0x10) %eax) -22317 (write-buffered *(ebp+0x10) ": stmt get: must have an output\n") -22318 (flush *(ebp+0x10)) -22319 (stop *(ebp+0x14) 1) -22320 # never gets here -22321 -22322 $check-mu-get-stmt:error-too-many-outputs: -22323 (write-buffered *(ebp+0x10) "fn ") -22324 8b/-> *(ebp+0xc) 0/r32/eax -22325 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22326 (write-buffered *(ebp+0x10) %eax) -22327 (write-buffered *(ebp+0x10) ": stmt get: too many outputs (1 required)\n") -22328 (flush *(ebp+0x10)) -22329 (stop *(ebp+0x14) 1) -22330 # never gets here -22331 -22332 $check-mu-get-stmt:error-bad-base: -22333 # error("fn " fn ": stmt get: var '" base->name "' must have a 'type' definition\n") -22334 (write-buffered *(ebp+0x10) "fn ") -22335 8b/-> *(ebp+0xc) 0/r32/eax -22336 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22337 (write-buffered *(ebp+0x10) %eax) -22338 (write-buffered *(ebp+0x10) ": stmt get: var '") -22339 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22340 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22341 (lookup *eax *(eax+4)) # Var-name Var-name => eax -22342 (write-buffered *(ebp+0x10) %eax) -22343 (write-buffered *(ebp+0x10) "' must have a 'type' definition\n") -22344 (flush *(ebp+0x10)) -22345 (stop *(ebp+0x14) 1) -22346 # never gets here -22347 -22348 $check-mu-get-stmt:error-base-type-addr-but-not-register: -22349 (write-buffered *(ebp+0x10) "fn ") -22350 8b/-> *(ebp+0xc) 0/r32/eax -22351 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22352 (write-buffered *(ebp+0x10) %eax) -22353 (write-buffered *(ebp+0x10) ": stmt get: var '") -22354 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22355 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22356 (lookup *eax *(eax+4)) # Var-name Var-name => eax -22357 (write-buffered *(ebp+0x10) %eax) -22358 (write-buffered *(ebp+0x10) "' is an 'addr' type, and so must live in a register\n") -22359 (flush *(ebp+0x10)) -22360 (stop *(ebp+0x14) 1) -22361 # never gets here -22362 -22363 $check-mu-get-stmt:error-bad-field: -22364 # error("fn " fn ": stmt get: type " type " has no member called '" curr->name "'\n") +21676 5e/pop-to-esi +21677 58/pop-to-eax +21678 # . epilogue +21679 89/<- %esp 5/r32/ebp +21680 5d/pop-to-ebp +21681 c3/return +21682 +21683 check-mu-numberlike-output: # v: (addr stmt-var), stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21684 # . prologue +21685 55/push-ebp +21686 89/<- %ebp 4/r32/esp +21687 # . save registers +21688 50/push-eax +21689 # +21690 (is-mu-numberlike-output-var? *(ebp+8)) # => eax +21691 3d/compare-eax-and 0/imm32/false +21692 0f 84/jump-if-= $check-mu-numberlike-output:fail/disp32 +21693 $check-mu-numberlike-output:end: +21694 # . restore registers +21695 58/pop-to-eax +21696 # . epilogue +21697 89/<- %esp 5/r32/ebp +21698 5d/pop-to-ebp +21699 c3/return +21700 +21701 $check-mu-numberlike-output:fail: +21702 # otherwise raise an error +21703 (write-buffered *(ebp+0x14) "fn ") +21704 8b/-> *(ebp+0x10) 0/r32/eax +21705 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21706 (write-buffered *(ebp+0x14) %eax) +21707 (write-buffered *(ebp+0x14) ": stmt ") +21708 8b/-> *(ebp+0xc) 0/r32/eax +21709 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +21710 (write-buffered *(ebp+0x14) %eax) +21711 (write-buffered *(ebp+0x14) ": '") +21712 8b/-> *(ebp+8) 0/r32/eax +21713 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21714 (lookup *eax *(eax+4)) # Var-name Var-name => eax +21715 (write-buffered *(ebp+0x14) %eax) +21716 (write-buffered *(ebp+0x14) "' must be a non-addr non-offset scalar\n") +21717 (flush *(ebp+0x14)) +21718 (stop *(ebp+0x18) 1) +21719 # never gets here +21720 +21721 is-mu-numberlike-output-var?: # v: (addr stmt-var) -> result/eax: boolean +21722 # . prologue +21723 55/push-ebp +21724 89/<- %ebp 4/r32/esp +21725 # +21726 8b/-> *(ebp+8) 0/r32/eax +21727 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21728 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +21729 (is-mu-numberlike-output? %eax) # => eax +21730 $is-mu-numberlike-output-var?:end: +21731 # . epilogue +21732 89/<- %esp 5/r32/ebp +21733 5d/pop-to-ebp +21734 c3/return +21735 +21736 is-mu-numberlike-output?: # v: (addr type-tree) -> result/eax: boolean +21737 # . prologue +21738 55/push-ebp +21739 89/<- %ebp 4/r32/esp +21740 # . save registers +21741 56/push-esi +21742 # var t/esi: (addr type-tree) = lookup(v->value->type) +21743 8b/-> *(ebp+8) 6/r32/esi +21744 $is-mu-numberlike-output?:check-int: +21745 # if t is an int, return +21746 (is-simple-mu-type? %esi 1) # int => eax +21747 3d/compare-eax-and 0/imm32/false +21748 0f 85/jump-if-!= $is-mu-numberlike-output?:return-true/disp32 +21749 $is-mu-numberlike-output?:check-float: +21750 # if t is a float, return +21751 (is-simple-mu-type? %esi 0xf) # float => eax +21752 3d/compare-eax-and 0/imm32/false +21753 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 +21754 $is-mu-numberlike-output?:check-boolean: +21755 # if t is a boolean, return +21756 (is-simple-mu-type? %esi 5) # boolean => eax +21757 3d/compare-eax-and 0/imm32/false +21758 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 +21759 $is-mu-numberlike-output?:check-byte: +21760 # if t is a byte, return +21761 (is-simple-mu-type? %esi 8) # byte => eax +21762 3d/compare-eax-and 0/imm32/false +21763 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 +21764 $is-mu-numberlike-output?:check-code-point: +21765 # if t is a code-point, return +21766 (is-simple-mu-type? %esi 0xd) # code-point => eax +21767 3d/compare-eax-and 0/imm32/false +21768 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 +21769 $is-mu-numberlike-output?:check-grapheme: +21770 # if t is a grapheme, return +21771 (is-simple-mu-type? %esi 0xe) # grapheme => eax +21772 3d/compare-eax-and 0/imm32/false +21773 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 +21774 $is-mu-numberlike-output?:return-false: +21775 b8/copy-to-eax 0/imm32/false +21776 eb/jump $is-mu-numberlike-output?:end/disp8 +21777 $is-mu-numberlike-output?:return-true: +21778 b8/copy-to-eax 1/imm32/true +21779 $is-mu-numberlike-output?:end: +21780 # . restore registers +21781 5e/pop-to-esi +21782 # . epilogue +21783 89/<- %esp 5/r32/ebp +21784 5d/pop-to-ebp +21785 c3/return +21786 +21787 check-mu-copy-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21788 # . prologue +21789 55/push-ebp +21790 89/<- %ebp 4/r32/esp +21791 # . save registers +21792 50/push-eax +21793 51/push-ecx +21794 52/push-edx +21795 56/push-esi +21796 57/push-edi +21797 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) +21798 81 5/subop/subtract %esp 0x60/imm32 +21799 68/push 0x60/imm32/size +21800 68/push 0/imm32/read +21801 68/push 0/imm32/write +21802 89/<- %edx 4/r32/esp +21803 $check-mu-copy-stmt:get-output: +21804 # esi = stmt +21805 8b/-> *(ebp+8) 6/r32/esi +21806 # var output/edi: (addr stmt-var) = stmt->outputs +21807 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +21808 89/<- %edi 0/r32/eax +21809 # zero outputs +21810 3d/compare-eax-and 0/imm32 +21811 0f 84/jump-if-= $check-mu-copy-stmt:error-no-output/disp32 +21812 # > 1 output +21813 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +21814 3d/compare-eax-and 0/imm32 +21815 0f 85/jump-if-!= $check-mu-copy-stmt:error-too-many-outputs/disp32 +21816 $check-mu-copy-stmt:get-inout: +21817 # var inout/esi: (addr stmt-var) = stmt->inouts +21818 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21819 89/<- %esi 0/r32/eax +21820 # zero inouts +21821 3d/compare-eax-and 0/imm32 +21822 0f 84/jump-if-= $check-mu-copy-stmt:error-no-inout/disp32 +21823 # > 1 inout +21824 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +21825 3d/compare-eax-and 0/imm32 +21826 0f 85/jump-if-!= $check-mu-copy-stmt:error-too-many-inouts/disp32 +21827 $check-mu-copy-stmt:types: +21828 # if inout is not a scalar, abort +21829 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +21830 (size-of %eax) # => eax +21831 3d/compare-eax-and 4/imm32 +21832 0f 8f/jump-if-> $check-mu-copy-stmt:error-inout-too-large/disp32 +21833 # var inout-type/ecx: (addr type-tree) = inout->value->type +21834 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +21835 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +21836 89/<- %ecx 0/r32/eax +21837 # if (inout->is-deref?) inout-type = inout-type->payload +21838 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref +21839 3d/compare-eax-and 0/imm32/false +21840 { +21841 74/jump-if-= break/disp8 +21842 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +21843 # if inout-type->right is null, t = inout-type->left +21844 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +21845 { +21846 75/jump-if-!= break/disp8 +21847 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +21848 } +21849 89/<- %ecx 0/r32/eax +21850 } +21851 # if output not in register, abort +21852 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +21853 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +21854 3d/compare-eax-and 0/imm32 +21855 0f 84/jump-if-= $check-mu-copy-stmt:error-output-not-in-register/disp32 +21856 # var output-type/eax: (addr type-tree) = output->value->type +21857 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +21858 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +21859 # if (inout-type == output-type) return +21860 (type-match? %eax %ecx %edx) # => eax +21861 3d/compare-eax-and 0/imm32 +21862 0f 85/jump-if-!= $check-mu-copy-stmt:end/disp32 +21863 # if output is an addr and inout is 0, return +21864 { +21865 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +21866 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +21867 (is-mu-addr-type? %eax) # => eax +21868 3d/compare-eax-and 0/imm32/false +21869 74/jump-if-= break/disp8 +21870 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +21871 (lookup *eax *(eax+4)) # Var-name Var-name => eax +21872 (string-equal? %eax "0") # => eax +21873 3d/compare-eax-and 0/imm32/false +21874 74/jump-if-= break/disp8 +21875 e9/jump $check-mu-copy-stmt:end/disp32 +21876 } +21877 # if output is an offset and inout is 0, return +21878 { +21879 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +21880 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +21881 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +21882 75/jump-if-!= break/disp8 +21883 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +21884 (is-simple-mu-type? %eax 7) # offset => eax +21885 3d/compare-eax-and 0/imm32/false +21886 74/jump-if-= break/disp8 +21887 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +21888 (lookup *eax *(eax+4)) # Var-name Var-name => eax +21889 (string-equal? %eax "0") # => eax +21890 3d/compare-eax-and 0/imm32/false +21891 74/jump-if-= break/disp8 +21892 e9/jump $check-mu-copy-stmt:end/disp32 +21893 } +21894 # if output is a byte, abort if inout is not a literal. Otherwise return. +21895 { +21896 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +21897 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +21898 (is-simple-mu-type? %eax 8) # byte => eax +21899 3d/compare-eax-and 0/imm32/false +21900 74/jump-if-= break/disp8 +21901 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +21902 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +21903 (is-simple-mu-type? %eax 0) # literal => eax +21904 3d/compare-eax-and 0/imm32/false +21905 0f 84/jump-if-= $check-mu-copy-stmt:error-non-literal-to-byte/disp32 +21906 eb/jump $check-mu-copy-stmt:end/disp8 +21907 } +21908 # if output is not number-like, abort +21909 (check-mu-numberlike-output %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +21910 $check-mu-copy-stmt:end: +21911 # . reclaim locals +21912 81 0/subop/add %esp 0x6c/imm32 +21913 # . restore registers +21914 5f/pop-to-edi +21915 5e/pop-to-esi +21916 5a/pop-to-edx +21917 59/pop-to-ecx +21918 58/pop-to-eax +21919 # . epilogue +21920 89/<- %esp 5/r32/ebp +21921 5d/pop-to-ebp +21922 c3/return +21923 +21924 $check-mu-copy-stmt:error-no-inout: +21925 (write-buffered *(ebp+0x10) "fn ") +21926 8b/-> *(ebp+0xc) 0/r32/eax +21927 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21928 (write-buffered *(ebp+0x10) %eax) +21929 (write-buffered *(ebp+0x10) ": stmt 'copy' expects an inout\n") +21930 (flush *(ebp+0x10)) +21931 (stop *(ebp+0x14) 1) +21932 # never gets here +21933 +21934 $check-mu-copy-stmt:error-too-many-inouts: +21935 (write-buffered *(ebp+0x10) "fn ") +21936 8b/-> *(ebp+0xc) 0/r32/eax +21937 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21938 (write-buffered *(ebp+0x10) %eax) +21939 (write-buffered *(ebp+0x10) ": stmt 'copy' must have just one inout\n") +21940 (flush *(ebp+0x10)) +21941 (stop *(ebp+0x14) 1) +21942 # never gets here +21943 +21944 $check-mu-copy-stmt:error-no-output: +21945 (write-buffered *(ebp+0x10) "fn ") +21946 8b/-> *(ebp+0xc) 0/r32/eax +21947 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21948 (write-buffered *(ebp+0x10) %eax) +21949 (write-buffered *(ebp+0x10) ": stmt 'copy' expects an output\n") +21950 (flush *(ebp+0x10)) +21951 (stop *(ebp+0x14) 1) +21952 # never gets here +21953 +21954 $check-mu-copy-stmt:error-output-not-in-register: +21955 (write-buffered *(ebp+0x10) "fn ") +21956 8b/-> *(ebp+0xc) 0/r32/eax +21957 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21958 (write-buffered *(ebp+0x10) %eax) +21959 (write-buffered *(ebp+0x10) ": stmt copy: output '") +21960 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +21961 (lookup *eax *(eax+4)) # Var-name Var-name => eax +21962 (write-buffered *(ebp+0x10) %eax) +21963 (write-buffered *(ebp+0x10) "' not in a register\n") +21964 (flush *(ebp+0x10)) +21965 (stop *(ebp+0x14) 1) +21966 # never gets here +21967 +21968 $check-mu-copy-stmt:error-too-many-outputs: +21969 (write-buffered *(ebp+0x10) "fn ") +21970 8b/-> *(ebp+0xc) 0/r32/eax +21971 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21972 (write-buffered *(ebp+0x10) %eax) +21973 (write-buffered *(ebp+0x10) ": stmt 'copy' must have just one output\n") +21974 (flush *(ebp+0x10)) +21975 (stop *(ebp+0x14) 1) +21976 # never gets here +21977 +21978 $check-mu-copy-stmt:error-inout-too-large: +21979 (write-buffered *(ebp+0x10) "fn ") +21980 8b/-> *(ebp+0xc) 0/r32/eax +21981 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21982 (write-buffered *(ebp+0x10) %eax) +21983 (write-buffered *(ebp+0x10) ": stmt copy: '") +21984 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +21985 (lookup *eax *(eax+4)) # Var-name Var-name => eax +21986 (write-buffered *(ebp+0x10) %eax) +21987 (write-buffered *(ebp+0x10) "' is too large to fit in a register\n") +21988 (flush *(ebp+0x10)) +21989 (stop *(ebp+0x14) 1) +21990 # never gets here +21991 +21992 $check-mu-copy-stmt:error-non-literal-to-byte: +21993 (write-buffered *(ebp+0x10) "fn ") +21994 8b/-> *(ebp+0xc) 0/r32/eax +21995 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21996 (write-buffered *(ebp+0x10) %eax) +21997 (write-buffered *(ebp+0x10) ": stmt copy: cannot copy non-literal to '") +21998 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +21999 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22000 (write-buffered *(ebp+0x10) %eax) +22001 (write-buffered *(ebp+0x10) "' of type byte; use copy-byte\n") +22002 (flush *(ebp+0x10)) +22003 (stop *(ebp+0x14) 1) +22004 # never gets here +22005 +22006 check-mu-copy-to-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22007 # . prologue +22008 55/push-ebp +22009 89/<- %ebp 4/r32/esp +22010 # . save registers +22011 50/push-eax +22012 51/push-ecx +22013 52/push-edx +22014 53/push-ebx +22015 56/push-esi +22016 57/push-edi +22017 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) +22018 81 5/subop/subtract %esp 0x60/imm32 +22019 68/push 0x60/imm32/size +22020 68/push 0/imm32/read +22021 68/push 0/imm32/write +22022 89/<- %edx 4/r32/esp +22023 # esi = stmt +22024 8b/-> *(ebp+8) 6/r32/esi +22025 $check-mu-copy-to-stmt:check-for-output: +22026 # if stmt->outputs abort +22027 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +22028 3d/compare-eax-and 0/imm32 +22029 0f 85/jump-if-!= $check-mu-copy-to-stmt:error-too-many-outputs/disp32 +22030 $check-mu-copy-to-stmt:get-dest: +22031 # var dest/edi: (addr stmt-var) = stmt->inouts +22032 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22033 89/<- %edi 0/r32/eax +22034 # zero inouts +22035 3d/compare-eax-and 0/imm32 +22036 0f 84/jump-if-= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 +22037 $check-mu-copy-to-stmt:get-src: +22038 # var src/esi: (addr stmt-var) = dest->next +22039 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +22040 89/<- %esi 0/r32/eax +22041 # 1 inout +22042 3d/compare-eax-and 0/imm32 +22043 0f 84/jump-if-= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 +22044 # > 2 inouts +22045 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +22046 3d/compare-eax-and 0/imm32 +22047 0f 85/jump-if-!= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 +22048 $check-mu-copy-to-stmt:types: +22049 # if src is not a scalar, abort +22050 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22051 (size-of %eax) # => eax +22052 3d/compare-eax-and 4/imm32 +22053 0f 8f/jump-if-> $check-mu-copy-to-stmt:error-src-too-large/disp32 +22054 # var src-type/ecx: (addr type-tree) = src->value->type +22055 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22056 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22057 89/<- %ecx 0/r32/eax +22058 # if src not in register or literal, abort +22059 # (we can't use stack-offset because it hasn't been computed yet) +22060 { +22061 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22062 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax +22063 (is-simple-mu-type? %eax 0) # => eax +22064 3d/compare-eax-and 0/imm32 +22065 75/jump-if-!= break/disp8 +22066 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22067 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +22068 3d/compare-eax-and 0/imm32 +22069 75/jump-if-!= break/disp8 +22070 e9/jump $check-mu-copy-to-stmt:error-src-not-literal-or-in-register/disp32 +22071 } +22072 # var dest-type/ebx: (addr type-tree) = dest->value->type +22073 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22074 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22075 89/<- %ebx 0/r32/eax +22076 # if (dest->is-deref?) dest-type = dest-type->payload +22077 $check-mu-copy-to-stmt:check-dest-deref: +22078 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +22079 3d/compare-eax-and 0/imm32/false +22080 { +22081 74/jump-if-= break/disp8 +22082 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22083 $check-mu-copy-to-stmt:dest-is-deref: +22084 # if dest-type->right is null, dest-type = dest-type->left +22085 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22086 { +22087 75/jump-if-!= break/disp8 +22088 $check-mu-copy-to-stmt:dest-is-deref2: +22089 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22090 } +22091 89/<- %ebx 0/r32/eax +22092 } +22093 # if dest is a byte and src is not a literal, abort +22094 { +22095 $check-mu-copy-to-stmt:final-check-byte: +22096 (is-simple-mu-type? %ebx 8) # byte => eax +22097 3d/compare-eax-and 0/imm32/false +22098 74/jump-if-= break/disp8 +22099 (is-simple-mu-type? %ecx 0) # literal => eax +22100 3d/compare-eax-and 0/imm32/false +22101 0f 84/jump-if-= $check-mu-copy-to-stmt:error-non-literal-to-byte/disp32 +22102 } +22103 # if (src-type == dest-type) return +22104 (type-match? %ebx %ecx %edx) # => eax +22105 3d/compare-eax-and 0/imm32 +22106 0f 85/jump-if-!= $check-mu-copy-to-stmt:end/disp32 +22107 # if dest is an addr and src is 0, return +22108 { +22109 $check-mu-copy-to-stmt:final-check-addr: +22110 (is-mu-addr-type? %ebx) # => eax +22111 3d/compare-eax-and 0/imm32/false +22112 74/jump-if-= break/disp8 +22113 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22114 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22115 (string-equal? %eax "0") # => eax +22116 3d/compare-eax-and 0/imm32/false +22117 74/jump-if-= break/disp8 +22118 e9/jump $check-mu-copy-to-stmt:end/disp32 +22119 } +22120 # if dest is an offset and src is 0, return +22121 { +22122 $check-mu-copy-to-stmt:final-check-offset: +22123 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +22124 75/jump-if-!= break/disp8 +22125 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +22126 (is-simple-mu-type? %eax 7) # offset => eax +22127 3d/compare-eax-and 0/imm32/false +22128 74/jump-if-= break/disp8 +22129 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22130 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22131 (string-equal? %eax "0") # => eax +22132 3d/compare-eax-and 0/imm32/false +22133 74/jump-if-= break/disp8 +22134 e9/jump $check-mu-copy-to-stmt:end/disp32 +22135 } +22136 # if dest is not number-like, abort +22137 (check-mu-numberlike-arg %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +22138 $check-mu-copy-to-stmt:end: +22139 # . reclaim locals +22140 81 0/subop/add %esp 0x6c/imm32 +22141 # . restore registers +22142 5f/pop-to-edi +22143 5e/pop-to-esi +22144 5b/pop-to-ebx +22145 5a/pop-to-edx +22146 59/pop-to-ecx +22147 58/pop-to-eax +22148 # . epilogue +22149 89/<- %esp 5/r32/ebp +22150 5d/pop-to-ebp +22151 c3/return +22152 +22153 $check-mu-copy-to-stmt:error-incorrect-inouts: +22154 (write-buffered *(ebp+0x10) "fn ") +22155 8b/-> *(ebp+0xc) 0/r32/eax +22156 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22157 (write-buffered *(ebp+0x10) %eax) +22158 (write-buffered *(ebp+0x10) ": stmt 'copy-to' must have two inouts\n") +22159 (flush *(ebp+0x10)) +22160 (stop *(ebp+0x14) 1) +22161 # never gets here +22162 +22163 $check-mu-copy-to-stmt:error-too-many-outputs: +22164 (write-buffered *(ebp+0x10) "fn ") +22165 8b/-> *(ebp+0xc) 0/r32/eax +22166 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22167 (write-buffered *(ebp+0x10) %eax) +22168 (write-buffered *(ebp+0x10) ": stmt 'copy-to' must not have any outputs\n") +22169 (flush *(ebp+0x10)) +22170 (stop *(ebp+0x14) 1) +22171 # never gets here +22172 +22173 $check-mu-copy-to-stmt:error-src-not-literal-or-in-register: +22174 (write-buffered *(ebp+0x10) "fn ") +22175 8b/-> *(ebp+0xc) 0/r32/eax +22176 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22177 (write-buffered *(ebp+0x10) %eax) +22178 (write-buffered *(ebp+0x10) ": stmt copy-to: source (second inout) is in memory\n") +22179 (flush *(ebp+0x10)) +22180 (stop *(ebp+0x14) 1) +22181 # never gets here +22182 +22183 $check-mu-copy-to-stmt:error-src-too-large: +22184 (write-buffered *(ebp+0x10) "fn ") +22185 8b/-> *(ebp+0xc) 0/r32/eax +22186 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22187 (write-buffered *(ebp+0x10) %eax) +22188 (write-buffered *(ebp+0x10) ": stmt copy-to: '") +22189 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22190 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22191 (write-buffered *(ebp+0x10) %eax) +22192 (write-buffered *(ebp+0x10) "' is too large to copy\n") +22193 (flush *(ebp+0x10)) +22194 (stop *(ebp+0x14) 1) +22195 # never gets here +22196 +22197 $check-mu-copy-to-stmt:error-non-literal-to-byte: +22198 (write-buffered *(ebp+0x10) "fn ") +22199 8b/-> *(ebp+0xc) 0/r32/eax +22200 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22201 (write-buffered *(ebp+0x10) %eax) +22202 (write-buffered *(ebp+0x10) ": stmt copy-to: cannot copy non-literal to type byte; use copy-byte-to\n") +22203 (flush *(ebp+0x10)) +22204 (stop *(ebp+0x14) 1) +22205 # never gets here +22206 +22207 check-mu-copy-byte-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22208 # . prologue +22209 55/push-ebp +22210 89/<- %ebp 4/r32/esp +22211 # . save registers +22212 50/push-eax +22213 51/push-ecx +22214 52/push-edx +22215 56/push-esi +22216 57/push-edi +22217 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) +22218 81 5/subop/subtract %esp 0x60/imm32 +22219 68/push 0x60/imm32/size +22220 68/push 0/imm32/read +22221 68/push 0/imm32/write +22222 89/<- %edx 4/r32/esp +22223 $check-mu-copy-byte-stmt:get-output: +22224 # esi = stmt +22225 8b/-> *(ebp+8) 6/r32/esi +22226 # var output/edi: (addr stmt-var) = stmt->outputs +22227 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +22228 89/<- %edi 0/r32/eax +22229 # zero outputs +22230 3d/compare-eax-and 0/imm32 +22231 0f 84/jump-if-= $check-mu-copy-byte-stmt:error-no-output/disp32 +22232 # > 1 output +22233 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +22234 3d/compare-eax-and 0/imm32 +22235 0f 85/jump-if-!= $check-mu-copy-byte-stmt:error-too-many-outputs/disp32 +22236 $check-mu-copy-byte-stmt:get-inout: +22237 # var inout/esi: (addr stmt-var) = stmt->inouts +22238 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22239 89/<- %esi 0/r32/eax +22240 # zero inouts +22241 3d/compare-eax-and 0/imm32 +22242 0f 84/jump-if-= $check-mu-copy-byte-stmt:error-no-inout/disp32 +22243 # > 1 inout +22244 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +22245 3d/compare-eax-and 0/imm32 +22246 0f 85/jump-if-!= $check-mu-copy-byte-stmt:error-too-many-inouts/disp32 +22247 $check-mu-copy-byte-stmt:types: +22248 # if inout is not a scalar, abort +22249 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22250 (size-of %eax) # => eax +22251 3d/compare-eax-and 4/imm32 +22252 0f 8f/jump-if-> $check-mu-copy-byte-stmt:error-inout-too-large/disp32 +22253 # var inout-type/ecx: (addr type-tree) = inout->value->type +22254 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22255 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22256 89/<- %ecx 0/r32/eax +22257 $check-mu-copy-byte-stmt:check-inout-deref: +22258 # if (inout->is-deref?) inout-type = inout-type->payload +22259 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref +22260 3d/compare-eax-and 0/imm32/false +22261 { +22262 74/jump-if-= break/disp8 +22263 $check-mu-copy-byte-stmt:inout-is-deref: +22264 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +22265 # if inout-type->right is null, t = inout-type->left +22266 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22267 { +22268 75/jump-if-!= break/disp8 +22269 $check-mu-copy-byte-stmt:inout-is-deref2: +22270 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22271 } +22272 89/<- %ecx 0/r32/eax +22273 } +22274 # if output not in register, abort +22275 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22276 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +22277 3d/compare-eax-and 0/imm32 +22278 0f 84/jump-if-= $check-mu-copy-byte-stmt:error-output-not-in-register/disp32 +22279 # var output-type/eax: (addr type-tree) = output->value->type +22280 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22281 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22282 # if output is not of type byte, abort +22283 (is-simple-mu-type? %eax 8) # byte => eax +22284 3d/compare-eax-and 0/imm32 +22285 0f 84/jump-if-= $check-mu-copy-byte-stmt:error-invalid-output-type/disp32 +22286 $check-mu-copy-byte-stmt:end: +22287 # . reclaim locals +22288 81 0/subop/add %esp 0x6c/imm32 +22289 # . restore registers +22290 5f/pop-to-edi +22291 5e/pop-to-esi +22292 5a/pop-to-edx +22293 59/pop-to-ecx +22294 58/pop-to-eax +22295 # . epilogue +22296 89/<- %esp 5/r32/ebp +22297 5d/pop-to-ebp +22298 c3/return +22299 +22300 $check-mu-copy-byte-stmt:error-no-inout: +22301 (write-buffered *(ebp+0x10) "fn ") +22302 8b/-> *(ebp+0xc) 0/r32/eax +22303 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22304 (write-buffered *(ebp+0x10) %eax) +22305 (write-buffered *(ebp+0x10) ": stmt 'copy-byte' expects an inout\n") +22306 (flush *(ebp+0x10)) +22307 (stop *(ebp+0x14) 1) +22308 # never gets here +22309 +22310 $check-mu-copy-byte-stmt:error-too-many-inouts: +22311 (write-buffered *(ebp+0x10) "fn ") +22312 8b/-> *(ebp+0xc) 0/r32/eax +22313 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22314 (write-buffered *(ebp+0x10) %eax) +22315 (write-buffered *(ebp+0x10) ": stmt 'copy-byte' must have just one inout\n") +22316 (flush *(ebp+0x10)) +22317 (stop *(ebp+0x14) 1) +22318 # never gets here +22319 +22320 $check-mu-copy-byte-stmt:error-no-output: +22321 (write-buffered *(ebp+0x10) "fn ") +22322 8b/-> *(ebp+0xc) 0/r32/eax +22323 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22324 (write-buffered *(ebp+0x10) %eax) +22325 (write-buffered *(ebp+0x10) ": stmt 'copy-byte' expects an output\n") +22326 (flush *(ebp+0x10)) +22327 (stop *(ebp+0x14) 1) +22328 # never gets here +22329 +22330 $check-mu-copy-byte-stmt:error-output-not-in-register: +22331 (write-buffered *(ebp+0x10) "fn ") +22332 8b/-> *(ebp+0xc) 0/r32/eax +22333 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22334 (write-buffered *(ebp+0x10) %eax) +22335 (write-buffered *(ebp+0x10) ": stmt copy-byte: output '") +22336 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22337 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22338 (write-buffered *(ebp+0x10) %eax) +22339 (write-buffered *(ebp+0x10) "' not in a register\n") +22340 (flush *(ebp+0x10)) +22341 (stop *(ebp+0x14) 1) +22342 # never gets here +22343 +22344 $check-mu-copy-byte-stmt:error-too-many-outputs: +22345 (write-buffered *(ebp+0x10) "fn ") +22346 8b/-> *(ebp+0xc) 0/r32/eax +22347 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22348 (write-buffered *(ebp+0x10) %eax) +22349 (write-buffered *(ebp+0x10) ": stmt 'copy-byte' must have just one output\n") +22350 (flush *(ebp+0x10)) +22351 (stop *(ebp+0x14) 1) +22352 # never gets here +22353 +22354 $check-mu-copy-byte-stmt:error-invalid-output-type: +22355 (write-buffered *(ebp+0x10) "fn ") +22356 8b/-> *(ebp+0xc) 0/r32/eax +22357 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22358 (write-buffered *(ebp+0x10) %eax) +22359 (write-buffered *(ebp+0x10) ": stmt 'copy-byte' must write to output of type byte\n") +22360 (flush *(ebp+0x10)) +22361 (stop *(ebp+0x14) 1) +22362 # never gets here +22363 +22364 $check-mu-copy-byte-stmt:error-inout-too-large: 22365 (write-buffered *(ebp+0x10) "fn ") 22366 8b/-> *(ebp+0xc) 0/r32/eax 22367 (lookup *eax *(eax+4)) # Function-name Function-name => eax 22368 (write-buffered *(ebp+0x10) %eax) -22369 (write-buffered *(ebp+0x10) ": stmt get: type '") -22370 # . write(Type-id->data[tmp]) -22371 bf/copy-to-edi Type-id/imm32 -22372 8b/-> *(edi+ebx<<2+0xc) 6/r32/esi -22373 { -22374 81 7/subop/compare %esi 0/imm32 -22375 74/jump-if-= break/disp8 -22376 (write-buffered *(ebp+0x10) %esi) -22377 } -22378 # . -22379 (write-buffered *(ebp+0x10) "' has no member called '") -22380 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22381 (write-buffered *(ebp+0x10) %eax) -22382 (write-buffered *(ebp+0x10) "'\n") -22383 (flush *(ebp+0x10)) -22384 (stop *(ebp+0x14) 1) -22385 # never gets here -22386 -22387 $check-mu-get-stmt:error-output-not-in-register: -22388 (write-buffered *(ebp+0x10) "fn ") -22389 8b/-> *(ebp+0xc) 0/r32/eax -22390 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22391 (write-buffered *(ebp+0x10) %eax) -22392 (write-buffered *(ebp+0x10) ": stmt get: output '") -22393 (lookup *edi *(edi+4)) # Var-name Var-name => eax -22394 (write-buffered *(ebp+0x10) %eax) -22395 (write-buffered *(ebp+0x10) "' is not in a register\n") -22396 (flush *(ebp+0x10)) -22397 (stop *(ebp+0x14) 1) -22398 # never gets here -22399 -22400 $check-mu-get-stmt:error-output-type-not-address: -22401 (write-buffered *(ebp+0x10) "fn ") -22402 8b/-> *(ebp+0xc) 0/r32/eax -22403 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22404 (write-buffered *(ebp+0x10) %eax) -22405 (write-buffered *(ebp+0x10) ": stmt get: output must be an addr\n") -22406 (flush *(ebp+0x10)) -22407 (stop *(ebp+0x14) 1) -22408 # never gets here -22409 -22410 $check-mu-get-stmt:error-bad-output-type: -22411 (write-buffered *(ebp+0x10) "fn ") -22412 8b/-> *(ebp+0xc) 0/r32/eax -22413 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22414 (write-buffered *(ebp+0x10) %eax) -22415 (write-buffered *(ebp+0x10) ": stmt get: wrong output type for member '") -22416 (write-buffered *(ebp+0x10) %ecx) -22417 (write-buffered *(ebp+0x10) "' of type '") -22418 bf/copy-to-edi Type-id/imm32 -22419 8b/-> *(edi+ebx<<2+0xc) 6/r32/esi -22420 { -22421 81 7/subop/compare %esi 0/imm32 -22422 74/jump-if-= break/disp8 -22423 (write-buffered *(ebp+0x10) %esi) -22424 } -22425 (write-buffered *(ebp+0x10) "'\n") -22426 (flush *(ebp+0x10)) -22427 (stop *(ebp+0x14) 1) -22428 # never gets here -22429 -22430 check-mu-index-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -22431 # . prologue -22432 55/push-ebp -22433 89/<- %ebp 4/r32/esp -22434 # . save registers -22435 50/push-eax -22436 51/push-ecx -22437 52/push-edx -22438 53/push-ebx -22439 56/push-esi -22440 57/push-edi -22441 # esi = stmt -22442 8b/-> *(ebp+8) 6/r32/esi -22443 # - check for 0 inouts -22444 # var base/ecx: (addr var) = stmt->inouts->value -22445 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22446 $check-mu-index-stmt:check-no-inouts: -22447 3d/compare-eax-and 0/imm32 -22448 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-inouts/disp32 -22449 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22450 89/<- %ecx 0/r32/eax -22451 # - check base type is either (addr array ...) in register or (array ...) on stack -22452 # var base-type/ebx: (addr type-tree) = lookup(base->type) -22453 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -22454 89/<- %ebx 0/r32/eax -22455 # if base-type is an atom, abort with a precise error -22456 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -22457 { -22458 74/jump-if-= break/disp8 -22459 (is-simple-mu-type? %ebx 3) # array => eax -22460 3d/compare-eax-and 0/imm32/false -22461 0f 85/jump-if-!= $check-mu-index-stmt:error-base-array-atom-type/disp32 -22462 0f 84/jump-if-= $check-mu-index-stmt:error-base-non-array-type/disp32 -22463 } -22464 $check-mu-index-stmt:base-is-compound: -22465 # if type->left not addr or array, abort -22466 { -22467 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22468 (is-simple-mu-type? %eax 2) # addr => eax -22469 3d/compare-eax-and 0/imm32/false -22470 75/jump-if-!= break/disp8 -22471 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22472 (is-simple-mu-type? %eax 3) # array => eax -22473 3d/compare-eax-and 0/imm32/false -22474 75/jump-if-!= break/disp8 -22475 e9/jump $check-mu-index-stmt:error-base-non-array-type/disp32 -22476 } -22477 # if (type->left == addr) ensure type->right->left == array and type->register exists -22478 { -22479 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22480 (is-simple-mu-type? %eax 2) # addr => eax -22481 3d/compare-eax-and 0/imm32/false -22482 74/jump-if-= break/disp8 -22483 $check-mu-index-stmt:base-is-addr: -22484 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -22485 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -22486 (is-simple-mu-type? %eax 3) # array => eax -22487 3d/compare-eax-and 0/imm32/false -22488 0f 84/jump-if-= $check-mu-index-stmt:error-base-non-array-type/disp32 -22489 $check-mu-index-stmt:check-base-addr-is-register: -22490 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -22491 0f 84/jump-if-= $check-mu-index-stmt:error-base-address-array-type-on-stack/disp32 -22492 } -22493 # if (type->left == array) ensure type->register doesn't exist -22494 { -22495 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22496 (is-simple-mu-type? %eax 3) # array => eax -22497 3d/compare-eax-and 0/imm32/false -22498 74/jump-if-= break/disp8 -22499 $check-mu-index-stmt:base-is-array: -22500 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -22501 0f 85/jump-if-!= $check-mu-index-stmt:error-base-array-type-in-register/disp32 -22502 } -22503 # if (base-type->left == addr) base-type = base-type->right -22504 { -22505 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22506 (is-simple-mu-type? %eax 2) # addr => eax -22507 3d/compare-eax-and 0/imm32/false -22508 74/jump-if-= break/disp8 -22509 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -22510 89/<- %ebx 0/r32/eax -22511 } -22512 # - check for 1 inout -22513 # var index/ecx: (addr stmt-var) = stmt->inouts->next->value -22514 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22515 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22516 $check-mu-index-stmt:check-single-inout: -22517 3d/compare-eax-and 0/imm32 -22518 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-inouts/disp32 -22519 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22520 89/<- %ecx 0/r32/eax -22521 # - check index is either a literal or register -22522 # var index-type/edx: (addr type-tree) -22523 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -22524 89/<- %edx 0/r32/eax -22525 # if index type is an atom, it must be a literal or int -22526 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -22527 { -22528 74/jump-if-= break/disp8 -22529 $check-mu-index-stmt:index-type-is-atom: -22530 (is-simple-mu-type? %edx 0) # literal => eax -22531 3d/compare-eax-and 0/imm32/false -22532 75/jump-if-!= $check-mu-index-stmt:index-type-done/disp8 -22533 (is-simple-mu-type? %edx 1) # int => eax -22534 3d/compare-eax-and 0/imm32/false -22535 75/jump-if-!= $check-mu-index-stmt:index-type-done/disp8 -22536 (is-simple-mu-type? %edx 7) # offset => eax -22537 3d/compare-eax-and 0/imm32/false -22538 0f 85/jump-if-!= $check-mu-index-stmt:error-index-offset-atom-type/disp32 -22539 e9/jump $check-mu-index-stmt:error-invalid-index-type/disp32 -22540 } -22541 # if index type is a non-atom: it must be an offset -22542 { -22543 75/jump-if-!= break/disp8 -22544 $check-mu-index-stmt:index-type-is-non-atom: -22545 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -22546 (is-simple-mu-type? %eax 7) # offset => eax -22547 3d/compare-eax-and 0/imm32/false -22548 0f 84/jump-if-= $check-mu-index-stmt:error-invalid-index-type/disp32 -22549 } -22550 $check-mu-index-stmt:index-type-done: -22551 # check index is either a literal or in a register -22552 { -22553 (is-simple-mu-type? %edx 0) # literal => eax -22554 3d/compare-eax-and 0/imm32/false -22555 75/jump-if-!= break/disp8 -22556 $check-mu-index-stmt:check-index-in-register: -22557 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -22558 0f 84/jump-if-= $check-mu-index-stmt:error-index-on-stack/disp32 -22559 } -22560 # - if index is an 'int', check that element type of base has size 1, 2, 4 or 8 bytes. -22561 { -22562 (is-simple-mu-type? %edx 1) # int => eax -22563 3d/compare-eax-and 0/imm32/false -22564 74/jump-if-= break/disp8 -22565 $check-mu-index-stmt:check-index-can-be-int: -22566 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22567 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22568 (array-element-size %eax) # => eax -22569 3d/compare-eax-and 1/imm32 -22570 74/jump-if-= break/disp8 -22571 3d/compare-eax-and 2/imm32 -22572 74/jump-if-= break/disp8 -22573 3d/compare-eax-and 4/imm32 -22574 74/jump-if-= break/disp8 -22575 3d/compare-eax-and 8/imm32 -22576 74/jump-if-= break/disp8 -22577 e9/jump $check-mu-index-stmt:error-index-needs-offset/disp32 -22578 } -22579 # - check for too many inouts -22580 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22581 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22582 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22583 3d/compare-eax-and 0/imm32/false -22584 0f 85/jump-if-!= $check-mu-index-stmt:error-too-many-inouts/disp32 -22585 # - check for 0 outputs -22586 # var output/edi: (addr var) = stmt->outputs->value -22587 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -22588 3d/compare-eax-and 0/imm32/false -22589 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-outputs/disp32 -22590 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22591 89/<- %edi 0/r32/eax -22592 # - check output type -22593 # must have a non-atomic type -22594 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -22595 89/<- %edx 0/r32/eax -22596 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -22597 0f 85/jump-if-!= $check-mu-index-stmt:error-output-type-not-address/disp32 -22598 # type must start with (addr ...) -22599 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -22600 (is-simple-mu-type? %eax 2) # addr => eax -22601 3d/compare-eax-and 0/imm32/false -22602 0f 84/jump-if-= $check-mu-index-stmt:error-output-type-not-address/disp32 -22603 # if tail(base-type) != tail(output-type) abort -22604 (type-tail %ebx) # => eax -22605 89/<- %ebx 0/r32/eax -22606 (type-tail %edx) # => eax -22607 (type-equal? %ebx %eax) # => eax -22608 3d/compare-eax-and 0/imm32/false -22609 0f 84/jump-if-= $check-mu-index-stmt:error-bad-output-type/disp32 -22610 # - check for too many outputs -22611 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -22612 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22613 3d/compare-eax-and 0/imm32/false -22614 0f 85/jump-if-!= $check-mu-index-stmt:error-too-many-outputs/disp32 -22615 $check-mu-index-stmt:end: -22616 # . restore registers -22617 5f/pop-to-edi -22618 5e/pop-to-esi -22619 5b/pop-to-ebx -22620 5a/pop-to-edx -22621 59/pop-to-ecx -22622 58/pop-to-eax -22623 # . epilogue -22624 89/<- %esp 5/r32/ebp -22625 5d/pop-to-ebp -22626 c3/return -22627 -22628 $check-mu-index-stmt:error-base-non-array-type: -22629 (write-buffered *(ebp+0x10) "fn ") -22630 8b/-> *(ebp+0xc) 0/r32/eax -22631 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22632 (write-buffered *(ebp+0x10) %eax) -22633 (write-buffered *(ebp+0x10) ": stmt index: var '") -22634 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22635 (write-buffered *(ebp+0x10) %eax) -22636 (write-buffered *(ebp+0x10) "' is not an array\n") -22637 (flush *(ebp+0x10)) -22638 (stop *(ebp+0x14) 1) -22639 # never gets here -22640 -22641 $check-mu-index-stmt:error-base-array-atom-type: -22642 (write-buffered *(ebp+0x10) "fn ") -22643 8b/-> *(ebp+0xc) 0/r32/eax -22644 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22645 (write-buffered *(ebp+0x10) %eax) -22646 (write-buffered *(ebp+0x10) ": stmt index: array '") -22647 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22648 (write-buffered *(ebp+0x10) %eax) -22649 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") -22650 (flush *(ebp+0x10)) -22651 (stop *(ebp+0x14) 1) -22652 # never gets here -22653 -22654 $check-mu-index-stmt:error-base-address-array-type-on-stack: -22655 (write-buffered *(ebp+0x10) "fn ") -22656 8b/-> *(ebp+0xc) 0/r32/eax -22657 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22658 (write-buffered *(ebp+0x10) %eax) -22659 (write-buffered *(ebp+0x10) ": stmt index: var '") -22660 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22661 (write-buffered *(ebp+0x10) %eax) -22662 (write-buffered *(ebp+0x10) "' is an addr to an array, and so must live in a register\n") -22663 (flush *(ebp+0x10)) -22664 (stop *(ebp+0x14) 1) -22665 # never gets here -22666 -22667 $check-mu-index-stmt:error-base-array-type-in-register: -22668 (write-buffered *(ebp+0x10) "fn ") -22669 8b/-> *(ebp+0xc) 0/r32/eax -22670 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22671 (write-buffered *(ebp+0x10) %eax) -22672 (write-buffered *(ebp+0x10) ": stmt index: var '") -22673 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22674 (write-buffered *(ebp+0x10) %eax) -22675 (write-buffered *(ebp+0x10) "' is an array, and so must live on the stack\n") -22676 (flush *(ebp+0x10)) -22677 (stop *(ebp+0x14) 1) -22678 # never gets here -22679 -22680 $check-mu-index-stmt:error-too-few-inouts: -22681 (write-buffered *(ebp+0x10) "fn ") -22682 8b/-> *(ebp+0xc) 0/r32/eax -22683 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22684 (write-buffered *(ebp+0x10) %eax) -22685 (write-buffered *(ebp+0x10) ": stmt index: too few inouts (2 required)\n") -22686 (flush *(ebp+0x10)) -22687 (stop *(ebp+0x14) 1) -22688 # never gets here -22689 -22690 $check-mu-index-stmt:error-invalid-index-type: -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 index: second argument '") -22696 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22697 (write-buffered *(ebp+0x10) %eax) -22698 (write-buffered *(ebp+0x10) "' must be an int or offset\n") -22699 (flush *(ebp+0x10)) -22700 (stop *(ebp+0x14) 1) -22701 # never gets here -22702 -22703 $check-mu-index-stmt:error-index-offset-atom-type: -22704 (write-buffered *(ebp+0x10) "fn ") -22705 8b/-> *(ebp+0xc) 0/r32/eax -22706 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22707 (write-buffered *(ebp+0x10) %eax) -22708 (write-buffered *(ebp+0x10) ": stmt index: offset '") -22709 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22710 (write-buffered *(ebp+0x10) %eax) -22711 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") -22712 (flush *(ebp+0x10)) -22713 (stop *(ebp+0x14) 1) -22714 # never gets here -22715 -22716 $check-mu-index-stmt:error-index-on-stack: -22717 (write-buffered *(ebp+0x10) "fn ") -22718 8b/-> *(ebp+0xc) 0/r32/eax -22719 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22720 (write-buffered *(ebp+0x10) %eax) -22721 (write-buffered *(ebp+0x10) ": stmt index: second argument '") -22722 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22723 (write-buffered *(ebp+0x10) %eax) -22724 (write-buffered *(ebp+0x10) "' must be in a register\n") -22725 (flush *(ebp+0x10)) -22726 (stop *(ebp+0x14) 1) -22727 # never gets here -22728 -22729 $check-mu-index-stmt:error-index-needs-offset: -22730 (write-buffered *(ebp+0x10) "fn ") -22731 8b/-> *(ebp+0xc) 0/r32/eax -22732 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22733 (write-buffered *(ebp+0x10) %eax) -22734 (write-buffered *(ebp+0x10) ": stmt index: cannot take an int for array '") -22735 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22736 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22737 (lookup *eax *(eax+4)) # Var-name Var-name => eax -22738 (write-buffered *(ebp+0x10) %eax) -22739 (write-buffered *(ebp+0x10) "'; create an offset instead. See mu.md for details.\n") -22740 (flush *(ebp+0x10)) -22741 (stop *(ebp+0x14) 1) -22742 # never gets here -22743 -22744 $check-mu-index-stmt:error-too-many-inouts: -22745 (write-buffered *(ebp+0x10) "fn ") -22746 8b/-> *(ebp+0xc) 0/r32/eax -22747 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22748 (write-buffered *(ebp+0x10) %eax) -22749 (write-buffered *(ebp+0x10) ": stmt index: too many inouts (2 required)\n") -22750 (flush *(ebp+0x10)) -22751 (stop *(ebp+0x14) 1) -22752 # never gets here -22753 -22754 $check-mu-index-stmt:error-too-few-outputs: -22755 (write-buffered *(ebp+0x10) "fn ") -22756 8b/-> *(ebp+0xc) 0/r32/eax -22757 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22758 (write-buffered *(ebp+0x10) %eax) -22759 (write-buffered *(ebp+0x10) ": stmt index: must have an output\n") -22760 (flush *(ebp+0x10)) -22761 (stop *(ebp+0x14) 1) -22762 # never gets here -22763 -22764 $check-mu-index-stmt:error-too-many-outputs: -22765 (write-buffered *(ebp+0x10) "fn ") -22766 8b/-> *(ebp+0xc) 0/r32/eax -22767 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22768 (write-buffered *(ebp+0x10) %eax) -22769 (write-buffered *(ebp+0x10) ": stmt index: too many outputs (1 required)\n") -22770 (flush *(ebp+0x10)) -22771 (stop *(ebp+0x14) 1) -22772 # never gets here -22773 -22774 $check-mu-index-stmt:error-output-not-in-register: -22775 (write-buffered *(ebp+0x10) "fn ") -22776 8b/-> *(ebp+0xc) 0/r32/eax -22777 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22778 (write-buffered *(ebp+0x10) %eax) -22779 (write-buffered *(ebp+0x10) ": stmt index: output '") -22780 (lookup *edi *(edi+4)) # Var-name Var-name => eax -22781 (write-buffered *(ebp+0x10) %eax) -22782 (write-buffered *(ebp+0x10) "' is not in a register\n") -22783 (flush *(ebp+0x10)) -22784 (stop *(ebp+0x14) 1) -22785 # never gets here -22786 -22787 $check-mu-index-stmt:error-output-type-not-address: -22788 (write-buffered *(ebp+0x10) "fn ") -22789 8b/-> *(ebp+0xc) 0/r32/eax -22790 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22791 (write-buffered *(ebp+0x10) %eax) -22792 (write-buffered *(ebp+0x10) ": stmt index: output '") -22793 (lookup *edi *(edi+4)) # Var-name Var-name => eax -22794 (write-buffered *(ebp+0x10) %eax) -22795 (write-buffered *(ebp+0x10) "' must be an addr\n") -22796 (flush *(ebp+0x10)) -22797 (stop *(ebp+0x14) 1) -22798 # never gets here -22799 -22800 $check-mu-index-stmt:error-bad-output-type: -22801 (write-buffered *(ebp+0x10) "fn ") -22802 8b/-> *(ebp+0xc) 0/r32/eax -22803 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22804 (write-buffered *(ebp+0x10) %eax) -22805 (write-buffered *(ebp+0x10) ": stmt index: output '") -22806 (lookup *edi *(edi+4)) # Var-name Var-name => eax -22807 (write-buffered *(ebp+0x10) %eax) -22808 (write-buffered *(ebp+0x10) "' does not have the right type\n") -22809 (flush *(ebp+0x10)) -22810 (stop *(ebp+0x14) 1) -22811 # never gets here -22812 -22813 check-mu-length-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -22814 # . prologue -22815 55/push-ebp -22816 89/<- %ebp 4/r32/esp -22817 # . save registers -22818 50/push-eax -22819 51/push-ecx -22820 52/push-edx -22821 53/push-ebx -22822 56/push-esi -22823 57/push-edi -22824 # esi = stmt -22825 8b/-> *(ebp+8) 6/r32/esi -22826 # - check for 0 inouts -22827 # var base/ecx: (addr var) = stmt->inouts->value -22828 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22829 $check-mu-length-stmt:check-no-inouts: -22830 3d/compare-eax-and 0/imm32 -22831 0f 84/jump-if-= $check-mu-length-stmt:error-too-few-inouts/disp32 -22832 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22833 89/<- %ecx 0/r32/eax -22834 # - check base type is either (addr array ...) in register or (array ...) on stack -22835 # var base-type/ebx: (addr type-tree) = lookup(base->type) -22836 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -22837 89/<- %ebx 0/r32/eax -22838 # if base-type is an atom, abort with a precise error -22839 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -22840 { -22841 74/jump-if-= break/disp8 -22842 (is-simple-mu-type? %ebx 3) # array => eax -22843 3d/compare-eax-and 0/imm32/false -22844 0f 85/jump-if-!= $check-mu-length-stmt:error-base-array-atom-type/disp32 -22845 0f 84/jump-if-= $check-mu-length-stmt:error-base-non-array-type/disp32 -22846 } -22847 $check-mu-length-stmt:base-is-compound: -22848 # if type->left not addr or array, abort -22849 { -22850 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22851 (is-simple-mu-type? %eax 2) # addr => eax -22852 3d/compare-eax-and 0/imm32/false -22853 75/jump-if-!= break/disp8 -22854 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22855 (is-simple-mu-type? %eax 3) # array => eax -22856 3d/compare-eax-and 0/imm32/false -22857 75/jump-if-!= break/disp8 -22858 e9/jump $check-mu-length-stmt:error-base-non-array-type/disp32 -22859 } -22860 # if (type->left == addr) ensure type->right->left == array and type->register exists -22861 { -22862 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22863 (is-simple-mu-type? %eax 2) # addr => eax -22864 3d/compare-eax-and 0/imm32/false -22865 74/jump-if-= break/disp8 -22866 $check-mu-length-stmt:base-is-addr: -22867 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -22868 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -22869 (is-simple-mu-type? %eax 3) # array => eax -22870 3d/compare-eax-and 0/imm32/false -22871 0f 84/jump-if-= $check-mu-length-stmt:error-base-non-array-type/disp32 -22872 $check-mu-length-stmt:check-base-addr-is-register: -22873 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -22874 0f 84/jump-if-= $check-mu-length-stmt:error-base-address-array-type-on-stack/disp32 -22875 } -22876 # if (type->left == array) ensure type->register doesn't exist -22877 { -22878 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22879 (is-simple-mu-type? %eax 3) # array => eax -22880 3d/compare-eax-and 0/imm32/false -22881 74/jump-if-= break/disp8 -22882 $check-mu-length-stmt:base-is-array: -22883 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -22884 0f 85/jump-if-!= $check-mu-length-stmt:error-base-array-type-in-register/disp32 -22885 } -22886 # if (base-type->left == addr) base-type = base-type->right -22887 { -22888 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22889 (is-simple-mu-type? %eax 2) # addr => eax -22890 3d/compare-eax-and 0/imm32/false -22891 74/jump-if-= break/disp8 -22892 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -22893 89/<- %ebx 0/r32/eax -22894 } -22895 # - check for too many inouts -22896 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22897 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22898 3d/compare-eax-and 0/imm32/false -22899 0f 85/jump-if-!= $check-mu-length-stmt:error-too-many-inouts/disp32 -22900 # - check for 0 outputs -22901 # var output/edi: (addr var) = stmt->outputs->value -22902 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -22903 3d/compare-eax-and 0/imm32/false -22904 0f 84/jump-if-= $check-mu-length-stmt:error-too-few-outputs/disp32 -22905 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22906 89/<- %edi 0/r32/eax -22907 # - check output type -22908 # must have a non-atomic type -22909 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -22910 (is-simple-mu-type? %eax 1) # int => eax -22911 3d/compare-eax-and 0/imm32/false -22912 0f 84/jump-if-= $check-mu-length-stmt:error-invalid-output-type/disp32 -22913 # - check for too many outputs -22914 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -22915 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22916 3d/compare-eax-and 0/imm32/false -22917 0f 85/jump-if-!= $check-mu-length-stmt:error-too-many-outputs/disp32 -22918 $check-mu-length-stmt:end: -22919 # . restore registers -22920 5f/pop-to-edi -22921 5e/pop-to-esi -22922 5b/pop-to-ebx -22923 5a/pop-to-edx -22924 59/pop-to-ecx -22925 58/pop-to-eax -22926 # . epilogue -22927 89/<- %esp 5/r32/ebp -22928 5d/pop-to-ebp -22929 c3/return -22930 -22931 $check-mu-length-stmt:error-base-non-array-type: -22932 (write-buffered *(ebp+0x10) "fn ") -22933 8b/-> *(ebp+0xc) 0/r32/eax -22934 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22935 (write-buffered *(ebp+0x10) %eax) -22936 (write-buffered *(ebp+0x10) ": stmt length: var '") -22937 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22938 (write-buffered *(ebp+0x10) %eax) -22939 (write-buffered *(ebp+0x10) "' is not an array\n") -22940 (flush *(ebp+0x10)) -22941 (stop *(ebp+0x14) 1) -22942 # never gets here -22943 -22944 $check-mu-length-stmt:error-base-array-atom-type: -22945 (write-buffered *(ebp+0x10) "fn ") -22946 8b/-> *(ebp+0xc) 0/r32/eax -22947 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22948 (write-buffered *(ebp+0x10) %eax) -22949 (write-buffered *(ebp+0x10) ": stmt length: array '") -22950 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22951 (write-buffered *(ebp+0x10) %eax) -22952 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") -22953 (flush *(ebp+0x10)) -22954 (stop *(ebp+0x14) 1) -22955 # never gets here -22956 -22957 $check-mu-length-stmt:error-base-address-array-type-on-stack: -22958 (write-buffered *(ebp+0x10) "fn ") -22959 8b/-> *(ebp+0xc) 0/r32/eax -22960 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22961 (write-buffered *(ebp+0x10) %eax) -22962 (write-buffered *(ebp+0x10) ": stmt length: var '") -22963 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22964 (write-buffered *(ebp+0x10) %eax) -22965 (write-buffered *(ebp+0x10) "' is an addr to an array, and so must live in a register\n") -22966 (flush *(ebp+0x10)) -22967 (stop *(ebp+0x14) 1) -22968 # never gets here -22969 -22970 $check-mu-length-stmt:error-base-array-type-in-register: -22971 (write-buffered *(ebp+0x10) "fn ") -22972 8b/-> *(ebp+0xc) 0/r32/eax -22973 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22974 (write-buffered *(ebp+0x10) %eax) -22975 (write-buffered *(ebp+0x10) ": stmt length: var '") -22976 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22977 (write-buffered *(ebp+0x10) %eax) -22978 (write-buffered *(ebp+0x10) "' is an array, and so must live on the stack\n") -22979 (flush *(ebp+0x10)) -22980 (stop *(ebp+0x14) 1) -22981 # never gets here -22982 -22983 $check-mu-length-stmt:error-too-few-inouts: -22984 (write-buffered *(ebp+0x10) "fn ") -22985 8b/-> *(ebp+0xc) 0/r32/eax -22986 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22987 (write-buffered *(ebp+0x10) %eax) -22988 (write-buffered *(ebp+0x10) ": stmt length: too few inouts (1 required)\n") -22989 (flush *(ebp+0x10)) -22990 (stop *(ebp+0x14) 1) -22991 # never gets here -22992 -22993 $check-mu-length-stmt:error-invalid-index-type: -22994 (write-buffered *(ebp+0x10) "fn ") -22995 8b/-> *(ebp+0xc) 0/r32/eax -22996 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22997 (write-buffered *(ebp+0x10) %eax) -22998 (write-buffered *(ebp+0x10) ": stmt length: second argument '") -22999 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -23000 (write-buffered *(ebp+0x10) %eax) -23001 (write-buffered *(ebp+0x10) "' must be an int or offset\n") -23002 (flush *(ebp+0x10)) -23003 (stop *(ebp+0x14) 1) -23004 # never gets here -23005 -23006 $check-mu-length-stmt:error-index-offset-atom-type: -23007 (write-buffered *(ebp+0x10) "fn ") -23008 8b/-> *(ebp+0xc) 0/r32/eax -23009 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23010 (write-buffered *(ebp+0x10) %eax) -23011 (write-buffered *(ebp+0x10) ": stmt length: offset '") -23012 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -23013 (write-buffered *(ebp+0x10) %eax) -23014 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") -23015 (flush *(ebp+0x10)) -23016 (stop *(ebp+0x14) 1) -23017 # never gets here -23018 -23019 $check-mu-length-stmt:error-index-on-stack: -23020 (write-buffered *(ebp+0x10) "fn ") -23021 8b/-> *(ebp+0xc) 0/r32/eax -23022 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23023 (write-buffered *(ebp+0x10) %eax) -23024 (write-buffered *(ebp+0x10) ": stmt length: second argument '") -23025 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -23026 (write-buffered *(ebp+0x10) %eax) -23027 (write-buffered *(ebp+0x10) "' must be in a register\n") -23028 (flush *(ebp+0x10)) -23029 (stop *(ebp+0x14) 1) -23030 # never gets here -23031 -23032 $check-mu-length-stmt:error-index-needs-offset: -23033 (write-buffered *(ebp+0x10) "fn ") -23034 8b/-> *(ebp+0xc) 0/r32/eax -23035 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23036 (write-buffered *(ebp+0x10) %eax) -23037 (write-buffered *(ebp+0x10) ": stmt length: cannot take an int for array '") -23038 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -23039 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -23040 (lookup *eax *(eax+4)) # Var-name Var-name => eax -23041 (write-buffered *(ebp+0x10) %eax) -23042 (write-buffered *(ebp+0x10) "'; create an offset instead. See mu.md for details.\n") -23043 (flush *(ebp+0x10)) -23044 (stop *(ebp+0x14) 1) -23045 # never gets here -23046 -23047 $check-mu-length-stmt:error-too-many-inouts: -23048 (write-buffered *(ebp+0x10) "fn ") -23049 8b/-> *(ebp+0xc) 0/r32/eax -23050 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23051 (write-buffered *(ebp+0x10) %eax) -23052 (write-buffered *(ebp+0x10) ": stmt length: too many inouts (1 required)\n") -23053 (flush *(ebp+0x10)) -23054 (stop *(ebp+0x14) 1) -23055 # never gets here -23056 -23057 $check-mu-length-stmt:error-too-few-outputs: -23058 (write-buffered *(ebp+0x10) "fn ") -23059 8b/-> *(ebp+0xc) 0/r32/eax -23060 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23061 (write-buffered *(ebp+0x10) %eax) -23062 (write-buffered *(ebp+0x10) ": stmt length: must have an output\n") -23063 (flush *(ebp+0x10)) -23064 (stop *(ebp+0x14) 1) -23065 # never gets here -23066 -23067 $check-mu-length-stmt:error-too-many-outputs: -23068 (write-buffered *(ebp+0x10) "fn ") -23069 8b/-> *(ebp+0xc) 0/r32/eax -23070 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23071 (write-buffered *(ebp+0x10) %eax) -23072 (write-buffered *(ebp+0x10) ": stmt length: too many outputs (1 required)\n") -23073 (flush *(ebp+0x10)) -23074 (stop *(ebp+0x14) 1) -23075 # never gets here -23076 -23077 $check-mu-length-stmt:error-output-not-in-register: -23078 (write-buffered *(ebp+0x10) "fn ") -23079 8b/-> *(ebp+0xc) 0/r32/eax -23080 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23081 (write-buffered *(ebp+0x10) %eax) -23082 (write-buffered *(ebp+0x10) ": stmt length: output '") -23083 (lookup *edi *(edi+4)) # Var-name Var-name => eax +22369 (write-buffered *(ebp+0x10) ": stmt copy-byte: '") +22370 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22371 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22372 (write-buffered *(ebp+0x10) %eax) +22373 (write-buffered *(ebp+0x10) "' is too large to fit in a register\n") +22374 (flush *(ebp+0x10)) +22375 (stop *(ebp+0x14) 1) +22376 # never gets here +22377 +22378 check-mu-copy-byte-to-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22379 # . prologue +22380 55/push-ebp +22381 89/<- %ebp 4/r32/esp +22382 # . save registers +22383 50/push-eax +22384 52/push-edx +22385 53/push-ebx +22386 56/push-esi +22387 57/push-edi +22388 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) +22389 81 5/subop/subtract %esp 0x60/imm32 +22390 68/push 0x60/imm32/size +22391 68/push 0/imm32/read +22392 68/push 0/imm32/write +22393 89/<- %edx 4/r32/esp +22394 # esi = stmt +22395 8b/-> *(ebp+8) 6/r32/esi +22396 $check-mu-copy-byte-to-stmt:check-for-output: +22397 # if stmt->outputs abort +22398 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +22399 3d/compare-eax-and 0/imm32 +22400 0f 85/jump-if-!= $check-mu-copy-byte-to-stmt:error-too-many-outputs/disp32 +22401 $check-mu-copy-byte-to-stmt:get-dest: +22402 # var dest/edi: (addr stmt-var) = stmt->inouts +22403 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22404 89/<- %edi 0/r32/eax +22405 # zero inouts +22406 3d/compare-eax-and 0/imm32 +22407 0f 84/jump-if-= $check-mu-copy-byte-to-stmt:error-incorrect-inouts/disp32 +22408 $check-mu-copy-byte-to-stmt:get-src: +22409 # var src/esi: (addr stmt-var) = dest->next +22410 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +22411 89/<- %esi 0/r32/eax +22412 # 1 inout +22413 3d/compare-eax-and 0/imm32 +22414 0f 84/jump-if-= $check-mu-copy-byte-to-stmt:error-incorrect-inouts/disp32 +22415 # > 2 inouts +22416 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +22417 3d/compare-eax-and 0/imm32 +22418 0f 85/jump-if-!= $check-mu-copy-byte-to-stmt:error-incorrect-inouts/disp32 +22419 $check-mu-copy-byte-to-stmt:types: +22420 # if src is not a scalar, abort +22421 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22422 (size-of %eax) # => eax +22423 3d/compare-eax-and 4/imm32 +22424 0f 8f/jump-if-> $check-mu-copy-byte-to-stmt:error-src-too-large/disp32 +22425 # if src not in register, abort +22426 { +22427 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22428 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +22429 3d/compare-eax-and 0/imm32 +22430 75/jump-if-!= break/disp8 +22431 e9/jump $check-mu-copy-byte-to-stmt:error-src-not-in-register/disp32 +22432 } +22433 # var dest-type/ebx: (addr type-tree) = dest->value->type +22434 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22435 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22436 89/<- %ebx 0/r32/eax +22437 # if (dest->is-deref?) dest-type = dest-type->payload +22438 $check-mu-copy-byte-to-stmt:check-dest-deref: +22439 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +22440 3d/compare-eax-and 0/imm32/false +22441 { +22442 74/jump-if-= break/disp8 +22443 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22444 $check-mu-copy-byte-to-stmt:dest-is-deref: +22445 # if dest-type->right is null, dest-type = dest-type->left +22446 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22447 { +22448 75/jump-if-!= break/disp8 +22449 $check-mu-copy-byte-to-stmt:dest-is-deref2: +22450 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22451 } +22452 89/<- %ebx 0/r32/eax +22453 } +22454 # if dest is not a byte, abort +22455 (is-simple-mu-type? %ebx 8) # byte => eax +22456 3d/compare-eax-and 0/imm32/false +22457 0f 84/jump-if-= $check-mu-copy-byte-to-stmt:error-invalid-dest-type/disp32 +22458 $check-mu-copy-byte-to-stmt:end: +22459 # . reclaim locals +22460 81 0/subop/add %esp 0x6c/imm32 +22461 # . restore registers +22462 5f/pop-to-edi +22463 5e/pop-to-esi +22464 5b/pop-to-ebx +22465 5a/pop-to-edx +22466 58/pop-to-eax +22467 # . epilogue +22468 89/<- %esp 5/r32/ebp +22469 5d/pop-to-ebp +22470 c3/return +22471 +22472 $check-mu-copy-byte-to-stmt:error-incorrect-inouts: +22473 (write-buffered *(ebp+0x10) "fn ") +22474 8b/-> *(ebp+0xc) 0/r32/eax +22475 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22476 (write-buffered *(ebp+0x10) %eax) +22477 (write-buffered *(ebp+0x10) ": stmt 'copy-byte-to' must have two inouts\n") +22478 (flush *(ebp+0x10)) +22479 (stop *(ebp+0x14) 1) +22480 # never gets here +22481 +22482 $check-mu-copy-byte-to-stmt:error-too-many-outputs: +22483 (write-buffered *(ebp+0x10) "fn ") +22484 8b/-> *(ebp+0xc) 0/r32/eax +22485 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22486 (write-buffered *(ebp+0x10) %eax) +22487 (write-buffered *(ebp+0x10) ": stmt 'copy-byte-to' must not have any outputs\n") +22488 (flush *(ebp+0x10)) +22489 (stop *(ebp+0x14) 1) +22490 # never gets here +22491 +22492 $check-mu-copy-byte-to-stmt:error-src-not-in-register: +22493 (write-buffered *(ebp+0x10) "fn ") +22494 8b/-> *(ebp+0xc) 0/r32/eax +22495 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22496 (write-buffered *(ebp+0x10) %eax) +22497 (write-buffered *(ebp+0x10) ": stmt copy-byte-to: source (second inout) must be in a register\n") +22498 (flush *(ebp+0x10)) +22499 (stop *(ebp+0x14) 1) +22500 # never gets here +22501 +22502 $check-mu-copy-byte-to-stmt:error-invalid-dest-type: +22503 (write-buffered *(ebp+0x10) "fn ") +22504 8b/-> *(ebp+0xc) 0/r32/eax +22505 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22506 (write-buffered *(ebp+0x10) %eax) +22507 (write-buffered *(ebp+0x10) ": stmt copy-byte-to: '") +22508 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22509 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22510 (write-buffered *(ebp+0x10) %eax) +22511 (write-buffered *(ebp+0x10) "' must be a byte\n") +22512 (flush *(ebp+0x10)) +22513 (stop *(ebp+0x14) 1) +22514 # never gets here +22515 +22516 $check-mu-copy-byte-to-stmt:error-src-too-large: +22517 (write-buffered *(ebp+0x10) "fn ") +22518 8b/-> *(ebp+0xc) 0/r32/eax +22519 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22520 (write-buffered *(ebp+0x10) %eax) +22521 (write-buffered *(ebp+0x10) ": stmt copy-byte-to: '") +22522 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22523 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22524 (write-buffered *(ebp+0x10) %eax) +22525 (write-buffered *(ebp+0x10) "' is too large to copy\n") +22526 (flush *(ebp+0x10)) +22527 (stop *(ebp+0x14) 1) +22528 # never gets here +22529 +22530 check-mu-compare-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22531 # . prologue +22532 55/push-ebp +22533 89/<- %ebp 4/r32/esp +22534 # . save registers +22535 50/push-eax +22536 51/push-ecx +22537 52/push-edx +22538 53/push-ebx +22539 56/push-esi +22540 57/push-edi +22541 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) +22542 81 5/subop/subtract %esp 0x60/imm32 +22543 68/push 0x60/imm32/size +22544 68/push 0/imm32/read +22545 68/push 0/imm32/write +22546 89/<- %edx 4/r32/esp +22547 # esi = stmt +22548 8b/-> *(ebp+8) 6/r32/esi +22549 $check-mu-compare-stmt:check-for-output: +22550 # if stmt->outputs abort +22551 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +22552 3d/compare-eax-and 0/imm32 +22553 0f 85/jump-if-!= $check-mu-compare-stmt:error-too-many-outputs/disp32 +22554 $check-mu-compare-stmt:get-left: +22555 # var left/edi: (addr stmt-var) = stmt->inouts +22556 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22557 89/<- %edi 0/r32/eax +22558 # zero inouts +22559 3d/compare-eax-and 0/imm32 +22560 0f 84/jump-if-= $check-mu-compare-stmt:error-incorrect-inouts/disp32 +22561 $check-mu-compare-stmt:get-right: +22562 # var right/esi: (addr stmt-var) = left->next +22563 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +22564 89/<- %esi 0/r32/eax +22565 # 1 inout +22566 3d/compare-eax-and 0/imm32 +22567 0f 84/jump-if-= $check-mu-compare-stmt:error-incorrect-inouts/disp32 +22568 # > 2 inouts +22569 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +22570 3d/compare-eax-and 0/imm32 +22571 0f 85/jump-if-!= $check-mu-compare-stmt:error-incorrect-inouts/disp32 +22572 # if both inouts are in memory, abort +22573 { +22574 $check-mu-compare-stmt:both-in-mem: +22575 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22576 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax +22577 (is-simple-mu-type? %eax 0) # => eax +22578 3d/compare-eax-and 0/imm32 +22579 0f 85/jump-if-!= break/disp32 +22580 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22581 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +22582 3d/compare-eax-and 0/imm32 +22583 75/jump-if-!= break/disp8 +22584 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22585 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax +22586 (is-simple-mu-type? %eax 0) # => eax +22587 3d/compare-eax-and 0/imm32 +22588 75/jump-if-!= break/disp8 +22589 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22590 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +22591 3d/compare-eax-and 0/imm32 +22592 75/jump-if-!= break/disp8 +22593 e9/jump $check-mu-compare-stmt:error-both-in-memory/disp32 +22594 } +22595 $check-mu-compare-stmt:types: +22596 # var right-type/ecx: (addr type-tree) = right->value->type +22597 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22598 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22599 89/<- %ecx 0/r32/eax +22600 # if (right->is-deref?) right-type = right-type->payload +22601 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref +22602 3d/compare-eax-and 0/imm32/false +22603 { +22604 74/jump-if-= break/disp8 +22605 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +22606 # if right-type->right is null, right-type = right-type->left +22607 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22608 { +22609 75/jump-if-!= break/disp8 +22610 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22611 } +22612 89/<- %ecx 0/r32/eax +22613 } +22614 # if right is not a scalar, abort +22615 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22616 (size-of %eax) # => eax +22617 3d/compare-eax-and 4/imm32 +22618 0f 8f/jump-if-> $check-mu-compare-stmt:error-right-too-large/disp32 +22619 # if left is not a scalar, abort +22620 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22621 (size-of %eax) # => eax +22622 3d/compare-eax-and 4/imm32 +22623 0f 8f/jump-if-> $check-mu-compare-stmt:error-left-too-large/disp32 +22624 # var left-type/ebx: (addr type-tree) = left->value->type +22625 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22626 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22627 89/<- %ebx 0/r32/eax +22628 # if (left->is-deref?) left-type = left-type->payload +22629 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +22630 3d/compare-eax-and 0/imm32/false +22631 { +22632 74/jump-if-= break/disp8 +22633 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22634 # if left-type->right is null, left-type = left-type->left +22635 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22636 { +22637 75/jump-if-!= break/disp8 +22638 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22639 } +22640 89/<- %ebx 0/r32/eax +22641 } +22642 # if (left-type == right-type) return +22643 (type-match? %ebx %ecx %edx) # => eax +22644 3d/compare-eax-and 0/imm32 +22645 0f 85/jump-if-!= $check-mu-compare-stmt:end/disp32 +22646 # if left is an addr and right is 0, return +22647 { +22648 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22649 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22650 (is-mu-addr-type? %eax) # => eax +22651 3d/compare-eax-and 0/imm32/false +22652 74/jump-if-= break/disp8 +22653 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22654 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22655 (string-equal? %eax "0") # => eax +22656 3d/compare-eax-and 0/imm32/false +22657 74/jump-if-= break/disp8 +22658 eb/jump $check-mu-compare-stmt:end/disp8 +22659 } +22660 # if left is not number-like, abort +22661 (check-mu-numberlike-arg %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +22662 $check-mu-compare-stmt:end: +22663 # . reclaim locals +22664 81 0/subop/add %esp 0x6c/imm32 +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-compare-stmt:error-incorrect-inouts: +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 'compare' must have two inouts\n") +22683 (flush *(ebp+0x10)) +22684 (stop *(ebp+0x14) 1) +22685 # never gets here +22686 +22687 $check-mu-compare-stmt:error-too-many-outputs: +22688 (write-buffered *(ebp+0x10) "fn ") +22689 8b/-> *(ebp+0xc) 0/r32/eax +22690 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22691 (write-buffered *(ebp+0x10) %eax) +22692 (write-buffered *(ebp+0x10) ": stmt 'compare' must not have any outputs\n") +22693 (flush *(ebp+0x10)) +22694 (stop *(ebp+0x14) 1) +22695 # never gets here +22696 +22697 $check-mu-compare-stmt:error-both-in-memory: +22698 (write-buffered *(ebp+0x10) "fn ") +22699 8b/-> *(ebp+0xc) 0/r32/eax +22700 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22701 (write-buffered *(ebp+0x10) %eax) +22702 (write-buffered *(ebp+0x10) ": stmt compare: both inouts are in memory\n") +22703 (flush *(ebp+0x10)) +22704 (stop *(ebp+0x14) 1) +22705 # never gets here +22706 +22707 $check-mu-compare-stmt:error-left-too-large: +22708 (write-buffered *(ebp+0x10) "fn ") +22709 8b/-> *(ebp+0xc) 0/r32/eax +22710 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22711 (write-buffered *(ebp+0x10) %eax) +22712 (write-buffered *(ebp+0x10) ": stmt compare: '") +22713 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22714 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22715 (write-buffered *(ebp+0x10) %eax) +22716 (write-buffered *(ebp+0x10) "' is too large to compare\n") +22717 (flush *(ebp+0x10)) +22718 (stop *(ebp+0x14) 1) +22719 # never gets here +22720 +22721 $check-mu-compare-stmt:error-right-too-large: +22722 (write-buffered *(ebp+0x10) "fn ") +22723 8b/-> *(ebp+0xc) 0/r32/eax +22724 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22725 (write-buffered *(ebp+0x10) %eax) +22726 (write-buffered *(ebp+0x10) ": stmt compare: '") +22727 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22728 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22729 (write-buffered *(ebp+0x10) %eax) +22730 (write-buffered *(ebp+0x10) "' is too large to compare\n") +22731 (flush *(ebp+0x10)) +22732 (stop *(ebp+0x14) 1) +22733 # never gets here +22734 +22735 check-mu-address-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22736 # . prologue +22737 55/push-ebp +22738 89/<- %ebp 4/r32/esp +22739 # . save registers +22740 50/push-eax +22741 51/push-ecx +22742 52/push-edx +22743 56/push-esi +22744 57/push-edi +22745 $check-mu-address-stmt:get-output: +22746 # esi = stmt +22747 8b/-> *(ebp+8) 6/r32/esi +22748 # var output/edi: (addr stmt-var) = stmt->outputs +22749 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +22750 89/<- %edi 0/r32/eax +22751 # zero outputs +22752 3d/compare-eax-and 0/imm32 +22753 0f 84/jump-if-= $check-mu-address-stmt:error-no-output/disp32 +22754 # > 1 output +22755 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +22756 3d/compare-eax-and 0/imm32 +22757 0f 85/jump-if-!= $check-mu-address-stmt:error-too-many-outputs/disp32 +22758 $check-mu-address-stmt:get-inout: +22759 # var inout/esi: (addr stmt-var) = stmt->inouts +22760 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22761 89/<- %esi 0/r32/eax +22762 # zero inouts +22763 3d/compare-eax-and 0/imm32 +22764 0f 84/jump-if-= $check-mu-address-stmt:error-no-inout/disp32 +22765 # > 1 inout +22766 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +22767 3d/compare-eax-and 0/imm32 +22768 0f 85/jump-if-!= $check-mu-address-stmt:error-too-many-inouts/disp32 +22769 $check-mu-address-stmt:types: +22770 # if output not in register, abort +22771 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22772 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +22773 3d/compare-eax-and 0/imm32 +22774 0f 84/jump-if-= $check-mu-address-stmt:error-output-not-in-register/disp32 +22775 # var output-type/edx: (addr type-tree) = output->value->type +22776 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22777 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22778 89/<- %edx 0/r32/eax +22779 # if output-type not an addr, abort +22780 (is-mu-addr-type? %edx) # => eax +22781 3d/compare-eax-and 0/imm32/false +22782 0f 84/jump-if-= $check-mu-address-stmt:error-output-not-address/disp32 +22783 # output-type = output-type->right +22784 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax +22785 # if output-type->right is null, output-type = output-type->left +22786 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22787 { +22788 75/jump-if-!= break/disp8 +22789 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22790 } +22791 89/<- %edx 0/r32/eax +22792 # var inout-type/ecx: (addr type-tree) = inout->value->type +22793 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22794 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22795 89/<- %ecx 0/r32/eax +22796 # if (inout->is-deref?) inout-type = inout-type->payload +22797 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref +22798 3d/compare-eax-and 0/imm32/false +22799 { +22800 74/jump-if-= break/disp8 +22801 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +22802 # if inout-type->right is null, t = inout-type->left +22803 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22804 { +22805 75/jump-if-!= break/disp8 +22806 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22807 } +22808 89/<- %ecx 0/r32/eax +22809 } +22810 # if (inout-type != output-type) abort +22811 (type-equal-ignoring-capacity? %edx %ecx) # => eax +22812 3d/compare-eax-and 0/imm32 +22813 0f 84/jump-if-= $check-mu-address-stmt:error-type-mismatch/disp32 +22814 $check-mu-address-stmt:end: +22815 # . restore registers +22816 5f/pop-to-edi +22817 5e/pop-to-esi +22818 5a/pop-to-edx +22819 59/pop-to-ecx +22820 58/pop-to-eax +22821 # . epilogue +22822 89/<- %esp 5/r32/ebp +22823 5d/pop-to-ebp +22824 c3/return +22825 +22826 $check-mu-address-stmt:error-no-inout: +22827 (write-buffered *(ebp+0x10) "fn ") +22828 8b/-> *(ebp+0xc) 0/r32/eax +22829 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22830 (write-buffered *(ebp+0x10) %eax) +22831 (write-buffered *(ebp+0x10) ": stmt 'address' expects an inout\n") +22832 (flush *(ebp+0x10)) +22833 (stop *(ebp+0x14) 1) +22834 # never gets here +22835 +22836 $check-mu-address-stmt:error-too-many-inouts: +22837 (write-buffered *(ebp+0x10) "fn ") +22838 8b/-> *(ebp+0xc) 0/r32/eax +22839 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22840 (write-buffered *(ebp+0x10) %eax) +22841 (write-buffered *(ebp+0x10) ": stmt 'address' must have just one inout\n") +22842 (flush *(ebp+0x10)) +22843 (stop *(ebp+0x14) 1) +22844 # never gets here +22845 +22846 $check-mu-address-stmt:error-no-output: +22847 (write-buffered *(ebp+0x10) "fn ") +22848 8b/-> *(ebp+0xc) 0/r32/eax +22849 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22850 (write-buffered *(ebp+0x10) %eax) +22851 (write-buffered *(ebp+0x10) ": stmt 'address' expects an output\n") +22852 (flush *(ebp+0x10)) +22853 (stop *(ebp+0x14) 1) +22854 # never gets here +22855 +22856 $check-mu-address-stmt:error-output-not-in-register: +22857 (write-buffered *(ebp+0x10) "fn ") +22858 8b/-> *(ebp+0xc) 0/r32/eax +22859 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22860 (write-buffered *(ebp+0x10) %eax) +22861 (write-buffered *(ebp+0x10) ": stmt address: output '") +22862 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22863 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22864 (write-buffered *(ebp+0x10) %eax) +22865 (write-buffered *(ebp+0x10) "' not in a register\n") +22866 (flush *(ebp+0x10)) +22867 (stop *(ebp+0x14) 1) +22868 # never gets here +22869 +22870 $check-mu-address-stmt:error-too-many-outputs: +22871 (write-buffered *(ebp+0x10) "fn ") +22872 8b/-> *(ebp+0xc) 0/r32/eax +22873 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22874 (write-buffered *(ebp+0x10) %eax) +22875 (write-buffered *(ebp+0x10) ": stmt 'address' must have just one output\n") +22876 (flush *(ebp+0x10)) +22877 (stop *(ebp+0x14) 1) +22878 # never gets here +22879 +22880 $check-mu-address-stmt:error-output-not-address: +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 address: output '") +22886 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22887 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22888 (write-buffered *(ebp+0x10) %eax) +22889 (write-buffered *(ebp+0x10) "' is not an addr\n") +22890 (flush *(ebp+0x10)) +22891 (stop *(ebp+0x14) 1) +22892 # never gets here +22893 +22894 $check-mu-address-stmt:error-type-mismatch: +22895 (write-buffered *(ebp+0x10) "fn ") +22896 8b/-> *(ebp+0xc) 0/r32/eax +22897 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22898 (write-buffered *(ebp+0x10) %eax) +22899 (write-buffered *(ebp+0x10) ": stmt address: output '") +22900 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22901 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22902 (write-buffered *(ebp+0x10) %eax) +22903 (write-buffered *(ebp+0x10) "' cannot hold address of '") +22904 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22905 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22906 (write-buffered *(ebp+0x10) %eax) +22907 (write-buffered *(ebp+0x10) "'\n") +22908 (flush *(ebp+0x10)) +22909 (stop *(ebp+0x14) 1) +22910 # never gets here +22911 +22912 type-equal-ignoring-capacity?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean +22913 # . prologue +22914 55/push-ebp +22915 89/<- %ebp 4/r32/esp +22916 # . save registers +22917 51/push-ecx +22918 52/push-edx +22919 53/push-ebx +22920 # var curr-a/ecx: (addr type-tree) = a +22921 8b/-> *(ebp+8) 1/r32/ecx +22922 # var curr-b/ebx: (addr type-tree) = b +22923 8b/-> *(ebp+0xc) 3/r32/ebx +22924 # if (curr-a->is-atom?) fall back to regular equality +22925 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +22926 0f 85/jump-if-!= $type-equal-ignoring-capacity?:base-case/disp32 +22927 # if (curr-a->left != curr-b->left) return false +22928 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +22929 89/<- %edx 0/r32/eax +22930 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +22931 (type-equal? %edx %eax) # => eax +22932 3d/compare-eax-and 0/imm32/false +22933 0f 84/jump-if-= $type-equal-ignoring-capacity?:end/disp32 # eax switches meaning +22934 # if (curr-a->left == "array") curr-a = curr-a->element-type +22935 { +22936 (is-mu-array? %edx) # => eax +22937 3d/compare-eax-and 0/imm32/false +22938 75/jump-if-!= break/disp8 +22939 $type-equal-ignoring-capacity?:array: +22940 # curr-a = curr-a->right->left +22941 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +22942 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22943 89/<- %ecx 0/r32/eax +22944 # curr-b = curr-b->right->left +22945 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22946 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22947 89/<- %ebx 0/r32/eax +22948 eb/jump $type-equal-ignoring-capacity?:base-case/disp8 +22949 } +22950 # if (curr-a->left == "stream") curr-a = curr-a->element-type +22951 { +22952 (is-mu-stream? %edx) # => eax +22953 3d/compare-eax-and 0/imm32/false +22954 75/jump-if-!= break/disp8 +22955 $type-equal-ignoring-capacity?:stream: +22956 # curr-a = curr-a->right->left +22957 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +22958 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22959 89/<- %ecx 0/r32/eax +22960 # curr-b = curr-b->right->left +22961 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22962 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22963 89/<- %ebx 0/r32/eax +22964 eb/jump $type-equal-ignoring-capacity?:base-case/disp8 +22965 } +22966 $type-equal-ignoring-capacity?:base-case: +22967 # return type-equal?(curr-a, curr-b) +22968 (type-equal? %ecx %ebx) # => eax +22969 $type-equal-ignoring-capacity?:end: +22970 # . restore registers +22971 5b/pop-to-ebx +22972 5a/pop-to-edx +22973 59/pop-to-ecx +22974 # . epilogue +22975 89/<- %esp 5/r32/ebp +22976 5d/pop-to-ebp +22977 c3/return +22978 +22979 check-mu-return-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22980 # . prologue +22981 55/push-ebp +22982 89/<- %ebp 4/r32/esp +22983 # . save registers +22984 50/push-eax +22985 51/push-ecx +22986 52/push-edx +22987 53/push-ebx +22988 56/push-esi +22989 57/push-edi +22990 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) +22991 81 5/subop/subtract %esp 0x60/imm32 +22992 68/push 0x60/imm32/size +22993 68/push 0/imm32/read +22994 68/push 0/imm32/write +22995 89/<- %edx 4/r32/esp +22996 # var template/esi: (addr list var) = fn->outputs +22997 8b/-> *(ebp+0xc) 0/r32/eax +22998 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax +22999 89/<- %esi 0/r32/eax +23000 # var curr-template/ebx: (addr list var) = fn->outputs +23001 89/<- %ebx 0/r32/eax +23002 # var curr/edi: (addr stmt-var) = stmt->inouts +23003 8b/-> *(ebp+8) 0/r32/eax +23004 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +23005 89/<- %edi 0/r32/eax +23006 { +23007 # if template is null, break +23008 81 7/subop/compare %ebx 0/imm32 +23009 0f 84/jump-if-= break/disp32 +23010 # if curr is null, abort +23011 81 7/subop/compare %edi 0/imm32 +23012 0f 84/jump-if-= $check-mu-return-stmt:error-too-few-inouts/disp32 +23013 # var template-type/ecx: (addr type-tree) = template->value->type +23014 (lookup *ebx *(ebx+4)) # List-value List-value => eax +23015 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +23016 89/<- %ecx 0/r32/eax +23017 # var curr-type/eax: (addr type-tree) = curr->value->type +23018 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +23019 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +23020 # if (curr->is-deref?) curr-type = payload of curr-type +23021 81 7/subop/compare *(edi+0x10) 0/imm32/false # Stmt-var-is-deref +23022 { +23023 74/jump-if-= break/disp8 +23024 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +23025 # if t->right is null, t = t->left +23026 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +23027 75/jump-if-!= break/disp8 +23028 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +23029 } +23030 # if curr-type is literal and template-type is float, abort +23031 50/push-eax +23032 { +23033 (is-simple-mu-type? %eax 0) # literal => eax +23034 3d/compare-eax-and 0/imm32/false +23035 74/jump-if-= break/disp8 +23036 (is-simple-mu-type? %ecx 0xf) # float => eax +23037 3d/compare-eax-and 0/imm32/false +23038 0f 85/jump-if-!= $check-mu-return-stmt:error-literal-to-float/disp32 +23039 } +23040 58/pop-to-eax +23041 # if (curr-type != template-type) abort +23042 (type-match? %ecx %eax %edx) # => eax +23043 3d/compare-eax-and 0/imm32/false +23044 0f 84/jump-if-= $check-mu-return-stmt:error1/disp32 +23045 # if register-within-list-with-conflict?(curr, original template, curr-template, stmt) abort +23046 (register-within-list-with-conflict? %edi %esi %ebx *(ebp+8)) # => eax +23047 3d/compare-eax-and 0/imm32/false +23048 0f 85/jump-if-!= $check-mu-return-stmt:error2/disp32 +23049 # template = template->next +23050 (lookup *(ebx+8) *(ebx+0xc)) # List-next List-next => eax +23051 89/<- %ebx 0/r32/eax +23052 # curr = curr->next +23053 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +23054 89/<- %edi 0/r32/eax +23055 # +23056 e9/jump loop/disp32 +23057 } +23058 # if curr is not null, abort +23059 81 7/subop/compare %edi 0/imm32 +23060 0f 85/jump-if-!= $check-mu-return-stmt:error-too-many-inouts/disp32 +23061 $check-mu-return-stmt:end: +23062 # . reclaim locals +23063 81 0/subop/add %esp 0x6c/imm32 +23064 # . restore registers +23065 5f/pop-to-edi +23066 5e/pop-to-esi +23067 5b/pop-to-ebx +23068 5a/pop-to-edx +23069 59/pop-to-ecx +23070 58/pop-to-eax +23071 # . epilogue +23072 89/<- %esp 5/r32/ebp +23073 5d/pop-to-ebp +23074 c3/return +23075 +23076 $check-mu-return-stmt:error1: +23077 (write-buffered *(ebp+0x10) "fn ") +23078 8b/-> *(ebp+0xc) 0/r32/eax +23079 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23080 (write-buffered *(ebp+0x10) %eax) +23081 (write-buffered *(ebp+0x10) ": return: '") +23082 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +23083 (lookup *eax *(eax+4)) # Var-name Var-name => eax 23084 (write-buffered *(ebp+0x10) %eax) -23085 (write-buffered *(ebp+0x10) "' is not in a register\n") +23085 (write-buffered *(ebp+0x10) "' has the wrong type\n") 23086 (flush *(ebp+0x10)) 23087 (stop *(ebp+0x14) 1) 23088 # never gets here 23089 -23090 $check-mu-length-stmt:error-invalid-output-type: +23090 $check-mu-return-stmt:error2: 23091 (write-buffered *(ebp+0x10) "fn ") 23092 8b/-> *(ebp+0xc) 0/r32/eax 23093 (lookup *eax *(eax+4)) # Function-name Function-name => eax 23094 (write-buffered *(ebp+0x10) %eax) -23095 (write-buffered *(ebp+0x10) ": stmt length: output '") -23096 (lookup *edi *(edi+4)) # Var-name Var-name => eax -23097 (write-buffered *(ebp+0x10) %eax) -23098 (write-buffered *(ebp+0x10) "' does not have the right type\n") -23099 (flush *(ebp+0x10)) -23100 (stop *(ebp+0x14) 1) -23101 # never gets here -23102 -23103 check-mu-compute-offset-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -23104 # . prologue -23105 55/push-ebp -23106 89/<- %ebp 4/r32/esp -23107 # . save registers -23108 50/push-eax -23109 51/push-ecx -23110 52/push-edx -23111 53/push-ebx -23112 56/push-esi -23113 57/push-edi -23114 # esi = stmt -23115 8b/-> *(ebp+8) 6/r32/esi -23116 # - check for 0 inouts -23117 # var base/ecx: (addr var) = stmt->inouts->value -23118 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -23119 $check-mu-compute-offset-stmt:check-no-inouts: -23120 3d/compare-eax-and 0/imm32 -23121 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-inouts/disp32 -23122 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -23123 89/<- %ecx 0/r32/eax -23124 # - check base type is either (addr array ...) in register or (array ...) on stack -23125 # var base-type/ebx: (addr type-tree) = lookup(base->type) -23126 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -23127 89/<- %ebx 0/r32/eax -23128 # if base-type is an atom, abort with a precise error -23129 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -23130 { -23131 74/jump-if-= break/disp8 -23132 (is-simple-mu-type? %ebx 3) # array => eax -23133 3d/compare-eax-and 0/imm32/false -23134 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-base-array-atom-type/disp32 -23135 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 -23136 } -23137 $check-mu-compute-offset-stmt:base-is-compound: -23138 # if type->left not addr or array, abort -23139 { -23140 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -23141 (is-simple-mu-type? %eax 2) # addr => eax -23142 3d/compare-eax-and 0/imm32/false -23143 75/jump-if-!= break/disp8 -23144 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -23145 (is-simple-mu-type? %eax 3) # array => eax -23146 3d/compare-eax-and 0/imm32/false -23147 75/jump-if-!= break/disp8 -23148 e9/jump $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 -23149 } -23150 # if (type->left == addr) ensure type->right->left == array and type->register exists -23151 { -23152 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -23153 (is-simple-mu-type? %eax 2) # addr => eax -23154 3d/compare-eax-and 0/imm32/false -23155 74/jump-if-= break/disp8 -23156 $check-mu-compute-offset-stmt:base-is-addr: -23157 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -23158 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -23159 (is-simple-mu-type? %eax 3) # array => eax -23160 3d/compare-eax-and 0/imm32/false -23161 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 -23162 } -23163 # if (base-type->left == addr) base-type = base-type->right -23164 { -23165 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -23166 (is-simple-mu-type? %eax 2) # addr => eax -23167 3d/compare-eax-and 0/imm32/false -23168 74/jump-if-= break/disp8 -23169 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -23170 89/<- %ebx 0/r32/eax -23171 } -23172 # - check for 1 inout -23173 # var index/ecx: (addr stmt-var) = stmt->inouts->next->value -23174 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -23175 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -23176 $check-mu-compute-offset-stmt:check-single-inout: -23177 3d/compare-eax-and 0/imm32 -23178 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-inouts/disp32 -23179 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -23180 89/<- %ecx 0/r32/eax -23181 # - check index is either a literal or register -23182 # var index-type/edx: (addr type-tree) -23183 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -23184 89/<- %edx 0/r32/eax -23185 # index type must be a literal or int -23186 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -23187 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-invalid-index-type/disp32 -23188 { -23189 $check-mu-compute-offset-stmt:index-type-is-atom: -23190 (is-simple-mu-type? %edx 0) # literal => eax -23191 3d/compare-eax-and 0/imm32/false -23192 75/jump-if-!= break/disp8 -23193 (is-simple-mu-type? %edx 1) # int => eax -23194 3d/compare-eax-and 0/imm32/false -23195 75/jump-if-!= break/disp8 -23196 e9/jump $check-mu-compute-offset-stmt:error-invalid-index-type/disp32 -23197 } -23198 # - check for too many inouts -23199 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -23200 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -23201 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -23202 3d/compare-eax-and 0/imm32/false -23203 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-too-many-inouts/disp32 -23204 # - check for 0 outputs -23205 # var output/edi: (addr var) = stmt->outputs->value -23206 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -23207 3d/compare-eax-and 0/imm32/false -23208 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-outputs/disp32 -23209 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -23210 89/<- %edi 0/r32/eax -23211 # - check output type -23212 # must have a non-atomic type -23213 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -23214 89/<- %edx 0/r32/eax -23215 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -23216 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-output-type-not-offset/disp32 -23217 # type must start with (offset ...) -23218 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -23219 (is-simple-mu-type? %eax 7) # offset => eax -23220 3d/compare-eax-and 0/imm32/false -23221 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-output-type-not-offset/disp32 -23222 # if tail(base-type) != tail(output-type) abort -23223 (type-tail %ebx) # => eax -23224 89/<- %ebx 0/r32/eax -23225 (type-tail %edx) # => eax -23226 (type-equal? %ebx %eax) # => eax -23227 3d/compare-eax-and 0/imm32/false -23228 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-bad-output-type/disp32 -23229 # - check for too many outputs -23230 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -23231 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -23232 3d/compare-eax-and 0/imm32/false -23233 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-too-many-outputs/disp32 -23234 $check-mu-compute-offset-stmt:end: -23235 # . restore registers -23236 5f/pop-to-edi -23237 5e/pop-to-esi -23238 5b/pop-to-ebx -23239 5a/pop-to-edx -23240 59/pop-to-ecx -23241 58/pop-to-eax -23242 # . epilogue -23243 89/<- %esp 5/r32/ebp -23244 5d/pop-to-ebp -23245 c3/return -23246 -23247 $check-mu-compute-offset-stmt:error-base-non-array-type: -23248 (write-buffered *(ebp+0x10) "fn ") -23249 8b/-> *(ebp+0xc) 0/r32/eax -23250 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23251 (write-buffered *(ebp+0x10) %eax) -23252 (write-buffered *(ebp+0x10) ": stmt compute-offset: var '") -23253 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -23254 (write-buffered *(ebp+0x10) %eax) -23255 (write-buffered *(ebp+0x10) "' is not an array\n") -23256 (flush *(ebp+0x10)) -23257 (stop *(ebp+0x14) 1) -23258 # never gets here -23259 -23260 $check-mu-compute-offset-stmt:error-base-array-atom-type: -23261 (write-buffered *(ebp+0x10) "fn ") -23262 8b/-> *(ebp+0xc) 0/r32/eax -23263 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23264 (write-buffered *(ebp+0x10) %eax) -23265 (write-buffered *(ebp+0x10) ": stmt compute-offset: array '") -23266 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -23267 (write-buffered *(ebp+0x10) %eax) -23268 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") -23269 (flush *(ebp+0x10)) -23270 (stop *(ebp+0x14) 1) -23271 # never gets here -23272 -23273 $check-mu-compute-offset-stmt:error-too-few-inouts: -23274 (write-buffered *(ebp+0x10) "fn ") -23275 8b/-> *(ebp+0xc) 0/r32/eax -23276 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23277 (write-buffered *(ebp+0x10) %eax) -23278 (write-buffered *(ebp+0x10) ": stmt compute-offset: too few inouts (2 required)\n") -23279 (flush *(ebp+0x10)) -23280 (stop *(ebp+0x14) 1) -23281 # never gets here -23282 -23283 $check-mu-compute-offset-stmt:error-invalid-index-type: -23284 (write-buffered *(ebp+0x10) "fn ") -23285 8b/-> *(ebp+0xc) 0/r32/eax -23286 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23287 (write-buffered *(ebp+0x10) %eax) -23288 (write-buffered *(ebp+0x10) ": stmt compute-offset: second argument '") -23289 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -23290 (write-buffered *(ebp+0x10) %eax) -23291 (write-buffered *(ebp+0x10) "' must be an int\n") -23292 (flush *(ebp+0x10)) -23293 (stop *(ebp+0x14) 1) -23294 # never gets here -23295 -23296 $check-mu-compute-offset-stmt:error-index-offset-atom-type: -23297 (write-buffered *(ebp+0x10) "fn ") -23298 8b/-> *(ebp+0xc) 0/r32/eax -23299 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23300 (write-buffered *(ebp+0x10) %eax) -23301 (write-buffered *(ebp+0x10) ": stmt compute-offset: offset '") -23302 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -23303 (write-buffered *(ebp+0x10) %eax) -23304 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") -23305 (flush *(ebp+0x10)) -23306 (stop *(ebp+0x14) 1) -23307 # never gets here -23308 -23309 $check-mu-compute-offset-stmt:error-index-on-stack: -23310 (write-buffered *(ebp+0x10) "fn ") -23311 8b/-> *(ebp+0xc) 0/r32/eax -23312 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23313 (write-buffered *(ebp+0x10) %eax) -23314 (write-buffered *(ebp+0x10) ": stmt compute-offset: second argument '") -23315 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -23316 (write-buffered *(ebp+0x10) %eax) -23317 (write-buffered *(ebp+0x10) "' must be in a register\n") -23318 (flush *(ebp+0x10)) -23319 (stop *(ebp+0x14) 1) -23320 # never gets here -23321 -23322 $check-mu-compute-offset-stmt:error-too-many-inouts: -23323 (write-buffered *(ebp+0x10) "fn ") -23324 8b/-> *(ebp+0xc) 0/r32/eax -23325 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23326 (write-buffered *(ebp+0x10) %eax) -23327 (write-buffered *(ebp+0x10) ": stmt compute-offset: too many inouts (2 required)\n") -23328 (flush *(ebp+0x10)) -23329 (stop *(ebp+0x14) 1) -23330 # never gets here -23331 -23332 $check-mu-compute-offset-stmt:error-too-few-outputs: -23333 (write-buffered *(ebp+0x10) "fn ") -23334 8b/-> *(ebp+0xc) 0/r32/eax -23335 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23336 (write-buffered *(ebp+0x10) %eax) -23337 (write-buffered *(ebp+0x10) ": stmt compute-offset: must have an output\n") -23338 (flush *(ebp+0x10)) -23339 (stop *(ebp+0x14) 1) -23340 # never gets here -23341 -23342 $check-mu-compute-offset-stmt:error-too-many-outputs: -23343 (write-buffered *(ebp+0x10) "fn ") -23344 8b/-> *(ebp+0xc) 0/r32/eax -23345 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23346 (write-buffered *(ebp+0x10) %eax) -23347 (write-buffered *(ebp+0x10) ": stmt compute-offset: too many outputs (1 required)\n") -23348 (flush *(ebp+0x10)) -23349 (stop *(ebp+0x14) 1) -23350 # never gets here -23351 -23352 $check-mu-compute-offset-stmt:error-output-not-in-register: -23353 (write-buffered *(ebp+0x10) "fn ") -23354 8b/-> *(ebp+0xc) 0/r32/eax -23355 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23356 (write-buffered *(ebp+0x10) %eax) -23357 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") -23358 (lookup *edi *(edi+4)) # Var-name Var-name => eax -23359 (write-buffered *(ebp+0x10) %eax) -23360 (write-buffered *(ebp+0x10) "' is not in a register\n") -23361 (flush *(ebp+0x10)) -23362 (stop *(ebp+0x14) 1) -23363 # never gets here -23364 -23365 $check-mu-compute-offset-stmt:error-output-type-not-offset: -23366 (write-buffered *(ebp+0x10) "fn ") -23367 8b/-> *(ebp+0xc) 0/r32/eax -23368 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23369 (write-buffered *(ebp+0x10) %eax) -23370 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") -23371 (lookup *edi *(edi+4)) # Var-name Var-name => eax -23372 (write-buffered *(ebp+0x10) %eax) -23373 (write-buffered *(ebp+0x10) "' must be an offset\n") -23374 (flush *(ebp+0x10)) -23375 (stop *(ebp+0x14) 1) -23376 # never gets here -23377 -23378 $check-mu-compute-offset-stmt:error-bad-output-type: -23379 (write-buffered *(ebp+0x10) "fn ") -23380 8b/-> *(ebp+0xc) 0/r32/eax -23381 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23382 (write-buffered *(ebp+0x10) %eax) -23383 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") -23384 (lookup *edi *(edi+4)) # Var-name Var-name => eax -23385 (write-buffered *(ebp+0x10) %eax) -23386 (write-buffered *(ebp+0x10) "' does not have the right type\n") -23387 (flush *(ebp+0x10)) -23388 (stop *(ebp+0x14) 1) -23389 # never gets here -23390 -23391 check-mu-copy-object-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -23392 # . prologue -23393 55/push-ebp -23394 89/<- %ebp 4/r32/esp -23395 # . save registers -23396 50/push-eax -23397 51/push-ecx -23398 53/push-ebx -23399 56/push-esi -23400 57/push-edi -23401 # esi = stmt -23402 8b/-> *(ebp+8) 6/r32/esi -23403 $check-mu-copy-object-stmt:check-for-output: -23404 # if stmt->outputs abort -23405 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -23406 3d/compare-eax-and 0/imm32 -23407 0f 85/jump-if-!= $check-mu-copy-object-stmt:error-too-many-outputs/disp32 -23408 $check-mu-copy-object-stmt:get-left: -23409 # var dest/edi: (addr stmt-var) = stmt->inouts -23410 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -23411 89/<- %edi 0/r32/eax -23412 # zero inouts +23095 (write-buffered *(ebp+0x10) ": return: '") +23096 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +23097 (lookup *eax *(eax+4)) # Var-name Var-name => eax +23098 (write-buffered *(ebp+0x10) %eax) +23099 (write-buffered *(ebp+0x10) "' is no longer available\n") +23100 (flush *(ebp+0x10)) +23101 (stop *(ebp+0x14) 1) +23102 # never gets here +23103 +23104 $check-mu-return-stmt:error-literal-to-float: +23105 (write-buffered *(ebp+0x10) "fn ") +23106 8b/-> *(ebp+0xc) 0/r32/eax +23107 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23108 (write-buffered *(ebp+0x10) %eax) +23109 (write-buffered *(ebp+0x10) ": return: cannot copy literal '") +23110 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +23111 (lookup *eax *(eax+4)) # Var-name Var-name => eax +23112 (write-buffered *(ebp+0x10) %eax) +23113 (write-buffered *(ebp+0x10) "' to float\n") +23114 (flush *(ebp+0x10)) +23115 (stop *(ebp+0x14) 1) +23116 # never gets here +23117 +23118 $check-mu-return-stmt:error-too-few-inouts: +23119 (write-buffered *(ebp+0x10) "fn ") +23120 8b/-> *(ebp+0xc) 0/r32/eax +23121 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23122 (write-buffered *(ebp+0x10) %eax) +23123 (write-buffered *(ebp+0x10) ": return: too few inouts\n") +23124 (flush *(ebp+0x10)) +23125 (stop *(ebp+0x14) 1) +23126 # never gets here +23127 +23128 $check-mu-return-stmt:error-too-many-inouts: +23129 (write-buffered *(ebp+0x10) "fn ") +23130 8b/-> *(ebp+0xc) 0/r32/eax +23131 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23132 (write-buffered *(ebp+0x10) %eax) +23133 (write-buffered *(ebp+0x10) ": return: too many inouts\n") +23134 (flush *(ebp+0x10)) +23135 (stop *(ebp+0x14) 1) +23136 # never gets here +23137 +23138 check-all-unique-registers: # outputs: (addr list var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +23139 # . prologue +23140 55/push-ebp +23141 89/<- %ebp 4/r32/esp +23142 # . save registers +23143 50/push-eax +23144 51/push-ecx +23145 56/push-esi +23146 # var table/esi: (addr table (handle array byte) int 8) +23147 81 5/subop/subtract %esp 0x60/imm32 +23148 68/push 0x60/imm32/size +23149 68/push 0/imm32/read +23150 68/push 0/imm32/write +23151 89/<- %esi 4/r32/esp +23152 # var curr/ecx: (addr list var) = outputs +23153 8b/-> *(ebp+8) 1/r32/ecx +23154 { +23155 # if (curr == 0) break +23156 81 7/subop/compare %ecx 0/imm32 +23157 0f 84/jump-if-= break/disp32 +23158 # var reg/eax: (addr array byte) = curr->value->register # guaranteed to exist +23159 (lookup *ecx *(ecx+4)) # List-value List-value => eax +23160 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +23161 # if reg exists in table, abort +23162 (maybe-get %esi %eax 0xc) # => eax +23163 3d/compare-eax-and 0/imm32 +23164 0f 85/jump-if-!= $check-all-unique-registers:abort/disp32 +23165 # insert reg in table +23166 (lookup *ecx *(ecx+4)) # List-value List-value => eax +23167 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +23168 (get-or-insert %esi %eax 0xc Heap) +23169 # curr = curr->next +23170 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +23171 89/<- %ecx 0/r32/eax +23172 e9/jump loop/disp32 +23173 } +23174 $check-all-unique-registers:end: +23175 # . reclaim locals +23176 81 0/subop/add %esp 0x6c/imm32 +23177 # . restore registers +23178 5e/pop-to-esi +23179 59/pop-to-ecx +23180 58/pop-to-eax +23181 # . epilogue +23182 89/<- %esp 5/r32/ebp +23183 5d/pop-to-ebp +23184 c3/return +23185 +23186 $check-all-unique-registers:abort: +23187 (write-buffered *(ebp+0x10) "fn ") +23188 8b/-> *(ebp+0xc) 0/r32/eax +23189 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23190 (write-buffered *(ebp+0x10) %eax) +23191 (write-buffered *(ebp+0x10) ": outputs must be in unique registers\n") +23192 (flush *(ebp+0x10)) +23193 (stop *(ebp+0x14) 1) +23194 # never gets here +23195 +23196 # return false if s's register is not between start (inclusive) and end (exclusive) +23197 # return false if the positionally corresponding register in stmt->inouts (where s comes from) is also s's register +23198 # otherwise return true +23199 register-within-list-with-conflict?: # s: (addr stmt-var), start: (addr list var), end: (addr list var), stmt: (addr stmt) -> result/eax: boolean +23200 # . prologue +23201 55/push-ebp +23202 89/<- %ebp 4/r32/esp +23203 # . save registers +23204 51/push-ecx +23205 52/push-edx +23206 53/push-ebx +23207 56/push-esi +23208 57/push-edi +23209 # var target/ebx: (addr array byte) = s->value->register +23210 8b/-> *(ebp+8) 0/r32/eax +23211 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +23212 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +23213 #? (write-buffered Stderr "AA: ") +23214 #? (write-buffered Stderr %eax) +23215 #? (write-buffered Stderr Newline) +23216 #? (flush Stderr) +23217 # if (var->register == 0) return false +23218 3d/compare-eax-and 0/imm32 +23219 0f 84/jump-if-= $register-within-list-with-conflict?:end/disp32 # eax turns into result +23220 89/<- %ebx 0/r32/eax +23221 # var curr/ecx: (addr list var) = start +23222 8b/-> *(ebp+0xc) 1/r32/ecx +23223 # edx = end +23224 8b/-> *(ebp+0x10) 2/r32/edx +23225 { +23226 # if (curr == 0) break +23227 81 7/subop/compare %edi 0/imm32 +23228 0f 84/jump-if-= break/disp32 +23229 # if (curr == end) break +23230 39/compare %ecx 2/r32/edx +23231 0f 84/jump-if-= break/disp32 +23232 # var curr-reg/eax: (addr array byte) = curr->value->register +23233 (lookup *ecx *(ecx+4)) # List-value List-value => eax +23234 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +23235 # if (curr-reg == 0) continue +23236 3d/compare-eax-and 0/imm32 +23237 74/jump-if-= $register-within-list-with-conflict?:continue/disp8 +23238 # if (curr-reg == target) check for conflict +23239 (string-equal? %eax %ebx) # => eax +23240 3d/compare-eax-and 0/imm32/false +23241 { +23242 74/jump-if-= break/disp8 +23243 #? (write-buffered Stderr "conflict?\n") +23244 #? (flush Stderr) +23245 # var return-inouts/eax: (addr stmt-var) = stmt->inouts +23246 8b/-> *(ebp+0x14) 0/r32/eax +23247 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +23248 (register-conflict? %ebx %eax *(ebp+0xc)) # => eax +23249 eb/jump $register-within-list-with-conflict?:end/disp8 +23250 } +23251 $register-within-list-with-conflict?:continue: +23252 # curr = curr->next +23253 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +23254 89/<- %ecx 0/r32/eax +23255 e9/jump loop/disp32 +23256 } +23257 # return false +23258 b8/copy-to-eax 0/imm32/false +23259 $register-within-list-with-conflict?:end: +23260 # . restore registers +23261 5f/pop-to-edi +23262 5e/pop-to-esi +23263 5b/pop-to-ebx +23264 5a/pop-to-edx +23265 59/pop-to-ecx +23266 # . epilogue +23267 89/<- %esp 5/r32/ebp +23268 5d/pop-to-ebp +23269 c3/return +23270 +23271 # At the first occurrence of register 'reg' in fn-outputs, +23272 # check if the corresponding element of return-inouts has a different register. +23273 # This hacky helper is intended to be called in one specific place. Don't +23274 # reuse it as is. +23275 register-conflict?: # reg: (addr array byte), return-inouts: (addr stmt-var), fn-outputs: (addr list var) => result/eax: boolean +23276 # . prologue +23277 55/push-ebp +23278 89/<- %ebp 4/r32/esp +23279 # . save registers +23280 51/push-ecx +23281 52/push-edx +23282 53/push-ebx +23283 56/push-esi +23284 57/push-edi +23285 #? (write-buffered Stderr "BB: ") +23286 #? (write-buffered Stderr *(ebp+8)) +23287 #? (write-buffered Stderr Newline) +23288 #? (flush Stderr) +23289 # var curr-output/edi: (addr list var) = fn-outputs +23290 8b/-> *(ebp+0x10) 7/r32/edi +23291 # var curr-inout/esi: (addr stmt-var) = return-inouts +23292 8b/-> *(ebp+0xc) 6/r32/esi +23293 { +23294 # if (curr-output == 0) abort +23295 81 7/subop/compare %edi 0/imm32 +23296 0f 84/jump-if-= break/disp32 +23297 # if (curr-output->value->register != reg) continue +23298 (lookup *edi *(edi+4)) # List-value List-value => eax +23299 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +23300 (string-equal? %eax *(ebp+8)) # => eax +23301 3d/compare-eax-and 0/imm32/false +23302 0f 84/jump-if= $register-conflict?:continue/disp32 +23303 #? (write-buffered Stderr "rescan\n") +23304 #? (flush Stderr) +23305 # var curr-reg/eax: (addr array byte) = curr-inout->value->register +23306 (lookup *esi *(esi+4)) # List-value List-value => eax +23307 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +23308 # if (curr-reg == 0) return true +23309 3d/compare-eax-and 0/imm32 +23310 { +23311 75/jump-if-!= break/disp8 +23312 #? (write-buffered Stderr "no register\n") +23313 #? (flush Stderr) +23314 b8/copy-to-eax 1/imm32/true +23315 e9/jump $register-conflict?:end/disp32 +23316 } +23317 # return (curr-reg != reg) +23318 (string-equal? %eax *(ebp+8)) # => eax +23319 3d/compare-eax-and 0/imm32/false +23320 0f 94/set-if-= %al +23321 #? (write-buffered Stderr "final: ") +23322 #? (write-int32-hex-buffered Stderr %eax) +23323 #? (write-buffered Stderr Newline) +23324 #? (flush Stderr) +23325 eb/jump $register-conflict?:end/disp8 +23326 $register-conflict?:continue: +23327 # curr-output = curr-output->next +23328 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +23329 89/<- %edi 0/r32/eax +23330 # curr-inout = curr-inout->next +23331 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +23332 89/<- %esi 0/r32/eax +23333 e9/jump loop/disp32 +23334 } +23335 # should never get here +23336 (write-buffered Stderr "register-conflict? misused\n") +23337 (flush Stderr) +23338 e8/call syscall_exit/disp32 +23339 $register-conflict?:end: +23340 # . restore registers +23341 5f/pop-to-edi +23342 5e/pop-to-esi +23343 5b/pop-to-ebx +23344 5a/pop-to-edx +23345 59/pop-to-ecx +23346 # . epilogue +23347 89/<- %esp 5/r32/ebp +23348 5d/pop-to-ebp +23349 c3/return +23350 +23351 check-final-stmt-is-return: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +23352 # . prologue +23353 55/push-ebp +23354 89/<- %ebp 4/r32/esp +23355 # . save registers +23356 50/push-eax +23357 51/push-ecx +23358 # var curr/ecx: (addr list stmt) = block->stmts +23359 8b/-> *(ebp+8) 0/r32/eax +23360 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax +23361 3d/compare-eax-and 0/imm32 +23362 74/jump-if-= $check-final-stmt-is-return:error/disp8 +23363 89/<- %ecx 0/r32/eax +23364 { +23365 # if curr->next == 0, break +23366 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +23367 3d/compare-eax-and 0/imm32 +23368 74/jump-if-= break/disp8 +23369 # curr = curr->next +23370 89/<- %ecx 0/r32/eax +23371 e9/jump loop/disp32 +23372 } +23373 $check-final-stmt-is-return:check-tag: +23374 # if curr->value->tag != Stmt1, abort +23375 (lookup *ecx *(ecx+4)) # List-value List-value => eax +23376 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag +23377 75/jump-if-!= $check-final-stmt-is-return:error/disp8 +23378 $check-final-stmt-is-return:check-operation: +23379 # if curr->operation != "return", abort +23380 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +23381 (string-equal? %eax "return") +23382 3d/compare-eax-and 0/imm32/false +23383 74/jump-if-= $check-final-stmt-is-return:error/disp8 +23384 $check-final-stmt-is-return:end: +23385 # . restore registers +23386 59/pop-to-ecx +23387 58/pop-to-eax +23388 # . epilogue +23389 89/<- %esp 5/r32/ebp +23390 5d/pop-to-ebp +23391 c3/return +23392 +23393 $check-final-stmt-is-return:error: +23394 (write-buffered *(ebp+0x10) "fn ") +23395 8b/-> *(ebp+0xc) 0/r32/eax +23396 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23397 (write-buffered *(ebp+0x10) %eax) +23398 (write-buffered *(ebp+0x10) ": final statement should be a 'return'\n") +23399 (flush *(ebp+0x10)) +23400 (stop *(ebp+0x14) 1) +23401 # never gets here +23402 +23403 check-no-breaks: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +23404 # . prologue +23405 55/push-ebp +23406 89/<- %ebp 4/r32/esp +23407 # . save registers +23408 50/push-eax +23409 51/push-ecx +23410 # var curr/ecx: (addr list stmt) = block->stmts +23411 8b/-> *(ebp+8) 0/r32/eax +23412 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax 23413 3d/compare-eax-and 0/imm32 -23414 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 -23415 $check-mu-copy-object-stmt:get-src: -23416 # var src/esi: (addr stmt-var) = dest->next -23417 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -23418 89/<- %esi 0/r32/eax -23419 # 1 inout -23420 3d/compare-eax-and 0/imm32 -23421 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 -23422 # > 2 inouts -23423 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -23424 3d/compare-eax-and 0/imm32 -23425 0f 85/jump-if-!= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 -23426 $check-mu-copy-object-stmt:types: -23427 # var src-type/ecx: (addr type-tree) = src->value->type -23428 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -23429 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -23430 89/<- %ecx 0/r32/eax -23431 # if (src->is-deref?) src-type = src-type->payload -23432 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref -23433 3d/compare-eax-and 0/imm32/false -23434 { -23435 74/jump-if-= break/disp8 -23436 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -23437 # if src-type->right is null, src-type = src-type->left -23438 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -23439 { -23440 75/jump-if-!= break/disp8 -23441 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -23442 } -23443 89/<- %ecx 0/r32/eax -23444 } -23445 # if src-type is not addr, abort -23446 (is-mu-addr-type? %ecx) # => eax -23447 3d/compare-eax-and 0/imm32/false -23448 0f 84/jump-if-= $check-mu-copy-object-stmt:error-invalid-types/disp32 -23449 # var dest-type/ebx: (addr type-tree) = dest->value->type -23450 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -23451 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -23452 89/<- %ebx 0/r32/eax -23453 # if (dest->is-deref?) dest-type = dest-type->payload -23454 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -23455 3d/compare-eax-and 0/imm32/false -23456 { -23457 74/jump-if-= break/disp8 -23458 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -23459 # if dest-type->right is null, dest-type = dest-type->left -23460 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -23461 { -23462 75/jump-if-!= break/disp8 -23463 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -23464 } -23465 89/<- %ebx 0/r32/eax -23466 } -23467 # if (dest-type != src-type) abort -23468 (type-equal? %ecx %ebx) # => eax -23469 3d/compare-eax-and 0/imm32 -23470 0f 84/jump-if-= $check-mu-copy-object-stmt:error-invalid-types/disp32 -23471 $check-mu-copy-object-stmt:end: -23472 # . restore registers -23473 5f/pop-to-edi -23474 5e/pop-to-esi -23475 5b/pop-to-ebx -23476 59/pop-to-ecx -23477 58/pop-to-eax -23478 # . epilogue -23479 89/<- %esp 5/r32/ebp -23480 5d/pop-to-ebp -23481 c3/return -23482 -23483 $check-mu-copy-object-stmt:error-incorrect-inouts: -23484 (write-buffered *(ebp+0x10) "fn ") -23485 8b/-> *(ebp+0xc) 0/r32/eax -23486 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23487 (write-buffered *(ebp+0x10) %eax) -23488 (write-buffered *(ebp+0x10) ": stmt 'copy-object' must have two inouts\n") -23489 (flush *(ebp+0x10)) -23490 (stop *(ebp+0x14) 1) -23491 # never gets here -23492 -23493 $check-mu-copy-object-stmt:error-too-many-outputs: -23494 (write-buffered *(ebp+0x10) "fn ") -23495 8b/-> *(ebp+0xc) 0/r32/eax -23496 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23497 (write-buffered *(ebp+0x10) %eax) -23498 (write-buffered *(ebp+0x10) ": stmt 'copy-object' must not have any outputs\n") -23499 (flush *(ebp+0x10)) -23500 (stop *(ebp+0x14) 1) -23501 # never gets here -23502 -23503 $check-mu-copy-object-stmt:error-invalid-types: -23504 (write-buffered *(ebp+0x10) "fn ") -23505 8b/-> *(ebp+0xc) 0/r32/eax -23506 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23507 (write-buffered *(ebp+0x10) %eax) -23508 (write-buffered *(ebp+0x10) ": stmt copy-object: two inouts with identical addr types expected\n") -23509 (flush *(ebp+0x10)) -23510 (stop *(ebp+0x14) 1) -23511 # never gets here -23512 -23513 check-mu-clear-object-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -23514 # . prologue -23515 55/push-ebp -23516 89/<- %ebp 4/r32/esp -23517 # . save registers -23518 50/push-eax -23519 51/push-ecx -23520 53/push-ebx -23521 56/push-esi -23522 57/push-edi -23523 # esi = stmt -23524 8b/-> *(ebp+8) 6/r32/esi -23525 $check-mu-clear-object-stmt:check-for-output: -23526 # if stmt->outputs abort -23527 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -23528 3d/compare-eax-and 0/imm32 -23529 0f 85/jump-if-!= $check-mu-clear-object-stmt:error-too-many-outputs/disp32 -23530 $check-mu-clear-object-stmt:get-left: -23531 # var dest/edi: (addr stmt-var) = stmt->inouts -23532 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -23533 89/<- %edi 0/r32/eax -23534 # zero inouts -23535 3d/compare-eax-and 0/imm32 -23536 0f 84/jump-if-= $check-mu-clear-object-stmt:error-incorrect-inouts/disp32 -23537 $check-mu-clear-object-stmt:get-src: -23538 # > 1 inout -23539 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -23540 3d/compare-eax-and 0/imm32 -23541 0f 85/jump-if-!= $check-mu-clear-object-stmt:error-incorrect-inouts/disp32 -23542 $check-mu-clear-object-stmt:types: -23543 # var src-type/ecx: (addr type-tree) = src->value->type -23544 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -23545 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -23546 89/<- %ecx 0/r32/eax -23547 # if (src->is-deref?) src-type = src-type->payload -23548 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -23549 3d/compare-eax-and 0/imm32/false -23550 { -23551 74/jump-if-= break/disp8 -23552 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -23553 # if src-type->right is null, src-type = src-type->left -23554 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -23555 { -23556 75/jump-if-!= break/disp8 -23557 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -23558 } -23559 89/<- %ecx 0/r32/eax -23560 } -23561 # if src-type is not addr, abort -23562 (is-mu-addr-type? %ecx) # => eax -23563 3d/compare-eax-and 0/imm32/false -23564 0f 84/jump-if-= $check-mu-clear-object-stmt:error-invalid-type/disp32 -23565 $check-mu-clear-object-stmt:end: -23566 # . restore registers -23567 5f/pop-to-edi -23568 5e/pop-to-esi -23569 5b/pop-to-ebx -23570 59/pop-to-ecx -23571 58/pop-to-eax -23572 # . epilogue -23573 89/<- %esp 5/r32/ebp -23574 5d/pop-to-ebp -23575 c3/return -23576 -23577 $check-mu-clear-object-stmt:error-incorrect-inouts: -23578 (write-buffered *(ebp+0x10) "fn ") -23579 8b/-> *(ebp+0xc) 0/r32/eax -23580 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23581 (write-buffered *(ebp+0x10) %eax) -23582 (write-buffered *(ebp+0x10) ": stmt 'clear-object' must have a single inout\n") -23583 (flush *(ebp+0x10)) -23584 (stop *(ebp+0x14) 1) -23585 # never gets here -23586 -23587 $check-mu-clear-object-stmt:error-too-many-outputs: -23588 (write-buffered *(ebp+0x10) "fn ") -23589 8b/-> *(ebp+0xc) 0/r32/eax -23590 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23591 (write-buffered *(ebp+0x10) %eax) -23592 (write-buffered *(ebp+0x10) ": stmt 'clear-object' must not have any outputs\n") -23593 (flush *(ebp+0x10)) -23594 (stop *(ebp+0x14) 1) -23595 # never gets here -23596 -23597 $check-mu-clear-object-stmt:error-invalid-type: -23598 (write-buffered *(ebp+0x10) "fn ") -23599 8b/-> *(ebp+0xc) 0/r32/eax -23600 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23601 (write-buffered *(ebp+0x10) %eax) -23602 (write-buffered *(ebp+0x10) ": stmt clear-object: inout must have an addr type\n") -23603 (flush *(ebp+0x10)) -23604 (stop *(ebp+0x14) 1) -23605 # never gets here -23606 -23607 check-mu-allocate-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -23608 # . prologue -23609 55/push-ebp -23610 89/<- %ebp 4/r32/esp -23611 # . save registers -23612 50/push-eax -23613 53/push-ebx -23614 56/push-esi -23615 57/push-edi -23616 # esi = stmt -23617 8b/-> *(ebp+8) 6/r32/esi -23618 $check-mu-allocate-stmt:check-for-output: -23619 # if stmt->outputs abort -23620 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -23621 3d/compare-eax-and 0/imm32 -23622 0f 85/jump-if-!= $check-mu-allocate-stmt:error-too-many-outputs/disp32 -23623 $check-mu-allocate-stmt:get-target: -23624 # var target/edi: (addr stmt-var) = stmt->inouts -23625 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -23626 89/<- %edi 0/r32/eax -23627 # zero inouts -23628 3d/compare-eax-and 0/imm32 -23629 0f 84/jump-if-= $check-mu-allocate-stmt:error-incorrect-inouts/disp32 -23630 # > 1 inouts -23631 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -23632 3d/compare-eax-and 0/imm32 -23633 0f 85/jump-if-!= $check-mu-allocate-stmt:error-incorrect-inouts/disp32 -23634 $check-mu-allocate-stmt:check-type: -23635 # var target-type/ebx: (addr type-tree) = target->value->type -23636 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -23637 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -23638 89/<- %ebx 0/r32/eax -23639 # if (target->is-deref?) target-type = target-type->payload -23640 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -23641 3d/compare-eax-and 0/imm32/false -23642 { -23643 74/jump-if-= break/disp8 -23644 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -23645 # if target-type->right is null, target-type = target-type->left -23646 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -23647 { -23648 75/jump-if-!= break/disp8 -23649 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -23650 } -23651 89/<- %ebx 0/r32/eax -23652 } -23653 # if target-type is not addr, abort -23654 (is-mu-addr-type? %ebx) # => eax -23655 3d/compare-eax-and 0/imm32/false -23656 0f 84/jump-if-= $check-mu-allocate-stmt:error-invalid-type/disp32 -23657 # if target-type->right is an atom, abort -23658 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -23659 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -23660 0f 85/jump-if-!= $check-mu-allocate-stmt:error-invalid-type/disp32 -23661 # if target-type->right->left is not handle, abort -23662 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -23663 (is-simple-mu-type? %eax 4) # handle => eax -23664 3d/compare-eax-and 0/imm32/false -23665 0f 84/jump-if-= $check-mu-allocate-stmt:error-invalid-type/disp32 -23666 $check-mu-allocate-stmt:end: -23667 # . restore registers -23668 5f/pop-to-edi -23669 5e/pop-to-esi -23670 5b/pop-to-ebx -23671 58/pop-to-eax -23672 # . epilogue -23673 89/<- %esp 5/r32/ebp -23674 5d/pop-to-ebp -23675 c3/return -23676 -23677 $check-mu-allocate-stmt:error-incorrect-inouts: -23678 (write-buffered *(ebp+0x10) "fn ") -23679 8b/-> *(ebp+0xc) 0/r32/eax -23680 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23681 (write-buffered *(ebp+0x10) %eax) -23682 (write-buffered *(ebp+0x10) ": stmt 'allocate' must have a single inout\n") -23683 (flush *(ebp+0x10)) -23684 (stop *(ebp+0x14) 1) -23685 # never gets here -23686 -23687 $check-mu-allocate-stmt:error-too-many-outputs: -23688 (write-buffered *(ebp+0x10) "fn ") -23689 8b/-> *(ebp+0xc) 0/r32/eax -23690 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23691 (write-buffered *(ebp+0x10) %eax) -23692 (write-buffered *(ebp+0x10) ": stmt 'allocate' must not have any outputs\n") -23693 (flush *(ebp+0x10)) -23694 (stop *(ebp+0x14) 1) -23695 # never gets here -23696 -23697 $check-mu-allocate-stmt:error-invalid-type: -23698 (write-buffered *(ebp+0x10) "fn ") -23699 8b/-> *(ebp+0xc) 0/r32/eax -23700 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23414 0f 84/jump-if-= $check-no-breaks:end/disp32 +23415 89/<- %ecx 0/r32/eax +23416 { +23417 # if curr->next == 0, break +23418 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +23419 3d/compare-eax-and 0/imm32 +23420 74/jump-if-= break/disp8 +23421 # if curr->value->tag != Stmt1, continue +23422 (lookup *ecx *(ecx+4)) # List-value List-value => eax +23423 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag +23424 75/jump-if-!= $check-no-breaks:continue/disp8 +23425 # if curr->value->operation starts with "break", abort +23426 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +23427 (string-starts-with? %eax "break") # => eax +23428 3d/compare-eax-and 0/imm32/false +23429 75/jump-if-!= $check-no-breaks:error/disp8 +23430 $check-no-breaks:continue: +23431 # curr = curr->next +23432 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +23433 89/<- %ecx 0/r32/eax +23434 e9/jump loop/disp32 +23435 } +23436 $check-no-breaks:end: +23437 # . restore registers +23438 59/pop-to-ecx +23439 58/pop-to-eax +23440 # . epilogue +23441 89/<- %esp 5/r32/ebp +23442 5d/pop-to-ebp +23443 c3/return +23444 +23445 $check-no-breaks:error: +23446 (write-buffered *(ebp+0x10) "fn ") +23447 8b/-> *(ebp+0xc) 0/r32/eax +23448 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23449 (write-buffered *(ebp+0x10) %eax) +23450 (write-buffered *(ebp+0x10) " has outputs, so you cannot 'break' out of the outermost block. Use 'return'.\n") +23451 (flush *(ebp+0x10)) +23452 (stop *(ebp+0x14) 1) +23453 # never gets here +23454 +23455 check-mu-get-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +23456 # . prologue +23457 55/push-ebp +23458 89/<- %ebp 4/r32/esp +23459 # . save registers +23460 50/push-eax +23461 51/push-ecx +23462 52/push-edx +23463 53/push-ebx +23464 56/push-esi +23465 57/push-edi +23466 # esi = stmt +23467 8b/-> *(ebp+8) 6/r32/esi +23468 # - check for 0 inouts +23469 # var base/ecx: (addr var) = stmt->inouts->value +23470 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +23471 3d/compare-eax-and 0/imm32/false +23472 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-inouts/disp32 +23473 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +23474 89/<- %ecx 0/r32/eax +23475 $check-mu-get-stmt:check-base: +23476 # - check base type +23477 # if it's an 'addr', check that it's in a register +23478 # var base-type/ebx: (addr type-tree) = lookup(base->type) +23479 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +23480 89/<- %ebx 0/r32/eax +23481 { +23482 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +23483 0f 85/jump-if-!= break/disp32 +23484 $check-mu-get-stmt:base-is-compound: +23485 # if (type->left != addr) break +23486 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +23487 (is-simple-mu-type? %eax 2) # addr => eax +23488 3d/compare-eax-and 0/imm32/false +23489 74/jump-if-= break/disp8 +23490 $check-mu-get-stmt:base-is-addr: +23491 # now check for register +23492 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +23493 0f 84/jump-if-= $check-mu-get-stmt:error-base-type-addr-but-not-register/disp32 +23494 $check-mu-get-stmt:base-is-addr-in-register: +23495 # type->left is now an addr; skip it +23496 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +23497 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +23498 0f 85/jump-if-!= $check-mu-get-stmt:error-bad-base/disp32 +23499 $check-mu-get-stmt:base-is-addr-to-atom-in-register: +23500 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +23501 89/<- %ebx 0/r32/eax +23502 } +23503 $check-mu-get-stmt:check-base-typeinfo: +23504 # ensure type is a container +23505 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +23506 { +23507 75/jump-if-!= break/disp8 +23508 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +23509 89/<- %ebx 0/r32/eax +23510 } +23511 # var base-type-id/ebx: type-id = base-type->value +23512 8b/-> *(ebx+4) 3/r32/ebx # Type-tree-value +23513 (is-container? %ebx) # => eax +23514 3d/compare-eax-and 0/imm32/false +23515 0f 84/jump-if-= $check-mu-get-stmt:error-bad-base/disp32 +23516 # var base-typeinfo/edx: (addr typeinfo) = find-typeinfo(base-type-id) +23517 # . var container/ecx: (handle typeinfo) +23518 68/push 0/imm32 +23519 68/push 0/imm32 +23520 89/<- %ecx 4/r32/esp +23521 # . +23522 (find-typeinfo %ebx %ecx) +23523 (lookup *ecx *(ecx+4)) # => eax +23524 # . reclaim container +23525 81 0/subop/add %esp 8/imm32 +23526 # . +23527 89/<- %edx 0/r32/eax +23528 # var offset/ecx: (addr stmt-var) = stmt->inouts->next +23529 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +23530 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +23531 89/<- %ecx 0/r32/eax +23532 # - check for 1 inout +23533 3d/compare-eax-and 0/imm32/false +23534 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-inouts/disp32 +23535 # var offset/ecx: (addr var) = lookup(offset->value) +23536 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +23537 89/<- %ecx 0/r32/eax +23538 # - check for valid field +23539 81 7/subop/compare *(ecx+0x14) -1/imm32/uninitialized # Var-offset +23540 0f 84/jump-if-= $check-mu-get-stmt:error-bad-field/disp32 +23541 # - check for too many inouts +23542 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +23543 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +23544 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +23545 3d/compare-eax-and 0/imm32/false +23546 0f 85/jump-if-!= $check-mu-get-stmt:error-too-many-inouts/disp32 +23547 # var output/edi: (addr var) = stmt->outputs->value +23548 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +23549 # - check for 0 outputs +23550 3d/compare-eax-and 0/imm32/false +23551 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-outputs/disp32 +23552 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +23553 89/<- %edi 0/r32/eax +23554 $check-mu-get-stmt:check-output-type: +23555 # - check output type +23556 # must be in register +23557 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax +23558 3d/compare-eax-and 0/imm32 +23559 0f 84/jump-if-= $check-mu-get-stmt:error-output-not-in-register/disp32 +23560 # must have a non-atomic type +23561 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +23562 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +23563 0f 85/jump-if-!= $check-mu-get-stmt:error-output-type-not-address/disp32 +23564 # type must start with (addr ...) +23565 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +23566 (is-simple-mu-type? %eax 2) # => eax +23567 3d/compare-eax-and 0/imm32/false +23568 0f 84/jump-if-= $check-mu-get-stmt:error-output-type-not-address/disp32 +23569 $check-mu-get-stmt:check-output-type-match: +23570 # payload of addr type must match 'type' definition +23571 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +23572 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +23573 # if (payload->right == null) payload = payload->left +23574 81 7/subop/compare *(eax+0xc) 0/imm32/null # Type-tree-right +23575 { +23576 75/jump-if-!= break/disp8 +23577 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +23578 } +23579 89/<- %edi 0/r32/eax +23580 # . var output-name/ecx: (addr array byte) +23581 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +23582 89/<- %ecx 0/r32/eax +23583 # . var base-typeinfo-entry/eax: (addr handle typeinfo-entry) +23584 (lookup *(edx+4) *(edx+8)) # Typeinfo-fields Typeinfo-fields => eax +23585 (get %eax %ecx 0x10) # => eax +23586 # . +23587 (lookup *eax *(eax+4)) # => eax +23588 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax +23589 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +23590 # . +23591 (type-equal? %edi %eax) # => eax +23592 3d/compare-eax-and 0/imm32/false +23593 0f 84/jump-if-= $check-mu-get-stmt:error-bad-output-type/disp32 +23594 # - check for too many outputs +23595 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +23596 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +23597 3d/compare-eax-and 0/imm32/false +23598 0f 85/jump-if-!= $check-mu-get-stmt:error-too-many-outputs/disp32 +23599 $check-mu-get-stmt:end: +23600 # . restore registers +23601 5f/pop-to-edi +23602 5e/pop-to-esi +23603 5b/pop-to-ebx +23604 5a/pop-to-edx +23605 59/pop-to-ecx +23606 58/pop-to-eax +23607 # . epilogue +23608 89/<- %esp 5/r32/ebp +23609 5d/pop-to-ebp +23610 c3/return +23611 +23612 $check-mu-get-stmt:error-too-few-inouts: +23613 (write-buffered *(ebp+0x10) "fn ") +23614 8b/-> *(ebp+0xc) 0/r32/eax +23615 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23616 (write-buffered *(ebp+0x10) %eax) +23617 (write-buffered *(ebp+0x10) ": stmt get: too few inouts (2 required)\n") +23618 (flush *(ebp+0x10)) +23619 (stop *(ebp+0x14) 1) +23620 # never gets here +23621 +23622 $check-mu-get-stmt:error-too-many-inouts: +23623 (write-buffered *(ebp+0x10) "fn ") +23624 8b/-> *(ebp+0xc) 0/r32/eax +23625 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23626 (write-buffered *(ebp+0x10) %eax) +23627 (write-buffered *(ebp+0x10) ": stmt get: too many inouts (2 required)\n") +23628 (flush *(ebp+0x10)) +23629 (stop *(ebp+0x14) 1) +23630 # never gets here +23631 +23632 $check-mu-get-stmt:error-too-few-outputs: +23633 (write-buffered *(ebp+0x10) "fn ") +23634 8b/-> *(ebp+0xc) 0/r32/eax +23635 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23636 (write-buffered *(ebp+0x10) %eax) +23637 (write-buffered *(ebp+0x10) ": stmt get: must have an output\n") +23638 (flush *(ebp+0x10)) +23639 (stop *(ebp+0x14) 1) +23640 # never gets here +23641 +23642 $check-mu-get-stmt:error-too-many-outputs: +23643 (write-buffered *(ebp+0x10) "fn ") +23644 8b/-> *(ebp+0xc) 0/r32/eax +23645 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23646 (write-buffered *(ebp+0x10) %eax) +23647 (write-buffered *(ebp+0x10) ": stmt get: too many outputs (1 required)\n") +23648 (flush *(ebp+0x10)) +23649 (stop *(ebp+0x14) 1) +23650 # never gets here +23651 +23652 $check-mu-get-stmt:error-bad-base: +23653 # error("fn " fn ": stmt get: var '" base->name "' must have a 'type' definition\n") +23654 (write-buffered *(ebp+0x10) "fn ") +23655 8b/-> *(ebp+0xc) 0/r32/eax +23656 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23657 (write-buffered *(ebp+0x10) %eax) +23658 (write-buffered *(ebp+0x10) ": stmt get: var '") +23659 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +23660 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +23661 (lookup *eax *(eax+4)) # Var-name Var-name => eax +23662 (write-buffered *(ebp+0x10) %eax) +23663 (write-buffered *(ebp+0x10) "' must have a 'type' definition\n") +23664 (flush *(ebp+0x10)) +23665 (stop *(ebp+0x14) 1) +23666 # never gets here +23667 +23668 $check-mu-get-stmt:error-base-type-addr-but-not-register: +23669 (write-buffered *(ebp+0x10) "fn ") +23670 8b/-> *(ebp+0xc) 0/r32/eax +23671 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23672 (write-buffered *(ebp+0x10) %eax) +23673 (write-buffered *(ebp+0x10) ": stmt get: var '") +23674 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +23675 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +23676 (lookup *eax *(eax+4)) # Var-name Var-name => eax +23677 (write-buffered *(ebp+0x10) %eax) +23678 (write-buffered *(ebp+0x10) "' is an 'addr' type, and so must live in a register\n") +23679 (flush *(ebp+0x10)) +23680 (stop *(ebp+0x14) 1) +23681 # never gets here +23682 +23683 $check-mu-get-stmt:error-bad-field: +23684 # error("fn " fn ": stmt get: type " type " has no member called '" curr->name "'\n") +23685 (write-buffered *(ebp+0x10) "fn ") +23686 8b/-> *(ebp+0xc) 0/r32/eax +23687 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23688 (write-buffered *(ebp+0x10) %eax) +23689 (write-buffered *(ebp+0x10) ": stmt get: type '") +23690 # . write(Type-id->data[tmp]) +23691 bf/copy-to-edi Type-id/imm32 +23692 8b/-> *(edi+ebx<<2+0xc) 6/r32/esi +23693 { +23694 81 7/subop/compare %esi 0/imm32 +23695 74/jump-if-= break/disp8 +23696 (write-buffered *(ebp+0x10) %esi) +23697 } +23698 # . +23699 (write-buffered *(ebp+0x10) "' has no member called '") +23700 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax 23701 (write-buffered *(ebp+0x10) %eax) -23702 (write-buffered *(ebp+0x10) ": stmt allocate: inout '") -23703 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -23704 (lookup *eax *(eax+4)) # Var-name Var-name => eax -23705 (write-buffered *(ebp+0x10) %eax) -23706 (write-buffered *(ebp+0x10) "' must have type (addr handle ...)\n") -23707 (flush *(ebp+0x10)) -23708 (stop *(ebp+0x14) 1) -23709 # never gets here -23710 -23711 check-mu-populate-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -23712 # . prologue -23713 55/push-ebp -23714 89/<- %ebp 4/r32/esp -23715 # . save registers -23716 50/push-eax -23717 53/push-ebx -23718 56/push-esi -23719 57/push-edi -23720 # esi = stmt -23721 8b/-> *(ebp+8) 6/r32/esi -23722 $check-mu-populate-stmt:check-for-output: -23723 # if stmt->outputs abort -23724 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -23725 3d/compare-eax-and 0/imm32 -23726 0f 85/jump-if-!= $check-mu-populate-stmt:error-too-many-outputs/disp32 -23727 $check-mu-populate-stmt:get-target: -23728 # var target/edi: (addr stmt-var) = stmt->inouts -23729 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -23730 89/<- %edi 0/r32/eax -23731 # zero inouts -23732 3d/compare-eax-and 0/imm32 -23733 0f 84/jump-if-= $check-mu-populate-stmt:error-incorrect-inouts/disp32 -23734 $check-mu-populate-stmt:get-length: -23735 # var length/esi: (addr stmt-var) = dest->next -23736 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -23737 89/<- %esi 0/r32/eax -23738 # 1 inout -23739 3d/compare-eax-and 0/imm32 -23740 0f 84/jump-if-= $check-mu-populate-stmt:error-incorrect-inouts/disp32 -23741 # > 2 inouts -23742 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -23743 3d/compare-eax-and 0/imm32 -23744 0f 85/jump-if-!= $check-mu-populate-stmt:error-incorrect-inouts/disp32 -23745 $check-mu-populate-stmt:check-target-type: -23746 # var target-type/ebx: (addr type-tree) = target->value->type -23747 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -23748 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -23749 89/<- %ebx 0/r32/eax -23750 $check-mu-populate-stmt:check-target-type-deref: -23751 # if (target->is-deref?) target-type = target-type->payload -23752 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -23753 3d/compare-eax-and 0/imm32/false -23754 { -23755 74/jump-if-= break/disp8 -23756 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -23757 # if target-type->right is null, target-type = target-type->left -23758 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -23759 { -23760 75/jump-if-!= break/disp8 -23761 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -23762 } -23763 89/<- %ebx 0/r32/eax -23764 } -23765 $check-mu-populate-stmt:check-target-type-addr: -23766 # if target-type is not addr, abort -23767 (is-mu-addr-type? %ebx) # => eax -23768 3d/compare-eax-and 0/imm32/false -23769 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 -23770 # if target-type->right is an atom, abort -23771 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -23772 89/<- %ebx 0/r32/eax -23773 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -23774 0f 85/jump-if-!= $check-mu-populate-stmt:error-invalid-target-type/disp32 -23775 $check-mu-populate-stmt:check-target-type-handle: -23776 # if target-type->right->left is not handle, abort -23777 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -23778 (is-simple-mu-type? %eax 4) # handle => eax -23779 3d/compare-eax-and 0/imm32/false -23780 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 -23781 # if target-type->right->right is an atom, abort -23782 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -23783 89/<- %ebx 0/r32/eax -23784 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -23785 0f 85/jump-if-!= $check-mu-populate-stmt:error-invalid-target-type/disp32 -23786 $check-mu-populate-stmt:check-target-type-array: -23787 # if target-type->right->right->left is not array, abort -23788 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -23789 (is-simple-mu-type? %eax 3) # array => eax -23790 3d/compare-eax-and 0/imm32/false -23791 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 -23792 $check-mu-populate-stmt:check-length-type: -23793 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -23794 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -23795 89/<- %ebx 0/r32/eax -23796 (is-simple-mu-type? %ebx 0) # literal => eax -23797 3d/compare-eax-and 0/imm32/false -23798 75/jump-if-!= $check-mu-populate-stmt:end/disp8 -23799 (is-simple-mu-type? %ebx 1) # int => eax -23800 3d/compare-eax-and 0/imm32/false -23801 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-length-type/disp32 -23802 $check-mu-populate-stmt:end: -23803 # . restore registers -23804 5f/pop-to-edi -23805 5e/pop-to-esi -23806 5b/pop-to-ebx -23807 58/pop-to-eax -23808 # . epilogue -23809 89/<- %esp 5/r32/ebp -23810 5d/pop-to-ebp -23811 c3/return -23812 -23813 $check-mu-populate-stmt:error-incorrect-inouts: -23814 (write-buffered *(ebp+0x10) "fn ") -23815 8b/-> *(ebp+0xc) 0/r32/eax -23816 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23817 (write-buffered *(ebp+0x10) %eax) -23818 (write-buffered *(ebp+0x10) ": stmt 'populate' must have two inouts\n") -23819 (flush *(ebp+0x10)) -23820 (stop *(ebp+0x14) 1) -23821 # never gets here -23822 -23823 $check-mu-populate-stmt:error-too-many-outputs: -23824 (write-buffered *(ebp+0x10) "fn ") -23825 8b/-> *(ebp+0xc) 0/r32/eax -23826 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23827 (write-buffered *(ebp+0x10) %eax) -23828 (write-buffered *(ebp+0x10) ": stmt 'populate' must not have any outputs\n") -23829 (flush *(ebp+0x10)) -23830 (stop *(ebp+0x14) 1) -23831 # never gets here -23832 -23833 $check-mu-populate-stmt:error-invalid-target-type: -23834 (write-buffered *(ebp+0x10) "fn ") -23835 8b/-> *(ebp+0xc) 0/r32/eax -23836 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23837 (write-buffered *(ebp+0x10) %eax) -23838 (write-buffered *(ebp+0x10) ": stmt populate: first inout '") -23839 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -23840 (lookup *eax *(eax+4)) # Var-name Var-name => eax -23841 (write-buffered *(ebp+0x10) %eax) -23842 (write-buffered *(ebp+0x10) "' must have type (addr handle array ...)\n") -23843 (flush *(ebp+0x10)) -23844 (stop *(ebp+0x14) 1) -23845 # never gets here -23846 -23847 $check-mu-populate-stmt:error-invalid-length-type: -23848 (write-buffered *(ebp+0x10) "fn ") -23849 8b/-> *(ebp+0xc) 0/r32/eax -23850 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23851 (write-buffered *(ebp+0x10) %eax) -23852 (write-buffered *(ebp+0x10) ": stmt populate: second inout '") -23853 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -23854 (lookup *eax *(eax+4)) # Var-name Var-name => eax -23855 (write-buffered *(ebp+0x10) %eax) -23856 (write-buffered *(ebp+0x10) "' must be an int\n") -23857 (flush *(ebp+0x10)) -23858 (stop *(ebp+0x14) 1) -23859 # never gets here -23860 -23861 check-mu-populate-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -23862 # . prologue -23863 55/push-ebp -23864 89/<- %ebp 4/r32/esp -23865 # . save registers -23866 50/push-eax -23867 53/push-ebx -23868 56/push-esi -23869 57/push-edi -23870 # esi = stmt -23871 8b/-> *(ebp+8) 6/r32/esi -23872 $check-mu-populate-stream-stmt:check-for-output: -23873 # if stmt->outputs abort -23874 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -23875 3d/compare-eax-and 0/imm32 -23876 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-too-many-outputs/disp32 -23877 $check-mu-populate-stream-stmt:get-target: -23878 # var target/edi: (addr stmt-var) = stmt->inouts -23879 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -23880 89/<- %edi 0/r32/eax -23881 # zero inouts -23882 3d/compare-eax-and 0/imm32 -23883 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-incorrect-inouts/disp32 -23884 $check-mu-populate-stream-stmt:get-length: -23885 # var length/esi: (addr stmt-var) = dest->next -23886 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -23887 89/<- %esi 0/r32/eax -23888 # 1 inout -23889 3d/compare-eax-and 0/imm32 -23890 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-incorrect-inouts/disp32 -23891 # > 2 inouts -23892 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -23893 3d/compare-eax-and 0/imm32 -23894 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-incorrect-inouts/disp32 -23895 $check-mu-populate-stream-stmt:check-target-type: -23896 # var target-type/ebx: (addr type-tree) = target->value->type -23897 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -23898 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -23899 89/<- %ebx 0/r32/eax -23900 $check-mu-populate-stream-stmt:check-target-type-deref: -23901 # if (target->is-deref?) target-type = target-type->payload -23902 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +23702 (write-buffered *(ebp+0x10) "'\n") +23703 (flush *(ebp+0x10)) +23704 (stop *(ebp+0x14) 1) +23705 # never gets here +23706 +23707 $check-mu-get-stmt:error-output-not-in-register: +23708 (write-buffered *(ebp+0x10) "fn ") +23709 8b/-> *(ebp+0xc) 0/r32/eax +23710 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23711 (write-buffered *(ebp+0x10) %eax) +23712 (write-buffered *(ebp+0x10) ": stmt get: output '") +23713 (lookup *edi *(edi+4)) # Var-name Var-name => eax +23714 (write-buffered *(ebp+0x10) %eax) +23715 (write-buffered *(ebp+0x10) "' is not in a register\n") +23716 (flush *(ebp+0x10)) +23717 (stop *(ebp+0x14) 1) +23718 # never gets here +23719 +23720 $check-mu-get-stmt:error-output-type-not-address: +23721 (write-buffered *(ebp+0x10) "fn ") +23722 8b/-> *(ebp+0xc) 0/r32/eax +23723 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23724 (write-buffered *(ebp+0x10) %eax) +23725 (write-buffered *(ebp+0x10) ": stmt get: output must be an addr\n") +23726 (flush *(ebp+0x10)) +23727 (stop *(ebp+0x14) 1) +23728 # never gets here +23729 +23730 $check-mu-get-stmt:error-bad-output-type: +23731 (write-buffered *(ebp+0x10) "fn ") +23732 8b/-> *(ebp+0xc) 0/r32/eax +23733 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23734 (write-buffered *(ebp+0x10) %eax) +23735 (write-buffered *(ebp+0x10) ": stmt get: wrong output type for member '") +23736 (write-buffered *(ebp+0x10) %ecx) +23737 (write-buffered *(ebp+0x10) "' of type '") +23738 bf/copy-to-edi Type-id/imm32 +23739 8b/-> *(edi+ebx<<2+0xc) 6/r32/esi +23740 { +23741 81 7/subop/compare %esi 0/imm32 +23742 74/jump-if-= break/disp8 +23743 (write-buffered *(ebp+0x10) %esi) +23744 } +23745 (write-buffered *(ebp+0x10) "'\n") +23746 (flush *(ebp+0x10)) +23747 (stop *(ebp+0x14) 1) +23748 # never gets here +23749 +23750 check-mu-index-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +23751 # . prologue +23752 55/push-ebp +23753 89/<- %ebp 4/r32/esp +23754 # . save registers +23755 50/push-eax +23756 51/push-ecx +23757 52/push-edx +23758 53/push-ebx +23759 56/push-esi +23760 57/push-edi +23761 # esi = stmt +23762 8b/-> *(ebp+8) 6/r32/esi +23763 # - check for 0 inouts +23764 # var base/ecx: (addr var) = stmt->inouts->value +23765 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +23766 $check-mu-index-stmt:check-no-inouts: +23767 3d/compare-eax-and 0/imm32 +23768 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-inouts/disp32 +23769 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +23770 89/<- %ecx 0/r32/eax +23771 # - check base type is either (addr array ...) in register or (array ...) on stack +23772 # var base-type/ebx: (addr type-tree) = lookup(base->type) +23773 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +23774 89/<- %ebx 0/r32/eax +23775 # if base-type is an atom, abort with a precise error +23776 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +23777 { +23778 74/jump-if-= break/disp8 +23779 (is-simple-mu-type? %ebx 3) # array => eax +23780 3d/compare-eax-and 0/imm32/false +23781 0f 85/jump-if-!= $check-mu-index-stmt:error-base-array-atom-type/disp32 +23782 0f 84/jump-if-= $check-mu-index-stmt:error-base-non-array-type/disp32 +23783 } +23784 $check-mu-index-stmt:base-is-compound: +23785 # if type->left not addr or array, abort +23786 { +23787 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +23788 (is-simple-mu-type? %eax 2) # addr => eax +23789 3d/compare-eax-and 0/imm32/false +23790 75/jump-if-!= break/disp8 +23791 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +23792 (is-simple-mu-type? %eax 3) # array => eax +23793 3d/compare-eax-and 0/imm32/false +23794 75/jump-if-!= break/disp8 +23795 e9/jump $check-mu-index-stmt:error-base-non-array-type/disp32 +23796 } +23797 # if (type->left == addr) ensure type->right->left == array and type->register exists +23798 { +23799 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +23800 (is-simple-mu-type? %eax 2) # addr => eax +23801 3d/compare-eax-and 0/imm32/false +23802 74/jump-if-= break/disp8 +23803 $check-mu-index-stmt:base-is-addr: +23804 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +23805 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +23806 (is-simple-mu-type? %eax 3) # array => eax +23807 3d/compare-eax-and 0/imm32/false +23808 0f 84/jump-if-= $check-mu-index-stmt:error-base-non-array-type/disp32 +23809 $check-mu-index-stmt:check-base-addr-is-register: +23810 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +23811 0f 84/jump-if-= $check-mu-index-stmt:error-base-address-array-type-on-stack/disp32 +23812 } +23813 # if (type->left == array) ensure type->register doesn't exist +23814 { +23815 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +23816 (is-simple-mu-type? %eax 3) # array => eax +23817 3d/compare-eax-and 0/imm32/false +23818 74/jump-if-= break/disp8 +23819 $check-mu-index-stmt:base-is-array: +23820 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +23821 0f 85/jump-if-!= $check-mu-index-stmt:error-base-array-type-in-register/disp32 +23822 } +23823 # if (base-type->left == addr) base-type = base-type->right +23824 { +23825 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +23826 (is-simple-mu-type? %eax 2) # addr => eax +23827 3d/compare-eax-and 0/imm32/false +23828 74/jump-if-= break/disp8 +23829 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +23830 89/<- %ebx 0/r32/eax +23831 } +23832 # - check for 1 inout +23833 # var index/ecx: (addr stmt-var) = stmt->inouts->next->value +23834 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +23835 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +23836 $check-mu-index-stmt:check-single-inout: +23837 3d/compare-eax-and 0/imm32 +23838 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-inouts/disp32 +23839 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +23840 89/<- %ecx 0/r32/eax +23841 # - check index is either a literal or register +23842 # var index-type/edx: (addr type-tree) +23843 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +23844 89/<- %edx 0/r32/eax +23845 # if index type is an atom, it must be a literal or int +23846 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +23847 { +23848 74/jump-if-= break/disp8 +23849 $check-mu-index-stmt:index-type-is-atom: +23850 (is-simple-mu-type? %edx 0) # literal => eax +23851 3d/compare-eax-and 0/imm32/false +23852 75/jump-if-!= $check-mu-index-stmt:index-type-done/disp8 +23853 (is-simple-mu-type? %edx 1) # int => eax +23854 3d/compare-eax-and 0/imm32/false +23855 75/jump-if-!= $check-mu-index-stmt:index-type-done/disp8 +23856 (is-simple-mu-type? %edx 7) # offset => eax +23857 3d/compare-eax-and 0/imm32/false +23858 0f 85/jump-if-!= $check-mu-index-stmt:error-index-offset-atom-type/disp32 +23859 e9/jump $check-mu-index-stmt:error-invalid-index-type/disp32 +23860 } +23861 # if index type is a non-atom: it must be an offset +23862 { +23863 75/jump-if-!= break/disp8 +23864 $check-mu-index-stmt:index-type-is-non-atom: +23865 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +23866 (is-simple-mu-type? %eax 7) # offset => eax +23867 3d/compare-eax-and 0/imm32/false +23868 0f 84/jump-if-= $check-mu-index-stmt:error-invalid-index-type/disp32 +23869 } +23870 $check-mu-index-stmt:index-type-done: +23871 # check index is either a literal or in a register +23872 { +23873 (is-simple-mu-type? %edx 0) # literal => eax +23874 3d/compare-eax-and 0/imm32/false +23875 75/jump-if-!= break/disp8 +23876 $check-mu-index-stmt:check-index-in-register: +23877 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +23878 0f 84/jump-if-= $check-mu-index-stmt:error-index-on-stack/disp32 +23879 } +23880 # - if index is an 'int', check that element type of base has size 1, 2, 4 or 8 bytes. +23881 { +23882 (is-simple-mu-type? %edx 1) # int => eax +23883 3d/compare-eax-and 0/imm32/false +23884 74/jump-if-= break/disp8 +23885 $check-mu-index-stmt:check-index-can-be-int: +23886 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +23887 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +23888 (array-element-size %eax) # => eax +23889 3d/compare-eax-and 1/imm32 +23890 74/jump-if-= break/disp8 +23891 3d/compare-eax-and 2/imm32 +23892 74/jump-if-= break/disp8 +23893 3d/compare-eax-and 4/imm32 +23894 74/jump-if-= break/disp8 +23895 3d/compare-eax-and 8/imm32 +23896 74/jump-if-= break/disp8 +23897 e9/jump $check-mu-index-stmt:error-index-needs-offset/disp32 +23898 } +23899 # - check for too many inouts +23900 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +23901 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +23902 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax 23903 3d/compare-eax-and 0/imm32/false -23904 { -23905 74/jump-if-= break/disp8 -23906 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -23907 # if target-type->right is null, target-type = target-type->left -23908 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -23909 { -23910 75/jump-if-!= break/disp8 -23911 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -23912 } -23913 89/<- %ebx 0/r32/eax -23914 } -23915 $check-mu-populate-stream-stmt:check-target-type-addr: -23916 # if target-type is not addr, abort -23917 (is-mu-addr-type? %ebx) # => eax -23918 3d/compare-eax-and 0/imm32/false -23919 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 -23920 # if target-type->right is an atom, abort -23921 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -23922 89/<- %ebx 0/r32/eax -23923 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -23924 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 -23925 $check-mu-populate-stream-stmt:check-target-type-handle: -23926 # if target-type->right->left is not handle, abort -23927 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -23928 (is-simple-mu-type? %eax 4) # handle => eax -23929 3d/compare-eax-and 0/imm32/false -23930 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 -23931 # if target-type->right->right is an atom, abort -23932 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -23933 89/<- %ebx 0/r32/eax -23934 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -23935 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 -23936 $check-mu-populate-stream-stmt:check-target-type-stream: -23937 # if target-type->right->right->left is not stream, abort -23938 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -23939 (is-simple-mu-type? %eax 0xb) # stream => eax -23940 3d/compare-eax-and 0/imm32/false -23941 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 -23942 $check-mu-populate-stream-stmt:check-length-type: -23943 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -23944 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -23945 89/<- %ebx 0/r32/eax -23946 (is-simple-mu-type? %ebx 0) # literal => eax -23947 3d/compare-eax-and 0/imm32/false -23948 75/jump-if-!= $check-mu-populate-stream-stmt:end/disp8 -23949 (is-simple-mu-type? %ebx 1) # int => eax -23950 3d/compare-eax-and 0/imm32/false -23951 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-length-type/disp32 -23952 $check-mu-populate-stream-stmt:end: -23953 # . restore registers -23954 5f/pop-to-edi -23955 5e/pop-to-esi -23956 5b/pop-to-ebx -23957 58/pop-to-eax -23958 # . epilogue -23959 89/<- %esp 5/r32/ebp -23960 5d/pop-to-ebp -23961 c3/return -23962 -23963 $check-mu-populate-stream-stmt:error-incorrect-inouts: -23964 (write-buffered *(ebp+0x10) "fn ") -23965 8b/-> *(ebp+0xc) 0/r32/eax -23966 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23967 (write-buffered *(ebp+0x10) %eax) -23968 (write-buffered *(ebp+0x10) ": stmt 'populate-stream' must have two inouts\n") -23969 (flush *(ebp+0x10)) -23970 (stop *(ebp+0x14) 1) -23971 # never gets here -23972 -23973 $check-mu-populate-stream-stmt:error-too-many-outputs: -23974 (write-buffered *(ebp+0x10) "fn ") -23975 8b/-> *(ebp+0xc) 0/r32/eax -23976 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23977 (write-buffered *(ebp+0x10) %eax) -23978 (write-buffered *(ebp+0x10) ": stmt 'populate-stream' must not have any outputs\n") -23979 (flush *(ebp+0x10)) -23980 (stop *(ebp+0x14) 1) -23981 # never gets here -23982 -23983 $check-mu-populate-stream-stmt:error-invalid-target-type: -23984 (write-buffered *(ebp+0x10) "fn ") -23985 8b/-> *(ebp+0xc) 0/r32/eax -23986 (lookup *eax *(eax+4)) # Function-name Function-name => eax -23987 (write-buffered *(ebp+0x10) %eax) -23988 (write-buffered *(ebp+0x10) ": stmt populate-stream: first inout '") -23989 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -23990 (lookup *eax *(eax+4)) # Var-name Var-name => eax +23904 0f 85/jump-if-!= $check-mu-index-stmt:error-too-many-inouts/disp32 +23905 # - check for 0 outputs +23906 # var output/edi: (addr var) = stmt->outputs->value +23907 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +23908 3d/compare-eax-and 0/imm32/false +23909 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-outputs/disp32 +23910 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +23911 89/<- %edi 0/r32/eax +23912 # - check output type +23913 # must have a non-atomic type +23914 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +23915 89/<- %edx 0/r32/eax +23916 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +23917 0f 85/jump-if-!= $check-mu-index-stmt:error-output-type-not-address/disp32 +23918 # type must start with (addr ...) +23919 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +23920 (is-simple-mu-type? %eax 2) # addr => eax +23921 3d/compare-eax-and 0/imm32/false +23922 0f 84/jump-if-= $check-mu-index-stmt:error-output-type-not-address/disp32 +23923 # if tail(base-type) != tail(output-type) abort +23924 (type-tail %ebx) # => eax +23925 89/<- %ebx 0/r32/eax +23926 (type-tail %edx) # => eax +23927 (type-equal? %ebx %eax) # => eax +23928 3d/compare-eax-and 0/imm32/false +23929 0f 84/jump-if-= $check-mu-index-stmt:error-bad-output-type/disp32 +23930 # - check for too many outputs +23931 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +23932 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +23933 3d/compare-eax-and 0/imm32/false +23934 0f 85/jump-if-!= $check-mu-index-stmt:error-too-many-outputs/disp32 +23935 $check-mu-index-stmt:end: +23936 # . restore registers +23937 5f/pop-to-edi +23938 5e/pop-to-esi +23939 5b/pop-to-ebx +23940 5a/pop-to-edx +23941 59/pop-to-ecx +23942 58/pop-to-eax +23943 # . epilogue +23944 89/<- %esp 5/r32/ebp +23945 5d/pop-to-ebp +23946 c3/return +23947 +23948 $check-mu-index-stmt:error-base-non-array-type: +23949 (write-buffered *(ebp+0x10) "fn ") +23950 8b/-> *(ebp+0xc) 0/r32/eax +23951 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23952 (write-buffered *(ebp+0x10) %eax) +23953 (write-buffered *(ebp+0x10) ": stmt index: var '") +23954 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +23955 (write-buffered *(ebp+0x10) %eax) +23956 (write-buffered *(ebp+0x10) "' is not an array\n") +23957 (flush *(ebp+0x10)) +23958 (stop *(ebp+0x14) 1) +23959 # never gets here +23960 +23961 $check-mu-index-stmt:error-base-array-atom-type: +23962 (write-buffered *(ebp+0x10) "fn ") +23963 8b/-> *(ebp+0xc) 0/r32/eax +23964 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23965 (write-buffered *(ebp+0x10) %eax) +23966 (write-buffered *(ebp+0x10) ": stmt index: array '") +23967 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +23968 (write-buffered *(ebp+0x10) %eax) +23969 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") +23970 (flush *(ebp+0x10)) +23971 (stop *(ebp+0x14) 1) +23972 # never gets here +23973 +23974 $check-mu-index-stmt:error-base-address-array-type-on-stack: +23975 (write-buffered *(ebp+0x10) "fn ") +23976 8b/-> *(ebp+0xc) 0/r32/eax +23977 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23978 (write-buffered *(ebp+0x10) %eax) +23979 (write-buffered *(ebp+0x10) ": stmt index: var '") +23980 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +23981 (write-buffered *(ebp+0x10) %eax) +23982 (write-buffered *(ebp+0x10) "' is an addr to an array, and so must live in a register\n") +23983 (flush *(ebp+0x10)) +23984 (stop *(ebp+0x14) 1) +23985 # never gets here +23986 +23987 $check-mu-index-stmt:error-base-array-type-in-register: +23988 (write-buffered *(ebp+0x10) "fn ") +23989 8b/-> *(ebp+0xc) 0/r32/eax +23990 (lookup *eax *(eax+4)) # Function-name Function-name => eax 23991 (write-buffered *(ebp+0x10) %eax) -23992 (write-buffered *(ebp+0x10) "' must have type (addr handle stream ...)\n") -23993 (flush *(ebp+0x10)) -23994 (stop *(ebp+0x14) 1) -23995 # never gets here -23996 -23997 $check-mu-populate-stream-stmt:error-invalid-length-type: -23998 (write-buffered *(ebp+0x10) "fn ") -23999 8b/-> *(ebp+0xc) 0/r32/eax -24000 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24001 (write-buffered *(ebp+0x10) %eax) -24002 (write-buffered *(ebp+0x10) ": stmt populate-stream: second inout '") -24003 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -24004 (lookup *eax *(eax+4)) # Var-name Var-name => eax -24005 (write-buffered *(ebp+0x10) %eax) -24006 (write-buffered *(ebp+0x10) "' must be an int\n") -24007 (flush *(ebp+0x10)) -24008 (stop *(ebp+0x14) 1) -24009 # never gets here -24010 -24011 check-mu-read-from-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -24012 # . prologue -24013 55/push-ebp -24014 89/<- %ebp 4/r32/esp -24015 # . save registers -24016 50/push-eax -24017 51/push-ecx -24018 52/push-edx -24019 53/push-ebx -24020 56/push-esi -24021 57/push-edi -24022 # esi = stmt -24023 8b/-> *(ebp+8) 6/r32/esi -24024 # - check for 0 inouts -24025 # var base/ecx: (addr var) = stmt->inouts->value -24026 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -24027 $check-mu-read-from-stream-stmt:check-no-inouts: -24028 3d/compare-eax-and 0/imm32 -24029 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-too-few-inouts/disp32 -24030 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -24031 89/<- %ecx 0/r32/eax -24032 # - check base type is (addr stream T) -24033 # var base-type/ebx: (addr type-tree) = lookup(base->type) -24034 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -24035 89/<- %ebx 0/r32/eax -24036 $check-mu-read-from-stream-stmt:check-base-is-compound: -24037 # if base-type is an atom, abort -24038 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -24039 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 -24040 $check-mu-read-from-stream-stmt:check-base-is-addr: -24041 # if type->left not addr, abort -24042 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -24043 (is-simple-mu-type? %eax 2) # addr => eax -24044 3d/compare-eax-and 0/imm32/false -24045 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 -24046 $check-mu-read-from-stream-stmt:check-base-is-addr-to-stream: -24047 # base-type = base-type->right -24048 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -24049 89/<- %ebx 0/r32/eax -24050 # ensure base-type->left == stream -24051 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -24052 (is-simple-mu-type? %eax 0xb) # stream => eax -24053 3d/compare-eax-and 0/imm32/false -24054 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 -24055 # - check target type is (addr T) -24056 # var target/ecx: (addr stmt-var) = stmt->inouts->next->value -24057 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -24058 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -24059 $check-mu-read-from-stream-stmt:check-single-inout: -24060 3d/compare-eax-and 0/imm32 -24061 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-too-few-inouts/disp32 -24062 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -24063 89/<- %ecx 0/r32/eax -24064 # var target-type/edx: (addr type-tree) -24065 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -24066 89/<- %edx 0/r32/eax -24067 # if target-type is an atom, it must be a literal or int -24068 $check-mu-read-from-stream-stmt:check-target-is-compound: -24069 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -24070 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-target-type-not-address/disp32 -24071 $check-mu-read-from-stream-stmt:check-target-type: -24072 # target type must start with (addr ...) -24073 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -24074 (is-simple-mu-type? %eax 2) # addr => eax -24075 3d/compare-eax-and 0/imm32/false -24076 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-target-type-not-address/disp32 -24077 # if tail(base-type) != tail(target-type) abort -24078 (type-tail %ebx) # => eax -24079 89/<- %ebx 0/r32/eax -24080 (type-tail %edx) # => eax -24081 (type-equal? %ebx %eax) # => eax -24082 3d/compare-eax-and 0/imm32/false -24083 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-target-type/disp32 -24084 $check-mu-read-from-stream-stmt:check-too-many-inouts: -24085 # - check for too many inouts -24086 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -24087 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -24088 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -24089 3d/compare-eax-and 0/imm32/false -24090 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-too-many-inouts/disp32 -24091 $check-mu-read-from-stream-stmt:check-unexpected-output: -24092 # - check for any output -24093 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -24094 3d/compare-eax-and 0/imm32/false -24095 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-unexpected-output/disp32 -24096 $check-mu-read-from-stream-stmt:end: -24097 # . restore registers -24098 5f/pop-to-edi -24099 5e/pop-to-esi -24100 5b/pop-to-ebx -24101 5a/pop-to-edx -24102 59/pop-to-ecx -24103 58/pop-to-eax -24104 # . epilogue -24105 89/<- %esp 5/r32/ebp -24106 5d/pop-to-ebp -24107 c3/return -24108 -24109 $check-mu-read-from-stream-stmt:error-invalid-base-type: -24110 (write-buffered *(ebp+0x10) "fn ") -24111 8b/-> *(ebp+0xc) 0/r32/eax -24112 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24113 (write-buffered *(ebp+0x10) %eax) -24114 (write-buffered *(ebp+0x10) ": stmt read-from-stream: var '") -24115 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -24116 (write-buffered *(ebp+0x10) %eax) -24117 (write-buffered *(ebp+0x10) "' must be an addr to a stream\n") -24118 (flush *(ebp+0x10)) -24119 (stop *(ebp+0x14) 1) -24120 # never gets here -24121 -24122 $check-mu-read-from-stream-stmt:error-too-few-inouts: -24123 (write-buffered *(ebp+0x10) "fn ") -24124 8b/-> *(ebp+0xc) 0/r32/eax -24125 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24126 (write-buffered *(ebp+0x10) %eax) -24127 (write-buffered *(ebp+0x10) ": stmt read-from-stream: too few inouts (2 required)\n") -24128 (flush *(ebp+0x10)) -24129 (stop *(ebp+0x14) 1) -24130 # never gets here -24131 -24132 $check-mu-read-from-stream-stmt:error-target-type-not-address: -24133 (write-buffered *(ebp+0x10) "fn ") -24134 8b/-> *(ebp+0xc) 0/r32/eax -24135 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24136 (write-buffered *(ebp+0x10) %eax) -24137 (write-buffered *(ebp+0x10) ": stmt read-from-stream: target '") -24138 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -24139 (write-buffered *(ebp+0x10) %eax) -24140 (write-buffered *(ebp+0x10) "' must be an addr\n") -24141 (flush *(ebp+0x10)) -24142 (stop *(ebp+0x14) 1) -24143 # never gets here -24144 -24145 $check-mu-read-from-stream-stmt:error-invalid-target-type: -24146 (write-buffered *(ebp+0x10) "fn ") -24147 8b/-> *(ebp+0xc) 0/r32/eax -24148 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24149 (write-buffered *(ebp+0x10) %eax) -24150 (write-buffered *(ebp+0x10) ": stmt read-from-stream: second inout '") -24151 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -24152 (write-buffered *(ebp+0x10) %eax) -24153 (write-buffered *(ebp+0x10) "' does not have the right type\n") -24154 (flush *(ebp+0x10)) -24155 (stop *(ebp+0x14) 1) -24156 # never gets here -24157 -24158 $check-mu-read-from-stream-stmt:error-too-many-inouts: -24159 (write-buffered *(ebp+0x10) "fn ") -24160 8b/-> *(ebp+0xc) 0/r32/eax -24161 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24162 (write-buffered *(ebp+0x10) %eax) -24163 (write-buffered *(ebp+0x10) ": stmt read-from-stream: too many inouts (2 required)\n") -24164 (flush *(ebp+0x10)) -24165 (stop *(ebp+0x14) 1) -24166 # never gets here -24167 -24168 $check-mu-read-from-stream-stmt:error-unexpected-output: -24169 (write-buffered *(ebp+0x10) "fn ") -24170 8b/-> *(ebp+0xc) 0/r32/eax -24171 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24172 (write-buffered *(ebp+0x10) %eax) -24173 (write-buffered *(ebp+0x10) ": stmt read-from-stream: unexpected output\n") -24174 (flush *(ebp+0x10)) -24175 (stop *(ebp+0x14) 1) -24176 # never gets here -24177 -24178 check-mu-write-to-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -24179 # . prologue -24180 55/push-ebp -24181 89/<- %ebp 4/r32/esp -24182 # . save registers -24183 50/push-eax -24184 51/push-ecx -24185 52/push-edx -24186 53/push-ebx -24187 56/push-esi -24188 57/push-edi -24189 # esi = stmt -24190 8b/-> *(ebp+8) 6/r32/esi -24191 # - check for 0 inouts -24192 # var base/ecx: (addr var) = stmt->inouts->value -24193 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -24194 $check-mu-write-to-stream-stmt:check-no-inouts: -24195 3d/compare-eax-and 0/imm32 -24196 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-too-few-inouts/disp32 -24197 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -24198 89/<- %ecx 0/r32/eax -24199 # - check base type is (addr stream T) -24200 # var base-type/ebx: (addr type-tree) = lookup(base->type) -24201 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -24202 89/<- %ebx 0/r32/eax -24203 $check-mu-write-to-stream-stmt:check-base-is-compound: -24204 # if base-type is an atom, abort -24205 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -24206 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 -24207 $check-mu-write-to-stream-stmt:check-base-is-addr: -24208 # if type->left not addr, abort -24209 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -24210 (is-simple-mu-type? %eax 2) # addr => eax -24211 3d/compare-eax-and 0/imm32/false -24212 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 -24213 $check-mu-write-to-stream-stmt:check-base-is-addr-to-stream: -24214 # base-type = base-type->right -24215 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -24216 89/<- %ebx 0/r32/eax -24217 # ensure base-type->left == stream -24218 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -24219 (is-simple-mu-type? %eax 0xb) # stream => eax -24220 3d/compare-eax-and 0/imm32/false -24221 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 -24222 # - check target type is (addr T) -24223 # var target/ecx: (addr stmt-var) = stmt->inouts->next->value -24224 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -24225 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -24226 $check-mu-write-to-stream-stmt:check-single-inout: -24227 3d/compare-eax-and 0/imm32 -24228 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-too-few-inouts/disp32 -24229 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -24230 89/<- %ecx 0/r32/eax -24231 # var target-type/edx: (addr type-tree) -24232 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -24233 89/<- %edx 0/r32/eax -24234 # if target-type is an atom, it must be a literal or int -24235 $check-mu-write-to-stream-stmt:check-target-is-compound: -24236 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -24237 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-target-type-not-address/disp32 -24238 $check-mu-write-to-stream-stmt:check-target-type: -24239 # target type must start with (addr ...) -24240 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -24241 (is-simple-mu-type? %eax 2) # addr => eax -24242 3d/compare-eax-and 0/imm32/false -24243 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-target-type-not-address/disp32 -24244 # if tail(base-type) != tail(target-type) abort -24245 (type-tail %ebx) # => eax -24246 89/<- %ebx 0/r32/eax -24247 (type-tail %edx) # => eax -24248 (type-equal? %ebx %eax) # => eax -24249 3d/compare-eax-and 0/imm32/false -24250 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-target-type/disp32 -24251 $check-mu-write-to-stream-stmt:check-too-many-inouts: -24252 # - check for too many inouts -24253 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -24254 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -24255 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -24256 3d/compare-eax-and 0/imm32/false -24257 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-too-many-inouts/disp32 -24258 $check-mu-write-to-stream-stmt:check-unexpected-output: -24259 # - check for any output -24260 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -24261 3d/compare-eax-and 0/imm32/false -24262 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-unexpected-output/disp32 -24263 $check-mu-write-to-stream-stmt:end: -24264 # . restore registers -24265 5f/pop-to-edi -24266 5e/pop-to-esi -24267 5b/pop-to-ebx -24268 5a/pop-to-edx -24269 59/pop-to-ecx -24270 58/pop-to-eax -24271 # . epilogue -24272 89/<- %esp 5/r32/ebp -24273 5d/pop-to-ebp -24274 c3/return -24275 -24276 $check-mu-write-to-stream-stmt:error-invalid-base-type: -24277 (write-buffered *(ebp+0x10) "fn ") -24278 8b/-> *(ebp+0xc) 0/r32/eax -24279 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24280 (write-buffered *(ebp+0x10) %eax) -24281 (write-buffered *(ebp+0x10) ": stmt write-to-stream: var '") -24282 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -24283 (write-buffered *(ebp+0x10) %eax) -24284 (write-buffered *(ebp+0x10) "' must be an addr to a stream\n") -24285 (flush *(ebp+0x10)) -24286 (stop *(ebp+0x14) 1) -24287 # never gets here -24288 -24289 $check-mu-write-to-stream-stmt:error-too-few-inouts: -24290 (write-buffered *(ebp+0x10) "fn ") -24291 8b/-> *(ebp+0xc) 0/r32/eax -24292 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24293 (write-buffered *(ebp+0x10) %eax) -24294 (write-buffered *(ebp+0x10) ": stmt write-to-stream: too few inouts (2 required)\n") -24295 (flush *(ebp+0x10)) -24296 (stop *(ebp+0x14) 1) -24297 # never gets here -24298 -24299 $check-mu-write-to-stream-stmt:error-target-type-not-address: -24300 (write-buffered *(ebp+0x10) "fn ") -24301 8b/-> *(ebp+0xc) 0/r32/eax -24302 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24303 (write-buffered *(ebp+0x10) %eax) -24304 (write-buffered *(ebp+0x10) ": stmt write-to-stream: target '") -24305 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -24306 (write-buffered *(ebp+0x10) %eax) -24307 (write-buffered *(ebp+0x10) "' must be an addr\n") -24308 (flush *(ebp+0x10)) -24309 (stop *(ebp+0x14) 1) -24310 # never gets here -24311 -24312 $check-mu-write-to-stream-stmt:error-invalid-target-type: -24313 (write-buffered *(ebp+0x10) "fn ") -24314 8b/-> *(ebp+0xc) 0/r32/eax -24315 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24316 (write-buffered *(ebp+0x10) %eax) -24317 (write-buffered *(ebp+0x10) ": stmt write-to-stream: second inout '") -24318 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -24319 (write-buffered *(ebp+0x10) %eax) -24320 (write-buffered *(ebp+0x10) "' does not have the right type\n") -24321 (flush *(ebp+0x10)) -24322 (stop *(ebp+0x14) 1) -24323 # never gets here -24324 -24325 $check-mu-write-to-stream-stmt:error-too-many-inouts: -24326 (write-buffered *(ebp+0x10) "fn ") -24327 8b/-> *(ebp+0xc) 0/r32/eax -24328 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24329 (write-buffered *(ebp+0x10) %eax) -24330 (write-buffered *(ebp+0x10) ": stmt write-to-stream: too many inouts (2 required)\n") -24331 (flush *(ebp+0x10)) -24332 (stop *(ebp+0x14) 1) -24333 # never gets here -24334 -24335 $check-mu-write-to-stream-stmt:error-unexpected-output: -24336 (write-buffered *(ebp+0x10) "fn ") -24337 8b/-> *(ebp+0xc) 0/r32/eax -24338 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24339 (write-buffered *(ebp+0x10) %eax) -24340 (write-buffered *(ebp+0x10) ": stmt write-to-stream: unexpected output\n") -24341 (flush *(ebp+0x10)) -24342 (stop *(ebp+0x14) 1) -24343 # never gets here -24344 -24345 check-mu-convert-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -24346 # . prologue -24347 55/push-ebp -24348 89/<- %ebp 4/r32/esp -24349 # . save registers -24350 50/push-eax -24351 51/push-ecx -24352 52/push-edx -24353 56/push-esi -24354 57/push-edi -24355 $check-mu-convert-stmt:get-output: -24356 # esi = stmt -24357 8b/-> *(ebp+8) 6/r32/esi -24358 # var output/edi: (addr stmt-var) = stmt->outputs -24359 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -24360 89/<- %edi 0/r32/eax -24361 # zero outputs -24362 3d/compare-eax-and 0/imm32 -24363 0f 84/jump-if-= $check-mu-convert-stmt:error-no-output/disp32 -24364 # > 1 output -24365 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -24366 3d/compare-eax-and 0/imm32 -24367 0f 85/jump-if-!= $check-mu-convert-stmt:error-too-many-outputs/disp32 -24368 $check-mu-convert-stmt:get-inout: -24369 # var inout/esi: (addr stmt-var) = stmt->inouts -24370 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -24371 89/<- %esi 0/r32/eax -24372 # zero inouts -24373 3d/compare-eax-and 0/imm32 -24374 0f 84/jump-if-= $check-mu-convert-stmt:error-no-inout/disp32 -24375 # > 1 inout -24376 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -24377 3d/compare-eax-and 0/imm32 -24378 0f 85/jump-if-!= $check-mu-convert-stmt:error-too-many-inouts/disp32 -24379 $check-mu-convert-stmt:types: -24380 # var inout-type/ecx: (addr type-tree) = inout->value->type -24381 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -24382 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -24383 89/<- %ecx 0/r32/eax -24384 # if (inout->is-deref?) inout-type = inout-type->payload -24385 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref -24386 3d/compare-eax-and 0/imm32/false -24387 { -24388 74/jump-if-= break/disp8 -24389 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -24390 # if inout-type->right is null, t = inout-type->left -24391 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -24392 { -24393 75/jump-if-!= break/disp8 -24394 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -24395 } -24396 89/<- %ecx 0/r32/eax -24397 } -24398 # if input is not int or float, abort -24399 { -24400 (is-simple-mu-type? %ecx 1) # int => eax -24401 3d/compare-eax-and 0/imm32/false -24402 75/jump-if-!= break/disp8 -24403 (is-simple-mu-type? %ecx 0xf) # float => eax -24404 3d/compare-eax-and 0/imm32/false -24405 75/jump-if-!= break/disp8 -24406 e9/jump $check-mu-convert-stmt:error-invalid-inout-type/disp32 -24407 } -24408 # if output not in register, abort -24409 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -24410 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -24411 3d/compare-eax-and 0/imm32 -24412 0f 84/jump-if-= $check-mu-convert-stmt:error-output-not-in-register/disp32 -24413 # var output-type/edx: (addr type-tree) = output->value->type -24414 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -24415 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -24416 89/<- %edx 0/r32/eax -24417 # if output is not int or float, abort -24418 { -24419 (is-simple-mu-type? %edx 1) # int => eax -24420 3d/compare-eax-and 0/imm32/false -24421 75/jump-if-!= break/disp8 -24422 (is-simple-mu-type? %edx 0xf) # float => eax -24423 3d/compare-eax-and 0/imm32/false -24424 75/jump-if-!= break/disp8 -24425 e9/jump $check-mu-convert-stmt:error-invalid-output-type/disp32 -24426 } -24427 # if both are ints, abort -24428 { -24429 (is-simple-mu-type? %edx 1) # int => eax -24430 3d/compare-eax-and 0/imm32/false -24431 74/jump-if-= break/disp8 -24432 (is-simple-mu-type? %ecx 1) # int => eax -24433 3d/compare-eax-and 0/imm32/false -24434 74/jump-if-= break/disp8 -24435 e9/jump $check-mu-convert-stmt:error-int-to-int/disp32 -24436 } -24437 # if both are floats, abort -24438 { -24439 (is-simple-mu-type? %edx 0xf) # float => eax -24440 3d/compare-eax-and 0/imm32/false -24441 74/jump-if-= break/disp8 -24442 (is-simple-mu-type? %ecx 0xf) # float => eax -24443 3d/compare-eax-and 0/imm32/false -24444 74/jump-if-= break/disp8 -24445 e9/jump $check-mu-convert-stmt:error-float-to-float/disp32 -24446 } -24447 $check-mu-convert-stmt:end: -24448 # . restore registers -24449 5f/pop-to-edi -24450 5e/pop-to-esi -24451 5a/pop-to-edx -24452 59/pop-to-ecx -24453 58/pop-to-eax -24454 # . epilogue -24455 89/<- %esp 5/r32/ebp -24456 5d/pop-to-ebp -24457 c3/return -24458 -24459 $check-mu-convert-stmt:error-no-inout: -24460 (write-buffered *(ebp+0x10) "fn ") -24461 8b/-> *(ebp+0xc) 0/r32/eax -24462 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24463 (write-buffered *(ebp+0x10) %eax) -24464 (write-buffered *(ebp+0x10) ": stmt 'convert' expects an inout\n") -24465 (flush *(ebp+0x10)) -24466 (stop *(ebp+0x14) 1) -24467 # never gets here -24468 -24469 $check-mu-convert-stmt:error-too-many-inouts: -24470 (write-buffered *(ebp+0x10) "fn ") -24471 8b/-> *(ebp+0xc) 0/r32/eax -24472 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24473 (write-buffered *(ebp+0x10) %eax) -24474 (write-buffered *(ebp+0x10) ": stmt 'convert' must have just one inout\n") -24475 (flush *(ebp+0x10)) -24476 (stop *(ebp+0x14) 1) -24477 # never gets here -24478 -24479 $check-mu-convert-stmt:error-no-output: -24480 (write-buffered *(ebp+0x10) "fn ") -24481 8b/-> *(ebp+0xc) 0/r32/eax -24482 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24483 (write-buffered *(ebp+0x10) %eax) -24484 (write-buffered *(ebp+0x10) ": stmt 'convert' expects an output\n") -24485 (flush *(ebp+0x10)) -24486 (stop *(ebp+0x14) 1) -24487 # never gets here -24488 -24489 $check-mu-convert-stmt:error-output-not-in-register: -24490 (write-buffered *(ebp+0x10) "fn ") -24491 8b/-> *(ebp+0xc) 0/r32/eax -24492 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24493 (write-buffered *(ebp+0x10) %eax) -24494 (write-buffered *(ebp+0x10) ": stmt convert: output '") -24495 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -24496 (lookup *eax *(eax+4)) # Var-name Var-name => eax -24497 (write-buffered *(ebp+0x10) %eax) -24498 (write-buffered *(ebp+0x10) "' not in a register\n") -24499 (flush *(ebp+0x10)) -24500 (stop *(ebp+0x14) 1) -24501 # never gets here -24502 -24503 $check-mu-convert-stmt:error-too-many-outputs: -24504 (write-buffered *(ebp+0x10) "fn ") -24505 8b/-> *(ebp+0xc) 0/r32/eax -24506 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24507 (write-buffered *(ebp+0x10) %eax) -24508 (write-buffered *(ebp+0x10) ": stmt 'convert' must have just one output\n") -24509 (flush *(ebp+0x10)) -24510 (stop *(ebp+0x14) 1) -24511 # never gets here -24512 -24513 $check-mu-convert-stmt:error-invalid-inout-type: -24514 (write-buffered *(ebp+0x10) "fn ") -24515 8b/-> *(ebp+0xc) 0/r32/eax -24516 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24517 (write-buffered *(ebp+0x10) %eax) -24518 (write-buffered *(ebp+0x10) ": stmt convert: inout '") -24519 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -24520 (lookup *eax *(eax+4)) # Var-name Var-name => eax -24521 (write-buffered *(ebp+0x10) %eax) -24522 (write-buffered *(ebp+0x10) "' must be an int or float\n") -24523 (flush *(ebp+0x10)) -24524 (stop *(ebp+0x14) 1) -24525 # never gets here -24526 -24527 $check-mu-convert-stmt:error-invalid-output-type: -24528 (write-buffered *(ebp+0x10) "fn ") -24529 8b/-> *(ebp+0xc) 0/r32/eax -24530 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24531 (write-buffered *(ebp+0x10) %eax) -24532 (write-buffered *(ebp+0x10) ": stmt convert: output '") -24533 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -24534 (lookup *eax *(eax+4)) # Var-name Var-name => eax -24535 (write-buffered *(ebp+0x10) %eax) -24536 (write-buffered *(ebp+0x10) "' must be an int or float\n") -24537 (flush *(ebp+0x10)) -24538 (stop *(ebp+0x14) 1) -24539 # never gets here -24540 -24541 $check-mu-convert-stmt:error-int-to-int: -24542 (write-buffered *(ebp+0x10) "fn ") -24543 8b/-> *(ebp+0xc) 0/r32/eax -24544 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24545 (write-buffered *(ebp+0x10) %eax) -24546 (write-buffered *(ebp+0x10) ": stmt convert: no need to convert int to int\n") -24547 (flush *(ebp+0x10)) -24548 (stop *(ebp+0x14) 1) -24549 # never gets here -24550 -24551 $check-mu-convert-stmt:error-float-to-float: -24552 (write-buffered *(ebp+0x10) "fn ") -24553 8b/-> *(ebp+0xc) 0/r32/eax -24554 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24555 (write-buffered *(ebp+0x10) %eax) -24556 (write-buffered *(ebp+0x10) ": stmt convert: no need to convert float to float\n") -24557 (flush *(ebp+0x10)) -24558 (stop *(ebp+0x14) 1) -24559 # never gets here -24560 -24561 check-mu-call: # stmt: (addr stmt), callee: (addr function), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -24562 # . prologue -24563 55/push-ebp -24564 89/<- %ebp 4/r32/esp -24565 # var type-parameters: (addr table (handle array byte) (addr type-tree) 8) -24566 68/push 0/imm32 -24567 # var type-parameters-storage: (table (handle array byte) (addr type-tree) 8) -24568 81 5/subop/subtract %esp 0x60/imm32 -24569 68/push 0x60/imm32/size -24570 68/push 0/imm32/read -24571 68/push 0/imm32/write -24572 # save a pointer to type-parameters-storage at type-parameters -24573 89/<- *(ebp-4) 4/r32/esp -24574 (clear-stream *(ebp-4)) -24575 # . save registers -24576 50/push-eax -24577 51/push-ecx -24578 52/push-edx -24579 53/push-ebx -24580 56/push-esi -24581 57/push-edi -24582 # esi = stmt -24583 8b/-> *(ebp+8) 6/r32/esi -24584 # edi = callee -24585 8b/-> *(ebp+0xc) 7/r32/edi -24586 # var inouts/ecx: (addr stmt-var) = lookup(stmt->inouts) -24587 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -24588 89/<- %ecx 0/r32/eax -24589 # var expected/edx: (addr list var) = lookup(f->inouts) -24590 (lookup *(edi+8) *(edi+0xc)) # Function-inouts Function-inouts => eax -24591 89/<- %edx 0/r32/eax -24592 { -24593 $check-mu-call:check-for-inouts: -24594 # if (inouts == 0) break -24595 81 7/subop/compare %ecx 0/imm32 -24596 0f 84/jump-if-= break/disp32 -24597 # if (expected == 0) error -24598 81 7/subop/compare %edx 0/imm32 -24599 0f 84/jump-if-= break/disp32 -24600 $check-mu-call:check-null-addr: -24601 # if (inouts->value->name == "0") continue -24602 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -24603 (lookup *eax *(eax+4)) # Var-name Var-name => eax -24604 (string-equal? %eax "0") # => eax -24605 3d/compare-eax-and 0/imm32/false -24606 0f 85/jump-if-!= $check-mu-call:continue-to-next-inout/disp32 -24607 $check-mu-call:check-inout-type: -24608 # var t/ebx: (addr type-tree) = inouts->value->type -24609 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -24610 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -24611 89/<- %ebx 0/r32/eax -24612 # if (inouts->is-deref?) t = t->right -24613 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -24614 { -24615 74/jump-if-= break/disp8 -24616 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -24617 89/<- %ebx 0/r32/eax -24618 # if t->right is null, t = t->left -24619 81 7/subop/compare *(ebx+0xc) 0/imm32 # Type-tree-right -24620 75/jump-if-!= break/disp8 -24621 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -24622 89/<- %ebx 0/r32/eax -24623 } -24624 # var v2/eax: (addr v) = lookup(expected->value) -24625 (lookup *edx *(edx+4)) # List-value List-value => eax -24626 # var t2/eax: (addr type-tree) = lookup(v2->type) -24627 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -24628 # if (t != t2) error -24629 (type-match? %eax %ebx *(ebp-4)) # => eax -24630 3d/compare-eax-and 0/imm32/false -24631 { -24632 0f 85/jump-if-!= break/disp32 -24633 (write-buffered *(ebp+0x14) "fn ") -24634 8b/-> *(ebp+0x10) 0/r32/eax -24635 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24636 (write-buffered *(ebp+0x14) %eax) -24637 (write-buffered *(ebp+0x14) ": call ") -24638 (lookup *edi *(edi+4)) # Function-name Function-name => eax -24639 (write-buffered *(ebp+0x14) %eax) -24640 (write-buffered *(ebp+0x14) ": type for inout '") -24641 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -24642 (lookup *eax *(eax+4)) # Var-name Var-name => eax -24643 (write-buffered *(ebp+0x14) %eax) -24644 (write-buffered *(ebp+0x14) "' is not right\n") -24645 (flush *(ebp+0x14)) -24646 (stop *(ebp+0x18) 1) -24647 } -24648 $check-mu-call:continue-to-next-inout: -24649 # inouts = lookup(inouts->next) -24650 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax -24651 89/<- %ecx 0/r32/eax -24652 # expected = lookup(expected->next) -24653 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -24654 89/<- %edx 0/r32/eax -24655 # -24656 e9/jump loop/disp32 -24657 } -24658 $check-mu-call:check-inout-count: -24659 # if (inouts == expected) proceed -24660 39/compare %ecx 2/r32/edx -24661 { -24662 0f 84/jump-if-= break/disp32 -24663 # exactly one of the two is null -24664 # if (inouts == 0) error("too many inouts") -24665 { -24666 81 7/subop/compare %ecx 0/imm32 -24667 0f 84/jump-if-= break/disp32 -24668 (write-buffered *(ebp+0x14) "fn ") -24669 8b/-> *(ebp+0x10) 0/r32/eax -24670 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24671 (write-buffered *(ebp+0x14) %eax) -24672 (write-buffered *(ebp+0x14) ": call ") -24673 (lookup *edi *(edi+4)) # Function-name Function-name => eax -24674 (write-buffered *(ebp+0x14) %eax) -24675 (write-buffered *(ebp+0x14) ": too many inouts\n") -24676 (flush *(ebp+0x14)) -24677 (stop *(ebp+0x18) 1) -24678 } -24679 # if (expected == 0) error("too few inouts") -24680 { -24681 81 7/subop/compare %edx 0/imm32 -24682 0f 84/jump-if-= break/disp32 -24683 (write-buffered *(ebp+0x14) "fn ") -24684 8b/-> *(ebp+0x10) 0/r32/eax -24685 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24686 (write-buffered *(ebp+0x14) %eax) -24687 (write-buffered *(ebp+0x14) ": call ") -24688 (lookup *edi *(edi+4)) # Function-name Function-name => eax -24689 (write-buffered *(ebp+0x14) %eax) -24690 (write-buffered *(ebp+0x14) ": too few inouts\n") -24691 (flush *(ebp+0x14)) -24692 (stop *(ebp+0x18) 1) -24693 } -24694 } -24695 $check-mu-call:check-outputs: -24696 # var outputs/ecx: (addr stmt-var) = lookup(stmt->outputs) -24697 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -24698 89/<- %ecx 0/r32/eax -24699 # var expected/edx: (addr list var) = lookup(f->outputs) -24700 (lookup *(edi+0x10) *(edi+0x14)) # Function-outputs Function-outputs => eax -24701 89/<- %edx 0/r32/eax -24702 { -24703 $check-mu-call:check-for-outputs: -24704 # if (outputs == 0) break -24705 81 7/subop/compare %ecx 0/imm32 -24706 0f 84/jump-if-= break/disp32 -24707 # if (expected == 0) error -24708 81 7/subop/compare %edx 0/imm32 -24709 0f 84/jump-if-= break/disp32 -24710 $check-mu-call:check-output-type: -24711 # var v/eax: (addr v) = lookup(outputs->value) -24712 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -24713 # var t/ebx: (addr type-tree) = lookup(v->type) -24714 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -24715 89/<- %ebx 0/r32/eax -24716 # if (outputs->is-deref?) t = t->right # TODO: check that t->left is an addr -24717 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -24718 { -24719 74/jump-if-= break/disp8 -24720 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -24721 89/<- %ebx 0/r32/eax -24722 } -24723 # var v2/eax: (addr v) = lookup(expected->value) -24724 (lookup *edx *(edx+4)) # List-value List-value => eax -24725 # var t2/eax: (addr type-tree) = lookup(v2->type) -24726 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -24727 # if (t != t2) error -24728 (type-match? %eax %ebx *(ebp-4)) # => eax -24729 3d/compare-eax-and 0/imm32/false -24730 { -24731 0f 85/jump-if-!= break/disp32 -24732 (write-buffered *(ebp+0x14) "fn ") -24733 8b/-> *(ebp+0x10) 0/r32/eax -24734 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24735 (write-buffered *(ebp+0x14) %eax) -24736 (write-buffered *(ebp+0x14) ": call ") -24737 (lookup *edi *(edi+4)) # Function-name Function-name => eax -24738 (write-buffered *(ebp+0x14) %eax) -24739 (write-buffered *(ebp+0x14) ": type for output '") -24740 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -24741 (lookup *eax *(eax+4)) # Var-name Var-name => eax -24742 (write-buffered *(ebp+0x14) %eax) -24743 (write-buffered *(ebp+0x14) "' is not right\n") -24744 (flush *(ebp+0x14)) -24745 (stop *(ebp+0x18) 1) -24746 } -24747 $check-mu-call:check-output-register: -24748 # var v/eax: (addr v) = lookup(outputs->value) -24749 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -24750 # var r/ebx: (addr array byte) = lookup(v->register) -24751 (lookup *(eax+18) *(eax+0x1c)) # Var-register Var-register => eax -24752 89/<- %ebx 0/r32/eax -24753 # if (r == 0) error -24754 3d/compare-eax-and 0/imm32 -24755 { -24756 0f 85/jump-if-!= break/disp32 -24757 (write-buffered *(ebp+0x14) "fn ") -24758 8b/-> *(ebp+0x10) 0/r32/eax -24759 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24760 (write-buffered *(ebp+0x14) %eax) -24761 (write-buffered *(ebp+0x14) ": call ") -24762 (lookup *edi *(edi+4)) # Function-name Function-name => eax -24763 (write-buffered *(ebp+0x14) %eax) -24764 (write-buffered *(ebp+0x14) ": output '") -24765 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -24766 (lookup *eax *(eax+4)) # Var-name Var-name => eax -24767 (write-buffered *(ebp+0x14) %eax) -24768 (write-buffered *(ebp+0x14) "' is not in a register\n") -24769 (flush *(ebp+0x14)) -24770 (stop *(ebp+0x18) 1) -24771 } -24772 # var v2/eax: (addr v) = lookup(expected->value) -24773 (lookup *edx *(edx+4)) # Stmt-var-value Stmt-var-value => eax -24774 # var r2/eax: (addr array byte) = lookup(v2->register) -24775 (lookup *(eax+18) *(eax+0x1c)) # Var-register Var-register => eax -24776 # if (r != r2) error -24777 (string-equal? %eax %ebx) # => eax -24778 3d/compare-eax-and 0/imm32/false -24779 { -24780 0f 85/jump-if-!= break/disp32 -24781 (write-buffered *(ebp+0x14) "fn ") -24782 8b/-> *(ebp+0x10) 0/r32/eax -24783 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24784 (write-buffered *(ebp+0x14) %eax) -24785 (write-buffered *(ebp+0x14) ": call ") -24786 (lookup *edi *(edi+4)) # Function-name Function-name => eax -24787 (write-buffered *(ebp+0x14) %eax) -24788 (write-buffered *(ebp+0x14) ": register for output '") -24789 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -24790 (lookup *eax *(eax+4)) # Var-name Var-name => eax -24791 (write-buffered *(ebp+0x14) %eax) -24792 (write-buffered *(ebp+0x14) "' is not right\n") -24793 (flush *(ebp+0x14)) -24794 (stop *(ebp+0x18) 1) -24795 } -24796 $check-mu-call:continue-to-next-output: -24797 # outputs = lookup(outputs->next) -24798 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax -24799 89/<- %ecx 0/r32/eax -24800 # expected = lookup(expected->next) -24801 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -24802 89/<- %edx 0/r32/eax -24803 # -24804 e9/jump loop/disp32 -24805 } -24806 $check-mu-call:check-output-count: -24807 # if (outputs == expected) proceed -24808 39/compare %ecx 2/r32/edx -24809 { -24810 0f 84/jump-if-= break/disp32 -24811 # exactly one of the two is null -24812 # if (outputs == 0) error("too many outputs") -24813 { -24814 81 7/subop/compare %ecx 0/imm32 -24815 0f 84/jump-if-= break/disp32 -24816 (write-buffered *(ebp+0x14) "fn ") -24817 8b/-> *(ebp+0x10) 0/r32/eax -24818 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24819 (write-buffered *(ebp+0x14) %eax) -24820 (write-buffered *(ebp+0x14) ": call ") -24821 (lookup *edi *(edi+4)) # Function-name Function-name => eax -24822 (write-buffered *(ebp+0x14) %eax) -24823 (write-buffered *(ebp+0x14) ": too many outputs\n") -24824 (flush *(ebp+0x14)) -24825 (stop *(ebp+0x18) 1) -24826 } -24827 # if (expected == 0) error("too few outputs") -24828 { -24829 81 7/subop/compare %edx 0/imm32 -24830 0f 84/jump-if-= break/disp32 -24831 (write-buffered *(ebp+0x14) "fn ") -24832 8b/-> *(ebp+0x10) 0/r32/eax -24833 (lookup *eax *(eax+4)) # Function-name Function-name => eax -24834 (write-buffered *(ebp+0x14) %eax) -24835 (write-buffered *(ebp+0x14) ": call ") -24836 (lookup *edi *(edi+4)) # Function-name Function-name => eax -24837 (write-buffered *(ebp+0x14) %eax) -24838 (write-buffered *(ebp+0x14) ": too few outputs\n") -24839 (flush *(ebp+0x14)) -24840 (stop *(ebp+0x18) 1) -24841 } -24842 } -24843 $check-mu-call:end: -24844 # . restore registers -24845 5f/pop-to-edi -24846 5e/pop-to-esi -24847 5b/pop-to-ebx -24848 5a/pop-to-edx -24849 59/pop-to-ecx -24850 58/pop-to-eax -24851 # . reclaim locals exclusively on the stack -24852 81 0/subop/add %esp 0x70/imm32 -24853 # . epilogue -24854 89/<- %esp 5/r32/ebp -24855 5d/pop-to-ebp -24856 c3/return -24857 -24858 # like type-equal? but takes literals type parameters into account -24859 type-match?: # def: (addr type-tree), call: (addr type-tree), type-parameters: (addr table (handle array byte) (addr type-tree)) -> result/eax: boolean -24860 # . prologue -24861 55/push-ebp -24862 89/<- %ebp 4/r32/esp -24863 # if (call is literal and def is numberlike) return true -24864 { -24865 $type-match?:check-literal-int: -24866 (is-simple-mu-type? *(ebp+0xc) 0) # literal => eax -24867 3d/compare-eax-and 0/imm32/false -24868 74/jump-if-= break/disp8 -24869 (is-mu-numberlike-output? *(ebp+8)) # => eax -24870 3d/compare-eax-and 0/imm32/false +23992 (write-buffered *(ebp+0x10) ": stmt index: var '") +23993 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +23994 (write-buffered *(ebp+0x10) %eax) +23995 (write-buffered *(ebp+0x10) "' is an array, and so must live on the stack\n") +23996 (flush *(ebp+0x10)) +23997 (stop *(ebp+0x14) 1) +23998 # never gets here +23999 +24000 $check-mu-index-stmt:error-too-few-inouts: +24001 (write-buffered *(ebp+0x10) "fn ") +24002 8b/-> *(ebp+0xc) 0/r32/eax +24003 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24004 (write-buffered *(ebp+0x10) %eax) +24005 (write-buffered *(ebp+0x10) ": stmt index: too few inouts (2 required)\n") +24006 (flush *(ebp+0x10)) +24007 (stop *(ebp+0x14) 1) +24008 # never gets here +24009 +24010 $check-mu-index-stmt:error-invalid-index-type: +24011 (write-buffered *(ebp+0x10) "fn ") +24012 8b/-> *(ebp+0xc) 0/r32/eax +24013 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24014 (write-buffered *(ebp+0x10) %eax) +24015 (write-buffered *(ebp+0x10) ": stmt index: second argument '") +24016 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24017 (write-buffered *(ebp+0x10) %eax) +24018 (write-buffered *(ebp+0x10) "' must be an int or offset\n") +24019 (flush *(ebp+0x10)) +24020 (stop *(ebp+0x14) 1) +24021 # never gets here +24022 +24023 $check-mu-index-stmt:error-index-offset-atom-type: +24024 (write-buffered *(ebp+0x10) "fn ") +24025 8b/-> *(ebp+0xc) 0/r32/eax +24026 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24027 (write-buffered *(ebp+0x10) %eax) +24028 (write-buffered *(ebp+0x10) ": stmt index: offset '") +24029 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24030 (write-buffered *(ebp+0x10) %eax) +24031 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") +24032 (flush *(ebp+0x10)) +24033 (stop *(ebp+0x14) 1) +24034 # never gets here +24035 +24036 $check-mu-index-stmt:error-index-on-stack: +24037 (write-buffered *(ebp+0x10) "fn ") +24038 8b/-> *(ebp+0xc) 0/r32/eax +24039 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24040 (write-buffered *(ebp+0x10) %eax) +24041 (write-buffered *(ebp+0x10) ": stmt index: second argument '") +24042 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24043 (write-buffered *(ebp+0x10) %eax) +24044 (write-buffered *(ebp+0x10) "' must be in a register\n") +24045 (flush *(ebp+0x10)) +24046 (stop *(ebp+0x14) 1) +24047 # never gets here +24048 +24049 $check-mu-index-stmt:error-index-needs-offset: +24050 (write-buffered *(ebp+0x10) "fn ") +24051 8b/-> *(ebp+0xc) 0/r32/eax +24052 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24053 (write-buffered *(ebp+0x10) %eax) +24054 (write-buffered *(ebp+0x10) ": stmt index: cannot take an int for array '") +24055 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24056 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +24057 (lookup *eax *(eax+4)) # Var-name Var-name => eax +24058 (write-buffered *(ebp+0x10) %eax) +24059 (write-buffered *(ebp+0x10) "'; create an offset instead. See mu.md for details.\n") +24060 (flush *(ebp+0x10)) +24061 (stop *(ebp+0x14) 1) +24062 # never gets here +24063 +24064 $check-mu-index-stmt:error-too-many-inouts: +24065 (write-buffered *(ebp+0x10) "fn ") +24066 8b/-> *(ebp+0xc) 0/r32/eax +24067 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24068 (write-buffered *(ebp+0x10) %eax) +24069 (write-buffered *(ebp+0x10) ": stmt index: too many inouts (2 required)\n") +24070 (flush *(ebp+0x10)) +24071 (stop *(ebp+0x14) 1) +24072 # never gets here +24073 +24074 $check-mu-index-stmt:error-too-few-outputs: +24075 (write-buffered *(ebp+0x10) "fn ") +24076 8b/-> *(ebp+0xc) 0/r32/eax +24077 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24078 (write-buffered *(ebp+0x10) %eax) +24079 (write-buffered *(ebp+0x10) ": stmt index: must have an output\n") +24080 (flush *(ebp+0x10)) +24081 (stop *(ebp+0x14) 1) +24082 # never gets here +24083 +24084 $check-mu-index-stmt:error-too-many-outputs: +24085 (write-buffered *(ebp+0x10) "fn ") +24086 8b/-> *(ebp+0xc) 0/r32/eax +24087 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24088 (write-buffered *(ebp+0x10) %eax) +24089 (write-buffered *(ebp+0x10) ": stmt index: too many outputs (1 required)\n") +24090 (flush *(ebp+0x10)) +24091 (stop *(ebp+0x14) 1) +24092 # never gets here +24093 +24094 $check-mu-index-stmt:error-output-not-in-register: +24095 (write-buffered *(ebp+0x10) "fn ") +24096 8b/-> *(ebp+0xc) 0/r32/eax +24097 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24098 (write-buffered *(ebp+0x10) %eax) +24099 (write-buffered *(ebp+0x10) ": stmt index: output '") +24100 (lookup *edi *(edi+4)) # Var-name Var-name => eax +24101 (write-buffered *(ebp+0x10) %eax) +24102 (write-buffered *(ebp+0x10) "' is not in a register\n") +24103 (flush *(ebp+0x10)) +24104 (stop *(ebp+0x14) 1) +24105 # never gets here +24106 +24107 $check-mu-index-stmt:error-output-type-not-address: +24108 (write-buffered *(ebp+0x10) "fn ") +24109 8b/-> *(ebp+0xc) 0/r32/eax +24110 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24111 (write-buffered *(ebp+0x10) %eax) +24112 (write-buffered *(ebp+0x10) ": stmt index: output '") +24113 (lookup *edi *(edi+4)) # Var-name Var-name => eax +24114 (write-buffered *(ebp+0x10) %eax) +24115 (write-buffered *(ebp+0x10) "' must be an addr\n") +24116 (flush *(ebp+0x10)) +24117 (stop *(ebp+0x14) 1) +24118 # never gets here +24119 +24120 $check-mu-index-stmt:error-bad-output-type: +24121 (write-buffered *(ebp+0x10) "fn ") +24122 8b/-> *(ebp+0xc) 0/r32/eax +24123 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24124 (write-buffered *(ebp+0x10) %eax) +24125 (write-buffered *(ebp+0x10) ": stmt index: output '") +24126 (lookup *edi *(edi+4)) # Var-name Var-name => eax +24127 (write-buffered *(ebp+0x10) %eax) +24128 (write-buffered *(ebp+0x10) "' does not have the right type\n") +24129 (flush *(ebp+0x10)) +24130 (stop *(ebp+0x14) 1) +24131 # never gets here +24132 +24133 check-mu-length-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +24134 # . prologue +24135 55/push-ebp +24136 89/<- %ebp 4/r32/esp +24137 # . save registers +24138 50/push-eax +24139 51/push-ecx +24140 52/push-edx +24141 53/push-ebx +24142 56/push-esi +24143 57/push-edi +24144 # esi = stmt +24145 8b/-> *(ebp+8) 6/r32/esi +24146 # - check for 0 inouts +24147 # var base/ecx: (addr var) = stmt->inouts->value +24148 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24149 $check-mu-length-stmt:check-no-inouts: +24150 3d/compare-eax-and 0/imm32 +24151 0f 84/jump-if-= $check-mu-length-stmt:error-too-few-inouts/disp32 +24152 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +24153 89/<- %ecx 0/r32/eax +24154 # - check base type is either (addr array ...) in register or (array ...) on stack +24155 # var base-type/ebx: (addr type-tree) = lookup(base->type) +24156 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +24157 89/<- %ebx 0/r32/eax +24158 # if base-type is an atom, abort with a precise error +24159 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +24160 { +24161 74/jump-if-= break/disp8 +24162 (is-simple-mu-type? %ebx 3) # array => eax +24163 3d/compare-eax-and 0/imm32/false +24164 0f 85/jump-if-!= $check-mu-length-stmt:error-base-array-atom-type/disp32 +24165 0f 84/jump-if-= $check-mu-length-stmt:error-base-non-array-type/disp32 +24166 } +24167 $check-mu-length-stmt:base-is-compound: +24168 # if type->left not addr or array, abort +24169 { +24170 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +24171 (is-simple-mu-type? %eax 2) # addr => eax +24172 3d/compare-eax-and 0/imm32/false +24173 75/jump-if-!= break/disp8 +24174 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +24175 (is-simple-mu-type? %eax 3) # array => eax +24176 3d/compare-eax-and 0/imm32/false +24177 75/jump-if-!= break/disp8 +24178 e9/jump $check-mu-length-stmt:error-base-non-array-type/disp32 +24179 } +24180 # if (type->left == addr) ensure type->right->left == array and type->register exists +24181 { +24182 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +24183 (is-simple-mu-type? %eax 2) # addr => eax +24184 3d/compare-eax-and 0/imm32/false +24185 74/jump-if-= break/disp8 +24186 $check-mu-length-stmt:base-is-addr: +24187 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +24188 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +24189 (is-simple-mu-type? %eax 3) # array => eax +24190 3d/compare-eax-and 0/imm32/false +24191 0f 84/jump-if-= $check-mu-length-stmt:error-base-non-array-type/disp32 +24192 $check-mu-length-stmt:check-base-addr-is-register: +24193 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +24194 0f 84/jump-if-= $check-mu-length-stmt:error-base-address-array-type-on-stack/disp32 +24195 } +24196 # if (type->left == array) ensure type->register doesn't exist +24197 { +24198 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +24199 (is-simple-mu-type? %eax 3) # array => eax +24200 3d/compare-eax-and 0/imm32/false +24201 74/jump-if-= break/disp8 +24202 $check-mu-length-stmt:base-is-array: +24203 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +24204 0f 85/jump-if-!= $check-mu-length-stmt:error-base-array-type-in-register/disp32 +24205 } +24206 # if (base-type->left == addr) base-type = base-type->right +24207 { +24208 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +24209 (is-simple-mu-type? %eax 2) # addr => eax +24210 3d/compare-eax-and 0/imm32/false +24211 74/jump-if-= break/disp8 +24212 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +24213 89/<- %ebx 0/r32/eax +24214 } +24215 # - check for too many inouts +24216 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24217 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +24218 3d/compare-eax-and 0/imm32/false +24219 0f 85/jump-if-!= $check-mu-length-stmt:error-too-many-inouts/disp32 +24220 # - check for 0 outputs +24221 # var output/edi: (addr var) = stmt->outputs->value +24222 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +24223 3d/compare-eax-and 0/imm32/false +24224 0f 84/jump-if-= $check-mu-length-stmt:error-too-few-outputs/disp32 +24225 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +24226 89/<- %edi 0/r32/eax +24227 # - check output type +24228 # must have a non-atomic type +24229 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +24230 (is-simple-mu-type? %eax 1) # int => eax +24231 3d/compare-eax-and 0/imm32/false +24232 0f 84/jump-if-= $check-mu-length-stmt:error-invalid-output-type/disp32 +24233 # - check for too many outputs +24234 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +24235 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +24236 3d/compare-eax-and 0/imm32/false +24237 0f 85/jump-if-!= $check-mu-length-stmt:error-too-many-outputs/disp32 +24238 $check-mu-length-stmt:end: +24239 # . restore registers +24240 5f/pop-to-edi +24241 5e/pop-to-esi +24242 5b/pop-to-ebx +24243 5a/pop-to-edx +24244 59/pop-to-ecx +24245 58/pop-to-eax +24246 # . epilogue +24247 89/<- %esp 5/r32/ebp +24248 5d/pop-to-ebp +24249 c3/return +24250 +24251 $check-mu-length-stmt:error-base-non-array-type: +24252 (write-buffered *(ebp+0x10) "fn ") +24253 8b/-> *(ebp+0xc) 0/r32/eax +24254 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24255 (write-buffered *(ebp+0x10) %eax) +24256 (write-buffered *(ebp+0x10) ": stmt length: var '") +24257 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24258 (write-buffered *(ebp+0x10) %eax) +24259 (write-buffered *(ebp+0x10) "' is not an array\n") +24260 (flush *(ebp+0x10)) +24261 (stop *(ebp+0x14) 1) +24262 # never gets here +24263 +24264 $check-mu-length-stmt:error-base-array-atom-type: +24265 (write-buffered *(ebp+0x10) "fn ") +24266 8b/-> *(ebp+0xc) 0/r32/eax +24267 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24268 (write-buffered *(ebp+0x10) %eax) +24269 (write-buffered *(ebp+0x10) ": stmt length: array '") +24270 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24271 (write-buffered *(ebp+0x10) %eax) +24272 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") +24273 (flush *(ebp+0x10)) +24274 (stop *(ebp+0x14) 1) +24275 # never gets here +24276 +24277 $check-mu-length-stmt:error-base-address-array-type-on-stack: +24278 (write-buffered *(ebp+0x10) "fn ") +24279 8b/-> *(ebp+0xc) 0/r32/eax +24280 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24281 (write-buffered *(ebp+0x10) %eax) +24282 (write-buffered *(ebp+0x10) ": stmt length: var '") +24283 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24284 (write-buffered *(ebp+0x10) %eax) +24285 (write-buffered *(ebp+0x10) "' is an addr to an array, and so must live in a register\n") +24286 (flush *(ebp+0x10)) +24287 (stop *(ebp+0x14) 1) +24288 # never gets here +24289 +24290 $check-mu-length-stmt:error-base-array-type-in-register: +24291 (write-buffered *(ebp+0x10) "fn ") +24292 8b/-> *(ebp+0xc) 0/r32/eax +24293 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24294 (write-buffered *(ebp+0x10) %eax) +24295 (write-buffered *(ebp+0x10) ": stmt length: var '") +24296 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24297 (write-buffered *(ebp+0x10) %eax) +24298 (write-buffered *(ebp+0x10) "' is an array, and so must live on the stack\n") +24299 (flush *(ebp+0x10)) +24300 (stop *(ebp+0x14) 1) +24301 # never gets here +24302 +24303 $check-mu-length-stmt:error-too-few-inouts: +24304 (write-buffered *(ebp+0x10) "fn ") +24305 8b/-> *(ebp+0xc) 0/r32/eax +24306 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24307 (write-buffered *(ebp+0x10) %eax) +24308 (write-buffered *(ebp+0x10) ": stmt length: too few inouts (1 required)\n") +24309 (flush *(ebp+0x10)) +24310 (stop *(ebp+0x14) 1) +24311 # never gets here +24312 +24313 $check-mu-length-stmt:error-invalid-index-type: +24314 (write-buffered *(ebp+0x10) "fn ") +24315 8b/-> *(ebp+0xc) 0/r32/eax +24316 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24317 (write-buffered *(ebp+0x10) %eax) +24318 (write-buffered *(ebp+0x10) ": stmt length: second argument '") +24319 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24320 (write-buffered *(ebp+0x10) %eax) +24321 (write-buffered *(ebp+0x10) "' must be an int or offset\n") +24322 (flush *(ebp+0x10)) +24323 (stop *(ebp+0x14) 1) +24324 # never gets here +24325 +24326 $check-mu-length-stmt:error-index-offset-atom-type: +24327 (write-buffered *(ebp+0x10) "fn ") +24328 8b/-> *(ebp+0xc) 0/r32/eax +24329 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24330 (write-buffered *(ebp+0x10) %eax) +24331 (write-buffered *(ebp+0x10) ": stmt length: offset '") +24332 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24333 (write-buffered *(ebp+0x10) %eax) +24334 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") +24335 (flush *(ebp+0x10)) +24336 (stop *(ebp+0x14) 1) +24337 # never gets here +24338 +24339 $check-mu-length-stmt:error-index-on-stack: +24340 (write-buffered *(ebp+0x10) "fn ") +24341 8b/-> *(ebp+0xc) 0/r32/eax +24342 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24343 (write-buffered *(ebp+0x10) %eax) +24344 (write-buffered *(ebp+0x10) ": stmt length: second argument '") +24345 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24346 (write-buffered *(ebp+0x10) %eax) +24347 (write-buffered *(ebp+0x10) "' must be in a register\n") +24348 (flush *(ebp+0x10)) +24349 (stop *(ebp+0x14) 1) +24350 # never gets here +24351 +24352 $check-mu-length-stmt:error-index-needs-offset: +24353 (write-buffered *(ebp+0x10) "fn ") +24354 8b/-> *(ebp+0xc) 0/r32/eax +24355 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24356 (write-buffered *(ebp+0x10) %eax) +24357 (write-buffered *(ebp+0x10) ": stmt length: cannot take an int for array '") +24358 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24359 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +24360 (lookup *eax *(eax+4)) # Var-name Var-name => eax +24361 (write-buffered *(ebp+0x10) %eax) +24362 (write-buffered *(ebp+0x10) "'; create an offset instead. See mu.md for details.\n") +24363 (flush *(ebp+0x10)) +24364 (stop *(ebp+0x14) 1) +24365 # never gets here +24366 +24367 $check-mu-length-stmt:error-too-many-inouts: +24368 (write-buffered *(ebp+0x10) "fn ") +24369 8b/-> *(ebp+0xc) 0/r32/eax +24370 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24371 (write-buffered *(ebp+0x10) %eax) +24372 (write-buffered *(ebp+0x10) ": stmt length: too many inouts (1 required)\n") +24373 (flush *(ebp+0x10)) +24374 (stop *(ebp+0x14) 1) +24375 # never gets here +24376 +24377 $check-mu-length-stmt:error-too-few-outputs: +24378 (write-buffered *(ebp+0x10) "fn ") +24379 8b/-> *(ebp+0xc) 0/r32/eax +24380 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24381 (write-buffered *(ebp+0x10) %eax) +24382 (write-buffered *(ebp+0x10) ": stmt length: must have an output\n") +24383 (flush *(ebp+0x10)) +24384 (stop *(ebp+0x14) 1) +24385 # never gets here +24386 +24387 $check-mu-length-stmt:error-too-many-outputs: +24388 (write-buffered *(ebp+0x10) "fn ") +24389 8b/-> *(ebp+0xc) 0/r32/eax +24390 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24391 (write-buffered *(ebp+0x10) %eax) +24392 (write-buffered *(ebp+0x10) ": stmt length: too many outputs (1 required)\n") +24393 (flush *(ebp+0x10)) +24394 (stop *(ebp+0x14) 1) +24395 # never gets here +24396 +24397 $check-mu-length-stmt:error-output-not-in-register: +24398 (write-buffered *(ebp+0x10) "fn ") +24399 8b/-> *(ebp+0xc) 0/r32/eax +24400 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24401 (write-buffered *(ebp+0x10) %eax) +24402 (write-buffered *(ebp+0x10) ": stmt length: output '") +24403 (lookup *edi *(edi+4)) # Var-name Var-name => eax +24404 (write-buffered *(ebp+0x10) %eax) +24405 (write-buffered *(ebp+0x10) "' is not in a register\n") +24406 (flush *(ebp+0x10)) +24407 (stop *(ebp+0x14) 1) +24408 # never gets here +24409 +24410 $check-mu-length-stmt:error-invalid-output-type: +24411 (write-buffered *(ebp+0x10) "fn ") +24412 8b/-> *(ebp+0xc) 0/r32/eax +24413 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24414 (write-buffered *(ebp+0x10) %eax) +24415 (write-buffered *(ebp+0x10) ": stmt length: output '") +24416 (lookup *edi *(edi+4)) # Var-name Var-name => eax +24417 (write-buffered *(ebp+0x10) %eax) +24418 (write-buffered *(ebp+0x10) "' does not have the right type\n") +24419 (flush *(ebp+0x10)) +24420 (stop *(ebp+0x14) 1) +24421 # never gets here +24422 +24423 check-mu-compute-offset-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +24424 # . prologue +24425 55/push-ebp +24426 89/<- %ebp 4/r32/esp +24427 # . save registers +24428 50/push-eax +24429 51/push-ecx +24430 52/push-edx +24431 53/push-ebx +24432 56/push-esi +24433 57/push-edi +24434 # esi = stmt +24435 8b/-> *(ebp+8) 6/r32/esi +24436 # - check for 0 inouts +24437 # var base/ecx: (addr var) = stmt->inouts->value +24438 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24439 $check-mu-compute-offset-stmt:check-no-inouts: +24440 3d/compare-eax-and 0/imm32 +24441 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-inouts/disp32 +24442 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +24443 89/<- %ecx 0/r32/eax +24444 # - check base type is either (addr array ...) in register or (array ...) on stack +24445 # var base-type/ebx: (addr type-tree) = lookup(base->type) +24446 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +24447 89/<- %ebx 0/r32/eax +24448 # if base-type is an atom, abort with a precise error +24449 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +24450 { +24451 74/jump-if-= break/disp8 +24452 (is-simple-mu-type? %ebx 3) # array => eax +24453 3d/compare-eax-and 0/imm32/false +24454 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-base-array-atom-type/disp32 +24455 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 +24456 } +24457 $check-mu-compute-offset-stmt:base-is-compound: +24458 # if type->left not addr or array, abort +24459 { +24460 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +24461 (is-simple-mu-type? %eax 2) # addr => eax +24462 3d/compare-eax-and 0/imm32/false +24463 75/jump-if-!= break/disp8 +24464 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +24465 (is-simple-mu-type? %eax 3) # array => eax +24466 3d/compare-eax-and 0/imm32/false +24467 75/jump-if-!= break/disp8 +24468 e9/jump $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 +24469 } +24470 # if (type->left == addr) ensure type->right->left == array and type->register exists +24471 { +24472 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +24473 (is-simple-mu-type? %eax 2) # addr => eax +24474 3d/compare-eax-and 0/imm32/false +24475 74/jump-if-= break/disp8 +24476 $check-mu-compute-offset-stmt:base-is-addr: +24477 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +24478 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +24479 (is-simple-mu-type? %eax 3) # array => eax +24480 3d/compare-eax-and 0/imm32/false +24481 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 +24482 } +24483 # if (base-type->left == addr) base-type = base-type->right +24484 { +24485 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +24486 (is-simple-mu-type? %eax 2) # addr => eax +24487 3d/compare-eax-and 0/imm32/false +24488 74/jump-if-= break/disp8 +24489 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +24490 89/<- %ebx 0/r32/eax +24491 } +24492 # - check for 1 inout +24493 # var index/ecx: (addr stmt-var) = stmt->inouts->next->value +24494 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24495 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +24496 $check-mu-compute-offset-stmt:check-single-inout: +24497 3d/compare-eax-and 0/imm32 +24498 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-inouts/disp32 +24499 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +24500 89/<- %ecx 0/r32/eax +24501 # - check index is either a literal or register +24502 # var index-type/edx: (addr type-tree) +24503 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +24504 89/<- %edx 0/r32/eax +24505 # index type must be a literal or int +24506 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +24507 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-invalid-index-type/disp32 +24508 { +24509 $check-mu-compute-offset-stmt:index-type-is-atom: +24510 (is-simple-mu-type? %edx 0) # literal => eax +24511 3d/compare-eax-and 0/imm32/false +24512 75/jump-if-!= break/disp8 +24513 (is-simple-mu-type? %edx 1) # int => eax +24514 3d/compare-eax-and 0/imm32/false +24515 75/jump-if-!= break/disp8 +24516 e9/jump $check-mu-compute-offset-stmt:error-invalid-index-type/disp32 +24517 } +24518 # - check for too many inouts +24519 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24520 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +24521 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +24522 3d/compare-eax-and 0/imm32/false +24523 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-too-many-inouts/disp32 +24524 # - check for 0 outputs +24525 # var output/edi: (addr var) = stmt->outputs->value +24526 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +24527 3d/compare-eax-and 0/imm32/false +24528 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-outputs/disp32 +24529 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +24530 89/<- %edi 0/r32/eax +24531 # - check output type +24532 # must have a non-atomic type +24533 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +24534 89/<- %edx 0/r32/eax +24535 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +24536 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-output-type-not-offset/disp32 +24537 # type must start with (offset ...) +24538 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +24539 (is-simple-mu-type? %eax 7) # offset => eax +24540 3d/compare-eax-and 0/imm32/false +24541 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-output-type-not-offset/disp32 +24542 # if tail(base-type) != tail(output-type) abort +24543 (type-tail %ebx) # => eax +24544 89/<- %ebx 0/r32/eax +24545 (type-tail %edx) # => eax +24546 (type-equal? %ebx %eax) # => eax +24547 3d/compare-eax-and 0/imm32/false +24548 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-bad-output-type/disp32 +24549 # - check for too many outputs +24550 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +24551 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +24552 3d/compare-eax-and 0/imm32/false +24553 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-too-many-outputs/disp32 +24554 $check-mu-compute-offset-stmt:end: +24555 # . restore registers +24556 5f/pop-to-edi +24557 5e/pop-to-esi +24558 5b/pop-to-ebx +24559 5a/pop-to-edx +24560 59/pop-to-ecx +24561 58/pop-to-eax +24562 # . epilogue +24563 89/<- %esp 5/r32/ebp +24564 5d/pop-to-ebp +24565 c3/return +24566 +24567 $check-mu-compute-offset-stmt:error-base-non-array-type: +24568 (write-buffered *(ebp+0x10) "fn ") +24569 8b/-> *(ebp+0xc) 0/r32/eax +24570 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24571 (write-buffered *(ebp+0x10) %eax) +24572 (write-buffered *(ebp+0x10) ": stmt compute-offset: var '") +24573 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24574 (write-buffered *(ebp+0x10) %eax) +24575 (write-buffered *(ebp+0x10) "' is not an array\n") +24576 (flush *(ebp+0x10)) +24577 (stop *(ebp+0x14) 1) +24578 # never gets here +24579 +24580 $check-mu-compute-offset-stmt:error-base-array-atom-type: +24581 (write-buffered *(ebp+0x10) "fn ") +24582 8b/-> *(ebp+0xc) 0/r32/eax +24583 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24584 (write-buffered *(ebp+0x10) %eax) +24585 (write-buffered *(ebp+0x10) ": stmt compute-offset: array '") +24586 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24587 (write-buffered *(ebp+0x10) %eax) +24588 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") +24589 (flush *(ebp+0x10)) +24590 (stop *(ebp+0x14) 1) +24591 # never gets here +24592 +24593 $check-mu-compute-offset-stmt:error-too-few-inouts: +24594 (write-buffered *(ebp+0x10) "fn ") +24595 8b/-> *(ebp+0xc) 0/r32/eax +24596 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24597 (write-buffered *(ebp+0x10) %eax) +24598 (write-buffered *(ebp+0x10) ": stmt compute-offset: too few inouts (2 required)\n") +24599 (flush *(ebp+0x10)) +24600 (stop *(ebp+0x14) 1) +24601 # never gets here +24602 +24603 $check-mu-compute-offset-stmt:error-invalid-index-type: +24604 (write-buffered *(ebp+0x10) "fn ") +24605 8b/-> *(ebp+0xc) 0/r32/eax +24606 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24607 (write-buffered *(ebp+0x10) %eax) +24608 (write-buffered *(ebp+0x10) ": stmt compute-offset: second argument '") +24609 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24610 (write-buffered *(ebp+0x10) %eax) +24611 (write-buffered *(ebp+0x10) "' must be an int\n") +24612 (flush *(ebp+0x10)) +24613 (stop *(ebp+0x14) 1) +24614 # never gets here +24615 +24616 $check-mu-compute-offset-stmt:error-index-offset-atom-type: +24617 (write-buffered *(ebp+0x10) "fn ") +24618 8b/-> *(ebp+0xc) 0/r32/eax +24619 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24620 (write-buffered *(ebp+0x10) %eax) +24621 (write-buffered *(ebp+0x10) ": stmt compute-offset: offset '") +24622 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24623 (write-buffered *(ebp+0x10) %eax) +24624 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") +24625 (flush *(ebp+0x10)) +24626 (stop *(ebp+0x14) 1) +24627 # never gets here +24628 +24629 $check-mu-compute-offset-stmt:error-index-on-stack: +24630 (write-buffered *(ebp+0x10) "fn ") +24631 8b/-> *(ebp+0xc) 0/r32/eax +24632 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24633 (write-buffered *(ebp+0x10) %eax) +24634 (write-buffered *(ebp+0x10) ": stmt compute-offset: second argument '") +24635 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24636 (write-buffered *(ebp+0x10) %eax) +24637 (write-buffered *(ebp+0x10) "' must be in a register\n") +24638 (flush *(ebp+0x10)) +24639 (stop *(ebp+0x14) 1) +24640 # never gets here +24641 +24642 $check-mu-compute-offset-stmt:error-too-many-inouts: +24643 (write-buffered *(ebp+0x10) "fn ") +24644 8b/-> *(ebp+0xc) 0/r32/eax +24645 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24646 (write-buffered *(ebp+0x10) %eax) +24647 (write-buffered *(ebp+0x10) ": stmt compute-offset: too many inouts (2 required)\n") +24648 (flush *(ebp+0x10)) +24649 (stop *(ebp+0x14) 1) +24650 # never gets here +24651 +24652 $check-mu-compute-offset-stmt:error-too-few-outputs: +24653 (write-buffered *(ebp+0x10) "fn ") +24654 8b/-> *(ebp+0xc) 0/r32/eax +24655 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24656 (write-buffered *(ebp+0x10) %eax) +24657 (write-buffered *(ebp+0x10) ": stmt compute-offset: must have an output\n") +24658 (flush *(ebp+0x10)) +24659 (stop *(ebp+0x14) 1) +24660 # never gets here +24661 +24662 $check-mu-compute-offset-stmt:error-too-many-outputs: +24663 (write-buffered *(ebp+0x10) "fn ") +24664 8b/-> *(ebp+0xc) 0/r32/eax +24665 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24666 (write-buffered *(ebp+0x10) %eax) +24667 (write-buffered *(ebp+0x10) ": stmt compute-offset: too many outputs (1 required)\n") +24668 (flush *(ebp+0x10)) +24669 (stop *(ebp+0x14) 1) +24670 # never gets here +24671 +24672 $check-mu-compute-offset-stmt:error-output-not-in-register: +24673 (write-buffered *(ebp+0x10) "fn ") +24674 8b/-> *(ebp+0xc) 0/r32/eax +24675 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24676 (write-buffered *(ebp+0x10) %eax) +24677 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") +24678 (lookup *edi *(edi+4)) # Var-name Var-name => eax +24679 (write-buffered *(ebp+0x10) %eax) +24680 (write-buffered *(ebp+0x10) "' is not in a register\n") +24681 (flush *(ebp+0x10)) +24682 (stop *(ebp+0x14) 1) +24683 # never gets here +24684 +24685 $check-mu-compute-offset-stmt:error-output-type-not-offset: +24686 (write-buffered *(ebp+0x10) "fn ") +24687 8b/-> *(ebp+0xc) 0/r32/eax +24688 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24689 (write-buffered *(ebp+0x10) %eax) +24690 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") +24691 (lookup *edi *(edi+4)) # Var-name Var-name => eax +24692 (write-buffered *(ebp+0x10) %eax) +24693 (write-buffered *(ebp+0x10) "' must be an offset\n") +24694 (flush *(ebp+0x10)) +24695 (stop *(ebp+0x14) 1) +24696 # never gets here +24697 +24698 $check-mu-compute-offset-stmt:error-bad-output-type: +24699 (write-buffered *(ebp+0x10) "fn ") +24700 8b/-> *(ebp+0xc) 0/r32/eax +24701 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24702 (write-buffered *(ebp+0x10) %eax) +24703 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") +24704 (lookup *edi *(edi+4)) # Var-name Var-name => eax +24705 (write-buffered *(ebp+0x10) %eax) +24706 (write-buffered *(ebp+0x10) "' does not have the right type\n") +24707 (flush *(ebp+0x10)) +24708 (stop *(ebp+0x14) 1) +24709 # never gets here +24710 +24711 check-mu-copy-object-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +24712 # . prologue +24713 55/push-ebp +24714 89/<- %ebp 4/r32/esp +24715 # . save registers +24716 50/push-eax +24717 51/push-ecx +24718 53/push-ebx +24719 56/push-esi +24720 57/push-edi +24721 # esi = stmt +24722 8b/-> *(ebp+8) 6/r32/esi +24723 $check-mu-copy-object-stmt:check-for-output: +24724 # if stmt->outputs abort +24725 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +24726 3d/compare-eax-and 0/imm32 +24727 0f 85/jump-if-!= $check-mu-copy-object-stmt:error-too-many-outputs/disp32 +24728 $check-mu-copy-object-stmt:get-left: +24729 # var dest/edi: (addr stmt-var) = stmt->inouts +24730 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24731 89/<- %edi 0/r32/eax +24732 # zero inouts +24733 3d/compare-eax-and 0/imm32 +24734 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 +24735 $check-mu-copy-object-stmt:get-src: +24736 # var src/esi: (addr stmt-var) = dest->next +24737 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +24738 89/<- %esi 0/r32/eax +24739 # 1 inout +24740 3d/compare-eax-and 0/imm32 +24741 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 +24742 # > 2 inouts +24743 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +24744 3d/compare-eax-and 0/imm32 +24745 0f 85/jump-if-!= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 +24746 $check-mu-copy-object-stmt:types: +24747 # var src-type/ecx: (addr type-tree) = src->value->type +24748 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +24749 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +24750 89/<- %ecx 0/r32/eax +24751 # if (src->is-deref?) src-type = src-type->payload +24752 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref +24753 3d/compare-eax-and 0/imm32/false +24754 { +24755 74/jump-if-= break/disp8 +24756 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +24757 # if src-type->right is null, src-type = src-type->left +24758 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +24759 { +24760 75/jump-if-!= break/disp8 +24761 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +24762 } +24763 89/<- %ecx 0/r32/eax +24764 } +24765 # if src-type is not addr, abort +24766 (is-mu-addr-type? %ecx) # => eax +24767 3d/compare-eax-and 0/imm32/false +24768 0f 84/jump-if-= $check-mu-copy-object-stmt:error-invalid-types/disp32 +24769 # var dest-type/ebx: (addr type-tree) = dest->value->type +24770 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +24771 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +24772 89/<- %ebx 0/r32/eax +24773 # if (dest->is-deref?) dest-type = dest-type->payload +24774 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +24775 3d/compare-eax-and 0/imm32/false +24776 { +24777 74/jump-if-= break/disp8 +24778 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +24779 # if dest-type->right is null, dest-type = dest-type->left +24780 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +24781 { +24782 75/jump-if-!= break/disp8 +24783 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +24784 } +24785 89/<- %ebx 0/r32/eax +24786 } +24787 # if (dest-type != src-type) abort +24788 (type-equal? %ecx %ebx) # => eax +24789 3d/compare-eax-and 0/imm32 +24790 0f 84/jump-if-= $check-mu-copy-object-stmt:error-invalid-types/disp32 +24791 $check-mu-copy-object-stmt:end: +24792 # . restore registers +24793 5f/pop-to-edi +24794 5e/pop-to-esi +24795 5b/pop-to-ebx +24796 59/pop-to-ecx +24797 58/pop-to-eax +24798 # . epilogue +24799 89/<- %esp 5/r32/ebp +24800 5d/pop-to-ebp +24801 c3/return +24802 +24803 $check-mu-copy-object-stmt:error-incorrect-inouts: +24804 (write-buffered *(ebp+0x10) "fn ") +24805 8b/-> *(ebp+0xc) 0/r32/eax +24806 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24807 (write-buffered *(ebp+0x10) %eax) +24808 (write-buffered *(ebp+0x10) ": stmt 'copy-object' must have two inouts\n") +24809 (flush *(ebp+0x10)) +24810 (stop *(ebp+0x14) 1) +24811 # never gets here +24812 +24813 $check-mu-copy-object-stmt:error-too-many-outputs: +24814 (write-buffered *(ebp+0x10) "fn ") +24815 8b/-> *(ebp+0xc) 0/r32/eax +24816 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24817 (write-buffered *(ebp+0x10) %eax) +24818 (write-buffered *(ebp+0x10) ": stmt 'copy-object' must not have any outputs\n") +24819 (flush *(ebp+0x10)) +24820 (stop *(ebp+0x14) 1) +24821 # never gets here +24822 +24823 $check-mu-copy-object-stmt:error-invalid-types: +24824 (write-buffered *(ebp+0x10) "fn ") +24825 8b/-> *(ebp+0xc) 0/r32/eax +24826 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24827 (write-buffered *(ebp+0x10) %eax) +24828 (write-buffered *(ebp+0x10) ": stmt copy-object: two inouts with identical addr types expected\n") +24829 (flush *(ebp+0x10)) +24830 (stop *(ebp+0x14) 1) +24831 # never gets here +24832 +24833 check-mu-clear-object-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +24834 # . prologue +24835 55/push-ebp +24836 89/<- %ebp 4/r32/esp +24837 # . save registers +24838 50/push-eax +24839 51/push-ecx +24840 53/push-ebx +24841 56/push-esi +24842 57/push-edi +24843 # esi = stmt +24844 8b/-> *(ebp+8) 6/r32/esi +24845 $check-mu-clear-object-stmt:check-for-output: +24846 # if stmt->outputs abort +24847 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +24848 3d/compare-eax-and 0/imm32 +24849 0f 85/jump-if-!= $check-mu-clear-object-stmt:error-too-many-outputs/disp32 +24850 $check-mu-clear-object-stmt:get-left: +24851 # var dest/edi: (addr stmt-var) = stmt->inouts +24852 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24853 89/<- %edi 0/r32/eax +24854 # zero inouts +24855 3d/compare-eax-and 0/imm32 +24856 0f 84/jump-if-= $check-mu-clear-object-stmt:error-incorrect-inouts/disp32 +24857 $check-mu-clear-object-stmt:get-src: +24858 # > 1 inout +24859 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +24860 3d/compare-eax-and 0/imm32 +24861 0f 85/jump-if-!= $check-mu-clear-object-stmt:error-incorrect-inouts/disp32 +24862 $check-mu-clear-object-stmt:types: +24863 # var src-type/ecx: (addr type-tree) = src->value->type +24864 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +24865 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +24866 89/<- %ecx 0/r32/eax +24867 # if (src->is-deref?) src-type = src-type->payload +24868 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +24869 3d/compare-eax-and 0/imm32/false +24870 { 24871 74/jump-if-= break/disp8 -24872 b8/copy-to-eax 1/imm32/true -24873 e9/jump $type-match?:end/disp32 -24874 } -24875 # if (call is literal-string and def is string) return true -24876 { -24877 $type-match?:check-literal-string: -24878 (is-simple-mu-type? *(ebp+0xc) 0x10) # literal-string => eax -24879 3d/compare-eax-and 0/imm32/false -24880 74/jump-if-= break/disp8 -24881 (is-mu-string-type? *(ebp+8)) # => eax -24882 3d/compare-eax-and 0/imm32/false -24883 74/jump-if-= break/disp8 -24884 b8/copy-to-eax 1/imm32/true -24885 e9/jump $type-match?:end/disp32 -24886 } -24887 $type-match?:baseline: -24888 # otherwise fall back -24889 (type-component-match? *(ebp+8) *(ebp+0xc) *(ebp+0x10)) # => eax -24890 $type-match?:end: -24891 # . epilogue -24892 89/<- %esp 5/r32/ebp -24893 5d/pop-to-ebp -24894 c3/return -24895 -24896 type-component-match?: # def: (addr type-tree), call: (addr type-tree), type-parameters: (addr table (handle array byte) (addr type-tree)) -> result/eax: boolean -24897 # . prologue -24898 55/push-ebp -24899 89/<- %ebp 4/r32/esp -24900 # . save registers -24901 51/push-ecx -24902 52/push-edx -24903 53/push-ebx -24904 # ecx = def -24905 8b/-> *(ebp+8) 1/r32/ecx -24906 # edx = call -24907 8b/-> *(ebp+0xc) 2/r32/edx -24908 $type-component-match?:compare-addr: -24909 # if (def == call) return true -24910 8b/-> %ecx 0/r32/eax # Var-type -24911 39/compare %edx 0/r32/eax # Var-type -24912 b8/copy-to-eax 1/imm32/true -24913 0f 84/jump-if-= $type-component-match?:end/disp32 -24914 # if (def == 0) return false -24915 b8/copy-to-eax 0/imm32/false -24916 81 7/subop/compare %ecx 0/imm32 # Type-tree-is-atom -24917 0f 84/jump-if-= $type-component-match?:end/disp32 -24918 # if (call == 0) return false -24919 81 7/subop/compare %edx 0/imm32 # Type-tree-is-atom -24920 0f 84/jump-if-= $type-component-match?:end/disp32 -24921 # if def is a type parameter, just check in type-parameters -24922 { -24923 $type-component-match?:check-type-parameter: -24924 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -24925 74/jump-if-= break/disp8 -24926 81 7/subop/compare *(ecx+4) 0xa/imm32/type-parameter # Type-tree-value -24927 75/jump-if-!= break/disp8 -24928 $type-component-match?:type-parameter: -24929 (type-parameter-match? *(ecx+8) *(ecx+0xc) %edx *(ebp+0x10)) # => eax -24930 e9/jump $type-component-match?:end/disp32 -24931 } -24932 # if def is a list containing just a type parameter, just check in type-parameters -24933 { -24934 $type-component-match?:check-list-type-parameter: -24935 # if def is a list.. -24936 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -24937 75/jump-if-!= break/disp8 -24938 # ..that's a singleton -24939 81 7/subop/compare *(ecx+0xc) 0/imm32 # Type-tree-left -24940 75/jump-if-!= break/disp8 -24941 # ..and whose head is a type parameter -24942 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -24943 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -24944 74/jump-if-= break/disp8 -24945 81 7/subop/compare *(eax+4) 0xa/imm32/type-parameter # Type-tree-value -24946 75/jump-if-!= break/disp8 -24947 $type-component-match?:list-type-parameter: -24948 (type-parameter-match? *(eax+8) *(eax+0xc) %edx *(ebp+0x10)) # => eax -24949 e9/jump $type-component-match?:end/disp32 -24950 } -24951 $type-component-match?:compare-atom-state: -24952 # if (def->is-atom? != call->is-atom?) return false -24953 8b/-> *ecx 3/r32/ebx # Type-tree-is-atom -24954 39/compare *edx 3/r32/ebx # Type-tree-is-atom -24955 b8/copy-to-eax 0/imm32/false -24956 0f 85/jump-if-!= $type-component-match?:end/disp32 -24957 # if def->is-atom? return (def->value == call->value) -24958 { -24959 $type-component-match?:check-atom: -24960 81 7/subop/compare %ebx 0/imm32/false -24961 74/jump-if-= break/disp8 -24962 $type-component-match?:is-atom: -24963 8b/-> *(ecx+4) 0/r32/eax # Type-tree-value -24964 39/compare *(edx+4) 0/r32/eax # Type-tree-value -24965 0f 94/set-if-= %al -24966 81 4/subop/and %eax 0xff/imm32 -24967 e9/jump $type-component-match?:end/disp32 -24968 } -24969 $type-component-match?:check-left: -24970 # if (!type-component-match?(def->left, call->left)) return false -24971 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -24972 89/<- %ebx 0/r32/eax -24973 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -24974 (type-component-match? %ebx %eax *(ebp+0x10)) # => eax +24872 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +24873 # if src-type->right is null, src-type = src-type->left +24874 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +24875 { +24876 75/jump-if-!= break/disp8 +24877 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +24878 } +24879 89/<- %ecx 0/r32/eax +24880 } +24881 # if src-type is not addr, abort +24882 (is-mu-addr-type? %ecx) # => eax +24883 3d/compare-eax-and 0/imm32/false +24884 0f 84/jump-if-= $check-mu-clear-object-stmt:error-invalid-type/disp32 +24885 $check-mu-clear-object-stmt:end: +24886 # . restore registers +24887 5f/pop-to-edi +24888 5e/pop-to-esi +24889 5b/pop-to-ebx +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 $check-mu-clear-object-stmt:error-incorrect-inouts: +24898 (write-buffered *(ebp+0x10) "fn ") +24899 8b/-> *(ebp+0xc) 0/r32/eax +24900 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24901 (write-buffered *(ebp+0x10) %eax) +24902 (write-buffered *(ebp+0x10) ": stmt 'clear-object' must have a single inout\n") +24903 (flush *(ebp+0x10)) +24904 (stop *(ebp+0x14) 1) +24905 # never gets here +24906 +24907 $check-mu-clear-object-stmt:error-too-many-outputs: +24908 (write-buffered *(ebp+0x10) "fn ") +24909 8b/-> *(ebp+0xc) 0/r32/eax +24910 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24911 (write-buffered *(ebp+0x10) %eax) +24912 (write-buffered *(ebp+0x10) ": stmt 'clear-object' must not have any outputs\n") +24913 (flush *(ebp+0x10)) +24914 (stop *(ebp+0x14) 1) +24915 # never gets here +24916 +24917 $check-mu-clear-object-stmt:error-invalid-type: +24918 (write-buffered *(ebp+0x10) "fn ") +24919 8b/-> *(ebp+0xc) 0/r32/eax +24920 (lookup *eax *(eax+4)) # Function-name Function-name => eax +24921 (write-buffered *(ebp+0x10) %eax) +24922 (write-buffered *(ebp+0x10) ": stmt clear-object: inout must have an addr type\n") +24923 (flush *(ebp+0x10)) +24924 (stop *(ebp+0x14) 1) +24925 # never gets here +24926 +24927 check-mu-allocate-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +24928 # . prologue +24929 55/push-ebp +24930 89/<- %ebp 4/r32/esp +24931 # . save registers +24932 50/push-eax +24933 53/push-ebx +24934 56/push-esi +24935 57/push-edi +24936 # esi = stmt +24937 8b/-> *(ebp+8) 6/r32/esi +24938 $check-mu-allocate-stmt:check-for-output: +24939 # if stmt->outputs abort +24940 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +24941 3d/compare-eax-and 0/imm32 +24942 0f 85/jump-if-!= $check-mu-allocate-stmt:error-too-many-outputs/disp32 +24943 $check-mu-allocate-stmt:get-target: +24944 # var target/edi: (addr stmt-var) = stmt->inouts +24945 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24946 89/<- %edi 0/r32/eax +24947 # zero inouts +24948 3d/compare-eax-and 0/imm32 +24949 0f 84/jump-if-= $check-mu-allocate-stmt:error-incorrect-inouts/disp32 +24950 # > 1 inouts +24951 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +24952 3d/compare-eax-and 0/imm32 +24953 0f 85/jump-if-!= $check-mu-allocate-stmt:error-incorrect-inouts/disp32 +24954 $check-mu-allocate-stmt:check-type: +24955 # var target-type/ebx: (addr type-tree) = target->value->type +24956 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +24957 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +24958 89/<- %ebx 0/r32/eax +24959 # if (target->is-deref?) target-type = target-type->payload +24960 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +24961 3d/compare-eax-and 0/imm32/false +24962 { +24963 74/jump-if-= break/disp8 +24964 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +24965 # if target-type->right is null, target-type = target-type->left +24966 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +24967 { +24968 75/jump-if-!= break/disp8 +24969 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +24970 } +24971 89/<- %ebx 0/r32/eax +24972 } +24973 # if target-type is not addr, abort +24974 (is-mu-addr-type? %ebx) # => eax 24975 3d/compare-eax-and 0/imm32/false -24976 74/jump-if-= $type-component-match?:end/disp8 -24977 $type-component-match?:check-right: -24978 # return type-component-match?(def->right, call->right) -24979 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -24980 89/<- %ebx 0/r32/eax -24981 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax -24982 (type-component-match? %ebx %eax *(ebp+0x10)) # => eax -24983 $type-component-match?:end: -24984 # . restore registers -24985 5b/pop-to-ebx -24986 5a/pop-to-edx -24987 59/pop-to-ecx -24988 # . epilogue -24989 89/<- %esp 5/r32/ebp -24990 5d/pop-to-ebp -24991 c3/return -24992 -24993 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 -24994 # . prologue -24995 55/push-ebp -24996 89/<- %ebp 4/r32/esp -24997 # . save registers -24998 51/push-ecx -24999 # -25000 (get-or-insert-handle *(ebp+0x14) *(ebp+8) *(ebp+0xc) 0xc) # => eax -25001 # if parameter wasn't saved, save it -25002 { -25003 81 7/subop/compare *eax 0/imm32 -25004 75/jump-if-!= break/disp8 -25005 8b/-> *(ebp+0x10) 1/r32/ecx -25006 89/<- *eax 1/r32/ecx -25007 } -25008 # -25009 (type-equal? *(ebp+0x10) *eax) # => eax -25010 $type-parameter-match?:end: -25011 # . restore registers -25012 59/pop-to-ecx -25013 # . epilogue -25014 89/<- %esp 5/r32/ebp -25015 5d/pop-to-ebp -25016 c3/return -25017 -25018 size-of: # v: (addr var) -> result/eax: int -25019 # . prologue -25020 55/push-ebp -25021 89/<- %ebp 4/r32/esp -25022 # . save registers -25023 51/push-ecx -25024 # var t/ecx: (addr type-tree) = lookup(v->type) -25025 8b/-> *(ebp+8) 1/r32/ecx -25026 #? (write-buffered Stderr "size-of ") -25027 #? (write-int32-hex-buffered Stderr %ecx) -25028 #? (write-buffered Stderr Newline) -25029 #? (write-buffered Stderr "type allocid: ") -25030 #? (write-int32-hex-buffered Stderr *(ecx+8)) -25031 #? (write-buffered Stderr Newline) -25032 #? (flush Stderr) -25033 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -25034 89/<- %ecx 0/r32/eax -25035 # if is-mu-array?(t) return size-of-array(t) -25036 { -25037 (is-mu-array? %ecx) # => eax -25038 3d/compare-eax-and 0/imm32/false -25039 74/jump-if-= break/disp8 -25040 (size-of-array %ecx) # => eax -25041 eb/jump $size-of:end/disp8 -25042 } -25043 # if is-mu-stream?(t) return size-of-stream(t) -25044 { -25045 (is-mu-stream? %ecx) # => eax -25046 3d/compare-eax-and 0/imm32/false -25047 74/jump-if-= break/disp8 -25048 (size-of-stream %ecx) # => eax -25049 eb/jump $size-of:end/disp8 -25050 } -25051 # if (!t->is-atom?) t = lookup(t->left) -25052 { -25053 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -25054 75/jump-if-!= break/disp8 -25055 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -25056 89/<- %ecx 0/r32/eax -25057 } -25058 # TODO: assert t->is-atom? -25059 (size-of-type-id *(ecx+4)) # Type-tree-value => eax -25060 $size-of:end: -25061 # . restore registers -25062 59/pop-to-ecx -25063 # . epilogue -25064 89/<- %esp 5/r32/ebp -25065 5d/pop-to-ebp -25066 c3/return -25067 -25068 size-of-deref: # v: (addr var) -> result/eax: int -25069 # . prologue -25070 55/push-ebp -25071 89/<- %ebp 4/r32/esp -25072 # . save registers -25073 51/push-ecx -25074 # var t/ecx: (addr type-tree) = lookup(v->type) -25075 8b/-> *(ebp+8) 1/r32/ecx -25076 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -25077 89/<- %ecx 0/r32/eax -25078 # TODO: assert(t is an addr) -25079 # t = lookup(t->right) -25080 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -25081 89/<- %ecx 0/r32/eax -25082 # if is-mu-array?(t) return size-of-array(t) -25083 { -25084 (is-mu-array? %ecx) # => eax -25085 3d/compare-eax-and 0/imm32/false -25086 74/jump-if-= break/disp8 -25087 (size-of-array %ecx) # => eax -25088 eb/jump $size-of-deref:end/disp8 -25089 } -25090 # if is-mu-stream?(t) return size-of-stream(t) -25091 { -25092 (is-mu-stream? %ecx) # => eax -25093 3d/compare-eax-and 0/imm32/false -25094 74/jump-if-= break/disp8 -25095 (size-of-stream %ecx) # => eax -25096 eb/jump $size-of-deref:end/disp8 -25097 } -25098 # if (!t->is-atom?) t = lookup(t->left) -25099 { -25100 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -25101 75/jump-if-!= break/disp8 -25102 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -25103 89/<- %ecx 0/r32/eax -25104 } -25105 # TODO: assert t->is-atom? -25106 (size-of-type-id *(ecx+4)) # Type-tree-value => eax -25107 $size-of-deref:end: -25108 # . restore registers -25109 59/pop-to-ecx -25110 # . epilogue -25111 89/<- %esp 5/r32/ebp -25112 5d/pop-to-ebp -25113 c3/return -25114 -25115 is-mu-array?: # t: (addr type-tree) -> result/eax: boolean -25116 # . prologue -25117 55/push-ebp -25118 89/<- %ebp 4/r32/esp -25119 # . save registers -25120 51/push-ecx -25121 # ecx = t -25122 8b/-> *(ebp+8) 1/r32/ecx -25123 # if t->is-atom?, return false -25124 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -25125 75/jump-if-!= $is-mu-array?:return-false/disp8 -25126 # if !t->left->is-atom?, return false -25127 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -25128 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -25129 74/jump-if-= $is-mu-array?:return-false/disp8 -25130 # return t->left->value == array -25131 81 7/subop/compare *(eax+4) 3/imm32/array-type-id # Type-tree-value -25132 0f 94/set-if-= %al -25133 81 4/subop/and %eax 0xff/imm32 -25134 eb/jump $is-mu-array?:end/disp8 -25135 $is-mu-array?:return-false: -25136 b8/copy-to-eax 0/imm32/false -25137 $is-mu-array?:end: -25138 # . restore registers -25139 59/pop-to-ecx -25140 # . epilogue -25141 89/<- %esp 5/r32/ebp -25142 5d/pop-to-ebp -25143 c3/return -25144 -25145 # size of a statically allocated array where the size is part of the type expression -25146 size-of-array: # a: (addr type-tree) -> result/eax: int -25147 # . prologue -25148 55/push-ebp -25149 89/<- %ebp 4/r32/esp -25150 # . save registers -25151 51/push-ecx -25152 52/push-edx -25153 # -25154 8b/-> *(ebp+8) 1/r32/ecx -25155 # TODO: assert that a->left is 'array' -25156 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -25157 89/<- %ecx 0/r32/eax -25158 # var elem-type/edx: type-id = a->right->left->value -25159 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -25160 8b/-> *(eax+4) 2/r32/edx # Type-tree-value -25161 # TODO: assert that a->right->right->left->value == size -25162 # var array-size/ecx: int = a->right->right->left->value-size -25163 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -25164 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -25165 8b/-> *(eax+8) 1/r32/ecx # Type-tree-value-size -25166 # return 4 + array-size * size-of(elem-type) -25167 (size-of-type-id-as-array-element %edx) # => eax -25168 f7 4/subop/multiply-into-edx-eax %ecx -25169 05/add-to-eax 4/imm32 # for array size -25170 # TODO: check edx for overflow -25171 $size-of-array:end: -25172 # . restore registers -25173 5a/pop-to-edx -25174 59/pop-to-ecx -25175 # . epilogue -25176 89/<- %esp 5/r32/ebp -25177 5d/pop-to-ebp -25178 c3/return -25179 -25180 is-mu-stream?: # t: (addr type-tree) -> result/eax: boolean -25181 # . prologue -25182 55/push-ebp -25183 89/<- %ebp 4/r32/esp -25184 # . save registers -25185 51/push-ecx -25186 # ecx = t -25187 8b/-> *(ebp+8) 1/r32/ecx -25188 # if t->is-atom?, return false -25189 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -25190 75/jump-if-!= $is-mu-stream?:return-false/disp8 -25191 # if !t->left->is-atom?, return false -25192 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -25193 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -25194 74/jump-if-= $is-mu-stream?:return-false/disp8 -25195 # return t->left->value == stream -25196 81 7/subop/compare *(eax+4) 0xb/imm32/stream-type-id # Type-tree-value -25197 0f 94/set-if-= %al -25198 81 4/subop/and %eax 0xff/imm32 -25199 eb/jump $is-mu-stream?:end/disp8 -25200 $is-mu-stream?:return-false: -25201 b8/copy-to-eax 0/imm32/false -25202 $is-mu-stream?:end: -25203 # . restore registers -25204 59/pop-to-ecx -25205 # . epilogue -25206 89/<- %esp 5/r32/ebp -25207 5d/pop-to-ebp -25208 c3/return -25209 -25210 # size of a statically allocated stream where the size is part of the type expression -25211 size-of-stream: # a: (addr type-tree) -> result/eax: int -25212 # . prologue -25213 55/push-ebp -25214 89/<- %ebp 4/r32/esp -25215 # -25216 (size-of-array *(ebp+8)) # assumes we ignore the actual type name 'array' in the type -25217 05/add-to-eax 8/imm32 # for read/write pointers -25218 $size-of-stream:end: -25219 # . epilogue -25220 89/<- %esp 5/r32/ebp -25221 5d/pop-to-ebp -25222 c3/return -25223 -25224 size-of-type-id: # t: type-id -> result/eax: int -25225 # . prologue -25226 55/push-ebp -25227 89/<- %ebp 4/r32/esp -25228 # . save registers -25229 51/push-ecx -25230 # var out/ecx: (handle typeinfo) -25231 68/push 0/imm32 -25232 68/push 0/imm32 -25233 89/<- %ecx 4/r32/esp -25234 # eax = t -25235 8b/-> *(ebp+8) 0/r32/eax -25236 # if t is a literal, return 0 -25237 3d/compare-eax-and 0/imm32 -25238 0f 84/jump-if-= $size-of-type-id:end/disp32 # eax changes type from type-id to int -25239 # if t is a byte, return 4 (because we don't really support non-multiples of 4) -25240 3d/compare-eax-and 8/imm32/byte -25241 { -25242 75/jump-if-!= break/disp8 -25243 b8/copy-to-eax 4/imm32 -25244 eb/jump $size-of-type-id:end/disp8 -25245 } -25246 # if t is a handle, return 8 -25247 3d/compare-eax-and 4/imm32/handle -25248 { -25249 75/jump-if-!= break/disp8 -25250 b8/copy-to-eax 8/imm32 -25251 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int -25252 } -25253 # if t is a slice, return 8 -25254 3d/compare-eax-and 0xc/imm32/slice -25255 { -25256 75/jump-if-!= break/disp8 -25257 b8/copy-to-eax 8/imm32 -25258 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int -25259 } -25260 # if t is a user-defined type, return its size -25261 # TODO: support non-atom type -25262 (find-typeinfo %eax %ecx) -25263 { -25264 81 7/subop/compare *ecx 0/imm32 -25265 74/jump-if-= break/disp8 -25266 $size-of-type-id:user-defined: -25267 (lookup *ecx *(ecx+4)) # => eax -25268 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes -25269 eb/jump $size-of-type-id:end/disp8 -25270 } -25271 # otherwise return the word size -25272 b8/copy-to-eax 4/imm32 -25273 $size-of-type-id:end: -25274 # . reclaim locals -25275 81 0/subop/add %esp 8/imm32 -25276 # . restore registers -25277 59/pop-to-ecx +24976 0f 84/jump-if-= $check-mu-allocate-stmt:error-invalid-type/disp32 +24977 # if target-type->right is an atom, abort +24978 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +24979 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +24980 0f 85/jump-if-!= $check-mu-allocate-stmt:error-invalid-type/disp32 +24981 # if target-type->right->left is not handle, abort +24982 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +24983 (is-simple-mu-type? %eax 4) # handle => eax +24984 3d/compare-eax-and 0/imm32/false +24985 0f 84/jump-if-= $check-mu-allocate-stmt:error-invalid-type/disp32 +24986 $check-mu-allocate-stmt:end: +24987 # . restore registers +24988 5f/pop-to-edi +24989 5e/pop-to-esi +24990 5b/pop-to-ebx +24991 58/pop-to-eax +24992 # . epilogue +24993 89/<- %esp 5/r32/ebp +24994 5d/pop-to-ebp +24995 c3/return +24996 +24997 $check-mu-allocate-stmt:error-incorrect-inouts: +24998 (write-buffered *(ebp+0x10) "fn ") +24999 8b/-> *(ebp+0xc) 0/r32/eax +25000 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25001 (write-buffered *(ebp+0x10) %eax) +25002 (write-buffered *(ebp+0x10) ": stmt 'allocate' must have a single inout\n") +25003 (flush *(ebp+0x10)) +25004 (stop *(ebp+0x14) 1) +25005 # never gets here +25006 +25007 $check-mu-allocate-stmt:error-too-many-outputs: +25008 (write-buffered *(ebp+0x10) "fn ") +25009 8b/-> *(ebp+0xc) 0/r32/eax +25010 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25011 (write-buffered *(ebp+0x10) %eax) +25012 (write-buffered *(ebp+0x10) ": stmt 'allocate' must not have any outputs\n") +25013 (flush *(ebp+0x10)) +25014 (stop *(ebp+0x14) 1) +25015 # never gets here +25016 +25017 $check-mu-allocate-stmt:error-invalid-type: +25018 (write-buffered *(ebp+0x10) "fn ") +25019 8b/-> *(ebp+0xc) 0/r32/eax +25020 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25021 (write-buffered *(ebp+0x10) %eax) +25022 (write-buffered *(ebp+0x10) ": stmt allocate: inout '") +25023 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +25024 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25025 (write-buffered *(ebp+0x10) %eax) +25026 (write-buffered *(ebp+0x10) "' must have type (addr handle ...)\n") +25027 (flush *(ebp+0x10)) +25028 (stop *(ebp+0x14) 1) +25029 # never gets here +25030 +25031 check-mu-populate-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +25032 # . prologue +25033 55/push-ebp +25034 89/<- %ebp 4/r32/esp +25035 # . save registers +25036 50/push-eax +25037 53/push-ebx +25038 56/push-esi +25039 57/push-edi +25040 # esi = stmt +25041 8b/-> *(ebp+8) 6/r32/esi +25042 $check-mu-populate-stmt:check-for-output: +25043 # if stmt->outputs abort +25044 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +25045 3d/compare-eax-and 0/imm32 +25046 0f 85/jump-if-!= $check-mu-populate-stmt:error-too-many-outputs/disp32 +25047 $check-mu-populate-stmt:get-target: +25048 # var target/edi: (addr stmt-var) = stmt->inouts +25049 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25050 89/<- %edi 0/r32/eax +25051 # zero inouts +25052 3d/compare-eax-and 0/imm32 +25053 0f 84/jump-if-= $check-mu-populate-stmt:error-incorrect-inouts/disp32 +25054 $check-mu-populate-stmt:get-length: +25055 # var length/esi: (addr stmt-var) = dest->next +25056 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +25057 89/<- %esi 0/r32/eax +25058 # 1 inout +25059 3d/compare-eax-and 0/imm32 +25060 0f 84/jump-if-= $check-mu-populate-stmt:error-incorrect-inouts/disp32 +25061 # > 2 inouts +25062 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +25063 3d/compare-eax-and 0/imm32 +25064 0f 85/jump-if-!= $check-mu-populate-stmt:error-incorrect-inouts/disp32 +25065 $check-mu-populate-stmt:check-target-type: +25066 # var target-type/ebx: (addr type-tree) = target->value->type +25067 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +25068 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +25069 89/<- %ebx 0/r32/eax +25070 $check-mu-populate-stmt:check-target-type-deref: +25071 # if (target->is-deref?) target-type = target-type->payload +25072 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +25073 3d/compare-eax-and 0/imm32/false +25074 { +25075 74/jump-if-= break/disp8 +25076 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +25077 # if target-type->right is null, target-type = target-type->left +25078 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +25079 { +25080 75/jump-if-!= break/disp8 +25081 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +25082 } +25083 89/<- %ebx 0/r32/eax +25084 } +25085 $check-mu-populate-stmt:check-target-type-addr: +25086 # if target-type is not addr, abort +25087 (is-mu-addr-type? %ebx) # => eax +25088 3d/compare-eax-and 0/imm32/false +25089 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 +25090 # if target-type->right is an atom, abort +25091 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +25092 89/<- %ebx 0/r32/eax +25093 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +25094 0f 85/jump-if-!= $check-mu-populate-stmt:error-invalid-target-type/disp32 +25095 $check-mu-populate-stmt:check-target-type-handle: +25096 # if target-type->right->left is not handle, abort +25097 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +25098 (is-simple-mu-type? %eax 4) # handle => eax +25099 3d/compare-eax-and 0/imm32/false +25100 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 +25101 # if target-type->right->right is an atom, abort +25102 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +25103 89/<- %ebx 0/r32/eax +25104 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +25105 0f 85/jump-if-!= $check-mu-populate-stmt:error-invalid-target-type/disp32 +25106 $check-mu-populate-stmt:check-target-type-array: +25107 # if target-type->right->right->left is not array, abort +25108 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +25109 (is-simple-mu-type? %eax 3) # array => eax +25110 3d/compare-eax-and 0/imm32/false +25111 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 +25112 $check-mu-populate-stmt:check-length-type: +25113 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +25114 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +25115 89/<- %ebx 0/r32/eax +25116 (is-simple-mu-type? %ebx 0) # literal => eax +25117 3d/compare-eax-and 0/imm32/false +25118 75/jump-if-!= $check-mu-populate-stmt:end/disp8 +25119 (is-simple-mu-type? %ebx 1) # int => eax +25120 3d/compare-eax-and 0/imm32/false +25121 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-length-type/disp32 +25122 $check-mu-populate-stmt:end: +25123 # . restore registers +25124 5f/pop-to-edi +25125 5e/pop-to-esi +25126 5b/pop-to-ebx +25127 58/pop-to-eax +25128 # . epilogue +25129 89/<- %esp 5/r32/ebp +25130 5d/pop-to-ebp +25131 c3/return +25132 +25133 $check-mu-populate-stmt:error-incorrect-inouts: +25134 (write-buffered *(ebp+0x10) "fn ") +25135 8b/-> *(ebp+0xc) 0/r32/eax +25136 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25137 (write-buffered *(ebp+0x10) %eax) +25138 (write-buffered *(ebp+0x10) ": stmt 'populate' must have two inouts\n") +25139 (flush *(ebp+0x10)) +25140 (stop *(ebp+0x14) 1) +25141 # never gets here +25142 +25143 $check-mu-populate-stmt:error-too-many-outputs: +25144 (write-buffered *(ebp+0x10) "fn ") +25145 8b/-> *(ebp+0xc) 0/r32/eax +25146 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25147 (write-buffered *(ebp+0x10) %eax) +25148 (write-buffered *(ebp+0x10) ": stmt 'populate' must not have any outputs\n") +25149 (flush *(ebp+0x10)) +25150 (stop *(ebp+0x14) 1) +25151 # never gets here +25152 +25153 $check-mu-populate-stmt:error-invalid-target-type: +25154 (write-buffered *(ebp+0x10) "fn ") +25155 8b/-> *(ebp+0xc) 0/r32/eax +25156 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25157 (write-buffered *(ebp+0x10) %eax) +25158 (write-buffered *(ebp+0x10) ": stmt populate: first inout '") +25159 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +25160 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25161 (write-buffered *(ebp+0x10) %eax) +25162 (write-buffered *(ebp+0x10) "' must have type (addr handle array ...)\n") +25163 (flush *(ebp+0x10)) +25164 (stop *(ebp+0x14) 1) +25165 # never gets here +25166 +25167 $check-mu-populate-stmt:error-invalid-length-type: +25168 (write-buffered *(ebp+0x10) "fn ") +25169 8b/-> *(ebp+0xc) 0/r32/eax +25170 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25171 (write-buffered *(ebp+0x10) %eax) +25172 (write-buffered *(ebp+0x10) ": stmt populate: second inout '") +25173 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +25174 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25175 (write-buffered *(ebp+0x10) %eax) +25176 (write-buffered *(ebp+0x10) "' must be an int\n") +25177 (flush *(ebp+0x10)) +25178 (stop *(ebp+0x14) 1) +25179 # never gets here +25180 +25181 check-mu-populate-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +25182 # . prologue +25183 55/push-ebp +25184 89/<- %ebp 4/r32/esp +25185 # . save registers +25186 50/push-eax +25187 53/push-ebx +25188 56/push-esi +25189 57/push-edi +25190 # esi = stmt +25191 8b/-> *(ebp+8) 6/r32/esi +25192 $check-mu-populate-stream-stmt:check-for-output: +25193 # if stmt->outputs abort +25194 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +25195 3d/compare-eax-and 0/imm32 +25196 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-too-many-outputs/disp32 +25197 $check-mu-populate-stream-stmt:get-target: +25198 # var target/edi: (addr stmt-var) = stmt->inouts +25199 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25200 89/<- %edi 0/r32/eax +25201 # zero inouts +25202 3d/compare-eax-and 0/imm32 +25203 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-incorrect-inouts/disp32 +25204 $check-mu-populate-stream-stmt:get-length: +25205 # var length/esi: (addr stmt-var) = dest->next +25206 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +25207 89/<- %esi 0/r32/eax +25208 # 1 inout +25209 3d/compare-eax-and 0/imm32 +25210 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-incorrect-inouts/disp32 +25211 # > 2 inouts +25212 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +25213 3d/compare-eax-and 0/imm32 +25214 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-incorrect-inouts/disp32 +25215 $check-mu-populate-stream-stmt:check-target-type: +25216 # var target-type/ebx: (addr type-tree) = target->value->type +25217 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +25218 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +25219 89/<- %ebx 0/r32/eax +25220 $check-mu-populate-stream-stmt:check-target-type-deref: +25221 # if (target->is-deref?) target-type = target-type->payload +25222 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +25223 3d/compare-eax-and 0/imm32/false +25224 { +25225 74/jump-if-= break/disp8 +25226 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +25227 # if target-type->right is null, target-type = target-type->left +25228 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +25229 { +25230 75/jump-if-!= break/disp8 +25231 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +25232 } +25233 89/<- %ebx 0/r32/eax +25234 } +25235 $check-mu-populate-stream-stmt:check-target-type-addr: +25236 # if target-type is not addr, abort +25237 (is-mu-addr-type? %ebx) # => eax +25238 3d/compare-eax-and 0/imm32/false +25239 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 +25240 # if target-type->right is an atom, abort +25241 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +25242 89/<- %ebx 0/r32/eax +25243 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +25244 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 +25245 $check-mu-populate-stream-stmt:check-target-type-handle: +25246 # if target-type->right->left is not handle, abort +25247 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +25248 (is-simple-mu-type? %eax 4) # handle => eax +25249 3d/compare-eax-and 0/imm32/false +25250 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 +25251 # if target-type->right->right is an atom, abort +25252 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +25253 89/<- %ebx 0/r32/eax +25254 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +25255 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 +25256 $check-mu-populate-stream-stmt:check-target-type-stream: +25257 # if target-type->right->right->left is not stream, abort +25258 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +25259 (is-simple-mu-type? %eax 0xb) # stream => eax +25260 3d/compare-eax-and 0/imm32/false +25261 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 +25262 $check-mu-populate-stream-stmt:check-length-type: +25263 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +25264 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +25265 89/<- %ebx 0/r32/eax +25266 (is-simple-mu-type? %ebx 0) # literal => eax +25267 3d/compare-eax-and 0/imm32/false +25268 75/jump-if-!= $check-mu-populate-stream-stmt:end/disp8 +25269 (is-simple-mu-type? %ebx 1) # int => eax +25270 3d/compare-eax-and 0/imm32/false +25271 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-length-type/disp32 +25272 $check-mu-populate-stream-stmt:end: +25273 # . restore registers +25274 5f/pop-to-edi +25275 5e/pop-to-esi +25276 5b/pop-to-ebx +25277 58/pop-to-eax 25278 # . epilogue 25279 89/<- %esp 5/r32/ebp 25280 5d/pop-to-ebp 25281 c3/return 25282 -25283 # Minor violation of our type system since it returns an addr. But we could -25284 # replace it with a handle some time. -25285 # Returns null if t is an atom. -25286 type-tail: # t: (addr type-tree) -> out/eax: (addr type-tree) -25287 # . prologue -25288 55/push-ebp -25289 89/<- %ebp 4/r32/esp -25290 # . save registers -25291 51/push-ecx -25292 # eax = 0 -25293 b8/copy-to-eax 0/imm32 -25294 # ecx = t -25295 8b/-> *(ebp+8) 1/r32/ecx -25296 $type-tail:check-atom: -25297 # if t->is-atom? return 0 -25298 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -25299 0f 85/jump-if-!= $type-tail:end/disp32 -25300 # var tail = t->right -25301 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -25302 89/<- %ecx 0/r32/eax -25303 $type-tail:check-singleton: -25304 # if (tail->right == 0) return tail->left -25305 { -25306 81 7/subop/compare *(ecx+0xc) 0/imm32 # Type-tree-right -25307 75/jump-if-!= break/disp8 -25308 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -25309 e9/jump $type-tail:end/disp32 -25310 } -25311 # if tail->right->left is an array-capacity, return tail->left -25312 { -25313 $type-tail:check-array-capacity: -25314 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -25315 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -25316 75/jump-if-!= break/disp8 -25317 $type-tail:check-array-capacity-1: -25318 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -25319 3d/compare-eax-and 0/imm32 -25320 74/jump-if-= break/disp8 -25321 $type-tail:check-array-capacity-2: -25322 (is-simple-mu-type? %eax 9) # array-capacity => eax -25323 3d/compare-eax-and 0/imm32/false -25324 74/jump-if-= break/disp8 -25325 $type-tail:array-capacity: -25326 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -25327 eb/jump $type-tail:end/disp8 -25328 } -25329 $type-tail:check-compound-left: -25330 # if !tail->left->is-atom? return tail->left -25331 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -25332 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -25333 74/jump-if-= $type-tail:end/disp8 -25334 $type-tail:return-tail: -25335 # return tail -25336 89/<- %eax 1/r32/ecx -25337 $type-tail:end: -25338 # . restore registers -25339 59/pop-to-ecx -25340 # . epilogue -25341 89/<- %esp 5/r32/ebp -25342 5d/pop-to-ebp -25343 c3/return -25344 -25345 type-equal?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean -25346 # . prologue -25347 55/push-ebp -25348 89/<- %ebp 4/r32/esp -25349 # . save registers -25350 51/push-ecx -25351 52/push-edx -25352 53/push-ebx -25353 # ecx = a -25354 8b/-> *(ebp+8) 1/r32/ecx -25355 # edx = b -25356 8b/-> *(ebp+0xc) 2/r32/edx -25357 $type-equal?:compare-addr: -25358 # if (a == b) return true -25359 8b/-> %ecx 0/r32/eax # Var-type -25360 39/compare %edx 0/r32/eax # Var-type -25361 b8/copy-to-eax 1/imm32/true -25362 0f 84/jump-if-= $type-equal?:end/disp32 -25363 $type-equal?:compare-null-a: -25364 # if (a == 0) return false -25365 b8/copy-to-eax 0/imm32/false -25366 81 7/subop/compare %ecx 0/imm32 -25367 0f 84/jump-if-= $type-equal?:end/disp32 -25368 $type-equal?:compare-null-b: -25369 # if (b == 0) return false -25370 81 7/subop/compare %edx 0/imm32 -25371 0f 84/jump-if-= $type-equal?:end/disp32 -25372 $type-equal?:compare-atom-state: -25373 # if (a->is-atom? != b->is-atom?) return false -25374 8b/-> *ecx 3/r32/ebx # Type-tree-is-atom -25375 39/compare *edx 3/r32/ebx # Type-tree-is-atom -25376 b8/copy-to-eax 0/imm32/false -25377 0f 85/jump-if-!= $type-equal?:end/disp32 -25378 # if a->is-atom? return (a->value == b->value) -25379 { -25380 $type-equal?:check-atom: -25381 81 7/subop/compare %ebx 0/imm32/false -25382 74/jump-if-= break/disp8 -25383 $type-equal?:is-atom: -25384 8b/-> *(ecx+4) 0/r32/eax # Type-tree-value -25385 39/compare *(edx+4) 0/r32/eax # Type-tree-value -25386 0f 94/set-if-= %al -25387 81 4/subop/and %eax 0xff/imm32 -25388 e9/jump $type-equal?:end/disp32 -25389 } -25390 $type-equal?:check-left: -25391 # if (!type-equal?(a->left, b->left)) return false -25392 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -25393 89/<- %ebx 0/r32/eax -25394 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -25395 (type-equal? %eax %ebx) # => eax -25396 3d/compare-eax-and 0/imm32/false -25397 74/jump-if-= $type-equal?:end/disp8 -25398 $type-equal?:check-right: -25399 # return type-equal?(a->right, b->right) -25400 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -25401 89/<- %ebx 0/r32/eax -25402 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax -25403 (type-equal? %eax %ebx) # => eax -25404 $type-equal?:end: -25405 # . restore registers -25406 5b/pop-to-ebx -25407 5a/pop-to-edx -25408 59/pop-to-ecx -25409 # . epilogue -25410 89/<- %esp 5/r32/ebp -25411 5d/pop-to-ebp -25412 c3/return -25413 -25414 ####################################################### -25415 # Code-generation -25416 ####################################################### -25417 -25418 == data -25419 -25420 # Global state added to each var record when performing code-generation. -25421 Curr-local-stack-offset: # (addr int) -25422 0/imm32 -25423 -25424 == code -25425 -25426 # We may not need to pass err/ed everywhere here. I think they're relics of Mu -25427 # getting type checks later in life. -25428 # But we do need them for runtime checks, particularly array index bounds checks. -25429 # So perhaps it's not worth taking them out. They're a safety net. -25430 -25431 emit-subx: # out: (addr buffered-file), 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 # var curr/eax: (addr function) = *Program->functions -25438 (lookup *_Program-functions *_Program-functions->payload) # => eax -25439 { -25440 # if (curr == null) break -25441 3d/compare-eax-and 0/imm32 -25442 0f 84/jump-if-= break/disp32 -25443 (emit-subx-function *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) -25444 # curr = lookup(curr->next) -25445 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax -25446 e9/jump loop/disp32 -25447 } -25448 $emit-subx:end: -25449 # . restore registers -25450 58/pop-to-eax -25451 # . epilogue -25452 89/<- %esp 5/r32/ebp -25453 5d/pop-to-ebp -25454 c3/return -25455 -25456 emit-subx-function: # out: (addr buffered-file), f: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -25457 # . prologue -25458 55/push-ebp -25459 89/<- %ebp 4/r32/esp -25460 # some preprocessing -25461 (populate-mu-type-offsets-in-inouts *(ebp+0xc)) -25462 # . save registers -25463 50/push-eax -25464 51/push-ecx -25465 52/push-edx -25466 # initialize some global state -25467 c7 0/subop/copy *Curr-block-depth 1/imm32 # Important: keep this in sync with the parse phase -25468 c7 0/subop/copy *Curr-local-stack-offset 0/imm32 -25469 # ecx = f -25470 8b/-> *(ebp+0xc) 1/r32/ecx -25471 # var vars/edx: (stack (addr var) 256) -25472 81 5/subop/subtract %esp 0xc00/imm32 -25473 68/push 0xc00/imm32/size -25474 68/push 0/imm32/top -25475 89/<- %edx 4/r32/esp -25476 # var name/eax: (addr array byte) = lookup(f->name) -25477 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax -25478 # -25479 (write-buffered *(ebp+8) %eax) -25480 (write-buffered *(ebp+8) ":\n") -25481 (emit-subx-prologue *(ebp+8)) -25482 # var body/eax: (addr block) = lookup(f->body) -25483 (lookup *(ecx+0x18) *(ecx+0x1c)) # Function-body Function-body => eax -25484 # -25485 (emit-subx-block *(ebp+8) %eax %edx *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -25486 (emit-subx-epilogue *(ebp+8)) -25487 # TODO: validate that *Curr-block-depth and *Curr-local-stack-offset have -25488 # been cleaned up -25489 $emit-subx-function:end: -25490 # . reclaim locals -25491 81 0/subop/add %esp 0xc08/imm32 -25492 # . restore registers -25493 5a/pop-to-edx -25494 59/pop-to-ecx -25495 58/pop-to-eax -25496 # . epilogue -25497 89/<- %esp 5/r32/ebp -25498 5d/pop-to-ebp -25499 c3/return -25500 -25501 populate-mu-type-offsets-in-inouts: # f: (addr function) -25502 # . prologue -25503 55/push-ebp -25504 89/<- %ebp 4/r32/esp -25505 # . save registers -25506 50/push-eax -25507 51/push-ecx -25508 52/push-edx -25509 53/push-ebx -25510 57/push-edi -25511 # var next-offset/edx: int = 8 -25512 ba/copy-to-edx 8/imm32 -25513 # var curr/ecx: (addr list var) = lookup(f->inouts) -25514 8b/-> *(ebp+8) 1/r32/ecx -25515 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax -25516 89/<- %ecx 0/r32/eax -25517 { -25518 $populate-mu-type-offsets-in-inouts:loop: -25519 81 7/subop/compare %ecx 0/imm32 -25520 74/jump-if-= break/disp8 -25521 # var v/ebx: (addr var) = lookup(curr->value) -25522 (lookup *ecx *(ecx+4)) # List-value List-value => eax -25523 89/<- %ebx 0/r32/eax -25524 #? (lookup *ebx *(ebx+4)) -25525 #? (write-buffered Stderr "setting offset of fn inout ") -25526 #? (write-buffered Stderr %eax) -25527 #? (write-buffered Stderr "@") -25528 #? (write-int32-hex-buffered Stderr %ebx) -25529 #? (write-buffered Stderr " to ") -25530 #? (write-int32-hex-buffered Stderr %edx) -25531 #? (write-buffered Stderr Newline) -25532 #? (flush Stderr) -25533 # v->offset = next-offset -25534 89/<- *(ebx+0x14) 2/r32/edx # Var-offset -25535 # next-offset += size-of(v) -25536 (size-of %ebx) # => eax -25537 01/add-to %edx 0/r32/eax -25538 # curr = lookup(curr->next) -25539 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -25540 89/<- %ecx 0/r32/eax -25541 # -25542 eb/jump loop/disp8 -25543 } -25544 $populate-mu-type-offsets-in-inouts:end: -25545 # . restore registers -25546 5f/pop-to-edi -25547 5b/pop-to-ebx -25548 5a/pop-to-edx -25549 59/pop-to-ecx -25550 58/pop-to-eax -25551 # . epilogue -25552 89/<- %esp 5/r32/ebp -25553 5d/pop-to-ebp -25554 c3/return -25555 -25556 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) -25557 # . prologue -25558 55/push-ebp -25559 89/<- %ebp 4/r32/esp -25560 # . save registers -25561 50/push-eax -25562 51/push-ecx -25563 53/push-ebx -25564 56/push-esi -25565 # esi = stmts -25566 8b/-> *(ebp+0xc) 6/r32/esi -25567 # -25568 { -25569 $emit-subx-stmt-list:loop: -25570 81 7/subop/compare %esi 0/imm32 -25571 0f 84/jump-if-= break/disp32 -25572 # var curr-stmt/ecx: (addr stmt) = lookup(stmts->value) -25573 (lookup *esi *(esi+4)) # List-value List-value => eax -25574 89/<- %ecx 0/r32/eax -25575 { -25576 $emit-subx-stmt-list:check-for-block: -25577 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag -25578 75/jump-if-!= break/disp8 -25579 $emit-subx-stmt-list:block: -25580 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -25581 } -25582 { -25583 $emit-subx-stmt-list:check-for-stmt: -25584 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag -25585 0f 85/jump-if-!= break/disp32 -25586 $emit-subx-stmt-list:stmt1: -25587 { -25588 (is-mu-branch? %ecx) # => eax -25589 3d/compare-eax-and 0/imm32/false -25590 0f 84/jump-if-= break/disp32 -25591 $emit-subx-stmt-list:branch-stmt: -25592 +-- 25 lines: # unconditional return -------------------------------------------------------------------------------------------------------------------------------------------------- -25617 +-- 27 lines: # unconditional loops --------------------------------------------------------------------------------------------------------------------------------------------------- -25644 +-- 16 lines: # unconditional breaks -------------------------------------------------------------------------------------------------------------------------------------------------- -25660 +-- 38 lines: # simple conditional branches without a target -------------------------------------------------------------------------------------------------------------------------- -25698 +-- 19 lines: # conditional branches with an explicit target -------------------------------------------------------------------------------------------------------------------------- -25717 } -25718 $emit-subx-stmt-list:1-to-1: -25719 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -25720 e9/jump $emit-subx-stmt-list:continue/disp32 -25721 } -25722 { -25723 $emit-subx-stmt-list:check-for-var-def: -25724 81 7/subop/compare *ecx 2/imm32/var-def # Stmt-tag -25725 75/jump-if-!= break/disp8 -25726 $emit-subx-stmt-list:var-def: -25727 (emit-subx-var-def *(ebp+8) %ecx) -25728 (push *(ebp+0x10) *(ecx+4)) # Vardef-var -25729 (push *(ebp+0x10) *(ecx+8)) # Vardef-var -25730 (push *(ebp+0x10) 0) # Live-var-register-spilled = 0 for vars on the stack -25731 # -25732 eb/jump $emit-subx-stmt-list:continue/disp8 -25733 } -25734 { -25735 $emit-subx-stmt-list:check-for-reg-var-def: -25736 81 7/subop/compare *ecx 3/imm32/reg-var-def # Stmt-tag -25737 0f 85/jump-if-!= break/disp32 -25738 $emit-subx-stmt-list:reg-var-def: -25739 # TODO: ensure that there's exactly one output -25740 (push-output-and-maybe-emit-spill *(ebp+8) %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -25741 # emit the instruction as usual -25742 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -25743 # -25744 eb/jump $emit-subx-stmt-list:continue/disp8 -25745 } -25746 $emit-subx-stmt-list:continue: -25747 # TODO: raise an error on unrecognized Stmt-tag -25748 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax -25749 89/<- %esi 0/r32/eax -25750 e9/jump loop/disp32 -25751 } -25752 $emit-subx-stmt-list:emit-cleanup: -25753 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth) -25754 $emit-subx-stmt-list:clean-up: -25755 (clean-up-stack-offset-state *(ebp+0x10) *Curr-block-depth) -25756 (clean-up-blocks *(ebp+0x10) *Curr-block-depth *(ebp+0x14)) -25757 $emit-subx-stmt-list:end: -25758 # . restore registers -25759 5e/pop-to-esi -25760 5b/pop-to-ebx -25761 59/pop-to-ecx -25762 58/pop-to-eax -25763 # . epilogue -25764 89/<- %esp 5/r32/ebp -25765 5d/pop-to-ebp -25766 c3/return -25767 -25768 # 'later-stmts' includes 'stmt', but will behave the same even without it; reg-var-def stmts are guaranteed not to write to function outputs. -25769 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) -25770 # . prologue -25771 55/push-ebp -25772 89/<- %ebp 4/r32/esp -25773 # . save registers -25774 50/push-eax -25775 51/push-ecx -25776 52/push-edx -25777 # ecx = stmt -25778 8b/-> *(ebp+0xc) 1/r32/ecx -25779 # var sv/eax: (addr stmt-var) = lookup(curr-stmt->outputs) -25780 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax -25781 # TODO: assert !sv->is-deref? -25782 # var v/ecx: (addr var) = lookup(sv->value) -25783 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25784 89/<- %ecx 0/r32/eax -25785 # v->block-depth = *Curr-block-depth -25786 8b/-> *Curr-block-depth 0/r32/eax -25787 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth -25788 #? (write-buffered Stderr "var ") -25789 #? (lookup *ecx *(ecx+4)) -25790 #? (write-buffered Stderr %eax) -25791 #? (write-buffered Stderr " at depth ") -25792 #? (write-int32-hex-buffered Stderr *(ecx+0x10)) -25793 #? (write-buffered Stderr Newline) -25794 #? (flush Stderr) -25795 # ensure that v is in a register -25796 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -25797 0f 84/jump-if-= $push-output-and-maybe-emit-spill:abort/disp32 -25798 # var emit-spill?/edx: boolean = not-yet-spilled-this-block? && will-not-write-some-register?(fn) -25799 (not-yet-spilled-this-block? %ecx *(ebp+0x10)) # => eax -25800 89/<- %edx 0/r32/eax -25801 3d/compare-eax-and 0/imm32/false -25802 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 -25803 (will-not-write-some-register? %ecx *(ebp+0x14) *(ebp+0x18)) # => eax -25804 89/<- %edx 0/r32/eax -25805 # check emit-spill? -25806 3d/compare-eax-and 0/imm32/false -25807 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 -25808 # TODO: assert(size-of(output) == 4) -25809 # *Curr-local-stack-offset -= 4 -25810 81 5/subop/subtract *Curr-local-stack-offset 4/imm32 -25811 # emit spill -25812 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -25813 (emit-push-register *(ebp+8) %eax) -25814 $push-output-and-maybe-emit-spill:push: -25815 8b/-> *(ebp+0xc) 1/r32/ecx -25816 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax -25817 # push(vars, {sv->value, emit-spill?}) -25818 (push *(ebp+0x10) *eax) # Stmt-var-value -25819 (push *(ebp+0x10) *(eax+4)) # Stmt-var-value -25820 (push *(ebp+0x10) %edx) -25821 $push-output-and-maybe-emit-spill:end: -25822 # . restore registers -25823 5a/pop-to-edx -25824 59/pop-to-ecx -25825 58/pop-to-eax -25826 # . epilogue -25827 89/<- %esp 5/r32/ebp -25828 5d/pop-to-ebp -25829 c3/return -25830 -25831 $push-output-and-maybe-emit-spill:abort: -25832 # error("var '" var->name "' initialized from an instruction must live in a register\n") -25833 (write-buffered *(ebp+0x1c) "var '") -25834 (write-buffered *(ebp+0x1c) *eax) # Var-name -25835 (write-buffered *(ebp+0x1c) "' initialized from an instruction must live in a register\n") -25836 (flush *(ebp+0x1c)) -25837 (stop *(ebp+0x20) 1) -25838 # never gets here -25839 -25840 emit-subx-cleanup-and-unconditional-nonlocal-branch: # out: (addr buffered-file), stmt: (addr stmt1), vars: (addr stack live-var) -25841 # . prologue -25842 55/push-ebp -25843 89/<- %ebp 4/r32/esp -25844 # . save registers -25845 50/push-eax -25846 51/push-ecx -25847 # ecx = stmt -25848 8b/-> *(ebp+0xc) 1/r32/ecx -25849 # var target/eax: (addr array byte) = curr-stmt->inouts->value->name -25850 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25851 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25852 (lookup *eax *(eax+4)) # Var-name Var-name => eax -25853 # clean up until target block -25854 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %eax) -25855 # emit jump to target block -25856 (emit-indent *(ebp+8) *Curr-block-depth) -25857 (write-buffered *(ebp+8) "e9/jump ") -25858 (write-buffered *(ebp+8) %eax) -25859 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -25860 (string-starts-with? %eax "break") -25861 3d/compare-eax-and 0/imm32/false -25862 { -25863 74/jump-if-= break/disp8 -25864 (write-buffered *(ebp+8) ":break/disp32\n") -25865 eb/jump $emit-subx-cleanup-and-unconditional-nonlocal-branch:end/disp8 -25866 } -25867 (write-buffered *(ebp+8) ":loop/disp32\n") -25868 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end: -25869 # . restore registers -25870 59/pop-to-ecx -25871 58/pop-to-eax -25872 # . epilogue -25873 89/<- %esp 5/r32/ebp -25874 5d/pop-to-ebp -25875 c3/return -25876 -25877 emit-outputs: # out: (addr buffered-file), return-stmt: (addr stmt1), fn: (addr function) -25878 # pseudocode: -25879 # for every inout, output in return-stmt, fn->outputs -25880 # if inout is a literal -25881 # c7 0/subop/copy %output inout/imm32 -25882 # otherwise -25883 # 8b/-> inout %output -25884 # -25885 # . prologue -25886 55/push-ebp -25887 89/<- %ebp 4/r32/esp -25888 # . save registers -25889 50/push-eax -25890 51/push-ecx -25891 56/push-esi -25892 57/push-edi -25893 # var curr-inout/esi: (addr stmt-var) = return-stmt->inouts -25894 8b/-> *(ebp+0xc) 0/r32/eax -25895 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25896 89/<- %esi 0/r32/eax -25897 # var curr-output/edi: (addr list var) = fn->outputs -25898 8b/-> *(ebp+0x10) 0/r32/eax -25899 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax -25900 89/<- %edi 0/r32/eax -25901 { -25902 $emit-outputs:loop: -25903 81 7/subop/compare %esi 0/imm32 -25904 0f 84/jump-if-= break/disp32 -25905 # emit copy to output register -25906 # var curr-var/ecx = lookup(curr-inout->value) -25907 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -25908 89/<- %ecx 0/r32/eax -25909 # if curr-var is a literal, emit copy of a literal to the output -25910 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -25911 (is-simple-mu-type? %eax 0) # literal => eax -25912 { -25913 3d/compare-eax-and 0/imm32/false -25914 0f 84/jump-if-= break/disp32 -25915 (emit-indent *(ebp+8) *Curr-block-depth) -25916 (write-buffered *(ebp+8) "c7 0/subop/copy %") -25917 (lookup *edi *(edi+4)) # List-value List-value => eax -25918 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -25919 (write-buffered *(ebp+8) %eax) -25920 (write-buffered *(ebp+8) " ") -25921 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -25922 (write-buffered *(ebp+8) %eax) -25923 (write-buffered *(ebp+8) "/imm32\n") -25924 e9/jump $emit-outputs:continue/disp32 -25925 } -25926 # if the non-literal is a register starting with "x", emit a floating-point copy -25927 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -25928 { -25929 3d/compare-eax-and 0/imm32 -25930 0f 84/jump-if-= break/disp32 -25931 8a/copy-byte *(eax+4) 0/r32/AL -25932 81 4/subop/and %eax 0xff/imm32 -25933 3d/compare-eax-and 0x78/imm32/x -25934 0f 85/jump-if-!= break/disp32 -25935 (emit-indent *(ebp+8) *Curr-block-depth) -25936 (write-buffered *(ebp+8) "f3 0f 10/->") -25937 (emit-subx-var-as-rm32 *(ebp+8) %esi) -25938 (write-buffered *(ebp+8) " ") -25939 (lookup *edi *(edi+4)) # List-value List-value => eax -25940 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -25941 (get Mu-registers %eax 0xc "Mu-registers") # => eax -25942 (write-int32-hex-buffered *(ebp+8) *eax) -25943 (write-buffered *(ebp+8) "/x32\n") -25944 e9/jump $emit-outputs:continue/disp32 -25945 } -25946 # otherwise emit an integer copy -25947 (emit-indent *(ebp+8) *Curr-block-depth) -25948 (write-buffered *(ebp+8) "8b/->") -25949 (emit-subx-var-as-rm32 *(ebp+8) %esi) -25950 (write-buffered *(ebp+8) " ") -25951 (lookup *edi *(edi+4)) # List-value List-value => eax -25952 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -25953 (get Mu-registers %eax 0xc "Mu-registers") # => eax -25954 (write-int32-hex-buffered *(ebp+8) *eax) -25955 (write-buffered *(ebp+8) "/r32\n") -25956 $emit-outputs:continue: -25957 # curr-inout = curr-inout->next -25958 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -25959 89/<- %esi 0/r32/eax -25960 # curr-output = curr-output->next -25961 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -25962 89/<- %edi 0/r32/eax -25963 # -25964 e9/jump loop/disp32 -25965 } -25966 $emit-outputs:end: -25967 # . restore registers -25968 5f/pop-to-edi -25969 5e/pop-to-esi -25970 59/pop-to-ecx -25971 58/pop-to-eax -25972 # . epilogue -25973 89/<- %esp 5/r32/ebp -25974 5d/pop-to-ebp -25975 c3/return -25976 -25977 is-mu-branch?: # stmt: (addr stmt1) -> result/eax: boolean -25978 # . prologue -25979 55/push-ebp -25980 89/<- %ebp 4/r32/esp -25981 # . save registers -25982 51/push-ecx -25983 # ecx = lookup(stmt->operation) -25984 8b/-> *(ebp+8) 1/r32/ecx -25985 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -25986 89/<- %ecx 0/r32/eax -25987 # if (stmt->operation starts with "loop") return true -25988 (string-starts-with? %ecx "loop") # => eax -25989 3d/compare-eax-and 0/imm32/false -25990 75/jump-if-not-equal $is-mu-branch?:end/disp8 -25991 # if (stmt->operation starts with "break") return true -25992 (string-starts-with? %ecx "break") # => eax -25993 3d/compare-eax-and 0/imm32/false -25994 75/jump-if-not-equal $is-mu-branch?:end/disp8 -25995 # otherwise return (stmt->operation starts with "return") -25996 (string-starts-with? %ecx "return") # => eax -25997 $is-mu-branch?:end: -25998 # . restore registers -25999 59/pop-to-ecx -26000 # . epilogue -26001 89/<- %esp 5/r32/ebp -26002 5d/pop-to-ebp -26003 c3/return -26004 -26005 emit-reverse-break: # out: (addr buffered-file), stmt: (addr stmt1) -26006 # . prologue -26007 55/push-ebp -26008 89/<- %ebp 4/r32/esp -26009 # . save registers -26010 50/push-eax -26011 # eax = stmt -26012 8b/-> *(ebp+0xc) 0/r32/eax -26013 # -26014 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -26015 (get Reverse-branch %eax 0x10 "reverse-branch: ") # => eax: (addr handle array byte) -26016 (emit-indent *(ebp+8) *Curr-block-depth) -26017 (lookup *eax *(eax+4)) # => eax -26018 (write-buffered *(ebp+8) %eax) -26019 (write-buffered *(ebp+8) " break/disp32\n") -26020 $emit-reverse-break:end: -26021 # . restore registers -26022 58/pop-to-eax -26023 # . epilogue -26024 89/<- %esp 5/r32/ebp -26025 5d/pop-to-ebp -26026 c3/return -26027 -26028 == data -26029 -26030 # Table from Mu branch instructions to the reverse SubX opcodes for them. -26031 Reverse-branch: # (table (handle array byte) (handle array byte)) -26032 # a table is a stream -26033 0x1c0/imm32/write -26034 0/imm32/read -26035 0x1c0/imm32/size -26036 # data -26037 0x11/imm32/alloc-id _string-break-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 -26038 0x11/imm32/alloc-id _string-loop-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 -26039 0x11/imm32/alloc-id _string-break-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 -26040 0x11/imm32/alloc-id _string-loop-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 -26041 0x11/imm32/alloc-id _string-break-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 -26042 0x11/imm32/alloc-id _string-loop-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 -26043 0x11/imm32/alloc-id _string-break-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 -26044 0x11/imm32/alloc-id _string-loop-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 -26045 0x11/imm32/alloc-id _string-break-if-<=/imm32 0x11/imm32/alloc-id _string_0f_8f_jump_label/imm32 -26046 0x11/imm32/alloc-id _string-loop-if-<=/imm32 0x11/imm32/alloc-id _string_0f_8f_jump_label/imm32 -26047 0x11/imm32/alloc-id _string-break-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 -26048 0x11/imm32/alloc-id _string-loop-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 -26049 0x11/imm32/alloc-id _string-break-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 -26050 0x11/imm32/alloc-id _string-loop-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 -26051 0x11/imm32/alloc-id _string-break-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 -26052 0x11/imm32/alloc-id _string-loop-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 -26053 0x11/imm32/alloc-id _string-break-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 -26054 0x11/imm32/alloc-id _string-loop-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 -26055 0x11/imm32/alloc-id _string-break-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 -26056 0x11/imm32/alloc-id _string-loop-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 -26057 0x11/imm32/alloc-id _string-break-if-float</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 -26058 0x11/imm32/alloc-id _string-loop-if-float</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 -26059 0x11/imm32/alloc-id _string-break-if-float>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 -26060 0x11/imm32/alloc-id _string-loop-if-float>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 -26061 0x11/imm32/alloc-id _string-break-if-float<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 -26062 0x11/imm32/alloc-id _string-loop-if-float<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 -26063 0x11/imm32/alloc-id _string-break-if-float>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 -26064 0x11/imm32/alloc-id _string-loop-if-float>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 -26065 -26066 == code -26067 -26068 emit-unconditional-jump-to-depth: # out: (addr buffered-file), vars: (addr stack live-var), depth: int, label-suffix: (addr array byte) -26069 # . prologue -26070 55/push-ebp -26071 89/<- %ebp 4/r32/esp -26072 # . save registers -26073 50/push-eax -26074 51/push-ecx -26075 52/push-edx -26076 53/push-ebx -26077 56/push-esi -26078 # ecx = vars -26079 8b/-> *(ebp+0xc) 1/r32/ecx -26080 # var eax: int = vars->top -26081 8b/-> *ecx 0/r32/eax -26082 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] -26083 8d/copy-address *(ecx+eax-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size -26084 # var min/ecx: (addr handle var) = vars->data -26085 8d/copy-address *(ecx+8) 1/r32/ecx -26086 # edx = depth -26087 8b/-> *(ebp+0x10) 2/r32/edx -26088 { -26089 $emit-unconditional-jump-to-depth:loop: -26090 # if (curr < min) break -26091 39/compare %esi 1/r32/ecx -26092 0f 82/jump-if-addr< break/disp32 -26093 # var v/ebx: (addr var) = lookup(*curr) -26094 (lookup *esi *(esi+4)) # => eax -26095 89/<- %ebx 0/r32/eax -26096 # if (v->block-depth < until-block-depth) break -26097 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth -26098 0f 8c/jump-if-< break/disp32 +25283 $check-mu-populate-stream-stmt:error-incorrect-inouts: +25284 (write-buffered *(ebp+0x10) "fn ") +25285 8b/-> *(ebp+0xc) 0/r32/eax +25286 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25287 (write-buffered *(ebp+0x10) %eax) +25288 (write-buffered *(ebp+0x10) ": stmt 'populate-stream' must have two inouts\n") +25289 (flush *(ebp+0x10)) +25290 (stop *(ebp+0x14) 1) +25291 # never gets here +25292 +25293 $check-mu-populate-stream-stmt:error-too-many-outputs: +25294 (write-buffered *(ebp+0x10) "fn ") +25295 8b/-> *(ebp+0xc) 0/r32/eax +25296 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25297 (write-buffered *(ebp+0x10) %eax) +25298 (write-buffered *(ebp+0x10) ": stmt 'populate-stream' must not have any outputs\n") +25299 (flush *(ebp+0x10)) +25300 (stop *(ebp+0x14) 1) +25301 # never gets here +25302 +25303 $check-mu-populate-stream-stmt:error-invalid-target-type: +25304 (write-buffered *(ebp+0x10) "fn ") +25305 8b/-> *(ebp+0xc) 0/r32/eax +25306 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25307 (write-buffered *(ebp+0x10) %eax) +25308 (write-buffered *(ebp+0x10) ": stmt populate-stream: first inout '") +25309 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +25310 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25311 (write-buffered *(ebp+0x10) %eax) +25312 (write-buffered *(ebp+0x10) "' must have type (addr handle stream ...)\n") +25313 (flush *(ebp+0x10)) +25314 (stop *(ebp+0x14) 1) +25315 # never gets here +25316 +25317 $check-mu-populate-stream-stmt:error-invalid-length-type: +25318 (write-buffered *(ebp+0x10) "fn ") +25319 8b/-> *(ebp+0xc) 0/r32/eax +25320 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25321 (write-buffered *(ebp+0x10) %eax) +25322 (write-buffered *(ebp+0x10) ": stmt populate-stream: second inout '") +25323 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +25324 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25325 (write-buffered *(ebp+0x10) %eax) +25326 (write-buffered *(ebp+0x10) "' must be an int\n") +25327 (flush *(ebp+0x10)) +25328 (stop *(ebp+0x14) 1) +25329 # never gets here +25330 +25331 check-mu-read-from-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +25332 # . prologue +25333 55/push-ebp +25334 89/<- %ebp 4/r32/esp +25335 # . save registers +25336 50/push-eax +25337 51/push-ecx +25338 52/push-edx +25339 53/push-ebx +25340 56/push-esi +25341 57/push-edi +25342 # esi = stmt +25343 8b/-> *(ebp+8) 6/r32/esi +25344 # - check for 0 inouts +25345 # var base/ecx: (addr var) = stmt->inouts->value +25346 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25347 $check-mu-read-from-stream-stmt:check-no-inouts: +25348 3d/compare-eax-and 0/imm32 +25349 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-too-few-inouts/disp32 +25350 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +25351 89/<- %ecx 0/r32/eax +25352 # - check base type is (addr stream T) +25353 # var base-type/ebx: (addr type-tree) = lookup(base->type) +25354 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +25355 89/<- %ebx 0/r32/eax +25356 $check-mu-read-from-stream-stmt:check-base-is-compound: +25357 # if base-type is an atom, abort +25358 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +25359 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 +25360 $check-mu-read-from-stream-stmt:check-base-is-addr: +25361 # if type->left not addr, abort +25362 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +25363 (is-simple-mu-type? %eax 2) # addr => eax +25364 3d/compare-eax-and 0/imm32/false +25365 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 +25366 $check-mu-read-from-stream-stmt:check-base-is-addr-to-stream: +25367 # base-type = base-type->right +25368 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +25369 89/<- %ebx 0/r32/eax +25370 # ensure base-type->left == stream +25371 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +25372 (is-simple-mu-type? %eax 0xb) # stream => eax +25373 3d/compare-eax-and 0/imm32/false +25374 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 +25375 # - check target type is (addr T) +25376 # var target/ecx: (addr stmt-var) = stmt->inouts->next->value +25377 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25378 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +25379 $check-mu-read-from-stream-stmt:check-single-inout: +25380 3d/compare-eax-and 0/imm32 +25381 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-too-few-inouts/disp32 +25382 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +25383 89/<- %ecx 0/r32/eax +25384 # var target-type/edx: (addr type-tree) +25385 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +25386 89/<- %edx 0/r32/eax +25387 # if target-type is an atom, it must be a literal or int +25388 $check-mu-read-from-stream-stmt:check-target-is-compound: +25389 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +25390 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-target-type-not-address/disp32 +25391 $check-mu-read-from-stream-stmt:check-target-type: +25392 # target type must start with (addr ...) +25393 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +25394 (is-simple-mu-type? %eax 2) # addr => eax +25395 3d/compare-eax-and 0/imm32/false +25396 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-target-type-not-address/disp32 +25397 # if tail(base-type) != tail(target-type) abort +25398 (type-tail %ebx) # => eax +25399 89/<- %ebx 0/r32/eax +25400 (type-tail %edx) # => eax +25401 (type-equal? %ebx %eax) # => eax +25402 3d/compare-eax-and 0/imm32/false +25403 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-target-type/disp32 +25404 $check-mu-read-from-stream-stmt:check-too-many-inouts: +25405 # - check for too many inouts +25406 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25407 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +25408 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +25409 3d/compare-eax-and 0/imm32/false +25410 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-too-many-inouts/disp32 +25411 $check-mu-read-from-stream-stmt:check-unexpected-output: +25412 # - check for any output +25413 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +25414 3d/compare-eax-and 0/imm32/false +25415 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-unexpected-output/disp32 +25416 $check-mu-read-from-stream-stmt:end: +25417 # . restore registers +25418 5f/pop-to-edi +25419 5e/pop-to-esi +25420 5b/pop-to-ebx +25421 5a/pop-to-edx +25422 59/pop-to-ecx +25423 58/pop-to-eax +25424 # . epilogue +25425 89/<- %esp 5/r32/ebp +25426 5d/pop-to-ebp +25427 c3/return +25428 +25429 $check-mu-read-from-stream-stmt:error-invalid-base-type: +25430 (write-buffered *(ebp+0x10) "fn ") +25431 8b/-> *(ebp+0xc) 0/r32/eax +25432 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25433 (write-buffered *(ebp+0x10) %eax) +25434 (write-buffered *(ebp+0x10) ": stmt read-from-stream: var '") +25435 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +25436 (write-buffered *(ebp+0x10) %eax) +25437 (write-buffered *(ebp+0x10) "' must be an addr to a stream\n") +25438 (flush *(ebp+0x10)) +25439 (stop *(ebp+0x14) 1) +25440 # never gets here +25441 +25442 $check-mu-read-from-stream-stmt:error-too-few-inouts: +25443 (write-buffered *(ebp+0x10) "fn ") +25444 8b/-> *(ebp+0xc) 0/r32/eax +25445 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25446 (write-buffered *(ebp+0x10) %eax) +25447 (write-buffered *(ebp+0x10) ": stmt read-from-stream: too few inouts (2 required)\n") +25448 (flush *(ebp+0x10)) +25449 (stop *(ebp+0x14) 1) +25450 # never gets here +25451 +25452 $check-mu-read-from-stream-stmt:error-target-type-not-address: +25453 (write-buffered *(ebp+0x10) "fn ") +25454 8b/-> *(ebp+0xc) 0/r32/eax +25455 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25456 (write-buffered *(ebp+0x10) %eax) +25457 (write-buffered *(ebp+0x10) ": stmt read-from-stream: target '") +25458 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +25459 (write-buffered *(ebp+0x10) %eax) +25460 (write-buffered *(ebp+0x10) "' must be an addr\n") +25461 (flush *(ebp+0x10)) +25462 (stop *(ebp+0x14) 1) +25463 # never gets here +25464 +25465 $check-mu-read-from-stream-stmt:error-invalid-target-type: +25466 (write-buffered *(ebp+0x10) "fn ") +25467 8b/-> *(ebp+0xc) 0/r32/eax +25468 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25469 (write-buffered *(ebp+0x10) %eax) +25470 (write-buffered *(ebp+0x10) ": stmt read-from-stream: second inout '") +25471 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +25472 (write-buffered *(ebp+0x10) %eax) +25473 (write-buffered *(ebp+0x10) "' does not have the right type\n") +25474 (flush *(ebp+0x10)) +25475 (stop *(ebp+0x14) 1) +25476 # never gets here +25477 +25478 $check-mu-read-from-stream-stmt:error-too-many-inouts: +25479 (write-buffered *(ebp+0x10) "fn ") +25480 8b/-> *(ebp+0xc) 0/r32/eax +25481 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25482 (write-buffered *(ebp+0x10) %eax) +25483 (write-buffered *(ebp+0x10) ": stmt read-from-stream: too many inouts (2 required)\n") +25484 (flush *(ebp+0x10)) +25485 (stop *(ebp+0x14) 1) +25486 # never gets here +25487 +25488 $check-mu-read-from-stream-stmt:error-unexpected-output: +25489 (write-buffered *(ebp+0x10) "fn ") +25490 8b/-> *(ebp+0xc) 0/r32/eax +25491 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25492 (write-buffered *(ebp+0x10) %eax) +25493 (write-buffered *(ebp+0x10) ": stmt read-from-stream: unexpected output\n") +25494 (flush *(ebp+0x10)) +25495 (stop *(ebp+0x14) 1) +25496 # never gets here +25497 +25498 check-mu-write-to-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +25499 # . prologue +25500 55/push-ebp +25501 89/<- %ebp 4/r32/esp +25502 # . save registers +25503 50/push-eax +25504 51/push-ecx +25505 52/push-edx +25506 53/push-ebx +25507 56/push-esi +25508 57/push-edi +25509 # esi = stmt +25510 8b/-> *(ebp+8) 6/r32/esi +25511 # - check for 0 inouts +25512 # var base/ecx: (addr var) = stmt->inouts->value +25513 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25514 $check-mu-write-to-stream-stmt:check-no-inouts: +25515 3d/compare-eax-and 0/imm32 +25516 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-too-few-inouts/disp32 +25517 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +25518 89/<- %ecx 0/r32/eax +25519 # - check base type is (addr stream T) +25520 # var base-type/ebx: (addr type-tree) = lookup(base->type) +25521 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +25522 89/<- %ebx 0/r32/eax +25523 $check-mu-write-to-stream-stmt:check-base-is-compound: +25524 # if base-type is an atom, abort +25525 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +25526 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 +25527 $check-mu-write-to-stream-stmt:check-base-is-addr: +25528 # if type->left not addr, abort +25529 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +25530 (is-simple-mu-type? %eax 2) # addr => eax +25531 3d/compare-eax-and 0/imm32/false +25532 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 +25533 $check-mu-write-to-stream-stmt:check-base-is-addr-to-stream: +25534 # base-type = base-type->right +25535 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +25536 89/<- %ebx 0/r32/eax +25537 # ensure base-type->left == stream +25538 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +25539 (is-simple-mu-type? %eax 0xb) # stream => eax +25540 3d/compare-eax-and 0/imm32/false +25541 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 +25542 # - check target type is (addr T) +25543 # var target/ecx: (addr stmt-var) = stmt->inouts->next->value +25544 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25545 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +25546 $check-mu-write-to-stream-stmt:check-single-inout: +25547 3d/compare-eax-and 0/imm32 +25548 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-too-few-inouts/disp32 +25549 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +25550 89/<- %ecx 0/r32/eax +25551 # var target-type/edx: (addr type-tree) +25552 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +25553 89/<- %edx 0/r32/eax +25554 # if target-type is an atom, it must be a literal or int +25555 $check-mu-write-to-stream-stmt:check-target-is-compound: +25556 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +25557 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-target-type-not-address/disp32 +25558 $check-mu-write-to-stream-stmt:check-target-type: +25559 # target type must start with (addr ...) +25560 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +25561 (is-simple-mu-type? %eax 2) # addr => eax +25562 3d/compare-eax-and 0/imm32/false +25563 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-target-type-not-address/disp32 +25564 # if tail(base-type) != tail(target-type) abort +25565 (type-tail %ebx) # => eax +25566 89/<- %ebx 0/r32/eax +25567 (type-tail %edx) # => eax +25568 (type-equal? %ebx %eax) # => eax +25569 3d/compare-eax-and 0/imm32/false +25570 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-target-type/disp32 +25571 $check-mu-write-to-stream-stmt:check-too-many-inouts: +25572 # - check for too many inouts +25573 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25574 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +25575 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +25576 3d/compare-eax-and 0/imm32/false +25577 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-too-many-inouts/disp32 +25578 $check-mu-write-to-stream-stmt:check-unexpected-output: +25579 # - check for any output +25580 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +25581 3d/compare-eax-and 0/imm32/false +25582 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-unexpected-output/disp32 +25583 $check-mu-write-to-stream-stmt:end: +25584 # . restore registers +25585 5f/pop-to-edi +25586 5e/pop-to-esi +25587 5b/pop-to-ebx +25588 5a/pop-to-edx +25589 59/pop-to-ecx +25590 58/pop-to-eax +25591 # . epilogue +25592 89/<- %esp 5/r32/ebp +25593 5d/pop-to-ebp +25594 c3/return +25595 +25596 $check-mu-write-to-stream-stmt:error-invalid-base-type: +25597 (write-buffered *(ebp+0x10) "fn ") +25598 8b/-> *(ebp+0xc) 0/r32/eax +25599 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25600 (write-buffered *(ebp+0x10) %eax) +25601 (write-buffered *(ebp+0x10) ": stmt write-to-stream: var '") +25602 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +25603 (write-buffered *(ebp+0x10) %eax) +25604 (write-buffered *(ebp+0x10) "' must be an addr to a stream\n") +25605 (flush *(ebp+0x10)) +25606 (stop *(ebp+0x14) 1) +25607 # never gets here +25608 +25609 $check-mu-write-to-stream-stmt:error-too-few-inouts: +25610 (write-buffered *(ebp+0x10) "fn ") +25611 8b/-> *(ebp+0xc) 0/r32/eax +25612 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25613 (write-buffered *(ebp+0x10) %eax) +25614 (write-buffered *(ebp+0x10) ": stmt write-to-stream: too few inouts (2 required)\n") +25615 (flush *(ebp+0x10)) +25616 (stop *(ebp+0x14) 1) +25617 # never gets here +25618 +25619 $check-mu-write-to-stream-stmt:error-target-type-not-address: +25620 (write-buffered *(ebp+0x10) "fn ") +25621 8b/-> *(ebp+0xc) 0/r32/eax +25622 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25623 (write-buffered *(ebp+0x10) %eax) +25624 (write-buffered *(ebp+0x10) ": stmt write-to-stream: target '") +25625 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +25626 (write-buffered *(ebp+0x10) %eax) +25627 (write-buffered *(ebp+0x10) "' must be an addr\n") +25628 (flush *(ebp+0x10)) +25629 (stop *(ebp+0x14) 1) +25630 # never gets here +25631 +25632 $check-mu-write-to-stream-stmt:error-invalid-target-type: +25633 (write-buffered *(ebp+0x10) "fn ") +25634 8b/-> *(ebp+0xc) 0/r32/eax +25635 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25636 (write-buffered *(ebp+0x10) %eax) +25637 (write-buffered *(ebp+0x10) ": stmt write-to-stream: second inout '") +25638 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +25639 (write-buffered *(ebp+0x10) %eax) +25640 (write-buffered *(ebp+0x10) "' does not have the right type\n") +25641 (flush *(ebp+0x10)) +25642 (stop *(ebp+0x14) 1) +25643 # never gets here +25644 +25645 $check-mu-write-to-stream-stmt:error-too-many-inouts: +25646 (write-buffered *(ebp+0x10) "fn ") +25647 8b/-> *(ebp+0xc) 0/r32/eax +25648 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25649 (write-buffered *(ebp+0x10) %eax) +25650 (write-buffered *(ebp+0x10) ": stmt write-to-stream: too many inouts (2 required)\n") +25651 (flush *(ebp+0x10)) +25652 (stop *(ebp+0x14) 1) +25653 # never gets here +25654 +25655 $check-mu-write-to-stream-stmt:error-unexpected-output: +25656 (write-buffered *(ebp+0x10) "fn ") +25657 8b/-> *(ebp+0xc) 0/r32/eax +25658 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25659 (write-buffered *(ebp+0x10) %eax) +25660 (write-buffered *(ebp+0x10) ": stmt write-to-stream: unexpected output\n") +25661 (flush *(ebp+0x10)) +25662 (stop *(ebp+0x14) 1) +25663 # never gets here +25664 +25665 check-mu-convert-stmt: # stmt: (addr stmt), fn: (addr function), 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 52/push-edx +25673 56/push-esi +25674 57/push-edi +25675 $check-mu-convert-stmt:get-output: +25676 # esi = stmt +25677 8b/-> *(ebp+8) 6/r32/esi +25678 # var output/edi: (addr stmt-var) = stmt->outputs +25679 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +25680 89/<- %edi 0/r32/eax +25681 # zero outputs +25682 3d/compare-eax-and 0/imm32 +25683 0f 84/jump-if-= $check-mu-convert-stmt:error-no-output/disp32 +25684 # > 1 output +25685 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +25686 3d/compare-eax-and 0/imm32 +25687 0f 85/jump-if-!= $check-mu-convert-stmt:error-too-many-outputs/disp32 +25688 $check-mu-convert-stmt:get-inout: +25689 # var inout/esi: (addr stmt-var) = stmt->inouts +25690 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25691 89/<- %esi 0/r32/eax +25692 # zero inouts +25693 3d/compare-eax-and 0/imm32 +25694 0f 84/jump-if-= $check-mu-convert-stmt:error-no-inout/disp32 +25695 # > 1 inout +25696 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +25697 3d/compare-eax-and 0/imm32 +25698 0f 85/jump-if-!= $check-mu-convert-stmt:error-too-many-inouts/disp32 +25699 $check-mu-convert-stmt:types: +25700 # var inout-type/ecx: (addr type-tree) = inout->value->type +25701 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +25702 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +25703 89/<- %ecx 0/r32/eax +25704 # if (inout->is-deref?) inout-type = inout-type->payload +25705 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref +25706 3d/compare-eax-and 0/imm32/false +25707 { +25708 74/jump-if-= break/disp8 +25709 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +25710 # if inout-type->right is null, t = inout-type->left +25711 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +25712 { +25713 75/jump-if-!= break/disp8 +25714 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +25715 } +25716 89/<- %ecx 0/r32/eax +25717 } +25718 # if input is not int or float, abort +25719 { +25720 (is-simple-mu-type? %ecx 1) # int => eax +25721 3d/compare-eax-and 0/imm32/false +25722 75/jump-if-!= break/disp8 +25723 (is-simple-mu-type? %ecx 0xf) # float => eax +25724 3d/compare-eax-and 0/imm32/false +25725 75/jump-if-!= break/disp8 +25726 e9/jump $check-mu-convert-stmt:error-invalid-inout-type/disp32 +25727 } +25728 # if output not in register, abort +25729 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +25730 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +25731 3d/compare-eax-and 0/imm32 +25732 0f 84/jump-if-= $check-mu-convert-stmt:error-output-not-in-register/disp32 +25733 # var output-type/edx: (addr type-tree) = output->value->type +25734 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +25735 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +25736 89/<- %edx 0/r32/eax +25737 # if output is not int or float, abort +25738 { +25739 (is-simple-mu-type? %edx 1) # int => eax +25740 3d/compare-eax-and 0/imm32/false +25741 75/jump-if-!= break/disp8 +25742 (is-simple-mu-type? %edx 0xf) # float => eax +25743 3d/compare-eax-and 0/imm32/false +25744 75/jump-if-!= break/disp8 +25745 e9/jump $check-mu-convert-stmt:error-invalid-output-type/disp32 +25746 } +25747 # if both are ints, abort +25748 { +25749 (is-simple-mu-type? %edx 1) # int => eax +25750 3d/compare-eax-and 0/imm32/false +25751 74/jump-if-= break/disp8 +25752 (is-simple-mu-type? %ecx 1) # int => eax +25753 3d/compare-eax-and 0/imm32/false +25754 74/jump-if-= break/disp8 +25755 e9/jump $check-mu-convert-stmt:error-int-to-int/disp32 +25756 } +25757 # if both are floats, abort +25758 { +25759 (is-simple-mu-type? %edx 0xf) # float => eax +25760 3d/compare-eax-and 0/imm32/false +25761 74/jump-if-= break/disp8 +25762 (is-simple-mu-type? %ecx 0xf) # float => eax +25763 3d/compare-eax-and 0/imm32/false +25764 74/jump-if-= break/disp8 +25765 e9/jump $check-mu-convert-stmt:error-float-to-float/disp32 +25766 } +25767 $check-mu-convert-stmt:end: +25768 # . restore registers +25769 5f/pop-to-edi +25770 5e/pop-to-esi +25771 5a/pop-to-edx +25772 59/pop-to-ecx +25773 58/pop-to-eax +25774 # . epilogue +25775 89/<- %esp 5/r32/ebp +25776 5d/pop-to-ebp +25777 c3/return +25778 +25779 $check-mu-convert-stmt:error-no-inout: +25780 (write-buffered *(ebp+0x10) "fn ") +25781 8b/-> *(ebp+0xc) 0/r32/eax +25782 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25783 (write-buffered *(ebp+0x10) %eax) +25784 (write-buffered *(ebp+0x10) ": stmt 'convert' expects an inout\n") +25785 (flush *(ebp+0x10)) +25786 (stop *(ebp+0x14) 1) +25787 # never gets here +25788 +25789 $check-mu-convert-stmt:error-too-many-inouts: +25790 (write-buffered *(ebp+0x10) "fn ") +25791 8b/-> *(ebp+0xc) 0/r32/eax +25792 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25793 (write-buffered *(ebp+0x10) %eax) +25794 (write-buffered *(ebp+0x10) ": stmt 'convert' must have just one inout\n") +25795 (flush *(ebp+0x10)) +25796 (stop *(ebp+0x14) 1) +25797 # never gets here +25798 +25799 $check-mu-convert-stmt:error-no-output: +25800 (write-buffered *(ebp+0x10) "fn ") +25801 8b/-> *(ebp+0xc) 0/r32/eax +25802 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25803 (write-buffered *(ebp+0x10) %eax) +25804 (write-buffered *(ebp+0x10) ": stmt 'convert' expects an output\n") +25805 (flush *(ebp+0x10)) +25806 (stop *(ebp+0x14) 1) +25807 # never gets here +25808 +25809 $check-mu-convert-stmt:error-output-not-in-register: +25810 (write-buffered *(ebp+0x10) "fn ") +25811 8b/-> *(ebp+0xc) 0/r32/eax +25812 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25813 (write-buffered *(ebp+0x10) %eax) +25814 (write-buffered *(ebp+0x10) ": stmt convert: output '") +25815 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +25816 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25817 (write-buffered *(ebp+0x10) %eax) +25818 (write-buffered *(ebp+0x10) "' not in a register\n") +25819 (flush *(ebp+0x10)) +25820 (stop *(ebp+0x14) 1) +25821 # never gets here +25822 +25823 $check-mu-convert-stmt:error-too-many-outputs: +25824 (write-buffered *(ebp+0x10) "fn ") +25825 8b/-> *(ebp+0xc) 0/r32/eax +25826 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25827 (write-buffered *(ebp+0x10) %eax) +25828 (write-buffered *(ebp+0x10) ": stmt 'convert' must have just one output\n") +25829 (flush *(ebp+0x10)) +25830 (stop *(ebp+0x14) 1) +25831 # never gets here +25832 +25833 $check-mu-convert-stmt:error-invalid-inout-type: +25834 (write-buffered *(ebp+0x10) "fn ") +25835 8b/-> *(ebp+0xc) 0/r32/eax +25836 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25837 (write-buffered *(ebp+0x10) %eax) +25838 (write-buffered *(ebp+0x10) ": stmt convert: inout '") +25839 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +25840 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25841 (write-buffered *(ebp+0x10) %eax) +25842 (write-buffered *(ebp+0x10) "' must be an int or float\n") +25843 (flush *(ebp+0x10)) +25844 (stop *(ebp+0x14) 1) +25845 # never gets here +25846 +25847 $check-mu-convert-stmt:error-invalid-output-type: +25848 (write-buffered *(ebp+0x10) "fn ") +25849 8b/-> *(ebp+0xc) 0/r32/eax +25850 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25851 (write-buffered *(ebp+0x10) %eax) +25852 (write-buffered *(ebp+0x10) ": stmt convert: output '") +25853 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +25854 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25855 (write-buffered *(ebp+0x10) %eax) +25856 (write-buffered *(ebp+0x10) "' must be an int or float\n") +25857 (flush *(ebp+0x10)) +25858 (stop *(ebp+0x14) 1) +25859 # never gets here +25860 +25861 $check-mu-convert-stmt:error-int-to-int: +25862 (write-buffered *(ebp+0x10) "fn ") +25863 8b/-> *(ebp+0xc) 0/r32/eax +25864 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25865 (write-buffered *(ebp+0x10) %eax) +25866 (write-buffered *(ebp+0x10) ": stmt convert: no need to convert int to int\n") +25867 (flush *(ebp+0x10)) +25868 (stop *(ebp+0x14) 1) +25869 # never gets here +25870 +25871 $check-mu-convert-stmt:error-float-to-float: +25872 (write-buffered *(ebp+0x10) "fn ") +25873 8b/-> *(ebp+0xc) 0/r32/eax +25874 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25875 (write-buffered *(ebp+0x10) %eax) +25876 (write-buffered *(ebp+0x10) ": stmt convert: no need to convert float to float\n") +25877 (flush *(ebp+0x10)) +25878 (stop *(ebp+0x14) 1) +25879 # never gets here +25880 +25881 check-mu-call: # stmt: (addr stmt), callee: (addr function), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +25882 # . prologue +25883 55/push-ebp +25884 89/<- %ebp 4/r32/esp +25885 # var type-parameters: (addr table (handle array byte) (addr type-tree) 8) +25886 68/push 0/imm32 +25887 # var type-parameters-storage: (table (handle array byte) (addr type-tree) 8) +25888 81 5/subop/subtract %esp 0x60/imm32 +25889 68/push 0x60/imm32/size +25890 68/push 0/imm32/read +25891 68/push 0/imm32/write +25892 # save a pointer to type-parameters-storage at type-parameters +25893 89/<- *(ebp-4) 4/r32/esp +25894 (clear-stream *(ebp-4)) +25895 # . save registers +25896 50/push-eax +25897 51/push-ecx +25898 52/push-edx +25899 53/push-ebx +25900 56/push-esi +25901 57/push-edi +25902 # esi = stmt +25903 8b/-> *(ebp+8) 6/r32/esi +25904 # edi = callee +25905 8b/-> *(ebp+0xc) 7/r32/edi +25906 # var inouts/ecx: (addr stmt-var) = lookup(stmt->inouts) +25907 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25908 89/<- %ecx 0/r32/eax +25909 # var expected/edx: (addr list var) = lookup(f->inouts) +25910 (lookup *(edi+8) *(edi+0xc)) # Function-inouts Function-inouts => eax +25911 89/<- %edx 0/r32/eax +25912 { +25913 $check-mu-call:check-for-inouts: +25914 # if (inouts == 0) break +25915 81 7/subop/compare %ecx 0/imm32 +25916 0f 84/jump-if-= break/disp32 +25917 # if (expected == 0) error +25918 81 7/subop/compare %edx 0/imm32 +25919 0f 84/jump-if-= break/disp32 +25920 $check-mu-call:check-null-addr: +25921 # if (inouts->value->name == "0") continue +25922 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +25923 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25924 (string-equal? %eax "0") # => eax +25925 3d/compare-eax-and 0/imm32/false +25926 0f 85/jump-if-!= $check-mu-call:continue-to-next-inout/disp32 +25927 $check-mu-call:check-inout-type: +25928 # var t/ebx: (addr type-tree) = inouts->value->type +25929 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +25930 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +25931 89/<- %ebx 0/r32/eax +25932 # if (inouts->is-deref?) t = t->right +25933 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +25934 { +25935 74/jump-if-= break/disp8 +25936 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +25937 89/<- %ebx 0/r32/eax +25938 # if t->right is null, t = t->left +25939 81 7/subop/compare *(ebx+0xc) 0/imm32 # Type-tree-right +25940 75/jump-if-!= break/disp8 +25941 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +25942 89/<- %ebx 0/r32/eax +25943 } +25944 # var v2/eax: (addr v) = lookup(expected->value) +25945 (lookup *edx *(edx+4)) # List-value List-value => eax +25946 # var t2/eax: (addr type-tree) = lookup(v2->type) +25947 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +25948 # if (t != t2) error +25949 (type-match? %eax %ebx *(ebp-4)) # => eax +25950 3d/compare-eax-and 0/imm32/false +25951 { +25952 0f 85/jump-if-!= break/disp32 +25953 (write-buffered *(ebp+0x14) "fn ") +25954 8b/-> *(ebp+0x10) 0/r32/eax +25955 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25956 (write-buffered *(ebp+0x14) %eax) +25957 (write-buffered *(ebp+0x14) ": call ") +25958 (lookup *edi *(edi+4)) # Function-name Function-name => eax +25959 (write-buffered *(ebp+0x14) %eax) +25960 (write-buffered *(ebp+0x14) ": type for inout '") +25961 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +25962 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25963 (write-buffered *(ebp+0x14) %eax) +25964 (write-buffered *(ebp+0x14) "' is not right\n") +25965 (flush *(ebp+0x14)) +25966 (stop *(ebp+0x18) 1) +25967 } +25968 $check-mu-call:continue-to-next-inout: +25969 # inouts = lookup(inouts->next) +25970 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax +25971 89/<- %ecx 0/r32/eax +25972 # expected = lookup(expected->next) +25973 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +25974 89/<- %edx 0/r32/eax +25975 # +25976 e9/jump loop/disp32 +25977 } +25978 $check-mu-call:check-inout-count: +25979 # if (inouts == expected) proceed +25980 39/compare %ecx 2/r32/edx +25981 { +25982 0f 84/jump-if-= break/disp32 +25983 # exactly one of the two is null +25984 # if (inouts == 0) error("too many inouts") +25985 { +25986 81 7/subop/compare %ecx 0/imm32 +25987 0f 84/jump-if-= break/disp32 +25988 (write-buffered *(ebp+0x14) "fn ") +25989 8b/-> *(ebp+0x10) 0/r32/eax +25990 (lookup *eax *(eax+4)) # Function-name Function-name => eax +25991 (write-buffered *(ebp+0x14) %eax) +25992 (write-buffered *(ebp+0x14) ": call ") +25993 (lookup *edi *(edi+4)) # Function-name Function-name => eax +25994 (write-buffered *(ebp+0x14) %eax) +25995 (write-buffered *(ebp+0x14) ": too many inouts\n") +25996 (flush *(ebp+0x14)) +25997 (stop *(ebp+0x18) 1) +25998 } +25999 # if (expected == 0) error("too few inouts") +26000 { +26001 81 7/subop/compare %edx 0/imm32 +26002 0f 84/jump-if-= break/disp32 +26003 (write-buffered *(ebp+0x14) "fn ") +26004 8b/-> *(ebp+0x10) 0/r32/eax +26005 (lookup *eax *(eax+4)) # Function-name Function-name => eax +26006 (write-buffered *(ebp+0x14) %eax) +26007 (write-buffered *(ebp+0x14) ": call ") +26008 (lookup *edi *(edi+4)) # Function-name Function-name => eax +26009 (write-buffered *(ebp+0x14) %eax) +26010 (write-buffered *(ebp+0x14) ": too few inouts\n") +26011 (flush *(ebp+0x14)) +26012 (stop *(ebp+0x18) 1) +26013 } +26014 } +26015 $check-mu-call:check-outputs: +26016 # var outputs/ecx: (addr stmt-var) = lookup(stmt->outputs) +26017 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +26018 89/<- %ecx 0/r32/eax +26019 # var expected/edx: (addr list var) = lookup(f->outputs) +26020 (lookup *(edi+0x10) *(edi+0x14)) # Function-outputs Function-outputs => eax +26021 89/<- %edx 0/r32/eax +26022 { +26023 $check-mu-call:check-for-outputs: +26024 # if (outputs == 0) break +26025 81 7/subop/compare %ecx 0/imm32 +26026 0f 84/jump-if-= break/disp32 +26027 # if (expected == 0) error +26028 81 7/subop/compare %edx 0/imm32 +26029 0f 84/jump-if-= break/disp32 +26030 $check-mu-call:check-output-type: +26031 # var v/eax: (addr v) = lookup(outputs->value) +26032 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +26033 # var t/ebx: (addr type-tree) = lookup(v->type) +26034 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +26035 89/<- %ebx 0/r32/eax +26036 # if (outputs->is-deref?) t = t->right # TODO: check that t->left is an addr +26037 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +26038 { +26039 74/jump-if-= break/disp8 +26040 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +26041 89/<- %ebx 0/r32/eax +26042 } +26043 # var v2/eax: (addr v) = lookup(expected->value) +26044 (lookup *edx *(edx+4)) # List-value List-value => eax +26045 # var t2/eax: (addr type-tree) = lookup(v2->type) +26046 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +26047 # if (t != t2) error +26048 (type-match? %eax %ebx *(ebp-4)) # => eax +26049 3d/compare-eax-and 0/imm32/false +26050 { +26051 0f 85/jump-if-!= break/disp32 +26052 (write-buffered *(ebp+0x14) "fn ") +26053 8b/-> *(ebp+0x10) 0/r32/eax +26054 (lookup *eax *(eax+4)) # Function-name Function-name => eax +26055 (write-buffered *(ebp+0x14) %eax) +26056 (write-buffered *(ebp+0x14) ": call ") +26057 (lookup *edi *(edi+4)) # Function-name Function-name => eax +26058 (write-buffered *(ebp+0x14) %eax) +26059 (write-buffered *(ebp+0x14) ": type for output '") +26060 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +26061 (lookup *eax *(eax+4)) # Var-name Var-name => eax +26062 (write-buffered *(ebp+0x14) %eax) +26063 (write-buffered *(ebp+0x14) "' is not right\n") +26064 (flush *(ebp+0x14)) +26065 (stop *(ebp+0x18) 1) +26066 } +26067 $check-mu-call:check-output-register: +26068 # var v/eax: (addr v) = lookup(outputs->value) +26069 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +26070 # var r/ebx: (addr array byte) = lookup(v->register) +26071 (lookup *(eax+18) *(eax+0x1c)) # Var-register Var-register => eax +26072 89/<- %ebx 0/r32/eax +26073 # if (r == 0) error +26074 3d/compare-eax-and 0/imm32 +26075 { +26076 0f 85/jump-if-!= break/disp32 +26077 (write-buffered *(ebp+0x14) "fn ") +26078 8b/-> *(ebp+0x10) 0/r32/eax +26079 (lookup *eax *(eax+4)) # Function-name Function-name => eax +26080 (write-buffered *(ebp+0x14) %eax) +26081 (write-buffered *(ebp+0x14) ": call ") +26082 (lookup *edi *(edi+4)) # Function-name Function-name => eax +26083 (write-buffered *(ebp+0x14) %eax) +26084 (write-buffered *(ebp+0x14) ": output '") +26085 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +26086 (lookup *eax *(eax+4)) # Var-name Var-name => eax +26087 (write-buffered *(ebp+0x14) %eax) +26088 (write-buffered *(ebp+0x14) "' is not in a register\n") +26089 (flush *(ebp+0x14)) +26090 (stop *(ebp+0x18) 1) +26091 } +26092 # var v2/eax: (addr v) = lookup(expected->value) +26093 (lookup *edx *(edx+4)) # Stmt-var-value Stmt-var-value => eax +26094 # var r2/eax: (addr array byte) = lookup(v2->register) +26095 (lookup *(eax+18) *(eax+0x1c)) # Var-register Var-register => eax +26096 # if (r != r2) error +26097 (string-equal? %eax %ebx) # => eax +26098 3d/compare-eax-and 0/imm32/false 26099 { -26100 $emit-unconditional-jump-to-depth:check: -26101 # if v->block-depth != until-block-depth, continue -26102 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth -26103 0f 85/jump-if-!= break/disp32 -26104 $emit-unconditional-jump-to-depth:depth-found: -26105 # if v is not a literal, continue -26106 (size-of %ebx) # => eax -26107 3d/compare-eax-and 0/imm32 -26108 0f 85/jump-if-!= break/disp32 -26109 $emit-unconditional-jump-to-depth:label-found: -26110 # emit unconditional jump, then return -26111 (emit-indent *(ebp+8) *Curr-block-depth) -26112 (write-buffered *(ebp+8) "e9/jump ") -26113 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -26114 (write-buffered *(ebp+8) %eax) -26115 (write-buffered *(ebp+8) ":") -26116 (write-buffered *(ebp+8) *(ebp+0x14)) -26117 (write-buffered *(ebp+8) "/disp32\n") -26118 eb/jump $emit-unconditional-jump-to-depth:end/disp8 -26119 } -26120 # curr -= 12 -26121 81 5/subop/subtract %esi 0xc/imm32 -26122 e9/jump loop/disp32 -26123 } -26124 # TODO: error if no label at 'depth' was found -26125 $emit-unconditional-jump-to-depth:end: -26126 # . restore registers -26127 5e/pop-to-esi -26128 5b/pop-to-ebx -26129 5a/pop-to-edx -26130 59/pop-to-ecx -26131 58/pop-to-eax -26132 # . epilogue -26133 89/<- %esp 5/r32/ebp -26134 5d/pop-to-ebp -26135 c3/return -26136 -26137 # emit clean-up code for 'vars' until some block depth -26138 # doesn't actually modify 'vars' so we need traverse manually inside the stack -26139 emit-cleanup-code-until-depth: # out: (addr buffered-file), vars: (addr stack live-var), until-block-depth: int -26140 # . prologue -26141 55/push-ebp -26142 89/<- %ebp 4/r32/esp -26143 # . save registers -26144 50/push-eax -26145 51/push-ecx -26146 52/push-edx -26147 53/push-ebx -26148 56/push-esi -26149 #? (write-buffered Stderr "--- cleanup\n") -26150 #? (flush Stderr) -26151 # ecx = vars -26152 8b/-> *(ebp+0xc) 1/r32/ecx -26153 # var esi: int = vars->top -26154 8b/-> *ecx 6/r32/esi -26155 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] -26156 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size -26157 # var min/ecx: (addr handle var) = vars->data -26158 81 0/subop/add %ecx 8/imm32 -26159 # edx = until-block-depth -26160 8b/-> *(ebp+0x10) 2/r32/edx -26161 { -26162 $emit-cleanup-code-until-depth:loop: -26163 # if (curr < min) break -26164 39/compare %esi 1/r32/ecx -26165 0f 82/jump-if-addr< break/disp32 -26166 # var v/ebx: (addr var) = lookup(*curr) -26167 (lookup *esi *(esi+4)) # => eax -26168 89/<- %ebx 0/r32/eax -26169 #? (lookup *ebx *(ebx+4)) # Var-name -26170 #? (write-buffered Stderr "var ") -26171 #? (write-buffered Stderr %eax) -26172 #? (write-buffered Stderr Newline) -26173 #? (flush Stderr) -26174 # if (v->block-depth < until-block-depth) break -26175 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth -26176 0f 8c/jump-if-< break/disp32 -26177 # if v is in a register -26178 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register -26179 { -26180 0f 84/jump-if-= break/disp32 -26181 { -26182 $emit-cleanup-code-until-depth:check-for-previous-spill: -26183 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled -26184 3d/compare-eax-and 0/imm32/false -26185 74/jump-if-= break/disp8 -26186 $emit-cleanup-code-until-depth:reclaim-var-in-register: -26187 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -26188 (emit-pop-register *(ebp+8) %eax) -26189 } -26190 eb/jump $emit-cleanup-code-until-depth:continue/disp8 -26191 } -26192 # otherwise v is on the stack -26193 { -26194 75/jump-if-!= break/disp8 -26195 $emit-cleanup-code-until-depth:var-on-stack: -26196 (size-of %ebx) # => eax -26197 # don't emit code for labels -26198 3d/compare-eax-and 0/imm32 -26199 74/jump-if-= break/disp8 -26200 $emit-cleanup-code-until-depth:reclaim-var-on-stack: -26201 (emit-indent *(ebp+8) *Curr-block-depth) -26202 (write-buffered *(ebp+8) "81 0/subop/add %esp ") -26203 (write-int32-hex-buffered *(ebp+8) %eax) -26204 (write-buffered *(ebp+8) "/imm32\n") -26205 } -26206 $emit-cleanup-code-until-depth:continue: -26207 # curr -= 12 -26208 81 5/subop/subtract %esi 0xc/imm32 -26209 e9/jump loop/disp32 -26210 } -26211 $emit-cleanup-code-until-depth:end: -26212 # . restore registers -26213 5e/pop-to-esi -26214 5b/pop-to-ebx -26215 5a/pop-to-edx -26216 59/pop-to-ecx -26217 58/pop-to-eax -26218 # . epilogue -26219 89/<- %esp 5/r32/ebp -26220 5d/pop-to-ebp -26221 c3/return -26222 -26223 # emit clean-up code for 'vars' that don't conflict with output registers -26224 # doesn't actually modify 'vars' so we need traverse manually inside the stack -26225 emit-cleanup-code-for-non-outputs: # out: (addr buffered-file), vars: (addr stack live-var), fn: (addr function) -26226 # . prologue -26227 55/push-ebp -26228 89/<- %ebp 4/r32/esp -26229 # . save registers -26230 50/push-eax -26231 51/push-ecx -26232 52/push-edx -26233 53/push-ebx -26234 56/push-esi -26235 57/push-edi -26236 # ecx = vars -26237 8b/-> *(ebp+0xc) 1/r32/ecx -26238 # var esi: int = vars->top -26239 8b/-> *ecx 6/r32/esi -26240 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] -26241 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size -26242 # var min/ecx: (addr handle var) = vars->data -26243 81 0/subop/add %ecx 8/imm32 -26244 { -26245 $emit-cleanup-code-for-non-outputs:loop: -26246 # if (curr < min) break -26247 39/compare %esi 1/r32/ecx -26248 0f 82/jump-if-addr< break/disp32 -26249 # var v/ebx: (addr var) = lookup(*curr) -26250 (lookup *esi *(esi+4)) # => eax -26251 89/<- %ebx 0/r32/eax -26252 # if v is in a register -26253 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register -26254 { -26255 0f 84/jump-if-= break/disp32 -26256 { -26257 $emit-cleanup-code-for-non-outputs:check-for-previous-spill: -26258 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled -26259 3d/compare-eax-and 0/imm32/false -26260 0f 84/jump-if-= break/disp32 -26261 $emit-cleanup-code-for-non-outputs:reclaim-var-in-register: -26262 # var reg/edi: (addr array name) = v->register -26263 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -26264 89/<- %edi 0/r32/eax -26265 # if reg is not in function outputs, emit a pop -26266 (reg-in-function-outputs? *(ebp+0x10) %edi) # => eax -26267 3d/compare-eax-and 0/imm32/false -26268 { -26269 75/jump-if-!= break/disp8 -26270 (emit-pop-register *(ebp+8) %edi) -26271 eb/jump $emit-cleanup-code-for-non-outputs:reclaim-var-in-register-done/disp8 -26272 } -26273 # otherwise just drop it from the stack -26274 (emit-indent *(ebp+8) *Curr-block-depth) -26275 (write-buffered *(ebp+8) "81 0/subop/add %esp 4/imm32\n") -26276 } -26277 $emit-cleanup-code-for-non-outputs:reclaim-var-in-register-done: -26278 eb/jump $emit-cleanup-code-for-non-outputs:continue/disp8 -26279 } -26280 # otherwise v is on the stack -26281 { -26282 75/jump-if-!= break/disp8 -26283 $emit-cleanup-code-for-non-outputs:var-on-stack: -26284 (size-of %ebx) # => eax -26285 # don't emit code for labels -26286 3d/compare-eax-and 0/imm32 -26287 74/jump-if-= break/disp8 -26288 $emit-cleanup-code-for-non-outputs:reclaim-var-on-stack: -26289 (emit-indent *(ebp+8) *Curr-block-depth) -26290 (write-buffered *(ebp+8) "81 0/subop/add %esp ") -26291 (write-int32-hex-buffered *(ebp+8) %eax) -26292 (write-buffered *(ebp+8) "/imm32\n") -26293 } -26294 $emit-cleanup-code-for-non-outputs:continue: -26295 # curr -= 12 -26296 81 5/subop/subtract %esi 0xc/imm32 -26297 e9/jump loop/disp32 -26298 } -26299 $emit-cleanup-code-for-non-outputs:end: -26300 # . restore registers -26301 5f/pop-to-edi -26302 5e/pop-to-esi -26303 5b/pop-to-ebx -26304 5a/pop-to-edx -26305 59/pop-to-ecx -26306 58/pop-to-eax -26307 # . epilogue -26308 89/<- %esp 5/r32/ebp -26309 5d/pop-to-ebp -26310 c3/return -26311 -26312 emit-push-register: # out: (addr buffered-file), reg: (addr array byte) -26313 # . prologue -26314 55/push-ebp -26315 89/<- %ebp 4/r32/esp -26316 # eax = reg -26317 8b/-> *(ebp+0xc) 0/r32/eax -26318 # var prefix/eax: byte = reg->data[0] -26319 8a/copy-byte *(eax+4) 0/r32/AL -26320 81 4/subop/and %eax 0xff/imm32 -26321 # if (prefix == 'x') push xmm register +26100 0f 85/jump-if-!= break/disp32 +26101 (write-buffered *(ebp+0x14) "fn ") +26102 8b/-> *(ebp+0x10) 0/r32/eax +26103 (lookup *eax *(eax+4)) # Function-name Function-name => eax +26104 (write-buffered *(ebp+0x14) %eax) +26105 (write-buffered *(ebp+0x14) ": call ") +26106 (lookup *edi *(edi+4)) # Function-name Function-name => eax +26107 (write-buffered *(ebp+0x14) %eax) +26108 (write-buffered *(ebp+0x14) ": register for output '") +26109 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +26110 (lookup *eax *(eax+4)) # Var-name Var-name => eax +26111 (write-buffered *(ebp+0x14) %eax) +26112 (write-buffered *(ebp+0x14) "' is not right\n") +26113 (flush *(ebp+0x14)) +26114 (stop *(ebp+0x18) 1) +26115 } +26116 $check-mu-call:continue-to-next-output: +26117 # outputs = lookup(outputs->next) +26118 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax +26119 89/<- %ecx 0/r32/eax +26120 # expected = lookup(expected->next) +26121 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +26122 89/<- %edx 0/r32/eax +26123 # +26124 e9/jump loop/disp32 +26125 } +26126 $check-mu-call:check-output-count: +26127 # if (outputs == expected) proceed +26128 39/compare %ecx 2/r32/edx +26129 { +26130 0f 84/jump-if-= break/disp32 +26131 # exactly one of the two is null +26132 # if (outputs == 0) error("too many outputs") +26133 { +26134 81 7/subop/compare %ecx 0/imm32 +26135 0f 84/jump-if-= break/disp32 +26136 (write-buffered *(ebp+0x14) "fn ") +26137 8b/-> *(ebp+0x10) 0/r32/eax +26138 (lookup *eax *(eax+4)) # Function-name Function-name => eax +26139 (write-buffered *(ebp+0x14) %eax) +26140 (write-buffered *(ebp+0x14) ": call ") +26141 (lookup *edi *(edi+4)) # Function-name Function-name => eax +26142 (write-buffered *(ebp+0x14) %eax) +26143 (write-buffered *(ebp+0x14) ": too many outputs\n") +26144 (flush *(ebp+0x14)) +26145 (stop *(ebp+0x18) 1) +26146 } +26147 # if (expected == 0) error("too few outputs") +26148 { +26149 81 7/subop/compare %edx 0/imm32 +26150 0f 84/jump-if-= break/disp32 +26151 (write-buffered *(ebp+0x14) "fn ") +26152 8b/-> *(ebp+0x10) 0/r32/eax +26153 (lookup *eax *(eax+4)) # Function-name Function-name => eax +26154 (write-buffered *(ebp+0x14) %eax) +26155 (write-buffered *(ebp+0x14) ": call ") +26156 (lookup *edi *(edi+4)) # Function-name Function-name => eax +26157 (write-buffered *(ebp+0x14) %eax) +26158 (write-buffered *(ebp+0x14) ": too few outputs\n") +26159 (flush *(ebp+0x14)) +26160 (stop *(ebp+0x18) 1) +26161 } +26162 } +26163 $check-mu-call:end: +26164 # . restore registers +26165 5f/pop-to-edi +26166 5e/pop-to-esi +26167 5b/pop-to-ebx +26168 5a/pop-to-edx +26169 59/pop-to-ecx +26170 58/pop-to-eax +26171 # . reclaim locals exclusively on the stack +26172 81 0/subop/add %esp 0x70/imm32 +26173 # . epilogue +26174 89/<- %esp 5/r32/ebp +26175 5d/pop-to-ebp +26176 c3/return +26177 +26178 # like type-equal? but takes literals type parameters into account +26179 type-match?: # def: (addr type-tree), call: (addr type-tree), type-parameters: (addr table (handle array byte) (addr type-tree)) -> result/eax: boolean +26180 # . prologue +26181 55/push-ebp +26182 89/<- %ebp 4/r32/esp +26183 # if (call is literal and def is numberlike) return true +26184 { +26185 $type-match?:check-literal-int: +26186 (is-simple-mu-type? *(ebp+0xc) 0) # literal => eax +26187 3d/compare-eax-and 0/imm32/false +26188 74/jump-if-= break/disp8 +26189 (is-mu-numberlike-output? *(ebp+8)) # => eax +26190 3d/compare-eax-and 0/imm32/false +26191 74/jump-if-= break/disp8 +26192 b8/copy-to-eax 1/imm32/true +26193 e9/jump $type-match?:end/disp32 +26194 } +26195 # if (call is literal-string and def is string) return true +26196 { +26197 $type-match?:check-literal-string: +26198 (is-simple-mu-type? *(ebp+0xc) 0x10) # literal-string => eax +26199 3d/compare-eax-and 0/imm32/false +26200 74/jump-if-= break/disp8 +26201 (is-mu-string-type? *(ebp+8)) # => eax +26202 3d/compare-eax-and 0/imm32/false +26203 74/jump-if-= break/disp8 +26204 b8/copy-to-eax 1/imm32/true +26205 e9/jump $type-match?:end/disp32 +26206 } +26207 $type-match?:baseline: +26208 # otherwise fall back +26209 (type-component-match? *(ebp+8) *(ebp+0xc) *(ebp+0x10)) # => eax +26210 $type-match?:end: +26211 # . epilogue +26212 89/<- %esp 5/r32/ebp +26213 5d/pop-to-ebp +26214 c3/return +26215 +26216 type-component-match?: # def: (addr type-tree), call: (addr type-tree), type-parameters: (addr table (handle array byte) (addr type-tree)) -> result/eax: boolean +26217 # . prologue +26218 55/push-ebp +26219 89/<- %ebp 4/r32/esp +26220 # . save registers +26221 51/push-ecx +26222 52/push-edx +26223 53/push-ebx +26224 # ecx = def +26225 8b/-> *(ebp+8) 1/r32/ecx +26226 # edx = call +26227 8b/-> *(ebp+0xc) 2/r32/edx +26228 $type-component-match?:compare-addr: +26229 # if (def == call) return true +26230 8b/-> %ecx 0/r32/eax # Var-type +26231 39/compare %edx 0/r32/eax # Var-type +26232 b8/copy-to-eax 1/imm32/true +26233 0f 84/jump-if-= $type-component-match?:end/disp32 +26234 # if (def == 0) return false +26235 b8/copy-to-eax 0/imm32/false +26236 81 7/subop/compare %ecx 0/imm32 # Type-tree-is-atom +26237 0f 84/jump-if-= $type-component-match?:end/disp32 +26238 # if (call == 0) return false +26239 81 7/subop/compare %edx 0/imm32 # Type-tree-is-atom +26240 0f 84/jump-if-= $type-component-match?:end/disp32 +26241 # if def is a type parameter, just check in type-parameters +26242 { +26243 $type-component-match?:check-type-parameter: +26244 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +26245 74/jump-if-= break/disp8 +26246 81 7/subop/compare *(ecx+4) 0xa/imm32/type-parameter # Type-tree-value +26247 75/jump-if-!= break/disp8 +26248 $type-component-match?:type-parameter: +26249 (type-parameter-match? *(ecx+8) *(ecx+0xc) %edx *(ebp+0x10)) # => eax +26250 e9/jump $type-component-match?:end/disp32 +26251 } +26252 # if def is a list containing just a type parameter, just check in type-parameters +26253 { +26254 $type-component-match?:check-list-type-parameter: +26255 # if def is a list.. +26256 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +26257 75/jump-if-!= break/disp8 +26258 # ..that's a singleton +26259 81 7/subop/compare *(ecx+0xc) 0/imm32 # Type-tree-left +26260 75/jump-if-!= break/disp8 +26261 # ..and whose head is a type parameter +26262 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +26263 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +26264 74/jump-if-= break/disp8 +26265 81 7/subop/compare *(eax+4) 0xa/imm32/type-parameter # Type-tree-value +26266 75/jump-if-!= break/disp8 +26267 $type-component-match?:list-type-parameter: +26268 (type-parameter-match? *(eax+8) *(eax+0xc) %edx *(ebp+0x10)) # => eax +26269 e9/jump $type-component-match?:end/disp32 +26270 } +26271 $type-component-match?:compare-atom-state: +26272 # if (def->is-atom? != call->is-atom?) return false +26273 8b/-> *ecx 3/r32/ebx # Type-tree-is-atom +26274 39/compare *edx 3/r32/ebx # Type-tree-is-atom +26275 b8/copy-to-eax 0/imm32/false +26276 0f 85/jump-if-!= $type-component-match?:end/disp32 +26277 # if def->is-atom? return (def->value == call->value) +26278 { +26279 $type-component-match?:check-atom: +26280 81 7/subop/compare %ebx 0/imm32/false +26281 74/jump-if-= break/disp8 +26282 $type-component-match?:is-atom: +26283 8b/-> *(ecx+4) 0/r32/eax # Type-tree-value +26284 39/compare *(edx+4) 0/r32/eax # Type-tree-value +26285 0f 94/set-if-= %al +26286 81 4/subop/and %eax 0xff/imm32 +26287 e9/jump $type-component-match?:end/disp32 +26288 } +26289 $type-component-match?:check-left: +26290 # if (!type-component-match?(def->left, call->left)) return false +26291 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +26292 89/<- %ebx 0/r32/eax +26293 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +26294 (type-component-match? %ebx %eax *(ebp+0x10)) # => eax +26295 3d/compare-eax-and 0/imm32/false +26296 74/jump-if-= $type-component-match?:end/disp8 +26297 $type-component-match?:check-right: +26298 # return type-component-match?(def->right, call->right) +26299 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +26300 89/<- %ebx 0/r32/eax +26301 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax +26302 (type-component-match? %ebx %eax *(ebp+0x10)) # => eax +26303 $type-component-match?:end: +26304 # . restore registers +26305 5b/pop-to-ebx +26306 5a/pop-to-edx +26307 59/pop-to-ecx +26308 # . epilogue +26309 89/<- %esp 5/r32/ebp +26310 5d/pop-to-ebp +26311 c3/return +26312 +26313 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 +26314 # . prologue +26315 55/push-ebp +26316 89/<- %ebp 4/r32/esp +26317 # . save registers +26318 51/push-ecx +26319 # +26320 (get-or-insert-handle *(ebp+0x14) *(ebp+8) *(ebp+0xc) 0xc) # => eax +26321 # if parameter wasn't saved, save it 26322 { -26323 3d/compare-eax-and 0x78/imm32/x -26324 0f 85/jump-if-!= break/disp32 -26325 # TODO validate register -26326 (emit-indent *(ebp+8) *Curr-block-depth) -26327 (write-buffered *(ebp+8) "81 5/subop/subtract %esp 4/imm32\n") -26328 (emit-indent *(ebp+8) *Curr-block-depth) -26329 (write-buffered *(ebp+8) "f3 0f 11/<- *esp ") -26330 # var prefix/eax: byte = reg->data[3] -26331 8b/-> *(ebp+0xc) 0/r32/eax -26332 8a/copy-byte *(eax+7) 0/r32/AL -26333 81 4/subop/and %eax 0xff/imm32 -26334 (write-byte-buffered *(ebp+8) %eax) -26335 (write-buffered *(ebp+8) "/x32\n") -26336 e9/jump $emit-push-register:end/disp32 -26337 } -26338 # otherwise push gp register -26339 (emit-indent *(ebp+8) *Curr-block-depth) -26340 (write-buffered *(ebp+8) "ff 6/subop/push %") -26341 (write-buffered *(ebp+8) *(ebp+0xc)) -26342 (write-buffered *(ebp+8) Newline) -26343 $emit-push-register:end: -26344 # . epilogue -26345 89/<- %esp 5/r32/ebp -26346 5d/pop-to-ebp -26347 c3/return -26348 -26349 emit-pop-register: # out: (addr buffered-file), reg: (addr array byte) -26350 # . prologue -26351 55/push-ebp -26352 89/<- %ebp 4/r32/esp -26353 # . save registers -26354 50/push-eax -26355 # eax = reg -26356 8b/-> *(ebp+0xc) 0/r32/eax -26357 # var prefix/eax: byte = reg->data[0] -26358 8a/copy-byte *(eax+4) 0/r32/AL -26359 81 4/subop/and %eax 0xff/imm32 -26360 # if (prefix == 'x') pop to xmm register -26361 { -26362 3d/compare-eax-and 0x78/imm32/x -26363 0f 85/jump-if-!= break/disp32 -26364 # TODO validate register -26365 (emit-indent *(ebp+8) *Curr-block-depth) -26366 (write-buffered *(ebp+8) "f3 0f 10/-> *esp ") -26367 # var prefix/eax: byte = reg->data[3] -26368 8b/-> *(ebp+0xc) 0/r32/eax -26369 8a/copy-byte *(eax+7) 0/r32/AL -26370 81 4/subop/and %eax 0xff/imm32 -26371 (write-byte-buffered *(ebp+8) %eax) -26372 (write-buffered *(ebp+8) "/x32\n") -26373 (emit-indent *(ebp+8) *Curr-block-depth) -26374 (write-buffered *(ebp+8) "81 0/subop/add %esp 4/imm32\n") -26375 e9/jump $emit-pop-register:end/disp32 -26376 } -26377 # otherwise pop to gp register -26378 (emit-indent *(ebp+8) *Curr-block-depth) -26379 (write-buffered *(ebp+8) "8f 0/subop/pop %") -26380 (write-buffered *(ebp+8) *(ebp+0xc)) -26381 (write-buffered *(ebp+8) Newline) -26382 $emit-pop-register:end: -26383 # . restore registers -26384 58/pop-to-eax -26385 # . epilogue -26386 89/<- %esp 5/r32/ebp -26387 5d/pop-to-ebp -26388 c3/return -26389 -26390 # emit clean-up code for 'vars' until a given label is encountered -26391 # doesn't actually modify 'vars' so we need traverse manually inside the stack -26392 emit-cleanup-code-until-target: # out: (addr buffered-file), vars: (addr stack live-var), until-block-label: (addr array byte) -26393 # . prologue -26394 55/push-ebp -26395 89/<- %ebp 4/r32/esp -26396 # . save registers -26397 50/push-eax -26398 51/push-ecx -26399 52/push-edx -26400 53/push-ebx -26401 # ecx = vars -26402 8b/-> *(ebp+0xc) 1/r32/ecx -26403 # var eax: int = vars->top -26404 8b/-> *ecx 0/r32/eax -26405 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] -26406 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size -26407 # var min/ecx: (addr handle var) = vars->data -26408 81 0/subop/add %ecx 8/imm32 -26409 { -26410 $emit-cleanup-code-until-target:loop: -26411 # if (curr < min) break -26412 39/compare %edx 1/r32/ecx -26413 0f 82/jump-if-addr< break/disp32 -26414 # var v/ebx: (handle var) = lookup(*curr) -26415 (lookup *edx *(edx+4)) # => eax -26416 89/<- %ebx 0/r32/eax -26417 # if (v->name == until-block-label) break -26418 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -26419 (string-equal? %eax *(ebp+0x10)) # => eax -26420 3d/compare-eax-and 0/imm32/false -26421 0f 85/jump-if-!= break/disp32 -26422 # if v is in a register -26423 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register -26424 { -26425 0f 84/jump-if-= break/disp32 -26426 { -26427 $emit-cleanup-code-until-target:check-for-previous-spill: -26428 8b/-> *(edx+8) 0/r32/eax # Live-var-register-spilled -26429 3d/compare-eax-and 0/imm32/false -26430 74/jump-if-= break/disp8 -26431 $emit-cleanup-code-until-target:reclaim-var-in-register: -26432 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -26433 (emit-pop-register *(ebp+8) %eax) -26434 } -26435 eb/jump $emit-cleanup-code-until-target:continue/disp8 -26436 } -26437 # otherwise v is on the stack -26438 { -26439 75/jump-if-!= break/disp8 -26440 $emit-cleanup-code-until-target:reclaim-var-on-stack: -26441 (size-of %ebx) # => eax -26442 # don't emit code for labels -26443 3d/compare-eax-and 0/imm32 -26444 74/jump-if-= break/disp8 -26445 # -26446 (emit-indent *(ebp+8) *Curr-block-depth) -26447 (write-buffered *(ebp+8) "81 0/subop/add %esp ") -26448 (write-int32-hex-buffered *(ebp+8) %eax) -26449 (write-buffered *(ebp+8) "/imm32\n") -26450 } -26451 $emit-cleanup-code-until-target:continue: -26452 # curr -= 12 -26453 81 5/subop/subtract %edx 0xc/imm32 -26454 e9/jump loop/disp32 -26455 } -26456 $emit-cleanup-code-until-target:end: -26457 # . restore registers -26458 5b/pop-to-ebx -26459 5a/pop-to-edx -26460 59/pop-to-ecx -26461 58/pop-to-eax -26462 # . epilogue -26463 89/<- %esp 5/r32/ebp -26464 5d/pop-to-ebp -26465 c3/return -26466 -26467 # update Curr-local-stack-offset assuming vars until some block depth are popped -26468 # doesn't actually modify 'vars', so we need traverse manually inside the stack -26469 clean-up-stack-offset-state: # vars: (addr stack live-var), until-block-depth: int -26470 # . prologue -26471 55/push-ebp -26472 89/<- %ebp 4/r32/esp -26473 # . save registers -26474 50/push-eax -26475 51/push-ecx -26476 52/push-edx -26477 53/push-ebx -26478 56/push-esi -26479 # ecx = vars -26480 8b/-> *(ebp+8) 1/r32/ecx -26481 # var esi: int = vars->top -26482 8b/-> *ecx 6/r32/esi -26483 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] -26484 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size -26485 # var min/ecx: (addr handle var) = vars->data -26486 81 0/subop/add %ecx 8/imm32 -26487 # edx = until-block-depth -26488 8b/-> *(ebp+0xc) 2/r32/edx -26489 { -26490 $clean-up-stack-offset-state:loop: -26491 # if (curr < min) break -26492 39/compare %esi 1/r32/ecx -26493 0f 82/jump-if-addr< break/disp32 -26494 # var v/ebx: (addr var) = lookup(*curr) -26495 (lookup *esi *(esi+4)) # => eax -26496 89/<- %ebx 0/r32/eax -26497 # if (v->block-depth < until-block-depth) break -26498 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth -26499 0f 8c/jump-if-< break/disp32 -26500 # if v is in a register -26501 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register -26502 { -26503 0f 84/jump-if-= break/disp32 -26504 { -26505 $clean-up-stack-offset-state:check-for-previous-spill: -26506 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled -26507 3d/compare-eax-and 0/imm32/false -26508 74/jump-if-= break/disp8 -26509 $clean-up-stack-offset-state:reclaim-var-in-register: -26510 81 0/subop/add *Curr-local-stack-offset 4/imm32 -26511 } -26512 eb/jump $clean-up-stack-offset-state:continue/disp8 -26513 } -26514 # otherwise v is on the stack -26515 { -26516 75/jump-if-!= break/disp8 -26517 $clean-up-stack-offset-state:var-on-stack: -26518 (size-of %ebx) # => eax -26519 01/add-to *Curr-local-stack-offset 0/r32/eax -26520 } -26521 $clean-up-stack-offset-state:continue: -26522 # curr -= 12 -26523 81 5/subop/subtract %esi 0xc/imm32 -26524 e9/jump loop/disp32 -26525 } -26526 $clean-up-stack-offset-state:end: -26527 # . restore registers -26528 5e/pop-to-esi -26529 5b/pop-to-ebx -26530 5a/pop-to-edx -26531 59/pop-to-ecx -26532 58/pop-to-eax -26533 # . epilogue -26534 89/<- %esp 5/r32/ebp -26535 5d/pop-to-ebp -26536 c3/return -26537 -26538 # Return true if there isn't a variable in 'vars' with the same block-depth -26539 # and register as 'v'. -26540 # 'v' is guaranteed not to be within 'vars'. -26541 not-yet-spilled-this-block?: # v: (addr var), vars: (addr stack live-var) -> result/eax: boolean -26542 # . prologue -26543 55/push-ebp -26544 89/<- %ebp 4/r32/esp -26545 # . save registers -26546 51/push-ecx -26547 52/push-edx -26548 53/push-ebx -26549 56/push-esi -26550 57/push-edi -26551 # ecx = vars -26552 8b/-> *(ebp+0xc) 1/r32/ecx -26553 # var eax: int = vars->top -26554 8b/-> *ecx 0/r32/eax -26555 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] -26556 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size -26557 # var min/ecx: (addr handle var) = vars->data -26558 8d/copy-address *(ecx+8) 1/r32/ecx -26559 # var depth/ebx: int = v->block-depth -26560 8b/-> *(ebp+8) 3/r32/ebx -26561 8b/-> *(ebx+0x10) 3/r32/ebx # Var-block-depth -26562 # var needle/esi: (addr array byte) = v->register -26563 8b/-> *(ebp+8) 6/r32/esi -26564 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -26565 89/<- %esi 0/r32/eax -26566 { -26567 $not-yet-spilled-this-block?:loop: -26568 # if (curr < min) break -26569 39/compare %edx 1/r32/ecx -26570 0f 82/jump-if-addr< break/disp32 -26571 # var cand/edi: (addr var) = lookup(*curr) -26572 (lookup *edx *(edx+4)) # => eax -26573 89/<- %edi 0/r32/eax -26574 # if (cand->block-depth < depth) break -26575 39/compare *(edi+0x10) 3/r32/ebx # Var-block-depth -26576 0f 8c/jump-if-< break/disp32 -26577 # var cand-reg/edi: (array array byte) = cand->reg -26578 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax -26579 89/<- %edi 0/r32/eax -26580 # if (cand-reg == null) continue -26581 { -26582 $not-yet-spilled-this-block?:check-reg: -26583 81 7/subop/compare %edi 0/imm32 -26584 0f 84/jump-if-= break/disp32 -26585 # if (cand-reg == needle) return true -26586 (string-equal? %esi %edi) # => eax -26587 3d/compare-eax-and 0/imm32/false -26588 74/jump-if-= break/disp8 -26589 $not-yet-spilled-this-block?:return-false: -26590 b8/copy-to-eax 0/imm32/false -26591 eb/jump $not-yet-spilled-this-block?:end/disp8 -26592 } -26593 $not-yet-spilled-this-block?:continue: -26594 # curr -= 12 -26595 81 5/subop/subtract %edx 0xc/imm32 -26596 e9/jump loop/disp32 -26597 } -26598 $not-yet-spilled-this-block?:return-true: -26599 # return true -26600 b8/copy-to-eax 1/imm32/true -26601 $not-yet-spilled-this-block?:end: -26602 # . restore registers -26603 5f/pop-to-edi -26604 5e/pop-to-esi -26605 5b/pop-to-ebx -26606 5a/pop-to-edx -26607 59/pop-to-ecx -26608 # . epilogue -26609 89/<- %esp 5/r32/ebp -26610 5d/pop-to-ebp -26611 c3/return -26612 -26613 # could the register of 'v' ever be written to by one of the vars in fn-outputs? -26614 will-not-write-some-register?: # v: (addr var), stmts: (addr list stmt), fn: (addr function) -> result/eax: boolean -26615 # . prologue -26616 55/push-ebp -26617 89/<- %ebp 4/r32/esp -26618 # eax = v -26619 8b/-> *(ebp+8) 0/r32/eax -26620 # var reg/eax: (addr array byte) = lookup(v->register) -26621 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -26622 # var target/eax: (addr var) = find-register(fn-outputs, reg) -26623 (find-register *(ebp+0x10) %eax) # => eax -26624 # if (target == 0) return true +26323 81 7/subop/compare *eax 0/imm32 +26324 75/jump-if-!= break/disp8 +26325 8b/-> *(ebp+0x10) 1/r32/ecx +26326 89/<- *eax 1/r32/ecx +26327 } +26328 # +26329 (type-equal? *(ebp+0x10) *eax) # => eax +26330 $type-parameter-match?:end: +26331 # . restore registers +26332 59/pop-to-ecx +26333 # . epilogue +26334 89/<- %esp 5/r32/ebp +26335 5d/pop-to-ebp +26336 c3/return +26337 +26338 size-of: # v: (addr var) -> result/eax: int +26339 # . prologue +26340 55/push-ebp +26341 89/<- %ebp 4/r32/esp +26342 # . save registers +26343 51/push-ecx +26344 # var t/ecx: (addr type-tree) = lookup(v->type) +26345 8b/-> *(ebp+8) 1/r32/ecx +26346 #? (write-buffered Stderr "size-of ") +26347 #? (write-int32-hex-buffered Stderr %ecx) +26348 #? (write-buffered Stderr Newline) +26349 #? (write-buffered Stderr "type allocid: ") +26350 #? (write-int32-hex-buffered Stderr *(ecx+8)) +26351 #? (write-buffered Stderr Newline) +26352 #? (flush Stderr) +26353 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +26354 89/<- %ecx 0/r32/eax +26355 # if is-mu-array?(t) return size-of-array(t) +26356 { +26357 (is-mu-array? %ecx) # => eax +26358 3d/compare-eax-and 0/imm32/false +26359 74/jump-if-= break/disp8 +26360 (size-of-array %ecx) # => eax +26361 eb/jump $size-of:end/disp8 +26362 } +26363 # if is-mu-stream?(t) return size-of-stream(t) +26364 { +26365 (is-mu-stream? %ecx) # => eax +26366 3d/compare-eax-and 0/imm32/false +26367 74/jump-if-= break/disp8 +26368 (size-of-stream %ecx) # => eax +26369 eb/jump $size-of:end/disp8 +26370 } +26371 # if (!t->is-atom?) t = lookup(t->left) +26372 { +26373 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +26374 75/jump-if-!= break/disp8 +26375 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +26376 89/<- %ecx 0/r32/eax +26377 } +26378 # TODO: assert t->is-atom? +26379 (size-of-type-id *(ecx+4)) # Type-tree-value => eax +26380 $size-of:end: +26381 # . restore registers +26382 59/pop-to-ecx +26383 # . epilogue +26384 89/<- %esp 5/r32/ebp +26385 5d/pop-to-ebp +26386 c3/return +26387 +26388 size-of-deref: # v: (addr var) -> result/eax: int +26389 # . prologue +26390 55/push-ebp +26391 89/<- %ebp 4/r32/esp +26392 # . save registers +26393 51/push-ecx +26394 # var t/ecx: (addr type-tree) = lookup(v->type) +26395 8b/-> *(ebp+8) 1/r32/ecx +26396 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +26397 89/<- %ecx 0/r32/eax +26398 # TODO: assert(t is an addr) +26399 # t = lookup(t->right) +26400 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +26401 89/<- %ecx 0/r32/eax +26402 # if is-mu-array?(t) return size-of-array(t) +26403 { +26404 (is-mu-array? %ecx) # => eax +26405 3d/compare-eax-and 0/imm32/false +26406 74/jump-if-= break/disp8 +26407 (size-of-array %ecx) # => eax +26408 eb/jump $size-of-deref:end/disp8 +26409 } +26410 # if is-mu-stream?(t) return size-of-stream(t) +26411 { +26412 (is-mu-stream? %ecx) # => eax +26413 3d/compare-eax-and 0/imm32/false +26414 74/jump-if-= break/disp8 +26415 (size-of-stream %ecx) # => eax +26416 eb/jump $size-of-deref:end/disp8 +26417 } +26418 # if (!t->is-atom?) t = lookup(t->left) +26419 { +26420 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +26421 75/jump-if-!= break/disp8 +26422 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +26423 89/<- %ecx 0/r32/eax +26424 } +26425 # TODO: assert t->is-atom? +26426 (size-of-type-id *(ecx+4)) # Type-tree-value => eax +26427 $size-of-deref:end: +26428 # . restore registers +26429 59/pop-to-ecx +26430 # . epilogue +26431 89/<- %esp 5/r32/ebp +26432 5d/pop-to-ebp +26433 c3/return +26434 +26435 is-mu-array?: # t: (addr type-tree) -> result/eax: boolean +26436 # . prologue +26437 55/push-ebp +26438 89/<- %ebp 4/r32/esp +26439 # . save registers +26440 51/push-ecx +26441 # ecx = t +26442 8b/-> *(ebp+8) 1/r32/ecx +26443 # if t->is-atom?, return false +26444 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +26445 75/jump-if-!= $is-mu-array?:return-false/disp8 +26446 # if !t->left->is-atom?, return false +26447 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +26448 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +26449 74/jump-if-= $is-mu-array?:return-false/disp8 +26450 # return t->left->value == array +26451 81 7/subop/compare *(eax+4) 3/imm32/array-type-id # Type-tree-value +26452 0f 94/set-if-= %al +26453 81 4/subop/and %eax 0xff/imm32 +26454 eb/jump $is-mu-array?:end/disp8 +26455 $is-mu-array?:return-false: +26456 b8/copy-to-eax 0/imm32/false +26457 $is-mu-array?:end: +26458 # . restore registers +26459 59/pop-to-ecx +26460 # . epilogue +26461 89/<- %esp 5/r32/ebp +26462 5d/pop-to-ebp +26463 c3/return +26464 +26465 # size of a statically allocated array where the size is part of the type expression +26466 size-of-array: # a: (addr type-tree) -> result/eax: int +26467 # . prologue +26468 55/push-ebp +26469 89/<- %ebp 4/r32/esp +26470 # . save registers +26471 51/push-ecx +26472 52/push-edx +26473 # +26474 8b/-> *(ebp+8) 1/r32/ecx +26475 # TODO: assert that a->left is 'array' +26476 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +26477 89/<- %ecx 0/r32/eax +26478 # var elem-type/edx: type-id = a->right->left->value +26479 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +26480 8b/-> *(eax+4) 2/r32/edx # Type-tree-value +26481 # TODO: assert that a->right->right->left->value == size +26482 # var array-size/ecx: int = a->right->right->left->value-size +26483 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +26484 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +26485 8b/-> *(eax+8) 1/r32/ecx # Type-tree-value-size +26486 # return 4 + array-size * size-of(elem-type) +26487 (size-of-type-id-as-array-element %edx) # => eax +26488 f7 4/subop/multiply-into-edx-eax %ecx +26489 05/add-to-eax 4/imm32 # for array size +26490 # TODO: check edx for overflow +26491 $size-of-array:end: +26492 # . restore registers +26493 5a/pop-to-edx +26494 59/pop-to-ecx +26495 # . epilogue +26496 89/<- %esp 5/r32/ebp +26497 5d/pop-to-ebp +26498 c3/return +26499 +26500 is-mu-stream?: # t: (addr type-tree) -> result/eax: boolean +26501 # . prologue +26502 55/push-ebp +26503 89/<- %ebp 4/r32/esp +26504 # . save registers +26505 51/push-ecx +26506 # ecx = t +26507 8b/-> *(ebp+8) 1/r32/ecx +26508 # if t->is-atom?, return false +26509 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +26510 75/jump-if-!= $is-mu-stream?:return-false/disp8 +26511 # if !t->left->is-atom?, return false +26512 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +26513 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +26514 74/jump-if-= $is-mu-stream?:return-false/disp8 +26515 # return t->left->value == stream +26516 81 7/subop/compare *(eax+4) 0xb/imm32/stream-type-id # Type-tree-value +26517 0f 94/set-if-= %al +26518 81 4/subop/and %eax 0xff/imm32 +26519 eb/jump $is-mu-stream?:end/disp8 +26520 $is-mu-stream?:return-false: +26521 b8/copy-to-eax 0/imm32/false +26522 $is-mu-stream?:end: +26523 # . restore registers +26524 59/pop-to-ecx +26525 # . epilogue +26526 89/<- %esp 5/r32/ebp +26527 5d/pop-to-ebp +26528 c3/return +26529 +26530 # size of a statically allocated stream where the size is part of the type expression +26531 size-of-stream: # a: (addr type-tree) -> result/eax: int +26532 # . prologue +26533 55/push-ebp +26534 89/<- %ebp 4/r32/esp +26535 # +26536 (size-of-array *(ebp+8)) # assumes we ignore the actual type name 'array' in the type +26537 05/add-to-eax 8/imm32 # for read/write pointers +26538 $size-of-stream:end: +26539 # . epilogue +26540 89/<- %esp 5/r32/ebp +26541 5d/pop-to-ebp +26542 c3/return +26543 +26544 size-of-type-id: # t: type-id -> result/eax: int +26545 # . prologue +26546 55/push-ebp +26547 89/<- %ebp 4/r32/esp +26548 # . save registers +26549 51/push-ecx +26550 # var out/ecx: (handle typeinfo) +26551 68/push 0/imm32 +26552 68/push 0/imm32 +26553 89/<- %ecx 4/r32/esp +26554 # eax = t +26555 8b/-> *(ebp+8) 0/r32/eax +26556 # if t is a literal, return 0 +26557 3d/compare-eax-and 0/imm32 +26558 0f 84/jump-if-= $size-of-type-id:end/disp32 # eax changes type from type-id to int +26559 # if t is a byte, return 4 (because we don't really support non-multiples of 4) +26560 3d/compare-eax-and 8/imm32/byte +26561 { +26562 75/jump-if-!= break/disp8 +26563 b8/copy-to-eax 4/imm32 +26564 eb/jump $size-of-type-id:end/disp8 +26565 } +26566 # if t is a handle, return 8 +26567 3d/compare-eax-and 4/imm32/handle +26568 { +26569 75/jump-if-!= break/disp8 +26570 b8/copy-to-eax 8/imm32 +26571 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int +26572 } +26573 # if t is a slice, return 8 +26574 3d/compare-eax-and 0xc/imm32/slice +26575 { +26576 75/jump-if-!= break/disp8 +26577 b8/copy-to-eax 8/imm32 +26578 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int +26579 } +26580 # if t is a user-defined type, return its size +26581 # TODO: support non-atom type +26582 (find-typeinfo %eax %ecx) +26583 { +26584 81 7/subop/compare *ecx 0/imm32 +26585 74/jump-if-= break/disp8 +26586 $size-of-type-id:user-defined: +26587 (lookup *ecx *(ecx+4)) # => eax +26588 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes +26589 eb/jump $size-of-type-id:end/disp8 +26590 } +26591 # otherwise return the word size +26592 b8/copy-to-eax 4/imm32 +26593 $size-of-type-id:end: +26594 # . reclaim locals +26595 81 0/subop/add %esp 8/imm32 +26596 # . restore registers +26597 59/pop-to-ecx +26598 # . epilogue +26599 89/<- %esp 5/r32/ebp +26600 5d/pop-to-ebp +26601 c3/return +26602 +26603 # Minor violation of our type system since it returns an addr. But we could +26604 # replace it with a handle some time. +26605 # Returns null if t is an atom. +26606 type-tail: # t: (addr type-tree) -> out/eax: (addr type-tree) +26607 # . prologue +26608 55/push-ebp +26609 89/<- %ebp 4/r32/esp +26610 # . save registers +26611 51/push-ecx +26612 # eax = 0 +26613 b8/copy-to-eax 0/imm32 +26614 # ecx = t +26615 8b/-> *(ebp+8) 1/r32/ecx +26616 $type-tail:check-atom: +26617 # if t->is-atom? return 0 +26618 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +26619 0f 85/jump-if-!= $type-tail:end/disp32 +26620 # var tail = t->right +26621 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +26622 89/<- %ecx 0/r32/eax +26623 $type-tail:check-singleton: +26624 # if (tail->right == 0) return tail->left 26625 { -26626 3d/compare-eax-and 0/imm32 +26626 81 7/subop/compare *(ecx+0xc) 0/imm32 # Type-tree-right 26627 75/jump-if-!= break/disp8 -26628 b8/copy-to-eax 1/imm32/true -26629 eb/jump $will-not-write-some-register?:end/disp8 +26628 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +26629 e9/jump $type-tail:end/disp32 26630 } -26631 # return !assigns-in-stmts?(stmts, target) -26632 (assigns-in-stmts? *(ebp+0xc) %eax) # => eax -26633 3d/compare-eax-and 0/imm32/false -26634 # assume: true = 1, so no need to mask with 0x000000ff -26635 0f 94/set-if-= %al -26636 $will-not-write-some-register?:end: -26637 # . epilogue -26638 89/<- %esp 5/r32/ebp -26639 5d/pop-to-ebp -26640 c3/return -26641 -26642 # return fn output with matching register -26643 # always returns false if 'reg' is null -26644 find-register: # fn: (addr function), reg: (addr array byte) -> result/eax: (addr var) -26645 # . prologue -26646 55/push-ebp -26647 89/<- %ebp 4/r32/esp -26648 # . save registers -26649 51/push-ecx -26650 # var curr/ecx: (addr list var) = lookup(fn->outputs) -26651 8b/-> *(ebp+8) 1/r32/ecx -26652 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax -26653 89/<- %ecx 0/r32/eax -26654 { -26655 $find-register:loop: -26656 # if (curr == 0) break -26657 81 7/subop/compare %ecx 0/imm32 -26658 74/jump-if-= break/disp8 -26659 # eax = curr->value->register -26660 (lookup *ecx *(ecx+4)) # List-value List-value => eax -26661 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -26662 # if (eax == reg) return curr->value -26663 $find-register:compare: -26664 (string-equal? *(ebp+0xc) %eax) # => eax -26665 { -26666 3d/compare-eax-and 0/imm32/false -26667 74/jump-if-= break/disp8 -26668 $find-register:found: -26669 (lookup *ecx *(ecx+4)) # List-value List-value => eax -26670 eb/jump $find-register:end/disp8 -26671 } -26672 # curr = lookup(curr->next) -26673 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -26674 89/<- %ecx 0/r32/eax -26675 # -26676 eb/jump loop/disp8 -26677 } -26678 $find-register:end: -26679 # . restore registers -26680 59/pop-to-ecx -26681 # . epilogue -26682 89/<- %esp 5/r32/ebp -26683 5d/pop-to-ebp -26684 c3/return -26685 -26686 assigns-in-stmts?: # stmts: (addr list stmt), v: (addr var) -> result/eax: boolean -26687 # . prologue -26688 55/push-ebp -26689 89/<- %ebp 4/r32/esp -26690 # . save registers -26691 51/push-ecx -26692 # var curr/ecx: (addr list stmt) = stmts -26693 8b/-> *(ebp+8) 1/r32/ecx -26694 { -26695 # if (curr == 0) break -26696 81 7/subop/compare %ecx 0/imm32 -26697 74/jump-if-= break/disp8 -26698 # if assigns-in-stmt?(curr->value, v) return true -26699 (lookup *ecx *(ecx+4)) # List-value List-value => eax -26700 (assigns-in-stmt? %eax *(ebp+0xc)) # => eax -26701 3d/compare-eax-and 0/imm32/false -26702 75/jump-if-!= break/disp8 -26703 # curr = lookup(curr->next) -26704 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -26705 89/<- %ecx 0/r32/eax -26706 # -26707 eb/jump loop/disp8 -26708 } -26709 $assigns-in-stmts?:end: -26710 # . restore registers -26711 59/pop-to-ecx -26712 # . epilogue -26713 89/<- %esp 5/r32/ebp -26714 5d/pop-to-ebp -26715 c3/return -26716 -26717 assigns-in-stmt?: # stmt: (addr stmt), v: (addr var) -> result/eax: boolean -26718 # . prologue -26719 55/push-ebp -26720 89/<- %ebp 4/r32/esp -26721 # . save registers -26722 51/push-ecx -26723 # ecx = stmt -26724 8b/-> *(ebp+8) 1/r32/ecx -26725 # if stmt is a stmt1, return assigns-in-stmt-vars?(stmt->outputs, v) -26726 { -26727 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag -26728 75/jump-if-!= break/disp8 -26729 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -26730 (assigns-in-stmt-vars? %eax *(ebp+0xc)) # => eax -26731 eb/jump $assigns-in-stmt?:end/disp8 -26732 } -26733 # if stmt is a block, return assigns-in-stmts?(stmt->stmts, v) -26734 { -26735 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag -26736 75/jump-if-!= break/disp8 -26737 (lookup *(ecx+4) *(ecx+8)) # Block-stmts Block-stmts => eax -26738 (assigns-in-stmts? %eax *(ebp+0xc)) # => eax -26739 eb/jump $assigns-in-stmt?:end/disp8 -26740 } -26741 # otherwise return false -26742 b8/copy 0/imm32/false -26743 $assigns-in-stmt?:end: -26744 # . restore registers -26745 59/pop-to-ecx -26746 # . epilogue -26747 89/<- %esp 5/r32/ebp -26748 5d/pop-to-ebp -26749 c3/return +26631 # if tail->right->left is an array-capacity, return tail->left +26632 { +26633 $type-tail:check-array-capacity: +26634 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +26635 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +26636 75/jump-if-!= break/disp8 +26637 $type-tail:check-array-capacity-1: +26638 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +26639 3d/compare-eax-and 0/imm32 +26640 74/jump-if-= break/disp8 +26641 $type-tail:check-array-capacity-2: +26642 (is-simple-mu-type? %eax 9) # array-capacity => eax +26643 3d/compare-eax-and 0/imm32/false +26644 74/jump-if-= break/disp8 +26645 $type-tail:array-capacity: +26646 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +26647 eb/jump $type-tail:end/disp8 +26648 } +26649 $type-tail:check-compound-left: +26650 # if !tail->left->is-atom? return tail->left +26651 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +26652 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +26653 74/jump-if-= $type-tail:end/disp8 +26654 $type-tail:return-tail: +26655 # return tail +26656 89/<- %eax 1/r32/ecx +26657 $type-tail:end: +26658 # . restore registers +26659 59/pop-to-ecx +26660 # . epilogue +26661 89/<- %esp 5/r32/ebp +26662 5d/pop-to-ebp +26663 c3/return +26664 +26665 type-equal?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean +26666 # . prologue +26667 55/push-ebp +26668 89/<- %ebp 4/r32/esp +26669 # . save registers +26670 51/push-ecx +26671 52/push-edx +26672 53/push-ebx +26673 # ecx = a +26674 8b/-> *(ebp+8) 1/r32/ecx +26675 # edx = b +26676 8b/-> *(ebp+0xc) 2/r32/edx +26677 $type-equal?:compare-addr: +26678 # if (a == b) return true +26679 8b/-> %ecx 0/r32/eax # Var-type +26680 39/compare %edx 0/r32/eax # Var-type +26681 b8/copy-to-eax 1/imm32/true +26682 0f 84/jump-if-= $type-equal?:end/disp32 +26683 $type-equal?:compare-null-a: +26684 # if (a == 0) return false +26685 b8/copy-to-eax 0/imm32/false +26686 81 7/subop/compare %ecx 0/imm32 +26687 0f 84/jump-if-= $type-equal?:end/disp32 +26688 $type-equal?:compare-null-b: +26689 # if (b == 0) return false +26690 81 7/subop/compare %edx 0/imm32 +26691 0f 84/jump-if-= $type-equal?:end/disp32 +26692 $type-equal?:compare-atom-state: +26693 # if (a->is-atom? != b->is-atom?) return false +26694 8b/-> *ecx 3/r32/ebx # Type-tree-is-atom +26695 39/compare *edx 3/r32/ebx # Type-tree-is-atom +26696 b8/copy-to-eax 0/imm32/false +26697 0f 85/jump-if-!= $type-equal?:end/disp32 +26698 # if a->is-atom? return (a->value == b->value) +26699 { +26700 $type-equal?:check-atom: +26701 81 7/subop/compare %ebx 0/imm32/false +26702 74/jump-if-= break/disp8 +26703 $type-equal?:is-atom: +26704 8b/-> *(ecx+4) 0/r32/eax # Type-tree-value +26705 39/compare *(edx+4) 0/r32/eax # Type-tree-value +26706 0f 94/set-if-= %al +26707 81 4/subop/and %eax 0xff/imm32 +26708 e9/jump $type-equal?:end/disp32 +26709 } +26710 $type-equal?:check-left: +26711 # if (!type-equal?(a->left, b->left)) return false +26712 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +26713 89/<- %ebx 0/r32/eax +26714 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +26715 (type-equal? %eax %ebx) # => eax +26716 3d/compare-eax-and 0/imm32/false +26717 74/jump-if-= $type-equal?:end/disp8 +26718 $type-equal?:check-right: +26719 # return type-equal?(a->right, b->right) +26720 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +26721 89/<- %ebx 0/r32/eax +26722 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax +26723 (type-equal? %eax %ebx) # => eax +26724 $type-equal?:end: +26725 # . restore registers +26726 5b/pop-to-ebx +26727 5a/pop-to-edx +26728 59/pop-to-ecx +26729 # . epilogue +26730 89/<- %esp 5/r32/ebp +26731 5d/pop-to-ebp +26732 c3/return +26733 +26734 ####################################################### +26735 # Code-generation +26736 ####################################################### +26737 +26738 == data +26739 +26740 # Global state added to each var record when performing code-generation. +26741 Curr-local-stack-offset: # (addr int) +26742 0/imm32 +26743 +26744 == code +26745 +26746 # We may not need to pass err/ed everywhere here. I think they're relics of Mu +26747 # getting type checks later in life. +26748 # But we do need them for runtime checks, particularly array index bounds checks. +26749 # So perhaps it's not worth taking them out. They're a safety net. 26750 -26751 assigns-in-stmt-vars?: # stmt-var: (addr stmt-var), v: (addr var) -> result/eax: boolean +26751 emit-subx: # out: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) 26752 # . prologue 26753 55/push-ebp 26754 89/<- %ebp 4/r32/esp 26755 # . save registers -26756 51/push-ecx -26757 # var curr/ecx: (addr stmt-var) = stmt-var -26758 8b/-> *(ebp+8) 1/r32/ecx +26756 50/push-eax +26757 # var curr/eax: (addr function) = *Program->functions +26758 (lookup *_Program-functions *_Program-functions->payload) # => eax 26759 { -26760 # if (curr == 0) break -26761 81 7/subop/compare %ecx 0/imm32 -26762 74/jump-if-= break/disp8 -26763 # eax = lookup(curr->value) -26764 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -26765 # if (eax == v && curr->is-deref? == false) return true -26766 { -26767 39/compare *(ebp+0xc) 0/r32/eax -26768 75/jump-if-!= break/disp8 -26769 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -26770 75/jump-if-!= break/disp8 -26771 b8/copy-to-eax 1/imm32/true -26772 eb/jump $assigns-in-stmt-vars?:end/disp8 -26773 } -26774 # curr = lookup(curr->next) -26775 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax -26776 89/<- %ecx 0/r32/eax -26777 # -26778 eb/jump loop/disp8 -26779 } -26780 $assigns-in-stmt-vars?:end: -26781 # . restore registers -26782 59/pop-to-ecx -26783 # . epilogue -26784 89/<- %esp 5/r32/ebp -26785 5d/pop-to-ebp -26786 c3/return -26787 -26788 # is there a var before 'v' with the same block-depth and register on the 'vars' stack? -26789 # v is guaranteed to be within vars -26790 # 'start' is provided as an optimization, a pointer within vars -26791 # *start == v -26792 same-register-spilled-before?: # v: (addr var), vars: (addr stack (handle var)), start: (addr var) -> result/eax: boolean -26793 # . prologue -26794 55/push-ebp -26795 89/<- %ebp 4/r32/esp -26796 # . save registers -26797 51/push-ecx -26798 52/push-edx -26799 53/push-ebx -26800 56/push-esi -26801 57/push-edi -26802 # ecx = v -26803 8b/-> *(ebp+8) 1/r32/ecx -26804 # var reg/edx: (addr array byte) = lookup(v->register) -26805 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -26806 89/<- %edx 0/r32/eax -26807 # var depth/ebx: int = v->block-depth -26808 8b/-> *(ecx+0x10) 3/r32/ebx # Var-block-depth -26809 # var min/ecx: (addr handle var) = vars->data -26810 8b/-> *(ebp+0xc) 1/r32/ecx -26811 81 0/subop/add %ecx 8/imm32 -26812 # TODO: check that start >= min and start < &vars->data[top] -26813 # TODO: check that *start == v -26814 # var curr/esi: (addr handle var) = start -26815 8b/-> *(ebp+0x10) 6/r32/esi -26816 # curr -= 8 -26817 81 5/subop/subtract %esi 8/imm32 -26818 { -26819 $same-register-spilled-before?:loop: -26820 # if (curr < min) break -26821 39/compare %esi 1/r32/ecx -26822 0f 82/jump-if-addr< break/disp32 -26823 # var x/eax: (addr var) = lookup(*curr) -26824 (lookup *esi *(esi+4)) # => eax -26825 # if (x->block-depth < depth) break -26826 39/compare *(eax+0x10) 3/r32/ebx # Var-block-depth -26827 0f 8c/jump-if-< break/disp32 -26828 # if (x->register == 0) continue -26829 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -26830 74/jump-if-= $same-register-spilled-before?:continue/disp8 -26831 # if (x->register == reg) return true -26832 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -26833 (string-equal? %eax %edx) # => eax -26834 3d/compare-eax-and 0/imm32/false -26835 b8/copy-to-eax 1/imm32/true -26836 75/jump-if-!= $same-register-spilled-before?:end/disp8 -26837 $same-register-spilled-before?:continue: -26838 # curr -= 8 -26839 81 5/subop/subtract %esi 8/imm32 -26840 e9/jump loop/disp32 -26841 } -26842 $same-register-spilled-before?:false: -26843 b8/copy-to-eax 0/imm32/false -26844 $same-register-spilled-before?:end: -26845 # . restore registers -26846 5f/pop-to-edi -26847 5e/pop-to-esi -26848 5b/pop-to-ebx -26849 5a/pop-to-edx -26850 59/pop-to-ecx -26851 # . epilogue -26852 89/<- %esp 5/r32/ebp -26853 5d/pop-to-ebp -26854 c3/return -26855 -26856 # clean up global state for 'vars' until some block depth (inclusive) -26857 clean-up-blocks: # vars: (addr stack live-var), until-block-depth: int, fn: (addr function) -26858 # . prologue -26859 55/push-ebp -26860 89/<- %ebp 4/r32/esp -26861 # . save registers -26862 50/push-eax -26863 51/push-ecx -26864 56/push-esi -26865 # esi = vars -26866 8b/-> *(ebp+8) 6/r32/esi -26867 # ecx = until-block-depth -26868 8b/-> *(ebp+0xc) 1/r32/ecx -26869 { -26870 $clean-up-blocks:reclaim-loop: -26871 # if (vars->top <= 0) break -26872 8b/-> *esi 0/r32/eax # Stack-top -26873 3d/compare-eax-and 0/imm32 -26874 0f 8e/jump-if-<= break/disp32 -26875 # var v/eax: (addr var) = lookup(vars[vars->top-12]) -26876 (lookup *(esi+eax-4) *(esi+eax)) # vars + 8 + vars->top - 12 => eax -26877 # if (v->block-depth < until-block-depth) break -26878 39/compare *(eax+0x10) 1/r32/ecx # Var-block-depth -26879 0f 8c/jump-if-< break/disp32 -26880 (pop %esi) # => eax -26881 (pop %esi) # => eax -26882 (pop %esi) # => eax -26883 e9/jump loop/disp32 -26884 } -26885 $clean-up-blocks:end: -26886 # . restore registers -26887 5e/pop-to-esi -26888 59/pop-to-ecx -26889 58/pop-to-eax -26890 # . epilogue -26891 89/<- %esp 5/r32/ebp -26892 5d/pop-to-ebp -26893 c3/return -26894 -26895 reg-in-function-outputs?: # fn: (addr function), target: (addr array byte) -> result/eax: boolean -26896 # . prologue -26897 55/push-ebp -26898 89/<- %ebp 4/r32/esp -26899 # . save registers -26900 51/push-ecx -26901 # var curr/ecx: (addr list var) = lookup(fn->outputs) -26902 8b/-> *(ebp+8) 0/r32/eax -26903 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax -26904 89/<- %ecx 0/r32/eax -26905 # while curr != null -26906 { -26907 81 7/subop/compare %ecx 0/imm32 -26908 74/jump-if-= break/disp8 -26909 # var v/eax: (addr var) = lookup(curr->value) -26910 (lookup *ecx *(ecx+4)) # List-value List-value => eax -26911 # var reg/eax: (addr array byte) = lookup(v->register) -26912 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -26913 # if (reg == target) return true -26914 (string-equal? %eax *(ebp+0xc)) # => eax -26915 3d/compare-eax-and 0/imm32/false -26916 75/jump-if-!= $reg-in-function-outputs?:end/disp8 -26917 # curr = curr->next -26918 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -26919 89/<- %ecx 0/r32/eax -26920 # -26921 eb/jump loop/disp8 -26922 } -26923 # return false -26924 b8/copy-to-eax 0/imm32 -26925 $reg-in-function-outputs?:end: -26926 # . restore registers -26927 59/pop-to-ecx -26928 # . epilogue -26929 89/<- %esp 5/r32/ebp -26930 5d/pop-to-ebp -26931 c3/return -26932 -26933 emit-subx-var-def: # out: (addr buffered-file), stmt: (addr stmt) -26934 # . prologue -26935 55/push-ebp -26936 89/<- %ebp 4/r32/esp -26937 # . save registers -26938 50/push-eax -26939 51/push-ecx -26940 52/push-edx -26941 # eax = stmt -26942 8b/-> *(ebp+0xc) 0/r32/eax -26943 # var v/ecx: (addr var) -26944 (lookup *(eax+4) *(eax+8)) # Vardef-var Vardef-var => eax -26945 89/<- %ecx 0/r32/eax -26946 # v->block-depth = *Curr-block-depth -26947 8b/-> *Curr-block-depth 0/r32/eax -26948 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth -26949 # var n/edx: int = size-of(stmt->var) -26950 (size-of %ecx) # => eax -26951 89/<- %edx 0/r32/eax -26952 # *Curr-local-stack-offset -= n -26953 29/subtract-from *Curr-local-stack-offset 2/r32/edx -26954 # v->offset = *Curr-local-stack-offset -26955 8b/-> *Curr-local-stack-offset 0/r32/eax -26956 89/<- *(ecx+0x14) 0/r32/eax # Var-offset -26957 # if v is an array, do something special to initialize it -26958 { -26959 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -26960 (is-mu-array? %eax) # => eax -26961 3d/compare-eax-and 0/imm32/false -26962 0f 84/jump-if-= break/disp32 -26963 # var array-size-without-size/edx: int = n-4 -26964 81 5/subop/subtract %edx 4/imm32 -26965 # -26966 (emit-array-data-initialization *(ebp+8) %edx) -26967 e9/jump $emit-subx-var-def:end/disp32 -26968 } -26969 # another special-case for initializing streams -26970 # a stream is an array with 2 extra pointers -26971 { -26972 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -26973 (is-mu-stream? %eax) # => eax -26974 3d/compare-eax-and 0/imm32/false -26975 0f 84/jump-if-= break/disp32 -26976 # var array-size-without-size/edx: int = n-12 -26977 81 5/subop/subtract %edx 0xc/imm32 -26978 (emit-array-data-initialization *(ebp+8) %edx) -26979 # emit read and write pointers -26980 (emit-indent *(ebp+8) *Curr-block-depth) -26981 (write-buffered *(ebp+8) "68/push 0/imm32\n") -26982 (emit-indent *(ebp+8) *Curr-block-depth) -26983 (write-buffered *(ebp+8) "68/push 0/imm32\n") -26984 # -26985 eb/jump $emit-subx-var-def:end/disp8 -26986 } -26987 # while n > 0 -26988 { -26989 81 7/subop/compare %edx 0/imm32 -26990 7e/jump-if-<= break/disp8 -26991 (emit-indent *(ebp+8) *Curr-block-depth) -26992 (write-buffered *(ebp+8) "68/push 0/imm32\n") -26993 # n -= 4 -26994 81 5/subop/subtract %edx 4/imm32 -26995 # -26996 eb/jump loop/disp8 -26997 } -26998 $emit-subx-var-def:end: -26999 # . restore registers -27000 5a/pop-to-edx -27001 59/pop-to-ecx -27002 58/pop-to-eax -27003 # . epilogue -27004 89/<- %esp 5/r32/ebp -27005 5d/pop-to-ebp -27006 c3/return -27007 -27008 emit-array-data-initialization: # out: (addr buffered-file), n: int -27009 # . prologue -27010 55/push-ebp -27011 89/<- %ebp 4/r32/esp -27012 # -27013 (emit-indent *(ebp+8) *Curr-block-depth) -27014 (write-buffered *(ebp+8) "(push-n-zero-bytes ") -27015 (write-int32-hex-buffered *(ebp+8) *(ebp+0xc)) -27016 (write-buffered *(ebp+8) ")\n") -27017 (emit-indent *(ebp+8) *Curr-block-depth) -27018 (write-buffered *(ebp+8) "68/push ") -27019 (write-int32-hex-buffered *(ebp+8) *(ebp+0xc)) -27020 (write-buffered *(ebp+8) "/imm32\n") -27021 $emit-array-data-initialization:end: -27022 # . epilogue -27023 89/<- %esp 5/r32/ebp -27024 5d/pop-to-ebp -27025 c3/return -27026 -27027 emit-subx-stmt: # out: (addr buffered-file), stmt: (addr stmt), primitives: (addr primitive), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -27028 # . prologue -27029 55/push-ebp -27030 89/<- %ebp 4/r32/esp -27031 # . save registers -27032 50/push-eax -27033 51/push-ecx -27034 # - some special-case primitives that don't actually use the 'primitives' data structure -27035 # var op/ecx: (addr array byte) = lookup(stmt->operation) -27036 8b/-> *(ebp+0xc) 1/r32/ecx -27037 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -27038 89/<- %ecx 0/r32/eax -27039 # array size -27040 { -27041 # if (!string-equal?(stmt->operation, "length")) break -27042 (string-equal? %ecx "length") # => eax -27043 3d/compare-eax-and 0/imm32 -27044 0f 84/jump-if-= break/disp32 -27045 (translate-mu-length-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) -27046 e9/jump $emit-subx-stmt:end/disp32 -27047 } -27048 # index into array -27049 { -27050 # if (!string-equal?(stmt->operation, "index")) break -27051 (string-equal? %ecx "index") # => eax -27052 3d/compare-eax-and 0/imm32 -27053 0f 84/jump-if-= break/disp32 -27054 (translate-mu-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -27055 e9/jump $emit-subx-stmt:end/disp32 -27056 } -27057 # compute-offset for index into array -27058 { -27059 # if (!string-equal?(stmt->operation, "compute-offset")) break -27060 (string-equal? %ecx "compute-offset") # => eax -27061 3d/compare-eax-and 0/imm32 -27062 0f 84/jump-if-= break/disp32 -27063 (translate-mu-compute-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) -27064 e9/jump $emit-subx-stmt:end/disp32 -27065 } -27066 # get field from record -27067 { -27068 # if (!string-equal?(stmt->operation, "get")) break -27069 (string-equal? %ecx "get") # => eax -27070 3d/compare-eax-and 0/imm32 -27071 0f 84/jump-if-= break/disp32 -27072 (translate-mu-get-stmt *(ebp+8) *(ebp+0xc)) -27073 e9/jump $emit-subx-stmt:end/disp32 -27074 } -27075 # allocate scalar -27076 { -27077 # if (!string-equal?(stmt->operation, "allocate")) break -27078 (string-equal? %ecx "allocate") # => eax -27079 3d/compare-eax-and 0/imm32 -27080 0f 84/jump-if-= break/disp32 -27081 (translate-mu-allocate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) -27082 e9/jump $emit-subx-stmt:end/disp32 -27083 } -27084 # copy-object -27085 { -27086 # if (!string-equal?(stmt->operation, "copy-object")) break -27087 (string-equal? %ecx "copy-object") # => eax -27088 3d/compare-eax-and 0/imm32 -27089 0f 84/jump-if-= break/disp32 -27090 (translate-mu-copy-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) -27091 e9/jump $emit-subx-stmt:end/disp32 -27092 } -27093 # clear-object -27094 { -27095 # if (!string-equal?(stmt->operation, "clear-object")) break -27096 (string-equal? %ecx "clear-object") # => eax -27097 3d/compare-eax-and 0/imm32 -27098 0f 84/jump-if-= break/disp32 -27099 (translate-mu-clear-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) -27100 e9/jump $emit-subx-stmt:end/disp32 -27101 } -27102 # allocate array -27103 { -27104 # if (!string-equal?(stmt->operation, "populate")) break -27105 (string-equal? %ecx "populate") # => eax -27106 3d/compare-eax-and 0/imm32 -27107 0f 84/jump-if-= break/disp32 -27108 (translate-mu-populate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) -27109 e9/jump $emit-subx-stmt:end/disp32 -27110 } -27111 # allocate stream -27112 { -27113 # if (!string-equal?(stmt->operation, "populate-stream")) break -27114 (string-equal? %ecx "populate-stream") # => eax -27115 3d/compare-eax-and 0/imm32 -27116 0f 84/jump-if-= break/disp32 -27117 (translate-mu-populate-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) -27118 e9/jump $emit-subx-stmt:end/disp32 -27119 } -27120 # read from stream -27121 { -27122 # if (!string-equal?(stmt->operation, "read-from-stream")) break -27123 (string-equal? %ecx "read-from-stream") # => eax -27124 3d/compare-eax-and 0/imm32 -27125 0f 84/jump-if-= break/disp32 -27126 (translate-mu-read-from-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) -27127 e9/jump $emit-subx-stmt:end/disp32 -27128 } -27129 # write to stream -27130 { -27131 # if (!string-equal?(stmt->operation, "write-to-stream")) break -27132 (string-equal? %ecx "write-to-stream") # => eax -27133 3d/compare-eax-and 0/imm32 -27134 0f 84/jump-if-= break/disp32 -27135 (translate-mu-write-to-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) -27136 e9/jump $emit-subx-stmt:end/disp32 -27137 } -27138 # - if stmt matches a primitive, emit it -27139 { -27140 $emit-subx-stmt:check-for-primitive: -27141 # var curr/eax: (addr primitive) -27142 (find-matching-primitive *(ebp+0x10) *(ebp+0xc)) # primitives, stmt => eax -27143 3d/compare-eax-and 0/imm32 -27144 74/jump-if-= break/disp8 -27145 $emit-subx-stmt:primitive: -27146 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax) # out, stmt, curr -27147 e9/jump $emit-subx-stmt:end/disp32 -27148 } -27149 # - otherwise emit a call -27150 # TODO: type-checking -27151 $emit-subx-stmt:call: -27152 (emit-call *(ebp+8) *(ebp+0xc)) -27153 $emit-subx-stmt:end: -27154 # . restore registers -27155 59/pop-to-ecx -27156 58/pop-to-eax -27157 # . epilogue -27158 89/<- %esp 5/r32/ebp -27159 5d/pop-to-ebp -27160 c3/return -27161 -27162 translate-mu-length-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -27163 # . prologue -27164 55/push-ebp -27165 89/<- %ebp 4/r32/esp -27166 # . save registers -27167 50/push-eax -27168 51/push-ecx -27169 52/push-edx -27170 53/push-ebx -27171 56/push-esi -27172 # esi = stmt -27173 8b/-> *(ebp+0xc) 6/r32/esi -27174 # var base/ebx: (addr var) = stmt->inouts[0]->value -27175 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -27176 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27177 89/<- %ebx 0/r32/eax -27178 # var elemsize/ecx: int = array-element-size(base) -27179 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -27180 89/<- %ecx 0/r32/eax -27181 # var outreg/edx: (addr array byte) = stmt->outputs[0]->value->register -27182 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -27183 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27184 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -27185 89/<- %edx 0/r32/eax -27186 # if elemsize == 1 -27187 { -27188 81 7/subop/compare %ecx 1/imm32 -27189 75/jump-if-!= break/disp8 -27190 $translate-mu-length-stmt:size-1: -27191 (emit-save-size-to *(ebp+8) %ebx %edx) -27192 e9/jump $translate-mu-length-stmt:end/disp32 -27193 } -27194 # if elemsize is a power of 2 less than 256 -27195 { -27196 (power-of-2? %ecx *(ebp+0x10) *(ebp+0x14)) # => eax -27197 3d/compare-eax-and 0/imm32/false -27198 74/jump-if-= break/disp8 -27199 81 7/subop/compare %ecx 0xff/imm32 -27200 7f/jump-if-> break/disp8 -27201 $translate-mu-length-stmt:size-power-of-2: -27202 (emit-save-size-to *(ebp+8) %ebx %edx) -27203 (emit-divide-by-shift-right *(ebp+8) %edx %ecx) -27204 e9/jump $translate-mu-length-stmt:end/disp32 -27205 } -27206 # otherwise, the complex case -27207 # . emit register spills -27208 { -27209 $translate-mu-length-stmt:complex: -27210 (string-equal? %edx "eax") # => eax -27211 3d/compare-eax-and 0/imm32/false -27212 75/break-if-!= break/disp8 -27213 (emit-indent *(ebp+8) *Curr-block-depth) -27214 (write-buffered *(ebp+8) "50/push-eax\n") -27215 } -27216 { -27217 (string-equal? %edx "ecx") # => eax -27218 3d/compare-eax-and 0/imm32/false -27219 75/break-if-!= break/disp8 -27220 (emit-indent *(ebp+8) *Curr-block-depth) -27221 (write-buffered *(ebp+8) "51/push-ecx\n") -27222 } -27223 { -27224 (string-equal? %edx "edx") # => eax -27225 3d/compare-eax-and 0/imm32/false -27226 75/break-if-!= break/disp8 -27227 (emit-indent *(ebp+8) *Curr-block-depth) -27228 (write-buffered *(ebp+8) "52/push-edx\n") -27229 } -27230 # . -27231 (emit-save-size-to *(ebp+8) %ebx "eax") -27232 (emit-indent *(ebp+8) *Curr-block-depth) -27233 (write-buffered *(ebp+8) "31/xor %edx 2/r32/edx\n") -27234 (emit-indent *(ebp+8) *Curr-block-depth) -27235 (write-buffered *(ebp+8) "b9/copy-to-ecx ") -27236 (write-int32-hex-buffered *(ebp+8) %ecx) -27237 (write-buffered *(ebp+8) "/imm32\n") -27238 (emit-indent *(ebp+8) *Curr-block-depth) -27239 (write-buffered *(ebp+8) "f7 7/subop/idiv-eax-edx-by %ecx\n") -27240 { -27241 (string-equal? %edx "eax") # => eax -27242 3d/compare-eax-and 0/imm32/false -27243 75/break-if-!= break/disp8 -27244 (emit-indent *(ebp+8) *Curr-block-depth) -27245 (write-buffered *(ebp+8) "89/<- %") -27246 (write-buffered *(ebp+8) %edx) -27247 (write-buffered *(ebp+8) " 0/r32/eax\n") -27248 } -27249 # . emit register restores -27250 { -27251 (string-equal? %edx "edx") # => eax -27252 3d/compare-eax-and 0/imm32/false -27253 75/break-if-!= break/disp8 -27254 (emit-indent *(ebp+8) *Curr-block-depth) -27255 (write-buffered *(ebp+8) "5a/pop-to-edx\n") -27256 } -27257 { -27258 (string-equal? %edx "ecx") # => eax -27259 3d/compare-eax-and 0/imm32/false -27260 75/break-if-!= break/disp8 -27261 (emit-indent *(ebp+8) *Curr-block-depth) -27262 (write-buffered *(ebp+8) "59/pop-to-ecx\n") -27263 } -27264 { -27265 (string-equal? %edx "eax") # => eax -27266 3d/compare-eax-and 0/imm32/false -27267 75/break-if-!= break/disp8 -27268 (emit-indent *(ebp+8) *Curr-block-depth) -27269 (write-buffered *(ebp+8) "58/pop-to-eax\n") -27270 } -27271 $translate-mu-length-stmt:end: -27272 # . restore registers -27273 5e/pop-to-esi -27274 5b/pop-to-ebx -27275 5a/pop-to-edx -27276 59/pop-to-ecx -27277 58/pop-to-eax -27278 # . epilogue -27279 89/<- %esp 5/r32/ebp -27280 5d/pop-to-ebp -27281 c3/return -27282 -27283 array-element-size: # arr: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -27284 # . prologue -27285 55/push-ebp -27286 89/<- %ebp 4/r32/esp -27287 # -27288 (array-element-type-id *(ebp+8) *(ebp+0xc) *(ebp+0x10)) # => eax -27289 (size-of-type-id-as-array-element %eax) # => eax -27290 $array-element-size:end: -27291 # . epilogue -27292 89/<- %esp 5/r32/ebp -27293 5d/pop-to-ebp -27294 c3/return -27295 -27296 array-element-type-id: # v: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: type-id -27297 # precondition: n is positive -27298 # . prologue -27299 55/push-ebp -27300 89/<- %ebp 4/r32/esp -27301 # -27302 8b/-> *(ebp+8) 0/r32/eax -27303 # var t/eax: (addr type-tree) -27304 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -27305 # if t == 0 abort -27306 3d/compare-eax-with 0/imm32 -27307 0f 84/jump-if-== $array-element-type-id:error0/disp32 -27308 # if t->is-atom? abort -27309 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -27310 0f 85/jump-if-!= $array-element-type-id:error1/disp32 -27311 # if (t->left == addr) t = t->right -27312 { -27313 50/push-eax -27314 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -27315 (is-simple-mu-type? %eax 2) # addr => eax -27316 3d/compare-eax-with 0/imm32/false -27317 58/pop-to-eax -27318 74/jump-if-= break/disp8 -27319 $array-element-type-id:skip-addr: -27320 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -27321 } -27322 # if t == 0 abort -27323 3d/compare-eax-with 0/imm32 -27324 0f 84/jump-if-= $array-element-type-id:error2/disp32 -27325 # if t->is-atom? abort -27326 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -27327 0f 85/jump-if-!= $array-element-type-id:error2/disp32 -27328 # if t->left != array abort -27329 { -27330 50/push-eax -27331 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -27332 (is-simple-mu-type? %eax 3) # array => eax -27333 3d/compare-eax-with 0/imm32/false -27334 58/pop-to-eax -27335 $array-element-type-id:no-array: -27336 0f 84/jump-if-= $array-element-type-id:error2/disp32 -27337 } -27338 $array-element-type-id:skip-array: -27339 # t = t->right -27340 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -27341 # if t == 0 abort -27342 3d/compare-eax-with 0/imm32 -27343 0f 84/jump-if-= $array-element-type-id:error2/disp32 -27344 # if t->is-atom? abort -27345 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -27346 0f 85/jump-if-!= $array-element-type-id:error2/disp32 -27347 # t = t->left -27348 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -27349 # if (!t->is-atom?) t = t->left # TODO: assumes array element size can be determined from just first word of array element type -27350 # if (t->is-atom == false) t = lookup(t->left) -27351 { -27352 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -27353 75/jump-if-!= break/disp8 -27354 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -27355 } -27356 # return t->value -27357 8b/-> *(eax+4) 0/r32/eax # Type-tree-value -27358 $array-element-type-id:end: -27359 # . epilogue -27360 89/<- %esp 5/r32/ebp -27361 5d/pop-to-ebp -27362 c3/return -27363 -27364 $array-element-type-id:error0: -27365 (write-buffered *(ebp+0xc) "array-element-type-id: var '") -27366 50/push-eax -27367 8b/-> *(ebp+8) 0/r32/eax -27368 (lookup *eax *(eax+4)) # Var-name Var-name => eax -27369 (write-buffered *(ebp+0xc) %eax) -27370 58/pop-to-eax -27371 (write-buffered *(ebp+0xc) "' has no type\n") -27372 (flush *(ebp+0xc)) -27373 (stop *(ebp+0x10) 1) -27374 # never gets here -27375 -27376 $array-element-type-id:error1: -27377 (write-buffered *(ebp+0xc) "array-element-type-id: var '") -27378 50/push-eax -27379 8b/-> *(ebp+8) 0/r32/eax -27380 (lookup *eax *(eax+4)) # Var-name Var-name => eax -27381 (write-buffered *(ebp+0xc) %eax) -27382 58/pop-to-eax -27383 (write-buffered *(ebp+0xc) "' has atomic type ") -27384 (write-int32-hex-buffered *(ebp+0xc) *(eax+4)) # Type-tree-value -27385 (write-buffered *(ebp+0xc) Newline) -27386 (flush *(ebp+0xc)) -27387 (stop *(ebp+0x10) 1) -27388 # never gets here -27389 -27390 $array-element-type-id:error2: -27391 (write-buffered *(ebp+0xc) "array-element-type-id: var '") -27392 50/push-eax -27393 8b/-> *(ebp+8) 0/r32/eax -27394 (lookup *eax *(eax+4)) # Var-name Var-name => eax -27395 (write-buffered *(ebp+0xc) %eax) -27396 58/pop-to-eax -27397 (write-buffered *(ebp+0xc) "' has non-array type\n") -27398 (flush *(ebp+0xc)) -27399 (stop *(ebp+0x10) 1) -27400 # never gets here -27401 -27402 size-of-type-id-as-array-element: # t: type-id -> result/eax: int -27403 # . prologue -27404 55/push-ebp -27405 89/<- %ebp 4/r32/esp -27406 # eax = t -27407 8b/-> *(ebp+8) 0/r32/eax -27408 # if t is 'byte', size is 1 -27409 3d/compare-eax-and 8/imm32/byte -27410 { -27411 75/jump-if-!= break/disp8 -27412 b8/copy-to-eax 1/imm32 -27413 eb/jump $size-of-type-id-as-array-element:end/disp8 -27414 } -27415 # otherwise proceed as usual -27416 (size-of-type-id %eax) # => eax -27417 $size-of-type-id-as-array-element:end: -27418 # . epilogue -27419 89/<- %esp 5/r32/ebp -27420 5d/pop-to-ebp -27421 c3/return -27422 -27423 emit-save-size-to: # out: (addr buffered-file), base: (addr var), outreg: (addr array byte) -27424 # . prologue -27425 55/push-ebp -27426 89/<- %ebp 4/r32/esp -27427 # . save registers -27428 50/push-eax -27429 53/push-ebx -27430 # ebx = base -27431 8b/-> *(ebp+0xc) 3/r32/ebx -27432 (emit-indent *(ebp+8) *Curr-block-depth) -27433 (write-buffered *(ebp+8) "8b/-> *") -27434 # if base is an (addr array ...) in a register -27435 { -27436 81 7/subop/compare *(ebx+0x18)) 0/imm32 # Var-register -27437 74/jump-if-= break/disp8 -27438 $emit-save-size-to:emit-base-from-register: -27439 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -27440 (write-buffered *(ebp+8) %eax) -27441 eb/jump $emit-save-size-to:emit-output/disp8 -27442 } -27443 # otherwise if base is an (array ...) on the stack -27444 { -27445 81 7/subop/compare *(ebx+0x14)) 0/imm32 # Var-offset -27446 74/jump-if-= break/disp8 -27447 $emit-save-size-to:emit-base-from-stack: -27448 (write-buffered *(ebp+8) "(ebp+") -27449 (write-int32-hex-buffered *(ebp+8) *(ebx+0x14)) # Var-offset -27450 (write-buffered *(ebp+8) ")") -27451 } -27452 $emit-save-size-to:emit-output: -27453 (write-buffered *(ebp+8) " ") -27454 (get Mu-registers *(ebp+0x10) 0xc "Mu-registers") # => eax -27455 (write-int32-hex-buffered *(ebp+8) *eax) -27456 (write-buffered *(ebp+8) "/r32\n") -27457 $emit-save-size-to:end: -27458 # . restore registers -27459 5b/pop-to-ebx -27460 58/pop-to-eax -27461 # . epilogue -27462 89/<- %esp 5/r32/ebp -27463 5d/pop-to-ebp -27464 c3/return -27465 -27466 emit-divide-by-shift-right: # out: (addr buffered-file), reg: (addr array byte), size: int -27467 # . prologue -27468 55/push-ebp -27469 89/<- %ebp 4/r32/esp -27470 # . save registers -27471 50/push-eax -27472 # -27473 (emit-indent *(ebp+8) *Curr-block-depth) -27474 (write-buffered *(ebp+8) "c1/shift 5/subop/>> %") -27475 (write-buffered *(ebp+8) *(ebp+0xc)) -27476 (write-buffered *(ebp+8) Space) -27477 (num-shift-rights *(ebp+0x10)) # => eax -27478 (write-int32-hex-buffered *(ebp+8) %eax) -27479 (write-buffered *(ebp+8) "/imm8\n") -27480 $emit-divide-by-shift-right:end: -27481 # . restore registers -27482 58/pop-to-eax -27483 # . epilogue -27484 89/<- %esp 5/r32/ebp -27485 5d/pop-to-ebp -27486 c3/return -27487 -27488 # a little different from other translate- functions; notice the extra 'fn' argument -27489 translate-mu-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -27490 # . prologue -27491 55/push-ebp -27492 89/<- %ebp 4/r32/esp -27493 # . save registers -27494 53/push-ebx -27495 # ebx = stmt -27496 8b/-> *(ebp+0xc) 3/r32/ebx -27497 # var base/ebx: (addr var) = stmt->inouts[0] -27498 (lookup *(ebx+0xc) *(ebx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -27499 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27500 89/<- %ebx 0/r32/eax -27501 # emit bounds-check -27502 (emit-mu-index-bounds-check *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) -27503 # if (var->register) do one thing +26760 # if (curr == null) break +26761 3d/compare-eax-and 0/imm32 +26762 0f 84/jump-if-= break/disp32 +26763 (emit-subx-function *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) +26764 # curr = lookup(curr->next) +26765 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax +26766 e9/jump loop/disp32 +26767 } +26768 $emit-subx:end: +26769 # . restore registers +26770 58/pop-to-eax +26771 # . epilogue +26772 89/<- %esp 5/r32/ebp +26773 5d/pop-to-ebp +26774 c3/return +26775 +26776 emit-subx-function: # out: (addr buffered-file), f: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +26777 # . prologue +26778 55/push-ebp +26779 89/<- %ebp 4/r32/esp +26780 # some preprocessing +26781 (populate-mu-type-offsets-in-inouts *(ebp+0xc)) +26782 # . save registers +26783 50/push-eax +26784 51/push-ecx +26785 52/push-edx +26786 # initialize some global state +26787 c7 0/subop/copy *Curr-block-depth 1/imm32 # Important: keep this in sync with the parse phase +26788 c7 0/subop/copy *Curr-local-stack-offset 0/imm32 +26789 # ecx = f +26790 8b/-> *(ebp+0xc) 1/r32/ecx +26791 # var vars/edx: (stack (addr var) 256) +26792 81 5/subop/subtract %esp 0xc00/imm32 +26793 68/push 0xc00/imm32/size +26794 68/push 0/imm32/top +26795 89/<- %edx 4/r32/esp +26796 # var name/eax: (addr array byte) = lookup(f->name) +26797 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +26798 # +26799 (write-buffered *(ebp+8) %eax) +26800 (write-buffered *(ebp+8) ":\n") +26801 (emit-subx-prologue *(ebp+8)) +26802 # var body/eax: (addr block) = lookup(f->body) +26803 (lookup *(ecx+0x18) *(ecx+0x1c)) # Function-body Function-body => eax +26804 # +26805 (emit-subx-block *(ebp+8) %eax %edx *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +26806 (emit-subx-epilogue *(ebp+8)) +26807 # TODO: validate that *Curr-block-depth and *Curr-local-stack-offset have +26808 # been cleaned up +26809 $emit-subx-function:end: +26810 # . reclaim locals +26811 81 0/subop/add %esp 0xc08/imm32 +26812 # . restore registers +26813 5a/pop-to-edx +26814 59/pop-to-ecx +26815 58/pop-to-eax +26816 # . epilogue +26817 89/<- %esp 5/r32/ebp +26818 5d/pop-to-ebp +26819 c3/return +26820 +26821 populate-mu-type-offsets-in-inouts: # f: (addr function) +26822 # . prologue +26823 55/push-ebp +26824 89/<- %ebp 4/r32/esp +26825 # . save registers +26826 50/push-eax +26827 51/push-ecx +26828 52/push-edx +26829 53/push-ebx +26830 57/push-edi +26831 # var next-offset/edx: int = 8 +26832 ba/copy-to-edx 8/imm32 +26833 # var curr/ecx: (addr list var) = lookup(f->inouts) +26834 8b/-> *(ebp+8) 1/r32/ecx +26835 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax +26836 89/<- %ecx 0/r32/eax +26837 { +26838 $populate-mu-type-offsets-in-inouts:loop: +26839 81 7/subop/compare %ecx 0/imm32 +26840 74/jump-if-= break/disp8 +26841 # var v/ebx: (addr var) = lookup(curr->value) +26842 (lookup *ecx *(ecx+4)) # List-value List-value => eax +26843 89/<- %ebx 0/r32/eax +26844 #? (lookup *ebx *(ebx+4)) +26845 #? (write-buffered Stderr "setting offset of fn inout ") +26846 #? (write-buffered Stderr %eax) +26847 #? (write-buffered Stderr "@") +26848 #? (write-int32-hex-buffered Stderr %ebx) +26849 #? (write-buffered Stderr " to ") +26850 #? (write-int32-hex-buffered Stderr %edx) +26851 #? (write-buffered Stderr Newline) +26852 #? (flush Stderr) +26853 # v->offset = next-offset +26854 89/<- *(ebx+0x14) 2/r32/edx # Var-offset +26855 # next-offset += size-of(v) +26856 (size-of %ebx) # => eax +26857 01/add-to %edx 0/r32/eax +26858 # curr = lookup(curr->next) +26859 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +26860 89/<- %ecx 0/r32/eax +26861 # +26862 eb/jump loop/disp8 +26863 } +26864 $populate-mu-type-offsets-in-inouts:end: +26865 # . restore registers +26866 5f/pop-to-edi +26867 5b/pop-to-ebx +26868 5a/pop-to-edx +26869 59/pop-to-ecx +26870 58/pop-to-eax +26871 # . epilogue +26872 89/<- %esp 5/r32/ebp +26873 5d/pop-to-ebp +26874 c3/return +26875 +26876 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) +26877 # . prologue +26878 55/push-ebp +26879 89/<- %ebp 4/r32/esp +26880 # . save registers +26881 50/push-eax +26882 51/push-ecx +26883 53/push-ebx +26884 56/push-esi +26885 # esi = stmts +26886 8b/-> *(ebp+0xc) 6/r32/esi +26887 # +26888 { +26889 $emit-subx-stmt-list:loop: +26890 81 7/subop/compare %esi 0/imm32 +26891 0f 84/jump-if-= break/disp32 +26892 # var curr-stmt/ecx: (addr stmt) = lookup(stmts->value) +26893 (lookup *esi *(esi+4)) # List-value List-value => eax +26894 89/<- %ecx 0/r32/eax +26895 { +26896 $emit-subx-stmt-list:check-for-block: +26897 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag +26898 75/jump-if-!= break/disp8 +26899 $emit-subx-stmt-list:block: +26900 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +26901 } +26902 { +26903 $emit-subx-stmt-list:check-for-stmt: +26904 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag +26905 0f 85/jump-if-!= break/disp32 +26906 $emit-subx-stmt-list:stmt1: +26907 { +26908 (is-mu-branch? %ecx) # => eax +26909 3d/compare-eax-and 0/imm32/false +26910 0f 84/jump-if-= break/disp32 +26911 $emit-subx-stmt-list:branch-stmt: +26912 +-- 25 lines: # unconditional return ---------------------------------------------------------------------------------------------------------------------------------------------------- +26937 +-- 27 lines: # unconditional loops ----------------------------------------------------------------------------------------------------------------------------------------------------- +26964 +-- 16 lines: # unconditional breaks ---------------------------------------------------------------------------------------------------------------------------------------------------- +26980 +-- 38 lines: # simple conditional branches without a target ---------------------------------------------------------------------------------------------------------------------------- +27018 +-- 19 lines: # conditional branches with an explicit target ---------------------------------------------------------------------------------------------------------------------------- +27037 } +27038 $emit-subx-stmt-list:1-to-1: +27039 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +27040 e9/jump $emit-subx-stmt-list:continue/disp32 +27041 } +27042 { +27043 $emit-subx-stmt-list:check-for-var-def: +27044 81 7/subop/compare *ecx 2/imm32/var-def # Stmt-tag +27045 75/jump-if-!= break/disp8 +27046 $emit-subx-stmt-list:var-def: +27047 (emit-subx-var-def *(ebp+8) %ecx) +27048 (push *(ebp+0x10) *(ecx+4)) # Vardef-var +27049 (push *(ebp+0x10) *(ecx+8)) # Vardef-var +27050 (push *(ebp+0x10) 0) # Live-var-register-spilled = 0 for vars on the stack +27051 # +27052 eb/jump $emit-subx-stmt-list:continue/disp8 +27053 } +27054 { +27055 $emit-subx-stmt-list:check-for-reg-var-def: +27056 81 7/subop/compare *ecx 3/imm32/reg-var-def # Stmt-tag +27057 0f 85/jump-if-!= break/disp32 +27058 $emit-subx-stmt-list:reg-var-def: +27059 # TODO: ensure that there's exactly one output +27060 (push-output-and-maybe-emit-spill *(ebp+8) %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +27061 # emit the instruction as usual +27062 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +27063 # +27064 eb/jump $emit-subx-stmt-list:continue/disp8 +27065 } +27066 $emit-subx-stmt-list:continue: +27067 # TODO: raise an error on unrecognized Stmt-tag +27068 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax +27069 89/<- %esi 0/r32/eax +27070 e9/jump loop/disp32 +27071 } +27072 $emit-subx-stmt-list:emit-cleanup: +27073 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth) +27074 $emit-subx-stmt-list:clean-up: +27075 (clean-up-stack-offset-state *(ebp+0x10) *Curr-block-depth) +27076 (clean-up-blocks *(ebp+0x10) *Curr-block-depth *(ebp+0x14)) +27077 $emit-subx-stmt-list:end: +27078 # . restore registers +27079 5e/pop-to-esi +27080 5b/pop-to-ebx +27081 59/pop-to-ecx +27082 58/pop-to-eax +27083 # . epilogue +27084 89/<- %esp 5/r32/ebp +27085 5d/pop-to-ebp +27086 c3/return +27087 +27088 # 'later-stmts' includes 'stmt', but will behave the same even without it; reg-var-def stmts are guaranteed not to write to function outputs. +27089 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) +27090 # . prologue +27091 55/push-ebp +27092 89/<- %ebp 4/r32/esp +27093 # . save registers +27094 50/push-eax +27095 51/push-ecx +27096 52/push-edx +27097 # ecx = stmt +27098 8b/-> *(ebp+0xc) 1/r32/ecx +27099 # var sv/eax: (addr stmt-var) = lookup(curr-stmt->outputs) +27100 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax +27101 # TODO: assert !sv->is-deref? +27102 # var v/ecx: (addr var) = lookup(sv->value) +27103 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +27104 89/<- %ecx 0/r32/eax +27105 # v->block-depth = *Curr-block-depth +27106 8b/-> *Curr-block-depth 0/r32/eax +27107 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +27108 #? (write-buffered Stderr "var ") +27109 #? (lookup *ecx *(ecx+4)) +27110 #? (write-buffered Stderr %eax) +27111 #? (write-buffered Stderr " at depth ") +27112 #? (write-int32-hex-buffered Stderr *(ecx+0x10)) +27113 #? (write-buffered Stderr Newline) +27114 #? (flush Stderr) +27115 # ensure that v is in a register +27116 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +27117 0f 84/jump-if-= $push-output-and-maybe-emit-spill:abort/disp32 +27118 # var emit-spill?/edx: boolean = not-yet-spilled-this-block? && will-not-write-some-register?(fn) +27119 (not-yet-spilled-this-block? %ecx *(ebp+0x10)) # => eax +27120 89/<- %edx 0/r32/eax +27121 3d/compare-eax-and 0/imm32/false +27122 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 +27123 (will-not-write-some-register? %ecx *(ebp+0x14) *(ebp+0x18)) # => eax +27124 89/<- %edx 0/r32/eax +27125 # check emit-spill? +27126 3d/compare-eax-and 0/imm32/false +27127 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 +27128 # TODO: assert(size-of(output) == 4) +27129 # *Curr-local-stack-offset -= 4 +27130 81 5/subop/subtract *Curr-local-stack-offset 4/imm32 +27131 # emit spill +27132 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +27133 (emit-push-register *(ebp+8) %eax) +27134 $push-output-and-maybe-emit-spill:push: +27135 8b/-> *(ebp+0xc) 1/r32/ecx +27136 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax +27137 # push(vars, {sv->value, emit-spill?}) +27138 (push *(ebp+0x10) *eax) # Stmt-var-value +27139 (push *(ebp+0x10) *(eax+4)) # Stmt-var-value +27140 (push *(ebp+0x10) %edx) +27141 $push-output-and-maybe-emit-spill:end: +27142 # . restore registers +27143 5a/pop-to-edx +27144 59/pop-to-ecx +27145 58/pop-to-eax +27146 # . epilogue +27147 89/<- %esp 5/r32/ebp +27148 5d/pop-to-ebp +27149 c3/return +27150 +27151 $push-output-and-maybe-emit-spill:abort: +27152 # error("var '" var->name "' initialized from an instruction must live in a register\n") +27153 (write-buffered *(ebp+0x1c) "var '") +27154 (write-buffered *(ebp+0x1c) *eax) # Var-name +27155 (write-buffered *(ebp+0x1c) "' initialized from an instruction must live in a register\n") +27156 (flush *(ebp+0x1c)) +27157 (stop *(ebp+0x20) 1) +27158 # never gets here +27159 +27160 emit-subx-cleanup-and-unconditional-nonlocal-branch: # out: (addr buffered-file), stmt: (addr stmt1), vars: (addr stack live-var) +27161 # . prologue +27162 55/push-ebp +27163 89/<- %ebp 4/r32/esp +27164 # . save registers +27165 50/push-eax +27166 51/push-ecx +27167 # ecx = stmt +27168 8b/-> *(ebp+0xc) 1/r32/ecx +27169 # var target/eax: (addr array byte) = curr-stmt->inouts->value->name +27170 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +27171 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +27172 (lookup *eax *(eax+4)) # Var-name Var-name => eax +27173 # clean up until target block +27174 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %eax) +27175 # emit jump to target block +27176 (emit-indent *(ebp+8) *Curr-block-depth) +27177 (write-buffered *(ebp+8) "e9/jump ") +27178 (write-buffered *(ebp+8) %eax) +27179 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +27180 (string-starts-with? %eax "break") +27181 3d/compare-eax-and 0/imm32/false +27182 { +27183 74/jump-if-= break/disp8 +27184 (write-buffered *(ebp+8) ":break/disp32\n") +27185 eb/jump $emit-subx-cleanup-and-unconditional-nonlocal-branch:end/disp8 +27186 } +27187 (write-buffered *(ebp+8) ":loop/disp32\n") +27188 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end: +27189 # . restore registers +27190 59/pop-to-ecx +27191 58/pop-to-eax +27192 # . epilogue +27193 89/<- %esp 5/r32/ebp +27194 5d/pop-to-ebp +27195 c3/return +27196 +27197 emit-outputs: # out: (addr buffered-file), return-stmt: (addr stmt1), fn: (addr function) +27198 # . prologue +27199 55/push-ebp +27200 89/<- %ebp 4/r32/esp +27201 # . save registers +27202 50/push-eax +27203 51/push-ecx +27204 56/push-esi +27205 57/push-edi +27206 # var curr-inout/esi: (addr stmt-var) = return-stmt->inouts +27207 8b/-> *(ebp+0xc) 0/r32/eax +27208 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +27209 89/<- %esi 0/r32/eax +27210 # var curr-output/edi: (addr list var) = fn->outputs +27211 8b/-> *(ebp+0x10) 0/r32/eax +27212 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax +27213 89/<- %edi 0/r32/eax +27214 { +27215 $emit-outputs:loop: +27216 81 7/subop/compare %esi 0/imm32 +27217 0f 84/jump-if-= break/disp32 +27218 # emit copy to output register +27219 # var curr-output-register/ecx: (addr array byte) = curr-output->value->register +27220 (lookup *edi *(edi+4)) # List-value List-value => eax +27221 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +27222 89/<- %ecx 0/r32/eax +27223 # if curr-output-register starts with "x", emit a floating-point copy +27224 8a/copy-byte *(ecx+4) 0/r32/AL +27225 81 4/subop/and %eax 0xff/imm32 +27226 3d/compare-eax-and 0x78/imm32/x +27227 { +27228 75/jump-if-!= break/disp8 +27229 (emit-float-output *(ebp+8) %esi %ecx) +27230 eb/jump $emit-outputs:continue/disp8 +27231 } +27232 # otherwise emit an int copy +27233 (emit-int-output *(ebp+8) %esi %ecx) +27234 $emit-outputs:continue: +27235 # curr-inout = curr-inout->next +27236 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +27237 89/<- %esi 0/r32/eax +27238 # curr-output = curr-output->next +27239 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +27240 89/<- %edi 0/r32/eax +27241 # +27242 e9/jump loop/disp32 +27243 } +27244 $emit-outputs:end: +27245 # . restore registers +27246 5f/pop-to-edi +27247 5e/pop-to-esi +27248 59/pop-to-ecx +27249 58/pop-to-eax +27250 # . epilogue +27251 89/<- %esp 5/r32/ebp +27252 5d/pop-to-ebp +27253 c3/return +27254 +27255 emit-int-output: # out: (addr buffered-file), return-var: (addr stmt-var), dest-reg: (addr array byte) +27256 # . prologue +27257 55/push-ebp +27258 89/<- %ebp 4/r32/esp +27259 # . save registers +27260 50/push-eax +27261 51/push-ecx +27262 # ecx = return-var->value +27263 8b/-> *(ebp+0xc) 0/r32/eax +27264 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +27265 89/<- %ecx 0/r32/eax +27266 # if curr-var is a literal, emit copy of a literal to the output +27267 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +27268 (is-simple-mu-type? %eax 0) # literal => eax +27269 { +27270 3d/compare-eax-and 0/imm32/false +27271 0f 84/jump-if-= break/disp32 +27272 (emit-indent *(ebp+8) *Curr-block-depth) +27273 (write-buffered *(ebp+8) "c7 0/subop/copy %") +27274 (write-buffered *(ebp+8) *(ebp+0x10)) +27275 (write-buffered *(ebp+8) " ") +27276 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +27277 (write-buffered *(ebp+8) %eax) +27278 (write-buffered *(ebp+8) "/imm32\n") +27279 e9/jump $emit-int-output:end/disp32 +27280 } +27281 # otherwise emit an integer copy +27282 (emit-indent *(ebp+8) *Curr-block-depth) +27283 (write-buffered *(ebp+8) "8b/->") +27284 (emit-subx-var-as-rm32 *(ebp+8) *(ebp+0xc)) +27285 (write-buffered *(ebp+8) " ") +27286 (get Mu-registers *(ebp+0x10) 0xc "Mu-registers") # => eax +27287 (write-int32-hex-buffered *(ebp+8) *eax) +27288 (write-buffered *(ebp+8) "/r32\n") +27289 $emit-int-output:end: +27290 # . restore registers +27291 59/pop-to-ecx +27292 58/pop-to-eax +27293 # . epilogue +27294 89/<- %esp 5/r32/ebp +27295 5d/pop-to-ebp +27296 c3/return +27297 +27298 emit-float-output: # out: (addr buffered-file), return-var: (addr stmt-var), dest-reg: (addr array byte) +27299 # . prologue +27300 55/push-ebp +27301 89/<- %ebp 4/r32/esp +27302 # . save registers +27303 50/push-eax +27304 # +27305 (emit-indent *(ebp+8) *Curr-block-depth) +27306 (write-buffered *(ebp+8) "f3 0f 10/->") +27307 (emit-subx-var-as-rm32 *(ebp+8) *(ebp+0xc)) +27308 (write-buffered *(ebp+8) " ") +27309 (get Mu-registers *(ebp+0x10) 0xc "Mu-registers") # => eax +27310 (write-int32-hex-buffered *(ebp+8) *eax) +27311 (write-buffered *(ebp+8) "/x32\n") +27312 $emit-float-output:end: +27313 # . restore registers +27314 58/pop-to-eax +27315 # . epilogue +27316 89/<- %esp 5/r32/ebp +27317 5d/pop-to-ebp +27318 c3/return +27319 +27320 is-mu-branch?: # stmt: (addr stmt1) -> result/eax: boolean +27321 # . prologue +27322 55/push-ebp +27323 89/<- %ebp 4/r32/esp +27324 # . save registers +27325 51/push-ecx +27326 # ecx = lookup(stmt->operation) +27327 8b/-> *(ebp+8) 1/r32/ecx +27328 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +27329 89/<- %ecx 0/r32/eax +27330 # if (stmt->operation starts with "loop") return true +27331 (string-starts-with? %ecx "loop") # => eax +27332 3d/compare-eax-and 0/imm32/false +27333 75/jump-if-not-equal $is-mu-branch?:end/disp8 +27334 # if (stmt->operation starts with "break") return true +27335 (string-starts-with? %ecx "break") # => eax +27336 3d/compare-eax-and 0/imm32/false +27337 75/jump-if-not-equal $is-mu-branch?:end/disp8 +27338 # otherwise return (stmt->operation starts with "return") +27339 (string-starts-with? %ecx "return") # => eax +27340 $is-mu-branch?:end: +27341 # . restore registers +27342 59/pop-to-ecx +27343 # . epilogue +27344 89/<- %esp 5/r32/ebp +27345 5d/pop-to-ebp +27346 c3/return +27347 +27348 emit-reverse-break: # out: (addr buffered-file), stmt: (addr stmt1) +27349 # . prologue +27350 55/push-ebp +27351 89/<- %ebp 4/r32/esp +27352 # . save registers +27353 50/push-eax +27354 # eax = stmt +27355 8b/-> *(ebp+0xc) 0/r32/eax +27356 # +27357 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +27358 (get Reverse-branch %eax 0x10 "reverse-branch: ") # => eax: (addr handle array byte) +27359 (emit-indent *(ebp+8) *Curr-block-depth) +27360 (lookup *eax *(eax+4)) # => eax +27361 (write-buffered *(ebp+8) %eax) +27362 (write-buffered *(ebp+8) " break/disp32\n") +27363 $emit-reverse-break:end: +27364 # . restore registers +27365 58/pop-to-eax +27366 # . epilogue +27367 89/<- %esp 5/r32/ebp +27368 5d/pop-to-ebp +27369 c3/return +27370 +27371 == data +27372 +27373 # Table from Mu branch instructions to the reverse SubX opcodes for them. +27374 Reverse-branch: # (table (handle array byte) (handle array byte)) +27375 # a table is a stream +27376 0x1c0/imm32/write +27377 0/imm32/read +27378 0x1c0/imm32/size +27379 # data +27380 0x11/imm32/alloc-id _string-break-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 +27381 0x11/imm32/alloc-id _string-loop-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 +27382 0x11/imm32/alloc-id _string-break-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 +27383 0x11/imm32/alloc-id _string-loop-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 +27384 0x11/imm32/alloc-id _string-break-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 +27385 0x11/imm32/alloc-id _string-loop-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 +27386 0x11/imm32/alloc-id _string-break-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 +27387 0x11/imm32/alloc-id _string-loop-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 +27388 0x11/imm32/alloc-id _string-break-if-<=/imm32 0x11/imm32/alloc-id _string_0f_8f_jump_label/imm32 +27389 0x11/imm32/alloc-id _string-loop-if-<=/imm32 0x11/imm32/alloc-id _string_0f_8f_jump_label/imm32 +27390 0x11/imm32/alloc-id _string-break-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 +27391 0x11/imm32/alloc-id _string-loop-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 +27392 0x11/imm32/alloc-id _string-break-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 +27393 0x11/imm32/alloc-id _string-loop-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 +27394 0x11/imm32/alloc-id _string-break-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 +27395 0x11/imm32/alloc-id _string-loop-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 +27396 0x11/imm32/alloc-id _string-break-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +27397 0x11/imm32/alloc-id _string-loop-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +27398 0x11/imm32/alloc-id _string-break-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 +27399 0x11/imm32/alloc-id _string-loop-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 +27400 0x11/imm32/alloc-id _string-break-if-float</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 +27401 0x11/imm32/alloc-id _string-loop-if-float</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 +27402 0x11/imm32/alloc-id _string-break-if-float>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 +27403 0x11/imm32/alloc-id _string-loop-if-float>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 +27404 0x11/imm32/alloc-id _string-break-if-float<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +27405 0x11/imm32/alloc-id _string-loop-if-float<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +27406 0x11/imm32/alloc-id _string-break-if-float>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 +27407 0x11/imm32/alloc-id _string-loop-if-float>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 +27408 +27409 == code +27410 +27411 emit-unconditional-jump-to-depth: # out: (addr buffered-file), vars: (addr stack live-var), depth: int, label-suffix: (addr array byte) +27412 # . prologue +27413 55/push-ebp +27414 89/<- %ebp 4/r32/esp +27415 # . save registers +27416 50/push-eax +27417 51/push-ecx +27418 52/push-edx +27419 53/push-ebx +27420 56/push-esi +27421 # ecx = vars +27422 8b/-> *(ebp+0xc) 1/r32/ecx +27423 # var eax: int = vars->top +27424 8b/-> *ecx 0/r32/eax +27425 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +27426 8d/copy-address *(ecx+eax-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size +27427 # var min/ecx: (addr handle var) = vars->data +27428 8d/copy-address *(ecx+8) 1/r32/ecx +27429 # edx = depth +27430 8b/-> *(ebp+0x10) 2/r32/edx +27431 { +27432 $emit-unconditional-jump-to-depth:loop: +27433 # if (curr < min) break +27434 39/compare %esi 1/r32/ecx +27435 0f 82/jump-if-addr< break/disp32 +27436 # var v/ebx: (addr var) = lookup(*curr) +27437 (lookup *esi *(esi+4)) # => eax +27438 89/<- %ebx 0/r32/eax +27439 # if (v->block-depth < until-block-depth) break +27440 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth +27441 0f 8c/jump-if-< break/disp32 +27442 { +27443 $emit-unconditional-jump-to-depth:check: +27444 # if v->block-depth != until-block-depth, continue +27445 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth +27446 0f 85/jump-if-!= break/disp32 +27447 $emit-unconditional-jump-to-depth:depth-found: +27448 # if v is not a literal, continue +27449 (size-of %ebx) # => eax +27450 3d/compare-eax-and 0/imm32 +27451 0f 85/jump-if-!= break/disp32 +27452 $emit-unconditional-jump-to-depth:label-found: +27453 # emit unconditional jump, then return +27454 (emit-indent *(ebp+8) *Curr-block-depth) +27455 (write-buffered *(ebp+8) "e9/jump ") +27456 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +27457 (write-buffered *(ebp+8) %eax) +27458 (write-buffered *(ebp+8) ":") +27459 (write-buffered *(ebp+8) *(ebp+0x14)) +27460 (write-buffered *(ebp+8) "/disp32\n") +27461 eb/jump $emit-unconditional-jump-to-depth:end/disp8 +27462 } +27463 # curr -= 12 +27464 81 5/subop/subtract %esi 0xc/imm32 +27465 e9/jump loop/disp32 +27466 } +27467 # TODO: error if no label at 'depth' was found +27468 $emit-unconditional-jump-to-depth:end: +27469 # . restore registers +27470 5e/pop-to-esi +27471 5b/pop-to-ebx +27472 5a/pop-to-edx +27473 59/pop-to-ecx +27474 58/pop-to-eax +27475 # . epilogue +27476 89/<- %esp 5/r32/ebp +27477 5d/pop-to-ebp +27478 c3/return +27479 +27480 # emit clean-up code for 'vars' until some block depth +27481 # doesn't actually modify 'vars' so we need traverse manually inside the stack +27482 emit-cleanup-code-until-depth: # out: (addr buffered-file), vars: (addr stack live-var), until-block-depth: int +27483 # . prologue +27484 55/push-ebp +27485 89/<- %ebp 4/r32/esp +27486 # . save registers +27487 50/push-eax +27488 51/push-ecx +27489 52/push-edx +27490 53/push-ebx +27491 56/push-esi +27492 #? (write-buffered Stderr "--- cleanup\n") +27493 #? (flush Stderr) +27494 # ecx = vars +27495 8b/-> *(ebp+0xc) 1/r32/ecx +27496 # var esi: int = vars->top +27497 8b/-> *ecx 6/r32/esi +27498 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +27499 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size +27500 # var min/ecx: (addr handle var) = vars->data +27501 81 0/subop/add %ecx 8/imm32 +27502 # edx = until-block-depth +27503 8b/-> *(ebp+0x10) 2/r32/edx 27504 { -27505 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register -27506 74/jump-if-= break/disp8 -27507 # TODO: ensure there's no dereference -27508 (translate-mu-index-stmt-with-array-in-register *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -27509 eb/jump $translate-mu-index-stmt:end/disp8 -27510 } -27511 # if (var->offset) do a different thing -27512 { -27513 81 7/subop/compare *(ebx+0x14) 0/imm32 # Var-offset -27514 74/jump-if-= break/disp8 -27515 # TODO: ensure there's no dereference -27516 (translate-mu-index-stmt-with-array-on-stack *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -27517 eb/jump $translate-mu-index-stmt:end/disp8 -27518 } -27519 $translate-mu-index-stmt:end: -27520 # . restore registers -27521 5b/pop-to-ebx -27522 # . epilogue -27523 89/<- %esp 5/r32/ebp -27524 5d/pop-to-ebp -27525 c3/return -27526 -27527 $translate-mu-index-stmt:error1: -27528 (write-buffered *(ebp+0x14) "couldn't translate an index instruction. second (index) input must either lie in a register or be a literal\n") -27529 (flush *(ebp+0x14)) -27530 (stop *(ebp+0x18) 1) -27531 # never gets here -27532 -27533 $translate-mu-index-stmt:error2: -27534 (write-buffered *(ebp+0x14) "couldn't translate an index instruction. second (index) input when in a register must be an int or offset\n") -27535 (flush *(ebp+0x14)) -27536 (stop *(ebp+0x18) 1) -27537 # never gets here -27538 -27539 emit-mu-index-bounds-check: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -27540 # . prologue -27541 55/push-ebp -27542 89/<- %ebp 4/r32/esp -27543 # . save registers -27544 50/push-eax -27545 51/push-ecx -27546 52/push-edx -27547 53/push-ebx -27548 # ecx = stmt -27549 8b/-> *(ebp+0xc) 1/r32/ecx -27550 # -27551 (emit-indent *(ebp+8) *Curr-block-depth) -27552 (write-buffered *(ebp+8) "(__check-mu-array-bounds ") -27553 $emit-mu-index-bounds-check:compute-base: -27554 # var base/ebx: (addr var) = inouts[0] -27555 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -27556 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27557 89/<- %ebx 0/r32/eax -27558 $emit-mu-index-bounds-check:emit-index: -27559 # var index/edx: (addr var) = inouts[1] -27560 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -27561 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -27562 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27563 89/<- %edx 0/r32/eax -27564 # if index->register, print its code -27565 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register -27566 { -27567 0f 84/jump-if-= break/disp32 -27568 $emit-mu-index-bounds-check:emit-register-index: -27569 (write-buffered *(ebp+8) "%") -27570 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -27571 (write-buffered *(ebp+8) %eax) -27572 eb/jump $emit-mu-index-bounds-check:index-done/disp8 -27573 } -27574 # otherwise if index is a literal, print it -27575 $emit-mu-index-bounds-check:emit-literal-index: -27576 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -27577 (is-simple-mu-type? %eax 0) # => eax -27578 3d/compare-eax-and 0/imm32/false -27579 { -27580 0f 84/jump-if-= break/disp32 -27581 (lookup *edx *(edx+4)) # Var-name Var-name => eax -27582 (write-buffered *(ebp+8) %eax) -27583 } -27584 $emit-mu-index-bounds-check:index-done: -27585 (write-buffered *(ebp+8) " ") -27586 $emit-mu-index-bounds-check:emit-element-size: -27587 # if index is a literal or int, print size of array element -27588 { -27589 { -27590 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -27591 (is-simple-mu-type? %eax 0) # literal => eax -27592 3d/compare-eax-and 0/imm32/false -27593 75/jump-if-!= break/disp8 -27594 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -27595 (is-simple-mu-type? %eax 1) # int => eax -27596 3d/compare-eax-and 0/imm32/false -27597 75/jump-if-!= break/disp8 -27598 eb/jump $emit-mu-index-bounds-check:emit-element-size-offset/disp8 -27599 } -27600 $emit-mu-index-bounds-check:emit-int-register-index: -27601 (array-element-size %ebx *(ebp+0x14) *(ebp+0x18)) # => eax -27602 (write-int32-hex-buffered *(ebp+8) %eax) -27603 e9/jump $emit-mu-index-bounds-check:emit-base/disp32 -27604 } -27605 $emit-mu-index-bounds-check:emit-element-size-offset: -27606 # if index has type (offset ...), print "1" -27607 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -27608 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -27609 { -27610 75/jump-if-!= break/disp8 -27611 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -27612 (is-simple-mu-type? %eax 7) # => eax -27613 3d/compare-eax-and 0/imm32/false -27614 { -27615 0f 84/jump-if-= break/disp32 -27616 $emit-mu-index-bounds-check:emit-offset-register-index: -27617 (write-buffered *(ebp+8) "1") -27618 } -27619 } -27620 $emit-mu-index-bounds-check:emit-base: -27621 # if base is in a register, print " *" base->register -27622 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register -27623 { -27624 74/jump-if-= break/disp8 -27625 (write-buffered *(ebp+8) " *") -27626 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -27627 (write-buffered *(ebp+8) %eax) -27628 e9/jump $emit-mu-index-bounds-check:emit-function-name/disp32 -27629 } -27630 # otherwise print " *(ebp+" base->offset ")" -27631 (write-buffered *(ebp+8) " *(ebp+") -27632 (write-int32-hex-buffered *(ebp+8) *(ebx+0x14)) # Var-offset -27633 (write-buffered *(ebp+8) ")") -27634 $emit-mu-index-bounds-check:emit-function-name: -27635 # " \"" function-name "\"" -27636 (write-buffered *(ebp+8) " \"") -27637 8b/-> *(ebp+0x10) 1/r32/ecx -27638 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax -27639 (write-buffered *(ebp+8) %eax) -27640 (write-buffered *(ebp+8) "\"") -27641 $emit-mu-index-bounds-check:emit-array-name: -27642 # " \"" base->name "\"" -27643 (write-buffered *(ebp+8) " \"") -27644 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -27645 (write-buffered *(ebp+8) %eax) -27646 (write-buffered *(ebp+8) "\")\n") -27647 $emit-mu-index-bounds-check:end: -27648 # . restore registers -27649 5b/pop-to-ebx -27650 5a/pop-to-edx -27651 59/pop-to-ecx -27652 58/pop-to-eax -27653 # . epilogue -27654 89/<- %esp 5/r32/ebp -27655 5d/pop-to-ebp -27656 c3/return -27657 -27658 translate-mu-index-stmt-with-array-in-register: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -27659 # . prologue -27660 55/push-ebp -27661 89/<- %ebp 4/r32/esp -27662 # . save registers -27663 50/push-eax -27664 51/push-ecx -27665 52/push-edx -27666 53/push-ebx -27667 # -27668 (emit-indent *(ebp+8) *Curr-block-depth) -27669 (write-buffered *(ebp+8) "8d/copy-address *(") -27670 # TODO: ensure inouts[0] is in a register and not dereferenced -27671 $translate-mu-index-stmt-with-array-in-register:emit-base: -27672 # ecx = stmt -27673 8b/-> *(ebp+0xc) 1/r32/ecx -27674 # var base/ebx: (addr var) = inouts[0] -27675 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -27676 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27677 89/<- %ebx 0/r32/eax -27678 # print base->register " + " -27679 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -27680 (write-buffered *(ebp+8) %eax) -27681 (write-buffered *(ebp+8) " + ") -27682 # var index/edx: (addr var) = inouts[1] -27683 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -27684 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -27685 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27686 89/<- %edx 0/r32/eax -27687 # if index->register -27688 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register -27689 { -27690 0f 84/jump-if-= break/disp32 -27691 $translate-mu-index-stmt-with-array-in-register:emit-register-index: -27692 # if index is an int -27693 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -27694 (is-simple-mu-type? %eax 1) # int => eax -27695 3d/compare-eax-and 0/imm32/false -27696 { -27697 0f 84/jump-if-= break/disp32 -27698 $translate-mu-index-stmt-with-array-in-register:emit-int-register-index: -27699 # print index->register "<<" log2(array-element-size(base)) " + 4) " -27700 # . index->register "<<" -27701 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -27702 (write-buffered *(ebp+8) %eax) -27703 (write-buffered *(ebp+8) "<<") -27704 # . log2(array-element-size(base->type)) -27705 # we know size is a power of 2 -27706 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -27707 (num-shift-rights %eax) # => eax -27708 (write-int32-hex-buffered *(ebp+8) %eax) -27709 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-register-index-done/disp32 -27710 } -27711 # if index->type is any other atom, abort -27712 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -27713 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -27714 0f 85/jump-if-!= $translate-mu-index-stmt:error2/disp32 -27715 # if index has type (offset ...) -27716 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -27717 (is-simple-mu-type? %eax 7) # => eax -27718 3d/compare-eax-and 0/imm32/false -27719 { -27720 0f 84/jump-if-= break/disp32 -27721 # print index->register -27722 $translate-mu-index-stmt-with-array-in-register:emit-offset-register-index: -27723 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -27724 (write-buffered *(ebp+8) %eax) -27725 } -27726 $translate-mu-index-stmt-with-array-in-register:emit-register-index-done: -27727 (write-buffered *(ebp+8) " + 4) ") -27728 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 -27729 } -27730 # otherwise if index is a literal -27731 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -27732 (is-simple-mu-type? %eax 0) # => eax -27733 3d/compare-eax-and 0/imm32/false -27734 { -27735 0f 84/jump-if-= break/disp32 -27736 $translate-mu-index-stmt-with-array-in-register:emit-literal-index: -27737 # var index-value/edx: int = parse-hex-int(index->name) -27738 (lookup *edx *(edx+4)) # Var-name Var-name => eax -27739 (parse-hex-int %eax) # => eax -27740 89/<- %edx 0/r32/eax -27741 # offset = idx-value * array-element-size(base->type) -27742 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -27743 f7 4/subop/multiply-into-edx-eax %edx # clobbers edx -27744 # offset += 4 for array size -27745 05/add-to-eax 4/imm32 -27746 # TODO: check edx for overflow -27747 # print offset -27748 (write-int32-hex-buffered *(ebp+8) %eax) -27749 (write-buffered *(ebp+8) ") ") -27750 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 -27751 } -27752 # otherwise abort -27753 e9/jump $translate-mu-index-stmt:error1/disp32 -27754 $translate-mu-index-stmt-with-array-in-register:emit-output: -27755 # outputs[0] "/r32" -27756 8b/-> *(ebp+0xc) 1/r32/ecx -27757 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -27758 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27759 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -27760 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) -27761 (write-int32-hex-buffered *(ebp+8) *eax) -27762 (write-buffered *(ebp+8) "/r32\n") -27763 $translate-mu-index-stmt-with-array-in-register:end: -27764 # . restore registers -27765 5b/pop-to-ebx -27766 5a/pop-to-edx -27767 59/pop-to-ecx -27768 58/pop-to-eax -27769 # . epilogue -27770 89/<- %esp 5/r32/ebp -27771 5d/pop-to-ebp -27772 c3/return -27773 -27774 translate-mu-index-stmt-with-array-on-stack: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -27775 # . prologue -27776 55/push-ebp -27777 89/<- %ebp 4/r32/esp -27778 # . save registers -27779 50/push-eax -27780 51/push-ecx -27781 52/push-edx -27782 53/push-ebx -27783 # -27784 (emit-indent *(ebp+8) *Curr-block-depth) -27785 (write-buffered *(ebp+8) "8d/copy-address *(ebp + ") -27786 # var curr/edx: (addr stmt-var) = lookup(stmt->inouts) -27787 8b/-> *(ebp+0xc) 0/r32/eax -27788 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -27789 89/<- %edx 0/r32/eax -27790 # var base/ecx: (addr var) = lookup(curr->value) -27791 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27792 89/<- %ecx 0/r32/eax -27793 # var curr2/eax: (addr stmt-var) = lookup(curr->next) -27794 (lookup *(edx+8) *(edx+0xc)) # Stmt-var-next Stmt-var-next => eax -27795 # var index/edx: (handle var) = curr2->value -27796 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27797 89/<- %edx 0/r32/eax -27798 # if index->register -27799 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register -27800 { -27801 0f 84/jump-if-= break/disp32 -27802 $translate-mu-index-stmt-with-array-on-stack:emit-register-index: -27803 # if index is an int -27804 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -27805 (is-simple-mu-type? %eax 1) # int => eax -27806 3d/compare-eax-and 0/imm32/false -27807 { -27808 0f 84/jump-if-= break/disp32 -27809 $translate-mu-index-stmt-with-array-on-stack:emit-int-register-index: -27810 # print index->register "<<" log2(array-element-size(base)) " + " base->offset+4 -27811 # . inouts[1]->register "<<" -27812 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -27813 (write-buffered *(ebp+8) %eax) -27814 (write-buffered *(ebp+8) "<<") -27815 # . log2(array-element-size(base)) -27816 # TODO: ensure size is a power of 2 -27817 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax -27818 (num-shift-rights %eax) # => eax -27819 (write-int32-hex-buffered *(ebp+8) %eax) -27820 # -27821 (write-buffered *(ebp+8) " + ") -27822 # -27823 8b/-> *(ecx+0x14) 0/r32/eax # Var-offset -27824 05/add-to-eax 4/imm32 # for array length -27825 (write-int32-hex-buffered *(ebp+8) %eax) -27826 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done/disp32 -27827 } -27828 # if index->type is any other atom, abort -27829 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -27830 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -27831 0f 85/jump-if-!= $translate-mu-index-stmt:error2/disp32 -27832 # if index has type (offset ...) -27833 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -27834 (is-simple-mu-type? %eax 7) # => eax -27835 3d/compare-eax-and 0/imm32/false -27836 { -27837 0f 84/jump-if-= break/disp32 -27838 # print index->register -27839 $translate-mu-index-stmt-with-array-on-stack:emit-offset-register-index: -27840 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -27841 (write-buffered *(ebp+8) %eax) -27842 } -27843 $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done: -27844 (write-buffered *(ebp+8) ") ") -27845 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 -27846 } -27847 # otherwise if index is a literal -27848 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -27849 (is-simple-mu-type? %eax 0) # => eax -27850 3d/compare-eax-and 0/imm32/false -27851 { -27852 0f 84/jump-if-= break/disp32 -27853 $translate-mu-index-stmt-with-array-on-stack:emit-literal-index: -27854 # var idx-value/edx: int = parse-hex-int(index->name) -27855 (lookup *edx *(edx+4)) # Var-name Var-name => eax -27856 (parse-hex-int %eax) # Var-name => eax -27857 89/<- %edx 0/r32/eax -27858 # offset = idx-value * array-element-size(base) -27859 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax -27860 f7 4/subop/multiply-into-edx-eax %edx # clobbers edx -27861 # offset += base->offset -27862 03/add *(ecx+0x14) 0/r32/eax # Var-offset -27863 # offset += 4 for array size -27864 05/add-to-eax 4/imm32 -27865 # TODO: check edx for overflow -27866 # print offset -27867 (write-int32-hex-buffered *(ebp+8) %eax) -27868 (write-buffered *(ebp+8) ") ") -27869 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 -27870 } -27871 # otherwise abort -27872 e9/jump $translate-mu-index-stmt:error1/disp32 -27873 $translate-mu-index-stmt-with-array-on-stack:emit-output: -27874 # outputs[0] "/r32" -27875 8b/-> *(ebp+0xc) 0/r32/eax -27876 (lookup *(eax+0x14) *(eax+0x18)) # Stmt1-outputs Stmt1-outputs => eax -27877 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27878 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -27879 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) -27880 (write-int32-hex-buffered *(ebp+8) *eax) -27881 (write-buffered *(ebp+8) "/r32\n") -27882 $translate-mu-index-stmt-with-array-on-stack:end: -27883 # . restore registers -27884 5b/pop-to-ebx -27885 5a/pop-to-edx -27886 59/pop-to-ecx -27887 58/pop-to-eax -27888 # . epilogue -27889 89/<- %esp 5/r32/ebp -27890 5d/pop-to-ebp -27891 c3/return -27892 -27893 translate-mu-compute-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -27894 # . prologue -27895 55/push-ebp -27896 89/<- %ebp 4/r32/esp -27897 # . save registers -27898 50/push-eax -27899 51/push-ecx -27900 52/push-edx -27901 53/push-ebx -27902 # -27903 (emit-indent *(ebp+8) *Curr-block-depth) -27904 (write-buffered *(ebp+8) "69/multiply") -27905 # ecx = stmt -27906 8b/-> *(ebp+0xc) 1/r32/ecx -27907 # var first-inout/ebx: (addr stmt-var) = stmt->inouts[0] -27908 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -27909 89/<- %ebx 0/r32/eax -27910 $translate-mu-compute-index-stmt:emit-index: -27911 (lookup *(ebx+8) *(ebx+0xc)) # Stmt-var-next Stmt-var-next => eax -27912 (emit-subx-var-as-rm32 *(ebp+8) %eax) -27913 (write-buffered *(ebp+8) Space) -27914 $translate-mu-compute-index-stmt:emit-elem-size: -27915 # var base/ebx: (addr var) -27916 (lookup *ebx *(ebx+4)) # Stmt-var-value Stmt-var-value => eax -27917 89/<- %ebx 0/r32/eax -27918 # print array-element-size(base) -27919 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -27920 (write-int32-hex-buffered *(ebp+8) %eax) -27921 (write-buffered *(ebp+8) "/imm32 ") -27922 $translate-mu-compute-index-stmt:emit-output: -27923 # outputs[0] "/r32" -27924 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -27925 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27926 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -27927 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) -27928 (write-int32-hex-buffered *(ebp+8) *eax) -27929 (write-buffered *(ebp+8) "/r32\n") -27930 $translate-mu-compute-index-stmt:end: -27931 # . restore registers -27932 5b/pop-to-ebx -27933 5a/pop-to-edx -27934 59/pop-to-ecx -27935 58/pop-to-eax -27936 # . epilogue -27937 89/<- %esp 5/r32/ebp -27938 5d/pop-to-ebp -27939 c3/return -27940 -27941 translate-mu-get-stmt: # out: (addr buffered-file), stmt: (addr stmt) -27942 # . prologue -27943 55/push-ebp -27944 89/<- %ebp 4/r32/esp -27945 # . save registers -27946 50/push-eax -27947 51/push-ecx -27948 52/push-edx -27949 # -27950 (emit-indent *(ebp+8) *Curr-block-depth) -27951 (write-buffered *(ebp+8) "8d/copy-address ") -27952 # ecx = stmt -27953 8b/-> *(ebp+0xc) 1/r32/ecx -27954 # var offset/edx: int = get offset of stmt -27955 (mu-get-offset %ecx) # => eax -27956 89/<- %edx 0/r32/eax -27957 # var base/eax: (addr var) = stmt->inouts->value -27958 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -27959 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27960 # if base is in a register -27961 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -27962 { -27963 0f 84/jump-if-= break/disp32 -27964 $translate-mu-get-stmt:emit-register-input: -27965 # emit "*(" base->register " + " offset ") " -27966 (write-buffered *(ebp+8) "*(") -27967 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -27968 (write-buffered *(ebp+8) %eax) -27969 (write-buffered *(ebp+8) " + ") -27970 (write-int32-hex-buffered *(ebp+8) %edx) -27971 (write-buffered *(ebp+8) ") ") -27972 e9/jump $translate-mu-get-stmt:emit-output/disp32 +27505 $emit-cleanup-code-until-depth:loop: +27506 # if (curr < min) break +27507 39/compare %esi 1/r32/ecx +27508 0f 82/jump-if-addr< break/disp32 +27509 # var v/ebx: (addr var) = lookup(*curr) +27510 (lookup *esi *(esi+4)) # => eax +27511 89/<- %ebx 0/r32/eax +27512 #? (lookup *ebx *(ebx+4)) # Var-name +27513 #? (write-buffered Stderr "var ") +27514 #? (write-buffered Stderr %eax) +27515 #? (write-buffered Stderr Newline) +27516 #? (flush Stderr) +27517 # if (v->block-depth < until-block-depth) break +27518 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth +27519 0f 8c/jump-if-< break/disp32 +27520 # if v is in a register +27521 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +27522 { +27523 0f 84/jump-if-= break/disp32 +27524 { +27525 $emit-cleanup-code-until-depth:check-for-previous-spill: +27526 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled +27527 3d/compare-eax-and 0/imm32/false +27528 74/jump-if-= break/disp8 +27529 $emit-cleanup-code-until-depth:reclaim-var-in-register: +27530 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +27531 (emit-pop-register *(ebp+8) %eax) +27532 } +27533 eb/jump $emit-cleanup-code-until-depth:continue/disp8 +27534 } +27535 # otherwise v is on the stack +27536 { +27537 75/jump-if-!= break/disp8 +27538 $emit-cleanup-code-until-depth:var-on-stack: +27539 (size-of %ebx) # => eax +27540 # don't emit code for labels +27541 3d/compare-eax-and 0/imm32 +27542 74/jump-if-= break/disp8 +27543 $emit-cleanup-code-until-depth:reclaim-var-on-stack: +27544 (emit-indent *(ebp+8) *Curr-block-depth) +27545 (write-buffered *(ebp+8) "81 0/subop/add %esp ") +27546 (write-int32-hex-buffered *(ebp+8) %eax) +27547 (write-buffered *(ebp+8) "/imm32\n") +27548 } +27549 $emit-cleanup-code-until-depth:continue: +27550 # curr -= 12 +27551 81 5/subop/subtract %esi 0xc/imm32 +27552 e9/jump loop/disp32 +27553 } +27554 $emit-cleanup-code-until-depth:end: +27555 # . restore registers +27556 5e/pop-to-esi +27557 5b/pop-to-ebx +27558 5a/pop-to-edx +27559 59/pop-to-ecx +27560 58/pop-to-eax +27561 # . epilogue +27562 89/<- %esp 5/r32/ebp +27563 5d/pop-to-ebp +27564 c3/return +27565 +27566 # emit clean-up code for 'vars' that don't conflict with output registers +27567 # doesn't actually modify 'vars' so we need traverse manually inside the stack +27568 emit-cleanup-code-for-non-outputs: # out: (addr buffered-file), vars: (addr stack live-var), fn: (addr function) +27569 # . prologue +27570 55/push-ebp +27571 89/<- %ebp 4/r32/esp +27572 # . save registers +27573 50/push-eax +27574 51/push-ecx +27575 52/push-edx +27576 53/push-ebx +27577 56/push-esi +27578 57/push-edi +27579 # ecx = vars +27580 8b/-> *(ebp+0xc) 1/r32/ecx +27581 # var esi: int = vars->top +27582 8b/-> *ecx 6/r32/esi +27583 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +27584 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size +27585 # var min/ecx: (addr handle var) = vars->data +27586 81 0/subop/add %ecx 8/imm32 +27587 { +27588 $emit-cleanup-code-for-non-outputs:loop: +27589 # if (curr < min) break +27590 39/compare %esi 1/r32/ecx +27591 0f 82/jump-if-addr< break/disp32 +27592 # var v/ebx: (addr var) = lookup(*curr) +27593 (lookup *esi *(esi+4)) # => eax +27594 89/<- %ebx 0/r32/eax +27595 # if v is in a register +27596 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +27597 { +27598 0f 84/jump-if-= break/disp32 +27599 { +27600 $emit-cleanup-code-for-non-outputs:check-for-previous-spill: +27601 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled +27602 3d/compare-eax-and 0/imm32/false +27603 0f 84/jump-if-= break/disp32 +27604 $emit-cleanup-code-for-non-outputs:reclaim-var-in-register: +27605 # var reg/edi: (addr array name) = v->register +27606 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +27607 89/<- %edi 0/r32/eax +27608 # if reg is not in function outputs, emit a pop +27609 (reg-in-function-outputs? *(ebp+0x10) %edi) # => eax +27610 3d/compare-eax-and 0/imm32/false +27611 { +27612 75/jump-if-!= break/disp8 +27613 (emit-pop-register *(ebp+8) %edi) +27614 eb/jump $emit-cleanup-code-for-non-outputs:reclaim-var-in-register-done/disp8 +27615 } +27616 # otherwise just drop it from the stack +27617 (emit-indent *(ebp+8) *Curr-block-depth) +27618 (write-buffered *(ebp+8) "81 0/subop/add %esp 4/imm32\n") +27619 } +27620 $emit-cleanup-code-for-non-outputs:reclaim-var-in-register-done: +27621 eb/jump $emit-cleanup-code-for-non-outputs:continue/disp8 +27622 } +27623 # otherwise v is on the stack +27624 { +27625 75/jump-if-!= break/disp8 +27626 $emit-cleanup-code-for-non-outputs:var-on-stack: +27627 (size-of %ebx) # => eax +27628 # don't emit code for labels +27629 3d/compare-eax-and 0/imm32 +27630 74/jump-if-= break/disp8 +27631 $emit-cleanup-code-for-non-outputs:reclaim-var-on-stack: +27632 (emit-indent *(ebp+8) *Curr-block-depth) +27633 (write-buffered *(ebp+8) "81 0/subop/add %esp ") +27634 (write-int32-hex-buffered *(ebp+8) %eax) +27635 (write-buffered *(ebp+8) "/imm32\n") +27636 } +27637 $emit-cleanup-code-for-non-outputs:continue: +27638 # curr -= 12 +27639 81 5/subop/subtract %esi 0xc/imm32 +27640 e9/jump loop/disp32 +27641 } +27642 $emit-cleanup-code-for-non-outputs:end: +27643 # . restore registers +27644 5f/pop-to-edi +27645 5e/pop-to-esi +27646 5b/pop-to-ebx +27647 5a/pop-to-edx +27648 59/pop-to-ecx +27649 58/pop-to-eax +27650 # . epilogue +27651 89/<- %esp 5/r32/ebp +27652 5d/pop-to-ebp +27653 c3/return +27654 +27655 emit-push-register: # out: (addr buffered-file), reg: (addr array byte) +27656 # . prologue +27657 55/push-ebp +27658 89/<- %ebp 4/r32/esp +27659 # eax = reg +27660 8b/-> *(ebp+0xc) 0/r32/eax +27661 # var prefix/eax: byte = reg->data[0] +27662 8a/copy-byte *(eax+4) 0/r32/AL +27663 81 4/subop/and %eax 0xff/imm32 +27664 # if (prefix == 'x') push xmm register +27665 { +27666 3d/compare-eax-and 0x78/imm32/x +27667 0f 85/jump-if-!= break/disp32 +27668 # TODO validate register +27669 (emit-indent *(ebp+8) *Curr-block-depth) +27670 (write-buffered *(ebp+8) "81 5/subop/subtract %esp 4/imm32\n") +27671 (emit-indent *(ebp+8) *Curr-block-depth) +27672 (write-buffered *(ebp+8) "f3 0f 11/<- *esp ") +27673 # var prefix/eax: byte = reg->data[3] +27674 8b/-> *(ebp+0xc) 0/r32/eax +27675 8a/copy-byte *(eax+7) 0/r32/AL +27676 81 4/subop/and %eax 0xff/imm32 +27677 (write-byte-buffered *(ebp+8) %eax) +27678 (write-buffered *(ebp+8) "/x32\n") +27679 e9/jump $emit-push-register:end/disp32 +27680 } +27681 # otherwise push gp register +27682 (emit-indent *(ebp+8) *Curr-block-depth) +27683 (write-buffered *(ebp+8) "ff 6/subop/push %") +27684 (write-buffered *(ebp+8) *(ebp+0xc)) +27685 (write-buffered *(ebp+8) Newline) +27686 $emit-push-register:end: +27687 # . epilogue +27688 89/<- %esp 5/r32/ebp +27689 5d/pop-to-ebp +27690 c3/return +27691 +27692 emit-pop-register: # out: (addr buffered-file), reg: (addr array byte) +27693 # . prologue +27694 55/push-ebp +27695 89/<- %ebp 4/r32/esp +27696 # . save registers +27697 50/push-eax +27698 # eax = reg +27699 8b/-> *(ebp+0xc) 0/r32/eax +27700 # var prefix/eax: byte = reg->data[0] +27701 8a/copy-byte *(eax+4) 0/r32/AL +27702 81 4/subop/and %eax 0xff/imm32 +27703 # if (prefix == 'x') pop to xmm register +27704 { +27705 3d/compare-eax-and 0x78/imm32/x +27706 0f 85/jump-if-!= break/disp32 +27707 # TODO validate register +27708 (emit-indent *(ebp+8) *Curr-block-depth) +27709 (write-buffered *(ebp+8) "f3 0f 10/-> *esp ") +27710 # var prefix/eax: byte = reg->data[3] +27711 8b/-> *(ebp+0xc) 0/r32/eax +27712 8a/copy-byte *(eax+7) 0/r32/AL +27713 81 4/subop/and %eax 0xff/imm32 +27714 (write-byte-buffered *(ebp+8) %eax) +27715 (write-buffered *(ebp+8) "/x32\n") +27716 (emit-indent *(ebp+8) *Curr-block-depth) +27717 (write-buffered *(ebp+8) "81 0/subop/add %esp 4/imm32\n") +27718 e9/jump $emit-pop-register:end/disp32 +27719 } +27720 # otherwise pop to gp register +27721 (emit-indent *(ebp+8) *Curr-block-depth) +27722 (write-buffered *(ebp+8) "8f 0/subop/pop %") +27723 (write-buffered *(ebp+8) *(ebp+0xc)) +27724 (write-buffered *(ebp+8) Newline) +27725 $emit-pop-register:end: +27726 # . restore registers +27727 58/pop-to-eax +27728 # . epilogue +27729 89/<- %esp 5/r32/ebp +27730 5d/pop-to-ebp +27731 c3/return +27732 +27733 # emit clean-up code for 'vars' until a given label is encountered +27734 # doesn't actually modify 'vars' so we need traverse manually inside the stack +27735 emit-cleanup-code-until-target: # out: (addr buffered-file), vars: (addr stack live-var), until-block-label: (addr array byte) +27736 # . prologue +27737 55/push-ebp +27738 89/<- %ebp 4/r32/esp +27739 # . save registers +27740 50/push-eax +27741 51/push-ecx +27742 52/push-edx +27743 53/push-ebx +27744 # ecx = vars +27745 8b/-> *(ebp+0xc) 1/r32/ecx +27746 # var eax: int = vars->top +27747 8b/-> *ecx 0/r32/eax +27748 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] +27749 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size +27750 # var min/ecx: (addr handle var) = vars->data +27751 81 0/subop/add %ecx 8/imm32 +27752 { +27753 $emit-cleanup-code-until-target:loop: +27754 # if (curr < min) break +27755 39/compare %edx 1/r32/ecx +27756 0f 82/jump-if-addr< break/disp32 +27757 # var v/ebx: (handle var) = lookup(*curr) +27758 (lookup *edx *(edx+4)) # => eax +27759 89/<- %ebx 0/r32/eax +27760 # if (v->name == until-block-label) break +27761 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +27762 (string-equal? %eax *(ebp+0x10)) # => eax +27763 3d/compare-eax-and 0/imm32/false +27764 0f 85/jump-if-!= break/disp32 +27765 # if v is in a register +27766 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +27767 { +27768 0f 84/jump-if-= break/disp32 +27769 { +27770 $emit-cleanup-code-until-target:check-for-previous-spill: +27771 8b/-> *(edx+8) 0/r32/eax # Live-var-register-spilled +27772 3d/compare-eax-and 0/imm32/false +27773 74/jump-if-= break/disp8 +27774 $emit-cleanup-code-until-target:reclaim-var-in-register: +27775 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +27776 (emit-pop-register *(ebp+8) %eax) +27777 } +27778 eb/jump $emit-cleanup-code-until-target:continue/disp8 +27779 } +27780 # otherwise v is on the stack +27781 { +27782 75/jump-if-!= break/disp8 +27783 $emit-cleanup-code-until-target:reclaim-var-on-stack: +27784 (size-of %ebx) # => eax +27785 # don't emit code for labels +27786 3d/compare-eax-and 0/imm32 +27787 74/jump-if-= break/disp8 +27788 # +27789 (emit-indent *(ebp+8) *Curr-block-depth) +27790 (write-buffered *(ebp+8) "81 0/subop/add %esp ") +27791 (write-int32-hex-buffered *(ebp+8) %eax) +27792 (write-buffered *(ebp+8) "/imm32\n") +27793 } +27794 $emit-cleanup-code-until-target:continue: +27795 # curr -= 12 +27796 81 5/subop/subtract %edx 0xc/imm32 +27797 e9/jump loop/disp32 +27798 } +27799 $emit-cleanup-code-until-target:end: +27800 # . restore registers +27801 5b/pop-to-ebx +27802 5a/pop-to-edx +27803 59/pop-to-ecx +27804 58/pop-to-eax +27805 # . epilogue +27806 89/<- %esp 5/r32/ebp +27807 5d/pop-to-ebp +27808 c3/return +27809 +27810 # update Curr-local-stack-offset assuming vars until some block depth are popped +27811 # doesn't actually modify 'vars', so we need traverse manually inside the stack +27812 clean-up-stack-offset-state: # vars: (addr stack live-var), until-block-depth: int +27813 # . prologue +27814 55/push-ebp +27815 89/<- %ebp 4/r32/esp +27816 # . save registers +27817 50/push-eax +27818 51/push-ecx +27819 52/push-edx +27820 53/push-ebx +27821 56/push-esi +27822 # ecx = vars +27823 8b/-> *(ebp+8) 1/r32/ecx +27824 # var esi: int = vars->top +27825 8b/-> *ecx 6/r32/esi +27826 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +27827 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size +27828 # var min/ecx: (addr handle var) = vars->data +27829 81 0/subop/add %ecx 8/imm32 +27830 # edx = until-block-depth +27831 8b/-> *(ebp+0xc) 2/r32/edx +27832 { +27833 $clean-up-stack-offset-state:loop: +27834 # if (curr < min) break +27835 39/compare %esi 1/r32/ecx +27836 0f 82/jump-if-addr< break/disp32 +27837 # var v/ebx: (addr var) = lookup(*curr) +27838 (lookup *esi *(esi+4)) # => eax +27839 89/<- %ebx 0/r32/eax +27840 # if (v->block-depth < until-block-depth) break +27841 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth +27842 0f 8c/jump-if-< break/disp32 +27843 # if v is in a register +27844 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +27845 { +27846 0f 84/jump-if-= break/disp32 +27847 { +27848 $clean-up-stack-offset-state:check-for-previous-spill: +27849 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled +27850 3d/compare-eax-and 0/imm32/false +27851 74/jump-if-= break/disp8 +27852 $clean-up-stack-offset-state:reclaim-var-in-register: +27853 81 0/subop/add *Curr-local-stack-offset 4/imm32 +27854 } +27855 eb/jump $clean-up-stack-offset-state:continue/disp8 +27856 } +27857 # otherwise v is on the stack +27858 { +27859 75/jump-if-!= break/disp8 +27860 $clean-up-stack-offset-state:var-on-stack: +27861 (size-of %ebx) # => eax +27862 01/add-to *Curr-local-stack-offset 0/r32/eax +27863 } +27864 $clean-up-stack-offset-state:continue: +27865 # curr -= 12 +27866 81 5/subop/subtract %esi 0xc/imm32 +27867 e9/jump loop/disp32 +27868 } +27869 $clean-up-stack-offset-state:end: +27870 # . restore registers +27871 5e/pop-to-esi +27872 5b/pop-to-ebx +27873 5a/pop-to-edx +27874 59/pop-to-ecx +27875 58/pop-to-eax +27876 # . epilogue +27877 89/<- %esp 5/r32/ebp +27878 5d/pop-to-ebp +27879 c3/return +27880 +27881 # Return true if there isn't a variable in 'vars' with the same block-depth +27882 # and register as 'v'. +27883 # 'v' is guaranteed not to be within 'vars'. +27884 not-yet-spilled-this-block?: # v: (addr var), vars: (addr stack live-var) -> result/eax: boolean +27885 # . prologue +27886 55/push-ebp +27887 89/<- %ebp 4/r32/esp +27888 # . save registers +27889 51/push-ecx +27890 52/push-edx +27891 53/push-ebx +27892 56/push-esi +27893 57/push-edi +27894 # ecx = vars +27895 8b/-> *(ebp+0xc) 1/r32/ecx +27896 # var eax: int = vars->top +27897 8b/-> *ecx 0/r32/eax +27898 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] +27899 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size +27900 # var min/ecx: (addr handle var) = vars->data +27901 8d/copy-address *(ecx+8) 1/r32/ecx +27902 # var depth/ebx: int = v->block-depth +27903 8b/-> *(ebp+8) 3/r32/ebx +27904 8b/-> *(ebx+0x10) 3/r32/ebx # Var-block-depth +27905 # var needle/esi: (addr array byte) = v->register +27906 8b/-> *(ebp+8) 6/r32/esi +27907 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +27908 89/<- %esi 0/r32/eax +27909 { +27910 $not-yet-spilled-this-block?:loop: +27911 # if (curr < min) break +27912 39/compare %edx 1/r32/ecx +27913 0f 82/jump-if-addr< break/disp32 +27914 # var cand/edi: (addr var) = lookup(*curr) +27915 (lookup *edx *(edx+4)) # => eax +27916 89/<- %edi 0/r32/eax +27917 # if (cand->block-depth < depth) break +27918 39/compare *(edi+0x10) 3/r32/ebx # Var-block-depth +27919 0f 8c/jump-if-< break/disp32 +27920 # var cand-reg/edi: (array array byte) = cand->reg +27921 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax +27922 89/<- %edi 0/r32/eax +27923 # if (cand-reg == null) continue +27924 { +27925 $not-yet-spilled-this-block?:check-reg: +27926 81 7/subop/compare %edi 0/imm32 +27927 0f 84/jump-if-= break/disp32 +27928 # if (cand-reg == needle) return true +27929 (string-equal? %esi %edi) # => eax +27930 3d/compare-eax-and 0/imm32/false +27931 74/jump-if-= break/disp8 +27932 $not-yet-spilled-this-block?:return-false: +27933 b8/copy-to-eax 0/imm32/false +27934 eb/jump $not-yet-spilled-this-block?:end/disp8 +27935 } +27936 $not-yet-spilled-this-block?:continue: +27937 # curr -= 12 +27938 81 5/subop/subtract %edx 0xc/imm32 +27939 e9/jump loop/disp32 +27940 } +27941 $not-yet-spilled-this-block?:return-true: +27942 # return true +27943 b8/copy-to-eax 1/imm32/true +27944 $not-yet-spilled-this-block?:end: +27945 # . restore registers +27946 5f/pop-to-edi +27947 5e/pop-to-esi +27948 5b/pop-to-ebx +27949 5a/pop-to-edx +27950 59/pop-to-ecx +27951 # . epilogue +27952 89/<- %esp 5/r32/ebp +27953 5d/pop-to-ebp +27954 c3/return +27955 +27956 # could the register of 'v' ever be written to by one of the vars in fn-outputs? +27957 will-not-write-some-register?: # v: (addr var), stmts: (addr list stmt), fn: (addr function) -> result/eax: boolean +27958 # . prologue +27959 55/push-ebp +27960 89/<- %ebp 4/r32/esp +27961 # eax = v +27962 8b/-> *(ebp+8) 0/r32/eax +27963 # var reg/eax: (addr array byte) = lookup(v->register) +27964 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +27965 # var target/eax: (addr var) = find-register(fn-outputs, reg) +27966 (find-register *(ebp+0x10) %eax) # => eax +27967 # if (target == 0) return true +27968 { +27969 3d/compare-eax-and 0/imm32 +27970 75/jump-if-!= break/disp8 +27971 b8/copy-to-eax 1/imm32/true +27972 eb/jump $will-not-write-some-register?:end/disp8 27973 } -27974 # otherwise base is on the stack -27975 { -27976 $translate-mu-get-stmt:emit-stack-input: -27977 # emit "*(ebp + " inouts[0]->stack-offset + offset ") " -27978 (write-buffered *(ebp+8) "*(ebp+") -27979 03/add *(eax+0x14) 2/r32/edx # Var-offset -27980 (write-int32-hex-buffered *(ebp+8) %edx) -27981 (write-buffered *(ebp+8) ") ") -27982 eb/jump $translate-mu-get-stmt:emit-output/disp8 -27983 } -27984 $translate-mu-get-stmt:emit-output: -27985 # var output/eax: (addr var) = stmt->outputs->value -27986 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -27987 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -27988 # emit offset->register "/r32" -27989 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -27990 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) -27991 (write-int32-hex-buffered *(ebp+8) *eax) -27992 (write-buffered *(ebp+8) "/r32\n") -27993 $translate-mu-get-stmt:end: -27994 # . restore registers -27995 5a/pop-to-edx -27996 59/pop-to-ecx -27997 58/pop-to-eax -27998 # . epilogue -27999 89/<- %esp 5/r32/ebp -28000 5d/pop-to-ebp -28001 c3/return -28002 -28003 translate-mu-copy-object-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -28004 # . prologue -28005 55/push-ebp -28006 89/<- %ebp 4/r32/esp -28007 # . save registers -28008 50/push-eax -28009 # -28010 (emit-indent *(ebp+8) *Curr-block-depth) -28011 (write-buffered *(ebp+8) "(copy-bytes") -28012 # eax = stmt -28013 8b/-> *(ebp+0xc) 0/r32/eax -28014 # var first-inout/eax: (addr stmt-var) = stmt->inouts[0] -28015 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -28016 (emit-subx-call-operand *(ebp+8) %eax) -28017 # var second-inout/eax: (addr stmt-var) = stmt->inouts[1] -28018 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -28019 (emit-subx-call-operand *(ebp+8) %eax) -28020 # emit size of inouts -28021 (write-buffered *(ebp+8) Space) -28022 (addr-payload-size %eax *(ebp+0x10) *(ebp+0x14)) # => eax -28023 (write-int32-hex-buffered *(ebp+8) %eax) -28024 (write-buffered *(ebp+8) ")\n") -28025 $translate-mu-copy-object-stmt:end: -28026 # . restore registers -28027 58/pop-to-eax -28028 # . epilogue -28029 89/<- %esp 5/r32/ebp -28030 5d/pop-to-ebp -28031 c3/return -28032 -28033 translate-mu-clear-object-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -28034 # . prologue -28035 55/push-ebp -28036 89/<- %ebp 4/r32/esp -28037 # . save registers -28038 50/push-eax -28039 # -28040 (emit-indent *(ebp+8) *Curr-block-depth) -28041 (write-buffered *(ebp+8) "(zero-out") -28042 # eax = stmt -28043 8b/-> *(ebp+0xc) 0/r32/eax -28044 # var dest/eax: (addr stmt-var) = stmt->inouts[0] -28045 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -28046 # -28047 (emit-subx-call-operand *(ebp+8) %eax) -28048 (write-buffered *(ebp+8) Space) -28049 (addr-payload-size %eax *(ebp+0x10) *(ebp+0x14)) # => eax -28050 (write-int32-hex-buffered *(ebp+8) %eax) -28051 (write-buffered *(ebp+8) ")\n") -28052 $translate-mu-clear-object-stmt:end: +27974 # return !assigns-in-stmts?(stmts, target) +27975 (assigns-in-stmts? *(ebp+0xc) %eax) # => eax +27976 3d/compare-eax-and 0/imm32/false +27977 # assume: true = 1, so no need to mask with 0x000000ff +27978 0f 94/set-if-= %al +27979 $will-not-write-some-register?:end: +27980 # . epilogue +27981 89/<- %esp 5/r32/ebp +27982 5d/pop-to-ebp +27983 c3/return +27984 +27985 # return fn output with matching register +27986 # always returns false if 'reg' is null +27987 find-register: # fn: (addr function), reg: (addr array byte) -> result/eax: (addr var) +27988 # . prologue +27989 55/push-ebp +27990 89/<- %ebp 4/r32/esp +27991 # . save registers +27992 51/push-ecx +27993 # var curr/ecx: (addr list var) = lookup(fn->outputs) +27994 8b/-> *(ebp+8) 1/r32/ecx +27995 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax +27996 89/<- %ecx 0/r32/eax +27997 { +27998 $find-register:loop: +27999 # if (curr == 0) break +28000 81 7/subop/compare %ecx 0/imm32 +28001 74/jump-if-= break/disp8 +28002 # eax = curr->value->register +28003 (lookup *ecx *(ecx+4)) # List-value List-value => eax +28004 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +28005 # if (eax == reg) return curr->value +28006 $find-register:compare: +28007 (string-equal? *(ebp+0xc) %eax) # => eax +28008 { +28009 3d/compare-eax-and 0/imm32/false +28010 74/jump-if-= break/disp8 +28011 $find-register:found: +28012 (lookup *ecx *(ecx+4)) # List-value List-value => eax +28013 eb/jump $find-register:end/disp8 +28014 } +28015 # curr = lookup(curr->next) +28016 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +28017 89/<- %ecx 0/r32/eax +28018 # +28019 eb/jump loop/disp8 +28020 } +28021 $find-register:end: +28022 # . restore registers +28023 59/pop-to-ecx +28024 # . epilogue +28025 89/<- %esp 5/r32/ebp +28026 5d/pop-to-ebp +28027 c3/return +28028 +28029 assigns-in-stmts?: # stmts: (addr list stmt), v: (addr var) -> result/eax: boolean +28030 # . prologue +28031 55/push-ebp +28032 89/<- %ebp 4/r32/esp +28033 # . save registers +28034 51/push-ecx +28035 # var curr/ecx: (addr list stmt) = stmts +28036 8b/-> *(ebp+8) 1/r32/ecx +28037 { +28038 # if (curr == 0) break +28039 81 7/subop/compare %ecx 0/imm32 +28040 74/jump-if-= break/disp8 +28041 # if assigns-in-stmt?(curr->value, v) return true +28042 (lookup *ecx *(ecx+4)) # List-value List-value => eax +28043 (assigns-in-stmt? %eax *(ebp+0xc)) # => eax +28044 3d/compare-eax-and 0/imm32/false +28045 75/jump-if-!= break/disp8 +28046 # curr = lookup(curr->next) +28047 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +28048 89/<- %ecx 0/r32/eax +28049 # +28050 eb/jump loop/disp8 +28051 } +28052 $assigns-in-stmts?:end: 28053 # . restore registers -28054 58/pop-to-eax +28054 59/pop-to-ecx 28055 # . epilogue 28056 89/<- %esp 5/r32/ebp 28057 5d/pop-to-ebp 28058 c3/return 28059 -28060 translate-mu-allocate-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +28060 assigns-in-stmt?: # stmt: (addr stmt), v: (addr var) -> result/eax: boolean 28061 # . prologue 28062 55/push-ebp 28063 89/<- %ebp 4/r32/esp 28064 # . save registers -28065 50/push-eax -28066 56/push-esi -28067 57/push-edi -28068 # esi = stmt -28069 8b/-> *(ebp+0xc) 6/r32/esi -28070 # var target/edi: (addr stmt-var) = stmt->inouts[0] -28071 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -28072 89/<- %edi 0/r32/eax -28073 # -28074 (emit-indent *(ebp+8) *Curr-block-depth) -28075 (write-buffered *(ebp+8) "(allocate Heap ") -28076 (addr-handle-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax -28077 (write-int32-hex-buffered *(ebp+8) %eax) -28078 (emit-subx-call-operand *(ebp+8) %edi) -28079 (write-buffered *(ebp+8) ")\n") -28080 $translate-mu-allocate-stmt:end: -28081 # . restore registers -28082 5f/pop-to-edi -28083 5e/pop-to-esi -28084 58/pop-to-eax -28085 # . epilogue -28086 89/<- %esp 5/r32/ebp -28087 5d/pop-to-ebp -28088 c3/return -28089 -28090 addr-handle-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -28091 # . prologue -28092 55/push-ebp -28093 89/<- %ebp 4/r32/esp -28094 # var t/eax: (addr type-tree) = s->value->type -28095 8b/-> *(ebp+8) 0/r32/eax -28096 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -28097 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -28098 # TODO: check eax != 0 -28099 # TODO: check !t->is-atom? -28100 # TODO: check t->left == addr -28101 # t = t->right -28102 $addr-handle-payload-size:skip-addr: -28103 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -28104 # TODO: check eax != 0 -28105 # TODO: check !t->is-atom? -28106 # TODO: check t->left == handle -28107 # t = t->right -28108 $addr-handle-payload-size:skip-handle: -28109 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -28110 # TODO: check eax != 0 -28111 # if !t->is-atom? t = t->left -28112 81 7/subop/compare *eax 0/imm32/false -28113 { -28114 75/jump-if-!= break/disp8 -28115 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -28116 } -28117 # TODO: check t->is-atom? -28118 # return size(t->value) -28119 (size-of-type-id *(eax+4)) # Type-tree-value => eax -28120 $addr-handle-payload-size:end: -28121 # . epilogue -28122 89/<- %esp 5/r32/ebp -28123 5d/pop-to-ebp -28124 c3/return -28125 -28126 addr-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -28127 # . prologue -28128 55/push-ebp -28129 89/<- %ebp 4/r32/esp -28130 # var t/eax: (addr type-tree) = s->value->type -28131 8b/-> *(ebp+8) 0/r32/eax -28132 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -28133 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -28134 # TODO: check eax != 0 -28135 # TODO: check !t->is-atom? -28136 # TODO: check t->left == addr -28137 # t = t->right -28138 $addr-payload-size:skip-addr: -28139 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -28140 # TODO: check eax != 0 -28141 # if !t->is-atom? t = t->left -28142 81 7/subop/compare *eax 0/imm32/false -28143 { -28144 75/jump-if-!= break/disp8 -28145 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -28146 } -28147 # TODO: check t->is-atom? -28148 # return size(t->value) -28149 (size-of-type-id *(eax+4)) # Type-tree-value => eax -28150 $addr-payload-size:end: -28151 # . epilogue -28152 89/<- %esp 5/r32/ebp -28153 5d/pop-to-ebp -28154 c3/return -28155 -28156 translate-mu-populate-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -28157 # . prologue -28158 55/push-ebp -28159 89/<- %ebp 4/r32/esp -28160 # . save registers -28161 50/push-eax -28162 51/push-ecx -28163 56/push-esi -28164 57/push-edi -28165 # esi = stmt -28166 8b/-> *(ebp+0xc) 6/r32/esi -28167 # var target/edi: (addr stmt-var) = stmt->inouts[0] -28168 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -28169 89/<- %edi 0/r32/eax -28170 # var len/ecx: (addr stmt-var) = stmt->inouts[1] -28171 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -28172 89/<- %ecx 0/r32/eax -28173 # -28174 (emit-indent *(ebp+8) *Curr-block-depth) -28175 (write-buffered *(ebp+8) "(allocate-array2 Heap ") -28176 (addr-handle-array-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax -28177 (write-int32-hex-buffered *(ebp+8) %eax) -28178 (emit-subx-call-operand *(ebp+8) %ecx) -28179 (emit-subx-call-operand *(ebp+8) %edi) -28180 (write-buffered *(ebp+8) ")\n") -28181 $translate-mu-populate-stmt:end: -28182 # . restore registers -28183 5f/pop-to-edi -28184 5e/pop-to-esi -28185 59/pop-to-ecx -28186 58/pop-to-eax -28187 # . epilogue -28188 89/<- %esp 5/r32/ebp -28189 5d/pop-to-ebp -28190 c3/return -28191 -28192 translate-mu-populate-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -28193 # . prologue -28194 55/push-ebp -28195 89/<- %ebp 4/r32/esp -28196 # . save registers -28197 50/push-eax -28198 51/push-ecx -28199 56/push-esi -28200 57/push-edi -28201 # esi = stmt -28202 8b/-> *(ebp+0xc) 6/r32/esi -28203 # var target/edi: (addr stmt-var) = stmt->inouts[0] -28204 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -28205 89/<- %edi 0/r32/eax -28206 # var len/ecx: (addr stmt-var) = stmt->inouts[1] -28207 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -28208 89/<- %ecx 0/r32/eax -28209 # -28210 (emit-indent *(ebp+8) *Curr-block-depth) -28211 (write-buffered *(ebp+8) "(new-stream Heap ") -28212 (addr-handle-stream-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax -28213 (write-int32-hex-buffered *(ebp+8) %eax) -28214 (emit-subx-call-operand *(ebp+8) %ecx) -28215 (emit-subx-call-operand *(ebp+8) %edi) -28216 (write-buffered *(ebp+8) ")\n") -28217 $translate-mu-populate-stream-stmt:end: -28218 # . restore registers -28219 5f/pop-to-edi -28220 5e/pop-to-esi -28221 59/pop-to-ecx -28222 58/pop-to-eax -28223 # . epilogue -28224 89/<- %esp 5/r32/ebp -28225 5d/pop-to-ebp -28226 c3/return -28227 -28228 translate-mu-read-from-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -28229 # . prologue -28230 55/push-ebp -28231 89/<- %ebp 4/r32/esp -28232 # . save registers -28233 50/push-eax -28234 51/push-ecx -28235 56/push-esi -28236 57/push-edi -28237 # esi = stmt -28238 8b/-> *(ebp+0xc) 6/r32/esi -28239 # var stream/ecx: (addr stmt-var) = stmt->inouts[0] -28240 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -28241 89/<- %ecx 0/r32/eax -28242 # var target/edi: (addr stmt-var) = stmt->inouts[1] -28243 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax -28244 89/<- %edi 0/r32/eax -28245 # -28246 (emit-indent *(ebp+8) *Curr-block-depth) -28247 (write-buffered *(ebp+8) "(read-from-stream") -28248 (emit-subx-call-operand *(ebp+8) %ecx) -28249 (emit-subx-call-operand *(ebp+8) %edi) -28250 (write-buffered *(ebp+8) Space) -28251 (addr-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax -28252 (write-int32-hex-buffered *(ebp+8) %eax) -28253 (write-buffered *(ebp+8) ")\n") -28254 $translate-mu-read-from-stream-stmt:end: -28255 # . restore registers -28256 5f/pop-to-edi -28257 5e/pop-to-esi -28258 59/pop-to-ecx -28259 58/pop-to-eax -28260 # . epilogue -28261 89/<- %esp 5/r32/ebp -28262 5d/pop-to-ebp -28263 c3/return -28264 -28265 translate-mu-write-to-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -28266 # . prologue -28267 55/push-ebp -28268 89/<- %ebp 4/r32/esp -28269 # . save registers -28270 50/push-eax -28271 51/push-ecx -28272 56/push-esi -28273 57/push-edi -28274 # esi = stmt -28275 8b/-> *(ebp+0xc) 6/r32/esi -28276 # var stream/ecx: (addr stmt-var) = stmt->inouts[0] -28277 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -28278 89/<- %ecx 0/r32/eax -28279 # var target/edi: (addr stmt-var) = stmt->inouts[1] -28280 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax -28281 89/<- %edi 0/r32/eax -28282 # -28283 (emit-indent *(ebp+8) *Curr-block-depth) -28284 (write-buffered *(ebp+8) "(write-to-stream") -28285 (emit-subx-call-operand *(ebp+8) %ecx) -28286 (flush *(ebp+8)) -28287 (emit-subx-call-operand *(ebp+8) %edi) -28288 (flush *(ebp+8)) -28289 (write-buffered *(ebp+8) Space) -28290 (flush *(ebp+8)) -28291 (addr-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax -28292 (write-int32-hex-buffered *(ebp+8) %eax) -28293 (write-buffered *(ebp+8) ")\n") -28294 $translate-mu-write-to-stream-stmt:end: -28295 # . restore registers -28296 5f/pop-to-edi -28297 5e/pop-to-esi -28298 59/pop-to-ecx -28299 58/pop-to-eax -28300 # . epilogue -28301 89/<- %esp 5/r32/ebp -28302 5d/pop-to-ebp -28303 c3/return -28304 -28305 addr-handle-array-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -28306 # . prologue -28307 55/push-ebp -28308 89/<- %ebp 4/r32/esp -28309 # var t/eax: (addr type-tree) = s->value->type -28310 8b/-> *(ebp+8) 0/r32/eax -28311 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -28312 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -28313 # TODO: check eax != 0 -28314 # TODO: check !t->is-atom? -28315 # TODO: check t->left == addr -28316 # t = t->right -28317 $addr-handle-array-payload-size:skip-addr: -28318 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -28319 # TODO: check eax != 0 -28320 # TODO: check !t->is-atom? -28321 # TODO: check t->left == handle -28322 # t = t->right -28323 $addr-handle-array-payload-size:skip-handle: -28324 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -28325 # TODO: check eax != 0 -28326 # TODO: check !t->is-atom? -28327 # TODO: check t->left == array -28328 # t = t->right -28329 $addr-handle-array-payload-size:skip-array: -28330 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -28331 # TODO: check eax != 0 -28332 # if !t->is-atom? t = t->left -28333 81 7/subop/compare *eax 0/imm32/false -28334 { -28335 75/jump-if-!= break/disp8 -28336 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -28337 } -28338 $addr-handle-array-payload-size:compute-size: -28339 # TODO: check t->is-atom? -28340 # return size(t->value) -28341 (size-of-type-id-as-array-element *(eax+4)) # Type-tree-value => eax -28342 $addr-handle-array-payload-size:end: -28343 # . epilogue -28344 89/<- %esp 5/r32/ebp -28345 5d/pop-to-ebp -28346 c3/return -28347 -28348 addr-handle-stream-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -28349 # . prologue -28350 55/push-ebp -28351 89/<- %ebp 4/r32/esp -28352 # var t/eax: (addr type-tree) = s->value->type -28353 8b/-> *(ebp+8) 0/r32/eax -28354 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -28355 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -28356 # TODO: check eax != 0 -28357 # TODO: check !t->is-atom? -28358 # TODO: check t->left == addr -28359 # t = t->right -28360 $addr-handle-stream-payload-size:skip-addr: -28361 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -28362 # TODO: check eax != 0 -28363 # TODO: check !t->is-atom? -28364 # TODO: check t->left == handle -28365 # t = t->right -28366 $addr-handle-stream-payload-size:skip-handle: -28367 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -28368 # TODO: check eax != 0 -28369 # TODO: check !t->is-atom? -28370 # TODO: check t->left == stream -28371 # t = t->right -28372 $addr-handle-stream-payload-size:skip-stream: -28373 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -28374 # TODO: check eax != 0 -28375 # if !t->is-atom? t = t->left -28376 81 7/subop/compare *eax 0/imm32/false -28377 { -28378 75/jump-if-!= break/disp8 -28379 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -28380 } -28381 $addr-handle-stream-payload-size:compute-size: -28382 # TODO: check t->is-atom? -28383 # return size(t->value) -28384 (size-of-type-id-as-array-element *(eax+4)) # Type-tree-value => eax -28385 $addr-handle-stream-payload-size:end: -28386 # . epilogue -28387 89/<- %esp 5/r32/ebp -28388 5d/pop-to-ebp -28389 c3/return -28390 -28391 power-of-2?: # n: int, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: boolean -28392 # precondition: n is positive -28393 # . prologue -28394 55/push-ebp -28395 89/<- %ebp 4/r32/esp -28396 # eax = n -28397 8b/-> *(ebp+8) 0/r32/eax -28398 # if (n < 0) abort -28399 3d/compare-eax-with 0/imm32 -28400 0f 8c/jump-if-< $power-of-2?:abort/disp32 -28401 # var tmp/eax: int = n-1 -28402 48/decrement-eax -28403 # var tmp2/eax: int = n & tmp -28404 23/and-> *(ebp+8) 0/r32/eax -28405 # return (tmp2 == 0) -28406 3d/compare-eax-and 0/imm32 -28407 0f 94/set-byte-if-= %al -28408 81 4/subop/and %eax 0xff/imm32 -28409 $power-of-2?:end: -28410 # . epilogue -28411 89/<- %esp 5/r32/ebp -28412 5d/pop-to-ebp -28413 c3/return -28414 -28415 $power-of-2?:abort: -28416 (write-buffered *(ebp+0xc) "power-of-2?: negative number\n") -28417 (flush *(ebp+0xc)) -28418 (stop *(ebp+0x10) 1) -28419 # never gets here -28420 -28421 num-shift-rights: # n: int -> result/eax: int -28422 # precondition: n is a positive power of 2 -28423 # . prologue -28424 55/push-ebp -28425 89/<- %ebp 4/r32/esp -28426 # . save registers -28427 51/push-ecx -28428 # var curr/ecx: int = n -28429 8b/-> *(ebp+8) 1/r32/ecx -28430 # result = 0 -28431 b8/copy-to-eax 0/imm32 -28432 { -28433 # if (curr <= 1) break -28434 81 7/subop/compare %ecx 1/imm32 -28435 7e/jump-if-<= break/disp8 -28436 40/increment-eax -28437 c1/shift 5/subop/arithmetic-right %ecx 1/imm8 -28438 eb/jump loop/disp8 -28439 } -28440 $num-shift-rights:end: -28441 # . restore registers -28442 59/pop-to-ecx -28443 # . epilogue -28444 89/<- %esp 5/r32/ebp -28445 5d/pop-to-ebp -28446 c3/return -28447 -28448 mu-get-offset: # stmt: (addr stmt) -> result/eax: int -28449 # . prologue -28450 55/push-ebp -28451 89/<- %ebp 4/r32/esp -28452 # var second-inout/eax: (addr stmt-var) = stmt->inouts->next -28453 8b/-> *(ebp+8) 0/r32/eax -28454 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -28455 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -28456 # var output-var/eax: (addr var) = second-inout->value -28457 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -28458 #? (write-buffered Stderr "mu-get-offset: ") -28459 #? (write-int32-hex-buffered Stderr %eax) -28460 #? (write-buffered Stderr " name: ") -28461 #? 50/push-eax -28462 #? (lookup *eax *(eax+4)) # Var-name -28463 #? (write-buffered Stderr %eax) -28464 #? 58/pop-to-eax -28465 #? (write-buffered Stderr Newline) -28466 #? (flush Stderr) -28467 # return output-var->stack-offset -28468 8b/-> *(eax+0x14) 0/r32/eax # Var-offset -28469 #? (write-buffered Stderr "=> ") -28470 #? (write-int32-hex-buffered Stderr %eax) -28471 #? (write-buffered Stderr Newline) -28472 #? (flush Stderr) -28473 $emit-get-offset:end: -28474 # . epilogue -28475 89/<- %esp 5/r32/ebp -28476 5d/pop-to-ebp -28477 c3/return -28478 -28479 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) -28480 # . prologue -28481 55/push-ebp -28482 89/<- %ebp 4/r32/esp -28483 # . save registers -28484 50/push-eax -28485 51/push-ecx -28486 56/push-esi -28487 # esi = block -28488 8b/-> *(ebp+0xc) 6/r32/esi -28489 # block->var->block-depth = *Curr-block-depth -28490 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax -28491 8b/-> *Curr-block-depth 1/r32/ecx -28492 89/<- *(eax+0x10) 1/r32/ecx # Var-block-depth -28493 # var stmts/eax: (addr list stmt) = lookup(block->statements) -28494 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax -28495 # -28496 { -28497 $emit-subx-block:check-empty: -28498 3d/compare-eax-and 0/imm32 -28499 0f 84/jump-if-= break/disp32 -28500 (emit-indent *(ebp+8) *Curr-block-depth) -28501 (write-buffered *(ebp+8) "{\n") -28502 # var v/ecx: (addr var) = lookup(block->var) -28503 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax -28504 89/<- %ecx 0/r32/eax -28505 # -28506 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -28507 (write-buffered *(ebp+8) %eax) -28508 (write-buffered *(ebp+8) ":loop:\n") -28509 ff 0/subop/increment *Curr-block-depth -28510 (push *(ebp+0x10) *(esi+0xc)) # Block-var -28511 (push *(ebp+0x10) *(esi+0x10)) # Block-var -28512 (push *(ebp+0x10) 0) # false -28513 # emit block->statements -28514 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax -28515 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -28516 (pop *(ebp+0x10)) # => eax -28517 (pop *(ebp+0x10)) # => eax -28518 (pop *(ebp+0x10)) # => eax -28519 ff 1/subop/decrement *Curr-block-depth -28520 (emit-indent *(ebp+8) *Curr-block-depth) -28521 (write-buffered *(ebp+8) "}\n") -28522 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -28523 (write-buffered *(ebp+8) %eax) -28524 (write-buffered *(ebp+8) ":break:\n") -28525 } -28526 $emit-subx-block:end: -28527 # . restore registers -28528 5e/pop-to-esi -28529 59/pop-to-ecx -28530 58/pop-to-eax -28531 # . epilogue -28532 89/<- %esp 5/r32/ebp -28533 5d/pop-to-ebp -28534 c3/return -28535 -28536 # Primitives supported -28537 # See mu_instructions for a summary of this linked-list data structure. -28538 # -28539 # For each operation, put variants with hard-coded registers before flexible ones. -28540 # -28541 # Unfortunately, our restrictions on addresses require that various fields in -28542 # primitives be handles, which complicates these definitions. -28543 # - we need to insert dummy fields all over the place for fake alloc-ids -28544 # - we can't use our syntax sugar of quoted literals for string fields -28545 # -28546 # Fake alloc-ids are needed because our type definitions up top require -28547 # handles but it's clearer to statically allocate these long-lived objects. -28548 # Fake alloc-ids are perfectly safe, but they can't be reclaimed. -28549 # -28550 # Every 'object' below starts with a fake alloc-id. It may also contain other -28551 # fake alloc-ids for various handle fields. -28552 # -28553 # I think of objects starting with a fake alloc-id as having type 'payload'. -28554 # It's not really intended to be created dynamically; for that use `allocate` -28555 # as usual. -28556 # -28557 # Idea for a notation to simplify such definitions: -28558 # _Primitive-increment-eax: # (payload primitive) -28559 # 0x11/alloc-id:fake:payload -28560 # 0x11 @(0x11 "increment") # name -28561 # 0 0 # inouts -28562 # 0x11 @(0x11/payload -28563 # 0x11 @(0x11/payload # List-value -28564 # 0 0 # Var-name -28565 # 0x11 @(0x11 # Var-type -28566 # 1/is-atom -28567 # 1/value 0/unused # Type-tree-left -28568 # 0 0 # Type-tree-right -28569 # ) -28570 # 1 # block-depth -28571 # 0 # stack-offset -28572 # 0x11 @(0x11 "eax") # Var-register -28573 # ) -28574 # 0 0) # List-next -28575 # ... -28576 # _Primitive-increment-ecx/imm32/next -28577 # ... -28578 # Awfully complex and non-obvious. But also clearly signals there's something -28579 # to learn here, so may be worth trying. -28580 # -28581 # '@' is just an initial thought. Punctuation used so far in Mu: () * % # / " -28582 # -28583 # For now we'll continue to just use comments and manually ensure they stay up -28584 # to date. -28585 == data -28586 Primitives: # (addr primitive) -28587 # - increment/decrement -28588 _Primitive-increment-eax: # (addr primitive) -28589 # var/eax <- increment => 40/increment-eax -28590 0x11/imm32/alloc-id:fake -28591 _string-increment/imm32/name -28592 0/imm32/no-inouts -28593 0/imm32/no-inouts -28594 0x11/imm32/alloc-id:fake -28595 Single-int-var-in-eax/imm32/outputs -28596 0x11/imm32/alloc-id:fake -28597 _string_40_increment_eax/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-increment-ecx/imm32/next -28607 _Primitive-increment-ecx: # (payload primitive) -28608 0x11/imm32/alloc-id:fake:payload -28609 # var/ecx <- increment => 41/increment-ecx -28610 0x11/imm32/alloc-id:fake -28611 _string-increment/imm32/name -28612 0/imm32/no-inouts -28613 0/imm32/no-inouts -28614 0x11/imm32/alloc-id:fake -28615 Single-int-var-in-ecx/imm32/outputs -28616 0x11/imm32/alloc-id:fake -28617 _string_41_increment_ecx/imm32/subx-name -28618 0/imm32/no-rm32 -28619 0/imm32/no-r32 -28620 0/imm32/no-imm32 -28621 0/imm32/no-imm8 -28622 0/imm32/no-disp32 -28623 0/imm32/no-xm32 -28624 0/imm32/no-x32 -28625 0x11/imm32/alloc-id:fake -28626 _Primitive-increment-edx/imm32/next -28627 _Primitive-increment-edx: # (payload primitive) -28628 0x11/imm32/alloc-id:fake:payload -28629 # var/edx <- increment => 42/increment-edx -28630 0x11/imm32/alloc-id:fake -28631 _string-increment/imm32/name -28632 0/imm32/no-inouts -28633 0/imm32/no-inouts -28634 0x11/imm32/alloc-id:fake -28635 Single-int-var-in-edx/imm32/outputs -28636 0x11/imm32/alloc-id:fake -28637 _string_42_increment_edx/imm32/subx-name -28638 0/imm32/no-rm32 -28639 0/imm32/no-r32 -28640 0/imm32/no-imm32 -28641 0/imm32/no-imm8 -28642 0/imm32/no-disp32 -28643 0/imm32/no-xm32 -28644 0/imm32/no-x32 -28645 0x11/imm32/alloc-id:fake -28646 _Primitive-increment-ebx/imm32/next -28647 _Primitive-increment-ebx: # (payload primitive) -28648 0x11/imm32/alloc-id:fake:payload -28649 # var/ebx <- increment => 43/increment-ebx -28650 0x11/imm32/alloc-id:fake -28651 _string-increment/imm32/name -28652 0/imm32/no-inouts -28653 0/imm32/no-inouts -28654 0x11/imm32/alloc-id:fake -28655 Single-int-var-in-ebx/imm32/outputs -28656 0x11/imm32/alloc-id:fake -28657 _string_43_increment_ebx/imm32/subx-name -28658 0/imm32/no-rm32 -28659 0/imm32/no-r32 -28660 0/imm32/no-imm32 -28661 0/imm32/no-imm8 -28662 0/imm32/no-disp32 -28663 0/imm32/no-xm32 -28664 0/imm32/no-x32 -28665 0x11/imm32/alloc-id:fake -28666 _Primitive-increment-esi/imm32/next -28667 _Primitive-increment-esi: # (payload primitive) -28668 0x11/imm32/alloc-id:fake:payload -28669 # var/esi <- increment => 46/increment-esi -28670 0x11/imm32/alloc-id:fake -28671 _string-increment/imm32/name -28672 0/imm32/no-inouts -28673 0/imm32/no-inouts -28674 0x11/imm32/alloc-id:fake -28675 Single-int-var-in-esi/imm32/outputs -28676 0x11/imm32/alloc-id:fake -28677 _string_46_increment_esi/imm32/subx-name -28678 0/imm32/no-rm32 -28679 0/imm32/no-r32 -28680 0/imm32/no-imm32 -28681 0/imm32/no-imm8 -28682 0/imm32/no-disp32 -28683 0/imm32/no-xm32 -28684 0/imm32/no-x32 -28685 0x11/imm32/alloc-id:fake -28686 _Primitive-increment-edi/imm32/next -28687 _Primitive-increment-edi: # (payload primitive) -28688 0x11/imm32/alloc-id:fake:payload -28689 # var/edi <- increment => 47/increment-edi -28690 0x11/imm32/alloc-id:fake -28691 _string-increment/imm32/name -28692 0/imm32/no-inouts -28693 0/imm32/no-inouts -28694 0x11/imm32/alloc-id:fake -28695 Single-int-var-in-edi/imm32/outputs -28696 0x11/imm32/alloc-id:fake -28697 _string_47_increment_edi/imm32/subx-name -28698 0/imm32/no-rm32 -28699 0/imm32/no-r32 -28700 0/imm32/no-imm32 -28701 0/imm32/no-imm8 -28702 0/imm32/no-disp32 -28703 0/imm32/no-xm32 -28704 0/imm32/no-x32 -28705 0x11/imm32/alloc-id:fake -28706 _Primitive-decrement-eax/imm32/next -28707 _Primitive-decrement-eax: # (payload primitive) -28708 0x11/imm32/alloc-id:fake:payload -28709 # var/eax <- decrement => 48/decrement-eax -28710 0x11/imm32/alloc-id:fake -28711 _string-decrement/imm32/name -28712 0/imm32/no-inouts -28713 0/imm32/no-inouts -28714 0x11/imm32/alloc-id:fake -28715 Single-int-var-in-eax/imm32/outputs -28716 0x11/imm32/alloc-id:fake -28717 _string_48_decrement_eax/imm32/subx-name -28718 0/imm32/no-rm32 -28719 0/imm32/no-r32 -28720 0/imm32/no-imm32 -28721 0/imm32/no-imm8 -28722 0/imm32/no-disp32 -28723 0/imm32/no-xm32 -28724 0/imm32/no-x32 -28725 0x11/imm32/alloc-id:fake -28726 _Primitive-decrement-ecx/imm32/next -28727 _Primitive-decrement-ecx: # (payload primitive) -28728 0x11/imm32/alloc-id:fake:payload -28729 # var/ecx <- decrement => 49/decrement-ecx -28730 0x11/imm32/alloc-id:fake -28731 _string-decrement/imm32/name -28732 0/imm32/no-inouts -28733 0/imm32/no-inouts -28734 0x11/imm32/alloc-id:fake -28735 Single-int-var-in-ecx/imm32/outputs -28736 0x11/imm32/alloc-id:fake -28737 _string_49_decrement_ecx/imm32/subx-name -28738 0/imm32/no-rm32 -28739 0/imm32/no-r32 -28740 0/imm32/no-imm32 -28741 0/imm32/no-imm8 -28742 0/imm32/no-disp32 -28743 0/imm32/no-xm32 -28744 0/imm32/no-x32 -28745 0x11/imm32/alloc-id:fake -28746 _Primitive-decrement-edx/imm32/next -28747 _Primitive-decrement-edx: # (payload primitive) -28748 0x11/imm32/alloc-id:fake:payload -28749 # var/edx <- decrement => 4a/decrement-edx -28750 0x11/imm32/alloc-id:fake -28751 _string-decrement/imm32/name -28752 0/imm32/no-inouts -28753 0/imm32/no-inouts -28754 0x11/imm32/alloc-id:fake -28755 Single-int-var-in-edx/imm32/outputs -28756 0x11/imm32/alloc-id:fake -28757 _string_4a_decrement_edx/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 0/imm32/no-xm32 -28764 0/imm32/no-x32 -28765 0x11/imm32/alloc-id:fake -28766 _Primitive-decrement-ebx/imm32/next -28767 _Primitive-decrement-ebx: # (payload primitive) -28768 0x11/imm32/alloc-id:fake:payload -28769 # var/ebx <- decrement => 4b/decrement-ebx -28770 0x11/imm32/alloc-id:fake -28771 _string-decrement/imm32/name -28772 0/imm32/no-inouts -28773 0/imm32/no-inouts -28774 0x11/imm32/alloc-id:fake -28775 Single-int-var-in-ebx/imm32/outputs -28776 0x11/imm32/alloc-id:fake -28777 _string_4b_decrement_ebx/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 0/imm32/no-xm32 -28784 0/imm32/no-x32 -28785 0x11/imm32/alloc-id:fake -28786 _Primitive-decrement-esi/imm32/next -28787 _Primitive-decrement-esi: # (payload primitive) -28788 0x11/imm32/alloc-id:fake:payload -28789 # var/esi <- decrement => 4e/decrement-esi -28790 0x11/imm32/alloc-id:fake -28791 _string-decrement/imm32/name -28792 0/imm32/no-inouts -28793 0/imm32/no-inouts -28794 0x11/imm32/alloc-id:fake -28795 Single-int-var-in-esi/imm32/outputs -28796 0x11/imm32/alloc-id:fake -28797 _string_4e_decrement_esi/imm32/subx-name -28798 0/imm32/no-rm32 -28799 0/imm32/no-r32 -28800 0/imm32/no-imm32 -28801 0/imm32/no-imm8 -28802 0/imm32/no-disp32 -28803 0/imm32/no-xm32 -28804 0/imm32/no-x32 -28805 0x11/imm32/alloc-id:fake -28806 _Primitive-decrement-edi/imm32/next -28807 _Primitive-decrement-edi: # (payload primitive) -28808 0x11/imm32/alloc-id:fake:payload -28809 # var/edi <- decrement => 4f/decrement-edi -28810 0x11/imm32/alloc-id:fake -28811 _string-decrement/imm32/name -28812 0/imm32/no-inouts -28813 0/imm32/no-inouts -28814 0x11/imm32/alloc-id:fake -28815 Single-int-var-in-edi/imm32/outputs -28816 0x11/imm32/alloc-id:fake -28817 _string_4f_decrement_edi/imm32/subx-name -28818 0/imm32/no-rm32 -28819 0/imm32/no-r32 -28820 0/imm32/no-imm32 -28821 0/imm32/no-imm8 -28822 0/imm32/no-disp32 -28823 0/imm32/no-xm32 -28824 0/imm32/no-x32 -28825 0x11/imm32/alloc-id:fake -28826 _Primitive-increment-mem/imm32/next -28827 _Primitive-increment-mem: # (payload primitive) -28828 0x11/imm32/alloc-id:fake:payload -28829 # increment var => ff 0/subop/increment *(ebp+__) -28830 0x11/imm32/alloc-id:fake -28831 _string-increment/imm32/name -28832 0x11/imm32/alloc-id:fake -28833 Single-int-var-in-mem/imm32/inouts -28834 0/imm32/no-outputs -28835 0/imm32/no-outputs -28836 0x11/imm32/alloc-id:fake -28837 _string_ff_subop_increment/imm32/subx-name -28838 1/imm32/rm32-is-first-inout -28839 0/imm32/no-r32 -28840 0/imm32/no-imm32 -28841 0/imm32/no-imm8 -28842 0/imm32/no-disp32 -28843 0/imm32/no-xm32 -28844 0/imm32/no-x32 -28845 0x11/imm32/alloc-id:fake -28846 _Primitive-increment-reg/imm32/next -28847 _Primitive-increment-reg: # (payload primitive) -28848 0x11/imm32/alloc-id:fake:payload -28849 # var/reg <- increment => ff 0/subop/increment %__ -28850 0x11/imm32/alloc-id:fake -28851 _string-increment/imm32/name -28852 0/imm32/no-inouts -28853 0/imm32/no-inouts -28854 0x11/imm32/alloc-id:fake -28855 Single-int-var-in-some-register/imm32/outputs -28856 0x11/imm32/alloc-id:fake -28857 _string_ff_subop_increment/imm32/subx-name -28858 3/imm32/rm32-is-first-output -28859 0/imm32/no-r32 -28860 0/imm32/no-imm32 -28861 0/imm32/no-imm8 -28862 0/imm32/no-disp32 -28863 0/imm32/no-xm32 -28864 0/imm32/no-x32 -28865 0x11/imm32/alloc-id:fake -28866 _Primitive-decrement-mem/imm32/next -28867 _Primitive-decrement-mem: # (payload primitive) -28868 0x11/imm32/alloc-id:fake:payload -28869 # decrement var => ff 1/subop/decrement *(ebp+__) -28870 0x11/imm32/alloc-id:fake -28871 _string-decrement/imm32/name -28872 0x11/imm32/alloc-id:fake -28873 Single-int-var-in-mem/imm32/inouts -28874 0/imm32/no-outputs -28875 0/imm32/no-outputs -28876 0x11/imm32/alloc-id:fake -28877 _string_ff_subop_decrement/imm32/subx-name -28878 1/imm32/rm32-is-first-inout -28879 0/imm32/no-r32 -28880 0/imm32/no-imm32 -28881 0/imm32/no-imm8 -28882 0/imm32/no-disp32 -28883 0/imm32/no-xm32 -28884 0/imm32/no-x32 -28885 0x11/imm32/alloc-id:fake -28886 _Primitive-decrement-reg/imm32/next -28887 _Primitive-decrement-reg: # (payload primitive) -28888 0x11/imm32/alloc-id:fake:payload -28889 # var/reg <- decrement => ff 1/subop/decrement %__ -28890 0x11/imm32/alloc-id:fake -28891 _string-decrement/imm32/name -28892 0/imm32/no-inouts -28893 0/imm32/no-inouts -28894 0x11/imm32/alloc-id:fake -28895 Single-int-var-in-some-register/imm32/outputs -28896 0x11/imm32/alloc-id:fake -28897 _string_ff_subop_decrement/imm32/subx-name -28898 3/imm32/rm32-is-first-output -28899 0/imm32/no-r32 -28900 0/imm32/no-imm32 -28901 0/imm32/no-imm8 -28902 0/imm32/no-disp32 -28903 0/imm32/no-xm32 -28904 0/imm32/no-x32 -28905 0x11/imm32/alloc-id:fake -28906 _Primitive-add-to-eax/imm32/next -28907 # - add -28908 _Primitive-add-to-eax: # (payload primitive) -28909 0x11/imm32/alloc-id:fake:payload -28910 # var/eax <- add lit => 05/add-to-eax lit/imm32 -28911 0x11/imm32/alloc-id:fake -28912 _string-add/imm32/name -28913 0x11/imm32/alloc-id:fake -28914 Single-lit-var/imm32/inouts -28915 0x11/imm32/alloc-id:fake -28916 Single-int-var-in-eax/imm32/outputs -28917 0x11/imm32/alloc-id:fake -28918 _string_05_add_to_eax/imm32/subx-name -28919 0/imm32/no-rm32 -28920 0/imm32/no-r32 -28921 1/imm32/imm32-is-first-inout -28922 0/imm32/no-imm8 -28923 0/imm32/no-disp32 -28924 0/imm32/no-xm32 -28925 0/imm32/no-x32 -28926 0x11/imm32/alloc-id:fake -28927 _Primitive-add-reg-to-reg/imm32/next -28928 _Primitive-add-reg-to-reg: # (payload primitive) -28929 0x11/imm32/alloc-id:fake:payload -28930 # var1/reg <- add var2/reg => 01/add-to var1/rm32 var2/r32 -28931 0x11/imm32/alloc-id:fake -28932 _string-add/imm32/name -28933 0x11/imm32/alloc-id:fake -28934 Single-int-var-in-some-register/imm32/inouts -28935 0x11/imm32/alloc-id:fake -28936 Single-int-var-in-some-register/imm32/outputs -28937 0x11/imm32/alloc-id:fake -28938 _string_01_add_to/imm32/subx-name -28939 3/imm32/rm32-is-first-output -28940 1/imm32/r32-is-first-inout -28941 0/imm32/no-imm32 -28942 0/imm32/no-imm8 -28943 0/imm32/no-disp32 -28944 0/imm32/no-xm32 -28945 0/imm32/no-x32 -28946 0x11/imm32/alloc-id:fake -28947 _Primitive-add-reg-to-mem/imm32/next -28948 _Primitive-add-reg-to-mem: # (payload primitive) -28949 0x11/imm32/alloc-id:fake:payload -28950 # add-to var1 var2/reg => 01/add-to var1 var2/r32 -28951 0x11/imm32/alloc-id:fake -28952 _string-add-to/imm32/name -28953 0x11/imm32/alloc-id:fake -28954 Two-args-int-stack-int-reg/imm32/inouts -28955 0/imm32/no-outputs -28956 0/imm32/no-outputs -28957 0x11/imm32/alloc-id:fake -28958 _string_01_add_to/imm32/subx-name -28959 1/imm32/rm32-is-first-inout -28960 2/imm32/r32-is-second-inout -28961 0/imm32/no-imm32 -28962 0/imm32/no-imm8 -28963 0/imm32/no-disp32 -28964 0/imm32/no-xm32 -28965 0/imm32/no-x32 -28966 0x11/imm32/alloc-id:fake -28967 _Primitive-add-mem-to-reg/imm32/next -28968 _Primitive-add-mem-to-reg: # (payload primitive) -28969 0x11/imm32/alloc-id:fake:payload -28970 # var1/reg <- add var2 => 03/add var2/rm32 var1/r32 -28971 0x11/imm32/alloc-id:fake -28972 _string-add/imm32/name -28973 0x11/imm32/alloc-id:fake -28974 Single-int-var-in-mem/imm32/inouts -28975 0x11/imm32/alloc-id:fake -28976 Single-int-var-in-some-register/imm32/outputs -28977 0x11/imm32/alloc-id:fake -28978 _string_03_add/imm32/subx-name -28979 1/imm32/rm32-is-first-inout -28980 3/imm32/r32-is-first-output -28981 0/imm32/no-imm32 -28982 0/imm32/no-imm8 -28983 0/imm32/no-disp32 -28984 0/imm32/no-xm32 -28985 0/imm32/no-x32 -28986 0x11/imm32/alloc-id:fake -28987 _Primitive-add-lit-to-reg/imm32/next -28988 _Primitive-add-lit-to-reg: # (payload primitive) -28989 0x11/imm32/alloc-id:fake:payload -28990 # var1/reg <- add lit => 81 0/subop/add var1/rm32 lit/imm32 -28991 0x11/imm32/alloc-id:fake -28992 _string-add/imm32/name -28993 0x11/imm32/alloc-id:fake -28994 Single-lit-var/imm32/inouts -28995 0x11/imm32/alloc-id:fake -28996 Single-int-var-in-some-register/imm32/outputs -28997 0x11/imm32/alloc-id:fake -28998 _string_81_subop_add/imm32/subx-name -28999 3/imm32/rm32-is-first-output -29000 0/imm32/no-r32 -29001 1/imm32/imm32-is-first-inout -29002 0/imm32/no-imm8 -29003 0/imm32/no-disp32 -29004 0/imm32/no-xm32 -29005 0/imm32/no-x32 -29006 0x11/imm32/alloc-id:fake -29007 _Primitive-add-lit-to-mem/imm32/next -29008 _Primitive-add-lit-to-mem: # (payload primitive) -29009 0x11/imm32/alloc-id:fake:payload -29010 # add-to var1, lit => 81 0/subop/add var1/rm32 lit/imm32 -29011 0x11/imm32/alloc-id:fake -29012 _string-add-to/imm32/name -29013 0x11/imm32/alloc-id:fake -29014 Int-var-and-literal/imm32/inouts -29015 0/imm32/no-outputs -29016 0/imm32/no-outputs -29017 0x11/imm32/alloc-id:fake -29018 _string_81_subop_add/imm32/subx-name -29019 1/imm32/rm32-is-first-inout -29020 0/imm32/no-r32 -29021 2/imm32/imm32-is-second-inout -29022 0/imm32/no-imm8 -29023 0/imm32/no-disp32 -29024 0/imm32/no-xm32 -29025 0/imm32/no-x32 -29026 0x11/imm32/alloc-id:fake -29027 _Primitive-subtract-from-eax/imm32/next -29028 # - subtract -29029 _Primitive-subtract-from-eax: # (payload primitive) -29030 0x11/imm32/alloc-id:fake:payload -29031 # var/eax <- subtract lit => 2d/subtract-from-eax lit/imm32 -29032 0x11/imm32/alloc-id:fake -29033 _string-subtract/imm32/name -29034 0x11/imm32/alloc-id:fake -29035 Single-lit-var/imm32/inouts -29036 0x11/imm32/alloc-id:fake -29037 Single-int-var-in-eax/imm32/outputs -29038 0x11/imm32/alloc-id:fake -29039 _string_2d_subtract_from_eax/imm32/subx-name -29040 0/imm32/no-rm32 -29041 0/imm32/no-r32 -29042 1/imm32/imm32-is-first-inout -29043 0/imm32/no-imm8 -29044 0/imm32/no-disp32 -29045 0/imm32/no-xm32 -29046 0/imm32/no-x32 -29047 0x11/imm32/alloc-id:fake -29048 _Primitive-subtract-reg-from-reg/imm32/next -29049 _Primitive-subtract-reg-from-reg: # (payload primitive) -29050 0x11/imm32/alloc-id:fake:payload -29051 # var1/reg <- subtract var2/reg => 29/subtract-from var1/rm32 var2/r32 -29052 0x11/imm32/alloc-id:fake -29053 _string-subtract/imm32/name -29054 0x11/imm32/alloc-id:fake -29055 Single-int-var-in-some-register/imm32/inouts -29056 0x11/imm32/alloc-id:fake -29057 Single-int-var-in-some-register/imm32/outputs -29058 0x11/imm32/alloc-id:fake -29059 _string_29_subtract_from/imm32/subx-name -29060 3/imm32/rm32-is-first-output -29061 1/imm32/r32-is-first-inout -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-subtract-reg-from-mem/imm32/next -29069 _Primitive-subtract-reg-from-mem: # (payload primitive) -29070 0x11/imm32/alloc-id:fake:payload -29071 # subtract-from var1 var2/reg => 29/subtract-from var1 var2/r32 -29072 0x11/imm32/alloc-id:fake -29073 _string-subtract-from/imm32/name -29074 0x11/imm32/alloc-id:fake -29075 Two-args-int-stack-int-reg/imm32/inouts -29076 0/imm32/no-outputs -29077 0/imm32/no-outputs -29078 0x11/imm32/alloc-id:fake -29079 _string_29_subtract_from/imm32/subx-name -29080 1/imm32/rm32-is-first-inout -29081 2/imm32/r32-is-second-inout -29082 0/imm32/no-imm32 -29083 0/imm32/no-imm8 -29084 0/imm32/no-disp32 -29085 0/imm32/no-xm32 -29086 0/imm32/no-x32 -29087 0x11/imm32/alloc-id:fake -29088 _Primitive-subtract-mem-from-reg/imm32/next -29089 _Primitive-subtract-mem-from-reg: # (payload primitive) -29090 0x11/imm32/alloc-id:fake:payload -29091 # var1/reg <- subtract var2 => 2b/subtract var2/rm32 var1/r32 -29092 0x11/imm32/alloc-id:fake -29093 _string-subtract/imm32/name -29094 0x11/imm32/alloc-id:fake -29095 Single-int-var-in-mem/imm32/inouts -29096 0x11/imm32/alloc-id:fake -29097 Single-int-var-in-some-register/imm32/outputs -29098 0x11/imm32/alloc-id:fake -29099 _string_2b_subtract/imm32/subx-name -29100 1/imm32/rm32-is-first-inout -29101 3/imm32/r32-is-first-output -29102 0/imm32/no-imm32 -29103 0/imm32/no-imm8 -29104 0/imm32/no-disp32 -29105 0/imm32/no-xm32 -29106 0/imm32/no-x32 -29107 0x11/imm32/alloc-id:fake -29108 _Primitive-subtract-lit-from-reg/imm32/next -29109 _Primitive-subtract-lit-from-reg: # (payload primitive) -29110 0x11/imm32/alloc-id:fake:payload -29111 # var1/reg <- subtract lit => 81 5/subop/subtract var1/rm32 lit/imm32 -29112 0x11/imm32/alloc-id:fake -29113 _string-subtract/imm32/name -29114 0x11/imm32/alloc-id:fake -29115 Single-lit-var/imm32/inouts -29116 0x11/imm32/alloc-id:fake -29117 Single-int-var-in-some-register/imm32/outputs -29118 0x11/imm32/alloc-id:fake -29119 _string_81_subop_subtract/imm32/subx-name -29120 3/imm32/rm32-is-first-output -29121 0/imm32/no-r32 -29122 1/imm32/imm32-is-first-inout -29123 0/imm32/no-imm8 -29124 0/imm32/no-disp32 -29125 0/imm32/no-xm32 -29126 0/imm32/no-x32 -29127 0x11/imm32/alloc-id:fake -29128 _Primitive-subtract-lit-from-mem/imm32/next -29129 _Primitive-subtract-lit-from-mem: # (payload primitive) -29130 0x11/imm32/alloc-id:fake:payload -29131 # subtract-from var1, lit => 81 5/subop/subtract var1/rm32 lit/imm32 -29132 0x11/imm32/alloc-id:fake -29133 _string-subtract-from/imm32/name -29134 0x11/imm32/alloc-id:fake -29135 Int-var-and-literal/imm32/inouts -29136 0/imm32/no-outputs -29137 0/imm32/no-outputs -29138 0x11/imm32/alloc-id:fake -29139 _string_81_subop_subtract/imm32/subx-name -29140 1/imm32/rm32-is-first-inout -29141 0/imm32/no-r32 -29142 2/imm32/imm32-is-second-inout -29143 0/imm32/no-imm8 -29144 0/imm32/no-disp32 -29145 0/imm32/no-xm32 -29146 0/imm32/no-x32 -29147 0x11/imm32/alloc-id:fake -29148 _Primitive-and-with-eax/imm32/next -29149 # - and -29150 _Primitive-and-with-eax: # (payload primitive) -29151 0x11/imm32/alloc-id:fake:payload -29152 # var/eax <- and lit => 25/and-with-eax lit/imm32 -29153 0x11/imm32/alloc-id:fake -29154 _string-and/imm32/name -29155 0x11/imm32/alloc-id:fake -29156 Single-lit-var/imm32/inouts -29157 0x11/imm32/alloc-id:fake -29158 Single-int-var-in-eax/imm32/outputs -29159 0x11/imm32/alloc-id:fake -29160 _string_25_and_with_eax/imm32/subx-name -29161 0/imm32/no-rm32 -29162 0/imm32/no-r32 -29163 1/imm32/imm32-is-first-inout -29164 0/imm32/no-imm8 -29165 0/imm32/no-disp32 -29166 0/imm32/no-xm32 -29167 0/imm32/no-x32 -29168 0x11/imm32/alloc-id:fake -29169 _Primitive-and-reg-with-reg/imm32/next -29170 _Primitive-and-reg-with-reg: # (payload primitive) -29171 0x11/imm32/alloc-id:fake:payload -29172 # var1/reg <- and var2/reg => 21/and-with var1/rm32 var2/r32 -29173 0x11/imm32/alloc-id:fake -29174 _string-and/imm32/name -29175 0x11/imm32/alloc-id:fake -29176 Single-int-var-in-some-register/imm32/inouts -29177 0x11/imm32/alloc-id:fake -29178 Single-int-var-in-some-register/imm32/outputs -29179 0x11/imm32/alloc-id:fake -29180 _string_21_and_with/imm32/subx-name -29181 3/imm32/rm32-is-first-output -29182 1/imm32/r32-is-first-inout -29183 0/imm32/no-imm32 -29184 0/imm32/no-imm8 -29185 0/imm32/no-disp32 -29186 0/imm32/no-xm32 -29187 0/imm32/no-x32 -29188 0x11/imm32/alloc-id:fake -29189 _Primitive-and-reg-with-mem/imm32/next -29190 _Primitive-and-reg-with-mem: # (payload primitive) -29191 0x11/imm32/alloc-id:fake:payload -29192 # and-with var1 var2/reg => 21/and-with var1 var2/r32 -29193 0x11/imm32/alloc-id:fake -29194 _string-and-with/imm32/name -29195 0x11/imm32/alloc-id:fake -29196 Two-args-int-stack-int-reg/imm32/inouts -29197 0/imm32/no-outputs -29198 0/imm32/no-outputs -29199 0x11/imm32/alloc-id:fake -29200 _string_21_and_with/imm32/subx-name -29201 1/imm32/rm32-is-first-inout -29202 2/imm32/r32-is-second-inout -29203 0/imm32/no-imm32 -29204 0/imm32/no-imm8 -29205 0/imm32/no-disp32 -29206 0/imm32/no-xm32 -29207 0/imm32/no-x32 -29208 0x11/imm32/alloc-id:fake -29209 _Primitive-and-mem-with-reg/imm32/next -29210 _Primitive-and-mem-with-reg: # (payload primitive) -29211 0x11/imm32/alloc-id:fake:payload -29212 # var1/reg <- and var2 => 23/and var2/rm32 var1/r32 -29213 0x11/imm32/alloc-id:fake -29214 _string-and/imm32/name -29215 0x11/imm32/alloc-id:fake -29216 Single-int-var-in-mem/imm32/inouts -29217 0x11/imm32/alloc-id:fake -29218 Single-int-var-in-some-register/imm32/outputs -29219 0x11/imm32/alloc-id:fake -29220 _string_23_and/imm32/subx-name -29221 1/imm32/rm32-is-first-inout -29222 3/imm32/r32-is-first-output -29223 0/imm32/no-imm32 -29224 0/imm32/no-imm8 -29225 0/imm32/no-disp32 -29226 0/imm32/no-xm32 -29227 0/imm32/no-x32 -29228 0x11/imm32/alloc-id:fake -29229 _Primitive-and-lit-with-reg/imm32/next -29230 _Primitive-and-lit-with-reg: # (payload primitive) -29231 0x11/imm32/alloc-id:fake:payload -29232 # var1/reg <- and lit => 81 4/subop/and var1/rm32 lit/imm32 -29233 0x11/imm32/alloc-id:fake -29234 _string-and/imm32/name -29235 0x11/imm32/alloc-id:fake -29236 Single-lit-var/imm32/inouts -29237 0x11/imm32/alloc-id:fake -29238 Single-int-var-in-some-register/imm32/outputs -29239 0x11/imm32/alloc-id:fake -29240 _string_81_subop_and/imm32/subx-name -29241 3/imm32/rm32-is-first-output -29242 0/imm32/no-r32 -29243 1/imm32/imm32-is-first-inout -29244 0/imm32/no-imm8 -29245 0/imm32/no-disp32 -29246 0/imm32/no-xm32 -29247 0/imm32/no-x32 -29248 0x11/imm32/alloc-id:fake -29249 _Primitive-and-lit-with-mem/imm32/next -29250 _Primitive-and-lit-with-mem: # (payload primitive) -29251 0x11/imm32/alloc-id:fake:payload -29252 # and-with var1, lit => 81 4/subop/and var1/rm32 lit/imm32 -29253 0x11/imm32/alloc-id:fake -29254 _string-and-with/imm32/name -29255 0x11/imm32/alloc-id:fake -29256 Int-var-and-literal/imm32/inouts -29257 0/imm32/no-outputs -29258 0/imm32/no-outputs -29259 0x11/imm32/alloc-id:fake -29260 _string_81_subop_and/imm32/subx-name -29261 1/imm32/rm32-is-first-inout -29262 0/imm32/no-r32 -29263 2/imm32/imm32-is-second-inout -29264 0/imm32/no-imm8 -29265 0/imm32/no-disp32 -29266 0/imm32/no-xm32 -29267 0/imm32/no-x32 -29268 0x11/imm32/alloc-id:fake -29269 _Primitive-or-with-eax/imm32/next -29270 # - or -29271 _Primitive-or-with-eax: # (payload primitive) -29272 0x11/imm32/alloc-id:fake:payload -29273 # var/eax <- or lit => 0d/or-with-eax lit/imm32 -29274 0x11/imm32/alloc-id:fake -29275 _string-or/imm32/name -29276 0x11/imm32/alloc-id:fake -29277 Single-lit-var/imm32/inouts -29278 0x11/imm32/alloc-id:fake -29279 Single-int-var-in-eax/imm32/outputs -29280 0x11/imm32/alloc-id:fake -29281 _string_0d_or_with_eax/imm32/subx-name -29282 0/imm32/no-rm32 -29283 0/imm32/no-r32 -29284 1/imm32/imm32-is-first-inout -29285 0/imm32/no-imm8 -29286 0/imm32/no-disp32 -29287 0/imm32/no-xm32 -29288 0/imm32/no-x32 -29289 0x11/imm32/alloc-id:fake -29290 _Primitive-or-reg-with-reg/imm32/next -29291 _Primitive-or-reg-with-reg: # (payload primitive) -29292 0x11/imm32/alloc-id:fake:payload -29293 # var1/reg <- or var2/reg => 09/or-with var1/rm32 var2/r32 -29294 0x11/imm32/alloc-id:fake -29295 _string-or/imm32/name -29296 0x11/imm32/alloc-id:fake -29297 Single-int-var-in-some-register/imm32/inouts -29298 0x11/imm32/alloc-id:fake -29299 Single-int-var-in-some-register/imm32/outputs -29300 0x11/imm32/alloc-id:fake -29301 _string_09_or_with/imm32/subx-name -29302 3/imm32/rm32-is-first-output -29303 1/imm32/r32-is-first-inout -29304 0/imm32/no-imm32 -29305 0/imm32/no-imm8 -29306 0/imm32/no-disp32 -29307 0/imm32/no-xm32 -29308 0/imm32/no-x32 -29309 0x11/imm32/alloc-id:fake -29310 _Primitive-or-reg-with-mem/imm32/next -29311 _Primitive-or-reg-with-mem: # (payload primitive) -29312 0x11/imm32/alloc-id:fake:payload -29313 # or-with var1 var2/reg => 09/or-with var1 var2/r32 -29314 0x11/imm32/alloc-id:fake -29315 _string-or-with/imm32/name -29316 0x11/imm32/alloc-id:fake -29317 Two-args-int-stack-int-reg/imm32/inouts -29318 0/imm32/no-outputs -29319 0/imm32/no-outputs -29320 0x11/imm32/alloc-id:fake -29321 _string_09_or_with/imm32/subx-name -29322 1/imm32/rm32-is-first-inout -29323 2/imm32/r32-is-second-inout -29324 0/imm32/no-imm32 -29325 0/imm32/no-imm8 -29326 0/imm32/no-disp32 -29327 0/imm32/no-xm32 -29328 0/imm32/no-x32 -29329 0x11/imm32/alloc-id:fake -29330 _Primitive-or-mem-with-reg/imm32/next -29331 _Primitive-or-mem-with-reg: # (payload primitive) -29332 0x11/imm32/alloc-id:fake:payload -29333 # var1/reg <- or var2 => 0b/or var2/rm32 var1/r32 -29334 0x11/imm32/alloc-id:fake -29335 _string-or/imm32/name -29336 0x11/imm32/alloc-id:fake -29337 Single-int-var-in-mem/imm32/inouts -29338 0x11/imm32/alloc-id:fake -29339 Single-int-var-in-some-register/imm32/outputs -29340 0x11/imm32/alloc-id:fake -29341 _string_0b_or/imm32/subx-name -29342 1/imm32/rm32-is-first-inout -29343 3/imm32/r32-is-first-output -29344 0/imm32/no-imm32 -29345 0/imm32/no-imm8 -29346 0/imm32/no-disp32 -29347 0/imm32/no-xm32 -29348 0/imm32/no-x32 -29349 0x11/imm32/alloc-id:fake -29350 _Primitive-or-lit-with-reg/imm32/next -29351 _Primitive-or-lit-with-reg: # (payload primitive) -29352 0x11/imm32/alloc-id:fake:payload -29353 # var1/reg <- or lit => 81 1/subop/or var1/rm32 lit/imm32 -29354 0x11/imm32/alloc-id:fake -29355 _string-or/imm32/name -29356 0x11/imm32/alloc-id:fake -29357 Single-lit-var/imm32/inouts -29358 0x11/imm32/alloc-id:fake -29359 Single-int-var-in-some-register/imm32/outputs -29360 0x11/imm32/alloc-id:fake -29361 _string_81_subop_or/imm32/subx-name -29362 3/imm32/rm32-is-first-output -29363 0/imm32/no-r32 -29364 1/imm32/imm32-is-first-inout -29365 0/imm32/no-imm8 -29366 0/imm32/no-disp32 -29367 0/imm32/no-xm32 -29368 0/imm32/no-x32 -29369 0x11/imm32/alloc-id:fake -29370 _Primitive-or-lit-with-mem/imm32/next -29371 _Primitive-or-lit-with-mem: # (payload primitive) -29372 0x11/imm32/alloc-id:fake:payload -29373 # or-with var1, lit => 81 1/subop/or var1/rm32 lit/imm32 -29374 0x11/imm32/alloc-id:fake -29375 _string-or-with/imm32/name -29376 0x11/imm32/alloc-id:fake -29377 Int-var-and-literal/imm32/inouts -29378 0/imm32/no-outputs -29379 0/imm32/no-outputs -29380 0x11/imm32/alloc-id:fake -29381 _string_81_subop_or/imm32/subx-name -29382 1/imm32/rm32-is-first-inout -29383 0/imm32/no-r32 -29384 2/imm32/imm32-is-second-inout -29385 0/imm32/no-imm8 -29386 0/imm32/no-disp32 -29387 0/imm32/no-xm32 -29388 0/imm32/no-x32 -29389 0x11/imm32/alloc-id:fake -29390 _Primitive-xor-with-eax/imm32/next -29391 # - xor -29392 _Primitive-xor-with-eax: # (payload primitive) -29393 0x11/imm32/alloc-id:fake:payload -29394 # var/eax <- xor lit => 35/xor-with-eax lit/imm32 -29395 0x11/imm32/alloc-id:fake -29396 _string-xor/imm32/name -29397 0x11/imm32/alloc-id:fake -29398 Single-lit-var/imm32/inouts -29399 0x11/imm32/alloc-id:fake -29400 Single-int-var-in-eax/imm32/outputs -29401 0x11/imm32/alloc-id:fake -29402 _string_35_xor_with_eax/imm32/subx-name -29403 0/imm32/no-rm32 -29404 0/imm32/no-r32 -29405 1/imm32/imm32-is-first-inout -29406 0/imm32/no-imm8 -29407 0/imm32/no-disp32 -29408 0/imm32/no-xm32 -29409 0/imm32/no-x32 -29410 0x11/imm32/alloc-id:fake -29411 _Primitive-xor-reg-with-reg/imm32/next -29412 _Primitive-xor-reg-with-reg: # (payload primitive) -29413 0x11/imm32/alloc-id:fake:payload -29414 # var1/reg <- xor var2/reg => 31/xor-with var1/rm32 var2/r32 -29415 0x11/imm32/alloc-id:fake -29416 _string-xor/imm32/name -29417 0x11/imm32/alloc-id:fake -29418 Single-int-var-in-some-register/imm32/inouts -29419 0x11/imm32/alloc-id:fake -29420 Single-int-var-in-some-register/imm32/outputs -29421 0x11/imm32/alloc-id:fake -29422 _string_31_xor_with/imm32/subx-name -29423 3/imm32/rm32-is-first-output -29424 1/imm32/r32-is-first-inout -29425 0/imm32/no-imm32 -29426 0/imm32/no-imm8 -29427 0/imm32/no-disp32 -29428 0/imm32/no-xm32 -29429 0/imm32/no-x32 -29430 0x11/imm32/alloc-id:fake -29431 _Primitive-xor-reg-with-mem/imm32/next -29432 _Primitive-xor-reg-with-mem: # (payload primitive) -29433 0x11/imm32/alloc-id:fake:payload -29434 # xor-with var1 var2/reg => 31/xor-with var1 var2/r32 -29435 0x11/imm32/alloc-id:fake -29436 _string-xor-with/imm32/name -29437 0x11/imm32/alloc-id:fake -29438 Two-args-int-stack-int-reg/imm32/inouts -29439 0/imm32/no-outputs -29440 0/imm32/no-outputs -29441 0x11/imm32/alloc-id:fake -29442 _string_31_xor_with/imm32/subx-name -29443 1/imm32/rm32-is-first-inout -29444 2/imm32/r32-is-second-inout -29445 0/imm32/no-imm32 -29446 0/imm32/no-imm8 -29447 0/imm32/no-disp32 -29448 0/imm32/no-xm32 -29449 0/imm32/no-x32 -29450 0x11/imm32/alloc-id:fake -29451 _Primitive-xor-mem-with-reg/imm32/next -29452 _Primitive-xor-mem-with-reg: # (payload primitive) -29453 0x11/imm32/alloc-id:fake:payload -29454 # var1/reg <- xor var2 => 33/xor var2/rm32 var1/r32 -29455 0x11/imm32/alloc-id:fake -29456 _string-xor/imm32/name -29457 0x11/imm32/alloc-id:fake -29458 Single-int-var-in-mem/imm32/inouts -29459 0x11/imm32/alloc-id:fake -29460 Single-int-var-in-some-register/imm32/outputs -29461 0x11/imm32/alloc-id:fake -29462 _string_33_xor/imm32/subx-name -29463 1/imm32/rm32-is-first-inout -29464 3/imm32/r32-is-first-output -29465 0/imm32/no-imm32 -29466 0/imm32/no-imm8 -29467 0/imm32/no-disp32 -29468 0/imm32/no-xm32 -29469 0/imm32/no-x32 -29470 0x11/imm32/alloc-id:fake -29471 _Primitive-xor-lit-with-reg/imm32/next -29472 _Primitive-xor-lit-with-reg: # (payload primitive) -29473 0x11/imm32/alloc-id:fake:payload -29474 # var1/reg <- xor lit => 81 6/subop/xor var1/rm32 lit/imm32 -29475 0x11/imm32/alloc-id:fake -29476 _string-xor/imm32/name -29477 0x11/imm32/alloc-id:fake -29478 Single-lit-var/imm32/inouts -29479 0x11/imm32/alloc-id:fake -29480 Single-int-var-in-some-register/imm32/outputs -29481 0x11/imm32/alloc-id:fake -29482 _string_81_subop_xor/imm32/subx-name -29483 3/imm32/rm32-is-first-output -29484 0/imm32/no-r32 -29485 1/imm32/imm32-is-first-inout -29486 0/imm32/no-imm8 -29487 0/imm32/no-disp32 -29488 0/imm32/no-xm32 -29489 0/imm32/no-x32 -29490 0x11/imm32/alloc-id:fake -29491 _Primitive-xor-lit-with-mem/imm32/next -29492 _Primitive-xor-lit-with-mem: # (payload primitive) -29493 0x11/imm32/alloc-id:fake:payload -29494 # xor-with var1, lit => 81 6/subop/xor var1/rm32 lit/imm32 -29495 0x11/imm32/alloc-id:fake -29496 _string-xor-with/imm32/name -29497 0x11/imm32/alloc-id:fake -29498 Int-var-and-literal/imm32/inouts -29499 0/imm32/no-outputs -29500 0/imm32/no-outputs -29501 0x11/imm32/alloc-id:fake -29502 _string_81_subop_xor/imm32/subx-name -29503 1/imm32/rm32-is-first-inout -29504 0/imm32/no-r32 -29505 2/imm32/imm32-is-second-inout -29506 0/imm32/no-imm8 -29507 0/imm32/no-disp32 -29508 0/imm32/no-xm32 -29509 0/imm32/no-x32 -29510 0x11/imm32/alloc-id:fake -29511 _Primitive-shift-reg-left-by-lit/imm32/next -29512 _Primitive-shift-reg-left-by-lit: # (payload primitive) -29513 0x11/imm32/alloc-id:fake:payload -29514 # var1/reg <- shift-left lit => c1/shift 4/subop/left var1/rm32 lit/imm32 -29515 0x11/imm32/alloc-id:fake -29516 _string-shift-left/imm32/name -29517 0x11/imm32/alloc-id:fake -29518 Single-lit-var/imm32/inouts -29519 0x11/imm32/alloc-id:fake -29520 Single-int-var-in-some-register/imm32/outputs -29521 0x11/imm32/alloc-id:fake -29522 _string_c1_subop_shift_left/imm32/subx-name -29523 3/imm32/rm32-is-first-output -29524 0/imm32/no-r32 -29525 0/imm32/no-imm32 -29526 1/imm32/imm8-is-first-inout -29527 0/imm32/no-disp32 -29528 0/imm32/no-xm32 -29529 0/imm32/no-x32 -29530 0x11/imm32/alloc-id:fake -29531 _Primitive-shift-reg-right-by-lit/imm32/next -29532 _Primitive-shift-reg-right-by-lit: # (payload primitive) -29533 0x11/imm32/alloc-id:fake:payload -29534 # var1/reg <- shift-right lit => c1/shift 5/subop/right var1/rm32 lit/imm32 -29535 0x11/imm32/alloc-id:fake -29536 _string-shift-right/imm32/name -29537 0x11/imm32/alloc-id:fake -29538 Single-lit-var/imm32/inouts -29539 0x11/imm32/alloc-id:fake -29540 Single-int-var-in-some-register/imm32/outputs -29541 0x11/imm32/alloc-id:fake -29542 _string_c1_subop_shift_right_padding_zeroes/imm32/subx-name -29543 3/imm32/rm32-is-first-output -29544 0/imm32/no-r32 -29545 0/imm32/no-imm32 -29546 1/imm32/imm8-is-first-inout -29547 0/imm32/no-disp32 -29548 0/imm32/no-xm32 -29549 0/imm32/no-x32 -29550 0x11/imm32/alloc-id:fake -29551 _Primitive-shift-reg-right-signed-by-lit/imm32/next -29552 _Primitive-shift-reg-right-signed-by-lit: # (payload primitive) -29553 0x11/imm32/alloc-id:fake:payload -29554 # var1/reg <- shift-right-signed lit => c1/shift 7/subop/right-preserving-sign var1/rm32 lit/imm32 -29555 0x11/imm32/alloc-id:fake -29556 _string-shift-right-signed/imm32/name -29557 0x11/imm32/alloc-id:fake -29558 Single-lit-var/imm32/inouts -29559 0x11/imm32/alloc-id:fake -29560 Single-int-var-in-some-register/imm32/outputs -29561 0x11/imm32/alloc-id:fake -29562 _string_c1_subop_shift_right_preserving_sign/imm32/subx-name -29563 3/imm32/rm32-is-first-output -29564 0/imm32/no-r32 -29565 0/imm32/no-imm32 -29566 1/imm32/imm8-is-first-inout -29567 0/imm32/no-disp32 -29568 0/imm32/no-xm32 -29569 0/imm32/no-x32 -29570 0x11/imm32/alloc-id:fake -29571 _Primitive-shift-mem-left-by-lit/imm32/next -29572 _Primitive-shift-mem-left-by-lit: # (payload primitive) -29573 0x11/imm32/alloc-id:fake:payload -29574 # shift-left var1, lit => c1/shift 4/subop/left var1/rm32 lit/imm32 -29575 0x11/imm32/alloc-id:fake -29576 _string-shift-left/imm32/name -29577 0x11/imm32/alloc-id:fake -29578 Int-var-and-literal/imm32/inouts -29579 0/imm32/no-outputs -29580 0/imm32/no-outputs -29581 0x11/imm32/alloc-id:fake -29582 _string_c1_subop_shift_left/imm32/subx-name -29583 1/imm32/rm32-is-first-inout -29584 0/imm32/no-r32 -29585 0/imm32/no-imm32 -29586 2/imm32/imm8-is-second-inout -29587 0/imm32/no-disp32 -29588 0/imm32/no-xm32 -29589 0/imm32/no-x32 -29590 0x11/imm32/alloc-id:fake -29591 _Primitive-shift-mem-right-by-lit/imm32/next -29592 _Primitive-shift-mem-right-by-lit: # (payload primitive) -29593 0x11/imm32/alloc-id:fake:payload -29594 # shift-right var1, lit => c1/shift 5/subop/right var1/rm32 lit/imm32 -29595 0x11/imm32/alloc-id:fake -29596 _string-shift-right/imm32/name -29597 0x11/imm32/alloc-id:fake -29598 Int-var-and-literal/imm32/inouts -29599 0/imm32/no-outputs -29600 0/imm32/no-outputs -29601 0x11/imm32/alloc-id:fake -29602 _string_c1_subop_shift_right_padding_zeroes/imm32/subx-name -29603 1/imm32/rm32-is-first-inout -29604 0/imm32/no-r32 -29605 0/imm32/no-imm32 -29606 2/imm32/imm8-is-second-inout -29607 0/imm32/no-disp32 -29608 0/imm32/no-xm32 -29609 0/imm32/no-x32 -29610 0x11/imm32/alloc-id:fake -29611 _Primitive-shift-mem-right-signed-by-lit/imm32/next -29612 _Primitive-shift-mem-right-signed-by-lit: # (payload primitive) -29613 0x11/imm32/alloc-id:fake:payload -29614 # shift-right-signed var1, lit => c1/shift 7/subop/right-preserving-sign var1/rm32 lit/imm32 -29615 0x11/imm32/alloc-id:fake -29616 _string-shift-right-signed/imm32/name -29617 0x11/imm32/alloc-id:fake -29618 Int-var-and-literal/imm32/inouts -29619 0/imm32/no-outputs -29620 0/imm32/no-outputs -29621 0x11/imm32/alloc-id:fake -29622 _string_c1_subop_shift_right_preserving_sign/imm32/subx-name -29623 1/imm32/rm32-is-first-inout -29624 0/imm32/no-r32 -29625 0/imm32/no-imm32 -29626 2/imm32/imm8-is-second-inout -29627 0/imm32/no-disp32 -29628 0/imm32/no-xm32 -29629 0/imm32/no-x32 -29630 0x11/imm32/alloc-id:fake -29631 _Primitive-copy-to-eax/imm32/next -29632 # - copy -29633 _Primitive-copy-to-eax: # (payload primitive) -29634 0x11/imm32/alloc-id:fake:payload -29635 # var/eax <- copy lit => b8/copy-to-eax lit/imm32 -29636 0x11/imm32/alloc-id:fake -29637 _string-copy/imm32/name -29638 0x11/imm32/alloc-id:fake -29639 Single-lit-var/imm32/inouts -29640 0x11/imm32/alloc-id:fake -29641 Single-int-var-in-eax/imm32/outputs -29642 0x11/imm32/alloc-id:fake -29643 _string_b8_copy_to_eax/imm32/subx-name -29644 0/imm32/no-rm32 -29645 0/imm32/no-r32 -29646 1/imm32/imm32-is-first-inout -29647 0/imm32/no-imm8 -29648 0/imm32/no-disp32 -29649 0/imm32/no-xm32 -29650 0/imm32/no-x32 -29651 0x11/imm32/alloc-id:fake -29652 _Primitive-copy-to-ecx/imm32/next -29653 _Primitive-copy-to-ecx: # (payload primitive) -29654 0x11/imm32/alloc-id:fake:payload -29655 # var/ecx <- copy lit => b9/copy-to-ecx lit/imm32 -29656 0x11/imm32/alloc-id:fake -29657 _string-copy/imm32/name -29658 0x11/imm32/alloc-id:fake -29659 Single-lit-var/imm32/inouts -29660 0x11/imm32/alloc-id:fake -29661 Single-int-var-in-ecx/imm32/outputs -29662 0x11/imm32/alloc-id:fake -29663 _string_b9_copy_to_ecx/imm32/subx-name -29664 0/imm32/no-rm32 -29665 0/imm32/no-r32 -29666 1/imm32/imm32-is-first-inout -29667 0/imm32/no-imm8 -29668 0/imm32/no-disp32 -29669 0/imm32/no-xm32 -29670 0/imm32/no-x32 -29671 0x11/imm32/alloc-id:fake -29672 _Primitive-copy-to-edx/imm32/next -29673 _Primitive-copy-to-edx: # (payload primitive) -29674 0x11/imm32/alloc-id:fake:payload -29675 # var/edx <- copy lit => ba/copy-to-edx lit/imm32 -29676 0x11/imm32/alloc-id:fake -29677 _string-copy/imm32/name -29678 0x11/imm32/alloc-id:fake -29679 Single-lit-var/imm32/inouts -29680 0x11/imm32/alloc-id:fake -29681 Single-int-var-in-edx/imm32/outputs -29682 0x11/imm32/alloc-id:fake -29683 _string_ba_copy_to_edx/imm32/subx-name -29684 0/imm32/no-rm32 -29685 0/imm32/no-r32 -29686 1/imm32/imm32-is-first-inout -29687 0/imm32/no-imm8 -29688 0/imm32/no-disp32 -29689 0/imm32/no-xm32 -29690 0/imm32/no-x32 -29691 0x11/imm32/alloc-id:fake -29692 _Primitive-copy-to-ebx/imm32/next -29693 _Primitive-copy-to-ebx: # (payload primitive) -29694 0x11/imm32/alloc-id:fake:payload -29695 # var/ebx <- copy lit => bb/copy-to-ebx lit/imm32 -29696 0x11/imm32/alloc-id:fake -29697 _string-copy/imm32/name -29698 0x11/imm32/alloc-id:fake -29699 Single-lit-var/imm32/inouts -29700 0x11/imm32/alloc-id:fake -29701 Single-int-var-in-ebx/imm32/outputs -29702 0x11/imm32/alloc-id:fake -29703 _string_bb_copy_to_ebx/imm32/subx-name -29704 0/imm32/no-rm32 -29705 0/imm32/no-r32 -29706 1/imm32/imm32-is-first-inout -29707 0/imm32/no-imm8 -29708 0/imm32/no-disp32 -29709 0/imm32/no-xm32 -29710 0/imm32/no-x32 -29711 0x11/imm32/alloc-id:fake -29712 _Primitive-copy-to-esi/imm32/next -29713 _Primitive-copy-to-esi: # (payload primitive) -29714 0x11/imm32/alloc-id:fake:payload -29715 # var/esi <- copy lit => be/copy-to-esi lit/imm32 -29716 0x11/imm32/alloc-id:fake -29717 _string-copy/imm32/name -29718 0x11/imm32/alloc-id:fake -29719 Single-lit-var/imm32/inouts -29720 0x11/imm32/alloc-id:fake -29721 Single-int-var-in-esi/imm32/outputs -29722 0x11/imm32/alloc-id:fake -29723 _string_be_copy_to_esi/imm32/subx-name -29724 0/imm32/no-rm32 -29725 0/imm32/no-r32 -29726 1/imm32/imm32-is-first-inout -29727 0/imm32/no-imm8 -29728 0/imm32/no-disp32 -29729 0/imm32/no-xm32 -29730 0/imm32/no-x32 -29731 0x11/imm32/alloc-id:fake -29732 _Primitive-copy-to-edi/imm32/next -29733 _Primitive-copy-to-edi: # (payload primitive) -29734 0x11/imm32/alloc-id:fake:payload -29735 # var/edi <- copy lit => bf/copy-to-edi lit/imm32 -29736 0x11/imm32/alloc-id:fake -29737 _string-copy/imm32/name -29738 0x11/imm32/alloc-id:fake -29739 Single-lit-var/imm32/inouts -29740 0x11/imm32/alloc-id:fake -29741 Single-int-var-in-edi/imm32/outputs -29742 0x11/imm32/alloc-id:fake -29743 _string_bf_copy_to_edi/imm32/subx-name -29744 0/imm32/no-rm32 -29745 0/imm32/no-r32 -29746 1/imm32/imm32-is-first-inout -29747 0/imm32/no-imm8 -29748 0/imm32/no-disp32 -29749 0/imm32/no-xm32 -29750 0/imm32/no-x32 -29751 0x11/imm32/alloc-id:fake -29752 _Primitive-copy-reg-to-reg/imm32/next -29753 _Primitive-copy-reg-to-reg: # (payload primitive) -29754 0x11/imm32/alloc-id:fake:payload -29755 # var1/reg <- copy var2/reg => 89/<- var1/rm32 var2/r32 -29756 0x11/imm32/alloc-id:fake -29757 _string-copy/imm32/name -29758 0x11/imm32/alloc-id:fake -29759 Single-int-var-in-some-register/imm32/inouts -29760 0x11/imm32/alloc-id:fake -29761 Single-int-var-in-some-register/imm32/outputs -29762 0x11/imm32/alloc-id:fake -29763 _string_89_<-/imm32/subx-name -29764 3/imm32/rm32-is-first-output -29765 1/imm32/r32-is-first-inout -29766 0/imm32/no-imm32 -29767 0/imm32/no-imm8 -29768 0/imm32/no-disp32 -29769 0/imm32/no-xm32 -29770 0/imm32/no-x32 -29771 0x11/imm32/alloc-id:fake -29772 _Primitive-copy-reg-to-mem/imm32/next -29773 _Primitive-copy-reg-to-mem: # (payload primitive) -29774 0x11/imm32/alloc-id:fake:payload -29775 # copy-to var1 var2/reg => 89/<- var1 var2/r32 -29776 0x11/imm32/alloc-id:fake -29777 _string-copy-to/imm32/name -29778 0x11/imm32/alloc-id:fake -29779 Two-args-int-stack-int-reg/imm32/inouts -29780 0/imm32/no-outputs -29781 0/imm32/no-outputs -29782 0x11/imm32/alloc-id:fake -29783 _string_89_<-/imm32/subx-name -29784 1/imm32/rm32-is-first-inout -29785 2/imm32/r32-is-second-inout -29786 0/imm32/no-imm32 -29787 0/imm32/no-imm8 -29788 0/imm32/no-disp32 -29789 0/imm32/no-xm32 -29790 0/imm32/no-x32 -29791 0x11/imm32/alloc-id:fake -29792 _Primitive-copy-mem-to-reg/imm32/next -29793 _Primitive-copy-mem-to-reg: # (payload primitive) -29794 0x11/imm32/alloc-id:fake:payload -29795 # var1/reg <- copy var2 => 8b/-> var2/rm32 var1/r32 -29796 0x11/imm32/alloc-id:fake -29797 _string-copy/imm32/name -29798 0x11/imm32/alloc-id:fake -29799 Single-int-var-in-mem/imm32/inouts -29800 0x11/imm32/alloc-id:fake -29801 Single-int-var-in-some-register/imm32/outputs -29802 0x11/imm32/alloc-id:fake -29803 _string_8b_->/imm32/subx-name -29804 1/imm32/rm32-is-first-inout -29805 3/imm32/r32-is-first-output -29806 0/imm32/no-imm32 -29807 0/imm32/no-imm8 -29808 0/imm32/no-disp32 -29809 0/imm32/no-xm32 -29810 0/imm32/no-x32 -29811 0x11/imm32/alloc-id:fake -29812 _Primitive-copy-lit-to-reg/imm32/next -29813 _Primitive-copy-lit-to-reg: # (payload primitive) -29814 0x11/imm32/alloc-id:fake:payload -29815 # var1/reg <- copy lit => c7 0/subop/copy var1/rm32 lit/imm32 -29816 0x11/imm32/alloc-id:fake -29817 _string-copy/imm32/name -29818 0x11/imm32/alloc-id:fake -29819 Single-lit-var/imm32/inouts -29820 0x11/imm32/alloc-id:fake -29821 Single-int-var-in-some-register/imm32/outputs -29822 0x11/imm32/alloc-id:fake -29823 _string_c7_subop_copy/imm32/subx-name -29824 3/imm32/rm32-is-first-output -29825 0/imm32/no-r32 -29826 1/imm32/imm32-is-first-inout -29827 0/imm32/no-imm8 -29828 0/imm32/no-disp32 -29829 0/imm32/no-xm32 -29830 0/imm32/no-x32 -29831 0x11/imm32/alloc-id:fake -29832 _Primitive-copy-lit-to-mem/imm32/next -29833 _Primitive-copy-lit-to-mem: # (payload primitive) -29834 0x11/imm32/alloc-id:fake:payload -29835 # copy-to var1, lit => c7 0/subop/copy var1/rm32 lit/imm32 -29836 0x11/imm32/alloc-id:fake -29837 _string-copy-to/imm32/name -29838 0x11/imm32/alloc-id:fake -29839 Int-var-and-literal/imm32/inouts -29840 0/imm32/no-outputs -29841 0/imm32/no-outputs -29842 0x11/imm32/alloc-id:fake -29843 _string_c7_subop_copy/imm32/subx-name -29844 1/imm32/rm32-is-first-inout -29845 0/imm32/no-r32 -29846 2/imm32/imm32-is-second-inout -29847 0/imm32/no-imm8 -29848 0/imm32/no-disp32 -29849 0/imm32/no-xm32 -29850 0/imm32/no-x32 -29851 0x11/imm32/alloc-id:fake -29852 _Primitive-copy-byte-from-reg/imm32/next -29853 # - copy byte -29854 _Primitive-copy-byte-from-reg: -29855 0x11/imm32/alloc-id:fake:payload -29856 # var/reg <- copy-byte var2/reg2 => 8a/byte-> %var2 var/r32 -29857 0x11/imm32/alloc-id:fake -29858 _string-copy-byte/imm32/name -29859 0x11/imm32/alloc-id:fake -29860 Single-byte-var-in-some-register/imm32/inouts -29861 0x11/imm32/alloc-id:fake -29862 Single-byte-var-in-some-register/imm32/outputs -29863 0x11/imm32/alloc-id:fake -29864 _string_8a_copy_byte/imm32/subx-name -29865 1/imm32/rm32-is-first-inout -29866 3/imm32/r32-is-first-output -29867 0/imm32/no-imm32 -29868 0/imm32/no-imm8 -29869 0/imm32/no-disp32 -29870 0/imm32/no-xm32 -29871 0/imm32/no-x32 -29872 0x11/imm32/alloc-id:fake -29873 _Primitive-copy-byte-from-mem/imm32/next -29874 _Primitive-copy-byte-from-mem: -29875 0x11/imm32/alloc-id:fake:payload -29876 # var/reg <- copy-byte *var2/reg2 => 8a/byte-> *var2 var/r32 -29877 0x11/imm32/alloc-id:fake -29878 _string-copy-byte/imm32/name -29879 0x11/imm32/alloc-id:fake -29880 Single-byte-var-in-mem/imm32/inouts -29881 0x11/imm32/alloc-id:fake -29882 Single-byte-var-in-some-register/imm32/outputs -29883 0x11/imm32/alloc-id:fake -29884 _string_8a_copy_byte/imm32/subx-name -29885 1/imm32/rm32-is-first-inout -29886 3/imm32/r32-is-first-output -29887 0/imm32/no-imm32 -29888 0/imm32/no-imm8 -29889 0/imm32/no-disp32 -29890 0/imm32/no-xm32 -29891 0/imm32/no-x32 -29892 0x11/imm32/alloc-id:fake -29893 _Primitive-copy-byte-to-mem/imm32/next -29894 _Primitive-copy-byte-to-mem: -29895 0x11/imm32/alloc-id:fake:payload -29896 # copy-byte-to *var1/reg1, var2/reg2 => 88/byte<- *reg1 reg2/r32 -29897 0x11/imm32/alloc-id:fake -29898 _string-copy-byte-to/imm32/name -29899 0x11/imm32/alloc-id:fake -29900 Two-args-byte-stack-byte-reg/imm32/inouts -29901 0/imm32/no-outputs -29902 0/imm32/no-outputs -29903 0x11/imm32/alloc-id:fake -29904 _string_88_copy_byte/imm32/subx-name -29905 1/imm32/rm32-is-first-inout -29906 2/imm32/r32-is-second-inout -29907 0/imm32/no-imm32 -29908 0/imm32/no-imm8 -29909 0/imm32/no-disp32 -29910 0/imm32/no-xm32 -29911 0/imm32/no-x32 -29912 0x11/imm32/alloc-id:fake -29913 _Primitive-address/imm32/next -29914 # - address -29915 _Primitive-address: # (payload primitive) -29916 0x11/imm32/alloc-id:fake:payload -29917 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 -29918 0x11/imm32/alloc-id:fake -29919 _string-address/imm32/name -29920 0x11/imm32/alloc-id:fake -29921 Single-int-var-in-mem/imm32/inouts -29922 0x11/imm32/alloc-id:fake -29923 Single-addr-var-in-some-register/imm32/outputs -29924 0x11/imm32/alloc-id:fake -29925 _string_8d_copy_address/imm32/subx-name -29926 1/imm32/rm32-is-first-inout -29927 3/imm32/r32-is-first-output -29928 0/imm32/no-imm32 -29929 0/imm32/no-imm8 -29930 0/imm32/no-disp32 -29931 0/imm32/no-xm32 -29932 0/imm32/no-x32 -29933 0x11/imm32/alloc-id:fake -29934 _Primitive-compare-reg-with-reg/imm32/next -29935 # - compare -29936 _Primitive-compare-reg-with-reg: # (payload primitive) -29937 0x11/imm32/alloc-id:fake:payload -29938 # compare var1/reg1 var2/reg2 => 39/compare var1/rm32 var2/r32 -29939 0x11/imm32/alloc-id:fake -29940 _string-compare/imm32/name -29941 0x11/imm32/alloc-id:fake -29942 Two-int-args-in-regs/imm32/inouts -29943 0/imm32/no-outputs -29944 0/imm32/no-outputs -29945 0x11/imm32/alloc-id:fake -29946 _string_39_compare->/imm32/subx-name -29947 1/imm32/rm32-is-first-inout -29948 2/imm32/r32-is-second-inout -29949 0/imm32/no-imm32 -29950 0/imm32/no-imm8 -29951 0/imm32/no-disp32 -29952 0/imm32/no-xm32 -29953 0/imm32/no-x32 -29954 0x11/imm32/alloc-id:fake -29955 _Primitive-compare-mem-with-reg/imm32/next -29956 _Primitive-compare-mem-with-reg: # (payload primitive) -29957 0x11/imm32/alloc-id:fake:payload -29958 # compare var1 var2/reg => 39/compare var1/rm32 var2/r32 -29959 0x11/imm32/alloc-id:fake -29960 _string-compare/imm32/name -29961 0x11/imm32/alloc-id:fake -29962 Two-args-int-stack-int-reg/imm32/inouts -29963 0/imm32/no-outputs -29964 0/imm32/no-outputs -29965 0x11/imm32/alloc-id:fake -29966 _string_39_compare->/imm32/subx-name -29967 1/imm32/rm32-is-first-inout -29968 2/imm32/r32-is-second-inout -29969 0/imm32/no-imm32 -29970 0/imm32/no-imm8 -29971 0/imm32/no-disp32 -29972 0/imm32/no-xm32 -29973 0/imm32/no-x32 -29974 0x11/imm32/alloc-id:fake -29975 _Primitive-compare-reg-with-mem/imm32/next -29976 _Primitive-compare-reg-with-mem: # (payload primitive) -29977 0x11/imm32/alloc-id:fake:payload -29978 # compare var1/reg var2 => 3b/compare<- var2/rm32 var1/r32 -29979 0x11/imm32/alloc-id:fake -29980 _string-compare/imm32/name -29981 0x11/imm32/alloc-id:fake -29982 Two-args-int-reg-int-stack/imm32/inouts -29983 0/imm32/no-outputs -29984 0/imm32/no-outputs -29985 0x11/imm32/alloc-id:fake -29986 _string_3b_compare<-/imm32/subx-name -29987 2/imm32/rm32-is-second-inout -29988 1/imm32/r32-is-first-inout -29989 0/imm32/no-imm32 -29990 0/imm32/no-imm8 -29991 0/imm32/no-disp32 -29992 0/imm32/no-xm32 -29993 0/imm32/no-x32 -29994 0x11/imm32/alloc-id:fake -29995 _Primitive-compare-eax-with-literal/imm32/next -29996 _Primitive-compare-eax-with-literal: # (payload primitive) -29997 0x11/imm32/alloc-id:fake:payload -29998 # compare var1/eax n => 3d/compare-eax-with n/imm32 +28065 51/push-ecx +28066 # ecx = stmt +28067 8b/-> *(ebp+8) 1/r32/ecx +28068 # if stmt is a stmt1, return assigns-in-stmt-vars?(stmt->outputs, v) +28069 { +28070 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag +28071 75/jump-if-!= break/disp8 +28072 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +28073 (assigns-in-stmt-vars? %eax *(ebp+0xc)) # => eax +28074 eb/jump $assigns-in-stmt?:end/disp8 +28075 } +28076 # if stmt is a block, return assigns-in-stmts?(stmt->stmts, v) +28077 { +28078 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag +28079 75/jump-if-!= break/disp8 +28080 (lookup *(ecx+4) *(ecx+8)) # Block-stmts Block-stmts => eax +28081 (assigns-in-stmts? %eax *(ebp+0xc)) # => eax +28082 eb/jump $assigns-in-stmt?:end/disp8 +28083 } +28084 # otherwise return false +28085 b8/copy 0/imm32/false +28086 $assigns-in-stmt?:end: +28087 # . restore registers +28088 59/pop-to-ecx +28089 # . epilogue +28090 89/<- %esp 5/r32/ebp +28091 5d/pop-to-ebp +28092 c3/return +28093 +28094 assigns-in-stmt-vars?: # stmt-var: (addr stmt-var), v: (addr var) -> result/eax: boolean +28095 # . prologue +28096 55/push-ebp +28097 89/<- %ebp 4/r32/esp +28098 # . save registers +28099 51/push-ecx +28100 # var curr/ecx: (addr stmt-var) = stmt-var +28101 8b/-> *(ebp+8) 1/r32/ecx +28102 { +28103 # if (curr == 0) break +28104 81 7/subop/compare %ecx 0/imm32 +28105 74/jump-if-= break/disp8 +28106 # eax = lookup(curr->value) +28107 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +28108 # if (eax == v && curr->is-deref? == false) return true +28109 { +28110 39/compare *(ebp+0xc) 0/r32/eax +28111 75/jump-if-!= break/disp8 +28112 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +28113 75/jump-if-!= break/disp8 +28114 b8/copy-to-eax 1/imm32/true +28115 eb/jump $assigns-in-stmt-vars?:end/disp8 +28116 } +28117 # curr = lookup(curr->next) +28118 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax +28119 89/<- %ecx 0/r32/eax +28120 # +28121 eb/jump loop/disp8 +28122 } +28123 $assigns-in-stmt-vars?:end: +28124 # . restore registers +28125 59/pop-to-ecx +28126 # . epilogue +28127 89/<- %esp 5/r32/ebp +28128 5d/pop-to-ebp +28129 c3/return +28130 +28131 # is there a var before 'v' with the same block-depth and register on the 'vars' stack? +28132 # v is guaranteed to be within vars +28133 # 'start' is provided as an optimization, a pointer within vars +28134 # *start == v +28135 same-register-spilled-before?: # v: (addr var), vars: (addr stack (handle var)), start: (addr var) -> result/eax: boolean +28136 # . prologue +28137 55/push-ebp +28138 89/<- %ebp 4/r32/esp +28139 # . save registers +28140 51/push-ecx +28141 52/push-edx +28142 53/push-ebx +28143 56/push-esi +28144 57/push-edi +28145 # ecx = v +28146 8b/-> *(ebp+8) 1/r32/ecx +28147 # var reg/edx: (addr array byte) = lookup(v->register) +28148 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +28149 89/<- %edx 0/r32/eax +28150 # var depth/ebx: int = v->block-depth +28151 8b/-> *(ecx+0x10) 3/r32/ebx # Var-block-depth +28152 # var min/ecx: (addr handle var) = vars->data +28153 8b/-> *(ebp+0xc) 1/r32/ecx +28154 81 0/subop/add %ecx 8/imm32 +28155 # TODO: check that start >= min and start < &vars->data[top] +28156 # TODO: check that *start == v +28157 # var curr/esi: (addr handle var) = start +28158 8b/-> *(ebp+0x10) 6/r32/esi +28159 # curr -= 8 +28160 81 5/subop/subtract %esi 8/imm32 +28161 { +28162 $same-register-spilled-before?:loop: +28163 # if (curr < min) break +28164 39/compare %esi 1/r32/ecx +28165 0f 82/jump-if-addr< break/disp32 +28166 # var x/eax: (addr var) = lookup(*curr) +28167 (lookup *esi *(esi+4)) # => eax +28168 # if (x->block-depth < depth) break +28169 39/compare *(eax+0x10) 3/r32/ebx # Var-block-depth +28170 0f 8c/jump-if-< break/disp32 +28171 # if (x->register == 0) continue +28172 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +28173 74/jump-if-= $same-register-spilled-before?:continue/disp8 +28174 # if (x->register == reg) return true +28175 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +28176 (string-equal? %eax %edx) # => eax +28177 3d/compare-eax-and 0/imm32/false +28178 b8/copy-to-eax 1/imm32/true +28179 75/jump-if-!= $same-register-spilled-before?:end/disp8 +28180 $same-register-spilled-before?:continue: +28181 # curr -= 8 +28182 81 5/subop/subtract %esi 8/imm32 +28183 e9/jump loop/disp32 +28184 } +28185 $same-register-spilled-before?:false: +28186 b8/copy-to-eax 0/imm32/false +28187 $same-register-spilled-before?:end: +28188 # . restore registers +28189 5f/pop-to-edi +28190 5e/pop-to-esi +28191 5b/pop-to-ebx +28192 5a/pop-to-edx +28193 59/pop-to-ecx +28194 # . epilogue +28195 89/<- %esp 5/r32/ebp +28196 5d/pop-to-ebp +28197 c3/return +28198 +28199 # clean up global state for 'vars' until some block depth (inclusive) +28200 clean-up-blocks: # vars: (addr stack live-var), until-block-depth: int, fn: (addr function) +28201 # . prologue +28202 55/push-ebp +28203 89/<- %ebp 4/r32/esp +28204 # . save registers +28205 50/push-eax +28206 51/push-ecx +28207 56/push-esi +28208 # esi = vars +28209 8b/-> *(ebp+8) 6/r32/esi +28210 # ecx = until-block-depth +28211 8b/-> *(ebp+0xc) 1/r32/ecx +28212 { +28213 $clean-up-blocks:reclaim-loop: +28214 # if (vars->top <= 0) break +28215 8b/-> *esi 0/r32/eax # Stack-top +28216 3d/compare-eax-and 0/imm32 +28217 0f 8e/jump-if-<= break/disp32 +28218 # var v/eax: (addr var) = lookup(vars[vars->top-12]) +28219 (lookup *(esi+eax-4) *(esi+eax)) # vars + 8 + vars->top - 12 => eax +28220 # if (v->block-depth < until-block-depth) break +28221 39/compare *(eax+0x10) 1/r32/ecx # Var-block-depth +28222 0f 8c/jump-if-< break/disp32 +28223 (pop %esi) # => eax +28224 (pop %esi) # => eax +28225 (pop %esi) # => eax +28226 e9/jump loop/disp32 +28227 } +28228 $clean-up-blocks:end: +28229 # . restore registers +28230 5e/pop-to-esi +28231 59/pop-to-ecx +28232 58/pop-to-eax +28233 # . epilogue +28234 89/<- %esp 5/r32/ebp +28235 5d/pop-to-ebp +28236 c3/return +28237 +28238 reg-in-function-outputs?: # fn: (addr function), target: (addr array byte) -> result/eax: boolean +28239 # . prologue +28240 55/push-ebp +28241 89/<- %ebp 4/r32/esp +28242 # . save registers +28243 51/push-ecx +28244 # var curr/ecx: (addr list var) = lookup(fn->outputs) +28245 8b/-> *(ebp+8) 0/r32/eax +28246 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax +28247 89/<- %ecx 0/r32/eax +28248 # while curr != null +28249 { +28250 81 7/subop/compare %ecx 0/imm32 +28251 74/jump-if-= break/disp8 +28252 # var v/eax: (addr var) = lookup(curr->value) +28253 (lookup *ecx *(ecx+4)) # List-value List-value => eax +28254 # var reg/eax: (addr array byte) = lookup(v->register) +28255 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +28256 # if (reg == target) return true +28257 (string-equal? %eax *(ebp+0xc)) # => eax +28258 3d/compare-eax-and 0/imm32/false +28259 75/jump-if-!= $reg-in-function-outputs?:end/disp8 +28260 # curr = curr->next +28261 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +28262 89/<- %ecx 0/r32/eax +28263 # +28264 eb/jump loop/disp8 +28265 } +28266 # return false +28267 b8/copy-to-eax 0/imm32 +28268 $reg-in-function-outputs?:end: +28269 # . restore registers +28270 59/pop-to-ecx +28271 # . epilogue +28272 89/<- %esp 5/r32/ebp +28273 5d/pop-to-ebp +28274 c3/return +28275 +28276 emit-subx-var-def: # out: (addr buffered-file), stmt: (addr stmt) +28277 # . prologue +28278 55/push-ebp +28279 89/<- %ebp 4/r32/esp +28280 # . save registers +28281 50/push-eax +28282 51/push-ecx +28283 52/push-edx +28284 # eax = stmt +28285 8b/-> *(ebp+0xc) 0/r32/eax +28286 # var v/ecx: (addr var) +28287 (lookup *(eax+4) *(eax+8)) # Vardef-var Vardef-var => eax +28288 89/<- %ecx 0/r32/eax +28289 # v->block-depth = *Curr-block-depth +28290 8b/-> *Curr-block-depth 0/r32/eax +28291 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +28292 # var n/edx: int = size-of(stmt->var) +28293 (size-of %ecx) # => eax +28294 89/<- %edx 0/r32/eax +28295 # *Curr-local-stack-offset -= n +28296 29/subtract-from *Curr-local-stack-offset 2/r32/edx +28297 # v->offset = *Curr-local-stack-offset +28298 8b/-> *Curr-local-stack-offset 0/r32/eax +28299 89/<- *(ecx+0x14) 0/r32/eax # Var-offset +28300 # if v is an array, do something special to initialize it +28301 { +28302 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +28303 (is-mu-array? %eax) # => eax +28304 3d/compare-eax-and 0/imm32/false +28305 0f 84/jump-if-= break/disp32 +28306 # var array-size-without-size/edx: int = n-4 +28307 81 5/subop/subtract %edx 4/imm32 +28308 # +28309 (emit-array-data-initialization *(ebp+8) %edx) +28310 e9/jump $emit-subx-var-def:end/disp32 +28311 } +28312 # another special-case for initializing streams +28313 # a stream is an array with 2 extra pointers +28314 { +28315 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +28316 (is-mu-stream? %eax) # => eax +28317 3d/compare-eax-and 0/imm32/false +28318 0f 84/jump-if-= break/disp32 +28319 # var array-size-without-size/edx: int = n-12 +28320 81 5/subop/subtract %edx 0xc/imm32 +28321 (emit-array-data-initialization *(ebp+8) %edx) +28322 # emit read and write pointers +28323 (emit-indent *(ebp+8) *Curr-block-depth) +28324 (write-buffered *(ebp+8) "68/push 0/imm32\n") +28325 (emit-indent *(ebp+8) *Curr-block-depth) +28326 (write-buffered *(ebp+8) "68/push 0/imm32\n") +28327 # +28328 eb/jump $emit-subx-var-def:end/disp8 +28329 } +28330 # while n > 0 +28331 { +28332 81 7/subop/compare %edx 0/imm32 +28333 7e/jump-if-<= break/disp8 +28334 (emit-indent *(ebp+8) *Curr-block-depth) +28335 (write-buffered *(ebp+8) "68/push 0/imm32\n") +28336 # n -= 4 +28337 81 5/subop/subtract %edx 4/imm32 +28338 # +28339 eb/jump loop/disp8 +28340 } +28341 $emit-subx-var-def:end: +28342 # . restore registers +28343 5a/pop-to-edx +28344 59/pop-to-ecx +28345 58/pop-to-eax +28346 # . epilogue +28347 89/<- %esp 5/r32/ebp +28348 5d/pop-to-ebp +28349 c3/return +28350 +28351 emit-array-data-initialization: # out: (addr buffered-file), n: int +28352 # . prologue +28353 55/push-ebp +28354 89/<- %ebp 4/r32/esp +28355 # +28356 (emit-indent *(ebp+8) *Curr-block-depth) +28357 (write-buffered *(ebp+8) "(push-n-zero-bytes ") +28358 (write-int32-hex-buffered *(ebp+8) *(ebp+0xc)) +28359 (write-buffered *(ebp+8) ")\n") +28360 (emit-indent *(ebp+8) *Curr-block-depth) +28361 (write-buffered *(ebp+8) "68/push ") +28362 (write-int32-hex-buffered *(ebp+8) *(ebp+0xc)) +28363 (write-buffered *(ebp+8) "/imm32\n") +28364 $emit-array-data-initialization:end: +28365 # . epilogue +28366 89/<- %esp 5/r32/ebp +28367 5d/pop-to-ebp +28368 c3/return +28369 +28370 emit-subx-stmt: # out: (addr buffered-file), stmt: (addr stmt), primitives: (addr primitive), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +28371 # . prologue +28372 55/push-ebp +28373 89/<- %ebp 4/r32/esp +28374 # . save registers +28375 50/push-eax +28376 51/push-ecx +28377 # - some special-case primitives that don't actually use the 'primitives' data structure +28378 # var op/ecx: (addr array byte) = lookup(stmt->operation) +28379 8b/-> *(ebp+0xc) 1/r32/ecx +28380 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +28381 89/<- %ecx 0/r32/eax +28382 # copy byte (can be a primitive except we need to emit a second instruction) +28383 { +28384 # if (!string-equal?(stmt->operation, "copy-byte")) break +28385 (string-equal? %ecx "copy-byte") # => eax +28386 3d/compare-eax-and 0/imm32 +28387 0f 84/jump-if-= break/disp32 +28388 (translate-mu-copy-byte-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +28389 e9/jump $emit-subx-stmt:end/disp32 +28390 } +28391 # copy-byte-to can be a primitive; writes to memory don't need to clear surrounding bytes +28392 # array size +28393 { +28394 # if (!string-equal?(stmt->operation, "length")) break +28395 (string-equal? %ecx "length") # => eax +28396 3d/compare-eax-and 0/imm32 +28397 0f 84/jump-if-= break/disp32 +28398 (translate-mu-length-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +28399 e9/jump $emit-subx-stmt:end/disp32 +28400 } +28401 # index into array +28402 { +28403 # if (!string-equal?(stmt->operation, "index")) break +28404 (string-equal? %ecx "index") # => eax +28405 3d/compare-eax-and 0/imm32 +28406 0f 84/jump-if-= break/disp32 +28407 (translate-mu-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +28408 e9/jump $emit-subx-stmt:end/disp32 +28409 } +28410 # compute-offset for index into array +28411 { +28412 # if (!string-equal?(stmt->operation, "compute-offset")) break +28413 (string-equal? %ecx "compute-offset") # => eax +28414 3d/compare-eax-and 0/imm32 +28415 0f 84/jump-if-= break/disp32 +28416 (translate-mu-compute-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +28417 e9/jump $emit-subx-stmt:end/disp32 +28418 } +28419 # get field from record +28420 { +28421 # if (!string-equal?(stmt->operation, "get")) break +28422 (string-equal? %ecx "get") # => eax +28423 3d/compare-eax-and 0/imm32 +28424 0f 84/jump-if-= break/disp32 +28425 (translate-mu-get-stmt *(ebp+8) *(ebp+0xc)) +28426 e9/jump $emit-subx-stmt:end/disp32 +28427 } +28428 # allocate scalar +28429 { +28430 # if (!string-equal?(stmt->operation, "allocate")) break +28431 (string-equal? %ecx "allocate") # => eax +28432 3d/compare-eax-and 0/imm32 +28433 0f 84/jump-if-= break/disp32 +28434 (translate-mu-allocate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +28435 e9/jump $emit-subx-stmt:end/disp32 +28436 } +28437 # copy-object +28438 { +28439 # if (!string-equal?(stmt->operation, "copy-object")) break +28440 (string-equal? %ecx "copy-object") # => eax +28441 3d/compare-eax-and 0/imm32 +28442 0f 84/jump-if-= break/disp32 +28443 (translate-mu-copy-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +28444 e9/jump $emit-subx-stmt:end/disp32 +28445 } +28446 # clear-object +28447 { +28448 # if (!string-equal?(stmt->operation, "clear-object")) break +28449 (string-equal? %ecx "clear-object") # => eax +28450 3d/compare-eax-and 0/imm32 +28451 0f 84/jump-if-= break/disp32 +28452 (translate-mu-clear-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +28453 e9/jump $emit-subx-stmt:end/disp32 +28454 } +28455 # allocate array +28456 { +28457 # if (!string-equal?(stmt->operation, "populate")) break +28458 (string-equal? %ecx "populate") # => eax +28459 3d/compare-eax-and 0/imm32 +28460 0f 84/jump-if-= break/disp32 +28461 (translate-mu-populate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +28462 e9/jump $emit-subx-stmt:end/disp32 +28463 } +28464 # allocate stream +28465 { +28466 # if (!string-equal?(stmt->operation, "populate-stream")) break +28467 (string-equal? %ecx "populate-stream") # => eax +28468 3d/compare-eax-and 0/imm32 +28469 0f 84/jump-if-= break/disp32 +28470 (translate-mu-populate-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +28471 e9/jump $emit-subx-stmt:end/disp32 +28472 } +28473 # read from stream +28474 { +28475 # if (!string-equal?(stmt->operation, "read-from-stream")) break +28476 (string-equal? %ecx "read-from-stream") # => eax +28477 3d/compare-eax-and 0/imm32 +28478 0f 84/jump-if-= break/disp32 +28479 (translate-mu-read-from-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +28480 e9/jump $emit-subx-stmt:end/disp32 +28481 } +28482 # write to stream +28483 { +28484 # if (!string-equal?(stmt->operation, "write-to-stream")) break +28485 (string-equal? %ecx "write-to-stream") # => eax +28486 3d/compare-eax-and 0/imm32 +28487 0f 84/jump-if-= break/disp32 +28488 (translate-mu-write-to-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +28489 e9/jump $emit-subx-stmt:end/disp32 +28490 } +28491 # - if stmt matches a primitive, emit it +28492 { +28493 $emit-subx-stmt:check-for-primitive: +28494 # var curr/eax: (addr primitive) +28495 (find-matching-primitive *(ebp+0x10) *(ebp+0xc)) # primitives, stmt => eax +28496 3d/compare-eax-and 0/imm32 +28497 74/jump-if-= break/disp8 +28498 $emit-subx-stmt:primitive: +28499 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax) # out, stmt, curr +28500 e9/jump $emit-subx-stmt:end/disp32 +28501 } +28502 # - otherwise emit a call +28503 # TODO: type-checking +28504 $emit-subx-stmt:call: +28505 (emit-call *(ebp+8) *(ebp+0xc)) +28506 $emit-subx-stmt:end: +28507 # . restore registers +28508 59/pop-to-ecx +28509 58/pop-to-eax +28510 # . epilogue +28511 89/<- %esp 5/r32/ebp +28512 5d/pop-to-ebp +28513 c3/return +28514 +28515 translate-mu-length-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +28516 # . prologue +28517 55/push-ebp +28518 89/<- %ebp 4/r32/esp +28519 # . save registers +28520 50/push-eax +28521 51/push-ecx +28522 52/push-edx +28523 53/push-ebx +28524 56/push-esi +28525 # esi = stmt +28526 8b/-> *(ebp+0xc) 6/r32/esi +28527 # var base/ebx: (addr var) = stmt->inouts[0]->value +28528 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +28529 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +28530 89/<- %ebx 0/r32/eax +28531 # var elemsize/ecx: int = array-element-size(base) +28532 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +28533 89/<- %ecx 0/r32/eax +28534 # var outreg/edx: (addr array byte) = stmt->outputs[0]->value->register +28535 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +28536 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +28537 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +28538 89/<- %edx 0/r32/eax +28539 # if elemsize == 1 +28540 { +28541 81 7/subop/compare %ecx 1/imm32 +28542 75/jump-if-!= break/disp8 +28543 $translate-mu-length-stmt:size-1: +28544 (emit-save-size-to *(ebp+8) %ebx %edx) +28545 e9/jump $translate-mu-length-stmt:end/disp32 +28546 } +28547 # if elemsize is a power of 2 less than 256 +28548 { +28549 (power-of-2? %ecx *(ebp+0x10) *(ebp+0x14)) # => eax +28550 3d/compare-eax-and 0/imm32/false +28551 74/jump-if-= break/disp8 +28552 81 7/subop/compare %ecx 0xff/imm32 +28553 7f/jump-if-> break/disp8 +28554 $translate-mu-length-stmt:size-power-of-2: +28555 (emit-save-size-to *(ebp+8) %ebx %edx) +28556 (emit-divide-by-shift-right *(ebp+8) %edx %ecx) +28557 e9/jump $translate-mu-length-stmt:end/disp32 +28558 } +28559 # otherwise, the complex case +28560 # . emit register spills +28561 { +28562 $translate-mu-length-stmt:complex: +28563 (string-equal? %edx "eax") # => eax +28564 3d/compare-eax-and 0/imm32/false +28565 75/break-if-!= break/disp8 +28566 (emit-indent *(ebp+8) *Curr-block-depth) +28567 (write-buffered *(ebp+8) "50/push-eax\n") +28568 } +28569 { +28570 (string-equal? %edx "ecx") # => eax +28571 3d/compare-eax-and 0/imm32/false +28572 75/break-if-!= break/disp8 +28573 (emit-indent *(ebp+8) *Curr-block-depth) +28574 (write-buffered *(ebp+8) "51/push-ecx\n") +28575 } +28576 { +28577 (string-equal? %edx "edx") # => eax +28578 3d/compare-eax-and 0/imm32/false +28579 75/break-if-!= break/disp8 +28580 (emit-indent *(ebp+8) *Curr-block-depth) +28581 (write-buffered *(ebp+8) "52/push-edx\n") +28582 } +28583 # . +28584 (emit-save-size-to *(ebp+8) %ebx "eax") +28585 (emit-indent *(ebp+8) *Curr-block-depth) +28586 (write-buffered *(ebp+8) "31/xor %edx 2/r32/edx\n") +28587 (emit-indent *(ebp+8) *Curr-block-depth) +28588 (write-buffered *(ebp+8) "b9/copy-to-ecx ") +28589 (write-int32-hex-buffered *(ebp+8) %ecx) +28590 (write-buffered *(ebp+8) "/imm32\n") +28591 (emit-indent *(ebp+8) *Curr-block-depth) +28592 (write-buffered *(ebp+8) "f7 7/subop/idiv-eax-edx-by %ecx\n") +28593 { +28594 (string-equal? %edx "eax") # => eax +28595 3d/compare-eax-and 0/imm32/false +28596 75/break-if-!= break/disp8 +28597 (emit-indent *(ebp+8) *Curr-block-depth) +28598 (write-buffered *(ebp+8) "89/<- %") +28599 (write-buffered *(ebp+8) %edx) +28600 (write-buffered *(ebp+8) " 0/r32/eax\n") +28601 } +28602 # . emit register restores +28603 { +28604 (string-equal? %edx "edx") # => eax +28605 3d/compare-eax-and 0/imm32/false +28606 75/break-if-!= break/disp8 +28607 (emit-indent *(ebp+8) *Curr-block-depth) +28608 (write-buffered *(ebp+8) "5a/pop-to-edx\n") +28609 } +28610 { +28611 (string-equal? %edx "ecx") # => eax +28612 3d/compare-eax-and 0/imm32/false +28613 75/break-if-!= break/disp8 +28614 (emit-indent *(ebp+8) *Curr-block-depth) +28615 (write-buffered *(ebp+8) "59/pop-to-ecx\n") +28616 } +28617 { +28618 (string-equal? %edx "eax") # => eax +28619 3d/compare-eax-and 0/imm32/false +28620 75/break-if-!= break/disp8 +28621 (emit-indent *(ebp+8) *Curr-block-depth) +28622 (write-buffered *(ebp+8) "58/pop-to-eax\n") +28623 } +28624 $translate-mu-length-stmt:end: +28625 # . restore registers +28626 5e/pop-to-esi +28627 5b/pop-to-ebx +28628 5a/pop-to-edx +28629 59/pop-to-ecx +28630 58/pop-to-eax +28631 # . epilogue +28632 89/<- %esp 5/r32/ebp +28633 5d/pop-to-ebp +28634 c3/return +28635 +28636 array-element-size: # arr: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +28637 # . prologue +28638 55/push-ebp +28639 89/<- %ebp 4/r32/esp +28640 # +28641 (array-element-type-id *(ebp+8) *(ebp+0xc) *(ebp+0x10)) # => eax +28642 (size-of-type-id-as-array-element %eax) # => eax +28643 $array-element-size:end: +28644 # . epilogue +28645 89/<- %esp 5/r32/ebp +28646 5d/pop-to-ebp +28647 c3/return +28648 +28649 array-element-type-id: # v: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: type-id +28650 # precondition: n is positive +28651 # . prologue +28652 55/push-ebp +28653 89/<- %ebp 4/r32/esp +28654 # +28655 8b/-> *(ebp+8) 0/r32/eax +28656 # var t/eax: (addr type-tree) +28657 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +28658 # if t == 0 abort +28659 3d/compare-eax-with 0/imm32 +28660 0f 84/jump-if-== $array-element-type-id:error0/disp32 +28661 # if t->is-atom? abort +28662 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +28663 0f 85/jump-if-!= $array-element-type-id:error1/disp32 +28664 # if (t->left == addr) t = t->right +28665 { +28666 50/push-eax +28667 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +28668 (is-simple-mu-type? %eax 2) # addr => eax +28669 3d/compare-eax-with 0/imm32/false +28670 58/pop-to-eax +28671 74/jump-if-= break/disp8 +28672 $array-element-type-id:skip-addr: +28673 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +28674 } +28675 # if t == 0 abort +28676 3d/compare-eax-with 0/imm32 +28677 0f 84/jump-if-= $array-element-type-id:error2/disp32 +28678 # if t->is-atom? abort +28679 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +28680 0f 85/jump-if-!= $array-element-type-id:error2/disp32 +28681 # if t->left != array abort +28682 { +28683 50/push-eax +28684 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +28685 (is-simple-mu-type? %eax 3) # array => eax +28686 3d/compare-eax-with 0/imm32/false +28687 58/pop-to-eax +28688 $array-element-type-id:no-array: +28689 0f 84/jump-if-= $array-element-type-id:error2/disp32 +28690 } +28691 $array-element-type-id:skip-array: +28692 # t = t->right +28693 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +28694 # if t == 0 abort +28695 3d/compare-eax-with 0/imm32 +28696 0f 84/jump-if-= $array-element-type-id:error2/disp32 +28697 # if t->is-atom? abort +28698 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +28699 0f 85/jump-if-!= $array-element-type-id:error2/disp32 +28700 # t = t->left +28701 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +28702 # if (!t->is-atom?) t = t->left # TODO: assumes array element size can be determined from just first word of array element type +28703 # if (t->is-atom == false) t = lookup(t->left) +28704 { +28705 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +28706 75/jump-if-!= break/disp8 +28707 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +28708 } +28709 # return t->value +28710 8b/-> *(eax+4) 0/r32/eax # Type-tree-value +28711 $array-element-type-id:end: +28712 # . epilogue +28713 89/<- %esp 5/r32/ebp +28714 5d/pop-to-ebp +28715 c3/return +28716 +28717 $array-element-type-id:error0: +28718 (write-buffered *(ebp+0xc) "array-element-type-id: var '") +28719 50/push-eax +28720 8b/-> *(ebp+8) 0/r32/eax +28721 (lookup *eax *(eax+4)) # Var-name Var-name => eax +28722 (write-buffered *(ebp+0xc) %eax) +28723 58/pop-to-eax +28724 (write-buffered *(ebp+0xc) "' has no type\n") +28725 (flush *(ebp+0xc)) +28726 (stop *(ebp+0x10) 1) +28727 # never gets here +28728 +28729 $array-element-type-id:error1: +28730 (write-buffered *(ebp+0xc) "array-element-type-id: var '") +28731 50/push-eax +28732 8b/-> *(ebp+8) 0/r32/eax +28733 (lookup *eax *(eax+4)) # Var-name Var-name => eax +28734 (write-buffered *(ebp+0xc) %eax) +28735 58/pop-to-eax +28736 (write-buffered *(ebp+0xc) "' has atomic type ") +28737 (write-int32-hex-buffered *(ebp+0xc) *(eax+4)) # Type-tree-value +28738 (write-buffered *(ebp+0xc) Newline) +28739 (flush *(ebp+0xc)) +28740 (stop *(ebp+0x10) 1) +28741 # never gets here +28742 +28743 $array-element-type-id:error2: +28744 (write-buffered *(ebp+0xc) "array-element-type-id: var '") +28745 50/push-eax +28746 8b/-> *(ebp+8) 0/r32/eax +28747 (lookup *eax *(eax+4)) # Var-name Var-name => eax +28748 (write-buffered *(ebp+0xc) %eax) +28749 58/pop-to-eax +28750 (write-buffered *(ebp+0xc) "' has non-array type\n") +28751 (flush *(ebp+0xc)) +28752 (stop *(ebp+0x10) 1) +28753 # never gets here +28754 +28755 size-of-type-id-as-array-element: # t: type-id -> result/eax: int +28756 # . prologue +28757 55/push-ebp +28758 89/<- %ebp 4/r32/esp +28759 # eax = t +28760 8b/-> *(ebp+8) 0/r32/eax +28761 # if t is 'byte', size is 1 +28762 3d/compare-eax-and 8/imm32/byte +28763 { +28764 75/jump-if-!= break/disp8 +28765 b8/copy-to-eax 1/imm32 +28766 eb/jump $size-of-type-id-as-array-element:end/disp8 +28767 } +28768 # otherwise proceed as usual +28769 (size-of-type-id %eax) # => eax +28770 $size-of-type-id-as-array-element:end: +28771 # . epilogue +28772 89/<- %esp 5/r32/ebp +28773 5d/pop-to-ebp +28774 c3/return +28775 +28776 emit-save-size-to: # out: (addr buffered-file), base: (addr var), outreg: (addr array byte) +28777 # . prologue +28778 55/push-ebp +28779 89/<- %ebp 4/r32/esp +28780 # . save registers +28781 50/push-eax +28782 53/push-ebx +28783 # ebx = base +28784 8b/-> *(ebp+0xc) 3/r32/ebx +28785 (emit-indent *(ebp+8) *Curr-block-depth) +28786 (write-buffered *(ebp+8) "8b/-> *") +28787 # if base is an (addr array ...) in a register +28788 { +28789 81 7/subop/compare *(ebx+0x18)) 0/imm32 # Var-register +28790 74/jump-if-= break/disp8 +28791 $emit-save-size-to:emit-base-from-register: +28792 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +28793 (write-buffered *(ebp+8) %eax) +28794 eb/jump $emit-save-size-to:emit-output/disp8 +28795 } +28796 # otherwise if base is an (array ...) on the stack +28797 { +28798 81 7/subop/compare *(ebx+0x14)) 0/imm32 # Var-offset +28799 74/jump-if-= break/disp8 +28800 $emit-save-size-to:emit-base-from-stack: +28801 (write-buffered *(ebp+8) "(ebp+") +28802 (write-int32-hex-buffered *(ebp+8) *(ebx+0x14)) # Var-offset +28803 (write-buffered *(ebp+8) ")") +28804 } +28805 $emit-save-size-to:emit-output: +28806 (write-buffered *(ebp+8) " ") +28807 (get Mu-registers *(ebp+0x10) 0xc "Mu-registers") # => eax +28808 (write-int32-hex-buffered *(ebp+8) *eax) +28809 (write-buffered *(ebp+8) "/r32\n") +28810 $emit-save-size-to:end: +28811 # . restore registers +28812 5b/pop-to-ebx +28813 58/pop-to-eax +28814 # . epilogue +28815 89/<- %esp 5/r32/ebp +28816 5d/pop-to-ebp +28817 c3/return +28818 +28819 emit-divide-by-shift-right: # out: (addr buffered-file), reg: (addr array byte), size: int +28820 # . prologue +28821 55/push-ebp +28822 89/<- %ebp 4/r32/esp +28823 # . save registers +28824 50/push-eax +28825 # +28826 (emit-indent *(ebp+8) *Curr-block-depth) +28827 (write-buffered *(ebp+8) "c1/shift 5/subop/>> %") +28828 (write-buffered *(ebp+8) *(ebp+0xc)) +28829 (write-buffered *(ebp+8) Space) +28830 (num-shift-rights *(ebp+0x10)) # => eax +28831 (write-int32-hex-buffered *(ebp+8) %eax) +28832 (write-buffered *(ebp+8) "/imm8\n") +28833 $emit-divide-by-shift-right:end: +28834 # . restore registers +28835 58/pop-to-eax +28836 # . epilogue +28837 89/<- %esp 5/r32/ebp +28838 5d/pop-to-ebp +28839 c3/return +28840 +28841 translate-mu-copy-byte-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +28842 # . prologue +28843 55/push-ebp +28844 89/<- %ebp 4/r32/esp +28845 # . save registers +28846 50/push-eax +28847 56/push-esi +28848 # esi = stmt +28849 8b/-> *(ebp+0xc) 6/r32/esi +28850 # +28851 (emit-indent *(ebp+8) *Curr-block-depth) +28852 (write-buffered *(ebp+8) "8a/byte->") +28853 # emit stmt->inouts[0] +28854 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +28855 (emit-subx-var-as-rm32 *(ebp+8) %eax) +28856 # emit /r32 for stmt->outputs[0]->register +28857 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +28858 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +28859 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +28860 (maybe-get Mu-registers %eax 0xc) # => eax: (addr register-index) +28861 (write-buffered *(ebp+8) Space) +28862 (write-int32-hex-buffered *(ebp+8) *eax) +28863 (write-buffered *(ebp+8) "/r32\n") +28864 # clear rest of register +28865 (emit-indent *(ebp+8) *Curr-block-depth) +28866 (write-buffered *(ebp+8) "81 4/subop/and %") +28867 8b/-> *(ebp+0xc) 0/r32/eax +28868 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +28869 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +28870 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +28871 (write-buffered *(ebp+8) %eax) +28872 (write-buffered *(ebp+8) " 0xff/imm32\n") +28873 $translate-mu-copy-byte-stmt:end: +28874 # . restore registers +28875 5e/pop-to-esi +28876 58/pop-to-eax +28877 # . epilogue +28878 89/<- %esp 5/r32/ebp +28879 5d/pop-to-ebp +28880 c3/return +28881 +28882 # a little different from other translate- functions; notice the extra 'fn' argument +28883 translate-mu-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +28884 # . prologue +28885 55/push-ebp +28886 89/<- %ebp 4/r32/esp +28887 # . save registers +28888 53/push-ebx +28889 # ebx = stmt +28890 8b/-> *(ebp+0xc) 3/r32/ebx +28891 # var base/ebx: (addr var) = stmt->inouts[0] +28892 (lookup *(ebx+0xc) *(ebx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +28893 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +28894 89/<- %ebx 0/r32/eax +28895 # emit bounds-check +28896 (emit-mu-index-bounds-check *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) +28897 # if (var->register) do one thing +28898 { +28899 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +28900 74/jump-if-= break/disp8 +28901 # TODO: ensure there's no dereference +28902 (translate-mu-index-stmt-with-array-in-register *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +28903 eb/jump $translate-mu-index-stmt:end/disp8 +28904 } +28905 # if (var->offset) do a different thing +28906 { +28907 81 7/subop/compare *(ebx+0x14) 0/imm32 # Var-offset +28908 74/jump-if-= break/disp8 +28909 # TODO: ensure there's no dereference +28910 (translate-mu-index-stmt-with-array-on-stack *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +28911 eb/jump $translate-mu-index-stmt:end/disp8 +28912 } +28913 $translate-mu-index-stmt:end: +28914 # . restore registers +28915 5b/pop-to-ebx +28916 # . epilogue +28917 89/<- %esp 5/r32/ebp +28918 5d/pop-to-ebp +28919 c3/return +28920 +28921 $translate-mu-index-stmt:error1: +28922 (write-buffered *(ebp+0x14) "couldn't translate an index instruction. second (index) input must either lie in a register or be a literal\n") +28923 (flush *(ebp+0x14)) +28924 (stop *(ebp+0x18) 1) +28925 # never gets here +28926 +28927 $translate-mu-index-stmt:error2: +28928 (write-buffered *(ebp+0x14) "couldn't translate an index instruction. second (index) input when in a register must be an int or offset\n") +28929 (flush *(ebp+0x14)) +28930 (stop *(ebp+0x18) 1) +28931 # never gets here +28932 +28933 emit-mu-index-bounds-check: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +28934 # . prologue +28935 55/push-ebp +28936 89/<- %ebp 4/r32/esp +28937 # . save registers +28938 50/push-eax +28939 51/push-ecx +28940 52/push-edx +28941 53/push-ebx +28942 # ecx = stmt +28943 8b/-> *(ebp+0xc) 1/r32/ecx +28944 # +28945 (emit-indent *(ebp+8) *Curr-block-depth) +28946 (write-buffered *(ebp+8) "(__check-mu-array-bounds ") +28947 $emit-mu-index-bounds-check:compute-base: +28948 # var base/ebx: (addr var) = inouts[0] +28949 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +28950 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +28951 89/<- %ebx 0/r32/eax +28952 $emit-mu-index-bounds-check:emit-index: +28953 # var index/edx: (addr var) = inouts[1] +28954 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +28955 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +28956 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +28957 89/<- %edx 0/r32/eax +28958 # if index->register, print its code +28959 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register +28960 { +28961 0f 84/jump-if-= break/disp32 +28962 $emit-mu-index-bounds-check:emit-register-index: +28963 (write-buffered *(ebp+8) "%") +28964 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +28965 (write-buffered *(ebp+8) %eax) +28966 eb/jump $emit-mu-index-bounds-check:index-done/disp8 +28967 } +28968 # otherwise if index is a literal, print it +28969 $emit-mu-index-bounds-check:emit-literal-index: +28970 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +28971 (is-simple-mu-type? %eax 0) # => eax +28972 3d/compare-eax-and 0/imm32/false +28973 { +28974 0f 84/jump-if-= break/disp32 +28975 (lookup *edx *(edx+4)) # Var-name Var-name => eax +28976 (write-buffered *(ebp+8) %eax) +28977 } +28978 $emit-mu-index-bounds-check:index-done: +28979 (write-buffered *(ebp+8) " ") +28980 $emit-mu-index-bounds-check:emit-element-size: +28981 # if index is a literal or int, print size of array element +28982 { +28983 { +28984 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +28985 (is-simple-mu-type? %eax 0) # literal => eax +28986 3d/compare-eax-and 0/imm32/false +28987 75/jump-if-!= break/disp8 +28988 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +28989 (is-simple-mu-type? %eax 1) # int => eax +28990 3d/compare-eax-and 0/imm32/false +28991 75/jump-if-!= break/disp8 +28992 eb/jump $emit-mu-index-bounds-check:emit-element-size-offset/disp8 +28993 } +28994 $emit-mu-index-bounds-check:emit-int-register-index: +28995 (array-element-size %ebx *(ebp+0x14) *(ebp+0x18)) # => eax +28996 (write-int32-hex-buffered *(ebp+8) %eax) +28997 e9/jump $emit-mu-index-bounds-check:emit-base/disp32 +28998 } +28999 $emit-mu-index-bounds-check:emit-element-size-offset: +29000 # if index has type (offset ...), print "1" +29001 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +29002 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +29003 { +29004 75/jump-if-!= break/disp8 +29005 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +29006 (is-simple-mu-type? %eax 7) # => eax +29007 3d/compare-eax-and 0/imm32/false +29008 { +29009 0f 84/jump-if-= break/disp32 +29010 $emit-mu-index-bounds-check:emit-offset-register-index: +29011 (write-buffered *(ebp+8) "1") +29012 } +29013 } +29014 $emit-mu-index-bounds-check:emit-base: +29015 # if base is in a register, print " *" base->register +29016 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +29017 { +29018 74/jump-if-= break/disp8 +29019 (write-buffered *(ebp+8) " *") +29020 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +29021 (write-buffered *(ebp+8) %eax) +29022 e9/jump $emit-mu-index-bounds-check:emit-function-name/disp32 +29023 } +29024 # otherwise print " *(ebp+" base->offset ")" +29025 (write-buffered *(ebp+8) " *(ebp+") +29026 (write-int32-hex-buffered *(ebp+8) *(ebx+0x14)) # Var-offset +29027 (write-buffered *(ebp+8) ")") +29028 $emit-mu-index-bounds-check:emit-function-name: +29029 # " \"" function-name "\"" +29030 (write-buffered *(ebp+8) " \"") +29031 8b/-> *(ebp+0x10) 1/r32/ecx +29032 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +29033 (write-buffered *(ebp+8) %eax) +29034 (write-buffered *(ebp+8) "\"") +29035 $emit-mu-index-bounds-check:emit-array-name: +29036 # " \"" base->name "\"" +29037 (write-buffered *(ebp+8) " \"") +29038 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +29039 (write-buffered *(ebp+8) %eax) +29040 (write-buffered *(ebp+8) "\")\n") +29041 $emit-mu-index-bounds-check:end: +29042 # . restore registers +29043 5b/pop-to-ebx +29044 5a/pop-to-edx +29045 59/pop-to-ecx +29046 58/pop-to-eax +29047 # . epilogue +29048 89/<- %esp 5/r32/ebp +29049 5d/pop-to-ebp +29050 c3/return +29051 +29052 translate-mu-index-stmt-with-array-in-register: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +29053 # . prologue +29054 55/push-ebp +29055 89/<- %ebp 4/r32/esp +29056 # . save registers +29057 50/push-eax +29058 51/push-ecx +29059 52/push-edx +29060 53/push-ebx +29061 # +29062 (emit-indent *(ebp+8) *Curr-block-depth) +29063 (write-buffered *(ebp+8) "8d/copy-address *(") +29064 # TODO: ensure inouts[0] is in a register and not dereferenced +29065 $translate-mu-index-stmt-with-array-in-register:emit-base: +29066 # ecx = stmt +29067 8b/-> *(ebp+0xc) 1/r32/ecx +29068 # var base/ebx: (addr var) = inouts[0] +29069 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29070 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29071 89/<- %ebx 0/r32/eax +29072 # print base->register " + " +29073 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +29074 (write-buffered *(ebp+8) %eax) +29075 (write-buffered *(ebp+8) " + ") +29076 # var index/edx: (addr var) = inouts[1] +29077 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29078 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +29079 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29080 89/<- %edx 0/r32/eax +29081 # if index->register +29082 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register +29083 { +29084 0f 84/jump-if-= break/disp32 +29085 $translate-mu-index-stmt-with-array-in-register:emit-register-index: +29086 # if index is an int +29087 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +29088 (is-simple-mu-type? %eax 1) # int => eax +29089 3d/compare-eax-and 0/imm32/false +29090 { +29091 0f 84/jump-if-= break/disp32 +29092 $translate-mu-index-stmt-with-array-in-register:emit-int-register-index: +29093 # print index->register "<<" log2(array-element-size(base)) " + 4) " +29094 # . index->register "<<" +29095 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +29096 (write-buffered *(ebp+8) %eax) +29097 (write-buffered *(ebp+8) "<<") +29098 # . log2(array-element-size(base->type)) +29099 # we know size is a power of 2 +29100 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +29101 (num-shift-rights %eax) # => eax +29102 (write-int32-hex-buffered *(ebp+8) %eax) +29103 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-register-index-done/disp32 +29104 } +29105 # if index->type is any other atom, abort +29106 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +29107 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +29108 0f 85/jump-if-!= $translate-mu-index-stmt:error2/disp32 +29109 # if index has type (offset ...) +29110 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +29111 (is-simple-mu-type? %eax 7) # => eax +29112 3d/compare-eax-and 0/imm32/false +29113 { +29114 0f 84/jump-if-= break/disp32 +29115 # print index->register +29116 $translate-mu-index-stmt-with-array-in-register:emit-offset-register-index: +29117 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +29118 (write-buffered *(ebp+8) %eax) +29119 } +29120 $translate-mu-index-stmt-with-array-in-register:emit-register-index-done: +29121 (write-buffered *(ebp+8) " + 4) ") +29122 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 +29123 } +29124 # otherwise if index is a literal +29125 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +29126 (is-simple-mu-type? %eax 0) # => eax +29127 3d/compare-eax-and 0/imm32/false +29128 { +29129 0f 84/jump-if-= break/disp32 +29130 $translate-mu-index-stmt-with-array-in-register:emit-literal-index: +29131 # var index-value/edx: int = parse-hex-int(index->name) +29132 (lookup *edx *(edx+4)) # Var-name Var-name => eax +29133 (parse-hex-int %eax) # => eax +29134 89/<- %edx 0/r32/eax +29135 # offset = idx-value * array-element-size(base->type) +29136 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +29137 f7 4/subop/multiply-into-edx-eax %edx # clobbers edx +29138 # offset += 4 for array size +29139 05/add-to-eax 4/imm32 +29140 # TODO: check edx for overflow +29141 # print offset +29142 (write-int32-hex-buffered *(ebp+8) %eax) +29143 (write-buffered *(ebp+8) ") ") +29144 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 +29145 } +29146 # otherwise abort +29147 e9/jump $translate-mu-index-stmt:error1/disp32 +29148 $translate-mu-index-stmt-with-array-in-register:emit-output: +29149 # outputs[0] "/r32" +29150 8b/-> *(ebp+0xc) 1/r32/ecx +29151 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +29152 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29153 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +29154 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) +29155 (write-int32-hex-buffered *(ebp+8) *eax) +29156 (write-buffered *(ebp+8) "/r32\n") +29157 $translate-mu-index-stmt-with-array-in-register:end: +29158 # . restore registers +29159 5b/pop-to-ebx +29160 5a/pop-to-edx +29161 59/pop-to-ecx +29162 58/pop-to-eax +29163 # . epilogue +29164 89/<- %esp 5/r32/ebp +29165 5d/pop-to-ebp +29166 c3/return +29167 +29168 translate-mu-index-stmt-with-array-on-stack: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +29169 # . prologue +29170 55/push-ebp +29171 89/<- %ebp 4/r32/esp +29172 # . save registers +29173 50/push-eax +29174 51/push-ecx +29175 52/push-edx +29176 53/push-ebx +29177 # +29178 (emit-indent *(ebp+8) *Curr-block-depth) +29179 (write-buffered *(ebp+8) "8d/copy-address *(ebp + ") +29180 # var curr/edx: (addr stmt-var) = lookup(stmt->inouts) +29181 8b/-> *(ebp+0xc) 0/r32/eax +29182 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29183 89/<- %edx 0/r32/eax +29184 # var base/ecx: (addr var) = lookup(curr->value) +29185 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29186 89/<- %ecx 0/r32/eax +29187 # var curr2/eax: (addr stmt-var) = lookup(curr->next) +29188 (lookup *(edx+8) *(edx+0xc)) # Stmt-var-next Stmt-var-next => eax +29189 # var index/edx: (handle var) = curr2->value +29190 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29191 89/<- %edx 0/r32/eax +29192 # if index->register +29193 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register +29194 { +29195 0f 84/jump-if-= break/disp32 +29196 $translate-mu-index-stmt-with-array-on-stack:emit-register-index: +29197 # if index is an int +29198 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +29199 (is-simple-mu-type? %eax 1) # int => eax +29200 3d/compare-eax-and 0/imm32/false +29201 { +29202 0f 84/jump-if-= break/disp32 +29203 $translate-mu-index-stmt-with-array-on-stack:emit-int-register-index: +29204 # print index->register "<<" log2(array-element-size(base)) " + " base->offset+4 +29205 # . inouts[1]->register "<<" +29206 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +29207 (write-buffered *(ebp+8) %eax) +29208 (write-buffered *(ebp+8) "<<") +29209 # . log2(array-element-size(base)) +29210 # TODO: ensure size is a power of 2 +29211 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax +29212 (num-shift-rights %eax) # => eax +29213 (write-int32-hex-buffered *(ebp+8) %eax) +29214 # +29215 (write-buffered *(ebp+8) " + ") +29216 # +29217 8b/-> *(ecx+0x14) 0/r32/eax # Var-offset +29218 05/add-to-eax 4/imm32 # for array length +29219 (write-int32-hex-buffered *(ebp+8) %eax) +29220 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done/disp32 +29221 } +29222 # if index->type is any other atom, abort +29223 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +29224 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +29225 0f 85/jump-if-!= $translate-mu-index-stmt:error2/disp32 +29226 # if index has type (offset ...) +29227 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +29228 (is-simple-mu-type? %eax 7) # => eax +29229 3d/compare-eax-and 0/imm32/false +29230 { +29231 0f 84/jump-if-= break/disp32 +29232 # print index->register +29233 $translate-mu-index-stmt-with-array-on-stack:emit-offset-register-index: +29234 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +29235 (write-buffered *(ebp+8) %eax) +29236 } +29237 $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done: +29238 (write-buffered *(ebp+8) ") ") +29239 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 +29240 } +29241 # otherwise if index is a literal +29242 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +29243 (is-simple-mu-type? %eax 0) # => eax +29244 3d/compare-eax-and 0/imm32/false +29245 { +29246 0f 84/jump-if-= break/disp32 +29247 $translate-mu-index-stmt-with-array-on-stack:emit-literal-index: +29248 # var idx-value/edx: int = parse-hex-int(index->name) +29249 (lookup *edx *(edx+4)) # Var-name Var-name => eax +29250 (parse-hex-int %eax) # Var-name => eax +29251 89/<- %edx 0/r32/eax +29252 # offset = idx-value * array-element-size(base) +29253 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax +29254 f7 4/subop/multiply-into-edx-eax %edx # clobbers edx +29255 # offset += base->offset +29256 03/add *(ecx+0x14) 0/r32/eax # Var-offset +29257 # offset += 4 for array size +29258 05/add-to-eax 4/imm32 +29259 # TODO: check edx for overflow +29260 # print offset +29261 (write-int32-hex-buffered *(ebp+8) %eax) +29262 (write-buffered *(ebp+8) ") ") +29263 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 +29264 } +29265 # otherwise abort +29266 e9/jump $translate-mu-index-stmt:error1/disp32 +29267 $translate-mu-index-stmt-with-array-on-stack:emit-output: +29268 # outputs[0] "/r32" +29269 8b/-> *(ebp+0xc) 0/r32/eax +29270 (lookup *(eax+0x14) *(eax+0x18)) # Stmt1-outputs Stmt1-outputs => eax +29271 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29272 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +29273 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) +29274 (write-int32-hex-buffered *(ebp+8) *eax) +29275 (write-buffered *(ebp+8) "/r32\n") +29276 $translate-mu-index-stmt-with-array-on-stack:end: +29277 # . restore registers +29278 5b/pop-to-ebx +29279 5a/pop-to-edx +29280 59/pop-to-ecx +29281 58/pop-to-eax +29282 # . epilogue +29283 89/<- %esp 5/r32/ebp +29284 5d/pop-to-ebp +29285 c3/return +29286 +29287 translate-mu-compute-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +29288 # . prologue +29289 55/push-ebp +29290 89/<- %ebp 4/r32/esp +29291 # . save registers +29292 50/push-eax +29293 51/push-ecx +29294 52/push-edx +29295 53/push-ebx +29296 # +29297 (emit-indent *(ebp+8) *Curr-block-depth) +29298 (write-buffered *(ebp+8) "69/multiply") +29299 # ecx = stmt +29300 8b/-> *(ebp+0xc) 1/r32/ecx +29301 # var first-inout/ebx: (addr stmt-var) = stmt->inouts[0] +29302 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29303 89/<- %ebx 0/r32/eax +29304 $translate-mu-compute-index-stmt:emit-index: +29305 (lookup *(ebx+8) *(ebx+0xc)) # Stmt-var-next Stmt-var-next => eax +29306 (emit-subx-var-as-rm32 *(ebp+8) %eax) +29307 (write-buffered *(ebp+8) Space) +29308 $translate-mu-compute-index-stmt:emit-elem-size: +29309 # var base/ebx: (addr var) +29310 (lookup *ebx *(ebx+4)) # Stmt-var-value Stmt-var-value => eax +29311 89/<- %ebx 0/r32/eax +29312 # print array-element-size(base) +29313 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +29314 (write-int32-hex-buffered *(ebp+8) %eax) +29315 (write-buffered *(ebp+8) "/imm32 ") +29316 $translate-mu-compute-index-stmt:emit-output: +29317 # outputs[0] "/r32" +29318 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +29319 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29320 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +29321 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) +29322 (write-int32-hex-buffered *(ebp+8) *eax) +29323 (write-buffered *(ebp+8) "/r32\n") +29324 $translate-mu-compute-index-stmt:end: +29325 # . restore registers +29326 5b/pop-to-ebx +29327 5a/pop-to-edx +29328 59/pop-to-ecx +29329 58/pop-to-eax +29330 # . epilogue +29331 89/<- %esp 5/r32/ebp +29332 5d/pop-to-ebp +29333 c3/return +29334 +29335 translate-mu-get-stmt: # out: (addr buffered-file), stmt: (addr stmt) +29336 # . prologue +29337 55/push-ebp +29338 89/<- %ebp 4/r32/esp +29339 # . save registers +29340 50/push-eax +29341 51/push-ecx +29342 52/push-edx +29343 # +29344 (emit-indent *(ebp+8) *Curr-block-depth) +29345 (write-buffered *(ebp+8) "8d/copy-address ") +29346 # ecx = stmt +29347 8b/-> *(ebp+0xc) 1/r32/ecx +29348 # var offset/edx: int = get offset of stmt +29349 (mu-get-offset %ecx) # => eax +29350 89/<- %edx 0/r32/eax +29351 # var base/eax: (addr var) = stmt->inouts->value +29352 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29353 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29354 # if base is in a register +29355 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +29356 { +29357 0f 84/jump-if-= break/disp32 +29358 $translate-mu-get-stmt:emit-register-input: +29359 # emit "*(" base->register " + " offset ") " +29360 (write-buffered *(ebp+8) "*(") +29361 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +29362 (write-buffered *(ebp+8) %eax) +29363 (write-buffered *(ebp+8) " + ") +29364 (write-int32-hex-buffered *(ebp+8) %edx) +29365 (write-buffered *(ebp+8) ") ") +29366 e9/jump $translate-mu-get-stmt:emit-output/disp32 +29367 } +29368 # otherwise base is on the stack +29369 { +29370 $translate-mu-get-stmt:emit-stack-input: +29371 # emit "*(ebp + " inouts[0]->stack-offset + offset ") " +29372 (write-buffered *(ebp+8) "*(ebp+") +29373 03/add *(eax+0x14) 2/r32/edx # Var-offset +29374 (write-int32-hex-buffered *(ebp+8) %edx) +29375 (write-buffered *(ebp+8) ") ") +29376 eb/jump $translate-mu-get-stmt:emit-output/disp8 +29377 } +29378 $translate-mu-get-stmt:emit-output: +29379 # var output/eax: (addr var) = stmt->outputs->value +29380 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +29381 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29382 # emit offset->register "/r32" +29383 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +29384 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) +29385 (write-int32-hex-buffered *(ebp+8) *eax) +29386 (write-buffered *(ebp+8) "/r32\n") +29387 $translate-mu-get-stmt:end: +29388 # . restore registers +29389 5a/pop-to-edx +29390 59/pop-to-ecx +29391 58/pop-to-eax +29392 # . epilogue +29393 89/<- %esp 5/r32/ebp +29394 5d/pop-to-ebp +29395 c3/return +29396 +29397 translate-mu-copy-object-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +29398 # . prologue +29399 55/push-ebp +29400 89/<- %ebp 4/r32/esp +29401 # . save registers +29402 50/push-eax +29403 # +29404 (emit-indent *(ebp+8) *Curr-block-depth) +29405 (write-buffered *(ebp+8) "(copy-bytes") +29406 # eax = stmt +29407 8b/-> *(ebp+0xc) 0/r32/eax +29408 # var first-inout/eax: (addr stmt-var) = stmt->inouts[0] +29409 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29410 (emit-subx-call-operand *(ebp+8) %eax) +29411 # var second-inout/eax: (addr stmt-var) = stmt->inouts[1] +29412 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +29413 (emit-subx-call-operand *(ebp+8) %eax) +29414 # emit size of inouts +29415 (write-buffered *(ebp+8) Space) +29416 (addr-payload-size %eax *(ebp+0x10) *(ebp+0x14)) # => eax +29417 (write-int32-hex-buffered *(ebp+8) %eax) +29418 (write-buffered *(ebp+8) ")\n") +29419 $translate-mu-copy-object-stmt:end: +29420 # . restore registers +29421 58/pop-to-eax +29422 # . epilogue +29423 89/<- %esp 5/r32/ebp +29424 5d/pop-to-ebp +29425 c3/return +29426 +29427 translate-mu-clear-object-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +29428 # . prologue +29429 55/push-ebp +29430 89/<- %ebp 4/r32/esp +29431 # . save registers +29432 50/push-eax +29433 # +29434 (emit-indent *(ebp+8) *Curr-block-depth) +29435 (write-buffered *(ebp+8) "(zero-out") +29436 # eax = stmt +29437 8b/-> *(ebp+0xc) 0/r32/eax +29438 # var dest/eax: (addr stmt-var) = stmt->inouts[0] +29439 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29440 # +29441 (emit-subx-call-operand *(ebp+8) %eax) +29442 (write-buffered *(ebp+8) Space) +29443 (addr-payload-size %eax *(ebp+0x10) *(ebp+0x14)) # => eax +29444 (write-int32-hex-buffered *(ebp+8) %eax) +29445 (write-buffered *(ebp+8) ")\n") +29446 $translate-mu-clear-object-stmt:end: +29447 # . restore registers +29448 58/pop-to-eax +29449 # . epilogue +29450 89/<- %esp 5/r32/ebp +29451 5d/pop-to-ebp +29452 c3/return +29453 +29454 translate-mu-allocate-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +29455 # . prologue +29456 55/push-ebp +29457 89/<- %ebp 4/r32/esp +29458 # . save registers +29459 50/push-eax +29460 56/push-esi +29461 57/push-edi +29462 # esi = stmt +29463 8b/-> *(ebp+0xc) 6/r32/esi +29464 # var target/edi: (addr stmt-var) = stmt->inouts[0] +29465 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29466 89/<- %edi 0/r32/eax +29467 # +29468 (emit-indent *(ebp+8) *Curr-block-depth) +29469 (write-buffered *(ebp+8) "(allocate Heap ") +29470 (addr-handle-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax +29471 (write-int32-hex-buffered *(ebp+8) %eax) +29472 (emit-subx-call-operand *(ebp+8) %edi) +29473 (write-buffered *(ebp+8) ")\n") +29474 $translate-mu-allocate-stmt:end: +29475 # . restore registers +29476 5f/pop-to-edi +29477 5e/pop-to-esi +29478 58/pop-to-eax +29479 # . epilogue +29480 89/<- %esp 5/r32/ebp +29481 5d/pop-to-ebp +29482 c3/return +29483 +29484 addr-handle-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +29485 # . prologue +29486 55/push-ebp +29487 89/<- %ebp 4/r32/esp +29488 # var t/eax: (addr type-tree) = s->value->type +29489 8b/-> *(ebp+8) 0/r32/eax +29490 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29491 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +29492 # TODO: check eax != 0 +29493 # TODO: check !t->is-atom? +29494 # TODO: check t->left == addr +29495 # t = t->right +29496 $addr-handle-payload-size:skip-addr: +29497 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +29498 # TODO: check eax != 0 +29499 # TODO: check !t->is-atom? +29500 # TODO: check t->left == handle +29501 # t = t->right +29502 $addr-handle-payload-size:skip-handle: +29503 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +29504 # TODO: check eax != 0 +29505 # if !t->is-atom? t = t->left +29506 81 7/subop/compare *eax 0/imm32/false +29507 { +29508 75/jump-if-!= break/disp8 +29509 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +29510 } +29511 # TODO: check t->is-atom? +29512 # return size(t->value) +29513 (size-of-type-id *(eax+4)) # Type-tree-value => eax +29514 $addr-handle-payload-size:end: +29515 # . epilogue +29516 89/<- %esp 5/r32/ebp +29517 5d/pop-to-ebp +29518 c3/return +29519 +29520 addr-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +29521 # . prologue +29522 55/push-ebp +29523 89/<- %ebp 4/r32/esp +29524 # var t/eax: (addr type-tree) = s->value->type +29525 8b/-> *(ebp+8) 0/r32/eax +29526 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29527 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +29528 # TODO: check eax != 0 +29529 # TODO: check !t->is-atom? +29530 # TODO: check t->left == addr +29531 # t = t->right +29532 $addr-payload-size:skip-addr: +29533 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +29534 # TODO: check eax != 0 +29535 # if !t->is-atom? t = t->left +29536 81 7/subop/compare *eax 0/imm32/false +29537 { +29538 75/jump-if-!= break/disp8 +29539 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +29540 } +29541 # TODO: check t->is-atom? +29542 # return size(t->value) +29543 (size-of-type-id *(eax+4)) # Type-tree-value => eax +29544 $addr-payload-size:end: +29545 # . epilogue +29546 89/<- %esp 5/r32/ebp +29547 5d/pop-to-ebp +29548 c3/return +29549 +29550 translate-mu-populate-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +29551 # . prologue +29552 55/push-ebp +29553 89/<- %ebp 4/r32/esp +29554 # . save registers +29555 50/push-eax +29556 51/push-ecx +29557 56/push-esi +29558 57/push-edi +29559 # esi = stmt +29560 8b/-> *(ebp+0xc) 6/r32/esi +29561 # var target/edi: (addr stmt-var) = stmt->inouts[0] +29562 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29563 89/<- %edi 0/r32/eax +29564 # var len/ecx: (addr stmt-var) = stmt->inouts[1] +29565 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +29566 89/<- %ecx 0/r32/eax +29567 # +29568 (emit-indent *(ebp+8) *Curr-block-depth) +29569 (write-buffered *(ebp+8) "(allocate-array2 Heap ") +29570 (addr-handle-array-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax +29571 (write-int32-hex-buffered *(ebp+8) %eax) +29572 (emit-subx-call-operand *(ebp+8) %ecx) +29573 (emit-subx-call-operand *(ebp+8) %edi) +29574 (write-buffered *(ebp+8) ")\n") +29575 $translate-mu-populate-stmt:end: +29576 # . restore registers +29577 5f/pop-to-edi +29578 5e/pop-to-esi +29579 59/pop-to-ecx +29580 58/pop-to-eax +29581 # . epilogue +29582 89/<- %esp 5/r32/ebp +29583 5d/pop-to-ebp +29584 c3/return +29585 +29586 translate-mu-populate-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +29587 # . prologue +29588 55/push-ebp +29589 89/<- %ebp 4/r32/esp +29590 # . save registers +29591 50/push-eax +29592 51/push-ecx +29593 56/push-esi +29594 57/push-edi +29595 # esi = stmt +29596 8b/-> *(ebp+0xc) 6/r32/esi +29597 # var target/edi: (addr stmt-var) = stmt->inouts[0] +29598 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29599 89/<- %edi 0/r32/eax +29600 # var len/ecx: (addr stmt-var) = stmt->inouts[1] +29601 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +29602 89/<- %ecx 0/r32/eax +29603 # +29604 (emit-indent *(ebp+8) *Curr-block-depth) +29605 (write-buffered *(ebp+8) "(new-stream Heap ") +29606 (addr-handle-stream-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax +29607 (write-int32-hex-buffered *(ebp+8) %eax) +29608 (emit-subx-call-operand *(ebp+8) %ecx) +29609 (emit-subx-call-operand *(ebp+8) %edi) +29610 (write-buffered *(ebp+8) ")\n") +29611 $translate-mu-populate-stream-stmt:end: +29612 # . restore registers +29613 5f/pop-to-edi +29614 5e/pop-to-esi +29615 59/pop-to-ecx +29616 58/pop-to-eax +29617 # . epilogue +29618 89/<- %esp 5/r32/ebp +29619 5d/pop-to-ebp +29620 c3/return +29621 +29622 translate-mu-read-from-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +29623 # . prologue +29624 55/push-ebp +29625 89/<- %ebp 4/r32/esp +29626 # . save registers +29627 50/push-eax +29628 51/push-ecx +29629 56/push-esi +29630 57/push-edi +29631 # esi = stmt +29632 8b/-> *(ebp+0xc) 6/r32/esi +29633 # var stream/ecx: (addr stmt-var) = stmt->inouts[0] +29634 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29635 89/<- %ecx 0/r32/eax +29636 # var target/edi: (addr stmt-var) = stmt->inouts[1] +29637 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax +29638 89/<- %edi 0/r32/eax +29639 # +29640 (emit-indent *(ebp+8) *Curr-block-depth) +29641 (write-buffered *(ebp+8) "(read-from-stream") +29642 (emit-subx-call-operand *(ebp+8) %ecx) +29643 (emit-subx-call-operand *(ebp+8) %edi) +29644 (write-buffered *(ebp+8) Space) +29645 (addr-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax +29646 (write-int32-hex-buffered *(ebp+8) %eax) +29647 (write-buffered *(ebp+8) ")\n") +29648 $translate-mu-read-from-stream-stmt:end: +29649 # . restore registers +29650 5f/pop-to-edi +29651 5e/pop-to-esi +29652 59/pop-to-ecx +29653 58/pop-to-eax +29654 # . epilogue +29655 89/<- %esp 5/r32/ebp +29656 5d/pop-to-ebp +29657 c3/return +29658 +29659 translate-mu-write-to-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +29660 # . prologue +29661 55/push-ebp +29662 89/<- %ebp 4/r32/esp +29663 # . save registers +29664 50/push-eax +29665 51/push-ecx +29666 56/push-esi +29667 57/push-edi +29668 # esi = stmt +29669 8b/-> *(ebp+0xc) 6/r32/esi +29670 # var stream/ecx: (addr stmt-var) = stmt->inouts[0] +29671 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29672 89/<- %ecx 0/r32/eax +29673 # var target/edi: (addr stmt-var) = stmt->inouts[1] +29674 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax +29675 89/<- %edi 0/r32/eax +29676 # +29677 (emit-indent *(ebp+8) *Curr-block-depth) +29678 (write-buffered *(ebp+8) "(write-to-stream") +29679 (emit-subx-call-operand *(ebp+8) %ecx) +29680 (flush *(ebp+8)) +29681 (emit-subx-call-operand *(ebp+8) %edi) +29682 (flush *(ebp+8)) +29683 (write-buffered *(ebp+8) Space) +29684 (flush *(ebp+8)) +29685 (addr-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax +29686 (write-int32-hex-buffered *(ebp+8) %eax) +29687 (write-buffered *(ebp+8) ")\n") +29688 $translate-mu-write-to-stream-stmt:end: +29689 # . restore registers +29690 5f/pop-to-edi +29691 5e/pop-to-esi +29692 59/pop-to-ecx +29693 58/pop-to-eax +29694 # . epilogue +29695 89/<- %esp 5/r32/ebp +29696 5d/pop-to-ebp +29697 c3/return +29698 +29699 addr-handle-array-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +29700 # . prologue +29701 55/push-ebp +29702 89/<- %ebp 4/r32/esp +29703 # var t/eax: (addr type-tree) = s->value->type +29704 8b/-> *(ebp+8) 0/r32/eax +29705 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29706 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +29707 # TODO: check eax != 0 +29708 # TODO: check !t->is-atom? +29709 # TODO: check t->left == addr +29710 # t = t->right +29711 $addr-handle-array-payload-size:skip-addr: +29712 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +29713 # TODO: check eax != 0 +29714 # TODO: check !t->is-atom? +29715 # TODO: check t->left == handle +29716 # t = t->right +29717 $addr-handle-array-payload-size:skip-handle: +29718 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +29719 # TODO: check eax != 0 +29720 # TODO: check !t->is-atom? +29721 # TODO: check t->left == array +29722 # t = t->right +29723 $addr-handle-array-payload-size:skip-array: +29724 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +29725 # TODO: check eax != 0 +29726 # if !t->is-atom? t = t->left +29727 81 7/subop/compare *eax 0/imm32/false +29728 { +29729 75/jump-if-!= break/disp8 +29730 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +29731 } +29732 $addr-handle-array-payload-size:compute-size: +29733 # TODO: check t->is-atom? +29734 # return size(t->value) +29735 (size-of-type-id-as-array-element *(eax+4)) # Type-tree-value => eax +29736 $addr-handle-array-payload-size:end: +29737 # . epilogue +29738 89/<- %esp 5/r32/ebp +29739 5d/pop-to-ebp +29740 c3/return +29741 +29742 addr-handle-stream-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +29743 # . prologue +29744 55/push-ebp +29745 89/<- %ebp 4/r32/esp +29746 # var t/eax: (addr type-tree) = s->value->type +29747 8b/-> *(ebp+8) 0/r32/eax +29748 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29749 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +29750 # TODO: check eax != 0 +29751 # TODO: check !t->is-atom? +29752 # TODO: check t->left == addr +29753 # t = t->right +29754 $addr-handle-stream-payload-size:skip-addr: +29755 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +29756 # TODO: check eax != 0 +29757 # TODO: check !t->is-atom? +29758 # TODO: check t->left == handle +29759 # t = t->right +29760 $addr-handle-stream-payload-size:skip-handle: +29761 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +29762 # TODO: check eax != 0 +29763 # TODO: check !t->is-atom? +29764 # TODO: check t->left == stream +29765 # t = t->right +29766 $addr-handle-stream-payload-size:skip-stream: +29767 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +29768 # TODO: check eax != 0 +29769 # if !t->is-atom? t = t->left +29770 81 7/subop/compare *eax 0/imm32/false +29771 { +29772 75/jump-if-!= break/disp8 +29773 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +29774 } +29775 $addr-handle-stream-payload-size:compute-size: +29776 # TODO: check t->is-atom? +29777 # return size(t->value) +29778 (size-of-type-id-as-array-element *(eax+4)) # Type-tree-value => eax +29779 $addr-handle-stream-payload-size:end: +29780 # . epilogue +29781 89/<- %esp 5/r32/ebp +29782 5d/pop-to-ebp +29783 c3/return +29784 +29785 power-of-2?: # n: int, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: boolean +29786 # precondition: n is positive +29787 # . prologue +29788 55/push-ebp +29789 89/<- %ebp 4/r32/esp +29790 # eax = n +29791 8b/-> *(ebp+8) 0/r32/eax +29792 # if (n < 0) abort +29793 3d/compare-eax-with 0/imm32 +29794 0f 8c/jump-if-< $power-of-2?:abort/disp32 +29795 # var tmp/eax: int = n-1 +29796 48/decrement-eax +29797 # var tmp2/eax: int = n & tmp +29798 23/and-> *(ebp+8) 0/r32/eax +29799 # return (tmp2 == 0) +29800 3d/compare-eax-and 0/imm32 +29801 0f 94/set-byte-if-= %al +29802 81 4/subop/and %eax 0xff/imm32 +29803 $power-of-2?:end: +29804 # . epilogue +29805 89/<- %esp 5/r32/ebp +29806 5d/pop-to-ebp +29807 c3/return +29808 +29809 $power-of-2?:abort: +29810 (write-buffered *(ebp+0xc) "power-of-2?: negative number\n") +29811 (flush *(ebp+0xc)) +29812 (stop *(ebp+0x10) 1) +29813 # never gets here +29814 +29815 num-shift-rights: # n: int -> result/eax: int +29816 # precondition: n is a positive power of 2 +29817 # . prologue +29818 55/push-ebp +29819 89/<- %ebp 4/r32/esp +29820 # . save registers +29821 51/push-ecx +29822 # var curr/ecx: int = n +29823 8b/-> *(ebp+8) 1/r32/ecx +29824 # result = 0 +29825 b8/copy-to-eax 0/imm32 +29826 { +29827 # if (curr <= 1) break +29828 81 7/subop/compare %ecx 1/imm32 +29829 7e/jump-if-<= break/disp8 +29830 40/increment-eax +29831 c1/shift 5/subop/arithmetic-right %ecx 1/imm8 +29832 eb/jump loop/disp8 +29833 } +29834 $num-shift-rights:end: +29835 # . restore registers +29836 59/pop-to-ecx +29837 # . epilogue +29838 89/<- %esp 5/r32/ebp +29839 5d/pop-to-ebp +29840 c3/return +29841 +29842 mu-get-offset: # stmt: (addr stmt) -> result/eax: int +29843 # . prologue +29844 55/push-ebp +29845 89/<- %ebp 4/r32/esp +29846 # var second-inout/eax: (addr stmt-var) = stmt->inouts->next +29847 8b/-> *(ebp+8) 0/r32/eax +29848 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +29849 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +29850 # var output-var/eax: (addr var) = second-inout->value +29851 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +29852 #? (write-buffered Stderr "mu-get-offset: ") +29853 #? (write-int32-hex-buffered Stderr %eax) +29854 #? (write-buffered Stderr " name: ") +29855 #? 50/push-eax +29856 #? (lookup *eax *(eax+4)) # Var-name +29857 #? (write-buffered Stderr %eax) +29858 #? 58/pop-to-eax +29859 #? (write-buffered Stderr Newline) +29860 #? (flush Stderr) +29861 # return output-var->stack-offset +29862 8b/-> *(eax+0x14) 0/r32/eax # Var-offset +29863 #? (write-buffered Stderr "=> ") +29864 #? (write-int32-hex-buffered Stderr %eax) +29865 #? (write-buffered Stderr Newline) +29866 #? (flush Stderr) +29867 $emit-get-offset:end: +29868 # . epilogue +29869 89/<- %esp 5/r32/ebp +29870 5d/pop-to-ebp +29871 c3/return +29872 +29873 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) +29874 # . prologue +29875 55/push-ebp +29876 89/<- %ebp 4/r32/esp +29877 # . save registers +29878 50/push-eax +29879 51/push-ecx +29880 56/push-esi +29881 # esi = block +29882 8b/-> *(ebp+0xc) 6/r32/esi +29883 # block->var->block-depth = *Curr-block-depth +29884 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax +29885 8b/-> *Curr-block-depth 1/r32/ecx +29886 89/<- *(eax+0x10) 1/r32/ecx # Var-block-depth +29887 # var stmts/eax: (addr list stmt) = lookup(block->statements) +29888 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax +29889 # +29890 { +29891 $emit-subx-block:check-empty: +29892 3d/compare-eax-and 0/imm32 +29893 0f 84/jump-if-= break/disp32 +29894 (emit-indent *(ebp+8) *Curr-block-depth) +29895 (write-buffered *(ebp+8) "{\n") +29896 # var v/ecx: (addr var) = lookup(block->var) +29897 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax +29898 89/<- %ecx 0/r32/eax +29899 # +29900 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +29901 (write-buffered *(ebp+8) %eax) +29902 (write-buffered *(ebp+8) ":loop:\n") +29903 ff 0/subop/increment *Curr-block-depth +29904 (push *(ebp+0x10) *(esi+0xc)) # Block-var +29905 (push *(ebp+0x10) *(esi+0x10)) # Block-var +29906 (push *(ebp+0x10) 0) # false +29907 # emit block->statements +29908 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax +29909 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +29910 (pop *(ebp+0x10)) # => eax +29911 (pop *(ebp+0x10)) # => eax +29912 (pop *(ebp+0x10)) # => eax +29913 ff 1/subop/decrement *Curr-block-depth +29914 (emit-indent *(ebp+8) *Curr-block-depth) +29915 (write-buffered *(ebp+8) "}\n") +29916 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +29917 (write-buffered *(ebp+8) %eax) +29918 (write-buffered *(ebp+8) ":break:\n") +29919 } +29920 $emit-subx-block:end: +29921 # . restore registers +29922 5e/pop-to-esi +29923 59/pop-to-ecx +29924 58/pop-to-eax +29925 # . epilogue +29926 89/<- %esp 5/r32/ebp +29927 5d/pop-to-ebp +29928 c3/return +29929 +29930 # Primitives supported +29931 # See mu_instructions for a summary of this linked-list data structure. +29932 # +29933 # For each operation, put variants with hard-coded registers before flexible ones. +29934 # +29935 # Unfortunately, our restrictions on addresses require that various fields in +29936 # primitives be handles, which complicates these definitions. +29937 # - we need to insert dummy fields all over the place for fake alloc-ids +29938 # - we can't use our syntax sugar of quoted literals for string fields +29939 # +29940 # Fake alloc-ids are needed because our type definitions up top require +29941 # handles but it's clearer to statically allocate these long-lived objects. +29942 # Fake alloc-ids are perfectly safe, but they can't be reclaimed. +29943 # +29944 # Every 'object' below starts with a fake alloc-id. It may also contain other +29945 # fake alloc-ids for various handle fields. +29946 # +29947 # I think of objects starting with a fake alloc-id as having type 'payload'. +29948 # It's not really intended to be created dynamically; for that use `allocate` +29949 # as usual. +29950 # +29951 # Idea for a notation to simplify such definitions: +29952 # _Primitive-increment-eax: # (payload primitive) +29953 # 0x11/alloc-id:fake:payload +29954 # 0x11 @(0x11 "increment") # name +29955 # 0 0 # inouts +29956 # 0x11 @(0x11/payload +29957 # 0x11 @(0x11/payload # List-value +29958 # 0 0 # Var-name +29959 # 0x11 @(0x11 # Var-type +29960 # 1/is-atom +29961 # 1/value 0/unused # Type-tree-left +29962 # 0 0 # Type-tree-right +29963 # ) +29964 # 1 # block-depth +29965 # 0 # stack-offset +29966 # 0x11 @(0x11 "eax") # Var-register +29967 # ) +29968 # 0 0) # List-next +29969 # ... +29970 # _Primitive-increment-ecx/imm32/next +29971 # ... +29972 # Awfully complex and non-obvious. But also clearly signals there's something +29973 # to learn here, so may be worth trying. +29974 # +29975 # '@' is just an initial thought. Punctuation used so far in Mu: () * % # / " +29976 # +29977 # For now we'll continue to just use comments and manually ensure they stay up +29978 # to date. +29979 == data +29980 Primitives: # (addr primitive) +29981 # - increment/decrement +29982 _Primitive-increment-eax: # (addr primitive) +29983 # var/eax <- increment => 40/increment-eax +29984 0x11/imm32/alloc-id:fake +29985 _string-increment/imm32/name +29986 0/imm32/no-inouts +29987 0/imm32/no-inouts +29988 0x11/imm32/alloc-id:fake +29989 Single-int-var-in-eax/imm32/outputs +29990 0x11/imm32/alloc-id:fake +29991 _string_40_increment_eax/imm32/subx-name +29992 0/imm32/no-rm32 +29993 0/imm32/no-r32 +29994 0/imm32/no-imm32 +29995 0/imm32/no-imm8 +29996 0/imm32/no-disp32 +29997 0/imm32/no-xm32 +29998 0/imm32/no-x32 29999 0x11/imm32/alloc-id:fake -30000 _string-compare/imm32/name -30001 0x11/imm32/alloc-id:fake -30002 Two-args-int-eax-int-literal/imm32/inouts -30003 0/imm32/no-outputs -30004 0/imm32/no-outputs -30005 0x11/imm32/alloc-id:fake -30006 _string_3d_compare_eax_with/imm32/subx-name -30007 0/imm32/no-rm32 -30008 0/imm32/no-r32 -30009 2/imm32/imm32-is-second-inout -30010 0/imm32/no-imm8 -30011 0/imm32/no-disp32 -30012 0/imm32/no-xm32 -30013 0/imm32/no-x32 -30014 0x11/imm32/alloc-id:fake -30015 _Primitive-compare-reg-with-literal/imm32/next -30016 _Primitive-compare-reg-with-literal: # (payload primitive) -30017 0x11/imm32/alloc-id:fake:payload -30018 # compare var1/reg n => 81 7/subop/compare %reg n/imm32 +30000 _Primitive-increment-ecx/imm32/next +30001 _Primitive-increment-ecx: # (payload primitive) +30002 0x11/imm32/alloc-id:fake:payload +30003 # var/ecx <- increment => 41/increment-ecx +30004 0x11/imm32/alloc-id:fake +30005 _string-increment/imm32/name +30006 0/imm32/no-inouts +30007 0/imm32/no-inouts +30008 0x11/imm32/alloc-id:fake +30009 Single-int-var-in-ecx/imm32/outputs +30010 0x11/imm32/alloc-id:fake +30011 _string_41_increment_ecx/imm32/subx-name +30012 0/imm32/no-rm32 +30013 0/imm32/no-r32 +30014 0/imm32/no-imm32 +30015 0/imm32/no-imm8 +30016 0/imm32/no-disp32 +30017 0/imm32/no-xm32 +30018 0/imm32/no-x32 30019 0x11/imm32/alloc-id:fake -30020 _string-compare/imm32/name -30021 0x11/imm32/alloc-id:fake -30022 Int-var-in-register-and-literal/imm32/inouts -30023 0/imm32/no-outputs -30024 0/imm32/no-outputs -30025 0x11/imm32/alloc-id:fake -30026 _string_81_subop_compare/imm32/subx-name -30027 1/imm32/rm32-is-first-inout -30028 0/imm32/no-r32 -30029 2/imm32/imm32-is-second-inout -30030 0/imm32/no-imm8 -30031 0/imm32/no-disp32 -30032 0/imm32/no-xm32 -30033 0/imm32/no-x32 -30034 0x11/imm32/alloc-id:fake -30035 _Primitive-compare-mem-with-literal/imm32/next -30036 _Primitive-compare-mem-with-literal: # (payload primitive) -30037 0x11/imm32/alloc-id:fake:payload -30038 # compare var1 n => 81 7/subop/compare *(ebp+___) n/imm32 +30020 _Primitive-increment-edx/imm32/next +30021 _Primitive-increment-edx: # (payload primitive) +30022 0x11/imm32/alloc-id:fake:payload +30023 # var/edx <- increment => 42/increment-edx +30024 0x11/imm32/alloc-id:fake +30025 _string-increment/imm32/name +30026 0/imm32/no-inouts +30027 0/imm32/no-inouts +30028 0x11/imm32/alloc-id:fake +30029 Single-int-var-in-edx/imm32/outputs +30030 0x11/imm32/alloc-id:fake +30031 _string_42_increment_edx/imm32/subx-name +30032 0/imm32/no-rm32 +30033 0/imm32/no-r32 +30034 0/imm32/no-imm32 +30035 0/imm32/no-imm8 +30036 0/imm32/no-disp32 +30037 0/imm32/no-xm32 +30038 0/imm32/no-x32 30039 0x11/imm32/alloc-id:fake -30040 _string-compare/imm32/name -30041 0x11/imm32/alloc-id:fake -30042 Int-var-and-literal/imm32/inouts -30043 0/imm32/no-outputs -30044 0/imm32/no-outputs -30045 0x11/imm32/alloc-id:fake -30046 _string_81_subop_compare/imm32/subx-name -30047 1/imm32/rm32-is-first-inout -30048 0/imm32/no-r32 -30049 2/imm32/imm32-is-second-inout -30050 0/imm32/no-imm8 -30051 0/imm32/no-disp32 -30052 0/imm32/no-xm32 -30053 0/imm32/no-x32 -30054 0x11/imm32/alloc-id:fake -30055 _Primitive-negate-reg/imm32/next -30056 # - negate -30057 _Primitive-negate-reg: # (payload primitive) -30058 0x11/imm32/alloc-id:fake:payload -30059 # var1/reg <- negate => f7 3/subop/negate var1/rm32 -30060 0x11/imm32/alloc-id:fake -30061 _string-negate/imm32/name -30062 0/imm32/no-inouts -30063 0/imm32/no-inouts +30040 _Primitive-increment-ebx/imm32/next +30041 _Primitive-increment-ebx: # (payload primitive) +30042 0x11/imm32/alloc-id:fake:payload +30043 # var/ebx <- increment => 43/increment-ebx +30044 0x11/imm32/alloc-id:fake +30045 _string-increment/imm32/name +30046 0/imm32/no-inouts +30047 0/imm32/no-inouts +30048 0x11/imm32/alloc-id:fake +30049 Single-int-var-in-ebx/imm32/outputs +30050 0x11/imm32/alloc-id:fake +30051 _string_43_increment_ebx/imm32/subx-name +30052 0/imm32/no-rm32 +30053 0/imm32/no-r32 +30054 0/imm32/no-imm32 +30055 0/imm32/no-imm8 +30056 0/imm32/no-disp32 +30057 0/imm32/no-xm32 +30058 0/imm32/no-x32 +30059 0x11/imm32/alloc-id:fake +30060 _Primitive-increment-esi/imm32/next +30061 _Primitive-increment-esi: # (payload primitive) +30062 0x11/imm32/alloc-id:fake:payload +30063 # var/esi <- increment => 46/increment-esi 30064 0x11/imm32/alloc-id:fake -30065 Single-int-var-in-some-register/imm32/outputs -30066 0x11/imm32/alloc-id:fake -30067 _string_f7_subop_negate/imm32/subx-name -30068 3/imm32/rm32-is-first-output -30069 0/imm32/no-r32 -30070 0/imm32/no-imm32 -30071 0/imm32/no-imm8 -30072 0/imm32/no-disp32 -30073 0/imm32/no-xm32 -30074 0/imm32/no-x32 -30075 0x11/imm32/alloc-id:fake -30076 _Primitive-negate-mem/imm32/next -30077 _Primitive-negate-mem: # (payload primitive) -30078 0x11/imm32/alloc-id:fake:payload -30079 # negate var1 => f7 3/subop/negate var1/rm32 -30080 0x11/imm32/alloc-id:fake -30081 _string-negate/imm32/name -30082 0x11/imm32/alloc-id:fake -30083 Single-int-var-in-mem/imm32/inouts -30084 0/imm32/no-outputs -30085 0/imm32/no-outputs -30086 0x11/imm32/alloc-id:fake -30087 _string_f7_subop_negate/imm32/subx-name -30088 1/imm32/rm32-is-first-inout -30089 0/imm32/no-r32 -30090 0/imm32/no-imm32 -30091 0/imm32/no-imm8 -30092 0/imm32/no-disp32 -30093 0/imm32/no-xm32 -30094 0/imm32/no-x32 -30095 0x11/imm32/alloc-id:fake -30096 _Primitive-multiply-reg-by-reg/imm32/next -30097 # - multiply -30098 _Primitive-multiply-reg-by-reg: # (payload primitive) -30099 0x11/imm32/alloc-id:fake:payload -30100 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 -30101 0x11/imm32/alloc-id:fake -30102 _string-multiply/imm32/name -30103 0x11/imm32/alloc-id:fake -30104 Single-int-var-in-some-register/imm32/inouts -30105 0x11/imm32/alloc-id:fake -30106 Single-int-var-in-some-register/imm32/outputs -30107 0x11/imm32/alloc-id:fake -30108 _string_0f_af_multiply/imm32/subx-name -30109 1/imm32/rm32-is-first-inout -30110 3/imm32/r32-is-first-output -30111 0/imm32/no-imm32 -30112 0/imm32/no-imm8 -30113 0/imm32/no-disp32 -30114 0/imm32/no-xm32 -30115 0/imm32/no-x32 -30116 0x11/imm32/alloc-id:fake -30117 _Primitive-multiply-reg-by-mem/imm32/next -30118 _Primitive-multiply-reg-by-mem: # (payload primitive) -30119 0x11/imm32/alloc-id:fake:payload -30120 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 -30121 0x11/imm32/alloc-id:fake -30122 _string-multiply/imm32/name -30123 0x11/imm32/alloc-id:fake -30124 Single-int-var-in-mem/imm32/inouts -30125 0x11/imm32/alloc-id:fake -30126 Single-int-var-in-some-register/imm32/outputs -30127 0x11/imm32/alloc-id:fake -30128 _string_0f_af_multiply/imm32/subx-name -30129 1/imm32/rm32-is-first-inout -30130 3/imm32/r32-is-first-output -30131 0/imm32/no-imm32 -30132 0/imm32/no-imm8 -30133 0/imm32/no-disp32 -30134 0/imm32/no-xm32 -30135 0/imm32/no-x32 -30136 0x11/imm32/alloc-id:fake -30137 _Primitive-convert-mem-to-xreg/imm32/next -30138 # - convert int to floating point -30139 _Primitive-convert-mem-to-xreg: # (payload primitive) -30140 0x11/imm32/alloc-id:fake:payload -30141 # var1/xreg <- convert var2 => f3 0f 2a/convert-to-float var2/rm32 var1/x32 -30142 0x11/imm32/alloc-id:fake -30143 _string-convert/imm32/name +30065 _string-increment/imm32/name +30066 0/imm32/no-inouts +30067 0/imm32/no-inouts +30068 0x11/imm32/alloc-id:fake +30069 Single-int-var-in-esi/imm32/outputs +30070 0x11/imm32/alloc-id:fake +30071 _string_46_increment_esi/imm32/subx-name +30072 0/imm32/no-rm32 +30073 0/imm32/no-r32 +30074 0/imm32/no-imm32 +30075 0/imm32/no-imm8 +30076 0/imm32/no-disp32 +30077 0/imm32/no-xm32 +30078 0/imm32/no-x32 +30079 0x11/imm32/alloc-id:fake +30080 _Primitive-increment-edi/imm32/next +30081 _Primitive-increment-edi: # (payload primitive) +30082 0x11/imm32/alloc-id:fake:payload +30083 # var/edi <- increment => 47/increment-edi +30084 0x11/imm32/alloc-id:fake +30085 _string-increment/imm32/name +30086 0/imm32/no-inouts +30087 0/imm32/no-inouts +30088 0x11/imm32/alloc-id:fake +30089 Single-int-var-in-edi/imm32/outputs +30090 0x11/imm32/alloc-id:fake +30091 _string_47_increment_edi/imm32/subx-name +30092 0/imm32/no-rm32 +30093 0/imm32/no-r32 +30094 0/imm32/no-imm32 +30095 0/imm32/no-imm8 +30096 0/imm32/no-disp32 +30097 0/imm32/no-xm32 +30098 0/imm32/no-x32 +30099 0x11/imm32/alloc-id:fake +30100 _Primitive-decrement-eax/imm32/next +30101 _Primitive-decrement-eax: # (payload primitive) +30102 0x11/imm32/alloc-id:fake:payload +30103 # var/eax <- decrement => 48/decrement-eax +30104 0x11/imm32/alloc-id:fake +30105 _string-decrement/imm32/name +30106 0/imm32/no-inouts +30107 0/imm32/no-inouts +30108 0x11/imm32/alloc-id:fake +30109 Single-int-var-in-eax/imm32/outputs +30110 0x11/imm32/alloc-id:fake +30111 _string_48_decrement_eax/imm32/subx-name +30112 0/imm32/no-rm32 +30113 0/imm32/no-r32 +30114 0/imm32/no-imm32 +30115 0/imm32/no-imm8 +30116 0/imm32/no-disp32 +30117 0/imm32/no-xm32 +30118 0/imm32/no-x32 +30119 0x11/imm32/alloc-id:fake +30120 _Primitive-decrement-ecx/imm32/next +30121 _Primitive-decrement-ecx: # (payload primitive) +30122 0x11/imm32/alloc-id:fake:payload +30123 # var/ecx <- decrement => 49/decrement-ecx +30124 0x11/imm32/alloc-id:fake +30125 _string-decrement/imm32/name +30126 0/imm32/no-inouts +30127 0/imm32/no-inouts +30128 0x11/imm32/alloc-id:fake +30129 Single-int-var-in-ecx/imm32/outputs +30130 0x11/imm32/alloc-id:fake +30131 _string_49_decrement_ecx/imm32/subx-name +30132 0/imm32/no-rm32 +30133 0/imm32/no-r32 +30134 0/imm32/no-imm32 +30135 0/imm32/no-imm8 +30136 0/imm32/no-disp32 +30137 0/imm32/no-xm32 +30138 0/imm32/no-x32 +30139 0x11/imm32/alloc-id:fake +30140 _Primitive-decrement-edx/imm32/next +30141 _Primitive-decrement-edx: # (payload primitive) +30142 0x11/imm32/alloc-id:fake:payload +30143 # var/edx <- decrement => 4a/decrement-edx 30144 0x11/imm32/alloc-id:fake -30145 Single-int-var-in-mem/imm32/inouts -30146 0x11/imm32/alloc-id:fake -30147 Single-float-var-in-some-register/imm32/outputs +30145 _string-decrement/imm32/name +30146 0/imm32/no-inouts +30147 0/imm32/no-inouts 30148 0x11/imm32/alloc-id:fake -30149 _string_f3_0f_2a_convert_to_float/imm32/subx-name -30150 1/imm32/rm32-is-first-inout -30151 0/imm32/no-r32 -30152 0/imm32/no-imm32 -30153 0/imm32/no-imm8 -30154 0/imm32/no-disp32 -30155 0/imm32/no-xm32 -30156 3/imm32/x32-is-first-output -30157 0x11/imm32/alloc-id:fake -30158 _Primitive-convert-reg-to-xreg/imm32/next -30159 _Primitive-convert-reg-to-xreg: # (payload primitive) -30160 0x11/imm32/alloc-id:fake:payload -30161 # var1/xreg <- convert var2/reg => f3 0f 2a/convert-to-float var2/rm32 var1/x32 -30162 0x11/imm32/alloc-id:fake -30163 _string-convert/imm32/name +30149 Single-int-var-in-edx/imm32/outputs +30150 0x11/imm32/alloc-id:fake +30151 _string_4a_decrement_edx/imm32/subx-name +30152 0/imm32/no-rm32 +30153 0/imm32/no-r32 +30154 0/imm32/no-imm32 +30155 0/imm32/no-imm8 +30156 0/imm32/no-disp32 +30157 0/imm32/no-xm32 +30158 0/imm32/no-x32 +30159 0x11/imm32/alloc-id:fake +30160 _Primitive-decrement-ebx/imm32/next +30161 _Primitive-decrement-ebx: # (payload primitive) +30162 0x11/imm32/alloc-id:fake:payload +30163 # var/ebx <- decrement => 4b/decrement-ebx 30164 0x11/imm32/alloc-id:fake -30165 Single-int-var-in-some-register/imm32/inouts -30166 0x11/imm32/alloc-id:fake -30167 Single-float-var-in-some-register/imm32/outputs +30165 _string-decrement/imm32/name +30166 0/imm32/no-inouts +30167 0/imm32/no-inouts 30168 0x11/imm32/alloc-id:fake -30169 _string_f3_0f_2a_convert_to_float/imm32/subx-name -30170 1/imm32/rm32-is-first-inout -30171 0/imm32/no-r32 -30172 0/imm32/no-imm32 -30173 0/imm32/no-imm8 -30174 0/imm32/no-disp32 -30175 0/imm32/no-xm32 -30176 3/imm32/x32-is-first-output -30177 0x11/imm32/alloc-id:fake -30178 _Primitive-convert-xmem-to-reg/imm32/next -30179 # - convert floating point to int -30180 _Primitive-convert-xmem-to-reg: # (payload primitive) -30181 0x11/imm32/alloc-id:fake:payload -30182 # var1/reg <- convert var2 => f3 0f 2d/convert-to-int var2/xm32 var1/r32 -30183 0x11/imm32/alloc-id:fake -30184 _string-convert/imm32/name -30185 0x11/imm32/alloc-id:fake -30186 Single-float-var-in-mem/imm32/inouts -30187 0x11/imm32/alloc-id:fake -30188 Single-int-var-in-some-register/imm32/outputs -30189 0x11/imm32/alloc-id:fake -30190 _string_f3_0f_2d_convert_to_int/imm32/subx-name -30191 0/imm32/no-rm32 -30192 3/imm32/r32-is-first-output -30193 0/imm32/no-imm32 -30194 0/imm32/no-imm8 -30195 0/imm32/no-disp32 -30196 1/imm32/xm32-is-first-inout -30197 0/imm32/no-x32 -30198 0x11/imm32/alloc-id:fake -30199 _Primitive-convert-xreg-to-reg/imm32/next -30200 _Primitive-convert-xreg-to-reg: # (payload primitive) -30201 0x11/imm32/alloc-id:fake:payload -30202 # var1/reg <- convert var2/xreg => f3 0f 2d/convert-to-int var2/xm32 var1/r32 -30203 0x11/imm32/alloc-id:fake -30204 _string-convert/imm32/name -30205 0x11/imm32/alloc-id:fake -30206 Single-float-var-in-some-register/imm32/inouts -30207 0x11/imm32/alloc-id:fake -30208 Single-int-var-in-some-register/imm32/outputs -30209 0x11/imm32/alloc-id:fake -30210 _string_f3_0f_2d_convert_to_int/imm32/subx-name -30211 0/imm32/no-rm32 -30212 3/imm32/r32-is-first-output -30213 0/imm32/no-imm32 -30214 0/imm32/no-imm8 -30215 0/imm32/no-disp32 -30216 1/imm32/xm32-is-first-inout -30217 0/imm32/no-x32 -30218 0x11/imm32/alloc-id:fake -30219 _Primitive-truncate-xmem-to-reg/imm32/next -30220 _Primitive-truncate-xmem-to-reg: # (payload primitive) -30221 0x11/imm32/alloc-id:fake:payload -30222 # var1/reg <- truncate var2 => f3 0f 2c/truncate-to-int var2/xm32 var1/r32 -30223 0x11/imm32/alloc-id:fake -30224 _string-truncate/imm32/name -30225 0x11/imm32/alloc-id:fake -30226 Single-float-var-in-mem/imm32/inouts -30227 0x11/imm32/alloc-id:fake -30228 Single-int-var-in-some-register/imm32/outputs -30229 0x11/imm32/alloc-id:fake -30230 _string_f3_0f_2c_truncate_to_int/imm32/subx-name -30231 0/imm32/no-rm32 -30232 3/imm32/r32-is-first-output -30233 0/imm32/no-imm32 -30234 0/imm32/no-imm8 -30235 0/imm32/no-disp32 -30236 1/imm32/xm32-is-first-inout -30237 0/imm32/no-x32 -30238 0x11/imm32/alloc-id:fake -30239 _Primitive-truncate-xreg-to-reg/imm32/next -30240 _Primitive-truncate-xreg-to-reg: # (payload primitive) -30241 0x11/imm32/alloc-id:fake:payload -30242 # var1/reg <- truncate var2/xreg => f3 0f 2c/truncate-to-int var2/xm32 var1/r32 -30243 0x11/imm32/alloc-id:fake -30244 _string-truncate/imm32/name -30245 0x11/imm32/alloc-id:fake -30246 Single-float-var-in-some-register/imm32/inouts -30247 0x11/imm32/alloc-id:fake -30248 Single-int-var-in-some-register/imm32/outputs -30249 0x11/imm32/alloc-id:fake -30250 _string_f3_0f_2c_truncate_to_int/imm32/subx-name -30251 0/imm32/no-rm32 -30252 3/imm32/r32-is-first-output -30253 0/imm32/no-imm32 -30254 0/imm32/no-imm8 -30255 0/imm32/no-disp32 -30256 1/imm32/xm32-is-first-inout -30257 0/imm32/no-x32 -30258 0x11/imm32/alloc-id:fake -30259 _Primitive-reinterpret-xmem-as-reg/imm32/next -30260 # - reinterpret bytes (just for debugging) -30261 _Primitive-reinterpret-xmem-as-reg: # (payload primitive) +30169 Single-int-var-in-ebx/imm32/outputs +30170 0x11/imm32/alloc-id:fake +30171 _string_4b_decrement_ebx/imm32/subx-name +30172 0/imm32/no-rm32 +30173 0/imm32/no-r32 +30174 0/imm32/no-imm32 +30175 0/imm32/no-imm8 +30176 0/imm32/no-disp32 +30177 0/imm32/no-xm32 +30178 0/imm32/no-x32 +30179 0x11/imm32/alloc-id:fake +30180 _Primitive-decrement-esi/imm32/next +30181 _Primitive-decrement-esi: # (payload primitive) +30182 0x11/imm32/alloc-id:fake:payload +30183 # var/esi <- decrement => 4e/decrement-esi +30184 0x11/imm32/alloc-id:fake +30185 _string-decrement/imm32/name +30186 0/imm32/no-inouts +30187 0/imm32/no-inouts +30188 0x11/imm32/alloc-id:fake +30189 Single-int-var-in-esi/imm32/outputs +30190 0x11/imm32/alloc-id:fake +30191 _string_4e_decrement_esi/imm32/subx-name +30192 0/imm32/no-rm32 +30193 0/imm32/no-r32 +30194 0/imm32/no-imm32 +30195 0/imm32/no-imm8 +30196 0/imm32/no-disp32 +30197 0/imm32/no-xm32 +30198 0/imm32/no-x32 +30199 0x11/imm32/alloc-id:fake +30200 _Primitive-decrement-edi/imm32/next +30201 _Primitive-decrement-edi: # (payload primitive) +30202 0x11/imm32/alloc-id:fake:payload +30203 # var/edi <- decrement => 4f/decrement-edi +30204 0x11/imm32/alloc-id:fake +30205 _string-decrement/imm32/name +30206 0/imm32/no-inouts +30207 0/imm32/no-inouts +30208 0x11/imm32/alloc-id:fake +30209 Single-int-var-in-edi/imm32/outputs +30210 0x11/imm32/alloc-id:fake +30211 _string_4f_decrement_edi/imm32/subx-name +30212 0/imm32/no-rm32 +30213 0/imm32/no-r32 +30214 0/imm32/no-imm32 +30215 0/imm32/no-imm8 +30216 0/imm32/no-disp32 +30217 0/imm32/no-xm32 +30218 0/imm32/no-x32 +30219 0x11/imm32/alloc-id:fake +30220 _Primitive-increment-mem/imm32/next +30221 _Primitive-increment-mem: # (payload primitive) +30222 0x11/imm32/alloc-id:fake:payload +30223 # increment var => ff 0/subop/increment *(ebp+__) +30224 0x11/imm32/alloc-id:fake +30225 _string-increment/imm32/name +30226 0x11/imm32/alloc-id:fake +30227 Single-int-var-in-mem/imm32/inouts +30228 0/imm32/no-outputs +30229 0/imm32/no-outputs +30230 0x11/imm32/alloc-id:fake +30231 _string_ff_subop_increment/imm32/subx-name +30232 1/imm32/rm32-is-first-inout +30233 0/imm32/no-r32 +30234 0/imm32/no-imm32 +30235 0/imm32/no-imm8 +30236 0/imm32/no-disp32 +30237 0/imm32/no-xm32 +30238 0/imm32/no-x32 +30239 0x11/imm32/alloc-id:fake +30240 _Primitive-increment-reg/imm32/next +30241 _Primitive-increment-reg: # (payload primitive) +30242 0x11/imm32/alloc-id:fake:payload +30243 # var/reg <- increment => ff 0/subop/increment %__ +30244 0x11/imm32/alloc-id:fake +30245 _string-increment/imm32/name +30246 0/imm32/no-inouts +30247 0/imm32/no-inouts +30248 0x11/imm32/alloc-id:fake +30249 Single-int-var-in-some-register/imm32/outputs +30250 0x11/imm32/alloc-id:fake +30251 _string_ff_subop_increment/imm32/subx-name +30252 3/imm32/rm32-is-first-output +30253 0/imm32/no-r32 +30254 0/imm32/no-imm32 +30255 0/imm32/no-imm8 +30256 0/imm32/no-disp32 +30257 0/imm32/no-xm32 +30258 0/imm32/no-x32 +30259 0x11/imm32/alloc-id:fake +30260 _Primitive-decrement-mem/imm32/next +30261 _Primitive-decrement-mem: # (payload primitive) 30262 0x11/imm32/alloc-id:fake:payload -30263 # var1/reg <- reinterpret var2 => 8b/-> var2/xm32 var1/r32 +30263 # decrement var => ff 1/subop/decrement *(ebp+__) 30264 0x11/imm32/alloc-id:fake -30265 _string-reinterpret/imm32/name +30265 _string-decrement/imm32/name 30266 0x11/imm32/alloc-id:fake -30267 Single-float-var-in-mem/imm32/inouts -30268 0x11/imm32/alloc-id:fake -30269 Single-int-var-in-some-register/imm32/outputs +30267 Single-int-var-in-mem/imm32/inouts +30268 0/imm32/no-outputs +30269 0/imm32/no-outputs 30270 0x11/imm32/alloc-id:fake -30271 _string_8b_->/imm32/subx-name -30272 0/imm32/no-rm32 -30273 3/imm32/r32-is-first-output +30271 _string_ff_subop_decrement/imm32/subx-name +30272 1/imm32/rm32-is-first-inout +30273 0/imm32/no-r32 30274 0/imm32/no-imm32 30275 0/imm32/no-imm8 30276 0/imm32/no-disp32 -30277 1/imm32/xm32-is-first-inout +30277 0/imm32/no-xm32 30278 0/imm32/no-x32 30279 0x11/imm32/alloc-id:fake -30280 _Primitive-reinterpret-mem-as-xreg/imm32/next -30281 _Primitive-reinterpret-mem-as-xreg: # (payload primitive) +30280 _Primitive-decrement-reg/imm32/next +30281 _Primitive-decrement-reg: # (payload primitive) 30282 0x11/imm32/alloc-id:fake:payload -30283 # var1/xreg <- reinterpret var2 => f3 0f 10/-> var2/rm32 var1/x32 +30283 # var/reg <- decrement => ff 1/subop/decrement %__ 30284 0x11/imm32/alloc-id:fake -30285 _string-reinterpret/imm32/name -30286 0x11/imm32/alloc-id:fake -30287 Single-int-var-in-mem/imm32/inouts +30285 _string-decrement/imm32/name +30286 0/imm32/no-inouts +30287 0/imm32/no-inouts 30288 0x11/imm32/alloc-id:fake -30289 Single-float-var-in-some-register/imm32/outputs +30289 Single-int-var-in-some-register/imm32/outputs 30290 0x11/imm32/alloc-id:fake -30291 _string_f3_0f_10_copy/imm32/subx-name -30292 1/imm32/rm32-is-first-inout +30291 _string_ff_subop_decrement/imm32/subx-name +30292 3/imm32/rm32-is-first-output 30293 0/imm32/no-r32 30294 0/imm32/no-imm32 30295 0/imm32/no-imm8 30296 0/imm32/no-disp32 30297 0/imm32/no-xm32 -30298 3/imm32/x32-is-first-output +30298 0/imm32/no-x32 30299 0x11/imm32/alloc-id:fake -30300 _Primitive-copy-xreg-to-xreg/imm32/next -30301 # - floating-point copy -30302 _Primitive-copy-xreg-to-xreg: # (payload primitive) +30300 _Primitive-add-to-eax/imm32/next +30301 # - add +30302 _Primitive-add-to-eax: # (payload primitive) 30303 0x11/imm32/alloc-id:fake:payload -30304 # var1/xreg <- copy var2/xreg => f3 0f 11/<- var1/xm32 var2/x32 +30304 # var/eax <- add lit => 05/add-to-eax lit/imm32 30305 0x11/imm32/alloc-id:fake -30306 _string-copy/imm32/name +30306 _string-add/imm32/name 30307 0x11/imm32/alloc-id:fake -30308 Single-float-var-in-some-register/imm32/inouts +30308 Single-lit-var/imm32/inouts 30309 0x11/imm32/alloc-id:fake -30310 Single-float-var-in-some-register/imm32/outputs +30310 Single-int-var-in-eax/imm32/outputs 30311 0x11/imm32/alloc-id:fake -30312 _string_f3_0f_11_copy/imm32/subx-name +30312 _string_05_add_to_eax/imm32/subx-name 30313 0/imm32/no-rm32 30314 0/imm32/no-r32 -30315 0/imm32/no-imm32 +30315 1/imm32/imm32-is-first-inout 30316 0/imm32/no-imm8 30317 0/imm32/no-disp32 -30318 3/imm32/xm32-is-first-output -30319 1/imm32/x32-is-first-inout +30318 0/imm32/no-xm32 +30319 0/imm32/no-x32 30320 0x11/imm32/alloc-id:fake -30321 _Primitive-copy-xreg-to-mem/imm32/next -30322 _Primitive-copy-xreg-to-mem: # (payload primitive) +30321 _Primitive-add-reg-to-reg/imm32/next +30322 _Primitive-add-reg-to-reg: # (payload primitive) 30323 0x11/imm32/alloc-id:fake:payload -30324 # copy-to var1 var2/xreg => f3 0f 11/<- var1 var2/x32 +30324 # var1/reg <- add var2/reg => 01/add-to var1/rm32 var2/r32 30325 0x11/imm32/alloc-id:fake -30326 _string-copy-to/imm32/name +30326 _string-add/imm32/name 30327 0x11/imm32/alloc-id:fake -30328 Two-args-float-stack-float-reg/imm32/inouts -30329 0/imm32/no-outputs -30330 0/imm32/no-outputs +30328 Single-int-var-in-some-register/imm32/inouts +30329 0x11/imm32/alloc-id:fake +30330 Single-int-var-in-some-register/imm32/outputs 30331 0x11/imm32/alloc-id:fake -30332 _string_f3_0f_11_copy/imm32/subx-name -30333 0/imm32/no-rm32 -30334 0/imm32/no-r32 +30332 _string_01_add_to/imm32/subx-name +30333 3/imm32/rm32-is-first-output +30334 1/imm32/r32-is-first-inout 30335 0/imm32/no-imm32 30336 0/imm32/no-imm8 30337 0/imm32/no-disp32 -30338 1/imm32/xm32-is-first-inout -30339 2/imm32/x32-is-second-inout +30338 0/imm32/no-xm32 +30339 0/imm32/no-x32 30340 0x11/imm32/alloc-id:fake -30341 _Primitive-copy-mem-to-xreg/imm32/next -30342 _Primitive-copy-mem-to-xreg: # (payload primitive) +30341 _Primitive-add-reg-to-mem/imm32/next +30342 _Primitive-add-reg-to-mem: # (payload primitive) 30343 0x11/imm32/alloc-id:fake:payload -30344 # var1/xreg <- copy var2 => f3 0f 10/-> var2/rm32 var1/x32 +30344 # add-to var1 var2/reg => 01/add-to var1 var2/r32 30345 0x11/imm32/alloc-id:fake -30346 _string-copy/imm32/name +30346 _string-add-to/imm32/name 30347 0x11/imm32/alloc-id:fake -30348 Single-float-var-in-mem/imm32/inouts -30349 0x11/imm32/alloc-id:fake -30350 Single-float-var-in-some-register/imm32/outputs +30348 Two-args-int-stack-int-reg/imm32/inouts +30349 0/imm32/no-outputs +30350 0/imm32/no-outputs 30351 0x11/imm32/alloc-id:fake -30352 _string_f3_0f_10_copy/imm32/subx-name -30353 0/imm32/no-rm32 -30354 0/imm32/no-r32 +30352 _string_01_add_to/imm32/subx-name +30353 1/imm32/rm32-is-first-inout +30354 2/imm32/r32-is-second-inout 30355 0/imm32/no-imm32 30356 0/imm32/no-imm8 30357 0/imm32/no-disp32 -30358 1/imm32/xm32-is-first-inout -30359 3/imm32/x32-is-first-output +30358 0/imm32/no-xm32 +30359 0/imm32/no-x32 30360 0x11/imm32/alloc-id:fake -30361 _Primitive-address-of-xmem/imm32/next -30362 # - floating-point-address -30363 _Primitive-address-of-xmem: # (payload primitive) -30364 0x11/imm32/alloc-id:fake:payload -30365 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 -30366 0x11/imm32/alloc-id:fake -30367 _string-address/imm32/name -30368 0x11/imm32/alloc-id:fake -30369 Single-float-var-in-mem/imm32/inouts -30370 0x11/imm32/alloc-id:fake -30371 Single-addr-var-in-some-register/imm32/outputs -30372 0x11/imm32/alloc-id:fake -30373 _string_8d_copy_address/imm32/subx-name -30374 1/imm32/rm32-is-first-inout -30375 3/imm32/r32-is-first-output -30376 0/imm32/no-imm32 -30377 0/imm32/no-imm8 -30378 0/imm32/no-disp32 -30379 0/imm32/no-xm32 -30380 0/imm32/no-x32 -30381 0x11/imm32/alloc-id:fake -30382 _Primitive-add-xreg-to-xreg/imm32/next -30383 # - floating-point add -30384 _Primitive-add-xreg-to-xreg: # (payload primitive) -30385 0x11/imm32/alloc-id:fake:payload -30386 # var1/xreg <- add var2/xreg => f3 0f 58/add var1/xm32 var2/x32 +30361 _Primitive-add-mem-to-reg/imm32/next +30362 _Primitive-add-mem-to-reg: # (payload primitive) +30363 0x11/imm32/alloc-id:fake:payload +30364 # var1/reg <- add var2 => 03/add var2/rm32 var1/r32 +30365 0x11/imm32/alloc-id:fake +30366 _string-add/imm32/name +30367 0x11/imm32/alloc-id:fake +30368 Single-int-var-in-mem/imm32/inouts +30369 0x11/imm32/alloc-id:fake +30370 Single-int-var-in-some-register/imm32/outputs +30371 0x11/imm32/alloc-id:fake +30372 _string_03_add/imm32/subx-name +30373 1/imm32/rm32-is-first-inout +30374 3/imm32/r32-is-first-output +30375 0/imm32/no-imm32 +30376 0/imm32/no-imm8 +30377 0/imm32/no-disp32 +30378 0/imm32/no-xm32 +30379 0/imm32/no-x32 +30380 0x11/imm32/alloc-id:fake +30381 _Primitive-add-lit-to-reg/imm32/next +30382 _Primitive-add-lit-to-reg: # (payload primitive) +30383 0x11/imm32/alloc-id:fake:payload +30384 # var1/reg <- add lit => 81 0/subop/add var1/rm32 lit/imm32 +30385 0x11/imm32/alloc-id:fake +30386 _string-add/imm32/name 30387 0x11/imm32/alloc-id:fake -30388 _string-add/imm32/name +30388 Single-lit-var/imm32/inouts 30389 0x11/imm32/alloc-id:fake -30390 Single-float-var-in-some-register/imm32/inouts +30390 Single-int-var-in-some-register/imm32/outputs 30391 0x11/imm32/alloc-id:fake -30392 Single-float-var-in-some-register/imm32/outputs -30393 0x11/imm32/alloc-id:fake -30394 _string_f3_0f_58_add/imm32/subx-name -30395 0/imm32/no-rm32 -30396 0/imm32/no-r32 -30397 0/imm32/no-imm32 -30398 0/imm32/no-imm8 -30399 0/imm32/no-disp32 -30400 1/imm32/xm32-is-first-inout -30401 3/imm32/x32-is-first-output -30402 0x11/imm32/alloc-id:fake -30403 _Primitive-add-mem-to-xreg/imm32/next -30404 _Primitive-add-mem-to-xreg: # (payload primitive) -30405 0x11/imm32/alloc-id:fake:payload -30406 # var1/xreg <- add var2 => f3 0f 58/add var2/xm32 var1/x32 +30392 _string_81_subop_add/imm32/subx-name +30393 3/imm32/rm32-is-first-output +30394 0/imm32/no-r32 +30395 1/imm32/imm32-is-first-inout +30396 0/imm32/no-imm8 +30397 0/imm32/no-disp32 +30398 0/imm32/no-xm32 +30399 0/imm32/no-x32 +30400 0x11/imm32/alloc-id:fake +30401 _Primitive-add-lit-to-mem/imm32/next +30402 _Primitive-add-lit-to-mem: # (payload primitive) +30403 0x11/imm32/alloc-id:fake:payload +30404 # add-to var1, lit => 81 0/subop/add var1/rm32 lit/imm32 +30405 0x11/imm32/alloc-id:fake +30406 _string-add-to/imm32/name 30407 0x11/imm32/alloc-id:fake -30408 _string-add/imm32/name -30409 0x11/imm32/alloc-id:fake -30410 Single-float-var-in-mem/imm32/inouts +30408 Int-var-and-literal/imm32/inouts +30409 0/imm32/no-outputs +30410 0/imm32/no-outputs 30411 0x11/imm32/alloc-id:fake -30412 Single-float-var-in-some-register/imm32/outputs -30413 0x11/imm32/alloc-id:fake -30414 _string_f3_0f_58_add/imm32/subx-name -30415 0/imm32/no-rm32 -30416 0/imm32/no-r32 -30417 0/imm32/no-imm32 -30418 0/imm32/no-imm8 -30419 0/imm32/no-disp32 -30420 1/imm32/xm32-is-first-inout -30421 3/imm32/x32-is-first-output -30422 0x11/imm32/alloc-id:fake -30423 _Primitive-subtract-xreg-from-xreg/imm32/next -30424 # - floating-point subtract -30425 _Primitive-subtract-xreg-from-xreg: # (payload primitive) -30426 0x11/imm32/alloc-id:fake:payload -30427 # var1/xreg <- subtract var2/xreg => f3 0f 5c/subtract var1/xm32 var2/x32 +30412 _string_81_subop_add/imm32/subx-name +30413 1/imm32/rm32-is-first-inout +30414 0/imm32/no-r32 +30415 2/imm32/imm32-is-second-inout +30416 0/imm32/no-imm8 +30417 0/imm32/no-disp32 +30418 0/imm32/no-xm32 +30419 0/imm32/no-x32 +30420 0x11/imm32/alloc-id:fake +30421 _Primitive-subtract-from-eax/imm32/next +30422 # - subtract +30423 _Primitive-subtract-from-eax: # (payload primitive) +30424 0x11/imm32/alloc-id:fake:payload +30425 # var/eax <- subtract lit => 2d/subtract-from-eax lit/imm32 +30426 0x11/imm32/alloc-id:fake +30427 _string-subtract/imm32/name 30428 0x11/imm32/alloc-id:fake -30429 _string-subtract/imm32/name +30429 Single-lit-var/imm32/inouts 30430 0x11/imm32/alloc-id:fake -30431 Single-float-var-in-some-register/imm32/inouts +30431 Single-int-var-in-eax/imm32/outputs 30432 0x11/imm32/alloc-id:fake -30433 Single-float-var-in-some-register/imm32/outputs -30434 0x11/imm32/alloc-id:fake -30435 _string_f3_0f_5c_subtract/imm32/subx-name -30436 0/imm32/no-rm32 -30437 0/imm32/no-r32 -30438 0/imm32/no-imm32 -30439 0/imm32/no-imm8 -30440 0/imm32/no-disp32 -30441 1/imm32/xm32-is-first-inout -30442 3/imm32/x32-is-first-output -30443 0x11/imm32/alloc-id:fake -30444 _Primitive-subtract-mem-from-xreg/imm32/next -30445 _Primitive-subtract-mem-from-xreg: # (payload primitive) -30446 0x11/imm32/alloc-id:fake:payload -30447 # var1/xreg <- subtract var2 => f3 0f 5c/subtract var2/xm32 var1/x32 +30433 _string_2d_subtract_from_eax/imm32/subx-name +30434 0/imm32/no-rm32 +30435 0/imm32/no-r32 +30436 1/imm32/imm32-is-first-inout +30437 0/imm32/no-imm8 +30438 0/imm32/no-disp32 +30439 0/imm32/no-xm32 +30440 0/imm32/no-x32 +30441 0x11/imm32/alloc-id:fake +30442 _Primitive-subtract-reg-from-reg/imm32/next +30443 _Primitive-subtract-reg-from-reg: # (payload primitive) +30444 0x11/imm32/alloc-id:fake:payload +30445 # var1/reg <- subtract var2/reg => 29/subtract-from var1/rm32 var2/r32 +30446 0x11/imm32/alloc-id:fake +30447 _string-subtract/imm32/name 30448 0x11/imm32/alloc-id:fake -30449 _string-subtract/imm32/name +30449 Single-int-var-in-some-register/imm32/inouts 30450 0x11/imm32/alloc-id:fake -30451 Single-float-var-in-mem/imm32/inouts +30451 Single-int-var-in-some-register/imm32/outputs 30452 0x11/imm32/alloc-id:fake -30453 Single-float-var-in-some-register/imm32/outputs -30454 0x11/imm32/alloc-id:fake -30455 _string_f3_0f_5c_subtract/imm32/subx-name -30456 0/imm32/no-rm32 -30457 0/imm32/no-r32 -30458 0/imm32/no-imm32 -30459 0/imm32/no-imm8 -30460 0/imm32/no-disp32 -30461 1/imm32/xm32-is-first-inout -30462 3/imm32/x32-is-first-output -30463 0x11/imm32/alloc-id:fake -30464 _Primitive-multiply-xreg-by-xreg/imm32/next -30465 # - floating-point multiply -30466 _Primitive-multiply-xreg-by-xreg: # (payload primitive) -30467 0x11/imm32/alloc-id:fake:payload -30468 # var1/xreg <- multiply var2 => f3 0f 59/multiply var2/xm32 var1/x32 -30469 0x11/imm32/alloc-id:fake -30470 _string-multiply/imm32/name -30471 0x11/imm32/alloc-id:fake -30472 Single-float-var-in-some-register/imm32/inouts -30473 0x11/imm32/alloc-id:fake -30474 Single-float-var-in-some-register/imm32/outputs -30475 0x11/imm32/alloc-id:fake -30476 _string_f3_0f_59_multiply/imm32/subx-name -30477 0/imm32/no-rm32 -30478 0/imm32/no-r32 -30479 0/imm32/no-imm32 -30480 0/imm32/no-imm8 -30481 0/imm32/no-disp32 -30482 1/imm32/xm32-is-first-inout -30483 3/imm32/x32-is-first-output -30484 0x11/imm32/alloc-id:fake -30485 _Primitive-multiply-xreg-by-mem/imm32/next -30486 _Primitive-multiply-xreg-by-mem: # (payload primitive) -30487 0x11/imm32/alloc-id:fake:payload -30488 # var1/xreg <- multiply var2 => 53 0f 59/multiply var2/xm32 var1/x32 -30489 0x11/imm32/alloc-id:fake -30490 _string-multiply/imm32/name -30491 0x11/imm32/alloc-id:fake -30492 Single-float-var-in-mem/imm32/inouts -30493 0x11/imm32/alloc-id:fake -30494 Single-float-var-in-some-register/imm32/outputs -30495 0x11/imm32/alloc-id:fake -30496 _string_f3_0f_59_multiply/imm32/subx-name -30497 0/imm32/no-rm32 -30498 0/imm32/no-r32 -30499 0/imm32/no-imm32 -30500 0/imm32/no-imm8 -30501 0/imm32/no-disp32 -30502 1/imm32/xm32-is-first-inout -30503 3/imm32/x32-is-first-output -30504 0x11/imm32/alloc-id:fake -30505 _Primitive-divide-xreg-by-xreg/imm32/next -30506 # - floating-point divide -30507 _Primitive-divide-xreg-by-xreg: # (payload primitive) -30508 0x11/imm32/alloc-id:fake:payload -30509 # var1/xreg <- divide var2 => f3 0f 5e/divide var2/xm32 var1/x32 +30453 _string_29_subtract_from/imm32/subx-name +30454 3/imm32/rm32-is-first-output +30455 1/imm32/r32-is-first-inout +30456 0/imm32/no-imm32 +30457 0/imm32/no-imm8 +30458 0/imm32/no-disp32 +30459 0/imm32/no-xm32 +30460 0/imm32/no-x32 +30461 0x11/imm32/alloc-id:fake +30462 _Primitive-subtract-reg-from-mem/imm32/next +30463 _Primitive-subtract-reg-from-mem: # (payload primitive) +30464 0x11/imm32/alloc-id:fake:payload +30465 # subtract-from var1 var2/reg => 29/subtract-from var1 var2/r32 +30466 0x11/imm32/alloc-id:fake +30467 _string-subtract-from/imm32/name +30468 0x11/imm32/alloc-id:fake +30469 Two-args-int-stack-int-reg/imm32/inouts +30470 0/imm32/no-outputs +30471 0/imm32/no-outputs +30472 0x11/imm32/alloc-id:fake +30473 _string_29_subtract_from/imm32/subx-name +30474 1/imm32/rm32-is-first-inout +30475 2/imm32/r32-is-second-inout +30476 0/imm32/no-imm32 +30477 0/imm32/no-imm8 +30478 0/imm32/no-disp32 +30479 0/imm32/no-xm32 +30480 0/imm32/no-x32 +30481 0x11/imm32/alloc-id:fake +30482 _Primitive-subtract-mem-from-reg/imm32/next +30483 _Primitive-subtract-mem-from-reg: # (payload primitive) +30484 0x11/imm32/alloc-id:fake:payload +30485 # var1/reg <- subtract var2 => 2b/subtract var2/rm32 var1/r32 +30486 0x11/imm32/alloc-id:fake +30487 _string-subtract/imm32/name +30488 0x11/imm32/alloc-id:fake +30489 Single-int-var-in-mem/imm32/inouts +30490 0x11/imm32/alloc-id:fake +30491 Single-int-var-in-some-register/imm32/outputs +30492 0x11/imm32/alloc-id:fake +30493 _string_2b_subtract/imm32/subx-name +30494 1/imm32/rm32-is-first-inout +30495 3/imm32/r32-is-first-output +30496 0/imm32/no-imm32 +30497 0/imm32/no-imm8 +30498 0/imm32/no-disp32 +30499 0/imm32/no-xm32 +30500 0/imm32/no-x32 +30501 0x11/imm32/alloc-id:fake +30502 _Primitive-subtract-lit-from-reg/imm32/next +30503 _Primitive-subtract-lit-from-reg: # (payload primitive) +30504 0x11/imm32/alloc-id:fake:payload +30505 # var1/reg <- subtract lit => 81 5/subop/subtract var1/rm32 lit/imm32 +30506 0x11/imm32/alloc-id:fake +30507 _string-subtract/imm32/name +30508 0x11/imm32/alloc-id:fake +30509 Single-lit-var/imm32/inouts 30510 0x11/imm32/alloc-id:fake -30511 _string-divide/imm32/name +30511 Single-int-var-in-some-register/imm32/outputs 30512 0x11/imm32/alloc-id:fake -30513 Single-float-var-in-some-register/imm32/inouts -30514 0x11/imm32/alloc-id:fake -30515 Single-float-var-in-some-register/imm32/outputs -30516 0x11/imm32/alloc-id:fake -30517 _string_f3_0f_5e_divide/imm32/subx-name -30518 0/imm32/no-rm32 -30519 0/imm32/no-r32 -30520 0/imm32/no-imm32 -30521 0/imm32/no-imm8 -30522 0/imm32/no-disp32 -30523 1/imm32/xm32-is-first-inout -30524 3/imm32/x32-is-first-output -30525 0x11/imm32/alloc-id:fake -30526 _Primitive-divide-xreg-by-mem/imm32/next -30527 _Primitive-divide-xreg-by-mem: # (payload primitive) -30528 0x11/imm32/alloc-id:fake:payload -30529 # var1/xreg <- divide var2 => f3 0f 5e/divide var2/xm32 var1/x32 -30530 0x11/imm32/alloc-id:fake -30531 _string-divide/imm32/name +30513 _string_81_subop_subtract/imm32/subx-name +30514 3/imm32/rm32-is-first-output +30515 0/imm32/no-r32 +30516 1/imm32/imm32-is-first-inout +30517 0/imm32/no-imm8 +30518 0/imm32/no-disp32 +30519 0/imm32/no-xm32 +30520 0/imm32/no-x32 +30521 0x11/imm32/alloc-id:fake +30522 _Primitive-subtract-lit-from-mem/imm32/next +30523 _Primitive-subtract-lit-from-mem: # (payload primitive) +30524 0x11/imm32/alloc-id:fake:payload +30525 # subtract-from var1, lit => 81 5/subop/subtract var1/rm32 lit/imm32 +30526 0x11/imm32/alloc-id:fake +30527 _string-subtract-from/imm32/name +30528 0x11/imm32/alloc-id:fake +30529 Int-var-and-literal/imm32/inouts +30530 0/imm32/no-outputs +30531 0/imm32/no-outputs 30532 0x11/imm32/alloc-id:fake -30533 Single-float-var-in-mem/imm32/inouts -30534 0x11/imm32/alloc-id:fake -30535 Single-float-var-in-some-register/imm32/outputs -30536 0x11/imm32/alloc-id:fake -30537 _string_f3_0f_5e_divide/imm32/subx-name -30538 0/imm32/no-rm32 -30539 0/imm32/no-r32 -30540 0/imm32/no-imm32 -30541 0/imm32/no-imm8 -30542 0/imm32/no-disp32 -30543 1/imm32/xm32-is-first-inout -30544 3/imm32/x32-is-first-output -30545 0x11/imm32/alloc-id:fake -30546 _Primitive-max-xreg-with-xreg/imm32/next -30547 # - floating-point maximum -30548 _Primitive-max-xreg-with-xreg: # (payload primitive) -30549 0x11/imm32/alloc-id:fake:payload -30550 # var1/xreg <- max var2 => f3 0f 5f/max var2/xm32 var1/x32 +30533 _string_81_subop_subtract/imm32/subx-name +30534 1/imm32/rm32-is-first-inout +30535 0/imm32/no-r32 +30536 2/imm32/imm32-is-second-inout +30537 0/imm32/no-imm8 +30538 0/imm32/no-disp32 +30539 0/imm32/no-xm32 +30540 0/imm32/no-x32 +30541 0x11/imm32/alloc-id:fake +30542 _Primitive-and-with-eax/imm32/next +30543 # - and +30544 _Primitive-and-with-eax: # (payload primitive) +30545 0x11/imm32/alloc-id:fake:payload +30546 # var/eax <- and lit => 25/and-with-eax lit/imm32 +30547 0x11/imm32/alloc-id:fake +30548 _string-and/imm32/name +30549 0x11/imm32/alloc-id:fake +30550 Single-lit-var/imm32/inouts 30551 0x11/imm32/alloc-id:fake -30552 _string-max/imm32/name +30552 Single-int-var-in-eax/imm32/outputs 30553 0x11/imm32/alloc-id:fake -30554 Single-float-var-in-some-register/imm32/inouts -30555 0x11/imm32/alloc-id:fake -30556 Single-float-var-in-some-register/imm32/outputs -30557 0x11/imm32/alloc-id:fake -30558 _string_f3_0f_5f_max/imm32/subx-name -30559 0/imm32/no-rm32 -30560 0/imm32/no-r32 -30561 0/imm32/no-imm32 -30562 0/imm32/no-imm8 -30563 0/imm32/no-disp32 -30564 1/imm32/xm32-is-first-inout -30565 3/imm32/x32-is-first-output -30566 0x11/imm32/alloc-id:fake -30567 _Primitive-max-xreg-with-mem/imm32/next -30568 _Primitive-max-xreg-with-mem: # (payload primitive) -30569 0x11/imm32/alloc-id:fake:payload -30570 # var1/xreg <- divide var2 => f3 0f 5f/max var2/xm32 var1/x32 +30554 _string_25_and_with_eax/imm32/subx-name +30555 0/imm32/no-rm32 +30556 0/imm32/no-r32 +30557 1/imm32/imm32-is-first-inout +30558 0/imm32/no-imm8 +30559 0/imm32/no-disp32 +30560 0/imm32/no-xm32 +30561 0/imm32/no-x32 +30562 0x11/imm32/alloc-id:fake +30563 _Primitive-and-reg-with-reg/imm32/next +30564 _Primitive-and-reg-with-reg: # (payload primitive) +30565 0x11/imm32/alloc-id:fake:payload +30566 # var1/reg <- and var2/reg => 21/and-with var1/rm32 var2/r32 +30567 0x11/imm32/alloc-id:fake +30568 _string-and/imm32/name +30569 0x11/imm32/alloc-id:fake +30570 Single-int-var-in-some-register/imm32/inouts 30571 0x11/imm32/alloc-id:fake -30572 _string-max/imm32/name +30572 Single-int-var-in-some-register/imm32/outputs 30573 0x11/imm32/alloc-id:fake -30574 Single-float-var-in-mem/imm32/inouts -30575 0x11/imm32/alloc-id:fake -30576 Single-float-var-in-some-register/imm32/outputs -30577 0x11/imm32/alloc-id:fake -30578 _string_f3_0f_5f_max/imm32/subx-name -30579 0/imm32/no-rm32 -30580 0/imm32/no-r32 -30581 0/imm32/no-imm32 -30582 0/imm32/no-imm8 -30583 0/imm32/no-disp32 -30584 1/imm32/xm32-is-first-inout -30585 3/imm32/x32-is-first-output -30586 0x11/imm32/alloc-id:fake -30587 _Primitive-min-xreg-with-xreg/imm32/next -30588 # - floating-point minimum -30589 _Primitive-min-xreg-with-xreg: # (payload primitive) -30590 0x11/imm32/alloc-id:fake:payload -30591 # var1/xreg <- divide var2 => f3 0f 5d/min var2/xm32 var1/x32 -30592 0x11/imm32/alloc-id:fake -30593 _string-min/imm32/name -30594 0x11/imm32/alloc-id:fake -30595 Single-float-var-in-some-register/imm32/inouts -30596 0x11/imm32/alloc-id:fake -30597 Single-float-var-in-some-register/imm32/outputs -30598 0x11/imm32/alloc-id:fake -30599 _string_f3_0f_5d_min/imm32/subx-name -30600 0/imm32/no-rm32 -30601 0/imm32/no-r32 -30602 0/imm32/no-imm32 -30603 0/imm32/no-imm8 -30604 0/imm32/no-disp32 -30605 1/imm32/xm32-is-first-inout -30606 3/imm32/x32-is-first-output +30574 _string_21_and_with/imm32/subx-name +30575 3/imm32/rm32-is-first-output +30576 1/imm32/r32-is-first-inout +30577 0/imm32/no-imm32 +30578 0/imm32/no-imm8 +30579 0/imm32/no-disp32 +30580 0/imm32/no-xm32 +30581 0/imm32/no-x32 +30582 0x11/imm32/alloc-id:fake +30583 _Primitive-and-reg-with-mem/imm32/next +30584 _Primitive-and-reg-with-mem: # (payload primitive) +30585 0x11/imm32/alloc-id:fake:payload +30586 # and-with var1 var2/reg => 21/and-with var1 var2/r32 +30587 0x11/imm32/alloc-id:fake +30588 _string-and-with/imm32/name +30589 0x11/imm32/alloc-id:fake +30590 Two-args-int-stack-int-reg/imm32/inouts +30591 0/imm32/no-outputs +30592 0/imm32/no-outputs +30593 0x11/imm32/alloc-id:fake +30594 _string_21_and_with/imm32/subx-name +30595 1/imm32/rm32-is-first-inout +30596 2/imm32/r32-is-second-inout +30597 0/imm32/no-imm32 +30598 0/imm32/no-imm8 +30599 0/imm32/no-disp32 +30600 0/imm32/no-xm32 +30601 0/imm32/no-x32 +30602 0x11/imm32/alloc-id:fake +30603 _Primitive-and-mem-with-reg/imm32/next +30604 _Primitive-and-mem-with-reg: # (payload primitive) +30605 0x11/imm32/alloc-id:fake:payload +30606 # var1/reg <- and var2 => 23/and var2/rm32 var1/r32 30607 0x11/imm32/alloc-id:fake -30608 _Primitive-min-xreg-with-mem/imm32/next -30609 _Primitive-min-xreg-with-mem: # (payload primitive) -30610 0x11/imm32/alloc-id:fake:payload -30611 # var1/xreg <- divide var2 => f3 0f 5d/min var2/xm32 var1/x32 -30612 0x11/imm32/alloc-id:fake -30613 _string-min/imm32/name -30614 0x11/imm32/alloc-id:fake -30615 Single-float-var-in-mem/imm32/inouts -30616 0x11/imm32/alloc-id:fake -30617 Single-float-var-in-some-register/imm32/outputs -30618 0x11/imm32/alloc-id:fake -30619 _string_f3_0f_5d_min/imm32/subx-name -30620 0/imm32/no-rm32 -30621 0/imm32/no-r32 -30622 0/imm32/no-imm32 -30623 0/imm32/no-imm8 -30624 0/imm32/no-disp32 -30625 1/imm32/xm32-is-first-inout -30626 3/imm32/x32-is-first-output +30608 _string-and/imm32/name +30609 0x11/imm32/alloc-id:fake +30610 Single-int-var-in-mem/imm32/inouts +30611 0x11/imm32/alloc-id:fake +30612 Single-int-var-in-some-register/imm32/outputs +30613 0x11/imm32/alloc-id:fake +30614 _string_23_and/imm32/subx-name +30615 1/imm32/rm32-is-first-inout +30616 3/imm32/r32-is-first-output +30617 0/imm32/no-imm32 +30618 0/imm32/no-imm8 +30619 0/imm32/no-disp32 +30620 0/imm32/no-xm32 +30621 0/imm32/no-x32 +30622 0x11/imm32/alloc-id:fake +30623 _Primitive-and-lit-with-reg/imm32/next +30624 _Primitive-and-lit-with-reg: # (payload primitive) +30625 0x11/imm32/alloc-id:fake:payload +30626 # var1/reg <- and lit => 81 4/subop/and var1/rm32 lit/imm32 30627 0x11/imm32/alloc-id:fake -30628 _Primitive-reciprocal-xreg-to-xreg/imm32/next -30629 # - floating-point reciprocal -30630 _Primitive-reciprocal-xreg-to-xreg: # (payload primitive) -30631 0x11/imm32/alloc-id:fake:payload -30632 # var1/xreg <- reciprocal var2 => f3 0f 53/reciprocal var2/xm32 var1/x32 +30628 _string-and/imm32/name +30629 0x11/imm32/alloc-id:fake +30630 Single-lit-var/imm32/inouts +30631 0x11/imm32/alloc-id:fake +30632 Single-int-var-in-some-register/imm32/outputs 30633 0x11/imm32/alloc-id:fake -30634 _string-reciprocal/imm32/name -30635 0x11/imm32/alloc-id:fake -30636 Single-float-var-in-some-register/imm32/inouts -30637 0x11/imm32/alloc-id:fake -30638 Single-float-var-in-some-register/imm32/outputs -30639 0x11/imm32/alloc-id:fake -30640 _string_f3_0f_53_reciprocal/imm32/subx-name -30641 0/imm32/no-rm32 -30642 0/imm32/no-r32 -30643 0/imm32/no-imm32 -30644 0/imm32/no-imm8 -30645 0/imm32/no-disp32 -30646 1/imm32/xm32-is-first-inout -30647 3/imm32/x32-is-first-output -30648 0x11/imm32/alloc-id:fake -30649 _Primitive-reciprocal-mem-to-xreg/imm32/next -30650 _Primitive-reciprocal-mem-to-xreg: # (payload primitive) -30651 0x11/imm32/alloc-id:fake:payload -30652 # var1/xreg <- divide var2 => f3 0f 53/reciprocal var2/xm32 var1/x32 +30634 _string_81_subop_and/imm32/subx-name +30635 3/imm32/rm32-is-first-output +30636 0/imm32/no-r32 +30637 1/imm32/imm32-is-first-inout +30638 0/imm32/no-imm8 +30639 0/imm32/no-disp32 +30640 0/imm32/no-xm32 +30641 0/imm32/no-x32 +30642 0x11/imm32/alloc-id:fake +30643 _Primitive-and-lit-with-mem/imm32/next +30644 _Primitive-and-lit-with-mem: # (payload primitive) +30645 0x11/imm32/alloc-id:fake:payload +30646 # and-with var1, lit => 81 4/subop/and var1/rm32 lit/imm32 +30647 0x11/imm32/alloc-id:fake +30648 _string-and-with/imm32/name +30649 0x11/imm32/alloc-id:fake +30650 Int-var-and-literal/imm32/inouts +30651 0/imm32/no-outputs +30652 0/imm32/no-outputs 30653 0x11/imm32/alloc-id:fake -30654 _string-reciprocal/imm32/name -30655 0x11/imm32/alloc-id:fake -30656 Single-float-var-in-mem/imm32/inouts -30657 0x11/imm32/alloc-id:fake -30658 Single-float-var-in-some-register/imm32/outputs -30659 0x11/imm32/alloc-id:fake -30660 _string_f3_0f_53_reciprocal/imm32/subx-name -30661 0/imm32/no-rm32 -30662 0/imm32/no-r32 -30663 0/imm32/no-imm32 -30664 0/imm32/no-imm8 -30665 0/imm32/no-disp32 -30666 1/imm32/xm32-is-first-inout -30667 3/imm32/x32-is-first-output +30654 _string_81_subop_and/imm32/subx-name +30655 1/imm32/rm32-is-first-inout +30656 0/imm32/no-r32 +30657 2/imm32/imm32-is-second-inout +30658 0/imm32/no-imm8 +30659 0/imm32/no-disp32 +30660 0/imm32/no-xm32 +30661 0/imm32/no-x32 +30662 0x11/imm32/alloc-id:fake +30663 _Primitive-or-with-eax/imm32/next +30664 # - or +30665 _Primitive-or-with-eax: # (payload primitive) +30666 0x11/imm32/alloc-id:fake:payload +30667 # var/eax <- or lit => 0d/or-with-eax lit/imm32 30668 0x11/imm32/alloc-id:fake -30669 _Primitive-square-root-xreg-to-xreg/imm32/next -30670 # - floating-point square root -30671 _Primitive-square-root-xreg-to-xreg: # (payload primitive) -30672 0x11/imm32/alloc-id:fake:payload -30673 # var1/xreg <- square-root var2 => f3 0f 51/square-root var2/xm32 var1/x32 +30669 _string-or/imm32/name +30670 0x11/imm32/alloc-id:fake +30671 Single-lit-var/imm32/inouts +30672 0x11/imm32/alloc-id:fake +30673 Single-int-var-in-eax/imm32/outputs 30674 0x11/imm32/alloc-id:fake -30675 _string-square-root/imm32/name -30676 0x11/imm32/alloc-id:fake -30677 Single-float-var-in-some-register/imm32/inouts -30678 0x11/imm32/alloc-id:fake -30679 Single-float-var-in-some-register/imm32/outputs -30680 0x11/imm32/alloc-id:fake -30681 _string_f3_0f_51_square_root/imm32/subx-name -30682 0/imm32/no-rm32 -30683 0/imm32/no-r32 -30684 0/imm32/no-imm32 -30685 0/imm32/no-imm8 -30686 0/imm32/no-disp32 -30687 1/imm32/xm32-is-first-inout -30688 3/imm32/x32-is-first-output -30689 0x11/imm32/alloc-id:fake -30690 _Primitive-square-root-mem-to-xreg/imm32/next -30691 _Primitive-square-root-mem-to-xreg: # (payload primitive) -30692 0x11/imm32/alloc-id:fake:payload -30693 # var1/xreg <- divide var2 => f3 0f 51/square-root var2/xm32 var1/x32 +30675 _string_0d_or_with_eax/imm32/subx-name +30676 0/imm32/no-rm32 +30677 0/imm32/no-r32 +30678 1/imm32/imm32-is-first-inout +30679 0/imm32/no-imm8 +30680 0/imm32/no-disp32 +30681 0/imm32/no-xm32 +30682 0/imm32/no-x32 +30683 0x11/imm32/alloc-id:fake +30684 _Primitive-or-reg-with-reg/imm32/next +30685 _Primitive-or-reg-with-reg: # (payload primitive) +30686 0x11/imm32/alloc-id:fake:payload +30687 # var1/reg <- or var2/reg => 09/or-with var1/rm32 var2/r32 +30688 0x11/imm32/alloc-id:fake +30689 _string-or/imm32/name +30690 0x11/imm32/alloc-id:fake +30691 Single-int-var-in-some-register/imm32/inouts +30692 0x11/imm32/alloc-id:fake +30693 Single-int-var-in-some-register/imm32/outputs 30694 0x11/imm32/alloc-id:fake -30695 _string-square-root/imm32/name -30696 0x11/imm32/alloc-id:fake -30697 Single-float-var-in-mem/imm32/inouts -30698 0x11/imm32/alloc-id:fake -30699 Single-float-var-in-some-register/imm32/outputs -30700 0x11/imm32/alloc-id:fake -30701 _string_f3_0f_51_square_root/imm32/subx-name -30702 0/imm32/no-rm32 -30703 0/imm32/no-r32 -30704 0/imm32/no-imm32 -30705 0/imm32/no-imm8 -30706 0/imm32/no-disp32 -30707 1/imm32/xm32-is-first-inout -30708 3/imm32/x32-is-first-output -30709 0x11/imm32/alloc-id:fake -30710 _Primitive-inverse-square-root-xreg-to-xreg/imm32/next -30711 # - floating-point inverse square root 1/sqrt(x) -30712 _Primitive-inverse-square-root-xreg-to-xreg: # (payload primitive) -30713 0x11/imm32/alloc-id:fake:payload -30714 # var1/xreg <- reciprocal var2 => f3 0f 52/inverse-square-root var2/xm32 var1/x32 -30715 0x11/imm32/alloc-id:fake -30716 _string-inverse-square-root/imm32/name -30717 0x11/imm32/alloc-id:fake -30718 Single-float-var-in-some-register/imm32/inouts -30719 0x11/imm32/alloc-id:fake -30720 Single-float-var-in-some-register/imm32/outputs -30721 0x11/imm32/alloc-id:fake -30722 _string_f3_0f_52_inverse_square_root/imm32/subx-name -30723 0/imm32/no-rm32 -30724 0/imm32/no-r32 -30725 0/imm32/no-imm32 -30726 0/imm32/no-imm8 -30727 0/imm32/no-disp32 -30728 1/imm32/xm32-is-first-inout -30729 3/imm32/x32-is-first-output +30695 _string_09_or_with/imm32/subx-name +30696 3/imm32/rm32-is-first-output +30697 1/imm32/r32-is-first-inout +30698 0/imm32/no-imm32 +30699 0/imm32/no-imm8 +30700 0/imm32/no-disp32 +30701 0/imm32/no-xm32 +30702 0/imm32/no-x32 +30703 0x11/imm32/alloc-id:fake +30704 _Primitive-or-reg-with-mem/imm32/next +30705 _Primitive-or-reg-with-mem: # (payload primitive) +30706 0x11/imm32/alloc-id:fake:payload +30707 # or-with var1 var2/reg => 09/or-with var1 var2/r32 +30708 0x11/imm32/alloc-id:fake +30709 _string-or-with/imm32/name +30710 0x11/imm32/alloc-id:fake +30711 Two-args-int-stack-int-reg/imm32/inouts +30712 0/imm32/no-outputs +30713 0/imm32/no-outputs +30714 0x11/imm32/alloc-id:fake +30715 _string_09_or_with/imm32/subx-name +30716 1/imm32/rm32-is-first-inout +30717 2/imm32/r32-is-second-inout +30718 0/imm32/no-imm32 +30719 0/imm32/no-imm8 +30720 0/imm32/no-disp32 +30721 0/imm32/no-xm32 +30722 0/imm32/no-x32 +30723 0x11/imm32/alloc-id:fake +30724 _Primitive-or-mem-with-reg/imm32/next +30725 _Primitive-or-mem-with-reg: # (payload primitive) +30726 0x11/imm32/alloc-id:fake:payload +30727 # var1/reg <- or var2 => 0b/or var2/rm32 var1/r32 +30728 0x11/imm32/alloc-id:fake +30729 _string-or/imm32/name 30730 0x11/imm32/alloc-id:fake -30731 _Primitive-inverse-square-root-mem-to-xreg/imm32/next -30732 _Primitive-inverse-square-root-mem-to-xreg: # (payload primitive) -30733 0x11/imm32/alloc-id:fake:payload -30734 # var1/xreg <- divide var2 => f3 0f 52/inverse-square-root var2/xm32 var1/x32 -30735 0x11/imm32/alloc-id:fake -30736 _string-inverse-square-root/imm32/name -30737 0x11/imm32/alloc-id:fake -30738 Single-float-var-in-mem/imm32/inouts -30739 0x11/imm32/alloc-id:fake -30740 Single-float-var-in-some-register/imm32/outputs -30741 0x11/imm32/alloc-id:fake -30742 _string_f3_0f_52_inverse_square_root/imm32/subx-name -30743 0/imm32/no-rm32 -30744 0/imm32/no-r32 -30745 0/imm32/no-imm32 -30746 0/imm32/no-imm8 -30747 0/imm32/no-disp32 -30748 1/imm32/xm32-is-first-inout -30749 3/imm32/x32-is-first-output +30731 Single-int-var-in-mem/imm32/inouts +30732 0x11/imm32/alloc-id:fake +30733 Single-int-var-in-some-register/imm32/outputs +30734 0x11/imm32/alloc-id:fake +30735 _string_0b_or/imm32/subx-name +30736 1/imm32/rm32-is-first-inout +30737 3/imm32/r32-is-first-output +30738 0/imm32/no-imm32 +30739 0/imm32/no-imm8 +30740 0/imm32/no-disp32 +30741 0/imm32/no-xm32 +30742 0/imm32/no-x32 +30743 0x11/imm32/alloc-id:fake +30744 _Primitive-or-lit-with-reg/imm32/next +30745 _Primitive-or-lit-with-reg: # (payload primitive) +30746 0x11/imm32/alloc-id:fake:payload +30747 # var1/reg <- or lit => 81 1/subop/or var1/rm32 lit/imm32 +30748 0x11/imm32/alloc-id:fake +30749 _string-or/imm32/name 30750 0x11/imm32/alloc-id:fake -30751 _Primitive-compare-xreg-with-xreg/imm32/next -30752 # - floating-point compare -30753 _Primitive-compare-xreg-with-xreg: # (payload primitive) -30754 0x11/imm32/alloc-id:fake:payload -30755 # compare var1/reg1 var2/reg2 => 0f 2f/compare var2/x32 var1/xm32 -30756 0x11/imm32/alloc-id:fake -30757 _string-compare/imm32/name -30758 0x11/imm32/alloc-id:fake -30759 Two-float-args-in-regs/imm32/inouts -30760 0/imm32/no-outputs -30761 0/imm32/no-outputs -30762 0x11/imm32/alloc-id:fake -30763 _string_0f_2f_compare/imm32/subx-name -30764 0/imm32/no-rm32 -30765 0/imm32/no-r32 -30766 0/imm32/no-imm32 -30767 0/imm32/no-imm8 -30768 0/imm32/no-disp32 -30769 1/imm32/xm32-is-first-inout -30770 2/imm32/x32-is-second-inout -30771 0x11/imm32/alloc-id:fake -30772 _Primitive-compare-xreg-with-mem/imm32/next -30773 _Primitive-compare-xreg-with-mem: # (payload primitive) -30774 0x11/imm32/alloc-id:fake:payload -30775 # compare var1/xreg var2 => 0f 2f/compare var1/x32 var2/xm32 -30776 0x11/imm32/alloc-id:fake -30777 _string-compare/imm32/name -30778 0x11/imm32/alloc-id:fake -30779 Two-args-float-reg-float-stack/imm32/inouts -30780 0/imm32/no-outputs -30781 0/imm32/no-outputs -30782 0x11/imm32/alloc-id:fake -30783 _string_0f_2f_compare/imm32/subx-name -30784 0/imm32/no-rm32 -30785 0/imm32/no-r32 -30786 0/imm32/no-imm32 -30787 0/imm32/no-imm8 -30788 0/imm32/no-disp32 -30789 2/imm32/xm32-is-second-inout -30790 1/imm32/x32-is-first-inout +30751 Single-lit-var/imm32/inouts +30752 0x11/imm32/alloc-id:fake +30753 Single-int-var-in-some-register/imm32/outputs +30754 0x11/imm32/alloc-id:fake +30755 _string_81_subop_or/imm32/subx-name +30756 3/imm32/rm32-is-first-output +30757 0/imm32/no-r32 +30758 1/imm32/imm32-is-first-inout +30759 0/imm32/no-imm8 +30760 0/imm32/no-disp32 +30761 0/imm32/no-xm32 +30762 0/imm32/no-x32 +30763 0x11/imm32/alloc-id:fake +30764 _Primitive-or-lit-with-mem/imm32/next +30765 _Primitive-or-lit-with-mem: # (payload primitive) +30766 0x11/imm32/alloc-id:fake:payload +30767 # or-with var1, lit => 81 1/subop/or var1/rm32 lit/imm32 +30768 0x11/imm32/alloc-id:fake +30769 _string-or-with/imm32/name +30770 0x11/imm32/alloc-id:fake +30771 Int-var-and-literal/imm32/inouts +30772 0/imm32/no-outputs +30773 0/imm32/no-outputs +30774 0x11/imm32/alloc-id:fake +30775 _string_81_subop_or/imm32/subx-name +30776 1/imm32/rm32-is-first-inout +30777 0/imm32/no-r32 +30778 2/imm32/imm32-is-second-inout +30779 0/imm32/no-imm8 +30780 0/imm32/no-disp32 +30781 0/imm32/no-xm32 +30782 0/imm32/no-x32 +30783 0x11/imm32/alloc-id:fake +30784 _Primitive-xor-with-eax/imm32/next +30785 # - xor +30786 _Primitive-xor-with-eax: # (payload primitive) +30787 0x11/imm32/alloc-id:fake:payload +30788 # var/eax <- xor lit => 35/xor-with-eax lit/imm32 +30789 0x11/imm32/alloc-id:fake +30790 _string-xor/imm32/name 30791 0x11/imm32/alloc-id:fake -30792 _Primitive-break-if-addr</imm32/next -30793 # - branches -30794 _Primitive-break-if-addr<: # (payload primitive) -30795 0x11/imm32/alloc-id:fake:payload -30796 0x11/imm32/alloc-id:fake -30797 _string-break-if-addr</imm32/name -30798 0/imm32/no-inouts -30799 0/imm32/no-inouts -30800 0/imm32/no-outputs -30801 0/imm32/no-outputs -30802 0x11/imm32/alloc-id:fake -30803 _string_0f_82_jump_break/imm32/subx-name -30804 0/imm32/no-rm32 -30805 0/imm32/no-r32 -30806 0/imm32/no-imm32 -30807 0/imm32/no-imm8 -30808 0/imm32/no-disp32 -30809 0/imm32/no-xm32 -30810 0/imm32/no-x32 +30792 Single-lit-var/imm32/inouts +30793 0x11/imm32/alloc-id:fake +30794 Single-int-var-in-eax/imm32/outputs +30795 0x11/imm32/alloc-id:fake +30796 _string_35_xor_with_eax/imm32/subx-name +30797 0/imm32/no-rm32 +30798 0/imm32/no-r32 +30799 1/imm32/imm32-is-first-inout +30800 0/imm32/no-imm8 +30801 0/imm32/no-disp32 +30802 0/imm32/no-xm32 +30803 0/imm32/no-x32 +30804 0x11/imm32/alloc-id:fake +30805 _Primitive-xor-reg-with-reg/imm32/next +30806 _Primitive-xor-reg-with-reg: # (payload primitive) +30807 0x11/imm32/alloc-id:fake:payload +30808 # var1/reg <- xor var2/reg => 31/xor-with var1/rm32 var2/r32 +30809 0x11/imm32/alloc-id:fake +30810 _string-xor/imm32/name 30811 0x11/imm32/alloc-id:fake -30812 _Primitive-break-if-addr>=/imm32/next -30813 _Primitive-break-if-addr>=: # (payload primitive) -30814 0x11/imm32/alloc-id:fake:payload +30812 Single-int-var-in-some-register/imm32/inouts +30813 0x11/imm32/alloc-id:fake +30814 Single-int-var-in-some-register/imm32/outputs 30815 0x11/imm32/alloc-id:fake -30816 _string-break-if-addr>=/imm32/name -30817 0/imm32/no-inouts -30818 0/imm32/no-inouts -30819 0/imm32/no-outputs -30820 0/imm32/no-outputs -30821 0x11/imm32/alloc-id:fake -30822 _string_0f_83_jump_break/imm32/subx-name -30823 0/imm32/no-rm32 -30824 0/imm32/no-r32 -30825 0/imm32/no-imm32 -30826 0/imm32/no-imm8 -30827 0/imm32/no-disp32 -30828 0/imm32/no-xm32 -30829 0/imm32/no-x32 -30830 0x11/imm32/alloc-id:fake -30831 _Primitive-break-if-=/imm32/next -30832 _Primitive-break-if-=: # (payload primitive) -30833 0x11/imm32/alloc-id:fake:payload -30834 0x11/imm32/alloc-id:fake -30835 _string-break-if-=/imm32/name -30836 0/imm32/no-inouts -30837 0/imm32/no-inouts -30838 0/imm32/no-outputs -30839 0/imm32/no-outputs -30840 0x11/imm32/alloc-id:fake -30841 _string_0f_84_jump_break/imm32/subx-name -30842 0/imm32/no-rm32 -30843 0/imm32/no-r32 -30844 0/imm32/no-imm32 -30845 0/imm32/no-imm8 -30846 0/imm32/no-disp32 -30847 0/imm32/no-xm32 -30848 0/imm32/no-x32 +30816 _string_31_xor_with/imm32/subx-name +30817 3/imm32/rm32-is-first-output +30818 1/imm32/r32-is-first-inout +30819 0/imm32/no-imm32 +30820 0/imm32/no-imm8 +30821 0/imm32/no-disp32 +30822 0/imm32/no-xm32 +30823 0/imm32/no-x32 +30824 0x11/imm32/alloc-id:fake +30825 _Primitive-xor-reg-with-mem/imm32/next +30826 _Primitive-xor-reg-with-mem: # (payload primitive) +30827 0x11/imm32/alloc-id:fake:payload +30828 # xor-with var1 var2/reg => 31/xor-with var1 var2/r32 +30829 0x11/imm32/alloc-id:fake +30830 _string-xor-with/imm32/name +30831 0x11/imm32/alloc-id:fake +30832 Two-args-int-stack-int-reg/imm32/inouts +30833 0/imm32/no-outputs +30834 0/imm32/no-outputs +30835 0x11/imm32/alloc-id:fake +30836 _string_31_xor_with/imm32/subx-name +30837 1/imm32/rm32-is-first-inout +30838 2/imm32/r32-is-second-inout +30839 0/imm32/no-imm32 +30840 0/imm32/no-imm8 +30841 0/imm32/no-disp32 +30842 0/imm32/no-xm32 +30843 0/imm32/no-x32 +30844 0x11/imm32/alloc-id:fake +30845 _Primitive-xor-mem-with-reg/imm32/next +30846 _Primitive-xor-mem-with-reg: # (payload primitive) +30847 0x11/imm32/alloc-id:fake:payload +30848 # var1/reg <- xor var2 => 33/xor var2/rm32 var1/r32 30849 0x11/imm32/alloc-id:fake -30850 _Primitive-break-if-!=/imm32/next -30851 _Primitive-break-if-!=: # (payload primitive) -30852 0x11/imm32/alloc-id:fake:payload +30850 _string-xor/imm32/name +30851 0x11/imm32/alloc-id:fake +30852 Single-int-var-in-mem/imm32/inouts 30853 0x11/imm32/alloc-id:fake -30854 _string-break-if-!=/imm32/name -30855 0/imm32/no-inouts -30856 0/imm32/no-inouts -30857 0/imm32/no-outputs -30858 0/imm32/no-outputs -30859 0x11/imm32/alloc-id:fake -30860 _string_0f_85_jump_break/imm32/subx-name -30861 0/imm32/no-rm32 -30862 0/imm32/no-r32 -30863 0/imm32/no-imm32 -30864 0/imm32/no-imm8 -30865 0/imm32/no-disp32 -30866 0/imm32/no-xm32 -30867 0/imm32/no-x32 -30868 0x11/imm32/alloc-id:fake -30869 _Primitive-break-if-addr<=/imm32/next -30870 _Primitive-break-if-addr<=: # (payload primitive) -30871 0x11/imm32/alloc-id:fake:payload -30872 0x11/imm32/alloc-id:fake -30873 _string-break-if-addr<=/imm32/name -30874 0/imm32/no-inouts -30875 0/imm32/no-inouts -30876 0/imm32/no-outputs -30877 0/imm32/no-outputs -30878 0x11/imm32/alloc-id:fake -30879 _string_0f_86_jump_break/imm32/subx-name -30880 0/imm32/no-rm32 -30881 0/imm32/no-r32 -30882 0/imm32/no-imm32 -30883 0/imm32/no-imm8 -30884 0/imm32/no-disp32 -30885 0/imm32/no-xm32 -30886 0/imm32/no-x32 -30887 0x11/imm32/alloc-id:fake -30888 _Primitive-break-if-addr>/imm32/next -30889 _Primitive-break-if-addr>: # (payload primitive) -30890 0x11/imm32/alloc-id:fake:payload +30854 Single-int-var-in-some-register/imm32/outputs +30855 0x11/imm32/alloc-id:fake +30856 _string_33_xor/imm32/subx-name +30857 1/imm32/rm32-is-first-inout +30858 3/imm32/r32-is-first-output +30859 0/imm32/no-imm32 +30860 0/imm32/no-imm8 +30861 0/imm32/no-disp32 +30862 0/imm32/no-xm32 +30863 0/imm32/no-x32 +30864 0x11/imm32/alloc-id:fake +30865 _Primitive-xor-lit-with-reg/imm32/next +30866 _Primitive-xor-lit-with-reg: # (payload primitive) +30867 0x11/imm32/alloc-id:fake:payload +30868 # var1/reg <- xor lit => 81 6/subop/xor var1/rm32 lit/imm32 +30869 0x11/imm32/alloc-id:fake +30870 _string-xor/imm32/name +30871 0x11/imm32/alloc-id:fake +30872 Single-lit-var/imm32/inouts +30873 0x11/imm32/alloc-id:fake +30874 Single-int-var-in-some-register/imm32/outputs +30875 0x11/imm32/alloc-id:fake +30876 _string_81_subop_xor/imm32/subx-name +30877 3/imm32/rm32-is-first-output +30878 0/imm32/no-r32 +30879 1/imm32/imm32-is-first-inout +30880 0/imm32/no-imm8 +30881 0/imm32/no-disp32 +30882 0/imm32/no-xm32 +30883 0/imm32/no-x32 +30884 0x11/imm32/alloc-id:fake +30885 _Primitive-xor-lit-with-mem/imm32/next +30886 _Primitive-xor-lit-with-mem: # (payload primitive) +30887 0x11/imm32/alloc-id:fake:payload +30888 # xor-with var1, lit => 81 6/subop/xor var1/rm32 lit/imm32 +30889 0x11/imm32/alloc-id:fake +30890 _string-xor-with/imm32/name 30891 0x11/imm32/alloc-id:fake -30892 _string-break-if-addr>/imm32/name -30893 0/imm32/no-inouts -30894 0/imm32/no-inouts -30895 0/imm32/no-outputs -30896 0/imm32/no-outputs -30897 0x11/imm32/alloc-id:fake -30898 _string_0f_87_jump_break/imm32/subx-name -30899 0/imm32/no-rm32 -30900 0/imm32/no-r32 -30901 0/imm32/no-imm32 -30902 0/imm32/no-imm8 -30903 0/imm32/no-disp32 -30904 0/imm32/no-xm32 -30905 0/imm32/no-x32 -30906 0x11/imm32/alloc-id:fake -30907 _Primitive-break-if-</imm32/next -30908 _Primitive-break-if-<: # (payload primitive) -30909 0x11/imm32/alloc-id:fake:payload -30910 0x11/imm32/alloc-id:fake -30911 _string-break-if-</imm32/name -30912 0/imm32/no-inouts -30913 0/imm32/no-inouts -30914 0/imm32/no-outputs -30915 0/imm32/no-outputs -30916 0x11/imm32/alloc-id:fake -30917 _string_0f_8c_jump_break/imm32/subx-name -30918 0/imm32/no-rm32 -30919 0/imm32/no-r32 -30920 0/imm32/no-imm32 -30921 0/imm32/no-imm8 -30922 0/imm32/no-disp32 -30923 0/imm32/no-xm32 -30924 0/imm32/no-x32 -30925 0x11/imm32/alloc-id:fake -30926 _Primitive-break-if->=/imm32/next -30927 _Primitive-break-if->=: # (payload primitive) -30928 0x11/imm32/alloc-id:fake:payload +30892 Int-var-and-literal/imm32/inouts +30893 0/imm32/no-outputs +30894 0/imm32/no-outputs +30895 0x11/imm32/alloc-id:fake +30896 _string_81_subop_xor/imm32/subx-name +30897 1/imm32/rm32-is-first-inout +30898 0/imm32/no-r32 +30899 2/imm32/imm32-is-second-inout +30900 0/imm32/no-imm8 +30901 0/imm32/no-disp32 +30902 0/imm32/no-xm32 +30903 0/imm32/no-x32 +30904 0x11/imm32/alloc-id:fake +30905 _Primitive-shift-reg-left-by-lit/imm32/next +30906 _Primitive-shift-reg-left-by-lit: # (payload primitive) +30907 0x11/imm32/alloc-id:fake:payload +30908 # var1/reg <- shift-left lit => c1/shift 4/subop/left var1/rm32 lit/imm32 +30909 0x11/imm32/alloc-id:fake +30910 _string-shift-left/imm32/name +30911 0x11/imm32/alloc-id:fake +30912 Single-lit-var/imm32/inouts +30913 0x11/imm32/alloc-id:fake +30914 Single-int-var-in-some-register/imm32/outputs +30915 0x11/imm32/alloc-id:fake +30916 _string_c1_subop_shift_left/imm32/subx-name +30917 3/imm32/rm32-is-first-output +30918 0/imm32/no-r32 +30919 0/imm32/no-imm32 +30920 1/imm32/imm8-is-first-inout +30921 0/imm32/no-disp32 +30922 0/imm32/no-xm32 +30923 0/imm32/no-x32 +30924 0x11/imm32/alloc-id:fake +30925 _Primitive-shift-reg-right-by-lit/imm32/next +30926 _Primitive-shift-reg-right-by-lit: # (payload primitive) +30927 0x11/imm32/alloc-id:fake:payload +30928 # var1/reg <- shift-right lit => c1/shift 5/subop/right var1/rm32 lit/imm32 30929 0x11/imm32/alloc-id:fake -30930 _string-break-if->=/imm32/name -30931 0/imm32/no-inouts -30932 0/imm32/no-inouts -30933 0/imm32/no-outputs -30934 0/imm32/no-outputs +30930 _string-shift-right/imm32/name +30931 0x11/imm32/alloc-id:fake +30932 Single-lit-var/imm32/inouts +30933 0x11/imm32/alloc-id:fake +30934 Single-int-var-in-some-register/imm32/outputs 30935 0x11/imm32/alloc-id:fake -30936 _string_0f_8d_jump_break/imm32/subx-name -30937 0/imm32/no-rm32 +30936 _string_c1_subop_shift_right_padding_zeroes/imm32/subx-name +30937 3/imm32/rm32-is-first-output 30938 0/imm32/no-r32 30939 0/imm32/no-imm32 -30940 0/imm32/no-imm8 +30940 1/imm32/imm8-is-first-inout 30941 0/imm32/no-disp32 30942 0/imm32/no-xm32 30943 0/imm32/no-x32 30944 0x11/imm32/alloc-id:fake -30945 _Primitive-break-if-<=/imm32/next -30946 _Primitive-break-if-<=: # (payload primitive) +30945 _Primitive-shift-reg-right-signed-by-lit/imm32/next +30946 _Primitive-shift-reg-right-signed-by-lit: # (payload primitive) 30947 0x11/imm32/alloc-id:fake:payload -30948 0x11/imm32/alloc-id:fake -30949 _string-break-if-<=/imm32/name -30950 0/imm32/no-inouts -30951 0/imm32/no-inouts -30952 0/imm32/no-outputs -30953 0/imm32/no-outputs -30954 0x11/imm32/alloc-id:fake -30955 _string_0f_8e_jump_break/imm32/subx-name -30956 0/imm32/no-rm32 -30957 0/imm32/no-r32 -30958 0/imm32/no-imm32 -30959 0/imm32/no-imm8 -30960 0/imm32/no-disp32 -30961 0/imm32/no-xm32 -30962 0/imm32/no-x32 -30963 0x11/imm32/alloc-id:fake -30964 _Primitive-break-if->/imm32/next -30965 _Primitive-break-if->: # (payload primitive) -30966 0x11/imm32/alloc-id:fake:payload -30967 0x11/imm32/alloc-id:fake -30968 _string-break-if->/imm32/name -30969 0/imm32/no-inouts -30970 0/imm32/no-inouts -30971 0/imm32/no-outputs -30972 0/imm32/no-outputs -30973 0x11/imm32/alloc-id:fake -30974 _string_0f_8f_jump_break/imm32/subx-name -30975 0/imm32/no-rm32 -30976 0/imm32/no-r32 -30977 0/imm32/no-imm32 -30978 0/imm32/no-imm8 -30979 0/imm32/no-disp32 -30980 0/imm32/no-xm32 -30981 0/imm32/no-x32 -30982 0x11/imm32/alloc-id:fake -30983 _Primitive-break/imm32/next -30984 _Primitive-break: # (payload primitive) -30985 0x11/imm32/alloc-id:fake:payload -30986 0x11/imm32/alloc-id:fake -30987 _string-break/imm32/name -30988 0/imm32/no-inouts -30989 0/imm32/no-inouts -30990 0/imm32/no-outputs -30991 0/imm32/no-outputs -30992 0x11/imm32/alloc-id:fake -30993 _string_e9_jump_break/imm32/subx-name -30994 0/imm32/no-rm32 -30995 0/imm32/no-r32 -30996 0/imm32/no-imm32 -30997 0/imm32/no-imm8 -30998 0/imm32/no-disp32 -30999 0/imm32/no-xm32 -31000 0/imm32/no-x32 -31001 0x11/imm32/alloc-id:fake -31002 _Primitive-loop-if-addr</imm32/next -31003 _Primitive-loop-if-addr<: # (payload primitive) -31004 0x11/imm32/alloc-id:fake:payload -31005 0x11/imm32/alloc-id:fake -31006 _string-loop-if-addr</imm32/name -31007 0/imm32/no-inouts -31008 0/imm32/no-inouts -31009 0/imm32/no-outputs -31010 0/imm32/no-outputs +30948 # var1/reg <- shift-right-signed lit => c1/shift 7/subop/right-preserving-sign var1/rm32 lit/imm32 +30949 0x11/imm32/alloc-id:fake +30950 _string-shift-right-signed/imm32/name +30951 0x11/imm32/alloc-id:fake +30952 Single-lit-var/imm32/inouts +30953 0x11/imm32/alloc-id:fake +30954 Single-int-var-in-some-register/imm32/outputs +30955 0x11/imm32/alloc-id:fake +30956 _string_c1_subop_shift_right_preserving_sign/imm32/subx-name +30957 3/imm32/rm32-is-first-output +30958 0/imm32/no-r32 +30959 0/imm32/no-imm32 +30960 1/imm32/imm8-is-first-inout +30961 0/imm32/no-disp32 +30962 0/imm32/no-xm32 +30963 0/imm32/no-x32 +30964 0x11/imm32/alloc-id:fake +30965 _Primitive-shift-mem-left-by-lit/imm32/next +30966 _Primitive-shift-mem-left-by-lit: # (payload primitive) +30967 0x11/imm32/alloc-id:fake:payload +30968 # shift-left var1, lit => c1/shift 4/subop/left var1/rm32 lit/imm32 +30969 0x11/imm32/alloc-id:fake +30970 _string-shift-left/imm32/name +30971 0x11/imm32/alloc-id:fake +30972 Int-var-and-literal/imm32/inouts +30973 0/imm32/no-outputs +30974 0/imm32/no-outputs +30975 0x11/imm32/alloc-id:fake +30976 _string_c1_subop_shift_left/imm32/subx-name +30977 1/imm32/rm32-is-first-inout +30978 0/imm32/no-r32 +30979 0/imm32/no-imm32 +30980 2/imm32/imm8-is-second-inout +30981 0/imm32/no-disp32 +30982 0/imm32/no-xm32 +30983 0/imm32/no-x32 +30984 0x11/imm32/alloc-id:fake +30985 _Primitive-shift-mem-right-by-lit/imm32/next +30986 _Primitive-shift-mem-right-by-lit: # (payload primitive) +30987 0x11/imm32/alloc-id:fake:payload +30988 # shift-right var1, lit => c1/shift 5/subop/right var1/rm32 lit/imm32 +30989 0x11/imm32/alloc-id:fake +30990 _string-shift-right/imm32/name +30991 0x11/imm32/alloc-id:fake +30992 Int-var-and-literal/imm32/inouts +30993 0/imm32/no-outputs +30994 0/imm32/no-outputs +30995 0x11/imm32/alloc-id:fake +30996 _string_c1_subop_shift_right_padding_zeroes/imm32/subx-name +30997 1/imm32/rm32-is-first-inout +30998 0/imm32/no-r32 +30999 0/imm32/no-imm32 +31000 2/imm32/imm8-is-second-inout +31001 0/imm32/no-disp32 +31002 0/imm32/no-xm32 +31003 0/imm32/no-x32 +31004 0x11/imm32/alloc-id:fake +31005 _Primitive-shift-mem-right-signed-by-lit/imm32/next +31006 _Primitive-shift-mem-right-signed-by-lit: # (payload primitive) +31007 0x11/imm32/alloc-id:fake:payload +31008 # shift-right-signed var1, lit => c1/shift 7/subop/right-preserving-sign var1/rm32 lit/imm32 +31009 0x11/imm32/alloc-id:fake +31010 _string-shift-right-signed/imm32/name 31011 0x11/imm32/alloc-id:fake -31012 _string_0f_82_jump_loop/imm32/subx-name -31013 0/imm32/no-rm32 -31014 0/imm32/no-r32 -31015 0/imm32/no-imm32 -31016 0/imm32/no-imm8 -31017 0/imm32/no-disp32 -31018 0/imm32/no-xm32 -31019 0/imm32/no-x32 -31020 0x11/imm32/alloc-id:fake -31021 _Primitive-loop-if-addr>=/imm32/next -31022 _Primitive-loop-if-addr>=: # (payload primitive) -31023 0x11/imm32/alloc-id:fake:payload +31012 Int-var-and-literal/imm32/inouts +31013 0/imm32/no-outputs +31014 0/imm32/no-outputs +31015 0x11/imm32/alloc-id:fake +31016 _string_c1_subop_shift_right_preserving_sign/imm32/subx-name +31017 1/imm32/rm32-is-first-inout +31018 0/imm32/no-r32 +31019 0/imm32/no-imm32 +31020 2/imm32/imm8-is-second-inout +31021 0/imm32/no-disp32 +31022 0/imm32/no-xm32 +31023 0/imm32/no-x32 31024 0x11/imm32/alloc-id:fake -31025 _string-loop-if-addr>=/imm32/name -31026 0/imm32/no-inouts -31027 0/imm32/no-inouts -31028 0/imm32/no-outputs -31029 0/imm32/no-outputs +31025 _Primitive-copy-to-eax/imm32/next +31026 # - copy +31027 _Primitive-copy-to-eax: # (payload primitive) +31028 0x11/imm32/alloc-id:fake:payload +31029 # var/eax <- copy lit => b8/copy-to-eax lit/imm32 31030 0x11/imm32/alloc-id:fake -31031 _string_0f_83_jump_loop/imm32/subx-name -31032 0/imm32/no-rm32 -31033 0/imm32/no-r32 -31034 0/imm32/no-imm32 -31035 0/imm32/no-imm8 -31036 0/imm32/no-disp32 -31037 0/imm32/no-xm32 -31038 0/imm32/no-x32 -31039 0x11/imm32/alloc-id:fake -31040 _Primitive-loop-if-=/imm32/next -31041 _Primitive-loop-if-=: # (payload primitive) -31042 0x11/imm32/alloc-id:fake:payload -31043 0x11/imm32/alloc-id:fake -31044 _string-loop-if-=/imm32/name -31045 0/imm32/no-inouts -31046 0/imm32/no-inouts -31047 0/imm32/no-outputs -31048 0/imm32/no-outputs -31049 0x11/imm32/alloc-id:fake -31050 _string_0f_84_jump_loop/imm32/subx-name -31051 0/imm32/no-rm32 -31052 0/imm32/no-r32 -31053 0/imm32/no-imm32 -31054 0/imm32/no-imm8 -31055 0/imm32/no-disp32 -31056 0/imm32/no-xm32 -31057 0/imm32/no-x32 -31058 0x11/imm32/alloc-id:fake -31059 _Primitive-loop-if-!=/imm32/next -31060 _Primitive-loop-if-!=: # (payload primitive) -31061 0x11/imm32/alloc-id:fake:payload -31062 0x11/imm32/alloc-id:fake -31063 _string-loop-if-!=/imm32/name -31064 0/imm32/no-inouts -31065 0/imm32/no-inouts -31066 0/imm32/no-outputs -31067 0/imm32/no-outputs -31068 0x11/imm32/alloc-id:fake -31069 _string_0f_85_jump_loop/imm32/subx-name -31070 0/imm32/no-rm32 -31071 0/imm32/no-r32 -31072 0/imm32/no-imm32 -31073 0/imm32/no-imm8 -31074 0/imm32/no-disp32 -31075 0/imm32/no-xm32 -31076 0/imm32/no-x32 -31077 0x11/imm32/alloc-id:fake -31078 _Primitive-loop-if-addr<=/imm32/next -31079 _Primitive-loop-if-addr<=: # (payload primitive) -31080 0x11/imm32/alloc-id:fake:payload -31081 0x11/imm32/alloc-id:fake -31082 _string-loop-if-addr<=/imm32/name -31083 0/imm32/no-inouts -31084 0/imm32/no-inouts -31085 0/imm32/no-outputs -31086 0/imm32/no-outputs -31087 0x11/imm32/alloc-id:fake -31088 _string_0f_86_jump_loop/imm32/subx-name -31089 0/imm32/no-rm32 -31090 0/imm32/no-r32 -31091 0/imm32/no-imm32 -31092 0/imm32/no-imm8 -31093 0/imm32/no-disp32 -31094 0/imm32/no-xm32 -31095 0/imm32/no-x32 +31031 _string-copy/imm32/name +31032 0x11/imm32/alloc-id:fake +31033 Single-lit-var/imm32/inouts +31034 0x11/imm32/alloc-id:fake +31035 Single-int-var-in-eax/imm32/outputs +31036 0x11/imm32/alloc-id:fake +31037 _string_b8_copy_to_eax/imm32/subx-name +31038 0/imm32/no-rm32 +31039 0/imm32/no-r32 +31040 1/imm32/imm32-is-first-inout +31041 0/imm32/no-imm8 +31042 0/imm32/no-disp32 +31043 0/imm32/no-xm32 +31044 0/imm32/no-x32 +31045 0x11/imm32/alloc-id:fake +31046 _Primitive-copy-to-ecx/imm32/next +31047 _Primitive-copy-to-ecx: # (payload primitive) +31048 0x11/imm32/alloc-id:fake:payload +31049 # var/ecx <- copy lit => b9/copy-to-ecx lit/imm32 +31050 0x11/imm32/alloc-id:fake +31051 _string-copy/imm32/name +31052 0x11/imm32/alloc-id:fake +31053 Single-lit-var/imm32/inouts +31054 0x11/imm32/alloc-id:fake +31055 Single-int-var-in-ecx/imm32/outputs +31056 0x11/imm32/alloc-id:fake +31057 _string_b9_copy_to_ecx/imm32/subx-name +31058 0/imm32/no-rm32 +31059 0/imm32/no-r32 +31060 1/imm32/imm32-is-first-inout +31061 0/imm32/no-imm8 +31062 0/imm32/no-disp32 +31063 0/imm32/no-xm32 +31064 0/imm32/no-x32 +31065 0x11/imm32/alloc-id:fake +31066 _Primitive-copy-to-edx/imm32/next +31067 _Primitive-copy-to-edx: # (payload primitive) +31068 0x11/imm32/alloc-id:fake:payload +31069 # var/edx <- copy lit => ba/copy-to-edx lit/imm32 +31070 0x11/imm32/alloc-id:fake +31071 _string-copy/imm32/name +31072 0x11/imm32/alloc-id:fake +31073 Single-lit-var/imm32/inouts +31074 0x11/imm32/alloc-id:fake +31075 Single-int-var-in-edx/imm32/outputs +31076 0x11/imm32/alloc-id:fake +31077 _string_ba_copy_to_edx/imm32/subx-name +31078 0/imm32/no-rm32 +31079 0/imm32/no-r32 +31080 1/imm32/imm32-is-first-inout +31081 0/imm32/no-imm8 +31082 0/imm32/no-disp32 +31083 0/imm32/no-xm32 +31084 0/imm32/no-x32 +31085 0x11/imm32/alloc-id:fake +31086 _Primitive-copy-to-ebx/imm32/next +31087 _Primitive-copy-to-ebx: # (payload primitive) +31088 0x11/imm32/alloc-id:fake:payload +31089 # var/ebx <- copy lit => bb/copy-to-ebx lit/imm32 +31090 0x11/imm32/alloc-id:fake +31091 _string-copy/imm32/name +31092 0x11/imm32/alloc-id:fake +31093 Single-lit-var/imm32/inouts +31094 0x11/imm32/alloc-id:fake +31095 Single-int-var-in-ebx/imm32/outputs 31096 0x11/imm32/alloc-id:fake -31097 _Primitive-loop-if-addr>/imm32/next -31098 _Primitive-loop-if-addr>: # (payload primitive) -31099 0x11/imm32/alloc-id:fake:payload -31100 0x11/imm32/alloc-id:fake -31101 _string-loop-if-addr>/imm32/name -31102 0/imm32/no-inouts -31103 0/imm32/no-inouts -31104 0/imm32/no-outputs -31105 0/imm32/no-outputs -31106 0x11/imm32/alloc-id:fake -31107 _string_0f_87_jump_loop/imm32/subx-name -31108 0/imm32/no-rm32 -31109 0/imm32/no-r32 -31110 0/imm32/no-imm32 -31111 0/imm32/no-imm8 -31112 0/imm32/no-disp32 -31113 0/imm32/no-xm32 -31114 0/imm32/no-x32 -31115 0x11/imm32/alloc-id:fake -31116 _Primitive-loop-if-</imm32/next -31117 _Primitive-loop-if-<: # (payload primitive) -31118 0x11/imm32/alloc-id:fake:payload -31119 0x11/imm32/alloc-id:fake -31120 _string-loop-if-</imm32/name -31121 0/imm32/no-inouts -31122 0/imm32/no-inouts -31123 0/imm32/no-outputs -31124 0/imm32/no-outputs +31097 _string_bb_copy_to_ebx/imm32/subx-name +31098 0/imm32/no-rm32 +31099 0/imm32/no-r32 +31100 1/imm32/imm32-is-first-inout +31101 0/imm32/no-imm8 +31102 0/imm32/no-disp32 +31103 0/imm32/no-xm32 +31104 0/imm32/no-x32 +31105 0x11/imm32/alloc-id:fake +31106 _Primitive-copy-to-esi/imm32/next +31107 _Primitive-copy-to-esi: # (payload primitive) +31108 0x11/imm32/alloc-id:fake:payload +31109 # var/esi <- copy lit => be/copy-to-esi lit/imm32 +31110 0x11/imm32/alloc-id:fake +31111 _string-copy/imm32/name +31112 0x11/imm32/alloc-id:fake +31113 Single-lit-var/imm32/inouts +31114 0x11/imm32/alloc-id:fake +31115 Single-int-var-in-esi/imm32/outputs +31116 0x11/imm32/alloc-id:fake +31117 _string_be_copy_to_esi/imm32/subx-name +31118 0/imm32/no-rm32 +31119 0/imm32/no-r32 +31120 1/imm32/imm32-is-first-inout +31121 0/imm32/no-imm8 +31122 0/imm32/no-disp32 +31123 0/imm32/no-xm32 +31124 0/imm32/no-x32 31125 0x11/imm32/alloc-id:fake -31126 _string_0f_8c_jump_loop/imm32/subx-name -31127 0/imm32/no-rm32 -31128 0/imm32/no-r32 -31129 0/imm32/no-imm32 -31130 0/imm32/no-imm8 -31131 0/imm32/no-disp32 -31132 0/imm32/no-xm32 -31133 0/imm32/no-x32 +31126 _Primitive-copy-to-edi/imm32/next +31127 _Primitive-copy-to-edi: # (payload primitive) +31128 0x11/imm32/alloc-id:fake:payload +31129 # var/edi <- copy lit => bf/copy-to-edi lit/imm32 +31130 0x11/imm32/alloc-id:fake +31131 _string-copy/imm32/name +31132 0x11/imm32/alloc-id:fake +31133 Single-lit-var/imm32/inouts 31134 0x11/imm32/alloc-id:fake -31135 _Primitive-loop-if->=/imm32/next -31136 _Primitive-loop-if->=: # (payload primitive) -31137 0x11/imm32/alloc-id:fake:payload -31138 0x11/imm32/alloc-id:fake -31139 _string-loop-if->=/imm32/name -31140 0/imm32/no-inouts -31141 0/imm32/no-inouts -31142 0/imm32/no-outputs -31143 0/imm32/no-outputs -31144 0x11/imm32/alloc-id:fake -31145 _string_0f_8d_jump_loop/imm32/subx-name -31146 0/imm32/no-rm32 -31147 0/imm32/no-r32 -31148 0/imm32/no-imm32 -31149 0/imm32/no-imm8 -31150 0/imm32/no-disp32 -31151 0/imm32/no-xm32 -31152 0/imm32/no-x32 -31153 0x11/imm32/alloc-id:fake -31154 _Primitive-loop-if-<=/imm32/next -31155 _Primitive-loop-if-<=: # (payload primitive) -31156 0x11/imm32/alloc-id:fake:payload -31157 0x11/imm32/alloc-id:fake -31158 _string-loop-if-<=/imm32/name -31159 0/imm32/no-inouts -31160 0/imm32/no-inouts -31161 0/imm32/no-outputs -31162 0/imm32/no-outputs -31163 0x11/imm32/alloc-id:fake -31164 _string_0f_8e_jump_loop/imm32/subx-name -31165 0/imm32/no-rm32 -31166 0/imm32/no-r32 -31167 0/imm32/no-imm32 -31168 0/imm32/no-imm8 -31169 0/imm32/no-disp32 -31170 0/imm32/no-xm32 -31171 0/imm32/no-x32 +31135 Single-int-var-in-edi/imm32/outputs +31136 0x11/imm32/alloc-id:fake +31137 _string_bf_copy_to_edi/imm32/subx-name +31138 0/imm32/no-rm32 +31139 0/imm32/no-r32 +31140 1/imm32/imm32-is-first-inout +31141 0/imm32/no-imm8 +31142 0/imm32/no-disp32 +31143 0/imm32/no-xm32 +31144 0/imm32/no-x32 +31145 0x11/imm32/alloc-id:fake +31146 _Primitive-copy-reg-to-reg/imm32/next +31147 _Primitive-copy-reg-to-reg: # (payload primitive) +31148 0x11/imm32/alloc-id:fake:payload +31149 # var1/reg <- copy var2/reg => 89/<- var1/rm32 var2/r32 +31150 0x11/imm32/alloc-id:fake +31151 _string-copy/imm32/name +31152 0x11/imm32/alloc-id:fake +31153 Single-int-var-in-some-register/imm32/inouts +31154 0x11/imm32/alloc-id:fake +31155 Single-int-var-in-some-register/imm32/outputs +31156 0x11/imm32/alloc-id:fake +31157 _string_89_<-/imm32/subx-name +31158 3/imm32/rm32-is-first-output +31159 1/imm32/r32-is-first-inout +31160 0/imm32/no-imm32 +31161 0/imm32/no-imm8 +31162 0/imm32/no-disp32 +31163 0/imm32/no-xm32 +31164 0/imm32/no-x32 +31165 0x11/imm32/alloc-id:fake +31166 _Primitive-copy-reg-to-mem/imm32/next +31167 _Primitive-copy-reg-to-mem: # (payload primitive) +31168 0x11/imm32/alloc-id:fake:payload +31169 # copy-to var1 var2/reg => 89/<- var1 var2/r32 +31170 0x11/imm32/alloc-id:fake +31171 _string-copy-to/imm32/name 31172 0x11/imm32/alloc-id:fake -31173 _Primitive-loop-if->/imm32/next -31174 _Primitive-loop-if->: # (payload primitive) -31175 0x11/imm32/alloc-id:fake:payload +31173 Two-args-int-stack-int-reg/imm32/inouts +31174 0/imm32/no-outputs +31175 0/imm32/no-outputs 31176 0x11/imm32/alloc-id:fake -31177 _string-loop-if->/imm32/name -31178 0/imm32/no-inouts -31179 0/imm32/no-inouts -31180 0/imm32/no-outputs -31181 0/imm32/no-outputs -31182 0x11/imm32/alloc-id:fake -31183 _string_0f_8f_jump_loop/imm32/subx-name -31184 0/imm32/no-rm32 -31185 0/imm32/no-r32 -31186 0/imm32/no-imm32 -31187 0/imm32/no-imm8 -31188 0/imm32/no-disp32 -31189 0/imm32/no-xm32 -31190 0/imm32/no-x32 -31191 0x11/imm32/alloc-id:fake -31192 _Primitive-loop/imm32/next # we probably don't need an unconditional break -31193 _Primitive-loop: # (payload primitive) -31194 0x11/imm32/alloc-id:fake:payload -31195 0x11/imm32/alloc-id:fake -31196 _string-loop/imm32/name -31197 0/imm32/no-inouts -31198 0/imm32/no-inouts -31199 0/imm32/no-outputs -31200 0/imm32/no-outputs -31201 0x11/imm32/alloc-id:fake -31202 _string_e9_jump_loop/imm32/subx-name -31203 0/imm32/no-rm32 -31204 0/imm32/no-r32 -31205 0/imm32/no-imm32 -31206 0/imm32/no-imm8 -31207 0/imm32/no-disp32 -31208 0/imm32/no-xm32 -31209 0/imm32/no-x32 +31177 _string_89_<-/imm32/subx-name +31178 1/imm32/rm32-is-first-inout +31179 2/imm32/r32-is-second-inout +31180 0/imm32/no-imm32 +31181 0/imm32/no-imm8 +31182 0/imm32/no-disp32 +31183 0/imm32/no-xm32 +31184 0/imm32/no-x32 +31185 0x11/imm32/alloc-id:fake +31186 _Primitive-copy-mem-to-reg/imm32/next +31187 _Primitive-copy-mem-to-reg: # (payload primitive) +31188 0x11/imm32/alloc-id:fake:payload +31189 # var1/reg <- copy var2 => 8b/-> var2/rm32 var1/r32 +31190 0x11/imm32/alloc-id:fake +31191 _string-copy/imm32/name +31192 0x11/imm32/alloc-id:fake +31193 Single-int-var-in-mem/imm32/inouts +31194 0x11/imm32/alloc-id:fake +31195 Single-int-var-in-some-register/imm32/outputs +31196 0x11/imm32/alloc-id:fake +31197 _string_8b_->/imm32/subx-name +31198 1/imm32/rm32-is-first-inout +31199 3/imm32/r32-is-first-output +31200 0/imm32/no-imm32 +31201 0/imm32/no-imm8 +31202 0/imm32/no-disp32 +31203 0/imm32/no-xm32 +31204 0/imm32/no-x32 +31205 0x11/imm32/alloc-id:fake +31206 _Primitive-copy-lit-to-reg/imm32/next +31207 _Primitive-copy-lit-to-reg: # (payload primitive) +31208 0x11/imm32/alloc-id:fake:payload +31209 # var1/reg <- copy lit => c7 0/subop/copy var1/rm32 lit/imm32 31210 0x11/imm32/alloc-id:fake -31211 _Primitive-break-if-addr<-named/imm32/next -31212 # - branches to named blocks -31213 _Primitive-break-if-addr<-named: # (payload primitive) -31214 0x11/imm32/alloc-id:fake:payload -31215 0x11/imm32/alloc-id:fake -31216 _string-break-if-addr</imm32/name -31217 0x11/imm32/alloc-id:fake -31218 Single-lit-var/imm32/inouts -31219 0/imm32/no-outputs -31220 0/imm32/no-outputs -31221 0x11/imm32/alloc-id:fake -31222 _string_0f_82_jump_label/imm32/subx-name -31223 0/imm32/no-rm32 -31224 0/imm32/no-r32 -31225 0/imm32/no-imm32 -31226 0/imm32/no-imm8 -31227 1/imm32/disp32-is-first-inout -31228 0/imm32/no-xm32 -31229 0/imm32/no-x32 +31211 _string-copy/imm32/name +31212 0x11/imm32/alloc-id:fake +31213 Single-lit-var/imm32/inouts +31214 0x11/imm32/alloc-id:fake +31215 Single-int-var-in-some-register/imm32/outputs +31216 0x11/imm32/alloc-id:fake +31217 _string_c7_subop_copy/imm32/subx-name +31218 3/imm32/rm32-is-first-output +31219 0/imm32/no-r32 +31220 1/imm32/imm32-is-first-inout +31221 0/imm32/no-imm8 +31222 0/imm32/no-disp32 +31223 0/imm32/no-xm32 +31224 0/imm32/no-x32 +31225 0x11/imm32/alloc-id:fake +31226 _Primitive-copy-lit-to-mem/imm32/next +31227 _Primitive-copy-lit-to-mem: # (payload primitive) +31228 0x11/imm32/alloc-id:fake:payload +31229 # copy-to var1, lit => c7 0/subop/copy var1/rm32 lit/imm32 31230 0x11/imm32/alloc-id:fake -31231 _Primitive-break-if-addr>=-named/imm32/next -31232 _Primitive-break-if-addr>=-named: # (payload primitive) -31233 0x11/imm32/alloc-id:fake:payload -31234 0x11/imm32/alloc-id:fake -31235 _string-break-if-addr>=/imm32/name +31231 _string-copy-to/imm32/name +31232 0x11/imm32/alloc-id:fake +31233 Int-var-and-literal/imm32/inouts +31234 0/imm32/no-outputs +31235 0/imm32/no-outputs 31236 0x11/imm32/alloc-id:fake -31237 Single-lit-var/imm32/inouts -31238 0/imm32/no-outputs -31239 0/imm32/no-outputs -31240 0x11/imm32/alloc-id:fake -31241 _string_0f_83_jump_label/imm32/subx-name -31242 0/imm32/no-rm32 -31243 0/imm32/no-r32 -31244 0/imm32/no-imm32 -31245 0/imm32/no-imm8 -31246 1/imm32/disp32-is-first-inout -31247 0/imm32/no-xm32 -31248 0/imm32/no-x32 -31249 0x11/imm32/alloc-id:fake -31250 _Primitive-break-if-=-named/imm32/next -31251 _Primitive-break-if-=-named: # (payload primitive) -31252 0x11/imm32/alloc-id:fake:payload +31237 _string_c7_subop_copy/imm32/subx-name +31238 1/imm32/rm32-is-first-inout +31239 0/imm32/no-r32 +31240 2/imm32/imm32-is-second-inout +31241 0/imm32/no-imm8 +31242 0/imm32/no-disp32 +31243 0/imm32/no-xm32 +31244 0/imm32/no-x32 +31245 0x11/imm32/alloc-id:fake +31246 _Primitive-copy-byte-from-reg/imm32/next +31247 # - copy byte +31248 _Primitive-copy-byte-from-reg: +31249 0x11/imm32/alloc-id:fake:payload +31250 # var/reg <- copy-byte var2/reg2 => 8a/byte-> %var2 var/r32 +31251 0x11/imm32/alloc-id:fake +31252 _string-copy-byte/imm32/name 31253 0x11/imm32/alloc-id:fake -31254 _string-break-if-=/imm32/name +31254 Single-byte-var-in-some-register/imm32/inouts 31255 0x11/imm32/alloc-id:fake -31256 Single-lit-var/imm32/inouts -31257 0/imm32/no-outputs -31258 0/imm32/no-outputs -31259 0x11/imm32/alloc-id:fake -31260 _string_0f_84_jump_label/imm32/subx-name -31261 0/imm32/no-rm32 -31262 0/imm32/no-r32 -31263 0/imm32/no-imm32 -31264 0/imm32/no-imm8 -31265 1/imm32/disp32-is-first-inout -31266 0/imm32/no-xm32 -31267 0/imm32/no-x32 -31268 0x11/imm32/alloc-id:fake -31269 _Primitive-break-if-!=-named/imm32/next -31270 _Primitive-break-if-!=-named: # (payload primitive) -31271 0x11/imm32/alloc-id:fake:payload -31272 0x11/imm32/alloc-id:fake -31273 _string-break-if-!=/imm32/name -31274 0x11/imm32/alloc-id:fake -31275 Single-lit-var/imm32/inouts -31276 0/imm32/no-outputs -31277 0/imm32/no-outputs -31278 0x11/imm32/alloc-id:fake -31279 _string_0f_85_jump_label/imm32/subx-name -31280 0/imm32/no-rm32 -31281 0/imm32/no-r32 -31282 0/imm32/no-imm32 -31283 0/imm32/no-imm8 -31284 1/imm32/disp32-is-first-inout -31285 0/imm32/no-xm32 -31286 0/imm32/no-x32 -31287 0x11/imm32/alloc-id:fake -31288 _Primitive-break-if-addr<=-named/imm32/next -31289 _Primitive-break-if-addr<=-named: # (payload primitive) -31290 0x11/imm32/alloc-id:fake:payload +31256 Single-byte-var-in-some-register/imm32/outputs +31257 0x11/imm32/alloc-id:fake +31258 _string_8a_copy_byte/imm32/subx-name +31259 1/imm32/rm32-is-first-inout +31260 3/imm32/r32-is-first-output +31261 0/imm32/no-imm32 +31262 0/imm32/no-imm8 +31263 0/imm32/no-disp32 +31264 0/imm32/no-xm32 +31265 0/imm32/no-x32 +31266 0x11/imm32/alloc-id:fake +31267 _Primitive-copy-byte-from-mem/imm32/next +31268 _Primitive-copy-byte-from-mem: +31269 0x11/imm32/alloc-id:fake:payload +31270 # var/reg <- copy-byte *var2/reg2 => 8a/byte-> *var2 var/r32 +31271 0x11/imm32/alloc-id:fake +31272 _string-copy-byte/imm32/name +31273 0x11/imm32/alloc-id:fake +31274 Single-byte-var-in-mem/imm32/inouts +31275 0x11/imm32/alloc-id:fake +31276 Single-byte-var-in-some-register/imm32/outputs +31277 0x11/imm32/alloc-id:fake +31278 _string_8a_copy_byte/imm32/subx-name +31279 1/imm32/rm32-is-first-inout +31280 3/imm32/r32-is-first-output +31281 0/imm32/no-imm32 +31282 0/imm32/no-imm8 +31283 0/imm32/no-disp32 +31284 0/imm32/no-xm32 +31285 0/imm32/no-x32 +31286 0x11/imm32/alloc-id:fake +31287 _Primitive-copy-byte-to-mem/imm32/next +31288 _Primitive-copy-byte-to-mem: +31289 0x11/imm32/alloc-id:fake:payload +31290 # copy-byte-to *var1/reg1, var2/reg2 => 88/byte<- *reg1 reg2/r32 31291 0x11/imm32/alloc-id:fake -31292 _string-break-if-addr<=/imm32/name +31292 _string-copy-byte-to/imm32/name 31293 0x11/imm32/alloc-id:fake -31294 Single-lit-var/imm32/inouts +31294 Two-args-byte-stack-byte-reg/imm32/inouts 31295 0/imm32/no-outputs 31296 0/imm32/no-outputs 31297 0x11/imm32/alloc-id:fake -31298 _string_0f_86_jump_label/imm32/subx-name -31299 0/imm32/no-rm32 -31300 0/imm32/no-r32 +31298 _string_88_copy_byte/imm32/subx-name +31299 1/imm32/rm32-is-first-inout +31300 2/imm32/r32-is-second-inout 31301 0/imm32/no-imm32 31302 0/imm32/no-imm8 -31303 1/imm32/disp32-is-first-inout +31303 0/imm32/no-disp32 31304 0/imm32/no-xm32 31305 0/imm32/no-x32 31306 0x11/imm32/alloc-id:fake -31307 _Primitive-break-if-addr>-named/imm32/next -31308 _Primitive-break-if-addr>-named: # (payload primitive) -31309 0x11/imm32/alloc-id:fake:payload -31310 0x11/imm32/alloc-id:fake -31311 _string-break-if-addr>/imm32/name +31307 _Primitive-address/imm32/next +31308 # - address +31309 _Primitive-address: # (payload primitive) +31310 0x11/imm32/alloc-id:fake:payload +31311 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 31312 0x11/imm32/alloc-id:fake -31313 Single-lit-var/imm32/inouts -31314 0/imm32/no-outputs -31315 0/imm32/no-outputs +31313 _string-address/imm32/name +31314 0x11/imm32/alloc-id:fake +31315 Single-int-var-in-mem/imm32/inouts 31316 0x11/imm32/alloc-id:fake -31317 _string_0f_87_jump_label/imm32/subx-name -31318 0/imm32/no-rm32 -31319 0/imm32/no-r32 -31320 0/imm32/no-imm32 -31321 0/imm32/no-imm8 -31322 1/imm32/disp32-is-first-inout -31323 0/imm32/no-xm32 -31324 0/imm32/no-x32 -31325 0x11/imm32/alloc-id:fake -31326 _Primitive-break-if-<-named/imm32/next -31327 _Primitive-break-if-<-named: # (payload primitive) -31328 0x11/imm32/alloc-id:fake:payload -31329 0x11/imm32/alloc-id:fake -31330 _string-break-if-</imm32/name -31331 0x11/imm32/alloc-id:fake -31332 Single-lit-var/imm32/inouts -31333 0/imm32/no-outputs -31334 0/imm32/no-outputs +31317 Single-addr-var-in-some-register/imm32/outputs +31318 0x11/imm32/alloc-id:fake +31319 _string_8d_copy_address/imm32/subx-name +31320 1/imm32/rm32-is-first-inout +31321 3/imm32/r32-is-first-output +31322 0/imm32/no-imm32 +31323 0/imm32/no-imm8 +31324 0/imm32/no-disp32 +31325 0/imm32/no-xm32 +31326 0/imm32/no-x32 +31327 0x11/imm32/alloc-id:fake +31328 _Primitive-compare-reg-with-reg/imm32/next +31329 # - compare +31330 _Primitive-compare-reg-with-reg: # (payload primitive) +31331 0x11/imm32/alloc-id:fake:payload +31332 # compare var1/reg1 var2/reg2 => 39/compare var1/rm32 var2/r32 +31333 0x11/imm32/alloc-id:fake +31334 _string-compare/imm32/name 31335 0x11/imm32/alloc-id:fake -31336 _string_0f_8c_jump_label/imm32/subx-name -31337 0/imm32/no-rm32 -31338 0/imm32/no-r32 -31339 0/imm32/no-imm32 -31340 0/imm32/no-imm8 -31341 1/imm32/disp32-is-first-inout -31342 0/imm32/no-xm32 -31343 0/imm32/no-x32 -31344 0x11/imm32/alloc-id:fake -31345 _Primitive-break-if->=-named/imm32/next -31346 _Primitive-break-if->=-named: # (payload primitive) -31347 0x11/imm32/alloc-id:fake:payload +31336 Two-int-args-in-regs/imm32/inouts +31337 0/imm32/no-outputs +31338 0/imm32/no-outputs +31339 0x11/imm32/alloc-id:fake +31340 _string_39_compare->/imm32/subx-name +31341 1/imm32/rm32-is-first-inout +31342 2/imm32/r32-is-second-inout +31343 0/imm32/no-imm32 +31344 0/imm32/no-imm8 +31345 0/imm32/no-disp32 +31346 0/imm32/no-xm32 +31347 0/imm32/no-x32 31348 0x11/imm32/alloc-id:fake -31349 _string-break-if->=/imm32/name -31350 0x11/imm32/alloc-id:fake -31351 Single-lit-var/imm32/inouts -31352 0/imm32/no-outputs -31353 0/imm32/no-outputs -31354 0x11/imm32/alloc-id:fake -31355 _string_0f_8d_jump_label/imm32/subx-name -31356 0/imm32/no-rm32 -31357 0/imm32/no-r32 -31358 0/imm32/no-imm32 -31359 0/imm32/no-imm8 -31360 1/imm32/disp32-is-first-inout -31361 0/imm32/no-xm32 -31362 0/imm32/no-x32 -31363 0x11/imm32/alloc-id:fake -31364 _Primitive-break-if-<=-named/imm32/next -31365 _Primitive-break-if-<=-named: # (payload primitive) -31366 0x11/imm32/alloc-id:fake:payload -31367 0x11/imm32/alloc-id:fake -31368 _string-break-if-<=/imm32/name -31369 0x11/imm32/alloc-id:fake -31370 Single-lit-var/imm32/inouts -31371 0/imm32/no-outputs -31372 0/imm32/no-outputs +31349 _Primitive-compare-mem-with-reg/imm32/next +31350 _Primitive-compare-mem-with-reg: # (payload primitive) +31351 0x11/imm32/alloc-id:fake:payload +31352 # compare var1 var2/reg => 39/compare var1/rm32 var2/r32 +31353 0x11/imm32/alloc-id:fake +31354 _string-compare/imm32/name +31355 0x11/imm32/alloc-id:fake +31356 Two-args-int-stack-int-reg/imm32/inouts +31357 0/imm32/no-outputs +31358 0/imm32/no-outputs +31359 0x11/imm32/alloc-id:fake +31360 _string_39_compare->/imm32/subx-name +31361 1/imm32/rm32-is-first-inout +31362 2/imm32/r32-is-second-inout +31363 0/imm32/no-imm32 +31364 0/imm32/no-imm8 +31365 0/imm32/no-disp32 +31366 0/imm32/no-xm32 +31367 0/imm32/no-x32 +31368 0x11/imm32/alloc-id:fake +31369 _Primitive-compare-reg-with-mem/imm32/next +31370 _Primitive-compare-reg-with-mem: # (payload primitive) +31371 0x11/imm32/alloc-id:fake:payload +31372 # compare var1/reg var2 => 3b/compare<- var2/rm32 var1/r32 31373 0x11/imm32/alloc-id:fake -31374 _string_0f_8e_jump_label/imm32/subx-name -31375 0/imm32/no-rm32 -31376 0/imm32/no-r32 -31377 0/imm32/no-imm32 -31378 0/imm32/no-imm8 -31379 1/imm32/disp32-is-first-inout -31380 0/imm32/no-xm32 -31381 0/imm32/no-x32 -31382 0x11/imm32/alloc-id:fake -31383 _Primitive-break-if->-named/imm32/next -31384 _Primitive-break-if->-named: # (payload primitive) -31385 0x11/imm32/alloc-id:fake:payload -31386 0x11/imm32/alloc-id:fake -31387 _string-break-if->/imm32/name +31374 _string-compare/imm32/name +31375 0x11/imm32/alloc-id:fake +31376 Two-args-int-reg-int-stack/imm32/inouts +31377 0/imm32/no-outputs +31378 0/imm32/no-outputs +31379 0x11/imm32/alloc-id:fake +31380 _string_3b_compare<-/imm32/subx-name +31381 2/imm32/rm32-is-second-inout +31382 1/imm32/r32-is-first-inout +31383 0/imm32/no-imm32 +31384 0/imm32/no-imm8 +31385 0/imm32/no-disp32 +31386 0/imm32/no-xm32 +31387 0/imm32/no-x32 31388 0x11/imm32/alloc-id:fake -31389 Single-lit-var/imm32/inouts -31390 0/imm32/no-outputs -31391 0/imm32/no-outputs -31392 0x11/imm32/alloc-id:fake -31393 _string_0f_8f_jump_label/imm32/subx-name -31394 0/imm32/no-rm32 -31395 0/imm32/no-r32 -31396 0/imm32/no-imm32 -31397 0/imm32/no-imm8 -31398 1/imm32/disp32-is-first-inout -31399 0/imm32/no-xm32 -31400 0/imm32/no-x32 -31401 0x11/imm32/alloc-id:fake -31402 _Primitive-break-named/imm32/next -31403 _Primitive-break-named: # (payload primitive) -31404 0x11/imm32/alloc-id:fake:payload -31405 0x11/imm32/alloc-id:fake -31406 _string-break/imm32/name -31407 0x11/imm32/alloc-id:fake -31408 Single-lit-var/imm32/inouts -31409 0/imm32/no-outputs -31410 0/imm32/no-outputs -31411 0x11/imm32/alloc-id:fake -31412 _string_e9_jump_label/imm32/subx-name -31413 0/imm32/no-rm32 -31414 0/imm32/no-r32 -31415 0/imm32/no-imm32 -31416 0/imm32/no-imm8 -31417 1/imm32/disp32-is-first-inout -31418 0/imm32/no-xm32 -31419 0/imm32/no-x32 -31420 0x11/imm32/alloc-id:fake -31421 _Primitive-loop-if-addr<-named/imm32/next -31422 _Primitive-loop-if-addr<-named: # (payload primitive) -31423 0x11/imm32/alloc-id:fake:payload -31424 0x11/imm32/alloc-id:fake -31425 _string-loop-if-addr</imm32/name -31426 0x11/imm32/alloc-id:fake -31427 Single-lit-var/imm32/inouts -31428 0/imm32/no-outputs -31429 0/imm32/no-outputs -31430 0x11/imm32/alloc-id:fake -31431 _string_0f_82_jump_label/imm32/subx-name -31432 0/imm32/no-rm32 -31433 0/imm32/no-r32 -31434 0/imm32/no-imm32 -31435 0/imm32/no-imm8 -31436 1/imm32/disp32-is-first-inout -31437 0/imm32/no-xm32 -31438 0/imm32/no-x32 +31389 _Primitive-compare-eax-with-literal/imm32/next +31390 _Primitive-compare-eax-with-literal: # (payload primitive) +31391 0x11/imm32/alloc-id:fake:payload +31392 # compare var1/eax n => 3d/compare-eax-with n/imm32 +31393 0x11/imm32/alloc-id:fake +31394 _string-compare/imm32/name +31395 0x11/imm32/alloc-id:fake +31396 Two-args-int-eax-int-literal/imm32/inouts +31397 0/imm32/no-outputs +31398 0/imm32/no-outputs +31399 0x11/imm32/alloc-id:fake +31400 _string_3d_compare_eax_with/imm32/subx-name +31401 0/imm32/no-rm32 +31402 0/imm32/no-r32 +31403 2/imm32/imm32-is-second-inout +31404 0/imm32/no-imm8 +31405 0/imm32/no-disp32 +31406 0/imm32/no-xm32 +31407 0/imm32/no-x32 +31408 0x11/imm32/alloc-id:fake +31409 _Primitive-compare-reg-with-literal/imm32/next +31410 _Primitive-compare-reg-with-literal: # (payload primitive) +31411 0x11/imm32/alloc-id:fake:payload +31412 # compare var1/reg n => 81 7/subop/compare %reg n/imm32 +31413 0x11/imm32/alloc-id:fake +31414 _string-compare/imm32/name +31415 0x11/imm32/alloc-id:fake +31416 Int-var-in-register-and-literal/imm32/inouts +31417 0/imm32/no-outputs +31418 0/imm32/no-outputs +31419 0x11/imm32/alloc-id:fake +31420 _string_81_subop_compare/imm32/subx-name +31421 1/imm32/rm32-is-first-inout +31422 0/imm32/no-r32 +31423 2/imm32/imm32-is-second-inout +31424 0/imm32/no-imm8 +31425 0/imm32/no-disp32 +31426 0/imm32/no-xm32 +31427 0/imm32/no-x32 +31428 0x11/imm32/alloc-id:fake +31429 _Primitive-compare-mem-with-literal/imm32/next +31430 _Primitive-compare-mem-with-literal: # (payload primitive) +31431 0x11/imm32/alloc-id:fake:payload +31432 # compare var1 n => 81 7/subop/compare *(ebp+___) n/imm32 +31433 0x11/imm32/alloc-id:fake +31434 _string-compare/imm32/name +31435 0x11/imm32/alloc-id:fake +31436 Int-var-and-literal/imm32/inouts +31437 0/imm32/no-outputs +31438 0/imm32/no-outputs 31439 0x11/imm32/alloc-id:fake -31440 _Primitive-loop-if-addr>=-named/imm32/next -31441 _Primitive-loop-if-addr>=-named: # (payload primitive) -31442 0x11/imm32/alloc-id:fake:payload -31443 0x11/imm32/alloc-id:fake -31444 _string-loop-if-addr>=/imm32/name -31445 0x11/imm32/alloc-id:fake -31446 Single-lit-var/imm32/inouts -31447 0/imm32/no-outputs -31448 0/imm32/no-outputs -31449 0x11/imm32/alloc-id:fake -31450 _string_0f_83_jump_label/imm32/subx-name -31451 0/imm32/no-rm32 -31452 0/imm32/no-r32 -31453 0/imm32/no-imm32 -31454 0/imm32/no-imm8 -31455 1/imm32/disp32-is-first-inout -31456 0/imm32/no-xm32 -31457 0/imm32/no-x32 +31440 _string_81_subop_compare/imm32/subx-name +31441 1/imm32/rm32-is-first-inout +31442 0/imm32/no-r32 +31443 2/imm32/imm32-is-second-inout +31444 0/imm32/no-imm8 +31445 0/imm32/no-disp32 +31446 0/imm32/no-xm32 +31447 0/imm32/no-x32 +31448 0x11/imm32/alloc-id:fake +31449 _Primitive-negate-reg/imm32/next +31450 # - negate +31451 _Primitive-negate-reg: # (payload primitive) +31452 0x11/imm32/alloc-id:fake:payload +31453 # var1/reg <- negate => f7 3/subop/negate var1/rm32 +31454 0x11/imm32/alloc-id:fake +31455 _string-negate/imm32/name +31456 0/imm32/no-inouts +31457 0/imm32/no-inouts 31458 0x11/imm32/alloc-id:fake -31459 _Primitive-loop-if-=-named/imm32/next -31460 _Primitive-loop-if-=-named: # (payload primitive) -31461 0x11/imm32/alloc-id:fake:payload -31462 0x11/imm32/alloc-id:fake -31463 _string-loop-if-=/imm32/name -31464 0x11/imm32/alloc-id:fake -31465 Single-lit-var/imm32/inouts -31466 0/imm32/no-outputs -31467 0/imm32/no-outputs -31468 0x11/imm32/alloc-id:fake -31469 _string_0f_84_jump_label/imm32/subx-name -31470 0/imm32/no-rm32 -31471 0/imm32/no-r32 -31472 0/imm32/no-imm32 -31473 0/imm32/no-imm8 -31474 1/imm32/disp32-is-first-inout -31475 0/imm32/no-xm32 -31476 0/imm32/no-x32 -31477 0x11/imm32/alloc-id:fake -31478 _Primitive-loop-if-!=-named/imm32/next -31479 _Primitive-loop-if-!=-named: # (payload primitive) -31480 0x11/imm32/alloc-id:fake:payload -31481 0x11/imm32/alloc-id:fake -31482 _string-loop-if-!=/imm32/name -31483 0x11/imm32/alloc-id:fake -31484 Single-lit-var/imm32/inouts -31485 0/imm32/no-outputs -31486 0/imm32/no-outputs -31487 0x11/imm32/alloc-id:fake -31488 _string_0f_85_jump_label/imm32/subx-name -31489 0/imm32/no-rm32 -31490 0/imm32/no-r32 -31491 0/imm32/no-imm32 -31492 0/imm32/no-imm8 -31493 1/imm32/disp32-is-first-inout -31494 0/imm32/no-xm32 -31495 0/imm32/no-x32 -31496 0x11/imm32/alloc-id:fake -31497 _Primitive-loop-if-addr<=-named/imm32/next -31498 _Primitive-loop-if-addr<=-named: # (payload primitive) -31499 0x11/imm32/alloc-id:fake:payload -31500 0x11/imm32/alloc-id:fake -31501 _string-loop-if-addr<=/imm32/name -31502 0x11/imm32/alloc-id:fake -31503 Single-lit-var/imm32/inouts -31504 0/imm32/no-outputs -31505 0/imm32/no-outputs -31506 0x11/imm32/alloc-id:fake -31507 _string_0f_86_jump_label/imm32/subx-name -31508 0/imm32/no-rm32 -31509 0/imm32/no-r32 -31510 0/imm32/no-imm32 -31511 0/imm32/no-imm8 -31512 1/imm32/disp32-is-first-inout -31513 0/imm32/no-xm32 -31514 0/imm32/no-x32 +31459 Single-int-var-in-some-register/imm32/outputs +31460 0x11/imm32/alloc-id:fake +31461 _string_f7_subop_negate/imm32/subx-name +31462 3/imm32/rm32-is-first-output +31463 0/imm32/no-r32 +31464 0/imm32/no-imm32 +31465 0/imm32/no-imm8 +31466 0/imm32/no-disp32 +31467 0/imm32/no-xm32 +31468 0/imm32/no-x32 +31469 0x11/imm32/alloc-id:fake +31470 _Primitive-negate-mem/imm32/next +31471 _Primitive-negate-mem: # (payload primitive) +31472 0x11/imm32/alloc-id:fake:payload +31473 # negate var1 => f7 3/subop/negate var1/rm32 +31474 0x11/imm32/alloc-id:fake +31475 _string-negate/imm32/name +31476 0x11/imm32/alloc-id:fake +31477 Single-int-var-in-mem/imm32/inouts +31478 0/imm32/no-outputs +31479 0/imm32/no-outputs +31480 0x11/imm32/alloc-id:fake +31481 _string_f7_subop_negate/imm32/subx-name +31482 1/imm32/rm32-is-first-inout +31483 0/imm32/no-r32 +31484 0/imm32/no-imm32 +31485 0/imm32/no-imm8 +31486 0/imm32/no-disp32 +31487 0/imm32/no-xm32 +31488 0/imm32/no-x32 +31489 0x11/imm32/alloc-id:fake +31490 _Primitive-multiply-reg-by-reg/imm32/next +31491 # - multiply +31492 _Primitive-multiply-reg-by-reg: # (payload primitive) +31493 0x11/imm32/alloc-id:fake:payload +31494 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 +31495 0x11/imm32/alloc-id:fake +31496 _string-multiply/imm32/name +31497 0x11/imm32/alloc-id:fake +31498 Single-int-var-in-some-register/imm32/inouts +31499 0x11/imm32/alloc-id:fake +31500 Single-int-var-in-some-register/imm32/outputs +31501 0x11/imm32/alloc-id:fake +31502 _string_0f_af_multiply/imm32/subx-name +31503 1/imm32/rm32-is-first-inout +31504 3/imm32/r32-is-first-output +31505 0/imm32/no-imm32 +31506 0/imm32/no-imm8 +31507 0/imm32/no-disp32 +31508 0/imm32/no-xm32 +31509 0/imm32/no-x32 +31510 0x11/imm32/alloc-id:fake +31511 _Primitive-multiply-reg-by-mem/imm32/next +31512 _Primitive-multiply-reg-by-mem: # (payload primitive) +31513 0x11/imm32/alloc-id:fake:payload +31514 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 31515 0x11/imm32/alloc-id:fake -31516 _Primitive-loop-if-addr>-named/imm32/next -31517 _Primitive-loop-if-addr>-named: # (payload primitive) -31518 0x11/imm32/alloc-id:fake:payload +31516 _string-multiply/imm32/name +31517 0x11/imm32/alloc-id:fake +31518 Single-int-var-in-mem/imm32/inouts 31519 0x11/imm32/alloc-id:fake -31520 _string-loop-if-addr>/imm32/name +31520 Single-int-var-in-some-register/imm32/outputs 31521 0x11/imm32/alloc-id:fake -31522 Single-lit-var/imm32/inouts -31523 0/imm32/no-outputs -31524 0/imm32/no-outputs -31525 0x11/imm32/alloc-id:fake -31526 _string_0f_87_jump_label/imm32/subx-name -31527 0/imm32/no-rm32 -31528 0/imm32/no-r32 -31529 0/imm32/no-imm32 -31530 0/imm32/no-imm8 -31531 1/imm32/disp32-is-first-inout -31532 0/imm32/no-xm32 -31533 0/imm32/no-x32 -31534 0x11/imm32/alloc-id:fake -31535 _Primitive-loop-if-<-named/imm32/next -31536 _Primitive-loop-if-<-named: # (payload primitive) -31537 0x11/imm32/alloc-id:fake:payload +31522 _string_0f_af_multiply/imm32/subx-name +31523 1/imm32/rm32-is-first-inout +31524 3/imm32/r32-is-first-output +31525 0/imm32/no-imm32 +31526 0/imm32/no-imm8 +31527 0/imm32/no-disp32 +31528 0/imm32/no-xm32 +31529 0/imm32/no-x32 +31530 0x11/imm32/alloc-id:fake +31531 _Primitive-convert-mem-to-xreg/imm32/next +31532 # - convert int to floating point +31533 _Primitive-convert-mem-to-xreg: # (payload primitive) +31534 0x11/imm32/alloc-id:fake:payload +31535 # var1/xreg <- convert var2 => f3 0f 2a/convert-to-float var2/rm32 var1/x32 +31536 0x11/imm32/alloc-id:fake +31537 _string-convert/imm32/name 31538 0x11/imm32/alloc-id:fake -31539 _string-loop-if-</imm32/name +31539 Single-int-var-in-mem/imm32/inouts 31540 0x11/imm32/alloc-id:fake -31541 Single-lit-var/imm32/inouts -31542 0/imm32/no-outputs -31543 0/imm32/no-outputs -31544 0x11/imm32/alloc-id:fake -31545 _string_0f_8c_jump_label/imm32/subx-name -31546 0/imm32/no-rm32 -31547 0/imm32/no-r32 -31548 0/imm32/no-imm32 -31549 0/imm32/no-imm8 -31550 1/imm32/disp32-is-first-inout -31551 0/imm32/no-xm32 -31552 0/imm32/no-x32 -31553 0x11/imm32/alloc-id:fake -31554 _Primitive-loop-if->=-named/imm32/next -31555 _Primitive-loop-if->=-named: # (payload primitive) -31556 0x11/imm32/alloc-id:fake:payload -31557 0x11/imm32/alloc-id:fake -31558 _string-loop-if->=/imm32/name -31559 0x11/imm32/alloc-id:fake -31560 Single-lit-var/imm32/inouts -31561 0/imm32/no-outputs -31562 0/imm32/no-outputs -31563 0x11/imm32/alloc-id:fake -31564 _string_0f_8d_jump_label/imm32/subx-name -31565 0/imm32/no-rm32 -31566 0/imm32/no-r32 -31567 0/imm32/no-imm32 -31568 0/imm32/no-imm8 -31569 1/imm32/disp32-is-first-inout -31570 0/imm32/no-xm32 -31571 0/imm32/no-x32 -31572 0x11/imm32/alloc-id:fake -31573 _Primitive-loop-if-<=-named/imm32/next -31574 _Primitive-loop-if-<=-named: # (payload primitive) +31541 Single-float-var-in-some-register/imm32/outputs +31542 0x11/imm32/alloc-id:fake +31543 _string_f3_0f_2a_convert_to_float/imm32/subx-name +31544 1/imm32/rm32-is-first-inout +31545 0/imm32/no-r32 +31546 0/imm32/no-imm32 +31547 0/imm32/no-imm8 +31548 0/imm32/no-disp32 +31549 0/imm32/no-xm32 +31550 3/imm32/x32-is-first-output +31551 0x11/imm32/alloc-id:fake +31552 _Primitive-convert-reg-to-xreg/imm32/next +31553 _Primitive-convert-reg-to-xreg: # (payload primitive) +31554 0x11/imm32/alloc-id:fake:payload +31555 # var1/xreg <- convert var2/reg => f3 0f 2a/convert-to-float var2/rm32 var1/x32 +31556 0x11/imm32/alloc-id:fake +31557 _string-convert/imm32/name +31558 0x11/imm32/alloc-id:fake +31559 Single-int-var-in-some-register/imm32/inouts +31560 0x11/imm32/alloc-id:fake +31561 Single-float-var-in-some-register/imm32/outputs +31562 0x11/imm32/alloc-id:fake +31563 _string_f3_0f_2a_convert_to_float/imm32/subx-name +31564 1/imm32/rm32-is-first-inout +31565 0/imm32/no-r32 +31566 0/imm32/no-imm32 +31567 0/imm32/no-imm8 +31568 0/imm32/no-disp32 +31569 0/imm32/no-xm32 +31570 3/imm32/x32-is-first-output +31571 0x11/imm32/alloc-id:fake +31572 _Primitive-convert-xmem-to-reg/imm32/next +31573 # - convert floating point to int +31574 _Primitive-convert-xmem-to-reg: # (payload primitive) 31575 0x11/imm32/alloc-id:fake:payload -31576 0x11/imm32/alloc-id:fake -31577 _string-loop-if-<=/imm32/name -31578 0x11/imm32/alloc-id:fake -31579 Single-lit-var/imm32/inouts -31580 0/imm32/no-outputs -31581 0/imm32/no-outputs -31582 0x11/imm32/alloc-id:fake -31583 _string_0f_8e_jump_label/imm32/subx-name -31584 0/imm32/no-rm32 -31585 0/imm32/no-r32 -31586 0/imm32/no-imm32 -31587 0/imm32/no-imm8 -31588 1/imm32/disp32-is-first-inout -31589 0/imm32/no-xm32 -31590 0/imm32/no-x32 -31591 0x11/imm32/alloc-id:fake -31592 _Primitive-loop-if->-named/imm32/next -31593 _Primitive-loop-if->-named: # (payload primitive) -31594 0x11/imm32/alloc-id:fake:payload -31595 0x11/imm32/alloc-id:fake -31596 _string-loop-if->/imm32/name +31576 # var1/reg <- convert var2 => f3 0f 2d/convert-to-int var2/xm32 var1/r32 +31577 0x11/imm32/alloc-id:fake +31578 _string-convert/imm32/name +31579 0x11/imm32/alloc-id:fake +31580 Single-float-var-in-mem/imm32/inouts +31581 0x11/imm32/alloc-id:fake +31582 Single-int-var-in-some-register/imm32/outputs +31583 0x11/imm32/alloc-id:fake +31584 _string_f3_0f_2d_convert_to_int/imm32/subx-name +31585 0/imm32/no-rm32 +31586 3/imm32/r32-is-first-output +31587 0/imm32/no-imm32 +31588 0/imm32/no-imm8 +31589 0/imm32/no-disp32 +31590 1/imm32/xm32-is-first-inout +31591 0/imm32/no-x32 +31592 0x11/imm32/alloc-id:fake +31593 _Primitive-convert-xreg-to-reg/imm32/next +31594 _Primitive-convert-xreg-to-reg: # (payload primitive) +31595 0x11/imm32/alloc-id:fake:payload +31596 # var1/reg <- convert var2/xreg => f3 0f 2d/convert-to-int var2/xm32 var1/r32 31597 0x11/imm32/alloc-id:fake -31598 Single-lit-var/imm32/inouts -31599 0/imm32/no-outputs -31600 0/imm32/no-outputs +31598 _string-convert/imm32/name +31599 0x11/imm32/alloc-id:fake +31600 Single-float-var-in-some-register/imm32/inouts 31601 0x11/imm32/alloc-id:fake -31602 _string_0f_8f_jump_label/imm32/subx-name -31603 0/imm32/no-rm32 -31604 0/imm32/no-r32 -31605 0/imm32/no-imm32 -31606 0/imm32/no-imm8 -31607 1/imm32/disp32-is-first-inout -31608 0/imm32/no-xm32 -31609 0/imm32/no-x32 -31610 0x11/imm32/alloc-id:fake -31611 _Primitive-loop-named/imm32/next # we probably don't need an unconditional break -31612 _Primitive-loop-named: # (payload primitive) -31613 0x11/imm32/alloc-id:fake:payload -31614 0x11/imm32/alloc-id:fake -31615 _string-loop/imm32/name -31616 0x11/imm32/alloc-id:fake -31617 Single-lit-var/imm32/inouts -31618 0/imm32/no-outputs -31619 0/imm32/no-outputs -31620 0x11/imm32/alloc-id:fake -31621 _string_e9_jump_label/imm32/subx-name -31622 0/imm32/no-rm32 -31623 0/imm32/no-r32 -31624 0/imm32/no-imm32 -31625 0/imm32/no-imm8 -31626 1/imm32/disp32-is-first-inout -31627 0/imm32/no-xm32 -31628 0/imm32/no-x32 -31629 0x11/imm32/alloc-id:fake -31630 _Primitive-break-if-float</imm32/next -31631 # - branches based on floating-point comparisons -31632 _Primitive-break-if-float<: # (payload primitive) -31633 0x11/imm32/alloc-id:fake:payload -31634 0x11/imm32/alloc-id:fake -31635 _string-break-if-float</imm32/name -31636 0/imm32/no-inouts -31637 0/imm32/no-inouts -31638 0/imm32/no-outputs -31639 0/imm32/no-outputs -31640 0x11/imm32/alloc-id:fake -31641 _string_0f_82_jump_break/imm32/subx-name -31642 0/imm32/no-rm32 -31643 0/imm32/no-r32 -31644 0/imm32/no-imm32 -31645 0/imm32/no-imm8 -31646 0/imm32/no-disp32 -31647 0/imm32/no-xm32 -31648 0/imm32/no-x32 -31649 0x11/imm32/alloc-id:fake -31650 _Primitive-break-if-float>=/imm32/next -31651 _Primitive-break-if-float>=: # (payload primitive) -31652 0x11/imm32/alloc-id:fake:payload -31653 0x11/imm32/alloc-id:fake -31654 _string-break-if-float>=/imm32/name -31655 0/imm32/no-inouts -31656 0/imm32/no-inouts -31657 0/imm32/no-outputs -31658 0/imm32/no-outputs -31659 0x11/imm32/alloc-id:fake -31660 _string_0f_83_jump_break/imm32/subx-name -31661 0/imm32/no-rm32 -31662 0/imm32/no-r32 -31663 0/imm32/no-imm32 -31664 0/imm32/no-imm8 -31665 0/imm32/no-disp32 -31666 0/imm32/no-xm32 -31667 0/imm32/no-x32 -31668 0x11/imm32/alloc-id:fake -31669 _Primitive-break-if-float<=/imm32/next -31670 _Primitive-break-if-float<=: # (payload primitive) -31671 0x11/imm32/alloc-id:fake:payload -31672 0x11/imm32/alloc-id:fake -31673 _string-break-if-float<=/imm32/name -31674 0/imm32/no-inouts -31675 0/imm32/no-inouts -31676 0/imm32/no-outputs -31677 0/imm32/no-outputs +31602 Single-int-var-in-some-register/imm32/outputs +31603 0x11/imm32/alloc-id:fake +31604 _string_f3_0f_2d_convert_to_int/imm32/subx-name +31605 0/imm32/no-rm32 +31606 3/imm32/r32-is-first-output +31607 0/imm32/no-imm32 +31608 0/imm32/no-imm8 +31609 0/imm32/no-disp32 +31610 1/imm32/xm32-is-first-inout +31611 0/imm32/no-x32 +31612 0x11/imm32/alloc-id:fake +31613 _Primitive-truncate-xmem-to-reg/imm32/next +31614 _Primitive-truncate-xmem-to-reg: # (payload primitive) +31615 0x11/imm32/alloc-id:fake:payload +31616 # var1/reg <- truncate var2 => f3 0f 2c/truncate-to-int var2/xm32 var1/r32 +31617 0x11/imm32/alloc-id:fake +31618 _string-truncate/imm32/name +31619 0x11/imm32/alloc-id:fake +31620 Single-float-var-in-mem/imm32/inouts +31621 0x11/imm32/alloc-id:fake +31622 Single-int-var-in-some-register/imm32/outputs +31623 0x11/imm32/alloc-id:fake +31624 _string_f3_0f_2c_truncate_to_int/imm32/subx-name +31625 0/imm32/no-rm32 +31626 3/imm32/r32-is-first-output +31627 0/imm32/no-imm32 +31628 0/imm32/no-imm8 +31629 0/imm32/no-disp32 +31630 1/imm32/xm32-is-first-inout +31631 0/imm32/no-x32 +31632 0x11/imm32/alloc-id:fake +31633 _Primitive-truncate-xreg-to-reg/imm32/next +31634 _Primitive-truncate-xreg-to-reg: # (payload primitive) +31635 0x11/imm32/alloc-id:fake:payload +31636 # var1/reg <- truncate var2/xreg => f3 0f 2c/truncate-to-int var2/xm32 var1/r32 +31637 0x11/imm32/alloc-id:fake +31638 _string-truncate/imm32/name +31639 0x11/imm32/alloc-id:fake +31640 Single-float-var-in-some-register/imm32/inouts +31641 0x11/imm32/alloc-id:fake +31642 Single-int-var-in-some-register/imm32/outputs +31643 0x11/imm32/alloc-id:fake +31644 _string_f3_0f_2c_truncate_to_int/imm32/subx-name +31645 0/imm32/no-rm32 +31646 3/imm32/r32-is-first-output +31647 0/imm32/no-imm32 +31648 0/imm32/no-imm8 +31649 0/imm32/no-disp32 +31650 1/imm32/xm32-is-first-inout +31651 0/imm32/no-x32 +31652 0x11/imm32/alloc-id:fake +31653 _Primitive-reinterpret-xmem-as-reg/imm32/next +31654 # - reinterpret bytes (just for debugging) +31655 _Primitive-reinterpret-xmem-as-reg: # (payload primitive) +31656 0x11/imm32/alloc-id:fake:payload +31657 # var1/reg <- reinterpret var2 => 8b/-> var2/xm32 var1/r32 +31658 0x11/imm32/alloc-id:fake +31659 _string-reinterpret/imm32/name +31660 0x11/imm32/alloc-id:fake +31661 Single-float-var-in-mem/imm32/inouts +31662 0x11/imm32/alloc-id:fake +31663 Single-int-var-in-some-register/imm32/outputs +31664 0x11/imm32/alloc-id:fake +31665 _string_8b_->/imm32/subx-name +31666 0/imm32/no-rm32 +31667 3/imm32/r32-is-first-output +31668 0/imm32/no-imm32 +31669 0/imm32/no-imm8 +31670 0/imm32/no-disp32 +31671 1/imm32/xm32-is-first-inout +31672 0/imm32/no-x32 +31673 0x11/imm32/alloc-id:fake +31674 _Primitive-reinterpret-mem-as-xreg/imm32/next +31675 _Primitive-reinterpret-mem-as-xreg: # (payload primitive) +31676 0x11/imm32/alloc-id:fake:payload +31677 # var1/xreg <- reinterpret var2 => f3 0f 10/-> var2/rm32 var1/x32 31678 0x11/imm32/alloc-id:fake -31679 _string_0f_86_jump_break/imm32/subx-name -31680 0/imm32/no-rm32 -31681 0/imm32/no-r32 -31682 0/imm32/no-imm32 -31683 0/imm32/no-imm8 -31684 0/imm32/no-disp32 -31685 0/imm32/no-xm32 -31686 0/imm32/no-x32 -31687 0x11/imm32/alloc-id:fake -31688 _Primitive-break-if-float>/imm32/next -31689 _Primitive-break-if-float>: # (payload primitive) -31690 0x11/imm32/alloc-id:fake:payload -31691 0x11/imm32/alloc-id:fake -31692 _string-break-if-float>/imm32/name -31693 0/imm32/no-inouts -31694 0/imm32/no-inouts -31695 0/imm32/no-outputs -31696 0/imm32/no-outputs -31697 0x11/imm32/alloc-id:fake -31698 _string_0f_87_jump_break/imm32/subx-name -31699 0/imm32/no-rm32 -31700 0/imm32/no-r32 -31701 0/imm32/no-imm32 -31702 0/imm32/no-imm8 -31703 0/imm32/no-disp32 -31704 0/imm32/no-xm32 -31705 0/imm32/no-x32 -31706 0x11/imm32/alloc-id:fake -31707 _Primitive-loop-if-float</imm32/next -31708 _Primitive-loop-if-float<: # (payload primitive) -31709 0x11/imm32/alloc-id:fake:payload -31710 0x11/imm32/alloc-id:fake -31711 _string-loop-if-float</imm32/name -31712 0/imm32/no-inouts -31713 0/imm32/no-inouts -31714 0/imm32/no-outputs -31715 0/imm32/no-outputs -31716 0x11/imm32/alloc-id:fake -31717 _string_0f_82_jump_loop/imm32/subx-name -31718 0/imm32/no-rm32 -31719 0/imm32/no-r32 -31720 0/imm32/no-imm32 -31721 0/imm32/no-imm8 -31722 0/imm32/no-disp32 -31723 0/imm32/no-xm32 -31724 0/imm32/no-x32 +31679 _string-reinterpret/imm32/name +31680 0x11/imm32/alloc-id:fake +31681 Single-int-var-in-mem/imm32/inouts +31682 0x11/imm32/alloc-id:fake +31683 Single-float-var-in-some-register/imm32/outputs +31684 0x11/imm32/alloc-id:fake +31685 _string_f3_0f_10_copy/imm32/subx-name +31686 1/imm32/rm32-is-first-inout +31687 0/imm32/no-r32 +31688 0/imm32/no-imm32 +31689 0/imm32/no-imm8 +31690 0/imm32/no-disp32 +31691 0/imm32/no-xm32 +31692 3/imm32/x32-is-first-output +31693 0x11/imm32/alloc-id:fake +31694 _Primitive-copy-xreg-to-xreg/imm32/next +31695 # - floating-point copy +31696 _Primitive-copy-xreg-to-xreg: # (payload primitive) +31697 0x11/imm32/alloc-id:fake:payload +31698 # var1/xreg <- copy var2/xreg => f3 0f 11/<- var1/xm32 var2/x32 +31699 0x11/imm32/alloc-id:fake +31700 _string-copy/imm32/name +31701 0x11/imm32/alloc-id:fake +31702 Single-float-var-in-some-register/imm32/inouts +31703 0x11/imm32/alloc-id:fake +31704 Single-float-var-in-some-register/imm32/outputs +31705 0x11/imm32/alloc-id:fake +31706 _string_f3_0f_11_copy/imm32/subx-name +31707 0/imm32/no-rm32 +31708 0/imm32/no-r32 +31709 0/imm32/no-imm32 +31710 0/imm32/no-imm8 +31711 0/imm32/no-disp32 +31712 3/imm32/xm32-is-first-output +31713 1/imm32/x32-is-first-inout +31714 0x11/imm32/alloc-id:fake +31715 _Primitive-copy-xreg-to-mem/imm32/next +31716 _Primitive-copy-xreg-to-mem: # (payload primitive) +31717 0x11/imm32/alloc-id:fake:payload +31718 # copy-to var1 var2/xreg => f3 0f 11/<- var1 var2/x32 +31719 0x11/imm32/alloc-id:fake +31720 _string-copy-to/imm32/name +31721 0x11/imm32/alloc-id:fake +31722 Two-args-float-stack-float-reg/imm32/inouts +31723 0/imm32/no-outputs +31724 0/imm32/no-outputs 31725 0x11/imm32/alloc-id:fake -31726 _Primitive-loop-if-float>=/imm32/next -31727 _Primitive-loop-if-float>=: # (payload primitive) -31728 0x11/imm32/alloc-id:fake:payload -31729 0x11/imm32/alloc-id:fake -31730 _string-loop-if-float>=/imm32/name -31731 0/imm32/no-inouts -31732 0/imm32/no-inouts -31733 0/imm32/no-outputs -31734 0/imm32/no-outputs -31735 0x11/imm32/alloc-id:fake -31736 _string_0f_83_jump_loop/imm32/subx-name -31737 0/imm32/no-rm32 -31738 0/imm32/no-r32 -31739 0/imm32/no-imm32 -31740 0/imm32/no-imm8 -31741 0/imm32/no-disp32 -31742 0/imm32/no-xm32 -31743 0/imm32/no-x32 -31744 0x11/imm32/alloc-id:fake -31745 _Primitive-loop-if-float<=/imm32/next -31746 _Primitive-loop-if-float<=: # (payload primitive) -31747 0x11/imm32/alloc-id:fake:payload -31748 0x11/imm32/alloc-id:fake -31749 _string-loop-if-float<=/imm32/name -31750 0/imm32/no-inouts -31751 0/imm32/no-inouts -31752 0/imm32/no-outputs -31753 0/imm32/no-outputs +31726 _string_f3_0f_11_copy/imm32/subx-name +31727 0/imm32/no-rm32 +31728 0/imm32/no-r32 +31729 0/imm32/no-imm32 +31730 0/imm32/no-imm8 +31731 0/imm32/no-disp32 +31732 1/imm32/xm32-is-first-inout +31733 2/imm32/x32-is-second-inout +31734 0x11/imm32/alloc-id:fake +31735 _Primitive-copy-mem-to-xreg/imm32/next +31736 _Primitive-copy-mem-to-xreg: # (payload primitive) +31737 0x11/imm32/alloc-id:fake:payload +31738 # var1/xreg <- copy var2 => f3 0f 10/-> var2/rm32 var1/x32 +31739 0x11/imm32/alloc-id:fake +31740 _string-copy/imm32/name +31741 0x11/imm32/alloc-id:fake +31742 Single-float-var-in-mem/imm32/inouts +31743 0x11/imm32/alloc-id:fake +31744 Single-float-var-in-some-register/imm32/outputs +31745 0x11/imm32/alloc-id:fake +31746 _string_f3_0f_10_copy/imm32/subx-name +31747 0/imm32/no-rm32 +31748 0/imm32/no-r32 +31749 0/imm32/no-imm32 +31750 0/imm32/no-imm8 +31751 0/imm32/no-disp32 +31752 1/imm32/xm32-is-first-inout +31753 3/imm32/x32-is-first-output 31754 0x11/imm32/alloc-id:fake -31755 _string_0f_86_jump_loop/imm32/subx-name -31756 0/imm32/no-rm32 -31757 0/imm32/no-r32 -31758 0/imm32/no-imm32 -31759 0/imm32/no-imm8 -31760 0/imm32/no-disp32 -31761 0/imm32/no-xm32 -31762 0/imm32/no-x32 -31763 0x11/imm32/alloc-id:fake -31764 _Primitive-loop-if-float>/imm32/next -31765 _Primitive-loop-if-float>: # (payload primitive) -31766 0x11/imm32/alloc-id:fake:payload -31767 0x11/imm32/alloc-id:fake -31768 _string-loop-if-float>/imm32/name -31769 0/imm32/no-inouts -31770 0/imm32/no-inouts -31771 0/imm32/no-outputs -31772 0/imm32/no-outputs -31773 0x11/imm32/alloc-id:fake -31774 _string_0f_87_jump_loop/imm32/subx-name -31775 0/imm32/no-rm32 -31776 0/imm32/no-r32 -31777 0/imm32/no-imm32 -31778 0/imm32/no-imm8 -31779 0/imm32/no-disp32 -31780 0/imm32/no-xm32 -31781 0/imm32/no-x32 -31782 0x11/imm32/alloc-id:fake -31783 _Primitive-break-if-float<-named/imm32/next -31784 _Primitive-break-if-float<-named: # (payload primitive) -31785 0x11/imm32/alloc-id:fake:payload -31786 0x11/imm32/alloc-id:fake -31787 _string-break-if-float</imm32/name -31788 0x11/imm32/alloc-id:fake -31789 Single-lit-var/imm32/inouts -31790 0/imm32/no-outputs -31791 0/imm32/no-outputs -31792 0x11/imm32/alloc-id:fake -31793 _string_0f_82_jump_label/imm32/subx-name -31794 0/imm32/no-rm32 -31795 0/imm32/no-r32 -31796 0/imm32/no-imm32 -31797 0/imm32/no-imm8 -31798 1/imm32/disp32-is-first-inout -31799 0/imm32/no-xm32 -31800 0/imm32/no-x32 +31755 _Primitive-address-of-xmem/imm32/next +31756 # - floating-point-address +31757 _Primitive-address-of-xmem: # (payload primitive) +31758 0x11/imm32/alloc-id:fake:payload +31759 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 +31760 0x11/imm32/alloc-id:fake +31761 _string-address/imm32/name +31762 0x11/imm32/alloc-id:fake +31763 Single-float-var-in-mem/imm32/inouts +31764 0x11/imm32/alloc-id:fake +31765 Single-addr-var-in-some-register/imm32/outputs +31766 0x11/imm32/alloc-id:fake +31767 _string_8d_copy_address/imm32/subx-name +31768 1/imm32/rm32-is-first-inout +31769 3/imm32/r32-is-first-output +31770 0/imm32/no-imm32 +31771 0/imm32/no-imm8 +31772 0/imm32/no-disp32 +31773 0/imm32/no-xm32 +31774 0/imm32/no-x32 +31775 0x11/imm32/alloc-id:fake +31776 _Primitive-add-xreg-to-xreg/imm32/next +31777 # - floating-point add +31778 _Primitive-add-xreg-to-xreg: # (payload primitive) +31779 0x11/imm32/alloc-id:fake:payload +31780 # var1/xreg <- add var2/xreg => f3 0f 58/add var1/xm32 var2/x32 +31781 0x11/imm32/alloc-id:fake +31782 _string-add/imm32/name +31783 0x11/imm32/alloc-id:fake +31784 Single-float-var-in-some-register/imm32/inouts +31785 0x11/imm32/alloc-id:fake +31786 Single-float-var-in-some-register/imm32/outputs +31787 0x11/imm32/alloc-id:fake +31788 _string_f3_0f_58_add/imm32/subx-name +31789 0/imm32/no-rm32 +31790 0/imm32/no-r32 +31791 0/imm32/no-imm32 +31792 0/imm32/no-imm8 +31793 0/imm32/no-disp32 +31794 1/imm32/xm32-is-first-inout +31795 3/imm32/x32-is-first-output +31796 0x11/imm32/alloc-id:fake +31797 _Primitive-add-mem-to-xreg/imm32/next +31798 _Primitive-add-mem-to-xreg: # (payload primitive) +31799 0x11/imm32/alloc-id:fake:payload +31800 # var1/xreg <- add var2 => f3 0f 58/add var2/xm32 var1/x32 31801 0x11/imm32/alloc-id:fake -31802 _Primitive-break-if-float>=-named/imm32/next -31803 _Primitive-break-if-float>=-named: # (payload primitive) -31804 0x11/imm32/alloc-id:fake:payload +31802 _string-add/imm32/name +31803 0x11/imm32/alloc-id:fake +31804 Single-float-var-in-mem/imm32/inouts 31805 0x11/imm32/alloc-id:fake -31806 _string-break-if-float>=/imm32/name +31806 Single-float-var-in-some-register/imm32/outputs 31807 0x11/imm32/alloc-id:fake -31808 Single-lit-var/imm32/inouts -31809 0/imm32/no-outputs -31810 0/imm32/no-outputs -31811 0x11/imm32/alloc-id:fake -31812 _string_0f_83_jump_label/imm32/subx-name -31813 0/imm32/no-rm32 -31814 0/imm32/no-r32 -31815 0/imm32/no-imm32 -31816 0/imm32/no-imm8 -31817 1/imm32/disp32-is-first-inout -31818 0/imm32/no-xm32 -31819 0/imm32/no-x32 -31820 0x11/imm32/alloc-id:fake -31821 _Primitive-break-if-float<=-named/imm32/next -31822 _Primitive-break-if-float<=-named: # (payload primitive) -31823 0x11/imm32/alloc-id:fake:payload +31808 _string_f3_0f_58_add/imm32/subx-name +31809 0/imm32/no-rm32 +31810 0/imm32/no-r32 +31811 0/imm32/no-imm32 +31812 0/imm32/no-imm8 +31813 0/imm32/no-disp32 +31814 1/imm32/xm32-is-first-inout +31815 3/imm32/x32-is-first-output +31816 0x11/imm32/alloc-id:fake +31817 _Primitive-subtract-xreg-from-xreg/imm32/next +31818 # - floating-point subtract +31819 _Primitive-subtract-xreg-from-xreg: # (payload primitive) +31820 0x11/imm32/alloc-id:fake:payload +31821 # var1/xreg <- subtract var2/xreg => f3 0f 5c/subtract var1/xm32 var2/x32 +31822 0x11/imm32/alloc-id:fake +31823 _string-subtract/imm32/name 31824 0x11/imm32/alloc-id:fake -31825 _string-break-if-float<=/imm32/name +31825 Single-float-var-in-some-register/imm32/inouts 31826 0x11/imm32/alloc-id:fake -31827 Single-lit-var/imm32/inouts -31828 0/imm32/no-outputs -31829 0/imm32/no-outputs -31830 0x11/imm32/alloc-id:fake -31831 _string_0f_86_jump_label/imm32/subx-name -31832 0/imm32/no-rm32 -31833 0/imm32/no-r32 -31834 0/imm32/no-imm32 -31835 0/imm32/no-imm8 -31836 1/imm32/disp32-is-first-inout -31837 0/imm32/no-xm32 -31838 0/imm32/no-x32 -31839 0x11/imm32/alloc-id:fake -31840 _Primitive-break-if-float>-named/imm32/next -31841 _Primitive-break-if-float>-named: # (payload primitive) -31842 0x11/imm32/alloc-id:fake:payload -31843 0x11/imm32/alloc-id:fake -31844 _string-break-if-float>/imm32/name -31845 0x11/imm32/alloc-id:fake -31846 Single-lit-var/imm32/inouts -31847 0/imm32/no-outputs -31848 0/imm32/no-outputs -31849 0x11/imm32/alloc-id:fake -31850 _string_0f_87_jump_label/imm32/subx-name -31851 0/imm32/no-rm32 -31852 0/imm32/no-r32 -31853 0/imm32/no-imm32 -31854 0/imm32/no-imm8 -31855 1/imm32/disp32-is-first-inout -31856 0/imm32/no-xm32 -31857 0/imm32/no-x32 -31858 0x11/imm32/alloc-id:fake -31859 _Primitive-loop-if-float<-named/imm32/next -31860 _Primitive-loop-if-float<-named: # (payload primitive) +31827 Single-float-var-in-some-register/imm32/outputs +31828 0x11/imm32/alloc-id:fake +31829 _string_f3_0f_5c_subtract/imm32/subx-name +31830 0/imm32/no-rm32 +31831 0/imm32/no-r32 +31832 0/imm32/no-imm32 +31833 0/imm32/no-imm8 +31834 0/imm32/no-disp32 +31835 1/imm32/xm32-is-first-inout +31836 3/imm32/x32-is-first-output +31837 0x11/imm32/alloc-id:fake +31838 _Primitive-subtract-mem-from-xreg/imm32/next +31839 _Primitive-subtract-mem-from-xreg: # (payload primitive) +31840 0x11/imm32/alloc-id:fake:payload +31841 # var1/xreg <- subtract var2 => f3 0f 5c/subtract var2/xm32 var1/x32 +31842 0x11/imm32/alloc-id:fake +31843 _string-subtract/imm32/name +31844 0x11/imm32/alloc-id:fake +31845 Single-float-var-in-mem/imm32/inouts +31846 0x11/imm32/alloc-id:fake +31847 Single-float-var-in-some-register/imm32/outputs +31848 0x11/imm32/alloc-id:fake +31849 _string_f3_0f_5c_subtract/imm32/subx-name +31850 0/imm32/no-rm32 +31851 0/imm32/no-r32 +31852 0/imm32/no-imm32 +31853 0/imm32/no-imm8 +31854 0/imm32/no-disp32 +31855 1/imm32/xm32-is-first-inout +31856 3/imm32/x32-is-first-output +31857 0x11/imm32/alloc-id:fake +31858 _Primitive-multiply-xreg-by-xreg/imm32/next +31859 # - floating-point multiply +31860 _Primitive-multiply-xreg-by-xreg: # (payload primitive) 31861 0x11/imm32/alloc-id:fake:payload -31862 0x11/imm32/alloc-id:fake -31863 _string-loop-if-float</imm32/name -31864 0x11/imm32/alloc-id:fake -31865 Single-lit-var/imm32/inouts -31866 0/imm32/no-outputs -31867 0/imm32/no-outputs -31868 0x11/imm32/alloc-id:fake -31869 _string_0f_82_jump_label/imm32/subx-name -31870 0/imm32/no-rm32 -31871 0/imm32/no-r32 -31872 0/imm32/no-imm32 -31873 0/imm32/no-imm8 -31874 1/imm32/disp32-is-first-inout -31875 0/imm32/no-xm32 -31876 0/imm32/no-x32 -31877 0x11/imm32/alloc-id:fake -31878 _Primitive-loop-if-float>=-named/imm32/next -31879 _Primitive-loop-if-float>=-named: # (payload primitive) -31880 0x11/imm32/alloc-id:fake:payload -31881 0x11/imm32/alloc-id:fake -31882 _string-loop-if-float>=/imm32/name +31862 # var1/xreg <- multiply var2 => f3 0f 59/multiply var2/xm32 var1/x32 +31863 0x11/imm32/alloc-id:fake +31864 _string-multiply/imm32/name +31865 0x11/imm32/alloc-id:fake +31866 Single-float-var-in-some-register/imm32/inouts +31867 0x11/imm32/alloc-id:fake +31868 Single-float-var-in-some-register/imm32/outputs +31869 0x11/imm32/alloc-id:fake +31870 _string_f3_0f_59_multiply/imm32/subx-name +31871 0/imm32/no-rm32 +31872 0/imm32/no-r32 +31873 0/imm32/no-imm32 +31874 0/imm32/no-imm8 +31875 0/imm32/no-disp32 +31876 1/imm32/xm32-is-first-inout +31877 3/imm32/x32-is-first-output +31878 0x11/imm32/alloc-id:fake +31879 _Primitive-multiply-xreg-by-mem/imm32/next +31880 _Primitive-multiply-xreg-by-mem: # (payload primitive) +31881 0x11/imm32/alloc-id:fake:payload +31882 # var1/xreg <- multiply var2 => 53 0f 59/multiply var2/xm32 var1/x32 31883 0x11/imm32/alloc-id:fake -31884 Single-lit-var/imm32/inouts -31885 0/imm32/no-outputs -31886 0/imm32/no-outputs +31884 _string-multiply/imm32/name +31885 0x11/imm32/alloc-id:fake +31886 Single-float-var-in-mem/imm32/inouts 31887 0x11/imm32/alloc-id:fake -31888 _string_0f_83_jump_label/imm32/subx-name -31889 0/imm32/no-rm32 -31890 0/imm32/no-r32 -31891 0/imm32/no-imm32 -31892 0/imm32/no-imm8 -31893 1/imm32/disp32-is-first-inout -31894 0/imm32/no-xm32 -31895 0/imm32/no-x32 -31896 0x11/imm32/alloc-id:fake -31897 _Primitive-loop-if-float<=-named/imm32/next -31898 _Primitive-loop-if-float<=-named: # (payload primitive) -31899 0x11/imm32/alloc-id:fake:payload -31900 0x11/imm32/alloc-id:fake -31901 _string-loop-if-float<=/imm32/name -31902 0x11/imm32/alloc-id:fake -31903 Single-lit-var/imm32/inouts -31904 0/imm32/no-outputs -31905 0/imm32/no-outputs +31888 Single-float-var-in-some-register/imm32/outputs +31889 0x11/imm32/alloc-id:fake +31890 _string_f3_0f_59_multiply/imm32/subx-name +31891 0/imm32/no-rm32 +31892 0/imm32/no-r32 +31893 0/imm32/no-imm32 +31894 0/imm32/no-imm8 +31895 0/imm32/no-disp32 +31896 1/imm32/xm32-is-first-inout +31897 3/imm32/x32-is-first-output +31898 0x11/imm32/alloc-id:fake +31899 _Primitive-divide-xreg-by-xreg/imm32/next +31900 # - floating-point divide +31901 _Primitive-divide-xreg-by-xreg: # (payload primitive) +31902 0x11/imm32/alloc-id:fake:payload +31903 # var1/xreg <- divide var2 => f3 0f 5e/divide var2/xm32 var1/x32 +31904 0x11/imm32/alloc-id:fake +31905 _string-divide/imm32/name 31906 0x11/imm32/alloc-id:fake -31907 _string_0f_86_jump_label/imm32/subx-name -31908 0/imm32/no-rm32 -31909 0/imm32/no-r32 -31910 0/imm32/no-imm32 -31911 0/imm32/no-imm8 -31912 1/imm32/disp32-is-first-inout -31913 0/imm32/no-xm32 -31914 0/imm32/no-x32 -31915 0x11/imm32/alloc-id:fake -31916 _Primitive-loop-if-float>-named/imm32/next -31917 _Primitive-loop-if-float>-named: # (payload primitive) -31918 0x11/imm32/alloc-id:fake:payload +31907 Single-float-var-in-some-register/imm32/inouts +31908 0x11/imm32/alloc-id:fake +31909 Single-float-var-in-some-register/imm32/outputs +31910 0x11/imm32/alloc-id:fake +31911 _string_f3_0f_5e_divide/imm32/subx-name +31912 0/imm32/no-rm32 +31913 0/imm32/no-r32 +31914 0/imm32/no-imm32 +31915 0/imm32/no-imm8 +31916 0/imm32/no-disp32 +31917 1/imm32/xm32-is-first-inout +31918 3/imm32/x32-is-first-output 31919 0x11/imm32/alloc-id:fake -31920 _string-loop-if-float>/imm32/name -31921 0x11/imm32/alloc-id:fake -31922 Single-lit-var/imm32/inouts -31923 0/imm32/no-outputs -31924 0/imm32/no-outputs -31925 0x11/imm32/alloc-id:fake -31926 _string_0f_87_jump_label/imm32/subx-name -31927 0/imm32/no-rm32 -31928 0/imm32/no-r32 -31929 0/imm32/no-imm32 -31930 0/imm32/no-imm8 -31931 1/imm32/disp32-is-first-inout -31932 0/imm32/no-xm32 -31933 0/imm32/no-x32 -31934 0/imm32/next -31935 0/imm32/next -31936 -31937 # string literals for Mu instructions -31938 _string-add: # (payload array byte) -31939 0x11/imm32/alloc-id:fake:payload -31940 # "add" -31941 0x3/imm32/size -31942 0x61/a 0x64/d 0x64/d -31943 _string-address: # (payload array byte) -31944 0x11/imm32/alloc-id:fake:payload -31945 # "address" -31946 0x7/imm32/size -31947 0x61/a 0x64/d 0x64/d 0x72/r 0x65/e 0x73/s 0x73/s -31948 _string-add-to: # (payload array byte) -31949 0x11/imm32/alloc-id:fake:payload -31950 # "add-to" -31951 0x6/imm32/size -31952 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o -31953 _string-and: # (payload array byte) -31954 0x11/imm32/alloc-id:fake:payload -31955 # "and" -31956 0x3/imm32/size -31957 0x61/a 0x6e/n 0x64/d -31958 _string-and-with: # (payload array byte) -31959 0x11/imm32/alloc-id:fake:payload -31960 # "and-with" -31961 0x8/imm32/size -31962 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -31963 _string-break: # (payload array byte) -31964 0x11/imm32/alloc-id:fake:payload -31965 # "break" -31966 0x5/imm32/size -31967 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k -31968 _string-break-if-<: # (payload array byte) -31969 0x11/imm32/alloc-id:fake:payload -31970 # "break-if-<" -31971 0xa/imm32/size -31972 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< -31973 _string-break-if-<=: # (payload array byte) -31974 0x11/imm32/alloc-id:fake:payload -31975 # "break-if-<=" -31976 0xb/imm32/size -31977 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= -31978 _string-break-if-=: # (payload array byte) -31979 0x11/imm32/alloc-id:fake:payload -31980 # "break-if-=" -31981 0xa/imm32/size -31982 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= -31983 _string-break-if->: # (payload array byte) +31920 _Primitive-divide-xreg-by-mem/imm32/next +31921 _Primitive-divide-xreg-by-mem: # (payload primitive) +31922 0x11/imm32/alloc-id:fake:payload +31923 # var1/xreg <- divide var2 => f3 0f 5e/divide var2/xm32 var1/x32 +31924 0x11/imm32/alloc-id:fake +31925 _string-divide/imm32/name +31926 0x11/imm32/alloc-id:fake +31927 Single-float-var-in-mem/imm32/inouts +31928 0x11/imm32/alloc-id:fake +31929 Single-float-var-in-some-register/imm32/outputs +31930 0x11/imm32/alloc-id:fake +31931 _string_f3_0f_5e_divide/imm32/subx-name +31932 0/imm32/no-rm32 +31933 0/imm32/no-r32 +31934 0/imm32/no-imm32 +31935 0/imm32/no-imm8 +31936 0/imm32/no-disp32 +31937 1/imm32/xm32-is-first-inout +31938 3/imm32/x32-is-first-output +31939 0x11/imm32/alloc-id:fake +31940 _Primitive-max-xreg-with-xreg/imm32/next +31941 # - floating-point maximum +31942 _Primitive-max-xreg-with-xreg: # (payload primitive) +31943 0x11/imm32/alloc-id:fake:payload +31944 # var1/xreg <- max var2 => f3 0f 5f/max var2/xm32 var1/x32 +31945 0x11/imm32/alloc-id:fake +31946 _string-max/imm32/name +31947 0x11/imm32/alloc-id:fake +31948 Single-float-var-in-some-register/imm32/inouts +31949 0x11/imm32/alloc-id:fake +31950 Single-float-var-in-some-register/imm32/outputs +31951 0x11/imm32/alloc-id:fake +31952 _string_f3_0f_5f_max/imm32/subx-name +31953 0/imm32/no-rm32 +31954 0/imm32/no-r32 +31955 0/imm32/no-imm32 +31956 0/imm32/no-imm8 +31957 0/imm32/no-disp32 +31958 1/imm32/xm32-is-first-inout +31959 3/imm32/x32-is-first-output +31960 0x11/imm32/alloc-id:fake +31961 _Primitive-max-xreg-with-mem/imm32/next +31962 _Primitive-max-xreg-with-mem: # (payload primitive) +31963 0x11/imm32/alloc-id:fake:payload +31964 # var1/xreg <- divide var2 => f3 0f 5f/max var2/xm32 var1/x32 +31965 0x11/imm32/alloc-id:fake +31966 _string-max/imm32/name +31967 0x11/imm32/alloc-id:fake +31968 Single-float-var-in-mem/imm32/inouts +31969 0x11/imm32/alloc-id:fake +31970 Single-float-var-in-some-register/imm32/outputs +31971 0x11/imm32/alloc-id:fake +31972 _string_f3_0f_5f_max/imm32/subx-name +31973 0/imm32/no-rm32 +31974 0/imm32/no-r32 +31975 0/imm32/no-imm32 +31976 0/imm32/no-imm8 +31977 0/imm32/no-disp32 +31978 1/imm32/xm32-is-first-inout +31979 3/imm32/x32-is-first-output +31980 0x11/imm32/alloc-id:fake +31981 _Primitive-min-xreg-with-xreg/imm32/next +31982 # - floating-point minimum +31983 _Primitive-min-xreg-with-xreg: # (payload primitive) 31984 0x11/imm32/alloc-id:fake:payload -31985 # "break-if->" -31986 0xa/imm32/size -31987 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> -31988 _string-break-if->=: # (payload array byte) -31989 0x11/imm32/alloc-id:fake:payload -31990 # "break-if->=" -31991 0xb/imm32/size -31992 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= -31993 _string-break-if-!=: # (payload array byte) -31994 0x11/imm32/alloc-id:fake:payload -31995 # "break-if-!=" -31996 0xb/imm32/size -31997 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= -31998 _string-break-if-addr<: # (payload array byte) -31999 0x11/imm32/alloc-id:fake:payload -32000 # "break-if-addr<" -32001 0xe/imm32/size -32002 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/< -32003 _string-break-if-addr<=: # (payload array byte) +31985 # var1/xreg <- divide var2 => f3 0f 5d/min var2/xm32 var1/x32 +31986 0x11/imm32/alloc-id:fake +31987 _string-min/imm32/name +31988 0x11/imm32/alloc-id:fake +31989 Single-float-var-in-some-register/imm32/inouts +31990 0x11/imm32/alloc-id:fake +31991 Single-float-var-in-some-register/imm32/outputs +31992 0x11/imm32/alloc-id:fake +31993 _string_f3_0f_5d_min/imm32/subx-name +31994 0/imm32/no-rm32 +31995 0/imm32/no-r32 +31996 0/imm32/no-imm32 +31997 0/imm32/no-imm8 +31998 0/imm32/no-disp32 +31999 1/imm32/xm32-is-first-inout +32000 3/imm32/x32-is-first-output +32001 0x11/imm32/alloc-id:fake +32002 _Primitive-min-xreg-with-mem/imm32/next +32003 _Primitive-min-xreg-with-mem: # (payload primitive) 32004 0x11/imm32/alloc-id:fake:payload -32005 # "break-if-addr<=" -32006 0xf/imm32/size -32007 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/= -32008 _string-break-if-addr>: # (payload array byte) -32009 0x11/imm32/alloc-id:fake:payload -32010 # "break-if-addr>" -32011 0xe/imm32/size -32012 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/> -32013 _string-break-if-addr>=: # (payload array byte) -32014 0x11/imm32/alloc-id:fake:payload -32015 # "break-if-addr>=" -32016 0xf/imm32/size -32017 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/= -32018 _string-break-if-float<: # (payload array byte) -32019 0x11/imm32/alloc-id:fake:payload -32020 # "break-if-float<" -32021 0xf/imm32/size -32022 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/< -32023 _string-break-if-float<=: # (payload array byte) -32024 0x11/imm32/alloc-id:fake:payload -32025 # "break-if-float<=" -32026 0x10/imm32/size -32027 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/= -32028 _string-break-if-float>: # (payload array byte) -32029 0x11/imm32/alloc-id:fake:payload -32030 # "break-if-float>" -32031 0xf/imm32/size -32032 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/> -32033 _string-break-if-float>=: # (payload array byte) -32034 0x11/imm32/alloc-id:fake:payload -32035 # "break-if-float>=" -32036 0x10/imm32/size -32037 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/= -32038 _string-compare: # (payload array byte) -32039 0x11/imm32/alloc-id:fake:payload -32040 # "compare" -32041 0x7/imm32/size -32042 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e -32043 _string-copy: # (payload array byte) -32044 0x11/imm32/alloc-id:fake:payload -32045 # "copy" -32046 0x4/imm32/size -32047 0x63/c 0x6f/o 0x70/p 0x79/y -32048 _string-copy-to: # (payload array byte) -32049 0x11/imm32/alloc-id:fake:payload -32050 # "copy-to" -32051 0x7/imm32/size -32052 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o -32053 _string-copy-byte: -32054 0x11/imm32/alloc-id:fake:payload -32055 # "copy-byte" -32056 0x9/imm32/size -32057 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e -32058 _string-copy-byte-to: -32059 0x11/imm32/alloc-id:fake:payload -32060 # "copy-byte-to" -32061 0xc/imm32/size -32062 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x74/t 0x6f/o -32063 _string-decrement: # (payload array byte) -32064 0x11/imm32/alloc-id:fake:payload -32065 # "decrement" -32066 0x9/imm32/size -32067 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t -32068 _string-increment: # (payload array byte) -32069 0x11/imm32/alloc-id:fake:payload -32070 # "increment" -32071 0x9/imm32/size -32072 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t -32073 _string-loop: # (payload array byte) -32074 0x11/imm32/alloc-id:fake:payload -32075 # "loop" -32076 0x4/imm32/size -32077 0x6c/l 0x6f/o 0x6f/o 0x70/p -32078 _string-loop-if-<: # (payload array byte) -32079 0x11/imm32/alloc-id:fake:payload -32080 # "loop-if-<" -32081 0x9/imm32/size -32082 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< -32083 _string-loop-if-<=: # (payload array byte) -32084 0x11/imm32/alloc-id:fake:payload -32085 # "loop-if-<=" -32086 0xa/imm32/size -32087 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= -32088 _string-loop-if-=: # (payload array byte) -32089 0x11/imm32/alloc-id:fake:payload -32090 # "loop-if-=" -32091 0x9/imm32/size -32092 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= -32093 _string-loop-if->: # (payload array byte) -32094 0x11/imm32/alloc-id:fake:payload -32095 # "loop-if->" -32096 0x9/imm32/size -32097 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> -32098 _string-loop-if->=: # (payload array byte) -32099 0x11/imm32/alloc-id:fake:payload -32100 # "loop-if->=" -32101 0xa/imm32/size -32102 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= -32103 _string-loop-if-!=: # (payload array byte) -32104 0x11/imm32/alloc-id:fake:payload -32105 # "loop-if-!=" -32106 0xa/imm32/size -32107 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= -32108 _string-loop-if-addr<: # (payload array byte) -32109 0x11/imm32/alloc-id:fake:payload -32110 # "loop-if-addr<" -32111 0xd/imm32/size -32112 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/< -32113 _string-loop-if-addr<=: # (payload array byte) -32114 0x11/imm32/alloc-id:fake:payload -32115 # "loop-if-addr<=" -32116 0xe/imm32/size -32117 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/= -32118 _string-loop-if-addr>: # (payload array byte) -32119 0x11/imm32/alloc-id:fake:payload -32120 # "loop-if-addr>" -32121 0xd/imm32/size -32122 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/> -32123 _string-loop-if-addr>=: # (payload array byte) -32124 0x11/imm32/alloc-id:fake:payload -32125 # "loop-if-addr>=" -32126 0xe/imm32/size -32127 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/= -32128 _string-loop-if-float<: # (payload array byte) -32129 0x11/imm32/alloc-id:fake:payload -32130 # "loop-if-float<" -32131 0xe/imm32/size -32132 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/< -32133 _string-loop-if-float<=: # (payload array byte) -32134 0x11/imm32/alloc-id:fake:payload -32135 # "loop-if-float<=" -32136 0xf/imm32/size -32137 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/= -32138 _string-loop-if-float>: # (payload array byte) -32139 0x11/imm32/alloc-id:fake:payload -32140 # "loop-if-float>" -32141 0xe/imm32/size -32142 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/> -32143 _string-loop-if-float>=: # (payload array byte) -32144 0x11/imm32/alloc-id:fake:payload -32145 # "loop-if-float>=" -32146 0xf/imm32/size -32147 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/= -32148 _string-multiply: # (payload array byte) -32149 0x11/imm32/alloc-id:fake:payload -32150 # "multiply" -32151 0x8/imm32/size -32152 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y -32153 _string-convert: # (payload array byte) -32154 0x11/imm32/alloc-id:fake:payload -32155 # "convert" -32156 0x7/imm32/size -32157 0x63/c 0x6f/o 0x6e/n 0x76/v 0x65/e 0x72/r 0x74/t -32158 _string-truncate: # (payload array byte) -32159 0x11/imm32/alloc-id:fake:payload -32160 # "truncate" -32161 0x8/imm32/size -32162 0x74/t 0x72/r 0x75/u 0x6e/n 0x63/c 0x61/a 0x74/t 0x65/e -32163 _string-reinterpret: # (payload array byte) -32164 0x11/imm32/alloc-id:fake:payload -32165 # "reinterpret" -32166 0xb/imm32/size -32167 0x72/r 0x65/e 0x69/i 0x6e/n 0x74/t 0x65/e 0x72/r 0x70/p 0x72/r 0x65/e 0x74/t -32168 _string-divide: -32169 0x11/imm32/alloc-id:fake:payload -32170 # "divide" -32171 0x6/imm32/size -32172 0x64/d 0x69/i 0x76/v 0x69/i 0x64/d 0x65/e -32173 _string-max: -32174 0x11/imm32/alloc-id:fake:payload -32175 # "max" -32176 0x3/imm32/size -32177 0x6d/m 0x61/a 0x78/x -32178 _string-min: -32179 0x11/imm32/alloc-id:fake:payload -32180 # "min" -32181 0x3/imm32/size -32182 0x6d/m 0x69/i 0x6e/n -32183 _string-reciprocal: -32184 0x11/imm32/alloc-id:fake:payload -32185 # "reciprocal" -32186 0xa/imm32/size -32187 0x72/r 0x65/e 0x63/c 0x69/i 0x70/p 0x72/r 0x6f/o 0x63/c 0x61/a 0x6c/l -32188 _string-square-root: +32005 # var1/xreg <- divide var2 => f3 0f 5d/min var2/xm32 var1/x32 +32006 0x11/imm32/alloc-id:fake +32007 _string-min/imm32/name +32008 0x11/imm32/alloc-id:fake +32009 Single-float-var-in-mem/imm32/inouts +32010 0x11/imm32/alloc-id:fake +32011 Single-float-var-in-some-register/imm32/outputs +32012 0x11/imm32/alloc-id:fake +32013 _string_f3_0f_5d_min/imm32/subx-name +32014 0/imm32/no-rm32 +32015 0/imm32/no-r32 +32016 0/imm32/no-imm32 +32017 0/imm32/no-imm8 +32018 0/imm32/no-disp32 +32019 1/imm32/xm32-is-first-inout +32020 3/imm32/x32-is-first-output +32021 0x11/imm32/alloc-id:fake +32022 _Primitive-reciprocal-xreg-to-xreg/imm32/next +32023 # - floating-point reciprocal +32024 _Primitive-reciprocal-xreg-to-xreg: # (payload primitive) +32025 0x11/imm32/alloc-id:fake:payload +32026 # var1/xreg <- reciprocal var2 => f3 0f 53/reciprocal var2/xm32 var1/x32 +32027 0x11/imm32/alloc-id:fake +32028 _string-reciprocal/imm32/name +32029 0x11/imm32/alloc-id:fake +32030 Single-float-var-in-some-register/imm32/inouts +32031 0x11/imm32/alloc-id:fake +32032 Single-float-var-in-some-register/imm32/outputs +32033 0x11/imm32/alloc-id:fake +32034 _string_f3_0f_53_reciprocal/imm32/subx-name +32035 0/imm32/no-rm32 +32036 0/imm32/no-r32 +32037 0/imm32/no-imm32 +32038 0/imm32/no-imm8 +32039 0/imm32/no-disp32 +32040 1/imm32/xm32-is-first-inout +32041 3/imm32/x32-is-first-output +32042 0x11/imm32/alloc-id:fake +32043 _Primitive-reciprocal-mem-to-xreg/imm32/next +32044 _Primitive-reciprocal-mem-to-xreg: # (payload primitive) +32045 0x11/imm32/alloc-id:fake:payload +32046 # var1/xreg <- divide var2 => f3 0f 53/reciprocal var2/xm32 var1/x32 +32047 0x11/imm32/alloc-id:fake +32048 _string-reciprocal/imm32/name +32049 0x11/imm32/alloc-id:fake +32050 Single-float-var-in-mem/imm32/inouts +32051 0x11/imm32/alloc-id:fake +32052 Single-float-var-in-some-register/imm32/outputs +32053 0x11/imm32/alloc-id:fake +32054 _string_f3_0f_53_reciprocal/imm32/subx-name +32055 0/imm32/no-rm32 +32056 0/imm32/no-r32 +32057 0/imm32/no-imm32 +32058 0/imm32/no-imm8 +32059 0/imm32/no-disp32 +32060 1/imm32/xm32-is-first-inout +32061 3/imm32/x32-is-first-output +32062 0x11/imm32/alloc-id:fake +32063 _Primitive-square-root-xreg-to-xreg/imm32/next +32064 # - floating-point square root +32065 _Primitive-square-root-xreg-to-xreg: # (payload primitive) +32066 0x11/imm32/alloc-id:fake:payload +32067 # var1/xreg <- square-root var2 => f3 0f 51/square-root var2/xm32 var1/x32 +32068 0x11/imm32/alloc-id:fake +32069 _string-square-root/imm32/name +32070 0x11/imm32/alloc-id:fake +32071 Single-float-var-in-some-register/imm32/inouts +32072 0x11/imm32/alloc-id:fake +32073 Single-float-var-in-some-register/imm32/outputs +32074 0x11/imm32/alloc-id:fake +32075 _string_f3_0f_51_square_root/imm32/subx-name +32076 0/imm32/no-rm32 +32077 0/imm32/no-r32 +32078 0/imm32/no-imm32 +32079 0/imm32/no-imm8 +32080 0/imm32/no-disp32 +32081 1/imm32/xm32-is-first-inout +32082 3/imm32/x32-is-first-output +32083 0x11/imm32/alloc-id:fake +32084 _Primitive-square-root-mem-to-xreg/imm32/next +32085 _Primitive-square-root-mem-to-xreg: # (payload primitive) +32086 0x11/imm32/alloc-id:fake:payload +32087 # var1/xreg <- divide var2 => f3 0f 51/square-root var2/xm32 var1/x32 +32088 0x11/imm32/alloc-id:fake +32089 _string-square-root/imm32/name +32090 0x11/imm32/alloc-id:fake +32091 Single-float-var-in-mem/imm32/inouts +32092 0x11/imm32/alloc-id:fake +32093 Single-float-var-in-some-register/imm32/outputs +32094 0x11/imm32/alloc-id:fake +32095 _string_f3_0f_51_square_root/imm32/subx-name +32096 0/imm32/no-rm32 +32097 0/imm32/no-r32 +32098 0/imm32/no-imm32 +32099 0/imm32/no-imm8 +32100 0/imm32/no-disp32 +32101 1/imm32/xm32-is-first-inout +32102 3/imm32/x32-is-first-output +32103 0x11/imm32/alloc-id:fake +32104 _Primitive-inverse-square-root-xreg-to-xreg/imm32/next +32105 # - floating-point inverse square root 1/sqrt(x) +32106 _Primitive-inverse-square-root-xreg-to-xreg: # (payload primitive) +32107 0x11/imm32/alloc-id:fake:payload +32108 # var1/xreg <- reciprocal var2 => f3 0f 52/inverse-square-root var2/xm32 var1/x32 +32109 0x11/imm32/alloc-id:fake +32110 _string-inverse-square-root/imm32/name +32111 0x11/imm32/alloc-id:fake +32112 Single-float-var-in-some-register/imm32/inouts +32113 0x11/imm32/alloc-id:fake +32114 Single-float-var-in-some-register/imm32/outputs +32115 0x11/imm32/alloc-id:fake +32116 _string_f3_0f_52_inverse_square_root/imm32/subx-name +32117 0/imm32/no-rm32 +32118 0/imm32/no-r32 +32119 0/imm32/no-imm32 +32120 0/imm32/no-imm8 +32121 0/imm32/no-disp32 +32122 1/imm32/xm32-is-first-inout +32123 3/imm32/x32-is-first-output +32124 0x11/imm32/alloc-id:fake +32125 _Primitive-inverse-square-root-mem-to-xreg/imm32/next +32126 _Primitive-inverse-square-root-mem-to-xreg: # (payload primitive) +32127 0x11/imm32/alloc-id:fake:payload +32128 # var1/xreg <- divide var2 => f3 0f 52/inverse-square-root var2/xm32 var1/x32 +32129 0x11/imm32/alloc-id:fake +32130 _string-inverse-square-root/imm32/name +32131 0x11/imm32/alloc-id:fake +32132 Single-float-var-in-mem/imm32/inouts +32133 0x11/imm32/alloc-id:fake +32134 Single-float-var-in-some-register/imm32/outputs +32135 0x11/imm32/alloc-id:fake +32136 _string_f3_0f_52_inverse_square_root/imm32/subx-name +32137 0/imm32/no-rm32 +32138 0/imm32/no-r32 +32139 0/imm32/no-imm32 +32140 0/imm32/no-imm8 +32141 0/imm32/no-disp32 +32142 1/imm32/xm32-is-first-inout +32143 3/imm32/x32-is-first-output +32144 0x11/imm32/alloc-id:fake +32145 _Primitive-compare-xreg-with-xreg/imm32/next +32146 # - floating-point compare +32147 _Primitive-compare-xreg-with-xreg: # (payload primitive) +32148 0x11/imm32/alloc-id:fake:payload +32149 # compare var1/reg1 var2/reg2 => 0f 2f/compare var2/x32 var1/xm32 +32150 0x11/imm32/alloc-id:fake +32151 _string-compare/imm32/name +32152 0x11/imm32/alloc-id:fake +32153 Two-float-args-in-regs/imm32/inouts +32154 0/imm32/no-outputs +32155 0/imm32/no-outputs +32156 0x11/imm32/alloc-id:fake +32157 _string_0f_2f_compare/imm32/subx-name +32158 0/imm32/no-rm32 +32159 0/imm32/no-r32 +32160 0/imm32/no-imm32 +32161 0/imm32/no-imm8 +32162 0/imm32/no-disp32 +32163 1/imm32/xm32-is-first-inout +32164 2/imm32/x32-is-second-inout +32165 0x11/imm32/alloc-id:fake +32166 _Primitive-compare-xreg-with-mem/imm32/next +32167 _Primitive-compare-xreg-with-mem: # (payload primitive) +32168 0x11/imm32/alloc-id:fake:payload +32169 # compare var1/xreg var2 => 0f 2f/compare var1/x32 var2/xm32 +32170 0x11/imm32/alloc-id:fake +32171 _string-compare/imm32/name +32172 0x11/imm32/alloc-id:fake +32173 Two-args-float-reg-float-stack/imm32/inouts +32174 0/imm32/no-outputs +32175 0/imm32/no-outputs +32176 0x11/imm32/alloc-id:fake +32177 _string_0f_2f_compare/imm32/subx-name +32178 0/imm32/no-rm32 +32179 0/imm32/no-r32 +32180 0/imm32/no-imm32 +32181 0/imm32/no-imm8 +32182 0/imm32/no-disp32 +32183 2/imm32/xm32-is-second-inout +32184 1/imm32/x32-is-first-inout +32185 0x11/imm32/alloc-id:fake +32186 _Primitive-break-if-addr</imm32/next +32187 # - branches +32188 _Primitive-break-if-addr<: # (payload primitive) 32189 0x11/imm32/alloc-id:fake:payload -32190 # "square-root" -32191 0xb/imm32/size -32192 0x73/s 0x71/q 0x75/u 0x61/a 0x72/r 0x65/e 0x2d/- 0x72/r 0x6f/o 0x6f/o 0x74/t -32193 _string-inverse-square-root: -32194 0x11/imm32/alloc-id:fake:payload -32195 # "inverse-square-root" -32196 0x13/imm32/size -32197 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 -32198 _string-negate: # (payload array byte) -32199 0x11/imm32/alloc-id:fake:payload -32200 # "negate" -32201 0x6/imm32/size -32202 0x6e/n 0x65/e 0x67/g 0x61/a 0x74/t 0x65/e -32203 _string-or: # (payload array byte) -32204 0x11/imm32/alloc-id:fake:payload -32205 # "or" -32206 0x2/imm32/size -32207 0x6f/o 0x72/r -32208 _string-or-with: # (payload array byte) -32209 0x11/imm32/alloc-id:fake:payload -32210 # "or-with" -32211 0x7/imm32/size -32212 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -32213 _string-subtract: # (payload array byte) -32214 0x11/imm32/alloc-id:fake:payload -32215 # "subtract" -32216 0x8/imm32/size -32217 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t -32218 _string-subtract-from: # (payload array byte) -32219 0x11/imm32/alloc-id:fake:payload -32220 # "subtract-from" -32221 0xd/imm32/size -32222 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 -32223 _string-xor: # (payload array byte) -32224 0x11/imm32/alloc-id:fake:payload -32225 # "xor" -32226 0x3/imm32/size -32227 0x78/x 0x6f/o 0x72/r -32228 _string-xor-with: # (payload array byte) -32229 0x11/imm32/alloc-id:fake:payload -32230 # "xor-with" -32231 0x8/imm32/size -32232 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -32233 _string-shift-left: # (payload array byte) -32234 0x11/imm32/alloc-id:fake:payload -32235 # "shift-left" -32236 0xa/imm32/size -32237 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x2d/dash 0x6c/l 0x65/e 0x66/f 0x74/t -32238 _string-shift-right: # (payload array byte) -32239 0x11/imm32/alloc-id:fake:payload -32240 # "shift-right" -32241 0xb/imm32/size -32242 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x2d/dash 0x72/r 0x69/i 0x67/g 0x68/h 0x74/t -32243 _string-shift-right-signed: # (payload array byte) -32244 0x11/imm32/alloc-id:fake:payload -32245 # "shift-right-signed" -32246 0x12/imm32/size -32247 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 -32248 -32249 # string literals for SubX instructions -32250 _string_01_add_to: # (payload array byte) -32251 0x11/imm32/alloc-id:fake:payload -32252 # "01/add-to" -32253 0x9/imm32/size -32254 0x30/0 0x31/1 0x2f/slash 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o -32255 _string_03_add: # (payload array byte) -32256 0x11/imm32/alloc-id:fake:payload -32257 # "03/add" -32258 0x6/imm32/size -32259 0x30/0 0x33/3 0x2f/slash 0x61/a 0x64/d 0x64/d -32260 _string_05_add_to_eax: # (payload array byte) -32261 0x11/imm32/alloc-id:fake:payload -32262 # "05/add-to-eax" -32263 0xd/imm32/size -32264 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 -32265 _string_09_or_with: # (payload array byte) -32266 0x11/imm32/alloc-id:fake:payload -32267 # "09/or-with" -32268 0xa/imm32/size -32269 0x30/0 0x39/9 0x2f/slash 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -32270 _string_0b_or: # (payload array byte) -32271 0x11/imm32/alloc-id:fake:payload -32272 # "0b/or" -32273 0x5/imm32/size -32274 0x30/0 0x62/b 0x2f/slash 0x6f/o 0x72/r -32275 _string_0d_or_with_eax: # (payload array byte) -32276 0x11/imm32/alloc-id:fake:payload -32277 # "0d/or-with-eax" -32278 0xe/imm32/size -32279 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 -32280 _string_0f_82_jump_label: # (payload array byte) -32281 0x11/imm32/alloc-id:fake:payload -32282 # "0f 82/jump-if-addr<" -32283 0x13/imm32/size -32284 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/< -32285 _string_0f_82_jump_break: # (payload array byte) -32286 0x11/imm32/alloc-id:fake:payload -32287 # "0f 82/jump-if-addr< break/disp32" -32288 0x20/imm32/size -32289 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 -32290 _string_0f_82_jump_loop: # (payload array byte) -32291 0x11/imm32/alloc-id:fake:payload -32292 # "0f 82/jump-if-addr< loop/disp32" -32293 0x1f/imm32/size -32294 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 -32295 _string_0f_83_jump_label: # (payload array byte) -32296 0x11/imm32/alloc-id:fake:payload -32297 # "0f 83/jump-if-addr>=" -32298 0x14/imm32/size -32299 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/= -32300 _string_0f_83_jump_break: # (payload array byte) -32301 0x11/imm32/alloc-id:fake:payload -32302 # "0f 83/jump-if-addr>= break/disp32" -32303 0x21/imm32/size -32304 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 -32305 _string_0f_83_jump_loop: # (payload array byte) -32306 0x11/imm32/alloc-id:fake:payload -32307 # "0f 83/jump-if-addr>= loop/disp32" -32308 0x20/imm32/size -32309 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 -32310 _string_0f_84_jump_label: # (payload array byte) -32311 0x11/imm32/alloc-id:fake:payload -32312 # "0f 84/jump-if-=" -32313 0xf/imm32/size -32314 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/= -32315 _string_0f_84_jump_break: # (payload array byte) -32316 0x11/imm32/alloc-id:fake:payload -32317 # "0f 84/jump-if-= break/disp32" -32318 0x1c/imm32/size -32319 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 -32320 _string_0f_84_jump_loop: # (payload array byte) -32321 0x11/imm32/alloc-id:fake:payload -32322 # "0f 84/jump-if-= loop/disp32" -32323 0x1b/imm32/size -32324 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 -32325 _string_0f_85_jump_label: # (payload array byte) -32326 0x11/imm32/alloc-id:fake:payload -32327 # "0f 85/jump-if-!=" -32328 0x10/imm32/size -32329 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/= -32330 _string_0f_85_jump_break: # (payload array byte) -32331 0x11/imm32/alloc-id:fake:payload -32332 # "0f 85/jump-if-!= break/disp32" -32333 0x1d/imm32/size -32334 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 -32335 _string_0f_85_jump_loop: # (payload array byte) -32336 0x11/imm32/alloc-id:fake:payload -32337 # "0f 85/jump-if-!= loop/disp32" -32338 0x1c/imm32/size -32339 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 -32340 _string_0f_86_jump_label: # (payload array byte) +32190 0x11/imm32/alloc-id:fake +32191 _string-break-if-addr</imm32/name +32192 0/imm32/no-inouts +32193 0/imm32/no-inouts +32194 0/imm32/no-outputs +32195 0/imm32/no-outputs +32196 0x11/imm32/alloc-id:fake +32197 _string_0f_82_jump_break/imm32/subx-name +32198 0/imm32/no-rm32 +32199 0/imm32/no-r32 +32200 0/imm32/no-imm32 +32201 0/imm32/no-imm8 +32202 0/imm32/no-disp32 +32203 0/imm32/no-xm32 +32204 0/imm32/no-x32 +32205 0x11/imm32/alloc-id:fake +32206 _Primitive-break-if-addr>=/imm32/next +32207 _Primitive-break-if-addr>=: # (payload primitive) +32208 0x11/imm32/alloc-id:fake:payload +32209 0x11/imm32/alloc-id:fake +32210 _string-break-if-addr>=/imm32/name +32211 0/imm32/no-inouts +32212 0/imm32/no-inouts +32213 0/imm32/no-outputs +32214 0/imm32/no-outputs +32215 0x11/imm32/alloc-id:fake +32216 _string_0f_83_jump_break/imm32/subx-name +32217 0/imm32/no-rm32 +32218 0/imm32/no-r32 +32219 0/imm32/no-imm32 +32220 0/imm32/no-imm8 +32221 0/imm32/no-disp32 +32222 0/imm32/no-xm32 +32223 0/imm32/no-x32 +32224 0x11/imm32/alloc-id:fake +32225 _Primitive-break-if-=/imm32/next +32226 _Primitive-break-if-=: # (payload primitive) +32227 0x11/imm32/alloc-id:fake:payload +32228 0x11/imm32/alloc-id:fake +32229 _string-break-if-=/imm32/name +32230 0/imm32/no-inouts +32231 0/imm32/no-inouts +32232 0/imm32/no-outputs +32233 0/imm32/no-outputs +32234 0x11/imm32/alloc-id:fake +32235 _string_0f_84_jump_break/imm32/subx-name +32236 0/imm32/no-rm32 +32237 0/imm32/no-r32 +32238 0/imm32/no-imm32 +32239 0/imm32/no-imm8 +32240 0/imm32/no-disp32 +32241 0/imm32/no-xm32 +32242 0/imm32/no-x32 +32243 0x11/imm32/alloc-id:fake +32244 _Primitive-break-if-!=/imm32/next +32245 _Primitive-break-if-!=: # (payload primitive) +32246 0x11/imm32/alloc-id:fake:payload +32247 0x11/imm32/alloc-id:fake +32248 _string-break-if-!=/imm32/name +32249 0/imm32/no-inouts +32250 0/imm32/no-inouts +32251 0/imm32/no-outputs +32252 0/imm32/no-outputs +32253 0x11/imm32/alloc-id:fake +32254 _string_0f_85_jump_break/imm32/subx-name +32255 0/imm32/no-rm32 +32256 0/imm32/no-r32 +32257 0/imm32/no-imm32 +32258 0/imm32/no-imm8 +32259 0/imm32/no-disp32 +32260 0/imm32/no-xm32 +32261 0/imm32/no-x32 +32262 0x11/imm32/alloc-id:fake +32263 _Primitive-break-if-addr<=/imm32/next +32264 _Primitive-break-if-addr<=: # (payload primitive) +32265 0x11/imm32/alloc-id:fake:payload +32266 0x11/imm32/alloc-id:fake +32267 _string-break-if-addr<=/imm32/name +32268 0/imm32/no-inouts +32269 0/imm32/no-inouts +32270 0/imm32/no-outputs +32271 0/imm32/no-outputs +32272 0x11/imm32/alloc-id:fake +32273 _string_0f_86_jump_break/imm32/subx-name +32274 0/imm32/no-rm32 +32275 0/imm32/no-r32 +32276 0/imm32/no-imm32 +32277 0/imm32/no-imm8 +32278 0/imm32/no-disp32 +32279 0/imm32/no-xm32 +32280 0/imm32/no-x32 +32281 0x11/imm32/alloc-id:fake +32282 _Primitive-break-if-addr>/imm32/next +32283 _Primitive-break-if-addr>: # (payload primitive) +32284 0x11/imm32/alloc-id:fake:payload +32285 0x11/imm32/alloc-id:fake +32286 _string-break-if-addr>/imm32/name +32287 0/imm32/no-inouts +32288 0/imm32/no-inouts +32289 0/imm32/no-outputs +32290 0/imm32/no-outputs +32291 0x11/imm32/alloc-id:fake +32292 _string_0f_87_jump_break/imm32/subx-name +32293 0/imm32/no-rm32 +32294 0/imm32/no-r32 +32295 0/imm32/no-imm32 +32296 0/imm32/no-imm8 +32297 0/imm32/no-disp32 +32298 0/imm32/no-xm32 +32299 0/imm32/no-x32 +32300 0x11/imm32/alloc-id:fake +32301 _Primitive-break-if-</imm32/next +32302 _Primitive-break-if-<: # (payload primitive) +32303 0x11/imm32/alloc-id:fake:payload +32304 0x11/imm32/alloc-id:fake +32305 _string-break-if-</imm32/name +32306 0/imm32/no-inouts +32307 0/imm32/no-inouts +32308 0/imm32/no-outputs +32309 0/imm32/no-outputs +32310 0x11/imm32/alloc-id:fake +32311 _string_0f_8c_jump_break/imm32/subx-name +32312 0/imm32/no-rm32 +32313 0/imm32/no-r32 +32314 0/imm32/no-imm32 +32315 0/imm32/no-imm8 +32316 0/imm32/no-disp32 +32317 0/imm32/no-xm32 +32318 0/imm32/no-x32 +32319 0x11/imm32/alloc-id:fake +32320 _Primitive-break-if->=/imm32/next +32321 _Primitive-break-if->=: # (payload primitive) +32322 0x11/imm32/alloc-id:fake:payload +32323 0x11/imm32/alloc-id:fake +32324 _string-break-if->=/imm32/name +32325 0/imm32/no-inouts +32326 0/imm32/no-inouts +32327 0/imm32/no-outputs +32328 0/imm32/no-outputs +32329 0x11/imm32/alloc-id:fake +32330 _string_0f_8d_jump_break/imm32/subx-name +32331 0/imm32/no-rm32 +32332 0/imm32/no-r32 +32333 0/imm32/no-imm32 +32334 0/imm32/no-imm8 +32335 0/imm32/no-disp32 +32336 0/imm32/no-xm32 +32337 0/imm32/no-x32 +32338 0x11/imm32/alloc-id:fake +32339 _Primitive-break-if-<=/imm32/next +32340 _Primitive-break-if-<=: # (payload primitive) 32341 0x11/imm32/alloc-id:fake:payload -32342 # "0f 86/jump-if-addr<=" -32343 0x14/imm32/size -32344 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/= -32345 _string_0f_86_jump_break: # (payload array byte) -32346 0x11/imm32/alloc-id:fake:payload -32347 # "0f 86/jump-if-addr<= break/disp32" -32348 0x21/imm32/size -32349 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 -32350 _string_0f_86_jump_loop: # (payload array byte) -32351 0x11/imm32/alloc-id:fake:payload -32352 # "0f 86/jump-if-addr<= loop/disp32" -32353 0x20/imm32/size -32354 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 -32355 _string_0f_87_jump_label: # (payload array byte) -32356 0x11/imm32/alloc-id:fake:payload -32357 # "0f 87/jump-if-addr>" -32358 0x13/imm32/size -32359 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/> -32360 _string_0f_87_jump_break: # (payload array byte) -32361 0x11/imm32/alloc-id:fake:payload -32362 # "0f 87/jump-if-addr> break/disp32" -32363 0x20/imm32/size -32364 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 -32365 _string_0f_87_jump_loop: # (payload array byte) -32366 0x11/imm32/alloc-id:fake:payload -32367 # "0f 87/jump-if-addr> loop/disp32" -32368 0x1f/imm32/size -32369 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 -32370 _string_0f_8c_jump_label: # (payload array byte) -32371 0x11/imm32/alloc-id:fake:payload -32372 # "0f 8c/jump-if-<" -32373 0xf/imm32/size -32374 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/< -32375 _string_0f_8c_jump_break: # (payload array byte) -32376 0x11/imm32/alloc-id:fake:payload -32377 # "0f 8c/jump-if-< break/disp32" -32378 0x1c/imm32/size -32379 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 -32380 _string_0f_8c_jump_loop: # (payload array byte) -32381 0x11/imm32/alloc-id:fake:payload -32382 # "0f 8c/jump-if-< loop/disp32" -32383 0x1b/imm32/size -32384 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 -32385 _string_0f_8d_jump_label: # (payload array byte) -32386 0x11/imm32/alloc-id:fake:payload -32387 # "0f 8d/jump-if->=" -32388 0x10/imm32/size -32389 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/= -32390 _string_0f_8d_jump_break: # (payload array byte) -32391 0x11/imm32/alloc-id:fake:payload -32392 # "0f 8d/jump-if->= break/disp32" -32393 0x1d/imm32/size -32394 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 -32395 _string_0f_8d_jump_loop: # (payload array byte) -32396 0x11/imm32/alloc-id:fake:payload -32397 # "0f 8d/jump-if->= loop/disp32" -32398 0x1c/imm32/size -32399 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 -32400 _string_0f_8e_jump_label: # (payload array byte) -32401 0x11/imm32/alloc-id:fake:payload -32402 # "0f 8e/jump-if-<=" -32403 0x10/imm32/size -32404 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/= -32405 _string_0f_8e_jump_break: # (payload array byte) -32406 0x11/imm32/alloc-id:fake:payload -32407 # "0f 8e/jump-if-<= break/disp32" -32408 0x1d/imm32/size -32409 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 -32410 _string_0f_8e_jump_loop: # (payload array byte) -32411 0x11/imm32/alloc-id:fake:payload -32412 # "0f 8e/jump-if-<= loop/disp32" -32413 0x1c/imm32/size -32414 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 -32415 _string_0f_8f_jump_label: # (payload array byte) -32416 0x11/imm32/alloc-id:fake:payload -32417 # "0f 8f/jump-if->" -32418 0xf/imm32/size -32419 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/> -32420 _string_0f_8f_jump_break: # (payload array byte) -32421 0x11/imm32/alloc-id:fake:payload -32422 # "0f 8f/jump-if-> break/disp32" -32423 0x1c/imm32/size -32424 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 -32425 _string_0f_8f_jump_loop: # (payload array byte) -32426 0x11/imm32/alloc-id:fake:payload -32427 # "0f 8f/jump-if-> loop/disp32" -32428 0x1b/imm32/size -32429 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 -32430 _string_0f_af_multiply: # (payload array byte) -32431 0x11/imm32/alloc-id:fake:payload -32432 # "0f af/multiply" -32433 0xe/imm32/size -32434 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 -32435 _string_f3_0f_2a_convert_to_float: +32342 0x11/imm32/alloc-id:fake +32343 _string-break-if-<=/imm32/name +32344 0/imm32/no-inouts +32345 0/imm32/no-inouts +32346 0/imm32/no-outputs +32347 0/imm32/no-outputs +32348 0x11/imm32/alloc-id:fake +32349 _string_0f_8e_jump_break/imm32/subx-name +32350 0/imm32/no-rm32 +32351 0/imm32/no-r32 +32352 0/imm32/no-imm32 +32353 0/imm32/no-imm8 +32354 0/imm32/no-disp32 +32355 0/imm32/no-xm32 +32356 0/imm32/no-x32 +32357 0x11/imm32/alloc-id:fake +32358 _Primitive-break-if->/imm32/next +32359 _Primitive-break-if->: # (payload primitive) +32360 0x11/imm32/alloc-id:fake:payload +32361 0x11/imm32/alloc-id:fake +32362 _string-break-if->/imm32/name +32363 0/imm32/no-inouts +32364 0/imm32/no-inouts +32365 0/imm32/no-outputs +32366 0/imm32/no-outputs +32367 0x11/imm32/alloc-id:fake +32368 _string_0f_8f_jump_break/imm32/subx-name +32369 0/imm32/no-rm32 +32370 0/imm32/no-r32 +32371 0/imm32/no-imm32 +32372 0/imm32/no-imm8 +32373 0/imm32/no-disp32 +32374 0/imm32/no-xm32 +32375 0/imm32/no-x32 +32376 0x11/imm32/alloc-id:fake +32377 _Primitive-break/imm32/next +32378 _Primitive-break: # (payload primitive) +32379 0x11/imm32/alloc-id:fake:payload +32380 0x11/imm32/alloc-id:fake +32381 _string-break/imm32/name +32382 0/imm32/no-inouts +32383 0/imm32/no-inouts +32384 0/imm32/no-outputs +32385 0/imm32/no-outputs +32386 0x11/imm32/alloc-id:fake +32387 _string_e9_jump_break/imm32/subx-name +32388 0/imm32/no-rm32 +32389 0/imm32/no-r32 +32390 0/imm32/no-imm32 +32391 0/imm32/no-imm8 +32392 0/imm32/no-disp32 +32393 0/imm32/no-xm32 +32394 0/imm32/no-x32 +32395 0x11/imm32/alloc-id:fake +32396 _Primitive-loop-if-addr</imm32/next +32397 _Primitive-loop-if-addr<: # (payload primitive) +32398 0x11/imm32/alloc-id:fake:payload +32399 0x11/imm32/alloc-id:fake +32400 _string-loop-if-addr</imm32/name +32401 0/imm32/no-inouts +32402 0/imm32/no-inouts +32403 0/imm32/no-outputs +32404 0/imm32/no-outputs +32405 0x11/imm32/alloc-id:fake +32406 _string_0f_82_jump_loop/imm32/subx-name +32407 0/imm32/no-rm32 +32408 0/imm32/no-r32 +32409 0/imm32/no-imm32 +32410 0/imm32/no-imm8 +32411 0/imm32/no-disp32 +32412 0/imm32/no-xm32 +32413 0/imm32/no-x32 +32414 0x11/imm32/alloc-id:fake +32415 _Primitive-loop-if-addr>=/imm32/next +32416 _Primitive-loop-if-addr>=: # (payload primitive) +32417 0x11/imm32/alloc-id:fake:payload +32418 0x11/imm32/alloc-id:fake +32419 _string-loop-if-addr>=/imm32/name +32420 0/imm32/no-inouts +32421 0/imm32/no-inouts +32422 0/imm32/no-outputs +32423 0/imm32/no-outputs +32424 0x11/imm32/alloc-id:fake +32425 _string_0f_83_jump_loop/imm32/subx-name +32426 0/imm32/no-rm32 +32427 0/imm32/no-r32 +32428 0/imm32/no-imm32 +32429 0/imm32/no-imm8 +32430 0/imm32/no-disp32 +32431 0/imm32/no-xm32 +32432 0/imm32/no-x32 +32433 0x11/imm32/alloc-id:fake +32434 _Primitive-loop-if-=/imm32/next +32435 _Primitive-loop-if-=: # (payload primitive) 32436 0x11/imm32/alloc-id:fake:payload -32437 # "f3 0f 2a/convert-to-float" -32438 0x19/imm32/size -32439 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 -32440 _string_f3_0f_2d_convert_to_int: -32441 0x11/imm32/alloc-id:fake:payload -32442 # "f3 0f 2d/convert-to-int" -32443 0x17/imm32/size -32444 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 -32445 _string_f3_0f_2c_truncate_to_int: -32446 0x11/imm32/alloc-id:fake:payload -32447 # "f3 0f 2c/truncate-to-int" -32448 0x18/imm32/size -32449 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 -32450 _string_f3_0f_58_add: -32451 0x11/imm32/alloc-id:fake:payload -32452 # "f3 0f 58/add" -32453 0xc/imm32/size -32454 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x38/8 0x2f/slash 0x61/a 0x64/d 0x64/d -32455 _string_f3_0f_5c_subtract: -32456 0x11/imm32/alloc-id:fake:payload -32457 # "f3 0f 5c/subtract" -32458 0x11/imm32/size -32459 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 -32460 _string_f3_0f_59_multiply: -32461 0x11/imm32/alloc-id:fake:payload -32462 # "f3 0f 59/multiply" -32463 0x11/imm32/size -32464 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 -32465 _string_f3_0f_5e_divide: -32466 0x11/imm32/alloc-id:fake:payload -32467 # "f3 0f 5e/divide" -32468 0xf/imm32/size -32469 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 -32470 _string_f3_0f_53_reciprocal: -32471 0x11/imm32/alloc-id:fake:payload -32472 # "f3 0f 53/reciprocal" -32473 0x13/imm32/size -32474 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 -32475 _string_f3_0f_51_square_root: -32476 0x11/imm32/alloc-id:fake:payload -32477 # "f3 0f 51/square-root" -32478 0x14/imm32/size -32479 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 -32480 _string_f3_0f_52_inverse_square_root: -32481 0x11/imm32/alloc-id:fake:payload -32482 # "f3 0f 52/inverse-square-root" -32483 0x1c/imm32/size -32484 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 -32485 _string_f3_0f_5d_min: -32486 0x11/imm32/alloc-id:fake:payload -32487 # "f3 0f 5d/min" -32488 0xc/imm32/size -32489 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x64/d 0x2f/slash 0x6d/m 0x69/i 0x6e/n -32490 _string_f3_0f_5f_max: -32491 0x11/imm32/alloc-id:fake:payload -32492 # "f3 0f 5f/max" -32493 0xc/imm32/size -32494 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x66/f 0x2f/slash 0x6d/m 0x61/a 0x78/x -32495 _string_f3_0f_10_copy: -32496 0x11/imm32/alloc-id:fake:payload -32497 # "f3 0f 10/copy" -32498 0xd/imm32/size -32499 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 -32500 _string_f3_0f_11_copy: -32501 0x11/imm32/alloc-id:fake:payload -32502 # "f3 0f 11/copy" -32503 0xd/imm32/size -32504 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 -32505 _string_0f_2f_compare: -32506 0x11/imm32/alloc-id:fake:payload -32507 # "0f 2f/compare" -32508 0xd/imm32/size -32509 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 -32510 _string_21_and_with: # (payload array byte) -32511 0x11/imm32/alloc-id:fake:payload -32512 # "21/and-with" -32513 0xb/imm32/size -32514 0x32/2 0x31/1 0x2f/slash 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -32515 _string_23_and: # (payload array byte) -32516 0x11/imm32/alloc-id:fake:payload -32517 # "23/and" -32518 0x6/imm32/size -32519 0x32/2 0x33/3 0x2f/slash 0x61/a 0x6e/n 0x64/d -32520 _string_25_and_with_eax: # (payload array byte) -32521 0x11/imm32/alloc-id:fake:payload -32522 # "25/and-with-eax" -32523 0xf/imm32/size -32524 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 -32525 _string_29_subtract_from: # (payload array byte) -32526 0x11/imm32/alloc-id:fake:payload -32527 # "29/subtract-from" -32528 0x10/imm32/size -32529 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 -32530 _string_2b_subtract: # (payload array byte) +32437 0x11/imm32/alloc-id:fake +32438 _string-loop-if-=/imm32/name +32439 0/imm32/no-inouts +32440 0/imm32/no-inouts +32441 0/imm32/no-outputs +32442 0/imm32/no-outputs +32443 0x11/imm32/alloc-id:fake +32444 _string_0f_84_jump_loop/imm32/subx-name +32445 0/imm32/no-rm32 +32446 0/imm32/no-r32 +32447 0/imm32/no-imm32 +32448 0/imm32/no-imm8 +32449 0/imm32/no-disp32 +32450 0/imm32/no-xm32 +32451 0/imm32/no-x32 +32452 0x11/imm32/alloc-id:fake +32453 _Primitive-loop-if-!=/imm32/next +32454 _Primitive-loop-if-!=: # (payload primitive) +32455 0x11/imm32/alloc-id:fake:payload +32456 0x11/imm32/alloc-id:fake +32457 _string-loop-if-!=/imm32/name +32458 0/imm32/no-inouts +32459 0/imm32/no-inouts +32460 0/imm32/no-outputs +32461 0/imm32/no-outputs +32462 0x11/imm32/alloc-id:fake +32463 _string_0f_85_jump_loop/imm32/subx-name +32464 0/imm32/no-rm32 +32465 0/imm32/no-r32 +32466 0/imm32/no-imm32 +32467 0/imm32/no-imm8 +32468 0/imm32/no-disp32 +32469 0/imm32/no-xm32 +32470 0/imm32/no-x32 +32471 0x11/imm32/alloc-id:fake +32472 _Primitive-loop-if-addr<=/imm32/next +32473 _Primitive-loop-if-addr<=: # (payload primitive) +32474 0x11/imm32/alloc-id:fake:payload +32475 0x11/imm32/alloc-id:fake +32476 _string-loop-if-addr<=/imm32/name +32477 0/imm32/no-inouts +32478 0/imm32/no-inouts +32479 0/imm32/no-outputs +32480 0/imm32/no-outputs +32481 0x11/imm32/alloc-id:fake +32482 _string_0f_86_jump_loop/imm32/subx-name +32483 0/imm32/no-rm32 +32484 0/imm32/no-r32 +32485 0/imm32/no-imm32 +32486 0/imm32/no-imm8 +32487 0/imm32/no-disp32 +32488 0/imm32/no-xm32 +32489 0/imm32/no-x32 +32490 0x11/imm32/alloc-id:fake +32491 _Primitive-loop-if-addr>/imm32/next +32492 _Primitive-loop-if-addr>: # (payload primitive) +32493 0x11/imm32/alloc-id:fake:payload +32494 0x11/imm32/alloc-id:fake +32495 _string-loop-if-addr>/imm32/name +32496 0/imm32/no-inouts +32497 0/imm32/no-inouts +32498 0/imm32/no-outputs +32499 0/imm32/no-outputs +32500 0x11/imm32/alloc-id:fake +32501 _string_0f_87_jump_loop/imm32/subx-name +32502 0/imm32/no-rm32 +32503 0/imm32/no-r32 +32504 0/imm32/no-imm32 +32505 0/imm32/no-imm8 +32506 0/imm32/no-disp32 +32507 0/imm32/no-xm32 +32508 0/imm32/no-x32 +32509 0x11/imm32/alloc-id:fake +32510 _Primitive-loop-if-</imm32/next +32511 _Primitive-loop-if-<: # (payload primitive) +32512 0x11/imm32/alloc-id:fake:payload +32513 0x11/imm32/alloc-id:fake +32514 _string-loop-if-</imm32/name +32515 0/imm32/no-inouts +32516 0/imm32/no-inouts +32517 0/imm32/no-outputs +32518 0/imm32/no-outputs +32519 0x11/imm32/alloc-id:fake +32520 _string_0f_8c_jump_loop/imm32/subx-name +32521 0/imm32/no-rm32 +32522 0/imm32/no-r32 +32523 0/imm32/no-imm32 +32524 0/imm32/no-imm8 +32525 0/imm32/no-disp32 +32526 0/imm32/no-xm32 +32527 0/imm32/no-x32 +32528 0x11/imm32/alloc-id:fake +32529 _Primitive-loop-if->=/imm32/next +32530 _Primitive-loop-if->=: # (payload primitive) 32531 0x11/imm32/alloc-id:fake:payload -32532 # "2b/subtract" -32533 0xb/imm32/size -32534 0x32/2 0x62/b 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t -32535 _string_2d_subtract_from_eax: # (payload array byte) -32536 0x11/imm32/alloc-id:fake:payload -32537 # "2d/subtract-from-eax" -32538 0x14/imm32/size -32539 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 -32540 _string_31_xor_with: # (payload array byte) -32541 0x11/imm32/alloc-id:fake:payload -32542 # "31/xor-with" -32543 0xb/imm32/size -32544 0x33/3 0x31/1 0x2f/slash 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -32545 _string_33_xor: # (payload array byte) -32546 0x11/imm32/alloc-id:fake:payload -32547 # "33/xor" -32548 0x6/imm32/size -32549 0x33/3 0x33/3 0x2f/slash 0x78/x 0x6f/o 0x72/r -32550 _string_35_xor_with_eax: # (payload array byte) -32551 0x11/imm32/alloc-id:fake:payload -32552 # "35/xor-with-eax" -32553 0xf/imm32/size -32554 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 -32555 _string_39_compare->: # (payload array byte) -32556 0x11/imm32/alloc-id:fake:payload -32557 # "39/compare->" -32558 0xc/imm32/size -32559 0x33/3 0x39/9 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x2d/dash 0x3e/> -32560 _string_3b_compare<-: # (payload array byte) -32561 0x11/imm32/alloc-id:fake:payload -32562 # "3b/compare<-" -32563 0xc/imm32/size -32564 0x33/3 0x62/b 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x3c/< 0x2d/dash -32565 _string_3d_compare_eax_with: # (payload array byte) -32566 0x11/imm32/alloc-id:fake:payload -32567 # "3d/compare-eax-with" -32568 0x13/imm32/size -32569 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 -32570 _string_40_increment_eax: # (payload array byte) -32571 0x11/imm32/alloc-id:fake:payload -32572 # "40/increment-eax" -32573 0x10/imm32/size -32574 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 -32575 _string_41_increment_ecx: # (payload array byte) -32576 0x11/imm32/alloc-id:fake:payload -32577 # "41/increment-ecx" -32578 0x10/imm32/size -32579 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 -32580 _string_42_increment_edx: # (payload array byte) -32581 0x11/imm32/alloc-id:fake:payload -32582 # "42/increment-edx" -32583 0x10/imm32/size -32584 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 -32585 _string_43_increment_ebx: # (payload array byte) -32586 0x11/imm32/alloc-id:fake:payload -32587 # "43/increment-ebx" -32588 0x10/imm32/size -32589 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 -32590 _string_46_increment_esi: # (payload array byte) -32591 0x11/imm32/alloc-id:fake:payload -32592 # "46/increment-esi" -32593 0x10/imm32/size -32594 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 -32595 _string_47_increment_edi: # (payload array byte) -32596 0x11/imm32/alloc-id:fake:payload -32597 # "47/increment-edi" -32598 0x10/imm32/size -32599 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 -32600 _string_48_decrement_eax: # (payload array byte) -32601 0x11/imm32/alloc-id:fake:payload -32602 # "48/decrement-eax" -32603 0x10/imm32/size -32604 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 -32605 _string_49_decrement_ecx: # (payload array byte) -32606 0x11/imm32/alloc-id:fake:payload -32607 # "49/decrement-ecx" -32608 0x10/imm32/size -32609 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 -32610 _string_4a_decrement_edx: # (payload array byte) -32611 0x11/imm32/alloc-id:fake:payload -32612 # "4a/decrement-edx" -32613 0x10/imm32/size -32614 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 -32615 _string_4b_decrement_ebx: # (payload array byte) -32616 0x11/imm32/alloc-id:fake:payload -32617 # "4b/decrement-ebx" -32618 0x10/imm32/size -32619 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 -32620 _string_4e_decrement_esi: # (payload array byte) -32621 0x11/imm32/alloc-id:fake:payload -32622 # "4e/decrement-esi" -32623 0x10/imm32/size -32624 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 -32625 _string_4f_decrement_edi: # (payload array byte) -32626 0x11/imm32/alloc-id:fake:payload -32627 # "4f/decrement-edi" -32628 0x10/imm32/size -32629 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 -32630 _string_81_subop_add: # (payload array byte) -32631 0x11/imm32/alloc-id:fake:payload -32632 # "81 0/subop/add" -32633 0xe/imm32/size -32634 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 -32635 _string_81_subop_or: # (payload array byte) -32636 0x11/imm32/alloc-id:fake:payload -32637 # "81 1/subop/or" -32638 0xd/imm32/size -32639 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 -32640 _string_81_subop_and: # (payload array byte) -32641 0x11/imm32/alloc-id:fake:payload -32642 # "81 4/subop/and" -32643 0xe/imm32/size -32644 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 -32645 _string_81_subop_subtract: # (payload array byte) +32532 0x11/imm32/alloc-id:fake +32533 _string-loop-if->=/imm32/name +32534 0/imm32/no-inouts +32535 0/imm32/no-inouts +32536 0/imm32/no-outputs +32537 0/imm32/no-outputs +32538 0x11/imm32/alloc-id:fake +32539 _string_0f_8d_jump_loop/imm32/subx-name +32540 0/imm32/no-rm32 +32541 0/imm32/no-r32 +32542 0/imm32/no-imm32 +32543 0/imm32/no-imm8 +32544 0/imm32/no-disp32 +32545 0/imm32/no-xm32 +32546 0/imm32/no-x32 +32547 0x11/imm32/alloc-id:fake +32548 _Primitive-loop-if-<=/imm32/next +32549 _Primitive-loop-if-<=: # (payload primitive) +32550 0x11/imm32/alloc-id:fake:payload +32551 0x11/imm32/alloc-id:fake +32552 _string-loop-if-<=/imm32/name +32553 0/imm32/no-inouts +32554 0/imm32/no-inouts +32555 0/imm32/no-outputs +32556 0/imm32/no-outputs +32557 0x11/imm32/alloc-id:fake +32558 _string_0f_8e_jump_loop/imm32/subx-name +32559 0/imm32/no-rm32 +32560 0/imm32/no-r32 +32561 0/imm32/no-imm32 +32562 0/imm32/no-imm8 +32563 0/imm32/no-disp32 +32564 0/imm32/no-xm32 +32565 0/imm32/no-x32 +32566 0x11/imm32/alloc-id:fake +32567 _Primitive-loop-if->/imm32/next +32568 _Primitive-loop-if->: # (payload primitive) +32569 0x11/imm32/alloc-id:fake:payload +32570 0x11/imm32/alloc-id:fake +32571 _string-loop-if->/imm32/name +32572 0/imm32/no-inouts +32573 0/imm32/no-inouts +32574 0/imm32/no-outputs +32575 0/imm32/no-outputs +32576 0x11/imm32/alloc-id:fake +32577 _string_0f_8f_jump_loop/imm32/subx-name +32578 0/imm32/no-rm32 +32579 0/imm32/no-r32 +32580 0/imm32/no-imm32 +32581 0/imm32/no-imm8 +32582 0/imm32/no-disp32 +32583 0/imm32/no-xm32 +32584 0/imm32/no-x32 +32585 0x11/imm32/alloc-id:fake +32586 _Primitive-loop/imm32/next # we probably don't need an unconditional break +32587 _Primitive-loop: # (payload primitive) +32588 0x11/imm32/alloc-id:fake:payload +32589 0x11/imm32/alloc-id:fake +32590 _string-loop/imm32/name +32591 0/imm32/no-inouts +32592 0/imm32/no-inouts +32593 0/imm32/no-outputs +32594 0/imm32/no-outputs +32595 0x11/imm32/alloc-id:fake +32596 _string_e9_jump_loop/imm32/subx-name +32597 0/imm32/no-rm32 +32598 0/imm32/no-r32 +32599 0/imm32/no-imm32 +32600 0/imm32/no-imm8 +32601 0/imm32/no-disp32 +32602 0/imm32/no-xm32 +32603 0/imm32/no-x32 +32604 0x11/imm32/alloc-id:fake +32605 _Primitive-break-if-addr<-named/imm32/next +32606 # - branches to named blocks +32607 _Primitive-break-if-addr<-named: # (payload primitive) +32608 0x11/imm32/alloc-id:fake:payload +32609 0x11/imm32/alloc-id:fake +32610 _string-break-if-addr</imm32/name +32611 0x11/imm32/alloc-id:fake +32612 Single-lit-var/imm32/inouts +32613 0/imm32/no-outputs +32614 0/imm32/no-outputs +32615 0x11/imm32/alloc-id:fake +32616 _string_0f_82_jump_label/imm32/subx-name +32617 0/imm32/no-rm32 +32618 0/imm32/no-r32 +32619 0/imm32/no-imm32 +32620 0/imm32/no-imm8 +32621 1/imm32/disp32-is-first-inout +32622 0/imm32/no-xm32 +32623 0/imm32/no-x32 +32624 0x11/imm32/alloc-id:fake +32625 _Primitive-break-if-addr>=-named/imm32/next +32626 _Primitive-break-if-addr>=-named: # (payload primitive) +32627 0x11/imm32/alloc-id:fake:payload +32628 0x11/imm32/alloc-id:fake +32629 _string-break-if-addr>=/imm32/name +32630 0x11/imm32/alloc-id:fake +32631 Single-lit-var/imm32/inouts +32632 0/imm32/no-outputs +32633 0/imm32/no-outputs +32634 0x11/imm32/alloc-id:fake +32635 _string_0f_83_jump_label/imm32/subx-name +32636 0/imm32/no-rm32 +32637 0/imm32/no-r32 +32638 0/imm32/no-imm32 +32639 0/imm32/no-imm8 +32640 1/imm32/disp32-is-first-inout +32641 0/imm32/no-xm32 +32642 0/imm32/no-x32 +32643 0x11/imm32/alloc-id:fake +32644 _Primitive-break-if-=-named/imm32/next +32645 _Primitive-break-if-=-named: # (payload primitive) 32646 0x11/imm32/alloc-id:fake:payload -32647 # "81 5/subop/subtract" -32648 0x13/imm32/size -32649 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 -32650 _string_81_subop_xor: # (payload array byte) -32651 0x11/imm32/alloc-id:fake:payload -32652 # "81 6/subop/xor" -32653 0xe/imm32/size -32654 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 -32655 _string_81_subop_compare: # (payload array byte) -32656 0x11/imm32/alloc-id:fake:payload -32657 # "81 7/subop/compare" -32658 0x12/imm32/size -32659 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 -32660 _string_89_<-: # (payload array byte) -32661 0x11/imm32/alloc-id:fake:payload -32662 # "89/<-" -32663 0x5/imm32/size -32664 0x38/8 0x39/9 0x2f/slash 0x3c/< 0x2d/dash -32665 _string_8b_->: # (payload array byte) -32666 0x11/imm32/alloc-id:fake:payload -32667 # "8b/->" -32668 0x5/imm32/size -32669 0x38/8 0x62/b 0x2f/slash 0x2d/dash 0x3e/> -32670 _string_8a_copy_byte: -32671 0x11/imm32/alloc-id:fake:payload -32672 # "8a/byte->" -32673 0x9/imm32/size -32674 0x38/8 0x61/a 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x3e/> -32675 _string_88_copy_byte: -32676 0x11/imm32/alloc-id:fake:payload -32677 # "88/byte<-" -32678 0x9/imm32/size -32679 0x38/8 0x38/8 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x3c/< 0x2d/- -32680 _string_8d_copy_address: # (payload array byte) -32681 0x11/imm32/alloc-id:fake:payload -32682 # "8d/copy-address" -32683 0xf/imm32/size -32684 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 -32685 _string_b8_copy_to_eax: # (payload array byte) -32686 0x11/imm32/alloc-id:fake:payload -32687 # "b8/copy-to-eax" -32688 0xe/imm32/size -32689 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 -32690 _string_b9_copy_to_ecx: # (payload array byte) -32691 0x11/imm32/alloc-id:fake:payload -32692 # "b9/copy-to-ecx" -32693 0xe/imm32/size -32694 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 -32695 _string_ba_copy_to_edx: # (payload array byte) -32696 0x11/imm32/alloc-id:fake:payload -32697 # "ba/copy-to-edx" -32698 0xe/imm32/size -32699 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 -32700 _string_bb_copy_to_ebx: # (payload array byte) -32701 0x11/imm32/alloc-id:fake:payload -32702 # "bb/copy-to-ebx" -32703 0xe/imm32/size -32704 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 -32705 _string_be_copy_to_esi: # (payload array byte) -32706 0x11/imm32/alloc-id:fake:payload -32707 # "be/copy-to-esi" -32708 0xe/imm32/size -32709 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 -32710 _string_bf_copy_to_edi: # (payload array byte) -32711 0x11/imm32/alloc-id:fake:payload -32712 # "bf/copy-to-edi" -32713 0xe/imm32/size -32714 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 -32715 _string_c7_subop_copy: # (payload array byte) -32716 0x11/imm32/alloc-id:fake:payload -32717 # "c7 0/subop/copy" -32718 0xf/imm32/size -32719 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 -32720 _string_e9_jump_label: # (payload array byte) -32721 0x11/imm32/alloc-id:fake:payload -32722 # "e9/jump" -32723 0x7/imm32/size -32724 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p -32725 _string_e9_jump_break: # (payload array byte) -32726 0x11/imm32/alloc-id:fake:payload -32727 # "e9/jump break/disp32" -32728 0x14/imm32/size -32729 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 -32730 _string_e9_jump_loop: # (payload array byte) -32731 0x11/imm32/alloc-id:fake:payload -32732 # "e9/jump loop/disp32" -32733 0x13/imm32/size -32734 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 -32735 _string_f7_subop_negate: -32736 0x11/imm32/alloc-id:fake:payload -32737 # "f7 3/subop/negate" -32738 0x11/imm32/size -32739 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 -32740 _string_ff_subop_increment: # (payload array byte) +32647 0x11/imm32/alloc-id:fake +32648 _string-break-if-=/imm32/name +32649 0x11/imm32/alloc-id:fake +32650 Single-lit-var/imm32/inouts +32651 0/imm32/no-outputs +32652 0/imm32/no-outputs +32653 0x11/imm32/alloc-id:fake +32654 _string_0f_84_jump_label/imm32/subx-name +32655 0/imm32/no-rm32 +32656 0/imm32/no-r32 +32657 0/imm32/no-imm32 +32658 0/imm32/no-imm8 +32659 1/imm32/disp32-is-first-inout +32660 0/imm32/no-xm32 +32661 0/imm32/no-x32 +32662 0x11/imm32/alloc-id:fake +32663 _Primitive-break-if-!=-named/imm32/next +32664 _Primitive-break-if-!=-named: # (payload primitive) +32665 0x11/imm32/alloc-id:fake:payload +32666 0x11/imm32/alloc-id:fake +32667 _string-break-if-!=/imm32/name +32668 0x11/imm32/alloc-id:fake +32669 Single-lit-var/imm32/inouts +32670 0/imm32/no-outputs +32671 0/imm32/no-outputs +32672 0x11/imm32/alloc-id:fake +32673 _string_0f_85_jump_label/imm32/subx-name +32674 0/imm32/no-rm32 +32675 0/imm32/no-r32 +32676 0/imm32/no-imm32 +32677 0/imm32/no-imm8 +32678 1/imm32/disp32-is-first-inout +32679 0/imm32/no-xm32 +32680 0/imm32/no-x32 +32681 0x11/imm32/alloc-id:fake +32682 _Primitive-break-if-addr<=-named/imm32/next +32683 _Primitive-break-if-addr<=-named: # (payload primitive) +32684 0x11/imm32/alloc-id:fake:payload +32685 0x11/imm32/alloc-id:fake +32686 _string-break-if-addr<=/imm32/name +32687 0x11/imm32/alloc-id:fake +32688 Single-lit-var/imm32/inouts +32689 0/imm32/no-outputs +32690 0/imm32/no-outputs +32691 0x11/imm32/alloc-id:fake +32692 _string_0f_86_jump_label/imm32/subx-name +32693 0/imm32/no-rm32 +32694 0/imm32/no-r32 +32695 0/imm32/no-imm32 +32696 0/imm32/no-imm8 +32697 1/imm32/disp32-is-first-inout +32698 0/imm32/no-xm32 +32699 0/imm32/no-x32 +32700 0x11/imm32/alloc-id:fake +32701 _Primitive-break-if-addr>-named/imm32/next +32702 _Primitive-break-if-addr>-named: # (payload primitive) +32703 0x11/imm32/alloc-id:fake:payload +32704 0x11/imm32/alloc-id:fake +32705 _string-break-if-addr>/imm32/name +32706 0x11/imm32/alloc-id:fake +32707 Single-lit-var/imm32/inouts +32708 0/imm32/no-outputs +32709 0/imm32/no-outputs +32710 0x11/imm32/alloc-id:fake +32711 _string_0f_87_jump_label/imm32/subx-name +32712 0/imm32/no-rm32 +32713 0/imm32/no-r32 +32714 0/imm32/no-imm32 +32715 0/imm32/no-imm8 +32716 1/imm32/disp32-is-first-inout +32717 0/imm32/no-xm32 +32718 0/imm32/no-x32 +32719 0x11/imm32/alloc-id:fake +32720 _Primitive-break-if-<-named/imm32/next +32721 _Primitive-break-if-<-named: # (payload primitive) +32722 0x11/imm32/alloc-id:fake:payload +32723 0x11/imm32/alloc-id:fake +32724 _string-break-if-</imm32/name +32725 0x11/imm32/alloc-id:fake +32726 Single-lit-var/imm32/inouts +32727 0/imm32/no-outputs +32728 0/imm32/no-outputs +32729 0x11/imm32/alloc-id:fake +32730 _string_0f_8c_jump_label/imm32/subx-name +32731 0/imm32/no-rm32 +32732 0/imm32/no-r32 +32733 0/imm32/no-imm32 +32734 0/imm32/no-imm8 +32735 1/imm32/disp32-is-first-inout +32736 0/imm32/no-xm32 +32737 0/imm32/no-x32 +32738 0x11/imm32/alloc-id:fake +32739 _Primitive-break-if->=-named/imm32/next +32740 _Primitive-break-if->=-named: # (payload primitive) 32741 0x11/imm32/alloc-id:fake:payload -32742 # "ff 0/subop/increment" -32743 0x14/imm32/size -32744 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 -32745 _string_ff_subop_decrement: # (payload array byte) -32746 0x11/imm32/alloc-id:fake:payload -32747 # "ff 1/subop/decrement" -32748 0x14/imm32/size -32749 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 -32750 _string_c1_subop_shift_left: # (payload array byte) -32751 0x11/imm32/alloc-id:fake:payload -32752 # "c1/shift 4/subop/left" -32753 0x15/imm32/size -32754 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 -32755 _string_c1_subop_shift_right_padding_zeroes: # (payload array byte) -32756 0x11/imm32/alloc-id:fake:payload -32757 # "c1/shift 5/subop/right-padding-zeroes" -32758 0x25/imm32/size -32759 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 -32760 _string_c1_subop_shift_right_preserving_sign: # (payload array byte) -32761 0x11/imm32/alloc-id:fake:payload -32762 # "c1/shift 7/subop/right-preserving-sign" -32763 0x26/imm32/size -32764 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 -32765 -32766 Single-int-var-in-mem: # (payload list var) -32767 0x11/imm32/alloc-id:fake:payload -32768 0x11/imm32/alloc-id:fake -32769 Int-var-in-mem/imm32 -32770 0/imm32/next -32771 0/imm32/next -32772 -32773 Int-var-in-mem: # (payload var) -32774 0x11/imm32/alloc-id:fake:payload -32775 0/imm32/name -32776 0/imm32/name -32777 0x11/imm32/alloc-id:fake -32778 Type-int/imm32 -32779 1/imm32/some-block-depth -32780 1/imm32/some-stack-offset -32781 0/imm32/no-register -32782 0/imm32/no-register -32783 -32784 # Not really legal, but closest we can currently represent a dereference of an (addr byte) -32785 Single-byte-var-in-mem: # (payload list var) -32786 0x11/imm32/alloc-id:fake:payload -32787 0x11/imm32/alloc-id:fake -32788 Byte-var-in-mem/imm32 -32789 0/imm32/next -32790 0/imm32/next -32791 -32792 # Not really legal, but closest we can currently represent a dereference of an (addr byte) -32793 Byte-var-in-mem: # (payload var) -32794 0x11/imm32/alloc-id:fake:payload -32795 0/imm32/name -32796 0/imm32/name -32797 0x11/imm32/alloc-id:fake -32798 Type-byte/imm32 -32799 1/imm32/some-block-depth -32800 1/imm32/some-stack-offset -32801 0/imm32/no-register -32802 0/imm32/no-register -32803 -32804 Two-args-int-stack-int-reg: # (payload list var) -32805 0x11/imm32/alloc-id:fake:payload -32806 0x11/imm32/alloc-id:fake -32807 Int-var-in-mem/imm32 -32808 0x11/imm32/alloc-id:fake -32809 Single-int-var-in-some-register/imm32/next -32810 -32811 Two-int-args-in-regs: # (payload list var) -32812 0x11/imm32/alloc-id:fake:payload -32813 0x11/imm32/alloc-id:fake -32814 Int-var-in-some-register/imm32 -32815 0x11/imm32/alloc-id:fake -32816 Single-int-var-in-some-register/imm32/next -32817 -32818 # Not really legal, but closest we can currently represent a dereference of an (addr byte) -32819 Two-args-byte-stack-byte-reg: # (payload list var) -32820 0x11/imm32/alloc-id:fake:payload -32821 0x11/imm32/alloc-id:fake -32822 Byte-var-in-mem/imm32 -32823 0x11/imm32/alloc-id:fake -32824 Single-byte-var-in-some-register/imm32/next -32825 -32826 Two-args-int-reg-int-stack: # (payload list var) -32827 0x11/imm32/alloc-id:fake:payload -32828 0x11/imm32/alloc-id:fake -32829 Int-var-in-some-register/imm32 -32830 0x11/imm32/alloc-id:fake -32831 Single-int-var-in-mem/imm32/next -32832 -32833 Two-args-int-eax-int-literal: # (payload list var) -32834 0x11/imm32/alloc-id:fake:payload -32835 0x11/imm32/alloc-id:fake -32836 Int-var-in-eax/imm32 +32742 0x11/imm32/alloc-id:fake +32743 _string-break-if->=/imm32/name +32744 0x11/imm32/alloc-id:fake +32745 Single-lit-var/imm32/inouts +32746 0/imm32/no-outputs +32747 0/imm32/no-outputs +32748 0x11/imm32/alloc-id:fake +32749 _string_0f_8d_jump_label/imm32/subx-name +32750 0/imm32/no-rm32 +32751 0/imm32/no-r32 +32752 0/imm32/no-imm32 +32753 0/imm32/no-imm8 +32754 1/imm32/disp32-is-first-inout +32755 0/imm32/no-xm32 +32756 0/imm32/no-x32 +32757 0x11/imm32/alloc-id:fake +32758 _Primitive-break-if-<=-named/imm32/next +32759 _Primitive-break-if-<=-named: # (payload primitive) +32760 0x11/imm32/alloc-id:fake:payload +32761 0x11/imm32/alloc-id:fake +32762 _string-break-if-<=/imm32/name +32763 0x11/imm32/alloc-id:fake +32764 Single-lit-var/imm32/inouts +32765 0/imm32/no-outputs +32766 0/imm32/no-outputs +32767 0x11/imm32/alloc-id:fake +32768 _string_0f_8e_jump_label/imm32/subx-name +32769 0/imm32/no-rm32 +32770 0/imm32/no-r32 +32771 0/imm32/no-imm32 +32772 0/imm32/no-imm8 +32773 1/imm32/disp32-is-first-inout +32774 0/imm32/no-xm32 +32775 0/imm32/no-x32 +32776 0x11/imm32/alloc-id:fake +32777 _Primitive-break-if->-named/imm32/next +32778 _Primitive-break-if->-named: # (payload primitive) +32779 0x11/imm32/alloc-id:fake:payload +32780 0x11/imm32/alloc-id:fake +32781 _string-break-if->/imm32/name +32782 0x11/imm32/alloc-id:fake +32783 Single-lit-var/imm32/inouts +32784 0/imm32/no-outputs +32785 0/imm32/no-outputs +32786 0x11/imm32/alloc-id:fake +32787 _string_0f_8f_jump_label/imm32/subx-name +32788 0/imm32/no-rm32 +32789 0/imm32/no-r32 +32790 0/imm32/no-imm32 +32791 0/imm32/no-imm8 +32792 1/imm32/disp32-is-first-inout +32793 0/imm32/no-xm32 +32794 0/imm32/no-x32 +32795 0x11/imm32/alloc-id:fake +32796 _Primitive-break-named/imm32/next +32797 _Primitive-break-named: # (payload primitive) +32798 0x11/imm32/alloc-id:fake:payload +32799 0x11/imm32/alloc-id:fake +32800 _string-break/imm32/name +32801 0x11/imm32/alloc-id:fake +32802 Single-lit-var/imm32/inouts +32803 0/imm32/no-outputs +32804 0/imm32/no-outputs +32805 0x11/imm32/alloc-id:fake +32806 _string_e9_jump_label/imm32/subx-name +32807 0/imm32/no-rm32 +32808 0/imm32/no-r32 +32809 0/imm32/no-imm32 +32810 0/imm32/no-imm8 +32811 1/imm32/disp32-is-first-inout +32812 0/imm32/no-xm32 +32813 0/imm32/no-x32 +32814 0x11/imm32/alloc-id:fake +32815 _Primitive-loop-if-addr<-named/imm32/next +32816 _Primitive-loop-if-addr<-named: # (payload primitive) +32817 0x11/imm32/alloc-id:fake:payload +32818 0x11/imm32/alloc-id:fake +32819 _string-loop-if-addr</imm32/name +32820 0x11/imm32/alloc-id:fake +32821 Single-lit-var/imm32/inouts +32822 0/imm32/no-outputs +32823 0/imm32/no-outputs +32824 0x11/imm32/alloc-id:fake +32825 _string_0f_82_jump_label/imm32/subx-name +32826 0/imm32/no-rm32 +32827 0/imm32/no-r32 +32828 0/imm32/no-imm32 +32829 0/imm32/no-imm8 +32830 1/imm32/disp32-is-first-inout +32831 0/imm32/no-xm32 +32832 0/imm32/no-x32 +32833 0x11/imm32/alloc-id:fake +32834 _Primitive-loop-if-addr>=-named/imm32/next +32835 _Primitive-loop-if-addr>=-named: # (payload primitive) +32836 0x11/imm32/alloc-id:fake:payload 32837 0x11/imm32/alloc-id:fake -32838 Single-lit-var/imm32/next -32839 -32840 Int-var-and-literal: # (payload list var) -32841 0x11/imm32/alloc-id:fake:payload -32842 0x11/imm32/alloc-id:fake -32843 Int-var-in-mem/imm32 -32844 0x11/imm32/alloc-id:fake -32845 Single-lit-var/imm32/next -32846 -32847 Int-var-in-register-and-literal: # (payload list var) -32848 0x11/imm32/alloc-id:fake:payload -32849 0x11/imm32/alloc-id:fake -32850 Int-var-in-some-register/imm32 -32851 0x11/imm32/alloc-id:fake -32852 Single-lit-var/imm32/next -32853 -32854 Two-float-args-in-regs: # (payload list var) +32838 _string-loop-if-addr>=/imm32/name +32839 0x11/imm32/alloc-id:fake +32840 Single-lit-var/imm32/inouts +32841 0/imm32/no-outputs +32842 0/imm32/no-outputs +32843 0x11/imm32/alloc-id:fake +32844 _string_0f_83_jump_label/imm32/subx-name +32845 0/imm32/no-rm32 +32846 0/imm32/no-r32 +32847 0/imm32/no-imm32 +32848 0/imm32/no-imm8 +32849 1/imm32/disp32-is-first-inout +32850 0/imm32/no-xm32 +32851 0/imm32/no-x32 +32852 0x11/imm32/alloc-id:fake +32853 _Primitive-loop-if-=-named/imm32/next +32854 _Primitive-loop-if-=-named: # (payload primitive) 32855 0x11/imm32/alloc-id:fake:payload 32856 0x11/imm32/alloc-id:fake -32857 Float-var-in-some-register/imm32 +32857 _string-loop-if-=/imm32/name 32858 0x11/imm32/alloc-id:fake -32859 Single-float-var-in-some-register/imm32/next -32860 -32861 Two-args-float-reg-float-stack: # (payload list var) -32862 0x11/imm32/alloc-id:fake:payload -32863 0x11/imm32/alloc-id:fake -32864 Float-var-in-some-register/imm32 -32865 0x11/imm32/alloc-id:fake -32866 Single-float-var-in-mem/imm32/next -32867 -32868 Two-args-float-stack-float-reg: # (payload list var) -32869 0x11/imm32/alloc-id:fake:payload -32870 0x11/imm32/alloc-id:fake -32871 Float-var-in-mem/imm32 -32872 0x11/imm32/alloc-id:fake -32873 Single-float-var-in-some-register/imm32/next -32874 -32875 Single-int-var-in-some-register: # (payload list var) -32876 0x11/imm32/alloc-id:fake:payload +32859 Single-lit-var/imm32/inouts +32860 0/imm32/no-outputs +32861 0/imm32/no-outputs +32862 0x11/imm32/alloc-id:fake +32863 _string_0f_84_jump_label/imm32/subx-name +32864 0/imm32/no-rm32 +32865 0/imm32/no-r32 +32866 0/imm32/no-imm32 +32867 0/imm32/no-imm8 +32868 1/imm32/disp32-is-first-inout +32869 0/imm32/no-xm32 +32870 0/imm32/no-x32 +32871 0x11/imm32/alloc-id:fake +32872 _Primitive-loop-if-!=-named/imm32/next +32873 _Primitive-loop-if-!=-named: # (payload primitive) +32874 0x11/imm32/alloc-id:fake:payload +32875 0x11/imm32/alloc-id:fake +32876 _string-loop-if-!=/imm32/name 32877 0x11/imm32/alloc-id:fake -32878 Int-var-in-some-register/imm32 -32879 0/imm32/next -32880 0/imm32/next -32881 -32882 Single-addr-var-in-some-register: # (payload list var) -32883 0x11/imm32/alloc-id:fake:payload -32884 0x11/imm32/alloc-id:fake -32885 Addr-var-in-some-register/imm32 -32886 0/imm32/next -32887 0/imm32/next -32888 -32889 Single-byte-var-in-some-register: # (payload list var) -32890 0x11/imm32/alloc-id:fake:payload -32891 0x11/imm32/alloc-id:fake -32892 Byte-var-in-some-register/imm32 -32893 0/imm32/next -32894 0/imm32/next -32895 -32896 Int-var-in-some-register: # (payload var) -32897 0x11/imm32/alloc-id:fake:payload -32898 0/imm32/name -32899 0/imm32/name +32878 Single-lit-var/imm32/inouts +32879 0/imm32/no-outputs +32880 0/imm32/no-outputs +32881 0x11/imm32/alloc-id:fake +32882 _string_0f_85_jump_label/imm32/subx-name +32883 0/imm32/no-rm32 +32884 0/imm32/no-r32 +32885 0/imm32/no-imm32 +32886 0/imm32/no-imm8 +32887 1/imm32/disp32-is-first-inout +32888 0/imm32/no-xm32 +32889 0/imm32/no-x32 +32890 0x11/imm32/alloc-id:fake +32891 _Primitive-loop-if-addr<=-named/imm32/next +32892 _Primitive-loop-if-addr<=-named: # (payload primitive) +32893 0x11/imm32/alloc-id:fake:payload +32894 0x11/imm32/alloc-id:fake +32895 _string-loop-if-addr<=/imm32/name +32896 0x11/imm32/alloc-id:fake +32897 Single-lit-var/imm32/inouts +32898 0/imm32/no-outputs +32899 0/imm32/no-outputs 32900 0x11/imm32/alloc-id:fake -32901 Type-int/imm32 -32902 1/imm32/some-block-depth -32903 0/imm32/no-stack-offset -32904 0x11/imm32/alloc-id:fake -32905 Any-register/imm32 -32906 -32907 Any-register: # (payload array byte) -32908 0x11/imm32/alloc-id:fake:payload -32909 1/imm32/size -32910 # data -32911 2a/asterisk -32912 -32913 Addr-var-in-some-register: # (payload var) -32914 0x11/imm32/alloc-id:fake:payload -32915 0/imm32/name -32916 0/imm32/name -32917 0x11/imm32/alloc-id:fake -32918 Type-addr/imm32 -32919 1/imm32/some-block-depth -32920 0/imm32/no-stack-offset -32921 0x11/imm32/alloc-id:fake -32922 Any-register/imm32 -32923 -32924 Byte-var-in-some-register: # (payload var) -32925 0x11/imm32/alloc-id:fake:payload -32926 0/imm32/name -32927 0/imm32/name +32901 _string_0f_86_jump_label/imm32/subx-name +32902 0/imm32/no-rm32 +32903 0/imm32/no-r32 +32904 0/imm32/no-imm32 +32905 0/imm32/no-imm8 +32906 1/imm32/disp32-is-first-inout +32907 0/imm32/no-xm32 +32908 0/imm32/no-x32 +32909 0x11/imm32/alloc-id:fake +32910 _Primitive-loop-if-addr>-named/imm32/next +32911 _Primitive-loop-if-addr>-named: # (payload primitive) +32912 0x11/imm32/alloc-id:fake:payload +32913 0x11/imm32/alloc-id:fake +32914 _string-loop-if-addr>/imm32/name +32915 0x11/imm32/alloc-id:fake +32916 Single-lit-var/imm32/inouts +32917 0/imm32/no-outputs +32918 0/imm32/no-outputs +32919 0x11/imm32/alloc-id:fake +32920 _string_0f_87_jump_label/imm32/subx-name +32921 0/imm32/no-rm32 +32922 0/imm32/no-r32 +32923 0/imm32/no-imm32 +32924 0/imm32/no-imm8 +32925 1/imm32/disp32-is-first-inout +32926 0/imm32/no-xm32 +32927 0/imm32/no-x32 32928 0x11/imm32/alloc-id:fake -32929 Type-byte/imm32 -32930 1/imm32/some-block-depth -32931 0/imm32/no-stack-offset +32929 _Primitive-loop-if-<-named/imm32/next +32930 _Primitive-loop-if-<-named: # (payload primitive) +32931 0x11/imm32/alloc-id:fake:payload 32932 0x11/imm32/alloc-id:fake -32933 Any-register/imm32 -32934 -32935 Single-int-var-in-eax: # (payload list var) -32936 0x11/imm32/alloc-id:fake:payload -32937 0x11/imm32/alloc-id:fake -32938 Int-var-in-eax/imm32 -32939 0/imm32/next -32940 0/imm32/next -32941 -32942 Int-var-in-eax: -32943 0x11/imm32/alloc-id:fake:payload -32944 0/imm32/name -32945 0/imm32/name -32946 0x11/imm32/alloc-id:fake -32947 Type-int/imm32 -32948 1/imm32/some-block-depth -32949 0/imm32/no-stack-offset -32950 0x11/imm32/alloc-id:fake -32951 $Mu-register-eax/imm32 # can't use Register-eax only to keep our buggy tools/treeshake.cc happy (TODO) -32952 -32953 Single-int-var-in-ecx: # (payload list var) -32954 0x11/imm32/alloc-id:fake:payload -32955 0x11/imm32/alloc-id:fake -32956 Int-var-in-ecx/imm32 -32957 0/imm32/next -32958 0/imm32/next -32959 -32960 Int-var-in-ecx: -32961 0x11/imm32/alloc-id:fake:payload -32962 0/imm32/name -32963 0/imm32/name -32964 0x11/imm32/alloc-id:fake -32965 Type-int/imm32 -32966 1/imm32/some-block-depth -32967 0/imm32/no-stack-offset -32968 0x11/imm32/alloc-id:fake -32969 $Register-ecx/imm32/register -32970 -32971 Single-int-var-in-edx: # (payload list var) -32972 0x11/imm32/alloc-id:fake:payload -32973 0x11/imm32/alloc-id:fake -32974 Int-var-in-edx/imm32 -32975 0/imm32/next -32976 0/imm32/next -32977 -32978 Int-var-in-edx: # (payload list var) -32979 0x11/imm32/alloc-id:fake:payload -32980 0/imm32/name -32981 0/imm32/name -32982 0x11/imm32/alloc-id:fake -32983 Type-int/imm32 -32984 1/imm32/some-block-depth -32985 0/imm32/no-stack-offset -32986 0x11/imm32/alloc-id:fake -32987 $Register-edx/imm32/register -32988 -32989 Single-int-var-in-ebx: # (payload list var) -32990 0x11/imm32/alloc-id:fake:payload +32933 _string-loop-if-</imm32/name +32934 0x11/imm32/alloc-id:fake +32935 Single-lit-var/imm32/inouts +32936 0/imm32/no-outputs +32937 0/imm32/no-outputs +32938 0x11/imm32/alloc-id:fake +32939 _string_0f_8c_jump_label/imm32/subx-name +32940 0/imm32/no-rm32 +32941 0/imm32/no-r32 +32942 0/imm32/no-imm32 +32943 0/imm32/no-imm8 +32944 1/imm32/disp32-is-first-inout +32945 0/imm32/no-xm32 +32946 0/imm32/no-x32 +32947 0x11/imm32/alloc-id:fake +32948 _Primitive-loop-if->=-named/imm32/next +32949 _Primitive-loop-if->=-named: # (payload primitive) +32950 0x11/imm32/alloc-id:fake:payload +32951 0x11/imm32/alloc-id:fake +32952 _string-loop-if->=/imm32/name +32953 0x11/imm32/alloc-id:fake +32954 Single-lit-var/imm32/inouts +32955 0/imm32/no-outputs +32956 0/imm32/no-outputs +32957 0x11/imm32/alloc-id:fake +32958 _string_0f_8d_jump_label/imm32/subx-name +32959 0/imm32/no-rm32 +32960 0/imm32/no-r32 +32961 0/imm32/no-imm32 +32962 0/imm32/no-imm8 +32963 1/imm32/disp32-is-first-inout +32964 0/imm32/no-xm32 +32965 0/imm32/no-x32 +32966 0x11/imm32/alloc-id:fake +32967 _Primitive-loop-if-<=-named/imm32/next +32968 _Primitive-loop-if-<=-named: # (payload primitive) +32969 0x11/imm32/alloc-id:fake:payload +32970 0x11/imm32/alloc-id:fake +32971 _string-loop-if-<=/imm32/name +32972 0x11/imm32/alloc-id:fake +32973 Single-lit-var/imm32/inouts +32974 0/imm32/no-outputs +32975 0/imm32/no-outputs +32976 0x11/imm32/alloc-id:fake +32977 _string_0f_8e_jump_label/imm32/subx-name +32978 0/imm32/no-rm32 +32979 0/imm32/no-r32 +32980 0/imm32/no-imm32 +32981 0/imm32/no-imm8 +32982 1/imm32/disp32-is-first-inout +32983 0/imm32/no-xm32 +32984 0/imm32/no-x32 +32985 0x11/imm32/alloc-id:fake +32986 _Primitive-loop-if->-named/imm32/next +32987 _Primitive-loop-if->-named: # (payload primitive) +32988 0x11/imm32/alloc-id:fake:payload +32989 0x11/imm32/alloc-id:fake +32990 _string-loop-if->/imm32/name 32991 0x11/imm32/alloc-id:fake -32992 Int-var-in-ebx/imm32 -32993 0/imm32/next -32994 0/imm32/next -32995 -32996 Int-var-in-ebx: # (payload list var) -32997 0x11/imm32/alloc-id:fake:payload -32998 0/imm32/name -32999 0/imm32/name -33000 0x11/imm32/alloc-id:fake -33001 Type-int/imm32 -33002 1/imm32/some-block-depth -33003 0/imm32/no-stack-offset +32992 Single-lit-var/imm32/inouts +32993 0/imm32/no-outputs +32994 0/imm32/no-outputs +32995 0x11/imm32/alloc-id:fake +32996 _string_0f_8f_jump_label/imm32/subx-name +32997 0/imm32/no-rm32 +32998 0/imm32/no-r32 +32999 0/imm32/no-imm32 +33000 0/imm32/no-imm8 +33001 1/imm32/disp32-is-first-inout +33002 0/imm32/no-xm32 +33003 0/imm32/no-x32 33004 0x11/imm32/alloc-id:fake -33005 $Register-ebx/imm32/register -33006 -33007 Single-int-var-in-esi: # (payload list var) -33008 0x11/imm32/alloc-id:fake:payload -33009 0x11/imm32/alloc-id:fake -33010 Int-var-in-esi/imm32 -33011 0/imm32/next -33012 0/imm32/next -33013 -33014 Int-var-in-esi: # (payload list var) -33015 0x11/imm32/alloc-id:fake:payload -33016 0/imm32/name -33017 0/imm32/name -33018 0x11/imm32/alloc-id:fake -33019 Type-int/imm32 -33020 1/imm32/some-block-depth -33021 0/imm32/no-stack-offset -33022 0x11/imm32/alloc-id:fake -33023 $Register-esi/imm32/register -33024 -33025 Single-int-var-in-edi: # (payload list var) -33026 0x11/imm32/alloc-id:fake:payload -33027 0x11/imm32/alloc-id:fake -33028 Int-var-in-edi/imm32 -33029 0/imm32/next -33030 0/imm32/next -33031 -33032 Int-var-in-edi: # (payload list var) -33033 0x11/imm32/alloc-id:fake:payload -33034 0/imm32/name -33035 0/imm32/name -33036 0x11/imm32/alloc-id:fake -33037 Type-int/imm32 -33038 1/imm32/some-block-depth -33039 0/imm32/no-stack-offset -33040 0x11/imm32/alloc-id:fake -33041 $Register-edi/imm32/register -33042 -33043 Single-lit-var: # (payload list var) -33044 0x11/imm32/alloc-id:fake:payload -33045 0x11/imm32/alloc-id:fake -33046 Lit-var/imm32 -33047 0/imm32/next -33048 0/imm32/next -33049 -33050 Lit-var: # (payload var) -33051 0x11/imm32/alloc-id:fake:payload -33052 0/imm32/name -33053 0/imm32/name -33054 0x11/imm32/alloc-id:fake -33055 Type-literal/imm32 -33056 1/imm32/some-block-depth -33057 0/imm32/no-stack-offset -33058 0/imm32/no-register -33059 0/imm32/no-register -33060 -33061 Single-float-var-in-mem: # (payload list var) -33062 0x11/imm32/alloc-id:fake:payload -33063 0x11/imm32/alloc-id:fake -33064 Float-var-in-mem/imm32 -33065 0/imm32/next -33066 0/imm32/next -33067 -33068 Float-var-in-mem: # (payload var) -33069 0x11/imm32/alloc-id:fake:payload -33070 0/imm32/name -33071 0/imm32/name +33005 _Primitive-loop-named/imm32/next # we probably don't need an unconditional break +33006 _Primitive-loop-named: # (payload primitive) +33007 0x11/imm32/alloc-id:fake:payload +33008 0x11/imm32/alloc-id:fake +33009 _string-loop/imm32/name +33010 0x11/imm32/alloc-id:fake +33011 Single-lit-var/imm32/inouts +33012 0/imm32/no-outputs +33013 0/imm32/no-outputs +33014 0x11/imm32/alloc-id:fake +33015 _string_e9_jump_label/imm32/subx-name +33016 0/imm32/no-rm32 +33017 0/imm32/no-r32 +33018 0/imm32/no-imm32 +33019 0/imm32/no-imm8 +33020 1/imm32/disp32-is-first-inout +33021 0/imm32/no-xm32 +33022 0/imm32/no-x32 +33023 0x11/imm32/alloc-id:fake +33024 _Primitive-break-if-float</imm32/next +33025 # - branches based on floating-point comparisons +33026 _Primitive-break-if-float<: # (payload primitive) +33027 0x11/imm32/alloc-id:fake:payload +33028 0x11/imm32/alloc-id:fake +33029 _string-break-if-float</imm32/name +33030 0/imm32/no-inouts +33031 0/imm32/no-inouts +33032 0/imm32/no-outputs +33033 0/imm32/no-outputs +33034 0x11/imm32/alloc-id:fake +33035 _string_0f_82_jump_break/imm32/subx-name +33036 0/imm32/no-rm32 +33037 0/imm32/no-r32 +33038 0/imm32/no-imm32 +33039 0/imm32/no-imm8 +33040 0/imm32/no-disp32 +33041 0/imm32/no-xm32 +33042 0/imm32/no-x32 +33043 0x11/imm32/alloc-id:fake +33044 _Primitive-break-if-float>=/imm32/next +33045 _Primitive-break-if-float>=: # (payload primitive) +33046 0x11/imm32/alloc-id:fake:payload +33047 0x11/imm32/alloc-id:fake +33048 _string-break-if-float>=/imm32/name +33049 0/imm32/no-inouts +33050 0/imm32/no-inouts +33051 0/imm32/no-outputs +33052 0/imm32/no-outputs +33053 0x11/imm32/alloc-id:fake +33054 _string_0f_83_jump_break/imm32/subx-name +33055 0/imm32/no-rm32 +33056 0/imm32/no-r32 +33057 0/imm32/no-imm32 +33058 0/imm32/no-imm8 +33059 0/imm32/no-disp32 +33060 0/imm32/no-xm32 +33061 0/imm32/no-x32 +33062 0x11/imm32/alloc-id:fake +33063 _Primitive-break-if-float<=/imm32/next +33064 _Primitive-break-if-float<=: # (payload primitive) +33065 0x11/imm32/alloc-id:fake:payload +33066 0x11/imm32/alloc-id:fake +33067 _string-break-if-float<=/imm32/name +33068 0/imm32/no-inouts +33069 0/imm32/no-inouts +33070 0/imm32/no-outputs +33071 0/imm32/no-outputs 33072 0x11/imm32/alloc-id:fake -33073 Type-float/imm32 -33074 1/imm32/some-block-depth -33075 1/imm32/some-stack-offset -33076 0/imm32/no-register -33077 0/imm32/no-register -33078 -33079 Single-float-var-in-some-register: # (payload list var) -33080 0x11/imm32/alloc-id:fake:payload +33073 _string_0f_86_jump_break/imm32/subx-name +33074 0/imm32/no-rm32 +33075 0/imm32/no-r32 +33076 0/imm32/no-imm32 +33077 0/imm32/no-imm8 +33078 0/imm32/no-disp32 +33079 0/imm32/no-xm32 +33080 0/imm32/no-x32 33081 0x11/imm32/alloc-id:fake -33082 Float-var-in-some-register/imm32 -33083 0/imm32/next -33084 0/imm32/next -33085 -33086 Float-var-in-some-register: # (payload var) -33087 0x11/imm32/alloc-id:fake:payload -33088 0/imm32/name -33089 0/imm32/name -33090 0x11/imm32/alloc-id:fake -33091 Type-float/imm32 -33092 1/imm32/some-block-depth -33093 0/imm32/no-stack-offset -33094 0x11/imm32/alloc-id:fake -33095 Any-register/imm32 -33096 -33097 Type-int: # (payload type-tree) -33098 0x11/imm32/alloc-id:fake:payload -33099 1/imm32/is-atom -33100 1/imm32/value:int -33101 0/imm32/left:unused -33102 0/imm32/right:null -33103 0/imm32/right:null -33104 -33105 Type-literal: # (payload type-tree) -33106 0x11/imm32/alloc-id:fake:payload -33107 1/imm32/is-atom -33108 0/imm32/value:literal -33109 0/imm32/left:unused -33110 0/imm32/right:null -33111 0/imm32/right:null -33112 -33113 Type-addr: # (payload type-tree) -33114 0x11/imm32/alloc-id:fake:payload -33115 1/imm32/is-atom -33116 2/imm32/value:addr -33117 0/imm32/left:unused -33118 0/imm32/right:null -33119 0/imm32/right:null -33120 -33121 Type-byte: # (payload type-tree) +33082 _Primitive-break-if-float>/imm32/next +33083 _Primitive-break-if-float>: # (payload primitive) +33084 0x11/imm32/alloc-id:fake:payload +33085 0x11/imm32/alloc-id:fake +33086 _string-break-if-float>/imm32/name +33087 0/imm32/no-inouts +33088 0/imm32/no-inouts +33089 0/imm32/no-outputs +33090 0/imm32/no-outputs +33091 0x11/imm32/alloc-id:fake +33092 _string_0f_87_jump_break/imm32/subx-name +33093 0/imm32/no-rm32 +33094 0/imm32/no-r32 +33095 0/imm32/no-imm32 +33096 0/imm32/no-imm8 +33097 0/imm32/no-disp32 +33098 0/imm32/no-xm32 +33099 0/imm32/no-x32 +33100 0x11/imm32/alloc-id:fake +33101 _Primitive-loop-if-float</imm32/next +33102 _Primitive-loop-if-float<: # (payload primitive) +33103 0x11/imm32/alloc-id:fake:payload +33104 0x11/imm32/alloc-id:fake +33105 _string-loop-if-float</imm32/name +33106 0/imm32/no-inouts +33107 0/imm32/no-inouts +33108 0/imm32/no-outputs +33109 0/imm32/no-outputs +33110 0x11/imm32/alloc-id:fake +33111 _string_0f_82_jump_loop/imm32/subx-name +33112 0/imm32/no-rm32 +33113 0/imm32/no-r32 +33114 0/imm32/no-imm32 +33115 0/imm32/no-imm8 +33116 0/imm32/no-disp32 +33117 0/imm32/no-xm32 +33118 0/imm32/no-x32 +33119 0x11/imm32/alloc-id:fake +33120 _Primitive-loop-if-float>=/imm32/next +33121 _Primitive-loop-if-float>=: # (payload primitive) 33122 0x11/imm32/alloc-id:fake:payload -33123 1/imm32/is-atom -33124 8/imm32/value:byte -33125 0/imm32/left:unused -33126 0/imm32/right:null -33127 0/imm32/right:null -33128 -33129 Type-float: # (payload type-tree) -33130 0x11/imm32/alloc-id:fake:payload -33131 1/imm32/is-atom -33132 0xf/imm32/value:float -33133 0/imm32/left:unused -33134 0/imm32/right:null -33135 0/imm32/right:null -33136 -33137 == code -33138 emit-subx-primitive: # out: (addr buffered-file), stmt: (addr stmt), primitive: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) -33139 # . prologue -33140 55/push-ebp -33141 89/<- %ebp 4/r32/esp -33142 # . save registers -33143 50/push-eax -33144 51/push-ecx -33145 # ecx = primitive -33146 8b/-> *(ebp+0x10) 1/r32/ecx -33147 # emit primitive name -33148 (emit-indent *(ebp+8) *Curr-block-depth) -33149 (lookup *(ecx+0x18) *(ecx+0x1c)) # Primitive-subx-name Primitive-subx-name => eax -33150 (write-buffered *(ebp+8) %eax) -33151 # emit rm32 if necessary -33152 (emit-subx-rm32 *(ebp+8) *(ecx+0x20) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-rm32 -33153 # emit xm32 if necessary -33154 (emit-subx-rm32 *(ebp+8) *(ecx+0x34) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-xm32 -33155 # emit r32 if necessary -33156 (emit-subx-r32 *(ebp+8) *(ecx+0x24) *(ebp+0xc)) # Primitive-subx-r32 -33157 # emit x32 if necessary -33158 (emit-subx-x32 *(ebp+8) *(ecx+0x38) *(ebp+0xc)) # Primitive-subx-x32 -33159 # emit imm32 if necessary -33160 (emit-subx-imm32 *(ebp+8) *(ecx+0x28) *(ebp+0xc)) # Primitive-subx-imm32 -33161 # emit imm8 if necessary -33162 (emit-subx-imm8 *(ebp+8) *(ecx+0x2c) *(ebp+0xc)) # Primitive-subx-imm8 -33163 # emit disp32 if necessary -33164 (emit-subx-disp32 *(ebp+8) *(ecx+0x30) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-disp32 -33165 (write-buffered *(ebp+8) Newline) -33166 $emit-subx-primitive:end: -33167 # . restore registers -33168 59/pop-to-ecx -33169 58/pop-to-eax -33170 # . epilogue -33171 89/<- %esp 5/r32/ebp -33172 5d/pop-to-ebp -33173 c3/return -33174 -33175 emit-subx-rm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -33176 # . prologue -33177 55/push-ebp -33178 89/<- %ebp 4/r32/esp -33179 # . save registers -33180 50/push-eax -33181 # if (l == 0) return -33182 81 7/subop/compare *(ebp+0xc) 0/imm32 -33183 74/jump-if-= $emit-subx-rm32:end/disp8 -33184 # var v/eax: (addr stmt-var) -33185 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax -33186 (emit-subx-var-as-rm32 *(ebp+8) %eax) -33187 $emit-subx-rm32:end: -33188 # . restore registers -33189 58/pop-to-eax -33190 # . epilogue -33191 89/<- %esp 5/r32/ebp -33192 5d/pop-to-ebp -33193 c3/return -33194 -33195 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) -33196 # . prologue -33197 55/push-ebp -33198 89/<- %ebp 4/r32/esp -33199 # . save registers -33200 51/push-ecx -33201 # eax = l -33202 8b/-> *(ebp+0xc) 0/r32/eax -33203 # ecx = stmt -33204 8b/-> *(ebp+8) 1/r32/ecx -33205 # if (l == 1) return stmt->inouts -33206 { -33207 3d/compare-eax-and 1/imm32 -33208 75/jump-if-!= break/disp8 -33209 $get-stmt-operand-from-arg-location:1: -33210 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -33211 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -33212 } -33213 # if (l == 2) return stmt->inouts->next -33214 { -33215 3d/compare-eax-and 2/imm32 -33216 75/jump-if-!= break/disp8 -33217 $get-stmt-operand-from-arg-location:2: -33218 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -33219 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -33220 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -33221 } -33222 # if (l == 3) return stmt->outputs -33223 { -33224 3d/compare-eax-and 3/imm32 -33225 75/jump-if-!= break/disp8 -33226 $get-stmt-operand-from-arg-location:3: -33227 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -33228 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -33229 } -33230 # abort -33231 e9/jump $get-stmt-operand-from-arg-location:abort/disp32 -33232 $get-stmt-operand-from-arg-location:end: -33233 # . restore registers -33234 59/pop-to-ecx -33235 # . epilogue -33236 89/<- %esp 5/r32/ebp -33237 5d/pop-to-ebp -33238 c3/return -33239 -33240 $get-stmt-operand-from-arg-location:abort: -33241 # error("invalid arg-location " eax) -33242 (write-buffered *(ebp+0x10) "invalid arg-location ") -33243 (write-int32-hex-buffered *(ebp+0x10) %eax) -33244 (write-buffered *(ebp+0x10) Newline) -33245 (flush *(ebp+0x10)) -33246 (stop *(ebp+0x14) 1) -33247 # never gets here -33248 -33249 emit-subx-r32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -33250 # . prologue -33251 55/push-ebp -33252 89/<- %ebp 4/r32/esp -33253 # . save registers -33254 50/push-eax -33255 51/push-ecx -33256 # if (l == 0) return -33257 81 7/subop/compare *(ebp+0xc) 0/imm32 -33258 0f 84/jump-if-= $emit-subx-r32:end/disp32 -33259 # var v/eax: (addr stmt-var) -33260 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -33261 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -33262 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -33263 #? (write-buffered Stderr "looking up ") -33264 #? (write-buffered Stderr %eax) -33265 #? (write-buffered Stderr Newline) -33266 #? (flush Stderr) -33267 (maybe-get Mu-registers %eax 0xc) # => eax: (addr register-index) -33268 (write-buffered *(ebp+8) Space) -33269 (write-int32-hex-buffered *(ebp+8) *eax) -33270 (write-buffered *(ebp+8) "/r32") -33271 $emit-subx-r32:end: -33272 # . restore registers -33273 59/pop-to-ecx -33274 58/pop-to-eax -33275 # . epilogue -33276 89/<- %esp 5/r32/ebp -33277 5d/pop-to-ebp -33278 c3/return -33279 -33280 emit-subx-x32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -33281 # . prologue -33282 55/push-ebp -33283 89/<- %ebp 4/r32/esp -33284 # . save registers -33285 50/push-eax -33286 51/push-ecx -33287 # if (l == 0) return -33288 81 7/subop/compare *(ebp+0xc) 0/imm32 -33289 0f 84/jump-if-= $emit-subx-x32:end/disp32 -33290 # var v/eax: (addr stmt-var) -33291 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -33292 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -33293 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -33294 #? (write-buffered Stderr "looking up ") -33295 #? (write-buffered Stderr %eax) -33296 #? (write-buffered Stderr Newline) -33297 #? (flush Stderr) -33298 (maybe-get Mu-registers %eax 0xc) # => eax: (addr register-index) -33299 (write-buffered *(ebp+8) Space) -33300 (write-int32-hex-buffered *(ebp+8) *eax) -33301 (write-buffered *(ebp+8) "/x32") -33302 $emit-subx-x32:end: -33303 # . restore registers -33304 59/pop-to-ecx -33305 58/pop-to-eax -33306 # . epilogue -33307 89/<- %esp 5/r32/ebp -33308 5d/pop-to-ebp -33309 c3/return -33310 -33311 emit-subx-imm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -33312 # . prologue -33313 55/push-ebp -33314 89/<- %ebp 4/r32/esp -33315 # . save registers -33316 50/push-eax -33317 51/push-ecx -33318 # if (l == 0) return -33319 81 7/subop/compare *(ebp+0xc) 0/imm32 -33320 0f 84/jump-if-= $emit-subx-imm32:end/disp32 -33321 # var v/eax: (handle var) -33322 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -33323 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -33324 (lookup *eax *(eax+4)) # Var-name Var-name => eax -33325 (write-buffered *(ebp+8) Space) -33326 (write-buffered *(ebp+8) %eax) -33327 (write-buffered *(ebp+8) "/imm32") -33328 $emit-subx-imm32:end: -33329 # . restore registers -33330 59/pop-to-ecx -33331 58/pop-to-eax -33332 # . epilogue -33333 89/<- %esp 5/r32/ebp -33334 5d/pop-to-ebp -33335 c3/return -33336 -33337 emit-subx-imm8: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -33338 # . prologue -33339 55/push-ebp -33340 89/<- %ebp 4/r32/esp -33341 # . save registers -33342 50/push-eax -33343 51/push-ecx -33344 # if (l == 0) return -33345 81 7/subop/compare *(ebp+0xc) 0/imm32 -33346 0f 84/jump-if-= $emit-subx-imm32:end/disp32 -33347 # var v/eax: (handle var) -33348 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -33349 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -33350 (lookup *eax *(eax+4)) # Var-name Var-name => eax -33351 (write-buffered *(ebp+8) Space) -33352 (write-buffered *(ebp+8) %eax) -33353 (write-buffered *(ebp+8) "/imm8") -33354 $emit-subx-imm8:end: -33355 # . restore registers -33356 59/pop-to-ecx -33357 58/pop-to-eax -33358 # . epilogue -33359 89/<- %esp 5/r32/ebp -33360 5d/pop-to-ebp -33361 c3/return -33362 -33363 emit-subx-disp32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -33364 # . prologue -33365 55/push-ebp -33366 89/<- %ebp 4/r32/esp -33367 # . save registers -33368 50/push-eax -33369 51/push-ecx -33370 # if (location == 0) return -33371 81 7/subop/compare *(ebp+0xc) 0/imm32 -33372 0f 84/jump-if-= $emit-subx-disp32:end/disp32 -33373 # var v/eax: (addr stmt-var) -33374 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax -33375 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -33376 (lookup *eax *(eax+4)) # Var-name Var-name => eax -33377 (write-buffered *(ebp+8) Space) -33378 (write-buffered *(ebp+8) %eax) -33379 # hack: if instruction operation starts with "break", emit ":break" -33380 # var name/ecx: (addr array byte) = lookup(stmt->operation) -33381 8b/-> *(ebp+0x10) 0/r32/eax -33382 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -33383 89/<- %ecx 0/r32/eax -33384 { -33385 (string-starts-with? %ecx "break") # => eax -33386 3d/compare-eax-and 0/imm32/false -33387 74/jump-if-= break/disp8 -33388 (write-buffered *(ebp+8) ":break") -33389 } -33390 # hack: if instruction operation starts with "loop", emit ":loop" -33391 { -33392 (string-starts-with? %ecx "loop") # => eax -33393 3d/compare-eax-and 0/imm32/false -33394 74/jump-if-= break/disp8 -33395 (write-buffered *(ebp+8) ":loop") -33396 } -33397 (write-buffered *(ebp+8) "/disp32") -33398 $emit-subx-disp32:end: -33399 # . restore registers -33400 59/pop-to-ecx -33401 58/pop-to-eax -33402 # . epilogue -33403 89/<- %esp 5/r32/ebp -33404 5d/pop-to-ebp -33405 c3/return -33406 -33407 emit-call: # out: (addr buffered-file), stmt: (addr stmt) -33408 # . prologue -33409 55/push-ebp -33410 89/<- %ebp 4/r32/esp -33411 # . save registers -33412 50/push-eax -33413 51/push-ecx -33414 # -33415 (emit-indent *(ebp+8) *Curr-block-depth) -33416 (write-buffered *(ebp+8) "(") -33417 # ecx = stmt -33418 8b/-> *(ebp+0xc) 1/r32/ecx -33419 # - emit function name -33420 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -33421 (write-buffered *(ebp+8) %eax) -33422 # - emit arguments -33423 # var curr/eax: (addr stmt-var) = lookup(stmt->inouts) -33424 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -33425 { -33426 # if (curr == null) break -33427 3d/compare-eax-and 0/imm32 -33428 74/jump-if-= break/disp8 -33429 # -33430 (emit-subx-call-operand *(ebp+8) %eax) -33431 # curr = lookup(curr->next) -33432 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -33433 eb/jump loop/disp8 -33434 } -33435 # -33436 (write-buffered *(ebp+8) ")\n") -33437 $emit-call:end: -33438 # . restore registers -33439 59/pop-to-ecx -33440 58/pop-to-eax -33441 # . epilogue -33442 89/<- %esp 5/r32/ebp -33443 5d/pop-to-ebp -33444 c3/return -33445 -33446 emit-subx-call-operand: # out: (addr buffered-file), s: (addr stmt-var) -33447 # shares code with emit-subx-var-as-rm32 -33448 # . prologue -33449 55/push-ebp -33450 89/<- %ebp 4/r32/esp -33451 # . save registers -33452 50/push-eax -33453 51/push-ecx -33454 56/push-esi -33455 # ecx = s -33456 8b/-> *(ebp+0xc) 1/r32/ecx -33457 # var operand/esi: (addr var) = lookup(s->value) -33458 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -33459 89/<- %esi 0/r32/eax -33460 # if (operand->register && !s->is-deref?) emit "%__" -33461 { -33462 $emit-subx-call-operand:check-for-register-direct: -33463 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -33464 74/jump-if-= break/disp8 -33465 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -33466 75/jump-if-!= break/disp8 -33467 $emit-subx-call-operand:register-direct: -33468 (write-buffered *(ebp+8) " %") -33469 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -33470 (write-buffered *(ebp+8) %eax) -33471 e9/jump $emit-subx-call-operand:end/disp32 -33472 } -33473 # else if (operand->register && s->is-deref?) emit "*__" -33474 { -33475 $emit-subx-call-operand:check-for-register-indirect: -33476 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -33477 74/jump-if-= break/disp8 -33478 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -33479 74/jump-if-= break/disp8 -33480 $emit-subx-call-operand:register-indirect: -33481 (emit-subx-call-operand-register-indirect *(ebp+8) %esi) -33482 e9/jump $emit-subx-call-operand:end/disp32 -33483 } -33484 # else if (operand->stack-offset) emit "*(ebp+__)" -33485 { -33486 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset -33487 74/jump-if-= break/disp8 -33488 $emit-subx-call-operand:stack: -33489 (emit-subx-call-operand-stack *(ebp+8) %esi) -33490 e9/jump $emit-subx-call-operand:end/disp32 -33491 } -33492 # else if (operand->type == literal) emit "__" -33493 { -33494 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax -33495 81 7/subop/compare *(eax+4) 0/imm32 # Type-tree-value -33496 75/jump-if-!= break/disp8 -33497 $emit-subx-call-operand:literal: -33498 (write-buffered *(ebp+8) Space) -33499 (lookup *esi *(esi+4)) # Var-name Var-name => eax -33500 (write-buffered *(ebp+8) %eax) -33501 e9/jump $emit-subx-call-operand:end/disp32 -33502 } -33503 # else if (operand->type == literal-string) emit "__" -33504 { -33505 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax -33506 81 7/subop/compare *(eax+4) 0x10/imm32 # Type-tree-value -33507 75/jump-if-!= break/disp8 -33508 $emit-subx-call-operand:literal-string: -33509 (write-buffered *(ebp+8) Space) -33510 (lookup *esi *(esi+4)) # Var-name Var-name => eax -33511 (write-buffered *(ebp+8) %eax) -33512 } -33513 $emit-subx-call-operand:end: -33514 # . restore registers -33515 5e/pop-to-esi -33516 59/pop-to-ecx -33517 58/pop-to-eax -33518 # . epilogue -33519 89/<- %esp 5/r32/ebp -33520 5d/pop-to-ebp -33521 c3/return -33522 -33523 emit-subx-call-operand-register-indirect: # out: (addr buffered-file), v: (addr var) -33524 # . prologue -33525 55/push-ebp -33526 89/<- %ebp 4/r32/esp -33527 # . save registers -33528 50/push-eax -33529 51/push-ecx -33530 56/push-esi -33531 # esi = v -33532 8b/-> *(ebp+0xc) 6/r32/esi -33533 # var size/ecx: int = size-of-deref(v) -33534 (size-of-deref %esi) # => eax -33535 89/<- %ecx 0/r32/eax -33536 # var reg-name/esi: (addr array byte) = lookup(v->register) -33537 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -33538 89/<- %esi 0/r32/eax -33539 # TODO: assert size is a multiple of 4 -33540 # var i/eax: int = 0 -33541 b8/copy-to-eax 0/imm32 -33542 { -33543 $emit-subx-call-operand-register-indirect:loop: -33544 # if (i >= size) break -33545 39/compare %eax 1/r32/ecx -33546 7d/jump-if->= break/disp8 -33547 # emit " *(" v->register "+" i ")" -33548 (write-buffered *(ebp+8) " *(") -33549 (write-buffered *(ebp+8) %esi) -33550 (write-buffered *(ebp+8) "+") -33551 (write-int32-hex-buffered *(ebp+8) %eax) -33552 (write-buffered *(ebp+8) ")") -33553 # i += 4 -33554 05/add-to-eax 4/imm32 -33555 # -33556 eb/jump loop/disp8 -33557 } -33558 $emit-subx-call-operand-register-indirect:end: -33559 # . restore registers -33560 5e/pop-to-esi -33561 59/pop-to-ecx -33562 58/pop-to-eax -33563 # . epilogue -33564 89/<- %esp 5/r32/ebp -33565 5d/pop-to-ebp -33566 c3/return -33567 -33568 emit-subx-call-operand-stack: # out: (addr buffered-file), v: (addr var) -33569 # . prologue -33570 55/push-ebp -33571 89/<- %ebp 4/r32/esp -33572 # . save registers -33573 50/push-eax -33574 51/push-ecx -33575 56/push-esi -33576 # esi = v -33577 8b/-> *(ebp+0xc) 6/r32/esi -33578 # var curr/ecx: int = v->offset -33579 8b/-> *(esi+0x14) 1/r32/ecx # Var-offset -33580 # var max/eax: int = v->offset + size-of(v) -33581 (size-of %esi) # => eax -33582 # TODO: assert size is a multiple of 4 -33583 01/add-to %eax 1/r32/ecx -33584 { -33585 $emit-subx-call-operand-stack:loop: -33586 # if (curr >= max) break -33587 39/compare %ecx 0/r32/eax -33588 7d/jump-if->= break/disp8 -33589 # emit " *(ebp+" curr ")" -33590 (write-buffered *(ebp+8) " *(ebp+") -33591 (write-int32-hex-buffered *(ebp+8) %ecx) -33592 (write-buffered *(ebp+8) ")") -33593 # i += 4 -33594 81 0/subop/add %ecx 4/imm32 -33595 # -33596 eb/jump loop/disp8 -33597 } -33598 $emit-subx-call-operand-stack:end: -33599 # . restore registers -33600 5e/pop-to-esi -33601 59/pop-to-ecx -33602 58/pop-to-eax -33603 # . epilogue -33604 89/<- %esp 5/r32/ebp -33605 5d/pop-to-ebp -33606 c3/return -33607 -33608 emit-subx-var-as-rm32: # out: (addr buffered-file), s: (addr stmt-var) -33609 # . prologue -33610 55/push-ebp -33611 89/<- %ebp 4/r32/esp -33612 # . save registers -33613 50/push-eax -33614 51/push-ecx -33615 56/push-esi -33616 # ecx = s -33617 8b/-> *(ebp+0xc) 1/r32/ecx -33618 # var operand/esi: (addr var) = lookup(s->value) -33619 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -33620 89/<- %esi 0/r32/eax -33621 # if (operand->register && s->is-deref?) emit "*__" -33622 { -33623 $emit-subx-var-as-rm32:check-for-register-indirect: -33624 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -33625 74/jump-if-= break/disp8 -33626 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -33627 74/jump-if-= break/disp8 -33628 $emit-subx-var-as-rm32:register-indirect: -33629 (write-buffered *(ebp+8) " *") -33630 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -33631 (write-buffered *(ebp+8) %eax) -33632 e9/jump $emit-subx-var-as-rm32:end/disp32 -33633 } -33634 # if (operand->register && !s->is-deref?) emit "%__" -33635 { -33636 $emit-subx-var-as-rm32:check-for-register-direct: -33637 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -33638 74/jump-if-= break/disp8 -33639 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -33640 75/jump-if-!= break/disp8 -33641 $emit-subx-var-as-rm32:register-direct: -33642 (write-buffered *(ebp+8) " %") -33643 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -33644 (write-buffered *(ebp+8) %eax) -33645 e9/jump $emit-subx-var-as-rm32:end/disp32 -33646 } -33647 # else if (operand->stack-offset) emit "*(ebp+__)" -33648 { -33649 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset -33650 74/jump-if-= break/disp8 -33651 $emit-subx-var-as-rm32:stack: -33652 (write-buffered *(ebp+8) Space) -33653 (write-buffered *(ebp+8) "*(ebp+") -33654 (write-int32-hex-buffered *(ebp+8) *(esi+0x14)) # Var-offset -33655 (write-buffered *(ebp+8) ")") -33656 } -33657 $emit-subx-var-as-rm32:end: -33658 # . restore registers -33659 5e/pop-to-esi -33660 59/pop-to-ecx -33661 58/pop-to-eax -33662 # . epilogue -33663 89/<- %esp 5/r32/ebp -33664 5d/pop-to-ebp -33665 c3/return -33666 -33667 find-matching-primitive: # primitives: (addr primitive), stmt: (addr stmt) -> result/eax: (addr primitive) -33668 # . prologue -33669 55/push-ebp -33670 89/<- %ebp 4/r32/esp -33671 # . save registers -33672 51/push-ecx -33673 # var curr/ecx: (addr primitive) = primitives -33674 8b/-> *(ebp+8) 1/r32/ecx -33675 { -33676 $find-matching-primitive:loop: -33677 # if (curr == null) break -33678 81 7/subop/compare %ecx 0/imm32 -33679 74/jump-if-= break/disp8 -33680 # if match(curr, stmt) return curr -33681 { -33682 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx) # => eax -33683 3d/compare-eax-and 0/imm32/false -33684 74/jump-if-= break/disp8 -33685 89/<- %eax 1/r32/ecx -33686 eb/jump $find-matching-primitive:end/disp8 -33687 } -33688 $find-matching-primitive:next-primitive: -33689 # curr = curr->next -33690 (lookup *(ecx+0x3c) *(ecx+0x40)) # Primitive-next Primitive-next => eax -33691 89/<- %ecx 0/r32/eax -33692 # -33693 e9/jump loop/disp32 -33694 } -33695 # return null -33696 b8/copy-to-eax 0/imm32 -33697 $find-matching-primitive:end: -33698 # . restore registers -33699 59/pop-to-ecx -33700 # . epilogue -33701 89/<- %esp 5/r32/ebp -33702 5d/pop-to-ebp -33703 c3/return -33704 -33705 mu-stmt-matches-primitive?: # stmt: (addr stmt), primitive: (addr primitive) -> result/eax: boolean -33706 # A mu stmt matches a primitive if the name matches, all the inout vars -33707 # match, and all the output vars match. -33708 # Vars match if types match and registers match. -33709 # In addition, a stmt output matches a primitive's output if types match -33710 # and the primitive has a wildcard register. -33711 # . prologue -33712 55/push-ebp -33713 89/<- %ebp 4/r32/esp -33714 # . save registers -33715 51/push-ecx -33716 52/push-edx -33717 53/push-ebx -33718 56/push-esi -33719 57/push-edi -33720 # ecx = stmt -33721 8b/-> *(ebp+8) 1/r32/ecx -33722 # edx = primitive -33723 8b/-> *(ebp+0xc) 2/r32/edx -33724 { -33725 $mu-stmt-matches-primitive?:check-name: -33726 # if (primitive->name != stmt->operation) return false -33727 # . var esi: (addr array byte) = lookup(stmt->operation) -33728 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -33729 89/<- %esi 0/r32/eax -33730 # . var edi: (addr array byte) = lookup(primitive->name) -33731 (lookup *edx *(edx+4)) # Primitive-name Primitive-name => eax -33732 #? (write-buffered Stderr %eax) -33733 #? (write-buffered Stderr Newline) -33734 #? (flush Stderr) -33735 89/<- %edi 0/r32/eax -33736 (string-equal? %esi %edi) # => eax -33737 3d/compare-eax-and 0/imm32/false -33738 75/jump-if-!= break/disp8 -33739 b8/copy-to-eax 0/imm32 -33740 e9/jump $mu-stmt-matches-primitive?:end/disp32 -33741 } -33742 # var curr/esi: (addr stmt-var) = lookup(stmt->inouts) -33743 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -33744 89/<- %esi 0/r32/eax -33745 # var curr2/edi: (addr list var) = lookup(primitive->inouts) -33746 (lookup *(edx+8) *(edx+0xc)) # Primitive-inouts Primitive-inouts => eax -33747 89/<- %edi 0/r32/eax -33748 { -33749 $mu-stmt-matches-primitive?:inouts-loop: -33750 # if (curr == 0 && curr2 == 0) move on to check outputs -33751 { -33752 $mu-stmt-matches-primitive?:check-both-inouts-null: -33753 81 7/subop/compare %esi 0/imm32 -33754 75/jump-if-!= break/disp8 -33755 $mu-stmt-matches-primitive?:stmt-inout-null: -33756 81 7/subop/compare %edi 0/imm32 -33757 0f 84/jump-if-= $mu-stmt-matches-primitive?:check-outputs/disp32 -33758 $mu-stmt-matches-primitive?:stmt-inout-null-and-prim-inout-not-null: -33759 # return false -33760 b8/copy-to-eax 0/imm32/false -33761 e9/jump $mu-stmt-matches-primitive?:end/disp32 -33762 } -33763 # if (curr2 == 0) return false -33764 { -33765 $mu-stmt-matches-primitive?:check-prim-inout-null: -33766 81 7/subop/compare %edi 0/imm32 -33767 75/jump-if-!= break/disp8 -33768 $mu-stmt-matches-primitive?:prim-inout-null: -33769 b8/copy-to-eax 0/imm32/false -33770 e9/jump $mu-stmt-matches-primitive?:end/disp32 -33771 } -33772 # if (curr != curr2) return false -33773 { -33774 $mu-stmt-matches-primitive?:check-inouts-match: -33775 (lookup *edi *(edi+4)) # List-value List-value => eax -33776 (operand-matches-primitive? %esi %eax) # => eax -33777 3d/compare-eax-and 0/imm32/false -33778 75/jump-if-!= break/disp8 -33779 $mu-stmt-matches-primitive?:inouts-match: -33780 b8/copy-to-eax 0/imm32/false -33781 e9/jump $mu-stmt-matches-primitive?:end/disp32 -33782 } -33783 $mu-stmt-matches-primitive?:next-inout: -33784 # curr = lookup(curr->next) -33785 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -33786 89/<- %esi 0/r32/eax -33787 # curr2 = lookup(curr2->next) -33788 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -33789 89/<- %edi 0/r32/eax -33790 # -33791 e9/jump loop/disp32 -33792 } -33793 $mu-stmt-matches-primitive?:check-outputs: -33794 # var curr/esi: (addr stmt-var) = lookup(stmt->outputs) -33795 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -33796 89/<- %esi 0/r32/eax -33797 # var curr2/edi: (addr list var) = lookup(primitive->outputs) -33798 (lookup *(edx+0x10) *(edx+0x14)) # Primitive-outputs Primitive-outputs => eax -33799 89/<- %edi 0/r32/eax -33800 { -33801 $mu-stmt-matches-primitive?:outputs-loop: -33802 # if (curr == 0) return (curr2 == 0) -33803 { -33804 $mu-stmt-matches-primitive?:check-both-outputs-null: -33805 81 7/subop/compare %esi 0/imm32 -33806 75/jump-if-!= break/disp8 -33807 { -33808 $mu-stmt-matches-primitive?:stmt-output-null: -33809 81 7/subop/compare %edi 0/imm32 -33810 75/jump-if-!= break/disp8 -33811 $mu-stmt-matches-primitive?:both-outputs-null: -33812 # return true -33813 b8/copy-to-eax 1/imm32 -33814 e9/jump $mu-stmt-matches-primitive?:end/disp32 -33815 } -33816 $mu-stmt-matches-primitive?:stmt-output-null-and-prim-output-not-null: -33817 # return false -33818 b8/copy-to-eax 0/imm32 -33819 e9/jump $mu-stmt-matches-primitive?:end/disp32 -33820 } -33821 # if (curr2 == 0) return false -33822 { -33823 $mu-stmt-matches-primitive?:check-prim-output-null: -33824 81 7/subop/compare %edi 0/imm32 -33825 75/jump-if-!= break/disp8 -33826 $mu-stmt-matches-primitive?:prim-output-is-null: -33827 b8/copy-to-eax 0/imm32 -33828 e9/jump $mu-stmt-matches-primitive?:end/disp32 -33829 } -33830 # if (curr != curr2) return false -33831 { -33832 $mu-stmt-matches-primitive?:check-outputs-match: -33833 (lookup *edi *(edi+4)) # List-value List-value => eax -33834 (operand-matches-primitive? %esi %eax) # => eax -33835 3d/compare-eax-and 0/imm32/false -33836 75/jump-if-!= break/disp8 -33837 $mu-stmt-matches-primitive?:outputs-match: -33838 b8/copy-to-eax 0/imm32 -33839 e9/jump $mu-stmt-matches-primitive?:end/disp32 -33840 } -33841 $mu-stmt-matches-primitive?:next-output: -33842 # curr = lookup(curr->next) -33843 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -33844 89/<- %esi 0/r32/eax -33845 # curr2 = lookup(curr2->next) -33846 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -33847 89/<- %edi 0/r32/eax -33848 # -33849 e9/jump loop/disp32 -33850 } -33851 $mu-stmt-matches-primitive?:return-true: -33852 b8/copy-to-eax 1/imm32 -33853 $mu-stmt-matches-primitive?:end: -33854 # . restore registers -33855 5f/pop-to-edi -33856 5e/pop-to-esi -33857 5b/pop-to-ebx -33858 5a/pop-to-edx -33859 59/pop-to-ecx -33860 # . epilogue -33861 89/<- %esp 5/r32/ebp -33862 5d/pop-to-ebp -33863 c3/return -33864 -33865 operand-matches-primitive?: # s: (addr stmt-var), prim-var: (addr var) -> result/eax: boolean -33866 # . prologue -33867 55/push-ebp -33868 89/<- %ebp 4/r32/esp -33869 # . save registers -33870 51/push-ecx -33871 52/push-edx -33872 53/push-ebx -33873 56/push-esi -33874 57/push-edi -33875 # ecx = s -33876 8b/-> *(ebp+8) 1/r32/ecx -33877 # var var/esi: (addr var) = lookup(s->value) -33878 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -33879 89/<- %esi 0/r32/eax -33880 # edi = prim-var -33881 8b/-> *(ebp+0xc) 7/r32/edi -33882 $operand-matches-primitive?:check-type: -33883 # if !category-match?(var->type, prim-var->type) return false -33884 # . var vtype/ebx: (addr type-tree) = lookup(var->type) -33885 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax -33886 89/<- %ebx 0/r32/eax -33887 # . if s is deref, vtype = vtype->right -33888 { -33889 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -33890 74/jump-if-= break/disp8 -33891 $operand-matches-primitive?:is-deref: -33892 # . var t/eax: (addr type) -33893 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -33894 # . if !t->is-atom? t = t->left -33895 81 7/subop/compare *eax 0/imm32/false -33896 { -33897 75/jump-if-!= break/disp8 -33898 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -33899 } -33900 # . -33901 89/<- %ebx 0/r32/eax -33902 } -33903 # . var ptype/eax: (addr type-tree) = lookup(prim-var->type) -33904 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -33905 (subx-type-category-match? %ebx %eax) # => eax -33906 3d/compare-eax-and 0/imm32/false -33907 0f 84/jump-if-= $operand-matches-primitive?:return-false/disp32 -33908 { -33909 $operand-matches-primitive?:check-register: -33910 # if prim-var is in memory and var is in register but dereference, match -33911 { -33912 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register -33913 0f 85/jump-if-!= break/disp32 -33914 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -33915 74/jump-if-= break/disp8 -33916 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -33917 74/jump-if-= break/disp8 -33918 $operand-matches-primitive?:var-deref-match: -33919 e9/jump $operand-matches-primitive?:return-true/disp32 -33920 } -33921 # if prim-var is in register and var is in register but dereference, no match -33922 { -33923 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register -33924 0f 84/jump-if-= break/disp32 -33925 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -33926 0f 84/jump-if-= break/disp32 -33927 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -33928 74/jump-if-= break/disp8 -33929 $operand-matches-primitive?:var-deref-no-match: -33930 e9/jump $operand-matches-primitive?:return-false/disp32 -33931 } -33932 # return false if var->register doesn't match prim-var->register -33933 { -33934 # if register addresses are equal, it's a match -33935 # var vreg/ebx: (addr array byte) = lookup(var->register) -33936 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -33937 89/<- %ebx 0/r32/eax -33938 # var preg/ecx: (addr array byte) = lookup(prim-var->register) -33939 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax -33940 89/<- %ecx 0/r32/eax -33941 # if (vreg == preg) break -33942 39/compare %ecx 3/r32/ebx -33943 74/jump-if-= break/disp8 -33944 $operand-matches-primitive?:var-register-no-match: -33945 # if either address is 0, return false -33946 81 7/subop/compare %ebx 0/imm32 -33947 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -33948 81 7/subop/compare %ecx 0/imm32 -33949 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -33950 # if prim-var->register is wildcard, it's a match -33951 (string-equal? %ecx "*") # Any-register => eax -33952 3d/compare-eax-and 0/imm32/false -33953 75/jump-if-!= break/disp8 -33954 $operand-matches-primitive?:wildcard-no-match: -33955 # if string contents aren't equal, return false -33956 (string-equal? %ecx %ebx) # => eax -33957 3d/compare-eax-and 0/imm32/false -33958 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -33959 } -33960 } -33961 $operand-matches-primitive?:return-true: -33962 b8/copy-to-eax 1/imm32/true -33963 eb/jump $operand-matches-primitive?:end/disp8 -33964 $operand-matches-primitive?:return-false: -33965 b8/copy-to-eax 0/imm32/false -33966 $operand-matches-primitive?:end: -33967 # . restore registers -33968 5f/pop-to-edi -33969 5e/pop-to-esi -33970 5b/pop-to-ebx -33971 5a/pop-to-edx -33972 59/pop-to-ecx -33973 # . epilogue -33974 89/<- %esp 5/r32/ebp -33975 5d/pop-to-ebp -33976 c3/return -33977 -33978 find-matching-function: # functions: (addr function), stmt: (addr stmt) -> result/eax: (addr function) -33979 # . prologue -33980 55/push-ebp -33981 89/<- %ebp 4/r32/esp -33982 # . save registers -33983 51/push-ecx -33984 # var curr/ecx: (handle function) = functions -33985 8b/-> *(ebp+8) 1/r32/ecx -33986 { -33987 # if (curr == null) break -33988 81 7/subop/compare %ecx 0/imm32 -33989 74/jump-if-= break/disp8 -33990 #? (write-buffered Stderr "iter\n") -33991 #? (flush Stderr) -33992 # if match(stmt, curr) return curr -33993 { -33994 (mu-stmt-matches-function? *(ebp+0xc) %ecx) # => eax -33995 3d/compare-eax-and 0/imm32/false -33996 74/jump-if-= break/disp8 -33997 89/<- %eax 1/r32/ecx -33998 eb/jump $find-matching-function:end/disp8 -33999 } -34000 # curr = curr->next -34001 (lookup *(ecx+0x20) *(ecx+0x24)) # Function-next Function-next => eax -34002 89/<- %ecx 0/r32/eax -34003 # -34004 eb/jump loop/disp8 -34005 } -34006 # return null -34007 b8/copy-to-eax 0/imm32 -34008 $find-matching-function:end: -34009 # . restore registers -34010 59/pop-to-ecx -34011 # . epilogue -34012 89/<- %esp 5/r32/ebp -34013 5d/pop-to-ebp -34014 c3/return -34015 -34016 # Just compare names; user-defined functions don't support overloading yet. -34017 mu-stmt-matches-function?: # stmt: (addr stmt1), function: (addr function) -> result/eax: boolean -34018 # . prologue -34019 55/push-ebp -34020 89/<- %ebp 4/r32/esp -34021 # . save registers -34022 51/push-ecx -34023 # return function->name == stmt->operation -34024 # ecx = lookup(stmt->operation) -34025 8b/-> *(ebp+8) 0/r32/eax -34026 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -34027 89/<- %ecx 0/r32/eax -34028 # eax = lookup(function->name) -34029 8b/-> *(ebp+0xc) 0/r32/eax -34030 (lookup *eax *(eax+4)) # Function-name Function-name => eax -34031 (string-equal? %eax %ecx) # => eax -34032 $mu-stmt-matches-function?:end: -34033 # . restore registers -34034 59/pop-to-ecx -34035 # . epilogue -34036 89/<- %esp 5/r32/ebp -34037 5d/pop-to-ebp -34038 c3/return -34039 -34040 # Type-checking happens elsewhere. This method is for selecting between -34041 # primitives. -34042 subx-type-category-match?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean -34043 # . prologue -34044 55/push-ebp -34045 89/<- %ebp 4/r32/esp -34046 # . save registers -34047 51/push-ecx -34048 # var cata/ecx: int = type-category(a) -34049 (type-category *(ebp+8)) # => eax -34050 89/<- %ecx 0/r32/eax -34051 # var catb/eax: int = type-category(b) -34052 (type-category *(ebp+0xc)) # => eax -34053 # return cata == catb -34054 39/compare %eax 1/r32/ecx -34055 0f 94/set-byte-if-= %al -34056 81 4/subop/and %eax 0xff/imm32 -34057 $subx-type-category-match?:end: -34058 # . restore registers -34059 59/pop-to-ecx -34060 # . epilogue -34061 89/<- %esp 5/r32/ebp -34062 5d/pop-to-ebp -34063 c3/return -34064 -34065 type-category: # a: (addr type-tree) -> result/eax: int -34066 # . prologue -34067 55/push-ebp -34068 89/<- %ebp 4/r32/esp -34069 # . save registers -34070 51/push-ecx -34071 # var lit?/ecx: boolean = is-literal-type?(a) -34072 (is-simple-mu-type? *(ebp+8) 0) # literal => eax -34073 89/<- %ecx 0/r32/eax -34074 # var float?/eax: int = is-float?(a) -34075 (is-simple-mu-type? *(ebp+8) 0xf) # => eax -34076 # set bits for lit? and float? -34077 c1/shift 4/subop/left %ecx 1/imm8 -34078 09/or %eax 1/r32/ecx -34079 $type-category:end: -34080 # . restore registers -34081 59/pop-to-ecx -34082 # . epilogue -34083 89/<- %esp 5/r32/ebp -34084 5d/pop-to-ebp -34085 c3/return -34086 -34087 is-simple-mu-type?: # a: (addr type-tree), n: type-id -> result/eax: boolean -34088 # . prologue -34089 55/push-ebp -34090 89/<- %ebp 4/r32/esp -34091 # . save registers -34092 51/push-ecx -34093 # ecx = n -34094 8b/-> *(ebp+0xc) 1/r32/ecx -34095 # return (a->value == n) -34096 8b/-> *(ebp+8) 0/r32/eax -34097 39/compare *(eax+4) 1/r32/ecx # Type-tree-value -34098 0f 94/set-byte-if-= %al -34099 81 4/subop/and %eax 0xff/imm32 -34100 $is-simple-mu-type?:end: -34101 # . restore registers -34102 59/pop-to-ecx -34103 # . epilogue -34104 89/<- %esp 5/r32/ebp -34105 5d/pop-to-ebp -34106 c3/return -34107 -34108 is-mu-addr-type?: # a: (addr type-tree) -> result/eax: boolean -34109 # . prologue -34110 55/push-ebp -34111 89/<- %ebp 4/r32/esp -34112 # eax = a -34113 8b/-> *(ebp+8) 0/r32/eax -34114 # if (!a->is-atom?) a = a->left -34115 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -34116 { -34117 75/jump-if-!= break/disp8 -34118 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -34119 } -34120 # return (a->value == addr) -34121 81 7/subop/compare *(eax+4) 2/imm32/addr # Type-tree-value -34122 0f 94/set-byte-if-= %al -34123 81 4/subop/and %eax 0xff/imm32 -34124 $is-mu-addr-type?:end: -34125 # . epilogue -34126 89/<- %esp 5/r32/ebp -34127 5d/pop-to-ebp -34128 c3/return -34129 -34130 is-mu-array-type?: # a: (addr type-tree) -> result/eax: boolean -34131 # . prologue -34132 55/push-ebp -34133 89/<- %ebp 4/r32/esp -34134 # eax = a -34135 8b/-> *(ebp+8) 0/r32/eax -34136 # if (!a->is-atom?) a = a->left -34137 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -34138 { -34139 75/jump-if-!= break/disp8 -34140 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -34141 } -34142 # return (a->value == array) -34143 81 7/subop/compare *(eax+4) 3/imm32/array # Type-tree-value -34144 0f 94/set-byte-if-= %al -34145 81 4/subop/and %eax 0xff/imm32 -34146 $is-mu-array-type?:end: -34147 # . epilogue -34148 89/<- %esp 5/r32/ebp -34149 5d/pop-to-ebp -34150 c3/return -34151 -34152 is-mu-string-type?: # a: (addr type-tree) -> result/eax: boolean -34153 # . prologue -34154 55/push-ebp -34155 89/<- %ebp 4/r32/esp -34156 # . save registers -34157 56/push-esi -34158 # esi = a -34159 8b/-> *(ebp+8) 6/r32/esi -34160 # if (a->is-atom?) return false -34161 81 7/subop/compare *esi 0/imm32/false # Type-tree-is-atom -34162 0f 85/jump-if-!= $is-mu-string-type?:return-false/disp32 -34163 # if a is not an addr, return false -34164 (is-mu-addr-type? %esi) # => eax -34165 3d/compare-eax-with 0/imm32/false -34166 0f 84/jump-if-= $is-mu-string-type?:end/disp32 # eax changes var -34167 # if a is not an array, return false -34168 (lookup *(esi+0xc) *(esi+0x10)) # Type-tree-right Type-tree-right => eax -34169 (is-mu-array-type? %eax) # => eax -34170 3d/compare-eax-with 0/imm32/false -34171 74/jump-if-= $is-mu-string-type?:end/disp8 # eax changes var -34172 # var p/eax: (addr type-tree) = payload of a -34173 (lookup *(esi+0xc) *(esi+0x10)) # Type-tree-right Type-tree-right => eax -34174 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -34175 # if p is an atom, return false -34176 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -34177 75/jump-if-!= $is-mu-string-type?:return-false/disp8 -34178 # return (p == byte) -34179 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -34180 (is-simple-mu-type? %eax 8) # byte => eax -34181 eb/jump $is-mu-string-type?:end/disp8 -34182 $is-mu-string-type?:return-false: -34183 b8/copy-to-eax 0/imm32/false -34184 $is-mu-string-type?:end: -34185 # . restore registers -34186 5e/pop-to-esi -34187 # . epilogue -34188 89/<- %esp 5/r32/ebp -34189 5d/pop-to-ebp -34190 c3/return -34191 -34192 is-mu-stream-type?: # a: (addr type-tree) -> result/eax: boolean -34193 # . prologue -34194 55/push-ebp -34195 89/<- %ebp 4/r32/esp -34196 # eax = a -34197 8b/-> *(ebp+8) 0/r32/eax -34198 # if (!a->is-atom?) a = a->left -34199 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -34200 { -34201 75/jump-if-!= break/disp8 -34202 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -34203 } -34204 # return (a->value == stream) -34205 81 7/subop/compare *(eax+4) 0xb/imm32/stream # Type-tree-value -34206 0f 94/set-byte-if-= %al -34207 81 4/subop/and %eax 0xff/imm32 -34208 $is-mu-stream-type?:end: -34209 # . epilogue -34210 89/<- %esp 5/r32/ebp -34211 5d/pop-to-ebp -34212 c3/return -34213 -34214 test-emit-subx-stmt-primitive: -34215 # Primitive operation on a variable on the stack. -34216 # increment foo -34217 # => -34218 # ff 0/subop/increment *(ebp-8) -34219 # -34220 # There's a variable on the var stack as follows: -34221 # name: 'foo' -34222 # type: int -34223 # stack-offset: -8 -34224 # -34225 # There's a primitive with this info: -34226 # name: 'increment' -34227 # inouts: int/mem -34228 # value: 'ff 0/subop/increment' -34229 # -34230 # . prologue -34231 55/push-ebp -34232 89/<- %ebp 4/r32/esp -34233 # setup -34234 (clear-stream _test-output-stream) -34235 (clear-stream $_test-output-buffered-file->buffer) -34236 # simulate allocated payloads starting with an initial fake alloc-id (0x11) -34237 $test-emit-subx-stmt-primitive:initialize-type: -34238 # var type/ecx: (payload type-tree) = int -34239 68/push 0/imm32/right:null -34240 68/push 0/imm32/right:null -34241 68/push 0/imm32/left:unused -34242 68/push 1/imm32/value:int -34243 68/push 1/imm32/is-atom?:true -34244 68/push 0x11/imm32/alloc-id:fake:payload -34245 89/<- %ecx 4/r32/esp -34246 $test-emit-subx-stmt-primitive:initialize-var: -34247 # var var-foo/ecx: (payload var) = var(type) -34248 68/push 0/imm32/no-register -34249 68/push 0/imm32/no-register -34250 68/push -8/imm32/stack-offset -34251 68/push 1/imm32/block-depth -34252 51/push-ecx/type -34253 68/push 0x11/imm32/alloc-id:fake -34254 68/push 0/imm32/name -34255 68/push 0/imm32/name -34256 68/push 0x11/imm32/alloc-id:fake:payload -34257 89/<- %ecx 4/r32/esp -34258 $test-emit-subx-stmt-primitive:initialize-var-name: -34259 # var-foo->name = "foo" -34260 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -34261 (copy-array Heap "foo" %eax) -34262 $test-emit-subx-stmt-primitive:initialize-stmt-var: -34263 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -34264 68/push 0/imm32/is-deref:false -34265 68/push 0/imm32/next -34266 68/push 0/imm32/next -34267 51/push-ecx/var-foo -34268 68/push 0x11/imm32/alloc-id:fake -34269 68/push 0x11/imm32/alloc-id:fake:payload -34270 89/<- %ebx 4/r32/esp -34271 $test-emit-subx-stmt-primitive:initialize-stmt: -34272 # var stmt/esi: (addr statement) -34273 68/push 0/imm32/no-outputs -34274 68/push 0/imm32/no-outputs -34275 53/push-ebx/inouts -34276 68/push 0x11/imm32/alloc-id:fake -34277 68/push 0/imm32/operation -34278 68/push 0/imm32/operation -34279 68/push 1/imm32/tag -34280 89/<- %esi 4/r32/esp -34281 $test-emit-subx-stmt-primitive:initialize-stmt-operation: -34282 # stmt->operation = "increment" -34283 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -34284 (copy-array Heap "increment" %eax) -34285 $test-emit-subx-stmt-primitive:initialize-primitive: -34286 # var primitives/ebx: (addr primitive) -34287 68/push 0/imm32/next -34288 68/push 0/imm32/next -34289 68/push 0/imm32/no-x32 -34290 68/push 0/imm32/no-xm32 -34291 68/push 0/imm32/no-disp32 -34292 68/push 0/imm32/no-imm8 -34293 68/push 0/imm32/no-imm32 -34294 68/push 0/imm32/no-r32 -34295 68/push 1/imm32/rm32-is-first-inout -34296 68/push 0/imm32/subx-name -34297 68/push 0/imm32/subx-name -34298 68/push 0/imm32/no-outputs -34299 68/push 0/imm32/no-outputs -34300 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -34301 68/push 0x11/imm32/alloc-id:fake -34302 68/push 0/imm32/name -34303 68/push 0/imm32/name -34304 89/<- %ebx 4/r32/esp -34305 $test-emit-subx-stmt-primitive:initialize-primitive-name: -34306 # primitives->name = "increment" -34307 (copy-array Heap "increment" %ebx) # Primitive-name -34308 $test-emit-subx-stmt-primitive:initialize-primitive-subx-name: -34309 # primitives->subx-name = "ff 0/subop/increment" -34310 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -34311 (copy-array Heap "ff 0/subop/increment" %eax) -34312 # convert -34313 c7 0/subop/copy *Curr-block-depth 0/imm32 -34314 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0 Stderr 0) -34315 (flush _test-output-buffered-file) -34316 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -34322 # check output -34323 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive") -34324 # . epilogue -34325 89/<- %esp 5/r32/ebp -34326 5d/pop-to-ebp -34327 c3/return +33123 0x11/imm32/alloc-id:fake +33124 _string-loop-if-float>=/imm32/name +33125 0/imm32/no-inouts +33126 0/imm32/no-inouts +33127 0/imm32/no-outputs +33128 0/imm32/no-outputs +33129 0x11/imm32/alloc-id:fake +33130 _string_0f_83_jump_loop/imm32/subx-name +33131 0/imm32/no-rm32 +33132 0/imm32/no-r32 +33133 0/imm32/no-imm32 +33134 0/imm32/no-imm8 +33135 0/imm32/no-disp32 +33136 0/imm32/no-xm32 +33137 0/imm32/no-x32 +33138 0x11/imm32/alloc-id:fake +33139 _Primitive-loop-if-float<=/imm32/next +33140 _Primitive-loop-if-float<=: # (payload primitive) +33141 0x11/imm32/alloc-id:fake:payload +33142 0x11/imm32/alloc-id:fake +33143 _string-loop-if-float<=/imm32/name +33144 0/imm32/no-inouts +33145 0/imm32/no-inouts +33146 0/imm32/no-outputs +33147 0/imm32/no-outputs +33148 0x11/imm32/alloc-id:fake +33149 _string_0f_86_jump_loop/imm32/subx-name +33150 0/imm32/no-rm32 +33151 0/imm32/no-r32 +33152 0/imm32/no-imm32 +33153 0/imm32/no-imm8 +33154 0/imm32/no-disp32 +33155 0/imm32/no-xm32 +33156 0/imm32/no-x32 +33157 0x11/imm32/alloc-id:fake +33158 _Primitive-loop-if-float>/imm32/next +33159 _Primitive-loop-if-float>: # (payload primitive) +33160 0x11/imm32/alloc-id:fake:payload +33161 0x11/imm32/alloc-id:fake +33162 _string-loop-if-float>/imm32/name +33163 0/imm32/no-inouts +33164 0/imm32/no-inouts +33165 0/imm32/no-outputs +33166 0/imm32/no-outputs +33167 0x11/imm32/alloc-id:fake +33168 _string_0f_87_jump_loop/imm32/subx-name +33169 0/imm32/no-rm32 +33170 0/imm32/no-r32 +33171 0/imm32/no-imm32 +33172 0/imm32/no-imm8 +33173 0/imm32/no-disp32 +33174 0/imm32/no-xm32 +33175 0/imm32/no-x32 +33176 0x11/imm32/alloc-id:fake +33177 _Primitive-break-if-float<-named/imm32/next +33178 _Primitive-break-if-float<-named: # (payload primitive) +33179 0x11/imm32/alloc-id:fake:payload +33180 0x11/imm32/alloc-id:fake +33181 _string-break-if-float</imm32/name +33182 0x11/imm32/alloc-id:fake +33183 Single-lit-var/imm32/inouts +33184 0/imm32/no-outputs +33185 0/imm32/no-outputs +33186 0x11/imm32/alloc-id:fake +33187 _string_0f_82_jump_label/imm32/subx-name +33188 0/imm32/no-rm32 +33189 0/imm32/no-r32 +33190 0/imm32/no-imm32 +33191 0/imm32/no-imm8 +33192 1/imm32/disp32-is-first-inout +33193 0/imm32/no-xm32 +33194 0/imm32/no-x32 +33195 0x11/imm32/alloc-id:fake +33196 _Primitive-break-if-float>=-named/imm32/next +33197 _Primitive-break-if-float>=-named: # (payload primitive) +33198 0x11/imm32/alloc-id:fake:payload +33199 0x11/imm32/alloc-id:fake +33200 _string-break-if-float>=/imm32/name +33201 0x11/imm32/alloc-id:fake +33202 Single-lit-var/imm32/inouts +33203 0/imm32/no-outputs +33204 0/imm32/no-outputs +33205 0x11/imm32/alloc-id:fake +33206 _string_0f_83_jump_label/imm32/subx-name +33207 0/imm32/no-rm32 +33208 0/imm32/no-r32 +33209 0/imm32/no-imm32 +33210 0/imm32/no-imm8 +33211 1/imm32/disp32-is-first-inout +33212 0/imm32/no-xm32 +33213 0/imm32/no-x32 +33214 0x11/imm32/alloc-id:fake +33215 _Primitive-break-if-float<=-named/imm32/next +33216 _Primitive-break-if-float<=-named: # (payload primitive) +33217 0x11/imm32/alloc-id:fake:payload +33218 0x11/imm32/alloc-id:fake +33219 _string-break-if-float<=/imm32/name +33220 0x11/imm32/alloc-id:fake +33221 Single-lit-var/imm32/inouts +33222 0/imm32/no-outputs +33223 0/imm32/no-outputs +33224 0x11/imm32/alloc-id:fake +33225 _string_0f_86_jump_label/imm32/subx-name +33226 0/imm32/no-rm32 +33227 0/imm32/no-r32 +33228 0/imm32/no-imm32 +33229 0/imm32/no-imm8 +33230 1/imm32/disp32-is-first-inout +33231 0/imm32/no-xm32 +33232 0/imm32/no-x32 +33233 0x11/imm32/alloc-id:fake +33234 _Primitive-break-if-float>-named/imm32/next +33235 _Primitive-break-if-float>-named: # (payload primitive) +33236 0x11/imm32/alloc-id:fake:payload +33237 0x11/imm32/alloc-id:fake +33238 _string-break-if-float>/imm32/name +33239 0x11/imm32/alloc-id:fake +33240 Single-lit-var/imm32/inouts +33241 0/imm32/no-outputs +33242 0/imm32/no-outputs +33243 0x11/imm32/alloc-id:fake +33244 _string_0f_87_jump_label/imm32/subx-name +33245 0/imm32/no-rm32 +33246 0/imm32/no-r32 +33247 0/imm32/no-imm32 +33248 0/imm32/no-imm8 +33249 1/imm32/disp32-is-first-inout +33250 0/imm32/no-xm32 +33251 0/imm32/no-x32 +33252 0x11/imm32/alloc-id:fake +33253 _Primitive-loop-if-float<-named/imm32/next +33254 _Primitive-loop-if-float<-named: # (payload primitive) +33255 0x11/imm32/alloc-id:fake:payload +33256 0x11/imm32/alloc-id:fake +33257 _string-loop-if-float</imm32/name +33258 0x11/imm32/alloc-id:fake +33259 Single-lit-var/imm32/inouts +33260 0/imm32/no-outputs +33261 0/imm32/no-outputs +33262 0x11/imm32/alloc-id:fake +33263 _string_0f_82_jump_label/imm32/subx-name +33264 0/imm32/no-rm32 +33265 0/imm32/no-r32 +33266 0/imm32/no-imm32 +33267 0/imm32/no-imm8 +33268 1/imm32/disp32-is-first-inout +33269 0/imm32/no-xm32 +33270 0/imm32/no-x32 +33271 0x11/imm32/alloc-id:fake +33272 _Primitive-loop-if-float>=-named/imm32/next +33273 _Primitive-loop-if-float>=-named: # (payload primitive) +33274 0x11/imm32/alloc-id:fake:payload +33275 0x11/imm32/alloc-id:fake +33276 _string-loop-if-float>=/imm32/name +33277 0x11/imm32/alloc-id:fake +33278 Single-lit-var/imm32/inouts +33279 0/imm32/no-outputs +33280 0/imm32/no-outputs +33281 0x11/imm32/alloc-id:fake +33282 _string_0f_83_jump_label/imm32/subx-name +33283 0/imm32/no-rm32 +33284 0/imm32/no-r32 +33285 0/imm32/no-imm32 +33286 0/imm32/no-imm8 +33287 1/imm32/disp32-is-first-inout +33288 0/imm32/no-xm32 +33289 0/imm32/no-x32 +33290 0x11/imm32/alloc-id:fake +33291 _Primitive-loop-if-float<=-named/imm32/next +33292 _Primitive-loop-if-float<=-named: # (payload primitive) +33293 0x11/imm32/alloc-id:fake:payload +33294 0x11/imm32/alloc-id:fake +33295 _string-loop-if-float<=/imm32/name +33296 0x11/imm32/alloc-id:fake +33297 Single-lit-var/imm32/inouts +33298 0/imm32/no-outputs +33299 0/imm32/no-outputs +33300 0x11/imm32/alloc-id:fake +33301 _string_0f_86_jump_label/imm32/subx-name +33302 0/imm32/no-rm32 +33303 0/imm32/no-r32 +33304 0/imm32/no-imm32 +33305 0/imm32/no-imm8 +33306 1/imm32/disp32-is-first-inout +33307 0/imm32/no-xm32 +33308 0/imm32/no-x32 +33309 0x11/imm32/alloc-id:fake +33310 _Primitive-loop-if-float>-named/imm32/next +33311 _Primitive-loop-if-float>-named: # (payload primitive) +33312 0x11/imm32/alloc-id:fake:payload +33313 0x11/imm32/alloc-id:fake +33314 _string-loop-if-float>/imm32/name +33315 0x11/imm32/alloc-id:fake +33316 Single-lit-var/imm32/inouts +33317 0/imm32/no-outputs +33318 0/imm32/no-outputs +33319 0x11/imm32/alloc-id:fake +33320 _string_0f_87_jump_label/imm32/subx-name +33321 0/imm32/no-rm32 +33322 0/imm32/no-r32 +33323 0/imm32/no-imm32 +33324 0/imm32/no-imm8 +33325 1/imm32/disp32-is-first-inout +33326 0/imm32/no-xm32 +33327 0/imm32/no-x32 +33328 0/imm32/next +33329 0/imm32/next +33330 +33331 # string literals for Mu instructions +33332 _string-add: # (payload array byte) +33333 0x11/imm32/alloc-id:fake:payload +33334 # "add" +33335 0x3/imm32/size +33336 0x61/a 0x64/d 0x64/d +33337 _string-address: # (payload array byte) +33338 0x11/imm32/alloc-id:fake:payload +33339 # "address" +33340 0x7/imm32/size +33341 0x61/a 0x64/d 0x64/d 0x72/r 0x65/e 0x73/s 0x73/s +33342 _string-add-to: # (payload array byte) +33343 0x11/imm32/alloc-id:fake:payload +33344 # "add-to" +33345 0x6/imm32/size +33346 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o +33347 _string-and: # (payload array byte) +33348 0x11/imm32/alloc-id:fake:payload +33349 # "and" +33350 0x3/imm32/size +33351 0x61/a 0x6e/n 0x64/d +33352 _string-and-with: # (payload array byte) +33353 0x11/imm32/alloc-id:fake:payload +33354 # "and-with" +33355 0x8/imm32/size +33356 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +33357 _string-break: # (payload array byte) +33358 0x11/imm32/alloc-id:fake:payload +33359 # "break" +33360 0x5/imm32/size +33361 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k +33362 _string-break-if-<: # (payload array byte) +33363 0x11/imm32/alloc-id:fake:payload +33364 # "break-if-<" +33365 0xa/imm32/size +33366 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< +33367 _string-break-if-<=: # (payload array byte) +33368 0x11/imm32/alloc-id:fake:payload +33369 # "break-if-<=" +33370 0xb/imm32/size +33371 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= +33372 _string-break-if-=: # (payload array byte) +33373 0x11/imm32/alloc-id:fake:payload +33374 # "break-if-=" +33375 0xa/imm32/size +33376 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= +33377 _string-break-if->: # (payload array byte) +33378 0x11/imm32/alloc-id:fake:payload +33379 # "break-if->" +33380 0xa/imm32/size +33381 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> +33382 _string-break-if->=: # (payload array byte) +33383 0x11/imm32/alloc-id:fake:payload +33384 # "break-if->=" +33385 0xb/imm32/size +33386 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= +33387 _string-break-if-!=: # (payload array byte) +33388 0x11/imm32/alloc-id:fake:payload +33389 # "break-if-!=" +33390 0xb/imm32/size +33391 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= +33392 _string-break-if-addr<: # (payload array byte) +33393 0x11/imm32/alloc-id:fake:payload +33394 # "break-if-addr<" +33395 0xe/imm32/size +33396 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/< +33397 _string-break-if-addr<=: # (payload array byte) +33398 0x11/imm32/alloc-id:fake:payload +33399 # "break-if-addr<=" +33400 0xf/imm32/size +33401 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/= +33402 _string-break-if-addr>: # (payload array byte) +33403 0x11/imm32/alloc-id:fake:payload +33404 # "break-if-addr>" +33405 0xe/imm32/size +33406 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/> +33407 _string-break-if-addr>=: # (payload array byte) +33408 0x11/imm32/alloc-id:fake:payload +33409 # "break-if-addr>=" +33410 0xf/imm32/size +33411 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/= +33412 _string-break-if-float<: # (payload array byte) +33413 0x11/imm32/alloc-id:fake:payload +33414 # "break-if-float<" +33415 0xf/imm32/size +33416 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/< +33417 _string-break-if-float<=: # (payload array byte) +33418 0x11/imm32/alloc-id:fake:payload +33419 # "break-if-float<=" +33420 0x10/imm32/size +33421 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/= +33422 _string-break-if-float>: # (payload array byte) +33423 0x11/imm32/alloc-id:fake:payload +33424 # "break-if-float>" +33425 0xf/imm32/size +33426 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/> +33427 _string-break-if-float>=: # (payload array byte) +33428 0x11/imm32/alloc-id:fake:payload +33429 # "break-if-float>=" +33430 0x10/imm32/size +33431 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/= +33432 _string-compare: # (payload array byte) +33433 0x11/imm32/alloc-id:fake:payload +33434 # "compare" +33435 0x7/imm32/size +33436 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e +33437 _string-copy: # (payload array byte) +33438 0x11/imm32/alloc-id:fake:payload +33439 # "copy" +33440 0x4/imm32/size +33441 0x63/c 0x6f/o 0x70/p 0x79/y +33442 _string-copy-to: # (payload array byte) +33443 0x11/imm32/alloc-id:fake:payload +33444 # "copy-to" +33445 0x7/imm32/size +33446 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o +33447 _string-copy-byte: +33448 0x11/imm32/alloc-id:fake:payload +33449 # "copy-byte" +33450 0x9/imm32/size +33451 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e +33452 _string-copy-byte-to: +33453 0x11/imm32/alloc-id:fake:payload +33454 # "copy-byte-to" +33455 0xc/imm32/size +33456 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x74/t 0x6f/o +33457 _string-decrement: # (payload array byte) +33458 0x11/imm32/alloc-id:fake:payload +33459 # "decrement" +33460 0x9/imm32/size +33461 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t +33462 _string-increment: # (payload array byte) +33463 0x11/imm32/alloc-id:fake:payload +33464 # "increment" +33465 0x9/imm32/size +33466 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t +33467 _string-loop: # (payload array byte) +33468 0x11/imm32/alloc-id:fake:payload +33469 # "loop" +33470 0x4/imm32/size +33471 0x6c/l 0x6f/o 0x6f/o 0x70/p +33472 _string-loop-if-<: # (payload array byte) +33473 0x11/imm32/alloc-id:fake:payload +33474 # "loop-if-<" +33475 0x9/imm32/size +33476 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< +33477 _string-loop-if-<=: # (payload array byte) +33478 0x11/imm32/alloc-id:fake:payload +33479 # "loop-if-<=" +33480 0xa/imm32/size +33481 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= +33482 _string-loop-if-=: # (payload array byte) +33483 0x11/imm32/alloc-id:fake:payload +33484 # "loop-if-=" +33485 0x9/imm32/size +33486 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= +33487 _string-loop-if->: # (payload array byte) +33488 0x11/imm32/alloc-id:fake:payload +33489 # "loop-if->" +33490 0x9/imm32/size +33491 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> +33492 _string-loop-if->=: # (payload array byte) +33493 0x11/imm32/alloc-id:fake:payload +33494 # "loop-if->=" +33495 0xa/imm32/size +33496 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= +33497 _string-loop-if-!=: # (payload array byte) +33498 0x11/imm32/alloc-id:fake:payload +33499 # "loop-if-!=" +33500 0xa/imm32/size +33501 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= +33502 _string-loop-if-addr<: # (payload array byte) +33503 0x11/imm32/alloc-id:fake:payload +33504 # "loop-if-addr<" +33505 0xd/imm32/size +33506 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/< +33507 _string-loop-if-addr<=: # (payload array byte) +33508 0x11/imm32/alloc-id:fake:payload +33509 # "loop-if-addr<=" +33510 0xe/imm32/size +33511 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/= +33512 _string-loop-if-addr>: # (payload array byte) +33513 0x11/imm32/alloc-id:fake:payload +33514 # "loop-if-addr>" +33515 0xd/imm32/size +33516 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/> +33517 _string-loop-if-addr>=: # (payload array byte) +33518 0x11/imm32/alloc-id:fake:payload +33519 # "loop-if-addr>=" +33520 0xe/imm32/size +33521 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/= +33522 _string-loop-if-float<: # (payload array byte) +33523 0x11/imm32/alloc-id:fake:payload +33524 # "loop-if-float<" +33525 0xe/imm32/size +33526 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/< +33527 _string-loop-if-float<=: # (payload array byte) +33528 0x11/imm32/alloc-id:fake:payload +33529 # "loop-if-float<=" +33530 0xf/imm32/size +33531 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/= +33532 _string-loop-if-float>: # (payload array byte) +33533 0x11/imm32/alloc-id:fake:payload +33534 # "loop-if-float>" +33535 0xe/imm32/size +33536 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/> +33537 _string-loop-if-float>=: # (payload array byte) +33538 0x11/imm32/alloc-id:fake:payload +33539 # "loop-if-float>=" +33540 0xf/imm32/size +33541 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/= +33542 _string-multiply: # (payload array byte) +33543 0x11/imm32/alloc-id:fake:payload +33544 # "multiply" +33545 0x8/imm32/size +33546 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y +33547 _string-convert: # (payload array byte) +33548 0x11/imm32/alloc-id:fake:payload +33549 # "convert" +33550 0x7/imm32/size +33551 0x63/c 0x6f/o 0x6e/n 0x76/v 0x65/e 0x72/r 0x74/t +33552 _string-truncate: # (payload array byte) +33553 0x11/imm32/alloc-id:fake:payload +33554 # "truncate" +33555 0x8/imm32/size +33556 0x74/t 0x72/r 0x75/u 0x6e/n 0x63/c 0x61/a 0x74/t 0x65/e +33557 _string-reinterpret: # (payload array byte) +33558 0x11/imm32/alloc-id:fake:payload +33559 # "reinterpret" +33560 0xb/imm32/size +33561 0x72/r 0x65/e 0x69/i 0x6e/n 0x74/t 0x65/e 0x72/r 0x70/p 0x72/r 0x65/e 0x74/t +33562 _string-divide: +33563 0x11/imm32/alloc-id:fake:payload +33564 # "divide" +33565 0x6/imm32/size +33566 0x64/d 0x69/i 0x76/v 0x69/i 0x64/d 0x65/e +33567 _string-max: +33568 0x11/imm32/alloc-id:fake:payload +33569 # "max" +33570 0x3/imm32/size +33571 0x6d/m 0x61/a 0x78/x +33572 _string-min: +33573 0x11/imm32/alloc-id:fake:payload +33574 # "min" +33575 0x3/imm32/size +33576 0x6d/m 0x69/i 0x6e/n +33577 _string-reciprocal: +33578 0x11/imm32/alloc-id:fake:payload +33579 # "reciprocal" +33580 0xa/imm32/size +33581 0x72/r 0x65/e 0x63/c 0x69/i 0x70/p 0x72/r 0x6f/o 0x63/c 0x61/a 0x6c/l +33582 _string-square-root: +33583 0x11/imm32/alloc-id:fake:payload +33584 # "square-root" +33585 0xb/imm32/size +33586 0x73/s 0x71/q 0x75/u 0x61/a 0x72/r 0x65/e 0x2d/- 0x72/r 0x6f/o 0x6f/o 0x74/t +33587 _string-inverse-square-root: +33588 0x11/imm32/alloc-id:fake:payload +33589 # "inverse-square-root" +33590 0x13/imm32/size +33591 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 +33592 _string-negate: # (payload array byte) +33593 0x11/imm32/alloc-id:fake:payload +33594 # "negate" +33595 0x6/imm32/size +33596 0x6e/n 0x65/e 0x67/g 0x61/a 0x74/t 0x65/e +33597 _string-or: # (payload array byte) +33598 0x11/imm32/alloc-id:fake:payload +33599 # "or" +33600 0x2/imm32/size +33601 0x6f/o 0x72/r +33602 _string-or-with: # (payload array byte) +33603 0x11/imm32/alloc-id:fake:payload +33604 # "or-with" +33605 0x7/imm32/size +33606 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +33607 _string-subtract: # (payload array byte) +33608 0x11/imm32/alloc-id:fake:payload +33609 # "subtract" +33610 0x8/imm32/size +33611 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t +33612 _string-subtract-from: # (payload array byte) +33613 0x11/imm32/alloc-id:fake:payload +33614 # "subtract-from" +33615 0xd/imm32/size +33616 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 +33617 _string-xor: # (payload array byte) +33618 0x11/imm32/alloc-id:fake:payload +33619 # "xor" +33620 0x3/imm32/size +33621 0x78/x 0x6f/o 0x72/r +33622 _string-xor-with: # (payload array byte) +33623 0x11/imm32/alloc-id:fake:payload +33624 # "xor-with" +33625 0x8/imm32/size +33626 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +33627 _string-shift-left: # (payload array byte) +33628 0x11/imm32/alloc-id:fake:payload +33629 # "shift-left" +33630 0xa/imm32/size +33631 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x2d/dash 0x6c/l 0x65/e 0x66/f 0x74/t +33632 _string-shift-right: # (payload array byte) +33633 0x11/imm32/alloc-id:fake:payload +33634 # "shift-right" +33635 0xb/imm32/size +33636 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x2d/dash 0x72/r 0x69/i 0x67/g 0x68/h 0x74/t +33637 _string-shift-right-signed: # (payload array byte) +33638 0x11/imm32/alloc-id:fake:payload +33639 # "shift-right-signed" +33640 0x12/imm32/size +33641 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 +33642 +33643 # string literals for SubX instructions +33644 _string_01_add_to: # (payload array byte) +33645 0x11/imm32/alloc-id:fake:payload +33646 # "01/add-to" +33647 0x9/imm32/size +33648 0x30/0 0x31/1 0x2f/slash 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o +33649 _string_03_add: # (payload array byte) +33650 0x11/imm32/alloc-id:fake:payload +33651 # "03/add" +33652 0x6/imm32/size +33653 0x30/0 0x33/3 0x2f/slash 0x61/a 0x64/d 0x64/d +33654 _string_05_add_to_eax: # (payload array byte) +33655 0x11/imm32/alloc-id:fake:payload +33656 # "05/add-to-eax" +33657 0xd/imm32/size +33658 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 +33659 _string_09_or_with: # (payload array byte) +33660 0x11/imm32/alloc-id:fake:payload +33661 # "09/or-with" +33662 0xa/imm32/size +33663 0x30/0 0x39/9 0x2f/slash 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +33664 _string_0b_or: # (payload array byte) +33665 0x11/imm32/alloc-id:fake:payload +33666 # "0b/or" +33667 0x5/imm32/size +33668 0x30/0 0x62/b 0x2f/slash 0x6f/o 0x72/r +33669 _string_0d_or_with_eax: # (payload array byte) +33670 0x11/imm32/alloc-id:fake:payload +33671 # "0d/or-with-eax" +33672 0xe/imm32/size +33673 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 +33674 _string_0f_82_jump_label: # (payload array byte) +33675 0x11/imm32/alloc-id:fake:payload +33676 # "0f 82/jump-if-addr<" +33677 0x13/imm32/size +33678 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/< +33679 _string_0f_82_jump_break: # (payload array byte) +33680 0x11/imm32/alloc-id:fake:payload +33681 # "0f 82/jump-if-addr< break/disp32" +33682 0x20/imm32/size +33683 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 +33684 _string_0f_82_jump_loop: # (payload array byte) +33685 0x11/imm32/alloc-id:fake:payload +33686 # "0f 82/jump-if-addr< loop/disp32" +33687 0x1f/imm32/size +33688 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 +33689 _string_0f_83_jump_label: # (payload array byte) +33690 0x11/imm32/alloc-id:fake:payload +33691 # "0f 83/jump-if-addr>=" +33692 0x14/imm32/size +33693 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/= +33694 _string_0f_83_jump_break: # (payload array byte) +33695 0x11/imm32/alloc-id:fake:payload +33696 # "0f 83/jump-if-addr>= break/disp32" +33697 0x21/imm32/size +33698 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 +33699 _string_0f_83_jump_loop: # (payload array byte) +33700 0x11/imm32/alloc-id:fake:payload +33701 # "0f 83/jump-if-addr>= loop/disp32" +33702 0x20/imm32/size +33703 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 +33704 _string_0f_84_jump_label: # (payload array byte) +33705 0x11/imm32/alloc-id:fake:payload +33706 # "0f 84/jump-if-=" +33707 0xf/imm32/size +33708 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/= +33709 _string_0f_84_jump_break: # (payload array byte) +33710 0x11/imm32/alloc-id:fake:payload +33711 # "0f 84/jump-if-= break/disp32" +33712 0x1c/imm32/size +33713 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 +33714 _string_0f_84_jump_loop: # (payload array byte) +33715 0x11/imm32/alloc-id:fake:payload +33716 # "0f 84/jump-if-= loop/disp32" +33717 0x1b/imm32/size +33718 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 +33719 _string_0f_85_jump_label: # (payload array byte) +33720 0x11/imm32/alloc-id:fake:payload +33721 # "0f 85/jump-if-!=" +33722 0x10/imm32/size +33723 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/= +33724 _string_0f_85_jump_break: # (payload array byte) +33725 0x11/imm32/alloc-id:fake:payload +33726 # "0f 85/jump-if-!= break/disp32" +33727 0x1d/imm32/size +33728 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 +33729 _string_0f_85_jump_loop: # (payload array byte) +33730 0x11/imm32/alloc-id:fake:payload +33731 # "0f 85/jump-if-!= loop/disp32" +33732 0x1c/imm32/size +33733 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 +33734 _string_0f_86_jump_label: # (payload array byte) +33735 0x11/imm32/alloc-id:fake:payload +33736 # "0f 86/jump-if-addr<=" +33737 0x14/imm32/size +33738 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/= +33739 _string_0f_86_jump_break: # (payload array byte) +33740 0x11/imm32/alloc-id:fake:payload +33741 # "0f 86/jump-if-addr<= break/disp32" +33742 0x21/imm32/size +33743 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 +33744 _string_0f_86_jump_loop: # (payload array byte) +33745 0x11/imm32/alloc-id:fake:payload +33746 # "0f 86/jump-if-addr<= loop/disp32" +33747 0x20/imm32/size +33748 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 +33749 _string_0f_87_jump_label: # (payload array byte) +33750 0x11/imm32/alloc-id:fake:payload +33751 # "0f 87/jump-if-addr>" +33752 0x13/imm32/size +33753 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/> +33754 _string_0f_87_jump_break: # (payload array byte) +33755 0x11/imm32/alloc-id:fake:payload +33756 # "0f 87/jump-if-addr> break/disp32" +33757 0x20/imm32/size +33758 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 +33759 _string_0f_87_jump_loop: # (payload array byte) +33760 0x11/imm32/alloc-id:fake:payload +33761 # "0f 87/jump-if-addr> loop/disp32" +33762 0x1f/imm32/size +33763 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 +33764 _string_0f_8c_jump_label: # (payload array byte) +33765 0x11/imm32/alloc-id:fake:payload +33766 # "0f 8c/jump-if-<" +33767 0xf/imm32/size +33768 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/< +33769 _string_0f_8c_jump_break: # (payload array byte) +33770 0x11/imm32/alloc-id:fake:payload +33771 # "0f 8c/jump-if-< break/disp32" +33772 0x1c/imm32/size +33773 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 +33774 _string_0f_8c_jump_loop: # (payload array byte) +33775 0x11/imm32/alloc-id:fake:payload +33776 # "0f 8c/jump-if-< loop/disp32" +33777 0x1b/imm32/size +33778 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 +33779 _string_0f_8d_jump_label: # (payload array byte) +33780 0x11/imm32/alloc-id:fake:payload +33781 # "0f 8d/jump-if->=" +33782 0x10/imm32/size +33783 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/= +33784 _string_0f_8d_jump_break: # (payload array byte) +33785 0x11/imm32/alloc-id:fake:payload +33786 # "0f 8d/jump-if->= break/disp32" +33787 0x1d/imm32/size +33788 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 +33789 _string_0f_8d_jump_loop: # (payload array byte) +33790 0x11/imm32/alloc-id:fake:payload +33791 # "0f 8d/jump-if->= loop/disp32" +33792 0x1c/imm32/size +33793 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 +33794 _string_0f_8e_jump_label: # (payload array byte) +33795 0x11/imm32/alloc-id:fake:payload +33796 # "0f 8e/jump-if-<=" +33797 0x10/imm32/size +33798 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/= +33799 _string_0f_8e_jump_break: # (payload array byte) +33800 0x11/imm32/alloc-id:fake:payload +33801 # "0f 8e/jump-if-<= break/disp32" +33802 0x1d/imm32/size +33803 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 +33804 _string_0f_8e_jump_loop: # (payload array byte) +33805 0x11/imm32/alloc-id:fake:payload +33806 # "0f 8e/jump-if-<= loop/disp32" +33807 0x1c/imm32/size +33808 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 +33809 _string_0f_8f_jump_label: # (payload array byte) +33810 0x11/imm32/alloc-id:fake:payload +33811 # "0f 8f/jump-if->" +33812 0xf/imm32/size +33813 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/> +33814 _string_0f_8f_jump_break: # (payload array byte) +33815 0x11/imm32/alloc-id:fake:payload +33816 # "0f 8f/jump-if-> break/disp32" +33817 0x1c/imm32/size +33818 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 +33819 _string_0f_8f_jump_loop: # (payload array byte) +33820 0x11/imm32/alloc-id:fake:payload +33821 # "0f 8f/jump-if-> loop/disp32" +33822 0x1b/imm32/size +33823 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 +33824 _string_0f_af_multiply: # (payload array byte) +33825 0x11/imm32/alloc-id:fake:payload +33826 # "0f af/multiply" +33827 0xe/imm32/size +33828 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 +33829 _string_f3_0f_2a_convert_to_float: +33830 0x11/imm32/alloc-id:fake:payload +33831 # "f3 0f 2a/convert-to-float" +33832 0x19/imm32/size +33833 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 +33834 _string_f3_0f_2d_convert_to_int: +33835 0x11/imm32/alloc-id:fake:payload +33836 # "f3 0f 2d/convert-to-int" +33837 0x17/imm32/size +33838 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 +33839 _string_f3_0f_2c_truncate_to_int: +33840 0x11/imm32/alloc-id:fake:payload +33841 # "f3 0f 2c/truncate-to-int" +33842 0x18/imm32/size +33843 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 +33844 _string_f3_0f_58_add: +33845 0x11/imm32/alloc-id:fake:payload +33846 # "f3 0f 58/add" +33847 0xc/imm32/size +33848 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x38/8 0x2f/slash 0x61/a 0x64/d 0x64/d +33849 _string_f3_0f_5c_subtract: +33850 0x11/imm32/alloc-id:fake:payload +33851 # "f3 0f 5c/subtract" +33852 0x11/imm32/size +33853 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 +33854 _string_f3_0f_59_multiply: +33855 0x11/imm32/alloc-id:fake:payload +33856 # "f3 0f 59/multiply" +33857 0x11/imm32/size +33858 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 +33859 _string_f3_0f_5e_divide: +33860 0x11/imm32/alloc-id:fake:payload +33861 # "f3 0f 5e/divide" +33862 0xf/imm32/size +33863 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 +33864 _string_f3_0f_53_reciprocal: +33865 0x11/imm32/alloc-id:fake:payload +33866 # "f3 0f 53/reciprocal" +33867 0x13/imm32/size +33868 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 +33869 _string_f3_0f_51_square_root: +33870 0x11/imm32/alloc-id:fake:payload +33871 # "f3 0f 51/square-root" +33872 0x14/imm32/size +33873 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 +33874 _string_f3_0f_52_inverse_square_root: +33875 0x11/imm32/alloc-id:fake:payload +33876 # "f3 0f 52/inverse-square-root" +33877 0x1c/imm32/size +33878 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 +33879 _string_f3_0f_5d_min: +33880 0x11/imm32/alloc-id:fake:payload +33881 # "f3 0f 5d/min" +33882 0xc/imm32/size +33883 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x64/d 0x2f/slash 0x6d/m 0x69/i 0x6e/n +33884 _string_f3_0f_5f_max: +33885 0x11/imm32/alloc-id:fake:payload +33886 # "f3 0f 5f/max" +33887 0xc/imm32/size +33888 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x66/f 0x2f/slash 0x6d/m 0x61/a 0x78/x +33889 _string_f3_0f_10_copy: +33890 0x11/imm32/alloc-id:fake:payload +33891 # "f3 0f 10/copy" +33892 0xd/imm32/size +33893 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 +33894 _string_f3_0f_11_copy: +33895 0x11/imm32/alloc-id:fake:payload +33896 # "f3 0f 11/copy" +33897 0xd/imm32/size +33898 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 +33899 _string_0f_2f_compare: +33900 0x11/imm32/alloc-id:fake:payload +33901 # "0f 2f/compare" +33902 0xd/imm32/size +33903 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 +33904 _string_21_and_with: # (payload array byte) +33905 0x11/imm32/alloc-id:fake:payload +33906 # "21/and-with" +33907 0xb/imm32/size +33908 0x32/2 0x31/1 0x2f/slash 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +33909 _string_23_and: # (payload array byte) +33910 0x11/imm32/alloc-id:fake:payload +33911 # "23/and" +33912 0x6/imm32/size +33913 0x32/2 0x33/3 0x2f/slash 0x61/a 0x6e/n 0x64/d +33914 _string_25_and_with_eax: # (payload array byte) +33915 0x11/imm32/alloc-id:fake:payload +33916 # "25/and-with-eax" +33917 0xf/imm32/size +33918 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 +33919 _string_29_subtract_from: # (payload array byte) +33920 0x11/imm32/alloc-id:fake:payload +33921 # "29/subtract-from" +33922 0x10/imm32/size +33923 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 +33924 _string_2b_subtract: # (payload array byte) +33925 0x11/imm32/alloc-id:fake:payload +33926 # "2b/subtract" +33927 0xb/imm32/size +33928 0x32/2 0x62/b 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t +33929 _string_2d_subtract_from_eax: # (payload array byte) +33930 0x11/imm32/alloc-id:fake:payload +33931 # "2d/subtract-from-eax" +33932 0x14/imm32/size +33933 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 +33934 _string_31_xor_with: # (payload array byte) +33935 0x11/imm32/alloc-id:fake:payload +33936 # "31/xor-with" +33937 0xb/imm32/size +33938 0x33/3 0x31/1 0x2f/slash 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +33939 _string_33_xor: # (payload array byte) +33940 0x11/imm32/alloc-id:fake:payload +33941 # "33/xor" +33942 0x6/imm32/size +33943 0x33/3 0x33/3 0x2f/slash 0x78/x 0x6f/o 0x72/r +33944 _string_35_xor_with_eax: # (payload array byte) +33945 0x11/imm32/alloc-id:fake:payload +33946 # "35/xor-with-eax" +33947 0xf/imm32/size +33948 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 +33949 _string_39_compare->: # (payload array byte) +33950 0x11/imm32/alloc-id:fake:payload +33951 # "39/compare->" +33952 0xc/imm32/size +33953 0x33/3 0x39/9 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x2d/dash 0x3e/> +33954 _string_3b_compare<-: # (payload array byte) +33955 0x11/imm32/alloc-id:fake:payload +33956 # "3b/compare<-" +33957 0xc/imm32/size +33958 0x33/3 0x62/b 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x3c/< 0x2d/dash +33959 _string_3d_compare_eax_with: # (payload array byte) +33960 0x11/imm32/alloc-id:fake:payload +33961 # "3d/compare-eax-with" +33962 0x13/imm32/size +33963 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 +33964 _string_40_increment_eax: # (payload array byte) +33965 0x11/imm32/alloc-id:fake:payload +33966 # "40/increment-eax" +33967 0x10/imm32/size +33968 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 +33969 _string_41_increment_ecx: # (payload array byte) +33970 0x11/imm32/alloc-id:fake:payload +33971 # "41/increment-ecx" +33972 0x10/imm32/size +33973 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 +33974 _string_42_increment_edx: # (payload array byte) +33975 0x11/imm32/alloc-id:fake:payload +33976 # "42/increment-edx" +33977 0x10/imm32/size +33978 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 +33979 _string_43_increment_ebx: # (payload array byte) +33980 0x11/imm32/alloc-id:fake:payload +33981 # "43/increment-ebx" +33982 0x10/imm32/size +33983 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 +33984 _string_46_increment_esi: # (payload array byte) +33985 0x11/imm32/alloc-id:fake:payload +33986 # "46/increment-esi" +33987 0x10/imm32/size +33988 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 +33989 _string_47_increment_edi: # (payload array byte) +33990 0x11/imm32/alloc-id:fake:payload +33991 # "47/increment-edi" +33992 0x10/imm32/size +33993 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 +33994 _string_48_decrement_eax: # (payload array byte) +33995 0x11/imm32/alloc-id:fake:payload +33996 # "48/decrement-eax" +33997 0x10/imm32/size +33998 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 +33999 _string_49_decrement_ecx: # (payload array byte) +34000 0x11/imm32/alloc-id:fake:payload +34001 # "49/decrement-ecx" +34002 0x10/imm32/size +34003 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 +34004 _string_4a_decrement_edx: # (payload array byte) +34005 0x11/imm32/alloc-id:fake:payload +34006 # "4a/decrement-edx" +34007 0x10/imm32/size +34008 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 +34009 _string_4b_decrement_ebx: # (payload array byte) +34010 0x11/imm32/alloc-id:fake:payload +34011 # "4b/decrement-ebx" +34012 0x10/imm32/size +34013 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 +34014 _string_4e_decrement_esi: # (payload array byte) +34015 0x11/imm32/alloc-id:fake:payload +34016 # "4e/decrement-esi" +34017 0x10/imm32/size +34018 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 +34019 _string_4f_decrement_edi: # (payload array byte) +34020 0x11/imm32/alloc-id:fake:payload +34021 # "4f/decrement-edi" +34022 0x10/imm32/size +34023 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 +34024 _string_81_subop_add: # (payload array byte) +34025 0x11/imm32/alloc-id:fake:payload +34026 # "81 0/subop/add" +34027 0xe/imm32/size +34028 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 +34029 _string_81_subop_or: # (payload array byte) +34030 0x11/imm32/alloc-id:fake:payload +34031 # "81 1/subop/or" +34032 0xd/imm32/size +34033 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 +34034 _string_81_subop_and: # (payload array byte) +34035 0x11/imm32/alloc-id:fake:payload +34036 # "81 4/subop/and" +34037 0xe/imm32/size +34038 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 +34039 _string_81_subop_subtract: # (payload array byte) +34040 0x11/imm32/alloc-id:fake:payload +34041 # "81 5/subop/subtract" +34042 0x13/imm32/size +34043 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 +34044 _string_81_subop_xor: # (payload array byte) +34045 0x11/imm32/alloc-id:fake:payload +34046 # "81 6/subop/xor" +34047 0xe/imm32/size +34048 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 +34049 _string_81_subop_compare: # (payload array byte) +34050 0x11/imm32/alloc-id:fake:payload +34051 # "81 7/subop/compare" +34052 0x12/imm32/size +34053 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 +34054 _string_89_<-: # (payload array byte) +34055 0x11/imm32/alloc-id:fake:payload +34056 # "89/<-" +34057 0x5/imm32/size +34058 0x38/8 0x39/9 0x2f/slash 0x3c/< 0x2d/dash +34059 _string_8b_->: # (payload array byte) +34060 0x11/imm32/alloc-id:fake:payload +34061 # "8b/->" +34062 0x5/imm32/size +34063 0x38/8 0x62/b 0x2f/slash 0x2d/dash 0x3e/> +34064 _string_8a_copy_byte: +34065 0x11/imm32/alloc-id:fake:payload +34066 # "8a/byte->" +34067 0x9/imm32/size +34068 0x38/8 0x61/a 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x3e/> +34069 _string_88_copy_byte: +34070 0x11/imm32/alloc-id:fake:payload +34071 # "88/byte<-" +34072 0x9/imm32/size +34073 0x38/8 0x38/8 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x3c/< 0x2d/- +34074 _string_8d_copy_address: # (payload array byte) +34075 0x11/imm32/alloc-id:fake:payload +34076 # "8d/copy-address" +34077 0xf/imm32/size +34078 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 +34079 _string_b8_copy_to_eax: # (payload array byte) +34080 0x11/imm32/alloc-id:fake:payload +34081 # "b8/copy-to-eax" +34082 0xe/imm32/size +34083 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 +34084 _string_b9_copy_to_ecx: # (payload array byte) +34085 0x11/imm32/alloc-id:fake:payload +34086 # "b9/copy-to-ecx" +34087 0xe/imm32/size +34088 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 +34089 _string_ba_copy_to_edx: # (payload array byte) +34090 0x11/imm32/alloc-id:fake:payload +34091 # "ba/copy-to-edx" +34092 0xe/imm32/size +34093 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 +34094 _string_bb_copy_to_ebx: # (payload array byte) +34095 0x11/imm32/alloc-id:fake:payload +34096 # "bb/copy-to-ebx" +34097 0xe/imm32/size +34098 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 +34099 _string_be_copy_to_esi: # (payload array byte) +34100 0x11/imm32/alloc-id:fake:payload +34101 # "be/copy-to-esi" +34102 0xe/imm32/size +34103 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 +34104 _string_bf_copy_to_edi: # (payload array byte) +34105 0x11/imm32/alloc-id:fake:payload +34106 # "bf/copy-to-edi" +34107 0xe/imm32/size +34108 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 +34109 _string_c7_subop_copy: # (payload array byte) +34110 0x11/imm32/alloc-id:fake:payload +34111 # "c7 0/subop/copy" +34112 0xf/imm32/size +34113 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 +34114 _string_e9_jump_label: # (payload array byte) +34115 0x11/imm32/alloc-id:fake:payload +34116 # "e9/jump" +34117 0x7/imm32/size +34118 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p +34119 _string_e9_jump_break: # (payload array byte) +34120 0x11/imm32/alloc-id:fake:payload +34121 # "e9/jump break/disp32" +34122 0x14/imm32/size +34123 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 +34124 _string_e9_jump_loop: # (payload array byte) +34125 0x11/imm32/alloc-id:fake:payload +34126 # "e9/jump loop/disp32" +34127 0x13/imm32/size +34128 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 +34129 _string_f7_subop_negate: +34130 0x11/imm32/alloc-id:fake:payload +34131 # "f7 3/subop/negate" +34132 0x11/imm32/size +34133 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 +34134 _string_ff_subop_increment: # (payload array byte) +34135 0x11/imm32/alloc-id:fake:payload +34136 # "ff 0/subop/increment" +34137 0x14/imm32/size +34138 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 +34139 _string_ff_subop_decrement: # (payload array byte) +34140 0x11/imm32/alloc-id:fake:payload +34141 # "ff 1/subop/decrement" +34142 0x14/imm32/size +34143 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 +34144 _string_c1_subop_shift_left: # (payload array byte) +34145 0x11/imm32/alloc-id:fake:payload +34146 # "c1/shift 4/subop/left" +34147 0x15/imm32/size +34148 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 +34149 _string_c1_subop_shift_right_padding_zeroes: # (payload array byte) +34150 0x11/imm32/alloc-id:fake:payload +34151 # "c1/shift 5/subop/right-padding-zeroes" +34152 0x25/imm32/size +34153 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 +34154 _string_c1_subop_shift_right_preserving_sign: # (payload array byte) +34155 0x11/imm32/alloc-id:fake:payload +34156 # "c1/shift 7/subop/right-preserving-sign" +34157 0x26/imm32/size +34158 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 +34159 +34160 Single-int-var-in-mem: # (payload list var) +34161 0x11/imm32/alloc-id:fake:payload +34162 0x11/imm32/alloc-id:fake +34163 Int-var-in-mem/imm32 +34164 0/imm32/next +34165 0/imm32/next +34166 +34167 Int-var-in-mem: # (payload var) +34168 0x11/imm32/alloc-id:fake:payload +34169 0/imm32/name +34170 0/imm32/name +34171 0x11/imm32/alloc-id:fake +34172 Type-int/imm32 +34173 1/imm32/some-block-depth +34174 1/imm32/some-stack-offset +34175 0/imm32/no-register +34176 0/imm32/no-register +34177 +34178 # Not really legal, but closest we can currently represent a dereference of an (addr byte) +34179 Single-byte-var-in-mem: # (payload list var) +34180 0x11/imm32/alloc-id:fake:payload +34181 0x11/imm32/alloc-id:fake +34182 Byte-var-in-mem/imm32 +34183 0/imm32/next +34184 0/imm32/next +34185 +34186 # Not really legal, but closest we can currently represent a dereference of an (addr byte) +34187 Byte-var-in-mem: # (payload var) +34188 0x11/imm32/alloc-id:fake:payload +34189 0/imm32/name +34190 0/imm32/name +34191 0x11/imm32/alloc-id:fake +34192 Type-byte/imm32 +34193 1/imm32/some-block-depth +34194 1/imm32/some-stack-offset +34195 0/imm32/no-register +34196 0/imm32/no-register +34197 +34198 Two-args-int-stack-int-reg: # (payload list var) +34199 0x11/imm32/alloc-id:fake:payload +34200 0x11/imm32/alloc-id:fake +34201 Int-var-in-mem/imm32 +34202 0x11/imm32/alloc-id:fake +34203 Single-int-var-in-some-register/imm32/next +34204 +34205 Two-int-args-in-regs: # (payload list var) +34206 0x11/imm32/alloc-id:fake:payload +34207 0x11/imm32/alloc-id:fake +34208 Int-var-in-some-register/imm32 +34209 0x11/imm32/alloc-id:fake +34210 Single-int-var-in-some-register/imm32/next +34211 +34212 # Not really legal, but closest we can currently represent a dereference of an (addr byte) +34213 Two-args-byte-stack-byte-reg: # (payload list var) +34214 0x11/imm32/alloc-id:fake:payload +34215 0x11/imm32/alloc-id:fake +34216 Byte-var-in-mem/imm32 +34217 0x11/imm32/alloc-id:fake +34218 Single-byte-var-in-some-register/imm32/next +34219 +34220 Two-args-int-reg-int-stack: # (payload list var) +34221 0x11/imm32/alloc-id:fake:payload +34222 0x11/imm32/alloc-id:fake +34223 Int-var-in-some-register/imm32 +34224 0x11/imm32/alloc-id:fake +34225 Single-int-var-in-mem/imm32/next +34226 +34227 Two-args-int-eax-int-literal: # (payload list var) +34228 0x11/imm32/alloc-id:fake:payload +34229 0x11/imm32/alloc-id:fake +34230 Int-var-in-eax/imm32 +34231 0x11/imm32/alloc-id:fake +34232 Single-lit-var/imm32/next +34233 +34234 Int-var-and-literal: # (payload list var) +34235 0x11/imm32/alloc-id:fake:payload +34236 0x11/imm32/alloc-id:fake +34237 Int-var-in-mem/imm32 +34238 0x11/imm32/alloc-id:fake +34239 Single-lit-var/imm32/next +34240 +34241 Int-var-in-register-and-literal: # (payload list var) +34242 0x11/imm32/alloc-id:fake:payload +34243 0x11/imm32/alloc-id:fake +34244 Int-var-in-some-register/imm32 +34245 0x11/imm32/alloc-id:fake +34246 Single-lit-var/imm32/next +34247 +34248 Two-float-args-in-regs: # (payload list var) +34249 0x11/imm32/alloc-id:fake:payload +34250 0x11/imm32/alloc-id:fake +34251 Float-var-in-some-register/imm32 +34252 0x11/imm32/alloc-id:fake +34253 Single-float-var-in-some-register/imm32/next +34254 +34255 Two-args-float-reg-float-stack: # (payload list var) +34256 0x11/imm32/alloc-id:fake:payload +34257 0x11/imm32/alloc-id:fake +34258 Float-var-in-some-register/imm32 +34259 0x11/imm32/alloc-id:fake +34260 Single-float-var-in-mem/imm32/next +34261 +34262 Two-args-float-stack-float-reg: # (payload list var) +34263 0x11/imm32/alloc-id:fake:payload +34264 0x11/imm32/alloc-id:fake +34265 Float-var-in-mem/imm32 +34266 0x11/imm32/alloc-id:fake +34267 Single-float-var-in-some-register/imm32/next +34268 +34269 Single-int-var-in-some-register: # (payload list var) +34270 0x11/imm32/alloc-id:fake:payload +34271 0x11/imm32/alloc-id:fake +34272 Int-var-in-some-register/imm32 +34273 0/imm32/next +34274 0/imm32/next +34275 +34276 Single-addr-var-in-some-register: # (payload list var) +34277 0x11/imm32/alloc-id:fake:payload +34278 0x11/imm32/alloc-id:fake +34279 Addr-var-in-some-register/imm32 +34280 0/imm32/next +34281 0/imm32/next +34282 +34283 Single-byte-var-in-some-register: # (payload list var) +34284 0x11/imm32/alloc-id:fake:payload +34285 0x11/imm32/alloc-id:fake +34286 Byte-var-in-some-register/imm32 +34287 0/imm32/next +34288 0/imm32/next +34289 +34290 Int-var-in-some-register: # (payload var) +34291 0x11/imm32/alloc-id:fake:payload +34292 0/imm32/name +34293 0/imm32/name +34294 0x11/imm32/alloc-id:fake +34295 Type-int/imm32 +34296 1/imm32/some-block-depth +34297 0/imm32/no-stack-offset +34298 0x11/imm32/alloc-id:fake +34299 Any-register/imm32 +34300 +34301 Any-register: # (payload array byte) +34302 0x11/imm32/alloc-id:fake:payload +34303 1/imm32/size +34304 # data +34305 2a/asterisk +34306 +34307 Addr-var-in-some-register: # (payload var) +34308 0x11/imm32/alloc-id:fake:payload +34309 0/imm32/name +34310 0/imm32/name +34311 0x11/imm32/alloc-id:fake +34312 Type-addr/imm32 +34313 1/imm32/some-block-depth +34314 0/imm32/no-stack-offset +34315 0x11/imm32/alloc-id:fake +34316 Any-register/imm32 +34317 +34318 Byte-var-in-some-register: # (payload var) +34319 0x11/imm32/alloc-id:fake:payload +34320 0/imm32/name +34321 0/imm32/name +34322 0x11/imm32/alloc-id:fake +34323 Type-byte/imm32 +34324 1/imm32/some-block-depth +34325 0/imm32/no-stack-offset +34326 0x11/imm32/alloc-id:fake +34327 Any-register/imm32 34328 -34329 test-emit-subx-stmt-primitive-register: -34330 # Primitive operation on a variable in a register. -34331 # foo <- increment -34332 # => -34333 # ff 0/subop/increment %eax # sub-optimal, but should suffice -34334 # -34335 # There's a variable on the var stack as follows: -34336 # name: 'foo' -34337 # type: int -34338 # register: 'eax' -34339 # -34340 # There's a primitive with this info: -34341 # name: 'increment' -34342 # out: int/reg -34343 # value: 'ff 0/subop/increment' -34344 # -34345 # . prologue -34346 55/push-ebp -34347 89/<- %ebp 4/r32/esp -34348 # setup -34349 (clear-stream _test-output-stream) -34350 (clear-stream $_test-output-buffered-file->buffer) -34351 $test-emit-subx-stmt-primitive-register:initialize-type: -34352 # var type/ecx: (payload type-tree) = int -34353 68/push 0/imm32/right:null -34354 68/push 0/imm32/right:null -34355 68/push 0/imm32/left:unused -34356 68/push 1/imm32/value:int -34357 68/push 1/imm32/is-atom?:true -34358 68/push 0x11/imm32/alloc-id:fake:payload -34359 89/<- %ecx 4/r32/esp -34360 $test-emit-subx-stmt-primitive-register:initialize-var: -34361 # var var-foo/ecx: (payload var) -34362 68/push 0/imm32/register -34363 68/push 0/imm32/register -34364 68/push 0/imm32/no-stack-offset -34365 68/push 1/imm32/block-depth -34366 51/push-ecx -34367 68/push 0x11/imm32/alloc-id:fake -34368 68/push 0/imm32/name -34369 68/push 0/imm32/name -34370 68/push 0x11/imm32/alloc-id:fake:payload -34371 89/<- %ecx 4/r32/esp -34372 $test-emit-subx-stmt-primitive-register:initialize-var-name: -34373 # var-foo->name = "foo" -34374 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -34375 (copy-array Heap "foo" %eax) -34376 $test-emit-subx-stmt-primitive-register:initialize-var-register: -34377 # var-foo->register = "eax" -34378 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -34379 (copy-array Heap "eax" %eax) -34380 $test-emit-subx-stmt-primitive-register:initialize-stmt-var: -34381 # var operand/ebx: (payload stmt-var) -34382 68/push 0/imm32/is-deref:false -34383 68/push 0/imm32/next -34384 68/push 0/imm32/next -34385 51/push-ecx/var-foo -34386 68/push 0x11/imm32/alloc-id:fake -34387 68/push 0x11/imm32/alloc-id:fake:payload -34388 89/<- %ebx 4/r32/esp -34389 $test-emit-subx-stmt-primitive-register:initialize-stmt: -34390 # var stmt/esi: (addr statement) -34391 53/push-ebx/outputs -34392 68/push 0x11/imm32/alloc-id:fake -34393 68/push 0/imm32/no-inouts -34394 68/push 0/imm32/no-inouts -34395 68/push 0/imm32/operation -34396 68/push 0/imm32/operation -34397 68/push 1/imm32 -34398 89/<- %esi 4/r32/esp -34399 $test-emit-subx-stmt-primitive-register:initialize-stmt-operation: -34400 # stmt->operation = "increment" -34401 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -34402 (copy-array Heap "increment" %eax) -34403 $test-emit-subx-stmt-primitive-register:initialize-formal-var: -34404 # var formal-var/ebx: (payload var) -34405 68/push 0/imm32/register -34406 68/push 0/imm32/register -34407 68/push 0/imm32/no-stack-offset -34408 68/push 1/imm32/block-depth -34409 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -34410 68/push 0x11/imm32/alloc-id:fake -34411 68/push 0/imm32/name -34412 68/push 0/imm32/name -34413 68/push 0x11/imm32/alloc-id:fake:payload -34414 89/<- %ebx 4/r32/esp -34415 $test-emit-subx-stmt-primitive-register:initialize-formal-var-name: -34416 # formal-var->name = "dummy" -34417 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -34418 (copy-array Heap "dummy" %eax) -34419 $test-emit-subx-stmt-primitive-register:initialize-formal-register: -34420 # formal-var->register = "*" -34421 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -34422 (copy-array Heap "*" %eax) # Any-register -34423 $test-emit-subx-stmt-primitive-register:initialize-var-list: -34424 # var formal-outputs/ebx: (payload list var) -34425 68/push 0/imm32/next -34426 68/push 0/imm32/next -34427 53/push-ebx/formal-var -34428 68/push 0x11/imm32/alloc-id:fake -34429 68/push 0x11/imm32/alloc-id:fake:payload -34430 89/<- %ebx 4/r32/esp -34431 $test-emit-subx-stmt-primitive-register:initialize-primitive: -34432 # var primitives/ebx: (addr primitive) -34433 68/push 0/imm32/next -34434 68/push 0/imm32/next -34435 68/push 0/imm32/no-x32 -34436 68/push 0/imm32/no-xm32 -34437 68/push 0/imm32/no-disp32 -34438 68/push 0/imm32/no-imm8 -34439 68/push 0/imm32/no-imm32 -34440 68/push 0/imm32/no-r32 -34441 68/push 3/imm32/rm32-is-first-output -34442 68/push 0/imm32/subx-name -34443 68/push 0/imm32/subx-name -34444 53/push-ebx/outputs -34445 68/push 0x11/imm32/alloc-id:fake -34446 68/push 0/imm32/no-inouts -34447 68/push 0/imm32/no-inouts -34448 68/push 0/imm32/name -34449 68/push 0/imm32/name -34450 89/<- %ebx 4/r32/esp -34451 $test-emit-subx-stmt-primitive-register:initialize-primitive-name: -34452 # primitives->name = "increment" -34453 (copy-array Heap "increment" %ebx) # Primitive-name -34454 $test-emit-subx-stmt-primitive-register:initialize-primitive-subx-name: -34455 # primitives->subx-name = "ff 0/subop/increment" -34456 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -34457 (copy-array Heap "ff 0/subop/increment" %eax) -34458 # convert -34459 c7 0/subop/copy *Curr-block-depth 0/imm32 -34460 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0 Stderr 0) -34461 (flush _test-output-buffered-file) -34462 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -34468 # check output -34469 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register") -34470 # . epilogue -34471 89/<- %esp 5/r32/ebp -34472 5d/pop-to-ebp -34473 c3/return -34474 -34475 test-emit-subx-stmt-select-primitive: -34476 # Select the right primitive between overloads. -34477 # foo <- increment -34478 # => -34479 # ff 0/subop/increment %eax # sub-optimal, but should suffice -34480 # -34481 # There's a variable on the var stack as follows: -34482 # name: 'foo' -34483 # type: int -34484 # register: 'eax' -34485 # -34486 # There's two primitives, as follows: -34487 # - name: 'increment' -34488 # out: int/reg -34489 # value: 'ff 0/subop/increment' -34490 # - name: 'increment' -34491 # inout: int/mem -34492 # value: 'ff 0/subop/increment' -34493 # -34494 # . prologue -34495 55/push-ebp -34496 89/<- %ebp 4/r32/esp -34497 # setup -34498 (clear-stream _test-output-stream) -34499 (clear-stream $_test-output-buffered-file->buffer) -34500 $test-emit-subx-stmt-select-primitive:initialize-type: -34501 # var type/ecx: (payload type-tree) = int -34502 68/push 0/imm32/right:null -34503 68/push 0/imm32/right:null -34504 68/push 0/imm32/left:unused -34505 68/push 1/imm32/value:int -34506 68/push 1/imm32/is-atom?:true -34507 68/push 0x11/imm32/alloc-id:fake:payload -34508 89/<- %ecx 4/r32/esp -34509 $test-emit-subx-stmt-select-primitive:initialize-var: -34510 # var var-foo/ecx: (payload var) -34511 68/push 0/imm32/register -34512 68/push 0/imm32/register -34513 68/push 0/imm32/no-stack-offset -34514 68/push 1/imm32/block-depth -34515 51/push-ecx -34516 68/push 0x11/imm32/alloc-id:fake -34517 68/push 0/imm32/name -34518 68/push 0/imm32/name -34519 68/push 0x11/imm32/alloc-id:fake:payload -34520 89/<- %ecx 4/r32/esp -34521 $test-emit-subx-stmt-select-primitive:initialize-var-name: -34522 # var-foo->name = "foo" -34523 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -34524 (copy-array Heap "foo" %eax) -34525 $test-emit-subx-stmt-select-primitive:initialize-var-register: -34526 # var-foo->register = "eax" -34527 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -34528 (copy-array Heap "eax" %eax) -34529 $test-emit-subx-stmt-select-primitive:initialize-stmt-var: -34530 # var operand/ebx: (payload stmt-var) -34531 68/push 0/imm32/is-deref:false -34532 68/push 0/imm32/next -34533 68/push 0/imm32/next -34534 51/push-ecx/var-foo -34535 68/push 0x11/imm32/alloc-id:fake -34536 68/push 0x11/imm32/alloc-id:fake:payload -34537 89/<- %ebx 4/r32/esp -34538 $test-emit-subx-stmt-select-primitive:initialize-stmt: -34539 # var stmt/esi: (addr statement) -34540 53/push-ebx/outputs -34541 68/push 0x11/imm32/alloc-id:fake -34542 68/push 0/imm32/no-inouts -34543 68/push 0/imm32/no-inouts -34544 68/push 0/imm32/operation -34545 68/push 0/imm32/operation -34546 68/push 1/imm32 -34547 89/<- %esi 4/r32/esp -34548 $test-emit-subx-stmt-select-primitive:initialize-stmt-operation: -34549 # stmt->operation = "increment" -34550 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -34551 (copy-array Heap "increment" %eax) -34552 $test-emit-subx-stmt-select-primitive:initialize-formal-var: -34553 # var formal-var/ebx: (payload var) -34554 68/push 0/imm32/register -34555 68/push 0/imm32/register -34556 68/push 0/imm32/no-stack-offset -34557 68/push 1/imm32/block-depth -34558 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -34559 68/push 0x11/imm32/alloc-id:fake -34560 68/push 0/imm32/name -34561 68/push 0/imm32/name -34562 68/push 0x11/imm32/alloc-id:fake:payload -34563 89/<- %ebx 4/r32/esp -34564 $test-emit-subx-stmt-select-primitive:initialize-formal-var-name: -34565 # formal-var->name = "dummy" -34566 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -34567 (copy-array Heap "dummy" %eax) -34568 $test-emit-subx-stmt-select-primitive:initialize-formal-register: -34569 # formal-var->register = "*" -34570 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -34571 (copy-array Heap "*" %eax) # Any-register -34572 $test-emit-subx-stmt-select-primitive:initialize-var-list: -34573 # var formal-outputs/ebx: (payload list var) -34574 68/push 0/imm32/next -34575 68/push 0/imm32/next -34576 53/push-ebx/formal-var -34577 68/push 0x11/imm32/alloc-id:fake -34578 68/push 0x11/imm32/alloc-id:fake:payload -34579 89/<- %ebx 4/r32/esp -34580 $test-emit-subx-stmt-select-primitive:initialize-primitive2: -34581 # var primitive2/edi: (payload primitive) -34582 68/push 0/imm32/next -34583 68/push 0/imm32/next -34584 68/push 0/imm32/no-x32 -34585 68/push 0/imm32/no-xm32 -34586 68/push 0/imm32/no-disp32 -34587 68/push 0/imm32/no-imm8 -34588 68/push 0/imm32/no-imm32 -34589 68/push 0/imm32/no-r32 -34590 68/push 3/imm32/rm32-is-first-output -34591 68/push 0/imm32/subx-name -34592 68/push 0/imm32/subx-name -34593 53/push-ebx/outputs -34594 68/push 0x11/imm32/alloc-id:fake -34595 68/push 0/imm32/no-inouts -34596 68/push 0/imm32/no-inouts -34597 68/push 0/imm32/name -34598 68/push 0/imm32/name -34599 68/push 0x11/imm32/alloc-id:fake:payload -34600 89/<- %edi 4/r32/esp -34601 $test-emit-subx-stmt-select-primitive:initialize-primitive2-name: -34602 # primitives->name = "increment" -34603 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 -34604 (copy-array Heap "increment" %eax) -34605 $test-emit-subx-stmt-select-primitive:initialize-primitive2-subx-name: -34606 # primitives->subx-name = "ff 0/subop/increment" -34607 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 -34608 (copy-array Heap "ff 0/subop/increment" %eax) -34609 $test-emit-subx-stmt-select-primitive:initialize-primitive: -34610 # var primitives/ebx: (addr primitive) -34611 57/push-edi -34612 68/push 0x11/imm32/alloc-id:fake -34613 68/push 0/imm32/no-x32 -34614 68/push 0/imm32/no-xm32 -34615 68/push 0/imm32/no-disp32 -34616 68/push 0/imm32/no-imm8 -34617 68/push 0/imm32/no-imm32 -34618 68/push 0/imm32/no-r32 -34619 68/push 1/imm32/rm32-is-first-inout -34620 68/push 0/imm32/subx-name -34621 68/push 0/imm32/subx-name -34622 68/push 0/imm32/no-outputs -34623 68/push 0/imm32/no-outputs -34624 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -34625 68/push 0x11/imm32/alloc-id:fake -34626 68/push 0/imm32/name -34627 68/push 0/imm32/name -34628 89/<- %ebx 4/r32/esp -34629 $test-emit-subx-stmt-select-primitive:initialize-primitive-name: -34630 # primitives->name = "increment" -34631 (copy-array Heap "increment" %ebx) # Primitive-name -34632 $test-emit-subx-stmt-select-primitive:initialize-primitive-subx-name: -34633 # primitives->subx-name = "ff 0/subop/increment" -34634 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -34635 (copy-array Heap "ff 0/subop/increment" %eax) -34636 # convert -34637 c7 0/subop/copy *Curr-block-depth 0/imm32 -34638 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0 Stderr 0) -34639 (flush _test-output-buffered-file) -34640 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -34646 # check output -34647 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive") -34648 # . epilogue -34649 89/<- %esp 5/r32/ebp -34650 5d/pop-to-ebp -34651 c3/return -34652 -34653 test-emit-subx-stmt-select-primitive-2: -34654 # Select the right primitive between overloads. -34655 # increment foo -34656 # => -34657 # ff 0/subop/increment %eax # sub-optimal, but should suffice -34658 # -34659 # There's a variable on the var stack as follows: -34660 # name: 'foo' -34661 # type: int -34662 # register: 'eax' -34663 # -34664 # There's two primitives, as follows: -34665 # - name: 'increment' -34666 # out: int/reg -34667 # value: 'ff 0/subop/increment' -34668 # - name: 'increment' -34669 # inout: int/mem -34670 # value: 'ff 0/subop/increment' -34671 # -34672 # . prologue -34673 55/push-ebp -34674 89/<- %ebp 4/r32/esp -34675 # setup -34676 (clear-stream _test-output-stream) -34677 (clear-stream $_test-output-buffered-file->buffer) -34678 $test-emit-subx-stmt-select-primitive-2:initialize-type: -34679 # var type/ecx: (payload type-tree) = int -34680 68/push 0/imm32/right:null -34681 68/push 0/imm32/right:null -34682 68/push 0/imm32/left:unused -34683 68/push 1/imm32/value:int -34684 68/push 1/imm32/is-atom?:true -34685 68/push 0x11/imm32/alloc-id:fake:payload -34686 89/<- %ecx 4/r32/esp -34687 $test-emit-subx-stmt-select-primitive-2:initialize-var: -34688 # var var-foo/ecx: (payload var) -34689 68/push 0/imm32/register -34690 68/push 0/imm32/register -34691 68/push 0/imm32/no-stack-offset -34692 68/push 1/imm32/block-depth -34693 51/push-ecx -34694 68/push 0x11/imm32/alloc-id:fake -34695 68/push 0/imm32/name -34696 68/push 0/imm32/name -34697 68/push 0x11/imm32/alloc-id:fake:payload -34698 89/<- %ecx 4/r32/esp -34699 $test-emit-subx-stmt-select-primitive-2:initialize-var-name: -34700 # var-foo->name = "foo" -34701 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -34702 (copy-array Heap "foo" %eax) -34703 $test-emit-subx-stmt-select-primitive-2:initialize-var-register: -34704 # var-foo->register = "eax" -34705 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -34706 (copy-array Heap "eax" %eax) -34707 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-var: -34708 # var operand/ebx: (payload stmt-var) -34709 68/push 0/imm32/is-deref:false -34710 68/push 0/imm32/next -34711 68/push 0/imm32/next -34712 51/push-ecx/var-foo -34713 68/push 0x11/imm32/alloc-id:fake -34714 68/push 0x11/imm32/alloc-id:fake:payload -34715 89/<- %ebx 4/r32/esp -34716 $test-emit-subx-stmt-select-primitive-2:initialize-stmt: -34717 # var stmt/esi: (addr statement) -34718 68/push 0/imm32/no-outputs -34719 68/push 0/imm32/no-outputs -34720 53/push-ebx/inouts -34721 68/push 0x11/imm32/alloc-id:fake -34722 68/push 0/imm32/operation -34723 68/push 0/imm32/operation -34724 68/push 1/imm32 -34725 89/<- %esi 4/r32/esp -34726 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-operation: -34727 # stmt->operation = "increment" -34728 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -34729 (copy-array Heap "increment" %eax) -34730 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var: -34731 # var formal-var/ebx: (payload var) -34732 68/push 0/imm32/register -34733 68/push 0/imm32/register -34734 68/push 0/imm32/no-stack-offset -34735 68/push 1/imm32/block-depth -34736 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -34737 68/push 0x11/imm32/alloc-id:fake -34738 68/push 0/imm32/name -34739 68/push 0/imm32/name -34740 68/push 0x11/imm32/alloc-id:fake:payload -34741 89/<- %ebx 4/r32/esp -34742 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var-name: -34743 # formal-var->name = "dummy" -34744 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -34745 (copy-array Heap "dummy" %eax) -34746 $test-emit-subx-stmt-select-primitive-2:initialize-formal-register: -34747 # formal-var->register = "*" -34748 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -34749 (copy-array Heap "*" %eax) # Any-register -34750 $test-emit-subx-stmt-select-primitive-2:initialize-var-list: -34751 # var formal-outputs/ebx: (payload list stmt-var) -34752 68/push 0/imm32/next -34753 68/push 0/imm32/next -34754 53/push-ebx/formal-var -34755 68/push 0x11/imm32/alloc-id:fake -34756 68/push 0x11/imm32/alloc-id:fake:payload -34757 89/<- %ebx 4/r32/esp -34758 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2: -34759 # var primitive2/edi: (payload primitive) -34760 68/push 0/imm32/next -34761 68/push 0/imm32/next -34762 68/push 0/imm32/no-x32 -34763 68/push 0/imm32/no-xm32 -34764 68/push 0/imm32/no-disp32 -34765 68/push 0/imm32/no-imm8 -34766 68/push 0/imm32/no-imm32 -34767 68/push 0/imm32/no-r32 -34768 68/push 3/imm32/rm32-is-first-output -34769 68/push 0/imm32/subx-name -34770 68/push 0/imm32/subx-name -34771 53/push-ebx/outputs -34772 68/push 0x11/imm32/alloc-id:fake -34773 68/push 0/imm32/no-inouts -34774 68/push 0/imm32/no-inouts -34775 68/push 0/imm32/name -34776 68/push 0/imm32/name -34777 68/push 0x11/imm32/alloc-id:fake:payload -34778 89/<- %edi 4/r32/esp -34779 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-name: -34780 # primitives->name = "increment" -34781 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 -34782 (copy-array Heap "increment" %eax) -34783 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-subx-name: -34784 # primitives->subx-name = "ff 0/subop/increment" -34785 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 -34786 (copy-array Heap "ff 0/subop/increment" %eax) -34787 $test-emit-subx-stmt-select-primitive-2:initialize-primitive: -34788 # var primitives/ebx: (addr primitive) -34789 57/push-edi -34790 68/push 0x11/imm32/alloc-id:fake -34791 68/push 0/imm32/no-x32 -34792 68/push 0/imm32/no-xm32 -34793 68/push 0/imm32/no-disp32 -34794 68/push 0/imm32/no-imm8 -34795 68/push 0/imm32/no-imm32 -34796 68/push 0/imm32/no-r32 -34797 68/push 1/imm32/rm32-is-first-inout -34798 68/push 0/imm32/subx-name -34799 68/push 0/imm32/subx-name -34800 68/push 0/imm32/no-outputs -34801 68/push 0/imm32/no-outputs -34802 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -34803 68/push 0x11/imm32/alloc-id:fake -34804 68/push 0/imm32/name -34805 68/push 0/imm32/name -34806 89/<- %ebx 4/r32/esp -34807 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-name: -34808 # primitives->name = "increment" -34809 (copy-array Heap "increment" %ebx) # Primitive-name -34810 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-subx-name: -34811 # primitives->subx-name = "ff 0/subop/increment" -34812 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -34813 (copy-array Heap "ff 0/subop/increment" %eax) -34814 # convert -34815 c7 0/subop/copy *Curr-block-depth 0/imm32 -34816 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0 Stderr 0) -34817 (flush _test-output-buffered-file) -34818 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -34824 # check output -34825 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2") -34826 # . epilogue -34827 89/<- %esp 5/r32/ebp -34828 5d/pop-to-ebp -34829 c3/return -34830 -34831 test-increment-register: -34832 # Select the right register between overloads. -34833 # foo <- increment -34834 # => -34835 # 50/increment-eax -34836 # -34837 # There's a variable on the var stack as follows: -34838 # name: 'foo' -34839 # type: int -34840 # register: 'eax' -34841 # -34842 # Primitives are the global definitions. -34843 # -34844 # . prologue -34845 55/push-ebp -34846 89/<- %ebp 4/r32/esp -34847 # setup -34848 (clear-stream _test-output-stream) -34849 (clear-stream $_test-output-buffered-file->buffer) -34850 $test-increment-register:initialize-type: -34851 # var type/ecx: (payload type-tree) = int -34852 68/push 0/imm32/right:null -34853 68/push 0/imm32/right:null -34854 68/push 0/imm32/left:unused -34855 68/push 1/imm32/value:int -34856 68/push 1/imm32/is-atom?:true -34857 68/push 0x11/imm32/alloc-id:fake:payload -34858 89/<- %ecx 4/r32/esp -34859 $test-increment-register:initialize-var: -34860 # var var-foo/ecx: (payload var) -34861 68/push 0/imm32/register -34862 68/push 0/imm32/register -34863 68/push 0/imm32/no-stack-offset -34864 68/push 1/imm32/block-depth -34865 51/push-ecx -34866 68/push 0x11/imm32/alloc-id:fake -34867 68/push 0/imm32/name -34868 68/push 0/imm32/name -34869 68/push 0x11/imm32/alloc-id:fake:payload -34870 89/<- %ecx 4/r32/esp -34871 $test-increment-register:initialize-var-name: -34872 # var-foo->name = "foo" -34873 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -34874 (copy-array Heap "foo" %eax) -34875 $test-increment-register:initialize-var-register: -34876 # var-foo->register = "eax" -34877 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -34878 (copy-array Heap "eax" %eax) -34879 $test-increment-register:initialize-stmt-var: -34880 # var operand/ebx: (payload stmt-var) -34881 68/push 0/imm32/is-deref:false -34882 68/push 0/imm32/next -34883 68/push 0/imm32/next -34884 51/push-ecx/var-foo -34885 68/push 0x11/imm32/alloc-id:fake -34886 68/push 0x11/imm32/alloc-id:fake:payload -34887 89/<- %ebx 4/r32/esp -34888 $test-increment-register:initialize-stmt: -34889 # var stmt/esi: (addr statement) -34890 53/push-ebx/outputs -34891 68/push 0x11/imm32/alloc-id:fake -34892 68/push 0/imm32/no-inouts -34893 68/push 0/imm32/no-inouts -34894 68/push 0/imm32/operation -34895 68/push 0/imm32/operation -34896 68/push 1/imm32 -34897 89/<- %esi 4/r32/esp -34898 $test-increment-register:initialize-stmt-operation: -34899 # stmt->operation = "increment" -34900 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -34901 (copy-array Heap "increment" %eax) -34902 # convert -34903 c7 0/subop/copy *Curr-block-depth 0/imm32 -34904 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -34905 (flush _test-output-buffered-file) -34906 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -34912 # check output -34913 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register") -34914 # . epilogue -34915 89/<- %esp 5/r32/ebp -34916 5d/pop-to-ebp -34917 c3/return -34918 -34919 test-add-reg-to-reg: -34920 # var1/reg <- add var2/reg -34921 # => -34922 # 01/add-to %var1 var2 -34923 # -34924 # . prologue -34925 55/push-ebp -34926 89/<- %ebp 4/r32/esp -34927 # setup -34928 (clear-stream _test-output-stream) -34929 (clear-stream $_test-output-buffered-file->buffer) -34930 $test-add-reg-to-reg:initialize-type: -34931 # var type/ecx: (payload type-tree) = int -34932 68/push 0/imm32/right:null -34933 68/push 0/imm32/right:null -34934 68/push 0/imm32/left:unused -34935 68/push 1/imm32/value:int -34936 68/push 1/imm32/is-atom?:true -34937 68/push 0x11/imm32/alloc-id:fake:payload -34938 89/<- %ecx 4/r32/esp -34939 $test-add-reg-to-reg:initialize-var1: -34940 # var var1/ecx: (payload var) -34941 68/push 0/imm32/register -34942 68/push 0/imm32/register -34943 68/push 0/imm32/no-stack-offset -34944 68/push 1/imm32/block-depth -34945 51/push-ecx -34946 68/push 0x11/imm32/alloc-id:fake -34947 68/push 0/imm32/name -34948 68/push 0/imm32/name -34949 68/push 0x11/imm32/alloc-id:fake:payload -34950 89/<- %ecx 4/r32/esp -34951 $test-add-reg-to-reg:initialize-var1-name: -34952 # var1->name = "var1" -34953 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -34954 (copy-array Heap "var1" %eax) -34955 $test-add-reg-to-reg:initialize-var1-register: -34956 # var1->register = "eax" -34957 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -34958 (copy-array Heap "eax" %eax) -34959 $test-add-reg-to-reg:initialize-var2: -34960 # var var2/edx: (payload var) -34961 68/push 0/imm32/register -34962 68/push 0/imm32/register -34963 68/push 0/imm32/no-stack-offset -34964 68/push 1/imm32/block-depth -34965 ff 6/subop/push *(ecx+0x10) -34966 68/push 0x11/imm32/alloc-id:fake -34967 68/push 0/imm32/name -34968 68/push 0/imm32/name -34969 68/push 0x11/imm32/alloc-id:fake:payload -34970 89/<- %edx 4/r32/esp -34971 $test-add-reg-to-reg:initialize-var2-name: -34972 # var2->name = "var2" -34973 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -34974 (copy-array Heap "var2" %eax) -34975 $test-add-reg-to-reg:initialize-var2-register: -34976 # var2->register = "ecx" -34977 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -34978 (copy-array Heap "ecx" %eax) -34979 $test-add-reg-to-reg:initialize-inouts: -34980 # var inouts/esi: (payload stmt-var) = [var2] -34981 68/push 0/imm32/is-deref:false -34982 68/push 0/imm32/next -34983 68/push 0/imm32/next -34984 52/push-edx/var2 -34985 68/push 0x11/imm32/alloc-id:fake -34986 68/push 0x11/imm32/alloc-id:fake:payload -34987 89/<- %esi 4/r32/esp -34988 $test-add-reg-to-reg:initialize-outputs: -34989 # var outputs/edi: (payload stmt-var) = [var1] -34990 68/push 0/imm32/is-deref:false -34991 68/push 0/imm32/next -34992 68/push 0/imm32/next -34993 51/push-ecx/var1 -34994 68/push 0x11/imm32/alloc-id:fake -34995 68/push 0x11/imm32/alloc-id:fake:payload -34996 89/<- %edi 4/r32/esp -34997 $test-add-reg-to-reg:initialize-stmt: -34998 # var stmt/esi: (addr statement) -34999 68/push 0/imm32/next -35000 68/push 0/imm32/next -35001 57/push-edi/outputs -35002 68/push 0x11/imm32/alloc-id:fake -35003 56/push-esi/inouts -35004 68/push 0x11/imm32/alloc-id:fake -35005 68/push 0/imm32/operation -35006 68/push 0/imm32/operation -35007 68/push 1/imm32/tag:stmt1 -35008 89/<- %esi 4/r32/esp -35009 $test-add-reg-to-reg:initialize-stmt-operation: -35010 # stmt->operation = "add" -35011 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -35012 (copy-array Heap "add" %eax) -35013 # convert -35014 c7 0/subop/copy *Curr-block-depth 0/imm32 -35015 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -35016 (flush _test-output-buffered-file) -35017 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -35023 # check output -35024 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg") -35025 # . epilogue -35026 89/<- %esp 5/r32/ebp -35027 5d/pop-to-ebp -35028 c3/return -35029 -35030 test-add-reg-to-mem: -35031 # add-to var1 var2/reg -35032 # => -35033 # 01/add-to *(ebp+__) var2 -35034 # -35035 # . prologue -35036 55/push-ebp -35037 89/<- %ebp 4/r32/esp -35038 # setup -35039 (clear-stream _test-output-stream) -35040 (clear-stream $_test-output-buffered-file->buffer) -35041 $test-add-reg-to-mem:initialize-type: -35042 # var type/ecx: (payload type-tree) = int -35043 68/push 0/imm32/right:null -35044 68/push 0/imm32/right:null -35045 68/push 0/imm32/left:unused -35046 68/push 1/imm32/value:int -35047 68/push 1/imm32/is-atom?:true -35048 68/push 0x11/imm32/alloc-id:fake:payload -35049 89/<- %ecx 4/r32/esp -35050 $test-add-reg-to-mem:initialize-var1: -35051 # var var1/ecx: (payload var) -35052 68/push 0/imm32/register -35053 68/push 0/imm32/register -35054 68/push 8/imm32/stack-offset -35055 68/push 1/imm32/block-depth -35056 51/push-ecx -35057 68/push 0x11/imm32/alloc-id:fake -35058 68/push 0/imm32/name -35059 68/push 0/imm32/name -35060 68/push 0x11/imm32/alloc-id:fake:payload -35061 89/<- %ecx 4/r32/esp -35062 $test-add-reg-to-mem:initialize-var1-name: -35063 # var1->name = "var1" -35064 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -35065 (copy-array Heap "var1" %eax) -35066 $test-add-reg-to-mem:initialize-var2: -35067 # var var2/edx: (payload var) -35068 68/push 0/imm32/register -35069 68/push 0/imm32/register -35070 68/push 0/imm32/no-stack-offset -35071 68/push 1/imm32/block-depth -35072 ff 6/subop/push *(ecx+0x10) -35073 68/push 0x11/imm32/alloc-id:fake -35074 68/push 0/imm32/name -35075 68/push 0/imm32/name -35076 68/push 0x11/imm32/alloc-id:fake:payload -35077 89/<- %edx 4/r32/esp -35078 $test-add-reg-to-mem:initialize-var2-name: -35079 # var2->name = "var2" -35080 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -35081 (copy-array Heap "var2" %eax) -35082 $test-add-reg-to-mem:initialize-var2-register: -35083 # var2->register = "ecx" -35084 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -35085 (copy-array Heap "ecx" %eax) -35086 $test-add-reg-to-mem:initialize-inouts: -35087 # var inouts/esi: (payload stmt-var) = [var2] -35088 68/push 0/imm32/is-deref:false -35089 68/push 0/imm32/next -35090 68/push 0/imm32/next -35091 52/push-edx/var2 -35092 68/push 0x11/imm32/alloc-id:fake -35093 68/push 0x11/imm32/alloc-id:fake:payload -35094 89/<- %esi 4/r32/esp -35095 # inouts = [var1, var2] -35096 68/push 0/imm32/is-deref:false -35097 56/push-esi/next -35098 68/push 0x11/imm32/alloc-id:fake -35099 51/push-ecx/var1 -35100 68/push 0x11/imm32/alloc-id:fake -35101 68/push 0x11/imm32/alloc-id:fake:payload -35102 89/<- %esi 4/r32/esp -35103 $test-add-reg-to-mem:initialize-stmt: -35104 # var stmt/esi: (addr statement) -35105 68/push 0/imm32/next -35106 68/push 0/imm32/next -35107 68/push 0/imm32/outputs -35108 68/push 0/imm32/outputs -35109 56/push-esi/inouts -35110 68/push 0x11/imm32/alloc-id:fake -35111 68/push 0/imm32/operation -35112 68/push 0/imm32/operation -35113 68/push 1/imm32/tag:stmt1 -35114 89/<- %esi 4/r32/esp -35115 $test-add-reg-to-mem:initialize-stmt-operation: -35116 # stmt->operation = "add-to" -35117 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -35118 (copy-array Heap "add-to" %eax) -35119 # convert -35120 c7 0/subop/copy *Curr-block-depth 0/imm32 -35121 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -35122 (flush _test-output-buffered-file) -35123 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -35129 # check output -35130 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem") -35131 # . epilogue -35132 89/<- %esp 5/r32/ebp -35133 5d/pop-to-ebp -35134 c3/return -35135 -35136 test-add-mem-to-reg: -35137 # var1/reg <- add var2 -35138 # => -35139 # 03/add *(ebp+__) var1 -35140 # -35141 # . prologue -35142 55/push-ebp -35143 89/<- %ebp 4/r32/esp -35144 # setup -35145 (clear-stream _test-output-stream) -35146 (clear-stream $_test-output-buffered-file->buffer) -35147 $test-add-mem-to-reg:initialize-type: -35148 # var type/ecx: (payload type-tree) = int -35149 68/push 0/imm32/right:null -35150 68/push 0/imm32/right:null -35151 68/push 0/imm32/left:unused -35152 68/push 1/imm32/value:int -35153 68/push 1/imm32/is-atom?:true -35154 68/push 0x11/imm32/alloc-id:fake:payload -35155 89/<- %ecx 4/r32/esp -35156 $test-add-mem-to-reg:initialize-var: -35157 # var var1/ecx: (payload var) -35158 68/push 0/imm32/register -35159 68/push 0/imm32/register -35160 68/push 0/imm32/no-stack-offset -35161 68/push 1/imm32/block-depth -35162 51/push-ecx -35163 68/push 0x11/imm32/alloc-id:fake -35164 68/push 0/imm32/name -35165 68/push 0/imm32/name -35166 68/push 0x11/imm32/alloc-id:fake:payload -35167 89/<- %ecx 4/r32/esp -35168 $test-add-mem-to-reg:initialize-var-name: -35169 # var1->name = "foo" -35170 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -35171 (copy-array Heap "var1" %eax) -35172 $test-add-mem-to-reg:initialize-var-register: -35173 # var1->register = "eax" -35174 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -35175 (copy-array Heap "eax" %eax) -35176 $test-add-mem-to-reg:initialize-var2: -35177 # var var2/edx: (payload var) -35178 68/push 0/imm32/register -35179 68/push 0/imm32/register -35180 68/push 8/imm32/stack-offset -35181 68/push 1/imm32/block-depth -35182 ff 6/subop/push *(ecx+0x10) -35183 68/push 0x11/imm32/alloc-id:fake -35184 68/push 0/imm32/name -35185 68/push 0/imm32/name -35186 68/push 0x11/imm32/alloc-id:fake:payload -35187 89/<- %edx 4/r32/esp -35188 $test-add-mem-to-reg:initialize-var2-name: -35189 # var2->name = "var2" -35190 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -35191 (copy-array Heap "var2" %eax) -35192 $test-add-mem-to-reg:initialize-inouts: -35193 # var inouts/esi: (payload stmt-var) = [var2] -35194 68/push 0/imm32/is-deref:false -35195 68/push 0/imm32/next -35196 68/push 0/imm32/next -35197 52/push-edx/var2 -35198 68/push 0x11/imm32/alloc-id:fake -35199 68/push 0x11/imm32/alloc-id:fake:payload -35200 89/<- %esi 4/r32/esp -35201 $test-add-mem-to-reg:initialize-outputs: -35202 # var outputs/edi: (payload stmt-var) = [var1] -35203 68/push 0/imm32/is-deref:false -35204 68/push 0/imm32/next -35205 68/push 0/imm32/next -35206 51/push-ecx/var1 -35207 68/push 0x11/imm32/alloc-id:fake -35208 68/push 0x11/imm32/alloc-id:fake:payload -35209 89/<- %edi 4/r32/esp -35210 $test-add-mem-to-reg:initialize-stmt: -35211 # var stmt/esi: (addr statement) -35212 68/push 0/imm32/next -35213 68/push 0/imm32/next -35214 57/push-edi/outputs -35215 68/push 0x11/imm32/alloc-id:fake -35216 56/push-esi/inouts -35217 68/push 0x11/imm32/alloc-id:fake -35218 68/push 0/imm32/operation -35219 68/push 0/imm32/operation -35220 68/push 1/imm32/tag:stmt1 -35221 89/<- %esi 4/r32/esp -35222 $test-add-mem-to-reg:initialize-stmt-operation: -35223 # stmt->operation = "add" -35224 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -35225 (copy-array Heap "add" %eax) -35226 # convert -35227 c7 0/subop/copy *Curr-block-depth 0/imm32 -35228 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -35229 (flush _test-output-buffered-file) -35230 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -35236 # check output -35237 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg") -35238 # . epilogue -35239 89/<- %esp 5/r32/ebp -35240 5d/pop-to-ebp -35241 c3/return -35242 -35243 test-add-literal-to-eax: -35244 # var1/eax <- add 0x34 -35245 # => -35246 # 05/add-to-eax 0x34/imm32 -35247 # -35248 # . prologue -35249 55/push-ebp -35250 89/<- %ebp 4/r32/esp -35251 # setup -35252 (clear-stream _test-output-stream) -35253 (clear-stream $_test-output-buffered-file->buffer) -35254 $test-add-literal-to-eax:initialize-var-type: -35255 # var type/ecx: (payload type-tree) = int -35256 68/push 0/imm32/right:null -35257 68/push 0/imm32/right:null -35258 68/push 0/imm32/left:unused -35259 68/push 1/imm32/value:int -35260 68/push 1/imm32/is-atom?:true -35261 68/push 0x11/imm32/alloc-id:fake:payload -35262 89/<- %ecx 4/r32/esp -35263 $test-add-literal-to-eax:initialize-var: -35264 # var v/ecx: (payload var) -35265 68/push 0/imm32/register -35266 68/push 0/imm32/register -35267 68/push 0/imm32/no-stack-offset -35268 68/push 1/imm32/block-depth -35269 51/push-ecx -35270 68/push 0x11/imm32/alloc-id:fake -35271 68/push 0/imm32/name -35272 68/push 0/imm32/name -35273 68/push 0x11/imm32/alloc-id:fake:payload -35274 89/<- %ecx 4/r32/esp -35275 $test-add-literal-to-eax:initialize-var-name: -35276 # v->name = "v" -35277 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -35278 (copy-array Heap "v" %eax) -35279 $test-add-literal-to-eax:initialize-var-register: -35280 # v->register = "eax" -35281 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -35282 (copy-array Heap "eax" %eax) -35283 $test-add-literal-to-eax:initialize-literal-type: -35284 # var type/edx: (payload type-tree) = literal -35285 68/push 0/imm32/right:null -35286 68/push 0/imm32/right:null -35287 68/push 0/imm32/left:unused -35288 68/push 0/imm32/value:literal -35289 68/push 1/imm32/is-atom?:true -35290 68/push 0x11/imm32/alloc-id:fake:payload -35291 89/<- %edx 4/r32/esp -35292 $test-add-literal-to-eax:initialize-literal: -35293 # var l/edx: (payload var) -35294 68/push 0/imm32/register -35295 68/push 0/imm32/register -35296 68/push 0/imm32/no-stack-offset -35297 68/push 1/imm32/block-depth -35298 52/push-edx -35299 68/push 0x11/imm32/alloc-id:fake -35300 68/push 0/imm32/name -35301 68/push 0/imm32/name -35302 68/push 0x11/imm32/alloc-id:fake:payload -35303 89/<- %edx 4/r32/esp -35304 $test-add-literal-to-eax:initialize-literal-value: -35305 # l->name = "0x34" -35306 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -35307 (copy-array Heap "0x34" %eax) -35308 $test-add-literal-to-eax:initialize-inouts: -35309 # var inouts/esi: (payload stmt-var) = [l] -35310 68/push 0/imm32/is-deref:false -35311 68/push 0/imm32/next -35312 68/push 0/imm32/next -35313 52/push-edx/l -35314 68/push 0x11/imm32/alloc-id:fake -35315 68/push 0x11/imm32/alloc-id:fake:payload -35316 89/<- %esi 4/r32/esp -35317 $test-add-literal-to-eax:initialize-outputs: -35318 # var outputs/edi: (payload stmt-var) = [v] -35319 68/push 0/imm32/is-deref:false -35320 68/push 0/imm32/next -35321 68/push 0/imm32/next -35322 51/push-ecx/v -35323 68/push 0x11/imm32/alloc-id:fake -35324 68/push 0x11/imm32/alloc-id:fake:payload -35325 89/<- %edi 4/r32/esp -35326 $test-add-literal-to-eax:initialize-stmt: -35327 # var stmt/esi: (addr statement) -35328 68/push 0/imm32/next -35329 68/push 0/imm32/next -35330 57/push-edi/outputs -35331 68/push 0x11/imm32/alloc-id:fake -35332 56/push-esi/inouts -35333 68/push 0x11/imm32/alloc-id:fake -35334 68/push 0/imm32/operation -35335 68/push 0/imm32/operation -35336 68/push 1/imm32/tag:stmt1 -35337 89/<- %esi 4/r32/esp -35338 $test-add-literal-to-eax:initialize-stmt-operation: -35339 # stmt->operation = "add" -35340 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -35341 (copy-array Heap "add" %eax) -35342 # convert -35343 c7 0/subop/copy *Curr-block-depth 0/imm32 -35344 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -35345 (flush _test-output-buffered-file) -35346 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -35352 # check output -35353 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax") -35354 # . epilogue -35355 89/<- %esp 5/r32/ebp -35356 5d/pop-to-ebp -35357 c3/return -35358 -35359 test-add-literal-to-reg: -35360 # var1/ecx <- add 0x34 -35361 # => -35362 # 81 0/subop/add %ecx 0x34/imm32 -35363 # -35364 # . prologue -35365 55/push-ebp -35366 89/<- %ebp 4/r32/esp -35367 # setup -35368 (clear-stream _test-output-stream) -35369 (clear-stream $_test-output-buffered-file->buffer) -35370 $test-add-literal-to-reg:initialize-var-type: -35371 # var type/ecx: (payload type-tree) = int -35372 68/push 0/imm32/right:null -35373 68/push 0/imm32/right:null -35374 68/push 0/imm32/left:unused -35375 68/push 1/imm32/value:int -35376 68/push 1/imm32/is-atom?:true -35377 68/push 0x11/imm32/alloc-id:fake:payload -35378 89/<- %ecx 4/r32/esp -35379 $test-add-literal-to-reg:initialize-var: -35380 # var v/ecx: (payload var) -35381 68/push 0/imm32/register -35382 68/push 0/imm32/register -35383 68/push 0/imm32/no-stack-offset -35384 68/push 1/imm32/block-depth -35385 51/push-ecx -35386 68/push 0x11/imm32/alloc-id:fake -35387 68/push 0/imm32/name -35388 68/push 0/imm32/name -35389 68/push 0x11/imm32/alloc-id:fake:payload -35390 89/<- %ecx 4/r32/esp -35391 $test-add-literal-to-reg:initialize-var-name: -35392 # v->name = "v" -35393 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -35394 (copy-array Heap "v" %eax) -35395 $test-add-literal-to-reg:initialize-var-register: -35396 # v->register = "ecx" -35397 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -35398 (copy-array Heap "ecx" %eax) -35399 $test-add-literal-to-reg:initialize-literal-type: -35400 # var type/edx: (payload type-tree) = literal -35401 68/push 0/imm32/right:null -35402 68/push 0/imm32/right:null -35403 68/push 0/imm32/left:unused -35404 68/push 0/imm32/value:literal -35405 68/push 1/imm32/is-atom?:true -35406 68/push 0x11/imm32/alloc-id:fake:payload -35407 89/<- %edx 4/r32/esp -35408 $test-add-literal-to-reg:initialize-literal: -35409 # var l/edx: (payload var) -35410 68/push 0/imm32/register -35411 68/push 0/imm32/register -35412 68/push 0/imm32/no-stack-offset -35413 68/push 1/imm32/block-depth -35414 52/push-edx -35415 68/push 0x11/imm32/alloc-id:fake -35416 68/push 0/imm32/name -35417 68/push 0/imm32/name -35418 68/push 0x11/imm32/alloc-id:fake:payload -35419 89/<- %edx 4/r32/esp -35420 $test-add-literal-to-reg:initialize-literal-value: -35421 # l->name = "0x34" -35422 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -35423 (copy-array Heap "0x34" %eax) -35424 $test-add-literal-to-reg:initialize-inouts: -35425 # var inouts/esi: (payload stmt-var) = [l] -35426 68/push 0/imm32/is-deref:false -35427 68/push 0/imm32/next -35428 68/push 0/imm32/next -35429 52/push-edx/l -35430 68/push 0x11/imm32/alloc-id:fake -35431 68/push 0x11/imm32/alloc-id:fake:payload -35432 89/<- %esi 4/r32/esp -35433 $test-add-literal-to-reg:initialize-outputs: -35434 # var outputs/edi: (payload stmt-var) = [v] -35435 68/push 0/imm32/is-deref:false -35436 68/push 0/imm32/next -35437 68/push 0/imm32/next -35438 51/push-ecx/v -35439 68/push 0x11/imm32/alloc-id:fake -35440 68/push 0x11/imm32/alloc-id:fake:payload -35441 89/<- %edi 4/r32/esp -35442 $test-add-literal-to-reg:initialize-stmt: -35443 # var stmt/esi: (addr statement) -35444 68/push 0/imm32/next -35445 68/push 0/imm32/next -35446 57/push-edi/outputs -35447 68/push 0x11/imm32/alloc-id:fake -35448 56/push-esi/inouts -35449 68/push 0x11/imm32/alloc-id:fake -35450 68/push 0/imm32/operation -35451 68/push 0/imm32/operation -35452 68/push 1/imm32/tag:stmt1 -35453 89/<- %esi 4/r32/esp -35454 $test-add-literal-to-reg:initialize-stmt-operation: -35455 # stmt->operation = "add" -35456 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -35457 (copy-array Heap "add" %eax) -35458 # convert -35459 c7 0/subop/copy *Curr-block-depth 0/imm32 -35460 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -35461 (flush _test-output-buffered-file) -35462 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -35468 # check output -35469 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg") -35470 # . epilogue -35471 89/<- %esp 5/r32/ebp -35472 5d/pop-to-ebp -35473 c3/return -35474 -35475 test-add-literal-to-mem: -35476 # add-to var1, 0x34 -35477 # => -35478 # 81 0/subop/add %eax 0x34/imm32 -35479 # -35480 # . prologue -35481 55/push-ebp -35482 89/<- %ebp 4/r32/esp -35483 # setup -35484 (clear-stream _test-output-stream) -35485 (clear-stream $_test-output-buffered-file->buffer) -35486 $test-add-literal-to-mem:initialize-type: -35487 # var type/ecx: (payload type-tree) = int -35488 68/push 0/imm32/right:null -35489 68/push 0/imm32/right:null -35490 68/push 0/imm32/left:unused -35491 68/push 1/imm32/value:int -35492 68/push 1/imm32/is-atom?:true -35493 68/push 0x11/imm32/alloc-id:fake:payload -35494 89/<- %ecx 4/r32/esp -35495 $test-add-literal-to-mem:initialize-var1: -35496 # var var1/ecx: (payload var) -35497 68/push 0/imm32/register -35498 68/push 0/imm32/register -35499 68/push 8/imm32/stack-offset -35500 68/push 1/imm32/block-depth -35501 51/push-ecx -35502 68/push 0x11/imm32/alloc-id:fake -35503 68/push 0/imm32/name -35504 68/push 0/imm32/name -35505 68/push 0x11/imm32/alloc-id:fake:payload -35506 89/<- %ecx 4/r32/esp -35507 $test-add-literal-to-mem:initialize-var1-name: -35508 # var1->name = "var1" -35509 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -35510 (copy-array Heap "var1" %eax) -35511 $test-add-literal-to-mem:initialize-literal-type: -35512 # var type/edx: (payload type-tree) = literal -35513 68/push 0/imm32/right:null -35514 68/push 0/imm32/right:null -35515 68/push 0/imm32/left:unused -35516 68/push 0/imm32/value:literal -35517 68/push 1/imm32/is-atom?:true -35518 68/push 0x11/imm32/alloc-id:fake:payload -35519 89/<- %edx 4/r32/esp -35520 $test-add-literal-to-mem:initialize-literal: -35521 # var l/edx: (payload var) -35522 68/push 0/imm32/register -35523 68/push 0/imm32/register -35524 68/push 0/imm32/no-stack-offset -35525 68/push 1/imm32/block-depth -35526 52/push-edx -35527 68/push 0x11/imm32/alloc-id:fake -35528 68/push 0/imm32/name -35529 68/push 0/imm32/name -35530 68/push 0x11/imm32/alloc-id:fake:payload -35531 89/<- %edx 4/r32/esp -35532 $test-add-literal-to-mem:initialize-literal-value: -35533 # l->name = "0x34" -35534 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -35535 (copy-array Heap "0x34" %eax) -35536 $test-add-literal-to-mem:initialize-inouts: -35537 # var inouts/esi: (payload stmt-var) = [l] -35538 68/push 0/imm32/is-deref:false -35539 68/push 0/imm32/next -35540 68/push 0/imm32/next -35541 52/push-edx/l -35542 68/push 0x11/imm32/alloc-id:fake -35543 68/push 0x11/imm32/alloc-id:fake:payload -35544 89/<- %esi 4/r32/esp -35545 # var inouts = (handle stmt-var) = [var1, var2] -35546 68/push 0/imm32/is-deref:false -35547 56/push-esi/next -35548 68/push 0x11/imm32/alloc-id:fake -35549 51/push-ecx/var1 -35550 68/push 0x11/imm32/alloc-id:fake -35551 68/push 0x11/imm32/alloc-id:fake:payload -35552 89/<- %esi 4/r32/esp -35553 $test-add-literal-to-mem:initialize-stmt: -35554 # var stmt/esi: (addr statement) -35555 68/push 0/imm32/next -35556 68/push 0/imm32/next -35557 68/push 0/imm32/outputs -35558 68/push 0/imm32/outputs -35559 56/push-esi/inouts -35560 68/push 0x11/imm32/alloc-id:fake -35561 68/push 0/imm32/operation -35562 68/push 0/imm32/operation -35563 68/push 1/imm32/tag:stmt1 -35564 89/<- %esi 4/r32/esp -35565 $test-add-literal-to-mem:initialize-stmt-operation: -35566 # stmt->operation = "add-to" -35567 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -35568 (copy-array Heap "add-to" %eax) -35569 # convert -35570 c7 0/subop/copy *Curr-block-depth 0/imm32 -35571 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -35572 (flush _test-output-buffered-file) -35573 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -35579 # check output -35580 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem") +34329 Single-int-var-in-eax: # (payload list var) +34330 0x11/imm32/alloc-id:fake:payload +34331 0x11/imm32/alloc-id:fake +34332 Int-var-in-eax/imm32 +34333 0/imm32/next +34334 0/imm32/next +34335 +34336 Int-var-in-eax: +34337 0x11/imm32/alloc-id:fake:payload +34338 0/imm32/name +34339 0/imm32/name +34340 0x11/imm32/alloc-id:fake +34341 Type-int/imm32 +34342 1/imm32/some-block-depth +34343 0/imm32/no-stack-offset +34344 0x11/imm32/alloc-id:fake +34345 $Mu-register-eax/imm32 # can't use Register-eax only to keep our buggy tools/treeshake.cc happy (TODO) +34346 +34347 Single-int-var-in-ecx: # (payload list var) +34348 0x11/imm32/alloc-id:fake:payload +34349 0x11/imm32/alloc-id:fake +34350 Int-var-in-ecx/imm32 +34351 0/imm32/next +34352 0/imm32/next +34353 +34354 Int-var-in-ecx: +34355 0x11/imm32/alloc-id:fake:payload +34356 0/imm32/name +34357 0/imm32/name +34358 0x11/imm32/alloc-id:fake +34359 Type-int/imm32 +34360 1/imm32/some-block-depth +34361 0/imm32/no-stack-offset +34362 0x11/imm32/alloc-id:fake +34363 $Register-ecx/imm32/register +34364 +34365 Single-int-var-in-edx: # (payload list var) +34366 0x11/imm32/alloc-id:fake:payload +34367 0x11/imm32/alloc-id:fake +34368 Int-var-in-edx/imm32 +34369 0/imm32/next +34370 0/imm32/next +34371 +34372 Int-var-in-edx: # (payload list var) +34373 0x11/imm32/alloc-id:fake:payload +34374 0/imm32/name +34375 0/imm32/name +34376 0x11/imm32/alloc-id:fake +34377 Type-int/imm32 +34378 1/imm32/some-block-depth +34379 0/imm32/no-stack-offset +34380 0x11/imm32/alloc-id:fake +34381 $Register-edx/imm32/register +34382 +34383 Single-int-var-in-ebx: # (payload list var) +34384 0x11/imm32/alloc-id:fake:payload +34385 0x11/imm32/alloc-id:fake +34386 Int-var-in-ebx/imm32 +34387 0/imm32/next +34388 0/imm32/next +34389 +34390 Int-var-in-ebx: # (payload list var) +34391 0x11/imm32/alloc-id:fake:payload +34392 0/imm32/name +34393 0/imm32/name +34394 0x11/imm32/alloc-id:fake +34395 Type-int/imm32 +34396 1/imm32/some-block-depth +34397 0/imm32/no-stack-offset +34398 0x11/imm32/alloc-id:fake +34399 $Register-ebx/imm32/register +34400 +34401 Single-int-var-in-esi: # (payload list var) +34402 0x11/imm32/alloc-id:fake:payload +34403 0x11/imm32/alloc-id:fake +34404 Int-var-in-esi/imm32 +34405 0/imm32/next +34406 0/imm32/next +34407 +34408 Int-var-in-esi: # (payload list var) +34409 0x11/imm32/alloc-id:fake:payload +34410 0/imm32/name +34411 0/imm32/name +34412 0x11/imm32/alloc-id:fake +34413 Type-int/imm32 +34414 1/imm32/some-block-depth +34415 0/imm32/no-stack-offset +34416 0x11/imm32/alloc-id:fake +34417 $Register-esi/imm32/register +34418 +34419 Single-int-var-in-edi: # (payload list var) +34420 0x11/imm32/alloc-id:fake:payload +34421 0x11/imm32/alloc-id:fake +34422 Int-var-in-edi/imm32 +34423 0/imm32/next +34424 0/imm32/next +34425 +34426 Int-var-in-edi: # (payload list var) +34427 0x11/imm32/alloc-id:fake:payload +34428 0/imm32/name +34429 0/imm32/name +34430 0x11/imm32/alloc-id:fake +34431 Type-int/imm32 +34432 1/imm32/some-block-depth +34433 0/imm32/no-stack-offset +34434 0x11/imm32/alloc-id:fake +34435 $Register-edi/imm32/register +34436 +34437 Single-lit-var: # (payload list var) +34438 0x11/imm32/alloc-id:fake:payload +34439 0x11/imm32/alloc-id:fake +34440 Lit-var/imm32 +34441 0/imm32/next +34442 0/imm32/next +34443 +34444 Lit-var: # (payload var) +34445 0x11/imm32/alloc-id:fake:payload +34446 0/imm32/name +34447 0/imm32/name +34448 0x11/imm32/alloc-id:fake +34449 Type-literal/imm32 +34450 1/imm32/some-block-depth +34451 0/imm32/no-stack-offset +34452 0/imm32/no-register +34453 0/imm32/no-register +34454 +34455 Single-float-var-in-mem: # (payload list var) +34456 0x11/imm32/alloc-id:fake:payload +34457 0x11/imm32/alloc-id:fake +34458 Float-var-in-mem/imm32 +34459 0/imm32/next +34460 0/imm32/next +34461 +34462 Float-var-in-mem: # (payload var) +34463 0x11/imm32/alloc-id:fake:payload +34464 0/imm32/name +34465 0/imm32/name +34466 0x11/imm32/alloc-id:fake +34467 Type-float/imm32 +34468 1/imm32/some-block-depth +34469 1/imm32/some-stack-offset +34470 0/imm32/no-register +34471 0/imm32/no-register +34472 +34473 Single-float-var-in-some-register: # (payload list var) +34474 0x11/imm32/alloc-id:fake:payload +34475 0x11/imm32/alloc-id:fake +34476 Float-var-in-some-register/imm32 +34477 0/imm32/next +34478 0/imm32/next +34479 +34480 Float-var-in-some-register: # (payload var) +34481 0x11/imm32/alloc-id:fake:payload +34482 0/imm32/name +34483 0/imm32/name +34484 0x11/imm32/alloc-id:fake +34485 Type-float/imm32 +34486 1/imm32/some-block-depth +34487 0/imm32/no-stack-offset +34488 0x11/imm32/alloc-id:fake +34489 Any-register/imm32 +34490 +34491 Type-int: # (payload type-tree) +34492 0x11/imm32/alloc-id:fake:payload +34493 1/imm32/is-atom +34494 1/imm32/value:int +34495 0/imm32/left:unused +34496 0/imm32/right:null +34497 0/imm32/right:null +34498 +34499 Type-literal: # (payload type-tree) +34500 0x11/imm32/alloc-id:fake:payload +34501 1/imm32/is-atom +34502 0/imm32/value:literal +34503 0/imm32/left:unused +34504 0/imm32/right:null +34505 0/imm32/right:null +34506 +34507 Type-addr: # (payload type-tree) +34508 0x11/imm32/alloc-id:fake:payload +34509 1/imm32/is-atom +34510 2/imm32/value:addr +34511 0/imm32/left:unused +34512 0/imm32/right:null +34513 0/imm32/right:null +34514 +34515 Type-byte: # (payload type-tree) +34516 0x11/imm32/alloc-id:fake:payload +34517 1/imm32/is-atom +34518 8/imm32/value:byte +34519 0/imm32/left:unused +34520 0/imm32/right:null +34521 0/imm32/right:null +34522 +34523 Type-float: # (payload type-tree) +34524 0x11/imm32/alloc-id:fake:payload +34525 1/imm32/is-atom +34526 0xf/imm32/value:float +34527 0/imm32/left:unused +34528 0/imm32/right:null +34529 0/imm32/right:null +34530 +34531 == code +34532 emit-subx-primitive: # out: (addr buffered-file), stmt: (addr stmt), primitive: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) +34533 # . prologue +34534 55/push-ebp +34535 89/<- %ebp 4/r32/esp +34536 # . save registers +34537 50/push-eax +34538 51/push-ecx +34539 # ecx = primitive +34540 8b/-> *(ebp+0x10) 1/r32/ecx +34541 # emit primitive name +34542 (emit-indent *(ebp+8) *Curr-block-depth) +34543 (lookup *(ecx+0x18) *(ecx+0x1c)) # Primitive-subx-name Primitive-subx-name => eax +34544 (write-buffered *(ebp+8) %eax) +34545 # emit rm32 if necessary +34546 (emit-subx-rm32 *(ebp+8) *(ecx+0x20) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-rm32 +34547 # emit xm32 if necessary +34548 (emit-subx-rm32 *(ebp+8) *(ecx+0x34) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-xm32 +34549 # emit r32 if necessary +34550 (emit-subx-r32 *(ebp+8) *(ecx+0x24) *(ebp+0xc)) # Primitive-subx-r32 +34551 # emit x32 if necessary +34552 (emit-subx-x32 *(ebp+8) *(ecx+0x38) *(ebp+0xc)) # Primitive-subx-x32 +34553 # emit imm32 if necessary +34554 (emit-subx-imm32 *(ebp+8) *(ecx+0x28) *(ebp+0xc)) # Primitive-subx-imm32 +34555 # emit imm8 if necessary +34556 (emit-subx-imm8 *(ebp+8) *(ecx+0x2c) *(ebp+0xc)) # Primitive-subx-imm8 +34557 # emit disp32 if necessary +34558 (emit-subx-disp32 *(ebp+8) *(ecx+0x30) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-disp32 +34559 (write-buffered *(ebp+8) Newline) +34560 $emit-subx-primitive:end: +34561 # . restore registers +34562 59/pop-to-ecx +34563 58/pop-to-eax +34564 # . epilogue +34565 89/<- %esp 5/r32/ebp +34566 5d/pop-to-ebp +34567 c3/return +34568 +34569 emit-subx-rm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +34570 # . prologue +34571 55/push-ebp +34572 89/<- %ebp 4/r32/esp +34573 # . save registers +34574 50/push-eax +34575 # if (l == 0) return +34576 81 7/subop/compare *(ebp+0xc) 0/imm32 +34577 74/jump-if-= $emit-subx-rm32:end/disp8 +34578 # var v/eax: (addr stmt-var) +34579 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax +34580 (emit-subx-var-as-rm32 *(ebp+8) %eax) +34581 $emit-subx-rm32:end: +34582 # . restore registers +34583 58/pop-to-eax +34584 # . epilogue +34585 89/<- %esp 5/r32/ebp +34586 5d/pop-to-ebp +34587 c3/return +34588 +34589 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) +34590 # . prologue +34591 55/push-ebp +34592 89/<- %ebp 4/r32/esp +34593 # . save registers +34594 51/push-ecx +34595 # eax = l +34596 8b/-> *(ebp+0xc) 0/r32/eax +34597 # ecx = stmt +34598 8b/-> *(ebp+8) 1/r32/ecx +34599 # if (l == 1) return stmt->inouts +34600 { +34601 3d/compare-eax-and 1/imm32 +34602 75/jump-if-!= break/disp8 +34603 $get-stmt-operand-from-arg-location:1: +34604 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +34605 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +34606 } +34607 # if (l == 2) return stmt->inouts->next +34608 { +34609 3d/compare-eax-and 2/imm32 +34610 75/jump-if-!= break/disp8 +34611 $get-stmt-operand-from-arg-location:2: +34612 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +34613 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +34614 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +34615 } +34616 # if (l == 3) return stmt->outputs +34617 { +34618 3d/compare-eax-and 3/imm32 +34619 75/jump-if-!= break/disp8 +34620 $get-stmt-operand-from-arg-location:3: +34621 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +34622 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +34623 } +34624 # abort +34625 e9/jump $get-stmt-operand-from-arg-location:abort/disp32 +34626 $get-stmt-operand-from-arg-location:end: +34627 # . restore registers +34628 59/pop-to-ecx +34629 # . epilogue +34630 89/<- %esp 5/r32/ebp +34631 5d/pop-to-ebp +34632 c3/return +34633 +34634 $get-stmt-operand-from-arg-location:abort: +34635 # error("invalid arg-location " eax) +34636 (write-buffered *(ebp+0x10) "invalid arg-location ") +34637 (write-int32-hex-buffered *(ebp+0x10) %eax) +34638 (write-buffered *(ebp+0x10) Newline) +34639 (flush *(ebp+0x10)) +34640 (stop *(ebp+0x14) 1) +34641 # never gets here +34642 +34643 emit-subx-r32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +34644 # . prologue +34645 55/push-ebp +34646 89/<- %ebp 4/r32/esp +34647 # . save registers +34648 50/push-eax +34649 51/push-ecx +34650 # if (l == 0) return +34651 81 7/subop/compare *(ebp+0xc) 0/imm32 +34652 0f 84/jump-if-= $emit-subx-r32:end/disp32 +34653 # var v/eax: (addr stmt-var) +34654 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +34655 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +34656 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +34657 #? (write-buffered Stderr "looking up ") +34658 #? (write-buffered Stderr %eax) +34659 #? (write-buffered Stderr Newline) +34660 #? (flush Stderr) +34661 (maybe-get Mu-registers %eax 0xc) # => eax: (addr register-index) +34662 (write-buffered *(ebp+8) Space) +34663 (write-int32-hex-buffered *(ebp+8) *eax) +34664 (write-buffered *(ebp+8) "/r32") +34665 $emit-subx-r32:end: +34666 # . restore registers +34667 59/pop-to-ecx +34668 58/pop-to-eax +34669 # . epilogue +34670 89/<- %esp 5/r32/ebp +34671 5d/pop-to-ebp +34672 c3/return +34673 +34674 emit-subx-x32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +34675 # . prologue +34676 55/push-ebp +34677 89/<- %ebp 4/r32/esp +34678 # . save registers +34679 50/push-eax +34680 51/push-ecx +34681 # if (l == 0) return +34682 81 7/subop/compare *(ebp+0xc) 0/imm32 +34683 0f 84/jump-if-= $emit-subx-x32:end/disp32 +34684 # var v/eax: (addr stmt-var) +34685 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +34686 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +34687 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +34688 #? (write-buffered Stderr "looking up ") +34689 #? (write-buffered Stderr %eax) +34690 #? (write-buffered Stderr Newline) +34691 #? (flush Stderr) +34692 (maybe-get Mu-registers %eax 0xc) # => eax: (addr register-index) +34693 (write-buffered *(ebp+8) Space) +34694 (write-int32-hex-buffered *(ebp+8) *eax) +34695 (write-buffered *(ebp+8) "/x32") +34696 $emit-subx-x32:end: +34697 # . restore registers +34698 59/pop-to-ecx +34699 58/pop-to-eax +34700 # . epilogue +34701 89/<- %esp 5/r32/ebp +34702 5d/pop-to-ebp +34703 c3/return +34704 +34705 emit-subx-imm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +34706 # . prologue +34707 55/push-ebp +34708 89/<- %ebp 4/r32/esp +34709 # . save registers +34710 50/push-eax +34711 51/push-ecx +34712 # if (l == 0) return +34713 81 7/subop/compare *(ebp+0xc) 0/imm32 +34714 0f 84/jump-if-= $emit-subx-imm32:end/disp32 +34715 # var v/eax: (handle var) +34716 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +34717 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +34718 (lookup *eax *(eax+4)) # Var-name Var-name => eax +34719 (write-buffered *(ebp+8) Space) +34720 (write-buffered *(ebp+8) %eax) +34721 (write-buffered *(ebp+8) "/imm32") +34722 $emit-subx-imm32:end: +34723 # . restore registers +34724 59/pop-to-ecx +34725 58/pop-to-eax +34726 # . epilogue +34727 89/<- %esp 5/r32/ebp +34728 5d/pop-to-ebp +34729 c3/return +34730 +34731 emit-subx-imm8: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +34732 # . prologue +34733 55/push-ebp +34734 89/<- %ebp 4/r32/esp +34735 # . save registers +34736 50/push-eax +34737 51/push-ecx +34738 # if (l == 0) return +34739 81 7/subop/compare *(ebp+0xc) 0/imm32 +34740 0f 84/jump-if-= $emit-subx-imm32:end/disp32 +34741 # var v/eax: (handle var) +34742 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +34743 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +34744 (lookup *eax *(eax+4)) # Var-name Var-name => eax +34745 (write-buffered *(ebp+8) Space) +34746 (write-buffered *(ebp+8) %eax) +34747 (write-buffered *(ebp+8) "/imm8") +34748 $emit-subx-imm8:end: +34749 # . restore registers +34750 59/pop-to-ecx +34751 58/pop-to-eax +34752 # . epilogue +34753 89/<- %esp 5/r32/ebp +34754 5d/pop-to-ebp +34755 c3/return +34756 +34757 emit-subx-disp32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +34758 # . prologue +34759 55/push-ebp +34760 89/<- %ebp 4/r32/esp +34761 # . save registers +34762 50/push-eax +34763 51/push-ecx +34764 # if (location == 0) return +34765 81 7/subop/compare *(ebp+0xc) 0/imm32 +34766 0f 84/jump-if-= $emit-subx-disp32:end/disp32 +34767 # var v/eax: (addr stmt-var) +34768 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax +34769 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +34770 (lookup *eax *(eax+4)) # Var-name Var-name => eax +34771 (write-buffered *(ebp+8) Space) +34772 (write-buffered *(ebp+8) %eax) +34773 # hack: if instruction operation starts with "break", emit ":break" +34774 # var name/ecx: (addr array byte) = lookup(stmt->operation) +34775 8b/-> *(ebp+0x10) 0/r32/eax +34776 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +34777 89/<- %ecx 0/r32/eax +34778 { +34779 (string-starts-with? %ecx "break") # => eax +34780 3d/compare-eax-and 0/imm32/false +34781 74/jump-if-= break/disp8 +34782 (write-buffered *(ebp+8) ":break") +34783 } +34784 # hack: if instruction operation starts with "loop", emit ":loop" +34785 { +34786 (string-starts-with? %ecx "loop") # => eax +34787 3d/compare-eax-and 0/imm32/false +34788 74/jump-if-= break/disp8 +34789 (write-buffered *(ebp+8) ":loop") +34790 } +34791 (write-buffered *(ebp+8) "/disp32") +34792 $emit-subx-disp32:end: +34793 # . restore registers +34794 59/pop-to-ecx +34795 58/pop-to-eax +34796 # . epilogue +34797 89/<- %esp 5/r32/ebp +34798 5d/pop-to-ebp +34799 c3/return +34800 +34801 emit-call: # out: (addr buffered-file), stmt: (addr stmt) +34802 # . prologue +34803 55/push-ebp +34804 89/<- %ebp 4/r32/esp +34805 # . save registers +34806 50/push-eax +34807 51/push-ecx +34808 # +34809 (emit-indent *(ebp+8) *Curr-block-depth) +34810 (write-buffered *(ebp+8) "(") +34811 # ecx = stmt +34812 8b/-> *(ebp+0xc) 1/r32/ecx +34813 # - emit function name +34814 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +34815 (write-buffered *(ebp+8) %eax) +34816 # - emit arguments +34817 # var curr/eax: (addr stmt-var) = lookup(stmt->inouts) +34818 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +34819 { +34820 # if (curr == null) break +34821 3d/compare-eax-and 0/imm32 +34822 74/jump-if-= break/disp8 +34823 # +34824 (emit-subx-call-operand *(ebp+8) %eax) +34825 # curr = lookup(curr->next) +34826 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +34827 eb/jump loop/disp8 +34828 } +34829 # +34830 (write-buffered *(ebp+8) ")\n") +34831 $emit-call:end: +34832 # . restore registers +34833 59/pop-to-ecx +34834 58/pop-to-eax +34835 # . epilogue +34836 89/<- %esp 5/r32/ebp +34837 5d/pop-to-ebp +34838 c3/return +34839 +34840 emit-subx-call-operand: # out: (addr buffered-file), s: (addr stmt-var) +34841 # shares code with emit-subx-var-as-rm32 +34842 # . prologue +34843 55/push-ebp +34844 89/<- %ebp 4/r32/esp +34845 # . save registers +34846 50/push-eax +34847 51/push-ecx +34848 56/push-esi +34849 # ecx = s +34850 8b/-> *(ebp+0xc) 1/r32/ecx +34851 # var operand/esi: (addr var) = lookup(s->value) +34852 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +34853 89/<- %esi 0/r32/eax +34854 # if (operand->register && !s->is-deref?) emit "%__" +34855 { +34856 $emit-subx-call-operand:check-for-register-direct: +34857 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +34858 74/jump-if-= break/disp8 +34859 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +34860 75/jump-if-!= break/disp8 +34861 $emit-subx-call-operand:register-direct: +34862 (write-buffered *(ebp+8) " %") +34863 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +34864 (write-buffered *(ebp+8) %eax) +34865 e9/jump $emit-subx-call-operand:end/disp32 +34866 } +34867 # else if (operand->register && s->is-deref?) emit "*__" +34868 { +34869 $emit-subx-call-operand:check-for-register-indirect: +34870 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +34871 74/jump-if-= break/disp8 +34872 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +34873 74/jump-if-= break/disp8 +34874 $emit-subx-call-operand:register-indirect: +34875 (emit-subx-call-operand-register-indirect *(ebp+8) %esi) +34876 e9/jump $emit-subx-call-operand:end/disp32 +34877 } +34878 # else if (operand->stack-offset) emit "*(ebp+__)" +34879 { +34880 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset +34881 74/jump-if-= break/disp8 +34882 $emit-subx-call-operand:stack: +34883 (emit-subx-call-operand-stack *(ebp+8) %esi) +34884 e9/jump $emit-subx-call-operand:end/disp32 +34885 } +34886 # else if (operand->type == literal) emit "__" +34887 { +34888 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +34889 81 7/subop/compare *(eax+4) 0/imm32 # Type-tree-value +34890 75/jump-if-!= break/disp8 +34891 $emit-subx-call-operand:literal: +34892 (write-buffered *(ebp+8) Space) +34893 (lookup *esi *(esi+4)) # Var-name Var-name => eax +34894 (write-buffered *(ebp+8) %eax) +34895 e9/jump $emit-subx-call-operand:end/disp32 +34896 } +34897 # else if (operand->type == literal-string) emit "__" +34898 { +34899 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +34900 81 7/subop/compare *(eax+4) 0x10/imm32 # Type-tree-value +34901 75/jump-if-!= break/disp8 +34902 $emit-subx-call-operand:literal-string: +34903 (write-buffered *(ebp+8) Space) +34904 (lookup *esi *(esi+4)) # Var-name Var-name => eax +34905 (write-buffered *(ebp+8) %eax) +34906 } +34907 $emit-subx-call-operand:end: +34908 # . restore registers +34909 5e/pop-to-esi +34910 59/pop-to-ecx +34911 58/pop-to-eax +34912 # . epilogue +34913 89/<- %esp 5/r32/ebp +34914 5d/pop-to-ebp +34915 c3/return +34916 +34917 emit-subx-call-operand-register-indirect: # out: (addr buffered-file), v: (addr var) +34918 # . prologue +34919 55/push-ebp +34920 89/<- %ebp 4/r32/esp +34921 # . save registers +34922 50/push-eax +34923 51/push-ecx +34924 56/push-esi +34925 # esi = v +34926 8b/-> *(ebp+0xc) 6/r32/esi +34927 # var size/ecx: int = size-of-deref(v) +34928 (size-of-deref %esi) # => eax +34929 89/<- %ecx 0/r32/eax +34930 # var reg-name/esi: (addr array byte) = lookup(v->register) +34931 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +34932 89/<- %esi 0/r32/eax +34933 # TODO: assert size is a multiple of 4 +34934 # var i/eax: int = 0 +34935 b8/copy-to-eax 0/imm32 +34936 { +34937 $emit-subx-call-operand-register-indirect:loop: +34938 # if (i >= size) break +34939 39/compare %eax 1/r32/ecx +34940 7d/jump-if->= break/disp8 +34941 # emit " *(" v->register "+" i ")" +34942 (write-buffered *(ebp+8) " *(") +34943 (write-buffered *(ebp+8) %esi) +34944 (write-buffered *(ebp+8) "+") +34945 (write-int32-hex-buffered *(ebp+8) %eax) +34946 (write-buffered *(ebp+8) ")") +34947 # i += 4 +34948 05/add-to-eax 4/imm32 +34949 # +34950 eb/jump loop/disp8 +34951 } +34952 $emit-subx-call-operand-register-indirect:end: +34953 # . restore registers +34954 5e/pop-to-esi +34955 59/pop-to-ecx +34956 58/pop-to-eax +34957 # . epilogue +34958 89/<- %esp 5/r32/ebp +34959 5d/pop-to-ebp +34960 c3/return +34961 +34962 emit-subx-call-operand-stack: # out: (addr buffered-file), v: (addr var) +34963 # . prologue +34964 55/push-ebp +34965 89/<- %ebp 4/r32/esp +34966 # . save registers +34967 50/push-eax +34968 51/push-ecx +34969 56/push-esi +34970 # esi = v +34971 8b/-> *(ebp+0xc) 6/r32/esi +34972 # var curr/ecx: int = v->offset +34973 8b/-> *(esi+0x14) 1/r32/ecx # Var-offset +34974 # var max/eax: int = v->offset + size-of(v) +34975 (size-of %esi) # => eax +34976 # TODO: assert size is a multiple of 4 +34977 01/add-to %eax 1/r32/ecx +34978 { +34979 $emit-subx-call-operand-stack:loop: +34980 # if (curr >= max) break +34981 39/compare %ecx 0/r32/eax +34982 7d/jump-if->= break/disp8 +34983 # emit " *(ebp+" curr ")" +34984 (write-buffered *(ebp+8) " *(ebp+") +34985 (write-int32-hex-buffered *(ebp+8) %ecx) +34986 (write-buffered *(ebp+8) ")") +34987 # i += 4 +34988 81 0/subop/add %ecx 4/imm32 +34989 # +34990 eb/jump loop/disp8 +34991 } +34992 $emit-subx-call-operand-stack:end: +34993 # . restore registers +34994 5e/pop-to-esi +34995 59/pop-to-ecx +34996 58/pop-to-eax +34997 # . epilogue +34998 89/<- %esp 5/r32/ebp +34999 5d/pop-to-ebp +35000 c3/return +35001 +35002 emit-subx-var-as-rm32: # out: (addr buffered-file), s: (addr stmt-var) +35003 # . prologue +35004 55/push-ebp +35005 89/<- %ebp 4/r32/esp +35006 # . save registers +35007 50/push-eax +35008 51/push-ecx +35009 56/push-esi +35010 # ecx = s +35011 8b/-> *(ebp+0xc) 1/r32/ecx +35012 # var operand/esi: (addr var) = lookup(s->value) +35013 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +35014 89/<- %esi 0/r32/eax +35015 # if (operand->register && s->is-deref?) emit "*__" +35016 { +35017 $emit-subx-var-as-rm32:check-for-register-indirect: +35018 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +35019 74/jump-if-= break/disp8 +35020 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +35021 74/jump-if-= break/disp8 +35022 $emit-subx-var-as-rm32:register-indirect: +35023 (write-buffered *(ebp+8) " *") +35024 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +35025 (write-buffered *(ebp+8) %eax) +35026 e9/jump $emit-subx-var-as-rm32:end/disp32 +35027 } +35028 # if (operand->register && !s->is-deref?) emit "%__" +35029 { +35030 $emit-subx-var-as-rm32:check-for-register-direct: +35031 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +35032 74/jump-if-= break/disp8 +35033 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +35034 75/jump-if-!= break/disp8 +35035 $emit-subx-var-as-rm32:register-direct: +35036 (write-buffered *(ebp+8) " %") +35037 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +35038 (write-buffered *(ebp+8) %eax) +35039 e9/jump $emit-subx-var-as-rm32:end/disp32 +35040 } +35041 # else if (operand->stack-offset) emit "*(ebp+__)" +35042 { +35043 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset +35044 74/jump-if-= break/disp8 +35045 $emit-subx-var-as-rm32:stack: +35046 (write-buffered *(ebp+8) Space) +35047 (write-buffered *(ebp+8) "*(ebp+") +35048 (write-int32-hex-buffered *(ebp+8) *(esi+0x14)) # Var-offset +35049 (write-buffered *(ebp+8) ")") +35050 } +35051 $emit-subx-var-as-rm32:end: +35052 # . restore registers +35053 5e/pop-to-esi +35054 59/pop-to-ecx +35055 58/pop-to-eax +35056 # . epilogue +35057 89/<- %esp 5/r32/ebp +35058 5d/pop-to-ebp +35059 c3/return +35060 +35061 find-matching-primitive: # primitives: (addr primitive), stmt: (addr stmt) -> result/eax: (addr primitive) +35062 # . prologue +35063 55/push-ebp +35064 89/<- %ebp 4/r32/esp +35065 # . save registers +35066 51/push-ecx +35067 # var curr/ecx: (addr primitive) = primitives +35068 8b/-> *(ebp+8) 1/r32/ecx +35069 { +35070 $find-matching-primitive:loop: +35071 # if (curr == null) break +35072 81 7/subop/compare %ecx 0/imm32 +35073 74/jump-if-= break/disp8 +35074 # if match(curr, stmt) return curr +35075 { +35076 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx) # => eax +35077 3d/compare-eax-and 0/imm32/false +35078 74/jump-if-= break/disp8 +35079 89/<- %eax 1/r32/ecx +35080 eb/jump $find-matching-primitive:end/disp8 +35081 } +35082 $find-matching-primitive:next-primitive: +35083 # curr = curr->next +35084 (lookup *(ecx+0x3c) *(ecx+0x40)) # Primitive-next Primitive-next => eax +35085 89/<- %ecx 0/r32/eax +35086 # +35087 e9/jump loop/disp32 +35088 } +35089 # return null +35090 b8/copy-to-eax 0/imm32 +35091 $find-matching-primitive:end: +35092 # . restore registers +35093 59/pop-to-ecx +35094 # . epilogue +35095 89/<- %esp 5/r32/ebp +35096 5d/pop-to-ebp +35097 c3/return +35098 +35099 mu-stmt-matches-primitive?: # stmt: (addr stmt), primitive: (addr primitive) -> result/eax: boolean +35100 # A mu stmt matches a primitive if the name matches, all the inout vars +35101 # match, and all the output vars match. +35102 # Vars match if types match and registers match. +35103 # In addition, a stmt output matches a primitive's output if types match +35104 # and the primitive has a wildcard register. +35105 # . prologue +35106 55/push-ebp +35107 89/<- %ebp 4/r32/esp +35108 # . save registers +35109 51/push-ecx +35110 52/push-edx +35111 53/push-ebx +35112 56/push-esi +35113 57/push-edi +35114 # ecx = stmt +35115 8b/-> *(ebp+8) 1/r32/ecx +35116 # edx = primitive +35117 8b/-> *(ebp+0xc) 2/r32/edx +35118 { +35119 $mu-stmt-matches-primitive?:check-name: +35120 # if (primitive->name != stmt->operation) return false +35121 # . var esi: (addr array byte) = lookup(stmt->operation) +35122 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +35123 89/<- %esi 0/r32/eax +35124 # . var edi: (addr array byte) = lookup(primitive->name) +35125 (lookup *edx *(edx+4)) # Primitive-name Primitive-name => eax +35126 #? (write-buffered Stderr %eax) +35127 #? (write-buffered Stderr Newline) +35128 #? (flush Stderr) +35129 89/<- %edi 0/r32/eax +35130 (string-equal? %esi %edi) # => eax +35131 3d/compare-eax-and 0/imm32/false +35132 75/jump-if-!= break/disp8 +35133 b8/copy-to-eax 0/imm32 +35134 e9/jump $mu-stmt-matches-primitive?:end/disp32 +35135 } +35136 # var curr/esi: (addr stmt-var) = lookup(stmt->inouts) +35137 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +35138 89/<- %esi 0/r32/eax +35139 # var curr2/edi: (addr list var) = lookup(primitive->inouts) +35140 (lookup *(edx+8) *(edx+0xc)) # Primitive-inouts Primitive-inouts => eax +35141 89/<- %edi 0/r32/eax +35142 { +35143 $mu-stmt-matches-primitive?:inouts-loop: +35144 # if (curr == 0 && curr2 == 0) move on to check outputs +35145 { +35146 $mu-stmt-matches-primitive?:check-both-inouts-null: +35147 81 7/subop/compare %esi 0/imm32 +35148 75/jump-if-!= break/disp8 +35149 $mu-stmt-matches-primitive?:stmt-inout-null: +35150 81 7/subop/compare %edi 0/imm32 +35151 0f 84/jump-if-= $mu-stmt-matches-primitive?:check-outputs/disp32 +35152 $mu-stmt-matches-primitive?:stmt-inout-null-and-prim-inout-not-null: +35153 # return false +35154 b8/copy-to-eax 0/imm32/false +35155 e9/jump $mu-stmt-matches-primitive?:end/disp32 +35156 } +35157 # if (curr2 == 0) return false +35158 { +35159 $mu-stmt-matches-primitive?:check-prim-inout-null: +35160 81 7/subop/compare %edi 0/imm32 +35161 75/jump-if-!= break/disp8 +35162 $mu-stmt-matches-primitive?:prim-inout-null: +35163 b8/copy-to-eax 0/imm32/false +35164 e9/jump $mu-stmt-matches-primitive?:end/disp32 +35165 } +35166 # if (curr != curr2) return false +35167 { +35168 $mu-stmt-matches-primitive?:check-inouts-match: +35169 (lookup *edi *(edi+4)) # List-value List-value => eax +35170 (operand-matches-primitive? %esi %eax) # => eax +35171 3d/compare-eax-and 0/imm32/false +35172 75/jump-if-!= break/disp8 +35173 $mu-stmt-matches-primitive?:inouts-match: +35174 b8/copy-to-eax 0/imm32/false +35175 e9/jump $mu-stmt-matches-primitive?:end/disp32 +35176 } +35177 $mu-stmt-matches-primitive?:next-inout: +35178 # curr = lookup(curr->next) +35179 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +35180 89/<- %esi 0/r32/eax +35181 # curr2 = lookup(curr2->next) +35182 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +35183 89/<- %edi 0/r32/eax +35184 # +35185 e9/jump loop/disp32 +35186 } +35187 $mu-stmt-matches-primitive?:check-outputs: +35188 # var curr/esi: (addr stmt-var) = lookup(stmt->outputs) +35189 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +35190 89/<- %esi 0/r32/eax +35191 # var curr2/edi: (addr list var) = lookup(primitive->outputs) +35192 (lookup *(edx+0x10) *(edx+0x14)) # Primitive-outputs Primitive-outputs => eax +35193 89/<- %edi 0/r32/eax +35194 { +35195 $mu-stmt-matches-primitive?:outputs-loop: +35196 # if (curr == 0) return (curr2 == 0) +35197 { +35198 $mu-stmt-matches-primitive?:check-both-outputs-null: +35199 81 7/subop/compare %esi 0/imm32 +35200 75/jump-if-!= break/disp8 +35201 { +35202 $mu-stmt-matches-primitive?:stmt-output-null: +35203 81 7/subop/compare %edi 0/imm32 +35204 75/jump-if-!= break/disp8 +35205 $mu-stmt-matches-primitive?:both-outputs-null: +35206 # return true +35207 b8/copy-to-eax 1/imm32 +35208 e9/jump $mu-stmt-matches-primitive?:end/disp32 +35209 } +35210 $mu-stmt-matches-primitive?:stmt-output-null-and-prim-output-not-null: +35211 # return false +35212 b8/copy-to-eax 0/imm32 +35213 e9/jump $mu-stmt-matches-primitive?:end/disp32 +35214 } +35215 # if (curr2 == 0) return false +35216 { +35217 $mu-stmt-matches-primitive?:check-prim-output-null: +35218 81 7/subop/compare %edi 0/imm32 +35219 75/jump-if-!= break/disp8 +35220 $mu-stmt-matches-primitive?:prim-output-is-null: +35221 b8/copy-to-eax 0/imm32 +35222 e9/jump $mu-stmt-matches-primitive?:end/disp32 +35223 } +35224 # if (curr != curr2) return false +35225 { +35226 $mu-stmt-matches-primitive?:check-outputs-match: +35227 (lookup *edi *(edi+4)) # List-value List-value => eax +35228 (operand-matches-primitive? %esi %eax) # => eax +35229 3d/compare-eax-and 0/imm32/false +35230 75/jump-if-!= break/disp8 +35231 $mu-stmt-matches-primitive?:outputs-match: +35232 b8/copy-to-eax 0/imm32 +35233 e9/jump $mu-stmt-matches-primitive?:end/disp32 +35234 } +35235 $mu-stmt-matches-primitive?:next-output: +35236 # curr = lookup(curr->next) +35237 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +35238 89/<- %esi 0/r32/eax +35239 # curr2 = lookup(curr2->next) +35240 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +35241 89/<- %edi 0/r32/eax +35242 # +35243 e9/jump loop/disp32 +35244 } +35245 $mu-stmt-matches-primitive?:return-true: +35246 b8/copy-to-eax 1/imm32 +35247 $mu-stmt-matches-primitive?:end: +35248 # . restore registers +35249 5f/pop-to-edi +35250 5e/pop-to-esi +35251 5b/pop-to-ebx +35252 5a/pop-to-edx +35253 59/pop-to-ecx +35254 # . epilogue +35255 89/<- %esp 5/r32/ebp +35256 5d/pop-to-ebp +35257 c3/return +35258 +35259 operand-matches-primitive?: # s: (addr stmt-var), prim-var: (addr var) -> result/eax: boolean +35260 # . prologue +35261 55/push-ebp +35262 89/<- %ebp 4/r32/esp +35263 # . save registers +35264 51/push-ecx +35265 52/push-edx +35266 53/push-ebx +35267 56/push-esi +35268 57/push-edi +35269 # ecx = s +35270 8b/-> *(ebp+8) 1/r32/ecx +35271 # var var/esi: (addr var) = lookup(s->value) +35272 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +35273 89/<- %esi 0/r32/eax +35274 # edi = prim-var +35275 8b/-> *(ebp+0xc) 7/r32/edi +35276 $operand-matches-primitive?:check-type: +35277 # if !category-match?(var->type, prim-var->type) return false +35278 # . var vtype/ebx: (addr type-tree) = lookup(var->type) +35279 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +35280 89/<- %ebx 0/r32/eax +35281 # . if s is deref, vtype = vtype->right +35282 { +35283 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +35284 74/jump-if-= break/disp8 +35285 $operand-matches-primitive?:is-deref: +35286 # . var t/eax: (addr type) +35287 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +35288 # . if !t->is-atom? t = t->left +35289 81 7/subop/compare *eax 0/imm32/false +35290 { +35291 75/jump-if-!= break/disp8 +35292 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +35293 } +35294 # . +35295 89/<- %ebx 0/r32/eax +35296 } +35297 # . var ptype/eax: (addr type-tree) = lookup(prim-var->type) +35298 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +35299 (subx-type-category-match? %ebx %eax) # => eax +35300 3d/compare-eax-and 0/imm32/false +35301 0f 84/jump-if-= $operand-matches-primitive?:return-false/disp32 +35302 { +35303 $operand-matches-primitive?:check-register: +35304 # if prim-var is in memory and var is in register but dereference, match +35305 { +35306 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register +35307 0f 85/jump-if-!= break/disp32 +35308 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +35309 74/jump-if-= break/disp8 +35310 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +35311 74/jump-if-= break/disp8 +35312 $operand-matches-primitive?:var-deref-match: +35313 e9/jump $operand-matches-primitive?:return-true/disp32 +35314 } +35315 # if prim-var is in register and var is in register but dereference, no match +35316 { +35317 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register +35318 0f 84/jump-if-= break/disp32 +35319 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +35320 0f 84/jump-if-= break/disp32 +35321 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +35322 74/jump-if-= break/disp8 +35323 $operand-matches-primitive?:var-deref-no-match: +35324 e9/jump $operand-matches-primitive?:return-false/disp32 +35325 } +35326 # return false if var->register doesn't match prim-var->register +35327 { +35328 # if register addresses are equal, it's a match +35329 # var vreg/ebx: (addr array byte) = lookup(var->register) +35330 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +35331 89/<- %ebx 0/r32/eax +35332 # var preg/ecx: (addr array byte) = lookup(prim-var->register) +35333 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax +35334 89/<- %ecx 0/r32/eax +35335 # if (vreg == preg) break +35336 39/compare %ecx 3/r32/ebx +35337 74/jump-if-= break/disp8 +35338 $operand-matches-primitive?:var-register-no-match: +35339 # if either address is 0, return false +35340 81 7/subop/compare %ebx 0/imm32 +35341 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +35342 81 7/subop/compare %ecx 0/imm32 +35343 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +35344 # if prim-var->register is wildcard, it's a match +35345 (string-equal? %ecx "*") # Any-register => eax +35346 3d/compare-eax-and 0/imm32/false +35347 75/jump-if-!= break/disp8 +35348 $operand-matches-primitive?:wildcard-no-match: +35349 # if string contents aren't equal, return false +35350 (string-equal? %ecx %ebx) # => eax +35351 3d/compare-eax-and 0/imm32/false +35352 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +35353 } +35354 } +35355 $operand-matches-primitive?:return-true: +35356 b8/copy-to-eax 1/imm32/true +35357 eb/jump $operand-matches-primitive?:end/disp8 +35358 $operand-matches-primitive?:return-false: +35359 b8/copy-to-eax 0/imm32/false +35360 $operand-matches-primitive?:end: +35361 # . restore registers +35362 5f/pop-to-edi +35363 5e/pop-to-esi +35364 5b/pop-to-ebx +35365 5a/pop-to-edx +35366 59/pop-to-ecx +35367 # . epilogue +35368 89/<- %esp 5/r32/ebp +35369 5d/pop-to-ebp +35370 c3/return +35371 +35372 find-matching-function: # functions: (addr function), stmt: (addr stmt) -> result/eax: (addr function) +35373 # . prologue +35374 55/push-ebp +35375 89/<- %ebp 4/r32/esp +35376 # . save registers +35377 51/push-ecx +35378 # var curr/ecx: (handle function) = functions +35379 8b/-> *(ebp+8) 1/r32/ecx +35380 { +35381 # if (curr == null) break +35382 81 7/subop/compare %ecx 0/imm32 +35383 74/jump-if-= break/disp8 +35384 #? (write-buffered Stderr "iter\n") +35385 #? (flush Stderr) +35386 # if match(stmt, curr) return curr +35387 { +35388 (mu-stmt-matches-function? *(ebp+0xc) %ecx) # => eax +35389 3d/compare-eax-and 0/imm32/false +35390 74/jump-if-= break/disp8 +35391 89/<- %eax 1/r32/ecx +35392 eb/jump $find-matching-function:end/disp8 +35393 } +35394 # curr = curr->next +35395 (lookup *(ecx+0x20) *(ecx+0x24)) # Function-next Function-next => eax +35396 89/<- %ecx 0/r32/eax +35397 # +35398 eb/jump loop/disp8 +35399 } +35400 # return null +35401 b8/copy-to-eax 0/imm32 +35402 $find-matching-function:end: +35403 # . restore registers +35404 59/pop-to-ecx +35405 # . epilogue +35406 89/<- %esp 5/r32/ebp +35407 5d/pop-to-ebp +35408 c3/return +35409 +35410 # Just compare names; user-defined functions don't support overloading yet. +35411 mu-stmt-matches-function?: # stmt: (addr stmt1), function: (addr function) -> result/eax: boolean +35412 # . prologue +35413 55/push-ebp +35414 89/<- %ebp 4/r32/esp +35415 # . save registers +35416 51/push-ecx +35417 # return function->name == stmt->operation +35418 # ecx = lookup(stmt->operation) +35419 8b/-> *(ebp+8) 0/r32/eax +35420 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +35421 89/<- %ecx 0/r32/eax +35422 # eax = lookup(function->name) +35423 8b/-> *(ebp+0xc) 0/r32/eax +35424 (lookup *eax *(eax+4)) # Function-name Function-name => eax +35425 (string-equal? %eax %ecx) # => eax +35426 $mu-stmt-matches-function?:end: +35427 # . restore registers +35428 59/pop-to-ecx +35429 # . epilogue +35430 89/<- %esp 5/r32/ebp +35431 5d/pop-to-ebp +35432 c3/return +35433 +35434 # Type-checking happens elsewhere. This method is for selecting between +35435 # primitives. +35436 subx-type-category-match?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean +35437 # . prologue +35438 55/push-ebp +35439 89/<- %ebp 4/r32/esp +35440 # . save registers +35441 51/push-ecx +35442 # var cata/ecx: int = type-category(a) +35443 (type-category *(ebp+8)) # => eax +35444 89/<- %ecx 0/r32/eax +35445 # var catb/eax: int = type-category(b) +35446 (type-category *(ebp+0xc)) # => eax +35447 # return cata == catb +35448 39/compare %eax 1/r32/ecx +35449 0f 94/set-byte-if-= %al +35450 81 4/subop/and %eax 0xff/imm32 +35451 $subx-type-category-match?:end: +35452 # . restore registers +35453 59/pop-to-ecx +35454 # . epilogue +35455 89/<- %esp 5/r32/ebp +35456 5d/pop-to-ebp +35457 c3/return +35458 +35459 type-category: # a: (addr type-tree) -> result/eax: int +35460 # . prologue +35461 55/push-ebp +35462 89/<- %ebp 4/r32/esp +35463 # . save registers +35464 51/push-ecx +35465 # var lit?/ecx: boolean = is-literal-type?(a) +35466 (is-simple-mu-type? *(ebp+8) 0) # literal => eax +35467 89/<- %ecx 0/r32/eax +35468 # var float?/eax: int = is-float?(a) +35469 (is-simple-mu-type? *(ebp+8) 0xf) # => eax +35470 # set bits for lit? and float? +35471 c1/shift 4/subop/left %ecx 1/imm8 +35472 09/or %eax 1/r32/ecx +35473 $type-category:end: +35474 # . restore registers +35475 59/pop-to-ecx +35476 # . epilogue +35477 89/<- %esp 5/r32/ebp +35478 5d/pop-to-ebp +35479 c3/return +35480 +35481 is-simple-mu-type?: # a: (addr type-tree), n: type-id -> result/eax: boolean +35482 # . prologue +35483 55/push-ebp +35484 89/<- %ebp 4/r32/esp +35485 # . save registers +35486 51/push-ecx +35487 # ecx = n +35488 8b/-> *(ebp+0xc) 1/r32/ecx +35489 # return (a->value == n) +35490 8b/-> *(ebp+8) 0/r32/eax +35491 39/compare *(eax+4) 1/r32/ecx # Type-tree-value +35492 0f 94/set-byte-if-= %al +35493 81 4/subop/and %eax 0xff/imm32 +35494 $is-simple-mu-type?:end: +35495 # . restore registers +35496 59/pop-to-ecx +35497 # . epilogue +35498 89/<- %esp 5/r32/ebp +35499 5d/pop-to-ebp +35500 c3/return +35501 +35502 is-mu-addr-type?: # a: (addr type-tree) -> result/eax: boolean +35503 # . prologue +35504 55/push-ebp +35505 89/<- %ebp 4/r32/esp +35506 # eax = a +35507 8b/-> *(ebp+8) 0/r32/eax +35508 # if (!a->is-atom?) a = a->left +35509 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +35510 { +35511 75/jump-if-!= break/disp8 +35512 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +35513 } +35514 # return (a->value == addr) +35515 81 7/subop/compare *(eax+4) 2/imm32/addr # Type-tree-value +35516 0f 94/set-byte-if-= %al +35517 81 4/subop/and %eax 0xff/imm32 +35518 $is-mu-addr-type?:end: +35519 # . epilogue +35520 89/<- %esp 5/r32/ebp +35521 5d/pop-to-ebp +35522 c3/return +35523 +35524 is-mu-array-type?: # a: (addr type-tree) -> result/eax: boolean +35525 # . prologue +35526 55/push-ebp +35527 89/<- %ebp 4/r32/esp +35528 # eax = a +35529 8b/-> *(ebp+8) 0/r32/eax +35530 # if (!a->is-atom?) a = a->left +35531 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +35532 { +35533 75/jump-if-!= break/disp8 +35534 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +35535 } +35536 # return (a->value == array) +35537 81 7/subop/compare *(eax+4) 3/imm32/array # Type-tree-value +35538 0f 94/set-byte-if-= %al +35539 81 4/subop/and %eax 0xff/imm32 +35540 $is-mu-array-type?:end: +35541 # . epilogue +35542 89/<- %esp 5/r32/ebp +35543 5d/pop-to-ebp +35544 c3/return +35545 +35546 is-mu-string-type?: # a: (addr type-tree) -> result/eax: boolean +35547 # . prologue +35548 55/push-ebp +35549 89/<- %ebp 4/r32/esp +35550 # . save registers +35551 56/push-esi +35552 # esi = a +35553 8b/-> *(ebp+8) 6/r32/esi +35554 # if (a->is-atom?) return false +35555 81 7/subop/compare *esi 0/imm32/false # Type-tree-is-atom +35556 0f 85/jump-if-!= $is-mu-string-type?:return-false/disp32 +35557 # if a is not an addr, return false +35558 (is-mu-addr-type? %esi) # => eax +35559 3d/compare-eax-with 0/imm32/false +35560 0f 84/jump-if-= $is-mu-string-type?:end/disp32 # eax changes var +35561 # if a is not an array, return false +35562 (lookup *(esi+0xc) *(esi+0x10)) # Type-tree-right Type-tree-right => eax +35563 (is-mu-array-type? %eax) # => eax +35564 3d/compare-eax-with 0/imm32/false +35565 74/jump-if-= $is-mu-string-type?:end/disp8 # eax changes var +35566 # var p/eax: (addr type-tree) = payload of a +35567 (lookup *(esi+0xc) *(esi+0x10)) # Type-tree-right Type-tree-right => eax +35568 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +35569 # if p is an atom, return false +35570 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +35571 75/jump-if-!= $is-mu-string-type?:return-false/disp8 +35572 # return (p == byte) +35573 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +35574 (is-simple-mu-type? %eax 8) # byte => eax +35575 eb/jump $is-mu-string-type?:end/disp8 +35576 $is-mu-string-type?:return-false: +35577 b8/copy-to-eax 0/imm32/false +35578 $is-mu-string-type?:end: +35579 # . restore registers +35580 5e/pop-to-esi 35581 # . epilogue 35582 89/<- %esp 5/r32/ebp 35583 5d/pop-to-ebp 35584 c3/return 35585 -35586 test-shift-reg-by-literal: -35587 # var1/ecx <- shift-left 2 -35588 # => -35589 # c1/shift 4/subop/left %ecx 2/imm8 -35590 # -35591 # . prologue -35592 55/push-ebp -35593 89/<- %ebp 4/r32/esp -35594 # setup -35595 (clear-stream _test-output-stream) -35596 (clear-stream $_test-output-buffered-file->buffer) -35597 $test-shift-reg-by-literal:initialize-var-type: -35598 # var type/ecx: (payload type-tree) = int -35599 68/push 0/imm32/right:null -35600 68/push 0/imm32/right:null -35601 68/push 0/imm32/left:unused -35602 68/push 1/imm32/value:int -35603 68/push 1/imm32/is-atom?:true -35604 68/push 0x11/imm32/alloc-id:fake:payload -35605 89/<- %ecx 4/r32/esp -35606 $test-shift-reg-by-literal:initialize-var: -35607 # var v/ecx: (payload var) -35608 68/push 0/imm32/register -35609 68/push 0/imm32/register -35610 68/push 0/imm32/no-stack-offset -35611 68/push 1/imm32/block-depth -35612 51/push-ecx -35613 68/push 0x11/imm32/alloc-id:fake -35614 68/push 0/imm32/name -35615 68/push 0/imm32/name -35616 68/push 0x11/imm32/alloc-id:fake:payload -35617 89/<- %ecx 4/r32/esp -35618 $test-shift-reg-by-literal:initialize-var-name: -35619 # v->name = "v" -35620 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -35621 (copy-array Heap "v" %eax) -35622 $test-shift-reg-by-literal:initialize-var-register: -35623 # v->register = "ecx" -35624 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -35625 (copy-array Heap "ecx" %eax) -35626 $test-shift-reg-by-literal:initialize-literal-type: -35627 # var type/edx: (payload type-tree) = literal -35628 68/push 0/imm32/right:null -35629 68/push 0/imm32/right:null -35630 68/push 0/imm32/left:unused -35631 68/push 0/imm32/value:literal -35632 68/push 1/imm32/is-atom?:true -35633 68/push 0x11/imm32/alloc-id:fake:payload -35634 89/<- %edx 4/r32/esp -35635 $test-shift-reg-by-literal:initialize-literal: -35636 # var l/edx: (payload var) -35637 68/push 0/imm32/register -35638 68/push 0/imm32/register -35639 68/push 0/imm32/no-stack-offset -35640 68/push 1/imm32/block-depth -35641 52/push-edx -35642 68/push 0x11/imm32/alloc-id:fake -35643 68/push 0/imm32/name -35644 68/push 0/imm32/name -35645 68/push 0x11/imm32/alloc-id:fake:payload -35646 89/<- %edx 4/r32/esp -35647 $test-shift-reg-by-literal:initialize-literal-value: -35648 # l->name = "2" -35649 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -35650 (copy-array Heap "2" %eax) -35651 $test-shift-reg-by-literal:initialize-inouts: -35652 # var inouts/esi: (payload stmt-var) = [l] -35653 68/push 0/imm32/is-deref:false -35654 68/push 0/imm32/next -35655 68/push 0/imm32/next -35656 52/push-edx/l -35657 68/push 0x11/imm32/alloc-id:fake -35658 68/push 0x11/imm32/alloc-id:fake:payload -35659 89/<- %esi 4/r32/esp -35660 $test-shift-reg-by-literal:initialize-outputs: -35661 # var outputs/edi: (payload stmt-var) = [v] -35662 68/push 0/imm32/is-deref:false -35663 68/push 0/imm32/next -35664 68/push 0/imm32/next -35665 51/push-ecx/v -35666 68/push 0x11/imm32/alloc-id:fake -35667 68/push 0x11/imm32/alloc-id:fake:payload -35668 89/<- %edi 4/r32/esp -35669 $test-shift-reg-by-literal:initialize-stmt: -35670 # var stmt/esi: (addr statement) -35671 68/push 0/imm32/next -35672 68/push 0/imm32/next -35673 57/push-edi/outputs -35674 68/push 0x11/imm32/alloc-id:fake -35675 56/push-esi/inouts -35676 68/push 0x11/imm32/alloc-id:fake -35677 68/push 0/imm32/operation -35678 68/push 0/imm32/operation -35679 68/push 1/imm32/tag:stmt1 -35680 89/<- %esi 4/r32/esp -35681 $test-shift-reg-by-literal:initialize-stmt-operation: -35682 # stmt->operation = "shift-left" -35683 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -35684 (copy-array Heap "shift-left" %eax) -35685 # convert -35686 c7 0/subop/copy *Curr-block-depth 0/imm32 -35687 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -35688 (flush _test-output-buffered-file) -35689 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -35695 # check output -35696 (check-next-stream-line-equal _test-output-stream "c1/shift 4/subop/left %ecx 2/imm8" "F - test-shift-reg-by-literal") -35697 # . epilogue -35698 89/<- %esp 5/r32/ebp -35699 5d/pop-to-ebp -35700 c3/return -35701 -35702 test-shift-mem-by-literal: -35703 # shift-left var 3 -35704 # => -35705 # c1/shift 4/subop/left *(ebp+8) 3/imm8 -35706 # -35707 # . prologue -35708 55/push-ebp -35709 89/<- %ebp 4/r32/esp -35710 # setup -35711 (clear-stream _test-output-stream) -35712 (clear-stream $_test-output-buffered-file->buffer) -35713 $test-shift-mem-by-literal:initialize-type: -35714 # var type/ecx: (payload type-tree) = int -35715 68/push 0/imm32/right:null -35716 68/push 0/imm32/right:null -35717 68/push 0/imm32/left:unused -35718 68/push 1/imm32/value:int -35719 68/push 1/imm32/is-atom?:true -35720 68/push 0x11/imm32/alloc-id:fake:payload -35721 89/<- %ecx 4/r32/esp -35722 $test-shift-mem-by-literal:initialize-var1: -35723 # var var1/ecx: (payload var) -35724 68/push 0/imm32/register -35725 68/push 0/imm32/register -35726 68/push 8/imm32/stack-offset -35727 68/push 1/imm32/block-depth -35728 51/push-ecx -35729 68/push 0x11/imm32/alloc-id:fake -35730 68/push 0/imm32/name -35731 68/push 0/imm32/name -35732 68/push 0x11/imm32/alloc-id:fake:payload -35733 89/<- %ecx 4/r32/esp -35734 $test-shift-mem-by-literal:initialize-var1-name: -35735 # var1->name = "var1" -35736 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -35737 (copy-array Heap "var1" %eax) -35738 $test-shift-mem-by-literal:initialize-literal-type: -35739 # var type/edx: (payload type-tree) = literal -35740 68/push 0/imm32/right:null -35741 68/push 0/imm32/right:null -35742 68/push 0/imm32/left:unused -35743 68/push 0/imm32/value:literal -35744 68/push 1/imm32/is-atom?:true -35745 68/push 0x11/imm32/alloc-id:fake:payload -35746 89/<- %edx 4/r32/esp -35747 $test-shift-mem-by-literal:initialize-literal: -35748 # var l/edx: (payload var) -35749 68/push 0/imm32/register -35750 68/push 0/imm32/register -35751 68/push 0/imm32/no-stack-offset -35752 68/push 1/imm32/block-depth -35753 52/push-edx -35754 68/push 0x11/imm32/alloc-id:fake -35755 68/push 0/imm32/name -35756 68/push 0/imm32/name -35757 68/push 0x11/imm32/alloc-id:fake:payload -35758 89/<- %edx 4/r32/esp -35759 $test-shift-mem-by-literal:initialize-literal-value: -35760 # l->name = "3" -35761 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -35762 (copy-array Heap "3" %eax) -35763 $test-shift-mem-by-literal:initialize-inouts: -35764 # var inouts/esi: (payload stmt-var) = [l] -35765 68/push 0/imm32/is-deref:false -35766 68/push 0/imm32/next -35767 68/push 0/imm32/next -35768 52/push-edx/l -35769 68/push 0x11/imm32/alloc-id:fake -35770 68/push 0x11/imm32/alloc-id:fake:payload -35771 89/<- %esi 4/r32/esp -35772 # var inouts = (handle stmt-var) = [var1, var2] -35773 68/push 0/imm32/is-deref:false -35774 56/push-esi/next -35775 68/push 0x11/imm32/alloc-id:fake -35776 51/push-ecx/var1 -35777 68/push 0x11/imm32/alloc-id:fake -35778 68/push 0x11/imm32/alloc-id:fake:payload -35779 89/<- %esi 4/r32/esp -35780 $test-shift-mem-by-literal:initialize-stmt: -35781 # var stmt/esi: (addr statement) -35782 68/push 0/imm32/next -35783 68/push 0/imm32/next -35784 68/push 0/imm32/outputs -35785 68/push 0/imm32/outputs -35786 56/push-esi/inouts -35787 68/push 0x11/imm32/alloc-id:fake -35788 68/push 0/imm32/operation +35586 is-mu-stream-type?: # a: (addr type-tree) -> result/eax: boolean +35587 # . prologue +35588 55/push-ebp +35589 89/<- %ebp 4/r32/esp +35590 # eax = a +35591 8b/-> *(ebp+8) 0/r32/eax +35592 # if (!a->is-atom?) a = a->left +35593 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +35594 { +35595 75/jump-if-!= break/disp8 +35596 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +35597 } +35598 # return (a->value == stream) +35599 81 7/subop/compare *(eax+4) 0xb/imm32/stream # Type-tree-value +35600 0f 94/set-byte-if-= %al +35601 81 4/subop/and %eax 0xff/imm32 +35602 $is-mu-stream-type?:end: +35603 # . epilogue +35604 89/<- %esp 5/r32/ebp +35605 5d/pop-to-ebp +35606 c3/return +35607 +35608 test-emit-subx-stmt-primitive: +35609 # Primitive operation on a variable on the stack. +35610 # increment foo +35611 # => +35612 # ff 0/subop/increment *(ebp-8) +35613 # +35614 # There's a variable on the var stack as follows: +35615 # name: 'foo' +35616 # type: int +35617 # stack-offset: -8 +35618 # +35619 # There's a primitive with this info: +35620 # name: 'increment' +35621 # inouts: int/mem +35622 # value: 'ff 0/subop/increment' +35623 # +35624 # . prologue +35625 55/push-ebp +35626 89/<- %ebp 4/r32/esp +35627 # setup +35628 (clear-stream _test-output-stream) +35629 (clear-stream $_test-output-buffered-file->buffer) +35630 # simulate allocated payloads starting with an initial fake alloc-id (0x11) +35631 $test-emit-subx-stmt-primitive:initialize-type: +35632 # var type/ecx: (payload type-tree) = int +35633 68/push 0/imm32/right:null +35634 68/push 0/imm32/right:null +35635 68/push 0/imm32/left:unused +35636 68/push 1/imm32/value:int +35637 68/push 1/imm32/is-atom?:true +35638 68/push 0x11/imm32/alloc-id:fake:payload +35639 89/<- %ecx 4/r32/esp +35640 $test-emit-subx-stmt-primitive:initialize-var: +35641 # var var-foo/ecx: (payload var) = var(type) +35642 68/push 0/imm32/no-register +35643 68/push 0/imm32/no-register +35644 68/push -8/imm32/stack-offset +35645 68/push 1/imm32/block-depth +35646 51/push-ecx/type +35647 68/push 0x11/imm32/alloc-id:fake +35648 68/push 0/imm32/name +35649 68/push 0/imm32/name +35650 68/push 0x11/imm32/alloc-id:fake:payload +35651 89/<- %ecx 4/r32/esp +35652 $test-emit-subx-stmt-primitive:initialize-var-name: +35653 # var-foo->name = "foo" +35654 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +35655 (copy-array Heap "foo" %eax) +35656 $test-emit-subx-stmt-primitive:initialize-stmt-var: +35657 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +35658 68/push 0/imm32/is-deref:false +35659 68/push 0/imm32/next +35660 68/push 0/imm32/next +35661 51/push-ecx/var-foo +35662 68/push 0x11/imm32/alloc-id:fake +35663 68/push 0x11/imm32/alloc-id:fake:payload +35664 89/<- %ebx 4/r32/esp +35665 $test-emit-subx-stmt-primitive:initialize-stmt: +35666 # var stmt/esi: (addr statement) +35667 68/push 0/imm32/no-outputs +35668 68/push 0/imm32/no-outputs +35669 53/push-ebx/inouts +35670 68/push 0x11/imm32/alloc-id:fake +35671 68/push 0/imm32/operation +35672 68/push 0/imm32/operation +35673 68/push 1/imm32/tag +35674 89/<- %esi 4/r32/esp +35675 $test-emit-subx-stmt-primitive:initialize-stmt-operation: +35676 # stmt->operation = "increment" +35677 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +35678 (copy-array Heap "increment" %eax) +35679 $test-emit-subx-stmt-primitive:initialize-primitive: +35680 # var primitives/ebx: (addr primitive) +35681 68/push 0/imm32/next +35682 68/push 0/imm32/next +35683 68/push 0/imm32/no-x32 +35684 68/push 0/imm32/no-xm32 +35685 68/push 0/imm32/no-disp32 +35686 68/push 0/imm32/no-imm8 +35687 68/push 0/imm32/no-imm32 +35688 68/push 0/imm32/no-r32 +35689 68/push 1/imm32/rm32-is-first-inout +35690 68/push 0/imm32/subx-name +35691 68/push 0/imm32/subx-name +35692 68/push 0/imm32/no-outputs +35693 68/push 0/imm32/no-outputs +35694 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +35695 68/push 0x11/imm32/alloc-id:fake +35696 68/push 0/imm32/name +35697 68/push 0/imm32/name +35698 89/<- %ebx 4/r32/esp +35699 $test-emit-subx-stmt-primitive:initialize-primitive-name: +35700 # primitives->name = "increment" +35701 (copy-array Heap "increment" %ebx) # Primitive-name +35702 $test-emit-subx-stmt-primitive:initialize-primitive-subx-name: +35703 # primitives->subx-name = "ff 0/subop/increment" +35704 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +35705 (copy-array Heap "ff 0/subop/increment" %eax) +35706 # convert +35707 c7 0/subop/copy *Curr-block-depth 0/imm32 +35708 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0 Stderr 0) +35709 (flush _test-output-buffered-file) +35710 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +35716 # check output +35717 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive") +35718 # . epilogue +35719 89/<- %esp 5/r32/ebp +35720 5d/pop-to-ebp +35721 c3/return +35722 +35723 test-emit-subx-stmt-primitive-register: +35724 # Primitive operation on a variable in a register. +35725 # foo <- increment +35726 # => +35727 # ff 0/subop/increment %eax # sub-optimal, but should suffice +35728 # +35729 # There's a variable on the var stack as follows: +35730 # name: 'foo' +35731 # type: int +35732 # register: 'eax' +35733 # +35734 # There's a primitive with this info: +35735 # name: 'increment' +35736 # out: int/reg +35737 # value: 'ff 0/subop/increment' +35738 # +35739 # . prologue +35740 55/push-ebp +35741 89/<- %ebp 4/r32/esp +35742 # setup +35743 (clear-stream _test-output-stream) +35744 (clear-stream $_test-output-buffered-file->buffer) +35745 $test-emit-subx-stmt-primitive-register:initialize-type: +35746 # var type/ecx: (payload type-tree) = int +35747 68/push 0/imm32/right:null +35748 68/push 0/imm32/right:null +35749 68/push 0/imm32/left:unused +35750 68/push 1/imm32/value:int +35751 68/push 1/imm32/is-atom?:true +35752 68/push 0x11/imm32/alloc-id:fake:payload +35753 89/<- %ecx 4/r32/esp +35754 $test-emit-subx-stmt-primitive-register:initialize-var: +35755 # var var-foo/ecx: (payload var) +35756 68/push 0/imm32/register +35757 68/push 0/imm32/register +35758 68/push 0/imm32/no-stack-offset +35759 68/push 1/imm32/block-depth +35760 51/push-ecx +35761 68/push 0x11/imm32/alloc-id:fake +35762 68/push 0/imm32/name +35763 68/push 0/imm32/name +35764 68/push 0x11/imm32/alloc-id:fake:payload +35765 89/<- %ecx 4/r32/esp +35766 $test-emit-subx-stmt-primitive-register:initialize-var-name: +35767 # var-foo->name = "foo" +35768 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +35769 (copy-array Heap "foo" %eax) +35770 $test-emit-subx-stmt-primitive-register:initialize-var-register: +35771 # var-foo->register = "eax" +35772 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +35773 (copy-array Heap "eax" %eax) +35774 $test-emit-subx-stmt-primitive-register:initialize-stmt-var: +35775 # var operand/ebx: (payload stmt-var) +35776 68/push 0/imm32/is-deref:false +35777 68/push 0/imm32/next +35778 68/push 0/imm32/next +35779 51/push-ecx/var-foo +35780 68/push 0x11/imm32/alloc-id:fake +35781 68/push 0x11/imm32/alloc-id:fake:payload +35782 89/<- %ebx 4/r32/esp +35783 $test-emit-subx-stmt-primitive-register:initialize-stmt: +35784 # var stmt/esi: (addr statement) +35785 53/push-ebx/outputs +35786 68/push 0x11/imm32/alloc-id:fake +35787 68/push 0/imm32/no-inouts +35788 68/push 0/imm32/no-inouts 35789 68/push 0/imm32/operation -35790 68/push 1/imm32/tag:stmt1 -35791 89/<- %esi 4/r32/esp -35792 $test-shift-mem-by-literal:initialize-stmt-operation: -35793 # stmt->operation = "shift-left" -35794 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -35795 (copy-array Heap "shift-left" %eax) -35796 # convert -35797 c7 0/subop/copy *Curr-block-depth 0/imm32 -35798 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -35799 (flush _test-output-buffered-file) -35800 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -35806 # check output -35807 (check-next-stream-line-equal _test-output-stream "c1/shift 4/subop/left *(ebp+0x00000008) 3/imm8" "F - test-shift-mem-by-literal") -35808 # . epilogue -35809 89/<- %esp 5/r32/ebp -35810 5d/pop-to-ebp -35811 c3/return -35812 -35813 test-compare-reg-with-reg: -35814 # compare var1/ecx, var2/eax -35815 # => -35816 # 39/compare %ecx 0/r32/eax -35817 # -35818 # . prologue -35819 55/push-ebp -35820 89/<- %ebp 4/r32/esp -35821 # setup -35822 (clear-stream _test-output-stream) -35823 (clear-stream $_test-output-buffered-file->buffer) -35824 $test-compare-reg-with-reg:initialize-type: -35825 # var type/ecx: (payload type-tree) = int -35826 68/push 0/imm32/right:null -35827 68/push 0/imm32/right:null -35828 68/push 0/imm32/left:unused -35829 68/push 1/imm32/value:int -35830 68/push 1/imm32/is-atom?:true -35831 68/push 0x11/imm32/alloc-id:fake:payload -35832 89/<- %ecx 4/r32/esp -35833 $test-compare-reg-with-reg:initialize-var1: -35834 # var var1/ecx: (payload var) -35835 68/push 0/imm32/register -35836 68/push 0/imm32/register -35837 68/push 0/imm32/no-stack-offset -35838 68/push 1/imm32/block-depth -35839 51/push-ecx -35840 68/push 0x11/imm32/alloc-id:fake -35841 68/push 0/imm32/name +35790 68/push 0/imm32/operation +35791 68/push 1/imm32 +35792 89/<- %esi 4/r32/esp +35793 $test-emit-subx-stmt-primitive-register:initialize-stmt-operation: +35794 # stmt->operation = "increment" +35795 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +35796 (copy-array Heap "increment" %eax) +35797 $test-emit-subx-stmt-primitive-register:initialize-formal-var: +35798 # var formal-var/ebx: (payload var) +35799 68/push 0/imm32/register +35800 68/push 0/imm32/register +35801 68/push 0/imm32/no-stack-offset +35802 68/push 1/imm32/block-depth +35803 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +35804 68/push 0x11/imm32/alloc-id:fake +35805 68/push 0/imm32/name +35806 68/push 0/imm32/name +35807 68/push 0x11/imm32/alloc-id:fake:payload +35808 89/<- %ebx 4/r32/esp +35809 $test-emit-subx-stmt-primitive-register:initialize-formal-var-name: +35810 # formal-var->name = "dummy" +35811 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +35812 (copy-array Heap "dummy" %eax) +35813 $test-emit-subx-stmt-primitive-register:initialize-formal-register: +35814 # formal-var->register = "*" +35815 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +35816 (copy-array Heap "*" %eax) # Any-register +35817 $test-emit-subx-stmt-primitive-register:initialize-var-list: +35818 # var formal-outputs/ebx: (payload list var) +35819 68/push 0/imm32/next +35820 68/push 0/imm32/next +35821 53/push-ebx/formal-var +35822 68/push 0x11/imm32/alloc-id:fake +35823 68/push 0x11/imm32/alloc-id:fake:payload +35824 89/<- %ebx 4/r32/esp +35825 $test-emit-subx-stmt-primitive-register:initialize-primitive: +35826 # var primitives/ebx: (addr primitive) +35827 68/push 0/imm32/next +35828 68/push 0/imm32/next +35829 68/push 0/imm32/no-x32 +35830 68/push 0/imm32/no-xm32 +35831 68/push 0/imm32/no-disp32 +35832 68/push 0/imm32/no-imm8 +35833 68/push 0/imm32/no-imm32 +35834 68/push 0/imm32/no-r32 +35835 68/push 3/imm32/rm32-is-first-output +35836 68/push 0/imm32/subx-name +35837 68/push 0/imm32/subx-name +35838 53/push-ebx/outputs +35839 68/push 0x11/imm32/alloc-id:fake +35840 68/push 0/imm32/no-inouts +35841 68/push 0/imm32/no-inouts 35842 68/push 0/imm32/name -35843 68/push 0x11/imm32/alloc-id:fake:payload -35844 89/<- %ecx 4/r32/esp -35845 $test-compare-reg-with-reg:initialize-var1-name: -35846 # var1->name = "var1" -35847 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -35848 (copy-array Heap "var1" %eax) -35849 $test-compare-reg-with-reg:initialize-var1-register: -35850 # var1->register = "ecx" -35851 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -35852 (copy-array Heap "ecx" %eax) -35853 $test-compare-reg-with-reg:initialize-var2: -35854 # var var2/edx: (payload var) -35855 68/push 0/imm32/register -35856 68/push 0/imm32/register -35857 68/push 0/imm32/no-stack-offset -35858 68/push 1/imm32/block-depth -35859 ff 6/subop/push *(ecx+0x10) -35860 68/push 0x11/imm32/alloc-id:fake -35861 68/push 0/imm32/name -35862 68/push 0/imm32/name -35863 68/push 0x11/imm32/alloc-id:fake:payload -35864 89/<- %edx 4/r32/esp -35865 $test-compare-reg-with-reg:initialize-var2-name: -35866 # var2->name = "var2" -35867 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -35868 (copy-array Heap "var2" %eax) -35869 $test-compare-reg-with-reg:initialize-var2-register: -35870 # var2->register = "eax" -35871 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -35872 (copy-array Heap "eax" %eax) -35873 $test-compare-reg-with-reg:initialize-inouts: -35874 # var inouts/esi: (payload stmt-var) = [var2] -35875 68/push 0/imm32/is-deref:false -35876 68/push 0/imm32/next -35877 68/push 0/imm32/next -35878 52/push-edx/var2 -35879 68/push 0x11/imm32/alloc-id:fake -35880 68/push 0x11/imm32/alloc-id:fake:payload -35881 89/<- %esi 4/r32/esp -35882 # inouts = [var1, var2] -35883 68/push 0/imm32/is-deref:false -35884 56/push-esi/next -35885 68/push 0x11/imm32/alloc-id:fake -35886 51/push-ecx/var1 -35887 68/push 0x11/imm32/alloc-id:fake -35888 68/push 0x11/imm32/alloc-id:fake:payload -35889 89/<- %esi 4/r32/esp -35890 $test-compare-reg-with-reg:initialize-stmt: -35891 # var stmt/esi: (addr statement) -35892 68/push 0/imm32/next -35893 68/push 0/imm32/next -35894 68/push 0/imm32/outputs -35895 68/push 0/imm32/outputs -35896 56/push-esi/inouts -35897 68/push 0x11/imm32/alloc-id:fake -35898 68/push 0/imm32/operation -35899 68/push 0/imm32/operation -35900 68/push 1/imm32/tag:stmt1 -35901 89/<- %esi 4/r32/esp -35902 $test-compare-reg-with-reg:initialize-stmt-operation: -35903 # stmt->operation = "compare" -35904 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -35905 (copy-array Heap "compare" %eax) -35906 # convert -35907 c7 0/subop/copy *Curr-block-depth 0/imm32 -35908 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -35909 (flush _test-output-buffered-file) -35910 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -35916 # check output -35917 (check-next-stream-line-equal _test-output-stream "39/compare-> %ecx 0x00000000/r32" "F - test-compare-reg-with-reg") -35918 # . epilogue -35919 89/<- %esp 5/r32/ebp -35920 5d/pop-to-ebp -35921 c3/return -35922 -35923 test-compare-mem-with-reg: -35924 # compare var1, var2/eax -35925 # => -35926 # 39/compare *(ebp+___) 0/r32/eax -35927 # -35928 # . prologue -35929 55/push-ebp -35930 89/<- %ebp 4/r32/esp -35931 # setup -35932 (clear-stream _test-output-stream) -35933 (clear-stream $_test-output-buffered-file->buffer) -35934 $test-compare-mem-with-reg:initialize-type: -35935 # var type/ecx: (payload type-tree) = int -35936 68/push 0/imm32/right:null -35937 68/push 0/imm32/right:null -35938 68/push 0/imm32/left:unused -35939 68/push 1/imm32/value:int -35940 68/push 1/imm32/is-atom?:true -35941 68/push 0x11/imm32/alloc-id:fake:payload -35942 89/<- %ecx 4/r32/esp -35943 $test-compare-mem-with-reg:initialize-var1: -35944 # var var1/ecx: (payload var) -35945 68/push 0/imm32/register -35946 68/push 0/imm32/register -35947 68/push 8/imm32/stack-offset -35948 68/push 1/imm32/block-depth -35949 51/push-ecx -35950 68/push 0x11/imm32/alloc-id:fake -35951 68/push 0/imm32/name -35952 68/push 0/imm32/name -35953 68/push 0x11/imm32/alloc-id:fake:payload -35954 89/<- %ecx 4/r32/esp -35955 $test-compare-mem-with-reg:initialize-var1-name: -35956 # var1->name = "var1" -35957 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -35958 (copy-array Heap "var1" %eax) -35959 $test-compare-mem-with-reg:initialize-var2: -35960 # var var2/edx: (payload var) -35961 68/push 0/imm32/register -35962 68/push 0/imm32/register -35963 68/push 0/imm32/no-stack-offset -35964 68/push 1/imm32/block-depth -35965 ff 6/subop/push *(ecx+0x10) -35966 68/push 0x11/imm32/alloc-id:fake -35967 68/push 0/imm32/name -35968 68/push 0/imm32/name -35969 68/push 0x11/imm32/alloc-id:fake:payload -35970 89/<- %edx 4/r32/esp -35971 $test-compare-mem-with-reg:initialize-var2-name: -35972 # var2->name = "var2" -35973 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -35974 (copy-array Heap "var2" %eax) -35975 $test-compare-mem-with-reg:initialize-var2-register: -35976 # var2->register = "eax" -35977 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -35978 (copy-array Heap "eax" %eax) -35979 $test-compare-mem-with-reg:initialize-inouts: -35980 # var inouts/esi: (payload stmt-var) = [var2] -35981 68/push 0/imm32/is-deref:false -35982 68/push 0/imm32/next -35983 68/push 0/imm32/next -35984 52/push-edx/var2 -35985 68/push 0x11/imm32/alloc-id:fake -35986 68/push 0x11/imm32/alloc-id:fake:payload -35987 89/<- %esi 4/r32/esp -35988 # inouts = [var1, var2] -35989 68/push 0/imm32/is-deref:false -35990 56/push-esi/next -35991 68/push 0x11/imm32/alloc-id:fake -35992 51/push-ecx/var1 -35993 68/push 0x11/imm32/alloc-id:fake -35994 68/push 0x11/imm32/alloc-id:fake:payload -35995 89/<- %esi 4/r32/esp -35996 $test-compare-mem-with-reg:initialize-stmt: -35997 # var stmt/esi: (addr statement) -35998 68/push 0/imm32/next -35999 68/push 0/imm32/next -36000 68/push 0/imm32/outputs -36001 68/push 0/imm32/outputs -36002 56/push-esi/inouts -36003 68/push 0x11/imm32/alloc-id:fake -36004 68/push 0/imm32/operation -36005 68/push 0/imm32/operation -36006 68/push 1/imm32/tag:stmt1 -36007 89/<- %esi 4/r32/esp -36008 $test-compare-mem-with-reg:initialize-stmt-operation: -36009 # stmt->operation = "compare" -36010 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -36011 (copy-array Heap "compare" %eax) -36012 # convert -36013 c7 0/subop/copy *Curr-block-depth 0/imm32 -36014 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -36015 (flush _test-output-buffered-file) -36016 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -36022 # check output -36023 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg") -36024 # . epilogue -36025 89/<- %esp 5/r32/ebp -36026 5d/pop-to-ebp -36027 c3/return -36028 -36029 test-compare-reg-with-mem: -36030 # compare var1/eax, var2 -36031 # => -36032 # 3b/compare<- *(ebp+___) 0/r32/eax -36033 # -36034 # . prologue -36035 55/push-ebp -36036 89/<- %ebp 4/r32/esp -36037 # setup -36038 (clear-stream _test-output-stream) -36039 (clear-stream $_test-output-buffered-file->buffer) -36040 $test-compare-reg-with-mem:initialize-type: -36041 # var type/ecx: (payload type-tree) = int -36042 68/push 0/imm32/right:null -36043 68/push 0/imm32/right:null -36044 68/push 0/imm32/left:unused -36045 68/push 1/imm32/value:int -36046 68/push 1/imm32/is-atom?:true -36047 68/push 0x11/imm32/alloc-id:fake:payload -36048 89/<- %ecx 4/r32/esp -36049 $test-compare-reg-with-mem:initialize-var1: -36050 # var var1/ecx: (payload var) -36051 68/push 0/imm32/register -36052 68/push 0/imm32/register -36053 68/push 0/imm32/no-stack-offset -36054 68/push 1/imm32/block-depth -36055 51/push-ecx -36056 68/push 0x11/imm32/alloc-id:fake -36057 68/push 0/imm32/name -36058 68/push 0/imm32/name -36059 68/push 0x11/imm32/alloc-id:fake:payload -36060 89/<- %ecx 4/r32/esp -36061 $test-compare-reg-with-mem:initialize-var1-name: -36062 # var1->name = "var1" -36063 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -36064 (copy-array Heap "var1" %eax) -36065 $test-compare-reg-with-mem:initialize-var1-register: -36066 # var1->register = "eax" -36067 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -36068 (copy-array Heap "eax" %eax) -36069 $test-compare-reg-with-mem:initialize-var2: -36070 # var var2/edx: (payload var) -36071 68/push 0/imm32/register -36072 68/push 0/imm32/register -36073 68/push 8/imm32/stack-offset -36074 68/push 1/imm32/block-depth -36075 ff 6/subop/push *(ecx+0x10) -36076 68/push 0x11/imm32/alloc-id:fake -36077 68/push 0/imm32/name -36078 68/push 0/imm32/name +35843 68/push 0/imm32/name +35844 89/<- %ebx 4/r32/esp +35845 $test-emit-subx-stmt-primitive-register:initialize-primitive-name: +35846 # primitives->name = "increment" +35847 (copy-array Heap "increment" %ebx) # Primitive-name +35848 $test-emit-subx-stmt-primitive-register:initialize-primitive-subx-name: +35849 # primitives->subx-name = "ff 0/subop/increment" +35850 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +35851 (copy-array Heap "ff 0/subop/increment" %eax) +35852 # convert +35853 c7 0/subop/copy *Curr-block-depth 0/imm32 +35854 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0 Stderr 0) +35855 (flush _test-output-buffered-file) +35856 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +35862 # check output +35863 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register") +35864 # . epilogue +35865 89/<- %esp 5/r32/ebp +35866 5d/pop-to-ebp +35867 c3/return +35868 +35869 test-emit-subx-stmt-select-primitive: +35870 # Select the right primitive between overloads. +35871 # foo <- increment +35872 # => +35873 # ff 0/subop/increment %eax # sub-optimal, but should suffice +35874 # +35875 # There's a variable on the var stack as follows: +35876 # name: 'foo' +35877 # type: int +35878 # register: 'eax' +35879 # +35880 # There's two primitives, as follows: +35881 # - name: 'increment' +35882 # out: int/reg +35883 # value: 'ff 0/subop/increment' +35884 # - name: 'increment' +35885 # inout: int/mem +35886 # value: 'ff 0/subop/increment' +35887 # +35888 # . prologue +35889 55/push-ebp +35890 89/<- %ebp 4/r32/esp +35891 # setup +35892 (clear-stream _test-output-stream) +35893 (clear-stream $_test-output-buffered-file->buffer) +35894 $test-emit-subx-stmt-select-primitive:initialize-type: +35895 # var type/ecx: (payload type-tree) = int +35896 68/push 0/imm32/right:null +35897 68/push 0/imm32/right:null +35898 68/push 0/imm32/left:unused +35899 68/push 1/imm32/value:int +35900 68/push 1/imm32/is-atom?:true +35901 68/push 0x11/imm32/alloc-id:fake:payload +35902 89/<- %ecx 4/r32/esp +35903 $test-emit-subx-stmt-select-primitive:initialize-var: +35904 # var var-foo/ecx: (payload var) +35905 68/push 0/imm32/register +35906 68/push 0/imm32/register +35907 68/push 0/imm32/no-stack-offset +35908 68/push 1/imm32/block-depth +35909 51/push-ecx +35910 68/push 0x11/imm32/alloc-id:fake +35911 68/push 0/imm32/name +35912 68/push 0/imm32/name +35913 68/push 0x11/imm32/alloc-id:fake:payload +35914 89/<- %ecx 4/r32/esp +35915 $test-emit-subx-stmt-select-primitive:initialize-var-name: +35916 # var-foo->name = "foo" +35917 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +35918 (copy-array Heap "foo" %eax) +35919 $test-emit-subx-stmt-select-primitive:initialize-var-register: +35920 # var-foo->register = "eax" +35921 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +35922 (copy-array Heap "eax" %eax) +35923 $test-emit-subx-stmt-select-primitive:initialize-stmt-var: +35924 # var operand/ebx: (payload stmt-var) +35925 68/push 0/imm32/is-deref:false +35926 68/push 0/imm32/next +35927 68/push 0/imm32/next +35928 51/push-ecx/var-foo +35929 68/push 0x11/imm32/alloc-id:fake +35930 68/push 0x11/imm32/alloc-id:fake:payload +35931 89/<- %ebx 4/r32/esp +35932 $test-emit-subx-stmt-select-primitive:initialize-stmt: +35933 # var stmt/esi: (addr statement) +35934 53/push-ebx/outputs +35935 68/push 0x11/imm32/alloc-id:fake +35936 68/push 0/imm32/no-inouts +35937 68/push 0/imm32/no-inouts +35938 68/push 0/imm32/operation +35939 68/push 0/imm32/operation +35940 68/push 1/imm32 +35941 89/<- %esi 4/r32/esp +35942 $test-emit-subx-stmt-select-primitive:initialize-stmt-operation: +35943 # stmt->operation = "increment" +35944 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +35945 (copy-array Heap "increment" %eax) +35946 $test-emit-subx-stmt-select-primitive:initialize-formal-var: +35947 # var formal-var/ebx: (payload var) +35948 68/push 0/imm32/register +35949 68/push 0/imm32/register +35950 68/push 0/imm32/no-stack-offset +35951 68/push 1/imm32/block-depth +35952 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +35953 68/push 0x11/imm32/alloc-id:fake +35954 68/push 0/imm32/name +35955 68/push 0/imm32/name +35956 68/push 0x11/imm32/alloc-id:fake:payload +35957 89/<- %ebx 4/r32/esp +35958 $test-emit-subx-stmt-select-primitive:initialize-formal-var-name: +35959 # formal-var->name = "dummy" +35960 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +35961 (copy-array Heap "dummy" %eax) +35962 $test-emit-subx-stmt-select-primitive:initialize-formal-register: +35963 # formal-var->register = "*" +35964 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +35965 (copy-array Heap "*" %eax) # Any-register +35966 $test-emit-subx-stmt-select-primitive:initialize-var-list: +35967 # var formal-outputs/ebx: (payload list var) +35968 68/push 0/imm32/next +35969 68/push 0/imm32/next +35970 53/push-ebx/formal-var +35971 68/push 0x11/imm32/alloc-id:fake +35972 68/push 0x11/imm32/alloc-id:fake:payload +35973 89/<- %ebx 4/r32/esp +35974 $test-emit-subx-stmt-select-primitive:initialize-primitive2: +35975 # var primitive2/edi: (payload primitive) +35976 68/push 0/imm32/next +35977 68/push 0/imm32/next +35978 68/push 0/imm32/no-x32 +35979 68/push 0/imm32/no-xm32 +35980 68/push 0/imm32/no-disp32 +35981 68/push 0/imm32/no-imm8 +35982 68/push 0/imm32/no-imm32 +35983 68/push 0/imm32/no-r32 +35984 68/push 3/imm32/rm32-is-first-output +35985 68/push 0/imm32/subx-name +35986 68/push 0/imm32/subx-name +35987 53/push-ebx/outputs +35988 68/push 0x11/imm32/alloc-id:fake +35989 68/push 0/imm32/no-inouts +35990 68/push 0/imm32/no-inouts +35991 68/push 0/imm32/name +35992 68/push 0/imm32/name +35993 68/push 0x11/imm32/alloc-id:fake:payload +35994 89/<- %edi 4/r32/esp +35995 $test-emit-subx-stmt-select-primitive:initialize-primitive2-name: +35996 # primitives->name = "increment" +35997 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 +35998 (copy-array Heap "increment" %eax) +35999 $test-emit-subx-stmt-select-primitive:initialize-primitive2-subx-name: +36000 # primitives->subx-name = "ff 0/subop/increment" +36001 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 +36002 (copy-array Heap "ff 0/subop/increment" %eax) +36003 $test-emit-subx-stmt-select-primitive:initialize-primitive: +36004 # var primitives/ebx: (addr primitive) +36005 57/push-edi +36006 68/push 0x11/imm32/alloc-id:fake +36007 68/push 0/imm32/no-x32 +36008 68/push 0/imm32/no-xm32 +36009 68/push 0/imm32/no-disp32 +36010 68/push 0/imm32/no-imm8 +36011 68/push 0/imm32/no-imm32 +36012 68/push 0/imm32/no-r32 +36013 68/push 1/imm32/rm32-is-first-inout +36014 68/push 0/imm32/subx-name +36015 68/push 0/imm32/subx-name +36016 68/push 0/imm32/no-outputs +36017 68/push 0/imm32/no-outputs +36018 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +36019 68/push 0x11/imm32/alloc-id:fake +36020 68/push 0/imm32/name +36021 68/push 0/imm32/name +36022 89/<- %ebx 4/r32/esp +36023 $test-emit-subx-stmt-select-primitive:initialize-primitive-name: +36024 # primitives->name = "increment" +36025 (copy-array Heap "increment" %ebx) # Primitive-name +36026 $test-emit-subx-stmt-select-primitive:initialize-primitive-subx-name: +36027 # primitives->subx-name = "ff 0/subop/increment" +36028 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +36029 (copy-array Heap "ff 0/subop/increment" %eax) +36030 # convert +36031 c7 0/subop/copy *Curr-block-depth 0/imm32 +36032 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0 Stderr 0) +36033 (flush _test-output-buffered-file) +36034 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +36040 # check output +36041 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive") +36042 # . epilogue +36043 89/<- %esp 5/r32/ebp +36044 5d/pop-to-ebp +36045 c3/return +36046 +36047 test-emit-subx-stmt-select-primitive-2: +36048 # Select the right primitive between overloads. +36049 # increment foo +36050 # => +36051 # ff 0/subop/increment %eax # sub-optimal, but should suffice +36052 # +36053 # There's a variable on the var stack as follows: +36054 # name: 'foo' +36055 # type: int +36056 # register: 'eax' +36057 # +36058 # There's two primitives, as follows: +36059 # - name: 'increment' +36060 # out: int/reg +36061 # value: 'ff 0/subop/increment' +36062 # - name: 'increment' +36063 # inout: int/mem +36064 # value: 'ff 0/subop/increment' +36065 # +36066 # . prologue +36067 55/push-ebp +36068 89/<- %ebp 4/r32/esp +36069 # setup +36070 (clear-stream _test-output-stream) +36071 (clear-stream $_test-output-buffered-file->buffer) +36072 $test-emit-subx-stmt-select-primitive-2:initialize-type: +36073 # var type/ecx: (payload type-tree) = int +36074 68/push 0/imm32/right:null +36075 68/push 0/imm32/right:null +36076 68/push 0/imm32/left:unused +36077 68/push 1/imm32/value:int +36078 68/push 1/imm32/is-atom?:true 36079 68/push 0x11/imm32/alloc-id:fake:payload -36080 89/<- %edx 4/r32/esp -36081 $test-compare-reg-with-mem:initialize-var2-name: -36082 # var2->name = "var2" -36083 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -36084 (copy-array Heap "var2" %eax) -36085 $test-compare-reg-with-mem:initialize-inouts: -36086 # var inouts/esi: (payload stmt-var) = [var2] -36087 68/push 0/imm32/is-deref:false -36088 68/push 0/imm32/next -36089 68/push 0/imm32/next -36090 52/push-edx/var2 -36091 68/push 0x11/imm32/alloc-id:fake -36092 68/push 0x11/imm32/alloc-id:fake:payload -36093 89/<- %esi 4/r32/esp -36094 # inouts = [var1, var2] -36095 68/push 0/imm32/is-deref:false -36096 56/push-esi/next -36097 68/push 0x11/imm32/alloc-id:fake -36098 51/push-ecx/var1 -36099 68/push 0x11/imm32/alloc-id:fake -36100 68/push 0x11/imm32/alloc-id:fake:payload -36101 89/<- %esi 4/r32/esp -36102 $test-compare-reg-with-mem:initialize-stmt: -36103 # var stmt/esi: (addr statement) +36080 89/<- %ecx 4/r32/esp +36081 $test-emit-subx-stmt-select-primitive-2:initialize-var: +36082 # var var-foo/ecx: (payload var) +36083 68/push 0/imm32/register +36084 68/push 0/imm32/register +36085 68/push 0/imm32/no-stack-offset +36086 68/push 1/imm32/block-depth +36087 51/push-ecx +36088 68/push 0x11/imm32/alloc-id:fake +36089 68/push 0/imm32/name +36090 68/push 0/imm32/name +36091 68/push 0x11/imm32/alloc-id:fake:payload +36092 89/<- %ecx 4/r32/esp +36093 $test-emit-subx-stmt-select-primitive-2:initialize-var-name: +36094 # var-foo->name = "foo" +36095 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +36096 (copy-array Heap "foo" %eax) +36097 $test-emit-subx-stmt-select-primitive-2:initialize-var-register: +36098 # var-foo->register = "eax" +36099 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +36100 (copy-array Heap "eax" %eax) +36101 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-var: +36102 # var operand/ebx: (payload stmt-var) +36103 68/push 0/imm32/is-deref:false 36104 68/push 0/imm32/next 36105 68/push 0/imm32/next -36106 68/push 0/imm32/outputs -36107 68/push 0/imm32/outputs -36108 56/push-esi/inouts -36109 68/push 0x11/imm32/alloc-id:fake -36110 68/push 0/imm32/operation -36111 68/push 0/imm32/operation -36112 68/push 1/imm32/tag:stmt1 -36113 89/<- %esi 4/r32/esp -36114 $test-compare-reg-with-mem:initialize-stmt-operation: -36115 # stmt->operation = "compare" -36116 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -36117 (copy-array Heap "compare" %eax) -36118 # convert -36119 c7 0/subop/copy *Curr-block-depth 0/imm32 -36120 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -36121 (flush _test-output-buffered-file) -36122 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -36128 # check output -36129 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem") -36130 # . epilogue -36131 89/<- %esp 5/r32/ebp -36132 5d/pop-to-ebp -36133 c3/return -36134 -36135 test-compare-mem-with-literal: -36136 # compare var1, 0x34 -36137 # => -36138 # 81 7/subop/compare *(ebp+___) 0x34/imm32 -36139 # -36140 # . prologue -36141 55/push-ebp -36142 89/<- %ebp 4/r32/esp -36143 # setup -36144 (clear-stream _test-output-stream) -36145 (clear-stream $_test-output-buffered-file->buffer) -36146 $test-compare-mem-with-literal:initialize-type: -36147 # var type/ecx: (payload type-tree) = int -36148 68/push 0/imm32/right:null -36149 68/push 0/imm32/right:null -36150 68/push 0/imm32/left:unused -36151 68/push 1/imm32/value:int -36152 68/push 1/imm32/is-atom?:true -36153 68/push 0x11/imm32/alloc-id:fake:payload -36154 89/<- %ecx 4/r32/esp -36155 $test-compare-mem-with-literal:initialize-var1: -36156 # var var1/ecx: (payload var) -36157 68/push 0/imm32/register -36158 68/push 0/imm32/register -36159 68/push 8/imm32/stack-offset -36160 68/push 1/imm32/block-depth -36161 51/push-ecx -36162 68/push 0x11/imm32/alloc-id:fake -36163 68/push 0/imm32/name -36164 68/push 0/imm32/name -36165 68/push 0x11/imm32/alloc-id:fake:payload -36166 89/<- %ecx 4/r32/esp -36167 $test-compare-mem-with-literal:initialize-var1-name: -36168 # var1->name = "var1" -36169 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -36170 (copy-array Heap "var1" %eax) -36171 $test-compare-mem-with-literal:initialize-literal-type: -36172 # var type/edx: (payload type-tree) = literal -36173 68/push 0/imm32/right:null -36174 68/push 0/imm32/right:null -36175 68/push 0/imm32/left:unused -36176 68/push 0/imm32/value:literal -36177 68/push 1/imm32/is-atom?:true -36178 68/push 0x11/imm32/alloc-id:fake:payload -36179 89/<- %edx 4/r32/esp -36180 $test-compare-mem-with-literal:initialize-literal: -36181 # var l/edx: (payload var) -36182 68/push 0/imm32/register -36183 68/push 0/imm32/register -36184 68/push 0/imm32/no-stack-offset -36185 68/push 1/imm32/block-depth -36186 52/push-edx -36187 68/push 0x11/imm32/alloc-id:fake -36188 68/push 0/imm32/name -36189 68/push 0/imm32/name -36190 68/push 0x11/imm32/alloc-id:fake:payload -36191 89/<- %edx 4/r32/esp -36192 $test-compare-mem-with-literal:initialize-literal-value: -36193 # l->name = "0x34" -36194 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -36195 (copy-array Heap "0x34" %eax) -36196 $test-compare-mem-with-literal:initialize-inouts: -36197 # var inouts/esi: (payload stmt-var) = [l] -36198 68/push 0/imm32/is-deref:false -36199 68/push 0/imm32/next -36200 68/push 0/imm32/next -36201 52/push-edx/l -36202 68/push 0x11/imm32/alloc-id:fake -36203 68/push 0x11/imm32/alloc-id:fake:payload -36204 89/<- %esi 4/r32/esp -36205 # var inouts = (handle stmt-var) = [var1, var2] -36206 68/push 0/imm32/is-deref:false -36207 56/push-esi/next -36208 68/push 0x11/imm32/alloc-id:fake -36209 51/push-ecx/var1 -36210 68/push 0x11/imm32/alloc-id:fake -36211 68/push 0x11/imm32/alloc-id:fake:payload -36212 89/<- %esi 4/r32/esp -36213 $test-compare-mem-with-literal:initialize-stmt: -36214 # var stmt/esi: (addr statement) -36215 68/push 0/imm32/next -36216 68/push 0/imm32/next -36217 68/push 0/imm32/outputs -36218 68/push 0/imm32/outputs -36219 56/push-esi/inouts -36220 68/push 0x11/imm32/alloc-id:fake -36221 68/push 0/imm32/operation -36222 68/push 0/imm32/operation -36223 68/push 1/imm32/tag:stmt1 -36224 89/<- %esi 4/r32/esp -36225 $test-compare-mem-with-literal:initialize-stmt-operation: -36226 # stmt->operation = "compare" -36227 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -36228 (copy-array Heap "compare" %eax) -36229 # convert -36230 c7 0/subop/copy *Curr-block-depth 0/imm32 -36231 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -36232 (flush _test-output-buffered-file) -36233 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -36239 # check output -36240 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal") -36241 # . epilogue -36242 89/<- %esp 5/r32/ebp -36243 5d/pop-to-ebp -36244 c3/return -36245 -36246 test-compare-eax-with-literal: -36247 # compare var1/eax 0x34 -36248 # => -36249 # 3d/compare-eax-with 0x34/imm32 -36250 # -36251 # . prologue -36252 55/push-ebp -36253 89/<- %ebp 4/r32/esp -36254 # setup -36255 (clear-stream _test-output-stream) -36256 (clear-stream $_test-output-buffered-file->buffer) -36257 $test-compare-eax-with-literal:initialize-type: -36258 # var type/ecx: (payload type-tree) = int -36259 68/push 0/imm32/right:null -36260 68/push 0/imm32/right:null -36261 68/push 0/imm32/left:unused -36262 68/push 1/imm32/value:int -36263 68/push 1/imm32/is-atom?:true -36264 68/push 0x11/imm32/alloc-id:fake:payload -36265 89/<- %ecx 4/r32/esp -36266 $test-compare-eax-with-literal:initialize-var1: -36267 # var var1/ecx: (payload var) -36268 68/push 0/imm32/register -36269 68/push 0/imm32/register -36270 68/push 0/imm32/no-stack-offset -36271 68/push 1/imm32/block-depth -36272 51/push-ecx -36273 68/push 0x11/imm32/alloc-id:fake -36274 68/push 0/imm32/name -36275 68/push 0/imm32/name -36276 68/push 0x11/imm32/alloc-id:fake:payload -36277 89/<- %ecx 4/r32/esp -36278 $test-compare-eax-with-literal:initialize-var1-name: -36279 # var1->name = "var1" -36280 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -36281 (copy-array Heap "var1" %eax) -36282 $test-compare-eax-with-literal:initialize-var1-register: -36283 # v->register = "eax" -36284 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -36285 (copy-array Heap "eax" %eax) -36286 $test-compare-eax-with-literal:initialize-literal-type: -36287 # var type/edx: (payload type-tree) = literal -36288 68/push 0/imm32/right:null -36289 68/push 0/imm32/right:null -36290 68/push 0/imm32/left:unused -36291 68/push 0/imm32/value:literal -36292 68/push 1/imm32/is-atom?:true -36293 68/push 0x11/imm32/alloc-id:fake:payload -36294 89/<- %edx 4/r32/esp -36295 $test-compare-eax-with-literal:initialize-literal: -36296 # var l/edx: (payload var) -36297 68/push 0/imm32/register -36298 68/push 0/imm32/register -36299 68/push 0/imm32/no-stack-offset -36300 68/push 1/imm32/block-depth -36301 52/push-edx -36302 68/push 0x11/imm32/alloc-id:fake -36303 68/push 0/imm32/name -36304 68/push 0/imm32/name -36305 68/push 0x11/imm32/alloc-id:fake:payload -36306 89/<- %edx 4/r32/esp -36307 $test-compare-eax-with-literal:initialize-literal-value: -36308 # l->name = "0x34" -36309 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -36310 (copy-array Heap "0x34" %eax) -36311 $test-compare-eax-with-literal:initialize-inouts: -36312 # var inouts/esi: (payload stmt-var) = [l] -36313 68/push 0/imm32/is-deref:false -36314 68/push 0/imm32/next -36315 68/push 0/imm32/next -36316 52/push-edx/l -36317 68/push 0x11/imm32/alloc-id:fake -36318 68/push 0x11/imm32/alloc-id:fake:payload -36319 89/<- %esi 4/r32/esp -36320 # var inouts = (handle stmt-var) = [var1, var2] -36321 68/push 0/imm32/is-deref:false -36322 56/push-esi/next -36323 68/push 0x11/imm32/alloc-id:fake -36324 51/push-ecx/var1 -36325 68/push 0x11/imm32/alloc-id:fake -36326 68/push 0x11/imm32/alloc-id:fake:payload -36327 89/<- %esi 4/r32/esp -36328 $test-compare-eax-with-literal:initialize-stmt: -36329 # var stmt/esi: (addr statement) -36330 68/push 0/imm32/next -36331 68/push 0/imm32/next -36332 68/push 0/imm32/outputs -36333 68/push 0/imm32/outputs -36334 56/push-esi/inouts -36335 68/push 0x11/imm32/alloc-id:fake -36336 68/push 0/imm32/operation -36337 68/push 0/imm32/operation -36338 68/push 1/imm32/tag:stmt1 -36339 89/<- %esi 4/r32/esp -36340 $test-compare-eax-with-literal:initialize-stmt-operation: -36341 # stmt->operation = "compare" -36342 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -36343 (copy-array Heap "compare" %eax) -36344 # convert -36345 c7 0/subop/copy *Curr-block-depth 0/imm32 -36346 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -36347 (flush _test-output-buffered-file) -36348 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -36354 # check output -36355 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal") -36356 # . epilogue -36357 89/<- %esp 5/r32/ebp -36358 5d/pop-to-ebp -36359 c3/return -36360 -36361 test-compare-reg-with-literal: -36362 # compare var1/ecx 0x34 -36363 # => -36364 # 81 7/subop/compare %ecx 0x34/imm32 -36365 # -36366 # . prologue -36367 55/push-ebp -36368 89/<- %ebp 4/r32/esp -36369 # setup -36370 (clear-stream _test-output-stream) -36371 (clear-stream $_test-output-buffered-file->buffer) -36372 $test-compare-reg-with-literal:initialize-type: -36373 # var type/ecx: (payload type-tree) = int -36374 68/push 0/imm32/right:null -36375 68/push 0/imm32/right:null -36376 68/push 0/imm32/left:unused -36377 68/push 1/imm32/value:int -36378 68/push 1/imm32/is-atom?:true -36379 68/push 0x11/imm32/alloc-id:fake:payload -36380 89/<- %ecx 4/r32/esp -36381 $test-compare-reg-with-literal:initialize-var1: -36382 # var var1/ecx: (payload var) -36383 68/push 0/imm32/register -36384 68/push 0/imm32/register -36385 68/push 0/imm32/no-stack-offset -36386 68/push 1/imm32/block-depth -36387 51/push-ecx +36106 51/push-ecx/var-foo +36107 68/push 0x11/imm32/alloc-id:fake +36108 68/push 0x11/imm32/alloc-id:fake:payload +36109 89/<- %ebx 4/r32/esp +36110 $test-emit-subx-stmt-select-primitive-2:initialize-stmt: +36111 # var stmt/esi: (addr statement) +36112 68/push 0/imm32/no-outputs +36113 68/push 0/imm32/no-outputs +36114 53/push-ebx/inouts +36115 68/push 0x11/imm32/alloc-id:fake +36116 68/push 0/imm32/operation +36117 68/push 0/imm32/operation +36118 68/push 1/imm32 +36119 89/<- %esi 4/r32/esp +36120 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-operation: +36121 # stmt->operation = "increment" +36122 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +36123 (copy-array Heap "increment" %eax) +36124 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var: +36125 # var formal-var/ebx: (payload var) +36126 68/push 0/imm32/register +36127 68/push 0/imm32/register +36128 68/push 0/imm32/no-stack-offset +36129 68/push 1/imm32/block-depth +36130 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +36131 68/push 0x11/imm32/alloc-id:fake +36132 68/push 0/imm32/name +36133 68/push 0/imm32/name +36134 68/push 0x11/imm32/alloc-id:fake:payload +36135 89/<- %ebx 4/r32/esp +36136 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var-name: +36137 # formal-var->name = "dummy" +36138 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +36139 (copy-array Heap "dummy" %eax) +36140 $test-emit-subx-stmt-select-primitive-2:initialize-formal-register: +36141 # formal-var->register = "*" +36142 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +36143 (copy-array Heap "*" %eax) # Any-register +36144 $test-emit-subx-stmt-select-primitive-2:initialize-var-list: +36145 # var formal-outputs/ebx: (payload list stmt-var) +36146 68/push 0/imm32/next +36147 68/push 0/imm32/next +36148 53/push-ebx/formal-var +36149 68/push 0x11/imm32/alloc-id:fake +36150 68/push 0x11/imm32/alloc-id:fake:payload +36151 89/<- %ebx 4/r32/esp +36152 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2: +36153 # var primitive2/edi: (payload primitive) +36154 68/push 0/imm32/next +36155 68/push 0/imm32/next +36156 68/push 0/imm32/no-x32 +36157 68/push 0/imm32/no-xm32 +36158 68/push 0/imm32/no-disp32 +36159 68/push 0/imm32/no-imm8 +36160 68/push 0/imm32/no-imm32 +36161 68/push 0/imm32/no-r32 +36162 68/push 3/imm32/rm32-is-first-output +36163 68/push 0/imm32/subx-name +36164 68/push 0/imm32/subx-name +36165 53/push-ebx/outputs +36166 68/push 0x11/imm32/alloc-id:fake +36167 68/push 0/imm32/no-inouts +36168 68/push 0/imm32/no-inouts +36169 68/push 0/imm32/name +36170 68/push 0/imm32/name +36171 68/push 0x11/imm32/alloc-id:fake:payload +36172 89/<- %edi 4/r32/esp +36173 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-name: +36174 # primitives->name = "increment" +36175 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 +36176 (copy-array Heap "increment" %eax) +36177 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-subx-name: +36178 # primitives->subx-name = "ff 0/subop/increment" +36179 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 +36180 (copy-array Heap "ff 0/subop/increment" %eax) +36181 $test-emit-subx-stmt-select-primitive-2:initialize-primitive: +36182 # var primitives/ebx: (addr primitive) +36183 57/push-edi +36184 68/push 0x11/imm32/alloc-id:fake +36185 68/push 0/imm32/no-x32 +36186 68/push 0/imm32/no-xm32 +36187 68/push 0/imm32/no-disp32 +36188 68/push 0/imm32/no-imm8 +36189 68/push 0/imm32/no-imm32 +36190 68/push 0/imm32/no-r32 +36191 68/push 1/imm32/rm32-is-first-inout +36192 68/push 0/imm32/subx-name +36193 68/push 0/imm32/subx-name +36194 68/push 0/imm32/no-outputs +36195 68/push 0/imm32/no-outputs +36196 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +36197 68/push 0x11/imm32/alloc-id:fake +36198 68/push 0/imm32/name +36199 68/push 0/imm32/name +36200 89/<- %ebx 4/r32/esp +36201 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-name: +36202 # primitives->name = "increment" +36203 (copy-array Heap "increment" %ebx) # Primitive-name +36204 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-subx-name: +36205 # primitives->subx-name = "ff 0/subop/increment" +36206 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +36207 (copy-array Heap "ff 0/subop/increment" %eax) +36208 # convert +36209 c7 0/subop/copy *Curr-block-depth 0/imm32 +36210 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0 Stderr 0) +36211 (flush _test-output-buffered-file) +36212 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +36218 # check output +36219 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2") +36220 # . epilogue +36221 89/<- %esp 5/r32/ebp +36222 5d/pop-to-ebp +36223 c3/return +36224 +36225 test-increment-register: +36226 # Select the right register between overloads. +36227 # foo <- increment +36228 # => +36229 # 50/increment-eax +36230 # +36231 # There's a variable on the var stack as follows: +36232 # name: 'foo' +36233 # type: int +36234 # register: 'eax' +36235 # +36236 # Primitives are the global definitions. +36237 # +36238 # . prologue +36239 55/push-ebp +36240 89/<- %ebp 4/r32/esp +36241 # setup +36242 (clear-stream _test-output-stream) +36243 (clear-stream $_test-output-buffered-file->buffer) +36244 $test-increment-register:initialize-type: +36245 # var type/ecx: (payload type-tree) = int +36246 68/push 0/imm32/right:null +36247 68/push 0/imm32/right:null +36248 68/push 0/imm32/left:unused +36249 68/push 1/imm32/value:int +36250 68/push 1/imm32/is-atom?:true +36251 68/push 0x11/imm32/alloc-id:fake:payload +36252 89/<- %ecx 4/r32/esp +36253 $test-increment-register:initialize-var: +36254 # var var-foo/ecx: (payload var) +36255 68/push 0/imm32/register +36256 68/push 0/imm32/register +36257 68/push 0/imm32/no-stack-offset +36258 68/push 1/imm32/block-depth +36259 51/push-ecx +36260 68/push 0x11/imm32/alloc-id:fake +36261 68/push 0/imm32/name +36262 68/push 0/imm32/name +36263 68/push 0x11/imm32/alloc-id:fake:payload +36264 89/<- %ecx 4/r32/esp +36265 $test-increment-register:initialize-var-name: +36266 # var-foo->name = "foo" +36267 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +36268 (copy-array Heap "foo" %eax) +36269 $test-increment-register:initialize-var-register: +36270 # var-foo->register = "eax" +36271 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +36272 (copy-array Heap "eax" %eax) +36273 $test-increment-register:initialize-stmt-var: +36274 # var operand/ebx: (payload stmt-var) +36275 68/push 0/imm32/is-deref:false +36276 68/push 0/imm32/next +36277 68/push 0/imm32/next +36278 51/push-ecx/var-foo +36279 68/push 0x11/imm32/alloc-id:fake +36280 68/push 0x11/imm32/alloc-id:fake:payload +36281 89/<- %ebx 4/r32/esp +36282 $test-increment-register:initialize-stmt: +36283 # var stmt/esi: (addr statement) +36284 53/push-ebx/outputs +36285 68/push 0x11/imm32/alloc-id:fake +36286 68/push 0/imm32/no-inouts +36287 68/push 0/imm32/no-inouts +36288 68/push 0/imm32/operation +36289 68/push 0/imm32/operation +36290 68/push 1/imm32 +36291 89/<- %esi 4/r32/esp +36292 $test-increment-register:initialize-stmt-operation: +36293 # stmt->operation = "increment" +36294 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +36295 (copy-array Heap "increment" %eax) +36296 # convert +36297 c7 0/subop/copy *Curr-block-depth 0/imm32 +36298 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +36299 (flush _test-output-buffered-file) +36300 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +36306 # check output +36307 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register") +36308 # . epilogue +36309 89/<- %esp 5/r32/ebp +36310 5d/pop-to-ebp +36311 c3/return +36312 +36313 test-add-reg-to-reg: +36314 # var1/reg <- add var2/reg +36315 # => +36316 # 01/add-to %var1 var2 +36317 # +36318 # . prologue +36319 55/push-ebp +36320 89/<- %ebp 4/r32/esp +36321 # setup +36322 (clear-stream _test-output-stream) +36323 (clear-stream $_test-output-buffered-file->buffer) +36324 $test-add-reg-to-reg:initialize-type: +36325 # var type/ecx: (payload type-tree) = int +36326 68/push 0/imm32/right:null +36327 68/push 0/imm32/right:null +36328 68/push 0/imm32/left:unused +36329 68/push 1/imm32/value:int +36330 68/push 1/imm32/is-atom?:true +36331 68/push 0x11/imm32/alloc-id:fake:payload +36332 89/<- %ecx 4/r32/esp +36333 $test-add-reg-to-reg:initialize-var1: +36334 # var var1/ecx: (payload var) +36335 68/push 0/imm32/register +36336 68/push 0/imm32/register +36337 68/push 0/imm32/no-stack-offset +36338 68/push 1/imm32/block-depth +36339 51/push-ecx +36340 68/push 0x11/imm32/alloc-id:fake +36341 68/push 0/imm32/name +36342 68/push 0/imm32/name +36343 68/push 0x11/imm32/alloc-id:fake:payload +36344 89/<- %ecx 4/r32/esp +36345 $test-add-reg-to-reg:initialize-var1-name: +36346 # var1->name = "var1" +36347 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +36348 (copy-array Heap "var1" %eax) +36349 $test-add-reg-to-reg:initialize-var1-register: +36350 # var1->register = "eax" +36351 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +36352 (copy-array Heap "eax" %eax) +36353 $test-add-reg-to-reg:initialize-var2: +36354 # var var2/edx: (payload var) +36355 68/push 0/imm32/register +36356 68/push 0/imm32/register +36357 68/push 0/imm32/no-stack-offset +36358 68/push 1/imm32/block-depth +36359 ff 6/subop/push *(ecx+0x10) +36360 68/push 0x11/imm32/alloc-id:fake +36361 68/push 0/imm32/name +36362 68/push 0/imm32/name +36363 68/push 0x11/imm32/alloc-id:fake:payload +36364 89/<- %edx 4/r32/esp +36365 $test-add-reg-to-reg:initialize-var2-name: +36366 # var2->name = "var2" +36367 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +36368 (copy-array Heap "var2" %eax) +36369 $test-add-reg-to-reg:initialize-var2-register: +36370 # var2->register = "ecx" +36371 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +36372 (copy-array Heap "ecx" %eax) +36373 $test-add-reg-to-reg:initialize-inouts: +36374 # var inouts/esi: (payload stmt-var) = [var2] +36375 68/push 0/imm32/is-deref:false +36376 68/push 0/imm32/next +36377 68/push 0/imm32/next +36378 52/push-edx/var2 +36379 68/push 0x11/imm32/alloc-id:fake +36380 68/push 0x11/imm32/alloc-id:fake:payload +36381 89/<- %esi 4/r32/esp +36382 $test-add-reg-to-reg:initialize-outputs: +36383 # var outputs/edi: (payload stmt-var) = [var1] +36384 68/push 0/imm32/is-deref:false +36385 68/push 0/imm32/next +36386 68/push 0/imm32/next +36387 51/push-ecx/var1 36388 68/push 0x11/imm32/alloc-id:fake -36389 68/push 0/imm32/name -36390 68/push 0/imm32/name -36391 68/push 0x11/imm32/alloc-id:fake:payload -36392 89/<- %ecx 4/r32/esp -36393 $test-compare-reg-with-literal:initialize-var1-name: -36394 # var1->name = "var1" -36395 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -36396 (copy-array Heap "var1" %eax) -36397 $test-compare-reg-with-literal:initialize-var1-register: -36398 # v->register = "ecx" -36399 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -36400 (copy-array Heap "ecx" %eax) -36401 $test-compare-reg-with-literal:initialize-literal-type: -36402 # var type/edx: (payload type-tree) = literal -36403 68/push 0/imm32/right:null -36404 68/push 0/imm32/right:null -36405 68/push 0/imm32/left:unused -36406 68/push 0/imm32/value:literal -36407 68/push 1/imm32/is-atom?:true -36408 68/push 0x11/imm32/alloc-id:fake:payload -36409 89/<- %edx 4/r32/esp -36410 $test-compare-reg-with-literal:initialize-literal: -36411 # var l/edx: (payload var) -36412 68/push 0/imm32/register -36413 68/push 0/imm32/register -36414 68/push 0/imm32/no-stack-offset -36415 68/push 1/imm32/block-depth -36416 52/push-edx -36417 68/push 0x11/imm32/alloc-id:fake -36418 68/push 0/imm32/name -36419 68/push 0/imm32/name -36420 68/push 0x11/imm32/alloc-id:fake:payload -36421 89/<- %edx 4/r32/esp -36422 $test-compare-reg-with-literal:initialize-literal-value: -36423 # l->name = "0x34" -36424 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -36425 (copy-array Heap "0x34" %eax) -36426 $test-compare-reg-with-literal:initialize-inouts: -36427 # var inouts/esi: (payload stmt-var) = [l] -36428 68/push 0/imm32/is-deref:false -36429 68/push 0/imm32/next -36430 68/push 0/imm32/next -36431 52/push-edx/l -36432 68/push 0x11/imm32/alloc-id:fake -36433 68/push 0x11/imm32/alloc-id:fake:payload -36434 89/<- %esi 4/r32/esp -36435 # var inouts = (handle stmt-var) = [var1, var2] -36436 68/push 0/imm32/is-deref:false -36437 56/push-esi/next -36438 68/push 0x11/imm32/alloc-id:fake -36439 51/push-ecx/var1 -36440 68/push 0x11/imm32/alloc-id:fake -36441 68/push 0x11/imm32/alloc-id:fake:payload -36442 89/<- %esi 4/r32/esp -36443 $test-compare-reg-with-literal:initialize-stmt: -36444 # var stmt/esi: (addr statement) -36445 68/push 0/imm32/next -36446 68/push 0/imm32/next -36447 68/push 0/imm32/outputs -36448 68/push 0/imm32/outputs -36449 56/push-esi/inouts -36450 68/push 0x11/imm32/alloc-id:fake -36451 68/push 0/imm32/operation -36452 68/push 0/imm32/operation -36453 68/push 1/imm32/tag:stmt1 -36454 89/<- %esi 4/r32/esp -36455 $test-compare-reg-with-literal:initialize-stmt-operation: -36456 # stmt->operation = "compare" -36457 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -36458 (copy-array Heap "compare" %eax) -36459 # convert -36460 c7 0/subop/copy *Curr-block-depth 0/imm32 -36461 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) -36462 (flush _test-output-buffered-file) -36463 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -36469 # check output -36470 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal") -36471 # . epilogue -36472 89/<- %esp 5/r32/ebp -36473 5d/pop-to-ebp -36474 c3/return -36475 -36476 test-emit-subx-stmt-function-call: -36477 # Call a function on a variable on the stack. -36478 # f foo -36479 # => -36480 # (f *(ebp-8)) -36481 # (Changing the function name supports overloading in general, but here it -36482 # just serves to help disambiguate things.) -36483 # -36484 # There's a variable on the var stack as follows: -36485 # name: 'foo' -36486 # type: int -36487 # stack-offset: -8 -36488 # -36489 # There's nothing in primitives. -36490 # -36491 # We don't perform any checking here on the type of 'f'. -36492 # -36493 # . prologue -36494 55/push-ebp -36495 89/<- %ebp 4/r32/esp -36496 # setup -36497 (clear-stream _test-output-stream) -36498 (clear-stream $_test-output-buffered-file->buffer) -36499 $test-emit-subx-function-call:initialize-type: -36500 # var type/ecx: (payload type-tree) = int -36501 68/push 0/imm32/right:null -36502 68/push 0/imm32/right:null -36503 68/push 0/imm32/left:unused -36504 68/push 1/imm32/value:int -36505 68/push 1/imm32/is-atom?:true -36506 68/push 0x11/imm32/alloc-id:fake:payload -36507 89/<- %ecx 4/r32/esp -36508 $test-emit-subx-function-call:initialize-var: -36509 # var var-foo/ecx: (payload var) = var(type) -36510 68/push 0/imm32/no-register -36511 68/push 0/imm32/no-register -36512 68/push -8/imm32/stack-offset -36513 68/push 1/imm32/block-depth -36514 51/push-ecx/type -36515 68/push 0x11/imm32/alloc-id:fake -36516 68/push 0/imm32/name -36517 68/push 0/imm32/name -36518 68/push 0x11/imm32/alloc-id:fake:payload -36519 89/<- %ecx 4/r32/esp -36520 $test-emit-subx-function-call:initialize-var-name: -36521 # var-foo->name = "foo" -36522 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -36523 (copy-array Heap "foo" %eax) -36524 $test-emit-subx-function-call:initialize-stmt-var: -36525 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -36526 68/push 0/imm32/is-deref:false -36527 68/push 0/imm32/next -36528 68/push 0/imm32/next -36529 51/push-ecx/var-foo -36530 68/push 0x11/imm32/alloc-id:fake -36531 68/push 0x11/imm32/alloc-id:fake:payload -36532 89/<- %ebx 4/r32/esp -36533 $test-emit-subx-function-call:initialize-stmt: -36534 # var stmt/esi: (addr statement) -36535 68/push 0/imm32/no-outputs -36536 68/push 0/imm32/no-outputs -36537 53/push-ebx/inouts -36538 68/push 0x11/imm32/alloc-id:fake -36539 68/push 0/imm32/operation -36540 68/push 0/imm32/operation -36541 68/push 1/imm32/tag -36542 89/<- %esi 4/r32/esp -36543 $test-emit-subx-function-call:initialize-stmt-operation: -36544 # stmt->operation = "f" -36545 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -36546 (copy-array Heap "f" %eax) -36547 # convert -36548 c7 0/subop/copy *Curr-block-depth 0/imm32 -36549 (emit-subx-stmt _test-output-buffered-file %esi 0 0 Stderr 0) -36550 (flush _test-output-buffered-file) -36551 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -36557 # check output -36558 (check-next-stream-line-equal _test-output-stream "(f *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call") -36559 # . epilogue -36560 89/<- %esp 5/r32/ebp -36561 5d/pop-to-ebp -36562 c3/return -36563 -36564 test-emit-subx-stmt-function-call-with-literal-arg: -36565 # Call a function on a literal. -36566 # f 0x34 -36567 # => -36568 # (f2 0x34) -36569 # -36570 # . prologue -36571 55/push-ebp -36572 89/<- %ebp 4/r32/esp -36573 # setup -36574 (clear-stream _test-output-stream) -36575 (clear-stream $_test-output-buffered-file->buffer) -36576 $test-emit-subx-function-call-with-literal-arg:initialize-type: -36577 # var type/ecx: (payload type-tree) = int -36578 68/push 0/imm32/right:null -36579 68/push 0/imm32/right:null -36580 68/push 0/imm32/left:unused -36581 68/push 0/imm32/value:literal -36582 68/push 1/imm32/is-atom?:true -36583 68/push 0x11/imm32/alloc-id:fake:payload -36584 89/<- %ecx 4/r32/esp -36585 $test-emit-subx-function-call-with-literal-arg:initialize-var: -36586 # var var-foo/ecx: (payload var) = var(lit) -36587 68/push 0/imm32/no-register -36588 68/push 0/imm32/no-register -36589 68/push 0/imm32/no-stack-offset -36590 68/push 1/imm32/block-depth -36591 51/push-ecx/type +36389 68/push 0x11/imm32/alloc-id:fake:payload +36390 89/<- %edi 4/r32/esp +36391 $test-add-reg-to-reg:initialize-stmt: +36392 # var stmt/esi: (addr statement) +36393 68/push 0/imm32/next +36394 68/push 0/imm32/next +36395 57/push-edi/outputs +36396 68/push 0x11/imm32/alloc-id:fake +36397 56/push-esi/inouts +36398 68/push 0x11/imm32/alloc-id:fake +36399 68/push 0/imm32/operation +36400 68/push 0/imm32/operation +36401 68/push 1/imm32/tag:stmt1 +36402 89/<- %esi 4/r32/esp +36403 $test-add-reg-to-reg:initialize-stmt-operation: +36404 # stmt->operation = "add" +36405 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +36406 (copy-array Heap "add" %eax) +36407 # convert +36408 c7 0/subop/copy *Curr-block-depth 0/imm32 +36409 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +36410 (flush _test-output-buffered-file) +36411 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +36417 # check output +36418 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg") +36419 # . epilogue +36420 89/<- %esp 5/r32/ebp +36421 5d/pop-to-ebp +36422 c3/return +36423 +36424 test-add-reg-to-mem: +36425 # add-to var1 var2/reg +36426 # => +36427 # 01/add-to *(ebp+__) var2 +36428 # +36429 # . prologue +36430 55/push-ebp +36431 89/<- %ebp 4/r32/esp +36432 # setup +36433 (clear-stream _test-output-stream) +36434 (clear-stream $_test-output-buffered-file->buffer) +36435 $test-add-reg-to-mem:initialize-type: +36436 # var type/ecx: (payload type-tree) = int +36437 68/push 0/imm32/right:null +36438 68/push 0/imm32/right:null +36439 68/push 0/imm32/left:unused +36440 68/push 1/imm32/value:int +36441 68/push 1/imm32/is-atom?:true +36442 68/push 0x11/imm32/alloc-id:fake:payload +36443 89/<- %ecx 4/r32/esp +36444 $test-add-reg-to-mem:initialize-var1: +36445 # var var1/ecx: (payload var) +36446 68/push 0/imm32/register +36447 68/push 0/imm32/register +36448 68/push 8/imm32/stack-offset +36449 68/push 1/imm32/block-depth +36450 51/push-ecx +36451 68/push 0x11/imm32/alloc-id:fake +36452 68/push 0/imm32/name +36453 68/push 0/imm32/name +36454 68/push 0x11/imm32/alloc-id:fake:payload +36455 89/<- %ecx 4/r32/esp +36456 $test-add-reg-to-mem:initialize-var1-name: +36457 # var1->name = "var1" +36458 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +36459 (copy-array Heap "var1" %eax) +36460 $test-add-reg-to-mem:initialize-var2: +36461 # var var2/edx: (payload var) +36462 68/push 0/imm32/register +36463 68/push 0/imm32/register +36464 68/push 0/imm32/no-stack-offset +36465 68/push 1/imm32/block-depth +36466 ff 6/subop/push *(ecx+0x10) +36467 68/push 0x11/imm32/alloc-id:fake +36468 68/push 0/imm32/name +36469 68/push 0/imm32/name +36470 68/push 0x11/imm32/alloc-id:fake:payload +36471 89/<- %edx 4/r32/esp +36472 $test-add-reg-to-mem:initialize-var2-name: +36473 # var2->name = "var2" +36474 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +36475 (copy-array Heap "var2" %eax) +36476 $test-add-reg-to-mem:initialize-var2-register: +36477 # var2->register = "ecx" +36478 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +36479 (copy-array Heap "ecx" %eax) +36480 $test-add-reg-to-mem:initialize-inouts: +36481 # var inouts/esi: (payload stmt-var) = [var2] +36482 68/push 0/imm32/is-deref:false +36483 68/push 0/imm32/next +36484 68/push 0/imm32/next +36485 52/push-edx/var2 +36486 68/push 0x11/imm32/alloc-id:fake +36487 68/push 0x11/imm32/alloc-id:fake:payload +36488 89/<- %esi 4/r32/esp +36489 # inouts = [var1, var2] +36490 68/push 0/imm32/is-deref:false +36491 56/push-esi/next +36492 68/push 0x11/imm32/alloc-id:fake +36493 51/push-ecx/var1 +36494 68/push 0x11/imm32/alloc-id:fake +36495 68/push 0x11/imm32/alloc-id:fake:payload +36496 89/<- %esi 4/r32/esp +36497 $test-add-reg-to-mem:initialize-stmt: +36498 # var stmt/esi: (addr statement) +36499 68/push 0/imm32/next +36500 68/push 0/imm32/next +36501 68/push 0/imm32/outputs +36502 68/push 0/imm32/outputs +36503 56/push-esi/inouts +36504 68/push 0x11/imm32/alloc-id:fake +36505 68/push 0/imm32/operation +36506 68/push 0/imm32/operation +36507 68/push 1/imm32/tag:stmt1 +36508 89/<- %esi 4/r32/esp +36509 $test-add-reg-to-mem:initialize-stmt-operation: +36510 # stmt->operation = "add-to" +36511 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +36512 (copy-array Heap "add-to" %eax) +36513 # convert +36514 c7 0/subop/copy *Curr-block-depth 0/imm32 +36515 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +36516 (flush _test-output-buffered-file) +36517 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +36523 # check output +36524 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem") +36525 # . epilogue +36526 89/<- %esp 5/r32/ebp +36527 5d/pop-to-ebp +36528 c3/return +36529 +36530 test-add-mem-to-reg: +36531 # var1/reg <- add var2 +36532 # => +36533 # 03/add *(ebp+__) var1 +36534 # +36535 # . prologue +36536 55/push-ebp +36537 89/<- %ebp 4/r32/esp +36538 # setup +36539 (clear-stream _test-output-stream) +36540 (clear-stream $_test-output-buffered-file->buffer) +36541 $test-add-mem-to-reg:initialize-type: +36542 # var type/ecx: (payload type-tree) = int +36543 68/push 0/imm32/right:null +36544 68/push 0/imm32/right:null +36545 68/push 0/imm32/left:unused +36546 68/push 1/imm32/value:int +36547 68/push 1/imm32/is-atom?:true +36548 68/push 0x11/imm32/alloc-id:fake:payload +36549 89/<- %ecx 4/r32/esp +36550 $test-add-mem-to-reg:initialize-var: +36551 # var var1/ecx: (payload var) +36552 68/push 0/imm32/register +36553 68/push 0/imm32/register +36554 68/push 0/imm32/no-stack-offset +36555 68/push 1/imm32/block-depth +36556 51/push-ecx +36557 68/push 0x11/imm32/alloc-id:fake +36558 68/push 0/imm32/name +36559 68/push 0/imm32/name +36560 68/push 0x11/imm32/alloc-id:fake:payload +36561 89/<- %ecx 4/r32/esp +36562 $test-add-mem-to-reg:initialize-var-name: +36563 # var1->name = "foo" +36564 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +36565 (copy-array Heap "var1" %eax) +36566 $test-add-mem-to-reg:initialize-var-register: +36567 # var1->register = "eax" +36568 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +36569 (copy-array Heap "eax" %eax) +36570 $test-add-mem-to-reg:initialize-var2: +36571 # var var2/edx: (payload var) +36572 68/push 0/imm32/register +36573 68/push 0/imm32/register +36574 68/push 8/imm32/stack-offset +36575 68/push 1/imm32/block-depth +36576 ff 6/subop/push *(ecx+0x10) +36577 68/push 0x11/imm32/alloc-id:fake +36578 68/push 0/imm32/name +36579 68/push 0/imm32/name +36580 68/push 0x11/imm32/alloc-id:fake:payload +36581 89/<- %edx 4/r32/esp +36582 $test-add-mem-to-reg:initialize-var2-name: +36583 # var2->name = "var2" +36584 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +36585 (copy-array Heap "var2" %eax) +36586 $test-add-mem-to-reg:initialize-inouts: +36587 # var inouts/esi: (payload stmt-var) = [var2] +36588 68/push 0/imm32/is-deref:false +36589 68/push 0/imm32/next +36590 68/push 0/imm32/next +36591 52/push-edx/var2 36592 68/push 0x11/imm32/alloc-id:fake -36593 68/push 0/imm32/name -36594 68/push 0/imm32/name -36595 68/push 0x11/imm32/alloc-id:fake:payload -36596 89/<- %ecx 4/r32/esp -36597 $test-emit-subx-function-call-with-literal-arg:initialize-var-name: -36598 # var-foo->name = "0x34" -36599 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -36600 (copy-array Heap "0x34" %eax) -36601 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-var: -36602 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -36603 68/push 0/imm32/is-deref:false -36604 68/push 0/imm32/next -36605 68/push 0/imm32/next -36606 51/push-ecx/var-foo -36607 68/push 0x11/imm32/alloc-id:fake -36608 68/push 0x11/imm32/alloc-id:fake:payload -36609 89/<- %ebx 4/r32/esp -36610 $test-emit-subx-function-call-with-literal-arg:initialize-stmt: -36611 # var stmt/esi: (addr statement) -36612 68/push 0/imm32/no-outputs -36613 68/push 0/imm32/no-outputs -36614 53/push-ebx/inouts -36615 68/push 0x11/imm32/alloc-id:fake -36616 68/push 0/imm32/operation -36617 68/push 0/imm32/operation -36618 68/push 1/imm32/tag -36619 89/<- %esi 4/r32/esp -36620 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-operation: -36621 # stmt->operation = "f" -36622 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -36623 (copy-array Heap "f" %eax) -36624 # convert -36625 c7 0/subop/copy *Curr-block-depth 0/imm32 -36626 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx 0 Stderr 0) -36627 (flush _test-output-buffered-file) -36628 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------- -36634 # check output -36635 (check-next-stream-line-equal _test-output-stream "(f 0x34)" "F - test-emit-subx-stmt-function-call-with-literal-arg") -36636 # . epilogue -36637 89/<- %esp 5/r32/ebp -36638 5d/pop-to-ebp -36639 c3/return -36640 -36641 emit-indent: # out: (addr buffered-file), n: int +36593 68/push 0x11/imm32/alloc-id:fake:payload +36594 89/<- %esi 4/r32/esp +36595 $test-add-mem-to-reg:initialize-outputs: +36596 # var outputs/edi: (payload stmt-var) = [var1] +36597 68/push 0/imm32/is-deref:false +36598 68/push 0/imm32/next +36599 68/push 0/imm32/next +36600 51/push-ecx/var1 +36601 68/push 0x11/imm32/alloc-id:fake +36602 68/push 0x11/imm32/alloc-id:fake:payload +36603 89/<- %edi 4/r32/esp +36604 $test-add-mem-to-reg:initialize-stmt: +36605 # var stmt/esi: (addr statement) +36606 68/push 0/imm32/next +36607 68/push 0/imm32/next +36608 57/push-edi/outputs +36609 68/push 0x11/imm32/alloc-id:fake +36610 56/push-esi/inouts +36611 68/push 0x11/imm32/alloc-id:fake +36612 68/push 0/imm32/operation +36613 68/push 0/imm32/operation +36614 68/push 1/imm32/tag:stmt1 +36615 89/<- %esi 4/r32/esp +36616 $test-add-mem-to-reg:initialize-stmt-operation: +36617 # stmt->operation = "add" +36618 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +36619 (copy-array Heap "add" %eax) +36620 # convert +36621 c7 0/subop/copy *Curr-block-depth 0/imm32 +36622 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +36623 (flush _test-output-buffered-file) +36624 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +36630 # check output +36631 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg") +36632 # . epilogue +36633 89/<- %esp 5/r32/ebp +36634 5d/pop-to-ebp +36635 c3/return +36636 +36637 test-add-literal-to-eax: +36638 # var1/eax <- add 0x34 +36639 # => +36640 # 05/add-to-eax 0x34/imm32 +36641 # 36642 # . prologue 36643 55/push-ebp 36644 89/<- %ebp 4/r32/esp -36645 # . save registers -36646 50/push-eax -36647 # var i/eax: int = n -36648 8b/-> *(ebp+0xc) 0/r32/eax -36649 { -36650 # if (i <= 0) break -36651 3d/compare-eax-with 0/imm32 -36652 7e/jump-if-<= break/disp8 -36653 (write-buffered *(ebp+8) " ") -36654 48/decrement-eax -36655 eb/jump loop/disp8 -36656 } -36657 $emit-indent:end: -36658 # . restore registers -36659 58/pop-to-eax -36660 # . epilogue -36661 89/<- %esp 5/r32/ebp -36662 5d/pop-to-ebp -36663 c3/return -36664 -36665 emit-subx-prologue: # out: (addr buffered-file) -36666 # . prologue -36667 55/push-ebp -36668 89/<- %ebp 4/r32/esp -36669 # -36670 (write-buffered *(ebp+8) " # . prologue\n") -36671 (write-buffered *(ebp+8) " 55/push-ebp\n") -36672 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n") -36673 $emit-subx-prologue:end: -36674 # . epilogue -36675 89/<- %esp 5/r32/ebp -36676 5d/pop-to-ebp -36677 c3/return -36678 -36679 emit-subx-epilogue: # out: (addr buffered-file) -36680 # . prologue -36681 55/push-ebp -36682 89/<- %ebp 4/r32/esp -36683 # -36684 (write-buffered *(ebp+8) " # . epilogue\n") -36685 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n") -36686 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n") -36687 (write-buffered *(ebp+8) " c3/return\n") -36688 $emit-subx-epilogue:end: -36689 # . epilogue -36690 89/<- %esp 5/r32/ebp -36691 5d/pop-to-ebp -36692 c3/return +36645 # setup +36646 (clear-stream _test-output-stream) +36647 (clear-stream $_test-output-buffered-file->buffer) +36648 $test-add-literal-to-eax:initialize-var-type: +36649 # var type/ecx: (payload type-tree) = int +36650 68/push 0/imm32/right:null +36651 68/push 0/imm32/right:null +36652 68/push 0/imm32/left:unused +36653 68/push 1/imm32/value:int +36654 68/push 1/imm32/is-atom?:true +36655 68/push 0x11/imm32/alloc-id:fake:payload +36656 89/<- %ecx 4/r32/esp +36657 $test-add-literal-to-eax:initialize-var: +36658 # var v/ecx: (payload var) +36659 68/push 0/imm32/register +36660 68/push 0/imm32/register +36661 68/push 0/imm32/no-stack-offset +36662 68/push 1/imm32/block-depth +36663 51/push-ecx +36664 68/push 0x11/imm32/alloc-id:fake +36665 68/push 0/imm32/name +36666 68/push 0/imm32/name +36667 68/push 0x11/imm32/alloc-id:fake:payload +36668 89/<- %ecx 4/r32/esp +36669 $test-add-literal-to-eax:initialize-var-name: +36670 # v->name = "v" +36671 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +36672 (copy-array Heap "v" %eax) +36673 $test-add-literal-to-eax:initialize-var-register: +36674 # v->register = "eax" +36675 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +36676 (copy-array Heap "eax" %eax) +36677 $test-add-literal-to-eax:initialize-literal-type: +36678 # var type/edx: (payload type-tree) = literal +36679 68/push 0/imm32/right:null +36680 68/push 0/imm32/right:null +36681 68/push 0/imm32/left:unused +36682 68/push 0/imm32/value:literal +36683 68/push 1/imm32/is-atom?:true +36684 68/push 0x11/imm32/alloc-id:fake:payload +36685 89/<- %edx 4/r32/esp +36686 $test-add-literal-to-eax:initialize-literal: +36687 # var l/edx: (payload var) +36688 68/push 0/imm32/register +36689 68/push 0/imm32/register +36690 68/push 0/imm32/no-stack-offset +36691 68/push 1/imm32/block-depth +36692 52/push-edx +36693 68/push 0x11/imm32/alloc-id:fake +36694 68/push 0/imm32/name +36695 68/push 0/imm32/name +36696 68/push 0x11/imm32/alloc-id:fake:payload +36697 89/<- %edx 4/r32/esp +36698 $test-add-literal-to-eax:initialize-literal-value: +36699 # l->name = "0x34" +36700 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +36701 (copy-array Heap "0x34" %eax) +36702 $test-add-literal-to-eax:initialize-inouts: +36703 # var inouts/esi: (payload stmt-var) = [l] +36704 68/push 0/imm32/is-deref:false +36705 68/push 0/imm32/next +36706 68/push 0/imm32/next +36707 52/push-edx/l +36708 68/push 0x11/imm32/alloc-id:fake +36709 68/push 0x11/imm32/alloc-id:fake:payload +36710 89/<- %esi 4/r32/esp +36711 $test-add-literal-to-eax:initialize-outputs: +36712 # var outputs/edi: (payload stmt-var) = [v] +36713 68/push 0/imm32/is-deref:false +36714 68/push 0/imm32/next +36715 68/push 0/imm32/next +36716 51/push-ecx/v +36717 68/push 0x11/imm32/alloc-id:fake +36718 68/push 0x11/imm32/alloc-id:fake:payload +36719 89/<- %edi 4/r32/esp +36720 $test-add-literal-to-eax:initialize-stmt: +36721 # var stmt/esi: (addr statement) +36722 68/push 0/imm32/next +36723 68/push 0/imm32/next +36724 57/push-edi/outputs +36725 68/push 0x11/imm32/alloc-id:fake +36726 56/push-esi/inouts +36727 68/push 0x11/imm32/alloc-id:fake +36728 68/push 0/imm32/operation +36729 68/push 0/imm32/operation +36730 68/push 1/imm32/tag:stmt1 +36731 89/<- %esi 4/r32/esp +36732 $test-add-literal-to-eax:initialize-stmt-operation: +36733 # stmt->operation = "add" +36734 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +36735 (copy-array Heap "add" %eax) +36736 # convert +36737 c7 0/subop/copy *Curr-block-depth 0/imm32 +36738 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +36739 (flush _test-output-buffered-file) +36740 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +36746 # check output +36747 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax") +36748 # . epilogue +36749 89/<- %esp 5/r32/ebp +36750 5d/pop-to-ebp +36751 c3/return +36752 +36753 test-add-literal-to-reg: +36754 # var1/ecx <- add 0x34 +36755 # => +36756 # 81 0/subop/add %ecx 0x34/imm32 +36757 # +36758 # . prologue +36759 55/push-ebp +36760 89/<- %ebp 4/r32/esp +36761 # setup +36762 (clear-stream _test-output-stream) +36763 (clear-stream $_test-output-buffered-file->buffer) +36764 $test-add-literal-to-reg:initialize-var-type: +36765 # var type/ecx: (payload type-tree) = int +36766 68/push 0/imm32/right:null +36767 68/push 0/imm32/right:null +36768 68/push 0/imm32/left:unused +36769 68/push 1/imm32/value:int +36770 68/push 1/imm32/is-atom?:true +36771 68/push 0x11/imm32/alloc-id:fake:payload +36772 89/<- %ecx 4/r32/esp +36773 $test-add-literal-to-reg:initialize-var: +36774 # var v/ecx: (payload var) +36775 68/push 0/imm32/register +36776 68/push 0/imm32/register +36777 68/push 0/imm32/no-stack-offset +36778 68/push 1/imm32/block-depth +36779 51/push-ecx +36780 68/push 0x11/imm32/alloc-id:fake +36781 68/push 0/imm32/name +36782 68/push 0/imm32/name +36783 68/push 0x11/imm32/alloc-id:fake:payload +36784 89/<- %ecx 4/r32/esp +36785 $test-add-literal-to-reg:initialize-var-name: +36786 # v->name = "v" +36787 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +36788 (copy-array Heap "v" %eax) +36789 $test-add-literal-to-reg:initialize-var-register: +36790 # v->register = "ecx" +36791 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +36792 (copy-array Heap "ecx" %eax) +36793 $test-add-literal-to-reg:initialize-literal-type: +36794 # var type/edx: (payload type-tree) = literal +36795 68/push 0/imm32/right:null +36796 68/push 0/imm32/right:null +36797 68/push 0/imm32/left:unused +36798 68/push 0/imm32/value:literal +36799 68/push 1/imm32/is-atom?:true +36800 68/push 0x11/imm32/alloc-id:fake:payload +36801 89/<- %edx 4/r32/esp +36802 $test-add-literal-to-reg:initialize-literal: +36803 # var l/edx: (payload var) +36804 68/push 0/imm32/register +36805 68/push 0/imm32/register +36806 68/push 0/imm32/no-stack-offset +36807 68/push 1/imm32/block-depth +36808 52/push-edx +36809 68/push 0x11/imm32/alloc-id:fake +36810 68/push 0/imm32/name +36811 68/push 0/imm32/name +36812 68/push 0x11/imm32/alloc-id:fake:payload +36813 89/<- %edx 4/r32/esp +36814 $test-add-literal-to-reg:initialize-literal-value: +36815 # l->name = "0x34" +36816 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +36817 (copy-array Heap "0x34" %eax) +36818 $test-add-literal-to-reg:initialize-inouts: +36819 # var inouts/esi: (payload stmt-var) = [l] +36820 68/push 0/imm32/is-deref:false +36821 68/push 0/imm32/next +36822 68/push 0/imm32/next +36823 52/push-edx/l +36824 68/push 0x11/imm32/alloc-id:fake +36825 68/push 0x11/imm32/alloc-id:fake:payload +36826 89/<- %esi 4/r32/esp +36827 $test-add-literal-to-reg:initialize-outputs: +36828 # var outputs/edi: (payload stmt-var) = [v] +36829 68/push 0/imm32/is-deref:false +36830 68/push 0/imm32/next +36831 68/push 0/imm32/next +36832 51/push-ecx/v +36833 68/push 0x11/imm32/alloc-id:fake +36834 68/push 0x11/imm32/alloc-id:fake:payload +36835 89/<- %edi 4/r32/esp +36836 $test-add-literal-to-reg:initialize-stmt: +36837 # var stmt/esi: (addr statement) +36838 68/push 0/imm32/next +36839 68/push 0/imm32/next +36840 57/push-edi/outputs +36841 68/push 0x11/imm32/alloc-id:fake +36842 56/push-esi/inouts +36843 68/push 0x11/imm32/alloc-id:fake +36844 68/push 0/imm32/operation +36845 68/push 0/imm32/operation +36846 68/push 1/imm32/tag:stmt1 +36847 89/<- %esi 4/r32/esp +36848 $test-add-literal-to-reg:initialize-stmt-operation: +36849 # stmt->operation = "add" +36850 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +36851 (copy-array Heap "add" %eax) +36852 # convert +36853 c7 0/subop/copy *Curr-block-depth 0/imm32 +36854 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +36855 (flush _test-output-buffered-file) +36856 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +36862 # check output +36863 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg") +36864 # . epilogue +36865 89/<- %esp 5/r32/ebp +36866 5d/pop-to-ebp +36867 c3/return +36868 +36869 test-add-literal-to-mem: +36870 # add-to var1, 0x34 +36871 # => +36872 # 81 0/subop/add %eax 0x34/imm32 +36873 # +36874 # . prologue +36875 55/push-ebp +36876 89/<- %ebp 4/r32/esp +36877 # setup +36878 (clear-stream _test-output-stream) +36879 (clear-stream $_test-output-buffered-file->buffer) +36880 $test-add-literal-to-mem:initialize-type: +36881 # var type/ecx: (payload type-tree) = int +36882 68/push 0/imm32/right:null +36883 68/push 0/imm32/right:null +36884 68/push 0/imm32/left:unused +36885 68/push 1/imm32/value:int +36886 68/push 1/imm32/is-atom?:true +36887 68/push 0x11/imm32/alloc-id:fake:payload +36888 89/<- %ecx 4/r32/esp +36889 $test-add-literal-to-mem:initialize-var1: +36890 # var var1/ecx: (payload var) +36891 68/push 0/imm32/register +36892 68/push 0/imm32/register +36893 68/push 8/imm32/stack-offset +36894 68/push 1/imm32/block-depth +36895 51/push-ecx +36896 68/push 0x11/imm32/alloc-id:fake +36897 68/push 0/imm32/name +36898 68/push 0/imm32/name +36899 68/push 0x11/imm32/alloc-id:fake:payload +36900 89/<- %ecx 4/r32/esp +36901 $test-add-literal-to-mem:initialize-var1-name: +36902 # var1->name = "var1" +36903 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +36904 (copy-array Heap "var1" %eax) +36905 $test-add-literal-to-mem:initialize-literal-type: +36906 # var type/edx: (payload type-tree) = literal +36907 68/push 0/imm32/right:null +36908 68/push 0/imm32/right:null +36909 68/push 0/imm32/left:unused +36910 68/push 0/imm32/value:literal +36911 68/push 1/imm32/is-atom?:true +36912 68/push 0x11/imm32/alloc-id:fake:payload +36913 89/<- %edx 4/r32/esp +36914 $test-add-literal-to-mem:initialize-literal: +36915 # var l/edx: (payload var) +36916 68/push 0/imm32/register +36917 68/push 0/imm32/register +36918 68/push 0/imm32/no-stack-offset +36919 68/push 1/imm32/block-depth +36920 52/push-edx +36921 68/push 0x11/imm32/alloc-id:fake +36922 68/push 0/imm32/name +36923 68/push 0/imm32/name +36924 68/push 0x11/imm32/alloc-id:fake:payload +36925 89/<- %edx 4/r32/esp +36926 $test-add-literal-to-mem:initialize-literal-value: +36927 # l->name = "0x34" +36928 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +36929 (copy-array Heap "0x34" %eax) +36930 $test-add-literal-to-mem:initialize-inouts: +36931 # var inouts/esi: (payload stmt-var) = [l] +36932 68/push 0/imm32/is-deref:false +36933 68/push 0/imm32/next +36934 68/push 0/imm32/next +36935 52/push-edx/l +36936 68/push 0x11/imm32/alloc-id:fake +36937 68/push 0x11/imm32/alloc-id:fake:payload +36938 89/<- %esi 4/r32/esp +36939 # var inouts = (handle stmt-var) = [var1, var2] +36940 68/push 0/imm32/is-deref:false +36941 56/push-esi/next +36942 68/push 0x11/imm32/alloc-id:fake +36943 51/push-ecx/var1 +36944 68/push 0x11/imm32/alloc-id:fake +36945 68/push 0x11/imm32/alloc-id:fake:payload +36946 89/<- %esi 4/r32/esp +36947 $test-add-literal-to-mem:initialize-stmt: +36948 # var stmt/esi: (addr statement) +36949 68/push 0/imm32/next +36950 68/push 0/imm32/next +36951 68/push 0/imm32/outputs +36952 68/push 0/imm32/outputs +36953 56/push-esi/inouts +36954 68/push 0x11/imm32/alloc-id:fake +36955 68/push 0/imm32/operation +36956 68/push 0/imm32/operation +36957 68/push 1/imm32/tag:stmt1 +36958 89/<- %esi 4/r32/esp +36959 $test-add-literal-to-mem:initialize-stmt-operation: +36960 # stmt->operation = "add-to" +36961 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +36962 (copy-array Heap "add-to" %eax) +36963 # convert +36964 c7 0/subop/copy *Curr-block-depth 0/imm32 +36965 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +36966 (flush _test-output-buffered-file) +36967 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +36973 # check output +36974 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem") +36975 # . epilogue +36976 89/<- %esp 5/r32/ebp +36977 5d/pop-to-ebp +36978 c3/return +36979 +36980 test-shift-reg-by-literal: +36981 # var1/ecx <- shift-left 2 +36982 # => +36983 # c1/shift 4/subop/left %ecx 2/imm8 +36984 # +36985 # . prologue +36986 55/push-ebp +36987 89/<- %ebp 4/r32/esp +36988 # setup +36989 (clear-stream _test-output-stream) +36990 (clear-stream $_test-output-buffered-file->buffer) +36991 $test-shift-reg-by-literal:initialize-var-type: +36992 # var type/ecx: (payload type-tree) = int +36993 68/push 0/imm32/right:null +36994 68/push 0/imm32/right:null +36995 68/push 0/imm32/left:unused +36996 68/push 1/imm32/value:int +36997 68/push 1/imm32/is-atom?:true +36998 68/push 0x11/imm32/alloc-id:fake:payload +36999 89/<- %ecx 4/r32/esp +37000 $test-shift-reg-by-literal:initialize-var: +37001 # var v/ecx: (payload var) +37002 68/push 0/imm32/register +37003 68/push 0/imm32/register +37004 68/push 0/imm32/no-stack-offset +37005 68/push 1/imm32/block-depth +37006 51/push-ecx +37007 68/push 0x11/imm32/alloc-id:fake +37008 68/push 0/imm32/name +37009 68/push 0/imm32/name +37010 68/push 0x11/imm32/alloc-id:fake:payload +37011 89/<- %ecx 4/r32/esp +37012 $test-shift-reg-by-literal:initialize-var-name: +37013 # v->name = "v" +37014 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +37015 (copy-array Heap "v" %eax) +37016 $test-shift-reg-by-literal:initialize-var-register: +37017 # v->register = "ecx" +37018 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +37019 (copy-array Heap "ecx" %eax) +37020 $test-shift-reg-by-literal:initialize-literal-type: +37021 # var type/edx: (payload type-tree) = literal +37022 68/push 0/imm32/right:null +37023 68/push 0/imm32/right:null +37024 68/push 0/imm32/left:unused +37025 68/push 0/imm32/value:literal +37026 68/push 1/imm32/is-atom?:true +37027 68/push 0x11/imm32/alloc-id:fake:payload +37028 89/<- %edx 4/r32/esp +37029 $test-shift-reg-by-literal:initialize-literal: +37030 # var l/edx: (payload var) +37031 68/push 0/imm32/register +37032 68/push 0/imm32/register +37033 68/push 0/imm32/no-stack-offset +37034 68/push 1/imm32/block-depth +37035 52/push-edx +37036 68/push 0x11/imm32/alloc-id:fake +37037 68/push 0/imm32/name +37038 68/push 0/imm32/name +37039 68/push 0x11/imm32/alloc-id:fake:payload +37040 89/<- %edx 4/r32/esp +37041 $test-shift-reg-by-literal:initialize-literal-value: +37042 # l->name = "2" +37043 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +37044 (copy-array Heap "2" %eax) +37045 $test-shift-reg-by-literal:initialize-inouts: +37046 # var inouts/esi: (payload stmt-var) = [l] +37047 68/push 0/imm32/is-deref:false +37048 68/push 0/imm32/next +37049 68/push 0/imm32/next +37050 52/push-edx/l +37051 68/push 0x11/imm32/alloc-id:fake +37052 68/push 0x11/imm32/alloc-id:fake:payload +37053 89/<- %esi 4/r32/esp +37054 $test-shift-reg-by-literal:initialize-outputs: +37055 # var outputs/edi: (payload stmt-var) = [v] +37056 68/push 0/imm32/is-deref:false +37057 68/push 0/imm32/next +37058 68/push 0/imm32/next +37059 51/push-ecx/v +37060 68/push 0x11/imm32/alloc-id:fake +37061 68/push 0x11/imm32/alloc-id:fake:payload +37062 89/<- %edi 4/r32/esp +37063 $test-shift-reg-by-literal:initialize-stmt: +37064 # var stmt/esi: (addr statement) +37065 68/push 0/imm32/next +37066 68/push 0/imm32/next +37067 57/push-edi/outputs +37068 68/push 0x11/imm32/alloc-id:fake +37069 56/push-esi/inouts +37070 68/push 0x11/imm32/alloc-id:fake +37071 68/push 0/imm32/operation +37072 68/push 0/imm32/operation +37073 68/push 1/imm32/tag:stmt1 +37074 89/<- %esi 4/r32/esp +37075 $test-shift-reg-by-literal:initialize-stmt-operation: +37076 # stmt->operation = "shift-left" +37077 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +37078 (copy-array Heap "shift-left" %eax) +37079 # convert +37080 c7 0/subop/copy *Curr-block-depth 0/imm32 +37081 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +37082 (flush _test-output-buffered-file) +37083 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +37089 # check output +37090 (check-next-stream-line-equal _test-output-stream "c1/shift 4/subop/left %ecx 2/imm8" "F - test-shift-reg-by-literal") +37091 # . epilogue +37092 89/<- %esp 5/r32/ebp +37093 5d/pop-to-ebp +37094 c3/return +37095 +37096 test-shift-mem-by-literal: +37097 # shift-left var 3 +37098 # => +37099 # c1/shift 4/subop/left *(ebp+8) 3/imm8 +37100 # +37101 # . prologue +37102 55/push-ebp +37103 89/<- %ebp 4/r32/esp +37104 # setup +37105 (clear-stream _test-output-stream) +37106 (clear-stream $_test-output-buffered-file->buffer) +37107 $test-shift-mem-by-literal:initialize-type: +37108 # var type/ecx: (payload type-tree) = int +37109 68/push 0/imm32/right:null +37110 68/push 0/imm32/right:null +37111 68/push 0/imm32/left:unused +37112 68/push 1/imm32/value:int +37113 68/push 1/imm32/is-atom?:true +37114 68/push 0x11/imm32/alloc-id:fake:payload +37115 89/<- %ecx 4/r32/esp +37116 $test-shift-mem-by-literal:initialize-var1: +37117 # var var1/ecx: (payload var) +37118 68/push 0/imm32/register +37119 68/push 0/imm32/register +37120 68/push 8/imm32/stack-offset +37121 68/push 1/imm32/block-depth +37122 51/push-ecx +37123 68/push 0x11/imm32/alloc-id:fake +37124 68/push 0/imm32/name +37125 68/push 0/imm32/name +37126 68/push 0x11/imm32/alloc-id:fake:payload +37127 89/<- %ecx 4/r32/esp +37128 $test-shift-mem-by-literal:initialize-var1-name: +37129 # var1->name = "var1" +37130 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +37131 (copy-array Heap "var1" %eax) +37132 $test-shift-mem-by-literal:initialize-literal-type: +37133 # var type/edx: (payload type-tree) = literal +37134 68/push 0/imm32/right:null +37135 68/push 0/imm32/right:null +37136 68/push 0/imm32/left:unused +37137 68/push 0/imm32/value:literal +37138 68/push 1/imm32/is-atom?:true +37139 68/push 0x11/imm32/alloc-id:fake:payload +37140 89/<- %edx 4/r32/esp +37141 $test-shift-mem-by-literal:initialize-literal: +37142 # var l/edx: (payload var) +37143 68/push 0/imm32/register +37144 68/push 0/imm32/register +37145 68/push 0/imm32/no-stack-offset +37146 68/push 1/imm32/block-depth +37147 52/push-edx +37148 68/push 0x11/imm32/alloc-id:fake +37149 68/push 0/imm32/name +37150 68/push 0/imm32/name +37151 68/push 0x11/imm32/alloc-id:fake:payload +37152 89/<- %edx 4/r32/esp +37153 $test-shift-mem-by-literal:initialize-literal-value: +37154 # l->name = "3" +37155 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +37156 (copy-array Heap "3" %eax) +37157 $test-shift-mem-by-literal:initialize-inouts: +37158 # var inouts/esi: (payload stmt-var) = [l] +37159 68/push 0/imm32/is-deref:false +37160 68/push 0/imm32/next +37161 68/push 0/imm32/next +37162 52/push-edx/l +37163 68/push 0x11/imm32/alloc-id:fake +37164 68/push 0x11/imm32/alloc-id:fake:payload +37165 89/<- %esi 4/r32/esp +37166 # var inouts = (handle stmt-var) = [var1, var2] +37167 68/push 0/imm32/is-deref:false +37168 56/push-esi/next +37169 68/push 0x11/imm32/alloc-id:fake +37170 51/push-ecx/var1 +37171 68/push 0x11/imm32/alloc-id:fake +37172 68/push 0x11/imm32/alloc-id:fake:payload +37173 89/<- %esi 4/r32/esp +37174 $test-shift-mem-by-literal:initialize-stmt: +37175 # var stmt/esi: (addr statement) +37176 68/push 0/imm32/next +37177 68/push 0/imm32/next +37178 68/push 0/imm32/outputs +37179 68/push 0/imm32/outputs +37180 56/push-esi/inouts +37181 68/push 0x11/imm32/alloc-id:fake +37182 68/push 0/imm32/operation +37183 68/push 0/imm32/operation +37184 68/push 1/imm32/tag:stmt1 +37185 89/<- %esi 4/r32/esp +37186 $test-shift-mem-by-literal:initialize-stmt-operation: +37187 # stmt->operation = "shift-left" +37188 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +37189 (copy-array Heap "shift-left" %eax) +37190 # convert +37191 c7 0/subop/copy *Curr-block-depth 0/imm32 +37192 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +37193 (flush _test-output-buffered-file) +37194 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +37200 # check output +37201 (check-next-stream-line-equal _test-output-stream "c1/shift 4/subop/left *(ebp+0x00000008) 3/imm8" "F - test-shift-mem-by-literal") +37202 # . epilogue +37203 89/<- %esp 5/r32/ebp +37204 5d/pop-to-ebp +37205 c3/return +37206 +37207 test-compare-reg-with-reg: +37208 # compare var1/ecx, var2/eax +37209 # => +37210 # 39/compare %ecx 0/r32/eax +37211 # +37212 # . prologue +37213 55/push-ebp +37214 89/<- %ebp 4/r32/esp +37215 # setup +37216 (clear-stream _test-output-stream) +37217 (clear-stream $_test-output-buffered-file->buffer) +37218 $test-compare-reg-with-reg:initialize-type: +37219 # var type/ecx: (payload type-tree) = int +37220 68/push 0/imm32/right:null +37221 68/push 0/imm32/right:null +37222 68/push 0/imm32/left:unused +37223 68/push 1/imm32/value:int +37224 68/push 1/imm32/is-atom?:true +37225 68/push 0x11/imm32/alloc-id:fake:payload +37226 89/<- %ecx 4/r32/esp +37227 $test-compare-reg-with-reg:initialize-var1: +37228 # var var1/ecx: (payload var) +37229 68/push 0/imm32/register +37230 68/push 0/imm32/register +37231 68/push 0/imm32/no-stack-offset +37232 68/push 1/imm32/block-depth +37233 51/push-ecx +37234 68/push 0x11/imm32/alloc-id:fake +37235 68/push 0/imm32/name +37236 68/push 0/imm32/name +37237 68/push 0x11/imm32/alloc-id:fake:payload +37238 89/<- %ecx 4/r32/esp +37239 $test-compare-reg-with-reg:initialize-var1-name: +37240 # var1->name = "var1" +37241 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +37242 (copy-array Heap "var1" %eax) +37243 $test-compare-reg-with-reg:initialize-var1-register: +37244 # var1->register = "ecx" +37245 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +37246 (copy-array Heap "ecx" %eax) +37247 $test-compare-reg-with-reg:initialize-var2: +37248 # var var2/edx: (payload var) +37249 68/push 0/imm32/register +37250 68/push 0/imm32/register +37251 68/push 0/imm32/no-stack-offset +37252 68/push 1/imm32/block-depth +37253 ff 6/subop/push *(ecx+0x10) +37254 68/push 0x11/imm32/alloc-id:fake +37255 68/push 0/imm32/name +37256 68/push 0/imm32/name +37257 68/push 0x11/imm32/alloc-id:fake:payload +37258 89/<- %edx 4/r32/esp +37259 $test-compare-reg-with-reg:initialize-var2-name: +37260 # var2->name = "var2" +37261 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +37262 (copy-array Heap "var2" %eax) +37263 $test-compare-reg-with-reg:initialize-var2-register: +37264 # var2->register = "eax" +37265 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +37266 (copy-array Heap "eax" %eax) +37267 $test-compare-reg-with-reg:initialize-inouts: +37268 # var inouts/esi: (payload stmt-var) = [var2] +37269 68/push 0/imm32/is-deref:false +37270 68/push 0/imm32/next +37271 68/push 0/imm32/next +37272 52/push-edx/var2 +37273 68/push 0x11/imm32/alloc-id:fake +37274 68/push 0x11/imm32/alloc-id:fake:payload +37275 89/<- %esi 4/r32/esp +37276 # inouts = [var1, var2] +37277 68/push 0/imm32/is-deref:false +37278 56/push-esi/next +37279 68/push 0x11/imm32/alloc-id:fake +37280 51/push-ecx/var1 +37281 68/push 0x11/imm32/alloc-id:fake +37282 68/push 0x11/imm32/alloc-id:fake:payload +37283 89/<- %esi 4/r32/esp +37284 $test-compare-reg-with-reg:initialize-stmt: +37285 # var stmt/esi: (addr statement) +37286 68/push 0/imm32/next +37287 68/push 0/imm32/next +37288 68/push 0/imm32/outputs +37289 68/push 0/imm32/outputs +37290 56/push-esi/inouts +37291 68/push 0x11/imm32/alloc-id:fake +37292 68/push 0/imm32/operation +37293 68/push 0/imm32/operation +37294 68/push 1/imm32/tag:stmt1 +37295 89/<- %esi 4/r32/esp +37296 $test-compare-reg-with-reg:initialize-stmt-operation: +37297 # stmt->operation = "compare" +37298 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +37299 (copy-array Heap "compare" %eax) +37300 # convert +37301 c7 0/subop/copy *Curr-block-depth 0/imm32 +37302 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +37303 (flush _test-output-buffered-file) +37304 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +37310 # check output +37311 (check-next-stream-line-equal _test-output-stream "39/compare-> %ecx 0x00000000/r32" "F - test-compare-reg-with-reg") +37312 # . epilogue +37313 89/<- %esp 5/r32/ebp +37314 5d/pop-to-ebp +37315 c3/return +37316 +37317 test-compare-mem-with-reg: +37318 # compare var1, var2/eax +37319 # => +37320 # 39/compare *(ebp+___) 0/r32/eax +37321 # +37322 # . prologue +37323 55/push-ebp +37324 89/<- %ebp 4/r32/esp +37325 # setup +37326 (clear-stream _test-output-stream) +37327 (clear-stream $_test-output-buffered-file->buffer) +37328 $test-compare-mem-with-reg:initialize-type: +37329 # var type/ecx: (payload type-tree) = int +37330 68/push 0/imm32/right:null +37331 68/push 0/imm32/right:null +37332 68/push 0/imm32/left:unused +37333 68/push 1/imm32/value:int +37334 68/push 1/imm32/is-atom?:true +37335 68/push 0x11/imm32/alloc-id:fake:payload +37336 89/<- %ecx 4/r32/esp +37337 $test-compare-mem-with-reg:initialize-var1: +37338 # var var1/ecx: (payload var) +37339 68/push 0/imm32/register +37340 68/push 0/imm32/register +37341 68/push 8/imm32/stack-offset +37342 68/push 1/imm32/block-depth +37343 51/push-ecx +37344 68/push 0x11/imm32/alloc-id:fake +37345 68/push 0/imm32/name +37346 68/push 0/imm32/name +37347 68/push 0x11/imm32/alloc-id:fake:payload +37348 89/<- %ecx 4/r32/esp +37349 $test-compare-mem-with-reg:initialize-var1-name: +37350 # var1->name = "var1" +37351 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +37352 (copy-array Heap "var1" %eax) +37353 $test-compare-mem-with-reg:initialize-var2: +37354 # var var2/edx: (payload var) +37355 68/push 0/imm32/register +37356 68/push 0/imm32/register +37357 68/push 0/imm32/no-stack-offset +37358 68/push 1/imm32/block-depth +37359 ff 6/subop/push *(ecx+0x10) +37360 68/push 0x11/imm32/alloc-id:fake +37361 68/push 0/imm32/name +37362 68/push 0/imm32/name +37363 68/push 0x11/imm32/alloc-id:fake:payload +37364 89/<- %edx 4/r32/esp +37365 $test-compare-mem-with-reg:initialize-var2-name: +37366 # var2->name = "var2" +37367 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +37368 (copy-array Heap "var2" %eax) +37369 $test-compare-mem-with-reg:initialize-var2-register: +37370 # var2->register = "eax" +37371 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +37372 (copy-array Heap "eax" %eax) +37373 $test-compare-mem-with-reg:initialize-inouts: +37374 # var inouts/esi: (payload stmt-var) = [var2] +37375 68/push 0/imm32/is-deref:false +37376 68/push 0/imm32/next +37377 68/push 0/imm32/next +37378 52/push-edx/var2 +37379 68/push 0x11/imm32/alloc-id:fake +37380 68/push 0x11/imm32/alloc-id:fake:payload +37381 89/<- %esi 4/r32/esp +37382 # inouts = [var1, var2] +37383 68/push 0/imm32/is-deref:false +37384 56/push-esi/next +37385 68/push 0x11/imm32/alloc-id:fake +37386 51/push-ecx/var1 +37387 68/push 0x11/imm32/alloc-id:fake +37388 68/push 0x11/imm32/alloc-id:fake:payload +37389 89/<- %esi 4/r32/esp +37390 $test-compare-mem-with-reg:initialize-stmt: +37391 # var stmt/esi: (addr statement) +37392 68/push 0/imm32/next +37393 68/push 0/imm32/next +37394 68/push 0/imm32/outputs +37395 68/push 0/imm32/outputs +37396 56/push-esi/inouts +37397 68/push 0x11/imm32/alloc-id:fake +37398 68/push 0/imm32/operation +37399 68/push 0/imm32/operation +37400 68/push 1/imm32/tag:stmt1 +37401 89/<- %esi 4/r32/esp +37402 $test-compare-mem-with-reg:initialize-stmt-operation: +37403 # stmt->operation = "compare" +37404 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +37405 (copy-array Heap "compare" %eax) +37406 # convert +37407 c7 0/subop/copy *Curr-block-depth 0/imm32 +37408 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +37409 (flush _test-output-buffered-file) +37410 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +37416 # check output +37417 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg") +37418 # . epilogue +37419 89/<- %esp 5/r32/ebp +37420 5d/pop-to-ebp +37421 c3/return +37422 +37423 test-compare-reg-with-mem: +37424 # compare var1/eax, var2 +37425 # => +37426 # 3b/compare<- *(ebp+___) 0/r32/eax +37427 # +37428 # . prologue +37429 55/push-ebp +37430 89/<- %ebp 4/r32/esp +37431 # setup +37432 (clear-stream _test-output-stream) +37433 (clear-stream $_test-output-buffered-file->buffer) +37434 $test-compare-reg-with-mem:initialize-type: +37435 # var type/ecx: (payload type-tree) = int +37436 68/push 0/imm32/right:null +37437 68/push 0/imm32/right:null +37438 68/push 0/imm32/left:unused +37439 68/push 1/imm32/value:int +37440 68/push 1/imm32/is-atom?:true +37441 68/push 0x11/imm32/alloc-id:fake:payload +37442 89/<- %ecx 4/r32/esp +37443 $test-compare-reg-with-mem:initialize-var1: +37444 # var var1/ecx: (payload var) +37445 68/push 0/imm32/register +37446 68/push 0/imm32/register +37447 68/push 0/imm32/no-stack-offset +37448 68/push 1/imm32/block-depth +37449 51/push-ecx +37450 68/push 0x11/imm32/alloc-id:fake +37451 68/push 0/imm32/name +37452 68/push 0/imm32/name +37453 68/push 0x11/imm32/alloc-id:fake:payload +37454 89/<- %ecx 4/r32/esp +37455 $test-compare-reg-with-mem:initialize-var1-name: +37456 # var1->name = "var1" +37457 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +37458 (copy-array Heap "var1" %eax) +37459 $test-compare-reg-with-mem:initialize-var1-register: +37460 # var1->register = "eax" +37461 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +37462 (copy-array Heap "eax" %eax) +37463 $test-compare-reg-with-mem:initialize-var2: +37464 # var var2/edx: (payload var) +37465 68/push 0/imm32/register +37466 68/push 0/imm32/register +37467 68/push 8/imm32/stack-offset +37468 68/push 1/imm32/block-depth +37469 ff 6/subop/push *(ecx+0x10) +37470 68/push 0x11/imm32/alloc-id:fake +37471 68/push 0/imm32/name +37472 68/push 0/imm32/name +37473 68/push 0x11/imm32/alloc-id:fake:payload +37474 89/<- %edx 4/r32/esp +37475 $test-compare-reg-with-mem:initialize-var2-name: +37476 # var2->name = "var2" +37477 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +37478 (copy-array Heap "var2" %eax) +37479 $test-compare-reg-with-mem:initialize-inouts: +37480 # var inouts/esi: (payload stmt-var) = [var2] +37481 68/push 0/imm32/is-deref:false +37482 68/push 0/imm32/next +37483 68/push 0/imm32/next +37484 52/push-edx/var2 +37485 68/push 0x11/imm32/alloc-id:fake +37486 68/push 0x11/imm32/alloc-id:fake:payload +37487 89/<- %esi 4/r32/esp +37488 # inouts = [var1, var2] +37489 68/push 0/imm32/is-deref:false +37490 56/push-esi/next +37491 68/push 0x11/imm32/alloc-id:fake +37492 51/push-ecx/var1 +37493 68/push 0x11/imm32/alloc-id:fake +37494 68/push 0x11/imm32/alloc-id:fake:payload +37495 89/<- %esi 4/r32/esp +37496 $test-compare-reg-with-mem:initialize-stmt: +37497 # var stmt/esi: (addr statement) +37498 68/push 0/imm32/next +37499 68/push 0/imm32/next +37500 68/push 0/imm32/outputs +37501 68/push 0/imm32/outputs +37502 56/push-esi/inouts +37503 68/push 0x11/imm32/alloc-id:fake +37504 68/push 0/imm32/operation +37505 68/push 0/imm32/operation +37506 68/push 1/imm32/tag:stmt1 +37507 89/<- %esi 4/r32/esp +37508 $test-compare-reg-with-mem:initialize-stmt-operation: +37509 # stmt->operation = "compare" +37510 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +37511 (copy-array Heap "compare" %eax) +37512 # convert +37513 c7 0/subop/copy *Curr-block-depth 0/imm32 +37514 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +37515 (flush _test-output-buffered-file) +37516 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +37522 # check output +37523 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem") +37524 # . epilogue +37525 89/<- %esp 5/r32/ebp +37526 5d/pop-to-ebp +37527 c3/return +37528 +37529 test-compare-mem-with-literal: +37530 # compare var1, 0x34 +37531 # => +37532 # 81 7/subop/compare *(ebp+___) 0x34/imm32 +37533 # +37534 # . prologue +37535 55/push-ebp +37536 89/<- %ebp 4/r32/esp +37537 # setup +37538 (clear-stream _test-output-stream) +37539 (clear-stream $_test-output-buffered-file->buffer) +37540 $test-compare-mem-with-literal:initialize-type: +37541 # var type/ecx: (payload type-tree) = int +37542 68/push 0/imm32/right:null +37543 68/push 0/imm32/right:null +37544 68/push 0/imm32/left:unused +37545 68/push 1/imm32/value:int +37546 68/push 1/imm32/is-atom?:true +37547 68/push 0x11/imm32/alloc-id:fake:payload +37548 89/<- %ecx 4/r32/esp +37549 $test-compare-mem-with-literal:initialize-var1: +37550 # var var1/ecx: (payload var) +37551 68/push 0/imm32/register +37552 68/push 0/imm32/register +37553 68/push 8/imm32/stack-offset +37554 68/push 1/imm32/block-depth +37555 51/push-ecx +37556 68/push 0x11/imm32/alloc-id:fake +37557 68/push 0/imm32/name +37558 68/push 0/imm32/name +37559 68/push 0x11/imm32/alloc-id:fake:payload +37560 89/<- %ecx 4/r32/esp +37561 $test-compare-mem-with-literal:initialize-var1-name: +37562 # var1->name = "var1" +37563 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +37564 (copy-array Heap "var1" %eax) +37565 $test-compare-mem-with-literal:initialize-literal-type: +37566 # var type/edx: (payload type-tree) = literal +37567 68/push 0/imm32/right:null +37568 68/push 0/imm32/right:null +37569 68/push 0/imm32/left:unused +37570 68/push 0/imm32/value:literal +37571 68/push 1/imm32/is-atom?:true +37572 68/push 0x11/imm32/alloc-id:fake:payload +37573 89/<- %edx 4/r32/esp +37574 $test-compare-mem-with-literal:initialize-literal: +37575 # var l/edx: (payload var) +37576 68/push 0/imm32/register +37577 68/push 0/imm32/register +37578 68/push 0/imm32/no-stack-offset +37579 68/push 1/imm32/block-depth +37580 52/push-edx +37581 68/push 0x11/imm32/alloc-id:fake +37582 68/push 0/imm32/name +37583 68/push 0/imm32/name +37584 68/push 0x11/imm32/alloc-id:fake:payload +37585 89/<- %edx 4/r32/esp +37586 $test-compare-mem-with-literal:initialize-literal-value: +37587 # l->name = "0x34" +37588 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +37589 (copy-array Heap "0x34" %eax) +37590 $test-compare-mem-with-literal:initialize-inouts: +37591 # var inouts/esi: (payload stmt-var) = [l] +37592 68/push 0/imm32/is-deref:false +37593 68/push 0/imm32/next +37594 68/push 0/imm32/next +37595 52/push-edx/l +37596 68/push 0x11/imm32/alloc-id:fake +37597 68/push 0x11/imm32/alloc-id:fake:payload +37598 89/<- %esi 4/r32/esp +37599 # var inouts = (handle stmt-var) = [var1, var2] +37600 68/push 0/imm32/is-deref:false +37601 56/push-esi/next +37602 68/push 0x11/imm32/alloc-id:fake +37603 51/push-ecx/var1 +37604 68/push 0x11/imm32/alloc-id:fake +37605 68/push 0x11/imm32/alloc-id:fake:payload +37606 89/<- %esi 4/r32/esp +37607 $test-compare-mem-with-literal:initialize-stmt: +37608 # var stmt/esi: (addr statement) +37609 68/push 0/imm32/next +37610 68/push 0/imm32/next +37611 68/push 0/imm32/outputs +37612 68/push 0/imm32/outputs +37613 56/push-esi/inouts +37614 68/push 0x11/imm32/alloc-id:fake +37615 68/push 0/imm32/operation +37616 68/push 0/imm32/operation +37617 68/push 1/imm32/tag:stmt1 +37618 89/<- %esi 4/r32/esp +37619 $test-compare-mem-with-literal:initialize-stmt-operation: +37620 # stmt->operation = "compare" +37621 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +37622 (copy-array Heap "compare" %eax) +37623 # convert +37624 c7 0/subop/copy *Curr-block-depth 0/imm32 +37625 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +37626 (flush _test-output-buffered-file) +37627 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +37633 # check output +37634 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal") +37635 # . epilogue +37636 89/<- %esp 5/r32/ebp +37637 5d/pop-to-ebp +37638 c3/return +37639 +37640 test-compare-eax-with-literal: +37641 # compare var1/eax 0x34 +37642 # => +37643 # 3d/compare-eax-with 0x34/imm32 +37644 # +37645 # . prologue +37646 55/push-ebp +37647 89/<- %ebp 4/r32/esp +37648 # setup +37649 (clear-stream _test-output-stream) +37650 (clear-stream $_test-output-buffered-file->buffer) +37651 $test-compare-eax-with-literal:initialize-type: +37652 # var type/ecx: (payload type-tree) = int +37653 68/push 0/imm32/right:null +37654 68/push 0/imm32/right:null +37655 68/push 0/imm32/left:unused +37656 68/push 1/imm32/value:int +37657 68/push 1/imm32/is-atom?:true +37658 68/push 0x11/imm32/alloc-id:fake:payload +37659 89/<- %ecx 4/r32/esp +37660 $test-compare-eax-with-literal:initialize-var1: +37661 # var var1/ecx: (payload var) +37662 68/push 0/imm32/register +37663 68/push 0/imm32/register +37664 68/push 0/imm32/no-stack-offset +37665 68/push 1/imm32/block-depth +37666 51/push-ecx +37667 68/push 0x11/imm32/alloc-id:fake +37668 68/push 0/imm32/name +37669 68/push 0/imm32/name +37670 68/push 0x11/imm32/alloc-id:fake:payload +37671 89/<- %ecx 4/r32/esp +37672 $test-compare-eax-with-literal:initialize-var1-name: +37673 # var1->name = "var1" +37674 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +37675 (copy-array Heap "var1" %eax) +37676 $test-compare-eax-with-literal:initialize-var1-register: +37677 # v->register = "eax" +37678 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +37679 (copy-array Heap "eax" %eax) +37680 $test-compare-eax-with-literal:initialize-literal-type: +37681 # var type/edx: (payload type-tree) = literal +37682 68/push 0/imm32/right:null +37683 68/push 0/imm32/right:null +37684 68/push 0/imm32/left:unused +37685 68/push 0/imm32/value:literal +37686 68/push 1/imm32/is-atom?:true +37687 68/push 0x11/imm32/alloc-id:fake:payload +37688 89/<- %edx 4/r32/esp +37689 $test-compare-eax-with-literal:initialize-literal: +37690 # var l/edx: (payload var) +37691 68/push 0/imm32/register +37692 68/push 0/imm32/register +37693 68/push 0/imm32/no-stack-offset +37694 68/push 1/imm32/block-depth +37695 52/push-edx +37696 68/push 0x11/imm32/alloc-id:fake +37697 68/push 0/imm32/name +37698 68/push 0/imm32/name +37699 68/push 0x11/imm32/alloc-id:fake:payload +37700 89/<- %edx 4/r32/esp +37701 $test-compare-eax-with-literal:initialize-literal-value: +37702 # l->name = "0x34" +37703 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +37704 (copy-array Heap "0x34" %eax) +37705 $test-compare-eax-with-literal:initialize-inouts: +37706 # var inouts/esi: (payload stmt-var) = [l] +37707 68/push 0/imm32/is-deref:false +37708 68/push 0/imm32/next +37709 68/push 0/imm32/next +37710 52/push-edx/l +37711 68/push 0x11/imm32/alloc-id:fake +37712 68/push 0x11/imm32/alloc-id:fake:payload +37713 89/<- %esi 4/r32/esp +37714 # var inouts = (handle stmt-var) = [var1, var2] +37715 68/push 0/imm32/is-deref:false +37716 56/push-esi/next +37717 68/push 0x11/imm32/alloc-id:fake +37718 51/push-ecx/var1 +37719 68/push 0x11/imm32/alloc-id:fake +37720 68/push 0x11/imm32/alloc-id:fake:payload +37721 89/<- %esi 4/r32/esp +37722 $test-compare-eax-with-literal:initialize-stmt: +37723 # var stmt/esi: (addr statement) +37724 68/push 0/imm32/next +37725 68/push 0/imm32/next +37726 68/push 0/imm32/outputs +37727 68/push 0/imm32/outputs +37728 56/push-esi/inouts +37729 68/push 0x11/imm32/alloc-id:fake +37730 68/push 0/imm32/operation +37731 68/push 0/imm32/operation +37732 68/push 1/imm32/tag:stmt1 +37733 89/<- %esi 4/r32/esp +37734 $test-compare-eax-with-literal:initialize-stmt-operation: +37735 # stmt->operation = "compare" +37736 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +37737 (copy-array Heap "compare" %eax) +37738 # convert +37739 c7 0/subop/copy *Curr-block-depth 0/imm32 +37740 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +37741 (flush _test-output-buffered-file) +37742 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +37748 # check output +37749 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal") +37750 # . epilogue +37751 89/<- %esp 5/r32/ebp +37752 5d/pop-to-ebp +37753 c3/return +37754 +37755 test-compare-reg-with-literal: +37756 # compare var1/ecx 0x34 +37757 # => +37758 # 81 7/subop/compare %ecx 0x34/imm32 +37759 # +37760 # . prologue +37761 55/push-ebp +37762 89/<- %ebp 4/r32/esp +37763 # setup +37764 (clear-stream _test-output-stream) +37765 (clear-stream $_test-output-buffered-file->buffer) +37766 $test-compare-reg-with-literal:initialize-type: +37767 # var type/ecx: (payload type-tree) = int +37768 68/push 0/imm32/right:null +37769 68/push 0/imm32/right:null +37770 68/push 0/imm32/left:unused +37771 68/push 1/imm32/value:int +37772 68/push 1/imm32/is-atom?:true +37773 68/push 0x11/imm32/alloc-id:fake:payload +37774 89/<- %ecx 4/r32/esp +37775 $test-compare-reg-with-literal:initialize-var1: +37776 # var var1/ecx: (payload var) +37777 68/push 0/imm32/register +37778 68/push 0/imm32/register +37779 68/push 0/imm32/no-stack-offset +37780 68/push 1/imm32/block-depth +37781 51/push-ecx +37782 68/push 0x11/imm32/alloc-id:fake +37783 68/push 0/imm32/name +37784 68/push 0/imm32/name +37785 68/push 0x11/imm32/alloc-id:fake:payload +37786 89/<- %ecx 4/r32/esp +37787 $test-compare-reg-with-literal:initialize-var1-name: +37788 # var1->name = "var1" +37789 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +37790 (copy-array Heap "var1" %eax) +37791 $test-compare-reg-with-literal:initialize-var1-register: +37792 # v->register = "ecx" +37793 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +37794 (copy-array Heap "ecx" %eax) +37795 $test-compare-reg-with-literal:initialize-literal-type: +37796 # var type/edx: (payload type-tree) = literal +37797 68/push 0/imm32/right:null +37798 68/push 0/imm32/right:null +37799 68/push 0/imm32/left:unused +37800 68/push 0/imm32/value:literal +37801 68/push 1/imm32/is-atom?:true +37802 68/push 0x11/imm32/alloc-id:fake:payload +37803 89/<- %edx 4/r32/esp +37804 $test-compare-reg-with-literal:initialize-literal: +37805 # var l/edx: (payload var) +37806 68/push 0/imm32/register +37807 68/push 0/imm32/register +37808 68/push 0/imm32/no-stack-offset +37809 68/push 1/imm32/block-depth +37810 52/push-edx +37811 68/push 0x11/imm32/alloc-id:fake +37812 68/push 0/imm32/name +37813 68/push 0/imm32/name +37814 68/push 0x11/imm32/alloc-id:fake:payload +37815 89/<- %edx 4/r32/esp +37816 $test-compare-reg-with-literal:initialize-literal-value: +37817 # l->name = "0x34" +37818 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +37819 (copy-array Heap "0x34" %eax) +37820 $test-compare-reg-with-literal:initialize-inouts: +37821 # var inouts/esi: (payload stmt-var) = [l] +37822 68/push 0/imm32/is-deref:false +37823 68/push 0/imm32/next +37824 68/push 0/imm32/next +37825 52/push-edx/l +37826 68/push 0x11/imm32/alloc-id:fake +37827 68/push 0x11/imm32/alloc-id:fake:payload +37828 89/<- %esi 4/r32/esp +37829 # var inouts = (handle stmt-var) = [var1, var2] +37830 68/push 0/imm32/is-deref:false +37831 56/push-esi/next +37832 68/push 0x11/imm32/alloc-id:fake +37833 51/push-ecx/var1 +37834 68/push 0x11/imm32/alloc-id:fake +37835 68/push 0x11/imm32/alloc-id:fake:payload +37836 89/<- %esi 4/r32/esp +37837 $test-compare-reg-with-literal:initialize-stmt: +37838 # var stmt/esi: (addr statement) +37839 68/push 0/imm32/next +37840 68/push 0/imm32/next +37841 68/push 0/imm32/outputs +37842 68/push 0/imm32/outputs +37843 56/push-esi/inouts +37844 68/push 0x11/imm32/alloc-id:fake +37845 68/push 0/imm32/operation +37846 68/push 0/imm32/operation +37847 68/push 1/imm32/tag:stmt1 +37848 89/<- %esi 4/r32/esp +37849 $test-compare-reg-with-literal:initialize-stmt-operation: +37850 # stmt->operation = "compare" +37851 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +37852 (copy-array Heap "compare" %eax) +37853 # convert +37854 c7 0/subop/copy *Curr-block-depth 0/imm32 +37855 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0 Stderr 0) +37856 (flush _test-output-buffered-file) +37857 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +37863 # check output +37864 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal") +37865 # . epilogue +37866 89/<- %esp 5/r32/ebp +37867 5d/pop-to-ebp +37868 c3/return +37869 +37870 test-emit-subx-stmt-function-call: +37871 # Call a function on a variable on the stack. +37872 # f foo +37873 # => +37874 # (f *(ebp-8)) +37875 # (Changing the function name supports overloading in general, but here it +37876 # just serves to help disambiguate things.) +37877 # +37878 # There's a variable on the var stack as follows: +37879 # name: 'foo' +37880 # type: int +37881 # stack-offset: -8 +37882 # +37883 # There's nothing in primitives. +37884 # +37885 # We don't perform any checking here on the type of 'f'. +37886 # +37887 # . prologue +37888 55/push-ebp +37889 89/<- %ebp 4/r32/esp +37890 # setup +37891 (clear-stream _test-output-stream) +37892 (clear-stream $_test-output-buffered-file->buffer) +37893 $test-emit-subx-function-call:initialize-type: +37894 # var type/ecx: (payload type-tree) = int +37895 68/push 0/imm32/right:null +37896 68/push 0/imm32/right:null +37897 68/push 0/imm32/left:unused +37898 68/push 1/imm32/value:int +37899 68/push 1/imm32/is-atom?:true +37900 68/push 0x11/imm32/alloc-id:fake:payload +37901 89/<- %ecx 4/r32/esp +37902 $test-emit-subx-function-call:initialize-var: +37903 # var var-foo/ecx: (payload var) = var(type) +37904 68/push 0/imm32/no-register +37905 68/push 0/imm32/no-register +37906 68/push -8/imm32/stack-offset +37907 68/push 1/imm32/block-depth +37908 51/push-ecx/type +37909 68/push 0x11/imm32/alloc-id:fake +37910 68/push 0/imm32/name +37911 68/push 0/imm32/name +37912 68/push 0x11/imm32/alloc-id:fake:payload +37913 89/<- %ecx 4/r32/esp +37914 $test-emit-subx-function-call:initialize-var-name: +37915 # var-foo->name = "foo" +37916 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +37917 (copy-array Heap "foo" %eax) +37918 $test-emit-subx-function-call:initialize-stmt-var: +37919 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +37920 68/push 0/imm32/is-deref:false +37921 68/push 0/imm32/next +37922 68/push 0/imm32/next +37923 51/push-ecx/var-foo +37924 68/push 0x11/imm32/alloc-id:fake +37925 68/push 0x11/imm32/alloc-id:fake:payload +37926 89/<- %ebx 4/r32/esp +37927 $test-emit-subx-function-call:initialize-stmt: +37928 # var stmt/esi: (addr statement) +37929 68/push 0/imm32/no-outputs +37930 68/push 0/imm32/no-outputs +37931 53/push-ebx/inouts +37932 68/push 0x11/imm32/alloc-id:fake +37933 68/push 0/imm32/operation +37934 68/push 0/imm32/operation +37935 68/push 1/imm32/tag +37936 89/<- %esi 4/r32/esp +37937 $test-emit-subx-function-call:initialize-stmt-operation: +37938 # stmt->operation = "f" +37939 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +37940 (copy-array Heap "f" %eax) +37941 # convert +37942 c7 0/subop/copy *Curr-block-depth 0/imm32 +37943 (emit-subx-stmt _test-output-buffered-file %esi 0 0 Stderr 0) +37944 (flush _test-output-buffered-file) +37945 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +37951 # check output +37952 (check-next-stream-line-equal _test-output-stream "(f *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call") +37953 # . epilogue +37954 89/<- %esp 5/r32/ebp +37955 5d/pop-to-ebp +37956 c3/return +37957 +37958 test-emit-subx-stmt-function-call-with-literal-arg: +37959 # Call a function on a literal. +37960 # f 0x34 +37961 # => +37962 # (f2 0x34) +37963 # +37964 # . prologue +37965 55/push-ebp +37966 89/<- %ebp 4/r32/esp +37967 # setup +37968 (clear-stream _test-output-stream) +37969 (clear-stream $_test-output-buffered-file->buffer) +37970 $test-emit-subx-function-call-with-literal-arg:initialize-type: +37971 # var type/ecx: (payload type-tree) = int +37972 68/push 0/imm32/right:null +37973 68/push 0/imm32/right:null +37974 68/push 0/imm32/left:unused +37975 68/push 0/imm32/value:literal +37976 68/push 1/imm32/is-atom?:true +37977 68/push 0x11/imm32/alloc-id:fake:payload +37978 89/<- %ecx 4/r32/esp +37979 $test-emit-subx-function-call-with-literal-arg:initialize-var: +37980 # var var-foo/ecx: (payload var) = var(lit) +37981 68/push 0/imm32/no-register +37982 68/push 0/imm32/no-register +37983 68/push 0/imm32/no-stack-offset +37984 68/push 1/imm32/block-depth +37985 51/push-ecx/type +37986 68/push 0x11/imm32/alloc-id:fake +37987 68/push 0/imm32/name +37988 68/push 0/imm32/name +37989 68/push 0x11/imm32/alloc-id:fake:payload +37990 89/<- %ecx 4/r32/esp +37991 $test-emit-subx-function-call-with-literal-arg:initialize-var-name: +37992 # var-foo->name = "0x34" +37993 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +37994 (copy-array Heap "0x34" %eax) +37995 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-var: +37996 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +37997 68/push 0/imm32/is-deref:false +37998 68/push 0/imm32/next +37999 68/push 0/imm32/next +38000 51/push-ecx/var-foo +38001 68/push 0x11/imm32/alloc-id:fake +38002 68/push 0x11/imm32/alloc-id:fake:payload +38003 89/<- %ebx 4/r32/esp +38004 $test-emit-subx-function-call-with-literal-arg:initialize-stmt: +38005 # var stmt/esi: (addr statement) +38006 68/push 0/imm32/no-outputs +38007 68/push 0/imm32/no-outputs +38008 53/push-ebx/inouts +38009 68/push 0x11/imm32/alloc-id:fake +38010 68/push 0/imm32/operation +38011 68/push 0/imm32/operation +38012 68/push 1/imm32/tag +38013 89/<- %esi 4/r32/esp +38014 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-operation: +38015 # stmt->operation = "f" +38016 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +38017 (copy-array Heap "f" %eax) +38018 # convert +38019 c7 0/subop/copy *Curr-block-depth 0/imm32 +38020 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx 0 Stderr 0) +38021 (flush _test-output-buffered-file) +38022 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +38028 # check output +38029 (check-next-stream-line-equal _test-output-stream "(f 0x34)" "F - test-emit-subx-stmt-function-call-with-literal-arg") +38030 # . epilogue +38031 89/<- %esp 5/r32/ebp +38032 5d/pop-to-ebp +38033 c3/return +38034 +38035 emit-indent: # out: (addr buffered-file), n: int +38036 # . prologue +38037 55/push-ebp +38038 89/<- %ebp 4/r32/esp +38039 # . save registers +38040 50/push-eax +38041 # var i/eax: int = n +38042 8b/-> *(ebp+0xc) 0/r32/eax +38043 { +38044 # if (i <= 0) break +38045 3d/compare-eax-with 0/imm32 +38046 7e/jump-if-<= break/disp8 +38047 (write-buffered *(ebp+8) " ") +38048 48/decrement-eax +38049 eb/jump loop/disp8 +38050 } +38051 $emit-indent:end: +38052 # . restore registers +38053 58/pop-to-eax +38054 # . epilogue +38055 89/<- %esp 5/r32/ebp +38056 5d/pop-to-ebp +38057 c3/return +38058 +38059 emit-subx-prologue: # out: (addr buffered-file) +38060 # . prologue +38061 55/push-ebp +38062 89/<- %ebp 4/r32/esp +38063 # +38064 (write-buffered *(ebp+8) " # . prologue\n") +38065 (write-buffered *(ebp+8) " 55/push-ebp\n") +38066 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n") +38067 $emit-subx-prologue:end: +38068 # . epilogue +38069 89/<- %esp 5/r32/ebp +38070 5d/pop-to-ebp +38071 c3/return +38072 +38073 emit-subx-epilogue: # out: (addr buffered-file) +38074 # . prologue +38075 55/push-ebp +38076 89/<- %ebp 4/r32/esp +38077 # +38078 (write-buffered *(ebp+8) " # . epilogue\n") +38079 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n") +38080 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n") +38081 (write-buffered *(ebp+8) " c3/return\n") +38082 $emit-subx-epilogue:end: +38083 # . epilogue +38084 89/<- %esp 5/r32/ebp +38085 5d/pop-to-ebp +38086 c3/return diff --git a/html/apps/pack.subx.html b/html/apps/pack.subx.html index 98acccfe..319caa09 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/3.mu.html b/html/apps/raytracing/3.mu.html index 0e6820b4..48dee774 100644 --- a/html/apps/raytracing/3.mu.html +++ b/html/apps/raytracing/3.mu.html @@ -90,7 +90,7 @@ if ('onhashchange' in window) { 29 var two-f/xmm2: float <- convert two 30 t <- divide two-f 31 #? print-string 0, "t: " - 32 #? print-float 0, t + 32 #? print-float-hex 0, t 33 #? print-string 0, "\n" 34 # whitening = (1.0 - t) * white 35 var whitening-storage: rgb @@ -104,9 +104,9 @@ if ('onhashchange' in window) { 43 #? print-string 0, "\n" 44 # out = t * (0.5, 0.7, 1.0) 45 var dest/eax: (addr float) <- get out, r - 46 fill-in-rational dest, 5, 0xa + 46 fill-in-rational dest, 5, 0xa 47 dest <- get out, g - 48 fill-in-rational dest, 7, 0xa + 48 fill-in-rational dest, 7, 0xa 49 dest <- get out, b 50 copy-to *dest, one-f 51 rgb-scale-up out, t @@ -127,9 +127,9 @@ if ('onhashchange' in window) { 66 # height = 400 * 9/16 = 225 67 var aspect: float 68 var aspect-addr/eax: (addr float) <- address aspect - 69 fill-in-rational aspect-addr, 0x10, 9 # 16/9 + 69 fill-in-rational aspect-addr, 0x10, 9 # 16/9 70 #? print-string 0, "aspect ratio: " - 71 #? print-float 0, aspect + 71 #? print-float-hex 0, aspect 72 #? print-string 0, " " 73 #? { 74 #? var foo2/ebx: int <- reinterpret aspect @@ -144,7 +144,7 @@ if ('onhashchange' in window) { 83 var two-f/xmm4: float <- convert tmp 84 var viewport-height/xmm7: float <- copy two-f 85 #? print-string 0, "viewport height: " - 86 #? print-float 0, viewport-height + 86 #? print-float-hex 0, viewport-height 87 #? print-string 0, " " 88 #? { 89 #? var foo: float @@ -157,7 +157,7 @@ if ('onhashchange' in window) { 96 var viewport-width/xmm6: float <- convert tmp 97 viewport-width <- multiply aspect 98 #? print-string 0, "viewport width: " - 99 #? print-float 0, viewport-width + 99 #? print-float-hex 0, viewport-width 100 #? print-string 0, " " 101 #? { 102 #? var foo: float @@ -231,7 +231,7 @@ if ('onhashchange' in window) { 170 var u/xmm0: float <- convert i 171 u <- divide image-width-1 172 #? print-string 0, "u: " -173 #? print-float 0, u +173 #? print-float-hex 0, u 174 #? print-string 0, "\n" 175 # v = j / (image-height - 1) 176 var v/xmm1: float <- convert j @@ -322,7 +322,7 @@ if ('onhashchange' in window) { 261 var c/esi: (addr rgb) <- copy _c 262 var xn: float 263 var xn-addr/ecx: (addr float) <- address xn -264 fill-in-rational xn-addr, 0x3e7ff, 0x3e8 # 255999 / 1000 +264 fill-in-rational xn-addr, 0x3e7ff, 0x3e8 # 255999 / 1000 265 # print 255.999 * c->r 266 var result/xmm0: float <- copy xn 267 var src-addr/eax: (addr float) <- get c, r @@ -350,13 +350,13 @@ if ('onhashchange' in window) { 289 var v/esi: (addr rgb) <- copy _v 290 print-string screen, "(" 291 var tmp/eax: (addr float) <- get v, r -292 print-float screen, *tmp +292 print-float-hex screen, *tmp 293 print-string screen, ", " 294 tmp <- get v, g -295 print-float screen, *tmp +295 print-float-hex screen, *tmp 296 print-string screen, ", " 297 tmp <- get v, b -298 print-float screen, *tmp +298 print-float-hex screen, *tmp 299 print-string screen, ")" 300 } 301 @@ -424,13 +424,13 @@ if ('onhashchange' in window) { 363 var v/esi: (addr vec3) <- copy _v 364 print-string screen, "(" 365 var tmp/eax: (addr float) <- get v, x -366 print-float screen, *tmp +366 print-float-hex screen, *tmp 367 print-string screen, ", " 368 tmp <- get v, y -369 print-float screen, *tmp +369 print-float-hex screen, *tmp 370 print-string screen, ", " 371 tmp <- get v, z -372 print-float screen, *tmp +372 print-float-hex screen, *tmp 373 print-string screen, ")" 374 } 375 @@ -512,7 +512,7 @@ if ('onhashchange' in window) { 451 fn vec3-unit in: (addr vec3), out: (addr vec3) { 452 var len/xmm0: float <- vec3-length in 453 #? print-string 0, "len: " -454 #? print-float 0, len +454 #? print-float-hex 0, len 455 #? print-string 0, "\n" 456 copy-object in, out 457 vec3-scale-down out, len diff --git a/html/apps/raytracing/color.mu.html b/html/apps/raytracing/color.mu.html index 3daaa25b..edad7f47 100644 --- a/html/apps/raytracing/color.mu.html +++ b/html/apps/raytracing/color.mu.html @@ -68,7 +68,7 @@ if ('onhashchange' in window) { 10 var c/esi: (addr rgb) <- copy _c 11 var xn: float 12 var xn-addr/ecx: (addr float) <- address xn -13 fill-in-rational xn-addr, 0x3e7ff, 0x3e8 # 255999 / 1000 +13 fill-in-rational xn-addr, 0x3e7ff, 0x3e8 # 255999 / 1000 14 # print 255.999 * c->r 15 var result/xmm0: float <- copy xn 16 var src-addr/eax: (addr float) <- get c, r diff --git a/html/apps/raytracing/vec.mu.html b/html/apps/raytracing/vec.mu.html index 9b8961c2..36084516 100644 --- a/html/apps/raytracing/vec.mu.html +++ b/html/apps/raytracing/vec.mu.html @@ -67,13 +67,13 @@ if ('onhashchange' in window) { 8 var v/esi: (addr vec3) <- copy _v 9 print-string screen, "(" 10 var tmp/eax: (addr float) <- get v, x - 11 print-float screen, *tmp + 11 print-float-hex screen, *tmp 12 print-string screen, ", " 13 tmp <- get v, y - 14 print-float screen, *tmp + 14 print-float-hex screen, *tmp 15 print-string screen, ", " 16 tmp <- get v, z - 17 print-float screen, *tmp + 17 print-float-hex screen, *tmp 18 print-string screen, ")" 19 } 20 @@ -155,7 +155,7 @@ if ('onhashchange' in window) { 96 fn vec3-unit in: (addr vec3), out: (addr vec3) { 97 var len/xmm0: float <- vec3-length in 98 #? print-string 0, "len: " - 99 #? print-float 0, len + 99 #? print-float-hex 0, len 100 #? print-string 0, "\n" 101 copy-object in, out 102 vec3-scale-down out, len diff --git a/html/apps/sigils.subx.html b/html/apps/sigils.subx.html index 37609093..c190b157 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 6dbd7ad5..f0ed15c8 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/tile/data.mu.html b/html/apps/tile/data.mu.html index 6ab72085..6e9e1f1b 100644 --- a/html/apps/tile/data.mu.html +++ b/html/apps/tile/data.mu.html @@ -95,7 +95,7 @@ if ('onhashchange' in window) { 36 # todo: turn this into a sum type 37 type value { 38 type: int - 39 int-data: int # if type = 0 + 39 number-data: float # 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 diff --git a/html/apps/tile/environment.mu.html b/html/apps/tile/environment.mu.html index 944f0019..e9140ecb 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 } @@ -120,336 +120,336 @@ if ('onhashchange' in window) { 60 ############# 61 62 fn process _self: (addr environment), key: grapheme { - 63 $process:body: { - 64 var self/esi: (addr environment) <- copy _self - 65 var sandbox-ah/eax: (addr handle sandbox) <- get self, sandboxes - 66 var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah - 67 var sandbox/edi: (addr sandbox) <- copy _sandbox - 68 var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word - 69 var rename-word-mode?/eax: (addr word) <- lookup *rename-word-mode-ah? - 70 compare rename-word-mode?, 0 - 71 { - 72 break-if-= - 73 #? print-string 0, "processing sandbox rename\n" - 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 - 78 var define-function-mode?/eax: (addr word) <- lookup *define-function-mode-ah? - 79 compare define-function-mode?, 0 - 80 { - 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 - 85 break $process:body - 86 } - 87 #? print-string 0, "processing sandbox\n" - 88 process-sandbox self, sandbox, key - 89 } - 90 } - 91 - 92 fn process-sandbox _self: (addr environment), _sandbox: (addr sandbox), key: grapheme { - 93 $process-sandbox:body: { - 94 var self/esi: (addr environment) <- copy _self - 95 var sandbox/edi: (addr sandbox) <- copy _sandbox - 96 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 97 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 98 var cursor-word-ah/ebx: (addr handle word) <- get cursor-call-path, word - 99 var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah - 100 var cursor-word/ecx: (addr word) <- copy _cursor-word - 101 compare key, 0x445b1b # left-arrow - 102 $process-sandbox:key-left-arrow: { - 103 break-if-!= - 104 #? print-string 0, "left-arrow\n" - 105 # if not at start, move left within current word - 106 var at-start?/eax: boolean <- cursor-at-start? cursor-word - 107 compare at-start?, 0 # false - 108 { - 109 break-if-!= - 110 #? print-string 0, "cursor left within word\n" - 111 cursor-left cursor-word - 112 break $process-sandbox:body - 113 } - 114 # if current word is expanded, move to the rightmost word in its body - 115 { - 116 var cursor-call-path/esi: (addr handle call-path-element) <- get sandbox, cursor-call-path - 117 var expanded-words/edx: (addr handle call-path) <- get sandbox, expanded-words - 118 var curr-word-is-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path - 119 compare curr-word-is-expanded?, 0 # false - 120 break-if-= - 121 # update cursor-call-path - 122 #? print-string 0, "curr word is expanded\n" - 123 var self/ecx: (addr environment) <- copy _self - 124 var functions/ecx: (addr handle function) <- get self, functions - 125 var body: (handle line) - 126 var body-ah/eax: (addr handle line) <- address body - 127 function-body functions, cursor-word-ah, body-ah - 128 var body-addr/eax: (addr line) <- lookup *body-ah - 129 var first-word-ah/edx: (addr handle word) <- get body-addr, data - 130 var final-word-h: (handle word) - 131 var final-word-ah/eax: (addr handle word) <- address final-word-h - 132 final-word first-word-ah, final-word-ah - 133 push-to-call-path-element cursor-call-path, final-word-ah - 134 # move cursor to end of word - 135 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 136 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 137 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word - 138 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah - 139 cursor-to-end cursor-word - 140 break $process-sandbox:body - 141 } - 142 # if at first word, look for a caller to jump to - 143 $process-sandbox:key-left-arrow-first-word: { - 144 var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev - 145 var prev-word/eax: (addr word) <- lookup *prev-word-ah - 146 compare prev-word, 0 - 147 break-if-!= - 148 $process-sandbox:key-left-arrow-first-word-and-caller: { - 149 #? print-string 0, "return\n" - 150 { - 151 var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path - 152 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 153 var next-cursor-element-ah/edx: (addr handle call-path-element) <- get cursor-call-path, next - 154 var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah - 155 compare next-cursor-element, 0 - 156 break-if-= $process-sandbox:key-left-arrow-first-word-and-caller - 157 copy-object next-cursor-element-ah, cursor-call-path-ah - 158 } - 159 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 160 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 161 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word - 162 var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah - 163 cursor-word <- copy _cursor-word - 164 } - 165 } - 166 # then move to end of previous word - 167 var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev - 168 var prev-word/eax: (addr word) <- lookup *prev-word-ah - 169 { - 170 compare prev-word, 0 - 171 break-if-= - 172 #? print-string 0, "move to previous word\n" - 173 cursor-to-end prev-word - 174 #? { - 175 #? var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 176 #? var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 177 #? var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word - 178 #? var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah - 179 #? var cursor-word/ebx: (addr word) <- copy _cursor-word - 180 #? print-string 0, "word at cursor before: " - 181 #? print-word 0, cursor-word - 182 #? print-string 0, "\n" - 183 #? } - 184 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 185 decrement-final-element cursor-call-path - 186 #? { - 187 #? var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 188 #? var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 189 #? var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word - 190 #? var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah - 191 #? var cursor-word/ebx: (addr word) <- copy _cursor-word - 192 #? print-string 0, "word at cursor after: " - 193 #? print-word 0, cursor-word - 194 #? print-string 0, "\n" - 195 #? } - 196 } - 197 break $process-sandbox:body - 198 } - 199 compare key, 0x435b1b # right-arrow - 200 $process-sandbox:key-right-arrow: { - 201 break-if-!= - 202 # if not at end, move right within current word - 203 var at-end?/eax: boolean <- cursor-at-end? cursor-word - 204 compare at-end?, 0 # false - 205 { - 206 break-if-!= - 207 #? print-string 0, "a\n" - 208 cursor-right cursor-word - 209 break $process-sandbox:body - 210 } - 211 # if at final word, look for a caller to jump to - 212 { - 213 var next-word-ah/edx: (addr handle word) <- get cursor-word, next - 214 var next-word/eax: (addr word) <- lookup *next-word-ah - 215 compare next-word, 0 - 216 break-if-!= - 217 var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path - 218 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 219 var next-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next - 220 var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah - 221 compare next-cursor-element, 0 - 222 break-if-= - 223 copy-object next-cursor-element-ah, cursor-call-path-ah - 224 break $process-sandbox:body - 225 } - 226 # otherwise, move to the next word - 227 var next-word-ah/edx: (addr handle word) <- get cursor-word, next - 228 var next-word/eax: (addr word) <- lookup *next-word-ah - 229 { - 230 compare next-word, 0 - 231 break-if-= - 232 #? print-string 0, "b\n" - 233 cursor-to-start next-word - 234 # . . cursor-word now out of date - 235 var cursor-call-path/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path - 236 increment-final-element cursor-call-path - 237 # Is the new cursor word expanded? If so, it's a function call. Add a - 238 # new level to the cursor-call-path for the call's body. - 239 $process-sandbox:key-right-arrow-next-word-is-call-expanded: { - 240 #? print-string 0, "c\n" - 241 { - 242 var expanded-words/eax: (addr handle call-path) <- get sandbox, expanded-words - 243 var curr-word-is-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path - 244 compare curr-word-is-expanded?, 0 # false - 245 break-if-= $process-sandbox:key-right-arrow-next-word-is-call-expanded - 246 } - 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 - 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 - 256 # position cursor at left - 257 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 258 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 259 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word - 260 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah - 261 cursor-to-start cursor-word - 262 #? print-string 0, "d\n" - 263 break $process-sandbox:body - 264 } - 265 } - 266 break $process-sandbox:body - 267 } - 268 compare key, 0xa # enter - 269 { - 270 break-if-!= - 271 # toggle display of subsidiary stack - 272 toggle-cursor-word sandbox - 273 break $process-sandbox:body - 274 } - 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 # 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 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 up past all calls and to start of line - 367 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 368 drop-nested-calls cursor-call-path-ah - 369 move-final-element-to-end-of-line cursor-call-path-ah - 370 # move cursor to end of word - 371 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 372 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, 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 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 + 63 var self/esi: (addr environment) <- copy _self + 64 var sandbox-ah/eax: (addr handle sandbox) <- get self, sandboxes + 65 var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + 66 var sandbox/edi: (addr sandbox) <- copy _sandbox + 67 var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word + 68 var rename-word-mode?/eax: (addr word) <- lookup *rename-word-mode-ah? + 69 compare rename-word-mode?, 0 + 70 { + 71 break-if-= + 72 #? print-string 0, "processing sandbox rename\n" + 73 process-sandbox-rename sandbox, key + 74 return + 75 } + 76 var define-function-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-function + 77 var define-function-mode?/eax: (addr word) <- lookup *define-function-mode-ah? + 78 compare define-function-mode?, 0 + 79 { + 80 break-if-= + 81 #? print-string 0, "processing function definition\n" + 82 var functions/ecx: (addr handle function) <- get self, functions + 83 process-sandbox-define sandbox, functions, key + 84 return + 85 } + 86 #? print-string 0, "processing sandbox\n" + 87 process-sandbox self, sandbox, key + 88 } + 89 + 90 fn process-sandbox _self: (addr environment), _sandbox: (addr sandbox), key: grapheme { + 91 var self/esi: (addr environment) <- copy _self + 92 var sandbox/edi: (addr sandbox) <- copy _sandbox + 93 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 94 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 95 var cursor-word-ah/ebx: (addr handle word) <- get cursor-call-path, word + 96 var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah + 97 var cursor-word/ecx: (addr word) <- copy _cursor-word + 98 compare key, 0x445b1b # left-arrow + 99 $process-sandbox:key-left-arrow: { + 100 break-if-!= + 101 #? print-string 0, "left-arrow\n" + 102 # if not at start, move left within current word + 103 var at-start?/eax: boolean <- cursor-at-start? cursor-word + 104 compare at-start?, 0 # false + 105 { + 106 break-if-!= + 107 #? print-string 0, "cursor left within word\n" + 108 cursor-left cursor-word + 109 return + 110 } + 111 # if current word is expanded, move to the rightmost word in its body + 112 { + 113 var cursor-call-path/esi: (addr handle call-path-element) <- get sandbox, cursor-call-path + 114 var expanded-words/edx: (addr handle call-path) <- get sandbox, expanded-words + 115 var curr-word-is-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path + 116 compare curr-word-is-expanded?, 0 # false + 117 break-if-= + 118 # update cursor-call-path + 119 #? print-string 0, "curr word is expanded\n" + 120 var self/ecx: (addr environment) <- copy _self + 121 var functions/ecx: (addr handle function) <- get self, functions + 122 var body: (handle line) + 123 var body-ah/eax: (addr handle line) <- address body + 124 function-body functions, cursor-word-ah, body-ah + 125 var body-addr/eax: (addr line) <- lookup *body-ah + 126 var first-word-ah/edx: (addr handle word) <- get body-addr, data + 127 var final-word-h: (handle word) + 128 var final-word-ah/eax: (addr handle word) <- address final-word-h + 129 final-word first-word-ah, final-word-ah + 130 push-to-call-path-element cursor-call-path, final-word-ah + 131 # move cursor to end of word + 132 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 133 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 134 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word + 135 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah + 136 cursor-to-end cursor-word + 137 return + 138 } + 139 # if at first word, look for a caller to jump to + 140 $process-sandbox:key-left-arrow-first-word: { + 141 var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev + 142 var prev-word/eax: (addr word) <- lookup *prev-word-ah + 143 compare prev-word, 0 + 144 break-if-!= + 145 $process-sandbox:key-left-arrow-first-word-and-caller: { + 146 #? print-string 0, "return\n" + 147 { + 148 var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + 149 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 150 var next-cursor-element-ah/edx: (addr handle call-path-element) <- get cursor-call-path, next + 151 var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah + 152 compare next-cursor-element, 0 + 153 break-if-= $process-sandbox:key-left-arrow-first-word-and-caller + 154 copy-object next-cursor-element-ah, cursor-call-path-ah + 155 } + 156 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 157 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 158 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word + 159 var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah + 160 cursor-word <- copy _cursor-word + 161 } + 162 } + 163 # then move to end of previous word + 164 var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev + 165 var prev-word/eax: (addr word) <- lookup *prev-word-ah + 166 { + 167 compare prev-word, 0 + 168 break-if-= + 169 #? print-string 0, "move to previous word\n" + 170 cursor-to-end prev-word + 171 #? { + 172 #? var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 173 #? var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 174 #? var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word + 175 #? var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah + 176 #? var cursor-word/ebx: (addr word) <- copy _cursor-word + 177 #? print-string 0, "word at cursor before: " + 178 #? print-word 0, cursor-word + 179 #? print-string 0, "\n" + 180 #? } + 181 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 182 decrement-final-element cursor-call-path + 183 #? { + 184 #? var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 185 #? var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 186 #? var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word + 187 #? var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah + 188 #? var cursor-word/ebx: (addr word) <- copy _cursor-word + 189 #? print-string 0, "word at cursor after: " + 190 #? print-word 0, cursor-word + 191 #? print-string 0, "\n" + 192 #? } + 193 } + 194 return + 195 } + 196 compare key, 0x435b1b # right-arrow + 197 $process-sandbox:key-right-arrow: { + 198 break-if-!= + 199 # if not at end, move right within current word + 200 var at-end?/eax: boolean <- cursor-at-end? cursor-word + 201 compare at-end?, 0 # false + 202 { + 203 break-if-!= + 204 #? print-string 0, "a\n" + 205 cursor-right cursor-word + 206 return + 207 } + 208 # if at final word, look for a caller to jump to + 209 { + 210 var next-word-ah/edx: (addr handle word) <- get cursor-word, next + 211 var next-word/eax: (addr word) <- lookup *next-word-ah + 212 compare next-word, 0 + 213 break-if-!= + 214 var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + 215 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 216 var next-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next + 217 var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah + 218 compare next-cursor-element, 0 + 219 break-if-= + 220 copy-object next-cursor-element-ah, cursor-call-path-ah + 221 return + 222 } + 223 # otherwise, move to the next word + 224 var next-word-ah/edx: (addr handle word) <- get cursor-word, next + 225 var next-word/eax: (addr word) <- lookup *next-word-ah + 226 { + 227 compare next-word, 0 + 228 break-if-= + 229 #? print-string 0, "b\n" + 230 cursor-to-start next-word + 231 # . . cursor-word now out of date + 232 var cursor-call-path/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path + 233 increment-final-element cursor-call-path + 234 # Is the new cursor word expanded? If so, it's a function call. Add a + 235 # new level to the cursor-call-path for the call's body. + 236 $process-sandbox:key-right-arrow-next-word-is-call-expanded: { + 237 #? print-string 0, "c\n" + 238 { + 239 var expanded-words/eax: (addr handle call-path) <- get sandbox, expanded-words + 240 var curr-word-is-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path + 241 compare curr-word-is-expanded?, 0 # false + 242 break-if-= $process-sandbox:key-right-arrow-next-word-is-call-expanded + 243 } + 244 var callee-h: (handle function) + 245 var callee-ah/edx: (addr handle function) <- address callee-h + 246 var functions/ebx: (addr handle function) <- get self, functions + 247 callee functions, next-word, callee-ah + 248 var callee/eax: (addr function) <- lookup *callee-ah + 249 var callee-body-ah/eax: (addr handle line) <- get callee, body + 250 var callee-body/eax: (addr line) <- lookup *callee-body-ah + 251 var callee-body-first-word/edx: (addr handle word) <- get callee-body, data + 252 push-to-call-path-element cursor-call-path, callee-body-first-word + 253 # position cursor at left + 254 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 255 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 256 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word + 257 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah + 258 cursor-to-start cursor-word + 259 #? print-string 0, "d\n" + 260 return + 261 } + 262 } + 263 return + 264 } + 265 compare key, 0xa # enter + 266 { + 267 break-if-!= + 268 # toggle display of subsidiary stack + 269 toggle-cursor-word sandbox + 270 return + 271 } + 272 compare key, 0xc # ctrl-l + 273 $process-sandbox:new-line: { + 274 break-if-!= + 275 # new line in sandbox + 276 append-line sandbox + 277 return + 278 } + 279 # word-based motions + 280 compare key, 2 # ctrl-b + 281 $process-sandbox:prev-word: { + 282 break-if-!= + 283 # jump to previous word at same level + 284 var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev + 285 var prev-word/eax: (addr word) <- lookup *prev-word-ah + 286 { + 287 compare prev-word, 0 + 288 break-if-= + 289 cursor-to-end prev-word + 290 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 291 decrement-final-element cursor-call-path + 292 return + 293 } + 294 # if previous word doesn't exist, try to bump up one level + 295 { + 296 var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + 297 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 298 var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next + 299 var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah + 300 compare caller-cursor-element, 0 + 301 break-if-= + 302 # check if previous word exists in caller + 303 var caller-word-ah/eax: (addr handle word) <- get caller-cursor-element, word + 304 var caller-word/eax: (addr word) <- lookup *caller-word-ah + 305 var word-before-caller-ah/eax: (addr handle word) <- get caller-word, prev + 306 var word-before-caller/eax: (addr word) <- lookup *word-before-caller-ah + 307 compare word-before-caller, 0 + 308 break-if-= + 309 # if so jump to it + 310 drop-from-call-path-element cursor-call-path-ah + 311 decrement-final-element cursor-call-path-ah + 312 return + 313 } + 314 } + 315 compare key, 6 # ctrl-f + 316 $process-sandbox:next-word: { + 317 break-if-!= + 318 #? print-string 0, "AA\n" + 319 # jump to previous word at same level + 320 var next-word-ah/edx: (addr handle word) <- get cursor-word, next + 321 var next-word/eax: (addr word) <- lookup *next-word-ah + 322 { + 323 compare next-word, 0 + 324 break-if-= + 325 #? print-string 0, "BB\n" + 326 cursor-to-end next-word + 327 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 328 increment-final-element cursor-call-path + 329 return + 330 } + 331 # if next word doesn't exist, try to bump up one level + 332 #? print-string 0, "CC\n" + 333 var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + 334 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 335 var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next + 336 var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah + 337 compare caller-cursor-element, 0 + 338 break-if-= + 339 #? print-string 0, "DD\n" + 340 copy-object caller-cursor-element-ah, cursor-call-path-ah + 341 return + 342 } + 343 # line-based motions + 344 compare key, 1 # ctrl-a + 345 $process-sandbox:start-of-line: { + 346 break-if-!= + 347 # move cursor up past all calls and to start of line + 348 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 349 drop-nested-calls cursor-call-path-ah + 350 move-final-element-to-start-of-line cursor-call-path-ah + 351 # move cursor to start of word + 352 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 353 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word + 354 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah + 355 cursor-to-start cursor-word + 356 # this works as long as the first word isn't expanded + 357 # but we don't expect to see zero-arg functions first-up + 358 return + 359 } + 360 compare key, 5 # ctrl-e + 361 $process-sandbox:end-of-line: { + 362 break-if-!= + 363 # move cursor up past all calls and to start of line + 364 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 365 drop-nested-calls cursor-call-path-ah + 366 move-final-element-to-end-of-line cursor-call-path-ah + 367 # move cursor to end of word + 368 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 369 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word + 370 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah + 371 cursor-to-end cursor-word + 372 # this works because expanded words lie to the right of their bodies + 373 # so the final word is always guaranteed to be at the top-level + 374 return + 375 } + 376 compare key, 0x15 # ctrl-u + 377 $process-sandbox:clear-line: { + 378 break-if-!= + 379 # clear line in sandbox + 380 initialize-sandbox sandbox + 381 return + 382 } + 383 # if cursor is within a call, disable editing hotkeys below + 384 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 385 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 386 var next-cursor-element-ah/eax: (addr handle call-path-element) <- get cursor-call-path, next + 387 var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah + 388 compare next-cursor-element, 0 + 389 { + 390 break-if-= + 391 return + 392 } 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: { @@ -460,7 +460,7 @@ if ('onhashchange' in window) { 400 { 401 break-if-!= 402 delete-before-cursor cursor-word - 403 break $process-sandbox:body + 403 return 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 @@ -473,7 +473,7 @@ if ('onhashchange' in window) { 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 + 416 return 417 } 418 compare key, 0x20 # space 419 $process-sandbox:space: { @@ -488,7 +488,7 @@ if ('onhashchange' in window) { 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 + 431 return 432 } 433 # if start of word is quote and grapheme before cursor is not, just insert it as usual 434 # TODO: support string escaping @@ -520,172 +520,172 @@ if ('onhashchange' in window) { 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 clear-object new-name-ah - 526 break $process-sandbox-rename:body - 527 } - 528 # if 'enter' pressed, perform rename - 529 compare key, 0xa # enter - 530 $process-sandbox-rename:commit: { - 531 break-if-!= - 532 #? print-string 0, "rename\n" - 533 # new line - 534 var new-line-h: (handle line) - 535 var new-line-ah/eax: (addr handle line) <- address new-line-h - 536 allocate new-line-ah - 537 var new-line/eax: (addr line) <- lookup *new-line-ah - 538 initialize-line new-line - 539 var new-line-word-ah/ecx: (addr handle word) <- get new-line, data - 540 { - 541 # move word at cursor to new line - 542 var cursor-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 543 var cursor/eax: (addr call-path-element) <- lookup *cursor-ah - 544 var word-at-cursor-ah/eax: (addr handle word) <- get cursor, word - 545 #? print-string 0, "cursor before at word " - 546 #? { - 547 #? var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah - 548 #? print-word 0, cursor-word - 549 #? print-string 0, "\n" - 550 #? } - 551 move-word-contents word-at-cursor-ah, new-line-word-ah - 552 # copy name to word at cursor - 553 copy-word-contents-before-cursor new-name-ah, word-at-cursor-ah - 554 #? print-string 0, "cursor after at word " - 555 #? { - 556 #? var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah - 557 #? print-word 0, cursor-word - 558 #? print-string 0, "\n" - 559 #? var foo/eax: int <- copy cursor-word - 560 #? print-int32-hex 0, foo - 561 #? print-string 0, "\n" - 562 #? } - 563 #? print-string 0, "new name word " - 564 #? { - 565 #? var new-name/eax: (addr word) <- lookup *new-name-ah - 566 #? print-word 0, new-name - 567 #? print-string 0, "\n" - 568 #? var foo/eax: int <- copy new-name - 569 #? print-int32-hex 0, foo - 570 #? print-string 0, "\n" - 571 #? } - 572 } - 573 # prepend '=' to name - 574 { - 575 var new-name/eax: (addr word) <- lookup *new-name-ah - 576 cursor-to-start new-name - 577 add-grapheme-to-word new-name, 0x3d # '=' - 578 } - 579 # append name to new line - 580 chain-words new-line-word-ah, new-name-ah - 581 # new-line->next = sandbox->data - 582 var new-line-next/ecx: (addr handle line) <- get new-line, next - 583 var sandbox-slot/edx: (addr handle line) <- get sandbox, data - 584 copy-object sandbox-slot, new-line-next - 585 # sandbox->data = new-line - 586 copy-handle new-line-h, sandbox-slot - 587 # clear partial-name-for-cursor-word - 588 clear-object new-name-ah - 589 #? var cursor-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 590 #? var cursor/eax: (addr call-path-element) <- lookup *cursor-ah - 591 #? var word-at-cursor-ah/eax: (addr handle word) <- get cursor, word - 592 #? print-string 0, "cursor after rename: " - 593 #? { - 594 #? var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah - 595 #? print-word 0, cursor-word - 596 #? print-string 0, " -- " - 597 #? var foo/eax: int <- copy cursor-word - 598 #? print-int32-hex 0, foo - 599 #? print-string 0, "\n" - 600 #? } - 601 break $process-sandbox-rename:body - 602 } - 603 # - 604 compare key, 0x7f # del (backspace on Macs) - 605 $process-sandbox-rename:backspace: { - 606 break-if-!= - 607 # if not at start, delete grapheme before cursor - 608 var new-name/eax: (addr word) <- lookup *new-name-ah - 609 var at-start?/eax: boolean <- cursor-at-start? new-name - 610 compare at-start?, 0 # false - 611 { - 612 break-if-!= - 613 var new-name/eax: (addr word) <- lookup *new-name-ah - 614 delete-before-cursor new-name - 615 } - 616 break $process-sandbox-rename:body - 617 } - 618 # otherwise insert key within current word - 619 var print?/eax: boolean <- real-grapheme? key - 620 $process-sandbox-rename:real-grapheme: { - 621 compare print?, 0 # false - 622 break-if-= - 623 var new-name/eax: (addr word) <- lookup *new-name-ah - 624 add-grapheme-to-word new-name, key - 625 break $process-sandbox-rename:body - 626 } - 627 # silently ignore other hotkeys - 628 } + 463 { + 464 break-if-= + 465 return + 466 } + 467 # otherwise we're in the middle of a word + 468 # move everything after cursor to the (just created) next word + 469 var next-word-ah/eax: (addr handle word) <- get cursor-word, next + 470 var _next-word/eax: (addr word) <- lookup *next-word-ah + 471 var next-word/ebx: (addr word) <- copy _next-word + 472 { + 473 var at-end?/eax: boolean <- cursor-at-end? cursor-word + 474 compare at-end?, 0 # false + 475 break-if-!= + 476 var g/eax: grapheme <- pop-after-cursor cursor-word + 477 add-grapheme-to-word next-word, g + 478 loop + 479 } + 480 cursor-to-start next-word + 481 return + 482 } + 483 compare key, 0xe # ctrl-n + 484 $process:rename-word: { + 485 break-if-!= + 486 # TODO: ensure current word is not a function + 487 # rename word at cursor + 488 var new-name-ah/eax: (addr handle word) <- get sandbox, partial-name-for-cursor-word + 489 allocate new-name-ah + 490 var new-name/eax: (addr word) <- lookup *new-name-ah + 491 initialize-word new-name + 492 return + 493 } + 494 compare key, 4 # ctrl-d + 495 $process:define-function: { + 496 break-if-!= + 497 # define function out of line at cursor + 498 var new-name-ah/eax: (addr handle word) <- get sandbox, partial-name-for-function + 499 allocate new-name-ah + 500 var new-name/eax: (addr word) <- lookup *new-name-ah + 501 initialize-word new-name + 502 return + 503 } + 504 # otherwise insert key within current word + 505 var g/edx: grapheme <- copy key + 506 var print?/eax: boolean <- real-grapheme? key + 507 $process-sandbox:real-grapheme: { + 508 compare print?, 0 # false + 509 break-if-= + 510 add-grapheme-to-word cursor-word, g + 511 return + 512 } + 513 # silently ignore other hotkeys + 514 } + 515 + 516 # collect new name in partial-name-for-cursor-word, and then rename the word + 517 # at cursor to it + 518 # Precondition: cursor-call-path is a singleton (not within a call) + 519 fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme { + 520 var sandbox/esi: (addr sandbox) <- copy _sandbox + 521 var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-cursor-word + 522 # if 'esc' pressed, cancel rename + 523 compare key, 0x1b # esc + 524 $process-sandbox-rename:cancel: { + 525 break-if-!= + 526 clear-object new-name-ah + 527 return + 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 clear-object new-name-ah + 590 #? var cursor-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 591 #? var cursor/eax: (addr call-path-element) <- lookup *cursor-ah + 592 #? var word-at-cursor-ah/eax: (addr handle word) <- get cursor, word + 593 #? print-string 0, "cursor after rename: " + 594 #? { + 595 #? var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah + 596 #? print-word 0, cursor-word + 597 #? print-string 0, " -- " + 598 #? var foo/eax: int <- copy cursor-word + 599 #? print-int32-hex 0, foo + 600 #? print-string 0, "\n" + 601 #? } + 602 return + 603 } + 604 # + 605 compare key, 0x7f # del (backspace on Macs) + 606 $process-sandbox-rename:backspace: { + 607 break-if-!= + 608 # if not at start, delete grapheme before cursor + 609 var new-name/eax: (addr word) <- lookup *new-name-ah + 610 var at-start?/eax: boolean <- cursor-at-start? new-name + 611 compare at-start?, 0 # false + 612 { + 613 break-if-!= + 614 var new-name/eax: (addr word) <- lookup *new-name-ah + 615 delete-before-cursor new-name + 616 } + 617 return + 618 } + 619 # otherwise insert key within current word + 620 var print?/eax: boolean <- real-grapheme? key + 621 $process-sandbox-rename:real-grapheme: { + 622 compare print?, 0 # false + 623 break-if-= + 624 var new-name/eax: (addr word) <- lookup *new-name-ah + 625 add-grapheme-to-word new-name, key + 626 return + 627 } + 628 # silently ignore other hotkeys 629 } 630 631 # collect new name in partial-name-for-function, and then define the last line @@ -693,1039 +693,1033 @@ if ('onhashchange' in window) { 633 # with a call to the appropriate function. 634 # Precondition: cursor-call-path is a singleton (not within a call) 635 fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle function), key: grapheme { - 636 $process-sandbox-define:body: { - 637 var sandbox/esi: (addr sandbox) <- copy _sandbox - 638 var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-function - 639 # if 'esc' pressed, cancel define - 640 compare key, 0x1b # esc - 641 $process-sandbox-define:cancel: { - 642 break-if-!= - 643 clear-object new-name-ah - 644 break $process-sandbox-define:body - 645 } - 646 # if 'enter' pressed, perform define - 647 compare key, 0xa # enter - 648 $process-sandbox-define:commit: { - 649 break-if-!= - 650 #? print-string 0, "define\n" - 651 # create new function - 652 var new-function: (handle function) - 653 var new-function-ah/ecx: (addr handle function) <- address new-function - 654 allocate new-function-ah - 655 var _new-function/eax: (addr function) <- lookup *new-function-ah - 656 var new-function/ebx: (addr function) <- copy _new-function - 657 var dest/edx: (addr handle function) <- get new-function, next - 658 copy-object functions, dest - 659 copy-object new-function-ah, functions - 660 # set function name to new-name - 661 var new-name/eax: (addr word) <- lookup *new-name-ah - 662 var dest/edx: (addr handle array byte) <- get new-function, name - 663 word-to-string new-name, dest - 664 # move final line to body - 665 var body-ah/eax: (addr handle line) <- get new-function, body - 666 allocate body-ah - 667 var body/eax: (addr line) <- lookup *body-ah - 668 var body-contents/ecx: (addr handle word) <- get body, data - 669 var final-line-storage: (handle line) - 670 var final-line-ah/eax: (addr handle line) <- address final-line-storage - 671 final-line sandbox, final-line-ah - 672 var final-line/eax: (addr line) <- lookup *final-line-ah - 673 var final-line-contents/eax: (addr handle word) <- get final-line, data - 674 copy-object final-line-contents, body-contents - 675 # - 676 copy-unbound-words-to-args functions - 677 # - 678 var empty-word: (handle word) - 679 copy-handle empty-word, final-line-contents - 680 construct-call functions, final-line-contents - 681 # clear partial-name-for-function - 682 var empty-word: (handle word) - 683 copy-handle empty-word, new-name-ah - 684 # update cursor - 685 var final-line/eax: (addr line) <- lookup final-line-storage - 686 var cursor-call-path-ah/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path - 687 allocate cursor-call-path-ah # leak - 688 initialize-path-from-line final-line, cursor-call-path-ah - 689 break $process-sandbox-define:body - 690 } - 691 # - 692 compare key, 0x7f # del (backspace on Macs) - 693 $process-sandbox-define:backspace: { - 694 break-if-!= - 695 # if not at start, delete grapheme before cursor - 696 var new-name/eax: (addr word) <- lookup *new-name-ah - 697 var at-start?/eax: boolean <- cursor-at-start? new-name - 698 compare at-start?, 0 # false - 699 { - 700 break-if-!= - 701 var new-name/eax: (addr word) <- lookup *new-name-ah - 702 delete-before-cursor new-name - 703 } - 704 break $process-sandbox-define:body - 705 } - 706 # otherwise insert key within current word - 707 var print?/eax: boolean <- real-grapheme? key - 708 $process-sandbox-define:real-grapheme: { - 709 compare print?, 0 # false - 710 break-if-= - 711 var new-name/eax: (addr word) <- lookup *new-name-ah - 712 add-grapheme-to-word new-name, key - 713 break $process-sandbox-define:body - 714 } - 715 # silently ignore other hotkeys - 716 } - 717 } - 718 - 719 # extract from the body of the first function in 'functions' all words that - 720 # aren't defined in the rest of 'functions'. Prepend them in reverse order. - 721 # Assumes function body is a single line for now. - 722 fn copy-unbound-words-to-args _functions: (addr handle function) { - 723 # target - 724 var target-ah/eax: (addr handle function) <- copy _functions - 725 var _target/eax: (addr function) <- lookup *target-ah - 726 var target/esi: (addr function) <- copy _target - 727 var dest-ah/edi: (addr handle word) <- get target, args - 728 # next - 729 var functions-ah/edx: (addr handle function) <- get target, next - 730 # src - 731 var line-ah/eax: (addr handle line) <- get target, body - 732 var line/eax: (addr line) <- lookup *line-ah - 733 var curr-ah/eax: (addr handle word) <- get line, data - 734 var curr/eax: (addr word) <- lookup *curr-ah - 735 { - 736 compare curr, 0 - 737 break-if-= - 738 $copy-unbound-words-to-args:loop-iter: { - 739 # is it a number? - 740 { - 741 var is-int?/eax: boolean <- word-is-decimal-integer? curr - 742 compare is-int?, 0 # false - 743 break-if-!= $copy-unbound-words-to-args:loop-iter - 744 } - 745 # is it a pre-existing function? - 746 var bound?/ebx: boolean <- bound-function? curr, functions-ah - 747 compare bound?, 0 # false - 748 break-if-!= - 749 # is it already bound as an arg? - 750 var dup?/ebx: boolean <- arg-exists? _functions, curr # _functions = target-ah - 751 compare dup?, 0 # false - 752 break-if-!= $copy-unbound-words-to-args:loop-iter - 753 # push copy of curr before dest-ah - 754 var rest-h: (handle word) - 755 var rest-ah/ecx: (addr handle word) <- address rest-h - 756 copy-object dest-ah, rest-ah - 757 copy-word curr, dest-ah - 758 chain-words dest-ah, rest-ah - 759 } - 760 var next-ah/ecx: (addr handle word) <- get curr, next - 761 curr <- lookup *next-ah - 762 loop - 763 } - 764 } - 765 - 766 fn bound-function? w: (addr word), functions-ah: (addr handle function) -> _/ebx: boolean { - 767 var result/ebx: boolean <- copy 1 # true - 768 { - 769 ## numbers - 770 # if w == "+" return true - 771 var subresult/eax: boolean <- word-equal? w, "+" - 772 compare subresult, 0 # false - 773 break-if-!= - 774 # if w == "-" return true - 775 subresult <- word-equal? w, "-" - 776 compare subresult, 0 # false - 777 break-if-!= - 778 # if w == "*" return true - 779 subresult <- word-equal? w, "*" - 780 compare subresult, 0 # false - 781 break-if-!= - 782 ## strings/arrays - 783 # if w == "len" return true - 784 subresult <- word-equal? w, "len" - 785 compare subresult, 0 # false - 786 break-if-!= - 787 ## files - 788 # if w == "open" return true - 789 subresult <- word-equal? w, "open" - 790 compare subresult, 0 # false - 791 break-if-!= - 792 # if w == "read" return true - 793 subresult <- word-equal? w, "read" - 794 compare subresult, 0 # false - 795 break-if-!= - 796 # if w == "slurp" return true - 797 subresult <- word-equal? w, "slurp" - 798 compare subresult, 0 # false - 799 break-if-!= - 800 # if w == "lines" return true - 801 subresult <- word-equal? w, "lines" - 802 compare subresult, 0 # false - 803 break-if-!= - 804 ## screens - 805 # if w == "fake-screen" return true - 806 subresult <- word-equal? w, "fake-screen" - 807 compare subresult, 0 # false - 808 break-if-!= - 809 # if w == "print" return true - 810 subresult <- word-equal? w, "print" - 811 compare subresult, 0 # false - 812 break-if-!= - 813 # if w == "move" return true - 814 subresult <- word-equal? w, "move" - 815 compare subresult, 0 # false - 816 break-if-!= - 817 # if w == "up" return true - 818 subresult <- word-equal? w, "up" - 819 compare subresult, 0 # false - 820 break-if-!= - 821 # if w == "down" return true - 822 subresult <- word-equal? w, "down" - 823 compare subresult, 0 # false - 824 break-if-!= - 825 # if w == "left" return true - 826 subresult <- word-equal? w, "left" - 827 compare subresult, 0 # false - 828 break-if-!= - 829 # if w == "right" return true - 830 subresult <- word-equal? w, "right" - 831 compare subresult, 0 # false - 832 break-if-!= - 833 ## hacks - 834 # if w == "dup" return true - 835 subresult <- word-equal? w, "dup" - 836 compare subresult, 0 # false - 837 break-if-!= - 838 # if w == "swap" return true - 839 subresult <- word-equal? w, "swap" - 840 compare subresult, 0 # false - 841 break-if-!= - 842 # return w in functions - 843 var out-h: (handle function) - 844 var out/eax: (addr handle function) <- address out-h - 845 callee functions-ah, w, out - 846 var found?/eax: (addr function) <- lookup *out - 847 result <- copy found? - 848 } - 849 return result - 850 } - 851 - 852 fn arg-exists? _f-ah: (addr handle function), arg: (addr word) -> _/ebx: boolean { - 853 var f-ah/eax: (addr handle function) <- copy _f-ah - 854 var f/eax: (addr function) <- lookup *f-ah - 855 var args-ah/eax: (addr handle word) <- get f, args - 856 var result/ebx: boolean <- word-exists? args-ah, arg - 857 return result - 858 } - 859 - 860 # construct a call to `f` with copies of exactly its args - 861 fn construct-call _f-ah: (addr handle function), _dest-ah: (addr handle word) { - 862 var f-ah/eax: (addr handle function) <- copy _f-ah - 863 var _f/eax: (addr function) <- lookup *f-ah - 864 var f/esi: (addr function) <- copy _f - 865 # append args in reverse - 866 var args-ah/eax: (addr handle word) <- get f, args - 867 var dest-ah/edi: (addr handle word) <- copy _dest-ah - 868 copy-words-in-reverse args-ah, dest-ah - 869 # append name - 870 var name-ah/eax: (addr handle array byte) <- get f, name - 871 var name/eax: (addr array byte) <- lookup *name-ah - 872 append-word-at-end-with dest-ah, name - 873 } - 874 - 875 fn word-index _words: (addr handle word), _n: int, out: (addr handle word) { - 876 $word-index:body: { - 877 var n/ecx: int <- copy _n - 878 { - 879 compare n, 0 - 880 break-if-!= - 881 copy-object _words, out - 882 break $word-index:body - 883 } - 884 var words-ah/eax: (addr handle word) <- copy _words - 885 var words/eax: (addr word) <- lookup *words-ah - 886 var next/eax: (addr handle word) <- get words, next - 887 n <- decrement - 888 word-index next, n, out - 889 } - 890 } - 891 - 892 fn toggle-cursor-word _sandbox: (addr sandbox) { - 893 $toggle-cursor-word:body: { - 894 var sandbox/esi: (addr sandbox) <- copy _sandbox - 895 var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words - 896 var cursor-call-path/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path - 897 #? print-string 0, "cursor call path: " - 898 #? dump-call-path-element 0, cursor-call-path - 899 #? print-string 0, "expanded words:\n" - 900 #? dump-call-paths 0, expanded-words - 901 var already-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path - 902 compare already-expanded?, 0 # false - 903 { - 904 break-if-!= - 905 #? print-string 0, "expand\n" - 906 # if not already-expanded, insert - 907 insert-in-call-path expanded-words cursor-call-path - 908 #? print-string 0, "expanded words now:\n" - 909 #? dump-call-paths 0, expanded-words - 910 break $toggle-cursor-word:body + 636 var sandbox/esi: (addr sandbox) <- copy _sandbox + 637 var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-function + 638 # if 'esc' pressed, cancel define + 639 compare key, 0x1b # esc + 640 $process-sandbox-define:cancel: { + 641 break-if-!= + 642 clear-object new-name-ah + 643 return + 644 } + 645 # if 'enter' pressed, perform define + 646 compare key, 0xa # enter + 647 $process-sandbox-define:commit: { + 648 break-if-!= + 649 #? print-string 0, "define\n" + 650 # create new function + 651 var new-function: (handle function) + 652 var new-function-ah/ecx: (addr handle function) <- address new-function + 653 allocate new-function-ah + 654 var _new-function/eax: (addr function) <- lookup *new-function-ah + 655 var new-function/ebx: (addr function) <- copy _new-function + 656 var dest/edx: (addr handle function) <- get new-function, next + 657 copy-object functions, dest + 658 copy-object new-function-ah, functions + 659 # set function name to new-name + 660 var new-name/eax: (addr word) <- lookup *new-name-ah + 661 var dest/edx: (addr handle array byte) <- get new-function, name + 662 word-to-string new-name, dest + 663 # move final line to body + 664 var body-ah/eax: (addr handle line) <- get new-function, body + 665 allocate body-ah + 666 var body/eax: (addr line) <- lookup *body-ah + 667 var body-contents/ecx: (addr handle word) <- get body, data + 668 var final-line-storage: (handle line) + 669 var final-line-ah/eax: (addr handle line) <- address final-line-storage + 670 final-line sandbox, final-line-ah + 671 var final-line/eax: (addr line) <- lookup *final-line-ah + 672 var final-line-contents/eax: (addr handle word) <- get final-line, data + 673 copy-object final-line-contents, body-contents + 674 # + 675 copy-unbound-words-to-args functions + 676 # + 677 var empty-word: (handle word) + 678 copy-handle empty-word, final-line-contents + 679 construct-call functions, final-line-contents + 680 # clear partial-name-for-function + 681 var empty-word: (handle word) + 682 copy-handle empty-word, new-name-ah + 683 # update cursor + 684 var final-line/eax: (addr line) <- lookup final-line-storage + 685 var cursor-call-path-ah/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path + 686 allocate cursor-call-path-ah # leak + 687 initialize-path-from-line final-line, cursor-call-path-ah + 688 return + 689 } + 690 # + 691 compare key, 0x7f # del (backspace on Macs) + 692 $process-sandbox-define:backspace: { + 693 break-if-!= + 694 # if not at start, delete grapheme before cursor + 695 var new-name/eax: (addr word) <- lookup *new-name-ah + 696 var at-start?/eax: boolean <- cursor-at-start? new-name + 697 compare at-start?, 0 # false + 698 { + 699 break-if-!= + 700 var new-name/eax: (addr word) <- lookup *new-name-ah + 701 delete-before-cursor new-name + 702 } + 703 return + 704 } + 705 # otherwise insert key within current word + 706 var print?/eax: boolean <- real-grapheme? key + 707 $process-sandbox-define:real-grapheme: { + 708 compare print?, 0 # false + 709 break-if-= + 710 var new-name/eax: (addr word) <- lookup *new-name-ah + 711 add-grapheme-to-word new-name, key + 712 return + 713 } + 714 # silently ignore other hotkeys + 715 } + 716 + 717 # extract from the body of the first function in 'functions' all words that + 718 # aren't defined in the rest of 'functions'. Prepend them in reverse order. + 719 # Assumes function body is a single line for now. + 720 fn copy-unbound-words-to-args _functions: (addr handle function) { + 721 # target + 722 var target-ah/eax: (addr handle function) <- copy _functions + 723 var _target/eax: (addr function) <- lookup *target-ah + 724 var target/esi: (addr function) <- copy _target + 725 var dest-ah/edi: (addr handle word) <- get target, args + 726 # next + 727 var functions-ah/edx: (addr handle function) <- get target, next + 728 # src + 729 var line-ah/eax: (addr handle line) <- get target, body + 730 var line/eax: (addr line) <- lookup *line-ah + 731 var curr-ah/eax: (addr handle word) <- get line, data + 732 var curr/eax: (addr word) <- lookup *curr-ah + 733 { + 734 compare curr, 0 + 735 break-if-= + 736 $copy-unbound-words-to-args:loop-iter: { + 737 # is it a number? + 738 { + 739 var is-int?/eax: boolean <- word-is-decimal-integer? curr + 740 compare is-int?, 0 # false + 741 break-if-!= $copy-unbound-words-to-args:loop-iter + 742 } + 743 # is it a pre-existing function? + 744 var bound?/ebx: boolean <- bound-function? curr, functions-ah + 745 compare bound?, 0 # false + 746 break-if-!= + 747 # is it already bound as an arg? + 748 var dup?/ebx: boolean <- arg-exists? _functions, curr # _functions = target-ah + 749 compare dup?, 0 # false + 750 break-if-!= $copy-unbound-words-to-args:loop-iter + 751 # push copy of curr before dest-ah + 752 var rest-h: (handle word) + 753 var rest-ah/ecx: (addr handle word) <- address rest-h + 754 copy-object dest-ah, rest-ah + 755 copy-word curr, dest-ah + 756 chain-words dest-ah, rest-ah + 757 } + 758 var next-ah/ecx: (addr handle word) <- get curr, next + 759 curr <- lookup *next-ah + 760 loop + 761 } + 762 } + 763 + 764 fn bound-function? w: (addr word), functions-ah: (addr handle function) -> _/ebx: boolean { + 765 var result/ebx: boolean <- copy 1 # true + 766 { + 767 ## numbers + 768 # if w == "+" return true + 769 var subresult/eax: boolean <- word-equal? w, "+" + 770 compare subresult, 0 # false + 771 break-if-!= + 772 # if w == "-" return true + 773 subresult <- word-equal? w, "-" + 774 compare subresult, 0 # false + 775 break-if-!= + 776 # if w == "*" return true + 777 subresult <- word-equal? w, "*" + 778 compare subresult, 0 # false + 779 break-if-!= + 780 ## strings/arrays + 781 # if w == "len" return true + 782 subresult <- word-equal? w, "len" + 783 compare subresult, 0 # false + 784 break-if-!= + 785 ## files + 786 # if w == "open" return true + 787 subresult <- word-equal? w, "open" + 788 compare subresult, 0 # false + 789 break-if-!= + 790 # if w == "read" return true + 791 subresult <- word-equal? w, "read" + 792 compare subresult, 0 # false + 793 break-if-!= + 794 # if w == "slurp" return true + 795 subresult <- word-equal? w, "slurp" + 796 compare subresult, 0 # false + 797 break-if-!= + 798 # if w == "lines" return true + 799 subresult <- word-equal? w, "lines" + 800 compare subresult, 0 # false + 801 break-if-!= + 802 ## screens + 803 # if w == "fake-screen" return true + 804 subresult <- word-equal? w, "fake-screen" + 805 compare subresult, 0 # false + 806 break-if-!= + 807 # if w == "print" return true + 808 subresult <- word-equal? w, "print" + 809 compare subresult, 0 # false + 810 break-if-!= + 811 # if w == "move" return true + 812 subresult <- word-equal? w, "move" + 813 compare subresult, 0 # false + 814 break-if-!= + 815 # if w == "up" return true + 816 subresult <- word-equal? w, "up" + 817 compare subresult, 0 # false + 818 break-if-!= + 819 # if w == "down" return true + 820 subresult <- word-equal? w, "down" + 821 compare subresult, 0 # false + 822 break-if-!= + 823 # if w == "left" return true + 824 subresult <- word-equal? w, "left" + 825 compare subresult, 0 # false + 826 break-if-!= + 827 # if w == "right" return true + 828 subresult <- word-equal? w, "right" + 829 compare subresult, 0 # false + 830 break-if-!= + 831 ## hacks + 832 # if w == "dup" return true + 833 subresult <- word-equal? w, "dup" + 834 compare subresult, 0 # false + 835 break-if-!= + 836 # if w == "swap" return true + 837 subresult <- word-equal? w, "swap" + 838 compare subresult, 0 # false + 839 break-if-!= + 840 # return w in functions + 841 var out-h: (handle function) + 842 var out/eax: (addr handle function) <- address out-h + 843 callee functions-ah, w, out + 844 var found?/eax: (addr function) <- lookup *out + 845 result <- copy found? + 846 } + 847 return result + 848 } + 849 + 850 fn arg-exists? _f-ah: (addr handle function), arg: (addr word) -> _/ebx: boolean { + 851 var f-ah/eax: (addr handle function) <- copy _f-ah + 852 var f/eax: (addr function) <- lookup *f-ah + 853 var args-ah/eax: (addr handle word) <- get f, args + 854 var result/ebx: boolean <- word-exists? args-ah, arg + 855 return result + 856 } + 857 + 858 # construct a call to `f` with copies of exactly its args + 859 fn construct-call _f-ah: (addr handle function), _dest-ah: (addr handle word) { + 860 var f-ah/eax: (addr handle function) <- copy _f-ah + 861 var _f/eax: (addr function) <- lookup *f-ah + 862 var f/esi: (addr function) <- copy _f + 863 # append args in reverse + 864 var args-ah/eax: (addr handle word) <- get f, args + 865 var dest-ah/edi: (addr handle word) <- copy _dest-ah + 866 copy-words-in-reverse args-ah, dest-ah + 867 # append name + 868 var name-ah/eax: (addr handle array byte) <- get f, name + 869 var name/eax: (addr array byte) <- lookup *name-ah + 870 append-word-at-end-with dest-ah, name + 871 } + 872 + 873 fn word-index _words: (addr handle word), _n: int, out: (addr handle word) { + 874 var n/ecx: int <- copy _n + 875 { + 876 compare n, 0 + 877 break-if-!= + 878 copy-object _words, out + 879 return + 880 } + 881 var words-ah/eax: (addr handle word) <- copy _words + 882 var words/eax: (addr word) <- lookup *words-ah + 883 var next/eax: (addr handle word) <- get words, next + 884 n <- decrement + 885 word-index next, n, out + 886 } + 887 + 888 fn toggle-cursor-word _sandbox: (addr sandbox) { + 889 var sandbox/esi: (addr sandbox) <- copy _sandbox + 890 var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words + 891 var cursor-call-path/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path + 892 #? print-string 0, "cursor call path: " + 893 #? dump-call-path-element 0, cursor-call-path + 894 #? print-string 0, "expanded words:\n" + 895 #? dump-call-paths 0, expanded-words + 896 var already-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path + 897 compare already-expanded?, 0 # false + 898 { + 899 break-if-!= + 900 #? print-string 0, "expand\n" + 901 # if not already-expanded, insert + 902 insert-in-call-path expanded-words cursor-call-path + 903 #? print-string 0, "expanded words now:\n" + 904 #? dump-call-paths 0, expanded-words + 905 return + 906 } + 907 { + 908 break-if-= + 909 # otherwise delete + 910 delete-in-call-path expanded-words cursor-call-path 911 } - 912 { - 913 break-if-= - 914 # otherwise delete - 915 delete-in-call-path expanded-words cursor-call-path - 916 } - 917 } - 918 } - 919 - 920 fn append-line _sandbox: (addr sandbox) { - 921 var sandbox/esi: (addr sandbox) <- copy _sandbox - 922 var line-ah/ecx: (addr handle line) <- get sandbox, data - 923 { - 924 var line/eax: (addr line) <- lookup *line-ah - 925 var next-line-ah/edx: (addr handle line) <- get line, next - 926 var next-line/eax: (addr line) <- lookup *next-line-ah - 927 compare next-line, 0 - 928 break-if-= - 929 line-ah <- copy next-line-ah - 930 loop - 931 } - 932 var line/eax: (addr line) <- lookup *line-ah - 933 var final-line-ah/edx: (addr handle line) <- get line, next - 934 allocate final-line-ah - 935 var final-line/eax: (addr line) <- lookup *final-line-ah - 936 initialize-line final-line - 937 var final-prev/eax: (addr handle line) <- get final-line, prev - 938 copy-object line-ah, final-prev - 939 # clear cursor - 940 var final-line/eax: (addr line) <- lookup *final-line-ah - 941 var word-ah/ecx: (addr handle word) <- get final-line, data - 942 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 943 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 944 var dest/eax: (addr handle word) <- get cursor-call-path, word - 945 copy-object word-ah, dest - 946 } - 947 - 948 ############# - 949 # Visualize - 950 ############# - 951 - 952 fn evaluate-environment _env: (addr environment), stack: (addr value-stack) { - 953 var env/esi: (addr environment) <- copy _env - 954 # functions - 955 var functions/edx: (addr handle function) <- get env, functions - 956 # line - 957 var sandbox-ah/esi: (addr handle sandbox) <- get env, sandboxes - 958 var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah - 959 var line-ah/eax: (addr handle line) <- get sandbox, data - 960 var _line/eax: (addr line) <- lookup *line-ah - 961 var line/esi: (addr line) <- copy _line - 962 evaluate functions, 0, line, 0, stack - 963 } - 964 - 965 fn render _env: (addr environment) { - 966 #? print-string 0, "== render\n" - 967 var env/esi: (addr environment) <- copy _env - 968 clear-canvas env - 969 # screen - 970 var screen-ah/eax: (addr handle screen) <- get env, screen - 971 var _screen/eax: (addr screen) <- lookup *screen-ah - 972 var screen/edi: (addr screen) <- copy _screen - 973 # repl-col - 974 var _repl-col/eax: (addr int) <- get env, code-separator-col - 975 var repl-col/ecx: int <- copy *_repl-col - 976 repl-col <- add 2 # repl-margin-left - 977 # functions - 978 var functions/edx: (addr handle function) <- get env, functions - 979 # sandbox - 980 var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes - 981 var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah - 982 # bindings - 983 var bindings-storage: table - 984 var bindings/ebx: (addr table) <- address bindings-storage - 985 initialize-table bindings, 0x10 - 986 #? print-string 0, "render-sandbox {\n" - 987 render-sandbox screen, functions, bindings, sandbox, 3, repl-col - 988 #? print-string 0, "render-sandbox }\n" - 989 } - 990 - 991 fn render-sandbox screen: (addr screen), functions: (addr handle function), bindings: (addr table), _sandbox: (addr sandbox), top-row: int, left-col: int { - 992 var sandbox/esi: (addr sandbox) <- copy _sandbox - 993 # line - 994 var curr-line-ah/eax: (addr handle line) <- get sandbox, data - 995 var _curr-line/eax: (addr line) <- lookup *curr-line-ah - 996 var curr-line/ecx: (addr line) <- copy _curr-line - 997 # - 998 var curr-row/edx: int <- copy top-row - 999 # cursor row, col -1000 var cursor-row: int -1001 var cursor-row-addr: (addr int) -1002 var tmp/eax: (addr int) <- address cursor-row -1003 copy-to cursor-row-addr, tmp -1004 var cursor-col: int -1005 var cursor-col-addr: (addr int) -1006 tmp <- address cursor-col -1007 copy-to cursor-col-addr, tmp -1008 # render all but final line without stack -1009 #? print-string 0, "render all but final line\n" -1010 { -1011 var next-line-ah/eax: (addr handle line) <- get curr-line, next -1012 var next-line/eax: (addr line) <- lookup *next-line-ah -1013 compare next-line, 0 -1014 break-if-= -1015 { -1016 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path -1017 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah -1018 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word -1019 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah -1020 # 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 -1021 render-line-without-stack screen, curr-line, curr-row, left-col, cursor-word, cursor-row-addr, cursor-col-addr -1022 } -1023 curr-line <- copy next-line -1024 curr-row <- add 2 -1025 loop -1026 } -1027 # -1028 render-final-line-with-stack screen, functions, bindings, sandbox, curr-row, left-col, cursor-row-addr, cursor-col-addr -1029 # at most one of the following dialogs will be rendered -1030 render-rename-dialog screen, sandbox, cursor-row, cursor-col -1031 render-define-dialog screen, sandbox, cursor-row, cursor-col -1032 move-cursor screen, cursor-row, cursor-col -1033 } -1034 -1035 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) { -1036 var sandbox/esi: (addr sandbox) <- copy _sandbox -1037 # expanded-words -1038 var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words -1039 # cursor-word -1040 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path -1041 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah -1042 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word -1043 var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah -1044 var cursor-word/ebx: (addr word) <- copy _cursor-word -1045 #? print-string 0, "word at cursor: " -1046 #? print-word 0, cursor-word -1047 #? print-string 0, "\n" -1048 # cursor-call-path -1049 var cursor-call-path: (addr handle call-path-element) -1050 { -1051 var src/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path -1052 copy-to cursor-call-path, src -1053 } -1054 # first line -1055 var first-line-ah/eax: (addr handle line) <- get sandbox, data -1056 var _first-line/eax: (addr line) <- lookup *first-line-ah -1057 var first-line/edx: (addr line) <- copy _first-line -1058 # final line -1059 var final-line-storage: (handle line) -1060 var final-line-ah/eax: (addr handle line) <- address final-line-storage -1061 final-line sandbox, final-line-ah -1062 var final-line/eax: (addr line) <- lookup *final-line-ah -1063 # curr-path -1064 var curr-path-storage: (handle call-path-element) -1065 var curr-path/ecx: (addr handle call-path-element) <- address curr-path-storage -1066 allocate curr-path # leak -1067 initialize-path-from-line final-line, curr-path -1068 # -1069 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 -1070 } -1071 -1072 fn final-line _sandbox: (addr sandbox), out: (addr handle line) { -1073 var sandbox/esi: (addr sandbox) <- copy _sandbox -1074 var curr-line-ah/ecx: (addr handle line) <- get sandbox, data -1075 { -1076 var curr-line/eax: (addr line) <- lookup *curr-line-ah -1077 var next-line-ah/edx: (addr handle line) <- get curr-line, next -1078 var next-line/eax: (addr line) <- lookup *next-line-ah -1079 compare next-line, 0 -1080 break-if-= -1081 curr-line-ah <- copy next-line-ah -1082 loop -1083 } -1084 copy-object curr-line-ah, out -1085 } -1086 -1087 fn render-rename-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int { -1088 var sandbox/edi: (addr sandbox) <- copy _sandbox -1089 var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word -1090 var rename-word-mode?/eax: (addr word) <- lookup *rename-word-mode-ah? -1091 compare rename-word-mode?, 0 -1092 break-if-= -1093 # clear a space for the dialog -1094 var top-row/eax: int <- copy cursor-row -1095 top-row <- subtract 3 -1096 var bottom-row/ecx: int <- copy cursor-row -1097 bottom-row <- add 3 -1098 var left-col/edx: int <- copy cursor-col -1099 left-col <- subtract 0x10 -1100 var right-col/ebx: int <- copy cursor-col -1101 right-col <- add 0x10 -1102 clear-rect screen, top-row, left-col, bottom-row, right-col -1103 draw-box screen, top-row, left-col, bottom-row, right-col -1104 # render a little menu for the dialog -1105 var menu-row/ecx: int <- copy bottom-row -1106 menu-row <- decrement -1107 var menu-col/edx: int <- copy left-col -1108 menu-col <- add 2 -1109 move-cursor screen, menu-row, menu-col -1110 start-reverse-video screen -1111 print-string screen, " esc " -1112 reset-formatting screen -1113 print-string screen, " cancel " -1114 start-reverse-video screen -1115 print-string screen, " enter " -1116 reset-formatting screen -1117 print-string screen, " rename " -1118 # draw the word, positioned appropriately around the cursor -1119 var start-col/ecx: int <- copy cursor-col -1120 var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-cursor-word -1121 var word/eax: (addr word) <- lookup *word-ah? -1122 var cursor-index/eax: int <- cursor-index word -1123 start-col <- subtract cursor-index -1124 move-cursor screen, cursor-row, start-col -1125 var word/eax: (addr word) <- lookup *word-ah? -1126 print-word screen, word -1127 } -1128 -1129 fn render-define-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int { -1130 var sandbox/edi: (addr sandbox) <- copy _sandbox -1131 var define-function-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-function -1132 var define-function-mode?/eax: (addr word) <- lookup *define-function-mode-ah? -1133 compare define-function-mode?, 0 -1134 break-if-= -1135 # clear a space for the dialog -1136 var top-row/eax: int <- copy cursor-row -1137 top-row <- subtract 3 -1138 var bottom-row/ecx: int <- copy cursor-row -1139 bottom-row <- add 3 -1140 var left-col/edx: int <- copy cursor-col -1141 left-col <- subtract 0x10 -1142 var right-col/ebx: int <- copy cursor-col -1143 right-col <- add 0x10 -1144 clear-rect screen, top-row, left-col, bottom-row, right-col -1145 draw-box screen, top-row, left-col, bottom-row, right-col -1146 # render a little menu for the dialog -1147 var menu-row/ecx: int <- copy bottom-row -1148 menu-row <- decrement -1149 var menu-col/edx: int <- copy left-col -1150 menu-col <- add 2 -1151 move-cursor screen, menu-row, menu-col -1152 start-reverse-video screen -1153 print-string screen, " esc " -1154 reset-formatting screen -1155 print-string screen, " cancel " -1156 start-reverse-video screen -1157 print-string screen, " enter " -1158 reset-formatting screen -1159 print-string screen, " define " -1160 # draw the word, positioned appropriately around the cursor -1161 var start-col/ecx: int <- copy cursor-col -1162 var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-function -1163 var word/eax: (addr word) <- lookup *word-ah? -1164 var cursor-index/eax: int <- cursor-index word -1165 start-col <- subtract cursor-index -1166 move-cursor screen, cursor-row, start-col -1167 var word/eax: (addr word) <- lookup *word-ah? -1168 print-word screen, word -1169 } -1170 -1171 # Render just the words in 'line'. -1172 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) { -1173 # curr-word -1174 var line/eax: (addr line) <- copy _line -1175 var first-word-ah/eax: (addr handle word) <- get line, data -1176 var _curr-word/eax: (addr word) <- lookup *first-word-ah -1177 var curr-word/esi: (addr word) <- copy _curr-word -1178 # -1179 # loop-carried dependency -1180 var curr-col/ecx: int <- copy left-col -1181 # -1182 { -1183 compare curr-word, 0 -1184 break-if-= -1185 #? print-string 0, "-- word in penultimate lines: " -1186 #? { -1187 #? var foo/eax: int <- copy curr-word -1188 #? print-int32-hex 0, foo -1189 #? } -1190 #? print-string 0, "\n" -1191 var old-col/edx: int <- copy curr-col -1192 reset-formatting screen -1193 move-cursor screen, curr-row, curr-col -1194 print-word screen, curr-word + 912 } + 913 + 914 fn append-line _sandbox: (addr sandbox) { + 915 var sandbox/esi: (addr sandbox) <- copy _sandbox + 916 var line-ah/ecx: (addr handle line) <- get sandbox, data + 917 { + 918 var line/eax: (addr line) <- lookup *line-ah + 919 var next-line-ah/edx: (addr handle line) <- get line, next + 920 var next-line/eax: (addr line) <- lookup *next-line-ah + 921 compare next-line, 0 + 922 break-if-= + 923 line-ah <- copy next-line-ah + 924 loop + 925 } + 926 var line/eax: (addr line) <- lookup *line-ah + 927 var final-line-ah/edx: (addr handle line) <- get line, next + 928 allocate final-line-ah + 929 var final-line/eax: (addr line) <- lookup *final-line-ah + 930 initialize-line final-line + 931 var final-prev/eax: (addr handle line) <- get final-line, prev + 932 copy-object line-ah, final-prev + 933 # clear cursor + 934 var final-line/eax: (addr line) <- lookup *final-line-ah + 935 var word-ah/ecx: (addr handle word) <- get final-line, data + 936 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 937 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 938 var dest/eax: (addr handle word) <- get cursor-call-path, word + 939 copy-object word-ah, dest + 940 } + 941 + 942 ############# + 943 # Visualize + 944 ############# + 945 + 946 fn evaluate-environment _env: (addr environment), stack: (addr value-stack) { + 947 var env/esi: (addr environment) <- copy _env + 948 # functions + 949 var functions/edx: (addr handle function) <- get env, functions + 950 # line + 951 var sandbox-ah/esi: (addr handle sandbox) <- get env, sandboxes + 952 var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + 953 var line-ah/eax: (addr handle line) <- get sandbox, data + 954 var _line/eax: (addr line) <- lookup *line-ah + 955 var line/esi: (addr line) <- copy _line + 956 evaluate functions, 0, line, 0, stack + 957 } + 958 + 959 fn render _env: (addr environment) { + 960 #? print-string 0, "== render\n" + 961 var env/esi: (addr environment) <- copy _env + 962 clear-canvas env + 963 # screen + 964 var screen-ah/eax: (addr handle screen) <- get env, screen + 965 var _screen/eax: (addr screen) <- lookup *screen-ah + 966 var screen/edi: (addr screen) <- copy _screen + 967 # repl-col + 968 var _repl-col/eax: (addr int) <- get env, code-separator-col + 969 var repl-col/ecx: int <- copy *_repl-col + 970 repl-col <- add 2 # repl-margin-left + 971 # functions + 972 var functions/edx: (addr handle function) <- get env, functions + 973 # sandbox + 974 var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes + 975 var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + 976 # bindings + 977 var bindings-storage: table + 978 var bindings/ebx: (addr table) <- address bindings-storage + 979 initialize-table bindings, 0x10 + 980 #? print-string 0, "render-sandbox {\n" + 981 render-sandbox screen, functions, bindings, sandbox, 3, repl-col + 982 #? print-string 0, "render-sandbox }\n" + 983 } + 984 + 985 fn render-sandbox screen: (addr screen), functions: (addr handle function), bindings: (addr table), _sandbox: (addr sandbox), top-row: int, left-col: int { + 986 var sandbox/esi: (addr sandbox) <- copy _sandbox + 987 # line + 988 var curr-line-ah/eax: (addr handle line) <- get sandbox, data + 989 var _curr-line/eax: (addr line) <- lookup *curr-line-ah + 990 var curr-line/ecx: (addr line) <- copy _curr-line + 991 # + 992 var curr-row/edx: int <- copy top-row + 993 # cursor row, col + 994 var cursor-row: int + 995 var cursor-row-addr: (addr int) + 996 var tmp/eax: (addr int) <- address cursor-row + 997 copy-to cursor-row-addr, tmp + 998 var cursor-col: int + 999 var cursor-col-addr: (addr int) +1000 tmp <- address cursor-col +1001 copy-to cursor-col-addr, tmp +1002 # render all but final line without stack +1003 #? print-string 0, "render all but final line\n" +1004 { +1005 var next-line-ah/eax: (addr handle line) <- get curr-line, next +1006 var next-line/eax: (addr line) <- lookup *next-line-ah +1007 compare next-line, 0 +1008 break-if-= +1009 { +1010 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path +1011 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah +1012 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word +1013 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah +1014 # 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 +1015 render-line-without-stack screen, curr-line, curr-row, left-col, cursor-word, cursor-row-addr, cursor-col-addr +1016 } +1017 curr-line <- copy next-line +1018 curr-row <- add 2 +1019 loop +1020 } +1021 # +1022 render-final-line-with-stack screen, functions, bindings, sandbox, curr-row, left-col, cursor-row-addr, cursor-col-addr +1023 # at most one of the following dialogs will be rendered +1024 render-rename-dialog screen, sandbox, cursor-row, cursor-col +1025 render-define-dialog screen, sandbox, cursor-row, cursor-col +1026 move-cursor screen, cursor-row, cursor-col +1027 } +1028 +1029 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) { +1030 var sandbox/esi: (addr sandbox) <- copy _sandbox +1031 # expanded-words +1032 var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words +1033 # cursor-word +1034 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path +1035 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah +1036 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word +1037 var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah +1038 var cursor-word/ebx: (addr word) <- copy _cursor-word +1039 #? print-string 0, "word at cursor: " +1040 #? print-word 0, cursor-word +1041 #? print-string 0, "\n" +1042 # cursor-call-path +1043 var cursor-call-path: (addr handle call-path-element) +1044 { +1045 var src/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path +1046 copy-to cursor-call-path, src +1047 } +1048 # first line +1049 var first-line-ah/eax: (addr handle line) <- get sandbox, data +1050 var _first-line/eax: (addr line) <- lookup *first-line-ah +1051 var first-line/edx: (addr line) <- copy _first-line +1052 # final line +1053 var final-line-storage: (handle line) +1054 var final-line-ah/eax: (addr handle line) <- address final-line-storage +1055 final-line sandbox, final-line-ah +1056 var final-line/eax: (addr line) <- lookup *final-line-ah +1057 # curr-path +1058 var curr-path-storage: (handle call-path-element) +1059 var curr-path/ecx: (addr handle call-path-element) <- address curr-path-storage +1060 allocate curr-path # leak +1061 initialize-path-from-line final-line, curr-path +1062 # +1063 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 +1064 } +1065 +1066 fn final-line _sandbox: (addr sandbox), out: (addr handle line) { +1067 var sandbox/esi: (addr sandbox) <- copy _sandbox +1068 var curr-line-ah/ecx: (addr handle line) <- get sandbox, data +1069 { +1070 var curr-line/eax: (addr line) <- lookup *curr-line-ah +1071 var next-line-ah/edx: (addr handle line) <- get curr-line, next +1072 var next-line/eax: (addr line) <- lookup *next-line-ah +1073 compare next-line, 0 +1074 break-if-= +1075 curr-line-ah <- copy next-line-ah +1076 loop +1077 } +1078 copy-object curr-line-ah, out +1079 } +1080 +1081 fn render-rename-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int { +1082 var sandbox/edi: (addr sandbox) <- copy _sandbox +1083 var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word +1084 var rename-word-mode?/eax: (addr word) <- lookup *rename-word-mode-ah? +1085 compare rename-word-mode?, 0 +1086 break-if-= +1087 # clear a space for the dialog +1088 var top-row/eax: int <- copy cursor-row +1089 top-row <- subtract 3 +1090 var bottom-row/ecx: int <- copy cursor-row +1091 bottom-row <- add 3 +1092 var left-col/edx: int <- copy cursor-col +1093 left-col <- subtract 0x10 +1094 var right-col/ebx: int <- copy cursor-col +1095 right-col <- add 0x10 +1096 clear-rect screen, top-row, left-col, bottom-row, right-col +1097 draw-box screen, top-row, left-col, bottom-row, right-col +1098 # render a little menu for the dialog +1099 var menu-row/ecx: int <- copy bottom-row +1100 menu-row <- decrement +1101 var menu-col/edx: int <- copy left-col +1102 menu-col <- add 2 +1103 move-cursor screen, menu-row, menu-col +1104 start-reverse-video screen +1105 print-string screen, " esc " +1106 reset-formatting screen +1107 print-string screen, " cancel " +1108 start-reverse-video screen +1109 print-string screen, " enter " +1110 reset-formatting screen +1111 print-string screen, " rename " +1112 # draw the word, positioned appropriately around the cursor +1113 var start-col/ecx: int <- copy cursor-col +1114 var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-cursor-word +1115 var word/eax: (addr word) <- lookup *word-ah? +1116 var cursor-index/eax: int <- cursor-index word +1117 start-col <- subtract cursor-index +1118 move-cursor screen, cursor-row, start-col +1119 var word/eax: (addr word) <- lookup *word-ah? +1120 print-word screen, word +1121 } +1122 +1123 fn render-define-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int { +1124 var sandbox/edi: (addr sandbox) <- copy _sandbox +1125 var define-function-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-function +1126 var define-function-mode?/eax: (addr word) <- lookup *define-function-mode-ah? +1127 compare define-function-mode?, 0 +1128 break-if-= +1129 # clear a space for the dialog +1130 var top-row/eax: int <- copy cursor-row +1131 top-row <- subtract 3 +1132 var bottom-row/ecx: int <- copy cursor-row +1133 bottom-row <- add 3 +1134 var left-col/edx: int <- copy cursor-col +1135 left-col <- subtract 0x10 +1136 var right-col/ebx: int <- copy cursor-col +1137 right-col <- add 0x10 +1138 clear-rect screen, top-row, left-col, bottom-row, right-col +1139 draw-box screen, top-row, left-col, bottom-row, right-col +1140 # render a little menu for the dialog +1141 var menu-row/ecx: int <- copy bottom-row +1142 menu-row <- decrement +1143 var menu-col/edx: int <- copy left-col +1144 menu-col <- add 2 +1145 move-cursor screen, menu-row, menu-col +1146 start-reverse-video screen +1147 print-string screen, " esc " +1148 reset-formatting screen +1149 print-string screen, " cancel " +1150 start-reverse-video screen +1151 print-string screen, " enter " +1152 reset-formatting screen +1153 print-string screen, " define " +1154 # draw the word, positioned appropriately around the cursor +1155 var start-col/ecx: int <- copy cursor-col +1156 var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-function +1157 var word/eax: (addr word) <- lookup *word-ah? +1158 var cursor-index/eax: int <- cursor-index word +1159 start-col <- subtract cursor-index +1160 move-cursor screen, cursor-row, start-col +1161 var word/eax: (addr word) <- lookup *word-ah? +1162 print-word screen, word +1163 } +1164 +1165 # Render just the words in 'line'. +1166 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) { +1167 # curr-word +1168 var line/eax: (addr line) <- copy _line +1169 var first-word-ah/eax: (addr handle word) <- get line, data +1170 var _curr-word/eax: (addr word) <- lookup *first-word-ah +1171 var curr-word/esi: (addr word) <- copy _curr-word +1172 # +1173 # loop-carried dependency +1174 var curr-col/ecx: int <- copy left-col +1175 # +1176 { +1177 compare curr-word, 0 +1178 break-if-= +1179 #? print-string 0, "-- word in penultimate lines: " +1180 #? { +1181 #? var foo/eax: int <- copy curr-word +1182 #? print-int32-hex 0, foo +1183 #? } +1184 #? print-string 0, "\n" +1185 var old-col/edx: int <- copy curr-col +1186 reset-formatting screen +1187 move-cursor screen, curr-row, curr-col +1188 print-word screen, curr-word +1189 { +1190 var max-width/eax: int <- word-length curr-word +1191 curr-col <- add max-width +1192 curr-col <- add 1 # margin-right +1193 } +1194 # cache cursor column if necessary 1195 { -1196 var max-width/eax: int <- word-length curr-word -1197 curr-col <- add max-width -1198 curr-col <- add 1 # margin-right -1199 } -1200 # cache cursor column if necessary -1201 { -1202 compare curr-word, cursor-word -1203 break-if-!= -1204 #? print-string 0, "Cursor at " -1205 #? print-int32-decimal 0, curr-row -1206 #? print-string 0, ", " -1207 #? print-int32-decimal 0, old-col -1208 #? print-string 0, "\n" -1209 #? print-string 0, "contents: " -1210 #? print-word 0, cursor-word -1211 #? print-string 0, "\n" -1212 #? { -1213 #? var foo/eax: int <- copy cursor-word -1214 #? print-int32-hex 0, foo -1215 #? print-string 0, "\n" -1216 #? } -1217 var dest/ecx: (addr int) <- copy cursor-row-addr -1218 var src/eax: int <- copy curr-row -1219 copy-to *dest, src -1220 dest <- copy cursor-col-addr -1221 copy-to *dest, old-col -1222 var cursor-index-in-word/eax: int <- cursor-index curr-word -1223 add-to *dest, cursor-index-in-word -1224 } -1225 # loop update -1226 var next-word-ah/edx: (addr handle word) <- get curr-word, next -1227 var _curr-word/eax: (addr word) <- lookup *next-word-ah -1228 curr-word <- copy _curr-word -1229 loop -1230 } -1231 } -1232 -1233 fn call-depth-at-cursor _sandbox: (addr sandbox) -> _/eax: int { -1234 var sandbox/esi: (addr sandbox) <- copy _sandbox -1235 var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path -1236 var result/eax: int <- call-path-element-length cursor-call-path -1237 result <- add 2 # input-row - 1 -1238 return result -1239 } -1240 -1241 fn call-path-element-length _x: (addr handle call-path-element) -> _/eax: int { -1242 var curr-ah/ecx: (addr handle call-path-element) <- copy _x -1243 var result/edi: int <- copy 0 -1244 { -1245 var curr/eax: (addr call-path-element) <- lookup *curr-ah -1246 compare curr, 0 -1247 break-if-= -1248 curr-ah <- get curr, next -1249 result <- increment -1250 loop -1251 } -1252 return result -1253 } -1254 -1255 # Render the line of words in line, along with the state of the stack under each word. -1256 # Also render any expanded function calls using recursive calls. -1257 # -1258 # Along the way, compute the column the cursor should be positioned at (cursor-col-addr). -1259 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 { -1260 #? print-string 0, "render-line\n" -1261 #? dump-table bindings -1262 # curr-word -1263 var line/esi: (addr line) <- copy _line -1264 var first-word-ah/eax: (addr handle word) <- get line, data -1265 var curr-word/eax: (addr word) <- lookup *first-word-ah -1266 # -1267 # loop-carried dependency -1268 var curr-col/ecx: int <- copy left-col -1269 # -1270 { -1271 compare curr-word, 0 -1272 break-if-= -1273 #? print-string 0, "-- word " -1274 #? print-word 0, curr-word -1275 #? print-string 0, "\n" -1276 # if necessary, first render columns for subsidiary stack -1277 $render-line:subsidiary: { -1278 { -1279 #? print-string 0, "check sub\n" -1280 var display-subsidiary-stack?/eax: boolean <- find-in-call-paths expanded-words, curr-path -1281 compare display-subsidiary-stack?, 0 # false -1282 break-if-= $render-line:subsidiary -1283 } -1284 #? print-string 0, "render subsidiary stack\n" -1285 # does function exist? -1286 var callee/edi: (addr function) <- copy 0 -1287 { -1288 var callee-h: (handle function) -1289 var callee-ah/ecx: (addr handle function) <- address callee-h -1290 callee functions, curr-word, callee-ah -1291 var _callee/eax: (addr function) <- lookup *callee-ah -1292 callee <- copy _callee -1293 compare callee, 0 -1294 break-if-= $render-line:subsidiary -1295 } -1296 move-cursor screen, top-row, curr-col -1297 start-color screen, 8, 7 -1298 print-word screen, curr-word -1299 { -1300 var word-len/eax: int <- word-length curr-word -1301 curr-col <- add word-len -1302 curr-col <- add 2 -1303 increment top-row -1304 } -1305 # obtain stack at call site -1306 var stack-storage: value-stack -1307 var stack/edx: (addr value-stack) <- address stack-storage -1308 initialize-value-stack stack, 0x10 -1309 { -1310 var prev-word-ah/eax: (addr handle word) <- get curr-word, prev -1311 var prev-word/eax: (addr word) <- lookup *prev-word-ah -1312 compare prev-word, 0 -1313 break-if-= -1314 var bindings2-storage: table -1315 var bindings2/ebx: (addr table) <- address bindings2-storage -1316 deep-copy-table bindings, bindings2 -1317 evaluate functions, bindings2, first-line, prev-word, stack -1318 } -1319 # construct new bindings -1320 var callee-bindings-storage: table -1321 var callee-bindings/esi: (addr table) <- address callee-bindings-storage -1322 initialize-table callee-bindings, 0x10 -1323 bind-args callee, stack, callee-bindings -1324 # obtain body -1325 var callee-body-ah/eax: (addr handle line) <- get callee, body -1326 var callee-body/eax: (addr line) <- lookup *callee-body-ah -1327 var callee-body-first-word/edx: (addr handle word) <- get callee-body, data -1328 # - render subsidiary stack -1329 push-to-call-path-element curr-path, callee-body-first-word # leak -1330 #? print-string 0, "subsidiary {\n" -1331 #? dump-table callee-bindings -1332 #? syscall_exit -1333 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 -1334 #? print-string 0, "}\n" -1335 drop-from-call-path-element curr-path -1336 # -1337 move-cursor screen, top-row, curr-col -1338 print-code-point screen, 0x21d7 # ⇗ -1339 # -1340 curr-col <- add 2 -1341 decrement top-row -1342 } -1343 # render main column -1344 var old-col/edx: int <- copy curr-col -1345 var bindings2-storage: table -1346 var bindings2/ebx: (addr table) <- address bindings2-storage -1347 #? print-string 0, "deep-copy {\n" -1348 deep-copy-table bindings, bindings2 -1349 #? print-string 0, "}\n" -1350 #? print-string 0, "render column {\n" -1351 curr-col <- render-column screen, functions, bindings2, first-line, line, curr-word, top-row, curr-col -1352 #? print-string 0, "}\n" -1353 # cache cursor column if necessary -1354 $render-line:cache-cursor-column: { +1196 compare curr-word, cursor-word +1197 break-if-!= +1198 #? print-string 0, "Cursor at " +1199 #? print-int32-decimal 0, curr-row +1200 #? print-string 0, ", " +1201 #? print-int32-decimal 0, old-col +1202 #? print-string 0, "\n" +1203 #? print-string 0, "contents: " +1204 #? print-word 0, cursor-word +1205 #? print-string 0, "\n" +1206 #? { +1207 #? var foo/eax: int <- copy cursor-word +1208 #? print-int32-hex 0, foo +1209 #? print-string 0, "\n" +1210 #? } +1211 var dest/ecx: (addr int) <- copy cursor-row-addr +1212 var src/eax: int <- copy curr-row +1213 copy-to *dest, src +1214 dest <- copy cursor-col-addr +1215 copy-to *dest, old-col +1216 var cursor-index-in-word/eax: int <- cursor-index curr-word +1217 add-to *dest, cursor-index-in-word +1218 } +1219 # loop update +1220 var next-word-ah/edx: (addr handle word) <- get curr-word, next +1221 var _curr-word/eax: (addr word) <- lookup *next-word-ah +1222 curr-word <- copy _curr-word +1223 loop +1224 } +1225 } +1226 +1227 fn call-depth-at-cursor _sandbox: (addr sandbox) -> _/eax: int { +1228 var sandbox/esi: (addr sandbox) <- copy _sandbox +1229 var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path +1230 var result/eax: int <- call-path-element-length cursor-call-path +1231 result <- add 2 # input-row - 1 +1232 return result +1233 } +1234 +1235 fn call-path-element-length _x: (addr handle call-path-element) -> _/eax: int { +1236 var curr-ah/ecx: (addr handle call-path-element) <- copy _x +1237 var result/edi: int <- copy 0 +1238 { +1239 var curr/eax: (addr call-path-element) <- lookup *curr-ah +1240 compare curr, 0 +1241 break-if-= +1242 curr-ah <- get curr, next +1243 result <- increment +1244 loop +1245 } +1246 return result +1247 } +1248 +1249 # Render the line of words in line, along with the state of the stack under each word. +1250 # Also render any expanded function calls using recursive calls. +1251 # +1252 # Along the way, compute the column the cursor should be positioned at (cursor-col-addr). +1253 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 { +1254 #? print-string 0, "render-line\n" +1255 #? dump-table bindings +1256 # curr-word +1257 var line/esi: (addr line) <- copy _line +1258 var first-word-ah/eax: (addr handle word) <- get line, data +1259 var curr-word/eax: (addr word) <- lookup *first-word-ah +1260 # +1261 # loop-carried dependency +1262 var curr-col/ecx: int <- copy left-col +1263 # +1264 { +1265 compare curr-word, 0 +1266 break-if-= +1267 #? print-string 0, "-- word " +1268 #? print-word 0, curr-word +1269 #? print-string 0, "\n" +1270 # if necessary, first render columns for subsidiary stack +1271 $render-line:subsidiary: { +1272 { +1273 #? print-string 0, "check sub\n" +1274 var display-subsidiary-stack?/eax: boolean <- find-in-call-paths expanded-words, curr-path +1275 compare display-subsidiary-stack?, 0 # false +1276 break-if-= $render-line:subsidiary +1277 } +1278 #? print-string 0, "render subsidiary stack\n" +1279 # does function exist? +1280 var callee/edi: (addr function) <- copy 0 +1281 { +1282 var callee-h: (handle function) +1283 var callee-ah/ecx: (addr handle function) <- address callee-h +1284 callee functions, curr-word, callee-ah +1285 var _callee/eax: (addr function) <- lookup *callee-ah +1286 callee <- copy _callee +1287 compare callee, 0 +1288 break-if-= $render-line:subsidiary +1289 } +1290 move-cursor screen, top-row, curr-col +1291 start-color screen, 8, 7 +1292 print-word screen, curr-word +1293 { +1294 var word-len/eax: int <- word-length curr-word +1295 curr-col <- add word-len +1296 curr-col <- add 2 +1297 increment top-row +1298 } +1299 # obtain stack at call site +1300 var stack-storage: value-stack +1301 var stack/edx: (addr value-stack) <- address stack-storage +1302 initialize-value-stack stack, 0x10 +1303 { +1304 var prev-word-ah/eax: (addr handle word) <- get curr-word, prev +1305 var prev-word/eax: (addr word) <- lookup *prev-word-ah +1306 compare prev-word, 0 +1307 break-if-= +1308 var bindings2-storage: table +1309 var bindings2/ebx: (addr table) <- address bindings2-storage +1310 deep-copy-table bindings, bindings2 +1311 evaluate functions, bindings2, first-line, prev-word, stack +1312 } +1313 # construct new bindings +1314 var callee-bindings-storage: table +1315 var callee-bindings/esi: (addr table) <- address callee-bindings-storage +1316 initialize-table callee-bindings, 0x10 +1317 bind-args callee, stack, callee-bindings +1318 # obtain body +1319 var callee-body-ah/eax: (addr handle line) <- get callee, body +1320 var callee-body/eax: (addr line) <- lookup *callee-body-ah +1321 var callee-body-first-word/edx: (addr handle word) <- get callee-body, data +1322 # - render subsidiary stack +1323 push-to-call-path-element curr-path, callee-body-first-word # leak +1324 #? print-string 0, "subsidiary {\n" +1325 #? dump-table callee-bindings +1326 #? syscall_exit +1327 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 +1328 #? print-string 0, "}\n" +1329 drop-from-call-path-element curr-path +1330 # +1331 move-cursor screen, top-row, curr-col +1332 print-code-point screen, 0x21d7 # ⇗ +1333 # +1334 curr-col <- add 2 +1335 decrement top-row +1336 } +1337 # render main column +1338 var old-col/edx: int <- copy curr-col +1339 var bindings2-storage: table +1340 var bindings2/ebx: (addr table) <- address bindings2-storage +1341 #? print-string 0, "deep-copy {\n" +1342 deep-copy-table bindings, bindings2 +1343 #? print-string 0, "}\n" +1344 #? print-string 0, "render column {\n" +1345 curr-col <- render-column screen, functions, bindings2, first-line, line, curr-word, top-row, curr-col +1346 #? print-string 0, "}\n" +1347 # cache cursor column if necessary +1348 $render-line:cache-cursor-column: { +1349 { +1350 var found?/eax: boolean <- call-path-element-match? curr-path, cursor-call-path +1351 compare found?, 0 # false +1352 break-if-= $render-line:cache-cursor-column +1353 } +1354 var dest/edi: (addr int) <- copy cursor-row-addr 1355 { -1356 var found?/eax: boolean <- call-path-element-match? curr-path, cursor-call-path -1357 compare found?, 0 # false -1358 break-if-= $render-line:cache-cursor-column -1359 } -1360 var dest/edi: (addr int) <- copy cursor-row-addr -1361 { -1362 var src/eax: int <- copy top-row -1363 copy-to *dest, src -1364 } -1365 dest <- copy cursor-col-addr -1366 copy-to *dest, old-col -1367 var cursor-index-in-word/eax: int <- cursor-index curr-word -1368 add-to *dest, cursor-index-in-word -1369 } -1370 # loop update -1371 #? print-string 0, "next word\n" -1372 var next-word-ah/edx: (addr handle word) <- get curr-word, next -1373 curr-word <- lookup *next-word-ah -1374 #? { -1375 #? var foo/eax: int <- copy curr-word -1376 #? print-int32-hex 0, foo -1377 #? print-string 0, "\n" -1378 #? } -1379 increment-final-element curr-path -1380 loop -1381 } -1382 return curr-col -1383 } -1384 -1385 fn callee functions: (addr handle function), word: (addr word), out: (addr handle function) { -1386 var stream-storage: (stream byte 0x10) -1387 var stream/esi: (addr stream byte) <- address stream-storage -1388 emit-word word, stream -1389 find-function functions, stream, out -1390 } -1391 -1392 # Render: -1393 # - starting at top-row, left-col: final-word -1394 # - starting somewhere below at left-col: the stack result from interpreting first-world to final-word (inclusive) -1395 # -1396 # Return the farthest column written. -1397 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 { -1398 #? print-string 0, "render-column\n" -1399 #? dump-table bindings -1400 var max-width/esi: int <- copy 0 -1401 { -1402 # compute stack -1403 var stack: value-stack -1404 var stack-addr/edi: (addr value-stack) <- address stack -1405 initialize-value-stack stack-addr, 0x10 # max-words -1406 # copy bindings -1407 var bindings2-storage: table -1408 var bindings2/ebx: (addr table) <- address bindings2-storage -1409 #? print-string 0, "deep copy table {\n" -1410 deep-copy-table bindings, bindings2 -1411 #? print-string 0, "}\n" -1412 evaluate functions, bindings2, first-line, final-word, stack-addr -1413 # indent stack -1414 var indented-col/ebx: int <- copy left-col -1415 indented-col <- add 1 # margin-right -1416 # render stack -1417 var curr-row/edx: int <- copy top-row -1418 curr-row <- add 2 # stack-margin-top -1419 var _max-width/eax: int <- value-stack-max-width stack-addr -1420 max-width <- copy _max-width -1421 { -1422 var top-addr/ecx: (addr int) <- get stack-addr, top -1423 compare *top-addr, 0 -1424 break-if-<= -1425 decrement *top-addr -1426 var data-ah/eax: (addr handle array value) <- get stack-addr, data -1427 var data/eax: (addr array value) <- lookup *data-ah -1428 var top/ecx: int <- copy *top-addr -1429 var dest-offset/ecx: (offset value) <- compute-offset data, top -1430 var val/eax: (addr value) <- index data, dest-offset -1431 render-value-at screen, curr-row, indented-col, val, max-width -1432 var height/eax: int <- value-height val -1433 curr-row <- add height -1434 loop -1435 } -1436 } -1437 -1438 max-width <- add 2 # spaces on either side of items on the stack -1439 -1440 # render word, initialize result -1441 reset-formatting screen -1442 move-cursor screen, top-row, left-col -1443 print-word screen, final-word -1444 { -1445 var size/eax: int <- word-length final-word -1446 compare size, max-width -1447 break-if-<= -1448 max-width <- copy size -1449 } -1450 -1451 # post-process right-col -1452 var right-col/ecx: int <- copy left-col -1453 right-col <- add max-width -1454 right-col <- add 1 # margin-right -1455 #? print-int32-decimal 0, left-col -1456 #? print-string 0, " => " -1457 #? print-int32-decimal 0, right-col -1458 #? print-string 0, "\n" -1459 return right-col -1460 } -1461 -1462 fn clear-canvas _env: (addr environment) { -1463 var env/esi: (addr environment) <- copy _env -1464 var screen-ah/edi: (addr handle screen) <- get env, screen -1465 var _screen/eax: (addr screen) <- lookup *screen-ah -1466 var screen/edi: (addr screen) <- copy _screen -1467 clear-screen screen -1468 var nrows/eax: (addr int) <- get env, nrows -1469 var _repl-col/ecx: (addr int) <- get env, code-separator-col -1470 var repl-col/ecx: int <- copy *_repl-col -1471 draw-vertical-line screen, 1, *nrows, repl-col -1472 # wordstar-style cheatsheet of shortcuts -1473 move-cursor screen, *nrows, 0 -1474 start-reverse-video screen -1475 print-string screen, " ctrl-q " -1476 reset-formatting screen -1477 print-string screen, " quit " -1478 var menu-start/ebx: int <- copy repl-col -1479 menu-start <- subtract 0x48 # 72 = half the size of the menu -1480 move-cursor screen, *nrows, menu-start -1481 start-reverse-video screen -1482 print-string screen, " ctrl-a " -1483 reset-formatting screen -1484 print-string screen, " ⏮ " -1485 start-reverse-video screen -1486 print-string screen, " ctrl-b " -1487 reset-formatting screen -1488 print-string screen, " ◀ word " -1489 start-reverse-video screen -1490 print-string screen, " ctrl-f " -1491 reset-formatting screen -1492 print-string screen, " word ▶ " -1493 start-reverse-video screen -1494 print-string screen, " ctrl-e " -1495 reset-formatting screen -1496 print-string screen, " ⏭ " -1497 start-reverse-video screen -1498 print-string screen, " ctrl-l " -1499 reset-formatting screen -1500 print-string screen, " new line " -1501 start-reverse-video screen -1502 print-string screen, " ctrl-u " -1503 reset-formatting screen -1504 print-string screen, " clear " -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 dummy/eax: int <- render-primitives screen, *nrows, repl-col -1515 # currently defined functions -1516 render-functions screen, repl-col, env -1517 } -1518 -1519 # return value: top-most row written to -1520 fn render-primitives screen: (addr screen), bottom-margin-row: int, right-col: int -> _/eax: int { -1521 # render primitives from the bottom of the screen upward -1522 var row/ecx: int <- copy bottom-margin-row -1523 row <- subtract 1 -1524 var col/edx: int <- copy 1 -1525 move-cursor screen, row, col -1526 row, col <- render-primitive-group screen, row, col, right-col, "numbers: ", "+ - * " -1527 row, col <- render-primitive-group screen, row, col, right-col, "arrays: ", "len " -1528 row, col <- render-primitive-group screen, row, col, right-col, "files: ", "open read slurp lines " -1529 row, col <- render-primitive-group screen, row, col, right-col, "misc: ", "dup swap " # hack: keep these at the right of the bottom row -1530 row, col <- render-primitive-group screen, row, col, right-col, "screens: ", "fake-screen print move up down left right " -1531 # finally print heading up top -1532 row <- decrement -1533 move-cursor screen, row, 1 -1534 start-bold screen -1535 print-string screen, "primitives:" -1536 reset-formatting screen -1537 return row -1538 } -1539 -1540 # start at row, col and print the given strings -1541 # move up one row if there isn't enough room before right-col -1542 # return row, col printed until -1543 fn render-primitive-group screen: (addr screen), _row: int, _col: int, right-col: int, _heading: (addr array byte), _contents: (addr array byte) -> _/ecx: int, _/edx: int { -1544 var row/ecx: int <- copy _row -1545 var col/edx: int <- copy _col -1546 # decrement row if necessary -1547 var new-col/ebx: int <- copy col -1548 var heading/esi: (addr array byte) <- copy _heading -1549 var len1/eax: int <- length heading -1550 new-col <- add len1 -1551 var contents/edi: (addr array byte) <- copy _contents -1552 var len2/eax: int <- length contents -1553 new-col <- add len2 -1554 var bound/eax: int <- copy right-col -1555 bound <- decrement -1556 { -1557 compare new-col, bound -1558 break-if-<= -1559 row <- decrement -1560 col <- copy 1 -1561 } -1562 move-cursor screen, row, col -1563 start-color screen, 0xf6, 7 -1564 print-string screen, heading -1565 reset-formatting screen -1566 print-string screen, contents -1567 return row, new-col -1568 } -1569 -1570 fn render-functions screen: (addr screen), right-col: int, _env: (addr environment) { -1571 var row/ecx: int <- copy 1 -1572 var dummy-col/edx: int <- copy right-col -1573 var env/esi: (addr environment) <- copy _env -1574 var functions/esi: (addr handle function) <- get env, functions -1575 { -1576 var curr/eax: (addr function) <- lookup *functions -1577 compare curr, 0 -1578 break-if-= -1579 row, dummy-col <- render-function-right-aligned screen, row, right-col, curr -1580 functions <- get curr, next -1581 row <- add 1 # inter-function-margin -1582 loop -1583 } -1584 } -1585 -1586 # print function starting at row, right-aligned before right-col -1587 # return row, col printed until -1588 fn render-function-right-aligned screen: (addr screen), row: int, right-col: int, f: (addr function) -> _/ecx: int, _/edx: int { -1589 var col/edx: int <- copy right-col -1590 col <- subtract 1 # function-right-margin -1591 var col2/ebx: int <- copy col -1592 var width/eax: int <- function-width f -1593 col <- subtract width -1594 var new-row/ecx: int <- copy row -1595 var height/eax: int <- function-height f -1596 new-row <- add height -1597 new-row <- decrement -1598 col <- subtract 1 # function-left-padding -1599 start-color screen, 0, 0xf7 -1600 clear-rect screen, row, col, new-row, col2 -1601 col <- add 1 -1602 #? var dummy/eax: grapheme <- read-key-from-real-keyboard -1603 render-function screen, row, col, f -1604 new-row <- add 1 # function-bottom-margin -1605 col <- subtract 1 # function-left-padding -1606 col <- subtract 1 # function-left-margin -1607 reset-formatting screen -1608 return new-row, col -1609 } -1610 -1611 # render function starting at row, col -1612 # only single-line functions supported for now -1613 fn render-function screen: (addr screen), row: int, col: int, _f: (addr function) { -1614 var f/esi: (addr function) <- copy _f -1615 var args/ecx: (addr handle word) <- get f, args -1616 move-cursor screen, row, col -1617 print-words-in-reverse screen, args -1618 var name-ah/eax: (addr handle array byte) <- get f, name -1619 var name/eax: (addr array byte) <- lookup *name-ah -1620 start-bold screen -1621 print-string screen, name -1622 reset-formatting screen -1623 start-color screen, 0, 0xf7 -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 } -1633 -1634 fn real-grapheme? g: grapheme -> _/eax: boolean { -1635 # if g == newline return true -1636 compare g, 0xa +1356 var src/eax: int <- copy top-row +1357 copy-to *dest, src +1358 } +1359 dest <- copy cursor-col-addr +1360 copy-to *dest, old-col +1361 var cursor-index-in-word/eax: int <- cursor-index curr-word +1362 add-to *dest, cursor-index-in-word +1363 } +1364 # loop update +1365 #? print-string 0, "next word\n" +1366 var next-word-ah/edx: (addr handle word) <- get curr-word, next +1367 curr-word <- lookup *next-word-ah +1368 #? { +1369 #? var foo/eax: int <- copy curr-word +1370 #? print-int32-hex 0, foo +1371 #? print-string 0, "\n" +1372 #? } +1373 increment-final-element curr-path +1374 loop +1375 } +1376 return curr-col +1377 } +1378 +1379 fn callee functions: (addr handle function), word: (addr word), out: (addr handle function) { +1380 var stream-storage: (stream byte 0x10) +1381 var stream/esi: (addr stream byte) <- address stream-storage +1382 emit-word word, stream +1383 find-function functions, stream, out +1384 } +1385 +1386 # Render: +1387 # - starting at top-row, left-col: final-word +1388 # - starting somewhere below at left-col: the stack result from interpreting first-world to final-word (inclusive) +1389 # +1390 # Return the farthest column written. +1391 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 { +1392 #? print-string 0, "render-column\n" +1393 #? dump-table bindings +1394 var max-width/esi: int <- copy 0 +1395 { +1396 # compute stack +1397 var stack: value-stack +1398 var stack-addr/edi: (addr value-stack) <- address stack +1399 initialize-value-stack stack-addr, 0x10 # max-words +1400 # copy bindings +1401 var bindings2-storage: table +1402 var bindings2/ebx: (addr table) <- address bindings2-storage +1403 #? print-string 0, "deep copy table {\n" +1404 deep-copy-table bindings, bindings2 +1405 #? print-string 0, "}\n" +1406 evaluate functions, bindings2, first-line, final-word, stack-addr +1407 # indent stack +1408 var indented-col/ebx: int <- copy left-col +1409 indented-col <- add 1 # margin-right +1410 # render stack +1411 var curr-row/edx: int <- copy top-row +1412 curr-row <- add 2 # stack-margin-top +1413 var _max-width/eax: int <- value-stack-max-width stack-addr +1414 max-width <- copy _max-width +1415 { +1416 var top-addr/ecx: (addr int) <- get stack-addr, top +1417 compare *top-addr, 0 +1418 break-if-<= +1419 decrement *top-addr +1420 var data-ah/eax: (addr handle array value) <- get stack-addr, data +1421 var data/eax: (addr array value) <- lookup *data-ah +1422 var top/ecx: int <- copy *top-addr +1423 var dest-offset/ecx: (offset value) <- compute-offset data, top +1424 var val/eax: (addr value) <- index data, dest-offset +1425 render-value-at screen, curr-row, indented-col, val, max-width +1426 var height/eax: int <- value-height val +1427 curr-row <- add height +1428 loop +1429 } +1430 } +1431 +1432 max-width <- add 2 # spaces on either side of items on the stack +1433 +1434 # render word, initialize result +1435 reset-formatting screen +1436 move-cursor screen, top-row, left-col +1437 print-word screen, final-word +1438 { +1439 var size/eax: int <- word-length final-word +1440 compare size, max-width +1441 break-if-<= +1442 max-width <- copy size +1443 } +1444 +1445 # post-process right-col +1446 var right-col/ecx: int <- copy left-col +1447 right-col <- add max-width +1448 right-col <- add 1 # margin-right +1449 #? print-int32-decimal 0, left-col +1450 #? print-string 0, " => " +1451 #? print-int32-decimal 0, right-col +1452 #? print-string 0, "\n" +1453 return right-col +1454 } +1455 +1456 fn clear-canvas _env: (addr environment) { +1457 var env/esi: (addr environment) <- copy _env +1458 var screen-ah/edi: (addr handle screen) <- get env, screen +1459 var _screen/eax: (addr screen) <- lookup *screen-ah +1460 var screen/edi: (addr screen) <- copy _screen +1461 clear-screen screen +1462 var nrows/eax: (addr int) <- get env, nrows +1463 var _repl-col/ecx: (addr int) <- get env, code-separator-col +1464 var repl-col/ecx: int <- copy *_repl-col +1465 draw-vertical-line screen, 1, *nrows, repl-col +1466 # wordstar-style cheatsheet of shortcuts +1467 move-cursor screen, *nrows, 0 +1468 start-reverse-video screen +1469 print-string screen, " ctrl-q " +1470 reset-formatting screen +1471 print-string screen, " quit " +1472 var menu-start/ebx: int <- copy repl-col +1473 menu-start <- subtract 0x48 # 72 = half the size of the menu +1474 move-cursor screen, *nrows, menu-start +1475 start-reverse-video screen +1476 print-string screen, " ctrl-a " +1477 reset-formatting screen +1478 print-string screen, " ⏮ " +1479 start-reverse-video screen +1480 print-string screen, " ctrl-b " +1481 reset-formatting screen +1482 print-string screen, " ◀ word " +1483 start-reverse-video screen +1484 print-string screen, " ctrl-f " +1485 reset-formatting screen +1486 print-string screen, " word ▶ " +1487 start-reverse-video screen +1488 print-string screen, " ctrl-e " +1489 reset-formatting screen +1490 print-string screen, " ⏭ " +1491 start-reverse-video screen +1492 print-string screen, " ctrl-l " +1493 reset-formatting screen +1494 print-string screen, " new line " +1495 start-reverse-video screen +1496 print-string screen, " ctrl-u " +1497 reset-formatting screen +1498 print-string screen, " clear " +1499 start-reverse-video screen +1500 print-string screen, " ctrl-n " +1501 reset-formatting screen +1502 print-string screen, " name value " +1503 start-reverse-video screen +1504 print-string screen, " ctrl-d " +1505 reset-formatting screen +1506 print-string screen, " define function " +1507 # primitives +1508 var dummy/eax: int <- render-primitives screen, *nrows, repl-col +1509 # currently defined functions +1510 render-functions screen, repl-col, env +1511 } +1512 +1513 # return value: top-most row written to +1514 fn render-primitives screen: (addr screen), bottom-margin-row: int, right-col: int -> _/eax: int { +1515 # render primitives from the bottom of the screen upward +1516 var row/ecx: int <- copy bottom-margin-row +1517 row <- subtract 1 +1518 var col/edx: int <- copy 1 +1519 move-cursor screen, row, col +1520 row, col <- render-primitive-group screen, row, col, right-col, "numbers: ", "+ - * / sqrt " +1521 row, col <- render-primitive-group screen, row, col, right-col, "arrays: ", "len " +1522 row, col <- render-primitive-group screen, row, col, right-col, "files: ", "open read slurp lines " +1523 row, col <- render-primitive-group screen, row, col, right-col, "misc: ", "dup swap " # hack: keep these at the right of the bottom row +1524 row, col <- render-primitive-group screen, row, col, right-col, "screens: ", "fake-screen print move up down left right " +1525 # finally print heading up top +1526 row <- decrement +1527 move-cursor screen, row, 1 +1528 start-bold screen +1529 print-string screen, "primitives:" +1530 reset-formatting screen +1531 return row +1532 } +1533 +1534 # start at row, col and print the given strings +1535 # move up one row if there isn't enough room before right-col +1536 # return row, col printed until +1537 fn render-primitive-group screen: (addr screen), _row: int, _col: int, right-col: int, _heading: (addr array byte), _contents: (addr array byte) -> _/ecx: int, _/edx: int { +1538 var row/ecx: int <- copy _row +1539 var col/edx: int <- copy _col +1540 # decrement row if necessary +1541 var new-col/ebx: int <- copy col +1542 var heading/esi: (addr array byte) <- copy _heading +1543 var len1/eax: int <- length heading +1544 new-col <- add len1 +1545 var contents/edi: (addr array byte) <- copy _contents +1546 var len2/eax: int <- length contents +1547 new-col <- add len2 +1548 var bound/eax: int <- copy right-col +1549 bound <- decrement +1550 { +1551 compare new-col, bound +1552 break-if-<= +1553 row <- decrement +1554 col <- copy 1 +1555 } +1556 move-cursor screen, row, col +1557 start-color screen, 0xf6, 7 +1558 print-string screen, heading +1559 reset-formatting screen +1560 print-string screen, contents +1561 return row, new-col +1562 } +1563 +1564 fn render-functions screen: (addr screen), right-col: int, _env: (addr environment) { +1565 var row/ecx: int <- copy 1 +1566 var dummy-col/edx: int <- copy right-col +1567 var env/esi: (addr environment) <- copy _env +1568 var functions/esi: (addr handle function) <- get env, functions +1569 { +1570 var curr/eax: (addr function) <- lookup *functions +1571 compare curr, 0 +1572 break-if-= +1573 row, dummy-col <- render-function-right-aligned screen, row, right-col, curr +1574 functions <- get curr, next +1575 row <- add 1 # inter-function-margin +1576 loop +1577 } +1578 } +1579 +1580 # print function starting at row, right-aligned before right-col +1581 # return row, col printed until +1582 fn render-function-right-aligned screen: (addr screen), row: int, right-col: int, f: (addr function) -> _/ecx: int, _/edx: int { +1583 var col/edx: int <- copy right-col +1584 col <- subtract 1 # function-right-margin +1585 var col2/ebx: int <- copy col +1586 var width/eax: int <- function-width f +1587 col <- subtract width +1588 var new-row/ecx: int <- copy row +1589 var height/eax: int <- function-height f +1590 new-row <- add height +1591 new-row <- decrement +1592 col <- subtract 1 # function-left-padding +1593 start-color screen, 0, 0xf7 +1594 clear-rect screen, row, col, new-row, col2 +1595 col <- add 1 +1596 #? var dummy/eax: grapheme <- read-key-from-real-keyboard +1597 render-function screen, row, col, f +1598 new-row <- add 1 # function-bottom-margin +1599 col <- subtract 1 # function-left-padding +1600 col <- subtract 1 # function-left-margin +1601 reset-formatting screen +1602 return new-row, col +1603 } +1604 +1605 # render function starting at row, col +1606 # only single-line functions supported for now +1607 fn render-function screen: (addr screen), row: int, col: int, _f: (addr function) { +1608 var f/esi: (addr function) <- copy _f +1609 var args/ecx: (addr handle word) <- get f, args +1610 move-cursor screen, row, col +1611 print-words-in-reverse screen, args +1612 var name-ah/eax: (addr handle array byte) <- get f, name +1613 var name/eax: (addr array byte) <- lookup *name-ah +1614 start-bold screen +1615 print-string screen, name +1616 reset-formatting screen +1617 start-color screen, 0, 0xf7 +1618 increment row +1619 add-to col, 2 +1620 move-cursor screen, row, col +1621 print-string screen, "≡ " +1622 var body-ah/eax: (addr handle line) <- get f, body +1623 var body/eax: (addr line) <- lookup *body-ah +1624 var body-words-ah/eax: (addr handle word) <- get body, data +1625 print-words screen, body-words-ah +1626 } +1627 +1628 fn real-grapheme? g: grapheme -> _/eax: boolean { +1629 # if g == newline return true +1630 compare g, 0xa +1631 { +1632 break-if-!= +1633 return 1 # true +1634 } +1635 # if g == tab return true +1636 compare g, 9 1637 { 1638 break-if-!= 1639 return 1 # true 1640 } -1641 # if g == tab return true -1642 compare g, 9 +1641 # if g < 32 return false +1642 compare g, 0x20 1643 { -1644 break-if-!= -1645 return 1 # true +1644 break-if->= +1645 return 0 # false 1646 } -1647 # if g < 32 return false -1648 compare g, 0x20 +1647 # if g <= 255 return true +1648 compare g, 0xff 1649 { -1650 break-if->= -1651 return 0 # false +1650 break-if-> +1651 return 1 # true 1652 } -1653 # if g <= 255 return true -1654 compare g, 0xff -1655 { -1656 break-if-> -1657 return 1 # true -1658 } -1659 # if (g&0xff == Esc) it's an escape sequence -1660 and-with g, 0xff -1661 compare g, 0x1b # Esc -1662 { -1663 break-if-!= -1664 return 0 # false -1665 } -1666 # otherwise return true -1667 return 1 # true -1668 } +1653 # if (g&0xff == Esc) it's an escape sequence +1654 and-with g, 0xff +1655 compare g, 0x1b # Esc +1656 { +1657 break-if-!= +1658 return 0 # false +1659 } +1660 # otherwise return true +1661 return 1 # true +1662 } diff --git a/html/apps/tile/float-stack.mu.html b/html/apps/tile/float-stack.mu.html new file mode 100644 index 00000000..071b189c --- /dev/null +++ b/html/apps/tile/float-stack.mu.html @@ -0,0 +1,126 @@ + + + + +Mu - apps/tile/float-stack.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/apps/tile/float-stack.mu +
+ 1 type float-stack {
+ 2   data: (handle array float)
+ 3   top: int
+ 4 }
+ 5 
+ 6 fn initialize-float-stack _self: (addr float-stack), n: int {
+ 7   var self/esi: (addr float-stack) <- copy _self
+ 8   var d/edi: (addr handle array float) <- get self, data
+ 9   populate d, n
+10   var top/eax: (addr int) <- get self, top
+11   copy-to *top, 0
+12 }
+13 
+14 fn clear-float-stack _self: (addr float-stack) {
+15   var self/esi: (addr float-stack) <- copy _self
+16   var top/eax: (addr int) <- get self, top
+17   copy-to *top, 0
+18 }
+19 
+20 fn push-float-stack _self: (addr float-stack), _val: float {
+21   var self/esi: (addr float-stack) <- copy _self
+22   var top-addr/ecx: (addr int) <- get self, top
+23   var data-ah/edx: (addr handle array float) <- get self, data
+24   var data/eax: (addr array float) <- lookup *data-ah
+25   var top/edx: int <- copy *top-addr
+26   var dest-addr/edx: (addr float) <- index data, top
+27   var val/xmm0: float <- copy _val
+28   copy-to *dest-addr, val
+29   add-to *top-addr, 1
+30 }
+31 
+32 fn pop-float-stack _self: (addr float-stack) -> _/xmm0: float {
+33   var self/esi: (addr float-stack) <- copy _self
+34   var top-addr/ecx: (addr int) <- get self, top
+35   {
+36     compare *top-addr, 0
+37     break-if->
+38     var zero: float
+39     return zero
+40   }
+41   subtract-from *top-addr, 1
+42   var data-ah/edx: (addr handle array float) <- get self, data
+43   var data/eax: (addr array float) <- lookup *data-ah
+44   var top/edx: int <- copy *top-addr
+45   var result-addr/eax: (addr float) <- index data, top
+46   return *result-addr
+47 }
+48 
+49 fn float-stack-empty? _self: (addr float-stack) -> _/eax: boolean {
+50   var self/esi: (addr float-stack) <- copy _self
+51   var top-addr/eax: (addr int) <- get self, top
+52   compare *top-addr, 0
+53   {
+54     break-if-!=
+55     return 1  # true
+56   }
+57   return 0  # false
+58 }
+59 
+60 fn float-stack-length _self: (addr float-stack) -> _/eax: int {
+61   var self/esi: (addr float-stack) <- copy _self
+62   var top-addr/eax: (addr int) <- get self, top
+63   return *top-addr
+64 }
+
+ + + diff --git a/html/apps/tile/gap-buffer.mu.html b/html/apps/tile/gap-buffer.mu.html index 028667b1..29cdc22f 100644 --- a/html/apps/tile/gap-buffer.mu.html +++ b/html/apps/tile/gap-buffer.mu.html @@ -90,7 +90,7 @@ if ('onhashchange' in window) { 31 var s-storage: (stream byte 0x100) 32 var s/ecx: (addr stream byte) <- address s-storage 33 emit-gap-buffer self, s - 34 stream-to-array s, out + 34 stream-to-array s, out 35 } 36 37 fn emit-gap-buffer _self: (addr gap-buffer), out: (addr stream byte) { diff --git a/html/apps/tile/main.mu.html b/html/apps/tile/main.mu.html index bdb2d8c2..3cf767e0 100644 --- a/html/apps/tile/main.mu.html +++ b/html/apps/tile/main.mu.html @@ -117,7 +117,7 @@ if ('onhashchange' in window) { 58 compare key, 0x11 # 'ctrl-q' 59 break-if-= 60 process env, key - 61 render env + 61 render env 62 loop 63 } 64 enable-keyboard-type-mode @@ -138,7 +138,7 @@ if ('onhashchange' in window) { 79 #? process env, 5 # ctrl-e: end of line 80 print-string 0, "==\n" 81 process env, 0xa # newline: expand - 82 render env + 82 render env 83 } 84 85 fn process-all env: (addr environment), cmds: (addr array byte) { @@ -183,20 +183,24 @@ if ('onhashchange' in window) { 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 +127 evaluate-environment env, stack 128 # print -129 var empty?/eax: boolean <- value-stack-empty? stack +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 } +133 var result/xmm0: float <- pop-number-from-value-stack stack +134 print-float-decimal-approximate 0, result, 3 +135 print-string 0, "\n" +136 print-string 0, "width: " +137 var width/eax: int <- float-size result, 3 +138 print-int32-decimal 0, width +139 print-string 0, "\n" +140 } +141 # +142 loop +143 } +144 } diff --git a/html/apps/tile/rpn.mu.html b/html/apps/tile/rpn.mu.html index 0c5d6255..02d74cf5 100644 --- a/html/apps/tile/rpn.mu.html +++ b/html/apps/tile/rpn.mu.html @@ -81,869 +81,894 @@ if ('onhashchange' in window) { 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 + 24 var _b/xmm0: float <- pop-number-from-value-stack out + 25 var b/xmm1: float <- copy _b + 26 var a/xmm0: float <- pop-number-from-value-stack out 27 a <- add b - 28 push-int-to-value-stack out, a + 28 push-number-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 + 35 var _b/xmm0: float <- pop-number-from-value-stack out + 36 var b/xmm1: float <- copy _b + 37 var a/xmm0: float <- pop-number-from-value-stack out 38 a <- subtract b - 39 push-int-to-value-stack out, a + 39 push-number-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 + 46 var _b/xmm0: float <- pop-number-from-value-stack out + 47 var b/xmm1: float <- copy _b + 48 var a/xmm0: float <- pop-number-from-value-stack out 49 a <- multiply b - 50 push-int-to-value-stack out, a + 50 push-number-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 clear-object target-string-ah - 85 var target/eax: (addr int) <- get target-val, int-data - 86 copy-to *target, result - 87 break $evaluate:process-word - 88 } - 89 compare *target-type-addr, 2 # array of ints - 90 { - 91 break-if-!= - 92 # compute length - 93 var src-ah/eax: (addr handle array value) <- get target-val, array-data - 94 var src/eax: (addr array value) <- lookup *src-ah - 95 var result/ebx: int <- length src - 96 # save result into target-val - 97 var type-addr/eax: (addr int) <- get target-val, type - 98 copy-to *type-addr, 0 # int - 99 var target-array-ah/eax: (addr handle array value) <- get target-val, array-data -100 clear-object target-array-ah -101 var target/eax: (addr int) <- get target-val, int-data -102 copy-to *target, result -103 break $evaluate:process-word -104 } -105 } -106 ## files -107 { -108 var is-open?/eax: boolean <- stream-data-equal? curr-stream, "open" -109 compare is-open?, 0 -110 break-if-= -111 # pop target-val from out -112 var out2/esi: (addr value-stack) <- copy out -113 var top-addr/ecx: (addr int) <- get out2, top -114 compare *top-addr, 0 -115 break-if-<= -116 var data-ah/eax: (addr handle array value) <- get out2, data -117 var data/eax: (addr array value) <- lookup *data-ah -118 var top/edx: int <- copy *top-addr -119 top <- decrement -120 var dest-offset/edx: (offset value) <- compute-offset data, top -121 var target-val/edx: (addr value) <- index data, dest-offset -122 # check target-val is a string -123 var target-type-addr/eax: (addr int) <- get target-val, type -124 compare *target-type-addr, 1 # string -125 break-if-!= -126 # open target-val as a filename and save the handle in target-val -127 var src-ah/eax: (addr handle array byte) <- get target-val, text-data -128 var src/eax: (addr array byte) <- lookup *src-ah -129 var result-ah/ecx: (addr handle buffered-file) <- get target-val, file-data -130 open src, 0, result-ah # write? = false -131 # save result into target-val -132 var type-addr/eax: (addr int) <- get target-val, type -133 copy-to *type-addr, 3 # file -134 var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data -135 var filename-ah/ecx: (addr handle array byte) <- get target-val, filename -136 copy-object target-string-ah, filename-ah -137 clear-object target-string-ah -138 break $evaluate:process-word -139 } -140 { -141 var is-read?/eax: boolean <- stream-data-equal? curr-stream, "read" -142 compare is-read?, 0 -143 break-if-= -144 # pop target-val from out -145 var out2/esi: (addr value-stack) <- copy out -146 var top-addr/ecx: (addr int) <- get out2, top -147 compare *top-addr, 0 -148 break-if-<= -149 var data-ah/eax: (addr handle array value) <- get out2, data -150 var data/eax: (addr array value) <- lookup *data-ah -151 var top/edx: int <- copy *top-addr -152 top <- decrement -153 var dest-offset/edx: (offset value) <- compute-offset data, top -154 var target-val/edx: (addr value) <- index data, dest-offset -155 # check target-val is a file -156 var target-type-addr/eax: (addr int) <- get target-val, type -157 compare *target-type-addr, 3 # file -158 break-if-!= -159 # read a line from the file and save in target-val -160 # read target-val as a filename and save the handle in target-val -161 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -162 var file/eax: (addr buffered-file) <- lookup *file-ah -163 var s: (stream byte 0x100) -164 var s-addr/ecx: (addr stream byte) <- address s -165 read-line-buffered file, s-addr -166 var target/eax: (addr handle array byte) <- get target-val, text-data -167 stream-to-array s-addr, target -168 # save result into target-val -169 var type-addr/eax: (addr int) <- get target-val, type -170 copy-to *type-addr, 1 # string -171 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -172 clear-object target-file-ah -173 break $evaluate:process-word -174 } -175 { -176 var is-slurp?/eax: boolean <- stream-data-equal? curr-stream, "slurp" -177 compare is-slurp?, 0 -178 break-if-= -179 # pop target-val from out -180 var out2/esi: (addr value-stack) <- copy out -181 var top-addr/ecx: (addr int) <- get out2, top -182 compare *top-addr, 0 -183 break-if-<= -184 var data-ah/eax: (addr handle array value) <- get out2, data -185 var data/eax: (addr array value) <- lookup *data-ah -186 var top/edx: int <- copy *top-addr -187 top <- decrement -188 var dest-offset/edx: (offset value) <- compute-offset data, top -189 var target-val/edx: (addr value) <- index data, dest-offset -190 # check target-val is a file -191 var target-type-addr/eax: (addr int) <- get target-val, type -192 compare *target-type-addr, 3 # file -193 break-if-!= -194 # slurp all contents from file and save in target-val -195 # read target-val as a filename and save the handle in target-val -196 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -197 var file/eax: (addr buffered-file) <- lookup *file-ah -198 var s: (stream byte 0x100) -199 var s-addr/ecx: (addr stream byte) <- address s -200 slurp file, s-addr -201 var target/eax: (addr handle array byte) <- get target-val, text-data -202 stream-to-array s-addr, target -203 # save result into target-val -204 var type-addr/eax: (addr int) <- get target-val, type -205 copy-to *type-addr, 1 # string -206 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -207 clear-object target-file-ah -208 break $evaluate:process-word -209 } -210 { -211 var is-lines?/eax: boolean <- stream-data-equal? curr-stream, "lines" -212 compare is-lines?, 0 -213 break-if-= -214 # pop target-val from out -215 var out2/esi: (addr value-stack) <- copy out -216 var top-addr/ecx: (addr int) <- get out2, top -217 compare *top-addr, 0 -218 break-if-<= -219 var data-ah/eax: (addr handle array value) <- get out2, data -220 var data/eax: (addr array value) <- lookup *data-ah -221 var top/edx: int <- copy *top-addr -222 top <- decrement -223 var dest-offset/edx: (offset value) <- compute-offset data, top -224 var target-val/edx: (addr value) <- index data, dest-offset -225 # check target-val is a file -226 var target-type-addr/eax: (addr int) <- get target-val, type -227 compare *target-type-addr, 3 # file -228 break-if-!= -229 # read all lines from file and save as an array of strings in target-val -230 # read target-val as a filename and save the handle in target-val -231 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -232 var file/eax: (addr buffered-file) <- lookup *file-ah -233 var s: (stream byte 0x100) -234 var s-addr/ecx: (addr stream byte) <- address s -235 slurp file, s-addr -236 var tmp-ah/eax: (addr handle array byte) <- get target-val, text-data -237 stream-to-array s-addr, tmp-ah -238 var tmp/eax: (addr array byte) <- lookup *tmp-ah -239 #? enable-screen-type-mode -240 #? print-string 0, tmp -241 var h: (handle array (handle array byte)) -242 { -243 var ah/edx: (addr handle array (handle array byte)) <- address h -244 split-string tmp, 0xa, ah -245 } -246 var target/eax: (addr handle array value) <- get target-val, array-data -247 save-lines h, target -248 # save result into target-val -249 var type-addr/eax: (addr int) <- get target-val, type -250 copy-to *type-addr, 2 # array -251 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -252 var empty-file: (handle buffered-file) -253 copy-handle empty-file, target-file-ah -254 var target-text-ah/eax: (addr handle array byte) <- get target-val, text-data -255 var empty-text: (handle array byte) -256 copy-handle empty-text, target-text-ah -257 break $evaluate:process-word -258 } -259 ## screens -260 { -261 var is-fake-screen?/eax: boolean <- stream-data-equal? curr-stream, "fake-screen" -262 compare is-fake-screen?, 0 -263 break-if-= -264 var out2/esi: (addr value-stack) <- copy out -265 var top-addr/ecx: (addr int) <- get out2, top -266 compare *top-addr, 0 -267 break-if-<= -268 # pop width and height from out -269 var _nrows/eax: int <- pop-int-from-value-stack out2 -270 var nrows/edx: int <- copy _nrows -271 var _ncols/eax: int <- pop-int-from-value-stack out2 -272 var ncols/ebx: int <- copy _ncols -273 # define a new screen with those dimensions -274 var screen-h: (handle screen) -275 var screen-ah/eax: (addr handle screen) <- address screen-h -276 allocate screen-ah -277 var screen/eax: (addr screen) <- lookup screen-h -278 initialize-screen screen, nrows, ncols -279 # push screen to stack -280 var data-ah/eax: (addr handle array value) <- get out2, data -281 var data/eax: (addr array value) <- lookup *data-ah -282 var top/edx: int <- copy *top-addr -283 increment *top-addr -284 var dest-offset/edx: (offset value) <- compute-offset data, top -285 var target-val/edx: (addr value) <- index data, dest-offset -286 var type/eax: (addr int) <- get target-val, type -287 copy-to *type, 4 # screen -288 var dest/eax: (addr handle screen) <- get target-val, screen-data -289 copy-handle screen-h, dest -290 break $evaluate:process-word -291 } -292 { -293 var is-print?/eax: boolean <- stream-data-equal? curr-stream, "print" -294 compare is-print?, 0 -295 break-if-= -296 var out2/esi: (addr value-stack) <- copy out -297 var top-addr/ecx: (addr int) <- get out2, top -298 compare *top-addr, 0 -299 break-if-<= -300 # pop string from out -301 var top-addr/ecx: (addr int) <- get out2, top -302 compare *top-addr, 0 -303 break-if-<= -304 decrement *top-addr -305 var data-ah/eax: (addr handle array value) <- get out2, data -306 var _data/eax: (addr array value) <- lookup *data-ah -307 var data/edi: (addr array value) <- copy _data -308 var top/eax: int <- copy *top-addr -309 var dest-offset/edx: (offset value) <- compute-offset data, top -310 var s/esi: (addr value) <- index data, dest-offset -311 # select target screen from top of out (but don't pop it) -312 compare *top-addr, 0 -313 break-if-<= -314 var top/eax: int <- copy *top-addr -315 top <- decrement -316 var dest-offset/edx: (offset value) <- compute-offset data, top -317 var target-val/edx: (addr value) <- index data, dest-offset -318 var type/eax: (addr int) <- get target-val, type -319 compare *type, 4 # screen -320 break-if-!= -321 # print string to target screen -322 var dest-ah/eax: (addr handle screen) <- get target-val, screen-data -323 var dest/eax: (addr screen) <- lookup *dest-ah -324 var r/ecx: (addr int) <- get dest, cursor-row -325 var c/edx: (addr int) <- get dest, cursor-col -326 render-value-at dest, *r, *c, s, 0 -327 break $evaluate:process-word -328 } -329 { -330 var is-move?/eax: boolean <- stream-data-equal? curr-stream, "move" -331 compare is-move?, 0 -332 break-if-= -333 var out2/esi: (addr value-stack) <- copy out -334 # pop args -335 var _r/eax: int <- pop-int-from-value-stack out2 -336 var r/ecx: int <- copy _r -337 var _c/eax: int <- pop-int-from-value-stack out2 -338 var c/edx: int <- copy _c -339 # select screen from top of out (but don't pop it) -340 var top-addr/ebx: (addr int) <- get out2, top -341 compare *top-addr, 0 -342 break-if-<= -343 var data-ah/eax: (addr handle array value) <- get out2, data -344 var _data/eax: (addr array value) <- lookup *data-ah -345 var data/edi: (addr array value) <- copy _data -346 var top/eax: int <- copy *top-addr -347 top <- decrement -348 var target-offset/eax: (offset value) <- compute-offset data, top -349 var target-val/ebx: (addr value) <- index data, target-offset -350 var type/eax: (addr int) <- get target-val, type -351 compare *type, 4 # screen -352 break-if-!= -353 var target-ah/eax: (addr handle screen) <- get target-val, screen-data -354 var target/eax: (addr screen) <- lookup *target-ah -355 move-cursor target, r, c -356 break $evaluate:process-word -357 } -358 { -359 var is-up?/eax: boolean <- stream-data-equal? curr-stream, "up" -360 compare is-up?, 0 -361 break-if-= -362 var out2/esi: (addr value-stack) <- copy out -363 var top-addr/ebx: (addr int) <- get out2, top -364 compare *top-addr, 0 -365 break-if-<= -366 # pop args -367 var _d/eax: int <- pop-int-from-value-stack out2 -368 var d/ecx: int <- copy _d -369 # select screen from top of out (but don't pop it) -370 compare *top-addr, 0 -371 break-if-<= -372 var data-ah/eax: (addr handle array value) <- get out2, data -373 var _data/eax: (addr array value) <- lookup *data-ah -374 var data/edi: (addr array value) <- copy _data -375 var top/eax: int <- copy *top-addr -376 top <- decrement -377 var target-offset/eax: (offset value) <- compute-offset data, top -378 var target-val/ebx: (addr value) <- index data, target-offset -379 var type/eax: (addr int) <- get target-val, type -380 compare *type, 4 # screen -381 break-if-!= -382 var target-ah/eax: (addr handle screen) <- get target-val, screen-data -383 var _target/eax: (addr screen) <- lookup *target-ah -384 var target/edi: (addr screen) <- copy _target -385 var r/edx: (addr int) <- get target, cursor-row -386 var c/eax: (addr int) <- get target, cursor-col -387 var col/eax: int <- copy *c -388 { -389 compare d, 0 -390 break-if-<= -391 compare *r, 1 -392 break-if-<= -393 print-string target "│" -394 decrement *r -395 move-cursor target, *r, col -396 d <- decrement -397 loop -398 } -399 break $evaluate:process-word -400 } -401 { -402 var is-down?/eax: boolean <- stream-data-equal? curr-stream, "down" -403 compare is-down?, 0 -404 break-if-= -405 var out2/esi: (addr value-stack) <- copy out -406 var top-addr/ebx: (addr int) <- get out2, top -407 compare *top-addr, 0 -408 break-if-<= -409 # pop args -410 var _d/eax: int <- pop-int-from-value-stack out2 -411 var d/ecx: int <- copy _d -412 # select screen from top of out (but don't pop it) -413 compare *top-addr, 0 -414 break-if-<= -415 var data-ah/eax: (addr handle array value) <- get out2, data -416 var _data/eax: (addr array value) <- lookup *data-ah -417 var data/edi: (addr array value) <- copy _data -418 var top/eax: int <- copy *top-addr -419 top <- decrement -420 var target-offset/eax: (offset value) <- compute-offset data, top -421 var target-val/ebx: (addr value) <- index data, target-offset -422 var type/eax: (addr int) <- get target-val, type -423 compare *type, 4 # screen -424 break-if-!= -425 var target-ah/eax: (addr handle screen) <- get target-val, screen-data -426 var _target/eax: (addr screen) <- lookup *target-ah -427 var target/edi: (addr screen) <- copy _target -428 var bound-a/ebx: (addr int) <- get target, num-rows -429 var bound/ebx: int <- copy *bound-a -430 var r/edx: (addr int) <- get target, cursor-row -431 var c/eax: (addr int) <- get target, cursor-col -432 var col/eax: int <- copy *c -433 { -434 compare d, 0 -435 break-if-<= -436 compare *r, bound -437 break-if->= -438 print-string target "│" -439 increment *r -440 move-cursor target, *r, col -441 d <- decrement -442 loop -443 } -444 break $evaluate:process-word -445 } -446 { -447 var is-left?/eax: boolean <- stream-data-equal? curr-stream, "left" -448 compare is-left?, 0 -449 break-if-= -450 var out2/esi: (addr value-stack) <- copy out -451 var top-addr/ebx: (addr int) <- get out2, top -452 compare *top-addr, 0 -453 break-if-<= -454 # pop args -455 var _d/eax: int <- pop-int-from-value-stack out2 -456 var d/ecx: int <- copy _d -457 # select screen from top of out (but don't pop it) -458 compare *top-addr, 0 -459 break-if-<= -460 var data-ah/eax: (addr handle array value) <- get out2, data -461 var _data/eax: (addr array value) <- lookup *data-ah -462 var data/edi: (addr array value) <- copy _data -463 var top/eax: int <- copy *top-addr -464 top <- decrement -465 var target-offset/eax: (offset value) <- compute-offset data, top -466 var target-val/ebx: (addr value) <- index data, target-offset -467 var type/eax: (addr int) <- get target-val, type -468 compare *type, 4 # screen -469 break-if-!= -470 var target-ah/eax: (addr handle screen) <- get target-val, screen-data -471 var _target/eax: (addr screen) <- lookup *target-ah -472 var target/edi: (addr screen) <- copy _target -473 var c/edx: (addr int) <- get target, cursor-col -474 var r/eax: (addr int) <- get target, cursor-row -475 var row/eax: int <- copy *r -476 { -477 compare d, 0 -478 break-if-<= -479 compare *c, 1 -480 break-if-<= -481 print-string target "─" -482 decrement *c -483 decrement *c # second one to undo the print above -484 move-cursor target, row, *c -485 d <- decrement -486 loop -487 } -488 break $evaluate:process-word -489 } -490 { -491 var is-right?/eax: boolean <- stream-data-equal? curr-stream, "right" -492 compare is-right?, 0 -493 break-if-= -494 var out2/esi: (addr value-stack) <- copy out -495 var top-addr/ebx: (addr int) <- get out2, top -496 compare *top-addr, 0 -497 break-if-<= -498 # pop args -499 var _d/eax: int <- pop-int-from-value-stack out2 -500 var d/ecx: int <- copy _d -501 # select screen from top of out (but don't pop it) -502 compare *top-addr, 0 -503 break-if-<= -504 var data-ah/eax: (addr handle array value) <- get out2, data -505 var _data/eax: (addr array value) <- lookup *data-ah -506 var data/edi: (addr array value) <- copy _data -507 var top/eax: int <- copy *top-addr -508 top <- decrement -509 var target-offset/eax: (offset value) <- compute-offset data, top -510 var target-val/ebx: (addr value) <- index data, target-offset -511 var type/eax: (addr int) <- get target-val, type -512 compare *type, 4 # screen -513 break-if-!= -514 var target-ah/eax: (addr handle screen) <- get target-val, screen-data -515 var _target/eax: (addr screen) <- lookup *target-ah -516 var target/edi: (addr screen) <- copy _target -517 var bound-a/ebx: (addr int) <- get target, num-rows -518 var bound/ebx: int <- copy *bound-a -519 var c/edx: (addr int) <- get target, cursor-col -520 var r/eax: (addr int) <- get target, cursor-row -521 var row/eax: int <- copy *r -522 { -523 compare d, 0 -524 break-if-<= -525 compare *c, bound -526 break-if->= -527 print-string target "─" -528 # no increment; the print took care of it -529 move-cursor target, row, *c -530 d <- decrement -531 loop -532 } -533 break $evaluate:process-word -534 } -535 ## HACKS: we're trying to avoid turning this into Forth -536 { -537 var is-dup?/eax: boolean <- stream-data-equal? curr-stream, "dup" -538 compare is-dup?, 0 -539 break-if-= -540 # read src-val from out -541 var out2/esi: (addr value-stack) <- copy out -542 var top-addr/ecx: (addr int) <- get out2, top -543 compare *top-addr, 0 -544 break-if-<= -545 var data-ah/eax: (addr handle array value) <- get out2, data -546 var data/eax: (addr array value) <- lookup *data-ah -547 var top/ecx: int <- copy *top-addr -548 top <- decrement -549 var offset/edx: (offset value) <- compute-offset data, top -550 var src-val/edx: (addr value) <- index data, offset -551 # push a copy of it -552 top <- increment -553 var offset/ebx: (offset value) <- compute-offset data, top -554 var target-val/ebx: (addr value) <- index data, offset -555 copy-object src-val, target-val -556 # commit -557 var top-addr/ecx: (addr int) <- get out2, top -558 increment *top-addr -559 break $evaluate:process-word -560 } -561 { -562 var is-swap?/eax: boolean <- stream-data-equal? curr-stream, "swap" -563 compare is-swap?, 0 -564 break-if-= -565 # read top-val from out -566 var out2/esi: (addr value-stack) <- copy out -567 var top-addr/ecx: (addr int) <- get out2, top -568 compare *top-addr, 0 -569 break-if-<= -570 var data-ah/eax: (addr handle array value) <- get out2, data -571 var data/eax: (addr array value) <- lookup *data-ah -572 var top/ecx: int <- copy *top-addr -573 top <- decrement -574 var offset/edx: (offset value) <- compute-offset data, top -575 var top-val/edx: (addr value) <- index data, offset -576 # read next val from out -577 top <- decrement -578 var offset/ebx: (offset value) <- compute-offset data, top -579 var pen-top-val/ebx: (addr value) <- index data, offset -580 # swap -581 var tmp: value -582 var tmp-a/eax: (addr value) <- address tmp -583 copy-object top-val, tmp-a -584 copy-object pen-top-val, top-val -585 copy-object tmp-a, pen-top-val -586 break $evaluate:process-word -587 } -588 ### if curr-stream defines a binding, save top of stack to bindings -589 { -590 var done?/eax: boolean <- stream-empty? curr-stream -591 compare done?, 0 # false -592 break-if-!= -593 var new-byte/eax: byte <- read-byte curr-stream -594 compare new-byte, 0x3d # '=' -595 break-if-!= -596 # pop target-val from out -597 var out2/esi: (addr value-stack) <- copy out -598 var top-addr/ecx: (addr int) <- get out2, top -599 compare *top-addr, 0 -600 break-if-<= -601 var data-ah/eax: (addr handle array value) <- get out2, data -602 var data/eax: (addr array value) <- lookup *data-ah -603 var top/edx: int <- copy *top-addr -604 top <- decrement -605 var dest-offset/edx: (offset value) <- compute-offset data, top -606 var target-val/edx: (addr value) <- index data, dest-offset -607 # create binding from curr-stream to target-val -608 var key-h: (handle array byte) -609 var key/ecx: (addr handle array byte) <- address key-h -610 stream-to-array curr-stream, key -611 bind-in-table bindings, key, target-val -612 break $evaluate:process-word -613 } -614 rewind-stream curr-stream -615 ### if curr-stream is a known function name, call it appropriately -616 { -617 var callee-h: (handle function) -618 var callee-ah/eax: (addr handle function) <- address callee-h -619 find-function functions, curr-stream, callee-ah -620 var callee/eax: (addr function) <- lookup *callee-ah -621 compare callee, 0 -622 break-if-= -623 perform-call callee, out, functions -624 break $evaluate:process-word -625 } -626 ### if it's a name, push its value -627 { -628 compare bindings, 0 -629 break-if-= -630 var tmp: (handle array byte) -631 var curr-string-ah/edx: (addr handle array byte) <- address tmp -632 stream-to-array curr-stream, curr-string-ah # unfortunate leak -633 var curr-string/eax: (addr array byte) <- lookup *curr-string-ah -634 var val-storage: (handle value) -635 var val-ah/edi: (addr handle value) <- address val-storage -636 lookup-binding bindings, curr-string, val-ah -637 var val/eax: (addr value) <- lookup *val-ah -638 compare val, 0 -639 break-if-= -640 push-value-stack out, val -641 break $evaluate:process-word -642 } -643 ### if the word starts with a quote and ends with a quote, turn it into a string -644 { -645 var start/eax: byte <- stream-first curr-stream -646 compare start, 0x22 # double-quote -647 break-if-!= -648 var end/eax: byte <- stream-final curr-stream -649 compare end, 0x22 # double-quote -650 break-if-!= -651 var h: (handle array byte) -652 var s/eax: (addr handle array byte) <- address h -653 unquote-stream-to-array curr-stream, s # leak -654 push-string-to-value-stack out, *s -655 break $evaluate:process-word -656 } -657 ### if the word starts with a '[' and ends with a ']', turn it into an array -658 { -659 var start/eax: byte <- stream-first curr-stream -660 compare start, 0x5b # '[' -661 break-if-!= -662 var end/eax: byte <- stream-final curr-stream -663 compare end, 0x5d # ']' -664 break-if-!= -665 # wastefully create a new input string to strip quotes -666 var h: (handle array value) -667 var input-ah/eax: (addr handle array byte) <- address h -668 unquote-stream-to-array curr-stream, input-ah # leak -669 # wastefully parse input into int-array -670 # TODO: support parsing arrays of other types -671 var input/eax: (addr array byte) <- lookup *input-ah -672 var h2: (handle array int) -673 var int-array-ah/esi: (addr handle array int) <- address h2 -674 parse-array-of-decimal-ints input, int-array-ah # leak -675 var _int-array/eax: (addr array int) <- lookup *int-array-ah -676 var int-array/esi: (addr array int) <- copy _int-array -677 var len/ebx: int <- length int-array -678 # push value-array of same size as int-array -679 var h3: (handle array value) -680 var value-array-ah/eax: (addr handle array value) <- address h3 -681 populate value-array-ah, len -682 push-array-to-value-stack out, *value-array-ah -683 # copy int-array into value-array -684 var _value-array/eax: (addr array value) <- lookup *value-array-ah -685 var value-array/edi: (addr array value) <- copy _value-array -686 var i/eax: int <- copy 0 -687 { -688 compare i, len -689 break-if->= -690 var src-addr/ecx: (addr int) <- index int-array, i -691 var src/ecx: int <- copy *src-addr -692 var dest-offset/edx: (offset value) <- compute-offset value-array, i -693 var dest-val/edx: (addr value) <- index value-array, dest-offset -694 var dest/edx: (addr int) <- get dest-val, int-data -695 copy-to *dest, src -696 i <- increment -697 loop -698 } -699 break $evaluate:process-word -700 } -701 ### otherwise assume it's a literal number and push it -702 { -703 var n/eax: int <- parse-decimal-int-from-stream curr-stream -704 push-int-to-value-stack out, n -705 } -706 } -707 # termination check -708 compare curr, end -709 break-if-= -710 # update -711 var next-word-ah/edx: (addr handle word) <- get curr, next -712 curr <- lookup *next-word-ah -713 # -714 loop -715 } -716 # process next line if necessary -717 var line/eax: (addr line) <- copy scratch -718 var next-line-ah/eax: (addr handle line) <- get line, next -719 var next-line/eax: (addr line) <- lookup *next-line-ah -720 compare next-line, 0 -721 break-if-= -722 evaluate functions, bindings, next-line, end, out -723 } -724 -725 fn test-evaluate { -726 var line-storage: line -727 var line/esi: (addr line) <- address line-storage -728 var first-word-ah/eax: (addr handle word) <- get line-storage, data -729 allocate-word-with first-word-ah, "3" -730 append-word-with *first-word-ah, "=a" -731 var next-line-ah/eax: (addr handle line) <- get line-storage, next -732 allocate next-line-ah -733 var next-line/eax: (addr line) <- lookup *next-line-ah -734 var first-word-ah/eax: (addr handle word) <- get next-line, data -735 allocate-word-with first-word-ah, "a" -736 var functions-storage: (handle function) -737 var functions/ecx: (addr handle function) <- address functions-storage -738 var table-storage: table -739 var table/ebx: (addr table) <- address table-storage -740 initialize-table table, 0x10 -741 var stack-storage: value-stack -742 var stack/edi: (addr value-stack) <- address stack-storage -743 initialize-value-stack stack, 0x10 -744 evaluate functions, table, line, 0, stack -745 var x/eax: int <- pop-int-from-value-stack stack -746 check-ints-equal x, 3, "F - test-evaluate" + 53 { + 54 var is-div?/eax: boolean <- stream-data-equal? curr-stream, "/" + 55 compare is-div?, 0 + 56 break-if-= + 57 var _b/xmm0: float <- pop-number-from-value-stack out + 58 var b/xmm1: float <- copy _b + 59 var a/xmm0: float <- pop-number-from-value-stack out + 60 a <- divide b + 61 push-number-to-value-stack out, a + 62 break $evaluate:process-word + 63 } + 64 { + 65 var is-sqrt?/eax: boolean <- stream-data-equal? curr-stream, "sqrt" + 66 compare is-sqrt?, 0 + 67 break-if-= + 68 var a/xmm0: float <- pop-number-from-value-stack out + 69 a <- square-root a + 70 push-number-to-value-stack out, a + 71 break $evaluate:process-word + 72 } + 73 ## strings/arrays + 74 { + 75 var is-len?/eax: boolean <- stream-data-equal? curr-stream, "len" + 76 compare is-len?, 0 + 77 break-if-= + 78 #? print-string 0, "is len\n" + 79 # pop target-val from out + 80 var out2/esi: (addr value-stack) <- copy out + 81 var top-addr/ecx: (addr int) <- get out2, top + 82 compare *top-addr, 0 + 83 break-if-<= + 84 #? print-string 0, "stack has stuff\n" + 85 var data-ah/eax: (addr handle array value) <- get out2, data + 86 var data/eax: (addr array value) <- lookup *data-ah + 87 var top/edx: int <- copy *top-addr + 88 top <- decrement + 89 var dest-offset/edx: (offset value) <- compute-offset data, top + 90 var target-val/edx: (addr value) <- index data, dest-offset + 91 # check target-val is a string or array + 92 var target-type-addr/eax: (addr int) <- get target-val, type + 93 compare *target-type-addr, 1 # string + 94 { + 95 break-if-!= + 96 # compute length + 97 var src-ah/eax: (addr handle array byte) <- get target-val, text-data + 98 var src/eax: (addr array byte) <- lookup *src-ah + 99 var result/ebx: int <- length src +100 var result-f/xmm0: float <- convert result +101 # save result into target-val +102 var type-addr/eax: (addr int) <- get target-val, type +103 copy-to *type-addr, 0 # int +104 var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data +105 clear-object target-string-ah +106 var target/eax: (addr float) <- get target-val, number-data +107 copy-to *target, result-f +108 break $evaluate:process-word +109 } +110 compare *target-type-addr, 2 # array of ints +111 { +112 break-if-!= +113 # compute length +114 var src-ah/eax: (addr handle array value) <- get target-val, array-data +115 var src/eax: (addr array value) <- lookup *src-ah +116 var result/ebx: int <- length src +117 var result-f/xmm0: float <- convert result +118 # save result into target-val +119 var type-addr/eax: (addr int) <- get target-val, type +120 copy-to *type-addr, 0 # int +121 var target-array-ah/eax: (addr handle array value) <- get target-val, array-data +122 clear-object target-array-ah +123 var target/eax: (addr float) <- get target-val, number-data +124 copy-to *target, result-f +125 break $evaluate:process-word +126 } +127 } +128 ## files +129 { +130 var is-open?/eax: boolean <- stream-data-equal? curr-stream, "open" +131 compare is-open?, 0 +132 break-if-= +133 # pop target-val from out +134 var out2/esi: (addr value-stack) <- copy out +135 var top-addr/ecx: (addr int) <- get out2, top +136 compare *top-addr, 0 +137 break-if-<= +138 var data-ah/eax: (addr handle array value) <- get out2, data +139 var data/eax: (addr array value) <- lookup *data-ah +140 var top/edx: int <- copy *top-addr +141 top <- decrement +142 var dest-offset/edx: (offset value) <- compute-offset data, top +143 var target-val/edx: (addr value) <- index data, dest-offset +144 # check target-val is a string +145 var target-type-addr/eax: (addr int) <- get target-val, type +146 compare *target-type-addr, 1 # string +147 break-if-!= +148 # open target-val as a filename and save the handle in target-val +149 var src-ah/eax: (addr handle array byte) <- get target-val, text-data +150 var src/eax: (addr array byte) <- lookup *src-ah +151 var result-ah/ecx: (addr handle buffered-file) <- get target-val, file-data +152 open src, 0, result-ah # write? = false +153 # save result into target-val +154 var type-addr/eax: (addr int) <- get target-val, type +155 copy-to *type-addr, 3 # file +156 var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data +157 var filename-ah/ecx: (addr handle array byte) <- get target-val, filename +158 copy-object target-string-ah, filename-ah +159 clear-object target-string-ah +160 break $evaluate:process-word +161 } +162 { +163 var is-read?/eax: boolean <- stream-data-equal? curr-stream, "read" +164 compare is-read?, 0 +165 break-if-= +166 # pop target-val from out +167 var out2/esi: (addr value-stack) <- copy out +168 var top-addr/ecx: (addr int) <- get out2, top +169 compare *top-addr, 0 +170 break-if-<= +171 var data-ah/eax: (addr handle array value) <- get out2, data +172 var data/eax: (addr array value) <- lookup *data-ah +173 var top/edx: int <- copy *top-addr +174 top <- decrement +175 var dest-offset/edx: (offset value) <- compute-offset data, top +176 var target-val/edx: (addr value) <- index data, dest-offset +177 # check target-val is a file +178 var target-type-addr/eax: (addr int) <- get target-val, type +179 compare *target-type-addr, 3 # file +180 break-if-!= +181 # read a line from the file and save in target-val +182 # read target-val as a filename and save the handle in target-val +183 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +184 var file/eax: (addr buffered-file) <- lookup *file-ah +185 var s: (stream byte 0x100) +186 var s-addr/ecx: (addr stream byte) <- address s +187 read-line-buffered file, s-addr +188 var target/eax: (addr handle array byte) <- get target-val, text-data +189 stream-to-array s-addr, target +190 # save result into target-val +191 var type-addr/eax: (addr int) <- get target-val, type +192 copy-to *type-addr, 1 # string +193 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +194 clear-object target-file-ah +195 break $evaluate:process-word +196 } +197 { +198 var is-slurp?/eax: boolean <- stream-data-equal? curr-stream, "slurp" +199 compare is-slurp?, 0 +200 break-if-= +201 # pop target-val from out +202 var out2/esi: (addr value-stack) <- copy out +203 var top-addr/ecx: (addr int) <- get out2, top +204 compare *top-addr, 0 +205 break-if-<= +206 var data-ah/eax: (addr handle array value) <- get out2, data +207 var data/eax: (addr array value) <- lookup *data-ah +208 var top/edx: int <- copy *top-addr +209 top <- decrement +210 var dest-offset/edx: (offset value) <- compute-offset data, top +211 var target-val/edx: (addr value) <- index data, dest-offset +212 # check target-val is a file +213 var target-type-addr/eax: (addr int) <- get target-val, type +214 compare *target-type-addr, 3 # file +215 break-if-!= +216 # slurp all contents from file and save in target-val +217 # read target-val as a filename and save the handle in target-val +218 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +219 var file/eax: (addr buffered-file) <- lookup *file-ah +220 var s: (stream byte 0x100) +221 var s-addr/ecx: (addr stream byte) <- address s +222 slurp file, s-addr +223 var target/eax: (addr handle array byte) <- get target-val, text-data +224 stream-to-array s-addr, target +225 # save result into target-val +226 var type-addr/eax: (addr int) <- get target-val, type +227 copy-to *type-addr, 1 # string +228 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +229 clear-object target-file-ah +230 break $evaluate:process-word +231 } +232 { +233 var is-lines?/eax: boolean <- stream-data-equal? curr-stream, "lines" +234 compare is-lines?, 0 +235 break-if-= +236 # pop target-val from out +237 var out2/esi: (addr value-stack) <- copy out +238 var top-addr/ecx: (addr int) <- get out2, top +239 compare *top-addr, 0 +240 break-if-<= +241 var data-ah/eax: (addr handle array value) <- get out2, data +242 var data/eax: (addr array value) <- lookup *data-ah +243 var top/edx: int <- copy *top-addr +244 top <- decrement +245 var dest-offset/edx: (offset value) <- compute-offset data, top +246 var target-val/edx: (addr value) <- index data, dest-offset +247 # check target-val is a file +248 var target-type-addr/eax: (addr int) <- get target-val, type +249 compare *target-type-addr, 3 # file +250 break-if-!= +251 # read all lines from file and save as an array of strings in target-val +252 # read target-val as a filename and save the handle in target-val +253 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +254 var file/eax: (addr buffered-file) <- lookup *file-ah +255 var s: (stream byte 0x100) +256 var s-addr/ecx: (addr stream byte) <- address s +257 slurp file, s-addr +258 var tmp-ah/eax: (addr handle array byte) <- get target-val, text-data +259 stream-to-array s-addr, tmp-ah +260 var tmp/eax: (addr array byte) <- lookup *tmp-ah +261 #? enable-screen-type-mode +262 #? print-string 0, tmp +263 var h: (handle array (handle array byte)) +264 { +265 var ah/edx: (addr handle array (handle array byte)) <- address h +266 split-string tmp, 0xa, ah +267 } +268 var target/eax: (addr handle array value) <- get target-val, array-data +269 save-lines h, target +270 # save result into target-val +271 var type-addr/eax: (addr int) <- get target-val, type +272 copy-to *type-addr, 2 # array +273 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +274 var empty-file: (handle buffered-file) +275 copy-handle empty-file, target-file-ah +276 var target-text-ah/eax: (addr handle array byte) <- get target-val, text-data +277 var empty-text: (handle array byte) +278 copy-handle empty-text, target-text-ah +279 break $evaluate:process-word +280 } +281 ## screens +282 { +283 var is-fake-screen?/eax: boolean <- stream-data-equal? curr-stream, "fake-screen" +284 compare is-fake-screen?, 0 +285 break-if-= +286 var out2/esi: (addr value-stack) <- copy out +287 var top-addr/ecx: (addr int) <- get out2, top +288 compare *top-addr, 0 +289 break-if-<= +290 # pop width and height from out +291 var nrows-f/xmm0: float <- pop-number-from-value-stack out2 +292 var nrows/edx: int <- convert nrows-f +293 var ncols-f/xmm0: float <- pop-number-from-value-stack out2 +294 var ncols/ebx: int <- convert ncols-f +295 # define a new screen with those dimensions +296 var screen-h: (handle screen) +297 var screen-ah/eax: (addr handle screen) <- address screen-h +298 allocate screen-ah +299 var screen/eax: (addr screen) <- lookup screen-h +300 initialize-screen screen, nrows, ncols +301 # push screen to stack +302 var data-ah/eax: (addr handle array value) <- get out2, data +303 var data/eax: (addr array value) <- lookup *data-ah +304 var top/edx: int <- copy *top-addr +305 increment *top-addr +306 var dest-offset/edx: (offset value) <- compute-offset data, top +307 var target-val/edx: (addr value) <- index data, dest-offset +308 var type/eax: (addr int) <- get target-val, type +309 copy-to *type, 4 # screen +310 var dest/eax: (addr handle screen) <- get target-val, screen-data +311 copy-handle screen-h, dest +312 break $evaluate:process-word +313 } +314 { +315 var is-print?/eax: boolean <- stream-data-equal? curr-stream, "print" +316 compare is-print?, 0 +317 break-if-= +318 var out2/esi: (addr value-stack) <- copy out +319 var top-addr/ecx: (addr int) <- get out2, top +320 compare *top-addr, 0 +321 break-if-<= +322 # pop string from out +323 var top-addr/ecx: (addr int) <- get out2, top +324 compare *top-addr, 0 +325 break-if-<= +326 decrement *top-addr +327 var data-ah/eax: (addr handle array value) <- get out2, data +328 var _data/eax: (addr array value) <- lookup *data-ah +329 var data/edi: (addr array value) <- copy _data +330 var top/eax: int <- copy *top-addr +331 var dest-offset/edx: (offset value) <- compute-offset data, top +332 var s/esi: (addr value) <- index data, dest-offset +333 # select target screen from top of out (but don't pop it) +334 compare *top-addr, 0 +335 break-if-<= +336 var top/eax: int <- copy *top-addr +337 top <- decrement +338 var dest-offset/edx: (offset value) <- compute-offset data, top +339 var target-val/edx: (addr value) <- index data, dest-offset +340 var type/eax: (addr int) <- get target-val, type +341 compare *type, 4 # screen +342 break-if-!= +343 # print string to target screen +344 var dest-ah/eax: (addr handle screen) <- get target-val, screen-data +345 var dest/eax: (addr screen) <- lookup *dest-ah +346 var r/ecx: (addr int) <- get dest, cursor-row +347 var c/edx: (addr int) <- get dest, cursor-col +348 render-value-at dest, *r, *c, s, 0 +349 break $evaluate:process-word +350 } +351 { +352 var is-move?/eax: boolean <- stream-data-equal? curr-stream, "move" +353 compare is-move?, 0 +354 break-if-= +355 var out2/esi: (addr value-stack) <- copy out +356 # pop args +357 var r-f/xmm0: float <- pop-number-from-value-stack out2 +358 var r/ecx: int <- convert r-f +359 var c-f/xmm0: float <- pop-number-from-value-stack out2 +360 var c/edx: int <- convert c-f +361 # select screen from top of out (but don't pop it) +362 var top-addr/ebx: (addr int) <- get out2, top +363 compare *top-addr, 0 +364 break-if-<= +365 var data-ah/eax: (addr handle array value) <- get out2, data +366 var _data/eax: (addr array value) <- lookup *data-ah +367 var data/edi: (addr array value) <- copy _data +368 var top/eax: int <- copy *top-addr +369 top <- decrement +370 var target-offset/eax: (offset value) <- compute-offset data, top +371 var target-val/ebx: (addr value) <- index data, target-offset +372 var type/eax: (addr int) <- get target-val, type +373 compare *type, 4 # screen +374 break-if-!= +375 var target-ah/eax: (addr handle screen) <- get target-val, screen-data +376 var target/eax: (addr screen) <- lookup *target-ah +377 move-cursor target, r, c +378 break $evaluate:process-word +379 } +380 { +381 var is-up?/eax: boolean <- stream-data-equal? curr-stream, "up" +382 compare is-up?, 0 +383 break-if-= +384 var out2/esi: (addr value-stack) <- copy out +385 var top-addr/ebx: (addr int) <- get out2, top +386 compare *top-addr, 0 +387 break-if-<= +388 # pop args +389 var d-f/xmm0: float <- pop-number-from-value-stack out2 +390 var d/ecx: int <- convert d-f +391 # select screen from top of out (but don't pop it) +392 compare *top-addr, 0 +393 break-if-<= +394 var data-ah/eax: (addr handle array value) <- get out2, data +395 var _data/eax: (addr array value) <- lookup *data-ah +396 var data/edi: (addr array value) <- copy _data +397 var top/eax: int <- copy *top-addr +398 top <- decrement +399 var target-offset/eax: (offset value) <- compute-offset data, top +400 var target-val/ebx: (addr value) <- index data, target-offset +401 var type/eax: (addr int) <- get target-val, type +402 compare *type, 4 # screen +403 break-if-!= +404 var target-ah/eax: (addr handle screen) <- get target-val, screen-data +405 var _target/eax: (addr screen) <- lookup *target-ah +406 var target/edi: (addr screen) <- copy _target +407 var r/edx: (addr int) <- get target, cursor-row +408 var c/eax: (addr int) <- get target, cursor-col +409 var col/eax: int <- copy *c +410 { +411 compare d, 0 +412 break-if-<= +413 compare *r, 1 +414 break-if-<= +415 print-string target "│" +416 decrement *r +417 move-cursor target, *r, col +418 d <- decrement +419 loop +420 } +421 break $evaluate:process-word +422 } +423 { +424 var is-down?/eax: boolean <- stream-data-equal? curr-stream, "down" +425 compare is-down?, 0 +426 break-if-= +427 var out2/esi: (addr value-stack) <- copy out +428 var top-addr/ebx: (addr int) <- get out2, top +429 compare *top-addr, 0 +430 break-if-<= +431 # pop args +432 var d-f/xmm0: float <- pop-number-from-value-stack out2 +433 var d/ecx: int <- convert d-f +434 # select screen from top of out (but don't pop it) +435 compare *top-addr, 0 +436 break-if-<= +437 var data-ah/eax: (addr handle array value) <- get out2, data +438 var _data/eax: (addr array value) <- lookup *data-ah +439 var data/edi: (addr array value) <- copy _data +440 var top/eax: int <- copy *top-addr +441 top <- decrement +442 var target-offset/eax: (offset value) <- compute-offset data, top +443 var target-val/ebx: (addr value) <- index data, target-offset +444 var type/eax: (addr int) <- get target-val, type +445 compare *type, 4 # screen +446 break-if-!= +447 var target-ah/eax: (addr handle screen) <- get target-val, screen-data +448 var _target/eax: (addr screen) <- lookup *target-ah +449 var target/edi: (addr screen) <- copy _target +450 var bound-a/ebx: (addr int) <- get target, num-rows +451 var bound/ebx: int <- copy *bound-a +452 var r/edx: (addr int) <- get target, cursor-row +453 var c/eax: (addr int) <- get target, cursor-col +454 var col/eax: int <- copy *c +455 { +456 compare d, 0 +457 break-if-<= +458 compare *r, bound +459 break-if->= +460 print-string target "│" +461 increment *r +462 move-cursor target, *r, col +463 d <- decrement +464 loop +465 } +466 break $evaluate:process-word +467 } +468 { +469 var is-left?/eax: boolean <- stream-data-equal? curr-stream, "left" +470 compare is-left?, 0 +471 break-if-= +472 var out2/esi: (addr value-stack) <- copy out +473 var top-addr/ebx: (addr int) <- get out2, top +474 compare *top-addr, 0 +475 break-if-<= +476 # pop args +477 var d-f/xmm0: float <- pop-number-from-value-stack out2 +478 var d/ecx: int <- convert d-f +479 # select screen from top of out (but don't pop it) +480 compare *top-addr, 0 +481 break-if-<= +482 var data-ah/eax: (addr handle array value) <- get out2, data +483 var _data/eax: (addr array value) <- lookup *data-ah +484 var data/edi: (addr array value) <- copy _data +485 var top/eax: int <- copy *top-addr +486 top <- decrement +487 var target-offset/eax: (offset value) <- compute-offset data, top +488 var target-val/ebx: (addr value) <- index data, target-offset +489 var type/eax: (addr int) <- get target-val, type +490 compare *type, 4 # screen +491 break-if-!= +492 var target-ah/eax: (addr handle screen) <- get target-val, screen-data +493 var _target/eax: (addr screen) <- lookup *target-ah +494 var target/edi: (addr screen) <- copy _target +495 var c/edx: (addr int) <- get target, cursor-col +496 var r/eax: (addr int) <- get target, cursor-row +497 var row/eax: int <- copy *r +498 { +499 compare d, 0 +500 break-if-<= +501 compare *c, 1 +502 break-if-<= +503 print-string target "─" +504 decrement *c +505 decrement *c # second one to undo the print above +506 move-cursor target, row, *c +507 d <- decrement +508 loop +509 } +510 break $evaluate:process-word +511 } +512 { +513 var is-right?/eax: boolean <- stream-data-equal? curr-stream, "right" +514 compare is-right?, 0 +515 break-if-= +516 var out2/esi: (addr value-stack) <- copy out +517 var top-addr/ebx: (addr int) <- get out2, top +518 compare *top-addr, 0 +519 break-if-<= +520 # pop args +521 var _d/xmm0: float <- pop-number-from-value-stack out2 +522 var d/ecx: int <- convert _d +523 # select screen from top of out (but don't pop it) +524 compare *top-addr, 0 +525 break-if-<= +526 var data-ah/eax: (addr handle array value) <- get out2, data +527 var _data/eax: (addr array value) <- lookup *data-ah +528 var data/edi: (addr array value) <- copy _data +529 var top/eax: int <- copy *top-addr +530 top <- decrement +531 var target-offset/eax: (offset value) <- compute-offset data, top +532 var target-val/ebx: (addr value) <- index data, target-offset +533 var type/eax: (addr int) <- get target-val, type +534 compare *type, 4 # screen +535 break-if-!= +536 var target-ah/eax: (addr handle screen) <- get target-val, screen-data +537 var _target/eax: (addr screen) <- lookup *target-ah +538 var target/edi: (addr screen) <- copy _target +539 var bound-a/ebx: (addr int) <- get target, num-rows +540 var bound/ebx: int <- copy *bound-a +541 var c/edx: (addr int) <- get target, cursor-col +542 var r/eax: (addr int) <- get target, cursor-row +543 var row/eax: int <- copy *r +544 { +545 compare d, 0 +546 break-if-<= +547 compare *c, bound +548 break-if->= +549 print-string target "─" +550 # no increment; the print took care of it +551 move-cursor target, row, *c +552 d <- decrement +553 loop +554 } +555 break $evaluate:process-word +556 } +557 ## HACKS: we're trying to avoid turning this into Forth +558 { +559 var is-dup?/eax: boolean <- stream-data-equal? curr-stream, "dup" +560 compare is-dup?, 0 +561 break-if-= +562 # read src-val from out +563 var out2/esi: (addr value-stack) <- copy out +564 var top-addr/ecx: (addr int) <- get out2, top +565 compare *top-addr, 0 +566 break-if-<= +567 var data-ah/eax: (addr handle array value) <- get out2, data +568 var data/eax: (addr array value) <- lookup *data-ah +569 var top/ecx: int <- copy *top-addr +570 top <- decrement +571 var offset/edx: (offset value) <- compute-offset data, top +572 var src-val/edx: (addr value) <- index data, offset +573 # push a copy of it +574 top <- increment +575 var offset/ebx: (offset value) <- compute-offset data, top +576 var target-val/ebx: (addr value) <- index data, offset +577 copy-object src-val, target-val +578 # commit +579 var top-addr/ecx: (addr int) <- get out2, top +580 increment *top-addr +581 break $evaluate:process-word +582 } +583 { +584 var is-swap?/eax: boolean <- stream-data-equal? curr-stream, "swap" +585 compare is-swap?, 0 +586 break-if-= +587 # read top-val from out +588 var out2/esi: (addr value-stack) <- copy out +589 var top-addr/ecx: (addr int) <- get out2, top +590 compare *top-addr, 0 +591 break-if-<= +592 var data-ah/eax: (addr handle array value) <- get out2, data +593 var data/eax: (addr array value) <- lookup *data-ah +594 var top/ecx: int <- copy *top-addr +595 top <- decrement +596 var offset/edx: (offset value) <- compute-offset data, top +597 var top-val/edx: (addr value) <- index data, offset +598 # read next val from out +599 top <- decrement +600 var offset/ebx: (offset value) <- compute-offset data, top +601 var pen-top-val/ebx: (addr value) <- index data, offset +602 # swap +603 var tmp: value +604 var tmp-a/eax: (addr value) <- address tmp +605 copy-object top-val, tmp-a +606 copy-object pen-top-val, top-val +607 copy-object tmp-a, pen-top-val +608 break $evaluate:process-word +609 } +610 ### if curr-stream defines a binding, save top of stack to bindings +611 { +612 var done?/eax: boolean <- stream-empty? curr-stream +613 compare done?, 0 # false +614 break-if-!= +615 var new-byte/eax: byte <- read-byte curr-stream +616 compare new-byte, 0x3d # '=' +617 break-if-!= +618 # pop target-val from out +619 var out2/esi: (addr value-stack) <- copy out +620 var top-addr/ecx: (addr int) <- get out2, top +621 compare *top-addr, 0 +622 break-if-<= +623 var data-ah/eax: (addr handle array value) <- get out2, data +624 var data/eax: (addr array value) <- lookup *data-ah +625 var top/edx: int <- copy *top-addr +626 top <- decrement +627 var dest-offset/edx: (offset value) <- compute-offset data, top +628 var target-val/edx: (addr value) <- index data, dest-offset +629 # create binding from curr-stream to target-val +630 var key-h: (handle array byte) +631 var key/ecx: (addr handle array byte) <- address key-h +632 stream-to-array curr-stream, key +633 bind-in-table bindings, key, target-val +634 break $evaluate:process-word +635 } +636 rewind-stream curr-stream +637 ### if curr-stream is a known function name, call it appropriately +638 { +639 var callee-h: (handle function) +640 var callee-ah/eax: (addr handle function) <- address callee-h +641 find-function functions, curr-stream, callee-ah +642 var callee/eax: (addr function) <- lookup *callee-ah +643 compare callee, 0 +644 break-if-= +645 perform-call callee, out, functions +646 break $evaluate:process-word +647 } +648 ### if it's a name, push its value +649 { +650 compare bindings, 0 +651 break-if-= +652 var tmp: (handle array byte) +653 var curr-string-ah/edx: (addr handle array byte) <- address tmp +654 stream-to-array curr-stream, curr-string-ah # unfortunate leak +655 var curr-string/eax: (addr array byte) <- lookup *curr-string-ah +656 var val-storage: (handle value) +657 var val-ah/edi: (addr handle value) <- address val-storage +658 lookup-binding bindings, curr-string, val-ah +659 var val/eax: (addr value) <- lookup *val-ah +660 compare val, 0 +661 break-if-= +662 push-value-stack out, val +663 break $evaluate:process-word +664 } +665 ### if the word starts with a quote and ends with a quote, turn it into a string +666 { +667 var start/eax: byte <- stream-first curr-stream +668 compare start, 0x22 # double-quote +669 break-if-!= +670 var end/eax: byte <- stream-final curr-stream +671 compare end, 0x22 # double-quote +672 break-if-!= +673 var h: (handle array byte) +674 var s/eax: (addr handle array byte) <- address h +675 unquote-stream-to-array curr-stream, s # leak +676 push-string-to-value-stack out, *s +677 break $evaluate:process-word +678 } +679 ### if the word starts with a '[' and ends with a ']', turn it into an array +680 { +681 var start/eax: byte <- stream-first curr-stream +682 compare start, 0x5b # '[' +683 break-if-!= +684 var end/eax: byte <- stream-final curr-stream +685 compare end, 0x5d # ']' +686 break-if-!= +687 # wastefully create a new input string to strip quotes +688 var h: (handle array value) +689 var input-ah/eax: (addr handle array byte) <- address h +690 unquote-stream-to-array curr-stream, input-ah # leak +691 # wastefully parse input into int-array +692 # TODO: support parsing arrays of other types +693 var input/eax: (addr array byte) <- lookup *input-ah +694 var h2: (handle array int) +695 var int-array-ah/esi: (addr handle array int) <- address h2 +696 parse-array-of-decimal-ints input, int-array-ah # leak +697 var _int-array/eax: (addr array int) <- lookup *int-array-ah +698 var int-array/esi: (addr array int) <- copy _int-array +699 var len/ebx: int <- length int-array +700 # push value-array of same size as int-array +701 var h3: (handle array value) +702 var value-array-ah/eax: (addr handle array value) <- address h3 +703 populate value-array-ah, len +704 push-array-to-value-stack out, *value-array-ah +705 # copy int-array into value-array +706 var _value-array/eax: (addr array value) <- lookup *value-array-ah +707 var value-array/edi: (addr array value) <- copy _value-array +708 var i/eax: int <- copy 0 +709 { +710 compare i, len +711 break-if->= +712 var src-addr/ecx: (addr int) <- index int-array, i +713 var src/ecx: int <- copy *src-addr +714 var src-f/xmm0: float <- convert src +715 var dest-offset/edx: (offset value) <- compute-offset value-array, i +716 var dest-val/edx: (addr value) <- index value-array, dest-offset +717 var dest/edx: (addr float) <- get dest-val, number-data +718 copy-to *dest, src-f +719 i <- increment +720 loop +721 } +722 break $evaluate:process-word +723 } +724 ### otherwise assume it's a literal number and push it +725 { +726 var n/eax: int <- parse-decimal-int-from-stream curr-stream +727 var n-f/xmm0: float <- convert n +728 push-number-to-value-stack out, n-f +729 } +730 } +731 # termination check +732 compare curr, end +733 break-if-= +734 # update +735 var next-word-ah/edx: (addr handle word) <- get curr, next +736 curr <- lookup *next-word-ah +737 # +738 loop +739 } +740 # process next line if necessary +741 var line/eax: (addr line) <- copy scratch +742 var next-line-ah/eax: (addr handle line) <- get line, next +743 var next-line/eax: (addr line) <- lookup *next-line-ah +744 compare next-line, 0 +745 break-if-= +746 evaluate functions, bindings, next-line, end, out 747 } 748 -749 fn find-function first: (addr handle function), name: (addr stream byte), out: (addr handle function) { -750 var curr/esi: (addr handle function) <- copy first -751 $find-function:loop: { -752 var _f/eax: (addr function) <- lookup *curr -753 var f/ecx: (addr function) <- copy _f -754 compare f, 0 -755 break-if-= -756 var curr-name-ah/eax: (addr handle array byte) <- get f, name -757 var curr-name/eax: (addr array byte) <- lookup *curr-name-ah -758 var done?/eax: boolean <- stream-data-equal? name, curr-name -759 compare done?, 0 # false -760 { -761 break-if-= -762 copy-handle *curr, out -763 break $find-function:loop -764 } -765 curr <- get f, next -766 loop -767 } -768 } -769 -770 fn perform-call _callee: (addr function), caller-stack: (addr value-stack), functions: (addr handle function) { -771 var callee/ecx: (addr function) <- copy _callee -772 # create bindings for args -773 var table-storage: table -774 var table/esi: (addr table) <- address table-storage -775 initialize-table table, 0x10 -776 bind-args callee, caller-stack, table -777 # obtain body -778 var body-ah/eax: (addr handle line) <- get callee, body -779 var body/eax: (addr line) <- lookup *body-ah -780 # perform call -781 var stack-storage: value-stack -782 var stack/edi: (addr value-stack) <- address stack-storage -783 initialize-value-stack stack, 0x10 -784 #? print-string-to-real-screen "about to enter recursive eval\n" -785 evaluate functions, table, body, 0, stack -786 #? print-string-to-real-screen "exited recursive eval\n" -787 # pop target-val from out -788 var top-addr/ecx: (addr int) <- get stack, top -789 compare *top-addr, 0 -790 break-if-<= -791 var data-ah/eax: (addr handle array value) <- get stack, data -792 var data/eax: (addr array value) <- lookup *data-ah -793 var top/edx: int <- copy *top-addr -794 top <- decrement -795 var dest-offset/edx: (offset value) <- compute-offset data, top -796 var target-val/edx: (addr value) <- index data, dest-offset -797 # stitch target-val into caller-stack -798 push-value-stack caller-stack, target-val -799 } -800 -801 # pop args from the caller-stack and bind them to successive args -802 # implies: function args are stored in reverse order -803 fn bind-args _callee: (addr function), _caller-stack: (addr value-stack), table: (addr table) { -804 var callee/ecx: (addr function) <- copy _callee -805 var curr-arg-ah/eax: (addr handle word) <- get callee, args -806 var curr-arg/eax: (addr word) <- lookup *curr-arg-ah -807 # -808 var curr-key-storage: (handle array byte) -809 var curr-key/edx: (addr handle array byte) <- address curr-key-storage -810 { -811 compare curr-arg, 0 -812 break-if-= -813 # create binding -814 word-to-string curr-arg, curr-key -815 { -816 # pop target-val from caller-stack -817 var caller-stack/esi: (addr value-stack) <- copy _caller-stack -818 var top-addr/ecx: (addr int) <- get caller-stack, top -819 compare *top-addr, 0 -820 break-if-<= -821 decrement *top-addr -822 var data-ah/eax: (addr handle array value) <- get caller-stack, data -823 var data/eax: (addr array value) <- lookup *data-ah -824 var top/ebx: int <- copy *top-addr -825 var dest-offset/ebx: (offset value) <- compute-offset data, top -826 var target-val/ebx: (addr value) <- index data, dest-offset -827 # create binding from curr-key to target-val -828 bind-in-table table, curr-key, target-val -829 } -830 # -831 var next-arg-ah/edx: (addr handle word) <- get curr-arg, next -832 curr-arg <- lookup *next-arg-ah -833 loop -834 } -835 } -836 -837 # Copy of 'simplify' that just tracks the maximum stack depth needed -838 # Doesn't actually need to simulate the stack, since every word has a predictable effect. -839 fn max-stack-depth first-word: (addr word), final-word: (addr word) -> _/edi: int { -840 var curr-word/eax: (addr word) <- copy first-word -841 var curr-depth/ecx: int <- copy 0 -842 var result/edi: int <- copy 0 -843 $max-stack-depth:loop: { -844 $max-stack-depth:process-word: { -845 # handle operators -846 { -847 var is-add?/eax: boolean <- word-equal? curr-word, "+" -848 compare is-add?, 0 -849 break-if-= -850 curr-depth <- decrement -851 break $max-stack-depth:process-word -852 } -853 { -854 var is-sub?/eax: boolean <- word-equal? curr-word, "-" -855 compare is-sub?, 0 -856 break-if-= -857 curr-depth <- decrement -858 break $max-stack-depth:process-word -859 } -860 { -861 var is-mul?/eax: boolean <- word-equal? curr-word, "*" -862 compare is-mul?, 0 -863 break-if-= -864 curr-depth <- decrement -865 break $max-stack-depth:process-word -866 } -867 # otherwise it's an int (do we need error-checking?) -868 curr-depth <- increment -869 # update max depth if necessary -870 { -871 compare curr-depth, result -872 break-if-<= -873 result <- copy curr-depth -874 } -875 } -876 # if curr-word == final-word break -877 compare curr-word, final-word -878 break-if-= -879 # curr-word = curr-word->next -880 var next-word-ah/edx: (addr handle word) <- get curr-word, next -881 curr-word <- lookup *next-word-ah -882 # -883 loop -884 } -885 return result -886 } +749 fn test-evaluate { +750 var line-storage: line +751 var line/esi: (addr line) <- address line-storage +752 var first-word-ah/eax: (addr handle word) <- get line-storage, data +753 allocate-word-with first-word-ah, "3" +754 append-word-with *first-word-ah, "=a" +755 var next-line-ah/eax: (addr handle line) <- get line-storage, next +756 allocate next-line-ah +757 var next-line/eax: (addr line) <- lookup *next-line-ah +758 var first-word-ah/eax: (addr handle word) <- get next-line, data +759 allocate-word-with first-word-ah, "a" +760 var functions-storage: (handle function) +761 var functions/ecx: (addr handle function) <- address functions-storage +762 var table-storage: table +763 var table/ebx: (addr table) <- address table-storage +764 initialize-table table, 0x10 +765 var stack-storage: value-stack +766 var stack/edi: (addr value-stack) <- address stack-storage +767 initialize-value-stack stack, 0x10 +768 evaluate functions, table, line, 0, stack +769 var x-f/xmm0: float <- pop-number-from-value-stack stack +770 var x/eax: int <- convert x-f +771 check-ints-equal x, 3, "F - test-evaluate" +772 } +773 +774 fn find-function first: (addr handle function), name: (addr stream byte), out: (addr handle function) { +775 var curr/esi: (addr handle function) <- copy first +776 $find-function:loop: { +777 var _f/eax: (addr function) <- lookup *curr +778 var f/ecx: (addr function) <- copy _f +779 compare f, 0 +780 break-if-= +781 var curr-name-ah/eax: (addr handle array byte) <- get f, name +782 var curr-name/eax: (addr array byte) <- lookup *curr-name-ah +783 var done?/eax: boolean <- stream-data-equal? name, curr-name +784 compare done?, 0 # false +785 { +786 break-if-= +787 copy-handle *curr, out +788 break $find-function:loop +789 } +790 curr <- get f, next +791 loop +792 } +793 } +794 +795 fn perform-call _callee: (addr function), caller-stack: (addr value-stack), functions: (addr handle function) { +796 var callee/ecx: (addr function) <- copy _callee +797 # create bindings for args +798 var table-storage: table +799 var table/esi: (addr table) <- address table-storage +800 initialize-table table, 0x10 +801 bind-args callee, caller-stack, table +802 # obtain body +803 var body-ah/eax: (addr handle line) <- get callee, body +804 var body/eax: (addr line) <- lookup *body-ah +805 # perform call +806 var stack-storage: value-stack +807 var stack/edi: (addr value-stack) <- address stack-storage +808 initialize-value-stack stack, 0x10 +809 #? print-string-to-real-screen "about to enter recursive eval\n" +810 evaluate functions, table, body, 0, stack +811 #? print-string-to-real-screen "exited recursive eval\n" +812 # pop target-val from out +813 var top-addr/ecx: (addr int) <- get stack, top +814 compare *top-addr, 0 +815 break-if-<= +816 var data-ah/eax: (addr handle array value) <- get stack, data +817 var data/eax: (addr array value) <- lookup *data-ah +818 var top/edx: int <- copy *top-addr +819 top <- decrement +820 var dest-offset/edx: (offset value) <- compute-offset data, top +821 var target-val/edx: (addr value) <- index data, dest-offset +822 # stitch target-val into caller-stack +823 push-value-stack caller-stack, target-val +824 } +825 +826 # pop args from the caller-stack and bind them to successive args +827 # implies: function args are stored in reverse order +828 fn bind-args _callee: (addr function), _caller-stack: (addr value-stack), table: (addr table) { +829 var callee/ecx: (addr function) <- copy _callee +830 var curr-arg-ah/eax: (addr handle word) <- get callee, args +831 var curr-arg/eax: (addr word) <- lookup *curr-arg-ah +832 # +833 var curr-key-storage: (handle array byte) +834 var curr-key/edx: (addr handle array byte) <- address curr-key-storage +835 { +836 compare curr-arg, 0 +837 break-if-= +838 # create binding +839 word-to-string curr-arg, curr-key +840 { +841 # pop target-val from caller-stack +842 var caller-stack/esi: (addr value-stack) <- copy _caller-stack +843 var top-addr/ecx: (addr int) <- get caller-stack, top +844 compare *top-addr, 0 +845 break-if-<= +846 decrement *top-addr +847 var data-ah/eax: (addr handle array value) <- get caller-stack, data +848 var data/eax: (addr array value) <- lookup *data-ah +849 var top/ebx: int <- copy *top-addr +850 var dest-offset/ebx: (offset value) <- compute-offset data, top +851 var target-val/ebx: (addr value) <- index data, dest-offset +852 # create binding from curr-key to target-val +853 bind-in-table table, curr-key, target-val +854 } +855 # +856 var next-arg-ah/edx: (addr handle word) <- get curr-arg, next +857 curr-arg <- lookup *next-arg-ah +858 loop +859 } +860 } +861 +862 # Copy of 'simplify' that just tracks the maximum stack depth needed +863 # Doesn't actually need to simulate the stack, since every word has a predictable effect. +864 fn max-stack-depth first-word: (addr word), final-word: (addr word) -> _/edi: int { +865 var curr-word/eax: (addr word) <- copy first-word +866 var curr-depth/ecx: int <- copy 0 +867 var result/edi: int <- copy 0 +868 $max-stack-depth:loop: { +869 $max-stack-depth:process-word: { +870 # handle operators +871 { +872 var is-add?/eax: boolean <- word-equal? curr-word, "+" +873 compare is-add?, 0 +874 break-if-= +875 curr-depth <- decrement +876 break $max-stack-depth:process-word +877 } +878 { +879 var is-sub?/eax: boolean <- word-equal? curr-word, "-" +880 compare is-sub?, 0 +881 break-if-= +882 curr-depth <- decrement +883 break $max-stack-depth:process-word +884 } +885 { +886 var is-mul?/eax: boolean <- word-equal? curr-word, "*" +887 compare is-mul?, 0 +888 break-if-= +889 curr-depth <- decrement +890 break $max-stack-depth:process-word +891 } +892 # otherwise it's an int (do we need error-checking?) +893 curr-depth <- increment +894 # update max depth if necessary +895 { +896 compare curr-depth, result +897 break-if-<= +898 result <- copy curr-depth +899 } +900 } +901 # if curr-word == final-word break +902 compare curr-word, final-word +903 break-if-= +904 # curr-word = curr-word->next +905 var next-word-ah/edx: (addr handle word) <- get curr-word, next +906 curr-word <- lookup *next-word-ah +907 # +908 loop +909 } +910 return result +911 } diff --git a/html/apps/tile/surface.mu.html b/html/apps/tile/surface.mu.html index f1b84f8c..33ab2637 100644 --- a/html/apps/tile/surface.mu.html +++ b/html/apps/tile/surface.mu.html @@ -81,10 +81,10 @@ if ('onhashchange' in window) { 21 fn initialize-surface-with _self: (addr surface), in: (addr array byte) { 22 var self/esi: (addr surface) <- copy _self 23 # fill in nrows, ncols - 24 var nrows/ecx: int <- num-lines in + 24 var nrows/ecx: int <- num-lines in 25 var dest/eax: (addr int) <- get self, nrows 26 copy-to *dest, nrows - 27 var ncols/edx: int <- first-line-length in # assume all lines are the same length + 27 var ncols/edx: int <- first-line-length in # assume all lines are the same length 28 dest <- get self, ncols 29 copy-to *dest, ncols 30 # fill in data @@ -94,7 +94,7 @@ if ('onhashchange' in window) { 34 var data/eax: (addr handle array screen-cell) <- get out, data 35 populate data, len 36 var data-addr/eax: (addr array screen-cell) <- lookup *data - 37 fill-in data-addr, in + 37 fill-in data-addr, in 38 # fill in screen-nrows, screen-ncols 39 { 40 var screen-ah/eax: (addr handle screen) <- get self, screen @@ -160,318 +160,316 @@ if ('onhashchange' in window) { 100 } 101 102 fn print-surface-cell-at _self: (addr surface), screen-row: int, screen-col: int { -103 $print-surface-cell-at:body: { -104 var self/esi: (addr surface) <- copy _self -105 var row/ecx: int <- screen-row-to-surface self, screen-row -106 var col/edx: int <- screen-col-to-surface self, screen-col -107 var data-ah/edi: (addr handle array screen-cell) <- get self, data -108 var _data-addr/eax: (addr array screen-cell) <- lookup *data-ah -109 var data-addr/edi: (addr array screen-cell) <- copy _data-addr -110 var idx/eax: int <- surface-screen-cell-index self, row, col -111 # if out of bounds, print ' ' -112 compare idx, 0 -113 { -114 break-if->= -115 var space/ecx: grapheme <- copy 0x20 -116 var screen-ah/edi: (addr handle screen) <- get self, screen -117 var screen/eax: (addr screen) <- lookup *screen-ah -118 print-grapheme screen, space -119 break $print-surface-cell-at:body -120 } -121 # otherwise print the appropriate screen-cell -122 var offset/ecx: (offset screen-cell) <- compute-offset data-addr, idx -123 var src/ecx: (addr screen-cell) <- index data-addr, offset -124 var screen-ah/edi: (addr handle screen) <- get self, screen -125 var screen/eax: (addr screen) <- lookup *screen-ah -126 print-screen-cell screen, src -127 } -128 } -129 -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 -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 -137 var tmp/eax: (addr boolean) <- get cell, bold? -138 { -139 compare *tmp, 0 -140 break-if-= -141 start-bold screen -142 } -143 { -144 tmp <- get cell, underline? -145 compare *tmp, 0 -146 break-if-= -147 start-underline screen -148 } -149 { -150 tmp <- get cell, reverse? -151 compare *tmp, 0 -152 break-if-= -153 start-reverse-video screen -154 } -155 { -156 tmp <- get cell, blink? -157 compare *tmp, 0 -158 break-if-= -159 start-blinking screen -160 } -161 var g/eax: (addr grapheme) <- get cell, data -162 print-grapheme screen, *g -163 #? var g2/eax: grapheme <- copy *g -164 #? var g3/eax: int <- copy g2 -165 #? print-int32-hex-to-real-screen g3 -166 #? print-string-to-real-screen "\n" -167 } -168 -169 fn surface-screen-cell-index _self: (addr surface), row: int, col: int -> _/eax: int { -170 var self/esi: (addr surface) <- copy _self -171 #? print-int32-hex-to-real-screen row -172 #? print-string-to-real-screen ", " -173 #? print-int32-hex-to-real-screen col -174 #? print-string-to-real-screen "\n" -175 var result/eax: int <- copy -1 -176 { -177 compare row, 1 +103 var self/esi: (addr surface) <- copy _self +104 var row/ecx: int <- screen-row-to-surface self, screen-row +105 var col/edx: int <- screen-col-to-surface self, screen-col +106 var data-ah/edi: (addr handle array screen-cell) <- get self, data +107 var _data-addr/eax: (addr array screen-cell) <- lookup *data-ah +108 var data-addr/edi: (addr array screen-cell) <- copy _data-addr +109 var idx/eax: int <- surface-screen-cell-index self, row, col +110 # if out of bounds, print ' ' +111 compare idx, 0 +112 { +113 break-if->= +114 var space/ecx: grapheme <- copy 0x20 +115 var screen-ah/edi: (addr handle screen) <- get self, screen +116 var screen/eax: (addr screen) <- lookup *screen-ah +117 print-grapheme screen, space +118 return +119 } +120 # otherwise print the appropriate screen-cell +121 var offset/ecx: (offset screen-cell) <- compute-offset data-addr, idx +122 var src/ecx: (addr screen-cell) <- index data-addr, offset +123 var screen-ah/edi: (addr handle screen) <- get self, screen +124 var screen/eax: (addr screen) <- lookup *screen-ah +125 print-screen-cell screen, src +126 } +127 +128 # print a cell with all its formatting at the cursor location +129 fn print-screen-cell screen: (addr screen), _cell: (addr screen-cell) { +130 var cell/esi: (addr screen-cell) <- copy _cell +131 reset-formatting screen +132 var fg/eax: (addr int) <- get cell, color +133 var bg/ecx: (addr int) <- get cell, background-color +134 start-color screen, *fg, *bg +135 var tmp/eax: (addr boolean) <- get cell, bold? +136 { +137 compare *tmp, 0 +138 break-if-= +139 start-bold screen +140 } +141 { +142 tmp <- get cell, underline? +143 compare *tmp, 0 +144 break-if-= +145 start-underline screen +146 } +147 { +148 tmp <- get cell, reverse? +149 compare *tmp, 0 +150 break-if-= +151 start-reverse-video screen +152 } +153 { +154 tmp <- get cell, blink? +155 compare *tmp, 0 +156 break-if-= +157 start-blinking screen +158 } +159 var g/eax: (addr grapheme) <- get cell, data +160 print-grapheme screen, *g +161 #? var g2/eax: grapheme <- copy *g +162 #? var g3/eax: int <- copy g2 +163 #? print-int32-hex-to-real-screen g3 +164 #? print-string-to-real-screen "\n" +165 } +166 +167 fn surface-screen-cell-index _self: (addr surface), row: int, col: int -> _/eax: int { +168 var self/esi: (addr surface) <- copy _self +169 #? print-int32-hex-to-real-screen row +170 #? print-string-to-real-screen ", " +171 #? print-int32-hex-to-real-screen col +172 #? print-string-to-real-screen "\n" +173 var result/eax: int <- copy -1 +174 { +175 compare row, 1 +176 break-if-< +177 compare col, 1 178 break-if-< -179 compare col, 1 -180 break-if-< -181 var nrows-addr/ecx: (addr int) <- get self, nrows -182 var nrows/ecx: int <- copy *nrows-addr -183 compare row, nrows -184 break-if-> -185 var ncols-addr/ecx: (addr int) <- get self, ncols -186 var ncols/ecx: int <- copy *ncols-addr -187 compare col, ncols -188 break-if-> -189 #? print-string-to-real-screen "!\n" -190 result <- copy row -191 result <- subtract 1 -192 result <- multiply ncols -193 result <- add col -194 result <- subtract 1 -195 } -196 return result -197 } -198 -199 fn screen-row-to-surface _self: (addr surface), screen-row: int -> _/ecx: int { -200 var self/esi: (addr surface) <- copy _self -201 var result/ecx: int <- copy screen-row -202 var tmp/eax: (addr int) <- get self, pin-row -203 result <- add *tmp -204 tmp <- get self, pin-screen-row -205 result <- subtract *tmp -206 return result -207 } -208 -209 fn max _a: int, b: int -> _/eax: int { -210 var a/eax: int <- copy _a -211 compare a, b -212 { -213 break-if-> -214 return b -215 } -216 return a -217 } -218 -219 fn min _a: int, b: int -> _/eax: int { -220 var a/eax: int <- copy _a -221 compare a, b -222 { -223 break-if-> -224 return a -225 } -226 return b -227 } -228 -229 fn screen-col-to-surface _self: (addr surface), screen-col: int -> _/edx: int { -230 var self/esi: (addr surface) <- copy _self -231 var result/edx: int <- copy screen-col -232 var tmp/eax: (addr int) <- get self, pin-col -233 result <- add *tmp -234 tmp <- get self, pin-screen-col -235 result <- subtract *tmp -236 return result -237 } -238 -239 fn surface-row-to-screen _self: (addr surface), row: int -> _/ecx: int { -240 var self/esi: (addr surface) <- copy _self -241 var result/ecx: int <- copy row -242 var tmp/eax: (addr int) <- get self, pin-screen-row -243 result <- add *tmp -244 tmp <- get self, pin-row -245 result <- subtract *tmp -246 return result -247 } -248 -249 fn surface-col-to-screen _self: (addr surface), col: int -> _/edx: int { -250 var self/esi: (addr surface) <- copy _self -251 var result/edx: int <- copy col -252 var tmp/eax: (addr int) <- get self, pin-screen-col -253 result <- add *tmp -254 tmp <- get self, pin-col -255 result <- subtract *tmp -256 return result -257 } -258 -259 # assumes last line doesn't end in '\n' -260 fn num-lines in: (addr array byte) -> _/ecx: int { -261 var s: (stream byte 0x100) -262 var s-addr/esi: (addr stream byte) <- address s -263 write s-addr, in -264 var result/ecx: int <- copy 1 -265 { -266 var done?/eax: boolean <- stream-empty? s-addr -267 compare done?, 0 # false -268 break-if-!= -269 var g/eax: grapheme <- read-grapheme s-addr -270 compare g, 0xa # newline -271 loop-if-!= -272 result <- increment -273 loop -274 } -275 return result -276 } -277 -278 fn first-line-length in: (addr array byte) -> _/edx: int { -279 var s: (stream byte 0x100) -280 var s-addr/esi: (addr stream byte) <- address s -281 write s-addr, in -282 var result/edx: int <- copy 0 -283 { -284 var done?/eax: boolean <- stream-empty? s-addr -285 compare done?, 0 # false -286 break-if-!= -287 var g/eax: grapheme <- read-grapheme s-addr -288 compare g, 0xa # newline -289 break-if-= -290 result <- increment -291 loop -292 } -293 return result -294 } -295 -296 fn fill-in _out: (addr array screen-cell), in: (addr array byte) { -297 var s: (stream byte 0x100) -298 var out/edi: (addr array screen-cell) <- copy _out -299 var s-addr/esi: (addr stream byte) <- address s -300 write s-addr, in -301 var idx/ecx: int <- copy 0 -302 { -303 var done?/eax: boolean <- stream-empty? s-addr -304 compare done?, 0 # false -305 break-if-!= -306 var g/eax: grapheme <- read-grapheme s-addr -307 compare g, 0xa # newline -308 loop-if-= -309 var offset/edx: (offset screen-cell) <- compute-offset out, idx -310 var dest/edx: (addr screen-cell) <- index out, offset -311 var dest2/edx: (addr grapheme) <- get dest, data -312 copy-to *dest2, g -313 idx <- increment -314 loop -315 } -316 } -317 -318 # pin (1, 1) to (1, 1) on screen -319 fn test-surface-pin-at-origin { -320 var s: surface -321 var s-addr/esi: (addr surface) <- address s -322 # surface contents are a fixed grid with 8 rows and 6 columns -323 # (strip vowels second time around to break vertical alignment of letters) -324 initialize-surface-with-fake-screen s-addr, 3, 4, "abcdef\nghijkl\nmnopqr\nstuvwx\nyzabcd\nfghjkl\nmnpqrs\ntvwxyz" -325 pin-surface-at s-addr, 1, 1 # surface row and column -326 pin-surface-to s-addr, 1, 1 # screen row and column -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" -333 } -334 -335 # pin (1, 1) to (2, 1) on screen; screen goes past edge of the universe -336 fn test-surface-pin-2 { -337 var s: surface -338 var s-addr/esi: (addr surface) <- address s -339 # surface contents are a fixed grid with 8 rows and 6 columns -340 # (strip vowels second time around to break vertical alignment of letters) -341 initialize-surface-with-fake-screen s-addr, 3, 4, "abcdef\nghijkl\nmnopqr\nstuvwx\nyzabcd\nfghjkl\nmnpqrs\ntvwxyz" -342 pin-surface-at s-addr, 1, 1 # surface row and column -343 pin-surface-to s-addr, 2, 1 # screen row and column -344 render-surface s-addr -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" -351 } -352 -353 # pin (2, 1) to (1, 1) on screen -354 fn test-surface-pin-3 { -355 var s: surface -356 var s-addr/esi: (addr surface) <- address s -357 # surface contents are a fixed grid with 8 rows and 6 columns -358 # (strip vowels second time around to break vertical alignment of letters) -359 initialize-surface-with-fake-screen s-addr, 3, 4, "abcdef\nghijkl\nmnopqr\nstuvwx\nyzabcd\nfghjkl\nmnpqrs\ntvwxyz" -360 pin-surface-at s-addr, 2, 1 # surface row and column -361 pin-surface-to s-addr, 1, 1 # screen row and column -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" -368 } -369 -370 # pin (1, 1) to (1, 2) on screen; screen goes past edge of the universe -371 fn test-surface-pin-4 { -372 var s: surface -373 var s-addr/esi: (addr surface) <- address s -374 # surface contents are a fixed grid with 8 rows and 6 columns -375 # (strip vowels second time around to break vertical alignment of letters) -376 initialize-surface-with-fake-screen s-addr, 3, 4, "abcdef\nghijkl\nmnopqr\nstuvwx\nyzabcd\nfghjkl\nmnpqrs\ntvwxyz" -377 pin-surface-at s-addr, 1, 1 # surface row and column -378 pin-surface-to s-addr, 1, 2 # screen row and column -379 render-surface s-addr -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" -386 } -387 -388 # pin (1, 2) to (1, 1) on screen -389 fn test-surface-pin-5 { -390 var s: surface -391 var s-addr/esi: (addr surface) <- address s -392 # surface contents are a fixed grid with 8 rows and 6 columns -393 # (strip vowels second time around to break vertical alignment of letters) -394 initialize-surface-with-fake-screen s-addr, 3, 4, "abcdef\nghijkl\nmnopqr\nstuvwx\nyzabcd\nfghjkl\nmnpqrs\ntvwxyz" -395 pin-surface-at s-addr, 1, 2 # surface row and column -396 pin-surface-to s-addr, 1, 1 # screen row and column -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" -403 } -404 -405 fn initialize-surface-with-fake-screen _self: (addr surface), nrows: int, ncols: int, in: (addr array byte) { -406 var self/esi: (addr surface) <- copy _self -407 # fill in screen -408 var screen-ah/eax: (addr handle screen) <- get self, screen -409 allocate screen-ah -410 var screen-addr/eax: (addr screen) <- lookup *screen-ah -411 initialize-screen screen-addr, nrows, ncols -412 # fill in everything else -413 initialize-surface-with self, in -414 } +179 var nrows-addr/ecx: (addr int) <- get self, nrows +180 var nrows/ecx: int <- copy *nrows-addr +181 compare row, nrows +182 break-if-> +183 var ncols-addr/ecx: (addr int) <- get self, ncols +184 var ncols/ecx: int <- copy *ncols-addr +185 compare col, ncols +186 break-if-> +187 #? print-string-to-real-screen "!\n" +188 result <- copy row +189 result <- subtract 1 +190 result <- multiply ncols +191 result <- add col +192 result <- subtract 1 +193 } +194 return result +195 } +196 +197 fn screen-row-to-surface _self: (addr surface), screen-row: int -> _/ecx: int { +198 var self/esi: (addr surface) <- copy _self +199 var result/ecx: int <- copy screen-row +200 var tmp/eax: (addr int) <- get self, pin-row +201 result <- add *tmp +202 tmp <- get self, pin-screen-row +203 result <- subtract *tmp +204 return result +205 } +206 +207 fn max _a: int, b: int -> _/eax: int { +208 var a/eax: int <- copy _a +209 compare a, b +210 { +211 break-if-> +212 return b +213 } +214 return a +215 } +216 +217 fn min _a: int, b: int -> _/eax: int { +218 var a/eax: int <- copy _a +219 compare a, b +220 { +221 break-if-> +222 return a +223 } +224 return b +225 } +226 +227 fn screen-col-to-surface _self: (addr surface), screen-col: int -> _/edx: int { +228 var self/esi: (addr surface) <- copy _self +229 var result/edx: int <- copy screen-col +230 var tmp/eax: (addr int) <- get self, pin-col +231 result <- add *tmp +232 tmp <- get self, pin-screen-col +233 result <- subtract *tmp +234 return result +235 } +236 +237 fn surface-row-to-screen _self: (addr surface), row: int -> _/ecx: int { +238 var self/esi: (addr surface) <- copy _self +239 var result/ecx: int <- copy row +240 var tmp/eax: (addr int) <- get self, pin-screen-row +241 result <- add *tmp +242 tmp <- get self, pin-row +243 result <- subtract *tmp +244 return result +245 } +246 +247 fn surface-col-to-screen _self: (addr surface), col: int -> _/edx: int { +248 var self/esi: (addr surface) <- copy _self +249 var result/edx: int <- copy col +250 var tmp/eax: (addr int) <- get self, pin-screen-col +251 result <- add *tmp +252 tmp <- get self, pin-col +253 result <- subtract *tmp +254 return result +255 } +256 +257 # assumes last line doesn't end in '\n' +258 fn num-lines in: (addr array byte) -> _/ecx: int { +259 var s: (stream byte 0x100) +260 var s-addr/esi: (addr stream byte) <- address s +261 write s-addr, in +262 var result/ecx: int <- copy 1 +263 { +264 var done?/eax: boolean <- stream-empty? s-addr +265 compare done?, 0 # false +266 break-if-!= +267 var g/eax: grapheme <- read-grapheme s-addr +268 compare g, 0xa # newline +269 loop-if-!= +270 result <- increment +271 loop +272 } +273 return result +274 } +275 +276 fn first-line-length in: (addr array byte) -> _/edx: int { +277 var s: (stream byte 0x100) +278 var s-addr/esi: (addr stream byte) <- address s +279 write s-addr, in +280 var result/edx: int <- copy 0 +281 { +282 var done?/eax: boolean <- stream-empty? s-addr +283 compare done?, 0 # false +284 break-if-!= +285 var g/eax: grapheme <- read-grapheme s-addr +286 compare g, 0xa # newline +287 break-if-= +288 result <- increment +289 loop +290 } +291 return result +292 } +293 +294 fn fill-in _out: (addr array screen-cell), in: (addr array byte) { +295 var s: (stream byte 0x100) +296 var out/edi: (addr array screen-cell) <- copy _out +297 var s-addr/esi: (addr stream byte) <- address s +298 write s-addr, in +299 var idx/ecx: int <- copy 0 +300 { +301 var done?/eax: boolean <- stream-empty? s-addr +302 compare done?, 0 # false +303 break-if-!= +304 var g/eax: grapheme <- read-grapheme s-addr +305 compare g, 0xa # newline +306 loop-if-= +307 var offset/edx: (offset screen-cell) <- compute-offset out, idx +308 var dest/edx: (addr screen-cell) <- index out, offset +309 var dest2/edx: (addr grapheme) <- get dest, data +310 copy-to *dest2, g +311 idx <- increment +312 loop +313 } +314 } +315 +316 # pin (1, 1) to (1, 1) on screen +317 fn test-surface-pin-at-origin { +318 var s: surface +319 var s-addr/esi: (addr surface) <- address s +320 # surface contents are a fixed grid with 8 rows and 6 columns +321 # (strip vowels second time around to break vertical alignment of letters) +322 initialize-surface-with-fake-screen s-addr, 3, 4, "abcdef\nghijkl\nmnopqr\nstuvwx\nyzabcd\nfghjkl\nmnpqrs\ntvwxyz" +323 pin-surface-at s-addr, 1, 1 # surface row and column +324 pin-surface-to s-addr, 1, 1 # screen row and column +325 render-surface s-addr +326 var screen-ah/eax: (addr handle screen) <- get s-addr, screen +327 var screen-addr/eax: (addr screen) <- lookup *screen-ah +328 check-screen-row screen-addr, 1, "abcd", "F - test-surface-pin-at-origin" +329 check-screen-row screen-addr, 2, "ghij", "F - test-surface-pin-at-origin" +330 check-screen-row screen-addr, 3, "mnop", "F - test-surface-pin-at-origin" +331 } +332 +333 # pin (1, 1) to (2, 1) on screen; screen goes past edge of the universe +334 fn test-surface-pin-2 { +335 var s: surface +336 var s-addr/esi: (addr surface) <- address s +337 # surface contents are a fixed grid with 8 rows and 6 columns +338 # (strip vowels second time around to break vertical alignment of letters) +339 initialize-surface-with-fake-screen s-addr, 3, 4, "abcdef\nghijkl\nmnopqr\nstuvwx\nyzabcd\nfghjkl\nmnpqrs\ntvwxyz" +340 pin-surface-at s-addr, 1, 1 # surface row and column +341 pin-surface-to s-addr, 2, 1 # screen row and column +342 render-surface s-addr +343 var screen-ah/eax: (addr handle screen) <- get s-addr, screen +344 var screen-addr/eax: (addr screen) <- lookup *screen-ah +345 # surface edge reached (should seldom happen in the app) +346 check-screen-row screen-addr, 1, " ", "F - test-surface-pin-2" +347 check-screen-row screen-addr, 2, "abcd", "F - test-surface-pin-2" +348 check-screen-row screen-addr, 3, "ghij", "F - test-surface-pin-2" +349 } +350 +351 # pin (2, 1) to (1, 1) on screen +352 fn test-surface-pin-3 { +353 var s: surface +354 var s-addr/esi: (addr surface) <- address s +355 # surface contents are a fixed grid with 8 rows and 6 columns +356 # (strip vowels second time around to break vertical alignment of letters) +357 initialize-surface-with-fake-screen s-addr, 3, 4, "abcdef\nghijkl\nmnopqr\nstuvwx\nyzabcd\nfghjkl\nmnpqrs\ntvwxyz" +358 pin-surface-at s-addr, 2, 1 # surface row and column +359 pin-surface-to s-addr, 1, 1 # screen row and column +360 render-surface s-addr +361 var screen-ah/eax: (addr handle screen) <- get s-addr, screen +362 var screen-addr/eax: (addr screen) <- lookup *screen-ah +363 check-screen-row screen-addr, 1, "ghij", "F - test-surface-pin-3" +364 check-screen-row screen-addr, 2, "mnop", "F - test-surface-pin-3" +365 check-screen-row screen-addr, 3, "stuv", "F - test-surface-pin-3" +366 } +367 +368 # pin (1, 1) to (1, 2) on screen; screen goes past edge of the universe +369 fn test-surface-pin-4 { +370 var s: surface +371 var s-addr/esi: (addr surface) <- address s +372 # surface contents are a fixed grid with 8 rows and 6 columns +373 # (strip vowels second time around to break vertical alignment of letters) +374 initialize-surface-with-fake-screen s-addr, 3, 4, "abcdef\nghijkl\nmnopqr\nstuvwx\nyzabcd\nfghjkl\nmnpqrs\ntvwxyz" +375 pin-surface-at s-addr, 1, 1 # surface row and column +376 pin-surface-to s-addr, 1, 2 # screen row and column +377 render-surface s-addr +378 var screen-ah/eax: (addr handle screen) <- get s-addr, screen +379 var screen-addr/eax: (addr screen) <- lookup *screen-ah +380 # surface edge reached (should seldom happen in the app) +381 check-screen-row screen-addr, 1, " abc", "F - test-surface-pin-4" +382 check-screen-row screen-addr, 2, " ghi", "F - test-surface-pin-4" +383 check-screen-row screen-addr, 3, " mno", "F - test-surface-pin-4" +384 } +385 +386 # pin (1, 2) to (1, 1) on screen +387 fn test-surface-pin-5 { +388 var s: surface +389 var s-addr/esi: (addr surface) <- address s +390 # surface contents are a fixed grid with 8 rows and 6 columns +391 # (strip vowels second time around to break vertical alignment of letters) +392 initialize-surface-with-fake-screen s-addr, 3, 4, "abcdef\nghijkl\nmnopqr\nstuvwx\nyzabcd\nfghjkl\nmnpqrs\ntvwxyz" +393 pin-surface-at s-addr, 1, 2 # surface row and column +394 pin-surface-to s-addr, 1, 1 # screen row and column +395 render-surface s-addr +396 var screen-ah/eax: (addr handle screen) <- get s-addr, screen +397 var screen-addr/eax: (addr screen) <- lookup *screen-ah +398 check-screen-row screen-addr, 1, "bcde", "F - test-surface-pin-5" +399 check-screen-row screen-addr, 2, "hijk", "F - test-surface-pin-5" +400 check-screen-row screen-addr, 3, "nopq", "F - test-surface-pin-5" +401 } +402 +403 fn initialize-surface-with-fake-screen _self: (addr surface), nrows: int, ncols: int, in: (addr array byte) { +404 var self/esi: (addr surface) <- copy _self +405 # fill in screen +406 var screen-ah/eax: (addr handle screen) <- get self, screen +407 allocate screen-ah +408 var screen-addr/eax: (addr screen) <- lookup *screen-ah +409 initialize-screen screen-addr, nrows, ncols +410 # fill in everything else +411 initialize-surface-with self, in +412 } diff --git a/html/apps/tile/table.mu.html b/html/apps/tile/table.mu.html index 41f1f542..1f07d3b2 100644 --- a/html/apps/tile/table.mu.html +++ b/html/apps/tile/table.mu.html @@ -99,7 +99,7 @@ if ('onhashchange' in window) { 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 + 43 deep-copy-value src-val, dest-val 44 #? print-string 0, "}\n" 45 } 46 i <- increment @@ -142,15 +142,15 @@ if ('onhashchange' in window) { 83 return result 84 } 85 - 86 fn make-int-binding _self: (addr bind), key: (addr handle array byte), _val: int { + 86 fn make-number-binding _self: (addr bind), key: (addr handle array byte), _val: float { 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 + 93 var dest4/eax: (addr float) <- get dest3, number-data + 94 var val/xmm0: float <- copy _val 95 copy-to *dest4, val 96 } 97 diff --git a/html/apps/tile/value-stack.mu.html b/html/apps/tile/value-stack.mu.html index e8c15026..dc118e7e 100644 --- a/html/apps/tile/value-stack.mu.html +++ b/html/apps/tile/value-stack.mu.html @@ -78,7 +78,7 @@ if ('onhashchange' in window) { 19 copy-to *top, 0 20 } 21 - 22 fn push-int-to-value-stack _self: (addr value-stack), _val: int { + 22 fn push-number-to-value-stack _self: (addr value-stack), _val: float { 23 var self/esi: (addr value-stack) <- copy _self 24 var top-addr/ecx: (addr int) <- get self, top 25 var data-ah/edx: (addr handle array value) <- get self, data @@ -86,13 +86,13 @@ if ('onhashchange' in window) { 27 var top/edx: int <- copy *top-addr 28 var dest-offset/edx: (offset value) <- compute-offset data, top 29 var dest-addr/edx: (addr value) <- index data, dest-offset - 30 var dest-addr2/eax: (addr int) <- get dest-addr, int-data - 31 var val/esi: int <- copy _val - 32 #? print-int32-hex-to-real-screen val + 30 var dest-addr2/eax: (addr float) <- get dest-addr, number-data + 31 var val/xmm0: float <- copy _val + 32 #? print-float-decimal-approximate 0, val, 3 33 copy-to *dest-addr2, val 34 increment *top-addr - 35 dest-addr2 <- get dest-addr, type - 36 copy-to *dest-addr2, 0 # int + 35 var type-addr/eax: (addr int) <- get dest-addr, type + 36 copy-to *type-addr, 0 # number 37 } 38 39 fn push-string-to-value-stack _self: (addr value-stack), val: (handle array byte) { @@ -144,92 +144,94 @@ if ('onhashchange' in window) { 85 increment *top-addr 86 } 87 - 88 fn pop-int-from-value-stack _self: (addr value-stack) -> _/eax: int { + 88 fn pop-number-from-value-stack _self: (addr value-stack) -> _/xmm0: float { 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 } + 94 var minus-one/eax: int <- copy -1 + 95 var minus-one-f/xmm0: float <- convert minus-one + 96 return minus-one-f + 97 } + 98 decrement *top-addr + 99 var data-ah/edx: (addr handle array value) <- get self, data +100 var data/eax: (addr array value) <- lookup *data-ah +101 var top/edx: int <- copy *top-addr +102 var dest-offset/edx: (offset value) <- compute-offset data, top +103 var result-addr/eax: (addr value) <- index data, dest-offset +104 var result-addr2/eax: (addr float) <- get result-addr, number-data +105 return *result-addr2 +106 } +107 +108 fn value-stack-empty? _self: (addr value-stack) -> _/eax: boolean { +109 var self/esi: (addr value-stack) <- copy _self +110 var top/eax: (addr int) <- get self, top +111 compare *top, 0 +112 { +113 break-if-!= +114 return 1 # true +115 } +116 return 0 # false +117 } +118 +119 fn value-stack-length _self: (addr value-stack) -> _/eax: int { +120 var self/esi: (addr value-stack) <- copy _self +121 var top-addr/eax: (addr int) <- get self, top +122 return *top-addr +123 } +124 +125 fn value-stack-max-width _self: (addr value-stack) -> _/eax: int { +126 var self/esi: (addr value-stack) <- copy _self +127 var data-ah/edi: (addr handle array value) <- get self, data +128 var _data/eax: (addr array value) <- lookup *data-ah +129 var data/edi: (addr array value) <- copy _data +130 var top-addr/ecx: (addr int) <- get self, top +131 var i/ebx: int <- copy 0 +132 var result: int +133 { +134 compare i, *top-addr +135 break-if->= +136 var o/edx: (offset value) <- compute-offset data, i +137 var v/edx: (addr value) <- index data, o +138 var w/eax: int <- value-width v, 1 # top-level=true +139 # if (w > result) w = result +140 { +141 compare w, result +142 break-if-<= +143 copy-to result, w +144 } +145 i <- increment +146 loop +147 } +148 return result +149 } +150 +151 fn save-lines in-h: (handle array (handle array byte)), _out-ah: (addr handle array value) { +152 var _in/eax: (addr array (handle array byte)) <- lookup in-h +153 var in/esi: (addr array (handle array byte)) <- copy _in +154 var len/ecx: int <- length in +155 var out-ah/edi: (addr handle array value) <- copy _out-ah +156 populate out-ah, len +157 var out/eax: (addr array value) <- lookup *out-ah +158 # copy in into out +159 var i/ebx: int <- copy 0 +160 { +161 compare i, len +162 break-if->= +163 #? print-int32-hex 0, i +164 #? print-string 0, "\n" +165 var src/ecx: (addr handle array byte) <- index in, i +166 var dest-offset/edx: (offset value) <- compute-offset out, i +167 var dest-val/edx: (addr value) <- index out, dest-offset +168 var dest/eax: (addr handle array byte) <- get dest-val, text-data +169 copy-object src, dest +170 var type/edx: (addr int) <- get dest-val, type +171 copy-to *type, 1 # string +172 i <- increment +173 loop +174 } +175 } diff --git a/html/apps/tile/value.mu.html b/html/apps/tile/value.mu.html index 6a14baf9..bf722f3e 100644 --- a/html/apps/tile/value.mu.html +++ b/html/apps/tile/value.mu.html @@ -75,7 +75,7 @@ if ('onhashchange' in window) { 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 + 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 @@ -84,7 +84,7 @@ if ('onhashchange' in window) { 25 print-code-point screen, 0x2026 # ellipses 26 } 27 print-code-point screen, 0x275e # close-quote - 28 reset-formatting screen + 28 reset-formatting screen 29 return 30 } 31 compare *val-type, 2 # array @@ -100,7 +100,7 @@ if ('onhashchange' in window) { 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 + 44 start-color screen, 0, 7 45 # TODO 46 print-string screen, " FILE " 47 return @@ -116,54 +116,54 @@ if ('onhashchange' in window) { 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 + 60 var val-num/eax: (addr float) <- get val, number-data + 61 render-number screen, *val-num, max-width 62 } 63 64 # synaesthesia - 65 fn render-integer screen: (addr screen), val: int, max-width: int { - 66 $render-integer:body: { + 65 # TODO: right-justify + 66 fn render-number screen: (addr screen), val: float, max-width: int { 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 + 71 print-float-decimal-approximate screen, val, 3 + 72 return 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 } + 74 var val-int/eax: int <- convert val + 75 var bg/eax: int <- hash-color val-int + 76 var fg/ecx: int <- copy 7 + 77 { + 78 compare bg, 2 + 79 break-if-!= + 80 fg <- copy 0 + 81 } + 82 { + 83 compare bg, 3 + 84 break-if-!= + 85 fg <- copy 0 + 86 } + 87 { + 88 compare bg, 6 + 89 break-if-!= + 90 fg <- copy 0 + 91 } + 92 start-color screen, fg, bg + 93 print-grapheme screen, 0x20 # space + 94 print-float-decimal-approximate screen, val, 3 + 95 print-grapheme screen, 0x20 # space 96 } 97 98 fn render-array-at screen: (addr screen), row: int, col: int, _a: (addr array value) { - 99 start-color screen, 0xf2, 7 + 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 +104 var max/ecx: int <- length a 105 var i/eax: int <- copy 0 106 { -107 compare i, max +107 compare i, max 108 break-if->= 109 { 110 compare i, 0 @@ -174,7 +174,7 @@ if ('onhashchange' in window) { 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 +118 var w/eax: int <- value-width x, 0 119 add-to col, w 120 increment col 121 } @@ -185,11 +185,11 @@ if ('onhashchange' in window) { 126 } 127 128 fn render-screen screen: (addr screen), row: int, col: int, _target-screen: (addr screen) { -129 reset-formatting screen +129 reset-formatting screen 130 move-cursor screen, row, col 131 var target-screen/esi: (addr screen) <- copy _target-screen 132 var ncols-a/ecx: (addr int) <- get target-screen, num-cols -133 print-upper-border screen, *ncols-a +133 print-upper-border screen, *ncols-a 134 var r/edx: int <- copy 1 135 var nrows-a/ebx: (addr int) <- get target-screen, num-rows 136 { @@ -202,7 +202,7 @@ if ('onhashchange' in window) { 143 { 144 compare c, *ncols-a 145 break-if-> -146 print-screen-cell-of-fake-screen screen, target-screen, r, c +146 print-screen-cell-of-fake-screen screen, target-screen, r, c 147 c <- increment 148 loop 149 } @@ -212,273 +212,275 @@ if ('onhashchange' in window) { 153 } 154 increment row # mutate arg 155 move-cursor screen, row, col -156 print-lower-border screen, *ncols-a +156 print-lower-border screen, *ncols-a 157 } 158 159 fn hash-color val: int -> _/eax: int { -160 var result/eax: int <- try-modulo val, 7 # assumes that 7 is always the background color -161 return result -162 } -163 -164 fn print-screen-cell-of-fake-screen screen: (addr screen), _target: (addr screen), _row: int, _col: int { -165 start-color screen, 0, 0xf6 -166 var target/esi: (addr screen) <- copy _target -167 var row/ecx: int <- copy _row -168 var col/edx: int <- copy _col -169 # if cursor is at screen-cell, add some fancy -170 { -171 var cursor-row/eax: (addr int) <- get target, cursor-row -172 compare *cursor-row, row -173 break-if-!= -174 var cursor-col/eax: (addr int) <- get target, cursor-col -175 compare *cursor-col, col -176 break-if-!= -177 start-blinking screen -178 start-color screen, 0, 1 -179 } -180 var g/eax: grapheme <- screen-grapheme-at target, row, col -181 { -182 compare g, 0 -183 break-if-!= -184 g <- copy 0x20 # space -185 } -186 print-grapheme screen, g -187 reset-formatting screen -188 } -189 -190 fn print-upper-border screen: (addr screen), width: int { -191 print-code-point screen, 0x250c # top-left corner -192 var i/eax: int <- copy 0 -193 { -194 compare i, width -195 break-if->= -196 print-code-point screen, 0x2500 # horizontal line -197 i <- increment -198 loop -199 } -200 print-code-point screen, 0x2510 # top-right corner -201 } -202 -203 fn print-lower-border screen: (addr screen), width: int { -204 print-code-point screen, 0x2514 # bottom-left corner -205 var i/eax: int <- copy 0 -206 { -207 compare i, width -208 break-if->= -209 print-code-point screen, 0x2500 # horizontal line -210 i <- increment -211 loop -212 } -213 print-code-point screen, 0x2518 # bottom-right corner -214 } -215 -216 fn value-width _v: (addr value), top-level: boolean -> _/eax: int { -217 var v/esi: (addr value) <- copy _v -218 var type/eax: (addr int) <- get v, type -219 { -220 compare *type, 0 # int -221 break-if-!= -222 var v-int/edx: (addr int) <- get v, int-data -223 var result/eax: int <- decimal-size *v-int -224 return result -225 } -226 { -227 compare *type, 1 # string -228 break-if-!= -229 var s-ah/eax: (addr handle array byte) <- get v, text-data -230 var s/eax: (addr array byte) <- lookup *s-ah -231 compare s, 0 -232 break-if-= -233 var result/eax: int <- length s -234 compare result, 0xd # max string size -235 { -236 break-if-<= -237 result <- copy 0xd -238 } -239 # if it's a nested string, include space for quotes -240 # we don't do this for the top-level, where the quotes will overflow -241 # into surrounding padding. -242 compare top-level, 0 # false -243 { -244 break-if-!= -245 result <- add 2 -246 } -247 return result -248 } -249 { -250 compare *type, 2 # array -251 break-if-!= -252 var a-ah/eax: (addr handle array value) <- get v, array-data -253 var a/eax: (addr array value) <- lookup *a-ah -254 compare a, 0 -255 break-if-= -256 var result/eax: int <- array-width a -257 return result -258 } -259 { -260 compare *type, 3 # file handle -261 break-if-!= -262 var f-ah/eax: (addr handle buffered-file) <- get v, file-data -263 var f/eax: (addr buffered-file) <- lookup *f-ah -264 compare f, 0 -265 break-if-= -266 # TODO: visualizing file handles -267 return 4 -268 } -269 { -270 compare *type, 4 # screen -271 break-if-!= -272 var screen-ah/eax: (addr handle screen) <- get v, screen-data -273 var screen/eax: (addr screen) <- lookup *screen-ah -274 compare screen, 0 -275 break-if-= -276 var ncols/ecx: (addr int) <- get screen, num-cols -277 var result/eax: int <- copy *ncols -278 result <- add 2 # left/right margins -279 return *ncols -280 } -281 return 0 -282 } -283 -284 # keep sync'd with render-array-at -285 fn array-width _a: (addr array value) -> _/eax: int { -286 var a/esi: (addr array value) <- copy _a -287 var max/ecx: int <- length a -288 var i/eax: int <- copy 0 -289 var result/edi: int <- copy 0 -290 { -291 compare i, max -292 break-if->= -293 { -294 compare i, 0 -295 break-if-= -296 result <- increment # for space -297 } -298 var off/ecx: (offset value) <- compute-offset a, i -299 var x/ecx: (addr value) <- index a, off -300 { -301 var w/eax: int <- value-width x, 0 -302 result <- add w -303 } -304 i <- increment -305 loop -306 } -307 # we won't add 2 for surrounding brackets since we don't surround arrays in -308 # spaces like other value types -309 return result -310 } -311 -312 fn value-height _v: (addr value) -> _/eax: int { -313 var v/esi: (addr value) <- copy _v -314 var type/eax: (addr int) <- get v, type -315 { -316 compare *type, 3 # file handle -317 break-if-!= -318 # TODO: visualizing file handles -319 return 1 -320 } -321 { -322 compare *type, 4 # screen -323 break-if-!= -324 var screen-ah/eax: (addr handle screen) <- get v, screen-data -325 var screen/eax: (addr screen) <- lookup *screen-ah -326 compare screen, 0 -327 break-if-= -328 var nrows/ecx: (addr int) <- get screen, num-rows -329 var result/eax: int <- copy *nrows -330 result <- add 2 # top and bottom border -331 return result -332 } -333 return 1 -334 } -335 -336 fn deep-copy-value _src: (addr value), _dest: (addr value) { -337 #? print-string 0, "deep-copy-value\n" -338 var src/esi: (addr value) <- copy _src -339 var dest/edi: (addr value) <- copy _dest -340 var type/ebx: (addr int) <- get src, type -341 var y/ecx: (addr int) <- get dest, type -342 copy-object type, y -343 compare *type, 0 # int -344 { -345 break-if-!= -346 #? print-string 0, "int value\n" -347 var x/eax: (addr int) <- get src, int-data -348 y <- get dest, int-data -349 copy-object x, y -350 return -351 } -352 compare *type, 1 # string -353 { -354 break-if-!= -355 #? print-string 0, "string value\n" -356 var src-ah/eax: (addr handle array byte) <- get src, text-data -357 var src/eax: (addr array byte) <- lookup *src-ah -358 var dest-ah/edx: (addr handle array byte) <- get dest, text-data -359 copy-array-object src, dest-ah -360 return -361 } -362 compare *type, 2 # array -363 { -364 break-if-!= -365 #? print-string 0, "array value\n" -366 var src-ah/eax: (addr handle array value) <- get src, array-data -367 var _src/eax: (addr array value) <- lookup *src-ah -368 var src/esi: (addr array value) <- copy _src -369 var n/ecx: int <- length src -370 var dest-ah/edx: (addr handle array value) <- get dest, array-data -371 populate dest-ah, n -372 var _dest/eax: (addr array value) <- lookup *dest-ah -373 var dest/edi: (addr array value) <- copy _dest -374 var i/eax: int <- copy 0 -375 { -376 compare i, n -377 break-if->= -378 { -379 var offset/edx: (offset value) <- compute-offset src, i -380 var src-element/eax: (addr value) <- index src, offset -381 var dest-element/ecx: (addr value) <- index dest, offset -382 deep-copy-value src-element, dest-element -383 } -384 i <- increment -385 loop -386 } -387 copy-array-object src, dest-ah -388 return -389 } -390 compare *type, 3 # file -391 { -392 break-if-!= -393 #? print-string 0, "file value\n" -394 var src-filename-ah/eax: (addr handle array byte) <- get src, filename -395 var _src-filename/eax: (addr array byte) <- lookup *src-filename-ah -396 var src-filename/ecx: (addr array byte) <- copy _src-filename -397 var dest-filename-ah/ebx: (addr handle array byte) <- get dest, filename -398 copy-array-object src-filename, dest-filename-ah -399 var src-file-ah/eax: (addr handle buffered-file) <- get src, file-data -400 var src-file/eax: (addr buffered-file) <- lookup *src-file-ah -401 var dest-file-ah/edx: (addr handle buffered-file) <- get dest, file-data -402 copy-file src-file, dest-file-ah, src-filename -403 return -404 } -405 compare *type, 4 # screen -406 { -407 break-if-!= -408 #? print-string 0, "screen value\n" -409 var src-screen-ah/eax: (addr handle screen) <- get src, screen-data -410 var _src-screen/eax: (addr screen) <- lookup *src-screen-ah -411 var src-screen/ecx: (addr screen) <- copy _src-screen -412 var dest-screen-ah/eax: (addr handle screen) <- get dest, screen-data -413 allocate dest-screen-ah -414 var dest-screen/eax: (addr screen) <- lookup *dest-screen-ah -415 copy-object src-screen, dest-screen -416 var dest-screen-data-ah/ebx: (addr handle array screen-cell) <- get dest-screen, data -417 var src-screen-data-ah/eax: (addr handle array screen-cell) <- get src-screen, data -418 var src-screen-data/eax: (addr array screen-cell) <- lookup *src-screen-data-ah -419 copy-array-object src-screen-data, dest-screen-data-ah -420 return -421 } -422 } +160 var quotient/eax: int <- copy 0 +161 var remainder/edx: int <- copy 0 +162 quotient, remainder <- integer-divide val, 7 # assumes that 7 is always the background color +163 return remainder +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-num/edx: (addr float) <- get v, number-data +225 var result/eax: int <- float-size *v-num, 3 +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 src-n/eax: (addr float) <- get src, number-data +350 var dest-n/ecx: (addr float) <- get dest, number-data +351 copy-object src-n, dest-n +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 35454832..4d709b75 100644 --- a/html/apps/tui.mu.html +++ b/html/apps/tui.mu.html @@ -68,10 +68,10 @@ 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 diff --git a/html/mu_instructions.html b/html/mu_instructions.html index 073ff552..0900e1e7 100644 --- a/html/mu_instructions.html +++ b/html/mu_instructions.html @@ -139,7 +139,9 @@ copy-to var, n => "c7 0/subop/ copy-to *var/reg, n => "c7 0/subop/copy *" reg " " n "/imm32" var/reg <- copy-byte var2/reg2 => "8a/byte-> %" reg2 " " reg "/r32" + "81 4/subop/and %" reg " 0xff/imm32" var/reg <- copy-byte *var2/reg2 => "8a/byte-> *" reg2 " " reg "/r32" + "81 4/subop/and %" reg " 0xff/imm32" copy-byte-to *var1/reg1, var2/reg2 => "88/byte<- *" reg1 " " reg2 "/r32" compare var1, var2/reg2 => "39/compare *(ebp+" var1.stack-offset ") " reg2 "/r32" @@ -152,6 +154,7 @@ compare var, n => "81 7/subop/ compare *var/reg, n => "81 7/subop/compare *" reg " " n "/imm32" var/reg <- multiply var2 => "0f af/multiply *(ebp+" var2.stack-offset ") " reg "/r32" +var/reg <- multiply var2/reg2 => "0f af/multiply %" reg2 " " reg "/r32" var/reg <- multiply *var2/reg2 => "0f af/multiply *" reg2 " " reg "/r32" ## Floating-point operations