From 07dba48f13be2aaa531b3d75a7d48d36e6ab4cb1 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 12 Jun 2020 00:46:06 -0700 Subject: 6512 --- html/apps/mu.subx.html | 29520 +++++++++++++++++++++++------------------------ 1 file changed, 14758 insertions(+), 14762 deletions(-) (limited to 'html/apps/*.subx.html') diff --git a/html/apps/mu.subx.html b/html/apps/mu.subx.html index 816aa562..108e8a6e 100644 --- a/html/apps/mu.subx.html +++ b/html/apps/mu.subx.html @@ -427,15166 +427,15162 @@ if ('onhashchange' in window) { 365 0xc/imm32 366 367 # Types are expressed as trees (s-expressions) of type-ids (ints). - 368 # However, there's no need for singletons, so we can assume (int) == int - 369 # - if x->right == nil, x is an atom - 370 # - x->left contains either a pointer to a pair, or an atomic type-id directly. - 371 - 372 Tree-is-atom: # boolean - 373 0/imm32 - 374 # if left-is-atom? - 375 Tree-value: # type-id + 368 + 369 Tree-is-atom: # boolean + 370 0/imm32 + 371 # if left-is-atom? + 372 Tree-value: # type-id + 373 4/imm32 + 374 # unless left-is-atom? + 375 Tree-left: # (addr tree type-id) 376 4/imm32 - 377 # unless left-is-atom? - 378 Tree-left: # (addr tree type-id) - 379 4/imm32 - 380 Tree-right: # (addr tree type-id) - 381 0xc/imm32 - 382 # - 383 Tree-size: # (addr int) - 384 0x14/imm32 - 385 - 386 # Types - 387 - 388 # TODO: heap allocations here can't be reclaimed - 389 Type-id: # (stream (addr array byte)) - 390 0x1c/imm32/write - 391 0/imm32/read - 392 0x100/imm32/size - 393 # data - 394 "literal"/imm32 # 0: value is just the name - 395 "int"/imm32 # 1 - 396 "addr"/imm32 # 2 - 397 "array"/imm32 # 3 - 398 "handle"/imm32 # 4 - 399 "boolean"/imm32 # 5 - 400 "constant"/imm32 # 6: like a literal, but value is an int in Var-offset - 401 "offset"/imm32 # 7: (offset T) is guaranteed to be a 32-bit multiple of size-of(T) - 402 0/imm32 - 403 # 0x20 + 377 Tree-right: # (addr tree type-id) + 378 0xc/imm32 + 379 # + 380 Tree-size: # (addr int) + 381 0x14/imm32 + 382 + 383 # Types + 384 + 385 # TODO: heap allocations here can't be reclaimed + 386 Type-id: # (stream (addr array byte)) + 387 0x1c/imm32/write + 388 0/imm32/read + 389 0x100/imm32/size + 390 # data + 391 "literal"/imm32 # 0: value is just the name + 392 "int"/imm32 # 1 + 393 "addr"/imm32 # 2 + 394 "array"/imm32 # 3 + 395 "handle"/imm32 # 4 + 396 "boolean"/imm32 # 5 + 397 "constant"/imm32 # 6: like a literal, but value is an int in Var-offset + 398 "offset"/imm32 # 7: (offset T) is guaranteed to be a 32-bit multiple of size-of(T) + 399 0/imm32 + 400 # 0x20 + 401 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 + 402 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 + 403 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 404 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 405 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 406 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 407 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 - 408 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 - 409 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 - 410 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 - 411 - 412 # == Type definitions - 413 # Program->types contains some typeinfo for each type definition. - 414 # Types contain vars with types, but can't specify registers. - 415 Typeinfo-id: # type-id - 416 0/imm32 - 417 Typeinfo-fields: # (handle table (handle array byte) (handle typeinfo-entry)) - 418 4/imm32 - 419 # Total size must be >= 0 - 420 # During parsing it may take on two additional values: - 421 # -2: not yet initialized - 422 # -1: in process of being computed - 423 # See populate-mu-type-sizes for details. - 424 Typeinfo-total-size-in-bytes: # int - 425 0xc/imm32 - 426 Typeinfo-next: # (handle typeinfo) - 427 0x10/imm32 - 428 Typeinfo-size: # (addr int) - 429 0x18/imm32 - 430 - 431 # Each entry in the typeinfo->fields table has a pointer to a string and a - 432 # pointer to a typeinfo-entry. - 433 Typeinfo-fields-row-size: # (addr int) - 434 0x10/imm32 - 435 - 436 # typeinfo-entry objects have information about a field in a single record type - 437 # - 438 # each field of a type is represented using two var's: - 439 # 1. the input var: expected type of the field; convenient for creating using parse-var-with-type - 440 # 2. the output var: a constant containing the byte offset; convenient for code-generation - 441 # computing the output happens after parsing; in the meantime we preserve the - 442 # order of fields in the 'index' field. - 443 Typeinfo-entry-input-var: # (handle var) - 444 0/imm32 - 445 Typeinfo-entry-index: # int - 446 8/imm32 - 447 Typeinfo-entry-output-var: # (handle var) - 448 0xc/imm32 - 449 Typeinfo-entry-size: # (addr int) - 450 0x14/imm32 - 451 - 452 == code - 453 - 454 Entry: - 455 # . prologue - 456 89/<- %ebp 4/r32/esp - 457 (new-segment *Heap-size Heap) - 458 # if (argv[1] == "test') run-tests() - 459 { - 460 # if (argc <= 1) break - 461 81 7/subop/compare *ebp 1/imm32 - 462 7e/jump-if-<= break/disp8 - 463 # if (argv[1] != "test") break - 464 (kernel-string-equal? *(ebp+8) "test") # => eax - 465 3d/compare-eax-and 0/imm32/false - 466 74/jump-if-= break/disp8 - 467 # - 468 (run-tests) - 469 # syscall(exit, *Num-test-failures) - 470 8b/-> *Num-test-failures 3/r32/ebx - 471 eb/jump $mu-main:end/disp8 - 472 } - 473 # otherwise convert Stdin - 474 (convert-mu Stdin Stdout) - 475 (flush Stdout) - 476 # syscall(exit, 0) - 477 bb/copy-to-ebx 0/imm32 - 478 $mu-main:end: - 479 b8/copy-to-eax 1/imm32/exit - 480 cd/syscall 0x80/imm8 - 481 - 482 convert-mu: # in: (addr buffered-file), out: (addr buffered-file) - 483 # . prologue - 484 55/push-ebp - 485 89/<- %ebp 4/r32/esp - 486 # initialize global data structures - 487 c7 0/subop/copy *Next-block-index 1/imm32 - 488 c7 0/subop/copy *Type-id 0x1c/imm32 # stream-write - 489 c7 0/subop/copy *_Program-functions 0/imm32 - 490 c7 0/subop/copy *_Program-functions->payload 0/imm32 - 491 c7 0/subop/copy *_Program-types 0/imm32 - 492 c7 0/subop/copy *_Program-types->payload 0/imm32 - 493 # - 494 (parse-mu *(ebp+8)) - 495 (populate-mu-type-sizes) - 496 #? (dump-typeinfos "=== typeinfos\n") - 497 (check-mu-types) - 498 (emit-subx *(ebp+0xc)) - 499 $convert-mu:end: - 500 # . epilogue - 501 89/<- %esp 5/r32/ebp - 502 5d/pop-to-ebp - 503 c3/return - 504 - 505 test-convert-empty-input: - 506 # empty input => empty output - 507 # . prologue - 508 55/push-ebp - 509 89/<- %ebp 4/r32/esp - 510 # setup - 511 (clear-stream _test-input-stream) - 512 (clear-stream $_test-input-buffered-file->buffer) - 513 (clear-stream _test-output-stream) - 514 (clear-stream $_test-output-buffered-file->buffer) - 515 # - 516 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 517 (flush _test-output-buffered-file) - 518 (check-stream-equal _test-output-stream "" "F - test-convert-empty-input") - 519 # . epilogue - 520 89/<- %esp 5/r32/ebp - 521 5d/pop-to-ebp - 522 c3/return - 523 - 524 test-convert-function-skeleton: - 525 # . prologue - 526 55/push-ebp - 527 89/<- %ebp 4/r32/esp - 528 # setup - 529 (clear-stream _test-input-stream) - 530 (clear-stream $_test-input-buffered-file->buffer) - 531 (clear-stream _test-output-stream) - 532 (clear-stream $_test-output-buffered-file->buffer) - 533 # - 534 (write _test-input-stream "fn foo {\n") - 535 (write _test-input-stream "}\n") - 536 # convert - 537 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 538 (flush _test-output-buffered-file) - 539 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 545 # check output - 546 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0") - 547 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-skeleton/1") - 548 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-skeleton/2") - 549 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3") - 550 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-skeleton/4") - 551 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5") - 552 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-skeleton/6") - 553 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-skeleton/7") - 554 # . epilogue - 555 89/<- %esp 5/r32/ebp - 556 5d/pop-to-ebp - 557 c3/return - 558 - 559 test-convert-multiple-function-skeletons: - 560 # . prologue - 561 55/push-ebp - 562 89/<- %ebp 4/r32/esp - 563 # setup - 564 (clear-stream _test-input-stream) - 565 (clear-stream $_test-input-buffered-file->buffer) - 566 (clear-stream _test-output-stream) - 567 (clear-stream $_test-output-buffered-file->buffer) - 568 # - 569 (write _test-input-stream "fn foo {\n") - 570 (write _test-input-stream "}\n") - 571 (write _test-input-stream "fn bar {\n") - 572 (write _test-input-stream "}\n") - 573 # convert - 574 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 575 (flush _test-output-buffered-file) - 576 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 582 # check first function - 583 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0") - 584 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/1") - 585 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/2") - 586 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3") - 587 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/4") - 588 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5") - 589 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6") - 590 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/7") - 591 # check second function - 592 (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10") - 593 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/11") - 594 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/12") - 595 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13") - 596 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/14") - 597 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15") - 598 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16") - 599 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/17") - 600 # . epilogue - 601 89/<- %esp 5/r32/ebp - 602 5d/pop-to-ebp - 603 c3/return - 604 - 605 test-convert-function-with-arg: - 606 # . prologue - 607 55/push-ebp - 608 89/<- %ebp 4/r32/esp - 609 # setup - 610 (clear-stream _test-input-stream) - 611 (clear-stream $_test-input-buffered-file->buffer) - 612 (clear-stream _test-output-stream) - 613 (clear-stream $_test-output-buffered-file->buffer) - 614 # - 615 (write _test-input-stream "fn foo n: int {\n") - 616 (write _test-input-stream "}\n") - 617 # convert - 618 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 619 (flush _test-output-buffered-file) - 620 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 626 # check output - 627 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0") - 628 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg/1") - 629 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg/2") - 630 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3") - 631 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg/4") - 632 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5") - 633 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg/6") - 634 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg/7") - 635 # . epilogue - 636 89/<- %esp 5/r32/ebp - 637 5d/pop-to-ebp - 638 c3/return - 639 - 640 test-convert-function-with-arg-and-body: - 641 # . prologue - 642 55/push-ebp - 643 89/<- %ebp 4/r32/esp - 644 # setup - 645 (clear-stream _test-input-stream) - 646 (clear-stream $_test-input-buffered-file->buffer) - 647 (clear-stream _test-output-stream) - 648 (clear-stream $_test-output-buffered-file->buffer) - 649 # - 650 (write _test-input-stream "fn foo n: int {\n") - 651 (write _test-input-stream " increment n\n") - 652 (write _test-input-stream "}\n") - 653 # convert - 654 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 655 (flush _test-output-buffered-file) - 656 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 662 # check output - 663 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0") - 664 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1") - 665 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg-and-body/2") - 666 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3") - 667 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-arg-and-body/4") - 668 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-arg-and-body/5") - 669 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/6") - 670 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-arg-and-body/7") - 671 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-arg-and-body/8") - 672 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg-and-body/9") - 673 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/10") - 674 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/11") - 675 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg-and-body/12") - 676 # . epilogue - 677 89/<- %esp 5/r32/ebp - 678 5d/pop-to-ebp - 679 c3/return - 680 - 681 test-convert-function-distinguishes-args: - 682 # . prologue - 683 55/push-ebp - 684 89/<- %ebp 4/r32/esp - 685 # setup - 686 (clear-stream _test-input-stream) - 687 (clear-stream $_test-input-buffered-file->buffer) - 688 (clear-stream _test-output-stream) - 689 (clear-stream $_test-output-buffered-file->buffer) - 690 # - 691 (write _test-input-stream "fn foo a: int, b: int {\n") - 692 (write _test-input-stream " increment b\n") - 693 (write _test-input-stream "}\n") - 694 # convert - 695 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 696 (flush _test-output-buffered-file) - 697 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 703 # check output - 704 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0") - 705 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-distinguishes-args/1") - 706 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-distinguishes-args/2") - 707 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3") - 708 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-distinguishes-args/4") - 709 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-distinguishes-args/5") - 710 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/6") - 711 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-distinguishes-args/7") - 712 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-distinguishes-args/8") - 713 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-distinguishes-args/9") - 714 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/10") - 715 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/11") - 716 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-distinguishes-args/12") - 717 # . epilogue - 718 89/<- %esp 5/r32/ebp - 719 5d/pop-to-ebp - 720 c3/return - 721 - 722 test-convert-function-returns-result: - 723 # . prologue - 724 55/push-ebp - 725 89/<- %ebp 4/r32/esp - 726 # setup - 727 (clear-stream _test-input-stream) - 728 (clear-stream $_test-input-buffered-file->buffer) - 729 (clear-stream _test-output-stream) - 730 (clear-stream $_test-output-buffered-file->buffer) - 731 # - 732 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n") - 733 (write _test-input-stream " result <- copy a\n") - 734 (write _test-input-stream " result <- increment\n") - 735 (write _test-input-stream "}\n") - 736 # convert - 737 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 738 (flush _test-output-buffered-file) - 739 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 745 # check output - 746 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-returns-result/0") - 747 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-returns-result/1") - 748 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-returns-result/2") - 749 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-returns-result/3") - 750 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-returns-result/4") - 751 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-returns-result/5") - 752 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-returns-result/6") - 753 (check-next-stream-line-equal _test-output-stream " 40/increment-eax" "F - test-convert-function-returns-result/7") - 754 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-returns-result/8") - 755 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-returns-result/9") - 756 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-returns-result/10") - 757 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-returns-result/11") - 758 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-returns-result/12") - 759 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-returns-result/13") - 760 # . epilogue - 761 89/<- %esp 5/r32/ebp - 762 5d/pop-to-ebp - 763 c3/return - 764 - 765 test-convert-function-with-literal-arg: - 766 # . prologue - 767 55/push-ebp - 768 89/<- %ebp 4/r32/esp - 769 # setup - 770 (clear-stream _test-input-stream) - 771 (clear-stream $_test-input-buffered-file->buffer) - 772 (clear-stream _test-output-stream) - 773 (clear-stream $_test-output-buffered-file->buffer) - 774 # - 775 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n") - 776 (write _test-input-stream " result <- copy a\n") - 777 (write _test-input-stream " result <- add 1\n") - 778 (write _test-input-stream "}\n") - 779 # convert - 780 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 781 (flush _test-output-buffered-file) - 782 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 788 # check output - 789 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg/0") - 790 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg/1") - 791 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg/2") - 792 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg/3") - 793 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg/4") - 794 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg/5") - 795 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-with-literal-arg/6") - 796 (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-with-literal-arg/7") - 797 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg/8") - 798 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg/9") - 799 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg/10") - 800 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg/11") - 801 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg/12") - 802 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg/13") - 803 # . epilogue - 804 89/<- %esp 5/r32/ebp - 805 5d/pop-to-ebp - 806 c3/return - 807 - 808 test-convert-function-with-literal-arg-2: - 809 # . prologue - 810 55/push-ebp - 811 89/<- %ebp 4/r32/esp - 812 # setup - 813 (clear-stream _test-input-stream) - 814 (clear-stream $_test-input-buffered-file->buffer) - 815 (clear-stream _test-output-stream) - 816 (clear-stream $_test-output-buffered-file->buffer) - 817 # - 818 (write _test-input-stream "fn foo a: int, b: int -> result/ebx: int {\n") - 819 (write _test-input-stream " result <- copy a\n") - 820 (write _test-input-stream " result <- add 1\n") - 821 (write _test-input-stream "}\n") - 822 # convert - 823 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 824 (flush _test-output-buffered-file) - 825 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 831 # check output - 832 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg-2/0") - 833 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg-2/1") - 834 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg-2/2") - 835 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg-2/3") - 836 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg-2/4") - 837 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg-2/5") - 838 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/6") - 839 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-with-literal-arg-2/7") - 840 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg-2/8") - 841 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg-2/9") - 842 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg-2/10") - 843 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg-2/11") - 844 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg-2/12") - 845 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg-2/13") - 846 # . epilogue - 847 89/<- %esp 5/r32/ebp - 848 5d/pop-to-ebp - 849 c3/return - 850 - 851 test-convert-function-call-with-literal-arg: - 852 # . prologue - 853 55/push-ebp - 854 89/<- %ebp 4/r32/esp - 855 # setup - 856 (clear-stream _test-input-stream) - 857 (clear-stream $_test-input-buffered-file->buffer) - 858 (clear-stream _test-output-stream) - 859 (clear-stream $_test-output-buffered-file->buffer) - 860 # - 861 (write _test-input-stream "fn main -> result/ebx: int {\n") - 862 (write _test-input-stream " result <- do-add 3 4\n") + 408 + 409 # == Type definitions + 410 # Program->types contains some typeinfo for each type definition. + 411 # Types contain vars with types, but can't specify registers. + 412 Typeinfo-id: # type-id + 413 0/imm32 + 414 Typeinfo-fields: # (handle table (handle array byte) (handle typeinfo-entry)) + 415 4/imm32 + 416 # Total size must be >= 0 + 417 # During parsing it may take on two additional values: + 418 # -2: not yet initialized + 419 # -1: in process of being computed + 420 # See populate-mu-type-sizes for details. + 421 Typeinfo-total-size-in-bytes: # int + 422 0xc/imm32 + 423 Typeinfo-next: # (handle typeinfo) + 424 0x10/imm32 + 425 Typeinfo-size: # (addr int) + 426 0x18/imm32 + 427 + 428 # Each entry in the typeinfo->fields table has a pointer to a string and a + 429 # pointer to a typeinfo-entry. + 430 Typeinfo-fields-row-size: # (addr int) + 431 0x10/imm32 + 432 + 433 # typeinfo-entry objects have information about a field in a single record type + 434 # + 435 # each field of a type is represented using two var's: + 436 # 1. the input var: expected type of the field; convenient for creating using parse-var-with-type + 437 # 2. the output var: a constant containing the byte offset; convenient for code-generation + 438 # computing the output happens after parsing; in the meantime we preserve the + 439 # order of fields in the 'index' field. + 440 Typeinfo-entry-input-var: # (handle var) + 441 0/imm32 + 442 Typeinfo-entry-index: # int + 443 8/imm32 + 444 Typeinfo-entry-output-var: # (handle var) + 445 0xc/imm32 + 446 Typeinfo-entry-size: # (addr int) + 447 0x14/imm32 + 448 + 449 == code + 450 + 451 Entry: + 452 # . prologue + 453 89/<- %ebp 4/r32/esp + 454 (new-segment *Heap-size Heap) + 455 # if (argv[1] == "test') run-tests() + 456 { + 457 # if (argc <= 1) break + 458 81 7/subop/compare *ebp 1/imm32 + 459 7e/jump-if-<= break/disp8 + 460 # if (argv[1] != "test") break + 461 (kernel-string-equal? *(ebp+8) "test") # => eax + 462 3d/compare-eax-and 0/imm32/false + 463 74/jump-if-= break/disp8 + 464 # + 465 (run-tests) + 466 # syscall(exit, *Num-test-failures) + 467 8b/-> *Num-test-failures 3/r32/ebx + 468 eb/jump $mu-main:end/disp8 + 469 } + 470 # otherwise convert Stdin + 471 (convert-mu Stdin Stdout Stderr 0) + 472 (flush Stdout) + 473 # syscall(exit, 0) + 474 bb/copy-to-ebx 0/imm32 + 475 $mu-main:end: + 476 e8/call syscall_exit/disp32 + 477 + 478 convert-mu: # in: (addr buffered-file), out: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) + 479 # . prologue + 480 55/push-ebp + 481 89/<- %ebp 4/r32/esp + 482 # initialize global data structures + 483 c7 0/subop/copy *Next-block-index 1/imm32 + 484 c7 0/subop/copy *Type-id 0x1c/imm32 # stream-write + 485 c7 0/subop/copy *_Program-functions 0/imm32 + 486 c7 0/subop/copy *_Program-functions->payload 0/imm32 + 487 c7 0/subop/copy *_Program-types 0/imm32 + 488 c7 0/subop/copy *_Program-types->payload 0/imm32 + 489 # + 490 (parse-mu *(ebp+8) *(ebp+0x10) *(ebp+0x14)) + 491 (populate-mu-type-sizes *(ebp+0x10) *(ebp+0x14)) + 492 #? (dump-typeinfos "=== typeinfos\n") + 493 (check-mu-types) + 494 (emit-subx *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) + 495 $convert-mu:end: + 496 # . epilogue + 497 89/<- %esp 5/r32/ebp + 498 5d/pop-to-ebp + 499 c3/return + 500 + 501 test-convert-empty-input: + 502 # empty input => empty output + 503 # . prologue + 504 55/push-ebp + 505 89/<- %ebp 4/r32/esp + 506 # setup + 507 (clear-stream _test-input-stream) + 508 (clear-stream $_test-input-buffered-file->buffer) + 509 (clear-stream _test-output-stream) + 510 (clear-stream $_test-output-buffered-file->buffer) + 511 # + 512 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 513 (flush _test-output-buffered-file) + 514 (check-stream-equal _test-output-stream "" "F - test-convert-empty-input") + 515 # . epilogue + 516 89/<- %esp 5/r32/ebp + 517 5d/pop-to-ebp + 518 c3/return + 519 + 520 test-convert-function-skeleton: + 521 # . prologue + 522 55/push-ebp + 523 89/<- %ebp 4/r32/esp + 524 # setup + 525 (clear-stream _test-input-stream) + 526 (clear-stream $_test-input-buffered-file->buffer) + 527 (clear-stream _test-output-stream) + 528 (clear-stream $_test-output-buffered-file->buffer) + 529 # + 530 (write _test-input-stream "fn foo {\n") + 531 (write _test-input-stream "}\n") + 532 # convert + 533 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 534 (flush _test-output-buffered-file) + 535 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 541 # check output + 542 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0") + 543 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-skeleton/1") + 544 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-skeleton/2") + 545 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3") + 546 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-skeleton/4") + 547 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5") + 548 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-skeleton/6") + 549 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-skeleton/7") + 550 # . epilogue + 551 89/<- %esp 5/r32/ebp + 552 5d/pop-to-ebp + 553 c3/return + 554 + 555 test-convert-multiple-function-skeletons: + 556 # . prologue + 557 55/push-ebp + 558 89/<- %ebp 4/r32/esp + 559 # setup + 560 (clear-stream _test-input-stream) + 561 (clear-stream $_test-input-buffered-file->buffer) + 562 (clear-stream _test-output-stream) + 563 (clear-stream $_test-output-buffered-file->buffer) + 564 # + 565 (write _test-input-stream "fn foo {\n") + 566 (write _test-input-stream "}\n") + 567 (write _test-input-stream "fn bar {\n") + 568 (write _test-input-stream "}\n") + 569 # convert + 570 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 571 (flush _test-output-buffered-file) + 572 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 578 # check first function + 579 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0") + 580 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/1") + 581 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/2") + 582 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3") + 583 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/4") + 584 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5") + 585 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6") + 586 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/7") + 587 # check second function + 588 (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10") + 589 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/11") + 590 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/12") + 591 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13") + 592 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/14") + 593 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15") + 594 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16") + 595 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/17") + 596 # . epilogue + 597 89/<- %esp 5/r32/ebp + 598 5d/pop-to-ebp + 599 c3/return + 600 + 601 test-convert-function-with-arg: + 602 # . prologue + 603 55/push-ebp + 604 89/<- %ebp 4/r32/esp + 605 # setup + 606 (clear-stream _test-input-stream) + 607 (clear-stream $_test-input-buffered-file->buffer) + 608 (clear-stream _test-output-stream) + 609 (clear-stream $_test-output-buffered-file->buffer) + 610 # + 611 (write _test-input-stream "fn foo n: int {\n") + 612 (write _test-input-stream "}\n") + 613 # convert + 614 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 615 (flush _test-output-buffered-file) + 616 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 622 # check output + 623 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0") + 624 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg/1") + 625 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg/2") + 626 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3") + 627 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg/4") + 628 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5") + 629 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg/6") + 630 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg/7") + 631 # . epilogue + 632 89/<- %esp 5/r32/ebp + 633 5d/pop-to-ebp + 634 c3/return + 635 + 636 test-convert-function-with-arg-and-body: + 637 # . prologue + 638 55/push-ebp + 639 89/<- %ebp 4/r32/esp + 640 # setup + 641 (clear-stream _test-input-stream) + 642 (clear-stream $_test-input-buffered-file->buffer) + 643 (clear-stream _test-output-stream) + 644 (clear-stream $_test-output-buffered-file->buffer) + 645 # + 646 (write _test-input-stream "fn foo n: int {\n") + 647 (write _test-input-stream " increment n\n") + 648 (write _test-input-stream "}\n") + 649 # convert + 650 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 651 (flush _test-output-buffered-file) + 652 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 658 # check output + 659 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0") + 660 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1") + 661 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg-and-body/2") + 662 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3") + 663 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-arg-and-body/4") + 664 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-arg-and-body/5") + 665 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/6") + 666 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-arg-and-body/7") + 667 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-arg-and-body/8") + 668 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg-and-body/9") + 669 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/10") + 670 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/11") + 671 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg-and-body/12") + 672 # . epilogue + 673 89/<- %esp 5/r32/ebp + 674 5d/pop-to-ebp + 675 c3/return + 676 + 677 test-convert-function-distinguishes-args: + 678 # . prologue + 679 55/push-ebp + 680 89/<- %ebp 4/r32/esp + 681 # setup + 682 (clear-stream _test-input-stream) + 683 (clear-stream $_test-input-buffered-file->buffer) + 684 (clear-stream _test-output-stream) + 685 (clear-stream $_test-output-buffered-file->buffer) + 686 # + 687 (write _test-input-stream "fn foo a: int, b: int {\n") + 688 (write _test-input-stream " increment b\n") + 689 (write _test-input-stream "}\n") + 690 # convert + 691 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 692 (flush _test-output-buffered-file) + 693 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 699 # check output + 700 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0") + 701 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-distinguishes-args/1") + 702 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-distinguishes-args/2") + 703 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3") + 704 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-distinguishes-args/4") + 705 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-distinguishes-args/5") + 706 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/6") + 707 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-distinguishes-args/7") + 708 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-distinguishes-args/8") + 709 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-distinguishes-args/9") + 710 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/10") + 711 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/11") + 712 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-distinguishes-args/12") + 713 # . epilogue + 714 89/<- %esp 5/r32/ebp + 715 5d/pop-to-ebp + 716 c3/return + 717 + 718 test-convert-function-returns-result: + 719 # . prologue + 720 55/push-ebp + 721 89/<- %ebp 4/r32/esp + 722 # setup + 723 (clear-stream _test-input-stream) + 724 (clear-stream $_test-input-buffered-file->buffer) + 725 (clear-stream _test-output-stream) + 726 (clear-stream $_test-output-buffered-file->buffer) + 727 # + 728 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n") + 729 (write _test-input-stream " result <- copy a\n") + 730 (write _test-input-stream " result <- increment\n") + 731 (write _test-input-stream "}\n") + 732 # convert + 733 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 734 (flush _test-output-buffered-file) + 735 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 741 # check output + 742 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-returns-result/0") + 743 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-returns-result/1") + 744 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-returns-result/2") + 745 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-returns-result/3") + 746 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-returns-result/4") + 747 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-returns-result/5") + 748 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-returns-result/6") + 749 (check-next-stream-line-equal _test-output-stream " 40/increment-eax" "F - test-convert-function-returns-result/7") + 750 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-returns-result/8") + 751 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-returns-result/9") + 752 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-returns-result/10") + 753 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-returns-result/11") + 754 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-returns-result/12") + 755 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-returns-result/13") + 756 # . epilogue + 757 89/<- %esp 5/r32/ebp + 758 5d/pop-to-ebp + 759 c3/return + 760 + 761 test-convert-function-with-literal-arg: + 762 # . prologue + 763 55/push-ebp + 764 89/<- %ebp 4/r32/esp + 765 # setup + 766 (clear-stream _test-input-stream) + 767 (clear-stream $_test-input-buffered-file->buffer) + 768 (clear-stream _test-output-stream) + 769 (clear-stream $_test-output-buffered-file->buffer) + 770 # + 771 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n") + 772 (write _test-input-stream " result <- copy a\n") + 773 (write _test-input-stream " result <- add 1\n") + 774 (write _test-input-stream "}\n") + 775 # convert + 776 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 777 (flush _test-output-buffered-file) + 778 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 784 # check output + 785 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg/0") + 786 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg/1") + 787 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg/2") + 788 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg/3") + 789 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg/4") + 790 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg/5") + 791 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-with-literal-arg/6") + 792 (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-with-literal-arg/7") + 793 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg/8") + 794 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg/9") + 795 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg/10") + 796 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg/11") + 797 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg/12") + 798 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg/13") + 799 # . epilogue + 800 89/<- %esp 5/r32/ebp + 801 5d/pop-to-ebp + 802 c3/return + 803 + 804 test-convert-function-with-literal-arg-2: + 805 # . prologue + 806 55/push-ebp + 807 89/<- %ebp 4/r32/esp + 808 # setup + 809 (clear-stream _test-input-stream) + 810 (clear-stream $_test-input-buffered-file->buffer) + 811 (clear-stream _test-output-stream) + 812 (clear-stream $_test-output-buffered-file->buffer) + 813 # + 814 (write _test-input-stream "fn foo a: int, b: int -> result/ebx: int {\n") + 815 (write _test-input-stream " result <- copy a\n") + 816 (write _test-input-stream " result <- add 1\n") + 817 (write _test-input-stream "}\n") + 818 # convert + 819 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 820 (flush _test-output-buffered-file) + 821 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 827 # check output + 828 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg-2/0") + 829 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg-2/1") + 830 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg-2/2") + 831 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg-2/3") + 832 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg-2/4") + 833 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg-2/5") + 834 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/6") + 835 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-with-literal-arg-2/7") + 836 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg-2/8") + 837 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg-2/9") + 838 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg-2/10") + 839 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg-2/11") + 840 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg-2/12") + 841 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg-2/13") + 842 # . epilogue + 843 89/<- %esp 5/r32/ebp + 844 5d/pop-to-ebp + 845 c3/return + 846 + 847 test-convert-function-call-with-literal-arg: + 848 # . prologue + 849 55/push-ebp + 850 89/<- %ebp 4/r32/esp + 851 # setup + 852 (clear-stream _test-input-stream) + 853 (clear-stream $_test-input-buffered-file->buffer) + 854 (clear-stream _test-output-stream) + 855 (clear-stream $_test-output-buffered-file->buffer) + 856 # + 857 (write _test-input-stream "fn main -> result/ebx: int {\n") + 858 (write _test-input-stream " result <- do-add 3 4\n") + 859 (write _test-input-stream "}\n") + 860 (write _test-input-stream "fn do-add a: int, b: int -> result/ebx: int {\n") + 861 (write _test-input-stream " result <- copy a\n") + 862 (write _test-input-stream " result <- add b\n") 863 (write _test-input-stream "}\n") - 864 (write _test-input-stream "fn do-add a: int, b: int -> result/ebx: int {\n") - 865 (write _test-input-stream " result <- copy a\n") - 866 (write _test-input-stream " result <- add b\n") - 867 (write _test-input-stream "}\n") - 868 # convert - 869 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 870 (flush _test-output-buffered-file) - 871 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 877 # check output - 878 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0") - 879 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1") - 880 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2") - 881 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3") - 882 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4") - 883 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-literal-arg/5") - 884 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/6") - 885 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/7") - 886 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-literal-arg/8") - 887 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/9") - 888 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/10") - 889 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/11") - 890 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/12") - 891 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/13") - 892 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/14") - 893 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/15") - 894 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/16") - 895 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/17") - 896 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:loop:" "F - test-convert-function-call-with-literal-arg/18") - 897 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/19") - 898 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/20") - 899 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/21") - 900 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:break:" "F - test-convert-function-call-with-literal-arg/22") - 901 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/23") - 902 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/24") - 903 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/25") - 904 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/26") - 905 # . epilogue - 906 89/<- %esp 5/r32/ebp - 907 5d/pop-to-ebp - 908 c3/return - 909 - 910 test-convert-function-with-local-var-in-mem: - 911 # . prologue - 912 55/push-ebp - 913 89/<- %ebp 4/r32/esp - 914 # setup - 915 (clear-stream _test-input-stream) - 916 (clear-stream $_test-input-buffered-file->buffer) - 917 (clear-stream _test-output-stream) - 918 (clear-stream $_test-output-buffered-file->buffer) - 919 # - 920 (write _test-input-stream "fn foo {\n") - 921 (write _test-input-stream " var x: int\n") - 922 (write _test-input-stream " increment x\n") - 923 (write _test-input-stream "}\n") - 924 # convert - 925 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 926 (flush _test-output-buffered-file) - 927 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 933 # check output - 934 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0") - 935 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1") - 936 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2") - 937 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3") - 938 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4") - 939 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem/5") - 940 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/6") - 941 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/7") - 942 (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") - 943 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/9") - 944 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem/10") - 945 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/11") - 946 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/12") - 947 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/13") - 948 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/14") - 949 # . epilogue - 950 89/<- %esp 5/r32/ebp - 951 5d/pop-to-ebp - 952 c3/return - 953 - 954 test-convert-function-with-local-var-with-compound-type-in-mem: - 955 # . prologue - 956 55/push-ebp - 957 89/<- %ebp 4/r32/esp - 958 # setup - 959 (clear-stream _test-input-stream) - 960 (clear-stream $_test-input-buffered-file->buffer) - 961 (clear-stream _test-output-stream) - 962 (clear-stream $_test-output-buffered-file->buffer) - 963 # - 964 (write _test-input-stream "fn foo {\n") - 965 (write _test-input-stream " var x: (addr int)\n") - 966 (write _test-input-stream " copy-to x, 0\n") - 967 (write _test-input-stream "}\n") - 968 # convert - 969 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 970 (flush _test-output-buffered-file) - 971 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 977 # check output - 978 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/0") - 979 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/1") - 980 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/2") - 981 (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") - 982 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-compound-type-in-mem/4") - 983 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/5") - 984 (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") - 985 (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") - 986 (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") - 987 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-compound-type-in-mem/9") - 988 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/10") - 989 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/11") - 990 (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") - 991 (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") - 992 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-compound-type-in-mem/14") - 993 # . epilogue - 994 89/<- %esp 5/r32/ebp - 995 5d/pop-to-ebp - 996 c3/return - 997 - 998 test-convert-function-with-local-var-in-reg: - 999 # . prologue - 1000 55/push-ebp - 1001 89/<- %ebp 4/r32/esp - 1002 # setup - 1003 (clear-stream _test-input-stream) - 1004 (clear-stream $_test-input-buffered-file->buffer) - 1005 (clear-stream _test-output-stream) - 1006 (clear-stream $_test-output-buffered-file->buffer) - 1007 # - 1008 (write _test-input-stream "fn foo {\n") - 1009 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1010 (write _test-input-stream " x <- increment\n") - 1011 (write _test-input-stream "}\n") - 1012 # convert - 1013 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1014 (flush _test-output-buffered-file) - 1015 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1021 # check output - 1022 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0") - 1023 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1") - 1024 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2") - 1025 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3") - 1026 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4") - 1027 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-reg/5") - 1028 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/6") - 1029 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/7") - 1030 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/8") - 1031 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/9") - 1032 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/10") - 1033 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-reg/11") - 1034 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/12") - 1035 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/13") - 1036 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/14") - 1037 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/15") - 1038 # . epilogue - 1039 89/<- %esp 5/r32/ebp - 1040 5d/pop-to-ebp - 1041 c3/return - 1042 - 1043 test-convert-function-with-second-local-var-in-same-reg: - 1044 # . prologue - 1045 55/push-ebp - 1046 89/<- %ebp 4/r32/esp - 1047 # setup - 1048 (clear-stream _test-input-stream) - 1049 (clear-stream $_test-input-buffered-file->buffer) - 1050 (clear-stream _test-output-stream) - 1051 (clear-stream $_test-output-buffered-file->buffer) - 1052 # - 1053 (write _test-input-stream "fn foo {\n") - 1054 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1055 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1056 (write _test-input-stream " y <- increment\n") - 1057 (write _test-input-stream "}\n") - 1058 # convert - 1059 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1060 (flush _test-output-buffered-file) - 1061 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1067 # check output - 1068 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-second-local-var-in-same-reg/0") - 1069 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-second-local-var-in-same-reg/1") - 1070 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/2") - 1071 (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") - 1072 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-second-local-var-in-same-reg/4") - 1073 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-second-local-var-in-same-reg/5") - 1074 (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") - 1075 (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") - 1076 (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") - 1077 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-second-local-var-in-same-reg/9") - 1078 (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") - 1079 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-second-local-var-in-same-reg/11") - 1080 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-second-local-var-in-same-reg/12") - 1081 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-second-local-var-in-same-reg/13") - 1082 (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") - 1083 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/15") - 1084 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-second-local-var-in-same-reg/16") - 1085 # . epilogue - 1086 89/<- %esp 5/r32/ebp - 1087 5d/pop-to-ebp - 1088 c3/return - 1089 - 1090 test-convert-function-with-local-var-dereferenced: - 1091 # . prologue - 1092 55/push-ebp - 1093 89/<- %ebp 4/r32/esp - 1094 # setup - 1095 (clear-stream _test-input-stream) - 1096 (clear-stream $_test-input-buffered-file->buffer) - 1097 (clear-stream _test-output-stream) - 1098 (clear-stream $_test-output-buffered-file->buffer) - 1099 # - 1100 (write _test-input-stream "fn foo {\n") - 1101 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n") - 1102 (write _test-input-stream " increment *x\n") - 1103 (write _test-input-stream "}\n") - 1104 # convert - 1105 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1106 (flush _test-output-buffered-file) - 1107 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1113 # check output - 1114 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0") - 1115 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1") - 1116 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2") - 1117 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3") - 1118 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4") - 1119 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5") - 1120 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6") - 1121 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7") - 1122 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8") - 1123 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9") - 1124 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10") - 1125 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11") - 1126 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12") - 1127 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13") - 1128 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14") - 1129 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15") - 1130 # . epilogue - 1131 89/<- %esp 5/r32/ebp - 1132 5d/pop-to-ebp - 1133 c3/return - 1134 - 1135 test-convert-compare-register-with-literal: - 1136 # . prologue - 1137 55/push-ebp - 1138 89/<- %ebp 4/r32/esp - 1139 # setup - 1140 (clear-stream _test-input-stream) - 1141 (clear-stream $_test-input-buffered-file->buffer) - 1142 (clear-stream _test-output-stream) - 1143 (clear-stream $_test-output-buffered-file->buffer) - 1144 # - 1145 (write _test-input-stream "fn foo {\n") - 1146 (write _test-input-stream " var x/ecx: int <- copy 0\n") - 1147 (write _test-input-stream " compare x, 0\n") - 1148 (write _test-input-stream "}\n") - 1149 # convert - 1150 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1151 (flush _test-output-buffered-file) - 1152 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1158 # check output - 1159 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0") - 1160 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1") - 1161 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2") - 1162 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3") - 1163 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4") - 1164 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5") - 1165 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") - 1166 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7") - 1167 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8") - 1168 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") - 1169 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10") - 1170 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11") - 1171 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12") - 1172 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13") - 1173 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14") - 1174 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15") - 1175 # . epilogue - 1176 89/<- %esp 5/r32/ebp - 1177 5d/pop-to-ebp - 1178 c3/return - 1179 - 1180 test-convert-function-with-local-var-in-block: - 1181 # . prologue - 1182 55/push-ebp - 1183 89/<- %ebp 4/r32/esp - 1184 # setup - 1185 (clear-stream _test-input-stream) - 1186 (clear-stream $_test-input-buffered-file->buffer) - 1187 (clear-stream _test-output-stream) - 1188 (clear-stream $_test-output-buffered-file->buffer) - 1189 # - 1190 (write _test-input-stream "fn foo {\n") - 1191 (write _test-input-stream " {\n") - 1192 (write _test-input-stream " var x: int\n") - 1193 (write _test-input-stream " increment x\n") - 1194 (write _test-input-stream " }\n") - 1195 (write _test-input-stream "}\n") - 1196 # convert - 1197 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1198 (flush _test-output-buffered-file) - 1199 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1205 # check output - 1206 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0") - 1207 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1") - 1208 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2") - 1209 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3") - 1210 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4") - 1211 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5") - 1212 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6") - 1213 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7") - 1214 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8") - 1215 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9") - 1216 (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") - 1217 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11") - 1218 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12") - 1219 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13") - 1220 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14") - 1221 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15") - 1222 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16") - 1223 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17") - 1224 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18") - 1225 # . epilogue - 1226 89/<- %esp 5/r32/ebp - 1227 5d/pop-to-ebp - 1228 c3/return - 1229 - 1230 test-convert-function-with-local-var-in-named-block: - 1231 # . prologue - 1232 55/push-ebp - 1233 89/<- %ebp 4/r32/esp - 1234 # setup - 1235 (clear-stream _test-input-stream) - 1236 (clear-stream $_test-input-buffered-file->buffer) - 1237 (clear-stream _test-output-stream) - 1238 (clear-stream $_test-output-buffered-file->buffer) - 1239 # - 1240 (write _test-input-stream "fn foo {\n") - 1241 (write _test-input-stream " $bar: {\n") - 1242 (write _test-input-stream " var x: int\n") - 1243 (write _test-input-stream " increment x\n") - 1244 (write _test-input-stream " }\n") - 1245 (write _test-input-stream "}\n") - 1246 # convert - 1247 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1248 (flush _test-output-buffered-file) - 1249 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1255 # check output - 1256 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0") - 1257 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1") - 1258 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2") - 1259 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3") - 1260 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4") - 1261 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5") - 1262 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6") - 1263 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7") - 1264 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8") - 1265 (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") - 1266 (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") - 1267 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11") - 1268 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12") - 1269 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13") - 1270 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14") - 1271 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15") - 1272 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16") - 1273 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17") - 1274 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18") - 1275 # . epilogue - 1276 89/<- %esp 5/r32/ebp - 1277 5d/pop-to-ebp - 1278 c3/return - 1279 - 1280 test-always-shadow-outermost-reg-vars-in-function: - 1281 # . prologue - 1282 55/push-ebp - 1283 89/<- %ebp 4/r32/esp - 1284 # setup - 1285 (clear-stream _test-input-stream) - 1286 (clear-stream $_test-input-buffered-file->buffer) - 1287 (clear-stream _test-output-stream) - 1288 (clear-stream $_test-output-buffered-file->buffer) - 1289 # - 1290 (write _test-input-stream "fn foo {\n") - 1291 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1292 (write _test-input-stream "}\n") - 1293 # convert - 1294 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1295 (flush _test-output-buffered-file) - 1296 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1302 # check output - 1303 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-always-shadow-outermost-reg-vars-in-function/0") - 1304 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-always-shadow-outermost-reg-vars-in-function/1") - 1305 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/2") - 1306 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-always-shadow-outermost-reg-vars-in-function/3") - 1307 (check-next-stream-line-equal _test-output-stream " {" "F - test-always-shadow-outermost-reg-vars-in-function/4") - 1308 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-always-shadow-outermost-reg-vars-in-function/5") - 1309 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") - 1310 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-always-shadow-outermost-reg-vars-in-function/8") - 1311 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") - 1312 (check-next-stream-line-equal _test-output-stream " }" "F - test-always-shadow-outermost-reg-vars-in-function/12") - 1313 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-always-shadow-outermost-reg-vars-in-function/13") - 1314 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-always-shadow-outermost-reg-vars-in-function/14") - 1315 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-always-shadow-outermost-reg-vars-in-function/15") - 1316 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/16") - 1317 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-always-shadow-outermost-reg-vars-in-function/17") - 1318 # . epilogue - 1319 89/<- %esp 5/r32/ebp - 1320 5d/pop-to-ebp - 1321 c3/return - 1322 - 1323 _pending-test-clobber-dead-local: - 1324 # . prologue - 1325 55/push-ebp - 1326 89/<- %ebp 4/r32/esp - 1327 # setup - 1328 (clear-stream _test-input-stream) - 1329 (clear-stream $_test-input-buffered-file->buffer) - 1330 (clear-stream _test-output-stream) - 1331 (clear-stream $_test-output-buffered-file->buffer) - 1332 # - 1333 (write _test-input-stream "fn foo {\n") - 1334 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1335 (write _test-input-stream " {\n") - 1336 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1337 (write _test-input-stream " }\n") - 1338 (write _test-input-stream "}\n") - 1339 # convert - 1340 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1341 (flush _test-output-buffered-file) - 1342 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1348 # check output - 1349 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-clobber-dead-local/0") - 1350 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-clobber-dead-local/1") - 1351 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-clobber-dead-local/2") - 1352 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-clobber-dead-local/3") - 1353 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/4") - 1354 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-clobber-dead-local/5") - 1355 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-clobber-dead-local/6") - 1356 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-clobber-dead-local/7") - 1357 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/8") - 1358 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-clobber-dead-local/9") - 1359 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-clobber-dead-local/10") # no push/pop here - 1360 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/11") - 1361 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-clobber-dead-local/12") - 1362 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-clobber-dead-local/13") - 1363 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/14") - 1364 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-clobber-dead-local/15") - 1365 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-clobber-dead-local/16") - 1366 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-clobber-dead-local/17") - 1367 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-clobber-dead-local/18") - 1368 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-clobber-dead-local/19") - 1369 # . epilogue - 1370 89/<- %esp 5/r32/ebp - 1371 5d/pop-to-ebp - 1372 c3/return - 1373 - 1374 test-shadow-live-local: - 1375 # . prologue - 1376 55/push-ebp - 1377 89/<- %ebp 4/r32/esp - 1378 # setup - 1379 (clear-stream _test-input-stream) - 1380 (clear-stream $_test-input-buffered-file->buffer) - 1381 (clear-stream _test-output-stream) - 1382 (clear-stream $_test-output-buffered-file->buffer) - 1383 # - 1384 (write _test-input-stream "fn foo {\n") - 1385 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1386 (write _test-input-stream " {\n") - 1387 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1388 (write _test-input-stream " }\n") - 1389 (write _test-input-stream " x <- increment\n") - 1390 (write _test-input-stream "}\n") - 1391 # convert - 1392 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1393 (flush _test-output-buffered-file) - 1394 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1400 # check output - 1401 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-local/0") - 1402 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-local/1") - 1403 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-local/2") - 1404 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-local/3") - 1405 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/4") - 1406 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-local/5") - 1407 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/6") - 1408 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-local/7") - 1409 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/8") - 1410 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-local/9") - 1411 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/10") - 1412 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-local/11") - 1413 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/12") - 1414 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/13") - 1415 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-local/14") - 1416 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-local/15") - 1417 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/16") - 1418 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/17") - 1419 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-local/18") - 1420 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-local/19") - 1421 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-local/20") - 1422 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-local/21") - 1423 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-local/21") - 1424 # . epilogue - 1425 89/<- %esp 5/r32/ebp - 1426 5d/pop-to-ebp - 1427 c3/return - 1428 - 1429 test-do-not-spill-same-register-in-block: - 1430 # . prologue - 1431 55/push-ebp - 1432 89/<- %ebp 4/r32/esp - 1433 # setup - 1434 (clear-stream _test-input-stream) - 1435 (clear-stream $_test-input-buffered-file->buffer) - 1436 (clear-stream _test-output-stream) - 1437 (clear-stream $_test-output-buffered-file->buffer) - 1438 # - 1439 (write _test-input-stream "fn foo {\n") - 1440 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1441 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1442 (write _test-input-stream " y <- increment\n") - 1443 (write _test-input-stream "}\n") - 1444 # convert - 1445 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1446 (flush _test-output-buffered-file) - 1447 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1453 # check output - 1454 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-do-not-spill-same-register-in-block/0") - 1455 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-do-not-spill-same-register-in-block/1") - 1456 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-do-not-spill-same-register-in-block/2") - 1457 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-do-not-spill-same-register-in-block/3") - 1458 (check-next-stream-line-equal _test-output-stream " {" "F - test-do-not-spill-same-register-in-block/4") - 1459 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-do-not-spill-same-register-in-block/5") - 1460 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-do-not-spill-same-register-in-block/6") - 1461 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-do-not-spill-same-register-in-block/7") - 1462 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-do-not-spill-same-register-in-block/8") - 1463 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-do-not-spill-same-register-in-block/9") - 1464 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-do-not-spill-same-register-in-block/10") - 1465 (check-next-stream-line-equal _test-output-stream " }" "F - test-do-not-spill-same-register-in-block/11") - 1466 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-do-not-spill-same-register-in-block/12") - 1467 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-do-not-spill-same-register-in-block/13") - 1468 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-do-not-spill-same-register-in-block/14") - 1469 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-do-not-spill-same-register-in-block/15") - 1470 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-do-not-spill-same-register-in-block/16") - 1471 # . epilogue - 1472 89/<- %esp 5/r32/ebp - 1473 5d/pop-to-ebp - 1474 c3/return - 1475 - 1476 test-spill-different-register-in-block: - 1477 # . prologue - 1478 55/push-ebp - 1479 89/<- %ebp 4/r32/esp - 1480 # setup - 1481 (clear-stream _test-input-stream) - 1482 (clear-stream $_test-input-buffered-file->buffer) - 1483 (clear-stream _test-output-stream) - 1484 (clear-stream $_test-output-buffered-file->buffer) - 1485 # - 1486 (write _test-input-stream "fn foo {\n") - 1487 (write _test-input-stream " var x/eax: int <- copy 3\n") - 1488 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1489 (write _test-input-stream " y <- increment\n") - 1490 (write _test-input-stream "}\n") - 1491 # convert - 1492 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1493 (flush _test-output-buffered-file) - 1494 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1500 # check output - 1501 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-spill-different-register-in-block/0") - 1502 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-spill-different-register-in-block/1") - 1503 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-spill-different-register-in-block/2") - 1504 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-spill-different-register-in-block/3") - 1505 (check-next-stream-line-equal _test-output-stream " {" "F - test-spill-different-register-in-block/4") - 1506 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-spill-different-register-in-block/5") - 1507 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-spill-different-register-in-block/6") - 1508 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-spill-different-register-in-block/7") - 1509 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-spill-different-register-in-block/8") - 1510 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-spill-different-register-in-block/9") - 1511 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-spill-different-register-in-block/10") - 1512 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-spill-different-register-in-block/11") - 1513 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-spill-different-register-in-block/12") - 1514 (check-next-stream-line-equal _test-output-stream " }" "F - test-spill-different-register-in-block/13") - 1515 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-spill-different-register-in-block/14") - 1516 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-spill-different-register-in-block/15") - 1517 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-spill-different-register-in-block/16") - 1518 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-spill-different-register-in-block/17") - 1519 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-spill-different-register-in-block/18") - 1520 # . epilogue - 1521 89/<- %esp 5/r32/ebp - 1522 5d/pop-to-ebp - 1523 c3/return - 1524 - 1525 test-shadow-live-output: - 1526 # . prologue - 1527 55/push-ebp - 1528 89/<- %ebp 4/r32/esp - 1529 # setup - 1530 (clear-stream _test-input-stream) - 1531 (clear-stream $_test-input-buffered-file->buffer) - 1532 (clear-stream _test-output-stream) - 1533 (clear-stream $_test-output-buffered-file->buffer) - 1534 # - 1535 (write _test-input-stream "fn foo -> x/ecx: int {\n") - 1536 (write _test-input-stream " x <- copy 3\n") - 1537 (write _test-input-stream " {\n") - 1538 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1539 (write _test-input-stream " }\n") - 1540 (write _test-input-stream " x <- increment\n") - 1541 (write _test-input-stream "}\n") - 1542 # convert - 1543 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1544 (flush _test-output-buffered-file) - 1545 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1551 # check output - 1552 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-output/0") - 1553 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-output/1") - 1554 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-output/2") - 1555 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-output/3") - 1556 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/4") - 1557 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-output/5") - 1558 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-output/7") # no push because it's an output reg - 1559 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/8") - 1560 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-output/9") - 1561 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-output/10") - 1562 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-output/11") - 1563 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-output/12") - 1564 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/13") - 1565 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-output/14") - 1566 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-output/15") - 1567 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/17") - 1568 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-output/18") - 1569 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-output/19") - 1570 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-output/20") - 1571 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-output/21") - 1572 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-output/21") - 1573 # . epilogue - 1574 89/<- %esp 5/r32/ebp - 1575 5d/pop-to-ebp - 1576 c3/return - 1577 - 1578 test-local-clobbered-by-output: - 1579 # also doesn't spill - 1580 # . prologue - 1581 55/push-ebp - 1582 89/<- %ebp 4/r32/esp - 1583 # setup - 1584 (clear-stream _test-input-stream) - 1585 (clear-stream $_test-input-buffered-file->buffer) - 1586 (clear-stream _test-output-stream) - 1587 (clear-stream $_test-output-buffered-file->buffer) - 1588 # - 1589 (write _test-input-stream "fn foo -> x/ecx: int {\n") - 1590 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1591 (write _test-input-stream " x <- copy y\n") - 1592 (write _test-input-stream "}\n") - 1593 # convert - 1594 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1595 (flush _test-output-buffered-file) - 1596 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1602 # check output - 1603 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-local-clobbered-by-output/0") - 1604 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-local-clobbered-by-output/1") - 1605 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-local-clobbered-by-output/2") - 1606 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-local-clobbered-by-output/3") - 1607 (check-next-stream-line-equal _test-output-stream " {" "F - test-local-clobbered-by-output/4") - 1608 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-local-clobbered-by-output/5") - 1609 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-local-clobbered-by-output/6") - 1610 (check-next-stream-line-equal _test-output-stream " 89/<- %ecx 0x00000001/r32" "F - test-local-clobbered-by-output/7") - 1611 (check-next-stream-line-equal _test-output-stream " }" "F - test-local-clobbered-by-output/8") - 1612 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-local-clobbered-by-output/9") - 1613 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-local-clobbered-by-output/10") - 1614 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-local-clobbered-by-output/11") - 1615 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-local-clobbered-by-output/12") - 1616 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-local-clobbered-by-output/13") - 1617 # . epilogue - 1618 89/<- %esp 5/r32/ebp - 1619 5d/pop-to-ebp - 1620 c3/return - 1621 - 1622 test-read-output: - 1623 # also doesn't spill - 1624 # . prologue - 1625 55/push-ebp - 1626 89/<- %ebp 4/r32/esp - 1627 # setup - 1628 (clear-stream _test-input-stream) - 1629 (clear-stream $_test-input-buffered-file->buffer) - 1630 (clear-stream _test-output-stream) - 1631 (clear-stream $_test-output-buffered-file->buffer) - 1632 # - 1633 (write _test-input-stream "fn foo -> x/ecx: int {\n") - 1634 (write _test-input-stream " x <- copy 0x34\n") - 1635 (write _test-input-stream " compare x, 0x35\n") - 1636 (write _test-input-stream "}\n") - 1637 # convert - 1638 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1639 (flush _test-output-buffered-file) - 1640 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1646 # check output - 1647 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-read-output/0") - 1648 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-read-output/1") - 1649 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-read-output/2") - 1650 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-read-output/3") - 1651 (check-next-stream-line-equal _test-output-stream " {" "F - test-read-output/4") - 1652 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-read-output/5") - 1653 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x34/imm32" "F - test-read-output/6") - 1654 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0x35/imm32" "F - test-read-output/7") - 1655 (check-next-stream-line-equal _test-output-stream " }" "F - test-read-output/8") - 1656 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-read-output/9") - 1657 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-read-output/10") - 1658 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-read-output/11") - 1659 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-read-output/12") - 1660 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-read-output/13") - 1661 # . epilogue - 1662 89/<- %esp 5/r32/ebp - 1663 5d/pop-to-ebp - 1664 c3/return - 1665 - 1666 test-convert-function-with-branches-in-block: - 1667 # . prologue - 1668 55/push-ebp - 1669 89/<- %ebp 4/r32/esp - 1670 # setup - 1671 (clear-stream _test-input-stream) - 1672 (clear-stream $_test-input-buffered-file->buffer) - 1673 (clear-stream _test-output-stream) - 1674 (clear-stream $_test-output-buffered-file->buffer) - 1675 # - 1676 (write _test-input-stream "fn foo x: int {\n") - 1677 (write _test-input-stream " {\n") - 1678 (write _test-input-stream " break-if->=\n") - 1679 (write _test-input-stream " loop-if-addr<\n") - 1680 (write _test-input-stream " increment x\n") - 1681 (write _test-input-stream " loop\n") - 1682 (write _test-input-stream " }\n") - 1683 (write _test-input-stream "}\n") - 1684 # convert - 1685 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1686 (flush _test-output-buffered-file) - 1687 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1693 # check output - 1694 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") - 1695 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") - 1696 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") - 1697 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") - 1698 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") - 1699 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") - 1700 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") - 1701 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") - 1702 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") - 1703 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") - 1704 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") - 1705 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") - 1706 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") - 1707 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") - 1708 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") - 1709 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") - 1710 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") - 1711 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") - 1712 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") - 1713 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") - 1714 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") - 1715 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") - 1716 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") - 1717 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") - 1718 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") - 1719 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") - 1720 # . epilogue - 1721 89/<- %esp 5/r32/ebp - 1722 5d/pop-to-ebp - 1723 c3/return - 1724 - 1725 test-convert-function-with-branches-in-named-block: - 1726 # . prologue - 1727 55/push-ebp - 1728 89/<- %ebp 4/r32/esp - 1729 # setup - 1730 (clear-stream _test-input-stream) - 1731 (clear-stream $_test-input-buffered-file->buffer) - 1732 (clear-stream _test-output-stream) - 1733 (clear-stream $_test-output-buffered-file->buffer) - 1734 # - 1735 (write _test-input-stream "fn foo x: int {\n") - 1736 (write _test-input-stream " $bar: {\n") - 1737 (write _test-input-stream " break-if->= $bar\n") - 1738 (write _test-input-stream " loop-if-addr< $bar\n") - 1739 (write _test-input-stream " increment x\n") - 1740 (write _test-input-stream " loop\n") - 1741 (write _test-input-stream " }\n") - 1742 (write _test-input-stream "}\n") - 1743 # convert - 1744 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1745 (flush _test-output-buffered-file) - 1746 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1752 # check output - 1753 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0") - 1754 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1") - 1755 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2") - 1756 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3") - 1757 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4") - 1758 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5") - 1759 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6") - 1760 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7") - 1761 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/8") - 1762 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-named-block/9") - 1763 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/10") - 1764 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/11") - 1765 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/12") - 1766 (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") - 1767 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:loop/disp32" "F - test-convert-function-with-branches-in-named-block/14") - 1768 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/15") - 1769 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/16") - 1770 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/17") - 1771 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/18") - 1772 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/19") - 1773 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/20") - 1774 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/21") - 1775 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/22") - 1776 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/23") - 1777 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/24") - 1778 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/25") - 1779 # . epilogue - 1780 89/<- %esp 5/r32/ebp - 1781 5d/pop-to-ebp - 1782 c3/return - 1783 - 1784 test-convert-function-with-var-in-nested-block: - 1785 # . prologue - 1786 55/push-ebp - 1787 89/<- %ebp 4/r32/esp - 1788 # setup - 1789 (clear-stream _test-input-stream) - 1790 (clear-stream $_test-input-buffered-file->buffer) - 1791 (clear-stream _test-output-stream) - 1792 (clear-stream $_test-output-buffered-file->buffer) - 1793 # - 1794 (write _test-input-stream "fn foo x: int {\n") - 1795 (write _test-input-stream " {\n") - 1796 (write _test-input-stream " {\n") - 1797 (write _test-input-stream " var x: int\n") - 1798 (write _test-input-stream " increment x\n") - 1799 (write _test-input-stream " }\n") - 1800 (write _test-input-stream " }\n") - 1801 (write _test-input-stream "}\n") - 1802 # convert - 1803 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1804 (flush _test-output-buffered-file) - 1805 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1811 # check output - 1812 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") - 1813 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1") - 1814 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") - 1815 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") - 1816 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4") - 1817 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5") - 1818 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6") - 1819 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7") - 1820 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8") - 1821 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9") - 1822 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10") - 1823 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11") - 1824 (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") - 1825 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13") - 1826 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14") - 1827 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15") - 1828 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16") - 1829 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17") - 1830 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18") - 1831 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19") - 1832 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20") - 1833 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21") - 1834 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22") - 1835 # . epilogue - 1836 89/<- %esp 5/r32/ebp - 1837 5d/pop-to-ebp - 1838 c3/return - 1839 - 1840 test-convert-function-with-multiple-vars-in-nested-blocks: - 1841 # . prologue - 1842 55/push-ebp - 1843 89/<- %ebp 4/r32/esp - 1844 # setup - 1845 (clear-stream _test-input-stream) - 1846 (clear-stream $_test-input-buffered-file->buffer) - 1847 (clear-stream _test-output-stream) - 1848 (clear-stream $_test-output-buffered-file->buffer) - 1849 # - 1850 (write _test-input-stream "fn foo x: int {\n") - 1851 (write _test-input-stream " {\n") - 1852 (write _test-input-stream " var x/eax: int <- copy 0\n") - 1853 (write _test-input-stream " {\n") - 1854 (write _test-input-stream " var y: int\n") - 1855 (write _test-input-stream " x <- add y\n") - 1856 (write _test-input-stream " }\n") - 1857 (write _test-input-stream " }\n") - 1858 (write _test-input-stream "}\n") - 1859 # convert - 1860 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1861 (flush _test-output-buffered-file) - 1862 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1868 # check output - 1869 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0") - 1870 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1") - 1871 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2") - 1872 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3") - 1873 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4") - 1874 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5") - 1875 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6") - 1876 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7") - 1877 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8") - 1878 (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") - 1879 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10") - 1880 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11") - 1881 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12") - 1882 (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") - 1883 (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") - 1884 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15") - 1885 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16") - 1886 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17") - 1887 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18") - 1888 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19") - 1889 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20") - 1890 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21") - 1891 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22") - 1892 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23") - 1893 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24") - 1894 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25") - 1895 # . epilogue - 1896 89/<- %esp 5/r32/ebp - 1897 5d/pop-to-ebp - 1898 c3/return - 1899 - 1900 test-convert-function-with-branches-and-local-vars: - 1901 # A conditional 'break' after a 'var' in a block is converted into a - 1902 # nested block that performs all necessary cleanup before jumping. This - 1903 # results in some ugly code duplication. - 1904 # . prologue - 1905 55/push-ebp - 1906 89/<- %ebp 4/r32/esp - 1907 # setup - 1908 (clear-stream _test-input-stream) - 1909 (clear-stream $_test-input-buffered-file->buffer) - 1910 (clear-stream _test-output-stream) - 1911 (clear-stream $_test-output-buffered-file->buffer) - 1912 # - 1913 (write _test-input-stream "fn foo {\n") - 1914 (write _test-input-stream " {\n") - 1915 (write _test-input-stream " var x: int\n") - 1916 (write _test-input-stream " break-if->=\n") - 1917 (write _test-input-stream " increment x\n") - 1918 (write _test-input-stream " }\n") - 1919 (write _test-input-stream "}\n") - 1920 # convert - 1921 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1922 (flush _test-output-buffered-file) - 1923 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1929 # check output - 1930 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0") - 1931 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1") - 1932 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2") - 1933 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3") - 1934 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4") - 1935 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5") - 1936 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6") - 1937 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7") - 1938 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8") - 1939 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9") - 1940 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10") - 1941 (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") - 1942 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12") - 1943 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13") - 1944 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14") - 1945 (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") - 1946 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16") - 1947 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17") - 1948 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18") - 1949 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19") - 1950 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20") - 1951 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21") - 1952 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22") - 1953 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23") - 1954 # . epilogue - 1955 89/<- %esp 5/r32/ebp - 1956 5d/pop-to-ebp - 1957 c3/return - 1958 - 1959 test-convert-function-with-conditional-loops-and-local-vars: - 1960 # A conditional 'loop' after a 'var' in a block is converted into a nested - 1961 # block that performs all necessary cleanup before jumping. This results - 1962 # in some ugly code duplication. - 1963 # . prologue - 1964 55/push-ebp - 1965 89/<- %ebp 4/r32/esp - 1966 # setup - 1967 (clear-stream _test-input-stream) - 1968 (clear-stream $_test-input-buffered-file->buffer) - 1969 (clear-stream _test-output-stream) - 1970 (clear-stream $_test-output-buffered-file->buffer) - 1971 # - 1972 (write _test-input-stream "fn foo {\n") - 1973 (write _test-input-stream " {\n") - 1974 (write _test-input-stream " var x: int\n") - 1975 (write _test-input-stream " loop-if->=\n") - 1976 (write _test-input-stream " increment x\n") - 1977 (write _test-input-stream " }\n") - 1978 (write _test-input-stream "}\n") - 1979 # convert - 1980 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 1981 (flush _test-output-buffered-file) - 1982 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1988 # check output - 1989 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0") - 1990 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1") - 1991 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2") - 1992 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3") - 1993 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4") - 1994 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5") - 1995 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6") - 1996 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7") - 1997 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8") - 1998 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9") - 1999 (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") - 2000 (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") - 2001 (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") - 2002 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13") - 2003 (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") - 2004 (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") - 2005 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16") - 2006 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17") - 2007 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18") - 2008 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19") - 2009 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20") - 2010 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21") - 2011 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22") - 2012 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23") - 2013 # . epilogue - 2014 89/<- %esp 5/r32/ebp - 2015 5d/pop-to-ebp - 2016 c3/return - 2017 - 2018 test-convert-function-with-unconditional-loops-and-local-vars: - 2019 # An unconditional 'loop' after a 'var' in a block is emitted _after_ the - 2020 # regular block cleanup. Any instructions after 'loop' are dead and - 2021 # therefore skipped. - 2022 # . prologue - 2023 55/push-ebp - 2024 89/<- %ebp 4/r32/esp - 2025 # setup - 2026 (clear-stream _test-input-stream) - 2027 (clear-stream $_test-input-buffered-file->buffer) - 2028 (clear-stream _test-output-stream) - 2029 (clear-stream $_test-output-buffered-file->buffer) - 2030 # - 2031 (write _test-input-stream "fn foo {\n") - 2032 (write _test-input-stream " {\n") - 2033 (write _test-input-stream " var x: int\n") - 2034 (write _test-input-stream " loop\n") - 2035 (write _test-input-stream " increment x\n") - 2036 (write _test-input-stream " }\n") - 2037 (write _test-input-stream "}\n") - 2038 # convert - 2039 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2040 (flush _test-output-buffered-file) - 2041 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2047 # check output - 2048 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0") - 2049 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1") - 2050 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2") - 2051 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3") - 2052 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4") - 2053 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5") - 2054 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6") - 2055 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7") - 2056 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8") - 2057 (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") - 2058 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10") - 2059 # not emitted: ff 0/subop/increment *(ebp+0xfffffffc) - 2060 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11") - 2061 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12") - 2062 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13") - 2063 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14") - 2064 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15") - 2065 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16") - 2066 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17") - 2067 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18") - 2068 # . epilogue - 2069 89/<- %esp 5/r32/ebp - 2070 5d/pop-to-ebp - 2071 c3/return - 2072 - 2073 test-convert-function-with-branches-and-loops-and-local-vars: - 2074 # . prologue - 2075 55/push-ebp - 2076 89/<- %ebp 4/r32/esp - 2077 # setup - 2078 (clear-stream _test-input-stream) - 2079 (clear-stream $_test-input-buffered-file->buffer) - 2080 (clear-stream _test-output-stream) - 2081 (clear-stream $_test-output-buffered-file->buffer) - 2082 # - 2083 (write _test-input-stream "fn foo {\n") - 2084 (write _test-input-stream " {\n") - 2085 (write _test-input-stream " var x: int\n") - 2086 (write _test-input-stream " break-if->=\n") - 2087 (write _test-input-stream " increment x\n") - 2088 (write _test-input-stream " loop\n") - 2089 (write _test-input-stream " }\n") - 2090 (write _test-input-stream "}\n") - 2091 # convert - 2092 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2093 (flush _test-output-buffered-file) - 2094 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2100 # check output - 2101 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0") - 2102 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1") - 2103 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2") - 2104 (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") - 2105 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4") - 2106 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5") - 2107 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6") - 2108 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7") - 2109 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8") - 2110 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9") - 2111 (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") - 2112 (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") - 2113 (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") - 2114 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13") - 2115 (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") - 2116 (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") - 2117 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16") - 2118 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17") - 2119 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18") - 2120 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19") - 2121 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20") - 2122 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21") - 2123 (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") - 2124 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23") - 2125 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24") - 2126 # . epilogue - 2127 89/<- %esp 5/r32/ebp - 2128 5d/pop-to-ebp - 2129 c3/return - 2130 - 2131 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars: - 2132 # . prologue - 2133 55/push-ebp - 2134 89/<- %ebp 4/r32/esp - 2135 # setup - 2136 (clear-stream _test-input-stream) - 2137 (clear-stream $_test-input-buffered-file->buffer) - 2138 (clear-stream _test-output-stream) - 2139 (clear-stream $_test-output-buffered-file->buffer) - 2140 # - 2141 (write _test-input-stream "fn foo {\n") - 2142 (write _test-input-stream " a: {\n") - 2143 (write _test-input-stream " var x: int\n") - 2144 (write _test-input-stream " {\n") - 2145 (write _test-input-stream " var y: int\n") - 2146 (write _test-input-stream " break-if->= a\n") - 2147 (write _test-input-stream " increment x\n") - 2148 (write _test-input-stream " loop\n") - 2149 (write _test-input-stream " }\n") - 2150 (write _test-input-stream " }\n") - 2151 (write _test-input-stream "}\n") - 2152 # convert - 2153 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2154 (flush _test-output-buffered-file) - 2155 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2161 # check output - 2162 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0") - 2163 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1") - 2164 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2") - 2165 (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") - 2166 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4") - 2167 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5") - 2168 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6") - 2169 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7") - 2170 (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") - 2171 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9") - 2172 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10") - 2173 (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") - 2174 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12") - 2175 (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") - 2176 (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") - 2177 (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") - 2178 (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") - 2179 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17") - 2180 (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") - 2181 (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") - 2182 (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") - 2183 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21") - 2184 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22") - 2185 (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") - 2186 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24") - 2187 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25") - 2188 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26") - 2189 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27") - 2190 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28") - 2191 (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") - 2192 (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") - 2193 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31") - 2194 # . epilogue - 2195 89/<- %esp 5/r32/ebp - 2196 5d/pop-to-ebp - 2197 c3/return - 2198 - 2199 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2: - 2200 # . prologue - 2201 55/push-ebp - 2202 89/<- %ebp 4/r32/esp - 2203 # setup - 2204 (clear-stream _test-input-stream) - 2205 (clear-stream $_test-input-buffered-file->buffer) - 2206 (clear-stream _test-output-stream) - 2207 (clear-stream $_test-output-buffered-file->buffer) - 2208 # non-local conditional branch from a block without a local variable, - 2209 # unwinding a local on the stack - 2210 (write _test-input-stream "fn foo {\n") - 2211 (write _test-input-stream " a: {\n") - 2212 (write _test-input-stream " var x: int\n") - 2213 (write _test-input-stream " {\n") - 2214 (write _test-input-stream " break-if->= a\n") - 2215 (write _test-input-stream " }\n") - 2216 (write _test-input-stream " }\n") - 2217 (write _test-input-stream "}\n") - 2218 # convert - 2219 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2220 (flush _test-output-buffered-file) - 2221 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2227 # check output - 2228 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/0") - 2229 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/1") - 2230 (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") - 2231 (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") - 2232 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/4") - 2233 (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") - 2234 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/6") - 2235 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/7") - 2236 (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") - 2237 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/9") - 2238 (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") - 2239 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/11") - 2240 (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") - 2241 (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") - 2242 (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") - 2243 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/15") - 2244 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/16") - 2245 (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") - 2246 (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") - 2247 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/19") - 2248 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/20") - 2249 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/21") - 2250 (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") - 2251 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/23") - 2252 (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") - 2253 (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") - 2254 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/26") - 2255 # . epilogue - 2256 89/<- %esp 5/r32/ebp - 2257 5d/pop-to-ebp - 2258 c3/return - 2259 - 2260 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3: - 2261 # . prologue - 2262 55/push-ebp - 2263 89/<- %ebp 4/r32/esp - 2264 # setup - 2265 (clear-stream _test-input-stream) - 2266 (clear-stream $_test-input-buffered-file->buffer) - 2267 (clear-stream _test-output-stream) - 2268 (clear-stream $_test-output-buffered-file->buffer) - 2269 # non-local unconditional branch from a block without a local variable, - 2270 # unwinding a local on the stack - 2271 (write _test-input-stream "fn foo {\n") - 2272 (write _test-input-stream " a: {\n") - 2273 (write _test-input-stream " var x: int\n") - 2274 (write _test-input-stream " {\n") - 2275 (write _test-input-stream " break a\n") - 2276 (write _test-input-stream " }\n") - 2277 (write _test-input-stream " }\n") - 2278 (write _test-input-stream "}\n") - 2279 # convert - 2280 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2281 (flush _test-output-buffered-file) - 2282 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2288 # check output - 2289 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/0") - 2290 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/1") - 2291 (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") - 2292 (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") - 2293 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/4") - 2294 (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") - 2295 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/6") - 2296 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/7") - 2297 (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") - 2298 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/9") - 2299 (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") - 2300 (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") - 2301 (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") - 2302 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/14") - 2303 (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") - 2304 (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") - 2305 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/17") - 2306 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/18") - 2307 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/19") - 2308 (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") - 2309 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/21") - 2310 (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") - 2311 (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") - 2312 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/24") - 2313 # . epilogue - 2314 89/<- %esp 5/r32/ebp - 2315 5d/pop-to-ebp - 2316 c3/return - 2317 - 2318 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4: - 2319 # . prologue - 2320 55/push-ebp - 2321 89/<- %ebp 4/r32/esp - 2322 # setup - 2323 (clear-stream _test-input-stream) - 2324 (clear-stream $_test-input-buffered-file->buffer) - 2325 (clear-stream _test-output-stream) - 2326 (clear-stream $_test-output-buffered-file->buffer) - 2327 # - 2328 (write _test-input-stream "fn foo {\n") - 2329 (write _test-input-stream " a: {\n") - 2330 (write _test-input-stream " var x/esi: int <- copy 0\n") - 2331 (write _test-input-stream " {\n") - 2332 (write _test-input-stream " break a\n") - 2333 (write _test-input-stream " }\n") - 2334 (write _test-input-stream " }\n") - 2335 (write _test-input-stream "}\n") - 2336 # convert - 2337 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2338 (flush _test-output-buffered-file) - 2339 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2345 # check output - 2346 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/0") - 2347 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/1") - 2348 (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") - 2349 (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") - 2350 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/4") - 2351 (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") - 2352 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/6") - 2353 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/7") - 2354 (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") - 2355 (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") - 2356 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/10") - 2357 (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") - 2358 (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") - 2359 (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") - 2360 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/14") - 2361 (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") - 2362 (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") - 2363 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/17") - 2364 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/18") - 2365 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/19") - 2366 (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") - 2367 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/21") - 2368 (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") - 2369 (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") - 2370 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/24") - 2371 # . epilogue - 2372 89/<- %esp 5/r32/ebp - 2373 5d/pop-to-ebp - 2374 c3/return - 2375 - 2376 test-convert-function-with-nonlocal-unconditional-break-and-local-vars: - 2377 # . prologue - 2378 55/push-ebp - 2379 89/<- %ebp 4/r32/esp - 2380 # setup - 2381 (clear-stream _test-input-stream) - 2382 (clear-stream $_test-input-buffered-file->buffer) - 2383 (clear-stream _test-output-stream) - 2384 (clear-stream $_test-output-buffered-file->buffer) - 2385 # - 2386 (write _test-input-stream "fn foo {\n") - 2387 (write _test-input-stream " a: {\n") - 2388 (write _test-input-stream " var x: int\n") - 2389 (write _test-input-stream " {\n") - 2390 (write _test-input-stream " var y: int\n") - 2391 (write _test-input-stream " break a\n") - 2392 (write _test-input-stream " increment x\n") - 2393 (write _test-input-stream " }\n") - 2394 (write _test-input-stream " }\n") - 2395 (write _test-input-stream "}\n") - 2396 # convert - 2397 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2398 (flush _test-output-buffered-file) - 2399 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2405 # check output - 2406 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0") - 2407 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1") - 2408 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2") - 2409 (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") - 2410 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4") - 2411 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5") - 2412 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6") - 2413 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7") - 2414 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8") - 2415 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9") - 2416 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10") - 2417 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11") - 2418 (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") - 2419 (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") - 2420 (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") - 2421 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15") - 2422 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16") - 2423 (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") - 2424 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18") - 2425 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19") - 2426 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20") - 2427 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21") - 2428 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22") - 2429 (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") - 2430 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24") - 2431 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25") - 2432 # . epilogue - 2433 89/<- %esp 5/r32/ebp - 2434 5d/pop-to-ebp - 2435 c3/return - 2436 - 2437 test-convert-function-with-unconditional-break-and-local-vars: - 2438 # . prologue - 2439 55/push-ebp - 2440 89/<- %ebp 4/r32/esp - 2441 # setup - 2442 (clear-stream _test-input-stream) - 2443 (clear-stream $_test-input-buffered-file->buffer) - 2444 (clear-stream _test-output-stream) - 2445 (clear-stream $_test-output-buffered-file->buffer) - 2446 # - 2447 (write _test-input-stream "fn foo {\n") - 2448 (write _test-input-stream " {\n") - 2449 (write _test-input-stream " var x: int\n") - 2450 (write _test-input-stream " {\n") - 2451 (write _test-input-stream " var y: int\n") - 2452 (write _test-input-stream " break\n") - 2453 (write _test-input-stream " increment x\n") - 2454 (write _test-input-stream " }\n") - 2455 (write _test-input-stream " }\n") - 2456 (write _test-input-stream "}\n") - 2457 # convert - 2458 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2459 (flush _test-output-buffered-file) - 2460 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2466 # check output - 2467 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0") - 2468 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1") - 2469 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2") - 2470 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3") - 2471 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4") - 2472 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5") - 2473 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6") - 2474 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7") - 2475 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8") - 2476 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9") - 2477 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10") - 2478 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11") - 2479 (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") - 2480 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13") - 2481 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14") - 2482 (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") - 2483 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16") - 2484 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17") - 2485 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18") - 2486 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19") - 2487 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20") - 2488 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21") - 2489 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22") - 2490 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23") - 2491 # . epilogue - 2492 89/<- %esp 5/r32/ebp - 2493 5d/pop-to-ebp - 2494 c3/return - 2495 - 2496 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars: - 2497 # . prologue - 2498 55/push-ebp - 2499 89/<- %ebp 4/r32/esp - 2500 # setup - 2501 (clear-stream _test-input-stream) - 2502 (clear-stream $_test-input-buffered-file->buffer) - 2503 (clear-stream _test-output-stream) - 2504 (clear-stream $_test-output-buffered-file->buffer) - 2505 # - 2506 (write _test-input-stream "fn foo {\n") - 2507 (write _test-input-stream " a: {\n") - 2508 (write _test-input-stream " var x: int\n") - 2509 (write _test-input-stream " {\n") - 2510 (write _test-input-stream " var y: int\n") - 2511 (write _test-input-stream " loop a\n") - 2512 (write _test-input-stream " increment x\n") - 2513 (write _test-input-stream " }\n") - 2514 (write _test-input-stream " }\n") - 2515 (write _test-input-stream "}\n") - 2516 # convert - 2517 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2518 (flush _test-output-buffered-file) - 2519 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2525 # check output - 2526 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0") - 2527 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1") - 2528 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2") - 2529 (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") - 2530 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4") - 2531 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5") - 2532 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6") - 2533 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7") - 2534 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8") - 2535 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9") - 2536 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10") - 2537 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11") - 2538 (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") - 2539 (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") - 2540 (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") - 2541 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15") - 2542 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16") - 2543 (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") - 2544 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18") - 2545 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19") - 2546 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20") - 2547 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21") - 2548 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22") - 2549 (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") - 2550 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24") - 2551 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25") - 2552 # . epilogue - 2553 89/<- %esp 5/r32/ebp - 2554 5d/pop-to-ebp - 2555 c3/return - 2556 - 2557 test-convert-function-with-local-array-var-in-mem: - 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 # - 2567 (write _test-input-stream "fn foo {\n") - 2568 (write _test-input-stream " var x: (array int 3)\n") - 2569 (write _test-input-stream "}\n") - 2570 # convert - 2571 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2572 (flush _test-output-buffered-file) - 2573 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2579 # check output - 2580 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-var-in-mem/0") - 2581 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-var-in-mem/1") - 2582 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-var-in-mem/2") - 2583 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-var-in-mem/3") - 2584 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-var-in-mem/4") - 2585 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-var-in-mem/5") - 2586 # define x - 2587 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-function-with-local-array-var-in-mem/7") - 2588 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-function-with-local-array-var-in-mem/8") - 2589 # reclaim x - 2590 (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") - 2591 # - 2592 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-var-in-mem/10") - 2593 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-var-in-mem/11") - 2594 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-var-in-mem/12") - 2595 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-var-in-mem/13") - 2596 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-var-in-mem/14") - 2597 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-var-in-mem/15") - 2598 # . epilogue - 2599 89/<- %esp 5/r32/ebp - 2600 5d/pop-to-ebp - 2601 c3/return - 2602 - 2603 test-convert-address: - 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 a: int\n") - 2615 (write _test-input-stream " var b/eax: (addr int) <- address a\n") - 2616 (write _test-input-stream "}\n") - 2617 # convert - 2618 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2619 (flush _test-output-buffered-file) - 2620 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2626 # check output - 2627 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-address/0") - 2628 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-address/1") - 2629 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-address/2") - 2630 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-address/3") - 2631 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-address/4") - 2632 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-address/5") - 2633 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-address/6") - 2634 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-address/7") - 2635 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-address/8") - 2636 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-address/9") - 2637 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-address/10") - 2638 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-address/11") - 2639 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-address/12") - 2640 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-address/13") - 2641 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-address/14") - 2642 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-address/15") - 2643 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-address/16") - 2644 # . epilogue - 2645 89/<- %esp 5/r32/ebp - 2646 5d/pop-to-ebp - 2647 c3/return - 2648 - 2649 test-convert-length-of-array: - 2650 # . prologue - 2651 55/push-ebp - 2652 89/<- %ebp 4/r32/esp - 2653 # setup - 2654 (clear-stream _test-input-stream) - 2655 (clear-stream $_test-input-buffered-file->buffer) - 2656 (clear-stream _test-output-stream) - 2657 (clear-stream $_test-output-buffered-file->buffer) - 2658 # - 2659 (write _test-input-stream "fn foo a: (addr array int) {\n") - 2660 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n") - 2661 (write _test-input-stream " var c/eax: int <- length b\n") - 2662 (write _test-input-stream "}\n") - 2663 # convert - 2664 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2665 (flush _test-output-buffered-file) - 2666 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2672 # check output - 2673 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0") - 2674 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1") - 2675 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2") - 2676 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3") - 2677 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4") - 2678 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5") - 2679 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6") - 2680 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7") - 2681 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array/8") - 2682 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array/9") - 2683 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/10") - 2684 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/11") - 2685 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/12") - 2686 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/13") - 2687 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/14") - 2688 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/15") - 2689 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/16") - 2690 # . epilogue - 2691 89/<- %esp 5/r32/ebp - 2692 5d/pop-to-ebp - 2693 c3/return - 2694 - 2695 test-convert-length-of-array-on-stack: - 2696 # . prologue - 2697 55/push-ebp - 2698 89/<- %ebp 4/r32/esp - 2699 # setup - 2700 (clear-stream _test-input-stream) - 2701 (clear-stream $_test-input-buffered-file->buffer) - 2702 (clear-stream _test-output-stream) - 2703 (clear-stream $_test-output-buffered-file->buffer) - 2704 # - 2705 (write _test-input-stream "fn foo {\n") - 2706 (write _test-input-stream " var a: (array int 3)\n") - 2707 (write _test-input-stream " var b/eax: int <- length a\n") - 2708 (write _test-input-stream "}\n") - 2709 # convert - 2710 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2711 (flush _test-output-buffered-file) - 2712 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2718 # check output - 2719 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-on-stack/0") - 2720 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-on-stack/1") - 2721 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-on-stack/2") - 2722 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-on-stack/3") - 2723 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-on-stack/4") - 2724 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-on-stack/5") - 2725 # define x - 2726 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-length-of-array-on-stack/6") - 2727 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-length-of-array-on-stack/7") - 2728 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-on-stack/8") - 2729 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff0) 0x00000000/r32" "F - test-convert-length-of-array-on-stack/9") - 2730 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array-on-stack/10") - 2731 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-on-stack/11") - 2732 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-length-of-array-on-stack/12") - 2733 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-on-stack/13") - 2734 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-on-stack/14") - 2735 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-on-stack/15") - 2736 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-on-stack/16") - 2737 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-on-stack/17") - 2738 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-on-stack/18") - 2739 # . epilogue - 2740 89/<- %esp 5/r32/ebp - 2741 5d/pop-to-ebp - 2742 c3/return - 2743 - 2744 test-convert-index-into-array: - 2745 # . prologue - 2746 55/push-ebp - 2747 89/<- %ebp 4/r32/esp - 2748 # setup - 2749 (clear-stream _test-input-stream) - 2750 (clear-stream $_test-input-buffered-file->buffer) - 2751 (clear-stream _test-output-stream) - 2752 (clear-stream $_test-output-buffered-file->buffer) - 2753 # - 2754 (write _test-input-stream "fn foo {\n") - 2755 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 2756 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 2757 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") - 2758 (write _test-input-stream "}\n") - 2759 # convert - 2760 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2761 (flush _test-output-buffered-file) - 2762 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2768 # check output - 2769 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0") - 2770 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1") - 2771 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2") - 2772 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3") - 2773 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4") - 2774 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5") - 2775 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6") - 2776 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7") - 2777 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8") - 2778 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9") - 2779 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-convert-index-into-array/11") - 2780 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/13") - 2781 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/14") - 2782 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/15") - 2783 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/16") - 2784 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/17") - 2785 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/18") - 2786 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/19") - 2787 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/20") - 2788 # . epilogue - 2789 89/<- %esp 5/r32/ebp - 2790 5d/pop-to-ebp - 2791 c3/return - 2792 - 2793 test-convert-index-into-array-with-literal: - 2794 # . prologue - 2795 55/push-ebp - 2796 89/<- %ebp 4/r32/esp - 2797 # setup - 2798 (clear-stream _test-input-stream) - 2799 (clear-stream $_test-input-buffered-file->buffer) - 2800 (clear-stream _test-output-stream) - 2801 (clear-stream $_test-output-buffered-file->buffer) - 2802 # - 2803 (write _test-input-stream "fn foo {\n") - 2804 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 2805 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") - 2806 (write _test-input-stream "}\n") - 2807 # convert - 2808 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2809 (flush _test-output-buffered-file) - 2810 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2816 # check output - 2817 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-with-literal/0") - 2818 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-with-literal/1") - 2819 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-with-literal/2") - 2820 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-with-literal/3") - 2821 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-with-literal/4") - 2822 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5") - 2823 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6") - 2824 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7") - 2825 # 2 * 4 bytes/elem + 4 bytes for size = offset 12 - 2826 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/8") - 2827 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/9") - 2828 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/10") - 2829 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-with-literal/11") - 2830 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-with-literal/12") - 2831 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-with-literal/13") - 2832 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-with-literal/14") - 2833 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-with-literal/15") - 2834 # . epilogue - 2835 89/<- %esp 5/r32/ebp - 2836 5d/pop-to-ebp - 2837 c3/return - 2838 - 2839 test-convert-index-into-array-on-stack: - 2840 # . prologue - 2841 55/push-ebp - 2842 89/<- %ebp 4/r32/esp - 2843 # setup - 2844 (clear-stream _test-input-stream) - 2845 (clear-stream $_test-input-buffered-file->buffer) - 2846 (clear-stream _test-output-stream) - 2847 (clear-stream $_test-output-buffered-file->buffer) - 2848 # - 2849 (write _test-input-stream "fn foo {\n") - 2850 (write _test-input-stream " var arr: (array int 3)\n") - 2851 (write _test-input-stream " var idx/eax: int <- copy 2\n") - 2852 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") - 2853 (write _test-input-stream "}\n") - 2854 # convert - 2855 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2856 (flush _test-output-buffered-file) - 2857 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2863 # check output - 2864 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack/0") - 2865 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack/1") - 2866 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack/2") - 2867 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack/3") - 2868 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack/4") - 2869 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack/5") - 2870 # var arr - 2871 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack/6") - 2872 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack/7") - 2873 # var idx - 2874 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack/8") - 2875 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 2/imm32" "F - test-convert-index-into-array-on-stack/9") - 2876 # var x is at (ebp-0x10) + idx<<2 + 4 = ebp + idx<<2 - 0xc - 2877 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + eax<<0x00000002 + 0xfffffff4) 0x00000000/r32" "F - test-convert-index-into-array-on-stack/10") - 2878 # reclaim idx - 2879 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack/11") - 2880 # reclaim arr - 2881 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack/12") - 2882 # - 2883 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack/13") - 2884 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack/14") - 2885 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack/15") - 2886 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack/16") - 2887 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack/17") - 2888 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack/18") - 2889 # . epilogue - 2890 89/<- %esp 5/r32/ebp - 2891 5d/pop-to-ebp - 2892 c3/return - 2893 - 2894 test-convert-index-into-array-on-stack-with-literal: - 2895 # . prologue - 2896 55/push-ebp - 2897 89/<- %ebp 4/r32/esp - 2898 # setup - 2899 (clear-stream _test-input-stream) - 2900 (clear-stream $_test-input-buffered-file->buffer) - 2901 (clear-stream _test-output-stream) - 2902 (clear-stream $_test-output-buffered-file->buffer) - 2903 # - 2904 (write _test-input-stream "fn foo {\n") - 2905 (write _test-input-stream " var arr: (array int 3)\n") - 2906 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") - 2907 (write _test-input-stream "}\n") - 2908 # convert - 2909 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2910 (flush _test-output-buffered-file) - 2911 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2917 # check output - 2918 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack-with-literal/0") - 2919 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack-with-literal/1") - 2920 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack-with-literal/2") - 2921 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack-with-literal/3") - 2922 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack-with-literal/4") - 2923 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack-with-literal/5") - 2924 # var arr - 2925 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack-with-literal/6") - 2926 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack-with-literal/7") - 2927 # var x - 2928 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack-with-literal/8") - 2929 # x is at (ebp-0x10) + 4 + 2*4 = ebp-4 - 2930 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + 0xfffffffc) 0x00000000/r32" "F - test-convert-index-into-array-on-stack-with-literal/9") - 2931 # reclaim x - 2932 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack-with-literal/10") - 2933 # reclaim arr - 2934 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack-with-literal/11") - 2935 # - 2936 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack-with-literal/12") - 2937 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack-with-literal/13") - 2938 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack-with-literal/14") - 2939 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack-with-literal/15") - 2940 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack-with-literal/16") - 2941 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack-with-literal/17") - 2942 # . epilogue - 2943 89/<- %esp 5/r32/ebp - 2944 5d/pop-to-ebp - 2945 c3/return - 2946 - 2947 test-convert-index-into-array-using-offset: - 2948 # . prologue - 2949 55/push-ebp - 2950 89/<- %ebp 4/r32/esp - 2951 # setup - 2952 (clear-stream _test-input-stream) - 2953 (clear-stream $_test-input-buffered-file->buffer) - 2954 (clear-stream _test-output-stream) - 2955 (clear-stream $_test-output-buffered-file->buffer) - 2956 # - 2957 (write _test-input-stream "fn foo {\n") - 2958 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 2959 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 2960 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") - 2961 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") - 2962 (write _test-input-stream "}\n") - 2963 # convert - 2964 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 2965 (flush _test-output-buffered-file) - 2966 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2972 # check output - 2973 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset/0") - 2974 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset/1") - 2975 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset/2") - 2976 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset/3") - 2977 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset/4") - 2978 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset/5") - 2979 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset/6") - 2980 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset/7") - 2981 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset/8") - 2982 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-using-offset/9") - 2983 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset/10") - 2984 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset/11") - 2985 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset/12") - 2986 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset/13") - 2987 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset/14") - 2988 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset/15") - 2989 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset/16") - 2990 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset/17") - 2991 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset/18") - 2992 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset/19") - 2993 # . epilogue - 2994 89/<- %esp 5/r32/ebp - 2995 5d/pop-to-ebp - 2996 c3/return - 2997 - 2998 test-convert-index-into-array-using-offset-on-stack: - 2999 # . prologue - 3000 55/push-ebp - 3001 89/<- %ebp 4/r32/esp - 3002 # setup - 3003 (clear-stream _test-input-stream) - 3004 (clear-stream $_test-input-buffered-file->buffer) - 3005 (clear-stream _test-output-stream) - 3006 (clear-stream $_test-output-buffered-file->buffer) - 3007 # - 3008 (write _test-input-stream "fn foo {\n") - 3009 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 3010 (write _test-input-stream " var idx: int\n") - 3011 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") - 3012 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") - 3013 (write _test-input-stream "}\n") - 3014 # convert - 3015 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3016 (flush _test-output-buffered-file) - 3017 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3023 # check output - 3024 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset-on-stack/0") - 3025 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset-on-stack/1") - 3026 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset-on-stack/2") - 3027 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset-on-stack/3") - 3028 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset-on-stack/4") - 3029 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset-on-stack/5") - 3030 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset-on-stack/6") - 3031 (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") - 3032 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/8") - 3033 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset-on-stack/9") - 3034 (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") - 3035 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset-on-stack/11") - 3036 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset-on-stack/12") - 3037 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-index-into-array-using-offset-on-stack/13") - 3038 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset-on-stack/14") - 3039 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset-on-stack/15") - 3040 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset-on-stack/16") - 3041 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset-on-stack/17") - 3042 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset-on-stack/18") - 3043 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset-on-stack/19") - 3044 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset-on-stack/20") - 3045 # . epilogue - 3046 89/<- %esp 5/r32/ebp - 3047 5d/pop-to-ebp - 3048 c3/return - 3049 - 3050 test-convert-function-and-type-definition: - 3051 # . prologue - 3052 55/push-ebp - 3053 89/<- %ebp 4/r32/esp - 3054 # setup - 3055 (clear-stream _test-input-stream) - 3056 (clear-stream $_test-input-buffered-file->buffer) - 3057 (clear-stream _test-output-stream) - 3058 (clear-stream $_test-output-buffered-file->buffer) - 3059 # - 3060 (write _test-input-stream "fn foo a: (addr t) {\n") - 3061 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n") - 3062 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n") - 3063 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n") - 3064 (write _test-input-stream "}\n") - 3065 (write _test-input-stream "type t {\n") - 3066 (write _test-input-stream " x: int\n") - 3067 (write _test-input-stream " y: int\n") - 3068 (write _test-input-stream "}\n") - 3069 # convert - 3070 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3071 (flush _test-output-buffered-file) - 3072 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3078 # check output - 3079 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0") - 3080 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1") - 3081 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2") - 3082 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3") - 3083 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4") - 3084 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5") - 3085 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6") - 3086 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7") - 3087 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8") - 3088 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9") - 3089 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11") - 3090 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13") - 3091 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14") - 3092 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15") - 3093 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16") - 3094 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17") - 3095 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18") - 3096 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19") - 3097 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20") - 3098 # . epilogue - 3099 89/<- %esp 5/r32/ebp - 3100 5d/pop-to-ebp - 3101 c3/return - 3102 - 3103 test-convert-function-with-local-var-with-user-defined-type: - 3104 # . prologue - 3105 55/push-ebp - 3106 89/<- %ebp 4/r32/esp - 3107 # setup - 3108 (clear-stream _test-input-stream) - 3109 (clear-stream $_test-input-buffered-file->buffer) - 3110 (clear-stream _test-output-stream) - 3111 (clear-stream $_test-output-buffered-file->buffer) - 3112 # - 3113 (write _test-input-stream "fn foo {\n") - 3114 (write _test-input-stream " var a: t\n") - 3115 (write _test-input-stream "}\n") - 3116 (write _test-input-stream "type t {\n") - 3117 (write _test-input-stream " x: int\n") - 3118 (write _test-input-stream " y: int\n") - 3119 (write _test-input-stream "}\n") - 3120 # convert - 3121 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3122 (flush _test-output-buffered-file) - 3123 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3129 # check output - 3130 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0") - 3131 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1") - 3132 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2") - 3133 (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") - 3134 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4") - 3135 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5") - 3136 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6") - 3137 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7") - 3138 (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") - 3139 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9") - 3140 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10") - 3141 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11") - 3142 (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") - 3143 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13") - 3144 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14") - 3145 # . epilogue - 3146 89/<- %esp 5/r32/ebp - 3147 5d/pop-to-ebp - 3148 c3/return - 3149 - 3150 test-convert-function-call-with-arg-of-user-defined-type: - 3151 # . prologue - 3152 55/push-ebp - 3153 89/<- %ebp 4/r32/esp - 3154 # setup - 3155 (clear-stream _test-input-stream) - 3156 (clear-stream $_test-input-buffered-file->buffer) - 3157 (clear-stream _test-output-stream) - 3158 (clear-stream $_test-output-buffered-file->buffer) - 3159 # - 3160 (write _test-input-stream "fn f {\n") - 3161 (write _test-input-stream " var a: t\n") - 3162 (write _test-input-stream " foo a\n") - 3163 (write _test-input-stream "}\n") - 3164 (write _test-input-stream "fn foo x: t {\n") - 3165 (write _test-input-stream "}\n") - 3166 (write _test-input-stream "type t {\n") - 3167 (write _test-input-stream " x: int\n") - 3168 (write _test-input-stream " y: int\n") - 3169 (write _test-input-stream "}\n") - 3170 # convert - 3171 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3172 (flush _test-output-buffered-file) - 3173 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3179 # check output - 3180 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") - 3181 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") - 3182 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") - 3183 (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") - 3184 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") - 3185 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") - 3186 # var a: t - 3187 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/6") - 3188 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7") - 3189 # foo a - 3190 (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") - 3191 # - 3192 (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") - 3193 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") - 3194 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") - 3195 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") - 3196 (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") - 3197 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") - 3198 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") - 3199 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") - 3200 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") - 3201 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") - 3202 (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") - 3203 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") - 3204 (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") - 3205 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") - 3206 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") - 3207 # . epilogue - 3208 89/<- %esp 5/r32/ebp - 3209 5d/pop-to-ebp - 3210 c3/return - 3211 - 3212 test-convert-function-call-with-arg-of-user-defined-type-register-indirect: - 3213 # . prologue - 3214 55/push-ebp - 3215 89/<- %ebp 4/r32/esp - 3216 # setup - 3217 (clear-stream _test-input-stream) - 3218 (clear-stream $_test-input-buffered-file->buffer) - 3219 (clear-stream _test-output-stream) - 3220 (clear-stream $_test-output-buffered-file->buffer) - 3221 # - 3222 (write _test-input-stream "fn f {\n") - 3223 (write _test-input-stream " var a/eax: (addr t) <- copy 0\n") - 3224 (write _test-input-stream " foo *a\n") - 3225 (write _test-input-stream "}\n") - 3226 (write _test-input-stream "fn foo x: t {\n") - 3227 (write _test-input-stream "}\n") - 3228 (write _test-input-stream "type t {\n") - 3229 (write _test-input-stream " x: int\n") - 3230 (write _test-input-stream " y: int\n") - 3231 (write _test-input-stream "}\n") - 3232 # convert - 3233 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3234 (flush _test-output-buffered-file) - 3235 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3241 # check output - 3242 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") - 3243 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") - 3244 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") - 3245 (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") - 3246 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") - 3247 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") - 3248 # var a - 3249 (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") - 3250 (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") - 3251 # foo a - 3252 (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") - 3253 # - 3254 (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") - 3255 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") - 3256 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") - 3257 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") - 3258 (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") - 3259 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") - 3260 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") - 3261 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") - 3262 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") - 3263 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") - 3264 (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") - 3265 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") - 3266 (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") - 3267 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") - 3268 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") - 3269 # . epilogue - 3270 89/<- %esp 5/r32/ebp - 3271 5d/pop-to-ebp - 3272 c3/return - 3273 - 3274 # we don't have special support for call-by-reference; just explicitly create - 3275 # a new variable with the address of the arg - 3276 test-convert-function-call-with-arg-of-user-defined-type-by-reference: - 3277 # . prologue - 3278 55/push-ebp - 3279 89/<- %ebp 4/r32/esp - 3280 # setup - 3281 (clear-stream _test-input-stream) - 3282 (clear-stream $_test-input-buffered-file->buffer) - 3283 (clear-stream _test-output-stream) - 3284 (clear-stream $_test-output-buffered-file->buffer) - 3285 # - 3286 (write _test-input-stream "fn f {\n") - 3287 (write _test-input-stream " var a: t\n") - 3288 (write _test-input-stream " var b/eax: (addr t) <- address a\n") - 3289 (write _test-input-stream " foo b\n") - 3290 (write _test-input-stream "}\n") - 3291 (write _test-input-stream "fn foo x: (addr t) {\n") - 3292 (write _test-input-stream " var x/ecx: (addr int) <- copy x\n") - 3293 (write _test-input-stream " increment *x\n") - 3294 (write _test-input-stream "}\n") - 3295 (write _test-input-stream "type t {\n") - 3296 (write _test-input-stream " x: int\n") - 3297 (write _test-input-stream " y: int\n") - 3298 (write _test-input-stream "}\n") - 3299 # convert - 3300 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3301 (flush _test-output-buffered-file) - 3302 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3308 # check output - 3309 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/0") - 3310 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/1") - 3311 (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") - 3312 (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") - 3313 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/4") - 3314 (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") - 3315 # var a: t - 3316 (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") - 3317 (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") - 3318 # var b/eax: (addr t) - 3319 (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") - 3320 (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") - 3321 # foo a - 3322 (check-next-stream-line-equal _test-output-stream " (foo %eax)" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/10") - 3323 # - 3324 (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") - 3325 (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") - 3326 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/13") - 3327 (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") - 3328 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/15") - 3329 (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") - 3330 (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") - 3331 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/18") - 3332 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/19") - 3333 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/20") - 3334 (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") - 3335 (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") - 3336 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/23") - 3337 (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") - 3338 (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") - 3339 (check-next-stream-line-equal _test-output-stream " 89/<- %ecx 0x00000001/r32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/26") - 3340 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/27") - 3341 (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/28") - 3342 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/29") - 3343 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/30") - 3344 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/31") - 3345 (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/32") - 3346 (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/33") - 3347 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/34") - 3348 # . epilogue - 3349 89/<- %esp 5/r32/ebp - 3350 5d/pop-to-ebp - 3351 c3/return - 3352 - 3353 test-convert-get-on-local-variable: - 3354 # . prologue - 3355 55/push-ebp - 3356 89/<- %ebp 4/r32/esp - 3357 # setup - 3358 (clear-stream _test-input-stream) - 3359 (clear-stream $_test-input-buffered-file->buffer) - 3360 (clear-stream _test-output-stream) - 3361 (clear-stream $_test-output-buffered-file->buffer) - 3362 # - 3363 (write _test-input-stream "fn foo {\n") - 3364 (write _test-input-stream " var a: t\n") - 3365 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 3366 (write _test-input-stream "}\n") - 3367 (write _test-input-stream "type t {\n") - 3368 (write _test-input-stream " x: int\n") - 3369 (write _test-input-stream " y: int\n") - 3370 (write _test-input-stream "}\n") - 3371 # convert - 3372 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3373 (flush _test-output-buffered-file) - 3374 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3380 # check output - 3381 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-local-variable/0") - 3382 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-local-variable/1") - 3383 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-local-variable/2") - 3384 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-local-variable/3") - 3385 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-local-variable/4") - 3386 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-local-variable/5") - 3387 # var a - 3388 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/6") - 3389 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/7") - 3390 # var c - 3391 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-local-variable/8") - 3392 # get - 3393 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000001/r32" "F - test-convert-get-on-local-variable/9") - 3394 # reclaim c - 3395 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-local-variable/10") - 3396 # reclaim a - 3397 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-get-on-local-variable/11") - 3398 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-local-variable/12") - 3399 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-local-variable/13") - 3400 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-local-variable/14") - 3401 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-local-variable/15") - 3402 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-local-variable/16") - 3403 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-local-variable/17") - 3404 # . epilogue - 3405 89/<- %esp 5/r32/ebp - 3406 5d/pop-to-ebp - 3407 c3/return - 3408 - 3409 test-convert-get-on-function-argument: - 3410 # . prologue - 3411 55/push-ebp - 3412 89/<- %ebp 4/r32/esp - 3413 # setup - 3414 (clear-stream _test-input-stream) - 3415 (clear-stream $_test-input-buffered-file->buffer) - 3416 (clear-stream _test-output-stream) - 3417 (clear-stream $_test-output-buffered-file->buffer) - 3418 # - 3419 (write _test-input-stream "fn foo a: t {\n") - 3420 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 3421 (write _test-input-stream "}\n") - 3422 (write _test-input-stream "type t {\n") - 3423 (write _test-input-stream " x: int\n") - 3424 (write _test-input-stream " y: int\n") - 3425 (write _test-input-stream "}\n") - 3426 # convert - 3427 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3428 (flush _test-output-buffered-file) - 3429 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3435 # check output - 3436 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument/0") - 3437 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument/1") - 3438 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument/2") - 3439 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument/3") - 3440 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument/4") - 3441 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument/5") - 3442 # var c - 3443 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument/6") - 3444 # get - 3445 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0x0000000c) 0x00000001/r32" "F - test-convert-get-on-function-argument/7") - 3446 # reclaim c - 3447 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument/8") - 3448 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument/9") - 3449 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument/10") - 3450 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument/11") - 3451 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument/12") - 3452 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument/13") - 3453 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument/14") - 3454 # . epilogue - 3455 89/<- %esp 5/r32/ebp - 3456 5d/pop-to-ebp - 3457 c3/return - 3458 - 3459 test-convert-get-on-function-argument-with-known-type: - 3460 # . prologue - 3461 55/push-ebp - 3462 89/<- %ebp 4/r32/esp - 3463 # setup - 3464 (clear-stream _test-input-stream) - 3465 (clear-stream $_test-input-buffered-file->buffer) - 3466 (clear-stream _test-output-stream) - 3467 (clear-stream $_test-output-buffered-file->buffer) - 3468 # - 3469 (write _test-input-stream "type t {\n") - 3470 (write _test-input-stream " x: int\n") - 3471 (write _test-input-stream " y: int\n") - 3472 (write _test-input-stream "}\n") - 3473 (write _test-input-stream "fn foo a: t {\n") - 3474 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 3475 (write _test-input-stream "}\n") - 3476 # convert - 3477 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3478 (flush _test-output-buffered-file) - 3479 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3485 # check output - 3486 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument-with-known-type/0") - 3487 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument-with-known-type/1") - 3488 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument-with-known-type/2") - 3489 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument-with-known-type/3") - 3490 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument-with-known-type/4") - 3491 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument-with-known-type/5") - 3492 # var c - 3493 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument-with-known-type/6") - 3494 # get - 3495 (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") - 3496 # reclaim c - 3497 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument-with-known-type/8") - 3498 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument-with-known-type/9") - 3499 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument-with-known-type/10") - 3500 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument-with-known-type/11") - 3501 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument-with-known-type/12") - 3502 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument-with-known-type/13") - 3503 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument-with-known-type/14") - 3504 # . epilogue - 3505 89/<- %esp 5/r32/ebp - 3506 5d/pop-to-ebp - 3507 c3/return - 3508 - 3509 test-convert-array-of-user-defined-types: - 3510 # . prologue - 3511 55/push-ebp - 3512 89/<- %ebp 4/r32/esp - 3513 # setup - 3514 (clear-stream _test-input-stream) - 3515 (clear-stream $_test-input-buffered-file->buffer) - 3516 (clear-stream _test-output-stream) - 3517 (clear-stream $_test-output-buffered-file->buffer) - 3518 # - 3519 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 - 3520 (write _test-input-stream " x: int\n") - 3521 (write _test-input-stream " y: int\n") - 3522 (write _test-input-stream "}\n") - 3523 (write _test-input-stream "fn foo {\n") - 3524 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 3525 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 3526 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") - 3527 (write _test-input-stream "}\n") - 3528 # convert - 3529 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3530 (flush _test-output-buffered-file) - 3531 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3537 # check output - 3538 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-array-of-user-defined-types/0") - 3539 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-array-of-user-defined-types/1") - 3540 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-array-of-user-defined-types/2") - 3541 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-array-of-user-defined-types/3") - 3542 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-array-of-user-defined-types/4") - 3543 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-array-of-user-defined-types/5") - 3544 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-array-of-user-defined-types/6") - 3545 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-array-of-user-defined-types/7") - 3546 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-array-of-user-defined-types/8") - 3547 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-array-of-user-defined-types/9") - 3548 (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") - 3549 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-array-of-user-defined-types/13") - 3550 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-array-of-user-defined-types/14") - 3551 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-array-of-user-defined-types/15") - 3552 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-array-of-user-defined-types/16") - 3553 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-array-of-user-defined-types/17") - 3554 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-array-of-user-defined-types/18") - 3555 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-array-of-user-defined-types/19") - 3556 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-array-of-user-defined-types/20") - 3557 # . epilogue - 3558 89/<- %esp 5/r32/ebp - 3559 5d/pop-to-ebp - 3560 c3/return - 3561 - 3562 test-convert-length-of-array-of-user-defined-types-to-eax: - 3563 # . prologue - 3564 55/push-ebp - 3565 89/<- %ebp 4/r32/esp - 3566 # setup - 3567 (clear-stream _test-input-stream) - 3568 (clear-stream $_test-input-buffered-file->buffer) - 3569 (clear-stream _test-output-stream) - 3570 (clear-stream $_test-output-buffered-file->buffer) - 3571 # - 3572 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 - 3573 (write _test-input-stream " x: int\n") - 3574 (write _test-input-stream " y: int\n") - 3575 (write _test-input-stream " z: int\n") - 3576 (write _test-input-stream "}\n") - 3577 (write _test-input-stream "fn foo {\n") - 3578 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 3579 (write _test-input-stream " var x/eax: (addr t) <- length arr\n") - 3580 (write _test-input-stream "}\n") - 3581 # convert - 3582 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3583 (flush _test-output-buffered-file) - 3584 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3590 # check output - 3591 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/0") - 3592 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/1") - 3593 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/2") - 3594 (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") - 3595 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-eax/4") - 3596 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/5") - 3597 # var arr - 3598 (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") - 3599 (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") - 3600 # length instruction - 3601 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/8") - 3602 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/9") - 3603 (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") - 3604 (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") - 3605 (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") - 3606 (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") - 3607 (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") - 3608 (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") - 3609 # reclaim arr - 3610 (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") - 3611 # - 3612 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-eax/17") - 3613 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/18") - 3614 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/19") - 3615 (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") - 3616 (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") - 3617 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-eax/22") - 3618 # . epilogue - 3619 89/<- %esp 5/r32/ebp - 3620 5d/pop-to-ebp - 3621 c3/return - 3622 - 3623 test-convert-length-of-array-of-user-defined-types-to-ecx: - 3624 # . prologue - 3625 55/push-ebp - 3626 89/<- %ebp 4/r32/esp - 3627 # setup - 3628 (clear-stream _test-input-stream) - 3629 (clear-stream $_test-input-buffered-file->buffer) - 3630 (clear-stream _test-output-stream) - 3631 (clear-stream $_test-output-buffered-file->buffer) - 3632 # - 3633 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 - 3634 (write _test-input-stream " x: int\n") - 3635 (write _test-input-stream " y: int\n") - 3636 (write _test-input-stream " z: int\n") - 3637 (write _test-input-stream "}\n") - 3638 (write _test-input-stream "fn foo {\n") - 3639 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 3640 (write _test-input-stream " var x/ecx: (addr t) <- length arr\n") - 3641 (write _test-input-stream "}\n") - 3642 # convert - 3643 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3644 (flush _test-output-buffered-file) - 3645 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3651 # check output - 3652 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/0") - 3653 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/1") - 3654 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/2") - 3655 (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") - 3656 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/4") - 3657 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/5") - 3658 # var a - 3659 (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") - 3660 (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") - 3661 # var x - 3662 (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") - 3663 # length instruction - 3664 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/9") - 3665 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/10") - 3666 (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") - 3667 (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") - 3668 (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") - 3669 (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") - 3670 (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") - 3671 (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") - 3672 (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") - 3673 # reclaim x - 3674 (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") - 3675 # reclaim a - 3676 (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") - 3677 # - 3678 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/20") - 3679 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/21") - 3680 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/22") - 3681 (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") - 3682 (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") - 3683 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/25") - 3684 # . epilogue - 3685 89/<- %esp 5/r32/ebp - 3686 5d/pop-to-ebp - 3687 c3/return - 3688 - 3689 test-convert-length-of-array-of-user-defined-types-to-edx: - 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 "type t {\n") # size = 12, which is not a power of 2 - 3700 (write _test-input-stream " x: int\n") - 3701 (write _test-input-stream " y: int\n") - 3702 (write _test-input-stream " z: int\n") - 3703 (write _test-input-stream "}\n") - 3704 (write _test-input-stream "fn foo {\n") - 3705 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 3706 (write _test-input-stream " var x/edx: (addr t) <- length arr\n") - 3707 (write _test-input-stream "}\n") - 3708 # convert - 3709 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3710 (flush _test-output-buffered-file) - 3711 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3717 # check output - 3718 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/0") - 3719 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/1") - 3720 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/2") - 3721 (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") - 3722 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-edx/4") - 3723 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/5") - 3724 # var a - 3725 (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") - 3726 (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") - 3727 # var x - 3728 (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") - 3729 # length instruction - 3730 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/9") - 3731 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/10") - 3732 (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") - 3733 (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") - 3734 (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") - 3735 (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") - 3736 (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") - 3737 (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") - 3738 (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") - 3739 # reclaim x - 3740 (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") - 3741 # reclaim a - 3742 (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") - 3743 # - 3744 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-edx/20") - 3745 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/21") - 3746 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/22") - 3747 (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") - 3748 (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") - 3749 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-edx/25") - 3750 # . epilogue - 3751 89/<- %esp 5/r32/ebp - 3752 5d/pop-to-ebp - 3753 c3/return - 3754 - 3755 test-convert-length-of-array-of-user-defined-types: - 3756 # . prologue - 3757 55/push-ebp - 3758 89/<- %ebp 4/r32/esp - 3759 # setup - 3760 (clear-stream _test-input-stream) - 3761 (clear-stream $_test-input-buffered-file->buffer) - 3762 (clear-stream _test-output-stream) - 3763 (clear-stream $_test-output-buffered-file->buffer) - 3764 # - 3765 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 - 3766 (write _test-input-stream " x: int\n") - 3767 (write _test-input-stream " y: int\n") - 3768 (write _test-input-stream " z: int\n") - 3769 (write _test-input-stream "}\n") - 3770 (write _test-input-stream "fn foo {\n") - 3771 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 3772 (write _test-input-stream " var x/ebx: (addr t) <- length arr\n") - 3773 (write _test-input-stream "}\n") - 3774 # convert - 3775 (convert-mu _test-input-buffered-file _test-output-buffered-file) - 3776 (flush _test-output-buffered-file) - 3777 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3783 # check output - 3784 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types/0") - 3785 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types/1") - 3786 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types/2") - 3787 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types/3") - 3788 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types/4") - 3789 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types/5") - 3790 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types/6") - 3791 (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") - 3792 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-length-of-array-of-user-defined-types/8") - 3793 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types/9") - 3794 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types/10") - 3795 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types/11") - 3796 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types/12") - 3797 (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") - 3798 (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") - 3799 (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") - 3800 (check-next-stream-line-equal _test-output-stream " 89/<- %ebx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types/16") - 3801 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types/17") - 3802 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types/18") - 3803 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types/19") - 3804 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ebx" "F - test-convert-length-of-array-of-user-defined-types/20") - 3805 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types/21") - 3806 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types/22") - 3807 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types/23") - 3808 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types/24") - 3809 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types/25") - 3810 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types/26") - 3811 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types/27") - 3812 # . epilogue - 3813 89/<- %esp 5/r32/ebp - 3814 5d/pop-to-ebp - 3815 c3/return - 3816 - 3817 ####################################################### - 3818 # Parsing - 3819 ####################################################### - 3820 - 3821 parse-mu: # in: (addr buffered-file) - 3822 # pseudocode - 3823 # var curr-function: (addr handle function) = Program->functions - 3824 # var curr-type: (addr handle typeinfo) = Program->types - 3825 # var line: (stream byte 512) - 3826 # var word-slice: slice - 3827 # while true # line loop - 3828 # clear-stream(line) - 3829 # read-line-buffered(in, line) - 3830 # if (line->write == 0) break # end of file - 3831 # word-slice = next-mu-token(line) - 3832 # if slice-empty?(word-slice) # end of line - 3833 # continue - 3834 # else if slice-starts-with?(word-slice, "#") # comment - 3835 # continue # end of line - 3836 # else if slice-equal?(word-slice, "fn") - 3837 # var new-function: (handle function) = allocate(function) - 3838 # var vars: (stack live-var 256) - 3839 # populate-mu-function-header(line, new-function, vars) - 3840 # populate-mu-function-body(in, new-function, vars) - 3841 # assert(vars->top == 0) - 3842 # *curr-function = new-function - 3843 # curr-function = &new-function->next - 3844 # else if slice-equal?(word-slice, "type") - 3845 # word-slice = next-mu-token(line) - 3846 # type-id = pos-or-insert-slice(Type-id, word-slice) - 3847 # var new-type: (handle typeinfo) = find-or-create-typeinfo(type-id) - 3848 # assert(next-word(line) == "{") - 3849 # populate-mu-type(in, new-type) - 3850 # else - 3851 # abort() - 3852 # - 3853 # . prologue - 3854 55/push-ebp - 3855 89/<- %ebp 4/r32/esp - 3856 # . save registers - 3857 50/push-eax - 3858 51/push-ecx - 3859 52/push-edx - 3860 53/push-ebx - 3861 56/push-esi - 3862 57/push-edi - 3863 # var line/ecx: (stream byte 512) - 3864 81 5/subop/subtract %esp 0x200/imm32 - 3865 68/push 0x200/imm32/size - 3866 68/push 0/imm32/read - 3867 68/push 0/imm32/write - 3868 89/<- %ecx 4/r32/esp - 3869 # var word-slice/edx: slice - 3870 68/push 0/imm32/end - 3871 68/push 0/imm32/start - 3872 89/<- %edx 4/r32/esp - 3873 # var curr-function/edi: (addr handle function) - 3874 bf/copy-to-edi _Program-functions/imm32 - 3875 # var vars/ebx: (stack live-var 256) - 3876 81 5/subop/subtract %esp 0xc00/imm32 - 3877 68/push 0xc00/imm32/size - 3878 68/push 0/imm32/top - 3879 89/<- %ebx 4/r32/esp - 3880 { - 3881 $parse-mu:line-loop: - 3882 (clear-stream %ecx) - 3883 (read-line-buffered *(ebp+8) %ecx) - 3884 # if (line->write == 0) break - 3885 81 7/subop/compare *ecx 0/imm32 - 3886 0f 84/jump-if-= break/disp32 - 3887 +-- 6 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3893 (next-mu-token %ecx %edx) - 3894 # if slice-empty?(word-slice) continue - 3895 (slice-empty? %edx) # => eax - 3896 3d/compare-eax-and 0/imm32/false - 3897 0f 85/jump-if-!= loop/disp32 - 3898 # if (*word-slice->start == "#") continue - 3899 # . eax = *word-slice->start - 3900 8b/-> *edx 0/r32/eax - 3901 8a/copy-byte *eax 0/r32/AL - 3902 81 4/subop/and %eax 0xff/imm32 - 3903 # . if (eax == '#') continue - 3904 3d/compare-eax-and 0x23/imm32/hash - 3905 0f 84/jump-if-= loop/disp32 - 3906 # if (slice-equal?(word-slice, "fn")) parse a function - 3907 { - 3908 $parse-mu:fn: - 3909 (slice-equal? %edx "fn") # => eax - 3910 3d/compare-eax-and 0/imm32/false - 3911 0f 84/jump-if-= break/disp32 - 3912 # var new-function/esi: (handle function) - 3913 68/push 0/imm32 - 3914 68/push 0/imm32 - 3915 89/<- %esi 4/r32/esp - 3916 # populate-mu-function(line, in, vars, new-function) - 3917 (allocate Heap *Function-size %esi) - 3918 # var new-function-addr/eax: (addr function) - 3919 (lookup *esi *(esi+4)) # => eax - 3920 (clear-stack %ebx) - 3921 (populate-mu-function-header %ecx %eax %ebx) - 3922 (populate-mu-function-body *(ebp+8) %eax %ebx) - 3923 # *curr-function = new-function - 3924 8b/-> *esi 0/r32/eax - 3925 89/<- *edi 0/r32/eax - 3926 8b/-> *(esi+4) 0/r32/eax - 3927 89/<- *(edi+4) 0/r32/eax - 3928 # curr-function = &new-function->next - 3929 # . var tmp/eax: (addr function) = lookup(new-function) - 3930 (lookup *esi *(esi+4)) # => eax - 3931 # . curr-function = &tmp->next - 3932 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next - 3933 # reclaim new-function - 3934 81 0/subop/add %esp 8/imm32 - 3935 # - 3936 e9/jump $parse-mu:line-loop/disp32 - 3937 } - 3938 # if (slice-equal?(word-slice, "type")) parse a type (struct/record) definition - 3939 { - 3940 $parse-mu:type: - 3941 (slice-equal? %edx "type") # => eax - 3942 3d/compare-eax-and 0/imm32 - 3943 0f 84/jump-if-= break/disp32 - 3944 (next-mu-token %ecx %edx) - 3945 # var type-id/eax: int - 3946 (pos-or-insert-slice Type-id %edx) # => eax - 3947 # spill - 3948 51/push-ecx - 3949 # var new-type/ecx: (handle typeinfo) - 3950 68/push 0/imm32 - 3951 68/push 0/imm32 - 3952 89/<- %ecx 4/r32/esp - 3953 (find-or-create-typeinfo %eax %ecx) - 3954 # - 3955 (lookup *ecx *(ecx+4)) # => eax - 3956 # TODO: ensure that 'line' has nothing else but '{' - 3957 #? (dump-typeinfos "=== aaa\n") - 3958 (populate-mu-type *(ebp+8) %eax) # => eax - 3959 #? (dump-typeinfos "=== zzz\n") - 3960 # reclaim new-type - 3961 81 0/subop/add %esp 8/imm32 - 3962 # restore - 3963 59/pop-to-ecx - 3964 e9/jump $parse-mu:line-loop/disp32 - 3965 } - 3966 # otherwise abort - 3967 e9/jump $parse-mu:error1/disp32 - 3968 } # end line loop - 3969 $parse-mu:end: - 3970 # . reclaim locals - 3971 81 0/subop/add %esp 0xe1c/imm32 - 3972 # . restore registers - 3973 5f/pop-to-edi - 3974 5e/pop-to-esi - 3975 5b/pop-to-ebx - 3976 5a/pop-to-edx - 3977 59/pop-to-ecx - 3978 58/pop-to-eax - 3979 # . epilogue - 3980 89/<- %esp 5/r32/ebp - 3981 5d/pop-to-ebp - 3982 c3/return - 3983 - 3984 $parse-mu:error1: - 3985 # error("unexpected top-level command: " word-slice "\n") - 3986 (write-buffered Stderr "unexpected top-level command: ") - 3987 (write-slice-buffered Stderr %edx) - 3988 (write-buffered Stderr "\n") - 3989 (flush Stderr) - 3990 # . syscall(exit, 1) - 3991 bb/copy-to-ebx 1/imm32 - 3992 b8/copy-to-eax 1/imm32/exit - 3993 cd/syscall 0x80/imm8 - 3994 # never gets here - 3995 - 3996 $parse-mu:error2: - 3997 # error(vars->top " vars not reclaimed after fn '" new-function->name "'\n") - 3998 (print-int32-buffered Stderr *ebx) - 3999 (write-buffered Stderr " vars not reclaimed after fn '") - 4000 (write-slice-buffered Stderr *eax) # Function-name - 4001 (write-buffered Stderr "'\n") - 4002 (flush Stderr) - 4003 # . syscall(exit, 1) - 4004 bb/copy-to-ebx 1/imm32 - 4005 b8/copy-to-eax 1/imm32/exit - 4006 cd/syscall 0x80/imm8 - 4007 # never gets here - 4008 - 4009 # scenarios considered: - 4010 # ✗ fn foo # no block - 4011 # ✓ fn foo { - 4012 # ✗ fn foo { { - 4013 # ✗ fn foo { } - 4014 # ✗ fn foo { } { - 4015 # ✗ fn foo x { - 4016 # ✗ fn foo x: { - 4017 # ✓ fn foo x: int { - 4018 # ✓ fn foo x: int { - 4019 # ✓ fn foo x: int -> y/eax: int { - 4020 populate-mu-function-header: # first-line: (addr stream byte), out: (addr function), vars: (addr stack live-var) - 4021 # pseudocode: - 4022 # var name: slice - 4023 # next-mu-token(first-line, name) - 4024 # assert(name not in '{' '}' '->') - 4025 # out->name = slice-to-string(name) - 4026 # ## inouts - 4027 # while true - 4028 # ## name - 4029 # name = next-mu-token(first-line) - 4030 # if (name == '{') goto done - 4031 # if (name == '->') break - 4032 # assert(name != '}') - 4033 # var v: (handle var) = parse-var-with-type(name, first-line) - 4034 # assert(v->register == null) - 4035 # # v->block-depth is implicitly 0 - 4036 # out->inouts = append(v, out->inouts) - 4037 # push(vars, {v, false}) - 4038 # ## outputs - 4039 # while true - 4040 # ## name - 4041 # name = next-mu-token(first-line) - 4042 # assert(name not in '{' '}' '->') - 4043 # var v: (handle var) = parse-var-with-type(name, first-line) - 4044 # assert(v->register != null) - 4045 # out->outputs = append(v, out->outputs) - 4046 # done: - 4047 # - 4048 # . prologue - 4049 55/push-ebp - 4050 89/<- %ebp 4/r32/esp - 4051 # . save registers - 4052 50/push-eax - 4053 51/push-ecx - 4054 52/push-edx - 4055 53/push-ebx - 4056 57/push-edi - 4057 # edi = out - 4058 8b/-> *(ebp+0xc) 7/r32/edi - 4059 # var word-slice/ecx: slice - 4060 68/push 0/imm32/end - 4061 68/push 0/imm32/start - 4062 89/<- %ecx 4/r32/esp - 4063 # var v/ebx: (handle var) - 4064 68/push 0/imm32 - 4065 68/push 0/imm32 - 4066 89/<- %ebx 4/r32/esp - 4067 # read function name - 4068 (next-mu-token *(ebp+8) %ecx) - 4069 # error checking - 4070 # TODO: error if name starts with 'break' or 'loop' - 4071 # if (word-slice == '{') abort - 4072 (slice-equal? %ecx "{") # => eax - 4073 3d/compare-eax-and 0/imm32/false - 4074 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 - 4075 # if (word-slice == '->') abort - 4076 (slice-equal? %ecx "->") # => eax - 4077 3d/compare-eax-and 0/imm32/false - 4078 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 - 4079 # if (word-slice == '}') abort - 4080 (slice-equal? %ecx "}") # => eax - 4081 3d/compare-eax-and 0/imm32/false - 4082 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 - 4083 # save function name - 4084 (slice-to-string Heap %ecx %edi) # Function-name - 4085 # save function inouts - 4086 { - 4087 $populate-mu-function-header:check-for-inout: - 4088 (next-mu-token *(ebp+8) %ecx) - 4089 # if (word-slice == '{') goto done - 4090 (slice-equal? %ecx "{") # => eax - 4091 3d/compare-eax-and 0/imm32/false - 4092 0f 85/jump-if-!= $populate-mu-function-header:done/disp32 - 4093 # if (word-slice == '->') break - 4094 (slice-equal? %ecx "->") # => eax - 4095 3d/compare-eax-and 0/imm32/false - 4096 0f 85/jump-if-!= break/disp32 - 4097 # if (word-slice == '}') abort - 4098 (slice-equal? %ecx "}") # => eax - 4099 3d/compare-eax-and 0/imm32/false - 4100 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 - 4101 # v = parse-var-with-type(word-slice, first-line) - 4102 (parse-var-with-type %ecx *(ebp+8) %ebx) - 4103 # assert(v->register == null) - 4104 # . eax: (addr var) = lookup(v) - 4105 (lookup *ebx *(ebx+4)) # => eax - 4106 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register - 4107 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32 - 4108 # v->block-depth is implicitly 0 - 4109 # - 4110 # out->inouts = append(v, out->inouts) - 4111 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts - 4112 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts - 4113 # push(vars, {v, false}) - 4114 (push *(ebp+0x10) *ebx) - 4115 (push *(ebp+0x10) *(ebx+4)) - 4116 (push *(ebp+0x10) 0) # false - 4117 # - 4118 e9/jump loop/disp32 - 4119 } - 4120 # save function outputs + 864 # convert + 865 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 866 (flush _test-output-buffered-file) + 867 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 873 # check output + 874 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0") + 875 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1") + 876 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2") + 877 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3") + 878 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4") + 879 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-literal-arg/5") + 880 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/6") + 881 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/7") + 882 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-literal-arg/8") + 883 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/9") + 884 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/10") + 885 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/11") + 886 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/12") + 887 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/13") + 888 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/14") + 889 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/15") + 890 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/16") + 891 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/17") + 892 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:loop:" "F - test-convert-function-call-with-literal-arg/18") + 893 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/19") + 894 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/20") + 895 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/21") + 896 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:break:" "F - test-convert-function-call-with-literal-arg/22") + 897 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/23") + 898 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/24") + 899 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/25") + 900 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/26") + 901 # . epilogue + 902 89/<- %esp 5/r32/ebp + 903 5d/pop-to-ebp + 904 c3/return + 905 + 906 test-convert-function-with-local-var-in-mem: + 907 # . prologue + 908 55/push-ebp + 909 89/<- %ebp 4/r32/esp + 910 # setup + 911 (clear-stream _test-input-stream) + 912 (clear-stream $_test-input-buffered-file->buffer) + 913 (clear-stream _test-output-stream) + 914 (clear-stream $_test-output-buffered-file->buffer) + 915 # + 916 (write _test-input-stream "fn foo {\n") + 917 (write _test-input-stream " var x: int\n") + 918 (write _test-input-stream " increment x\n") + 919 (write _test-input-stream "}\n") + 920 # convert + 921 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 922 (flush _test-output-buffered-file) + 923 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 929 # check output + 930 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0") + 931 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1") + 932 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2") + 933 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3") + 934 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4") + 935 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem/5") + 936 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/6") + 937 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/7") + 938 (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") + 939 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/9") + 940 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem/10") + 941 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/11") + 942 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/12") + 943 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/13") + 944 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/14") + 945 # . epilogue + 946 89/<- %esp 5/r32/ebp + 947 5d/pop-to-ebp + 948 c3/return + 949 + 950 test-local-var-in-mem-has-no-initializer: + 951 # . prologue + 952 55/push-ebp + 953 89/<- %ebp 4/r32/esp + 954 # setup + 955 (clear-stream _test-input-stream) + 956 (clear-stream $_test-input-buffered-file->buffer) + 957 (clear-stream _test-output-stream) + 958 (clear-stream $_test-output-buffered-file->buffer) + 959 (clear-stream _test-error-stream) + 960 (clear-stream $_test-error-buffered-file->buffer) + 961 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 962 68/push 0/imm32 + 963 68/push 0/imm32 + 964 89/<- %edx 4/r32/esp + 965 (tailor-exit-descriptor %edx 0x10) + 966 # + 967 (write _test-input-stream "fn foo {\n") + 968 (write _test-input-stream " var x: int <- copy 0\n") + 969 (write _test-input-stream " increment x\n") + 970 (write _test-input-stream "}\n") + 971 # convert + 972 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 973 # registers except esp clobbered at this point + 974 # restore ed + 975 89/<- %edx 4/r32/esp + 976 (flush _test-output-buffered-file) + 977 (flush _test-error-buffered-file) + 978 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 984 # check output + 985 (check-stream-equal _test-output-stream "" "F - test-var-in-mem-has-no-initializer: output should be empty") + 986 (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") + 987 # check that stop(1) was called + 988 (check-ints-equal *(edx+4) 2 "F - test-var-in-mem-has-no-initializer: exit status") + 989 # don't restore from ebp + 990 81 0/subop/add %esp 8/imm32 + 991 # . epilogue + 992 5d/pop-to-ebp + 993 c3/return + 994 + 995 test-convert-function-with-local-var-with-compound-type-in-mem: + 996 # . prologue + 997 55/push-ebp + 998 89/<- %ebp 4/r32/esp + 999 # setup + 1000 (clear-stream _test-input-stream) + 1001 (clear-stream $_test-input-buffered-file->buffer) + 1002 (clear-stream _test-output-stream) + 1003 (clear-stream $_test-output-buffered-file->buffer) + 1004 # + 1005 (write _test-input-stream "fn foo {\n") + 1006 (write _test-input-stream " var x: (addr int)\n") + 1007 (write _test-input-stream " copy-to x, 0\n") + 1008 (write _test-input-stream "}\n") + 1009 # convert + 1010 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1011 (flush _test-output-buffered-file) + 1012 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1018 # check output + 1019 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/0") + 1020 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/1") + 1021 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/2") + 1022 (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") + 1023 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-compound-type-in-mem/4") + 1024 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/5") + 1025 (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") + 1026 (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") + 1027 (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") + 1028 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-compound-type-in-mem/9") + 1029 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/10") + 1030 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/11") + 1031 (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") + 1032 (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") + 1033 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-compound-type-in-mem/14") + 1034 # . epilogue + 1035 89/<- %esp 5/r32/ebp + 1036 5d/pop-to-ebp + 1037 c3/return + 1038 + 1039 test-convert-function-with-local-var-in-reg: + 1040 # . prologue + 1041 55/push-ebp + 1042 89/<- %ebp 4/r32/esp + 1043 # setup + 1044 (clear-stream _test-input-stream) + 1045 (clear-stream $_test-input-buffered-file->buffer) + 1046 (clear-stream _test-output-stream) + 1047 (clear-stream $_test-output-buffered-file->buffer) + 1048 # + 1049 (write _test-input-stream "fn foo {\n") + 1050 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 1051 (write _test-input-stream " x <- increment\n") + 1052 (write _test-input-stream "}\n") + 1053 # convert + 1054 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1055 (flush _test-output-buffered-file) + 1056 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1062 # check output + 1063 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0") + 1064 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1") + 1065 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2") + 1066 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3") + 1067 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4") + 1068 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-reg/5") + 1069 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/6") + 1070 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/7") + 1071 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/8") + 1072 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/9") + 1073 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/10") + 1074 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-reg/11") + 1075 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/12") + 1076 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/13") + 1077 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/14") + 1078 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/15") + 1079 # . epilogue + 1080 89/<- %esp 5/r32/ebp + 1081 5d/pop-to-ebp + 1082 c3/return + 1083 + 1084 test-convert-function-with-second-local-var-in-same-reg: + 1085 # . prologue + 1086 55/push-ebp + 1087 89/<- %ebp 4/r32/esp + 1088 # setup + 1089 (clear-stream _test-input-stream) + 1090 (clear-stream $_test-input-buffered-file->buffer) + 1091 (clear-stream _test-output-stream) + 1092 (clear-stream $_test-output-buffered-file->buffer) + 1093 # + 1094 (write _test-input-stream "fn foo {\n") + 1095 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 1096 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 1097 (write _test-input-stream " y <- increment\n") + 1098 (write _test-input-stream "}\n") + 1099 # convert + 1100 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1101 (flush _test-output-buffered-file) + 1102 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1108 # check output + 1109 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-second-local-var-in-same-reg/0") + 1110 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-second-local-var-in-same-reg/1") + 1111 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/2") + 1112 (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") + 1113 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-second-local-var-in-same-reg/4") + 1114 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-second-local-var-in-same-reg/5") + 1115 (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") + 1116 (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") + 1117 (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") + 1118 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-second-local-var-in-same-reg/9") + 1119 (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") + 1120 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-second-local-var-in-same-reg/11") + 1121 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-second-local-var-in-same-reg/12") + 1122 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-second-local-var-in-same-reg/13") + 1123 (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") + 1124 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/15") + 1125 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-second-local-var-in-same-reg/16") + 1126 # . epilogue + 1127 89/<- %esp 5/r32/ebp + 1128 5d/pop-to-ebp + 1129 c3/return + 1130 + 1131 test-convert-function-with-local-var-dereferenced: + 1132 # . prologue + 1133 55/push-ebp + 1134 89/<- %ebp 4/r32/esp + 1135 # setup + 1136 (clear-stream _test-input-stream) + 1137 (clear-stream $_test-input-buffered-file->buffer) + 1138 (clear-stream _test-output-stream) + 1139 (clear-stream $_test-output-buffered-file->buffer) + 1140 # + 1141 (write _test-input-stream "fn foo {\n") + 1142 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n") + 1143 (write _test-input-stream " increment *x\n") + 1144 (write _test-input-stream "}\n") + 1145 # convert + 1146 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1147 (flush _test-output-buffered-file) + 1148 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1154 # check output + 1155 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0") + 1156 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1") + 1157 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2") + 1158 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3") + 1159 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4") + 1160 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5") + 1161 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6") + 1162 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7") + 1163 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8") + 1164 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9") + 1165 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10") + 1166 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11") + 1167 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12") + 1168 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13") + 1169 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14") + 1170 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15") + 1171 # . epilogue + 1172 89/<- %esp 5/r32/ebp + 1173 5d/pop-to-ebp + 1174 c3/return + 1175 + 1176 test-convert-compare-register-with-literal: + 1177 # . prologue + 1178 55/push-ebp + 1179 89/<- %ebp 4/r32/esp + 1180 # setup + 1181 (clear-stream _test-input-stream) + 1182 (clear-stream $_test-input-buffered-file->buffer) + 1183 (clear-stream _test-output-stream) + 1184 (clear-stream $_test-output-buffered-file->buffer) + 1185 # + 1186 (write _test-input-stream "fn foo {\n") + 1187 (write _test-input-stream " var x/ecx: int <- copy 0\n") + 1188 (write _test-input-stream " compare x, 0\n") + 1189 (write _test-input-stream "}\n") + 1190 # convert + 1191 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1192 (flush _test-output-buffered-file) + 1193 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1199 # check output + 1200 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0") + 1201 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1") + 1202 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2") + 1203 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3") + 1204 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4") + 1205 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5") + 1206 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") + 1207 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7") + 1208 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8") + 1209 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") + 1210 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10") + 1211 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11") + 1212 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12") + 1213 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13") + 1214 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14") + 1215 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15") + 1216 # . epilogue + 1217 89/<- %esp 5/r32/ebp + 1218 5d/pop-to-ebp + 1219 c3/return + 1220 + 1221 test-convert-function-with-local-var-in-block: + 1222 # . prologue + 1223 55/push-ebp + 1224 89/<- %ebp 4/r32/esp + 1225 # setup + 1226 (clear-stream _test-input-stream) + 1227 (clear-stream $_test-input-buffered-file->buffer) + 1228 (clear-stream _test-output-stream) + 1229 (clear-stream $_test-output-buffered-file->buffer) + 1230 # + 1231 (write _test-input-stream "fn foo {\n") + 1232 (write _test-input-stream " {\n") + 1233 (write _test-input-stream " var x: int\n") + 1234 (write _test-input-stream " increment x\n") + 1235 (write _test-input-stream " }\n") + 1236 (write _test-input-stream "}\n") + 1237 # convert + 1238 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1239 (flush _test-output-buffered-file) + 1240 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1246 # check output + 1247 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0") + 1248 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1") + 1249 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2") + 1250 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3") + 1251 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4") + 1252 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5") + 1253 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6") + 1254 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7") + 1255 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8") + 1256 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9") + 1257 (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") + 1258 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11") + 1259 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12") + 1260 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13") + 1261 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14") + 1262 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15") + 1263 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16") + 1264 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17") + 1265 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18") + 1266 # . epilogue + 1267 89/<- %esp 5/r32/ebp + 1268 5d/pop-to-ebp + 1269 c3/return + 1270 + 1271 test-convert-function-with-local-var-in-named-block: + 1272 # . prologue + 1273 55/push-ebp + 1274 89/<- %ebp 4/r32/esp + 1275 # setup + 1276 (clear-stream _test-input-stream) + 1277 (clear-stream $_test-input-buffered-file->buffer) + 1278 (clear-stream _test-output-stream) + 1279 (clear-stream $_test-output-buffered-file->buffer) + 1280 # + 1281 (write _test-input-stream "fn foo {\n") + 1282 (write _test-input-stream " $bar: {\n") + 1283 (write _test-input-stream " var x: int\n") + 1284 (write _test-input-stream " increment x\n") + 1285 (write _test-input-stream " }\n") + 1286 (write _test-input-stream "}\n") + 1287 # convert + 1288 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1289 (flush _test-output-buffered-file) + 1290 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1296 # check output + 1297 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0") + 1298 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1") + 1299 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2") + 1300 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3") + 1301 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4") + 1302 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5") + 1303 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6") + 1304 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7") + 1305 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8") + 1306 (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") + 1307 (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") + 1308 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11") + 1309 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12") + 1310 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13") + 1311 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14") + 1312 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15") + 1313 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16") + 1314 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17") + 1315 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18") + 1316 # . epilogue + 1317 89/<- %esp 5/r32/ebp + 1318 5d/pop-to-ebp + 1319 c3/return + 1320 + 1321 test-always-shadow-outermost-reg-vars-in-function: + 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 # + 1331 (write _test-input-stream "fn foo {\n") + 1332 (write _test-input-stream " var x/ecx: int <- copy 3\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-always-shadow-outermost-reg-vars-in-function/0") + 1345 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-always-shadow-outermost-reg-vars-in-function/1") + 1346 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/2") + 1347 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-always-shadow-outermost-reg-vars-in-function/3") + 1348 (check-next-stream-line-equal _test-output-stream " {" "F - test-always-shadow-outermost-reg-vars-in-function/4") + 1349 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-always-shadow-outermost-reg-vars-in-function/5") + 1350 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") + 1351 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-always-shadow-outermost-reg-vars-in-function/8") + 1352 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") + 1353 (check-next-stream-line-equal _test-output-stream " }" "F - test-always-shadow-outermost-reg-vars-in-function/12") + 1354 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-always-shadow-outermost-reg-vars-in-function/13") + 1355 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-always-shadow-outermost-reg-vars-in-function/14") + 1356 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-always-shadow-outermost-reg-vars-in-function/15") + 1357 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/16") + 1358 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-always-shadow-outermost-reg-vars-in-function/17") + 1359 # . epilogue + 1360 89/<- %esp 5/r32/ebp + 1361 5d/pop-to-ebp + 1362 c3/return + 1363 + 1364 _pending-test-clobber-dead-local: + 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 # + 1374 (write _test-input-stream "fn foo {\n") + 1375 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 1376 (write _test-input-stream " {\n") + 1377 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 1378 (write _test-input-stream " }\n") + 1379 (write _test-input-stream "}\n") + 1380 # convert + 1381 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1382 (flush _test-output-buffered-file) + 1383 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1389 # check output + 1390 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-clobber-dead-local/0") + 1391 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-clobber-dead-local/1") + 1392 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-clobber-dead-local/2") + 1393 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-clobber-dead-local/3") + 1394 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/4") + 1395 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-clobber-dead-local/5") + 1396 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-clobber-dead-local/6") + 1397 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-clobber-dead-local/7") + 1398 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/8") + 1399 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-clobber-dead-local/9") + 1400 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-clobber-dead-local/10") # no push/pop here + 1401 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/11") + 1402 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-clobber-dead-local/12") + 1403 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-clobber-dead-local/13") + 1404 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/14") + 1405 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-clobber-dead-local/15") + 1406 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-clobber-dead-local/16") + 1407 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-clobber-dead-local/17") + 1408 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-clobber-dead-local/18") + 1409 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-clobber-dead-local/19") + 1410 # . epilogue + 1411 89/<- %esp 5/r32/ebp + 1412 5d/pop-to-ebp + 1413 c3/return + 1414 + 1415 test-shadow-live-local: + 1416 # . prologue + 1417 55/push-ebp + 1418 89/<- %ebp 4/r32/esp + 1419 # setup + 1420 (clear-stream _test-input-stream) + 1421 (clear-stream $_test-input-buffered-file->buffer) + 1422 (clear-stream _test-output-stream) + 1423 (clear-stream $_test-output-buffered-file->buffer) + 1424 # + 1425 (write _test-input-stream "fn foo {\n") + 1426 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 1427 (write _test-input-stream " {\n") + 1428 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 1429 (write _test-input-stream " }\n") + 1430 (write _test-input-stream " x <- increment\n") + 1431 (write _test-input-stream "}\n") + 1432 # convert + 1433 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1434 (flush _test-output-buffered-file) + 1435 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1441 # check output + 1442 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-local/0") + 1443 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-local/1") + 1444 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-local/2") + 1445 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-local/3") + 1446 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/4") + 1447 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-local/5") + 1448 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/6") + 1449 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-local/7") + 1450 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/8") + 1451 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-local/9") + 1452 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/10") + 1453 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-local/11") + 1454 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/12") + 1455 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/13") + 1456 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-local/14") + 1457 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-local/15") + 1458 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/16") + 1459 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/17") + 1460 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-local/18") + 1461 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-local/19") + 1462 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-local/20") + 1463 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-local/21") + 1464 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-local/21") + 1465 # . epilogue + 1466 89/<- %esp 5/r32/ebp + 1467 5d/pop-to-ebp + 1468 c3/return + 1469 + 1470 test-do-not-spill-same-register-in-block: + 1471 # . prologue + 1472 55/push-ebp + 1473 89/<- %ebp 4/r32/esp + 1474 # setup + 1475 (clear-stream _test-input-stream) + 1476 (clear-stream $_test-input-buffered-file->buffer) + 1477 (clear-stream _test-output-stream) + 1478 (clear-stream $_test-output-buffered-file->buffer) + 1479 # + 1480 (write _test-input-stream "fn foo {\n") + 1481 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 1482 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 1483 (write _test-input-stream " y <- increment\n") + 1484 (write _test-input-stream "}\n") + 1485 # convert + 1486 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1487 (flush _test-output-buffered-file) + 1488 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1494 # check output + 1495 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-do-not-spill-same-register-in-block/0") + 1496 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-do-not-spill-same-register-in-block/1") + 1497 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-do-not-spill-same-register-in-block/2") + 1498 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-do-not-spill-same-register-in-block/3") + 1499 (check-next-stream-line-equal _test-output-stream " {" "F - test-do-not-spill-same-register-in-block/4") + 1500 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-do-not-spill-same-register-in-block/5") + 1501 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-do-not-spill-same-register-in-block/6") + 1502 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-do-not-spill-same-register-in-block/7") + 1503 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-do-not-spill-same-register-in-block/8") + 1504 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-do-not-spill-same-register-in-block/9") + 1505 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-do-not-spill-same-register-in-block/10") + 1506 (check-next-stream-line-equal _test-output-stream " }" "F - test-do-not-spill-same-register-in-block/11") + 1507 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-do-not-spill-same-register-in-block/12") + 1508 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-do-not-spill-same-register-in-block/13") + 1509 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-do-not-spill-same-register-in-block/14") + 1510 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-do-not-spill-same-register-in-block/15") + 1511 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-do-not-spill-same-register-in-block/16") + 1512 # . epilogue + 1513 89/<- %esp 5/r32/ebp + 1514 5d/pop-to-ebp + 1515 c3/return + 1516 + 1517 test-spill-different-register-in-block: + 1518 # . prologue + 1519 55/push-ebp + 1520 89/<- %ebp 4/r32/esp + 1521 # setup + 1522 (clear-stream _test-input-stream) + 1523 (clear-stream $_test-input-buffered-file->buffer) + 1524 (clear-stream _test-output-stream) + 1525 (clear-stream $_test-output-buffered-file->buffer) + 1526 # + 1527 (write _test-input-stream "fn foo {\n") + 1528 (write _test-input-stream " var x/eax: int <- copy 3\n") + 1529 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 1530 (write _test-input-stream " y <- increment\n") + 1531 (write _test-input-stream "}\n") + 1532 # convert + 1533 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1534 (flush _test-output-buffered-file) + 1535 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1541 # check output + 1542 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-spill-different-register-in-block/0") + 1543 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-spill-different-register-in-block/1") + 1544 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-spill-different-register-in-block/2") + 1545 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-spill-different-register-in-block/3") + 1546 (check-next-stream-line-equal _test-output-stream " {" "F - test-spill-different-register-in-block/4") + 1547 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-spill-different-register-in-block/5") + 1548 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-spill-different-register-in-block/6") + 1549 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-spill-different-register-in-block/7") + 1550 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-spill-different-register-in-block/8") + 1551 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-spill-different-register-in-block/9") + 1552 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-spill-different-register-in-block/10") + 1553 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-spill-different-register-in-block/11") + 1554 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-spill-different-register-in-block/12") + 1555 (check-next-stream-line-equal _test-output-stream " }" "F - test-spill-different-register-in-block/13") + 1556 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-spill-different-register-in-block/14") + 1557 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-spill-different-register-in-block/15") + 1558 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-spill-different-register-in-block/16") + 1559 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-spill-different-register-in-block/17") + 1560 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-spill-different-register-in-block/18") + 1561 # . epilogue + 1562 89/<- %esp 5/r32/ebp + 1563 5d/pop-to-ebp + 1564 c3/return + 1565 + 1566 test-shadow-live-output: + 1567 # . prologue + 1568 55/push-ebp + 1569 89/<- %ebp 4/r32/esp + 1570 # setup + 1571 (clear-stream _test-input-stream) + 1572 (clear-stream $_test-input-buffered-file->buffer) + 1573 (clear-stream _test-output-stream) + 1574 (clear-stream $_test-output-buffered-file->buffer) + 1575 # + 1576 (write _test-input-stream "fn foo -> x/ecx: int {\n") + 1577 (write _test-input-stream " x <- copy 3\n") + 1578 (write _test-input-stream " {\n") + 1579 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 1580 (write _test-input-stream " }\n") + 1581 (write _test-input-stream " x <- increment\n") + 1582 (write _test-input-stream "}\n") + 1583 # convert + 1584 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1585 (flush _test-output-buffered-file) + 1586 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1592 # check output + 1593 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-output/0") + 1594 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-output/1") + 1595 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-output/2") + 1596 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-output/3") + 1597 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/4") + 1598 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-output/5") + 1599 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-output/7") # no push because it's an output reg + 1600 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/8") + 1601 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-output/9") + 1602 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-output/10") + 1603 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-output/11") + 1604 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-output/12") + 1605 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/13") + 1606 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-output/14") + 1607 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-output/15") + 1608 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/17") + 1609 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-output/18") + 1610 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-output/19") + 1611 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-output/20") + 1612 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-output/21") + 1613 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-output/21") + 1614 # . epilogue + 1615 89/<- %esp 5/r32/ebp + 1616 5d/pop-to-ebp + 1617 c3/return + 1618 + 1619 test-local-clobbered-by-output: + 1620 # also doesn't spill + 1621 # . prologue + 1622 55/push-ebp + 1623 89/<- %ebp 4/r32/esp + 1624 # setup + 1625 (clear-stream _test-input-stream) + 1626 (clear-stream $_test-input-buffered-file->buffer) + 1627 (clear-stream _test-output-stream) + 1628 (clear-stream $_test-output-buffered-file->buffer) + 1629 # + 1630 (write _test-input-stream "fn foo -> x/ecx: int {\n") + 1631 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 1632 (write _test-input-stream " x <- copy y\n") + 1633 (write _test-input-stream "}\n") + 1634 # convert + 1635 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1636 (flush _test-output-buffered-file) + 1637 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1643 # check output + 1644 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-local-clobbered-by-output/0") + 1645 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-local-clobbered-by-output/1") + 1646 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-local-clobbered-by-output/2") + 1647 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-local-clobbered-by-output/3") + 1648 (check-next-stream-line-equal _test-output-stream " {" "F - test-local-clobbered-by-output/4") + 1649 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-local-clobbered-by-output/5") + 1650 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-local-clobbered-by-output/6") + 1651 (check-next-stream-line-equal _test-output-stream " 89/<- %ecx 0x00000001/r32" "F - test-local-clobbered-by-output/7") + 1652 (check-next-stream-line-equal _test-output-stream " }" "F - test-local-clobbered-by-output/8") + 1653 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-local-clobbered-by-output/9") + 1654 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-local-clobbered-by-output/10") + 1655 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-local-clobbered-by-output/11") + 1656 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-local-clobbered-by-output/12") + 1657 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-local-clobbered-by-output/13") + 1658 # . epilogue + 1659 89/<- %esp 5/r32/ebp + 1660 5d/pop-to-ebp + 1661 c3/return + 1662 + 1663 test-read-output: + 1664 # also doesn't spill + 1665 # . prologue + 1666 55/push-ebp + 1667 89/<- %ebp 4/r32/esp + 1668 # setup + 1669 (clear-stream _test-input-stream) + 1670 (clear-stream $_test-input-buffered-file->buffer) + 1671 (clear-stream _test-output-stream) + 1672 (clear-stream $_test-output-buffered-file->buffer) + 1673 # + 1674 (write _test-input-stream "fn foo -> x/ecx: int {\n") + 1675 (write _test-input-stream " x <- copy 0x34\n") + 1676 (write _test-input-stream " compare x, 0x35\n") + 1677 (write _test-input-stream "}\n") + 1678 # convert + 1679 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1680 (flush _test-output-buffered-file) + 1681 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1687 # check output + 1688 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-read-output/0") + 1689 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-read-output/1") + 1690 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-read-output/2") + 1691 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-read-output/3") + 1692 (check-next-stream-line-equal _test-output-stream " {" "F - test-read-output/4") + 1693 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-read-output/5") + 1694 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x34/imm32" "F - test-read-output/6") + 1695 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0x35/imm32" "F - test-read-output/7") + 1696 (check-next-stream-line-equal _test-output-stream " }" "F - test-read-output/8") + 1697 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-read-output/9") + 1698 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-read-output/10") + 1699 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-read-output/11") + 1700 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-read-output/12") + 1701 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-read-output/13") + 1702 # . epilogue + 1703 89/<- %esp 5/r32/ebp + 1704 5d/pop-to-ebp + 1705 c3/return + 1706 + 1707 test-convert-function-with-branches-in-block: + 1708 # . prologue + 1709 55/push-ebp + 1710 89/<- %ebp 4/r32/esp + 1711 # setup + 1712 (clear-stream _test-input-stream) + 1713 (clear-stream $_test-input-buffered-file->buffer) + 1714 (clear-stream _test-output-stream) + 1715 (clear-stream $_test-output-buffered-file->buffer) + 1716 # + 1717 (write _test-input-stream "fn foo x: int {\n") + 1718 (write _test-input-stream " {\n") + 1719 (write _test-input-stream " break-if->=\n") + 1720 (write _test-input-stream " loop-if-addr<\n") + 1721 (write _test-input-stream " increment x\n") + 1722 (write _test-input-stream " loop\n") + 1723 (write _test-input-stream " }\n") + 1724 (write _test-input-stream "}\n") + 1725 # convert + 1726 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1727 (flush _test-output-buffered-file) + 1728 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1734 # check output + 1735 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") + 1736 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") + 1737 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") + 1738 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") + 1739 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") + 1740 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") + 1741 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") + 1742 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") + 1743 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") + 1744 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") + 1745 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") + 1746 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") + 1747 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") + 1748 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") + 1749 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") + 1750 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") + 1751 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") + 1752 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") + 1753 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") + 1754 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") + 1755 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") + 1756 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") + 1757 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") + 1758 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") + 1759 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") + 1760 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") + 1761 # . epilogue + 1762 89/<- %esp 5/r32/ebp + 1763 5d/pop-to-ebp + 1764 c3/return + 1765 + 1766 test-convert-function-with-branches-in-named-block: + 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 x: int {\n") + 1777 (write _test-input-stream " $bar: {\n") + 1778 (write _test-input-stream " break-if->= $bar\n") + 1779 (write _test-input-stream " loop-if-addr< $bar\n") + 1780 (write _test-input-stream " increment x\n") + 1781 (write _test-input-stream " loop\n") + 1782 (write _test-input-stream " }\n") + 1783 (write _test-input-stream "}\n") + 1784 # convert + 1785 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1786 (flush _test-output-buffered-file) + 1787 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1793 # check output + 1794 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0") + 1795 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1") + 1796 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2") + 1797 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3") + 1798 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4") + 1799 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5") + 1800 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6") + 1801 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7") + 1802 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/8") + 1803 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-named-block/9") + 1804 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/10") + 1805 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/11") + 1806 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/12") + 1807 (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") + 1808 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:loop/disp32" "F - test-convert-function-with-branches-in-named-block/14") + 1809 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/15") + 1810 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/16") + 1811 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/17") + 1812 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/18") + 1813 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/19") + 1814 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/20") + 1815 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/21") + 1816 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/22") + 1817 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/23") + 1818 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/24") + 1819 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/25") + 1820 # . epilogue + 1821 89/<- %esp 5/r32/ebp + 1822 5d/pop-to-ebp + 1823 c3/return + 1824 + 1825 test-convert-function-with-var-in-nested-block: + 1826 # . prologue + 1827 55/push-ebp + 1828 89/<- %ebp 4/r32/esp + 1829 # setup + 1830 (clear-stream _test-input-stream) + 1831 (clear-stream $_test-input-buffered-file->buffer) + 1832 (clear-stream _test-output-stream) + 1833 (clear-stream $_test-output-buffered-file->buffer) + 1834 # + 1835 (write _test-input-stream "fn foo x: int {\n") + 1836 (write _test-input-stream " {\n") + 1837 (write _test-input-stream " {\n") + 1838 (write _test-input-stream " var x: int\n") + 1839 (write _test-input-stream " increment x\n") + 1840 (write _test-input-stream " }\n") + 1841 (write _test-input-stream " }\n") + 1842 (write _test-input-stream "}\n") + 1843 # convert + 1844 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1845 (flush _test-output-buffered-file) + 1846 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1852 # check output + 1853 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") + 1854 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1") + 1855 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") + 1856 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") + 1857 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4") + 1858 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5") + 1859 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6") + 1860 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7") + 1861 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8") + 1862 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9") + 1863 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10") + 1864 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11") + 1865 (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") + 1866 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13") + 1867 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14") + 1868 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15") + 1869 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16") + 1870 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17") + 1871 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18") + 1872 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19") + 1873 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20") + 1874 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21") + 1875 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22") + 1876 # . epilogue + 1877 89/<- %esp 5/r32/ebp + 1878 5d/pop-to-ebp + 1879 c3/return + 1880 + 1881 test-convert-function-with-multiple-vars-in-nested-blocks: + 1882 # . prologue + 1883 55/push-ebp + 1884 89/<- %ebp 4/r32/esp + 1885 # setup + 1886 (clear-stream _test-input-stream) + 1887 (clear-stream $_test-input-buffered-file->buffer) + 1888 (clear-stream _test-output-stream) + 1889 (clear-stream $_test-output-buffered-file->buffer) + 1890 # + 1891 (write _test-input-stream "fn foo x: int {\n") + 1892 (write _test-input-stream " {\n") + 1893 (write _test-input-stream " var x/eax: int <- copy 0\n") + 1894 (write _test-input-stream " {\n") + 1895 (write _test-input-stream " var y: int\n") + 1896 (write _test-input-stream " x <- add y\n") + 1897 (write _test-input-stream " }\n") + 1898 (write _test-input-stream " }\n") + 1899 (write _test-input-stream "}\n") + 1900 # convert + 1901 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1902 (flush _test-output-buffered-file) + 1903 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1909 # check output + 1910 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0") + 1911 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1") + 1912 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2") + 1913 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3") + 1914 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4") + 1915 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5") + 1916 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6") + 1917 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7") + 1918 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8") + 1919 (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") + 1920 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10") + 1921 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11") + 1922 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12") + 1923 (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") + 1924 (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") + 1925 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15") + 1926 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16") + 1927 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17") + 1928 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18") + 1929 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19") + 1930 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20") + 1931 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21") + 1932 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22") + 1933 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23") + 1934 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24") + 1935 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25") + 1936 # . epilogue + 1937 89/<- %esp 5/r32/ebp + 1938 5d/pop-to-ebp + 1939 c3/return + 1940 + 1941 test-convert-function-with-branches-and-local-vars: + 1942 # A conditional 'break' after a 'var' in a block is converted into a + 1943 # nested block that performs all necessary cleanup before jumping. This + 1944 # results in some ugly code duplication. + 1945 # . prologue + 1946 55/push-ebp + 1947 89/<- %ebp 4/r32/esp + 1948 # setup + 1949 (clear-stream _test-input-stream) + 1950 (clear-stream $_test-input-buffered-file->buffer) + 1951 (clear-stream _test-output-stream) + 1952 (clear-stream $_test-output-buffered-file->buffer) + 1953 # + 1954 (write _test-input-stream "fn foo {\n") + 1955 (write _test-input-stream " {\n") + 1956 (write _test-input-stream " var x: int\n") + 1957 (write _test-input-stream " break-if->=\n") + 1958 (write _test-input-stream " increment x\n") + 1959 (write _test-input-stream " }\n") + 1960 (write _test-input-stream "}\n") + 1961 # convert + 1962 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1963 (flush _test-output-buffered-file) + 1964 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1970 # check output + 1971 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0") + 1972 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1") + 1973 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2") + 1974 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3") + 1975 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4") + 1976 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5") + 1977 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6") + 1978 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7") + 1979 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8") + 1980 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9") + 1981 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10") + 1982 (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") + 1983 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12") + 1984 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13") + 1985 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14") + 1986 (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") + 1987 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16") + 1988 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17") + 1989 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18") + 1990 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19") + 1991 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20") + 1992 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21") + 1993 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22") + 1994 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23") + 1995 # . epilogue + 1996 89/<- %esp 5/r32/ebp + 1997 5d/pop-to-ebp + 1998 c3/return + 1999 + 2000 test-convert-function-with-conditional-loops-and-local-vars: + 2001 # A conditional 'loop' after a 'var' in a block is converted into a nested + 2002 # block that performs all necessary cleanup before jumping. This results + 2003 # in some ugly code duplication. + 2004 # . prologue + 2005 55/push-ebp + 2006 89/<- %ebp 4/r32/esp + 2007 # setup + 2008 (clear-stream _test-input-stream) + 2009 (clear-stream $_test-input-buffered-file->buffer) + 2010 (clear-stream _test-output-stream) + 2011 (clear-stream $_test-output-buffered-file->buffer) + 2012 # + 2013 (write _test-input-stream "fn foo {\n") + 2014 (write _test-input-stream " {\n") + 2015 (write _test-input-stream " var x: int\n") + 2016 (write _test-input-stream " loop-if->=\n") + 2017 (write _test-input-stream " increment x\n") + 2018 (write _test-input-stream " }\n") + 2019 (write _test-input-stream "}\n") + 2020 # convert + 2021 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2022 (flush _test-output-buffered-file) + 2023 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2029 # check output + 2030 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0") + 2031 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1") + 2032 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2") + 2033 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3") + 2034 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4") + 2035 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5") + 2036 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6") + 2037 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7") + 2038 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8") + 2039 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9") + 2040 (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") + 2041 (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") + 2042 (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") + 2043 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13") + 2044 (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") + 2045 (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") + 2046 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16") + 2047 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17") + 2048 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18") + 2049 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19") + 2050 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20") + 2051 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21") + 2052 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22") + 2053 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23") + 2054 # . epilogue + 2055 89/<- %esp 5/r32/ebp + 2056 5d/pop-to-ebp + 2057 c3/return + 2058 + 2059 test-convert-function-with-unconditional-loops-and-local-vars: + 2060 # An unconditional 'loop' after a 'var' in a block is emitted _after_ the + 2061 # regular block cleanup. Any instructions after 'loop' are dead and + 2062 # therefore skipped. + 2063 # . prologue + 2064 55/push-ebp + 2065 89/<- %ebp 4/r32/esp + 2066 # setup + 2067 (clear-stream _test-input-stream) + 2068 (clear-stream $_test-input-buffered-file->buffer) + 2069 (clear-stream _test-output-stream) + 2070 (clear-stream $_test-output-buffered-file->buffer) + 2071 # + 2072 (write _test-input-stream "fn foo {\n") + 2073 (write _test-input-stream " {\n") + 2074 (write _test-input-stream " var x: int\n") + 2075 (write _test-input-stream " loop\n") + 2076 (write _test-input-stream " increment x\n") + 2077 (write _test-input-stream " }\n") + 2078 (write _test-input-stream "}\n") + 2079 # convert + 2080 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2081 (flush _test-output-buffered-file) + 2082 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2088 # check output + 2089 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0") + 2090 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1") + 2091 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2") + 2092 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3") + 2093 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4") + 2094 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5") + 2095 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6") + 2096 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7") + 2097 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8") + 2098 (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") + 2099 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10") + 2100 # not emitted: ff 0/subop/increment *(ebp+0xfffffffc) + 2101 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11") + 2102 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12") + 2103 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13") + 2104 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14") + 2105 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15") + 2106 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16") + 2107 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17") + 2108 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18") + 2109 # . epilogue + 2110 89/<- %esp 5/r32/ebp + 2111 5d/pop-to-ebp + 2112 c3/return + 2113 + 2114 test-convert-function-with-branches-and-loops-and-local-vars: + 2115 # . prologue + 2116 55/push-ebp + 2117 89/<- %ebp 4/r32/esp + 2118 # setup + 2119 (clear-stream _test-input-stream) + 2120 (clear-stream $_test-input-buffered-file->buffer) + 2121 (clear-stream _test-output-stream) + 2122 (clear-stream $_test-output-buffered-file->buffer) + 2123 # + 2124 (write _test-input-stream "fn foo {\n") + 2125 (write _test-input-stream " {\n") + 2126 (write _test-input-stream " var x: int\n") + 2127 (write _test-input-stream " break-if->=\n") + 2128 (write _test-input-stream " increment x\n") + 2129 (write _test-input-stream " loop\n") + 2130 (write _test-input-stream " }\n") + 2131 (write _test-input-stream "}\n") + 2132 # convert + 2133 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2134 (flush _test-output-buffered-file) + 2135 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2141 # check output + 2142 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0") + 2143 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1") + 2144 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2") + 2145 (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") + 2146 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4") + 2147 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5") + 2148 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6") + 2149 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7") + 2150 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8") + 2151 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9") + 2152 (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") + 2153 (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") + 2154 (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") + 2155 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13") + 2156 (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") + 2157 (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") + 2158 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16") + 2159 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17") + 2160 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18") + 2161 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19") + 2162 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20") + 2163 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21") + 2164 (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") + 2165 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23") + 2166 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24") + 2167 # . epilogue + 2168 89/<- %esp 5/r32/ebp + 2169 5d/pop-to-ebp + 2170 c3/return + 2171 + 2172 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars: + 2173 # . prologue + 2174 55/push-ebp + 2175 89/<- %ebp 4/r32/esp + 2176 # setup + 2177 (clear-stream _test-input-stream) + 2178 (clear-stream $_test-input-buffered-file->buffer) + 2179 (clear-stream _test-output-stream) + 2180 (clear-stream $_test-output-buffered-file->buffer) + 2181 # + 2182 (write _test-input-stream "fn foo {\n") + 2183 (write _test-input-stream " a: {\n") + 2184 (write _test-input-stream " var x: int\n") + 2185 (write _test-input-stream " {\n") + 2186 (write _test-input-stream " var y: int\n") + 2187 (write _test-input-stream " break-if->= a\n") + 2188 (write _test-input-stream " increment x\n") + 2189 (write _test-input-stream " loop\n") + 2190 (write _test-input-stream " }\n") + 2191 (write _test-input-stream " }\n") + 2192 (write _test-input-stream "}\n") + 2193 # convert + 2194 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2195 (flush _test-output-buffered-file) + 2196 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2202 # check output + 2203 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0") + 2204 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1") + 2205 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2") + 2206 (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") + 2207 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4") + 2208 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5") + 2209 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6") + 2210 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7") + 2211 (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") + 2212 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9") + 2213 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10") + 2214 (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") + 2215 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12") + 2216 (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") + 2217 (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") + 2218 (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") + 2219 (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") + 2220 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17") + 2221 (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") + 2222 (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") + 2223 (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") + 2224 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21") + 2225 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22") + 2226 (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") + 2227 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24") + 2228 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25") + 2229 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26") + 2230 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27") + 2231 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28") + 2232 (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") + 2233 (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") + 2234 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31") + 2235 # . epilogue + 2236 89/<- %esp 5/r32/ebp + 2237 5d/pop-to-ebp + 2238 c3/return + 2239 + 2240 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2: + 2241 # . prologue + 2242 55/push-ebp + 2243 89/<- %ebp 4/r32/esp + 2244 # setup + 2245 (clear-stream _test-input-stream) + 2246 (clear-stream $_test-input-buffered-file->buffer) + 2247 (clear-stream _test-output-stream) + 2248 (clear-stream $_test-output-buffered-file->buffer) + 2249 # non-local conditional branch from a block without a local variable, + 2250 # unwinding a local on the stack + 2251 (write _test-input-stream "fn foo {\n") + 2252 (write _test-input-stream " a: {\n") + 2253 (write _test-input-stream " var x: int\n") + 2254 (write _test-input-stream " {\n") + 2255 (write _test-input-stream " break-if->= a\n") + 2256 (write _test-input-stream " }\n") + 2257 (write _test-input-stream " }\n") + 2258 (write _test-input-stream "}\n") + 2259 # convert + 2260 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2261 (flush _test-output-buffered-file) + 2262 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2268 # check output + 2269 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/0") + 2270 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/1") + 2271 (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") + 2272 (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") + 2273 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/4") + 2274 (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") + 2275 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/6") + 2276 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/7") + 2277 (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") + 2278 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/9") + 2279 (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") + 2280 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/11") + 2281 (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") + 2282 (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") + 2283 (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") + 2284 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/15") + 2285 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/16") + 2286 (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") + 2287 (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") + 2288 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/19") + 2289 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/20") + 2290 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/21") + 2291 (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") + 2292 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/23") + 2293 (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") + 2294 (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") + 2295 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/26") + 2296 # . epilogue + 2297 89/<- %esp 5/r32/ebp + 2298 5d/pop-to-ebp + 2299 c3/return + 2300 + 2301 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3: + 2302 # . prologue + 2303 55/push-ebp + 2304 89/<- %ebp 4/r32/esp + 2305 # setup + 2306 (clear-stream _test-input-stream) + 2307 (clear-stream $_test-input-buffered-file->buffer) + 2308 (clear-stream _test-output-stream) + 2309 (clear-stream $_test-output-buffered-file->buffer) + 2310 # non-local unconditional branch from a block without a local variable, + 2311 # unwinding a local on the stack + 2312 (write _test-input-stream "fn foo {\n") + 2313 (write _test-input-stream " a: {\n") + 2314 (write _test-input-stream " var x: int\n") + 2315 (write _test-input-stream " {\n") + 2316 (write _test-input-stream " break a\n") + 2317 (write _test-input-stream " }\n") + 2318 (write _test-input-stream " }\n") + 2319 (write _test-input-stream "}\n") + 2320 # convert + 2321 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2322 (flush _test-output-buffered-file) + 2323 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2329 # check output + 2330 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/0") + 2331 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/1") + 2332 (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") + 2333 (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") + 2334 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/4") + 2335 (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") + 2336 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/6") + 2337 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/7") + 2338 (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") + 2339 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/9") + 2340 (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") + 2341 (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") + 2342 (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") + 2343 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/14") + 2344 (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") + 2345 (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") + 2346 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/17") + 2347 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/18") + 2348 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/19") + 2349 (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") + 2350 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/21") + 2351 (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") + 2352 (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") + 2353 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/24") + 2354 # . epilogue + 2355 89/<- %esp 5/r32/ebp + 2356 5d/pop-to-ebp + 2357 c3/return + 2358 + 2359 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4: + 2360 # . prologue + 2361 55/push-ebp + 2362 89/<- %ebp 4/r32/esp + 2363 # setup + 2364 (clear-stream _test-input-stream) + 2365 (clear-stream $_test-input-buffered-file->buffer) + 2366 (clear-stream _test-output-stream) + 2367 (clear-stream $_test-output-buffered-file->buffer) + 2368 # + 2369 (write _test-input-stream "fn foo {\n") + 2370 (write _test-input-stream " a: {\n") + 2371 (write _test-input-stream " var x/esi: int <- copy 0\n") + 2372 (write _test-input-stream " {\n") + 2373 (write _test-input-stream " break a\n") + 2374 (write _test-input-stream " }\n") + 2375 (write _test-input-stream " }\n") + 2376 (write _test-input-stream "}\n") + 2377 # convert + 2378 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2379 (flush _test-output-buffered-file) + 2380 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2386 # check output + 2387 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/0") + 2388 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/1") + 2389 (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") + 2390 (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") + 2391 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/4") + 2392 (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") + 2393 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/6") + 2394 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/7") + 2395 (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") + 2396 (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") + 2397 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/10") + 2398 (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") + 2399 (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") + 2400 (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") + 2401 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/14") + 2402 (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") + 2403 (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") + 2404 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/17") + 2405 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/18") + 2406 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/19") + 2407 (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") + 2408 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/21") + 2409 (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") + 2410 (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") + 2411 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/24") + 2412 # . epilogue + 2413 89/<- %esp 5/r32/ebp + 2414 5d/pop-to-ebp + 2415 c3/return + 2416 + 2417 test-convert-function-with-nonlocal-unconditional-break-and-local-vars: + 2418 # . prologue + 2419 55/push-ebp + 2420 89/<- %ebp 4/r32/esp + 2421 # setup + 2422 (clear-stream _test-input-stream) + 2423 (clear-stream $_test-input-buffered-file->buffer) + 2424 (clear-stream _test-output-stream) + 2425 (clear-stream $_test-output-buffered-file->buffer) + 2426 # + 2427 (write _test-input-stream "fn foo {\n") + 2428 (write _test-input-stream " a: {\n") + 2429 (write _test-input-stream " var x: int\n") + 2430 (write _test-input-stream " {\n") + 2431 (write _test-input-stream " var y: int\n") + 2432 (write _test-input-stream " break a\n") + 2433 (write _test-input-stream " increment x\n") + 2434 (write _test-input-stream " }\n") + 2435 (write _test-input-stream " }\n") + 2436 (write _test-input-stream "}\n") + 2437 # convert + 2438 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2439 (flush _test-output-buffered-file) + 2440 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2446 # check output + 2447 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0") + 2448 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1") + 2449 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2") + 2450 (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") + 2451 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4") + 2452 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5") + 2453 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6") + 2454 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7") + 2455 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8") + 2456 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9") + 2457 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10") + 2458 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11") + 2459 (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") + 2460 (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") + 2461 (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") + 2462 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15") + 2463 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16") + 2464 (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") + 2465 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18") + 2466 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19") + 2467 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20") + 2468 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21") + 2469 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22") + 2470 (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") + 2471 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24") + 2472 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25") + 2473 # . epilogue + 2474 89/<- %esp 5/r32/ebp + 2475 5d/pop-to-ebp + 2476 c3/return + 2477 + 2478 test-convert-function-with-unconditional-break-and-local-vars: + 2479 # . prologue + 2480 55/push-ebp + 2481 89/<- %ebp 4/r32/esp + 2482 # setup + 2483 (clear-stream _test-input-stream) + 2484 (clear-stream $_test-input-buffered-file->buffer) + 2485 (clear-stream _test-output-stream) + 2486 (clear-stream $_test-output-buffered-file->buffer) + 2487 # + 2488 (write _test-input-stream "fn foo {\n") + 2489 (write _test-input-stream " {\n") + 2490 (write _test-input-stream " var x: int\n") + 2491 (write _test-input-stream " {\n") + 2492 (write _test-input-stream " var y: int\n") + 2493 (write _test-input-stream " break\n") + 2494 (write _test-input-stream " increment x\n") + 2495 (write _test-input-stream " }\n") + 2496 (write _test-input-stream " }\n") + 2497 (write _test-input-stream "}\n") + 2498 # convert + 2499 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2500 (flush _test-output-buffered-file) + 2501 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2507 # check output + 2508 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0") + 2509 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1") + 2510 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2") + 2511 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3") + 2512 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4") + 2513 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5") + 2514 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6") + 2515 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7") + 2516 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8") + 2517 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9") + 2518 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10") + 2519 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11") + 2520 (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") + 2521 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13") + 2522 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14") + 2523 (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") + 2524 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16") + 2525 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17") + 2526 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18") + 2527 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19") + 2528 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20") + 2529 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21") + 2530 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22") + 2531 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23") + 2532 # . epilogue + 2533 89/<- %esp 5/r32/ebp + 2534 5d/pop-to-ebp + 2535 c3/return + 2536 + 2537 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars: + 2538 # . prologue + 2539 55/push-ebp + 2540 89/<- %ebp 4/r32/esp + 2541 # setup + 2542 (clear-stream _test-input-stream) + 2543 (clear-stream $_test-input-buffered-file->buffer) + 2544 (clear-stream _test-output-stream) + 2545 (clear-stream $_test-output-buffered-file->buffer) + 2546 # + 2547 (write _test-input-stream "fn foo {\n") + 2548 (write _test-input-stream " a: {\n") + 2549 (write _test-input-stream " var x: int\n") + 2550 (write _test-input-stream " {\n") + 2551 (write _test-input-stream " var y: int\n") + 2552 (write _test-input-stream " loop a\n") + 2553 (write _test-input-stream " increment x\n") + 2554 (write _test-input-stream " }\n") + 2555 (write _test-input-stream " }\n") + 2556 (write _test-input-stream "}\n") + 2557 # convert + 2558 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2559 (flush _test-output-buffered-file) + 2560 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2566 # check output + 2567 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0") + 2568 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1") + 2569 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2") + 2570 (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") + 2571 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4") + 2572 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5") + 2573 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6") + 2574 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7") + 2575 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8") + 2576 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9") + 2577 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10") + 2578 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11") + 2579 (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") + 2580 (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") + 2581 (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") + 2582 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15") + 2583 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16") + 2584 (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") + 2585 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18") + 2586 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19") + 2587 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20") + 2588 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21") + 2589 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22") + 2590 (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") + 2591 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24") + 2592 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25") + 2593 # . epilogue + 2594 89/<- %esp 5/r32/ebp + 2595 5d/pop-to-ebp + 2596 c3/return + 2597 + 2598 test-convert-function-with-local-array-var-in-mem: + 2599 # . prologue + 2600 55/push-ebp + 2601 89/<- %ebp 4/r32/esp + 2602 # setup + 2603 (clear-stream _test-input-stream) + 2604 (clear-stream $_test-input-buffered-file->buffer) + 2605 (clear-stream _test-output-stream) + 2606 (clear-stream $_test-output-buffered-file->buffer) + 2607 # + 2608 (write _test-input-stream "fn foo {\n") + 2609 (write _test-input-stream " var x: (array int 3)\n") + 2610 (write _test-input-stream "}\n") + 2611 # convert + 2612 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2613 (flush _test-output-buffered-file) + 2614 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2620 # check output + 2621 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-var-in-mem/0") + 2622 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-var-in-mem/1") + 2623 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-var-in-mem/2") + 2624 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-var-in-mem/3") + 2625 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-var-in-mem/4") + 2626 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-var-in-mem/5") + 2627 # define x + 2628 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-function-with-local-array-var-in-mem/7") + 2629 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-function-with-local-array-var-in-mem/8") + 2630 # reclaim x + 2631 (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") + 2632 # + 2633 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-var-in-mem/10") + 2634 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-var-in-mem/11") + 2635 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-var-in-mem/12") + 2636 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-var-in-mem/13") + 2637 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-var-in-mem/14") + 2638 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-var-in-mem/15") + 2639 # . epilogue + 2640 89/<- %esp 5/r32/ebp + 2641 5d/pop-to-ebp + 2642 c3/return + 2643 + 2644 test-convert-address: + 2645 # . prologue + 2646 55/push-ebp + 2647 89/<- %ebp 4/r32/esp + 2648 # setup + 2649 (clear-stream _test-input-stream) + 2650 (clear-stream $_test-input-buffered-file->buffer) + 2651 (clear-stream _test-output-stream) + 2652 (clear-stream $_test-output-buffered-file->buffer) + 2653 # + 2654 (write _test-input-stream "fn foo {\n") + 2655 (write _test-input-stream " var a: int\n") + 2656 (write _test-input-stream " var b/eax: (addr int) <- address a\n") + 2657 (write _test-input-stream "}\n") + 2658 # convert + 2659 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2660 (flush _test-output-buffered-file) + 2661 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2667 # check output + 2668 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-address/0") + 2669 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-address/1") + 2670 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-address/2") + 2671 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-address/3") + 2672 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-address/4") + 2673 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-address/5") + 2674 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-address/6") + 2675 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-address/7") + 2676 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-address/8") + 2677 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-address/9") + 2678 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-address/10") + 2679 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-address/11") + 2680 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-address/12") + 2681 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-address/13") + 2682 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-address/14") + 2683 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-address/15") + 2684 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-address/16") + 2685 # . epilogue + 2686 89/<- %esp 5/r32/ebp + 2687 5d/pop-to-ebp + 2688 c3/return + 2689 + 2690 test-convert-length-of-array: + 2691 # . prologue + 2692 55/push-ebp + 2693 89/<- %ebp 4/r32/esp + 2694 # setup + 2695 (clear-stream _test-input-stream) + 2696 (clear-stream $_test-input-buffered-file->buffer) + 2697 (clear-stream _test-output-stream) + 2698 (clear-stream $_test-output-buffered-file->buffer) + 2699 # + 2700 (write _test-input-stream "fn foo a: (addr array int) {\n") + 2701 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n") + 2702 (write _test-input-stream " var c/eax: int <- length b\n") + 2703 (write _test-input-stream "}\n") + 2704 # convert + 2705 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2706 (flush _test-output-buffered-file) + 2707 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2713 # check output + 2714 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0") + 2715 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1") + 2716 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2") + 2717 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3") + 2718 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4") + 2719 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5") + 2720 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6") + 2721 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7") + 2722 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array/8") + 2723 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array/9") + 2724 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/10") + 2725 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/11") + 2726 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/12") + 2727 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/13") + 2728 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/14") + 2729 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/15") + 2730 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/16") + 2731 # . epilogue + 2732 89/<- %esp 5/r32/ebp + 2733 5d/pop-to-ebp + 2734 c3/return + 2735 + 2736 test-convert-length-of-array-on-stack: + 2737 # . prologue + 2738 55/push-ebp + 2739 89/<- %ebp 4/r32/esp + 2740 # setup + 2741 (clear-stream _test-input-stream) + 2742 (clear-stream $_test-input-buffered-file->buffer) + 2743 (clear-stream _test-output-stream) + 2744 (clear-stream $_test-output-buffered-file->buffer) + 2745 # + 2746 (write _test-input-stream "fn foo {\n") + 2747 (write _test-input-stream " var a: (array int 3)\n") + 2748 (write _test-input-stream " var b/eax: int <- length a\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-length-of-array-on-stack/0") + 2761 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-on-stack/1") + 2762 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-on-stack/2") + 2763 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-on-stack/3") + 2764 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-on-stack/4") + 2765 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-on-stack/5") + 2766 # define x + 2767 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-length-of-array-on-stack/6") + 2768 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-length-of-array-on-stack/7") + 2769 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-on-stack/8") + 2770 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff0) 0x00000000/r32" "F - test-convert-length-of-array-on-stack/9") + 2771 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array-on-stack/10") + 2772 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-on-stack/11") + 2773 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-length-of-array-on-stack/12") + 2774 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-on-stack/13") + 2775 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-on-stack/14") + 2776 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-on-stack/15") + 2777 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-on-stack/16") + 2778 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-on-stack/17") + 2779 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-on-stack/18") + 2780 # . epilogue + 2781 89/<- %esp 5/r32/ebp + 2782 5d/pop-to-ebp + 2783 c3/return + 2784 + 2785 test-convert-index-into-array: + 2786 # . prologue + 2787 55/push-ebp + 2788 89/<- %ebp 4/r32/esp + 2789 # setup + 2790 (clear-stream _test-input-stream) + 2791 (clear-stream $_test-input-buffered-file->buffer) + 2792 (clear-stream _test-output-stream) + 2793 (clear-stream $_test-output-buffered-file->buffer) + 2794 # + 2795 (write _test-input-stream "fn foo {\n") + 2796 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 2797 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 2798 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") + 2799 (write _test-input-stream "}\n") + 2800 # convert + 2801 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2802 (flush _test-output-buffered-file) + 2803 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2809 # check output + 2810 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0") + 2811 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1") + 2812 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2") + 2813 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3") + 2814 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4") + 2815 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5") + 2816 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6") + 2817 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7") + 2818 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8") + 2819 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9") + 2820 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-convert-index-into-array/11") + 2821 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/13") + 2822 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/14") + 2823 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/15") + 2824 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/16") + 2825 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/17") + 2826 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/18") + 2827 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/19") + 2828 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/20") + 2829 # . epilogue + 2830 89/<- %esp 5/r32/ebp + 2831 5d/pop-to-ebp + 2832 c3/return + 2833 + 2834 test-convert-index-into-array-with-literal: + 2835 # . prologue + 2836 55/push-ebp + 2837 89/<- %ebp 4/r32/esp + 2838 # setup + 2839 (clear-stream _test-input-stream) + 2840 (clear-stream $_test-input-buffered-file->buffer) + 2841 (clear-stream _test-output-stream) + 2842 (clear-stream $_test-output-buffered-file->buffer) + 2843 # + 2844 (write _test-input-stream "fn foo {\n") + 2845 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 2846 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") + 2847 (write _test-input-stream "}\n") + 2848 # convert + 2849 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2850 (flush _test-output-buffered-file) + 2851 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2857 # check output + 2858 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-with-literal/0") + 2859 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-with-literal/1") + 2860 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-with-literal/2") + 2861 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-with-literal/3") + 2862 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-with-literal/4") + 2863 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5") + 2864 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6") + 2865 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7") + 2866 # 2 * 4 bytes/elem + 4 bytes for size = offset 12 + 2867 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/8") + 2868 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/9") + 2869 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/10") + 2870 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-with-literal/11") + 2871 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-with-literal/12") + 2872 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-with-literal/13") + 2873 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-with-literal/14") + 2874 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-with-literal/15") + 2875 # . epilogue + 2876 89/<- %esp 5/r32/ebp + 2877 5d/pop-to-ebp + 2878 c3/return + 2879 + 2880 test-convert-index-into-array-on-stack: + 2881 # . prologue + 2882 55/push-ebp + 2883 89/<- %ebp 4/r32/esp + 2884 # setup + 2885 (clear-stream _test-input-stream) + 2886 (clear-stream $_test-input-buffered-file->buffer) + 2887 (clear-stream _test-output-stream) + 2888 (clear-stream $_test-output-buffered-file->buffer) + 2889 # + 2890 (write _test-input-stream "fn foo {\n") + 2891 (write _test-input-stream " var arr: (array int 3)\n") + 2892 (write _test-input-stream " var idx/eax: int <- copy 2\n") + 2893 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") + 2894 (write _test-input-stream "}\n") + 2895 # convert + 2896 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2897 (flush _test-output-buffered-file) + 2898 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2904 # check output + 2905 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack/0") + 2906 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack/1") + 2907 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack/2") + 2908 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack/3") + 2909 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack/4") + 2910 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack/5") + 2911 # var arr + 2912 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack/6") + 2913 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack/7") + 2914 # var idx + 2915 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack/8") + 2916 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 2/imm32" "F - test-convert-index-into-array-on-stack/9") + 2917 # var x is at (ebp-0x10) + idx<<2 + 4 = ebp + idx<<2 - 0xc + 2918 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + eax<<0x00000002 + 0xfffffff4) 0x00000000/r32" "F - test-convert-index-into-array-on-stack/10") + 2919 # reclaim idx + 2920 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack/11") + 2921 # reclaim arr + 2922 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack/12") + 2923 # + 2924 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack/13") + 2925 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack/14") + 2926 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack/15") + 2927 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack/16") + 2928 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack/17") + 2929 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack/18") + 2930 # . epilogue + 2931 89/<- %esp 5/r32/ebp + 2932 5d/pop-to-ebp + 2933 c3/return + 2934 + 2935 test-convert-index-into-array-on-stack-with-literal: + 2936 # . prologue + 2937 55/push-ebp + 2938 89/<- %ebp 4/r32/esp + 2939 # setup + 2940 (clear-stream _test-input-stream) + 2941 (clear-stream $_test-input-buffered-file->buffer) + 2942 (clear-stream _test-output-stream) + 2943 (clear-stream $_test-output-buffered-file->buffer) + 2944 # + 2945 (write _test-input-stream "fn foo {\n") + 2946 (write _test-input-stream " var arr: (array int 3)\n") + 2947 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") + 2948 (write _test-input-stream "}\n") + 2949 # convert + 2950 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2951 (flush _test-output-buffered-file) + 2952 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2958 # check output + 2959 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack-with-literal/0") + 2960 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack-with-literal/1") + 2961 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack-with-literal/2") + 2962 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack-with-literal/3") + 2963 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack-with-literal/4") + 2964 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack-with-literal/5") + 2965 # var arr + 2966 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack-with-literal/6") + 2967 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack-with-literal/7") + 2968 # var x + 2969 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack-with-literal/8") + 2970 # x is at (ebp-0x10) + 4 + 2*4 = ebp-4 + 2971 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + 0xfffffffc) 0x00000000/r32" "F - test-convert-index-into-array-on-stack-with-literal/9") + 2972 # reclaim x + 2973 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack-with-literal/10") + 2974 # reclaim arr + 2975 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack-with-literal/11") + 2976 # + 2977 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack-with-literal/12") + 2978 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack-with-literal/13") + 2979 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack-with-literal/14") + 2980 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack-with-literal/15") + 2981 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack-with-literal/16") + 2982 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack-with-literal/17") + 2983 # . epilogue + 2984 89/<- %esp 5/r32/ebp + 2985 5d/pop-to-ebp + 2986 c3/return + 2987 + 2988 test-convert-index-into-array-using-offset: + 2989 # . prologue + 2990 55/push-ebp + 2991 89/<- %ebp 4/r32/esp + 2992 # setup + 2993 (clear-stream _test-input-stream) + 2994 (clear-stream $_test-input-buffered-file->buffer) + 2995 (clear-stream _test-output-stream) + 2996 (clear-stream $_test-output-buffered-file->buffer) + 2997 # + 2998 (write _test-input-stream "fn foo {\n") + 2999 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 3000 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 3001 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") + 3002 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") + 3003 (write _test-input-stream "}\n") + 3004 # convert + 3005 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3006 (flush _test-output-buffered-file) + 3007 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3013 # check output + 3014 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset/0") + 3015 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset/1") + 3016 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset/2") + 3017 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset/3") + 3018 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset/4") + 3019 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset/5") + 3020 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset/6") + 3021 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset/7") + 3022 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset/8") + 3023 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-using-offset/9") + 3024 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset/10") + 3025 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset/11") + 3026 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset/12") + 3027 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset/13") + 3028 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset/14") + 3029 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset/15") + 3030 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset/16") + 3031 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset/17") + 3032 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset/18") + 3033 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset/19") + 3034 # . epilogue + 3035 89/<- %esp 5/r32/ebp + 3036 5d/pop-to-ebp + 3037 c3/return + 3038 + 3039 test-convert-index-into-array-using-offset-on-stack: + 3040 # . prologue + 3041 55/push-ebp + 3042 89/<- %ebp 4/r32/esp + 3043 # setup + 3044 (clear-stream _test-input-stream) + 3045 (clear-stream $_test-input-buffered-file->buffer) + 3046 (clear-stream _test-output-stream) + 3047 (clear-stream $_test-output-buffered-file->buffer) + 3048 # + 3049 (write _test-input-stream "fn foo {\n") + 3050 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 3051 (write _test-input-stream " var idx: int\n") + 3052 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") + 3053 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") + 3054 (write _test-input-stream "}\n") + 3055 # convert + 3056 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3057 (flush _test-output-buffered-file) + 3058 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3064 # check output + 3065 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset-on-stack/0") + 3066 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset-on-stack/1") + 3067 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset-on-stack/2") + 3068 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset-on-stack/3") + 3069 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset-on-stack/4") + 3070 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset-on-stack/5") + 3071 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset-on-stack/6") + 3072 (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") + 3073 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/8") + 3074 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset-on-stack/9") + 3075 (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") + 3076 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset-on-stack/11") + 3077 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset-on-stack/12") + 3078 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-index-into-array-using-offset-on-stack/13") + 3079 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset-on-stack/14") + 3080 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset-on-stack/15") + 3081 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset-on-stack/16") + 3082 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset-on-stack/17") + 3083 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset-on-stack/18") + 3084 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset-on-stack/19") + 3085 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset-on-stack/20") + 3086 # . epilogue + 3087 89/<- %esp 5/r32/ebp + 3088 5d/pop-to-ebp + 3089 c3/return + 3090 + 3091 test-convert-function-and-type-definition: + 3092 # . prologue + 3093 55/push-ebp + 3094 89/<- %ebp 4/r32/esp + 3095 # setup + 3096 (clear-stream _test-input-stream) + 3097 (clear-stream $_test-input-buffered-file->buffer) + 3098 (clear-stream _test-output-stream) + 3099 (clear-stream $_test-output-buffered-file->buffer) + 3100 # + 3101 (write _test-input-stream "fn foo a: (addr t) {\n") + 3102 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n") + 3103 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n") + 3104 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n") + 3105 (write _test-input-stream "}\n") + 3106 (write _test-input-stream "type t {\n") + 3107 (write _test-input-stream " x: int\n") + 3108 (write _test-input-stream " y: int\n") + 3109 (write _test-input-stream "}\n") + 3110 # convert + 3111 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3112 (flush _test-output-buffered-file) + 3113 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3119 # check output + 3120 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0") + 3121 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1") + 3122 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2") + 3123 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3") + 3124 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4") + 3125 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5") + 3126 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6") + 3127 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7") + 3128 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8") + 3129 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9") + 3130 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11") + 3131 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13") + 3132 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14") + 3133 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15") + 3134 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16") + 3135 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17") + 3136 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18") + 3137 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19") + 3138 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20") + 3139 # . epilogue + 3140 89/<- %esp 5/r32/ebp + 3141 5d/pop-to-ebp + 3142 c3/return + 3143 + 3144 test-convert-function-with-local-var-with-user-defined-type: + 3145 # . prologue + 3146 55/push-ebp + 3147 89/<- %ebp 4/r32/esp + 3148 # setup + 3149 (clear-stream _test-input-stream) + 3150 (clear-stream $_test-input-buffered-file->buffer) + 3151 (clear-stream _test-output-stream) + 3152 (clear-stream $_test-output-buffered-file->buffer) + 3153 # + 3154 (write _test-input-stream "fn foo {\n") + 3155 (write _test-input-stream " var a: t\n") + 3156 (write _test-input-stream "}\n") + 3157 (write _test-input-stream "type t {\n") + 3158 (write _test-input-stream " x: int\n") + 3159 (write _test-input-stream " y: int\n") + 3160 (write _test-input-stream "}\n") + 3161 # convert + 3162 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3163 (flush _test-output-buffered-file) + 3164 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3170 # check output + 3171 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0") + 3172 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1") + 3173 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2") + 3174 (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") + 3175 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4") + 3176 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5") + 3177 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6") + 3178 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7") + 3179 (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") + 3180 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9") + 3181 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10") + 3182 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11") + 3183 (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") + 3184 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13") + 3185 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14") + 3186 # . epilogue + 3187 89/<- %esp 5/r32/ebp + 3188 5d/pop-to-ebp + 3189 c3/return + 3190 + 3191 test-convert-function-call-with-arg-of-user-defined-type: + 3192 # . prologue + 3193 55/push-ebp + 3194 89/<- %ebp 4/r32/esp + 3195 # setup + 3196 (clear-stream _test-input-stream) + 3197 (clear-stream $_test-input-buffered-file->buffer) + 3198 (clear-stream _test-output-stream) + 3199 (clear-stream $_test-output-buffered-file->buffer) + 3200 # + 3201 (write _test-input-stream "fn f {\n") + 3202 (write _test-input-stream " var a: t\n") + 3203 (write _test-input-stream " foo a\n") + 3204 (write _test-input-stream "}\n") + 3205 (write _test-input-stream "fn foo x: t {\n") + 3206 (write _test-input-stream "}\n") + 3207 (write _test-input-stream "type t {\n") + 3208 (write _test-input-stream " x: int\n") + 3209 (write _test-input-stream " y: int\n") + 3210 (write _test-input-stream "}\n") + 3211 # convert + 3212 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3213 (flush _test-output-buffered-file) + 3214 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3220 # check output + 3221 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") + 3222 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") + 3223 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") + 3224 (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") + 3225 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") + 3226 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") + 3227 # var a: t + 3228 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/6") + 3229 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7") + 3230 # foo a + 3231 (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") + 3232 # + 3233 (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") + 3234 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") + 3235 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") + 3236 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") + 3237 (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") + 3238 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") + 3239 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") + 3240 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") + 3241 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") + 3242 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") + 3243 (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") + 3244 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") + 3245 (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") + 3246 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") + 3247 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") + 3248 # . epilogue + 3249 89/<- %esp 5/r32/ebp + 3250 5d/pop-to-ebp + 3251 c3/return + 3252 + 3253 test-convert-function-call-with-arg-of-user-defined-type-register-indirect: + 3254 # . prologue + 3255 55/push-ebp + 3256 89/<- %ebp 4/r32/esp + 3257 # setup + 3258 (clear-stream _test-input-stream) + 3259 (clear-stream $_test-input-buffered-file->buffer) + 3260 (clear-stream _test-output-stream) + 3261 (clear-stream $_test-output-buffered-file->buffer) + 3262 # + 3263 (write _test-input-stream "fn f {\n") + 3264 (write _test-input-stream " var a/eax: (addr t) <- copy 0\n") + 3265 (write _test-input-stream " foo *a\n") + 3266 (write _test-input-stream "}\n") + 3267 (write _test-input-stream "fn foo x: t {\n") + 3268 (write _test-input-stream "}\n") + 3269 (write _test-input-stream "type t {\n") + 3270 (write _test-input-stream " x: int\n") + 3271 (write _test-input-stream " y: int\n") + 3272 (write _test-input-stream "}\n") + 3273 # convert + 3274 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3275 (flush _test-output-buffered-file) + 3276 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3282 # check output + 3283 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") + 3284 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") + 3285 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") + 3286 (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") + 3287 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") + 3288 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") + 3289 # var a + 3290 (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") + 3291 (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") + 3292 # foo a + 3293 (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") + 3294 # + 3295 (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") + 3296 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") + 3297 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") + 3298 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") + 3299 (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") + 3300 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") + 3301 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") + 3302 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") + 3303 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") + 3304 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") + 3305 (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") + 3306 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") + 3307 (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") + 3308 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") + 3309 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") + 3310 # . epilogue + 3311 89/<- %esp 5/r32/ebp + 3312 5d/pop-to-ebp + 3313 c3/return + 3314 + 3315 # we don't have special support for call-by-reference; just explicitly create + 3316 # a new variable with the address of the arg + 3317 test-convert-function-call-with-arg-of-user-defined-type-by-reference: + 3318 # . prologue + 3319 55/push-ebp + 3320 89/<- %ebp 4/r32/esp + 3321 # setup + 3322 (clear-stream _test-input-stream) + 3323 (clear-stream $_test-input-buffered-file->buffer) + 3324 (clear-stream _test-output-stream) + 3325 (clear-stream $_test-output-buffered-file->buffer) + 3326 # + 3327 (write _test-input-stream "fn f {\n") + 3328 (write _test-input-stream " var a: t\n") + 3329 (write _test-input-stream " var b/eax: (addr t) <- address a\n") + 3330 (write _test-input-stream " foo b\n") + 3331 (write _test-input-stream "}\n") + 3332 (write _test-input-stream "fn foo x: (addr t) {\n") + 3333 (write _test-input-stream " var x/ecx: (addr int) <- copy x\n") + 3334 (write _test-input-stream " increment *x\n") + 3335 (write _test-input-stream "}\n") + 3336 (write _test-input-stream "type t {\n") + 3337 (write _test-input-stream " x: int\n") + 3338 (write _test-input-stream " y: int\n") + 3339 (write _test-input-stream "}\n") + 3340 # convert + 3341 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3342 (flush _test-output-buffered-file) + 3343 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3349 # check output + 3350 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/0") + 3351 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/1") + 3352 (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") + 3353 (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") + 3354 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/4") + 3355 (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") + 3356 # var a: t + 3357 (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") + 3358 (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") + 3359 # var b/eax: (addr t) + 3360 (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") + 3361 (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") + 3362 # foo a + 3363 (check-next-stream-line-equal _test-output-stream " (foo %eax)" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/10") + 3364 # + 3365 (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") + 3366 (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") + 3367 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/13") + 3368 (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") + 3369 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/15") + 3370 (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") + 3371 (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") + 3372 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/18") + 3373 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/19") + 3374 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/20") + 3375 (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") + 3376 (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") + 3377 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/23") + 3378 (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") + 3379 (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") + 3380 (check-next-stream-line-equal _test-output-stream " 89/<- %ecx 0x00000001/r32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/26") + 3381 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/27") + 3382 (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/28") + 3383 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/29") + 3384 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/30") + 3385 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/31") + 3386 (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/32") + 3387 (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/33") + 3388 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/34") + 3389 # . epilogue + 3390 89/<- %esp 5/r32/ebp + 3391 5d/pop-to-ebp + 3392 c3/return + 3393 + 3394 test-convert-get-on-local-variable: + 3395 # . prologue + 3396 55/push-ebp + 3397 89/<- %ebp 4/r32/esp + 3398 # setup + 3399 (clear-stream _test-input-stream) + 3400 (clear-stream $_test-input-buffered-file->buffer) + 3401 (clear-stream _test-output-stream) + 3402 (clear-stream $_test-output-buffered-file->buffer) + 3403 # + 3404 (write _test-input-stream "fn foo {\n") + 3405 (write _test-input-stream " var a: t\n") + 3406 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 3407 (write _test-input-stream "}\n") + 3408 (write _test-input-stream "type t {\n") + 3409 (write _test-input-stream " x: int\n") + 3410 (write _test-input-stream " y: int\n") + 3411 (write _test-input-stream "}\n") + 3412 # convert + 3413 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3414 (flush _test-output-buffered-file) + 3415 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3421 # check output + 3422 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-local-variable/0") + 3423 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-local-variable/1") + 3424 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-local-variable/2") + 3425 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-local-variable/3") + 3426 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-local-variable/4") + 3427 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-local-variable/5") + 3428 # var a + 3429 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/6") + 3430 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/7") + 3431 # var c + 3432 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-local-variable/8") + 3433 # get + 3434 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000001/r32" "F - test-convert-get-on-local-variable/9") + 3435 # reclaim c + 3436 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-local-variable/10") + 3437 # reclaim a + 3438 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-get-on-local-variable/11") + 3439 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-local-variable/12") + 3440 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-local-variable/13") + 3441 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-local-variable/14") + 3442 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-local-variable/15") + 3443 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-local-variable/16") + 3444 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-local-variable/17") + 3445 # . epilogue + 3446 89/<- %esp 5/r32/ebp + 3447 5d/pop-to-ebp + 3448 c3/return + 3449 + 3450 test-convert-get-on-function-argument: + 3451 # . prologue + 3452 55/push-ebp + 3453 89/<- %ebp 4/r32/esp + 3454 # setup + 3455 (clear-stream _test-input-stream) + 3456 (clear-stream $_test-input-buffered-file->buffer) + 3457 (clear-stream _test-output-stream) + 3458 (clear-stream $_test-output-buffered-file->buffer) + 3459 # + 3460 (write _test-input-stream "fn foo a: t {\n") + 3461 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 3462 (write _test-input-stream "}\n") + 3463 (write _test-input-stream "type t {\n") + 3464 (write _test-input-stream " x: int\n") + 3465 (write _test-input-stream " y: int\n") + 3466 (write _test-input-stream "}\n") + 3467 # convert + 3468 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3469 (flush _test-output-buffered-file) + 3470 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3476 # check output + 3477 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument/0") + 3478 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument/1") + 3479 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument/2") + 3480 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument/3") + 3481 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument/4") + 3482 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument/5") + 3483 # var c + 3484 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument/6") + 3485 # get + 3486 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0x0000000c) 0x00000001/r32" "F - test-convert-get-on-function-argument/7") + 3487 # reclaim c + 3488 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument/8") + 3489 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument/9") + 3490 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument/10") + 3491 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument/11") + 3492 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument/12") + 3493 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument/13") + 3494 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument/14") + 3495 # . epilogue + 3496 89/<- %esp 5/r32/ebp + 3497 5d/pop-to-ebp + 3498 c3/return + 3499 + 3500 test-convert-get-on-function-argument-with-known-type: + 3501 # . prologue + 3502 55/push-ebp + 3503 89/<- %ebp 4/r32/esp + 3504 # setup + 3505 (clear-stream _test-input-stream) + 3506 (clear-stream $_test-input-buffered-file->buffer) + 3507 (clear-stream _test-output-stream) + 3508 (clear-stream $_test-output-buffered-file->buffer) + 3509 # + 3510 (write _test-input-stream "type t {\n") + 3511 (write _test-input-stream " x: int\n") + 3512 (write _test-input-stream " y: int\n") + 3513 (write _test-input-stream "}\n") + 3514 (write _test-input-stream "fn foo a: t {\n") + 3515 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 3516 (write _test-input-stream "}\n") + 3517 # convert + 3518 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3519 (flush _test-output-buffered-file) + 3520 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3526 # check output + 3527 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument-with-known-type/0") + 3528 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument-with-known-type/1") + 3529 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument-with-known-type/2") + 3530 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument-with-known-type/3") + 3531 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument-with-known-type/4") + 3532 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument-with-known-type/5") + 3533 # var c + 3534 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument-with-known-type/6") + 3535 # get + 3536 (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") + 3537 # reclaim c + 3538 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument-with-known-type/8") + 3539 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument-with-known-type/9") + 3540 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument-with-known-type/10") + 3541 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument-with-known-type/11") + 3542 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument-with-known-type/12") + 3543 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument-with-known-type/13") + 3544 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument-with-known-type/14") + 3545 # . epilogue + 3546 89/<- %esp 5/r32/ebp + 3547 5d/pop-to-ebp + 3548 c3/return + 3549 + 3550 test-convert-array-of-user-defined-types: + 3551 # . prologue + 3552 55/push-ebp + 3553 89/<- %ebp 4/r32/esp + 3554 # setup + 3555 (clear-stream _test-input-stream) + 3556 (clear-stream $_test-input-buffered-file->buffer) + 3557 (clear-stream _test-output-stream) + 3558 (clear-stream $_test-output-buffered-file->buffer) + 3559 # + 3560 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 + 3561 (write _test-input-stream " x: int\n") + 3562 (write _test-input-stream " y: int\n") + 3563 (write _test-input-stream "}\n") + 3564 (write _test-input-stream "fn foo {\n") + 3565 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 3566 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 3567 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") + 3568 (write _test-input-stream "}\n") + 3569 # convert + 3570 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3571 (flush _test-output-buffered-file) + 3572 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3578 # check output + 3579 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-array-of-user-defined-types/0") + 3580 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-array-of-user-defined-types/1") + 3581 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-array-of-user-defined-types/2") + 3582 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-array-of-user-defined-types/3") + 3583 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-array-of-user-defined-types/4") + 3584 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-array-of-user-defined-types/5") + 3585 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-array-of-user-defined-types/6") + 3586 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-array-of-user-defined-types/7") + 3587 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-array-of-user-defined-types/8") + 3588 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-array-of-user-defined-types/9") + 3589 (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") + 3590 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-array-of-user-defined-types/13") + 3591 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-array-of-user-defined-types/14") + 3592 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-array-of-user-defined-types/15") + 3593 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-array-of-user-defined-types/16") + 3594 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-array-of-user-defined-types/17") + 3595 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-array-of-user-defined-types/18") + 3596 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-array-of-user-defined-types/19") + 3597 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-array-of-user-defined-types/20") + 3598 # . epilogue + 3599 89/<- %esp 5/r32/ebp + 3600 5d/pop-to-ebp + 3601 c3/return + 3602 + 3603 test-convert-length-of-array-of-user-defined-types-to-eax: + 3604 # . prologue + 3605 55/push-ebp + 3606 89/<- %ebp 4/r32/esp + 3607 # setup + 3608 (clear-stream _test-input-stream) + 3609 (clear-stream $_test-input-buffered-file->buffer) + 3610 (clear-stream _test-output-stream) + 3611 (clear-stream $_test-output-buffered-file->buffer) + 3612 # + 3613 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 + 3614 (write _test-input-stream " x: int\n") + 3615 (write _test-input-stream " y: int\n") + 3616 (write _test-input-stream " z: int\n") + 3617 (write _test-input-stream "}\n") + 3618 (write _test-input-stream "fn foo {\n") + 3619 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 3620 (write _test-input-stream " var x/eax: (addr t) <- length arr\n") + 3621 (write _test-input-stream "}\n") + 3622 # convert + 3623 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3624 (flush _test-output-buffered-file) + 3625 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3631 # check output + 3632 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/0") + 3633 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/1") + 3634 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/2") + 3635 (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") + 3636 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-eax/4") + 3637 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/5") + 3638 # var arr + 3639 (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") + 3640 (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") + 3641 # length instruction + 3642 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/8") + 3643 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/9") + 3644 (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") + 3645 (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") + 3646 (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") + 3647 (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") + 3648 (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") + 3649 (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") + 3650 # reclaim arr + 3651 (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") + 3652 # + 3653 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-eax/17") + 3654 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/18") + 3655 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/19") + 3656 (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") + 3657 (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") + 3658 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-eax/22") + 3659 # . epilogue + 3660 89/<- %esp 5/r32/ebp + 3661 5d/pop-to-ebp + 3662 c3/return + 3663 + 3664 test-convert-length-of-array-of-user-defined-types-to-ecx: + 3665 # . prologue + 3666 55/push-ebp + 3667 89/<- %ebp 4/r32/esp + 3668 # setup + 3669 (clear-stream _test-input-stream) + 3670 (clear-stream $_test-input-buffered-file->buffer) + 3671 (clear-stream _test-output-stream) + 3672 (clear-stream $_test-output-buffered-file->buffer) + 3673 # + 3674 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 + 3675 (write _test-input-stream " x: int\n") + 3676 (write _test-input-stream " y: int\n") + 3677 (write _test-input-stream " z: int\n") + 3678 (write _test-input-stream "}\n") + 3679 (write _test-input-stream "fn foo {\n") + 3680 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 3681 (write _test-input-stream " var x/ecx: (addr t) <- length arr\n") + 3682 (write _test-input-stream "}\n") + 3683 # convert + 3684 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3685 (flush _test-output-buffered-file) + 3686 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3692 # check output + 3693 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/0") + 3694 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/1") + 3695 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/2") + 3696 (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") + 3697 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/4") + 3698 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/5") + 3699 # var a + 3700 (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") + 3701 (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") + 3702 # var x + 3703 (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") + 3704 # length instruction + 3705 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/9") + 3706 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/10") + 3707 (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") + 3708 (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") + 3709 (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") + 3710 (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") + 3711 (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") + 3712 (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") + 3713 (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") + 3714 # reclaim x + 3715 (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") + 3716 # reclaim a + 3717 (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") + 3718 # + 3719 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/20") + 3720 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/21") + 3721 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/22") + 3722 (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") + 3723 (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") + 3724 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/25") + 3725 # . epilogue + 3726 89/<- %esp 5/r32/ebp + 3727 5d/pop-to-ebp + 3728 c3/return + 3729 + 3730 test-convert-length-of-array-of-user-defined-types-to-edx: + 3731 # . prologue + 3732 55/push-ebp + 3733 89/<- %ebp 4/r32/esp + 3734 # setup + 3735 (clear-stream _test-input-stream) + 3736 (clear-stream $_test-input-buffered-file->buffer) + 3737 (clear-stream _test-output-stream) + 3738 (clear-stream $_test-output-buffered-file->buffer) + 3739 # + 3740 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 + 3741 (write _test-input-stream " x: int\n") + 3742 (write _test-input-stream " y: int\n") + 3743 (write _test-input-stream " z: int\n") + 3744 (write _test-input-stream "}\n") + 3745 (write _test-input-stream "fn foo {\n") + 3746 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 3747 (write _test-input-stream " var x/edx: (addr t) <- length arr\n") + 3748 (write _test-input-stream "}\n") + 3749 # convert + 3750 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3751 (flush _test-output-buffered-file) + 3752 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3758 # check output + 3759 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/0") + 3760 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/1") + 3761 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/2") + 3762 (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") + 3763 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-edx/4") + 3764 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/5") + 3765 # var a + 3766 (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") + 3767 (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") + 3768 # var x + 3769 (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") + 3770 # length instruction + 3771 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/9") + 3772 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/10") + 3773 (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") + 3774 (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") + 3775 (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") + 3776 (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") + 3777 (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") + 3778 (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") + 3779 (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") + 3780 # reclaim x + 3781 (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") + 3782 # reclaim a + 3783 (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") + 3784 # + 3785 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-edx/20") + 3786 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/21") + 3787 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/22") + 3788 (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") + 3789 (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") + 3790 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-edx/25") + 3791 # . epilogue + 3792 89/<- %esp 5/r32/ebp + 3793 5d/pop-to-ebp + 3794 c3/return + 3795 + 3796 test-convert-length-of-array-of-user-defined-types: + 3797 # . prologue + 3798 55/push-ebp + 3799 89/<- %ebp 4/r32/esp + 3800 # setup + 3801 (clear-stream _test-input-stream) + 3802 (clear-stream $_test-input-buffered-file->buffer) + 3803 (clear-stream _test-output-stream) + 3804 (clear-stream $_test-output-buffered-file->buffer) + 3805 # + 3806 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 + 3807 (write _test-input-stream " x: int\n") + 3808 (write _test-input-stream " y: int\n") + 3809 (write _test-input-stream " z: int\n") + 3810 (write _test-input-stream "}\n") + 3811 (write _test-input-stream "fn foo {\n") + 3812 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 3813 (write _test-input-stream " var x/ebx: (addr t) <- length arr\n") + 3814 (write _test-input-stream "}\n") + 3815 # convert + 3816 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3817 (flush _test-output-buffered-file) + 3818 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3824 # check output + 3825 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types/0") + 3826 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types/1") + 3827 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types/2") + 3828 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types/3") + 3829 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types/4") + 3830 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types/5") + 3831 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types/6") + 3832 (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") + 3833 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-length-of-array-of-user-defined-types/8") + 3834 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types/9") + 3835 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types/10") + 3836 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types/11") + 3837 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types/12") + 3838 (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") + 3839 (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") + 3840 (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") + 3841 (check-next-stream-line-equal _test-output-stream " 89/<- %ebx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types/16") + 3842 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types/17") + 3843 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types/18") + 3844 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types/19") + 3845 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ebx" "F - test-convert-length-of-array-of-user-defined-types/20") + 3846 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types/21") + 3847 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types/22") + 3848 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types/23") + 3849 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types/24") + 3850 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types/25") + 3851 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types/26") + 3852 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types/27") + 3853 # . epilogue + 3854 89/<- %esp 5/r32/ebp + 3855 5d/pop-to-ebp + 3856 c3/return + 3857 + 3858 ####################################################### + 3859 # Parsing + 3860 ####################################################### + 3861 + 3862 parse-mu: # in: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) + 3863 # pseudocode + 3864 # var curr-function: (addr handle function) = Program->functions + 3865 # var curr-type: (addr handle typeinfo) = Program->types + 3866 # var line: (stream byte 512) + 3867 # var word-slice: slice + 3868 # while true # line loop + 3869 # clear-stream(line) + 3870 # read-line-buffered(in, line) + 3871 # if (line->write == 0) break # end of file + 3872 # word-slice = next-mu-token(line) + 3873 # if slice-empty?(word-slice) # end of line + 3874 # continue + 3875 # else if slice-starts-with?(word-slice, "#") # comment + 3876 # continue # end of line + 3877 # else if slice-equal?(word-slice, "fn") + 3878 # var new-function: (handle function) = allocate(function) + 3879 # var vars: (stack live-var 256) + 3880 # populate-mu-function-header(line, new-function, vars) + 3881 # populate-mu-function-body(in, new-function, vars) + 3882 # assert(vars->top == 0) + 3883 # *curr-function = new-function + 3884 # curr-function = &new-function->next + 3885 # else if slice-equal?(word-slice, "type") + 3886 # word-slice = next-mu-token(line) + 3887 # type-id = pos-or-insert-slice(Type-id, word-slice) + 3888 # var new-type: (handle typeinfo) = find-or-create-typeinfo(type-id) + 3889 # assert(next-word(line) == "{") + 3890 # populate-mu-type(in, new-type) + 3891 # else + 3892 # abort() + 3893 # + 3894 # . prologue + 3895 55/push-ebp + 3896 89/<- %ebp 4/r32/esp + 3897 # . save registers + 3898 50/push-eax + 3899 51/push-ecx + 3900 52/push-edx + 3901 53/push-ebx + 3902 56/push-esi + 3903 57/push-edi + 3904 # var line/ecx: (stream byte 512) + 3905 81 5/subop/subtract %esp 0x200/imm32 + 3906 68/push 0x200/imm32/size + 3907 68/push 0/imm32/read + 3908 68/push 0/imm32/write + 3909 89/<- %ecx 4/r32/esp + 3910 # var word-slice/edx: slice + 3911 68/push 0/imm32/end + 3912 68/push 0/imm32/start + 3913 89/<- %edx 4/r32/esp + 3914 # var curr-function/edi: (addr handle function) + 3915 bf/copy-to-edi _Program-functions/imm32 + 3916 # var vars/ebx: (stack live-var 256) + 3917 81 5/subop/subtract %esp 0xc00/imm32 + 3918 68/push 0xc00/imm32/size + 3919 68/push 0/imm32/top + 3920 89/<- %ebx 4/r32/esp + 3921 { + 3922 $parse-mu:line-loop: + 3923 (clear-stream %ecx) + 3924 (read-line-buffered *(ebp+8) %ecx) + 3925 # if (line->write == 0) break + 3926 81 7/subop/compare *ecx 0/imm32 + 3927 0f 84/jump-if-= break/disp32 + 3928 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------ + 3934 (next-mu-token %ecx %edx) + 3935 # if slice-empty?(word-slice) continue + 3936 (slice-empty? %edx) # => eax + 3937 3d/compare-eax-and 0/imm32/false + 3938 0f 85/jump-if-!= loop/disp32 + 3939 # if (*word-slice->start == "#") continue + 3940 # . eax = *word-slice->start + 3941 8b/-> *edx 0/r32/eax + 3942 8a/copy-byte *eax 0/r32/AL + 3943 81 4/subop/and %eax 0xff/imm32 + 3944 # . if (eax == '#') continue + 3945 3d/compare-eax-and 0x23/imm32/hash + 3946 0f 84/jump-if-= loop/disp32 + 3947 # if (slice-equal?(word-slice, "fn")) parse a function + 3948 { + 3949 $parse-mu:fn: + 3950 (slice-equal? %edx "fn") # => eax + 3951 3d/compare-eax-and 0/imm32/false + 3952 0f 84/jump-if-= break/disp32 + 3953 # var new-function/esi: (handle function) + 3954 68/push 0/imm32 + 3955 68/push 0/imm32 + 3956 89/<- %esi 4/r32/esp + 3957 # populate-mu-function(line, in, vars, new-function) + 3958 (allocate Heap *Function-size %esi) + 3959 # var new-function-addr/eax: (addr function) + 3960 (lookup *esi *(esi+4)) # => eax + 3961 (clear-stack %ebx) + 3962 (populate-mu-function-header %ecx %eax %ebx *(ebp+0xc) *(ebp+0x10)) + 3963 (populate-mu-function-body *(ebp+8) %eax %ebx *(ebp+0xc) *(ebp+0x10)) + 3964 # *curr-function = new-function + 3965 8b/-> *esi 0/r32/eax + 3966 89/<- *edi 0/r32/eax + 3967 8b/-> *(esi+4) 0/r32/eax + 3968 89/<- *(edi+4) 0/r32/eax + 3969 # curr-function = &new-function->next + 3970 # . var tmp/eax: (addr function) = lookup(new-function) + 3971 (lookup *esi *(esi+4)) # => eax + 3972 # . curr-function = &tmp->next + 3973 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next + 3974 # reclaim new-function + 3975 81 0/subop/add %esp 8/imm32 + 3976 # + 3977 e9/jump $parse-mu:line-loop/disp32 + 3978 } + 3979 # if (slice-equal?(word-slice, "type")) parse a type (struct/record) definition + 3980 { + 3981 $parse-mu:type: + 3982 (slice-equal? %edx "type") # => eax + 3983 3d/compare-eax-and 0/imm32 + 3984 0f 84/jump-if-= break/disp32 + 3985 (next-mu-token %ecx %edx) + 3986 # var type-id/eax: int + 3987 (pos-or-insert-slice Type-id %edx) # => eax + 3988 # spill + 3989 51/push-ecx + 3990 # var new-type/ecx: (handle typeinfo) + 3991 68/push 0/imm32 + 3992 68/push 0/imm32 + 3993 89/<- %ecx 4/r32/esp + 3994 (find-or-create-typeinfo %eax %ecx) + 3995 # + 3996 (lookup *ecx *(ecx+4)) # => eax + 3997 # TODO: ensure that 'line' has nothing else but '{' + 3998 #? (dump-typeinfos "=== aaa\n") + 3999 (populate-mu-type *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) # => eax + 4000 #? (dump-typeinfos "=== zzz\n") + 4001 # reclaim new-type + 4002 81 0/subop/add %esp 8/imm32 + 4003 # restore + 4004 59/pop-to-ecx + 4005 e9/jump $parse-mu:line-loop/disp32 + 4006 } + 4007 # otherwise abort + 4008 e9/jump $parse-mu:error1/disp32 + 4009 } # end line loop + 4010 $parse-mu:end: + 4011 # . reclaim locals + 4012 81 0/subop/add %esp 0xe1c/imm32 + 4013 # . restore registers + 4014 5f/pop-to-edi + 4015 5e/pop-to-esi + 4016 5b/pop-to-ebx + 4017 5a/pop-to-edx + 4018 59/pop-to-ecx + 4019 58/pop-to-eax + 4020 # . epilogue + 4021 89/<- %esp 5/r32/ebp + 4022 5d/pop-to-ebp + 4023 c3/return + 4024 + 4025 $parse-mu:error1: + 4026 # error("unexpected top-level command: " word-slice "\n") + 4027 (write-buffered *(ebp+0xc) "unexpected top-level command: ") + 4028 (write-slice-buffered *(ebp+0xc) %edx) + 4029 (write-buffered *(ebp+0xc) "\n") + 4030 (flush *(ebp+0xc)) + 4031 (stop *(ebp+0x10) 1) + 4032 # never gets here + 4033 + 4034 $parse-mu:error2: + 4035 # error(vars->top " vars not reclaimed after fn '" new-function->name "'\n") + 4036 (print-int32-buffered *(ebp+0xc) *ebx) + 4037 (write-buffered *(ebp+0xc) " vars not reclaimed after fn '") + 4038 (write-slice-buffered *(ebp+0xc) *eax) # Function-name + 4039 (write-buffered *(ebp+0xc) "'\n") + 4040 (flush *(ebp+0xc)) + 4041 (stop *(ebp+0x10) 1) + 4042 # never gets here + 4043 + 4044 # scenarios considered: + 4045 # ✗ fn foo # no block + 4046 # ✓ fn foo { + 4047 # ✗ fn foo { { + 4048 # ✗ fn foo { } + 4049 # ✗ fn foo { } { + 4050 # ✗ fn foo x { + 4051 # ✗ fn foo x: { + 4052 # ✓ fn foo x: int { + 4053 # ✓ fn foo x: int { + 4054 # ✓ fn foo x: int -> y/eax: int { + 4055 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) + 4056 # pseudocode: + 4057 # var name: slice + 4058 # next-mu-token(first-line, name) + 4059 # assert(name not in '{' '}' '->') + 4060 # out->name = slice-to-string(name) + 4061 # ## inouts + 4062 # while true + 4063 # ## name + 4064 # name = next-mu-token(first-line) + 4065 # if (name == '{') goto done + 4066 # if (name == '->') break + 4067 # assert(name != '}') + 4068 # var v: (handle var) = parse-var-with-type(name, first-line) + 4069 # assert(v->register == null) + 4070 # # v->block-depth is implicitly 0 + 4071 # out->inouts = append(v, out->inouts) + 4072 # push(vars, {v, false}) + 4073 # ## outputs + 4074 # while true + 4075 # ## name + 4076 # name = next-mu-token(first-line) + 4077 # assert(name not in '{' '}' '->') + 4078 # var v: (handle var) = parse-var-with-type(name, first-line) + 4079 # assert(v->register != null) + 4080 # out->outputs = append(v, out->outputs) + 4081 # done: + 4082 # + 4083 # . prologue + 4084 55/push-ebp + 4085 89/<- %ebp 4/r32/esp + 4086 # . save registers + 4087 50/push-eax + 4088 51/push-ecx + 4089 52/push-edx + 4090 53/push-ebx + 4091 57/push-edi + 4092 # edi = out + 4093 8b/-> *(ebp+0xc) 7/r32/edi + 4094 # var word-slice/ecx: slice + 4095 68/push 0/imm32/end + 4096 68/push 0/imm32/start + 4097 89/<- %ecx 4/r32/esp + 4098 # var v/ebx: (handle var) + 4099 68/push 0/imm32 + 4100 68/push 0/imm32 + 4101 89/<- %ebx 4/r32/esp + 4102 # read function name + 4103 (next-mu-token *(ebp+8) %ecx) + 4104 # error checking + 4105 # TODO: error if name starts with 'break' or 'loop' + 4106 # if (word-slice == '{') abort + 4107 (slice-equal? %ecx "{") # => eax + 4108 3d/compare-eax-and 0/imm32/false + 4109 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 4110 # if (word-slice == '->') abort + 4111 (slice-equal? %ecx "->") # => eax + 4112 3d/compare-eax-and 0/imm32/false + 4113 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 4114 # if (word-slice == '}') abort + 4115 (slice-equal? %ecx "}") # => eax + 4116 3d/compare-eax-and 0/imm32/false + 4117 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 4118 # save function name + 4119 (slice-to-string Heap %ecx %edi) # Function-name + 4120 # save function inouts 4121 { - 4122 $populate-mu-function-header:check-for-out: - 4123 (next-mu-token *(ebp+8) %ecx) - 4124 # if (word-slice == '{') break + 4122 $populate-mu-function-header:check-for-inout: + 4123 (next-mu-token *(ebp+8) %ecx) + 4124 # if (word-slice == '{') goto done 4125 (slice-equal? %ecx "{") # => eax 4126 3d/compare-eax-and 0/imm32/false - 4127 0f 85/jump-if-!= break/disp32 - 4128 # if (word-slice == '->') abort + 4127 0f 85/jump-if-!= $populate-mu-function-header:done/disp32 + 4128 # if (word-slice == '->') break 4129 (slice-equal? %ecx "->") # => eax 4130 3d/compare-eax-and 0/imm32/false - 4131 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 4131 0f 85/jump-if-!= break/disp32 4132 # if (word-slice == '}') abort 4133 (slice-equal? %ecx "}") # => eax 4134 3d/compare-eax-and 0/imm32/false 4135 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 4136 # v = parse-var-with-type(word-slice, first-line) - 4137 (parse-var-with-type %ecx *(ebp+8) %ebx) - 4138 # assert(var->register != null) + 4137 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x14) *(ebp+0x18)) + 4138 # assert(v->register == null) 4139 # . eax: (addr var) = lookup(v) - 4140 (lookup *ebx *(ebx+4)) # => eax + 4140 (lookup *ebx *(ebx+4)) # => eax 4141 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register - 4142 0f 84/jump-if-= $populate-mu-function-header:error3/disp32 - 4143 # out->outputs = append(v, out->outputs) - 4144 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs - 4145 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs - 4146 # - 4147 e9/jump loop/disp32 - 4148 } - 4149 $populate-mu-function-header:done: - 4150 (check-no-tokens-left *(ebp+8)) - 4151 $populate-mu-function-header:end: - 4152 # . reclaim locals - 4153 81 0/subop/add %esp 0x10/imm32 - 4154 # . restore registers - 4155 5f/pop-to-edi - 4156 5b/pop-to-ebx - 4157 5a/pop-to-edx - 4158 59/pop-to-ecx - 4159 58/pop-to-eax - 4160 # . epilogue - 4161 89/<- %esp 5/r32/ebp - 4162 5d/pop-to-ebp - 4163 c3/return - 4164 - 4165 $populate-mu-function-header:error1: - 4166 # error("function header not in form 'fn <name> {'") - 4167 (write-buffered Stderr "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '") - 4168 (flush Stderr) - 4169 (rewind-stream *(ebp+8)) - 4170 (write-stream 2 *(ebp+8)) - 4171 (write-buffered Stderr "'\n") - 4172 (flush Stderr) - 4173 # . syscall(exit, 1) - 4174 bb/copy-to-ebx 1/imm32 - 4175 b8/copy-to-eax 1/imm32/exit - 4176 cd/syscall 0x80/imm8 - 4177 # never gets here - 4178 - 4179 $populate-mu-function-header:error2: - 4180 # error("function input '" var "' cannot be in a register") - 4181 (write-buffered Stderr "function input '") - 4182 (write-buffered Stderr *ebx) # Var-name - 4183 (write-buffered Stderr "' cannot be in a register") - 4184 (flush Stderr) - 4185 # . syscall(exit, 1) - 4186 bb/copy-to-ebx 1/imm32 - 4187 b8/copy-to-eax 1/imm32/exit - 4188 cd/syscall 0x80/imm8 - 4189 # never gets here - 4190 - 4191 $populate-mu-function-header:error3: - 4192 # error("function input '" var "' must be in a register") - 4193 (write-buffered Stderr "function input '") - 4194 (lookup *ebx *(ebx+4)) # => eax - 4195 (lookup *eax *(eax+4)) # Var-name Var-name => eax - 4196 (write-buffered Stderr %eax) - 4197 (write-buffered Stderr "' must be in a register, in instruction '") - 4198 (flush Stderr) - 4199 (rewind-stream *(ebp+8)) - 4200 (write-stream 2 *(ebp+8)) - 4201 (write-buffered Stderr "'\n") - 4202 (flush Stderr) - 4203 # . syscall(exit, 1) - 4204 bb/copy-to-ebx 1/imm32 - 4205 b8/copy-to-eax 1/imm32/exit - 4206 cd/syscall 0x80/imm8 - 4207 # never gets here - 4208 - 4209 test-function-header-with-arg: - 4210 # . prologue - 4211 55/push-ebp - 4212 89/<- %ebp 4/r32/esp - 4213 # setup - 4214 (clear-stream _test-input-stream) - 4215 (write _test-input-stream "foo n: int {\n") - 4216 # var result/ecx: function - 4217 2b/subtract *Function-size 4/r32/esp - 4218 89/<- %ecx 4/r32/esp - 4219 (zero-out %ecx *Function-size) - 4220 # var vars/ebx: (stack live-var 16) - 4221 81 5/subop/subtract %esp 0xc0/imm32 - 4222 68/push 0xc0/imm32/size - 4223 68/push 0/imm32/top - 4224 89/<- %ebx 4/r32/esp - 4225 # convert - 4226 (populate-mu-function-header _test-input-stream %ecx %ebx) - 4227 # check result->name - 4228 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax - 4229 (check-strings-equal %eax "foo" "F - test-function-header-with-arg/name") - 4230 # var v/edx: (addr var) = result->inouts->value - 4231 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax - 4232 (lookup *eax *(eax+4)) # List-value List-value => eax - 4233 89/<- %edx 0/r32/eax - 4234 # check v->name - 4235 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 4236 (check-strings-equal %eax "n" "F - test-function-header-with-arg/inout:0") - 4237 # check v->type - 4238 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 4239 (check-ints-equal *eax 1 "F - test-function-header-with-arg/inout:0/type:0") # Tree-is-atom - 4240 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-arg/inout:0/type:1") # Tree-value - 4241 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-arg/inout:0/type:2") # Tree-right - 4242 # . epilogue - 4243 89/<- %esp 5/r32/ebp - 4244 5d/pop-to-ebp - 4245 c3/return - 4246 - 4247 test-function-header-with-multiple-args: - 4248 # . prologue - 4249 55/push-ebp - 4250 89/<- %ebp 4/r32/esp - 4251 # setup - 4252 (clear-stream _test-input-stream) - 4253 (write _test-input-stream "foo a: int, b: int c: int {\n") - 4254 # result/ecx: function - 4255 2b/subtract *Function-size 4/r32/esp - 4256 89/<- %ecx 4/r32/esp - 4257 (zero-out %ecx *Function-size) - 4258 # var vars/ebx: (stack live-var 16) - 4259 81 5/subop/subtract %esp 0xc0/imm32 - 4260 68/push 0xc0/imm32/size - 4261 68/push 0/imm32/top - 4262 89/<- %ebx 4/r32/esp - 4263 # convert - 4264 (populate-mu-function-header _test-input-stream %ecx %ebx) - 4265 # check result->name - 4266 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax - 4267 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args/name") - 4268 # var inouts/edx: (addr list var) = lookup(result->inouts) - 4269 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax - 4270 89/<- %edx 0/r32/eax - 4271 $test-function-header-with-multiple-args:inout0: - 4272 # var v/ebx: (addr var) = lookup(inouts->value) - 4273 (lookup *edx *(edx+4)) # List-value List-value => eax - 4274 89/<- %ebx 0/r32/eax - 4275 # check v->name - 4276 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4277 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args/inout:0") # Var-name - 4278 # check v->type - 4279 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4280 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:0/type:0") # Tree-is-atom - 4281 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:0/type:1") # Tree-value - 4282 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:0/type:2") # Tree-right - 4283 $test-function-header-with-multiple-args:inout1: - 4284 # inouts = lookup(inouts->next) - 4285 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax - 4286 89/<- %edx 0/r32/eax - 4287 # v = lookup(inouts->value) - 4288 (lookup *edx *(edx+4)) # List-value List-value => eax - 4289 89/<- %ebx 0/r32/eax - 4290 # check v->name - 4291 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4292 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args/inout:1") # Var-name - 4293 # check v->type - 4294 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4295 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:1/type:0") # Tree-is-atom - 4296 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:1/type:1") # Tree-value - 4297 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:1/type:2") # Tree-right - 4298 $test-function-header-with-multiple-args:inout2: - 4299 # inouts = lookup(inouts->next) - 4300 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax - 4301 89/<- %edx 0/r32/eax - 4302 # v = lookup(inouts->value) - 4303 (lookup *edx *(edx+4)) # List-value List-value => eax - 4304 89/<- %ebx 0/r32/eax - 4305 # check v->name - 4306 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4307 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args/inout:2") # Var-name - 4308 # check v->type - 4309 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4310 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:2/type:0") # Tree-is-atom - 4311 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:2/type:1") # Tree-value - 4312 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:2/type:2") # Tree-right - 4313 # . epilogue - 4314 89/<- %esp 5/r32/ebp - 4315 5d/pop-to-ebp - 4316 c3/return - 4317 - 4318 test-function-header-with-multiple-args-and-outputs: - 4319 # . prologue - 4320 55/push-ebp - 4321 89/<- %ebp 4/r32/esp - 4322 # setup - 4323 (clear-stream _test-input-stream) - 4324 (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx: int {\n") - 4325 # result/ecx: function - 4326 2b/subtract *Function-size 4/r32/esp - 4327 89/<- %ecx 4/r32/esp - 4328 (zero-out %ecx *Function-size) - 4329 # var vars/ebx: (stack live-var 16) - 4330 81 5/subop/subtract %esp 0xc0/imm32 - 4331 68/push 0xc0/imm32/size - 4332 68/push 0/imm32/top - 4333 89/<- %ebx 4/r32/esp - 4334 # convert - 4335 (populate-mu-function-header _test-input-stream %ecx %ebx) - 4336 # check result->name - 4337 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax - 4338 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args-and-outputs/name") - 4339 # var inouts/edx: (addr list var) = lookup(result->inouts) - 4340 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax - 4341 89/<- %edx 0/r32/eax - 4342 $test-function-header-with-multiple-args-and-outputs:inout0: - 4343 # var v/ebx: (addr var) = lookup(inouts->value) - 4344 (lookup *edx *(edx+4)) # List-value List-value => eax - 4345 89/<- %ebx 0/r32/eax - 4346 # check v->name - 4347 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4348 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0") - 4349 # check v->type - 4350 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4351 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0") # Tree-is-atom - 4352 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1") # Tree-value - 4353 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:2") # Tree-right - 4354 $test-function-header-with-multiple-args-and-outputs:inout1: - 4355 # inouts = lookup(inouts->next) - 4356 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax - 4357 89/<- %edx 0/r32/eax - 4358 # v = lookup(inouts->value) - 4359 (lookup *edx *(edx+4)) # List-value List-value => eax - 4360 89/<- %ebx 0/r32/eax - 4361 # check v->name - 4362 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4363 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1") - 4364 # check v->type - 4365 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4366 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0") # Tree-is-atom - 4367 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1") # Tree-value - 4368 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:2") # Tree-right - 4369 $test-function-header-with-multiple-args-and-outputs:inout2: - 4370 # inouts = lookup(inouts->next) - 4371 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax - 4372 89/<- %edx 0/r32/eax - 4373 # v = lookup(inouts->value) - 4374 (lookup *edx *(edx+4)) # List-value List-value => eax - 4375 89/<- %ebx 0/r32/eax - 4376 # check v->name - 4377 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4378 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2") - 4379 # check v->type - 4380 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4381 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0") # Tree-is-atom - 4382 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1") # Tree-value - 4383 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:2") # Tree-right - 4384 $test-function-header-with-multiple-args-and-outputs:out0: - 4385 # var outputs/edx: (addr list var) = lookup(result->outputs) - 4386 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax - 4387 89/<- %edx 0/r32/eax - 4388 # v = lookup(outputs->value) - 4389 (lookup *edx *(edx+4)) # List-value List-value => eax - 4390 89/<- %ebx 0/r32/eax - 4391 # check v->name - 4392 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4393 (check-strings-equal %eax "x" "F - test-function-header-with-multiple-args-and-outputs/output:0") - 4394 # check v->register - 4395 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax - 4396 (check-strings-equal %eax "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register") - 4397 # check v->type - 4398 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4399 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:0") # Tree-is-atom - 4400 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1") # Tree-value - 4401 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:2") # Tree-right - 4402 $test-function-header-with-multiple-args-and-outputs:out1: - 4403 # outputs = lookup(outputs->next) - 4404 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax - 4405 89/<- %edx 0/r32/eax - 4406 # v = lookup(inouts->value) - 4407 (lookup *edx *(edx+4)) # List-value List-value => eax - 4408 89/<- %ebx 0/r32/eax - 4409 # check v->name - 4410 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4411 (check-strings-equal %eax "y" "F - test-function-header-with-multiple-args-and-outputs/output:1") - 4412 # check v->register - 4413 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax - 4414 (check-strings-equal %eax "edx" "F - test-function-header-with-multiple-args-and-outputs/output:1/register") - 4415 # check v->type - 4416 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4417 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:0") # Tree-is-atom - 4418 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1") # Tree-value - 4419 (check-ints-equal *(eax+0c) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:2") # Tree-right - 4420 # . epilogue - 4421 89/<- %esp 5/r32/ebp - 4422 5d/pop-to-ebp - 4423 c3/return - 4424 - 4425 # format for variables with types - 4426 # x: int - 4427 # x: int, - 4428 # x/eax: int - 4429 # x/eax: int, - 4430 # ignores at most one trailing comma - 4431 # WARNING: modifies name - 4432 parse-var-with-type: # name: (addr slice), first-line: (addr stream byte), out: (addr handle var) - 4433 # pseudocode: - 4434 # var s: slice - 4435 # if (!slice-ends-with(name, ":")) - 4436 # abort - 4437 # --name->end to skip ':' - 4438 # next-token-from-slice(name->start, name->end, '/', s) - 4439 # new-var-from-slice(s, out) - 4440 # ## register - 4441 # next-token-from-slice(s->end, name->end, '/', s) - 4442 # if (!slice-empty?(s)) - 4443 # out->register = slice-to-string(s) - 4444 # ## type - 4445 # var type: (handle tree type-id) = parse-type(first-line) - 4446 # out->type = type - 4447 # - 4448 # . prologue - 4449 55/push-ebp - 4450 89/<- %ebp 4/r32/esp - 4451 # . save registers - 4452 50/push-eax - 4453 51/push-ecx - 4454 52/push-edx - 4455 53/push-ebx - 4456 56/push-esi - 4457 57/push-edi - 4458 # esi = name - 4459 8b/-> *(ebp+8) 6/r32/esi - 4460 # if (!slice-ends-with?(name, ":")) abort - 4461 8b/-> *(esi+4) 1/r32/ecx # Slice-end - 4462 49/decrement-ecx - 4463 8a/copy-byte *ecx 1/r32/CL - 4464 81 4/subop/and %ecx 0xff/imm32 - 4465 81 7/subop/compare %ecx 0x3a/imm32/colon - 4466 0f 85/jump-if-!= $parse-var-with-type:abort/disp32 - 4467 # --name->end to skip ':' - 4468 ff 1/subop/decrement *(esi+4) - 4469 # var s/ecx: slice - 4470 68/push 0/imm32/end - 4471 68/push 0/imm32/start - 4472 89/<- %ecx 4/r32/esp - 4473 $parse-var-with-type:parse-name: - 4474 (next-token-from-slice *esi *(esi+4) 0x2f %ecx) # Slice-start, Slice-end, '/' - 4475 $parse-var-with-type:create-var: - 4476 # new-var-from-slice(s, out) - 4477 (new-var-from-slice Heap %ecx *(ebp+0x10)) - 4478 # save out->register - 4479 $parse-var-with-type:save-register: - 4480 # . var out-addr/edi: (addr var) = lookup(*out) - 4481 8b/-> *(ebp+0x10) 7/r32/edi - 4482 (lookup *edi *(edi+4)) # => eax - 4483 89/<- %edi 0/r32/eax - 4484 # . s = next-token(...) - 4485 (next-token-from-slice *(ecx+4) *(esi+4) 0x2f %ecx) # s->end, name->end, '/' - 4486 # . if (!slice-empty?(s)) out->register = slice-to-string(s) - 4487 { - 4488 $parse-var-with-type:write-register: - 4489 (slice-empty? %ecx) # => eax - 4490 3d/compare-eax-and 0/imm32/false - 4491 75/jump-if-!= break/disp8 - 4492 # out->register = slice-to-string(s) - 4493 8d/copy-address *(edi+0x18) 0/r32/eax # Var-register - 4494 (slice-to-string Heap %ecx %eax) - 4495 } - 4496 $parse-var-with-type:save-type: - 4497 8d/copy-address *(edi+8) 0/r32/eax # Var-type - 4498 (parse-type Heap *(ebp+0xc) %eax) - 4499 $parse-var-with-type:end: - 4500 # . reclaim locals - 4501 81 0/subop/add %esp 8/imm32 - 4502 # . restore registers - 4503 5f/pop-to-edi - 4504 5e/pop-to-esi - 4505 5b/pop-to-ebx - 4506 5a/pop-to-edx - 4507 59/pop-to-ecx - 4508 58/pop-to-eax - 4509 # . epilogue - 4510 89/<- %esp 5/r32/ebp - 4511 5d/pop-to-ebp - 4512 c3/return - 4513 - 4514 $parse-var-with-type:abort: - 4515 # error("var should have form 'name: type' in '" line "'\n") - 4516 (write-buffered Stderr "var should have form 'name: type' in '") - 4517 (flush Stderr) - 4518 (rewind-stream *(ebp+0xc)) - 4519 (write-stream 2 *(ebp+0xc)) - 4520 (write-buffered Stderr "'\n") - 4521 (flush Stderr) - 4522 # . syscall(exit, 1) - 4523 bb/copy-to-ebx 1/imm32 - 4524 b8/copy-to-eax 1/imm32/exit - 4525 cd/syscall 0x80/imm8 - 4526 # never gets here - 4527 - 4528 parse-type: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle tree type-id) - 4529 # pseudocode: - 4530 # var s: slice = next-mu-token(in) - 4531 # assert s != "" - 4532 # assert s != "->" - 4533 # assert s != "{" - 4534 # assert s != "}" - 4535 # if s == ")" - 4536 # return - 4537 # out = allocate(Tree) - 4538 # if s != "(" - 4539 # HACK: if s is an int, parse and return it - 4540 # out->left-is-atom? = true - 4541 # out->value = pos-or-insert-slice(Type-id, s) - 4542 # return - 4543 # out->left = parse-type(ad, in) - 4544 # out->right = parse-type-tree(ad, in) - 4545 # - 4546 # . prologue - 4547 55/push-ebp - 4548 89/<- %ebp 4/r32/esp - 4549 # . save registers - 4550 50/push-eax - 4551 51/push-ecx - 4552 52/push-edx - 4553 # clear out - 4554 (zero-out *(ebp+0x10) *Handle-size) - 4555 # var s/ecx: slice - 4556 68/push 0/imm32 - 4557 68/push 0/imm32 - 4558 89/<- %ecx 4/r32/esp - 4559 # s = next-mu-token(in) - 4560 (next-mu-token *(ebp+0xc) %ecx) - 4561 #? (write-buffered Stderr "tok: ") - 4562 #? (write-slice-buffered Stderr %ecx) - 4563 #? (write-buffered Stderr "$\n") - 4564 #? (flush Stderr) - 4565 # assert s != "" - 4566 (slice-equal? %ecx "") # => eax - 4567 3d/compare-eax-and 0/imm32/false - 4568 0f 85/jump-if-!= $parse-type:abort/disp32 - 4569 # assert s != "{" - 4570 (slice-equal? %ecx "{") # => eax - 4571 3d/compare-eax-and 0/imm32/false - 4572 0f 85/jump-if-!= $parse-type:abort/disp32 - 4573 # assert s != "}" - 4574 (slice-equal? %ecx "}") # => eax - 4575 3d/compare-eax-and 0/imm32/false - 4576 0f 85/jump-if-!= $parse-type:abort/disp32 - 4577 # assert s != "->" - 4578 (slice-equal? %ecx "->") # => eax - 4579 3d/compare-eax-and 0/imm32/false - 4580 0f 85/jump-if-!= $parse-type:abort/disp32 - 4581 # if (s == ")") return - 4582 (slice-equal? %ecx ")") # => eax - 4583 3d/compare-eax-and 0/imm32/false - 4584 0f 85/jump-if-!= $parse-type:end/disp32 - 4585 # out = new tree - 4586 (allocate *(ebp+8) *Tree-size *(ebp+0x10)) - 4587 # var out-addr/edx: (addr tree type-id) = lookup(*out) - 4588 8b/-> *(ebp+0x10) 2/r32/edx - 4589 (lookup *edx *(edx+4)) # => eax - 4590 89/<- %edx 0/r32/eax - 4591 { - 4592 # if (s != "(") break - 4593 (slice-equal? %ecx "(") # => eax - 4594 3d/compare-eax-and 0/imm32/false - 4595 75/jump-if-!= break/disp8 - 4596 # EGREGIOUS HACK for static array sizes: if s is a number, parse it - 4597 { - 4598 $parse-type:check-for-int: - 4599 (is-hex-int? %ecx) # => eax - 4600 3d/compare-eax-and 0/imm32/false - 4601 74/jump-if-= break/disp8 - 4602 $parse-type:int: - 4603 (parse-hex-int-from-slice %ecx) # => eax - 4604 89/<- *(edx+4) 0/r32/eax # Tree-value - 4605 e9/jump $parse-type:end/disp32 - 4606 } - 4607 $parse-type:atom: - 4608 # out->left-is-atom? = true - 4609 c7 0/subop/copy *edx 1/imm32/true # Tree-is-atom - 4610 # out->value = pos-or-insert-slice(Type-id, s) - 4611 (pos-or-insert-slice Type-id %ecx) # => eax - 4612 89/<- *(edx+4) 0/r32/eax # Tree-value - 4613 e9/jump $parse-type:end/disp32 - 4614 } - 4615 $parse-type:non-atom: - 4616 # otherwise s == "(" - 4617 # out->left = parse-type(ad, in) - 4618 8d/copy-address *(edx+4) 0/r32/eax # Tree-left - 4619 (parse-type *(ebp+8) *(ebp+0xc) %eax) - 4620 # out->right = parse-type-tree(ad, in) - 4621 8d/copy-address *(edx+0xc) 0/r32/eax # Tree-right - 4622 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax) - 4623 $parse-type:end: - 4624 # . reclaim locals - 4625 81 0/subop/add %esp 8/imm32 - 4626 # . restore registers - 4627 5a/pop-to-edx - 4628 59/pop-to-ecx - 4629 58/pop-to-eax - 4630 # . epilogue - 4631 89/<- %esp 5/r32/ebp - 4632 5d/pop-to-ebp - 4633 c3/return - 4634 - 4635 $parse-type:abort: - 4636 # error("unexpected token when parsing type: '" s "'\n") - 4637 (write-buffered Stderr "unexpected token when parsing type: '") - 4638 (write-slice-buffered Stderr %ecx) - 4639 (write-buffered Stderr "'\n") - 4640 (flush Stderr) - 4641 # . syscall(exit, 1) - 4642 bb/copy-to-ebx 1/imm32 - 4643 b8/copy-to-eax 1/imm32/exit - 4644 cd/syscall 0x80/imm8 - 4645 # never gets here - 4646 - 4647 parse-type-tree: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle tree type-id) - 4648 # pseudocode: - 4649 # var tmp: (handle tree type-id) = parse-type(ad, in) - 4650 # if tmp == 0 - 4651 # return 0 - 4652 # out = allocate(Tree) - 4653 # out->left = tmp - 4654 # out->right = parse-type-tree(ad, in) - 4655 # - 4656 # . prologue - 4657 55/push-ebp - 4658 89/<- %ebp 4/r32/esp - 4659 # . save registers - 4660 50/push-eax - 4661 51/push-ecx - 4662 52/push-edx - 4663 # - 4664 (zero-out *(ebp+0x10) *Handle-size) - 4665 # var tmp/ecx: (handle tree type-id) - 4666 68/push 0/imm32 - 4667 68/push 0/imm32 - 4668 89/<- %ecx 4/r32/esp - 4669 # tmp = parse-type(ad, in) - 4670 (parse-type *(ebp+8) *(ebp+0xc) %ecx) - 4671 # if (tmp == 0) return - 4672 81 7/subop/compare *ecx 0/imm32 - 4673 74/jump-if-= $parse-type-tree:end/disp8 - 4674 # out = new tree - 4675 (allocate *(ebp+8) *Tree-size *(ebp+0x10)) - 4676 # var out-addr/edx: (addr tree) = lookup(*out) - 4677 8b/-> *(ebp+0x10) 2/r32/edx - 4678 (lookup *edx *(edx+4)) # => eax - 4679 89/<- %edx 0/r32/eax - 4680 # out->left = tmp - 4681 8b/-> *ecx 0/r32/eax - 4682 89/<- *(edx+4) 0/r32/eax # Tree-left - 4683 8b/-> *(ecx+4) 0/r32/eax - 4684 89/<- *(edx+8) 0/r32/eax # Tree-left - 4685 # out->right = parse-type-tree(ad, in) - 4686 8d/copy-address *(edx+0xc) 0/r32/eax # Tree-right - 4687 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax) - 4688 $parse-type-tree:end: - 4689 # . reclaim locals - 4690 81 0/subop/add %esp 8/imm32 - 4691 # . restore registers - 4692 5a/pop-to-edx - 4693 59/pop-to-ecx - 4694 58/pop-to-eax - 4695 # . epilogue - 4696 89/<- %esp 5/r32/ebp - 4697 5d/pop-to-ebp - 4698 c3/return - 4699 - 4700 next-mu-token: # in: (addr stream byte), out: (addr slice) - 4701 # pseudocode: - 4702 # start: - 4703 # skip-chars-matching-whitespace(in) - 4704 # if in->read >= in->write # end of in - 4705 # out = {0, 0} - 4706 # return - 4707 # out->start = &in->data[in->read] - 4708 # var curr-byte/eax: byte = in->data[in->read] - 4709 # if curr->byte == ',' # comment token - 4710 # ++in->read - 4711 # goto start - 4712 # if curr-byte == '#' # comment - 4713 # goto done # treat as eof - 4714 # if curr-byte == '"' # string literal - 4715 # skip-string(in) - 4716 # goto done # no metadata - 4717 # if curr-byte == '(' - 4718 # ++in->read - 4719 # goto done - 4720 # if curr-byte == ')' - 4721 # ++in->read - 4722 # goto done - 4723 # # read a word - 4724 # while true - 4725 # if in->read >= in->write - 4726 # break - 4727 # curr-byte = in->data[in->read] - 4728 # if curr-byte == ' ' - 4729 # break - 4730 # if curr-byte == '\r' - 4731 # break - 4732 # if curr-byte == '\n' - 4733 # break - 4734 # if curr-byte == '(' - 4735 # break - 4736 # if curr-byte == ')' - 4737 # break - 4738 # if curr-byte == ',' - 4739 # break - 4740 # ++in->read - 4741 # done: - 4742 # out->end = &in->data[in->read] - 4743 # - 4744 # . prologue - 4745 55/push-ebp - 4746 89/<- %ebp 4/r32/esp - 4747 # . save registers - 4748 50/push-eax - 4749 51/push-ecx - 4750 56/push-esi - 4751 57/push-edi - 4752 # esi = in - 4753 8b/-> *(ebp+8) 6/r32/esi - 4754 # edi = out - 4755 8b/-> *(ebp+0xc) 7/r32/edi - 4756 $next-mu-token:start: - 4757 (skip-chars-matching-whitespace %esi) - 4758 $next-mu-token:check0: - 4759 # if (in->read >= in->write) return out = {0, 0} - 4760 # . ecx = in->read - 4761 8b/-> *(esi+4) 1/r32/ecx - 4762 # . if (ecx >= in->write) return out = {0, 0} - 4763 3b/compare<- *esi 1/r32/ecx - 4764 c7 0/subop/copy *edi 0/imm32 - 4765 c7 0/subop/copy *(edi+4) 0/imm32 - 4766 0f 8d/jump-if->= $next-mu-token:end/disp32 - 4767 # out->start = &in->data[in->read] - 4768 8d/copy-address *(esi+ecx+0xc) 0/r32/eax - 4769 89/<- *edi 0/r32/eax - 4770 # var curr-byte/eax: byte = in->data[in->read] - 4771 31/xor-with %eax 0/r32/eax - 4772 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL - 4773 { - 4774 $next-mu-token:check-for-comma: - 4775 # if (curr-byte != ',') break - 4776 3d/compare-eax-and 0x2c/imm32/comma - 4777 75/jump-if-!= break/disp8 - 4778 # ++in->read - 4779 ff 0/subop/increment *(esi+4) - 4780 # restart - 4781 e9/jump $next-mu-token:start/disp32 - 4782 } - 4783 { - 4784 $next-mu-token:check-for-comment: - 4785 # if (curr-byte != '#') break - 4786 3d/compare-eax-and 0x23/imm32/pound - 4787 75/jump-if-!= break/disp8 - 4788 # return eof - 4789 e9/jump $next-mu-token:done/disp32 - 4790 } - 4791 { - 4792 $next-mu-token:check-for-string-literal: - 4793 # if (curr-byte != '"') break - 4794 3d/compare-eax-and 0x22/imm32/dquote - 4795 75/jump-if-!= break/disp8 - 4796 (skip-string %esi) - 4797 # return - 4798 e9/jump $next-mu-token:done/disp32 - 4799 } - 4800 { - 4801 $next-mu-token:check-for-open-paren: - 4802 # if (curr-byte != '(') break - 4803 3d/compare-eax-and 0x28/imm32/open-paren - 4804 75/jump-if-!= break/disp8 - 4805 # ++in->read - 4806 ff 0/subop/increment *(esi+4) - 4807 # return - 4808 e9/jump $next-mu-token:done/disp32 - 4809 } - 4810 { - 4811 $next-mu-token:check-for-close-paren: - 4812 # if (curr-byte != ')') break - 4813 3d/compare-eax-and 0x29/imm32/close-paren - 4814 75/jump-if-!= break/disp8 - 4815 # ++in->read - 4816 ff 0/subop/increment *(esi+4) + 4142 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32 + 4143 # v->block-depth is implicitly 0 + 4144 # + 4145 # out->inouts = append(v, out->inouts) + 4146 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts + 4147 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts + 4148 # push(vars, {v, false}) + 4149 (push *(ebp+0x10) *ebx) + 4150 (push *(ebp+0x10) *(ebx+4)) + 4151 (push *(ebp+0x10) 0) # false + 4152 # + 4153 e9/jump loop/disp32 + 4154 } + 4155 # save function outputs + 4156 { + 4157 $populate-mu-function-header:check-for-out: + 4158 (next-mu-token *(ebp+8) %ecx) + 4159 # if (word-slice == '{') break + 4160 (slice-equal? %ecx "{") # => eax + 4161 3d/compare-eax-and 0/imm32/false + 4162 0f 85/jump-if-!= break/disp32 + 4163 # if (word-slice == '->') abort + 4164 (slice-equal? %ecx "->") # => eax + 4165 3d/compare-eax-and 0/imm32/false + 4166 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 4167 # if (word-slice == '}') abort + 4168 (slice-equal? %ecx "}") # => eax + 4169 3d/compare-eax-and 0/imm32/false + 4170 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 4171 # v = parse-var-with-type(word-slice, first-line) + 4172 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x14) *(ebp+0x18)) + 4173 # assert(var->register != null) + 4174 # . eax: (addr var) = lookup(v) + 4175 (lookup *ebx *(ebx+4)) # => eax + 4176 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register + 4177 0f 84/jump-if-= $populate-mu-function-header:error3/disp32 + 4178 # out->outputs = append(v, out->outputs) + 4179 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs + 4180 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs + 4181 # + 4182 e9/jump loop/disp32 + 4183 } + 4184 $populate-mu-function-header:done: + 4185 (check-no-tokens-left *(ebp+8)) + 4186 $populate-mu-function-header:end: + 4187 # . reclaim locals + 4188 81 0/subop/add %esp 0x10/imm32 + 4189 # . restore registers + 4190 5f/pop-to-edi + 4191 5b/pop-to-ebx + 4192 5a/pop-to-edx + 4193 59/pop-to-ecx + 4194 58/pop-to-eax + 4195 # . epilogue + 4196 89/<- %esp 5/r32/ebp + 4197 5d/pop-to-ebp + 4198 c3/return + 4199 + 4200 $populate-mu-function-header:error1: + 4201 # error("function header not in form 'fn <name> {'") + 4202 (write-buffered *(ebp+0x14) "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '") + 4203 (flush *(ebp+0x14)) + 4204 (rewind-stream *(ebp+8)) + 4205 (write-stream 2 *(ebp+8)) + 4206 (write-buffered *(ebp+0x14) "'\n") + 4207 (flush *(ebp+0x14)) + 4208 (stop *(ebp+0x18) 1) + 4209 # never gets here + 4210 + 4211 $populate-mu-function-header:error2: + 4212 # error("function input '" var "' cannot be in a register") + 4213 (write-buffered *(ebp+0x14) "function input '") + 4214 (write-buffered *(ebp+0x14) *ebx) # Var-name + 4215 (write-buffered *(ebp+0x14) "' cannot be in a register") + 4216 (flush *(ebp+0x14)) + 4217 (stop *(ebp+0x18) 1) + 4218 # never gets here + 4219 + 4220 $populate-mu-function-header:error3: + 4221 # error("function input '" var "' must be in a register") + 4222 (write-buffered *(ebp+0x14) "function input '") + 4223 (lookup *ebx *(ebx+4)) # => eax + 4224 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 4225 (write-buffered *(ebp+0x14) %eax) + 4226 (write-buffered *(ebp+0x14) "' must be in a register, in instruction '") + 4227 (flush *(ebp+0x14)) + 4228 (rewind-stream *(ebp+8)) + 4229 (write-stream 2 *(ebp+8)) + 4230 (write-buffered *(ebp+0x14) "'\n") + 4231 (flush *(ebp+0x14)) + 4232 (stop *(ebp+0x18) 1) + 4233 # never gets here + 4234 + 4235 test-function-header-with-arg: + 4236 # . prologue + 4237 55/push-ebp + 4238 89/<- %ebp 4/r32/esp + 4239 # setup + 4240 (clear-stream _test-input-stream) + 4241 (write _test-input-stream "foo n: int {\n") + 4242 # var result/ecx: function + 4243 2b/subtract *Function-size 4/r32/esp + 4244 89/<- %ecx 4/r32/esp + 4245 (zero-out %ecx *Function-size) + 4246 # var vars/ebx: (stack live-var 16) + 4247 81 5/subop/subtract %esp 0xc0/imm32 + 4248 68/push 0xc0/imm32/size + 4249 68/push 0/imm32/top + 4250 89/<- %ebx 4/r32/esp + 4251 # convert + 4252 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) + 4253 # check result->name + 4254 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax + 4255 (check-strings-equal %eax "foo" "F - test-function-header-with-arg/name") + 4256 # var v/edx: (addr var) = result->inouts->value + 4257 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax + 4258 (lookup *eax *(eax+4)) # List-value List-value => eax + 4259 89/<- %edx 0/r32/eax + 4260 # check v->name + 4261 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 4262 (check-strings-equal %eax "n" "F - test-function-header-with-arg/inout:0") + 4263 # check v->type + 4264 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 4265 (check-ints-equal *eax 1 "F - test-function-header-with-arg/inout:0/type:0") # Tree-is-atom + 4266 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-arg/inout:0/type:1") # Tree-value + 4267 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-arg/inout:0/type:2") # Tree-right + 4268 # . epilogue + 4269 89/<- %esp 5/r32/ebp + 4270 5d/pop-to-ebp + 4271 c3/return + 4272 + 4273 test-function-header-with-multiple-args: + 4274 # . prologue + 4275 55/push-ebp + 4276 89/<- %ebp 4/r32/esp + 4277 # setup + 4278 (clear-stream _test-input-stream) + 4279 (write _test-input-stream "foo a: int, b: int c: int {\n") + 4280 # result/ecx: function + 4281 2b/subtract *Function-size 4/r32/esp + 4282 89/<- %ecx 4/r32/esp + 4283 (zero-out %ecx *Function-size) + 4284 # var vars/ebx: (stack live-var 16) + 4285 81 5/subop/subtract %esp 0xc0/imm32 + 4286 68/push 0xc0/imm32/size + 4287 68/push 0/imm32/top + 4288 89/<- %ebx 4/r32/esp + 4289 # convert + 4290 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) + 4291 # check result->name + 4292 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax + 4293 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args/name") + 4294 # var inouts/edx: (addr list var) = lookup(result->inouts) + 4295 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax + 4296 89/<- %edx 0/r32/eax + 4297 $test-function-header-with-multiple-args:inout0: + 4298 # var v/ebx: (addr var) = lookup(inouts->value) + 4299 (lookup *edx *(edx+4)) # List-value List-value => eax + 4300 89/<- %ebx 0/r32/eax + 4301 # check v->name + 4302 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 4303 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args/inout:0") # Var-name + 4304 # check v->type + 4305 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 4306 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:0/type:0") # Tree-is-atom + 4307 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:0/type:1") # Tree-value + 4308 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:0/type:2") # Tree-right + 4309 $test-function-header-with-multiple-args:inout1: + 4310 # inouts = lookup(inouts->next) + 4311 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 4312 89/<- %edx 0/r32/eax + 4313 # v = lookup(inouts->value) + 4314 (lookup *edx *(edx+4)) # List-value List-value => eax + 4315 89/<- %ebx 0/r32/eax + 4316 # check v->name + 4317 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 4318 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args/inout:1") # Var-name + 4319 # check v->type + 4320 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 4321 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:1/type:0") # Tree-is-atom + 4322 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:1/type:1") # Tree-value + 4323 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:1/type:2") # Tree-right + 4324 $test-function-header-with-multiple-args:inout2: + 4325 # inouts = lookup(inouts->next) + 4326 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 4327 89/<- %edx 0/r32/eax + 4328 # v = lookup(inouts->value) + 4329 (lookup *edx *(edx+4)) # List-value List-value => eax + 4330 89/<- %ebx 0/r32/eax + 4331 # check v->name + 4332 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 4333 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args/inout:2") # Var-name + 4334 # check v->type + 4335 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 4336 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:2/type:0") # Tree-is-atom + 4337 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:2/type:1") # Tree-value + 4338 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:2/type:2") # Tree-right + 4339 # . epilogue + 4340 89/<- %esp 5/r32/ebp + 4341 5d/pop-to-ebp + 4342 c3/return + 4343 + 4344 test-function-header-with-multiple-args-and-outputs: + 4345 # . prologue + 4346 55/push-ebp + 4347 89/<- %ebp 4/r32/esp + 4348 # setup + 4349 (clear-stream _test-input-stream) + 4350 (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx: int {\n") + 4351 # result/ecx: function + 4352 2b/subtract *Function-size 4/r32/esp + 4353 89/<- %ecx 4/r32/esp + 4354 (zero-out %ecx *Function-size) + 4355 # var vars/ebx: (stack live-var 16) + 4356 81 5/subop/subtract %esp 0xc0/imm32 + 4357 68/push 0xc0/imm32/size + 4358 68/push 0/imm32/top + 4359 89/<- %ebx 4/r32/esp + 4360 # convert + 4361 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) + 4362 # check result->name + 4363 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax + 4364 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args-and-outputs/name") + 4365 # var inouts/edx: (addr list var) = lookup(result->inouts) + 4366 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax + 4367 89/<- %edx 0/r32/eax + 4368 $test-function-header-with-multiple-args-and-outputs:inout0: + 4369 # var v/ebx: (addr var) = lookup(inouts->value) + 4370 (lookup *edx *(edx+4)) # List-value List-value => eax + 4371 89/<- %ebx 0/r32/eax + 4372 # check v->name + 4373 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 4374 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0") + 4375 # check v->type + 4376 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 4377 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0") # Tree-is-atom + 4378 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1") # Tree-value + 4379 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:2") # Tree-right + 4380 $test-function-header-with-multiple-args-and-outputs:inout1: + 4381 # inouts = lookup(inouts->next) + 4382 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 4383 89/<- %edx 0/r32/eax + 4384 # v = lookup(inouts->value) + 4385 (lookup *edx *(edx+4)) # List-value List-value => eax + 4386 89/<- %ebx 0/r32/eax + 4387 # check v->name + 4388 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 4389 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1") + 4390 # check v->type + 4391 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 4392 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0") # Tree-is-atom + 4393 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1") # Tree-value + 4394 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:2") # Tree-right + 4395 $test-function-header-with-multiple-args-and-outputs:inout2: + 4396 # inouts = lookup(inouts->next) + 4397 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 4398 89/<- %edx 0/r32/eax + 4399 # v = lookup(inouts->value) + 4400 (lookup *edx *(edx+4)) # List-value List-value => eax + 4401 89/<- %ebx 0/r32/eax + 4402 # check v->name + 4403 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 4404 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2") + 4405 # check v->type + 4406 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 4407 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0") # Tree-is-atom + 4408 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1") # Tree-value + 4409 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:2") # Tree-right + 4410 $test-function-header-with-multiple-args-and-outputs:out0: + 4411 # var outputs/edx: (addr list var) = lookup(result->outputs) + 4412 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax + 4413 89/<- %edx 0/r32/eax + 4414 # v = lookup(outputs->value) + 4415 (lookup *edx *(edx+4)) # List-value List-value => eax + 4416 89/<- %ebx 0/r32/eax + 4417 # check v->name + 4418 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 4419 (check-strings-equal %eax "x" "F - test-function-header-with-multiple-args-and-outputs/output:0") + 4420 # check v->register + 4421 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax + 4422 (check-strings-equal %eax "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register") + 4423 # check v->type + 4424 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 4425 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:0") # Tree-is-atom + 4426 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1") # Tree-value + 4427 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:2") # Tree-right + 4428 $test-function-header-with-multiple-args-and-outputs:out1: + 4429 # outputs = lookup(outputs->next) + 4430 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 4431 89/<- %edx 0/r32/eax + 4432 # v = lookup(inouts->value) + 4433 (lookup *edx *(edx+4)) # List-value List-value => eax + 4434 89/<- %ebx 0/r32/eax + 4435 # check v->name + 4436 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 4437 (check-strings-equal %eax "y" "F - test-function-header-with-multiple-args-and-outputs/output:1") + 4438 # check v->register + 4439 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax + 4440 (check-strings-equal %eax "edx" "F - test-function-header-with-multiple-args-and-outputs/output:1/register") + 4441 # check v->type + 4442 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 4443 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:0") # Tree-is-atom + 4444 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1") # Tree-value + 4445 (check-ints-equal *(eax+0c) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:2") # Tree-right + 4446 # . epilogue + 4447 89/<- %esp 5/r32/ebp + 4448 5d/pop-to-ebp + 4449 c3/return + 4450 + 4451 # format for variables with types + 4452 # x: int + 4453 # x: int, + 4454 # x/eax: int + 4455 # x/eax: int, + 4456 # ignores at most one trailing comma + 4457 # WARNING: modifies name + 4458 parse-var-with-type: # name: (addr slice), first-line: (addr stream byte), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) + 4459 # pseudocode: + 4460 # var s: slice + 4461 # if (!slice-ends-with(name, ":")) + 4462 # abort + 4463 # --name->end to skip ':' + 4464 # next-token-from-slice(name->start, name->end, '/', s) + 4465 # new-var-from-slice(s, out) + 4466 # ## register + 4467 # next-token-from-slice(s->end, name->end, '/', s) + 4468 # if (!slice-empty?(s)) + 4469 # out->register = slice-to-string(s) + 4470 # ## type + 4471 # var type: (handle tree type-id) = parse-type(first-line) + 4472 # out->type = type + 4473 # + 4474 # . prologue + 4475 55/push-ebp + 4476 89/<- %ebp 4/r32/esp + 4477 # . save registers + 4478 50/push-eax + 4479 51/push-ecx + 4480 52/push-edx + 4481 53/push-ebx + 4482 56/push-esi + 4483 57/push-edi + 4484 # esi = name + 4485 8b/-> *(ebp+8) 6/r32/esi + 4486 # if (!slice-ends-with?(name, ":")) abort + 4487 8b/-> *(esi+4) 1/r32/ecx # Slice-end + 4488 49/decrement-ecx + 4489 8a/copy-byte *ecx 1/r32/CL + 4490 81 4/subop/and %ecx 0xff/imm32 + 4491 81 7/subop/compare %ecx 0x3a/imm32/colon + 4492 0f 85/jump-if-!= $parse-var-with-type:abort/disp32 + 4493 # --name->end to skip ':' + 4494 ff 1/subop/decrement *(esi+4) + 4495 # var s/ecx: slice + 4496 68/push 0/imm32/end + 4497 68/push 0/imm32/start + 4498 89/<- %ecx 4/r32/esp + 4499 $parse-var-with-type:parse-name: + 4500 (next-token-from-slice *esi *(esi+4) 0x2f %ecx) # Slice-start, Slice-end, '/' + 4501 $parse-var-with-type:create-var: + 4502 # new-var-from-slice(s, out) + 4503 (new-var-from-slice Heap %ecx *(ebp+0x10)) + 4504 # save out->register + 4505 $parse-var-with-type:save-register: + 4506 # . var out-addr/edi: (addr var) = lookup(*out) + 4507 8b/-> *(ebp+0x10) 7/r32/edi + 4508 (lookup *edi *(edi+4)) # => eax + 4509 89/<- %edi 0/r32/eax + 4510 # . s = next-token(...) + 4511 (next-token-from-slice *(ecx+4) *(esi+4) 0x2f %ecx) # s->end, name->end, '/' + 4512 # . if (!slice-empty?(s)) out->register = slice-to-string(s) + 4513 { + 4514 $parse-var-with-type:write-register: + 4515 (slice-empty? %ecx) # => eax + 4516 3d/compare-eax-and 0/imm32/false + 4517 75/jump-if-!= break/disp8 + 4518 # out->register = slice-to-string(s) + 4519 8d/copy-address *(edi+0x18) 0/r32/eax # Var-register + 4520 (slice-to-string Heap %ecx %eax) + 4521 } + 4522 $parse-var-with-type:save-type: + 4523 8d/copy-address *(edi+8) 0/r32/eax # Var-type + 4524 (parse-type Heap *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) + 4525 $parse-var-with-type:end: + 4526 # . reclaim locals + 4527 81 0/subop/add %esp 8/imm32 + 4528 # . restore registers + 4529 5f/pop-to-edi + 4530 5e/pop-to-esi + 4531 5b/pop-to-ebx + 4532 5a/pop-to-edx + 4533 59/pop-to-ecx + 4534 58/pop-to-eax + 4535 # . epilogue + 4536 89/<- %esp 5/r32/ebp + 4537 5d/pop-to-ebp + 4538 c3/return + 4539 + 4540 $parse-var-with-type:abort: + 4541 # error("var should have form 'name: type' in '" line "'\n") + 4542 (write-buffered *(ebp+0x14) "var should have form 'name: type' in '") + 4543 (flush *(ebp+0x14)) + 4544 (rewind-stream *(ebp+0xc)) + 4545 (write-stream 2 *(ebp+0xc)) + 4546 (write-buffered *(ebp+0x14) "'\n") + 4547 (flush *(ebp+0x14)) + 4548 (stop *(ebp+0x18) 1) + 4549 # never gets here + 4550 + 4551 parse-type: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle tree type-id), err: (addr buffered-file), ed: (addr exit-descriptor) + 4552 # pseudocode: + 4553 # var s: slice = next-mu-token(in) + 4554 # assert s != "" + 4555 # assert s != "->" + 4556 # assert s != "{" + 4557 # assert s != "}" + 4558 # if s == ")" + 4559 # return + 4560 # out = allocate(Tree) + 4561 # if s != "(" + 4562 # HACK: if s is an int, parse and return it + 4563 # out->left-is-atom? = true + 4564 # out->value = pos-or-insert-slice(Type-id, s) + 4565 # return + 4566 # out->left = parse-type(ad, in) + 4567 # out->right = parse-type-tree(ad, in) + 4568 # + 4569 # . prologue + 4570 55/push-ebp + 4571 89/<- %ebp 4/r32/esp + 4572 # . save registers + 4573 50/push-eax + 4574 51/push-ecx + 4575 52/push-edx + 4576 # clear out + 4577 (zero-out *(ebp+0x10) *Handle-size) + 4578 # var s/ecx: slice + 4579 68/push 0/imm32 + 4580 68/push 0/imm32 + 4581 89/<- %ecx 4/r32/esp + 4582 # s = next-mu-token(in) + 4583 (next-mu-token *(ebp+0xc) %ecx) + 4584 #? (write-buffered Stderr "tok: ") + 4585 #? (write-slice-buffered Stderr %ecx) + 4586 #? (write-buffered Stderr "$\n") + 4587 #? (flush Stderr) + 4588 # assert s != "" + 4589 (slice-equal? %ecx "") # => eax + 4590 3d/compare-eax-and 0/imm32/false + 4591 0f 85/jump-if-!= $parse-type:abort/disp32 + 4592 # assert s != "{" + 4593 (slice-equal? %ecx "{") # => eax + 4594 3d/compare-eax-and 0/imm32/false + 4595 0f 85/jump-if-!= $parse-type:abort/disp32 + 4596 # assert s != "}" + 4597 (slice-equal? %ecx "}") # => eax + 4598 3d/compare-eax-and 0/imm32/false + 4599 0f 85/jump-if-!= $parse-type:abort/disp32 + 4600 # assert s != "->" + 4601 (slice-equal? %ecx "->") # => eax + 4602 3d/compare-eax-and 0/imm32/false + 4603 0f 85/jump-if-!= $parse-type:abort/disp32 + 4604 # if (s == ")") return + 4605 (slice-equal? %ecx ")") # => eax + 4606 3d/compare-eax-and 0/imm32/false + 4607 0f 85/jump-if-!= $parse-type:end/disp32 + 4608 # out = new tree + 4609 (allocate *(ebp+8) *Tree-size *(ebp+0x10)) + 4610 # var out-addr/edx: (addr tree type-id) = lookup(*out) + 4611 8b/-> *(ebp+0x10) 2/r32/edx + 4612 (lookup *edx *(edx+4)) # => eax + 4613 89/<- %edx 0/r32/eax + 4614 { + 4615 # if (s != "(") break + 4616 (slice-equal? %ecx "(") # => eax + 4617 3d/compare-eax-and 0/imm32/false + 4618 75/jump-if-!= break/disp8 + 4619 # EGREGIOUS HACK for static array sizes: if s is a number, parse it + 4620 { + 4621 $parse-type:check-for-int: + 4622 (is-hex-int? %ecx) # => eax + 4623 3d/compare-eax-and 0/imm32/false + 4624 74/jump-if-= break/disp8 + 4625 $parse-type:int: + 4626 (parse-hex-int-from-slice %ecx) # => eax + 4627 89/<- *(edx+4) 0/r32/eax # Tree-value + 4628 e9/jump $parse-type:end/disp32 + 4629 } + 4630 $parse-type:atom: + 4631 # out->left-is-atom? = true + 4632 c7 0/subop/copy *edx 1/imm32/true # Tree-is-atom + 4633 # out->value = pos-or-insert-slice(Type-id, s) + 4634 (pos-or-insert-slice Type-id %ecx) # => eax + 4635 89/<- *(edx+4) 0/r32/eax # Tree-value + 4636 e9/jump $parse-type:end/disp32 + 4637 } + 4638 $parse-type:non-atom: + 4639 # otherwise s == "(" + 4640 # out->left = parse-type(ad, in) + 4641 8d/copy-address *(edx+4) 0/r32/eax # Tree-left + 4642 (parse-type *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) + 4643 # out->right = parse-type-tree(ad, in) + 4644 8d/copy-address *(edx+0xc) 0/r32/eax # Tree-right + 4645 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) + 4646 $parse-type:end: + 4647 # . reclaim locals + 4648 81 0/subop/add %esp 8/imm32 + 4649 # . restore registers + 4650 5a/pop-to-edx + 4651 59/pop-to-ecx + 4652 58/pop-to-eax + 4653 # . epilogue + 4654 89/<- %esp 5/r32/ebp + 4655 5d/pop-to-ebp + 4656 c3/return + 4657 + 4658 $parse-type:abort: + 4659 # error("unexpected token when parsing type: '" s "'\n") + 4660 (write-buffered *(ebp+0x14) "unexpected token when parsing type: '") + 4661 (write-slice-buffered *(ebp+0x14) %ecx) + 4662 (write-buffered *(ebp+0x14) "'\n") + 4663 (flush *(ebp+0x14)) + 4664 (stop *(ebp+0x18) 1) + 4665 # never gets here + 4666 + 4667 parse-type-tree: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle tree type-id), err: (addr buffered-file), ed: (addr exit-descriptor) + 4668 # pseudocode: + 4669 # var tmp: (handle tree type-id) = parse-type(ad, in) + 4670 # if tmp == 0 + 4671 # return 0 + 4672 # out = allocate(Tree) + 4673 # out->left = tmp + 4674 # out->right = parse-type-tree(ad, in) + 4675 # + 4676 # . prologue + 4677 55/push-ebp + 4678 89/<- %ebp 4/r32/esp + 4679 # . save registers + 4680 50/push-eax + 4681 51/push-ecx + 4682 52/push-edx + 4683 # + 4684 (zero-out *(ebp+0x10) *Handle-size) + 4685 # var tmp/ecx: (handle tree type-id) + 4686 68/push 0/imm32 + 4687 68/push 0/imm32 + 4688 89/<- %ecx 4/r32/esp + 4689 # tmp = parse-type(ad, in) + 4690 (parse-type *(ebp+8) *(ebp+0xc) %ecx *(ebp+0x14) *(ebp+0x18)) + 4691 # if (tmp == 0) return + 4692 81 7/subop/compare *ecx 0/imm32 + 4693 74/jump-if-= $parse-type-tree:end/disp8 + 4694 # out = new tree + 4695 (allocate *(ebp+8) *Tree-size *(ebp+0x10)) + 4696 # var out-addr/edx: (addr tree) = lookup(*out) + 4697 8b/-> *(ebp+0x10) 2/r32/edx + 4698 (lookup *edx *(edx+4)) # => eax + 4699 89/<- %edx 0/r32/eax + 4700 # out->left = tmp + 4701 8b/-> *ecx 0/r32/eax + 4702 89/<- *(edx+4) 0/r32/eax # Tree-left + 4703 8b/-> *(ecx+4) 0/r32/eax + 4704 89/<- *(edx+8) 0/r32/eax # Tree-left + 4705 # out->right = parse-type-tree(ad, in) + 4706 8d/copy-address *(edx+0xc) 0/r32/eax # Tree-right + 4707 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) + 4708 $parse-type-tree:end: + 4709 # . reclaim locals + 4710 81 0/subop/add %esp 8/imm32 + 4711 # . restore registers + 4712 5a/pop-to-edx + 4713 59/pop-to-ecx + 4714 58/pop-to-eax + 4715 # . epilogue + 4716 89/<- %esp 5/r32/ebp + 4717 5d/pop-to-ebp + 4718 c3/return + 4719 + 4720 next-mu-token: # in: (addr stream byte), out: (addr slice) + 4721 # pseudocode: + 4722 # start: + 4723 # skip-chars-matching-whitespace(in) + 4724 # if in->read >= in->write # end of in + 4725 # out = {0, 0} + 4726 # return + 4727 # out->start = &in->data[in->read] + 4728 # var curr-byte/eax: byte = in->data[in->read] + 4729 # if curr->byte == ',' # comment token + 4730 # ++in->read + 4731 # goto start + 4732 # if curr-byte == '#' # comment + 4733 # goto done # treat as eof + 4734 # if curr-byte == '"' # string literal + 4735 # skip-string(in) + 4736 # goto done # no metadata + 4737 # if curr-byte == '(' + 4738 # ++in->read + 4739 # goto done + 4740 # if curr-byte == ')' + 4741 # ++in->read + 4742 # goto done + 4743 # # read a word + 4744 # while true + 4745 # if in->read >= in->write + 4746 # break + 4747 # curr-byte = in->data[in->read] + 4748 # if curr-byte == ' ' + 4749 # break + 4750 # if curr-byte == '\r' + 4751 # break + 4752 # if curr-byte == '\n' + 4753 # break + 4754 # if curr-byte == '(' + 4755 # break + 4756 # if curr-byte == ')' + 4757 # break + 4758 # if curr-byte == ',' + 4759 # break + 4760 # ++in->read + 4761 # done: + 4762 # out->end = &in->data[in->read] + 4763 # + 4764 # . prologue + 4765 55/push-ebp + 4766 89/<- %ebp 4/r32/esp + 4767 # . save registers + 4768 50/push-eax + 4769 51/push-ecx + 4770 56/push-esi + 4771 57/push-edi + 4772 # esi = in + 4773 8b/-> *(ebp+8) 6/r32/esi + 4774 # edi = out + 4775 8b/-> *(ebp+0xc) 7/r32/edi + 4776 $next-mu-token:start: + 4777 (skip-chars-matching-whitespace %esi) + 4778 $next-mu-token:check0: + 4779 # if (in->read >= in->write) return out = {0, 0} + 4780 # . ecx = in->read + 4781 8b/-> *(esi+4) 1/r32/ecx + 4782 # . if (ecx >= in->write) return out = {0, 0} + 4783 3b/compare<- *esi 1/r32/ecx + 4784 c7 0/subop/copy *edi 0/imm32 + 4785 c7 0/subop/copy *(edi+4) 0/imm32 + 4786 0f 8d/jump-if->= $next-mu-token:end/disp32 + 4787 # out->start = &in->data[in->read] + 4788 8d/copy-address *(esi+ecx+0xc) 0/r32/eax + 4789 89/<- *edi 0/r32/eax + 4790 # var curr-byte/eax: byte = in->data[in->read] + 4791 31/xor-with %eax 0/r32/eax + 4792 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL + 4793 { + 4794 $next-mu-token:check-for-comma: + 4795 # if (curr-byte != ',') break + 4796 3d/compare-eax-and 0x2c/imm32/comma + 4797 75/jump-if-!= break/disp8 + 4798 # ++in->read + 4799 ff 0/subop/increment *(esi+4) + 4800 # restart + 4801 e9/jump $next-mu-token:start/disp32 + 4802 } + 4803 { + 4804 $next-mu-token:check-for-comment: + 4805 # if (curr-byte != '#') break + 4806 3d/compare-eax-and 0x23/imm32/pound + 4807 75/jump-if-!= break/disp8 + 4808 # return eof + 4809 e9/jump $next-mu-token:done/disp32 + 4810 } + 4811 { + 4812 $next-mu-token:check-for-string-literal: + 4813 # if (curr-byte != '"') break + 4814 3d/compare-eax-and 0x22/imm32/dquote + 4815 75/jump-if-!= break/disp8 + 4816 (skip-string %esi) 4817 # return 4818 e9/jump $next-mu-token:done/disp32 4819 } 4820 { - 4821 $next-mu-token:regular-word-without-metadata: - 4822 # if (in->read >= in->write) break - 4823 # . ecx = in->read - 4824 8b/-> *(esi+4) 1/r32/ecx - 4825 # . if (ecx >= in->write) break - 4826 3b/compare<- *esi 1/r32/ecx - 4827 7d/jump-if->= break/disp8 - 4828 # var c/eax: byte = in->data[in->read] - 4829 31/xor-with %eax 0/r32/eax - 4830 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL - 4831 # if (c == ' ') break - 4832 3d/compare-eax-and 0x20/imm32/space - 4833 74/jump-if-= break/disp8 - 4834 # if (c == '\r') break - 4835 3d/compare-eax-and 0xd/imm32/carriage-return - 4836 74/jump-if-= break/disp8 - 4837 # if (c == '\n') break - 4838 3d/compare-eax-and 0xa/imm32/newline - 4839 74/jump-if-= break/disp8 - 4840 # if (c == '(') break - 4841 3d/compare-eax-and 0x28/imm32/open-paren - 4842 0f 84/jump-if-= break/disp32 - 4843 # if (c == ')') break - 4844 3d/compare-eax-and 0x29/imm32/close-paren - 4845 0f 84/jump-if-= break/disp32 - 4846 # if (c == ',') break - 4847 3d/compare-eax-and 0x2c/imm32/comma - 4848 0f 84/jump-if-= break/disp32 - 4849 # ++in->read - 4850 ff 0/subop/increment *(esi+4) - 4851 # - 4852 e9/jump loop/disp32 - 4853 } - 4854 $next-mu-token:done: - 4855 # out->end = &in->data[in->read] - 4856 8b/-> *(esi+4) 1/r32/ecx - 4857 8d/copy-address *(esi+ecx+0xc) 0/r32/eax - 4858 89/<- *(edi+4) 0/r32/eax - 4859 $next-mu-token:end: - 4860 # . restore registers - 4861 5f/pop-to-edi - 4862 5e/pop-to-esi - 4863 59/pop-to-ecx - 4864 58/pop-to-eax - 4865 # . epilogue - 4866 89/<- %esp 5/r32/ebp - 4867 5d/pop-to-ebp - 4868 c3/return - 4869 - 4870 pos-or-insert-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int - 4871 # . prologue - 4872 55/push-ebp - 4873 89/<- %ebp 4/r32/esp - 4874 # if (pos-slice(arr, s) != -1) return it - 4875 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax - 4876 3d/compare-eax-and -1/imm32 - 4877 75/jump-if-!= $pos-or-insert-slice:end/disp8 - 4878 $pos-or-insert-slice:insert: - 4879 # var s2/eax: (handle array byte) - 4880 68/push 0/imm32 - 4881 68/push 0/imm32 - 4882 89/<- %eax 4/r32/esp - 4883 (slice-to-string Heap *(ebp+0xc) %eax) - 4884 # throw away alloc-id - 4885 (lookup *eax *(eax+4)) # => eax - 4886 (write-int *(ebp+8) %eax) - 4887 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax - 4888 $pos-or-insert-slice:end: - 4889 # . reclaim locals - 4890 81 0/subop/add %esp 8/imm32 - 4891 # . epilogue - 4892 89/<- %esp 5/r32/ebp - 4893 5d/pop-to-ebp - 4894 c3/return - 4895 - 4896 # return the index in an array of strings matching 's', -1 if not found - 4897 # index is denominated in elements, not bytes - 4898 pos-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int - 4899 # . prologue - 4900 55/push-ebp - 4901 89/<- %ebp 4/r32/esp - 4902 # . save registers - 4903 51/push-ecx - 4904 52/push-edx - 4905 53/push-ebx - 4906 56/push-esi - 4907 #? (write-buffered Stderr "pos-slice: ") - 4908 #? (write-slice-buffered Stderr *(ebp+0xc)) - 4909 #? (write-buffered Stderr "\n") - 4910 #? (flush Stderr) - 4911 # esi = arr - 4912 8b/-> *(ebp+8) 6/r32/esi - 4913 # var index/ecx: int = 0 - 4914 b9/copy-to-ecx 0/imm32 - 4915 # var curr/edx: (addr (addr array byte)) = arr->data - 4916 8d/copy-address *(esi+0xc) 2/r32/edx - 4917 # var max/ebx: (addr (addr array byte)) = &arr->data[arr->write] - 4918 8b/-> *esi 3/r32/ebx - 4919 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx - 4920 { - 4921 #? (write-buffered Stderr " ") - 4922 #? (print-int32-buffered Stderr %ecx) - 4923 #? (write-buffered Stderr "\n") - 4924 #? (flush Stderr) - 4925 # if (curr >= max) return -1 - 4926 39/compare %edx 3/r32/ebx - 4927 b8/copy-to-eax -1/imm32 - 4928 73/jump-if-addr>= $pos-slice:end/disp8 - 4929 # if (slice-equal?(s, *curr)) break - 4930 (slice-equal? *(ebp+0xc) *edx) # => eax - 4931 3d/compare-eax-and 0/imm32/false - 4932 75/jump-if-!= break/disp8 - 4933 # ++index - 4934 41/increment-ecx - 4935 # curr += 4 - 4936 81 0/subop/add %edx 4/imm32 - 4937 # - 4938 eb/jump loop/disp8 - 4939 } - 4940 # return index - 4941 89/<- %eax 1/r32/ecx - 4942 $pos-slice:end: - 4943 #? (write-buffered Stderr "=> ") - 4944 #? (print-int32-buffered Stderr %eax) - 4945 #? (write-buffered Stderr "\n") - 4946 # . restore registers - 4947 5e/pop-to-esi - 4948 5b/pop-to-ebx - 4949 5a/pop-to-edx - 4950 59/pop-to-ecx - 4951 # . epilogue - 4952 89/<- %esp 5/r32/ebp - 4953 5d/pop-to-ebp - 4954 c3/return - 4955 - 4956 test-parse-var-with-type: - 4957 # . prologue - 4958 55/push-ebp - 4959 89/<- %ebp 4/r32/esp - 4960 # (eax..ecx) = "x:" - 4961 b8/copy-to-eax "x:"/imm32 - 4962 8b/-> *eax 1/r32/ecx - 4963 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 4964 05/add-to-eax 4/imm32 - 4965 # var slice/ecx: slice = {eax, ecx} - 4966 51/push-ecx - 4967 50/push-eax - 4968 89/<- %ecx 4/r32/esp - 4969 # _test-input-stream contains "int" - 4970 (clear-stream _test-input-stream) - 4971 (write _test-input-stream "int") - 4972 # var v/edx: (handle var) - 4973 68/push 0/imm32 - 4974 68/push 0/imm32 - 4975 89/<- %edx 4/r32/esp - 4976 # - 4977 (parse-var-with-type %ecx _test-input-stream %edx) - 4978 # var v-addr/edx: (addr var) = lookup(v) - 4979 (lookup *edx *(edx+4)) # => eax - 4980 89/<- %edx 0/r32/eax - 4981 # check v-addr->name - 4982 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 4983 (check-strings-equal %eax "x" "F - test-parse-var-with-type/name") - 4984 # check v-addr->type - 4985 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 4986 (check-ints-equal *eax 1 "F - test-parse-var-with-type/type:0") # Tree-is-atom - 4987 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type/type:1") # Tree-value - 4988 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type/type:2") # Tree-right - 4989 # . epilogue - 4990 89/<- %esp 5/r32/ebp - 4991 5d/pop-to-ebp - 4992 c3/return - 4993 - 4994 test-parse-var-with-type-and-register: - 4995 # . prologue - 4996 55/push-ebp - 4997 89/<- %ebp 4/r32/esp - 4998 # (eax..ecx) = "x/eax:" - 4999 b8/copy-to-eax "x/eax:"/imm32 - 5000 8b/-> *eax 1/r32/ecx - 5001 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5002 05/add-to-eax 4/imm32 - 5003 # var slice/ecx: slice = {eax, ecx} - 5004 51/push-ecx - 5005 50/push-eax - 5006 89/<- %ecx 4/r32/esp - 5007 # _test-input-stream contains "int" - 5008 (clear-stream _test-input-stream) - 5009 (write _test-input-stream "int") - 5010 # var v/edx: (handle var) - 5011 68/push 0/imm32 - 5012 68/push 0/imm32 - 5013 89/<- %edx 4/r32/esp - 5014 # - 5015 (parse-var-with-type %ecx _test-input-stream %edx) - 5016 # var v-addr/edx: (addr var) = lookup(v) - 5017 (lookup *edx *(edx+4)) # => eax - 5018 89/<- %edx 0/r32/eax - 5019 # check v-addr->name - 5020 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 5021 (check-strings-equal %eax "x" "F - test-parse-var-with-type-and-register/name") - 5022 # check v-addr->register - 5023 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax - 5024 (check-strings-equal %eax "eax" "F - test-parse-var-with-type-and-register/register") - 5025 # check v-addr->type - 5026 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 5027 (check-ints-equal *eax 1 "F - test-parse-var-with-type-and-register/type:0") # Tree-is-atom - 5028 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type-and-register/type:1") # Tree-left - 5029 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type-and-register/type:2") # Tree-right - 5030 # . epilogue - 5031 89/<- %esp 5/r32/ebp - 5032 5d/pop-to-ebp - 5033 c3/return - 5034 - 5035 test-parse-var-with-trailing-characters: - 5036 # . prologue - 5037 55/push-ebp - 5038 89/<- %ebp 4/r32/esp - 5039 # (eax..ecx) = "x:" - 5040 b8/copy-to-eax "x:"/imm32 - 5041 8b/-> *eax 1/r32/ecx - 5042 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5043 05/add-to-eax 4/imm32 - 5044 # var slice/ecx: slice = {eax, ecx} - 5045 51/push-ecx - 5046 50/push-eax - 5047 89/<- %ecx 4/r32/esp - 5048 # _test-input-stream contains "int," - 5049 (clear-stream _test-input-stream) - 5050 (write _test-input-stream "int,") - 5051 # var v/edx: (handle var) - 5052 68/push 0/imm32 - 5053 68/push 0/imm32 - 5054 89/<- %edx 4/r32/esp - 5055 # - 5056 (parse-var-with-type %ecx _test-input-stream %edx) - 5057 # var v-addr/edx: (addr var) = lookup(v) - 5058 (lookup *edx *(edx+4)) # => eax - 5059 89/<- %edx 0/r32/eax - 5060 # check v-addr->name - 5061 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 5062 (check-strings-equal %eax "x" "F - test-parse-var-with-trailing-characters/name") - 5063 # check v-addr->register - 5064 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-trailing-characters/register") # Var-register - 5065 # check v-addr->type - 5066 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 5067 (check-ints-equal *eax 1 "F - test-parse-var-with-trailing-characters/type:0") # Tree-is-atom - 5068 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-trailing-characters/type:1") # Tree-left - 5069 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-trailing-characters/type:1") # Tree-right - 5070 # . epilogue - 5071 89/<- %esp 5/r32/ebp - 5072 5d/pop-to-ebp - 5073 c3/return - 5074 - 5075 test-parse-var-with-register-and-trailing-characters: - 5076 # . prologue - 5077 55/push-ebp - 5078 89/<- %ebp 4/r32/esp - 5079 # (eax..ecx) = "x/eax:" - 5080 b8/copy-to-eax "x/eax:"/imm32 - 5081 8b/-> *eax 1/r32/ecx - 5082 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5083 05/add-to-eax 4/imm32 - 5084 # var slice/ecx: slice = {eax, ecx} - 5085 51/push-ecx - 5086 50/push-eax - 5087 89/<- %ecx 4/r32/esp - 5088 # _test-input-stream contains "int," - 5089 (clear-stream _test-input-stream) - 5090 (write _test-input-stream "int,") - 5091 # var v/edx: (handle var) - 5092 68/push 0/imm32 - 5093 68/push 0/imm32 - 5094 89/<- %edx 4/r32/esp - 5095 # - 5096 (parse-var-with-type %ecx _test-input-stream %edx) - 5097 # var v-addr/edx: (addr var) = lookup(v) - 5098 (lookup *edx *(edx+4)) # => eax - 5099 89/<- %edx 0/r32/eax - 5100 # check v-addr->name - 5101 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 5102 (check-strings-equal %eax "x" "F - test-parse-var-with-register-and-trailing-characters/name") - 5103 # check v-addr->register - 5104 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax - 5105 (check-strings-equal %eax "eax" "F - test-parse-var-with-register-and-trailing-characters/register") - 5106 # check v-addr->type - 5107 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 5108 (check-ints-equal *eax 1 "F - test-parse-var-with-register-and-trailing-characters/type:0") # Tree-is-atom - 5109 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-register-and-trailing-characters/type:1") # Tree-left - 5110 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-register-and-trailing-characters/type:2") # Tree-right - 5111 # . epilogue - 5112 89/<- %esp 5/r32/ebp - 5113 5d/pop-to-ebp - 5114 c3/return - 5115 - 5116 test-parse-var-with-compound-type: - 5117 # . prologue - 5118 55/push-ebp - 5119 89/<- %ebp 4/r32/esp - 5120 # (eax..ecx) = "x:" - 5121 b8/copy-to-eax "x:"/imm32 - 5122 8b/-> *eax 1/r32/ecx - 5123 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5124 05/add-to-eax 4/imm32 - 5125 # var slice/ecx: slice = {eax, ecx} - 5126 51/push-ecx - 5127 50/push-eax - 5128 89/<- %ecx 4/r32/esp - 5129 # _test-input-stream contains "(addr int)" - 5130 (clear-stream _test-input-stream) - 5131 (write _test-input-stream "(addr int)") - 5132 # var v/edx: (handle var) - 5133 68/push 0/imm32 - 5134 68/push 0/imm32 - 5135 89/<- %edx 4/r32/esp - 5136 # - 5137 (parse-var-with-type %ecx _test-input-stream %edx) - 5138 # var v-addr/edx: (addr var) = lookup(v) - 5139 (lookup *edx *(edx+4)) # => eax - 5140 89/<- %edx 0/r32/eax - 5141 # check v-addr->name - 5142 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 5143 (check-strings-equal %eax "x" "F - test-parse-var-with-compound-type/name") - 5144 # check v-addr->register - 5145 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-compound-type/register") # Var-register - 5146 # - check v-addr->type - 5147 # var type/edx: (addr tree type-id) = var->type - 5148 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 5149 89/<- %edx 0/r32/eax - 5150 # type is a non-atom - 5151 (check-ints-equal *edx 0 "F - test-parse-var-with-compound-type/type:0") # Tree-is-atom - 5152 # type->left == atom(addr) - 5153 (lookup *(edx+4) *(edx+8)) # Tree-left Tree-left => eax - 5154 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:1") # Tree-is-atom - 5155 (check-ints-equal *(eax+4) 2 "F - test-parse-var-with-compound-type/type:2") # Tree-value - 5156 # type->right->left == atom(int) - 5157 (lookup *(edx+0xc) *(edx+0x10)) # Tree-right Tree-right => eax - 5158 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax - 5159 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:3") # Tree-is-atom - 5160 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-compound-type/type:4") # Tree-value - 5161 # type->right->right == null - 5162 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-compound-type/type:5") # Tree-right - 5163 # . epilogue - 5164 89/<- %esp 5/r32/ebp - 5165 5d/pop-to-ebp - 5166 c3/return - 5167 - 5168 # identifier starts with a letter or '$' or '_' - 5169 # no constraints at the moment on later letters - 5170 # all we really want to do so far is exclude '{', '}' and '->' - 5171 is-identifier?: # in: (addr slice) -> result/eax: boolean - 5172 # . prologue - 5173 55/push-ebp - 5174 89/<- %ebp 4/r32/esp - 5175 # if (slice-empty?(in)) return false - 5176 (slice-empty? *(ebp+8)) # => eax - 5177 3d/compare-eax-and 0/imm32/false - 5178 75/jump-if-!= $is-identifier?:false/disp8 - 5179 # var c/eax: byte = *in->start - 5180 8b/-> *(ebp+8) 0/r32/eax - 5181 8b/-> *eax 0/r32/eax - 5182 8a/copy-byte *eax 0/r32/AL - 5183 81 4/subop/and %eax 0xff/imm32 - 5184 # if (c == '$') return true - 5185 3d/compare-eax-and 0x24/imm32/$ - 5186 74/jump-if-= $is-identifier?:true/disp8 - 5187 # if (c == '_') return true - 5188 3d/compare-eax-and 0x5f/imm32/_ - 5189 74/jump-if-= $is-identifier?:true/disp8 - 5190 # drop case - 5191 25/and-eax-with 0x5f/imm32 - 5192 # if (c < 'A') return false - 5193 3d/compare-eax-and 0x41/imm32/A - 5194 7c/jump-if-< $is-identifier?:false/disp8 - 5195 # if (c > 'Z') return false - 5196 3d/compare-eax-and 0x5a/imm32/Z - 5197 7f/jump-if-> $is-identifier?:false/disp8 - 5198 # otherwise return true - 5199 $is-identifier?:true: - 5200 b8/copy-to-eax 1/imm32/true - 5201 eb/jump $is-identifier?:end/disp8 - 5202 $is-identifier?:false: - 5203 b8/copy-to-eax 0/imm32/false - 5204 $is-identifier?:end: - 5205 # . epilogue - 5206 89/<- %esp 5/r32/ebp - 5207 5d/pop-to-ebp - 5208 c3/return - 5209 - 5210 test-is-identifier-dollar: - 5211 # . prologue - 5212 55/push-ebp - 5213 89/<- %ebp 4/r32/esp - 5214 # (eax..ecx) = "$a" - 5215 b8/copy-to-eax "$a"/imm32 - 5216 8b/-> *eax 1/r32/ecx - 5217 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5218 05/add-to-eax 4/imm32 - 5219 # var slice/ecx: slice = {eax, ecx} - 5220 51/push-ecx - 5221 50/push-eax - 5222 89/<- %ecx 4/r32/esp - 5223 # - 5224 (is-identifier? %ecx) - 5225 (check-ints-equal %eax 1 "F - test-is-identifier-dollar") - 5226 # . epilogue - 5227 89/<- %esp 5/r32/ebp - 5228 5d/pop-to-ebp - 5229 c3/return - 5230 - 5231 test-is-identifier-underscore: - 5232 # . prologue - 5233 55/push-ebp - 5234 89/<- %ebp 4/r32/esp - 5235 # (eax..ecx) = "_a" - 5236 b8/copy-to-eax "_a"/imm32 - 5237 8b/-> *eax 1/r32/ecx - 5238 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5239 05/add-to-eax 4/imm32 - 5240 # var slice/ecx: slice = {eax, ecx} - 5241 51/push-ecx - 5242 50/push-eax - 5243 89/<- %ecx 4/r32/esp - 5244 # - 5245 (is-identifier? %ecx) - 5246 (check-ints-equal %eax 1 "F - test-is-identifier-underscore") - 5247 # . epilogue - 5248 89/<- %esp 5/r32/ebp - 5249 5d/pop-to-ebp - 5250 c3/return - 5251 - 5252 test-is-identifier-a: - 5253 # . prologue - 5254 55/push-ebp - 5255 89/<- %ebp 4/r32/esp - 5256 # (eax..ecx) = "a$" - 5257 b8/copy-to-eax "a$"/imm32 - 5258 8b/-> *eax 1/r32/ecx - 5259 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5260 05/add-to-eax 4/imm32 - 5261 # var slice/ecx: slice = {eax, ecx} - 5262 51/push-ecx - 5263 50/push-eax - 5264 89/<- %ecx 4/r32/esp - 5265 # - 5266 (is-identifier? %ecx) - 5267 (check-ints-equal %eax 1 "F - test-is-identifier-a") - 5268 # . epilogue - 5269 89/<- %esp 5/r32/ebp - 5270 5d/pop-to-ebp - 5271 c3/return - 5272 - 5273 test-is-identifier-z: - 5274 # . prologue - 5275 55/push-ebp - 5276 89/<- %ebp 4/r32/esp - 5277 # (eax..ecx) = "z$" - 5278 b8/copy-to-eax "z$"/imm32 - 5279 8b/-> *eax 1/r32/ecx - 5280 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5281 05/add-to-eax 4/imm32 - 5282 # var slice/ecx: slice = {eax, ecx} - 5283 51/push-ecx - 5284 50/push-eax - 5285 89/<- %ecx 4/r32/esp - 5286 # - 5287 (is-identifier? %ecx) - 5288 (check-ints-equal %eax 1 "F - test-is-identifier-z") - 5289 # . epilogue - 5290 89/<- %esp 5/r32/ebp - 5291 5d/pop-to-ebp - 5292 c3/return - 5293 - 5294 test-is-identifier-A: - 5295 # . prologue - 5296 55/push-ebp - 5297 89/<- %ebp 4/r32/esp - 5298 # (eax..ecx) = "A$" - 5299 b8/copy-to-eax "A$"/imm32 - 5300 8b/-> *eax 1/r32/ecx - 5301 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5302 05/add-to-eax 4/imm32 - 5303 # var slice/ecx: slice = {eax, ecx} - 5304 51/push-ecx - 5305 50/push-eax - 5306 89/<- %ecx 4/r32/esp - 5307 # - 5308 (is-identifier? %ecx) - 5309 (check-ints-equal %eax 1 "F - test-is-identifier-A") - 5310 # . epilogue - 5311 89/<- %esp 5/r32/ebp - 5312 5d/pop-to-ebp - 5313 c3/return - 5314 - 5315 test-is-identifier-Z: - 5316 # . prologue - 5317 55/push-ebp - 5318 89/<- %ebp 4/r32/esp - 5319 # (eax..ecx) = "Z$" - 5320 b8/copy-to-eax "Z$"/imm32 - 5321 8b/-> *eax 1/r32/ecx - 5322 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5323 05/add-to-eax 4/imm32 - 5324 # var slice/ecx: slice = {eax, ecx} - 5325 51/push-ecx - 5326 50/push-eax - 5327 89/<- %ecx 4/r32/esp - 5328 # - 5329 (is-identifier? %ecx) - 5330 (check-ints-equal %eax 1 "F - test-is-identifier-Z") - 5331 # . epilogue - 5332 89/<- %esp 5/r32/ebp - 5333 5d/pop-to-ebp - 5334 c3/return - 5335 - 5336 test-is-identifier-at: - 5337 # character before 'A' is invalid - 5338 # . prologue - 5339 55/push-ebp - 5340 89/<- %ebp 4/r32/esp - 5341 # (eax..ecx) = "@a" - 5342 b8/copy-to-eax "@a"/imm32 - 5343 8b/-> *eax 1/r32/ecx - 5344 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5345 05/add-to-eax 4/imm32 - 5346 # var slice/ecx: slice = {eax, ecx} - 5347 51/push-ecx - 5348 50/push-eax - 5349 89/<- %ecx 4/r32/esp - 5350 # - 5351 (is-identifier? %ecx) - 5352 (check-ints-equal %eax 0 "F - test-is-identifier-@") - 5353 # . epilogue - 5354 89/<- %esp 5/r32/ebp - 5355 5d/pop-to-ebp - 5356 c3/return - 5357 - 5358 test-is-identifier-square-bracket: - 5359 # character after 'Z' is invalid - 5360 # . prologue - 5361 55/push-ebp - 5362 89/<- %ebp 4/r32/esp - 5363 # (eax..ecx) = "[a" - 5364 b8/copy-to-eax "[a"/imm32 - 5365 8b/-> *eax 1/r32/ecx - 5366 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5367 05/add-to-eax 4/imm32 - 5368 # var slice/ecx: slice = {eax, ecx} - 5369 51/push-ecx - 5370 50/push-eax - 5371 89/<- %ecx 4/r32/esp - 5372 # - 5373 (is-identifier? %ecx) - 5374 (check-ints-equal %eax 0 "F - test-is-identifier-@") - 5375 # . epilogue - 5376 89/<- %esp 5/r32/ebp - 5377 5d/pop-to-ebp - 5378 c3/return - 5379 - 5380 test-is-identifier-backtick: - 5381 # character before 'a' is invalid - 5382 # . prologue - 5383 55/push-ebp - 5384 89/<- %ebp 4/r32/esp - 5385 # (eax..ecx) = "`a" - 5386 b8/copy-to-eax "`a"/imm32 - 5387 8b/-> *eax 1/r32/ecx - 5388 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5389 05/add-to-eax 4/imm32 - 5390 # var slice/ecx: slice = {eax, ecx} - 5391 51/push-ecx - 5392 50/push-eax - 5393 89/<- %ecx 4/r32/esp - 5394 # - 5395 (is-identifier? %ecx) - 5396 (check-ints-equal %eax 0 "F - test-is-identifier-backtick") - 5397 # . epilogue - 5398 89/<- %esp 5/r32/ebp - 5399 5d/pop-to-ebp - 5400 c3/return - 5401 - 5402 test-is-identifier-curly-brace-open: - 5403 # character after 'z' is invalid; also used for blocks - 5404 # . prologue - 5405 55/push-ebp - 5406 89/<- %ebp 4/r32/esp - 5407 # (eax..ecx) = "{a" - 5408 b8/copy-to-eax "{a"/imm32 - 5409 8b/-> *eax 1/r32/ecx - 5410 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5411 05/add-to-eax 4/imm32 - 5412 # var slice/ecx: slice = {eax, ecx} - 5413 51/push-ecx - 5414 50/push-eax - 5415 89/<- %ecx 4/r32/esp - 5416 # - 5417 (is-identifier? %ecx) - 5418 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open") - 5419 # . epilogue - 5420 89/<- %esp 5/r32/ebp - 5421 5d/pop-to-ebp - 5422 c3/return - 5423 - 5424 test-is-identifier-curly-brace-close: - 5425 # . prologue - 5426 55/push-ebp - 5427 89/<- %ebp 4/r32/esp - 5428 # (eax..ecx) = "}a" - 5429 b8/copy-to-eax "}a"/imm32 - 5430 8b/-> *eax 1/r32/ecx - 5431 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5432 05/add-to-eax 4/imm32 - 5433 # var slice/ecx: slice = {eax, ecx} - 5434 51/push-ecx - 5435 50/push-eax - 5436 89/<- %ecx 4/r32/esp - 5437 # - 5438 (is-identifier? %ecx) - 5439 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close") - 5440 # . epilogue - 5441 89/<- %esp 5/r32/ebp - 5442 5d/pop-to-ebp - 5443 c3/return - 5444 - 5445 test-is-identifier-hyphen: - 5446 # disallow leading '-' since '->' has special meaning - 5447 # . prologue - 5448 55/push-ebp - 5449 89/<- %ebp 4/r32/esp - 5450 # (eax..ecx) = "-a" - 5451 b8/copy-to-eax "-a"/imm32 - 5452 8b/-> *eax 1/r32/ecx - 5453 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5454 05/add-to-eax 4/imm32 - 5455 # var slice/ecx: slice = {eax, ecx} - 5456 51/push-ecx - 5457 50/push-eax - 5458 89/<- %ecx 4/r32/esp - 5459 # - 5460 (is-identifier? %ecx) - 5461 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen") - 5462 # . epilogue - 5463 89/<- %esp 5/r32/ebp - 5464 5d/pop-to-ebp - 5465 c3/return - 5466 - 5467 populate-mu-function-body: # in: (addr buffered-file), out: (addr function), vars: (addr stack live-var) - 5468 # . prologue - 5469 55/push-ebp - 5470 89/<- %ebp 4/r32/esp - 5471 # . save registers - 5472 50/push-eax - 5473 56/push-esi - 5474 57/push-edi - 5475 # esi = in - 5476 8b/-> *(ebp+8) 6/r32/esi - 5477 # edi = out - 5478 8b/-> *(ebp+0xc) 7/r32/edi - 5479 # parse-mu-block(in, vars, out, out->body) - 5480 8d/copy-address *(edi+0x18) 0/r32/eax # Function-body - 5481 (parse-mu-block %esi *(ebp+0x10) %edi %eax) - 5482 $populate-mu-function-body:end: - 5483 # . restore registers - 5484 5f/pop-to-edi - 5485 5e/pop-to-esi - 5486 58/pop-to-eax - 5487 # . epilogue - 5488 89/<- %esp 5/r32/ebp - 5489 5d/pop-to-ebp - 5490 c3/return - 5491 - 5492 # parses a block, assuming that the leading '{' has already been read by the caller - 5493 parse-mu-block: # in: (addr buffered-file), vars: (addr stack live-var), fn: (addr function), out: (addr handle block) - 5494 # pseudocode: - 5495 # var line: (stream byte 512) - 5496 # var word-slice: slice - 5497 # allocate(Heap, Stmt-size, out) - 5498 # var out-addr: (addr block) = lookup(*out) - 5499 # out-addr->tag = 0/block - 5500 # out-addr->var = some unique name - 5501 # push(vars, {out-addr->var, false}) - 5502 # while true # line loop - 5503 # clear-stream(line) - 5504 # read-line-buffered(in, line) - 5505 # if (line->write == 0) break # end of file - 5506 # word-slice = next-mu-token(line) - 5507 # if slice-empty?(word-slice) # end of line - 5508 # continue - 5509 # else if slice-starts-with?(word-slice, "#") - 5510 # continue - 5511 # else if slice-equal?(word-slice, "{") - 5512 # assert(no-tokens-in(line)) - 5513 # block = parse-mu-block(in, vars, fn) - 5514 # append-to-block(out-addr, block) - 5515 # else if slice-equal?(word-slice, "}") - 5516 # break - 5517 # else if slice-ends-with?(word-slice, ":") - 5518 # # TODO: error-check the rest of 'line' - 5519 # --word-slice->end to skip ':' - 5520 # named-block = parse-mu-named-block(word-slice, in, vars, fn) - 5521 # append-to-block(out-addr, named-block) - 5522 # else if slice-equal?(word-slice, "var") - 5523 # var-def = parse-mu-var-def(line, vars) - 5524 # append-to-block(out-addr, var-def) - 5525 # else - 5526 # stmt = parse-mu-stmt(line, vars, fn) - 5527 # append-to-block(out-addr, stmt) - 5528 # pop(vars) - 5529 # - 5530 # . prologue - 5531 55/push-ebp - 5532 89/<- %ebp 4/r32/esp - 5533 # . save registers - 5534 50/push-eax - 5535 51/push-ecx - 5536 52/push-edx - 5537 53/push-ebx - 5538 57/push-edi - 5539 # var line/ecx: (stream byte 512) - 5540 81 5/subop/subtract %esp 0x200/imm32 - 5541 68/push 0x200/imm32/size - 5542 68/push 0/imm32/read - 5543 68/push 0/imm32/write - 5544 89/<- %ecx 4/r32/esp - 5545 # var word-slice/edx: slice - 5546 68/push 0/imm32/end - 5547 68/push 0/imm32/start - 5548 89/<- %edx 4/r32/esp - 5549 # allocate into out - 5550 (allocate Heap *Stmt-size *(ebp+0x14)) - 5551 # var out-addr/edi: (addr block) = lookup(*out) - 5552 8b/-> *(ebp+0x14) 7/r32/edi - 5553 (lookup *edi *(edi+4)) # => eax - 5554 89/<- %edi 0/r32/eax - 5555 # out-addr->tag is 0 (block) by default - 5556 # set out-addr->var - 5557 8d/copy-address *(edi+0xc) 0/r32/eax # Block-var - 5558 (new-block-name *(ebp+0x10) %eax) - 5559 # push(vars, out-addr->var) - 5560 (push *(ebp+0xc) *(edi+0xc)) # Block-var - 5561 (push *(ebp+0xc) *(edi+0x10)) # Block-var - 5562 (push *(ebp+0xc) 0) # false - 5563 { - 5564 $parse-mu-block:line-loop: - 5565 # line = read-line-buffered(in) - 5566 (clear-stream %ecx) - 5567 (read-line-buffered *(ebp+8) %ecx) - 5568 #? (write-buffered Stderr "line: ") - 5569 #? (write-stream-data Stderr %ecx) - 5570 #? (write-buffered Stderr Newline) - 5571 #? (flush Stderr) - 5572 # if (line->write == 0) break - 5573 81 7/subop/compare *ecx 0/imm32 - 5574 0f 84/jump-if-= break/disp32 - 5575 # word-slice = next-mu-token(line) - 5576 (next-mu-token %ecx %edx) - 5577 #? (write-buffered Stderr "word: ") - 5578 #? (write-slice-buffered Stderr %edx) - 5579 #? (write-buffered Stderr Newline) - 5580 #? (flush Stderr) - 5581 # if slice-empty?(word-slice) continue - 5582 (slice-empty? %edx) - 5583 3d/compare-eax-and 0/imm32/false - 5584 0f 85/jump-if-!= loop/disp32 - 5585 # if (slice-starts-with?(word-slice, '#') continue - 5586 # . eax = *word-slice->start - 5587 8b/-> *edx 0/r32/eax - 5588 8a/copy-byte *eax 0/r32/AL - 5589 81 4/subop/and %eax 0xff/imm32 - 5590 # . if (eax == '#') continue - 5591 3d/compare-eax-and 0x23/imm32/hash - 5592 0f 84/jump-if-= loop/disp32 - 5593 # if slice-equal?(word-slice, "{") - 5594 { - 5595 $parse-mu-block:check-for-block: - 5596 (slice-equal? %edx "{") - 5597 3d/compare-eax-and 0/imm32/false - 5598 74/jump-if-= break/disp8 - 5599 (check-no-tokens-left %ecx) - 5600 # parse new block and append - 5601 # . var tmp/eax: (handle block) - 5602 68/push 0/imm32 - 5603 68/push 0/imm32 - 5604 89/<- %eax 4/r32/esp - 5605 # . - 5606 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax) - 5607 (append-to-block Heap %edi *eax *(eax+4)) - 5608 # . reclaim tmp - 5609 81 0/subop/add %esp 8/imm32 - 5610 # . - 5611 e9/jump $parse-mu-block:line-loop/disp32 - 5612 } - 5613 # if slice-equal?(word-slice, "}") break - 5614 $parse-mu-block:check-for-end: - 5615 (slice-equal? %edx "}") - 5616 3d/compare-eax-and 0/imm32/false - 5617 0f 85/jump-if-!= break/disp32 - 5618 # if slice-ends-with?(word-slice, ":") parse named block and append - 5619 { - 5620 $parse-mu-block:check-for-named-block: - 5621 # . eax = *(word-slice->end-1) - 5622 8b/-> *(edx+4) 0/r32/eax - 5623 48/decrement-eax - 5624 8a/copy-byte *eax 0/r32/AL - 5625 81 4/subop/and %eax 0xff/imm32 - 5626 # . if (eax != ':') break - 5627 3d/compare-eax-and 0x3a/imm32/colon - 5628 0f 85/jump-if-!= break/disp32 - 5629 # TODO: error-check the rest of 'line' - 5630 # - 5631 # skip ':' - 5632 ff 1/subop/decrement *(edx+4) # Slice-end - 5633 # var tmp/eax: (handle block) - 5634 68/push 0/imm32 - 5635 68/push 0/imm32 - 5636 89/<- %eax 4/r32/esp - 5637 # - 5638 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax) - 5639 (append-to-block Heap %edi *eax *(eax+4)) - 5640 # reclaim tmp - 5641 81 0/subop/add %esp 8/imm32 - 5642 # - 5643 e9/jump $parse-mu-block:line-loop/disp32 - 5644 } - 5645 # if slice-equal?(word-slice, "var") - 5646 { - 5647 $parse-mu-block:check-for-var: - 5648 (slice-equal? %edx "var") - 5649 3d/compare-eax-and 0/imm32/false - 5650 74/jump-if-= break/disp8 - 5651 # var tmp/eax: (handle block) - 5652 68/push 0/imm32 - 5653 68/push 0/imm32 - 5654 89/<- %eax 4/r32/esp - 5655 # - 5656 (parse-mu-var-def %ecx *(ebp+0xc) %eax) - 5657 (append-to-block Heap %edi *eax *(eax+4)) - 5658 # reclaim tmp - 5659 81 0/subop/add %esp 8/imm32 - 5660 # - 5661 e9/jump $parse-mu-block:line-loop/disp32 - 5662 } - 5663 $parse-mu-block:regular-stmt: - 5664 # otherwise - 5665 # var tmp/eax: (handle block) - 5666 68/push 0/imm32 - 5667 68/push 0/imm32 - 5668 89/<- %eax 4/r32/esp - 5669 # - 5670 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10) %eax) - 5671 (append-to-block Heap %edi *eax *(eax+4)) - 5672 # reclaim tmp - 5673 81 0/subop/add %esp 8/imm32 - 5674 # - 5675 e9/jump loop/disp32 - 5676 } # end line loop - 5677 # pop(vars) - 5678 (pop *(ebp+0xc)) # => eax - 5679 (pop *(ebp+0xc)) # => eax - 5680 (pop *(ebp+0xc)) # => eax - 5681 $parse-mu-block:end: - 5682 # . reclaim locals - 5683 81 0/subop/add %esp 0x214/imm32 - 5684 # . restore registers - 5685 5f/pop-to-edi - 5686 5b/pop-to-ebx - 5687 5a/pop-to-edx - 5688 59/pop-to-ecx - 5689 58/pop-to-eax - 5690 # . epilogue - 5691 89/<- %esp 5/r32/ebp - 5692 5d/pop-to-ebp - 5693 c3/return - 5694 - 5695 $parse-mu-block:abort: - 5696 # error("'{' or '}' should be on its own line, but got '") - 5697 (write-buffered Stderr "'{' or '}' should be on its own line, but got '") - 5698 (rewind-stream %ecx) - 5699 (write-stream 2 %ecx) - 5700 (write-buffered Stderr "'\n") - 5701 (flush Stderr) - 5702 # . syscall(exit, 1) - 5703 bb/copy-to-ebx 1/imm32 - 5704 b8/copy-to-eax 1/imm32/exit - 5705 cd/syscall 0x80/imm8 - 5706 # never gets here - 5707 - 5708 new-block-name: # fn: (addr function), out: (addr handle var) - 5709 # . prologue - 5710 55/push-ebp - 5711 89/<- %ebp 4/r32/esp - 5712 # . save registers - 5713 50/push-eax - 5714 51/push-ecx - 5715 52/push-edx - 5716 # var n/ecx: int = len(fn->name) + 10 for an int + 2 for '$:' - 5717 8b/-> *(ebp+8) 0/r32/eax - 5718 (lookup *eax *(eax+4)) # Function-name Function-name => eax - 5719 8b/-> *eax 0/r32/eax # String-size - 5720 05/add-to-eax 0xd/imm32 # 10 + 2 for '$:' - 5721 89/<- %ecx 0/r32/eax - 5722 # var name/edx: (stream byte n) - 5723 29/subtract-from %esp 1/r32/ecx - 5724 ff 6/subop/push %ecx - 5725 68/push 0/imm32/read - 5726 68/push 0/imm32/write - 5727 89/<- %edx 4/r32/esp - 5728 (clear-stream %edx) - 5729 # eax = fn->name - 5730 8b/-> *(ebp+8) 0/r32/eax - 5731 (lookup *eax *(eax+4)) # Function-name Function-name => eax - 5732 # construct result using Next-block-index (and increment it) - 5733 (write %edx "$") - 5734 (write %edx %eax) - 5735 (write %edx ":") - 5736 (print-int32 %edx *Next-block-index) - 5737 ff 0/subop/increment *Next-block-index - 5738 # var s/eax: slice = {name->data, name->data + name->write} (clobbering edx) - 5739 # . eax = name->write - 5740 8b/-> *edx 0/r32/eax - 5741 # . edx = name->data - 5742 8d/copy-address *(edx+0xc) 2/r32/edx - 5743 # . eax = name->write + name->data - 5744 01/add-to %eax 2/r32/edx - 5745 # . push {edx, eax} - 5746 ff 6/subop/push %eax - 5747 ff 6/subop/push %edx - 5748 89/<- %eax 4/r32/esp - 5749 # out = new literal(s) - 5750 (new-literal Heap %eax *(ebp+0xc)) - 5751 #? 8b/-> *(ebp+0xc) 0/r32/eax - 5752 #? (write-buffered Stderr "type allocid in caller after new-literal: ") - 5753 #? (print-int32-buffered Stderr *(eax+8)) - 5754 #? (write-buffered Stderr " for var ") - 5755 #? (print-int32-buffered Stderr %eax) - 5756 #? (write-buffered Stderr Newline) - 5757 #? (flush Stderr) - 5758 $new-block-name:end: - 5759 # . reclaim locals - 5760 81 0/subop/add %ecx 0xc/imm32 # name.{read/write/len} - 5761 81 0/subop/add %ecx 8/imm32 # slice - 5762 01/add-to %esp 1/r32/ecx - 5763 # . restore registers - 5764 5a/pop-to-edx - 5765 59/pop-to-ecx - 5766 58/pop-to-eax - 5767 # . epilogue - 5768 89/<- %esp 5/r32/ebp - 5769 5d/pop-to-ebp - 5770 c3/return - 5771 - 5772 == data - 5773 - 5774 # Global state added to each var record when parsing a function - 5775 Next-block-index: # (addr int) - 5776 1/imm32 - 5777 - 5778 == code - 5779 - 5780 check-no-tokens-left: # line: (addr stream byte) - 5781 # . prologue - 5782 55/push-ebp - 5783 89/<- %ebp 4/r32/esp - 5784 # . save registers - 5785 50/push-eax - 5786 51/push-ecx - 5787 # var s/ecx: slice - 5788 68/push 0/imm32/end - 5789 68/push 0/imm32/start - 5790 89/<- %ecx 4/r32/esp - 5791 # - 5792 (next-mu-token *(ebp+8) %ecx) - 5793 # if slice-empty?(s) return - 5794 (slice-empty? %ecx) - 5795 3d/compare-eax-and 0/imm32/false - 5796 75/jump-if-!= $check-no-tokens-left:end/disp8 - 5797 # if (slice-starts-with?(s, '#') return - 5798 # . eax = *s->start - 5799 8b/-> *edx 0/r32/eax - 5800 8a/copy-byte *eax 0/r32/AL - 5801 81 4/subop/and %eax 0xff/imm32 - 5802 # . if (eax == '#') continue - 5803 3d/compare-eax-and 0x23/imm32/hash - 5804 74/jump-if-= $check-no-tokens-left:end/disp8 - 5805 # abort - 5806 (write-buffered Stderr "'{' or '}' should be on its own line, but got '") - 5807 (rewind-stream %ecx) - 5808 (write-stream 2 %ecx) - 5809 (write-buffered Stderr "'\n") - 5810 (flush Stderr) - 5811 # . syscall(exit, 1) - 5812 bb/copy-to-ebx 1/imm32 - 5813 b8/copy-to-eax 1/imm32/exit - 5814 cd/syscall 0x80/imm8 - 5815 # never gets here - 5816 $check-no-tokens-left:end: - 5817 # . reclaim locals - 5818 81 0/subop/add %esp 8/imm32 - 5819 # . restore registers - 5820 59/pop-to-ecx - 5821 58/pop-to-eax - 5822 # . epilogue - 5823 89/<- %esp 5/r32/ebp - 5824 5d/pop-to-ebp - 5825 c3/return - 5826 - 5827 parse-mu-named-block: # name: (addr slice), in: (addr buffered-file), vars: (addr stack live-var), fn: (addr function), out: (addr handle stmt) - 5828 # pseudocode: - 5829 # var v: (handle var) - 5830 # new-literal(name, v) - 5831 # push(vars, {v, false}) - 5832 # parse-mu-block(in, vars, fn, out) - 5833 # pop(vars) - 5834 # out->tag = block - 5835 # out->var = v - 5836 # - 5837 # . prologue - 5838 55/push-ebp - 5839 89/<- %ebp 4/r32/esp - 5840 # . save registers - 5841 50/push-eax - 5842 51/push-ecx - 5843 57/push-edi - 5844 # var v/ecx: (handle var) - 5845 68/push 0/imm32 - 5846 68/push 0/imm32 - 5847 89/<- %ecx 4/r32/esp - 5848 # - 5849 (new-literal Heap *(ebp+8) %ecx) - 5850 # push(vars, v) - 5851 (push *(ebp+0x10) *ecx) - 5852 (push *(ebp+0x10) *(ecx+4)) - 5853 (push *(ebp+0x10) 0) # false - 5854 # - 5855 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) - 5856 # pop v off vars - 5857 (pop *(ebp+0x10)) # => eax - 5858 (pop *(ebp+0x10)) # => eax - 5859 (pop *(ebp+0x10)) # => eax - 5860 # var out-addr/edi: (addr stmt) = lookup(*out) - 5861 8b/-> *(ebp+0x18) 7/r32/edi - 5862 (lookup *edi *(edi+4)) # => eax - 5863 89/<- %edi 0/r32/eax - 5864 # out-addr->tag = named-block - 5865 c7 0/subop/copy *edi 0/imm32/block # Stmt-tag - 5866 # out-addr->var = v - 5867 8b/-> *ecx 0/r32/eax - 5868 89/<- *(edi+0xc) 0/r32/eax # Block-var - 5869 8b/-> *(ecx+4) 0/r32/eax - 5870 89/<- *(edi+0x10) 0/r32/eax # Block-var - 5871 $parse-mu-named-block:end: - 5872 # . reclaim locals - 5873 81 0/subop/add %esp 8/imm32 - 5874 # . restore registers - 5875 5f/pop-to-edi - 5876 59/pop-to-ecx - 5877 58/pop-to-eax - 5878 # . epilogue - 5879 89/<- %esp 5/r32/ebp - 5880 5d/pop-to-ebp - 5881 c3/return - 5882 - 5883 parse-mu-var-def: # line: (addr stream byte), vars: (addr stack live-var), out: (addr handle stmt) - 5884 # . prologue - 5885 55/push-ebp - 5886 89/<- %ebp 4/r32/esp - 5887 # . save registers - 5888 50/push-eax - 5889 51/push-ecx - 5890 52/push-edx - 5891 57/push-edi - 5892 # edi = out - 5893 8b/-> *(ebp+0x10) 7/r32/edi - 5894 # var word-slice/ecx: slice - 5895 68/push 0/imm32/end - 5896 68/push 0/imm32/start - 5897 89/<- %ecx 4/r32/esp - 5898 # var v/edx: (handle var) - 5899 68/push 0/imm32 - 5900 68/push 0/imm32 - 5901 89/<- %edx 4/r32/esp - 5902 # v = parse-var-with-type(next-mu-token(line)) - 5903 (next-mu-token *(ebp+8) %ecx) - 5904 (parse-var-with-type %ecx *(ebp+8) %edx) - 5905 # - 5906 (push *(ebp+0xc) *edx) - 5907 (push *(ebp+0xc) *(edx+4)) - 5908 (push *(ebp+0xc) 0) # Live-var-register-spilled is unused during parsing - 5909 # either v has no register and there's no more to this line - 5910 (lookup *edx *(edx+4)) # => eax - 5911 8b/-> *(eax+0x18) 0/r32/eax # Var-register - 5912 3d/compare-eax-and 0/imm32 - 5913 { - 5914 75/jump-if-!= break/disp8 - 5915 # TODO: ensure that there's nothing else on this line - 5916 (new-var-def Heap *edx *(edx+4) %edi) - 5917 eb/jump $parse-mu-var-def:end/disp8 - 5918 } - 5919 # or v has a register and there's more to this line - 5920 { - 5921 74/jump-if-= break/disp8 - 5922 # ensure that the next word is '<-' - 5923 (next-mu-token *(ebp+8) %ecx) - 5924 (slice-equal? %ecx "<-") # => eax - 5925 3d/compare-eax-and 0/imm32/false - 5926 74/jump-if-= $parse-mu-var-def:abort/disp8 - 5927 # - 5928 (new-reg-var-def Heap *edx *(edx+4) %edi) - 5929 (lookup *edi *(edi+4)) # => eax - 5930 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc)) - 5931 } - 5932 $parse-mu-var-def:end: - 5933 # . reclaim locals - 5934 81 0/subop/add %esp 0x10/imm32 - 5935 # . restore registers - 5936 5f/pop-to-edi - 5937 5a/pop-to-edx - 5938 59/pop-to-ecx - 5939 58/pop-to-eax - 5940 # . epilogue - 5941 89/<- %esp 5/r32/ebp - 5942 5d/pop-to-ebp - 5943 c3/return - 5944 - 5945 $parse-mu-var-def:abort: - 5946 (rewind-stream *(ebp+8)) - 5947 # error("register variable requires a valid instruction to initialize but got '" line "'\n") - 5948 (write-buffered Stderr "register variable requires a valid instruction to initialize but got '") - 5949 (flush Stderr) - 5950 (write-stream 2 *(ebp+8)) - 5951 (write-buffered Stderr "'\n") - 5952 (flush Stderr) - 5953 # . syscall(exit, 1) - 5954 bb/copy-to-ebx 1/imm32 - 5955 b8/copy-to-eax 1/imm32/exit - 5956 cd/syscall 0x80/imm8 - 5957 # never gets here - 5958 - 5959 test-parse-mu-var-def: - 5960 # 'var n: int' - 5961 # . prologue - 5962 55/push-ebp - 5963 89/<- %ebp 4/r32/esp - 5964 # setup - 5965 (clear-stream _test-input-stream) - 5966 (write _test-input-stream "n: int\n") # caller has consumed the 'var' - 5967 # var out/esi: (handle stmt) - 5968 68/push 0/imm32 - 5969 68/push 0/imm32 - 5970 89/<- %esi 4/r32/esp - 5971 # var vars/ecx: (stack (addr var) 16) - 5972 81 5/subop/subtract %esp 0xc0/imm32 - 5973 68/push 0xc0/imm32/size - 5974 68/push 0/imm32/top - 5975 89/<- %ecx 4/r32/esp - 5976 (clear-stack %ecx) - 5977 # convert - 5978 (parse-mu-var-def _test-input-stream %ecx %esi) - 5979 # var out-addr/esi: (addr stmt) - 5980 (lookup *esi *(esi+4)) # => eax - 5981 89/<- %esi 0/r32/eax - 5982 # - 5983 (check-ints-equal *esi 2 "F - test-parse-mu-var-def/tag") # Stmt-tag is var-def - 5984 # var v/ecx: (addr var) = lookup(out->var) - 5985 (lookup *(esi+4) *(esi+8)) # Vardef-var Vardef-var => eax - 5986 89/<- %ecx 0/r32/eax - 5987 # v->name - 5988 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax - 5989 (check-strings-equal %eax "n" "F - test-parse-mu-var-def/var-name") - 5990 # v->register - 5991 (check-ints-equal *(ecx+0x18) 0 "F - test-parse-mu-var-def/var-register") # Var-register - 5992 # v->type == int - 5993 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 5994 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0") # Tree-is-atom - 5995 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-var-def/var-type:1") # Tree-value - 5996 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-var-def/var-type:2") # Tree-right - 5997 # . epilogue - 5998 89/<- %esp 5/r32/ebp - 5999 5d/pop-to-ebp - 6000 c3/return - 6001 - 6002 test-parse-mu-reg-var-def: - 6003 # 'var n/eax: int <- copy 0' - 6004 # . prologue - 6005 55/push-ebp - 6006 89/<- %ebp 4/r32/esp - 6007 # setup - 6008 (clear-stream _test-input-stream) - 6009 (write _test-input-stream "n/eax: int <- copy 0\n") # caller has consumed the 'var' - 6010 # var out/esi: (handle stmt) - 6011 68/push 0/imm32 - 6012 68/push 0/imm32 - 6013 89/<- %esi 4/r32/esp - 6014 # var vars/ecx: (stack (addr var) 16) - 6015 81 5/subop/subtract %esp 0xc0/imm32 - 6016 68/push 0xc0/imm32/size - 6017 68/push 0/imm32/top - 6018 89/<- %ecx 4/r32/esp - 6019 (clear-stack %ecx) - 6020 # convert - 6021 (parse-mu-var-def _test-input-stream %ecx %esi) - 6022 # var out-addr/esi: (addr stmt) - 6023 (lookup *esi *(esi+4)) # => eax - 6024 89/<- %esi 0/r32/eax - 6025 # - 6026 (check-ints-equal *esi 3 "F - test-parse-mu-reg-var-def/tag") # Stmt-tag is reg-var-def - 6027 # var v/ecx: (addr var) = lookup(out->outputs->value) - 6028 # . eax: (addr stmt-var) = lookup(out->outputs) - 6029 (lookup *(esi+0x14) *(esi+0x18)) # Regvardef-outputs Regvardef-outputs => eax - 6030 # . - 6031 (check-ints-equal *(eax+8) 0 "F - test-parse-mu-reg-var-def/single-output") # Stmt-var-next - 6032 # . eax: (addr var) = lookup(eax->value) - 6033 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 6034 # . ecx = eax - 6035 89/<- %ecx 0/r32/eax - 6036 # v->name - 6037 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax - 6038 (check-strings-equal %eax "n" "F - test-parse-mu-reg-var-def/output-name") # Var-name - 6039 # v->register - 6040 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax - 6041 (check-strings-equal %eax "eax" "F - test-parse-mu-reg-var-def/output-register") - 6042 # v->type == int - 6043 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 6044 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0") # Tree-is-atom - 6045 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-reg-var-def/output-type:1") # Tree-value - 6046 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-reg-var-def/output-type:2") # Tree-right - 6047 # . epilogue - 6048 89/<- %esp 5/r32/ebp - 6049 5d/pop-to-ebp - 6050 c3/return - 6051 - 6052 parse-mu-stmt: # line: (addr stream byte), vars: (addr stack live-var), fn: (addr function), out: (addr handle stmt) - 6053 # pseudocode: - 6054 # var name: slice - 6055 # allocate(Heap, Stmt-size, out) - 6056 # var out-addr: (addr stmt) = lookup(*out) - 6057 # out-addr->tag = stmt - 6058 # if stmt-has-outputs?(line) - 6059 # while true - 6060 # name = next-mu-token(line) - 6061 # if (name == '<-') break - 6062 # assert(is-identifier?(name)) - 6063 # var v: (handle var) = lookup-or-define-var(name, vars, fn) # regular stmts may define vars in fn outputs - 6064 # out-addr->outputs = append(v, out-addr->outputs) - 6065 # add-operation-and-inputs-to-stmt(out-addr, line, vars) - 6066 # - 6067 # . prologue - 6068 55/push-ebp - 6069 89/<- %ebp 4/r32/esp - 6070 # . save registers - 6071 50/push-eax - 6072 51/push-ecx - 6073 52/push-edx - 6074 53/push-ebx - 6075 57/push-edi - 6076 # var name/ecx: slice - 6077 68/push 0/imm32/end - 6078 68/push 0/imm32/start - 6079 89/<- %ecx 4/r32/esp - 6080 # var is-deref?/edx: boolean = false - 6081 ba/copy-to-edx 0/imm32/false - 6082 # var v: (handle var) - 6083 68/push 0/imm32 - 6084 68/push 0/imm32 - 6085 89/<- %ebx 4/r32/esp - 6086 # - 6087 (allocate Heap *Stmt-size *(ebp+0x14)) - 6088 # var out-addr/edi: (addr stmt) = lookup(*out) - 6089 8b/-> *(ebp+0x14) 7/r32/edi - 6090 (lookup *edi *(edi+4)) # => eax - 6091 89/<- %edi 0/r32/eax - 6092 # out-addr->tag = 1/stmt - 6093 c7 0/subop/copy *edi 1/imm32/stmt1 # Stmt-tag - 6094 { - 6095 (stmt-has-outputs? *(ebp+8)) - 6096 3d/compare-eax-and 0/imm32/false - 6097 0f 84/jump-if-= break/disp32 - 6098 { - 6099 $parse-mu-stmt:read-outputs: - 6100 # name = next-mu-token(line) - 6101 (next-mu-token *(ebp+8) %ecx) - 6102 # if slice-empty?(word-slice) break - 6103 (slice-empty? %ecx) # => eax - 6104 3d/compare-eax-and 0/imm32/false - 6105 0f 85/jump-if-!= break/disp32 - 6106 # if (name == "<-") break - 6107 (slice-equal? %ecx "<-") # => eax - 6108 3d/compare-eax-and 0/imm32/false - 6109 0f 85/jump-if-!= break/disp32 - 6110 # is-deref? = false - 6111 ba/copy-to-edx 0/imm32/false - 6112 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? - 6113 8b/-> *ecx 0/r32/eax # Slice-start - 6114 8a/copy-byte *eax 0/r32/AL - 6115 81 4/subop/and %eax 0xff/imm32 - 6116 3d/compare-eax-and 0x2a/imm32/asterisk - 6117 { - 6118 75/jump-if-!= break/disp8 - 6119 ff 0/subop/increment *ecx - 6120 ba/copy-to-edx 1/imm32/true - 6121 } - 6122 # assert(is-identifier?(name)) - 6123 (is-identifier? %ecx) # => eax - 6124 3d/compare-eax-and 0/imm32/false - 6125 0f 84/jump-if-= $parse-mu-stmt:abort/disp32 - 6126 # - 6127 (lookup-or-define-var %ecx *(ebp+0xc) *(ebp+0x10) %ebx) - 6128 8d/copy-address *(edi+0x14) 0/r32/eax # Stmt1-outputs - 6129 (append-stmt-var Heap *ebx *(ebx+4) *(edi+0x14) *(edi+0x18) %edx %eax) # Stmt1-outputs - 6130 # - 6131 e9/jump loop/disp32 - 6132 } - 6133 } - 6134 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc)) - 6135 $parse-mu-stmt:end: - 6136 # . reclaim locals - 6137 81 0/subop/add %esp 0x10/imm32 - 6138 # . restore registers - 6139 5f/pop-to-edi - 6140 5b/pop-to-ebx - 6141 5a/pop-to-edx - 6142 59/pop-to-ecx - 6143 58/pop-to-eax - 6144 # . epilogue - 6145 89/<- %esp 5/r32/ebp - 6146 5d/pop-to-ebp - 6147 c3/return - 6148 - 6149 $parse-mu-stmt:abort: - 6150 # error("invalid identifier '" name "'\n") - 6151 (write-buffered Stderr "invalid identifier '") - 6152 (write-slice-buffered Stderr %ecx) - 6153 (write-buffered Stderr "'\n") - 6154 (flush Stderr) - 6155 # . syscall(exit, 1) - 6156 bb/copy-to-ebx 1/imm32 - 6157 b8/copy-to-eax 1/imm32/exit - 6158 cd/syscall 0x80/imm8 - 6159 # never gets here - 6160 - 6161 add-operation-and-inputs-to-stmt: # stmt: (addr stmt), line: (addr stream byte), vars: (addr stack live-var) - 6162 # pseudocode: - 6163 # stmt->name = slice-to-string(next-mu-token(line)) - 6164 # while true - 6165 # name = next-mu-token(line) - 6166 # v = lookup-var-or-literal(name) - 6167 # stmt->inouts = append(v, stmt->inouts) - 6168 # - 6169 # . prologue - 6170 55/push-ebp - 6171 89/<- %ebp 4/r32/esp - 6172 # . save registers - 6173 50/push-eax - 6174 51/push-ecx - 6175 52/push-edx - 6176 53/push-ebx - 6177 56/push-esi - 6178 57/push-edi - 6179 # edi = stmt - 6180 8b/-> *(ebp+8) 7/r32/edi - 6181 # var name/ecx: slice - 6182 68/push 0/imm32/end - 6183 68/push 0/imm32/start - 6184 89/<- %ecx 4/r32/esp - 6185 # var is-deref?/edx: boolean = false - 6186 ba/copy-to-edx 0/imm32/false - 6187 # var v/esi: (handle var) - 6188 68/push 0/imm32 - 6189 68/push 0/imm32 - 6190 89/<- %esi 4/r32/esp - 6191 $add-operation-and-inputs-to-stmt:read-operation: - 6192 (next-mu-token *(ebp+0xc) %ecx) - 6193 8d/copy-address *(edi+4) 0/r32/eax # Stmt1-operation or Regvardef-operationStmt1-operation or Regvardef-operation - 6194 (slice-to-string Heap %ecx %eax) - 6195 # var is-get?/ebx: boolean = (name == "get") - 6196 (slice-equal? %ecx "get") # => eax - 6197 89/<- %ebx 0/r32/eax - 6198 { - 6199 $add-operation-and-inputs-to-stmt:read-inouts: - 6200 # name = next-mu-token(line) - 6201 (next-mu-token *(ebp+0xc) %ecx) - 6202 # if slice-empty?(word-slice) break - 6203 (slice-empty? %ecx) # => eax - 6204 3d/compare-eax-and 0/imm32/false - 6205 0f 85/jump-if-!= break/disp32 - 6206 # if (name == "<-") abort - 6207 (slice-equal? %ecx "<-") - 6208 3d/compare-eax-and 0/imm32/false - 6209 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32 - 6210 # if (is-get? && second operand) lookup or create offset - 6211 { - 6212 81 7/subop/compare %ebx 0/imm32/false - 6213 74/jump-if-= break/disp8 - 6214 (lookup *(edi+0xc) *(edi+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 6215 3d/compare-eax-and 0/imm32 - 6216 74/jump-if-= break/disp8 - 6217 (lookup-or-create-constant %eax %ecx %esi) - 6218 #? (lookup *esi *(esi+4)) - 6219 #? (write-buffered Stderr "creating new output var ") - 6220 #? (print-int32-buffered Stderr %eax) - 6221 #? (write-buffered Stderr " for field called ") - 6222 #? (write-slice-buffered Stderr %ecx) - 6223 #? (write-buffered Stderr "; var name ") - 6224 #? (lookup *eax *(eax+4)) # Var-name - 6225 #? (write-buffered Stderr %eax) - 6226 #? (write-buffered Stderr Newline) - 6227 #? (flush Stderr) - 6228 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32 - 6229 } - 6230 # is-deref? = false - 6231 ba/copy-to-edx 0/imm32/false - 6232 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? - 6233 8b/-> *ecx 0/r32/eax # Slice-start - 6234 8a/copy-byte *eax 0/r32/AL - 6235 81 4/subop/and %eax 0xff/imm32 - 6236 3d/compare-eax-and 0x2a/imm32/asterisk - 6237 { - 6238 75/jump-if-!= break/disp8 - 6239 $add-operation-and-inputs-to-stmt:inout-is-deref: - 6240 ff 0/subop/increment *ecx - 6241 ba/copy-to-edx 1/imm32/true - 6242 } - 6243 (lookup-var-or-literal %ecx *(ebp+0x10) %esi) - 6244 $add-operation-and-inputs-to-stmt:save-var: - 6245 8d/copy-address *(edi+0xc) 0/r32/eax - 6246 (append-stmt-var Heap *esi *(esi+4) *(edi+0xc) *(edi+0x10) %edx %eax) # Stmt1-inouts or Regvardef-inouts - 6247 # - 6248 e9/jump loop/disp32 - 6249 } - 6250 $add-operation-and-inputs-to-stmt:end: - 6251 # . reclaim locals - 6252 81 0/subop/add %esp 0x10/imm32 - 6253 # . restore registers - 6254 5f/pop-to-edi - 6255 5e/pop-to-esi - 6256 5b/pop-to-ebx - 6257 5a/pop-to-edx - 6258 59/pop-to-ecx - 6259 58/pop-to-eax - 6260 # . epilogue - 6261 89/<- %esp 5/r32/ebp - 6262 5d/pop-to-ebp - 6263 c3/return - 6264 - 6265 $add-operation-and-inputs-to-stmt:abort: - 6266 # error("invalid statement '" line "'\n") - 6267 (rewind-stream *(ebp+8)) - 6268 (write-buffered Stderr "invalid identifier '") - 6269 (flush Stderr) - 6270 (write-stream 2 *(ebp+8)) - 6271 (write-buffered Stderr "'\n") - 6272 (flush Stderr) - 6273 # . syscall(exit, 1) - 6274 bb/copy-to-ebx 1/imm32 - 6275 b8/copy-to-eax 1/imm32/exit - 6276 cd/syscall 0x80/imm8 - 6277 # never gets here - 6278 - 6279 stmt-has-outputs?: # line: (addr stream byte) -> result/eax: boolean - 6280 # . prologue - 6281 55/push-ebp - 6282 89/<- %ebp 4/r32/esp - 6283 # . save registers - 6284 51/push-ecx - 6285 # var word-slice/ecx: slice - 6286 68/push 0/imm32/end - 6287 68/push 0/imm32/start - 6288 89/<- %ecx 4/r32/esp - 6289 # result = false - 6290 b8/copy-to-eax 0/imm32/false - 6291 (rewind-stream *(ebp+8)) - 6292 { - 6293 (next-mu-token *(ebp+8) %ecx) - 6294 # if slice-empty?(word-slice) break - 6295 (slice-empty? %ecx) - 6296 3d/compare-eax-and 0/imm32/false - 6297 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) - 6298 0f 85/jump-if-!= break/disp32 - 6299 # if slice-starts-with?(word-slice, '#') break - 6300 # . eax = *word-slice->start - 6301 8b/-> *ecx 0/r32/eax - 6302 8a/copy-byte *eax 0/r32/AL - 6303 81 4/subop/and %eax 0xff/imm32 - 6304 # . if (eax == '#') break - 6305 3d/compare-eax-and 0x23/imm32/hash - 6306 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) - 6307 0f 84/jump-if-= break/disp32 - 6308 # if slice-equal?(word-slice, '<-') return true - 6309 (slice-equal? %ecx "<-") - 6310 3d/compare-eax-and 0/imm32/false - 6311 74/jump-if-= loop/disp8 - 6312 b8/copy-to-eax 1/imm32/true - 6313 } - 6314 $stmt-has-outputs:end: - 6315 (rewind-stream *(ebp+8)) - 6316 # . reclaim locals - 6317 81 0/subop/add %esp 8/imm32 - 6318 # . restore registers - 6319 59/pop-to-ecx - 6320 # . epilogue - 6321 89/<- %esp 5/r32/ebp - 6322 5d/pop-to-ebp - 6323 c3/return - 6324 - 6325 # if 'name' starts with a digit, create a new literal var for it - 6326 # otherwise return first 'name' from the top (back) of 'vars' and abort if not found - 6327 lookup-var-or-literal: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var) - 6328 # . prologue - 6329 55/push-ebp - 6330 89/<- %ebp 4/r32/esp - 6331 # . save registers - 6332 50/push-eax - 6333 51/push-ecx - 6334 56/push-esi - 6335 # esi = name - 6336 8b/-> *(ebp+8) 6/r32/esi - 6337 # if slice-empty?(name) abort - 6338 (slice-empty? %esi) # => eax - 6339 3d/compare-eax-and 0/imm32/false - 6340 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32 - 6341 # var c/ecx: byte = *name->start - 6342 8b/-> *esi 1/r32/ecx - 6343 8a/copy-byte *ecx 1/r32/CL - 6344 81 4/subop/and %ecx 0xff/imm32 - 6345 # if is-decimal-digit?(c) return new var(name) - 6346 { - 6347 (is-decimal-digit? %ecx) # => eax - 6348 3d/compare-eax-and 0/imm32/false - 6349 74/jump-if-= break/disp8 - 6350 (new-literal-integer Heap %esi *(ebp+0x10)) - 6351 eb/jump $lookup-var-or-literal:end/disp8 - 6352 } - 6353 # else if (c == '"') return new var(name) - 6354 { - 6355 81 7/subop/compare %ecx 0x22/imm32/dquote - 6356 75/jump-if-!= break/disp8 - 6357 (new-literal Heap %esi *(ebp+0x10)) - 6358 eb/jump $lookup-var-or-literal:end/disp8 - 6359 } - 6360 # otherwise return lookup-var(name, vars) - 6361 { - 6362 (lookup-var %esi *(ebp+0xc)) # => eax - 6363 } - 6364 $lookup-var-or-literal:end: - 6365 # . restore registers - 6366 5e/pop-to-esi - 6367 59/pop-to-ecx - 6368 58/pop-to-eax - 6369 # . epilogue - 6370 89/<- %esp 5/r32/ebp - 6371 5d/pop-to-ebp - 6372 c3/return - 6373 - 6374 $lookup-var-or-literal:abort: - 6375 (write-buffered Stderr "empty variable!") - 6376 (flush Stderr) - 6377 # . syscall(exit, 1) - 6378 bb/copy-to-ebx 1/imm32 - 6379 b8/copy-to-eax 1/imm32/exit - 6380 cd/syscall 0x80/imm8 - 6381 # never gets here - 6382 - 6383 # return first 'name' from the top (back) of 'vars' and abort if not found - 6384 lookup-var: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var) - 6385 # . prologue - 6386 55/push-ebp - 6387 89/<- %ebp 4/r32/esp - 6388 # . save registers - 6389 50/push-eax - 6390 # - 6391 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x10)) - 6392 # if (*out == 0) abort - 6393 8b/-> *(ebp+0x10) 0/r32/eax - 6394 81 7/subop/compare *eax 0/imm32 - 6395 74/jump-if-= $lookup-var:abort/disp8 - 6396 $lookup-var:end: - 6397 # . restore registers - 6398 58/pop-to-eax - 6399 # . epilogue - 6400 89/<- %esp 5/r32/ebp - 6401 5d/pop-to-ebp - 6402 c3/return - 6403 - 6404 $lookup-var:abort: - 6405 (write-buffered Stderr "unknown variable '") - 6406 (write-slice-buffered Stderr *(ebp+8)) - 6407 (write-buffered Stderr "'\n") - 6408 (flush Stderr) - 6409 # . syscall(exit, 1) - 6410 bb/copy-to-ebx 1/imm32 - 6411 b8/copy-to-eax 1/imm32/exit - 6412 cd/syscall 0x80/imm8 - 6413 # never gets here - 6414 - 6415 # return first 'name' from the top (back) of 'vars', and 0/null if not found - 6416 lookup-var-helper: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var) - 6417 # pseudocode: - 6418 # var curr: (addr handle var) = &vars->data[vars->top - 12] - 6419 # var min = vars->data - 6420 # while curr >= min - 6421 # var v: (handle var) = *curr - 6422 # if v->name == name - 6423 # return - 6424 # curr -= 12 - 6425 # - 6426 # . prologue - 6427 55/push-ebp - 6428 89/<- %ebp 4/r32/esp - 6429 # . save registers - 6430 50/push-eax - 6431 51/push-ecx - 6432 52/push-edx - 6433 53/push-ebx - 6434 56/push-esi - 6435 # clear out - 6436 (zero-out *(ebp+0x10) *Handle-size) - 6437 # esi = vars - 6438 8b/-> *(ebp+0xc) 6/r32/esi - 6439 # ebx = vars->top - 6440 8b/-> *esi 3/r32/ebx - 6441 # if (vars->top > vars->size) abort - 6442 3b/compare<- *(esi+4) 0/r32/eax - 6443 0f 8f/jump-if-> $lookup-var-helper:error1/disp32 - 6444 # var min/edx: (addr handle var) = vars->data - 6445 8d/copy-address *(esi+8) 2/r32/edx - 6446 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] - 6447 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 - 6448 { - 6449 # if (curr < min) return - 6450 39/compare %ebx 2/r32/edx - 6451 0f 82/jump-if-addr< break/disp32 - 6452 # var v/ecx: (addr var) = lookup(*curr) - 6453 (lookup *ebx *(ebx+4)) # => eax - 6454 89/<- %ecx 0/r32/eax - 6455 # var vn/eax: (addr array byte) = lookup(v->name) - 6456 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax - 6457 # if (vn == name) return curr - 6458 (slice-equal? *(ebp+8) %eax) # => eax - 6459 3d/compare-eax-and 0/imm32/false - 6460 { - 6461 74/jump-if-= break/disp8 - 6462 # esi = out - 6463 8b/-> *(ebp+0x10) 6/r32/esi - 6464 # *out = *curr - 6465 8b/-> *ebx 0/r32/eax - 6466 89/<- *esi 0/r32/eax - 6467 8b/-> *(ebx+4) 0/r32/eax - 6468 89/<- *(esi+4) 0/r32/eax - 6469 # return - 6470 eb/jump $lookup-var-helper:end/disp8 - 6471 } - 6472 # curr -= 12 - 6473 81 5/subop/subtract %ebx 0xc/imm32 - 6474 e9/jump loop/disp32 - 6475 } - 6476 $lookup-var-helper:end: - 6477 # . restore registers - 6478 5e/pop-to-esi - 6479 5b/pop-to-ebx - 6480 5a/pop-to-edx - 6481 59/pop-to-ecx - 6482 58/pop-to-eax - 6483 # . epilogue - 6484 89/<- %esp 5/r32/ebp - 6485 5d/pop-to-ebp - 6486 c3/return - 6487 - 6488 $lookup-var-helper:error1: - 6489 (write-buffered Stderr "malformed stack when looking up '") - 6490 (write-slice-buffered Stderr *(ebp+8)) - 6491 (write-buffered Stderr "'\n") - 6492 (flush Stderr) - 6493 # . syscall(exit, 1) - 6494 bb/copy-to-ebx 1/imm32 - 6495 b8/copy-to-eax 1/imm32/exit - 6496 cd/syscall 0x80/imm8 - 6497 # never gets here - 6498 - 6499 # return first 'name' from the top (back) of 'vars' and create a new var for a fn output if not found - 6500 lookup-or-define-var: # name: (addr slice), vars: (addr stack live-var), fn: (addr function), out: (addr handle var) - 6501 # . prologue - 6502 55/push-ebp - 6503 89/<- %ebp 4/r32/esp - 6504 # . save registers - 6505 50/push-eax - 6506 # - 6507 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x14)) - 6508 { - 6509 # if (out != 0) return - 6510 8b/-> *(ebp+0x14) 0/r32/eax - 6511 81 7/subop/compare *eax 0/imm32 - 6512 75/jump-if-!= break/disp8 - 6513 # if name is one of fn's outputs, return it - 6514 { - 6515 (find-in-function-outputs *(ebp+0x10) *(ebp+8) *(ebp+0x14)) - 6516 8b/-> *(ebp+0x14) 0/r32/eax - 6517 81 7/subop/compare *eax 0/imm32 - 6518 # otherwise abort - 6519 0f 84/jump-if-= $lookup-var:abort/disp32 - 6520 # update vars - 6521 (push *(ebp+0xc) *eax) - 6522 (push *(ebp+0xc) *(eax+4)) - 6523 (push *(ebp+0xc) 0) # never spill fn-outputs - 6524 } - 6525 } - 6526 $lookup-or-define-var:end: - 6527 # . restore registers - 6528 58/pop-to-eax - 6529 # . epilogue - 6530 89/<- %esp 5/r32/ebp - 6531 5d/pop-to-ebp - 6532 c3/return - 6533 - 6534 find-in-function-outputs: # fn: (addr function), name: (addr slice), out: (addr handle var) - 6535 # . prologue - 6536 55/push-ebp - 6537 89/<- %ebp 4/r32/esp - 6538 # . save registers - 6539 50/push-eax - 6540 51/push-ecx - 6541 # var curr/ecx: (addr list var) = lookup(fn->outputs) - 6542 8b/-> *(ebp+8) 1/r32/ecx - 6543 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax - 6544 89/<- %ecx 0/r32/eax - 6545 # while curr != null - 6546 { - 6547 81 7/subop/compare %ecx 0/imm32 - 6548 74/jump-if-= break/disp8 - 6549 # var v/eax: (addr var) = lookup(curr->value) - 6550 (lookup *ecx *(ecx+4)) # List-value List-value => eax - 6551 # var s/eax: (addr array byte) = lookup(v->name) - 6552 (lookup *eax *(eax+4)) # Var-name Var-name => eax - 6553 # if (s == name) return curr->value - 6554 (slice-equal? *(ebp+0xc) %eax) # => eax - 6555 3d/compare-eax-and 0/imm32/false - 6556 { - 6557 74/jump-if-= break/disp8 - 6558 # var edi = out - 6559 57/push-edi - 6560 8b/-> *(ebp+0x10) 7/r32/edi - 6561 # *out = curr->value - 6562 8b/-> *ecx 0/r32/eax - 6563 89/<- *edi 0/r32/eax - 6564 8b/-> *(ecx+4) 0/r32/eax - 6565 89/<- *(edi+4) 0/r32/eax - 6566 # - 6567 5f/pop-to-edi - 6568 eb/jump $find-in-function-outputs:end/disp8 - 6569 } - 6570 # curr = curr->next - 6571 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax - 6572 89/<- %ecx 0/r32/eax - 6573 # - 6574 eb/jump loop/disp8 - 6575 } - 6576 b8/copy-to-eax 0/imm32 - 6577 $find-in-function-outputs:end: - 6578 # . restore registers - 6579 59/pop-to-ecx - 6580 58/pop-to-eax - 6581 # . epilogue - 6582 89/<- %esp 5/r32/ebp - 6583 5d/pop-to-ebp - 6584 c3/return - 6585 - 6586 test-parse-mu-stmt: - 6587 # . prologue - 6588 55/push-ebp - 6589 89/<- %ebp 4/r32/esp - 6590 # setup - 6591 (clear-stream _test-input-stream) - 6592 (write _test-input-stream "increment n\n") - 6593 # var vars/ecx: (stack (addr var) 16) - 6594 81 5/subop/subtract %esp 0xc0/imm32 - 6595 68/push 0xc0/imm32/size - 6596 68/push 0/imm32/top - 6597 89/<- %ecx 4/r32/esp - 6598 (clear-stack %ecx) - 6599 # var v/edx: (handle var) - 6600 68/push 0/imm32 - 6601 68/push 0/imm32 - 6602 89/<- %edx 4/r32/esp - 6603 # var s/eax: (handle array byte) - 6604 68/push 0/imm32 - 6605 68/push 0/imm32 - 6606 89/<- %eax 4/r32/esp - 6607 # v = new var("n") - 6608 (copy-array Heap "n" %eax) - 6609 (new-var Heap *eax *(eax+4) %edx) - 6610 # - 6611 (push %ecx *edx) - 6612 (push %ecx *(edx+4)) - 6613 (push %ecx 0) - 6614 # var out/eax: (handle stmt) - 6615 68/push 0/imm32 - 6616 68/push 0/imm32 - 6617 89/<- %eax 4/r32/esp - 6618 # convert - 6619 (parse-mu-stmt _test-input-stream %ecx 0 %eax) - 6620 # var out-addr/edx: (addr stmt) = lookup(*out) - 6621 (lookup *eax *(eax+4)) # => eax - 6622 89/<- %edx 0/r32/eax - 6623 # out->tag - 6624 (check-ints-equal *edx 1 "F - test-parse-mu-stmt/tag") # Stmt-tag is Stmt1 - 6625 # out->operation - 6626 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax - 6627 (check-strings-equal %eax "increment" "F - test-parse-mu-stmt/name") # Stmt1-operation - 6628 # out->inouts->value->name - 6629 # . eax = out->inouts - 6630 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 6631 # . eax = out->inouts->value - 6632 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 6633 # . eax = out->inouts->value->name - 6634 (lookup *eax *(eax+4)) # Var-name Var-name => eax - 6635 # . - 6636 (check-strings-equal %eax "n" "F - test-parse-mu-stmt/inout:0") - 6637 # . epilogue - 6638 89/<- %esp 5/r32/ebp - 6639 5d/pop-to-ebp - 6640 c3/return - 6641 - 6642 test-parse-mu-stmt-with-comma: - 6643 # . prologue - 6644 55/push-ebp - 6645 89/<- %ebp 4/r32/esp - 6646 # setup - 6647 (clear-stream _test-input-stream) - 6648 (write _test-input-stream "copy-to n, 3\n") - 6649 # var vars/ecx: (stack (addr var) 16) - 6650 81 5/subop/subtract %esp 0xc0/imm32 - 6651 68/push 0xc0/imm32/size - 6652 68/push 0/imm32/top - 6653 89/<- %ecx 4/r32/esp - 6654 (clear-stack %ecx) - 6655 # var v/edx: (handle var) - 6656 68/push 0/imm32 - 6657 68/push 0/imm32 - 6658 89/<- %edx 4/r32/esp - 6659 # var s/eax: (handle array byte) - 6660 68/push 0/imm32 - 6661 68/push 0/imm32 - 6662 89/<- %eax 4/r32/esp - 6663 # v = new var("n") - 6664 (copy-array Heap "n" %eax) - 6665 (new-var Heap *eax *(eax+4) %edx) - 6666 # - 6667 (push %ecx *edx) - 6668 (push %ecx *(edx+4)) - 6669 (push %ecx 0) - 6670 # var out/eax: (handle stmt) - 6671 68/push 0/imm32 - 6672 68/push 0/imm32 - 6673 89/<- %eax 4/r32/esp - 6674 # convert - 6675 (parse-mu-stmt _test-input-stream %ecx 0 %eax) - 6676 # var out-addr/edx: (addr stmt) = lookup(*out) - 6677 (lookup *eax *(eax+4)) # => eax - 6678 89/<- %edx 0/r32/eax - 6679 # out->tag - 6680 (check-ints-equal *edx 1 "F - test-parse-mu-stmt-with-comma/tag") # Stmt-tag is Stmt1 - 6681 # out->operation - 6682 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax - 6683 (check-strings-equal %eax "copy-to" "F - test-parse-mu-stmt-with-comma/name") # Stmt1-operation - 6684 # out->inouts->value->name - 6685 # . eax = out->inouts - 6686 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 6687 # . eax = out->inouts->value - 6688 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 6689 # . eax = out->inouts->value->name - 6690 (lookup *eax *(eax+4)) # Var-name Var-name => eax - 6691 # . - 6692 (check-strings-equal %eax "n" "F - test-parse-mu-stmt-with-comma/inout:0") - 6693 # . epilogue - 6694 89/<- %esp 5/r32/ebp - 6695 5d/pop-to-ebp - 6696 c3/return - 6697 - 6698 new-var: # ad: (addr allocation-descriptor), name: (handle array byte), out: (addr handle var) - 6699 # . prologue - 6700 55/push-ebp - 6701 89/<- %ebp 4/r32/esp - 6702 # . save registers - 6703 50/push-eax - 6704 51/push-ecx - 6705 # ecx = out - 6706 8b/-> *(ebp+0x14) 1/r32/ecx - 6707 # - 6708 (allocate *(ebp+8) *Var-size %ecx) - 6709 # var out-addr/eax: (addr var) - 6710 (lookup *ecx *(ecx+4)) # => eax - 6711 # out-addr->name = name - 6712 8b/-> *(ebp+0xc) 1/r32/ecx - 6713 89/<- *eax 1/r32/ecx # Var-name - 6714 8b/-> *(ebp+0x10) 1/r32/ecx - 6715 89/<- *(eax+4) 1/r32/ecx # Var-name - 6716 #? (write-buffered Stderr "var ") - 6717 #? (lookup *(ebp+0xc) *(ebp+0x10)) - 6718 #? (write-buffered Stderr %eax) - 6719 #? (write-buffered Stderr " at ") - 6720 #? 8b/-> *(ebp+0x14) 1/r32/ecx - 6721 #? (lookup *ecx *(ecx+4)) # => eax - 6722 #? (print-int32-buffered Stderr %eax) - 6723 #? (write-buffered Stderr Newline) - 6724 #? (flush Stderr) - 6725 $new-var:end: - 6726 # . restore registers - 6727 59/pop-to-ecx - 6728 58/pop-to-eax - 6729 # . epilogue - 6730 89/<- %esp 5/r32/ebp - 6731 5d/pop-to-ebp - 6732 c3/return - 6733 - 6734 new-literal-integer: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) - 6735 # . prologue - 6736 55/push-ebp - 6737 89/<- %ebp 4/r32/esp - 6738 # . save registers - 6739 50/push-eax - 6740 51/push-ecx - 6741 # if (!is-hex-int?(name)) abort - 6742 (is-hex-int? *(ebp+0xc)) # => eax - 6743 3d/compare-eax-and 0/imm32/false - 6744 0f 84/jump-if-= $new-literal-integer:abort/disp32 - 6745 # out = new var(s) - 6746 (new-var-from-slice *(ebp+8) *(ebp+0xc) *(ebp+0x10)) - 6747 # var out-addr/ecx: (addr var) = lookup(*out) - 6748 8b/-> *(ebp+0x10) 0/r32/eax - 6749 (lookup *eax *(eax+4)) # => eax - 6750 89/<- %ecx 0/r32/eax - 6751 # out-addr->type = new tree() - 6752 8d/copy-address *(ecx+8) 0/r32/eax # Var-type - 6753 (allocate *(ebp+8) *Tree-size %eax) - 6754 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 6755 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom - 6756 # nothing else to do; default type is 'literal' - 6757 $new-literal-integer:end: - 6758 # . reclaim locals - 6759 81 0/subop/add %esp 8/imm32 - 6760 # . restore registers - 6761 59/pop-to-ecx - 6762 58/pop-to-eax - 6763 # . epilogue - 6764 89/<- %esp 5/r32/ebp - 6765 5d/pop-to-ebp - 6766 c3/return - 6767 - 6768 $new-literal-integer:abort: - 6769 (write-buffered Stderr "variable cannot begin with a digit '") - 6770 (write-slice-buffered Stderr *(ebp+0xc)) - 6771 (write-buffered Stderr "'\n") - 6772 (flush Stderr) - 6773 # . syscall(exit, 1) - 6774 bb/copy-to-ebx 1/imm32 - 6775 b8/copy-to-eax 1/imm32/exit - 6776 cd/syscall 0x80/imm8 - 6777 # never gets here - 6778 - 6779 new-literal: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) - 6780 # . prologue - 6781 55/push-ebp - 6782 89/<- %ebp 4/r32/esp - 6783 # . save registers - 6784 50/push-eax - 6785 51/push-ecx - 6786 # var s/ecx: (handle array byte) - 6787 68/push 0/imm32 - 6788 68/push 0/imm32 - 6789 89/<- %ecx 4/r32/esp - 6790 # s = slice-to-string(name) - 6791 (slice-to-string Heap *(ebp+0xc) %ecx) - 6792 # allocate to out - 6793 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) - 6794 # var out-addr/ecx: (addr var) = lookup(*out) - 6795 8b/-> *(ebp+0x10) 1/r32/ecx - 6796 (lookup *ecx *(ecx+4)) # => eax - 6797 89/<- %ecx 0/r32/eax - 6798 # out-addr->type/eax = new type - 6799 8d/copy-address *(ecx+8) 0/r32/eax # Var-type - 6800 (allocate *(ebp+8) *Tree-size %eax) - 6801 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 6802 # nothing else to do; default type is 'literal' - 6803 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom - 6804 $new-literal:end: - 6805 # . reclaim locals - 6806 81 0/subop/add %esp 8/imm32 - 6807 # . restore registers - 6808 59/pop-to-ecx - 6809 58/pop-to-eax - 6810 # . epilogue - 6811 89/<- %esp 5/r32/ebp - 6812 5d/pop-to-ebp - 6813 c3/return - 6814 - 6815 new-var-from-slice: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) - 6816 # . prologue - 6817 55/push-ebp - 6818 89/<- %ebp 4/r32/esp - 6819 # . save registers - 6820 51/push-ecx - 6821 # var tmp/ecx: (handle array byte) - 6822 68/push 0/imm32 - 6823 68/push 0/imm32 - 6824 89/<- %ecx 4/r32/esp - 6825 # tmp = slice-to-string(name) - 6826 (slice-to-string Heap *(ebp+0xc) %ecx) - 6827 # out = new-var(tmp) - 6828 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) - 6829 $new-var-from-slice:end: + 4821 $next-mu-token:check-for-open-paren: + 4822 # if (curr-byte != '(') break + 4823 3d/compare-eax-and 0x28/imm32/open-paren + 4824 75/jump-if-!= break/disp8 + 4825 # ++in->read + 4826 ff 0/subop/increment *(esi+4) + 4827 # return + 4828 e9/jump $next-mu-token:done/disp32 + 4829 } + 4830 { + 4831 $next-mu-token:check-for-close-paren: + 4832 # if (curr-byte != ')') break + 4833 3d/compare-eax-and 0x29/imm32/close-paren + 4834 75/jump-if-!= break/disp8 + 4835 # ++in->read + 4836 ff 0/subop/increment *(esi+4) + 4837 # return + 4838 e9/jump $next-mu-token:done/disp32 + 4839 } + 4840 { + 4841 $next-mu-token:regular-word-without-metadata: + 4842 # if (in->read >= in->write) break + 4843 # . ecx = in->read + 4844 8b/-> *(esi+4) 1/r32/ecx + 4845 # . if (ecx >= in->write) break + 4846 3b/compare<- *esi 1/r32/ecx + 4847 7d/jump-if->= break/disp8 + 4848 # var c/eax: byte = in->data[in->read] + 4849 31/xor-with %eax 0/r32/eax + 4850 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL + 4851 # if (c == ' ') break + 4852 3d/compare-eax-and 0x20/imm32/space + 4853 74/jump-if-= break/disp8 + 4854 # if (c == '\r') break + 4855 3d/compare-eax-and 0xd/imm32/carriage-return + 4856 74/jump-if-= break/disp8 + 4857 # if (c == '\n') break + 4858 3d/compare-eax-and 0xa/imm32/newline + 4859 74/jump-if-= break/disp8 + 4860 # if (c == '(') break + 4861 3d/compare-eax-and 0x28/imm32/open-paren + 4862 0f 84/jump-if-= break/disp32 + 4863 # if (c == ')') break + 4864 3d/compare-eax-and 0x29/imm32/close-paren + 4865 0f 84/jump-if-= break/disp32 + 4866 # if (c == ',') break + 4867 3d/compare-eax-and 0x2c/imm32/comma + 4868 0f 84/jump-if-= break/disp32 + 4869 # ++in->read + 4870 ff 0/subop/increment *(esi+4) + 4871 # + 4872 e9/jump loop/disp32 + 4873 } + 4874 $next-mu-token:done: + 4875 # out->end = &in->data[in->read] + 4876 8b/-> *(esi+4) 1/r32/ecx + 4877 8d/copy-address *(esi+ecx+0xc) 0/r32/eax + 4878 89/<- *(edi+4) 0/r32/eax + 4879 $next-mu-token:end: + 4880 # . restore registers + 4881 5f/pop-to-edi + 4882 5e/pop-to-esi + 4883 59/pop-to-ecx + 4884 58/pop-to-eax + 4885 # . epilogue + 4886 89/<- %esp 5/r32/ebp + 4887 5d/pop-to-ebp + 4888 c3/return + 4889 + 4890 pos-or-insert-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int + 4891 # . prologue + 4892 55/push-ebp + 4893 89/<- %ebp 4/r32/esp + 4894 # if (pos-slice(arr, s) != -1) return it + 4895 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax + 4896 3d/compare-eax-and -1/imm32 + 4897 75/jump-if-!= $pos-or-insert-slice:end/disp8 + 4898 $pos-or-insert-slice:insert: + 4899 # var s2/eax: (handle array byte) + 4900 68/push 0/imm32 + 4901 68/push 0/imm32 + 4902 89/<- %eax 4/r32/esp + 4903 (slice-to-string Heap *(ebp+0xc) %eax) + 4904 # throw away alloc-id + 4905 (lookup *eax *(eax+4)) # => eax + 4906 (write-int *(ebp+8) %eax) + 4907 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax + 4908 $pos-or-insert-slice:end: + 4909 # . reclaim locals + 4910 81 0/subop/add %esp 8/imm32 + 4911 # . epilogue + 4912 89/<- %esp 5/r32/ebp + 4913 5d/pop-to-ebp + 4914 c3/return + 4915 + 4916 # return the index in an array of strings matching 's', -1 if not found + 4917 # index is denominated in elements, not bytes + 4918 pos-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int + 4919 # . prologue + 4920 55/push-ebp + 4921 89/<- %ebp 4/r32/esp + 4922 # . save registers + 4923 51/push-ecx + 4924 52/push-edx + 4925 53/push-ebx + 4926 56/push-esi + 4927 #? (write-buffered Stderr "pos-slice: ") + 4928 #? (write-slice-buffered Stderr *(ebp+0xc)) + 4929 #? (write-buffered Stderr "\n") + 4930 #? (flush Stderr) + 4931 # esi = arr + 4932 8b/-> *(ebp+8) 6/r32/esi + 4933 # var index/ecx: int = 0 + 4934 b9/copy-to-ecx 0/imm32 + 4935 # var curr/edx: (addr (addr array byte)) = arr->data + 4936 8d/copy-address *(esi+0xc) 2/r32/edx + 4937 # var max/ebx: (addr (addr array byte)) = &arr->data[arr->write] + 4938 8b/-> *esi 3/r32/ebx + 4939 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx + 4940 { + 4941 #? (write-buffered Stderr " ") + 4942 #? (print-int32-buffered Stderr %ecx) + 4943 #? (write-buffered Stderr "\n") + 4944 #? (flush Stderr) + 4945 # if (curr >= max) return -1 + 4946 39/compare %edx 3/r32/ebx + 4947 b8/copy-to-eax -1/imm32 + 4948 73/jump-if-addr>= $pos-slice:end/disp8 + 4949 # if (slice-equal?(s, *curr)) break + 4950 (slice-equal? *(ebp+0xc) *edx) # => eax + 4951 3d/compare-eax-and 0/imm32/false + 4952 75/jump-if-!= break/disp8 + 4953 # ++index + 4954 41/increment-ecx + 4955 # curr += 4 + 4956 81 0/subop/add %edx 4/imm32 + 4957 # + 4958 eb/jump loop/disp8 + 4959 } + 4960 # return index + 4961 89/<- %eax 1/r32/ecx + 4962 $pos-slice:end: + 4963 #? (write-buffered Stderr "=> ") + 4964 #? (print-int32-buffered Stderr %eax) + 4965 #? (write-buffered Stderr "\n") + 4966 # . restore registers + 4967 5e/pop-to-esi + 4968 5b/pop-to-ebx + 4969 5a/pop-to-edx + 4970 59/pop-to-ecx + 4971 # . epilogue + 4972 89/<- %esp 5/r32/ebp + 4973 5d/pop-to-ebp + 4974 c3/return + 4975 + 4976 test-parse-var-with-type: + 4977 # . prologue + 4978 55/push-ebp + 4979 89/<- %ebp 4/r32/esp + 4980 # (eax..ecx) = "x:" + 4981 b8/copy-to-eax "x:"/imm32 + 4982 8b/-> *eax 1/r32/ecx + 4983 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 4984 05/add-to-eax 4/imm32 + 4985 # var slice/ecx: slice = {eax, ecx} + 4986 51/push-ecx + 4987 50/push-eax + 4988 89/<- %ecx 4/r32/esp + 4989 # _test-input-stream contains "int" + 4990 (clear-stream _test-input-stream) + 4991 (write _test-input-stream "int") + 4992 # var v/edx: (handle var) + 4993 68/push 0/imm32 + 4994 68/push 0/imm32 + 4995 89/<- %edx 4/r32/esp + 4996 # + 4997 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) + 4998 # var v-addr/edx: (addr var) = lookup(v) + 4999 (lookup *edx *(edx+4)) # => eax + 5000 89/<- %edx 0/r32/eax + 5001 # check v-addr->name + 5002 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 5003 (check-strings-equal %eax "x" "F - test-parse-var-with-type/name") + 5004 # check v-addr->type + 5005 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 5006 (check-ints-equal *eax 1 "F - test-parse-var-with-type/type:0") # Tree-is-atom + 5007 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type/type:1") # Tree-value + 5008 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type/type:2") # Tree-right + 5009 # . epilogue + 5010 89/<- %esp 5/r32/ebp + 5011 5d/pop-to-ebp + 5012 c3/return + 5013 + 5014 test-parse-var-with-type-and-register: + 5015 # . prologue + 5016 55/push-ebp + 5017 89/<- %ebp 4/r32/esp + 5018 # (eax..ecx) = "x/eax:" + 5019 b8/copy-to-eax "x/eax:"/imm32 + 5020 8b/-> *eax 1/r32/ecx + 5021 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5022 05/add-to-eax 4/imm32 + 5023 # var slice/ecx: slice = {eax, ecx} + 5024 51/push-ecx + 5025 50/push-eax + 5026 89/<- %ecx 4/r32/esp + 5027 # _test-input-stream contains "int" + 5028 (clear-stream _test-input-stream) + 5029 (write _test-input-stream "int") + 5030 # var v/edx: (handle var) + 5031 68/push 0/imm32 + 5032 68/push 0/imm32 + 5033 89/<- %edx 4/r32/esp + 5034 # + 5035 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) + 5036 # var v-addr/edx: (addr var) = lookup(v) + 5037 (lookup *edx *(edx+4)) # => eax + 5038 89/<- %edx 0/r32/eax + 5039 # check v-addr->name + 5040 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 5041 (check-strings-equal %eax "x" "F - test-parse-var-with-type-and-register/name") + 5042 # check v-addr->register + 5043 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax + 5044 (check-strings-equal %eax "eax" "F - test-parse-var-with-type-and-register/register") + 5045 # check v-addr->type + 5046 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 5047 (check-ints-equal *eax 1 "F - test-parse-var-with-type-and-register/type:0") # Tree-is-atom + 5048 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type-and-register/type:1") # Tree-left + 5049 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type-and-register/type:2") # Tree-right + 5050 # . epilogue + 5051 89/<- %esp 5/r32/ebp + 5052 5d/pop-to-ebp + 5053 c3/return + 5054 + 5055 test-parse-var-with-trailing-characters: + 5056 # . prologue + 5057 55/push-ebp + 5058 89/<- %ebp 4/r32/esp + 5059 # (eax..ecx) = "x:" + 5060 b8/copy-to-eax "x:"/imm32 + 5061 8b/-> *eax 1/r32/ecx + 5062 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5063 05/add-to-eax 4/imm32 + 5064 # var slice/ecx: slice = {eax, ecx} + 5065 51/push-ecx + 5066 50/push-eax + 5067 89/<- %ecx 4/r32/esp + 5068 # _test-input-stream contains "int," + 5069 (clear-stream _test-input-stream) + 5070 (write _test-input-stream "int,") + 5071 # var v/edx: (handle var) + 5072 68/push 0/imm32 + 5073 68/push 0/imm32 + 5074 89/<- %edx 4/r32/esp + 5075 # + 5076 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) + 5077 # var v-addr/edx: (addr var) = lookup(v) + 5078 (lookup *edx *(edx+4)) # => eax + 5079 89/<- %edx 0/r32/eax + 5080 # check v-addr->name + 5081 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 5082 (check-strings-equal %eax "x" "F - test-parse-var-with-trailing-characters/name") + 5083 # check v-addr->register + 5084 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-trailing-characters/register") # Var-register + 5085 # check v-addr->type + 5086 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 5087 (check-ints-equal *eax 1 "F - test-parse-var-with-trailing-characters/type:0") # Tree-is-atom + 5088 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-trailing-characters/type:1") # Tree-left + 5089 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-trailing-characters/type:1") # Tree-right + 5090 # . epilogue + 5091 89/<- %esp 5/r32/ebp + 5092 5d/pop-to-ebp + 5093 c3/return + 5094 + 5095 test-parse-var-with-register-and-trailing-characters: + 5096 # . prologue + 5097 55/push-ebp + 5098 89/<- %ebp 4/r32/esp + 5099 # (eax..ecx) = "x/eax:" + 5100 b8/copy-to-eax "x/eax:"/imm32 + 5101 8b/-> *eax 1/r32/ecx + 5102 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5103 05/add-to-eax 4/imm32 + 5104 # var slice/ecx: slice = {eax, ecx} + 5105 51/push-ecx + 5106 50/push-eax + 5107 89/<- %ecx 4/r32/esp + 5108 # _test-input-stream contains "int," + 5109 (clear-stream _test-input-stream) + 5110 (write _test-input-stream "int,") + 5111 # var v/edx: (handle var) + 5112 68/push 0/imm32 + 5113 68/push 0/imm32 + 5114 89/<- %edx 4/r32/esp + 5115 # + 5116 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) + 5117 # var v-addr/edx: (addr var) = lookup(v) + 5118 (lookup *edx *(edx+4)) # => eax + 5119 89/<- %edx 0/r32/eax + 5120 # check v-addr->name + 5121 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 5122 (check-strings-equal %eax "x" "F - test-parse-var-with-register-and-trailing-characters/name") + 5123 # check v-addr->register + 5124 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax + 5125 (check-strings-equal %eax "eax" "F - test-parse-var-with-register-and-trailing-characters/register") + 5126 # check v-addr->type + 5127 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 5128 (check-ints-equal *eax 1 "F - test-parse-var-with-register-and-trailing-characters/type:0") # Tree-is-atom + 5129 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-register-and-trailing-characters/type:1") # Tree-left + 5130 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-register-and-trailing-characters/type:2") # Tree-right + 5131 # . epilogue + 5132 89/<- %esp 5/r32/ebp + 5133 5d/pop-to-ebp + 5134 c3/return + 5135 + 5136 test-parse-var-with-compound-type: + 5137 # . prologue + 5138 55/push-ebp + 5139 89/<- %ebp 4/r32/esp + 5140 # (eax..ecx) = "x:" + 5141 b8/copy-to-eax "x:"/imm32 + 5142 8b/-> *eax 1/r32/ecx + 5143 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5144 05/add-to-eax 4/imm32 + 5145 # var slice/ecx: slice = {eax, ecx} + 5146 51/push-ecx + 5147 50/push-eax + 5148 89/<- %ecx 4/r32/esp + 5149 # _test-input-stream contains "(addr int)" + 5150 (clear-stream _test-input-stream) + 5151 (write _test-input-stream "(addr int)") + 5152 # var v/edx: (handle var) + 5153 68/push 0/imm32 + 5154 68/push 0/imm32 + 5155 89/<- %edx 4/r32/esp + 5156 # + 5157 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) + 5158 # var v-addr/edx: (addr var) = lookup(v) + 5159 (lookup *edx *(edx+4)) # => eax + 5160 89/<- %edx 0/r32/eax + 5161 # check v-addr->name + 5162 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 5163 (check-strings-equal %eax "x" "F - test-parse-var-with-compound-type/name") + 5164 # check v-addr->register + 5165 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-compound-type/register") # Var-register + 5166 # - check v-addr->type + 5167 # var type/edx: (addr tree type-id) = var->type + 5168 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 5169 89/<- %edx 0/r32/eax + 5170 # type is a non-atom + 5171 (check-ints-equal *edx 0 "F - test-parse-var-with-compound-type/type:0") # Tree-is-atom + 5172 # type->left == atom(addr) + 5173 (lookup *(edx+4) *(edx+8)) # Tree-left Tree-left => eax + 5174 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:1") # Tree-is-atom + 5175 (check-ints-equal *(eax+4) 2 "F - test-parse-var-with-compound-type/type:2") # Tree-value + 5176 # type->right->left == atom(int) + 5177 (lookup *(edx+0xc) *(edx+0x10)) # Tree-right Tree-right => eax + 5178 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax + 5179 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:3") # Tree-is-atom + 5180 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-compound-type/type:4") # Tree-value + 5181 # type->right->right == null + 5182 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-compound-type/type:5") # Tree-right + 5183 # . epilogue + 5184 89/<- %esp 5/r32/ebp + 5185 5d/pop-to-ebp + 5186 c3/return + 5187 + 5188 # identifier starts with a letter or '$' or '_' + 5189 # no constraints at the moment on later letters + 5190 # all we really want to do so far is exclude '{', '}' and '->' + 5191 is-identifier?: # in: (addr slice) -> result/eax: boolean + 5192 # . prologue + 5193 55/push-ebp + 5194 89/<- %ebp 4/r32/esp + 5195 # if (slice-empty?(in)) return false + 5196 (slice-empty? *(ebp+8)) # => eax + 5197 3d/compare-eax-and 0/imm32/false + 5198 75/jump-if-!= $is-identifier?:false/disp8 + 5199 # var c/eax: byte = *in->start + 5200 8b/-> *(ebp+8) 0/r32/eax + 5201 8b/-> *eax 0/r32/eax + 5202 8a/copy-byte *eax 0/r32/AL + 5203 81 4/subop/and %eax 0xff/imm32 + 5204 # if (c == '$') return true + 5205 3d/compare-eax-and 0x24/imm32/$ + 5206 74/jump-if-= $is-identifier?:true/disp8 + 5207 # if (c == '_') return true + 5208 3d/compare-eax-and 0x5f/imm32/_ + 5209 74/jump-if-= $is-identifier?:true/disp8 + 5210 # drop case + 5211 25/and-eax-with 0x5f/imm32 + 5212 # if (c < 'A') return false + 5213 3d/compare-eax-and 0x41/imm32/A + 5214 7c/jump-if-< $is-identifier?:false/disp8 + 5215 # if (c > 'Z') return false + 5216 3d/compare-eax-and 0x5a/imm32/Z + 5217 7f/jump-if-> $is-identifier?:false/disp8 + 5218 # otherwise return true + 5219 $is-identifier?:true: + 5220 b8/copy-to-eax 1/imm32/true + 5221 eb/jump $is-identifier?:end/disp8 + 5222 $is-identifier?:false: + 5223 b8/copy-to-eax 0/imm32/false + 5224 $is-identifier?:end: + 5225 # . epilogue + 5226 89/<- %esp 5/r32/ebp + 5227 5d/pop-to-ebp + 5228 c3/return + 5229 + 5230 test-is-identifier-dollar: + 5231 # . prologue + 5232 55/push-ebp + 5233 89/<- %ebp 4/r32/esp + 5234 # (eax..ecx) = "$a" + 5235 b8/copy-to-eax "$a"/imm32 + 5236 8b/-> *eax 1/r32/ecx + 5237 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5238 05/add-to-eax 4/imm32 + 5239 # var slice/ecx: slice = {eax, ecx} + 5240 51/push-ecx + 5241 50/push-eax + 5242 89/<- %ecx 4/r32/esp + 5243 # + 5244 (is-identifier? %ecx) + 5245 (check-ints-equal %eax 1 "F - test-is-identifier-dollar") + 5246 # . epilogue + 5247 89/<- %esp 5/r32/ebp + 5248 5d/pop-to-ebp + 5249 c3/return + 5250 + 5251 test-is-identifier-underscore: + 5252 # . prologue + 5253 55/push-ebp + 5254 89/<- %ebp 4/r32/esp + 5255 # (eax..ecx) = "_a" + 5256 b8/copy-to-eax "_a"/imm32 + 5257 8b/-> *eax 1/r32/ecx + 5258 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5259 05/add-to-eax 4/imm32 + 5260 # var slice/ecx: slice = {eax, ecx} + 5261 51/push-ecx + 5262 50/push-eax + 5263 89/<- %ecx 4/r32/esp + 5264 # + 5265 (is-identifier? %ecx) + 5266 (check-ints-equal %eax 1 "F - test-is-identifier-underscore") + 5267 # . epilogue + 5268 89/<- %esp 5/r32/ebp + 5269 5d/pop-to-ebp + 5270 c3/return + 5271 + 5272 test-is-identifier-a: + 5273 # . prologue + 5274 55/push-ebp + 5275 89/<- %ebp 4/r32/esp + 5276 # (eax..ecx) = "a$" + 5277 b8/copy-to-eax "a$"/imm32 + 5278 8b/-> *eax 1/r32/ecx + 5279 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5280 05/add-to-eax 4/imm32 + 5281 # var slice/ecx: slice = {eax, ecx} + 5282 51/push-ecx + 5283 50/push-eax + 5284 89/<- %ecx 4/r32/esp + 5285 # + 5286 (is-identifier? %ecx) + 5287 (check-ints-equal %eax 1 "F - test-is-identifier-a") + 5288 # . epilogue + 5289 89/<- %esp 5/r32/ebp + 5290 5d/pop-to-ebp + 5291 c3/return + 5292 + 5293 test-is-identifier-z: + 5294 # . prologue + 5295 55/push-ebp + 5296 89/<- %ebp 4/r32/esp + 5297 # (eax..ecx) = "z$" + 5298 b8/copy-to-eax "z$"/imm32 + 5299 8b/-> *eax 1/r32/ecx + 5300 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5301 05/add-to-eax 4/imm32 + 5302 # var slice/ecx: slice = {eax, ecx} + 5303 51/push-ecx + 5304 50/push-eax + 5305 89/<- %ecx 4/r32/esp + 5306 # + 5307 (is-identifier? %ecx) + 5308 (check-ints-equal %eax 1 "F - test-is-identifier-z") + 5309 # . epilogue + 5310 89/<- %esp 5/r32/ebp + 5311 5d/pop-to-ebp + 5312 c3/return + 5313 + 5314 test-is-identifier-A: + 5315 # . prologue + 5316 55/push-ebp + 5317 89/<- %ebp 4/r32/esp + 5318 # (eax..ecx) = "A$" + 5319 b8/copy-to-eax "A$"/imm32 + 5320 8b/-> *eax 1/r32/ecx + 5321 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5322 05/add-to-eax 4/imm32 + 5323 # var slice/ecx: slice = {eax, ecx} + 5324 51/push-ecx + 5325 50/push-eax + 5326 89/<- %ecx 4/r32/esp + 5327 # + 5328 (is-identifier? %ecx) + 5329 (check-ints-equal %eax 1 "F - test-is-identifier-A") + 5330 # . epilogue + 5331 89/<- %esp 5/r32/ebp + 5332 5d/pop-to-ebp + 5333 c3/return + 5334 + 5335 test-is-identifier-Z: + 5336 # . prologue + 5337 55/push-ebp + 5338 89/<- %ebp 4/r32/esp + 5339 # (eax..ecx) = "Z$" + 5340 b8/copy-to-eax "Z$"/imm32 + 5341 8b/-> *eax 1/r32/ecx + 5342 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5343 05/add-to-eax 4/imm32 + 5344 # var slice/ecx: slice = {eax, ecx} + 5345 51/push-ecx + 5346 50/push-eax + 5347 89/<- %ecx 4/r32/esp + 5348 # + 5349 (is-identifier? %ecx) + 5350 (check-ints-equal %eax 1 "F - test-is-identifier-Z") + 5351 # . epilogue + 5352 89/<- %esp 5/r32/ebp + 5353 5d/pop-to-ebp + 5354 c3/return + 5355 + 5356 test-is-identifier-at: + 5357 # character before 'A' is invalid + 5358 # . prologue + 5359 55/push-ebp + 5360 89/<- %ebp 4/r32/esp + 5361 # (eax..ecx) = "@a" + 5362 b8/copy-to-eax "@a"/imm32 + 5363 8b/-> *eax 1/r32/ecx + 5364 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5365 05/add-to-eax 4/imm32 + 5366 # var slice/ecx: slice = {eax, ecx} + 5367 51/push-ecx + 5368 50/push-eax + 5369 89/<- %ecx 4/r32/esp + 5370 # + 5371 (is-identifier? %ecx) + 5372 (check-ints-equal %eax 0 "F - test-is-identifier-@") + 5373 # . epilogue + 5374 89/<- %esp 5/r32/ebp + 5375 5d/pop-to-ebp + 5376 c3/return + 5377 + 5378 test-is-identifier-square-bracket: + 5379 # character after 'Z' is invalid + 5380 # . prologue + 5381 55/push-ebp + 5382 89/<- %ebp 4/r32/esp + 5383 # (eax..ecx) = "[a" + 5384 b8/copy-to-eax "[a"/imm32 + 5385 8b/-> *eax 1/r32/ecx + 5386 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5387 05/add-to-eax 4/imm32 + 5388 # var slice/ecx: slice = {eax, ecx} + 5389 51/push-ecx + 5390 50/push-eax + 5391 89/<- %ecx 4/r32/esp + 5392 # + 5393 (is-identifier? %ecx) + 5394 (check-ints-equal %eax 0 "F - test-is-identifier-@") + 5395 # . epilogue + 5396 89/<- %esp 5/r32/ebp + 5397 5d/pop-to-ebp + 5398 c3/return + 5399 + 5400 test-is-identifier-backtick: + 5401 # character before 'a' is invalid + 5402 # . prologue + 5403 55/push-ebp + 5404 89/<- %ebp 4/r32/esp + 5405 # (eax..ecx) = "`a" + 5406 b8/copy-to-eax "`a"/imm32 + 5407 8b/-> *eax 1/r32/ecx + 5408 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5409 05/add-to-eax 4/imm32 + 5410 # var slice/ecx: slice = {eax, ecx} + 5411 51/push-ecx + 5412 50/push-eax + 5413 89/<- %ecx 4/r32/esp + 5414 # + 5415 (is-identifier? %ecx) + 5416 (check-ints-equal %eax 0 "F - test-is-identifier-backtick") + 5417 # . epilogue + 5418 89/<- %esp 5/r32/ebp + 5419 5d/pop-to-ebp + 5420 c3/return + 5421 + 5422 test-is-identifier-curly-brace-open: + 5423 # character after 'z' is invalid; also used for blocks + 5424 # . prologue + 5425 55/push-ebp + 5426 89/<- %ebp 4/r32/esp + 5427 # (eax..ecx) = "{a" + 5428 b8/copy-to-eax "{a"/imm32 + 5429 8b/-> *eax 1/r32/ecx + 5430 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5431 05/add-to-eax 4/imm32 + 5432 # var slice/ecx: slice = {eax, ecx} + 5433 51/push-ecx + 5434 50/push-eax + 5435 89/<- %ecx 4/r32/esp + 5436 # + 5437 (is-identifier? %ecx) + 5438 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open") + 5439 # . epilogue + 5440 89/<- %esp 5/r32/ebp + 5441 5d/pop-to-ebp + 5442 c3/return + 5443 + 5444 test-is-identifier-curly-brace-close: + 5445 # . prologue + 5446 55/push-ebp + 5447 89/<- %ebp 4/r32/esp + 5448 # (eax..ecx) = "}a" + 5449 b8/copy-to-eax "}a"/imm32 + 5450 8b/-> *eax 1/r32/ecx + 5451 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5452 05/add-to-eax 4/imm32 + 5453 # var slice/ecx: slice = {eax, ecx} + 5454 51/push-ecx + 5455 50/push-eax + 5456 89/<- %ecx 4/r32/esp + 5457 # + 5458 (is-identifier? %ecx) + 5459 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close") + 5460 # . epilogue + 5461 89/<- %esp 5/r32/ebp + 5462 5d/pop-to-ebp + 5463 c3/return + 5464 + 5465 test-is-identifier-hyphen: + 5466 # disallow leading '-' since '->' has special meaning + 5467 # . prologue + 5468 55/push-ebp + 5469 89/<- %ebp 4/r32/esp + 5470 # (eax..ecx) = "-a" + 5471 b8/copy-to-eax "-a"/imm32 + 5472 8b/-> *eax 1/r32/ecx + 5473 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5474 05/add-to-eax 4/imm32 + 5475 # var slice/ecx: slice = {eax, ecx} + 5476 51/push-ecx + 5477 50/push-eax + 5478 89/<- %ecx 4/r32/esp + 5479 # + 5480 (is-identifier? %ecx) + 5481 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen") + 5482 # . epilogue + 5483 89/<- %esp 5/r32/ebp + 5484 5d/pop-to-ebp + 5485 c3/return + 5486 + 5487 populate-mu-function-body: # in: (addr buffered-file), out: (addr function), vars: (addr stack live-var), err: (addr buffered-file), ed: (addr exit-descriptor) + 5488 # . prologue + 5489 55/push-ebp + 5490 89/<- %ebp 4/r32/esp + 5491 # . save registers + 5492 50/push-eax + 5493 56/push-esi + 5494 57/push-edi + 5495 # esi = in + 5496 8b/-> *(ebp+8) 6/r32/esi + 5497 # edi = out + 5498 8b/-> *(ebp+0xc) 7/r32/edi + 5499 # parse-mu-block(in, vars, out, out->body) + 5500 8d/copy-address *(edi+0x18) 0/r32/eax # Function-body + 5501 (parse-mu-block %esi *(ebp+0x10) %edi %eax *(ebp+0x14) *(ebp+0x18)) + 5502 $populate-mu-function-body:end: + 5503 # . restore registers + 5504 5f/pop-to-edi + 5505 5e/pop-to-esi + 5506 58/pop-to-eax + 5507 # . epilogue + 5508 89/<- %esp 5/r32/ebp + 5509 5d/pop-to-ebp + 5510 c3/return + 5511 + 5512 # parses a block, assuming that the leading '{' has already been read by the caller + 5513 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) + 5514 # pseudocode: + 5515 # var line: (stream byte 512) + 5516 # var word-slice: slice + 5517 # allocate(Heap, Stmt-size, out) + 5518 # var out-addr: (addr block) = lookup(*out) + 5519 # out-addr->tag = 0/block + 5520 # out-addr->var = some unique name + 5521 # push(vars, {out-addr->var, false}) + 5522 # while true # line loop + 5523 # clear-stream(line) + 5524 # read-line-buffered(in, line) + 5525 # if (line->write == 0) break # end of file + 5526 # word-slice = next-mu-token(line) + 5527 # if slice-empty?(word-slice) # end of line + 5528 # continue + 5529 # else if slice-starts-with?(word-slice, "#") + 5530 # continue + 5531 # else if slice-equal?(word-slice, "{") + 5532 # assert(no-tokens-in(line)) + 5533 # block = parse-mu-block(in, vars, fn) + 5534 # append-to-block(out-addr, block) + 5535 # else if slice-equal?(word-slice, "}") + 5536 # break + 5537 # else if slice-ends-with?(word-slice, ":") + 5538 # # TODO: error-check the rest of 'line' + 5539 # --word-slice->end to skip ':' + 5540 # named-block = parse-mu-named-block(word-slice, in, vars, fn) + 5541 # append-to-block(out-addr, named-block) + 5542 # else if slice-equal?(word-slice, "var") + 5543 # var-def = parse-mu-var-def(line, vars, fn) + 5544 # append-to-block(out-addr, var-def) + 5545 # else + 5546 # stmt = parse-mu-stmt(line, vars, fn) + 5547 # append-to-block(out-addr, stmt) + 5548 # pop(vars) + 5549 # + 5550 # . prologue + 5551 55/push-ebp + 5552 89/<- %ebp 4/r32/esp + 5553 # . save registers + 5554 50/push-eax + 5555 51/push-ecx + 5556 52/push-edx + 5557 53/push-ebx + 5558 57/push-edi + 5559 # var line/ecx: (stream byte 512) + 5560 81 5/subop/subtract %esp 0x200/imm32 + 5561 68/push 0x200/imm32/size + 5562 68/push 0/imm32/read + 5563 68/push 0/imm32/write + 5564 89/<- %ecx 4/r32/esp + 5565 # var word-slice/edx: slice + 5566 68/push 0/imm32/end + 5567 68/push 0/imm32/start + 5568 89/<- %edx 4/r32/esp + 5569 # allocate into out + 5570 (allocate Heap *Stmt-size *(ebp+0x14)) + 5571 # var out-addr/edi: (addr block) = lookup(*out) + 5572 8b/-> *(ebp+0x14) 7/r32/edi + 5573 (lookup *edi *(edi+4)) # => eax + 5574 89/<- %edi 0/r32/eax + 5575 # out-addr->tag is 0 (block) by default + 5576 # set out-addr->var + 5577 8d/copy-address *(edi+0xc) 0/r32/eax # Block-var + 5578 (new-block-name *(ebp+0x10) %eax) + 5579 # push(vars, out-addr->var) + 5580 (push *(ebp+0xc) *(edi+0xc)) # Block-var + 5581 (push *(ebp+0xc) *(edi+0x10)) # Block-var + 5582 (push *(ebp+0xc) 0) # false + 5583 { + 5584 $parse-mu-block:line-loop: + 5585 # line = read-line-buffered(in) + 5586 (clear-stream %ecx) + 5587 (read-line-buffered *(ebp+8) %ecx) + 5588 #? (write-buffered Stderr "line: ") + 5589 #? (write-stream-data Stderr %ecx) + 5590 #? (write-buffered Stderr Newline) + 5591 #? (flush Stderr) + 5592 # if (line->write == 0) break + 5593 81 7/subop/compare *ecx 0/imm32 + 5594 0f 84/jump-if-= break/disp32 + 5595 # word-slice = next-mu-token(line) + 5596 (next-mu-token %ecx %edx) + 5597 #? (write-buffered Stderr "word: ") + 5598 #? (write-slice-buffered Stderr %edx) + 5599 #? (write-buffered Stderr Newline) + 5600 #? (flush Stderr) + 5601 # if slice-empty?(word-slice) continue + 5602 (slice-empty? %edx) + 5603 3d/compare-eax-and 0/imm32/false + 5604 0f 85/jump-if-!= loop/disp32 + 5605 # if (slice-starts-with?(word-slice, '#') continue + 5606 # . eax = *word-slice->start + 5607 8b/-> *edx 0/r32/eax + 5608 8a/copy-byte *eax 0/r32/AL + 5609 81 4/subop/and %eax 0xff/imm32 + 5610 # . if (eax == '#') continue + 5611 3d/compare-eax-and 0x23/imm32/hash + 5612 0f 84/jump-if-= loop/disp32 + 5613 # if slice-equal?(word-slice, "{") + 5614 { + 5615 $parse-mu-block:check-for-block: + 5616 (slice-equal? %edx "{") + 5617 3d/compare-eax-and 0/imm32/false + 5618 74/jump-if-= break/disp8 + 5619 (check-no-tokens-left %ecx) + 5620 # parse new block and append + 5621 # . var tmp/eax: (handle block) + 5622 68/push 0/imm32 + 5623 68/push 0/imm32 + 5624 89/<- %eax 4/r32/esp + 5625 # . + 5626 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) + 5627 (append-to-block Heap %edi *eax *(eax+4)) + 5628 # . reclaim tmp + 5629 81 0/subop/add %esp 8/imm32 + 5630 # . + 5631 e9/jump $parse-mu-block:line-loop/disp32 + 5632 } + 5633 # if slice-equal?(word-slice, "}") break + 5634 $parse-mu-block:check-for-end: + 5635 (slice-equal? %edx "}") + 5636 3d/compare-eax-and 0/imm32/false + 5637 0f 85/jump-if-!= break/disp32 + 5638 # if slice-ends-with?(word-slice, ":") parse named block and append + 5639 { + 5640 $parse-mu-block:check-for-named-block: + 5641 # . eax = *(word-slice->end-1) + 5642 8b/-> *(edx+4) 0/r32/eax + 5643 48/decrement-eax + 5644 8a/copy-byte *eax 0/r32/AL + 5645 81 4/subop/and %eax 0xff/imm32 + 5646 # . if (eax != ':') break + 5647 3d/compare-eax-and 0x3a/imm32/colon + 5648 0f 85/jump-if-!= break/disp32 + 5649 # TODO: error-check the rest of 'line' + 5650 # + 5651 # skip ':' + 5652 ff 1/subop/decrement *(edx+4) # Slice-end + 5653 # var tmp/eax: (handle block) + 5654 68/push 0/imm32 + 5655 68/push 0/imm32 + 5656 89/<- %eax 4/r32/esp + 5657 # + 5658 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax) + 5659 (append-to-block Heap %edi *eax *(eax+4)) + 5660 # reclaim tmp + 5661 81 0/subop/add %esp 8/imm32 + 5662 # + 5663 e9/jump $parse-mu-block:line-loop/disp32 + 5664 } + 5665 # if slice-equal?(word-slice, "var") + 5666 { + 5667 $parse-mu-block:check-for-var: + 5668 (slice-equal? %edx "var") + 5669 3d/compare-eax-and 0/imm32/false + 5670 74/jump-if-= break/disp8 + 5671 # var tmp/eax: (handle block) + 5672 68/push 0/imm32 + 5673 68/push 0/imm32 + 5674 89/<- %eax 4/r32/esp + 5675 # + 5676 (parse-mu-var-def %ecx *(ebp+0xc) %eax *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) + 5677 (append-to-block Heap %edi *eax *(eax+4)) + 5678 # reclaim tmp + 5679 81 0/subop/add %esp 8/imm32 + 5680 # + 5681 e9/jump $parse-mu-block:line-loop/disp32 + 5682 } + 5683 $parse-mu-block:regular-stmt: + 5684 # otherwise + 5685 # var tmp/eax: (handle block) + 5686 68/push 0/imm32 + 5687 68/push 0/imm32 + 5688 89/<- %eax 4/r32/esp + 5689 # + 5690 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) + 5691 (append-to-block Heap %edi *eax *(eax+4)) + 5692 # reclaim tmp + 5693 81 0/subop/add %esp 8/imm32 + 5694 # + 5695 e9/jump loop/disp32 + 5696 } # end line loop + 5697 # pop(vars) + 5698 (pop *(ebp+0xc)) # => eax + 5699 (pop *(ebp+0xc)) # => eax + 5700 (pop *(ebp+0xc)) # => eax + 5701 $parse-mu-block:end: + 5702 # . reclaim locals + 5703 81 0/subop/add %esp 0x214/imm32 + 5704 # . restore registers + 5705 5f/pop-to-edi + 5706 5b/pop-to-ebx + 5707 5a/pop-to-edx + 5708 59/pop-to-ecx + 5709 58/pop-to-eax + 5710 # . epilogue + 5711 89/<- %esp 5/r32/ebp + 5712 5d/pop-to-ebp + 5713 c3/return + 5714 + 5715 $parse-mu-block:abort: + 5716 # error("'{' or '}' should be on its own line, but got '") + 5717 (write-buffered *(ebp+0x18) "'{' or '}' should be on its own line, but got '") + 5718 (rewind-stream %ecx) + 5719 (write-stream 2 %ecx) + 5720 (write-buffered *(ebp+0x18) "'\n") + 5721 (flush *(ebp+0x18)) + 5722 (stop *(ebp+0x1c) 1) + 5723 # never gets here + 5724 + 5725 new-block-name: # fn: (addr function), out: (addr handle var) + 5726 # . prologue + 5727 55/push-ebp + 5728 89/<- %ebp 4/r32/esp + 5729 # . save registers + 5730 50/push-eax + 5731 51/push-ecx + 5732 52/push-edx + 5733 # var n/ecx: int = len(fn->name) + 10 for an int + 2 for '$:' + 5734 8b/-> *(ebp+8) 0/r32/eax + 5735 (lookup *eax *(eax+4)) # Function-name Function-name => eax + 5736 8b/-> *eax 0/r32/eax # String-size + 5737 05/add-to-eax 0xd/imm32 # 10 + 2 for '$:' + 5738 89/<- %ecx 0/r32/eax + 5739 # var name/edx: (stream byte n) + 5740 29/subtract-from %esp 1/r32/ecx + 5741 ff 6/subop/push %ecx + 5742 68/push 0/imm32/read + 5743 68/push 0/imm32/write + 5744 89/<- %edx 4/r32/esp + 5745 (clear-stream %edx) + 5746 # eax = fn->name + 5747 8b/-> *(ebp+8) 0/r32/eax + 5748 (lookup *eax *(eax+4)) # Function-name Function-name => eax + 5749 # construct result using Next-block-index (and increment it) + 5750 (write %edx "$") + 5751 (write %edx %eax) + 5752 (write %edx ":") + 5753 (print-int32 %edx *Next-block-index) + 5754 ff 0/subop/increment *Next-block-index + 5755 # var s/eax: slice = {name->data, name->data + name->write} (clobbering edx) + 5756 # . eax = name->write + 5757 8b/-> *edx 0/r32/eax + 5758 # . edx = name->data + 5759 8d/copy-address *(edx+0xc) 2/r32/edx + 5760 # . eax = name->write + name->data + 5761 01/add-to %eax 2/r32/edx + 5762 # . push {edx, eax} + 5763 ff 6/subop/push %eax + 5764 ff 6/subop/push %edx + 5765 89/<- %eax 4/r32/esp + 5766 # out = new literal(s) + 5767 (new-literal Heap %eax *(ebp+0xc)) + 5768 #? 8b/-> *(ebp+0xc) 0/r32/eax + 5769 #? (write-buffered Stderr "type allocid in caller after new-literal: ") + 5770 #? (print-int32-buffered Stderr *(eax+8)) + 5771 #? (write-buffered Stderr " for var ") + 5772 #? (print-int32-buffered Stderr %eax) + 5773 #? (write-buffered Stderr Newline) + 5774 #? (flush Stderr) + 5775 $new-block-name:end: + 5776 # . reclaim locals + 5777 81 0/subop/add %ecx 0xc/imm32 # name.{read/write/len} + 5778 81 0/subop/add %ecx 8/imm32 # slice + 5779 01/add-to %esp 1/r32/ecx + 5780 # . restore registers + 5781 5a/pop-to-edx + 5782 59/pop-to-ecx + 5783 58/pop-to-eax + 5784 # . epilogue + 5785 89/<- %esp 5/r32/ebp + 5786 5d/pop-to-ebp + 5787 c3/return + 5788 + 5789 == data + 5790 + 5791 # Global state added to each var record when parsing a function + 5792 Next-block-index: # (addr int) + 5793 1/imm32 + 5794 + 5795 == code + 5796 + 5797 check-no-tokens-left: # line: (addr stream byte) + 5798 # . prologue + 5799 55/push-ebp + 5800 89/<- %ebp 4/r32/esp + 5801 # . save registers + 5802 50/push-eax + 5803 51/push-ecx + 5804 # var s/ecx: slice + 5805 68/push 0/imm32/end + 5806 68/push 0/imm32/start + 5807 89/<- %ecx 4/r32/esp + 5808 # + 5809 (next-mu-token *(ebp+8) %ecx) + 5810 # if slice-empty?(s) return + 5811 (slice-empty? %ecx) + 5812 3d/compare-eax-and 0/imm32/false + 5813 75/jump-if-!= $check-no-tokens-left:end/disp8 + 5814 # if (slice-starts-with?(s, '#') return + 5815 # . eax = *s->start + 5816 8b/-> *edx 0/r32/eax + 5817 8a/copy-byte *eax 0/r32/AL + 5818 81 4/subop/and %eax 0xff/imm32 + 5819 # . if (eax == '#') continue + 5820 3d/compare-eax-and 0x23/imm32/hash + 5821 74/jump-if-= $check-no-tokens-left:end/disp8 + 5822 # abort + 5823 (write-buffered Stderr "'{' or '}' should be on its own line, but got '") + 5824 (rewind-stream %ecx) + 5825 (write-stream 2 %ecx) + 5826 (write-buffered Stderr "'\n") + 5827 (flush Stderr) + 5828 # . syscall(exit, 1) + 5829 bb/copy-to-ebx 1/imm32 + 5830 e8/call syscall_exit/disp32 + 5831 # never gets here + 5832 $check-no-tokens-left:end: + 5833 # . reclaim locals + 5834 81 0/subop/add %esp 8/imm32 + 5835 # . restore registers + 5836 59/pop-to-ecx + 5837 58/pop-to-eax + 5838 # . epilogue + 5839 89/<- %esp 5/r32/ebp + 5840 5d/pop-to-ebp + 5841 c3/return + 5842 + 5843 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) + 5844 # pseudocode: + 5845 # var v: (handle var) + 5846 # new-literal(name, v) + 5847 # push(vars, {v, false}) + 5848 # parse-mu-block(in, vars, fn, out) + 5849 # pop(vars) + 5850 # out->tag = block + 5851 # out->var = v + 5852 # + 5853 # . prologue + 5854 55/push-ebp + 5855 89/<- %ebp 4/r32/esp + 5856 # . save registers + 5857 50/push-eax + 5858 51/push-ecx + 5859 57/push-edi + 5860 # var v/ecx: (handle var) + 5861 68/push 0/imm32 + 5862 68/push 0/imm32 + 5863 89/<- %ecx 4/r32/esp + 5864 # + 5865 (new-literal Heap *(ebp+8) %ecx) + 5866 # push(vars, v) + 5867 (push *(ebp+0x10) *ecx) + 5868 (push *(ebp+0x10) *(ecx+4)) + 5869 (push *(ebp+0x10) 0) # false + 5870 # + 5871 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20)) + 5872 # pop v off vars + 5873 (pop *(ebp+0x10)) # => eax + 5874 (pop *(ebp+0x10)) # => eax + 5875 (pop *(ebp+0x10)) # => eax + 5876 # var out-addr/edi: (addr stmt) = lookup(*out) + 5877 8b/-> *(ebp+0x18) 7/r32/edi + 5878 (lookup *edi *(edi+4)) # => eax + 5879 89/<- %edi 0/r32/eax + 5880 # out-addr->tag = named-block + 5881 c7 0/subop/copy *edi 0/imm32/block # Stmt-tag + 5882 # out-addr->var = v + 5883 8b/-> *ecx 0/r32/eax + 5884 89/<- *(edi+0xc) 0/r32/eax # Block-var + 5885 8b/-> *(ecx+4) 0/r32/eax + 5886 89/<- *(edi+0x10) 0/r32/eax # Block-var + 5887 $parse-mu-named-block:end: + 5888 # . reclaim locals + 5889 81 0/subop/add %esp 8/imm32 + 5890 # . restore registers + 5891 5f/pop-to-edi + 5892 59/pop-to-ecx + 5893 58/pop-to-eax + 5894 # . epilogue + 5895 89/<- %esp 5/r32/ebp + 5896 5d/pop-to-ebp + 5897 c3/return + 5898 + 5899 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) + 5900 # . prologue + 5901 55/push-ebp + 5902 89/<- %ebp 4/r32/esp + 5903 # . save registers + 5904 50/push-eax + 5905 51/push-ecx + 5906 52/push-edx + 5907 57/push-edi + 5908 # edi = out + 5909 8b/-> *(ebp+0x10) 7/r32/edi + 5910 # var word-slice/ecx: slice + 5911 68/push 0/imm32/end + 5912 68/push 0/imm32/start + 5913 89/<- %ecx 4/r32/esp + 5914 # var v/edx: (handle var) + 5915 68/push 0/imm32 + 5916 68/push 0/imm32 + 5917 89/<- %edx 4/r32/esp + 5918 # v = parse-var-with-type(next-mu-token(line)) + 5919 (next-mu-token *(ebp+8) %ecx) + 5920 (parse-var-with-type %ecx *(ebp+8) %edx *(ebp+0x18) *(ebp+0x1c)) + 5921 # + 5922 (push *(ebp+0xc) *edx) + 5923 (push *(ebp+0xc) *(edx+4)) + 5924 (push *(ebp+0xc) 0) # Live-var-register-spilled is unused during parsing + 5925 # either v has no register and there's no more to this line + 5926 (lookup *edx *(edx+4)) # => eax + 5927 8b/-> *(eax+0x18) 0/r32/eax # Var-register + 5928 3d/compare-eax-and 0/imm32 + 5929 { + 5930 75/jump-if-!= break/disp8 + 5931 # ensure that there's nothing else on this line + 5932 (next-mu-token *(ebp+8) %ecx) + 5933 (slice-empty? %ecx) # => eax + 5934 3d/compare-eax-and 0/imm32/false + 5935 0f 84/jump-if-= $parse-mu-var-def:error2/disp32 + 5936 # + 5937 (new-var-def Heap *edx *(edx+4) %edi) + 5938 eb/jump $parse-mu-var-def:end/disp8 + 5939 } + 5940 # or v has a register and there's more to this line + 5941 { + 5942 74/jump-if-= break/disp8 + 5943 # ensure that the next word is '<-' + 5944 (next-mu-token *(ebp+8) %ecx) + 5945 (slice-equal? %ecx "<-") # => eax + 5946 3d/compare-eax-and 0/imm32/false + 5947 74/jump-if-= $parse-mu-var-def:error1/disp8 + 5948 # + 5949 (new-reg-var-def Heap *edx *(edx+4) %edi) + 5950 (lookup *edi *(edi+4)) # => eax + 5951 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc)) + 5952 } + 5953 $parse-mu-var-def:end: + 5954 # . reclaim locals + 5955 81 0/subop/add %esp 0x10/imm32 + 5956 # . restore registers + 5957 5f/pop-to-edi + 5958 5a/pop-to-edx + 5959 59/pop-to-ecx + 5960 58/pop-to-eax + 5961 # . epilogue + 5962 89/<- %esp 5/r32/ebp + 5963 5d/pop-to-ebp + 5964 c3/return + 5965 + 5966 $parse-mu-var-def:error1: + 5967 (rewind-stream *(ebp+8)) + 5968 # error("register variable requires a valid instruction to initialize but got '" line "'\n") + 5969 (write-buffered *(ebp+0x18) "register variable requires a valid instruction to initialize but got '") + 5970 (flush *(ebp+0x18)) + 5971 (write-stream 2 *(ebp+8)) + 5972 (write-buffered *(ebp+0x18) "'\n") + 5973 (flush *(ebp+0x18)) + 5974 (stop *(ebp+0x1c) 1) + 5975 # never gets here + 5976 + 5977 $parse-mu-var-def:error2: + 5978 (rewind-stream *(ebp+8)) + 5979 # error("fn " fn ": var " var ": variables on the stack can't take an initializer\n") + 5980 (write-buffered *(ebp+0x18) "fn ") + 5981 8b/-> *(ebp+0x14) 0/r32/eax + 5982 (lookup *eax *(eax+4)) # Function-name Function-name => eax + 5983 (write-buffered *(ebp+0x18) %eax) + 5984 (write-buffered *(ebp+0x18) ": var ") + 5985 # var v-addr/eax: (addr var) = lookup(v) + 5986 (lookup *edx *(edx+4)) # => eax + 5987 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 5988 (write-buffered *(ebp+0x18) %eax) # HERE: stream overflow + 5989 (write-buffered *(ebp+0x18) ": variables on the stack can't take an initializer\n") + 5990 (flush *(ebp+0x18)) + 5991 (stop *(ebp+0x1c) 1) + 5992 # never gets here + 5993 + 5994 test-parse-mu-var-def: + 5995 # 'var n: int' + 5996 # . prologue + 5997 55/push-ebp + 5998 89/<- %ebp 4/r32/esp + 5999 # setup + 6000 (clear-stream _test-input-stream) + 6001 (write _test-input-stream "n: int\n") # caller has consumed the 'var' + 6002 # var out/esi: (handle stmt) + 6003 68/push 0/imm32 + 6004 68/push 0/imm32 + 6005 89/<- %esi 4/r32/esp + 6006 # var vars/ecx: (stack (addr var) 16) + 6007 81 5/subop/subtract %esp 0xc0/imm32 + 6008 68/push 0xc0/imm32/size + 6009 68/push 0/imm32/top + 6010 89/<- %ecx 4/r32/esp + 6011 (clear-stack %ecx) + 6012 # convert + 6013 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) + 6014 # var out-addr/esi: (addr stmt) + 6015 (lookup *esi *(esi+4)) # => eax + 6016 89/<- %esi 0/r32/eax + 6017 # + 6018 (check-ints-equal *esi 2 "F - test-parse-mu-var-def/tag") # Stmt-tag is var-def + 6019 # var v/ecx: (addr var) = lookup(out->var) + 6020 (lookup *(esi+4) *(esi+8)) # Vardef-var Vardef-var => eax + 6021 89/<- %ecx 0/r32/eax + 6022 # v->name + 6023 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax + 6024 (check-strings-equal %eax "n" "F - test-parse-mu-var-def/var-name") + 6025 # v->register + 6026 (check-ints-equal *(ecx+0x18) 0 "F - test-parse-mu-var-def/var-register") # Var-register + 6027 # v->type == int + 6028 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 6029 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0") # Tree-is-atom + 6030 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-var-def/var-type:1") # Tree-value + 6031 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-var-def/var-type:2") # Tree-right + 6032 # . epilogue + 6033 89/<- %esp 5/r32/ebp + 6034 5d/pop-to-ebp + 6035 c3/return + 6036 + 6037 test-parse-mu-reg-var-def: + 6038 # 'var n/eax: int <- copy 0' + 6039 # . prologue + 6040 55/push-ebp + 6041 89/<- %ebp 4/r32/esp + 6042 # setup + 6043 (clear-stream _test-input-stream) + 6044 (write _test-input-stream "n/eax: int <- copy 0\n") # caller has consumed the 'var' + 6045 # var out/esi: (handle stmt) + 6046 68/push 0/imm32 + 6047 68/push 0/imm32 + 6048 89/<- %esi 4/r32/esp + 6049 # var vars/ecx: (stack (addr var) 16) + 6050 81 5/subop/subtract %esp 0xc0/imm32 + 6051 68/push 0xc0/imm32/size + 6052 68/push 0/imm32/top + 6053 89/<- %ecx 4/r32/esp + 6054 (clear-stack %ecx) + 6055 # convert + 6056 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) + 6057 # var out-addr/esi: (addr stmt) + 6058 (lookup *esi *(esi+4)) # => eax + 6059 89/<- %esi 0/r32/eax + 6060 # + 6061 (check-ints-equal *esi 3 "F - test-parse-mu-reg-var-def/tag") # Stmt-tag is reg-var-def + 6062 # var v/ecx: (addr var) = lookup(out->outputs->value) + 6063 # . eax: (addr stmt-var) = lookup(out->outputs) + 6064 (lookup *(esi+0x14) *(esi+0x18)) # Regvardef-outputs Regvardef-outputs => eax + 6065 # . + 6066 (check-ints-equal *(eax+8) 0 "F - test-parse-mu-reg-var-def/single-output") # Stmt-var-next + 6067 # . eax: (addr var) = lookup(eax->value) + 6068 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 6069 # . ecx = eax + 6070 89/<- %ecx 0/r32/eax + 6071 # v->name + 6072 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax + 6073 (check-strings-equal %eax "n" "F - test-parse-mu-reg-var-def/output-name") # Var-name + 6074 # v->register + 6075 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax + 6076 (check-strings-equal %eax "eax" "F - test-parse-mu-reg-var-def/output-register") + 6077 # v->type == int + 6078 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 6079 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0") # Tree-is-atom + 6080 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-reg-var-def/output-type:1") # Tree-value + 6081 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-reg-var-def/output-type:2") # Tree-right + 6082 # . epilogue + 6083 89/<- %esp 5/r32/ebp + 6084 5d/pop-to-ebp + 6085 c3/return + 6086 + 6087 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) + 6088 # pseudocode: + 6089 # var name: slice + 6090 # allocate(Heap, Stmt-size, out) + 6091 # var out-addr: (addr stmt) = lookup(*out) + 6092 # out-addr->tag = stmt + 6093 # if stmt-has-outputs?(line) + 6094 # while true + 6095 # name = next-mu-token(line) + 6096 # if (name == '<-') break + 6097 # assert(is-identifier?(name)) + 6098 # var v: (handle var) = lookup-or-define-var(name, vars, fn) # regular stmts may define vars in fn outputs + 6099 # out-addr->outputs = append(v, out-addr->outputs) + 6100 # add-operation-and-inputs-to-stmt(out-addr, line, vars) + 6101 # + 6102 # . prologue + 6103 55/push-ebp + 6104 89/<- %ebp 4/r32/esp + 6105 # . save registers + 6106 50/push-eax + 6107 51/push-ecx + 6108 52/push-edx + 6109 53/push-ebx + 6110 57/push-edi + 6111 # var name/ecx: slice + 6112 68/push 0/imm32/end + 6113 68/push 0/imm32/start + 6114 89/<- %ecx 4/r32/esp + 6115 # var is-deref?/edx: boolean = false + 6116 ba/copy-to-edx 0/imm32/false + 6117 # var v: (handle var) + 6118 68/push 0/imm32 + 6119 68/push 0/imm32 + 6120 89/<- %ebx 4/r32/esp + 6121 # + 6122 (allocate Heap *Stmt-size *(ebp+0x14)) + 6123 # var out-addr/edi: (addr stmt) = lookup(*out) + 6124 8b/-> *(ebp+0x14) 7/r32/edi + 6125 (lookup *edi *(edi+4)) # => eax + 6126 89/<- %edi 0/r32/eax + 6127 # out-addr->tag = 1/stmt + 6128 c7 0/subop/copy *edi 1/imm32/stmt1 # Stmt-tag + 6129 { + 6130 (stmt-has-outputs? *(ebp+8)) + 6131 3d/compare-eax-and 0/imm32/false + 6132 0f 84/jump-if-= break/disp32 + 6133 { + 6134 $parse-mu-stmt:read-outputs: + 6135 # name = next-mu-token(line) + 6136 (next-mu-token *(ebp+8) %ecx) + 6137 # if slice-empty?(word-slice) break + 6138 (slice-empty? %ecx) # => eax + 6139 3d/compare-eax-and 0/imm32/false + 6140 0f 85/jump-if-!= break/disp32 + 6141 # if (name == "<-") break + 6142 (slice-equal? %ecx "<-") # => eax + 6143 3d/compare-eax-and 0/imm32/false + 6144 0f 85/jump-if-!= break/disp32 + 6145 # is-deref? = false + 6146 ba/copy-to-edx 0/imm32/false + 6147 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? + 6148 8b/-> *ecx 0/r32/eax # Slice-start + 6149 8a/copy-byte *eax 0/r32/AL + 6150 81 4/subop/and %eax 0xff/imm32 + 6151 3d/compare-eax-and 0x2a/imm32/asterisk + 6152 { + 6153 75/jump-if-!= break/disp8 + 6154 ff 0/subop/increment *ecx + 6155 ba/copy-to-edx 1/imm32/true + 6156 } + 6157 # assert(is-identifier?(name)) + 6158 (is-identifier? %ecx) # => eax + 6159 3d/compare-eax-and 0/imm32/false + 6160 0f 84/jump-if-= $parse-mu-stmt:abort/disp32 + 6161 # + 6162 (lookup-or-define-var %ecx *(ebp+0xc) *(ebp+0x10) %ebx *(ebp+0x18) *(ebp+0x1c)) + 6163 8d/copy-address *(edi+0x14) 0/r32/eax # Stmt1-outputs + 6164 (append-stmt-var Heap *ebx *(ebx+4) *(edi+0x14) *(edi+0x18) %edx %eax) # Stmt1-outputs + 6165 # + 6166 e9/jump loop/disp32 + 6167 } + 6168 } + 6169 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc)) + 6170 $parse-mu-stmt:end: + 6171 # . reclaim locals + 6172 81 0/subop/add %esp 0x10/imm32 + 6173 # . restore registers + 6174 5f/pop-to-edi + 6175 5b/pop-to-ebx + 6176 5a/pop-to-edx + 6177 59/pop-to-ecx + 6178 58/pop-to-eax + 6179 # . epilogue + 6180 89/<- %esp 5/r32/ebp + 6181 5d/pop-to-ebp + 6182 c3/return + 6183 + 6184 $parse-mu-stmt:abort: + 6185 # error("invalid identifier '" name "'\n") + 6186 (write-buffered *(ebp+0x18) "invalid identifier '") + 6187 (write-slice-buffered *(ebp+0x18) %ecx) + 6188 (write-buffered *(ebp+0x18) "'\n") + 6189 (flush *(ebp+0x18)) + 6190 (stop *(ebp+0x1c) 1) + 6191 # never gets here + 6192 + 6193 add-operation-and-inputs-to-stmt: # stmt: (addr stmt), line: (addr stream byte), vars: (addr stack live-var), err: (addr buffered-file), ed: (addr exit-descriptor) + 6194 # pseudocode: + 6195 # stmt->name = slice-to-string(next-mu-token(line)) + 6196 # while true + 6197 # name = next-mu-token(line) + 6198 # v = lookup-var-or-literal(name) + 6199 # stmt->inouts = append(v, stmt->inouts) + 6200 # + 6201 # . prologue + 6202 55/push-ebp + 6203 89/<- %ebp 4/r32/esp + 6204 # . save registers + 6205 50/push-eax + 6206 51/push-ecx + 6207 52/push-edx + 6208 53/push-ebx + 6209 56/push-esi + 6210 57/push-edi + 6211 # edi = stmt + 6212 8b/-> *(ebp+8) 7/r32/edi + 6213 # var name/ecx: slice + 6214 68/push 0/imm32/end + 6215 68/push 0/imm32/start + 6216 89/<- %ecx 4/r32/esp + 6217 # var is-deref?/edx: boolean = false + 6218 ba/copy-to-edx 0/imm32/false + 6219 # var v/esi: (handle var) + 6220 68/push 0/imm32 + 6221 68/push 0/imm32 + 6222 89/<- %esi 4/r32/esp + 6223 $add-operation-and-inputs-to-stmt:read-operation: + 6224 (next-mu-token *(ebp+0xc) %ecx) + 6225 8d/copy-address *(edi+4) 0/r32/eax # Stmt1-operation or Regvardef-operationStmt1-operation or Regvardef-operation + 6226 (slice-to-string Heap %ecx %eax) + 6227 # var is-get?/ebx: boolean = (name == "get") + 6228 (slice-equal? %ecx "get") # => eax + 6229 89/<- %ebx 0/r32/eax + 6230 { + 6231 $add-operation-and-inputs-to-stmt:read-inouts: + 6232 # name = next-mu-token(line) + 6233 (next-mu-token *(ebp+0xc) %ecx) + 6234 # if slice-empty?(word-slice) break + 6235 (slice-empty? %ecx) # => eax + 6236 3d/compare-eax-and 0/imm32/false + 6237 0f 85/jump-if-!= break/disp32 + 6238 # if (name == "<-") abort + 6239 (slice-equal? %ecx "<-") + 6240 3d/compare-eax-and 0/imm32/false + 6241 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32 + 6242 # if (is-get? && second operand) lookup or create offset + 6243 { + 6244 81 7/subop/compare %ebx 0/imm32/false + 6245 74/jump-if-= break/disp8 + 6246 (lookup *(edi+0xc) *(edi+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 6247 3d/compare-eax-and 0/imm32 + 6248 74/jump-if-= break/disp8 + 6249 (lookup-or-create-constant %eax %ecx %esi) + 6250 #? (lookup *esi *(esi+4)) + 6251 #? (write-buffered Stderr "creating new output var ") + 6252 #? (print-int32-buffered Stderr %eax) + 6253 #? (write-buffered Stderr " for field called ") + 6254 #? (write-slice-buffered Stderr %ecx) + 6255 #? (write-buffered Stderr "; var name ") + 6256 #? (lookup *eax *(eax+4)) # Var-name + 6257 #? (write-buffered Stderr %eax) + 6258 #? (write-buffered Stderr Newline) + 6259 #? (flush Stderr) + 6260 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32 + 6261 } + 6262 # is-deref? = false + 6263 ba/copy-to-edx 0/imm32/false + 6264 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? + 6265 8b/-> *ecx 0/r32/eax # Slice-start + 6266 8a/copy-byte *eax 0/r32/AL + 6267 81 4/subop/and %eax 0xff/imm32 + 6268 3d/compare-eax-and 0x2a/imm32/asterisk + 6269 { + 6270 75/jump-if-!= break/disp8 + 6271 $add-operation-and-inputs-to-stmt:inout-is-deref: + 6272 ff 0/subop/increment *ecx + 6273 ba/copy-to-edx 1/imm32/true + 6274 } + 6275 (lookup-var-or-literal %ecx *(ebp+0x10) %esi) + 6276 $add-operation-and-inputs-to-stmt:save-var: + 6277 8d/copy-address *(edi+0xc) 0/r32/eax + 6278 (append-stmt-var Heap *esi *(esi+4) *(edi+0xc) *(edi+0x10) %edx %eax) # Stmt1-inouts or Regvardef-inouts + 6279 # + 6280 e9/jump loop/disp32 + 6281 } + 6282 $add-operation-and-inputs-to-stmt:end: + 6283 # . reclaim locals + 6284 81 0/subop/add %esp 0x10/imm32 + 6285 # . restore registers + 6286 5f/pop-to-edi + 6287 5e/pop-to-esi + 6288 5b/pop-to-ebx + 6289 5a/pop-to-edx + 6290 59/pop-to-ecx + 6291 58/pop-to-eax + 6292 # . epilogue + 6293 89/<- %esp 5/r32/ebp + 6294 5d/pop-to-ebp + 6295 c3/return + 6296 + 6297 $add-operation-and-inputs-to-stmt:abort: + 6298 # error("invalid statement '" line "'\n") + 6299 (rewind-stream *(ebp+8)) + 6300 (write-buffered *(ebp+0x14) "invalid identifier '") + 6301 (flush *(ebp+0x14)) + 6302 (write-stream 2 *(ebp+8)) + 6303 (write-buffered *(ebp+0x14) "'\n") + 6304 (flush *(ebp+0x14)) + 6305 (stop *(ebp+0x18) 1) + 6306 # never gets here + 6307 + 6308 stmt-has-outputs?: # line: (addr stream byte) -> result/eax: boolean + 6309 # . prologue + 6310 55/push-ebp + 6311 89/<- %ebp 4/r32/esp + 6312 # . save registers + 6313 51/push-ecx + 6314 # var word-slice/ecx: slice + 6315 68/push 0/imm32/end + 6316 68/push 0/imm32/start + 6317 89/<- %ecx 4/r32/esp + 6318 # result = false + 6319 b8/copy-to-eax 0/imm32/false + 6320 (rewind-stream *(ebp+8)) + 6321 { + 6322 (next-mu-token *(ebp+8) %ecx) + 6323 # if slice-empty?(word-slice) break + 6324 (slice-empty? %ecx) + 6325 3d/compare-eax-and 0/imm32/false + 6326 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) + 6327 0f 85/jump-if-!= break/disp32 + 6328 # if slice-starts-with?(word-slice, '#') break + 6329 # . eax = *word-slice->start + 6330 8b/-> *ecx 0/r32/eax + 6331 8a/copy-byte *eax 0/r32/AL + 6332 81 4/subop/and %eax 0xff/imm32 + 6333 # . if (eax == '#') break + 6334 3d/compare-eax-and 0x23/imm32/hash + 6335 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) + 6336 0f 84/jump-if-= break/disp32 + 6337 # if slice-equal?(word-slice, '<-') return true + 6338 (slice-equal? %ecx "<-") + 6339 3d/compare-eax-and 0/imm32/false + 6340 74/jump-if-= loop/disp8 + 6341 b8/copy-to-eax 1/imm32/true + 6342 } + 6343 $stmt-has-outputs:end: + 6344 (rewind-stream *(ebp+8)) + 6345 # . reclaim locals + 6346 81 0/subop/add %esp 8/imm32 + 6347 # . restore registers + 6348 59/pop-to-ecx + 6349 # . epilogue + 6350 89/<- %esp 5/r32/ebp + 6351 5d/pop-to-ebp + 6352 c3/return + 6353 + 6354 # if 'name' starts with a digit, create a new literal var for it + 6355 # otherwise return first 'name' from the top (back) of 'vars' and abort if not found + 6356 lookup-var-or-literal: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) + 6357 # . prologue + 6358 55/push-ebp + 6359 89/<- %ebp 4/r32/esp + 6360 # . save registers + 6361 50/push-eax + 6362 51/push-ecx + 6363 56/push-esi + 6364 # esi = name + 6365 8b/-> *(ebp+8) 6/r32/esi + 6366 # if slice-empty?(name) abort + 6367 (slice-empty? %esi) # => eax + 6368 3d/compare-eax-and 0/imm32/false + 6369 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32 + 6370 # var c/ecx: byte = *name->start + 6371 8b/-> *esi 1/r32/ecx + 6372 8a/copy-byte *ecx 1/r32/CL + 6373 81 4/subop/and %ecx 0xff/imm32 + 6374 # if is-decimal-digit?(c) return new var(name) + 6375 { + 6376 (is-decimal-digit? %ecx) # => eax + 6377 3d/compare-eax-and 0/imm32/false + 6378 74/jump-if-= break/disp8 + 6379 (new-literal-integer Heap %esi *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) + 6380 eb/jump $lookup-var-or-literal:end/disp8 + 6381 } + 6382 # else if (c == '"') return new var(name) + 6383 { + 6384 81 7/subop/compare %ecx 0x22/imm32/dquote + 6385 75/jump-if-!= break/disp8 + 6386 (new-literal Heap %esi *(ebp+0x10)) + 6387 eb/jump $lookup-var-or-literal:end/disp8 + 6388 } + 6389 # otherwise return lookup-var(name, vars) + 6390 { + 6391 (lookup-var %esi *(ebp+0xc)) # => eax + 6392 } + 6393 $lookup-var-or-literal:end: + 6394 # . restore registers + 6395 5e/pop-to-esi + 6396 59/pop-to-ecx + 6397 58/pop-to-eax + 6398 # . epilogue + 6399 89/<- %esp 5/r32/ebp + 6400 5d/pop-to-ebp + 6401 c3/return + 6402 + 6403 $lookup-var-or-literal:abort: + 6404 (write-buffered *(ebp+0x14) "empty variable!") + 6405 (flush *(ebp+0x14)) + 6406 (stop *(ebp+0x18) 1) + 6407 # never gets here + 6408 + 6409 # return first 'name' from the top (back) of 'vars' and abort if not found + 6410 lookup-var: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) + 6411 # . prologue + 6412 55/push-ebp + 6413 89/<- %ebp 4/r32/esp + 6414 # . save registers + 6415 50/push-eax + 6416 # + 6417 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x10)) + 6418 # if (*out == 0) abort + 6419 8b/-> *(ebp+0x10) 0/r32/eax + 6420 81 7/subop/compare *eax 0/imm32 + 6421 74/jump-if-= $lookup-var:abort/disp8 + 6422 $lookup-var:end: + 6423 # . restore registers + 6424 58/pop-to-eax + 6425 # . epilogue + 6426 89/<- %esp 5/r32/ebp + 6427 5d/pop-to-ebp + 6428 c3/return + 6429 + 6430 $lookup-var:abort: + 6431 (write-buffered *(ebp+0x14) "unknown variable '") + 6432 (write-slice-buffered *(ebp+0x14) *(ebp+8)) + 6433 (write-buffered *(ebp+0x14) "'\n") + 6434 (flush *(ebp+0x14)) + 6435 (stop *(ebp+0x18) 1) + 6436 # never gets here + 6437 + 6438 # return first 'name' from the top (back) of 'vars', and 0/null if not found + 6439 lookup-var-helper: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) + 6440 # pseudocode: + 6441 # var curr: (addr handle var) = &vars->data[vars->top - 12] + 6442 # var min = vars->data + 6443 # while curr >= min + 6444 # var v: (handle var) = *curr + 6445 # if v->name == name + 6446 # return + 6447 # curr -= 12 + 6448 # + 6449 # . prologue + 6450 55/push-ebp + 6451 89/<- %ebp 4/r32/esp + 6452 # . save registers + 6453 50/push-eax + 6454 51/push-ecx + 6455 52/push-edx + 6456 53/push-ebx + 6457 56/push-esi + 6458 # clear out + 6459 (zero-out *(ebp+0x10) *Handle-size) + 6460 # esi = vars + 6461 8b/-> *(ebp+0xc) 6/r32/esi + 6462 # ebx = vars->top + 6463 8b/-> *esi 3/r32/ebx + 6464 # if (vars->top > vars->size) abort + 6465 3b/compare<- *(esi+4) 0/r32/eax + 6466 0f 8f/jump-if-> $lookup-var-helper:error1/disp32 + 6467 # var min/edx: (addr handle var) = vars->data + 6468 8d/copy-address *(esi+8) 2/r32/edx + 6469 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] + 6470 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 + 6471 { + 6472 # if (curr < min) return + 6473 39/compare %ebx 2/r32/edx + 6474 0f 82/jump-if-addr< break/disp32 + 6475 # var v/ecx: (addr var) = lookup(*curr) + 6476 (lookup *ebx *(ebx+4)) # => eax + 6477 89/<- %ecx 0/r32/eax + 6478 # var vn/eax: (addr array byte) = lookup(v->name) + 6479 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax + 6480 # if (vn == name) return curr + 6481 (slice-equal? *(ebp+8) %eax) # => eax + 6482 3d/compare-eax-and 0/imm32/false + 6483 { + 6484 74/jump-if-= break/disp8 + 6485 # esi = out + 6486 8b/-> *(ebp+0x10) 6/r32/esi + 6487 # *out = *curr + 6488 8b/-> *ebx 0/r32/eax + 6489 89/<- *esi 0/r32/eax + 6490 8b/-> *(ebx+4) 0/r32/eax + 6491 89/<- *(esi+4) 0/r32/eax + 6492 # return + 6493 eb/jump $lookup-var-helper:end/disp8 + 6494 } + 6495 # curr -= 12 + 6496 81 5/subop/subtract %ebx 0xc/imm32 + 6497 e9/jump loop/disp32 + 6498 } + 6499 $lookup-var-helper:end: + 6500 # . restore registers + 6501 5e/pop-to-esi + 6502 5b/pop-to-ebx + 6503 5a/pop-to-edx + 6504 59/pop-to-ecx + 6505 58/pop-to-eax + 6506 # . epilogue + 6507 89/<- %esp 5/r32/ebp + 6508 5d/pop-to-ebp + 6509 c3/return + 6510 + 6511 $lookup-var-helper:error1: + 6512 (write-buffered *(ebp+0x14) "malformed stack when looking up '") + 6513 (write-slice-buffered *(ebp+0x14) *(ebp+8)) + 6514 (write-buffered *(ebp+0x14) "'\n") + 6515 (flush *(ebp+0x14)) + 6516 (stop *(ebp+0x18) 1) + 6517 # never gets here + 6518 + 6519 # return first 'name' from the top (back) of 'vars' and create a new var for a fn output if not found + 6520 lookup-or-define-var: # name: (addr slice), vars: (addr stack live-var), fn: (addr function), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) + 6521 # . prologue + 6522 55/push-ebp + 6523 89/<- %ebp 4/r32/esp + 6524 # . save registers + 6525 50/push-eax + 6526 # + 6527 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x14)) + 6528 { + 6529 # if (out != 0) return + 6530 8b/-> *(ebp+0x14) 0/r32/eax + 6531 81 7/subop/compare *eax 0/imm32 + 6532 75/jump-if-!= break/disp8 + 6533 # if name is one of fn's outputs, return it + 6534 { + 6535 (find-in-function-outputs *(ebp+0x10) *(ebp+8) *(ebp+0x14)) + 6536 8b/-> *(ebp+0x14) 0/r32/eax + 6537 81 7/subop/compare *eax 0/imm32 + 6538 # otherwise abort + 6539 0f 84/jump-if-= $lookup-or-define-var:abort/disp32 + 6540 # update vars + 6541 (push *(ebp+0xc) *eax) + 6542 (push *(ebp+0xc) *(eax+4)) + 6543 (push *(ebp+0xc) 0) # never spill fn-outputs + 6544 } + 6545 } + 6546 $lookup-or-define-var:end: + 6547 # . restore registers + 6548 58/pop-to-eax + 6549 # . epilogue + 6550 89/<- %esp 5/r32/ebp + 6551 5d/pop-to-ebp + 6552 c3/return + 6553 + 6554 $lookup-or-define-var:abort: + 6555 (write-buffered *(ebp+0x18) "unknown variable '") + 6556 (write-slice-buffered *(ebp+0x18) *(ebp+8)) + 6557 (write-buffered *(ebp+0x18) "'\n") + 6558 (flush *(ebp+0x18)) + 6559 (stop *(ebp+0x1c) 1) + 6560 # never gets here + 6561 + 6562 find-in-function-outputs: # fn: (addr function), name: (addr slice), out: (addr handle var) + 6563 # . prologue + 6564 55/push-ebp + 6565 89/<- %ebp 4/r32/esp + 6566 # . save registers + 6567 50/push-eax + 6568 51/push-ecx + 6569 # var curr/ecx: (addr list var) = lookup(fn->outputs) + 6570 8b/-> *(ebp+8) 1/r32/ecx + 6571 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax + 6572 89/<- %ecx 0/r32/eax + 6573 # while curr != null + 6574 { + 6575 81 7/subop/compare %ecx 0/imm32 + 6576 74/jump-if-= break/disp8 + 6577 # var v/eax: (addr var) = lookup(curr->value) + 6578 (lookup *ecx *(ecx+4)) # List-value List-value => eax + 6579 # var s/eax: (addr array byte) = lookup(v->name) + 6580 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 6581 # if (s == name) return curr->value + 6582 (slice-equal? *(ebp+0xc) %eax) # => eax + 6583 3d/compare-eax-and 0/imm32/false + 6584 { + 6585 74/jump-if-= break/disp8 + 6586 # var edi = out + 6587 57/push-edi + 6588 8b/-> *(ebp+0x10) 7/r32/edi + 6589 # *out = curr->value + 6590 8b/-> *ecx 0/r32/eax + 6591 89/<- *edi 0/r32/eax + 6592 8b/-> *(ecx+4) 0/r32/eax + 6593 89/<- *(edi+4) 0/r32/eax + 6594 # + 6595 5f/pop-to-edi + 6596 eb/jump $find-in-function-outputs:end/disp8 + 6597 } + 6598 # curr = curr->next + 6599 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax + 6600 89/<- %ecx 0/r32/eax + 6601 # + 6602 eb/jump loop/disp8 + 6603 } + 6604 b8/copy-to-eax 0/imm32 + 6605 $find-in-function-outputs:end: + 6606 # . restore registers + 6607 59/pop-to-ecx + 6608 58/pop-to-eax + 6609 # . epilogue + 6610 89/<- %esp 5/r32/ebp + 6611 5d/pop-to-ebp + 6612 c3/return + 6613 + 6614 test-parse-mu-stmt: + 6615 # . prologue + 6616 55/push-ebp + 6617 89/<- %ebp 4/r32/esp + 6618 # setup + 6619 (clear-stream _test-input-stream) + 6620 (write _test-input-stream "increment n\n") + 6621 # var vars/ecx: (stack (addr var) 16) + 6622 81 5/subop/subtract %esp 0xc0/imm32 + 6623 68/push 0xc0/imm32/size + 6624 68/push 0/imm32/top + 6625 89/<- %ecx 4/r32/esp + 6626 (clear-stack %ecx) + 6627 # var v/edx: (handle var) + 6628 68/push 0/imm32 + 6629 68/push 0/imm32 + 6630 89/<- %edx 4/r32/esp + 6631 # var s/eax: (handle array byte) + 6632 68/push 0/imm32 + 6633 68/push 0/imm32 + 6634 89/<- %eax 4/r32/esp + 6635 # v = new var("n") + 6636 (copy-array Heap "n" %eax) + 6637 (new-var Heap *eax *(eax+4) %edx) + 6638 # + 6639 (push %ecx *edx) + 6640 (push %ecx *(edx+4)) + 6641 (push %ecx 0) + 6642 # var out/eax: (handle stmt) + 6643 68/push 0/imm32 + 6644 68/push 0/imm32 + 6645 89/<- %eax 4/r32/esp + 6646 # convert + 6647 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) + 6648 # var out-addr/edx: (addr stmt) = lookup(*out) + 6649 (lookup *eax *(eax+4)) # => eax + 6650 89/<- %edx 0/r32/eax + 6651 # out->tag + 6652 (check-ints-equal *edx 1 "F - test-parse-mu-stmt/tag") # Stmt-tag is Stmt1 + 6653 # out->operation + 6654 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax + 6655 (check-strings-equal %eax "increment" "F - test-parse-mu-stmt/name") # Stmt1-operation + 6656 # out->inouts->value->name + 6657 # . eax = out->inouts + 6658 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 6659 # . eax = out->inouts->value + 6660 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 6661 # . eax = out->inouts->value->name + 6662 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 6663 # . + 6664 (check-strings-equal %eax "n" "F - test-parse-mu-stmt/inout:0") + 6665 # . epilogue + 6666 89/<- %esp 5/r32/ebp + 6667 5d/pop-to-ebp + 6668 c3/return + 6669 + 6670 test-parse-mu-stmt-with-comma: + 6671 # . prologue + 6672 55/push-ebp + 6673 89/<- %ebp 4/r32/esp + 6674 # setup + 6675 (clear-stream _test-input-stream) + 6676 (write _test-input-stream "copy-to n, 3\n") + 6677 # var vars/ecx: (stack (addr var) 16) + 6678 81 5/subop/subtract %esp 0xc0/imm32 + 6679 68/push 0xc0/imm32/size + 6680 68/push 0/imm32/top + 6681 89/<- %ecx 4/r32/esp + 6682 (clear-stack %ecx) + 6683 # var v/edx: (handle var) + 6684 68/push 0/imm32 + 6685 68/push 0/imm32 + 6686 89/<- %edx 4/r32/esp + 6687 # var s/eax: (handle array byte) + 6688 68/push 0/imm32 + 6689 68/push 0/imm32 + 6690 89/<- %eax 4/r32/esp + 6691 # v = new var("n") + 6692 (copy-array Heap "n" %eax) + 6693 (new-var Heap *eax *(eax+4) %edx) + 6694 # + 6695 (push %ecx *edx) + 6696 (push %ecx *(edx+4)) + 6697 (push %ecx 0) + 6698 # var out/eax: (handle stmt) + 6699 68/push 0/imm32 + 6700 68/push 0/imm32 + 6701 89/<- %eax 4/r32/esp + 6702 # convert + 6703 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) + 6704 # var out-addr/edx: (addr stmt) = lookup(*out) + 6705 (lookup *eax *(eax+4)) # => eax + 6706 89/<- %edx 0/r32/eax + 6707 # out->tag + 6708 (check-ints-equal *edx 1 "F - test-parse-mu-stmt-with-comma/tag") # Stmt-tag is Stmt1 + 6709 # out->operation + 6710 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax + 6711 (check-strings-equal %eax "copy-to" "F - test-parse-mu-stmt-with-comma/name") # Stmt1-operation + 6712 # out->inouts->value->name + 6713 # . eax = out->inouts + 6714 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 6715 # . eax = out->inouts->value + 6716 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 6717 # . eax = out->inouts->value->name + 6718 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 6719 # . + 6720 (check-strings-equal %eax "n" "F - test-parse-mu-stmt-with-comma/inout:0") + 6721 # . epilogue + 6722 89/<- %esp 5/r32/ebp + 6723 5d/pop-to-ebp + 6724 c3/return + 6725 + 6726 new-var: # ad: (addr allocation-descriptor), name: (handle array byte), out: (addr handle var) + 6727 # . prologue + 6728 55/push-ebp + 6729 89/<- %ebp 4/r32/esp + 6730 # . save registers + 6731 50/push-eax + 6732 51/push-ecx + 6733 # ecx = out + 6734 8b/-> *(ebp+0x14) 1/r32/ecx + 6735 # + 6736 (allocate *(ebp+8) *Var-size %ecx) + 6737 # var out-addr/eax: (addr var) + 6738 (lookup *ecx *(ecx+4)) # => eax + 6739 # out-addr->name = name + 6740 8b/-> *(ebp+0xc) 1/r32/ecx + 6741 89/<- *eax 1/r32/ecx # Var-name + 6742 8b/-> *(ebp+0x10) 1/r32/ecx + 6743 89/<- *(eax+4) 1/r32/ecx # Var-name + 6744 #? (write-buffered Stderr "var ") + 6745 #? (lookup *(ebp+0xc) *(ebp+0x10)) + 6746 #? (write-buffered Stderr %eax) + 6747 #? (write-buffered Stderr " at ") + 6748 #? 8b/-> *(ebp+0x14) 1/r32/ecx + 6749 #? (lookup *ecx *(ecx+4)) # => eax + 6750 #? (print-int32-buffered Stderr %eax) + 6751 #? (write-buffered Stderr Newline) + 6752 #? (flush Stderr) + 6753 $new-var:end: + 6754 # . restore registers + 6755 59/pop-to-ecx + 6756 58/pop-to-eax + 6757 # . epilogue + 6758 89/<- %esp 5/r32/ebp + 6759 5d/pop-to-ebp + 6760 c3/return + 6761 + 6762 new-literal-integer: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) + 6763 # . prologue + 6764 55/push-ebp + 6765 89/<- %ebp 4/r32/esp + 6766 # . save registers + 6767 50/push-eax + 6768 51/push-ecx + 6769 # if (!is-hex-int?(name)) abort + 6770 (is-hex-int? *(ebp+0xc)) # => eax + 6771 3d/compare-eax-and 0/imm32/false + 6772 0f 84/jump-if-= $new-literal-integer:abort/disp32 + 6773 # out = new var(s) + 6774 (new-var-from-slice *(ebp+8) *(ebp+0xc) *(ebp+0x10)) + 6775 # var out-addr/ecx: (addr var) = lookup(*out) + 6776 8b/-> *(ebp+0x10) 0/r32/eax + 6777 (lookup *eax *(eax+4)) # => eax + 6778 89/<- %ecx 0/r32/eax + 6779 # out-addr->type = new tree() + 6780 8d/copy-address *(ecx+8) 0/r32/eax # Var-type + 6781 (allocate *(ebp+8) *Tree-size %eax) + 6782 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 6783 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom + 6784 # nothing else to do; default type is 'literal' + 6785 $new-literal-integer:end: + 6786 # . reclaim locals + 6787 81 0/subop/add %esp 8/imm32 + 6788 # . restore registers + 6789 59/pop-to-ecx + 6790 58/pop-to-eax + 6791 # . epilogue + 6792 89/<- %esp 5/r32/ebp + 6793 5d/pop-to-ebp + 6794 c3/return + 6795 + 6796 $new-literal-integer:abort: + 6797 (write-buffered *(ebp+0x14) "variable cannot begin with a digit '") + 6798 (write-slice-buffered *(ebp+0x14) *(ebp+0xc)) + 6799 (write-buffered *(ebp+0x14) "'\n") + 6800 (flush *(ebp+0x14)) + 6801 (stop *(ebp+0x18) 1) + 6802 # never gets here + 6803 + 6804 new-literal: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) + 6805 # . prologue + 6806 55/push-ebp + 6807 89/<- %ebp 4/r32/esp + 6808 # . save registers + 6809 50/push-eax + 6810 51/push-ecx + 6811 # var s/ecx: (handle array byte) + 6812 68/push 0/imm32 + 6813 68/push 0/imm32 + 6814 89/<- %ecx 4/r32/esp + 6815 # s = slice-to-string(name) + 6816 (slice-to-string Heap *(ebp+0xc) %ecx) + 6817 # allocate to out + 6818 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) + 6819 # var out-addr/ecx: (addr var) = lookup(*out) + 6820 8b/-> *(ebp+0x10) 1/r32/ecx + 6821 (lookup *ecx *(ecx+4)) # => eax + 6822 89/<- %ecx 0/r32/eax + 6823 # out-addr->type/eax = new type + 6824 8d/copy-address *(ecx+8) 0/r32/eax # Var-type + 6825 (allocate *(ebp+8) *Tree-size %eax) + 6826 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 6827 # nothing else to do; default type is 'literal' + 6828 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom + 6829 $new-literal:end: 6830 # . reclaim locals 6831 81 0/subop/add %esp 8/imm32 6832 # . restore registers 6833 59/pop-to-ecx - 6834 # . epilogue - 6835 89/<- %esp 5/r32/ebp - 6836 5d/pop-to-ebp - 6837 c3/return - 6838 - 6839 new-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) - 6840 # . prologue - 6841 55/push-ebp - 6842 89/<- %ebp 4/r32/esp - 6843 # . save registers - 6844 50/push-eax + 6834 58/pop-to-eax + 6835 # . epilogue + 6836 89/<- %esp 5/r32/ebp + 6837 5d/pop-to-ebp + 6838 c3/return + 6839 + 6840 new-var-from-slice: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) + 6841 # . prologue + 6842 55/push-ebp + 6843 89/<- %ebp 4/r32/esp + 6844 # . save registers 6845 51/push-ecx - 6846 # - 6847 (allocate *(ebp+8) *Stmt-size *(ebp+0x14)) - 6848 # var out-addr/eax: (addr stmt) = lookup(*out) - 6849 8b/-> *(ebp+0x14) 0/r32/eax - 6850 (lookup *eax *(eax+4)) # => eax - 6851 # out-addr->tag = stmt - 6852 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack # Stmt-tag - 6853 # result->var = var - 6854 8b/-> *(ebp+0xc) 1/r32/ecx - 6855 89/<- *(eax+4) 1/r32/ecx # Vardef-var - 6856 8b/-> *(ebp+0x10) 1/r32/ecx - 6857 89/<- *(eax+8) 1/r32/ecx # Vardef-var - 6858 $new-var-def:end: - 6859 # . restore registers - 6860 59/pop-to-ecx - 6861 58/pop-to-eax - 6862 # . epilogue - 6863 89/<- %esp 5/r32/ebp - 6864 5d/pop-to-ebp - 6865 c3/return - 6866 - 6867 new-reg-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) - 6868 # . prologue - 6869 55/push-ebp - 6870 89/<- %ebp 4/r32/esp - 6871 # . save registers - 6872 50/push-eax - 6873 # eax = out + 6846 # var tmp/ecx: (handle array byte) + 6847 68/push 0/imm32 + 6848 68/push 0/imm32 + 6849 89/<- %ecx 4/r32/esp + 6850 # tmp = slice-to-string(name) + 6851 (slice-to-string Heap *(ebp+0xc) %ecx) + 6852 # out = new-var(tmp) + 6853 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) + 6854 $new-var-from-slice:end: + 6855 # . reclaim locals + 6856 81 0/subop/add %esp 8/imm32 + 6857 # . restore registers + 6858 59/pop-to-ecx + 6859 # . epilogue + 6860 89/<- %esp 5/r32/ebp + 6861 5d/pop-to-ebp + 6862 c3/return + 6863 + 6864 new-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) + 6865 # . prologue + 6866 55/push-ebp + 6867 89/<- %ebp 4/r32/esp + 6868 # . save registers + 6869 50/push-eax + 6870 51/push-ecx + 6871 # + 6872 (allocate *(ebp+8) *Stmt-size *(ebp+0x14)) + 6873 # var out-addr/eax: (addr stmt) = lookup(*out) 6874 8b/-> *(ebp+0x14) 0/r32/eax - 6875 # - 6876 (allocate *(ebp+8) *Stmt-size %eax) - 6877 # var out-addr/eax: (addr stmt) = lookup(*out) - 6878 (lookup *eax *(eax+4)) # => eax - 6879 # set tag - 6880 c7 0/subop/copy *eax 3/imm32/tag/var-in-register # Stmt-tag - 6881 # set output - 6882 8d/copy-address *(eax+0x14) 0/r32/eax # Regvardef-outputs - 6883 (append-stmt-var Heap *(ebp+0xc) *(ebp+0x10) 0 0 0 %eax) - 6884 $new-reg-var-def:end: - 6885 # . restore registers + 6875 (lookup *eax *(eax+4)) # => eax + 6876 # out-addr->tag = stmt + 6877 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack # Stmt-tag + 6878 # result->var = var + 6879 8b/-> *(ebp+0xc) 1/r32/ecx + 6880 89/<- *(eax+4) 1/r32/ecx # Vardef-var + 6881 8b/-> *(ebp+0x10) 1/r32/ecx + 6882 89/<- *(eax+8) 1/r32/ecx # Vardef-var + 6883 $new-var-def:end: + 6884 # . restore registers + 6885 59/pop-to-ecx 6886 58/pop-to-eax 6887 # . epilogue 6888 89/<- %esp 5/r32/ebp 6889 5d/pop-to-ebp 6890 c3/return 6891 - 6892 append-list: # ad: (addr allocation-descriptor), value: (handle _type), list: (handle list _type), out: (addr handle list _type) + 6892 new-reg-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) 6893 # . prologue 6894 55/push-ebp 6895 89/<- %ebp 4/r32/esp 6896 # . save registers 6897 50/push-eax - 6898 51/push-ecx - 6899 57/push-edi - 6900 # edi = out - 6901 8b/-> *(ebp+0x1c) 7/r32/edi - 6902 # *out = new list - 6903 (allocate *(ebp+8) *List-size %edi) - 6904 # var out-addr/edi: (addr list _type) = lookup(*out) - 6905 (lookup *edi *(edi+4)) # => eax - 6906 89/<- %edi 0/r32/eax - 6907 # out-addr->value = value - 6908 8b/-> *(ebp+0xc) 0/r32/eax - 6909 89/<- *edi 0/r32/eax # List-value - 6910 8b/-> *(ebp+0x10) 0/r32/eax - 6911 89/<- *(edi+4) 0/r32/eax # List-value - 6912 # if (list == null) return - 6913 81 7/subop/compare *(ebp+0x14) 0/imm32 - 6914 74/jump-if-= $append-list:end/disp8 - 6915 # otherwise append - 6916 $append-list:non-empty-list: - 6917 # var curr/eax: (addr list _type) = lookup(list) - 6918 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax - 6919 # while (curr->next != null) curr = curr->next - 6920 { - 6921 81 7/subop/compare *(eax+8) 0/imm32 # List-next - 6922 74/jump-if-= break/disp8 - 6923 # curr = lookup(curr->next) - 6924 (lookup *(eax+8) *(eax+0xc)) # List-next, List-next => eax - 6925 # - 6926 eb/jump loop/disp8 - 6927 } - 6928 # edi = out - 6929 8b/-> *(ebp+0x1c) 7/r32/edi - 6930 # curr->next = out - 6931 8b/-> *edi 1/r32/ecx - 6932 89/<- *(eax+8) 1/r32/ecx # List-next - 6933 8b/-> *(edi+4) 1/r32/ecx - 6934 89/<- *(eax+0xc) 1/r32/ecx # List-next - 6935 # out = list - 6936 8b/-> *(ebp+0x14) 1/r32/ecx - 6937 89/<- *edi 1/r32/ecx - 6938 8b/-> *(ebp+0x18) 1/r32/ecx - 6939 89/<- *(edi+4) 1/r32/ecx - 6940 $append-list:end: - 6941 # . restore registers - 6942 5f/pop-to-edi - 6943 59/pop-to-ecx - 6944 58/pop-to-eax - 6945 # . epilogue - 6946 89/<- %esp 5/r32/ebp - 6947 5d/pop-to-ebp - 6948 c3/return - 6949 - 6950 append-stmt-var: # ad: (addr allocation-descriptor), v: (handle var), vars: (handle stmt-var), is-deref?: boolean, out: (addr handle stmt-var) - 6951 # . prologue - 6952 55/push-ebp - 6953 89/<- %ebp 4/r32/esp - 6954 # . save registers - 6955 50/push-eax - 6956 51/push-ecx - 6957 57/push-edi - 6958 # edi = out - 6959 8b/-> *(ebp+0x20) 7/r32/edi - 6960 # out = new stmt-var - 6961 (allocate *(ebp+8) *Stmt-var-size %edi) - 6962 # var out-addr/ecx: (addr stmt-var) = lookup(*out) - 6963 (lookup *edi *(edi+4)) # => eax - 6964 89/<- %ecx 0/r32/eax - 6965 # out-addr->value = v - 6966 8b/-> *(ebp+0xc) 0/r32/eax - 6967 89/<- *ecx 0/r32/eax # Stmt-var-value - 6968 8b/-> *(ebp+0x10) 0/r32/eax - 6969 89/<- *(ecx+4) 0/r32/eax # Stmt-var-value - 6970 # out-addr->is-deref? = is-deref? - 6971 8b/-> *(ebp+0x1c) 0/r32/eax - 6972 89/<- *(ecx+0x10) 0/r32/eax # Stmt-var-is-deref - 6973 # if (vars == null) return result - 6974 81 7/subop/compare *(ebp+0x14) 0/imm32/null - 6975 74/jump-if-= $append-stmt-var:end/disp8 - 6976 # otherwise append - 6977 # var curr/eax: (addr stmt-var) = lookup(vars) - 6978 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax - 6979 # while (curr->next != null) curr = curr->next - 6980 { - 6981 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next - 6982 74/jump-if-= break/disp8 - 6983 # curr = lookup(curr->next) - 6984 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next, Stmt-var-next => eax - 6985 # - 6986 eb/jump loop/disp8 - 6987 } - 6988 # curr->next = out - 6989 8b/-> *edi 1/r32/ecx - 6990 89/<- *(eax+8) 1/r32/ecx # Stmt-var-next - 6991 8b/-> *(edi+4) 1/r32/ecx - 6992 89/<- *(eax+0xc) 1/r32/ecx # Stmt-var-next - 6993 # out = vars - 6994 8b/-> *(ebp+0x14) 1/r32/ecx - 6995 89/<- *edi 1/r32/ecx - 6996 8b/-> *(ebp+0x18) 1/r32/ecx - 6997 89/<- *(edi+4) 1/r32/ecx - 6998 $append-stmt-var:end: - 6999 # . restore registers - 7000 5f/pop-to-edi - 7001 59/pop-to-ecx - 7002 58/pop-to-eax - 7003 # . epilogue - 7004 89/<- %esp 5/r32/ebp - 7005 5d/pop-to-ebp - 7006 c3/return - 7007 - 7008 append-to-block: # ad: (addr allocation-descriptor), block: (addr block), x: (handle stmt) - 7009 # . prologue - 7010 55/push-ebp - 7011 89/<- %ebp 4/r32/esp - 7012 # . save registers - 7013 50/push-eax - 7014 56/push-esi - 7015 # esi = block - 7016 8b/-> *(ebp+0xc) 6/r32/esi - 7017 # block->stmts = append(x, block->stmts) - 7018 8d/copy-address *(esi+4) 0/r32/eax # Block-stmts - 7019 (append-list *(ebp+8) *(ebp+0x10) *(ebp+0x14) *(esi+4) *(esi+8) %eax) # ad, x, x, Block-stmts, Block-stmts - 7020 $append-to-block:end: - 7021 # . restore registers - 7022 5e/pop-to-esi - 7023 58/pop-to-eax - 7024 # . epilogue - 7025 89/<- %esp 5/r32/ebp - 7026 5d/pop-to-ebp - 7027 c3/return - 7028 - 7029 ## Parsing types - 7030 # We need to create metadata on user-defined types, and we need to use this - 7031 # metadata as we parse instructions. - 7032 # However, we also want to allow types to be used before their definitions. - 7033 # This means we can't ever assume any type data structures exist. - 7034 - 7035 lookup-or-create-constant: # container: (addr stmt-var), field-name: (addr slice), out: (addr handle var) - 7036 # . prologue - 7037 55/push-ebp - 7038 89/<- %ebp 4/r32/esp - 7039 # . save registers - 7040 50/push-eax - 7041 56/push-esi - 7042 # var container-type/esi: type-id - 7043 (container-type *(ebp+8)) # => eax - 7044 89/<- %esi 0/r32/eax - 7045 # var tmp/eax: (handle typeinfo) = find-or-create-typeinfo(container-type) - 7046 68/push 0/imm32 - 7047 68/push 0/imm32 - 7048 89/<- %eax 4/r32/esp - 7049 (find-or-create-typeinfo %esi %eax) - 7050 # var tmp-addr/eax: (addr typeinfo) = lookup(tmp) - 7051 (lookup *eax *(eax+4)) # => eax - 7052 # result = find-or-create-typeinfo-output-var(typeinfo, field-name) - 7053 #? (write-buffered Stderr "constant: ") - 7054 #? (write-slice-buffered Stderr *(ebp+0xc)) - 7055 #? (write-buffered Stderr Newline) - 7056 #? (flush Stderr) - 7057 (find-or-create-typeinfo-output-var %eax *(ebp+0xc) *(ebp+0x10)) - 7058 #? 8b/-> *(ebp+0x10) 0/r32/eax - 7059 #? (write-buffered Stderr "@") - 7060 #? (lookup *eax *(eax+4)) - 7061 #? (print-int32-buffered Stderr %eax) - 7062 #? (lookup *eax *(eax+4)) - 7063 #? (write-buffered Stderr %eax) - 7064 #? (write-buffered Stderr Newline) - 7065 #? (flush Stderr) - 7066 #? (write-buffered Stderr "offset: ") - 7067 #? 8b/-> *(eax+0x14) 0/r32/eax - 7068 #? (print-int32-buffered Stderr %eax) - 7069 #? (write-buffered Stderr Newline) - 7070 #? (flush Stderr) - 7071 $lookup-or-create-constant:end: - 7072 # . reclaim locals - 7073 81 0/subop/add %esp 8/imm32 - 7074 # . restore registers - 7075 5e/pop-to-esi - 7076 58/pop-to-eax - 7077 # . epilogue - 7078 89/<- %esp 5/r32/ebp - 7079 5d/pop-to-ebp - 7080 c3/return - 7081 - 7082 # if addr var: - 7083 # container->var->type->right->left->value - 7084 # otherwise - 7085 # container->var->type->value - 7086 container-type: # container: (addr stmt-var) -> result/eax: type-id - 7087 # . prologue - 7088 55/push-ebp - 7089 89/<- %ebp 4/r32/esp - 7090 # - 7091 8b/-> *(ebp+8) 0/r32/eax - 7092 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 7093 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax - 7094 { - 7095 81 7/subop/compare *(eax+8) 0/imm32 # Tree-right - 7096 74/jump-if-= break/disp8 - 7097 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax - 7098 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax - 7099 } - 7100 8b/-> *(eax+4) 0/r32/eax # Tree-value - 7101 $container-type:end: + 6898 # eax = out + 6899 8b/-> *(ebp+0x14) 0/r32/eax + 6900 # + 6901 (allocate *(ebp+8) *Stmt-size %eax) + 6902 # var out-addr/eax: (addr stmt) = lookup(*out) + 6903 (lookup *eax *(eax+4)) # => eax + 6904 # set tag + 6905 c7 0/subop/copy *eax 3/imm32/tag/var-in-register # Stmt-tag + 6906 # set output + 6907 8d/copy-address *(eax+0x14) 0/r32/eax # Regvardef-outputs + 6908 (append-stmt-var Heap *(ebp+0xc) *(ebp+0x10) 0 0 0 %eax) + 6909 $new-reg-var-def:end: + 6910 # . restore registers + 6911 58/pop-to-eax + 6912 # . epilogue + 6913 89/<- %esp 5/r32/ebp + 6914 5d/pop-to-ebp + 6915 c3/return + 6916 + 6917 append-list: # ad: (addr allocation-descriptor), value: (handle _type), list: (handle list _type), out: (addr handle list _type) + 6918 # . prologue + 6919 55/push-ebp + 6920 89/<- %ebp 4/r32/esp + 6921 # . save registers + 6922 50/push-eax + 6923 51/push-ecx + 6924 57/push-edi + 6925 # edi = out + 6926 8b/-> *(ebp+0x1c) 7/r32/edi + 6927 # *out = new list + 6928 (allocate *(ebp+8) *List-size %edi) + 6929 # var out-addr/edi: (addr list _type) = lookup(*out) + 6930 (lookup *edi *(edi+4)) # => eax + 6931 89/<- %edi 0/r32/eax + 6932 # out-addr->value = value + 6933 8b/-> *(ebp+0xc) 0/r32/eax + 6934 89/<- *edi 0/r32/eax # List-value + 6935 8b/-> *(ebp+0x10) 0/r32/eax + 6936 89/<- *(edi+4) 0/r32/eax # List-value + 6937 # if (list == null) return + 6938 81 7/subop/compare *(ebp+0x14) 0/imm32 + 6939 74/jump-if-= $append-list:end/disp8 + 6940 # otherwise append + 6941 $append-list:non-empty-list: + 6942 # var curr/eax: (addr list _type) = lookup(list) + 6943 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax + 6944 # while (curr->next != null) curr = curr->next + 6945 { + 6946 81 7/subop/compare *(eax+8) 0/imm32 # List-next + 6947 74/jump-if-= break/disp8 + 6948 # curr = lookup(curr->next) + 6949 (lookup *(eax+8) *(eax+0xc)) # List-next, List-next => eax + 6950 # + 6951 eb/jump loop/disp8 + 6952 } + 6953 # edi = out + 6954 8b/-> *(ebp+0x1c) 7/r32/edi + 6955 # curr->next = out + 6956 8b/-> *edi 1/r32/ecx + 6957 89/<- *(eax+8) 1/r32/ecx # List-next + 6958 8b/-> *(edi+4) 1/r32/ecx + 6959 89/<- *(eax+0xc) 1/r32/ecx # List-next + 6960 # out = list + 6961 8b/-> *(ebp+0x14) 1/r32/ecx + 6962 89/<- *edi 1/r32/ecx + 6963 8b/-> *(ebp+0x18) 1/r32/ecx + 6964 89/<- *(edi+4) 1/r32/ecx + 6965 $append-list:end: + 6966 # . restore registers + 6967 5f/pop-to-edi + 6968 59/pop-to-ecx + 6969 58/pop-to-eax + 6970 # . epilogue + 6971 89/<- %esp 5/r32/ebp + 6972 5d/pop-to-ebp + 6973 c3/return + 6974 + 6975 append-stmt-var: # ad: (addr allocation-descriptor), v: (handle var), vars: (handle stmt-var), is-deref?: boolean, out: (addr handle stmt-var) + 6976 # . prologue + 6977 55/push-ebp + 6978 89/<- %ebp 4/r32/esp + 6979 # . save registers + 6980 50/push-eax + 6981 51/push-ecx + 6982 57/push-edi + 6983 # edi = out + 6984 8b/-> *(ebp+0x20) 7/r32/edi + 6985 # out = new stmt-var + 6986 (allocate *(ebp+8) *Stmt-var-size %edi) + 6987 # var out-addr/ecx: (addr stmt-var) = lookup(*out) + 6988 (lookup *edi *(edi+4)) # => eax + 6989 89/<- %ecx 0/r32/eax + 6990 # out-addr->value = v + 6991 8b/-> *(ebp+0xc) 0/r32/eax + 6992 89/<- *ecx 0/r32/eax # Stmt-var-value + 6993 8b/-> *(ebp+0x10) 0/r32/eax + 6994 89/<- *(ecx+4) 0/r32/eax # Stmt-var-value + 6995 # out-addr->is-deref? = is-deref? + 6996 8b/-> *(ebp+0x1c) 0/r32/eax + 6997 89/<- *(ecx+0x10) 0/r32/eax # Stmt-var-is-deref + 6998 # if (vars == null) return result + 6999 81 7/subop/compare *(ebp+0x14) 0/imm32/null + 7000 74/jump-if-= $append-stmt-var:end/disp8 + 7001 # otherwise append + 7002 # var curr/eax: (addr stmt-var) = lookup(vars) + 7003 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax + 7004 # while (curr->next != null) curr = curr->next + 7005 { + 7006 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next + 7007 74/jump-if-= break/disp8 + 7008 # curr = lookup(curr->next) + 7009 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next, Stmt-var-next => eax + 7010 # + 7011 eb/jump loop/disp8 + 7012 } + 7013 # curr->next = out + 7014 8b/-> *edi 1/r32/ecx + 7015 89/<- *(eax+8) 1/r32/ecx # Stmt-var-next + 7016 8b/-> *(edi+4) 1/r32/ecx + 7017 89/<- *(eax+0xc) 1/r32/ecx # Stmt-var-next + 7018 # out = vars + 7019 8b/-> *(ebp+0x14) 1/r32/ecx + 7020 89/<- *edi 1/r32/ecx + 7021 8b/-> *(ebp+0x18) 1/r32/ecx + 7022 89/<- *(edi+4) 1/r32/ecx + 7023 $append-stmt-var:end: + 7024 # . restore registers + 7025 5f/pop-to-edi + 7026 59/pop-to-ecx + 7027 58/pop-to-eax + 7028 # . epilogue + 7029 89/<- %esp 5/r32/ebp + 7030 5d/pop-to-ebp + 7031 c3/return + 7032 + 7033 append-to-block: # ad: (addr allocation-descriptor), block: (addr block), x: (handle stmt) + 7034 # . prologue + 7035 55/push-ebp + 7036 89/<- %ebp 4/r32/esp + 7037 # . save registers + 7038 50/push-eax + 7039 56/push-esi + 7040 # esi = block + 7041 8b/-> *(ebp+0xc) 6/r32/esi + 7042 # block->stmts = append(x, block->stmts) + 7043 8d/copy-address *(esi+4) 0/r32/eax # Block-stmts + 7044 (append-list *(ebp+8) *(ebp+0x10) *(ebp+0x14) *(esi+4) *(esi+8) %eax) # ad, x, x, Block-stmts, Block-stmts + 7045 $append-to-block:end: + 7046 # . restore registers + 7047 5e/pop-to-esi + 7048 58/pop-to-eax + 7049 # . epilogue + 7050 89/<- %esp 5/r32/ebp + 7051 5d/pop-to-ebp + 7052 c3/return + 7053 + 7054 ## Parsing types + 7055 # We need to create metadata on user-defined types, and we need to use this + 7056 # metadata as we parse instructions. + 7057 # However, we also want to allow types to be used before their definitions. + 7058 # This means we can't ever assume any type data structures exist. + 7059 + 7060 lookup-or-create-constant: # container: (addr stmt-var), field-name: (addr slice), out: (addr handle var) + 7061 # . prologue + 7062 55/push-ebp + 7063 89/<- %ebp 4/r32/esp + 7064 # . save registers + 7065 50/push-eax + 7066 56/push-esi + 7067 # var container-type/esi: type-id + 7068 (container-type *(ebp+8)) # => eax + 7069 89/<- %esi 0/r32/eax + 7070 # var tmp/eax: (handle typeinfo) = find-or-create-typeinfo(container-type) + 7071 68/push 0/imm32 + 7072 68/push 0/imm32 + 7073 89/<- %eax 4/r32/esp + 7074 (find-or-create-typeinfo %esi %eax) + 7075 # var tmp-addr/eax: (addr typeinfo) = lookup(tmp) + 7076 (lookup *eax *(eax+4)) # => eax + 7077 # result = find-or-create-typeinfo-output-var(typeinfo, field-name) + 7078 #? (write-buffered Stderr "constant: ") + 7079 #? (write-slice-buffered Stderr *(ebp+0xc)) + 7080 #? (write-buffered Stderr Newline) + 7081 #? (flush Stderr) + 7082 (find-or-create-typeinfo-output-var %eax *(ebp+0xc) *(ebp+0x10)) + 7083 #? 8b/-> *(ebp+0x10) 0/r32/eax + 7084 #? (write-buffered Stderr "@") + 7085 #? (lookup *eax *(eax+4)) + 7086 #? (print-int32-buffered Stderr %eax) + 7087 #? (lookup *eax *(eax+4)) + 7088 #? (write-buffered Stderr %eax) + 7089 #? (write-buffered Stderr Newline) + 7090 #? (flush Stderr) + 7091 #? (write-buffered Stderr "offset: ") + 7092 #? 8b/-> *(eax+0x14) 0/r32/eax + 7093 #? (print-int32-buffered Stderr %eax) + 7094 #? (write-buffered Stderr Newline) + 7095 #? (flush Stderr) + 7096 $lookup-or-create-constant:end: + 7097 # . reclaim locals + 7098 81 0/subop/add %esp 8/imm32 + 7099 # . restore registers + 7100 5e/pop-to-esi + 7101 58/pop-to-eax 7102 # . epilogue 7103 89/<- %esp 5/r32/ebp 7104 5d/pop-to-ebp 7105 c3/return 7106 - 7107 find-or-create-typeinfo: # t: type-id, out: (addr handle typeinfo) - 7108 # . prologue - 7109 55/push-ebp - 7110 89/<- %ebp 4/r32/esp - 7111 # . save registers - 7112 50/push-eax - 7113 51/push-ecx - 7114 52/push-edx - 7115 57/push-edi - 7116 # edi = out - 7117 8b/-> *(ebp+0xc) 7/r32/edi - 7118 # var fields/ecx: (handle table (handle array byte) (handle typeinfo-entry)) - 7119 68/push 0/imm32 - 7120 68/push 0/imm32 - 7121 89/<- %ecx 4/r32/esp - 7122 # find-typeinfo(t, out) - 7123 (find-typeinfo *(ebp+8) %edi) - 7124 { - 7125 # if (*out != 0) break - 7126 81 7/subop/compare *edi 0/imm32 - 7127 0f 85/jump-if-!= break/disp32 - 7128 $find-or-create-typeinfo:create: - 7129 # *out = allocate - 7130 (allocate Heap *Typeinfo-size %edi) - 7131 # var tmp/eax: (addr typeinfo) = lookup(*out) - 7132 (lookup *edi *(edi+4)) # => eax - 7133 #? (write-buffered Stderr "created typeinfo at ") - 7134 #? (print-int32-buffered Stderr %eax) - 7135 #? (write-buffered Stderr " for type-id ") - 7136 #? (print-int32-buffered Stderr *(ebp+8)) - 7137 #? (write-buffered Stderr Newline) - 7138 #? (flush Stderr) - 7139 # tmp->id = t - 7140 8b/-> *(ebp+8) 2/r32/edx - 7141 89/<- *eax 2/r32/edx # Typeinfo-id - 7142 # tmp->fields = new table - 7143 # . fields = new table - 7144 (new-stream Heap 0x40 *Typeinfo-fields-row-size %ecx) - 7145 # . tmp->fields = fields - 7146 8b/-> *ecx 2/r32/edx - 7147 89/<- *(eax+4) 2/r32/edx # Typeinfo-fields - 7148 8b/-> *(ecx+4) 2/r32/edx - 7149 89/<- *(eax+8) 2/r32/edx # Typeinfo-fields - 7150 # tmp->next = Program->types - 7151 8b/-> *_Program-types 1/r32/ecx - 7152 89/<- *(eax+0x10) 1/r32/ecx # Typeinfo-next - 7153 8b/-> *_Program-types->payload 1/r32/ecx - 7154 89/<- *(eax+0x14) 1/r32/ecx # Typeinfo-next - 7155 # Program->types = out - 7156 8b/-> *edi 1/r32/ecx - 7157 89/<- *_Program-types 1/r32/ecx - 7158 8b/-> *(edi+4) 1/r32/ecx - 7159 89/<- *_Program-types->payload 1/r32/ecx - 7160 } - 7161 $find-or-create-typeinfo:end: - 7162 # . reclaim locals - 7163 81 0/subop/add %esp 8/imm32 - 7164 # . restore registers - 7165 5f/pop-to-edi - 7166 5a/pop-to-edx - 7167 59/pop-to-ecx - 7168 58/pop-to-eax - 7169 # . epilogue - 7170 89/<- %esp 5/r32/ebp - 7171 5d/pop-to-ebp - 7172 c3/return - 7173 - 7174 find-typeinfo: # t: type-id, out: (addr handle typeinfo) - 7175 # . prologue - 7176 55/push-ebp - 7177 89/<- %ebp 4/r32/esp - 7178 # . save registers - 7179 50/push-eax - 7180 51/push-ecx - 7181 52/push-edx - 7182 57/push-edi - 7183 # ecx = t - 7184 8b/-> *(ebp+8) 1/r32/ecx - 7185 # edi = out - 7186 8b/-> *(ebp+0xc) 7/r32/edi - 7187 # *out = Program->types - 7188 8b/-> *_Program-types 0/r32/eax - 7189 89/<- *edi 0/r32/eax - 7190 8b/-> *_Program-types->payload 0/r32/eax - 7191 89/<- *(edi+4) 0/r32/eax - 7192 { - 7193 # if (*out == 0) break - 7194 81 7/subop/compare *edi 0/imm32 - 7195 74/jump-if-= break/disp8 - 7196 # var tmp/eax: (addr typeinfo) = lookup(*out) - 7197 (lookup *edi *(edi+4)) # => eax - 7198 # if (tmp->id == t) break - 7199 39/compare *eax 1/r32/ecx # Typeinfo-id - 7200 74/jump-if-= break/disp8 - 7201 # *out = tmp->next - 7202 8b/-> *(eax+0x10) 2/r32/edx # Typeinfo-next - 7203 89/<- *edi 2/r32/edx - 7204 8b/-> *(eax+0x14) 2/r32/edx # Typeinfo-next - 7205 89/<- *(edi+4) 2/r32/edx - 7206 # - 7207 eb/jump loop/disp8 - 7208 } - 7209 $find-typeinfo:end: - 7210 # . restore registers - 7211 5f/pop-to-edi - 7212 5a/pop-to-edx - 7213 59/pop-to-ecx - 7214 58/pop-to-eax - 7215 # . epilogue - 7216 89/<- %esp 5/r32/ebp - 7217 5d/pop-to-ebp - 7218 c3/return - 7219 - 7220 find-or-create-typeinfo-output-var: # T: (addr typeinfo), f: (addr slice), out: (addr handle var) - 7221 # . prologue - 7222 55/push-ebp - 7223 89/<- %ebp 4/r32/esp - 7224 # . save registers - 7225 50/push-eax - 7226 52/push-edx - 7227 57/push-edi - 7228 # var dest/edi: (handle typeinfo-entry) - 7229 68/push 0/imm32 - 7230 68/push 0/imm32 - 7231 89/<- %edi 4/r32/esp - 7232 # find-or-create-typeinfo-fields(T, f, dest) - 7233 (find-or-create-typeinfo-fields *(ebp+8) *(ebp+0xc) %edi) - 7234 # var dest-addr/edi: (addr typeinfo-entry) = lookup(dest) - 7235 (lookup *edi *(edi+4)) # => eax - 7236 89/<- %edi 0/r32/eax - 7237 # if dest-addr->output-var doesn't exist, create it - 7238 { - 7239 81 7/subop/compare *(edi+0xc) 0/imm32 # Typeinfo-entry-output-var - 7240 0f 85/jump-if-!= break/disp32 - 7241 # dest-addr->output-var = new var(dummy name, type, -1 offset) - 7242 # . var name/eax: (handle array byte) = "field" - 7243 68/push 0/imm32 - 7244 68/push 0/imm32 - 7245 89/<- %eax 4/r32/esp - 7246 (copy-array Heap "field" %eax) - 7247 # . new var - 7248 8d/copy-address *(edi+0xc) 2/r32/edx - 7249 (new-var Heap *eax *(eax+4) %edx) - 7250 # . reclaim name - 7251 81 0/subop/add %esp 8/imm32 - 7252 # var result/edx: (addr var) = lookup(dest-addr->output-var) - 7253 (lookup *(edi+0xc) *(edi+0x10)) # => eax - 7254 89/<- %edx 0/r32/eax - 7255 # result->type = new constant type - 7256 8d/copy-address *(edx+8) 0/r32/eax # Var-type - 7257 (allocate Heap *Tree-size %eax) - 7258 (lookup *(edx+8) *(edx+0xc)) # => eax - 7259 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom - 7260 c7 0/subop/copy *(eax+4) 6/imm32/constant # Tree-value - 7261 c7 0/subop/copy *(eax+8) 0/imm32 # Tree-left - 7262 c7 0/subop/copy *(eax+0xc) 0/imm32 # Tree-right - 7263 c7 0/subop/copy *(eax+0x10) 0/imm32 # Tree-right - 7264 # result->offset isn't filled out yet - 7265 c7 0/subop/copy *(edx+0x14) -1/imm32/uninitialized # Var-offset - 7266 } - 7267 # out = dest-addr->output-var - 7268 8b/-> *(ebp+0x10) 2/r32/edx - 7269 8b/-> *(edi+0xc) 0/r32/eax # Typeinfo-entry-output-var - 7270 89/<- *edx 0/r32/eax - 7271 8b/-> *(edi+0x10) 0/r32/eax # Typeinfo-entry-output-var - 7272 89/<- *(edx+4) 0/r32/eax - 7273 $find-or-create-typeinfo-output-var:end: - 7274 # . reclaim locals - 7275 81 0/subop/add %esp 8/imm32 - 7276 # . restore registers - 7277 5f/pop-to-edi - 7278 5a/pop-to-edx - 7279 58/pop-to-eax - 7280 # . epilogue - 7281 89/<- %esp 5/r32/ebp - 7282 5d/pop-to-ebp - 7283 c3/return - 7284 - 7285 find-or-create-typeinfo-fields: # T: (addr typeinfo), f: (addr slice), out: (addr handle typeinfo-entry) - 7286 # . prologue - 7287 55/push-ebp - 7288 89/<- %ebp 4/r32/esp - 7289 # . save registers - 7290 50/push-eax - 7291 56/push-esi - 7292 57/push-edi - 7293 # eax = lookup(T->fields) - 7294 8b/-> *(ebp+8) 0/r32/eax - 7295 (lookup *(eax+4) *(eax+8)) # Typeinfo-fields Typeinfo-fields => eax - 7296 # edi = out - 7297 8b/-> *(ebp+0x10) 7/r32/edi - 7298 # var src/esi: (addr handle typeinfo-entry) = get-or-insert-slice(T->fields, f) - 7299 (get-or-insert-slice %eax *(ebp+0xc) *Typeinfo-fields-row-size Heap) # => eax - 7300 89/<- %esi 0/r32/eax - 7301 # if src doesn't exist, allocate it - 7302 { - 7303 81 7/subop/compare *esi 0/imm32 - 7304 75/jump-if-!= break/disp8 - 7305 (allocate Heap *Typeinfo-entry-size %esi) - 7306 #? (write-buffered Stderr "handle at ") - 7307 #? (print-int32-buffered Stderr %esi) - 7308 #? (write-buffered Stderr ": ") - 7309 #? (print-int32-buffered Stderr *esi) - 7310 #? (write-buffered Stderr " ") - 7311 #? (print-int32-buffered Stderr *(esi+4)) - 7312 #? (write-buffered Stderr Newline) - 7313 #? (flush Stderr) - 7314 #? (lookup *esi *(esi+4)) - 7315 #? (write-buffered Stderr "created typeinfo fields at ") - 7316 #? (print-int32-buffered Stderr %esi) - 7317 #? (write-buffered Stderr " for ") - 7318 #? (print-int32-buffered Stderr *(ebp+8)) - 7319 #? (write-buffered Stderr Newline) - 7320 #? (flush Stderr) - 7321 } - 7322 # *out = src - 7323 # . *edi = *src - 7324 8b/-> *esi 0/r32/eax - 7325 89/<- *edi 0/r32/eax - 7326 8b/-> *(esi+4) 0/r32/eax - 7327 89/<- *(edi+4) 0/r32/eax - 7328 $find-or-create-typeinfo-fields:end: - 7329 # . restore registers - 7330 5f/pop-to-edi - 7331 5e/pop-to-esi - 7332 58/pop-to-eax - 7333 # . epilogue - 7334 89/<- %esp 5/r32/ebp - 7335 5d/pop-to-ebp - 7336 c3/return - 7337 - 7338 populate-mu-type: # in: (addr stream byte), t: (addr typeinfo) - 7339 # pseudocode: - 7340 # var line: (stream byte 512) - 7341 # curr-index = 0 - 7342 # while true - 7343 # clear-stream(line) - 7344 # read-line-buffered(in, line) - 7345 # if line->write == 0 - 7346 # abort - 7347 # word-slice = next-mu-token(line) - 7348 # if slice-empty?(word-slice) # end of line - 7349 # continue - 7350 # if slice-equal?(word-slice, "}") - 7351 # break - 7352 # var v: (handle var) = parse-var-with-type(word-slice, line) - 7353 # var r: (handle typeinfo-fields) = find-or-create-typeinfo-fields(t, word-slice/v->name) - 7354 # TODO: ensure that r->first is null - 7355 # r->index = curr-index - 7356 # curr-index++ - 7357 # r->input-var = v - 7358 # if r->output-var == 0 - 7359 # r->output-var = new literal - 7360 # TODO: ensure nothing else in line - 7361 # t->total-size-in-bytes = -2 (not yet initialized) - 7362 # - 7363 # . prologue - 7364 55/push-ebp - 7365 89/<- %ebp 4/r32/esp - 7366 # var curr-index: int at *(ebp-4) - 7367 68/push 0/imm32 - 7368 # . save registers - 7369 50/push-eax - 7370 51/push-ecx - 7371 52/push-edx - 7372 53/push-ebx - 7373 56/push-esi - 7374 57/push-edi - 7375 # edi = t - 7376 8b/-> *(ebp+0xc) 7/r32/edi - 7377 # var line/ecx: (stream byte 512) - 7378 81 5/subop/subtract %esp 0x200/imm32 - 7379 68/push 0x200/imm32/size - 7380 68/push 0/imm32/read - 7381 68/push 0/imm32/write - 7382 89/<- %ecx 4/r32/esp - 7383 # var word-slice/edx: slice - 7384 68/push 0/imm32/end - 7385 68/push 0/imm32/start - 7386 89/<- %edx 4/r32/esp - 7387 # var v/esi: (handle var) - 7388 68/push 0/imm32 - 7389 68/push 0/imm32 - 7390 89/<- %esi 4/r32/esp - 7391 # var r/ebx: (handle typeinfo-entry) + 7107 # if addr var: + 7108 # container->var->type->right->left->value + 7109 # otherwise + 7110 # container->var->type->value + 7111 container-type: # container: (addr stmt-var) -> result/eax: type-id + 7112 # . prologue + 7113 55/push-ebp + 7114 89/<- %ebp 4/r32/esp + 7115 # + 7116 8b/-> *(ebp+8) 0/r32/eax + 7117 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 7118 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax + 7119 { + 7120 81 7/subop/compare *(eax+8) 0/imm32 # Tree-right + 7121 74/jump-if-= break/disp8 + 7122 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax + 7123 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax + 7124 } + 7125 8b/-> *(eax+4) 0/r32/eax # Tree-value + 7126 $container-type:end: + 7127 # . epilogue + 7128 89/<- %esp 5/r32/ebp + 7129 5d/pop-to-ebp + 7130 c3/return + 7131 + 7132 find-or-create-typeinfo: # t: type-id, out: (addr handle typeinfo) + 7133 # . prologue + 7134 55/push-ebp + 7135 89/<- %ebp 4/r32/esp + 7136 # . save registers + 7137 50/push-eax + 7138 51/push-ecx + 7139 52/push-edx + 7140 57/push-edi + 7141 # edi = out + 7142 8b/-> *(ebp+0xc) 7/r32/edi + 7143 # var fields/ecx: (handle table (handle array byte) (handle typeinfo-entry)) + 7144 68/push 0/imm32 + 7145 68/push 0/imm32 + 7146 89/<- %ecx 4/r32/esp + 7147 # find-typeinfo(t, out) + 7148 (find-typeinfo *(ebp+8) %edi) + 7149 { + 7150 # if (*out != 0) break + 7151 81 7/subop/compare *edi 0/imm32 + 7152 0f 85/jump-if-!= break/disp32 + 7153 $find-or-create-typeinfo:create: + 7154 # *out = allocate + 7155 (allocate Heap *Typeinfo-size %edi) + 7156 # var tmp/eax: (addr typeinfo) = lookup(*out) + 7157 (lookup *edi *(edi+4)) # => eax + 7158 #? (write-buffered Stderr "created typeinfo at ") + 7159 #? (print-int32-buffered Stderr %eax) + 7160 #? (write-buffered Stderr " for type-id ") + 7161 #? (print-int32-buffered Stderr *(ebp+8)) + 7162 #? (write-buffered Stderr Newline) + 7163 #? (flush Stderr) + 7164 # tmp->id = t + 7165 8b/-> *(ebp+8) 2/r32/edx + 7166 89/<- *eax 2/r32/edx # Typeinfo-id + 7167 # tmp->fields = new table + 7168 # . fields = new table + 7169 (new-stream Heap 0x40 *Typeinfo-fields-row-size %ecx) + 7170 # . tmp->fields = fields + 7171 8b/-> *ecx 2/r32/edx + 7172 89/<- *(eax+4) 2/r32/edx # Typeinfo-fields + 7173 8b/-> *(ecx+4) 2/r32/edx + 7174 89/<- *(eax+8) 2/r32/edx # Typeinfo-fields + 7175 # tmp->next = Program->types + 7176 8b/-> *_Program-types 1/r32/ecx + 7177 89/<- *(eax+0x10) 1/r32/ecx # Typeinfo-next + 7178 8b/-> *_Program-types->payload 1/r32/ecx + 7179 89/<- *(eax+0x14) 1/r32/ecx # Typeinfo-next + 7180 # Program->types = out + 7181 8b/-> *edi 1/r32/ecx + 7182 89/<- *_Program-types 1/r32/ecx + 7183 8b/-> *(edi+4) 1/r32/ecx + 7184 89/<- *_Program-types->payload 1/r32/ecx + 7185 } + 7186 $find-or-create-typeinfo:end: + 7187 # . reclaim locals + 7188 81 0/subop/add %esp 8/imm32 + 7189 # . restore registers + 7190 5f/pop-to-edi + 7191 5a/pop-to-edx + 7192 59/pop-to-ecx + 7193 58/pop-to-eax + 7194 # . epilogue + 7195 89/<- %esp 5/r32/ebp + 7196 5d/pop-to-ebp + 7197 c3/return + 7198 + 7199 find-typeinfo: # t: type-id, out: (addr handle typeinfo) + 7200 # . prologue + 7201 55/push-ebp + 7202 89/<- %ebp 4/r32/esp + 7203 # . save registers + 7204 50/push-eax + 7205 51/push-ecx + 7206 52/push-edx + 7207 57/push-edi + 7208 # ecx = t + 7209 8b/-> *(ebp+8) 1/r32/ecx + 7210 # edi = out + 7211 8b/-> *(ebp+0xc) 7/r32/edi + 7212 # *out = Program->types + 7213 8b/-> *_Program-types 0/r32/eax + 7214 89/<- *edi 0/r32/eax + 7215 8b/-> *_Program-types->payload 0/r32/eax + 7216 89/<- *(edi+4) 0/r32/eax + 7217 { + 7218 # if (*out == 0) break + 7219 81 7/subop/compare *edi 0/imm32 + 7220 74/jump-if-= break/disp8 + 7221 # var tmp/eax: (addr typeinfo) = lookup(*out) + 7222 (lookup *edi *(edi+4)) # => eax + 7223 # if (tmp->id == t) break + 7224 39/compare *eax 1/r32/ecx # Typeinfo-id + 7225 74/jump-if-= break/disp8 + 7226 # *out = tmp->next + 7227 8b/-> *(eax+0x10) 2/r32/edx # Typeinfo-next + 7228 89/<- *edi 2/r32/edx + 7229 8b/-> *(eax+0x14) 2/r32/edx # Typeinfo-next + 7230 89/<- *(edi+4) 2/r32/edx + 7231 # + 7232 eb/jump loop/disp8 + 7233 } + 7234 $find-typeinfo:end: + 7235 # . restore registers + 7236 5f/pop-to-edi + 7237 5a/pop-to-edx + 7238 59/pop-to-ecx + 7239 58/pop-to-eax + 7240 # . epilogue + 7241 89/<- %esp 5/r32/ebp + 7242 5d/pop-to-ebp + 7243 c3/return + 7244 + 7245 find-or-create-typeinfo-output-var: # T: (addr typeinfo), f: (addr slice), out: (addr handle var) + 7246 # . prologue + 7247 55/push-ebp + 7248 89/<- %ebp 4/r32/esp + 7249 # . save registers + 7250 50/push-eax + 7251 52/push-edx + 7252 57/push-edi + 7253 # var dest/edi: (handle typeinfo-entry) + 7254 68/push 0/imm32 + 7255 68/push 0/imm32 + 7256 89/<- %edi 4/r32/esp + 7257 # find-or-create-typeinfo-fields(T, f, dest) + 7258 (find-or-create-typeinfo-fields *(ebp+8) *(ebp+0xc) %edi) + 7259 # var dest-addr/edi: (addr typeinfo-entry) = lookup(dest) + 7260 (lookup *edi *(edi+4)) # => eax + 7261 89/<- %edi 0/r32/eax + 7262 # if dest-addr->output-var doesn't exist, create it + 7263 { + 7264 81 7/subop/compare *(edi+0xc) 0/imm32 # Typeinfo-entry-output-var + 7265 0f 85/jump-if-!= break/disp32 + 7266 # dest-addr->output-var = new var(dummy name, type, -1 offset) + 7267 # . var name/eax: (handle array byte) = "field" + 7268 68/push 0/imm32 + 7269 68/push 0/imm32 + 7270 89/<- %eax 4/r32/esp + 7271 (copy-array Heap "field" %eax) + 7272 # . new var + 7273 8d/copy-address *(edi+0xc) 2/r32/edx + 7274 (new-var Heap *eax *(eax+4) %edx) + 7275 # . reclaim name + 7276 81 0/subop/add %esp 8/imm32 + 7277 # var result/edx: (addr var) = lookup(dest-addr->output-var) + 7278 (lookup *(edi+0xc) *(edi+0x10)) # => eax + 7279 89/<- %edx 0/r32/eax + 7280 # result->type = new constant type + 7281 8d/copy-address *(edx+8) 0/r32/eax # Var-type + 7282 (allocate Heap *Tree-size %eax) + 7283 (lookup *(edx+8) *(edx+0xc)) # => eax + 7284 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom + 7285 c7 0/subop/copy *(eax+4) 6/imm32/constant # Tree-value + 7286 c7 0/subop/copy *(eax+8) 0/imm32 # Tree-left + 7287 c7 0/subop/copy *(eax+0xc) 0/imm32 # Tree-right + 7288 c7 0/subop/copy *(eax+0x10) 0/imm32 # Tree-right + 7289 # result->offset isn't filled out yet + 7290 c7 0/subop/copy *(edx+0x14) -1/imm32/uninitialized # Var-offset + 7291 } + 7292 # out = dest-addr->output-var + 7293 8b/-> *(ebp+0x10) 2/r32/edx + 7294 8b/-> *(edi+0xc) 0/r32/eax # Typeinfo-entry-output-var + 7295 89/<- *edx 0/r32/eax + 7296 8b/-> *(edi+0x10) 0/r32/eax # Typeinfo-entry-output-var + 7297 89/<- *(edx+4) 0/r32/eax + 7298 $find-or-create-typeinfo-output-var:end: + 7299 # . reclaim locals + 7300 81 0/subop/add %esp 8/imm32 + 7301 # . restore registers + 7302 5f/pop-to-edi + 7303 5a/pop-to-edx + 7304 58/pop-to-eax + 7305 # . epilogue + 7306 89/<- %esp 5/r32/ebp + 7307 5d/pop-to-ebp + 7308 c3/return + 7309 + 7310 find-or-create-typeinfo-fields: # T: (addr typeinfo), f: (addr slice), out: (addr handle typeinfo-entry) + 7311 # . prologue + 7312 55/push-ebp + 7313 89/<- %ebp 4/r32/esp + 7314 # . save registers + 7315 50/push-eax + 7316 56/push-esi + 7317 57/push-edi + 7318 # eax = lookup(T->fields) + 7319 8b/-> *(ebp+8) 0/r32/eax + 7320 (lookup *(eax+4) *(eax+8)) # Typeinfo-fields Typeinfo-fields => eax + 7321 # edi = out + 7322 8b/-> *(ebp+0x10) 7/r32/edi + 7323 # var src/esi: (addr handle typeinfo-entry) = get-or-insert-slice(T->fields, f) + 7324 (get-or-insert-slice %eax *(ebp+0xc) *Typeinfo-fields-row-size Heap) # => eax + 7325 89/<- %esi 0/r32/eax + 7326 # if src doesn't exist, allocate it + 7327 { + 7328 81 7/subop/compare *esi 0/imm32 + 7329 75/jump-if-!= break/disp8 + 7330 (allocate Heap *Typeinfo-entry-size %esi) + 7331 #? (write-buffered Stderr "handle at ") + 7332 #? (print-int32-buffered Stderr %esi) + 7333 #? (write-buffered Stderr ": ") + 7334 #? (print-int32-buffered Stderr *esi) + 7335 #? (write-buffered Stderr " ") + 7336 #? (print-int32-buffered Stderr *(esi+4)) + 7337 #? (write-buffered Stderr Newline) + 7338 #? (flush Stderr) + 7339 #? (lookup *esi *(esi+4)) + 7340 #? (write-buffered Stderr "created typeinfo fields at ") + 7341 #? (print-int32-buffered Stderr %esi) + 7342 #? (write-buffered Stderr " for ") + 7343 #? (print-int32-buffered Stderr *(ebp+8)) + 7344 #? (write-buffered Stderr Newline) + 7345 #? (flush Stderr) + 7346 } + 7347 # *out = src + 7348 # . *edi = *src + 7349 8b/-> *esi 0/r32/eax + 7350 89/<- *edi 0/r32/eax + 7351 8b/-> *(esi+4) 0/r32/eax + 7352 89/<- *(edi+4) 0/r32/eax + 7353 $find-or-create-typeinfo-fields:end: + 7354 # . restore registers + 7355 5f/pop-to-edi + 7356 5e/pop-to-esi + 7357 58/pop-to-eax + 7358 # . epilogue + 7359 89/<- %esp 5/r32/ebp + 7360 5d/pop-to-ebp + 7361 c3/return + 7362 + 7363 populate-mu-type: # in: (addr stream byte), t: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) + 7364 # pseudocode: + 7365 # var line: (stream byte 512) + 7366 # curr-index = 0 + 7367 # while true + 7368 # clear-stream(line) + 7369 # read-line-buffered(in, line) + 7370 # if line->write == 0 + 7371 # abort + 7372 # word-slice = next-mu-token(line) + 7373 # if slice-empty?(word-slice) # end of line + 7374 # continue + 7375 # if slice-equal?(word-slice, "}") + 7376 # break + 7377 # var v: (handle var) = parse-var-with-type(word-slice, line) + 7378 # var r: (handle typeinfo-fields) = find-or-create-typeinfo-fields(t, word-slice/v->name) + 7379 # TODO: ensure that r->first is null + 7380 # r->index = curr-index + 7381 # curr-index++ + 7382 # r->input-var = v + 7383 # if r->output-var == 0 + 7384 # r->output-var = new literal + 7385 # TODO: ensure nothing else in line + 7386 # t->total-size-in-bytes = -2 (not yet initialized) + 7387 # + 7388 # . prologue + 7389 55/push-ebp + 7390 89/<- %ebp 4/r32/esp + 7391 # var curr-index: int at *(ebp-4) 7392 68/push 0/imm32 - 7393 68/push 0/imm32 - 7394 89/<- %ebx 4/r32/esp - 7395 { - 7396 $populate-mu-type:line-loop: - 7397 (clear-stream %ecx) - 7398 (read-line-buffered *(ebp+8) %ecx) - 7399 # if (line->write == 0) abort - 7400 81 7/subop/compare *ecx 0/imm32 - 7401 0f 84/jump-if-= $populate-mu-type:abort/disp32 - 7402 +-- 6 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7408 (next-mu-token %ecx %edx) - 7409 # if slice-empty?(word-slice) continue - 7410 (slice-empty? %edx) # => eax - 7411 3d/compare-eax-and 0/imm32 - 7412 0f 85/jump-if-!= loop/disp32 - 7413 # if slice-equal?(word-slice, "}") break - 7414 (slice-equal? %edx "}") - 7415 3d/compare-eax-and 0/imm32 - 7416 0f 85/jump-if-!= break/disp32 - 7417 $populate-mu-type:parse-element: - 7418 # v = parse-var-with-type(word-slice, first-line) - 7419 # must do this first to strip the trailing ':' from word-slice before - 7420 # using it in find-or-create-typeinfo-fields below - 7421 # TODO: clean up that mutation in parse-var-with-type - 7422 (parse-var-with-type %edx %ecx %esi) # => eax - 7423 # var tmp/ecx - 7424 51/push-ecx - 7425 $populate-mu-type:create-typeinfo-fields: - 7426 # var r/ebx: (handle typeinfo-entry) - 7427 (find-or-create-typeinfo-fields %edi %edx %ebx) - 7428 # r->index = curr-index - 7429 (lookup *ebx *(ebx+4)) # => eax - 7430 8b/-> *(ebp-4) 1/r32/ecx - 7431 #? (write-buffered Stderr "saving index ") - 7432 #? (print-int32-buffered Stderr %ecx) - 7433 #? (write-buffered Stderr " at ") - 7434 #? (print-int32-buffered Stderr %edi) - 7435 #? (write-buffered Stderr Newline) - 7436 #? (flush Stderr) - 7437 89/<- *(eax+8) 1/r32/ecx # Typeinfo-entry-index - 7438 # ++curr-index - 7439 ff 0/subop/increment *(ebp-4) - 7440 $populate-mu-type:set-input-type: - 7441 # r->input-var = v - 7442 8b/-> *esi 1/r32/ecx - 7443 89/<- *eax 1/r32/ecx # Typeinfo-entry-input-var - 7444 8b/-> *(esi+4) 1/r32/ecx - 7445 89/<- *(eax+4) 1/r32/ecx # Typeinfo-entry-input-var - 7446 59/pop-to-ecx - 7447 { - 7448 $populate-mu-type:create-output-type: - 7449 # if (r->output-var == 0) create a new var with some placeholder data - 7450 81 7/subop/compare *(eax+0xc) 0/imm32 # Typeinfo-entry-output-var - 7451 75/jump-if-!= break/disp8 - 7452 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var - 7453 (new-literal Heap %edx %eax) - 7454 } - 7455 e9/jump loop/disp32 - 7456 } - 7457 $populate-mu-type:invalidate-total-size-in-bytes: - 7458 # Offsets and total size may not be accurate here since we may not yet - 7459 # have encountered the element types. - 7460 # We'll recompute them separately after parsing the entire program. - 7461 c7 0/subop/copy *(edi+0xc) -2/imm32/uninitialized # Typeinfo-total-size-in-bytes - 7462 $populate-mu-type:end: - 7463 # . reclaim locals - 7464 81 0/subop/add %esp 0x224/imm32 - 7465 # . restore registers - 7466 5f/pop-to-edi - 7467 5e/pop-to-esi - 7468 5b/pop-to-ebx - 7469 5a/pop-to-edx - 7470 59/pop-to-ecx - 7471 58/pop-to-eax - 7472 # reclaim curr-index - 7473 81 0/subop/add %esp 4/imm32 - 7474 # . epilogue - 7475 89/<- %esp 5/r32/ebp - 7476 5d/pop-to-ebp - 7477 c3/return - 7478 - 7479 $populate-mu-type:abort: - 7480 # error("unexpected top-level command: " word-slice "\n") - 7481 (write-buffered Stderr "incomplete type definition '") - 7482 (type-name *edi) # Typeinfo-id => eax - 7483 (write-buffered Stderr %eax) - 7484 (write-buffered Stderr "\n") - 7485 (flush Stderr) - 7486 # . syscall(exit, 1) - 7487 bb/copy-to-ebx 1/imm32 - 7488 b8/copy-to-eax 1/imm32/exit - 7489 cd/syscall 0x80/imm8 - 7490 # never gets here - 7491 - 7492 type-name: # index: int -> result/eax: (addr array byte) - 7493 # . prologue - 7494 55/push-ebp - 7495 89/<- %ebp 4/r32/esp - 7496 # - 7497 (index Type-id *(ebp+8)) - 7498 $type-name:end: + 7393 # . save registers + 7394 50/push-eax + 7395 51/push-ecx + 7396 52/push-edx + 7397 53/push-ebx + 7398 56/push-esi + 7399 57/push-edi + 7400 # edi = t + 7401 8b/-> *(ebp+0xc) 7/r32/edi + 7402 # var line/ecx: (stream byte 512) + 7403 81 5/subop/subtract %esp 0x200/imm32 + 7404 68/push 0x200/imm32/size + 7405 68/push 0/imm32/read + 7406 68/push 0/imm32/write + 7407 89/<- %ecx 4/r32/esp + 7408 # var word-slice/edx: slice + 7409 68/push 0/imm32/end + 7410 68/push 0/imm32/start + 7411 89/<- %edx 4/r32/esp + 7412 # var v/esi: (handle var) + 7413 68/push 0/imm32 + 7414 68/push 0/imm32 + 7415 89/<- %esi 4/r32/esp + 7416 # var r/ebx: (handle typeinfo-entry) + 7417 68/push 0/imm32 + 7418 68/push 0/imm32 + 7419 89/<- %ebx 4/r32/esp + 7420 { + 7421 $populate-mu-type:line-loop: + 7422 (clear-stream %ecx) + 7423 (read-line-buffered *(ebp+8) %ecx) + 7424 # if (line->write == 0) abort + 7425 81 7/subop/compare *ecx 0/imm32 + 7426 0f 84/jump-if-= $populate-mu-type:abort/disp32 + 7427 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------ + 7433 (next-mu-token %ecx %edx) + 7434 # if slice-empty?(word-slice) continue + 7435 (slice-empty? %edx) # => eax + 7436 3d/compare-eax-and 0/imm32 + 7437 0f 85/jump-if-!= loop/disp32 + 7438 # if slice-equal?(word-slice, "}") break + 7439 (slice-equal? %edx "}") + 7440 3d/compare-eax-and 0/imm32 + 7441 0f 85/jump-if-!= break/disp32 + 7442 $populate-mu-type:parse-element: + 7443 # v = parse-var-with-type(word-slice, first-line) + 7444 # must do this first to strip the trailing ':' from word-slice before + 7445 # using it in find-or-create-typeinfo-fields below + 7446 # TODO: clean up that mutation in parse-var-with-type + 7447 (parse-var-with-type %edx %ecx %esi *(ebp+0x10) *(ebp+0x14)) # => eax + 7448 # var tmp/ecx + 7449 51/push-ecx + 7450 $populate-mu-type:create-typeinfo-fields: + 7451 # var r/ebx: (handle typeinfo-entry) + 7452 (find-or-create-typeinfo-fields %edi %edx %ebx) + 7453 # r->index = curr-index + 7454 (lookup *ebx *(ebx+4)) # => eax + 7455 8b/-> *(ebp-4) 1/r32/ecx + 7456 #? (write-buffered Stderr "saving index ") + 7457 #? (print-int32-buffered Stderr %ecx) + 7458 #? (write-buffered Stderr " at ") + 7459 #? (print-int32-buffered Stderr %edi) + 7460 #? (write-buffered Stderr Newline) + 7461 #? (flush Stderr) + 7462 89/<- *(eax+8) 1/r32/ecx # Typeinfo-entry-index + 7463 # ++curr-index + 7464 ff 0/subop/increment *(ebp-4) + 7465 $populate-mu-type:set-input-type: + 7466 # r->input-var = v + 7467 8b/-> *esi 1/r32/ecx + 7468 89/<- *eax 1/r32/ecx # Typeinfo-entry-input-var + 7469 8b/-> *(esi+4) 1/r32/ecx + 7470 89/<- *(eax+4) 1/r32/ecx # Typeinfo-entry-input-var + 7471 59/pop-to-ecx + 7472 { + 7473 $populate-mu-type:create-output-type: + 7474 # if (r->output-var == 0) create a new var with some placeholder data + 7475 81 7/subop/compare *(eax+0xc) 0/imm32 # Typeinfo-entry-output-var + 7476 75/jump-if-!= break/disp8 + 7477 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var + 7478 (new-literal Heap %edx %eax) + 7479 } + 7480 e9/jump loop/disp32 + 7481 } + 7482 $populate-mu-type:invalidate-total-size-in-bytes: + 7483 # Offsets and total size may not be accurate here since we may not yet + 7484 # have encountered the element types. + 7485 # We'll recompute them separately after parsing the entire program. + 7486 c7 0/subop/copy *(edi+0xc) -2/imm32/uninitialized # Typeinfo-total-size-in-bytes + 7487 $populate-mu-type:end: + 7488 # . reclaim locals + 7489 81 0/subop/add %esp 0x224/imm32 + 7490 # . restore registers + 7491 5f/pop-to-edi + 7492 5e/pop-to-esi + 7493 5b/pop-to-ebx + 7494 5a/pop-to-edx + 7495 59/pop-to-ecx + 7496 58/pop-to-eax + 7497 # reclaim curr-index + 7498 81 0/subop/add %esp 4/imm32 7499 # . epilogue 7500 89/<- %esp 5/r32/ebp 7501 5d/pop-to-ebp 7502 c3/return 7503 - 7504 index: # arr: (addr stream (handle array byte)), index: int -> result/eax: (addr array byte) - 7505 # . prologue - 7506 55/push-ebp - 7507 89/<- %ebp 4/r32/esp - 7508 # . save registers - 7509 56/push-esi - 7510 # TODO: bounds-check index - 7511 # esi = arr - 7512 8b/-> *(ebp+8) 6/r32/esi - 7513 # eax = index - 7514 8b/-> *(ebp+0xc) 0/r32/eax - 7515 # eax = *(arr + 12 + index) - 7516 8b/-> *(esi+eax+0xc) 0/r32/eax - 7517 $index:end: - 7518 # . restore registers - 7519 5e/pop-to-esi - 7520 # . epilogue - 7521 89/<- %esp 5/r32/ebp - 7522 5d/pop-to-ebp - 7523 c3/return - 7524 - 7525 ####################################################### - 7526 # Compute type sizes - 7527 ####################################################### - 7528 - 7529 # Compute the sizes of all user-defined types. - 7530 # We'll need the sizes of their elements, which may be other user-defined - 7531 # types, which we will compute as needed. - 7532 - 7533 # Initially, all user-defined types have their sizes set to -2 (invalid) - 7534 populate-mu-type-sizes: - 7535 # . prologue - 7536 55/push-ebp - 7537 89/<- %ebp 4/r32/esp - 7538 $populate-mu-type-sizes:total-sizes: - 7539 # var curr/eax: (addr typeinfo) = lookup(Program->types) - 7540 (lookup *_Program-types *_Program-types->payload) # => eax - 7541 { - 7542 # if (curr == null) break - 7543 3d/compare-eax-and 0/imm32/null - 7544 74/jump-if-= break/disp8 - 7545 (populate-mu-type-sizes-in-type %eax) - 7546 # curr = lookup(curr->next) - 7547 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax - 7548 eb/jump loop/disp8 - 7549 } - 7550 $populate-mu-type-sizes:offsets: - 7551 # curr = *Program->types - 7552 (lookup *_Program-types *_Program-types->payload) # => eax - 7553 { - 7554 # if (curr == null) break - 7555 3d/compare-eax-and 0/imm32/null - 7556 74/jump-if-= break/disp8 - 7557 (populate-mu-type-offsets %eax) - 7558 # curr = curr->next - 7559 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax - 7560 eb/jump loop/disp8 - 7561 } - 7562 $populate-mu-type-sizes:end: - 7563 # . epilogue - 7564 89/<- %esp 5/r32/ebp - 7565 5d/pop-to-ebp - 7566 c3/return - 7567 - 7568 # compute sizes of all fields, recursing as necessary - 7569 # sum up all their sizes to arrive at total size - 7570 # fields may be out of order, but that doesn't affect the answer - 7571 populate-mu-type-sizes-in-type: # T: (addr typeinfo) - 7572 # . prologue - 7573 55/push-ebp - 7574 89/<- %ebp 4/r32/esp - 7575 # . save registers - 7576 50/push-eax - 7577 51/push-ecx - 7578 52/push-edx - 7579 56/push-esi - 7580 57/push-edi - 7581 # esi = T - 7582 8b/-> *(ebp+8) 6/r32/esi - 7583 # if T is already computed, return - 7584 81 7/subop/compare *(esi+0xc) 0/imm32 # Typeinfo-total-size-in-bytes - 7585 0f 8d/jump-if->= $populate-mu-type-sizes-in-type:end/disp32 - 7586 # if T is being computed, abort - 7587 81 7/subop/compare *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes - 7588 0f 84/jump-if-= $populate-mu-type-sizes-in-type:abort/disp32 - 7589 # tag T (-2 to -1) to avoid infinite recursion - 7590 c7 0/subop/copy *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes - 7591 # var total-size/edi: int = 0 - 7592 bf/copy-to-edi 0/imm32 - 7593 # - for every field, if it's a user-defined type, compute its size - 7594 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) - 7595 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax - 7596 89/<- %ecx 0/r32/eax - 7597 # var table-size/edx: int = table->write - 7598 8b/-> *ecx 2/r32/edx # stream-write - 7599 # var curr/ecx: (addr table_row) = table->data - 7600 8d/copy-address *(ecx+0xc) 1/r32/ecx - 7601 # var max/edx: (addr table_row) = table->data + table->write - 7602 8d/copy-address *(ecx+edx) 2/r32/edx - 7603 { - 7604 $populate-mu-type-sizes-in-type:loop: - 7605 # if (curr >= max) break - 7606 39/compare %ecx 2/r32/edx - 7607 73/jump-if-addr>= break/disp8 - 7608 # var t/eax: (addr typeinfo-entry) = lookup(curr->value) - 7609 (lookup *(ecx+8) *(ecx+0xc)) # => eax - 7610 # compute size of t->input-var - 7611 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax - 7612 (compute-size-of-var %eax) # => eax - 7613 # result += eax - 7614 01/add-to %edi 0/r32/eax - 7615 # curr += row-size - 7616 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size - 7617 # - 7618 eb/jump loop/disp8 - 7619 } - 7620 # - save result - 7621 89/<- *(esi+0xc) 7/r32/edi # Typeinfo-total-size-in-bytes - 7622 $populate-mu-type-sizes-in-type:end: - 7623 # . restore registers - 7624 5f/pop-to-edi - 7625 5e/pop-to-esi - 7626 5a/pop-to-edx - 7627 59/pop-to-ecx - 7628 58/pop-to-eax - 7629 # . epilogue - 7630 89/<- %esp 5/r32/ebp - 7631 5d/pop-to-ebp - 7632 c3/return - 7633 - 7634 $populate-mu-type-sizes-in-type:abort: - 7635 (write-buffered Stderr "cycle in type definitions\n") - 7636 (flush Stderr) - 7637 # . syscall(exit, 1) - 7638 bb/copy-to-ebx 1/imm32 - 7639 b8/copy-to-eax 1/imm32/exit - 7640 cd/syscall 0x80/imm8 - 7641 # never gets here - 7642 - 7643 # Analogous to size-of, except we need to compute what size-of can just read - 7644 # off the right data structures. - 7645 compute-size-of-var: # in: (addr var) -> result/eax: int - 7646 # . prologue - 7647 55/push-ebp - 7648 89/<- %ebp 4/r32/esp - 7649 # . push registers - 7650 51/push-ecx - 7651 # var t/ecx: (addr tree type-id) = lookup(v->type) - 7652 8b/-> *(ebp+8) 1/r32/ecx - 7653 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 7654 89/<- %ecx 0/r32/eax - 7655 # if (t->is-atom == false) t = lookup(t->left) - 7656 { - 7657 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom - 7658 75/jump-if-!= break/disp8 - 7659 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax - 7660 89/<- %ecx 0/r32/eax - 7661 } - 7662 # TODO: ensure t is an atom - 7663 (compute-size-of-type-id *(ecx+4)) # Tree-value => eax - 7664 $compute-size-of-var:end: - 7665 # . restore registers - 7666 59/pop-to-ecx - 7667 # . epilogue - 7668 89/<- %esp 5/r32/ebp - 7669 5d/pop-to-ebp - 7670 c3/return - 7671 - 7672 compute-size-of-type-id: # t: type-id -> result/eax: int - 7673 # . prologue - 7674 55/push-ebp - 7675 89/<- %ebp 4/r32/esp - 7676 # . save registers - 7677 51/push-ecx - 7678 # var out/ecx: (handle typeinfo) - 7679 68/push 0/imm32 - 7680 68/push 0/imm32 - 7681 89/<- %ecx 4/r32/esp - 7682 # eax = t - 7683 8b/-> *(ebp+8) 0/r32/eax - 7684 # if v is a literal, return 0 - 7685 3d/compare-eax-and 0/imm32 - 7686 74/jump-if-= $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int - 7687 # if v has a user-defined type, compute its size - 7688 # TODO: support non-atom type - 7689 (find-typeinfo %eax %ecx) - 7690 { - 7691 81 7/subop/compare *ecx 0/imm32 - 7692 74/jump-if-= break/disp8 - 7693 $compute-size-of-type-id:user-defined: - 7694 (populate-mu-type-sizes %eax) - 7695 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes - 7696 eb/jump $compute-size-of-type-id:end/disp8 - 7697 } - 7698 # otherwise return the word size - 7699 b8/copy-to-eax 4/imm32 - 7700 $compute-size-of-type-id:end: - 7701 # . reclaim locals - 7702 81 0/subop/add %esp 8/imm32 - 7703 # . restore registers - 7704 59/pop-to-ecx - 7705 # . epilogue - 7706 89/<- %esp 5/r32/ebp - 7707 5d/pop-to-ebp - 7708 c3/return - 7709 - 7710 # at this point we have total sizes for all user-defined types - 7711 # compute offsets for each element - 7712 # complication: fields may be out of order - 7713 populate-mu-type-offsets: # in: (addr typeinfo) - 7714 # . prologue - 7715 55/push-ebp - 7716 89/<- %ebp 4/r32/esp - 7717 # . save registers - 7718 50/push-eax - 7719 51/push-ecx - 7720 52/push-edx - 7721 53/push-ebx - 7722 56/push-esi - 7723 57/push-edi - 7724 #? (dump-typeinfos "aaa\n") - 7725 # var curr-offset/edi: int = 0 - 7726 bf/copy-to-edi 0/imm32 - 7727 # var table/ecx: (addr table string_key (handle typeinfo-entry)) = lookup(in->fields) - 7728 8b/-> *(ebp+8) 1/r32/ecx - 7729 (lookup *(ecx+4) *(ecx+8)) # Typeinfo-fields Typeinfo-fields => eax - 7730 89/<- %ecx 0/r32/eax - 7731 # var num-elems/edx: int = table->write / Typeinfo-fields-row-size - 7732 8b/-> *ecx 2/r32/edx # stream-write - 7733 c1 5/subop/shift-right-logical %edx 4/imm8 - 7734 # var i/ebx: int = 0 - 7735 bb/copy-to-ebx 0/imm32 - 7736 { - 7737 $populate-mu-type-offsets:loop: - 7738 39/compare %ebx 2/r32/edx - 7739 7d/jump-if->= break/disp8 - 7740 #? (write-buffered Stderr "looking up index ") - 7741 #? (print-int32-buffered Stderr %ebx) - 7742 #? (write-buffered Stderr " in ") - 7743 #? (print-int32-buffered Stderr *(ebp+8)) - 7744 #? (write-buffered Stderr Newline) - 7745 #? (flush Stderr) - 7746 # var v/esi: (addr typeinfo-entry) - 7747 (locate-typeinfo-entry-with-index %ecx %ebx) # => eax - 7748 89/<- %esi 0/r32/eax - 7749 # v->output-var->offset = curr-offset - 7750 # . eax: (addr var) - 7751 (lookup *(esi+0xc) *(esi+0x10)) # Typeinfo-entry-output-var Typeinfo-entry-output-var => eax - 7752 89/<- *(eax+0x14) 7/r32/edi # Var-offset - 7753 # curr-offset += size-of(v->input-var) - 7754 (lookup *esi *(esi+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax - 7755 (size-of %eax) # => eax - 7756 01/add-to %edi 0/r32/eax - 7757 # ++i - 7758 43/increment-ebx - 7759 eb/jump loop/disp8 - 7760 } - 7761 $populate-mu-type-offsets:end: - 7762 # . restore registers - 7763 5f/pop-to-edi - 7764 5e/pop-to-esi - 7765 5b/pop-to-ebx - 7766 5a/pop-to-edx - 7767 59/pop-to-ecx - 7768 58/pop-to-eax - 7769 # . epilogue - 7770 89/<- %esp 5/r32/ebp - 7771 5d/pop-to-ebp - 7772 c3/return - 7773 - 7774 locate-typeinfo-entry-with-index: # table: (addr table (handle array byte) (handle typeinfo-entry)), idx: int -> result/eax: (addr typeinfo-entry) - 7775 # . prologue - 7776 55/push-ebp - 7777 89/<- %ebp 4/r32/esp - 7778 # . save registers - 7779 51/push-ecx - 7780 52/push-edx - 7781 53/push-ebx - 7782 56/push-esi - 7783 57/push-edi - 7784 # esi = table - 7785 8b/-> *(ebp+8) 6/r32/esi - 7786 # var curr/ecx: (addr row (handle array byte) (handle typeinfo-entry)) = table->data - 7787 8d/copy-address *(esi+0xc) 1/r32/ecx - 7788 # var max/edx: (addr byte) = &table->data[table->write] - 7789 8b/-> *esi 2/r32/edx - 7790 8d/copy-address *(ecx+edx) 2/r32/edx - 7791 { - 7792 $locate-typeinfo-entry-with-index:loop: - 7793 39/compare %ecx 2/r32/edx - 7794 73/jump-if-addr>= $locate-typeinfo-entry-with-index:abort/disp8 - 7795 # var v/eax: (addr typeinfo-entry) - 7796 (lookup *(ecx+8) *(ecx+0xc)) # => eax - 7797 # if (v->index == idx) return v - 7798 8b/-> *(eax+8) 3/r32/ebx # Typeinfo-entry-index - 7799 #? (write-buffered Stderr "comparing ") - 7800 #? (print-int32-buffered Stderr %ebx) - 7801 #? (write-buffered Stderr " and ") - 7802 #? (print-int32-buffered Stderr *(ebp+0xc)) - 7803 #? (write-buffered Stderr Newline) - 7804 #? (flush Stderr) - 7805 39/compare *(ebp+0xc) 3/r32/ebx - 7806 74/jump-if-= $locate-typeinfo-entry-with-index:end/disp8 - 7807 # curr += Typeinfo-entry-size - 7808 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-entry-size - 7809 # - 7810 eb/jump loop/disp8 - 7811 } - 7812 # return 0 - 7813 b8/copy-to-eax 0/imm32 - 7814 $locate-typeinfo-entry-with-index:end: - 7815 #? (write-buffered Stderr "returning ") - 7816 #? (print-int32-buffered Stderr %eax) - 7817 #? (write-buffered Stderr Newline) - 7818 #? (flush Stderr) - 7819 # . restore registers - 7820 5f/pop-to-edi - 7821 5e/pop-to-esi - 7822 5b/pop-to-ebx - 7823 5a/pop-to-edx - 7824 59/pop-to-ecx - 7825 # . epilogue - 7826 89/<- %esp 5/r32/ebp - 7827 5d/pop-to-ebp - 7828 c3/return - 7829 - 7830 $locate-typeinfo-entry-with-index:abort: - 7831 (write-buffered Stderr "overflowing typeinfo-entry->index ") - 7832 (print-int32-buffered Stderr %ecx) - 7833 (write-buffered Stderr "\n") - 7834 (flush Stderr) - 7835 # . syscall(exit, 1) - 7836 bb/copy-to-ebx 1/imm32 - 7837 b8/copy-to-eax 1/imm32/exit - 7838 cd/syscall 0x80/imm8 - 7839 # never gets here - 7840 - 7841 dump-typeinfos: # hdr: (addr array byte) - 7842 # . prologue - 7843 55/push-ebp - 7844 89/<- %ebp 4/r32/esp - 7845 # . save registers - 7846 50/push-eax - 7847 # - 7848 (write-buffered Stderr *(ebp+8)) - 7849 (flush Stderr) - 7850 # var curr/eax: (addr typeinfo) = lookup(Program->types) - 7851 (lookup *_Program-types *_Program-types->payload) # => eax - 7852 { - 7853 # if (curr == null) break - 7854 3d/compare-eax-and 0/imm32 - 7855 74/jump-if-= break/disp8 - 7856 (write-buffered Stderr "---\n") - 7857 (flush Stderr) - 7858 (dump-typeinfo %eax) - 7859 # curr = lookup(curr->next) - 7860 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax - 7861 eb/jump loop/disp8 - 7862 } - 7863 $dump-typeinfos:end: - 7864 # . restore registers - 7865 58/pop-to-eax - 7866 # . epilogue - 7867 89/<- %esp 5/r32/ebp - 7868 5d/pop-to-ebp - 7869 c3/return - 7870 - 7871 dump-typeinfo: # in: (addr typeinfo) - 7872 # . prologue - 7873 55/push-ebp - 7874 89/<- %ebp 4/r32/esp - 7875 # . save registers - 7876 50/push-eax - 7877 51/push-ecx - 7878 52/push-edx - 7879 53/push-ebx - 7880 56/push-esi - 7881 57/push-edi - 7882 # esi = in - 7883 8b/-> *(ebp+8) 6/r32/esi - 7884 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) - 7885 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax - 7886 89/<- %ecx 0/r32/eax - 7887 (write-buffered Stderr "id:") - 7888 (print-int32-buffered Stderr *esi) - 7889 (write-buffered Stderr "\n") - 7890 (write-buffered Stderr "fields @ ") - 7891 (print-int32-buffered Stderr %ecx) - 7892 (write-buffered Stderr Newline) - 7893 (flush Stderr) - 7894 (write-buffered Stderr " write: ") - 7895 (print-int32-buffered Stderr *ecx) - 7896 (write-buffered Stderr Newline) - 7897 (flush Stderr) - 7898 (write-buffered Stderr " read: ") - 7899 (print-int32-buffered Stderr *(ecx+4)) - 7900 (write-buffered Stderr Newline) - 7901 (flush Stderr) - 7902 (write-buffered Stderr " size: ") - 7903 (print-int32-buffered Stderr *(ecx+8)) - 7904 (write-buffered Stderr Newline) - 7905 (flush Stderr) - 7906 # var table-size/edx: int = table->write - 7907 8b/-> *ecx 2/r32/edx # stream-write - 7908 # var curr/ecx: (addr table_row) = table->data - 7909 8d/copy-address *(ecx+0xc) 1/r32/ecx - 7910 # var max/edx: (addr table_row) = table->data + table->write - 7911 8d/copy-address *(ecx+edx) 2/r32/edx - 7912 { - 7913 $dump-typeinfo:loop: - 7914 # if (curr >= max) break - 7915 39/compare %ecx 2/r32/edx - 7916 0f 83/jump-if-addr>= break/disp32 - 7917 (write-buffered Stderr " row:\n") - 7918 (write-buffered Stderr " key: ") - 7919 (print-int32-buffered Stderr *ecx) - 7920 (write-buffered Stderr ",") - 7921 (print-int32-buffered Stderr *(ecx+4)) - 7922 (write-buffered Stderr " = '") - 7923 (lookup *ecx *(ecx+4)) - 7924 (write-buffered Stderr %eax) - 7925 (write-buffered Stderr "' @ ") - 7926 (print-int32-buffered Stderr %eax) - 7927 (write-buffered Stderr Newline) - 7928 (flush Stderr) - 7929 (write-buffered Stderr " value: ") - 7930 (print-int32-buffered Stderr *(ecx+8)) - 7931 (write-buffered Stderr ",") - 7932 (print-int32-buffered Stderr *(ecx+0xc)) - 7933 (write-buffered Stderr " = typeinfo-entry@") - 7934 (lookup *(ecx+8) *(ecx+0xc)) - 7935 (print-int32-buffered Stderr %eax) - 7936 (write-buffered Stderr Newline) - 7937 (flush Stderr) - 7938 (write-buffered Stderr " input var@") - 7939 (print-int32-buffered Stderr *eax) - 7940 (write-buffered Stderr ",") - 7941 (print-int32-buffered Stderr *(eax+4)) - 7942 (write-buffered Stderr "->") - 7943 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var - 7944 (print-int32-buffered Stderr %eax) - 7945 { - 7946 3d/compare-eax-and 0/imm32 - 7947 74/jump-if-= break/disp8 - 7948 (write-buffered Stderr " ") - 7949 # TODO - 7950 } - 7951 (write-buffered Stderr Newline) - 7952 (flush Stderr) - 7953 (lookup *(ecx+8) *(ecx+0xc)) - 7954 (write-buffered Stderr " index: ") - 7955 (print-int32-buffered Stderr *(eax+8)) - 7956 (write-buffered Stderr Newline) - 7957 (flush Stderr) - 7958 (write-buffered Stderr " output var@") - 7959 (print-int32-buffered Stderr *(eax+0xc)) - 7960 (write-buffered Stderr ",") - 7961 (print-int32-buffered Stderr *(eax+0x10)) - 7962 (write-buffered Stderr "->") - 7963 (lookup *(eax+0xc) *(eax+0x10)) # Typeinfo-entry-output-var - 7964 (print-int32-buffered Stderr %eax) - 7965 (write-buffered Stderr Newline) - 7966 (flush Stderr) - 7967 { - 7968 3d/compare-eax-and 0/imm32 - 7969 0f 84/jump-if-= break/disp32 - 7970 (write-buffered Stderr " name: ") - 7971 89/<- %ebx 0/r32/eax - 7972 (print-int32-buffered Stderr *ebx) # Var-name - 7973 (write-buffered Stderr ",") - 7974 (print-int32-buffered Stderr *(ebx+4)) # Var-name - 7975 (write-buffered Stderr "->") - 7976 (lookup *ebx *(ebx+4)) # Var-name - 7977 (print-int32-buffered Stderr %eax) - 7978 { - 7979 3d/compare-eax-and 0/imm32 - 7980 74/jump-if-= break/disp8 - 7981 (write-buffered Stderr Space) - 7982 (write-buffered Stderr %eax) - 7983 } - 7984 (write-buffered Stderr Newline) - 7985 (flush Stderr) - 7986 (write-buffered Stderr " block depth: ") - 7987 (print-int32-buffered Stderr *(ebx+0x10)) # Var-block-depth - 7988 (write-buffered Stderr Newline) - 7989 (flush Stderr) - 7990 (write-buffered Stderr " stack offset: ") - 7991 (print-int32-buffered Stderr *(ebx+0x14)) # Var-offset - 7992 (write-buffered Stderr Newline) - 7993 (flush Stderr) - 7994 (write-buffered Stderr " reg: ") - 7995 (print-int32-buffered Stderr *(ebx+0x18)) # Var-register - 7996 (write-buffered Stderr ",") - 7997 (print-int32-buffered Stderr *(ebx+0x1c)) # Var-register - 7998 (write-buffered Stderr "->") - 7999 (flush Stderr) - 8000 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register - 8001 (print-int32-buffered Stderr %eax) - 8002 { - 8003 3d/compare-eax-and 0/imm32 - 8004 74/jump-if-= break/disp8 - 8005 (write-buffered Stderr Space) - 8006 (write-buffered Stderr %eax) - 8007 } - 8008 (write-buffered Stderr Newline) + 7504 $populate-mu-type:abort: + 7505 # error("unexpected top-level command: " word-slice "\n") + 7506 (write-buffered *(ebp+0x10) "incomplete type definition '") + 7507 (type-name *edi) # Typeinfo-id => eax + 7508 (write-buffered *(ebp+0x10) %eax) + 7509 (write-buffered *(ebp+0x10) "\n") + 7510 (flush *(ebp+0x10)) + 7511 (stop *(ebp+0x14) 1) + 7512 # never gets here + 7513 + 7514 type-name: # index: int -> result/eax: (addr array byte) + 7515 # . prologue + 7516 55/push-ebp + 7517 89/<- %ebp 4/r32/esp + 7518 # + 7519 (index Type-id *(ebp+8)) + 7520 $type-name:end: + 7521 # . epilogue + 7522 89/<- %esp 5/r32/ebp + 7523 5d/pop-to-ebp + 7524 c3/return + 7525 + 7526 index: # arr: (addr stream (handle array byte)), index: int -> result/eax: (addr array byte) + 7527 # . prologue + 7528 55/push-ebp + 7529 89/<- %ebp 4/r32/esp + 7530 # . save registers + 7531 56/push-esi + 7532 # TODO: bounds-check index + 7533 # esi = arr + 7534 8b/-> *(ebp+8) 6/r32/esi + 7535 # eax = index + 7536 8b/-> *(ebp+0xc) 0/r32/eax + 7537 # eax = *(arr + 12 + index) + 7538 8b/-> *(esi+eax+0xc) 0/r32/eax + 7539 $index:end: + 7540 # . restore registers + 7541 5e/pop-to-esi + 7542 # . epilogue + 7543 89/<- %esp 5/r32/ebp + 7544 5d/pop-to-ebp + 7545 c3/return + 7546 + 7547 ####################################################### + 7548 # Compute type sizes + 7549 ####################################################### + 7550 + 7551 # Compute the sizes of all user-defined types. + 7552 # We'll need the sizes of their elements, which may be other user-defined + 7553 # types, which we will compute as needed. + 7554 + 7555 # Initially, all user-defined types have their sizes set to -2 (invalid) + 7556 populate-mu-type-sizes: # err: (addr buffered-file), ed: (addr exit-descriptor) + 7557 # . prologue + 7558 55/push-ebp + 7559 89/<- %ebp 4/r32/esp + 7560 $populate-mu-type-sizes:total-sizes: + 7561 # var curr/eax: (addr typeinfo) = lookup(Program->types) + 7562 (lookup *_Program-types *_Program-types->payload) # => eax + 7563 { + 7564 # if (curr == null) break + 7565 3d/compare-eax-and 0/imm32/null + 7566 74/jump-if-= break/disp8 + 7567 (populate-mu-type-sizes-in-type %eax *(ebp+8) *(ebp+0xc)) + 7568 # curr = lookup(curr->next) + 7569 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax + 7570 eb/jump loop/disp8 + 7571 } + 7572 $populate-mu-type-sizes:offsets: + 7573 # curr = *Program->types + 7574 (lookup *_Program-types *_Program-types->payload) # => eax + 7575 { + 7576 # if (curr == null) break + 7577 3d/compare-eax-and 0/imm32/null + 7578 74/jump-if-= break/disp8 + 7579 (populate-mu-type-offsets %eax *(ebp+8) *(ebp+0xc)) + 7580 # curr = curr->next + 7581 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax + 7582 eb/jump loop/disp8 + 7583 } + 7584 $populate-mu-type-sizes:end: + 7585 # . epilogue + 7586 89/<- %esp 5/r32/ebp + 7587 5d/pop-to-ebp + 7588 c3/return + 7589 + 7590 # compute sizes of all fields, recursing as necessary + 7591 # sum up all their sizes to arrive at total size + 7592 # fields may be out of order, but that doesn't affect the answer + 7593 populate-mu-type-sizes-in-type: # T: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) + 7594 # . prologue + 7595 55/push-ebp + 7596 89/<- %ebp 4/r32/esp + 7597 # . save registers + 7598 50/push-eax + 7599 51/push-ecx + 7600 52/push-edx + 7601 56/push-esi + 7602 57/push-edi + 7603 # esi = T + 7604 8b/-> *(ebp+8) 6/r32/esi + 7605 # if T is already computed, return + 7606 81 7/subop/compare *(esi+0xc) 0/imm32 # Typeinfo-total-size-in-bytes + 7607 0f 8d/jump-if->= $populate-mu-type-sizes-in-type:end/disp32 + 7608 # if T is being computed, abort + 7609 81 7/subop/compare *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes + 7610 0f 84/jump-if-= $populate-mu-type-sizes-in-type:abort/disp32 + 7611 # tag T (-2 to -1) to avoid infinite recursion + 7612 c7 0/subop/copy *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes + 7613 # var total-size/edi: int = 0 + 7614 bf/copy-to-edi 0/imm32 + 7615 # - for every field, if it's a user-defined type, compute its size + 7616 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) + 7617 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax + 7618 89/<- %ecx 0/r32/eax + 7619 # var table-size/edx: int = table->write + 7620 8b/-> *ecx 2/r32/edx # stream-write + 7621 # var curr/ecx: (addr table_row) = table->data + 7622 8d/copy-address *(ecx+0xc) 1/r32/ecx + 7623 # var max/edx: (addr table_row) = table->data + table->write + 7624 8d/copy-address *(ecx+edx) 2/r32/edx + 7625 { + 7626 $populate-mu-type-sizes-in-type:loop: + 7627 # if (curr >= max) break + 7628 39/compare %ecx 2/r32/edx + 7629 73/jump-if-addr>= break/disp8 + 7630 # var t/eax: (addr typeinfo-entry) = lookup(curr->value) + 7631 (lookup *(ecx+8) *(ecx+0xc)) # => eax + 7632 # compute size of t->input-var + 7633 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax + 7634 (compute-size-of-var %eax) # => eax + 7635 # result += eax + 7636 01/add-to %edi 0/r32/eax + 7637 # curr += row-size + 7638 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size + 7639 # + 7640 eb/jump loop/disp8 + 7641 } + 7642 # - save result + 7643 89/<- *(esi+0xc) 7/r32/edi # Typeinfo-total-size-in-bytes + 7644 $populate-mu-type-sizes-in-type:end: + 7645 # . restore registers + 7646 5f/pop-to-edi + 7647 5e/pop-to-esi + 7648 5a/pop-to-edx + 7649 59/pop-to-ecx + 7650 58/pop-to-eax + 7651 # . epilogue + 7652 89/<- %esp 5/r32/ebp + 7653 5d/pop-to-ebp + 7654 c3/return + 7655 + 7656 $populate-mu-type-sizes-in-type:abort: + 7657 (write-buffered *(ebp+0xc) "cycle in type definitions\n") + 7658 (flush *(ebp+0xc)) + 7659 (stop *(ebp+0x10) 1) + 7660 # never gets here + 7661 + 7662 # Analogous to size-of, except we need to compute what size-of can just read + 7663 # off the right data structures. + 7664 compute-size-of-var: # in: (addr var) -> result/eax: int + 7665 # . prologue + 7666 55/push-ebp + 7667 89/<- %ebp 4/r32/esp + 7668 # . push registers + 7669 51/push-ecx + 7670 # var t/ecx: (addr tree type-id) = lookup(v->type) + 7671 8b/-> *(ebp+8) 1/r32/ecx + 7672 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 7673 89/<- %ecx 0/r32/eax + 7674 # if (t->is-atom == false) t = lookup(t->left) + 7675 { + 7676 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom + 7677 75/jump-if-!= break/disp8 + 7678 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax + 7679 89/<- %ecx 0/r32/eax + 7680 } + 7681 # TODO: ensure t is an atom + 7682 (compute-size-of-type-id *(ecx+4)) # Tree-value => eax + 7683 $compute-size-of-var:end: + 7684 # . restore registers + 7685 59/pop-to-ecx + 7686 # . epilogue + 7687 89/<- %esp 5/r32/ebp + 7688 5d/pop-to-ebp + 7689 c3/return + 7690 + 7691 compute-size-of-type-id: # t: type-id -> result/eax: int + 7692 # . prologue + 7693 55/push-ebp + 7694 89/<- %ebp 4/r32/esp + 7695 # . save registers + 7696 51/push-ecx + 7697 # var out/ecx: (handle typeinfo) + 7698 68/push 0/imm32 + 7699 68/push 0/imm32 + 7700 89/<- %ecx 4/r32/esp + 7701 # eax = t + 7702 8b/-> *(ebp+8) 0/r32/eax + 7703 # if v is a literal, return 0 + 7704 3d/compare-eax-and 0/imm32 + 7705 74/jump-if-= $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int + 7706 # if v has a user-defined type, compute its size + 7707 # TODO: support non-atom type + 7708 (find-typeinfo %eax %ecx) + 7709 { + 7710 81 7/subop/compare *ecx 0/imm32 + 7711 74/jump-if-= break/disp8 + 7712 $compute-size-of-type-id:user-defined: + 7713 (populate-mu-type-sizes %eax) + 7714 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes + 7715 eb/jump $compute-size-of-type-id:end/disp8 + 7716 } + 7717 # otherwise return the word size + 7718 b8/copy-to-eax 4/imm32 + 7719 $compute-size-of-type-id:end: + 7720 # . reclaim locals + 7721 81 0/subop/add %esp 8/imm32 + 7722 # . restore registers + 7723 59/pop-to-ecx + 7724 # . epilogue + 7725 89/<- %esp 5/r32/ebp + 7726 5d/pop-to-ebp + 7727 c3/return + 7728 + 7729 # at this point we have total sizes for all user-defined types + 7730 # compute offsets for each element + 7731 # complication: fields may be out of order + 7732 populate-mu-type-offsets: # in: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) + 7733 # . prologue + 7734 55/push-ebp + 7735 89/<- %ebp 4/r32/esp + 7736 # . save registers + 7737 50/push-eax + 7738 51/push-ecx + 7739 52/push-edx + 7740 53/push-ebx + 7741 56/push-esi + 7742 57/push-edi + 7743 #? (dump-typeinfos "aaa\n") + 7744 # var curr-offset/edi: int = 0 + 7745 bf/copy-to-edi 0/imm32 + 7746 # var table/ecx: (addr table string_key (handle typeinfo-entry)) = lookup(in->fields) + 7747 8b/-> *(ebp+8) 1/r32/ecx + 7748 (lookup *(ecx+4) *(ecx+8)) # Typeinfo-fields Typeinfo-fields => eax + 7749 89/<- %ecx 0/r32/eax + 7750 # var num-elems/edx: int = table->write / Typeinfo-fields-row-size + 7751 8b/-> *ecx 2/r32/edx # stream-write + 7752 c1 5/subop/shift-right-logical %edx 4/imm8 + 7753 # var i/ebx: int = 0 + 7754 bb/copy-to-ebx 0/imm32 + 7755 { + 7756 $populate-mu-type-offsets:loop: + 7757 39/compare %ebx 2/r32/edx + 7758 7d/jump-if->= break/disp8 + 7759 #? (write-buffered Stderr "looking up index ") + 7760 #? (print-int32-buffered Stderr %ebx) + 7761 #? (write-buffered Stderr " in ") + 7762 #? (print-int32-buffered Stderr *(ebp+8)) + 7763 #? (write-buffered Stderr Newline) + 7764 #? (flush Stderr) + 7765 # var v/esi: (addr typeinfo-entry) + 7766 (locate-typeinfo-entry-with-index %ecx %ebx *(ebp+0xc) *(ebp+0x10)) # => eax + 7767 89/<- %esi 0/r32/eax + 7768 # v->output-var->offset = curr-offset + 7769 # . eax: (addr var) + 7770 (lookup *(esi+0xc) *(esi+0x10)) # Typeinfo-entry-output-var Typeinfo-entry-output-var => eax + 7771 89/<- *(eax+0x14) 7/r32/edi # Var-offset + 7772 # curr-offset += size-of(v->input-var) + 7773 (lookup *esi *(esi+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax + 7774 (size-of %eax) # => eax + 7775 01/add-to %edi 0/r32/eax + 7776 # ++i + 7777 43/increment-ebx + 7778 eb/jump loop/disp8 + 7779 } + 7780 $populate-mu-type-offsets:end: + 7781 # . restore registers + 7782 5f/pop-to-edi + 7783 5e/pop-to-esi + 7784 5b/pop-to-ebx + 7785 5a/pop-to-edx + 7786 59/pop-to-ecx + 7787 58/pop-to-eax + 7788 # . epilogue + 7789 89/<- %esp 5/r32/ebp + 7790 5d/pop-to-ebp + 7791 c3/return + 7792 + 7793 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) + 7794 # . prologue + 7795 55/push-ebp + 7796 89/<- %ebp 4/r32/esp + 7797 # . save registers + 7798 51/push-ecx + 7799 52/push-edx + 7800 53/push-ebx + 7801 56/push-esi + 7802 57/push-edi + 7803 # esi = table + 7804 8b/-> *(ebp+8) 6/r32/esi + 7805 # var curr/ecx: (addr row (handle array byte) (handle typeinfo-entry)) = table->data + 7806 8d/copy-address *(esi+0xc) 1/r32/ecx + 7807 # var max/edx: (addr byte) = &table->data[table->write] + 7808 8b/-> *esi 2/r32/edx + 7809 8d/copy-address *(ecx+edx) 2/r32/edx + 7810 { + 7811 $locate-typeinfo-entry-with-index:loop: + 7812 39/compare %ecx 2/r32/edx + 7813 73/jump-if-addr>= $locate-typeinfo-entry-with-index:abort/disp8 + 7814 # var v/eax: (addr typeinfo-entry) + 7815 (lookup *(ecx+8) *(ecx+0xc)) # => eax + 7816 # if (v->index == idx) return v + 7817 8b/-> *(eax+8) 3/r32/ebx # Typeinfo-entry-index + 7818 #? (write-buffered Stderr "comparing ") + 7819 #? (print-int32-buffered Stderr %ebx) + 7820 #? (write-buffered Stderr " and ") + 7821 #? (print-int32-buffered Stderr *(ebp+0xc)) + 7822 #? (write-buffered Stderr Newline) + 7823 #? (flush Stderr) + 7824 39/compare *(ebp+0xc) 3/r32/ebx + 7825 74/jump-if-= $locate-typeinfo-entry-with-index:end/disp8 + 7826 # curr += Typeinfo-entry-size + 7827 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-entry-size + 7828 # + 7829 eb/jump loop/disp8 + 7830 } + 7831 # return 0 + 7832 b8/copy-to-eax 0/imm32 + 7833 $locate-typeinfo-entry-with-index:end: + 7834 #? (write-buffered Stderr "returning ") + 7835 #? (print-int32-buffered Stderr %eax) + 7836 #? (write-buffered Stderr Newline) + 7837 #? (flush Stderr) + 7838 # . restore registers + 7839 5f/pop-to-edi + 7840 5e/pop-to-esi + 7841 5b/pop-to-ebx + 7842 5a/pop-to-edx + 7843 59/pop-to-ecx + 7844 # . epilogue + 7845 89/<- %esp 5/r32/ebp + 7846 5d/pop-to-ebp + 7847 c3/return + 7848 + 7849 $locate-typeinfo-entry-with-index:abort: + 7850 (write-buffered *(ebp+0x10) "overflowing typeinfo-entry->index ") + 7851 (print-int32-buffered *(ebp+0x10) %ecx) + 7852 (write-buffered *(ebp+0x10) "\n") + 7853 (flush *(ebp+0x10)) + 7854 (stop *(ebp+0x14) 1) + 7855 # never gets here + 7856 + 7857 dump-typeinfos: # hdr: (addr array byte) + 7858 # . prologue + 7859 55/push-ebp + 7860 89/<- %ebp 4/r32/esp + 7861 # . save registers + 7862 50/push-eax + 7863 # + 7864 (write-buffered Stderr *(ebp+8)) + 7865 (flush Stderr) + 7866 # var curr/eax: (addr typeinfo) = lookup(Program->types) + 7867 (lookup *_Program-types *_Program-types->payload) # => eax + 7868 { + 7869 # if (curr == null) break + 7870 3d/compare-eax-and 0/imm32 + 7871 74/jump-if-= break/disp8 + 7872 (write-buffered Stderr "---\n") + 7873 (flush Stderr) + 7874 (dump-typeinfo %eax) + 7875 # curr = lookup(curr->next) + 7876 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax + 7877 eb/jump loop/disp8 + 7878 } + 7879 $dump-typeinfos:end: + 7880 # . restore registers + 7881 58/pop-to-eax + 7882 # . epilogue + 7883 89/<- %esp 5/r32/ebp + 7884 5d/pop-to-ebp + 7885 c3/return + 7886 + 7887 dump-typeinfo: # in: (addr typeinfo) + 7888 # . prologue + 7889 55/push-ebp + 7890 89/<- %ebp 4/r32/esp + 7891 # . save registers + 7892 50/push-eax + 7893 51/push-ecx + 7894 52/push-edx + 7895 53/push-ebx + 7896 56/push-esi + 7897 57/push-edi + 7898 # esi = in + 7899 8b/-> *(ebp+8) 6/r32/esi + 7900 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) + 7901 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax + 7902 89/<- %ecx 0/r32/eax + 7903 (write-buffered Stderr "id:") + 7904 (print-int32-buffered Stderr *esi) + 7905 (write-buffered Stderr "\n") + 7906 (write-buffered Stderr "fields @ ") + 7907 (print-int32-buffered Stderr %ecx) + 7908 (write-buffered Stderr Newline) + 7909 (flush Stderr) + 7910 (write-buffered Stderr " write: ") + 7911 (print-int32-buffered Stderr *ecx) + 7912 (write-buffered Stderr Newline) + 7913 (flush Stderr) + 7914 (write-buffered Stderr " read: ") + 7915 (print-int32-buffered Stderr *(ecx+4)) + 7916 (write-buffered Stderr Newline) + 7917 (flush Stderr) + 7918 (write-buffered Stderr " size: ") + 7919 (print-int32-buffered Stderr *(ecx+8)) + 7920 (write-buffered Stderr Newline) + 7921 (flush Stderr) + 7922 # var table-size/edx: int = table->write + 7923 8b/-> *ecx 2/r32/edx # stream-write + 7924 # var curr/ecx: (addr table_row) = table->data + 7925 8d/copy-address *(ecx+0xc) 1/r32/ecx + 7926 # var max/edx: (addr table_row) = table->data + table->write + 7927 8d/copy-address *(ecx+edx) 2/r32/edx + 7928 { + 7929 $dump-typeinfo:loop: + 7930 # if (curr >= max) break + 7931 39/compare %ecx 2/r32/edx + 7932 0f 83/jump-if-addr>= break/disp32 + 7933 (write-buffered Stderr " row:\n") + 7934 (write-buffered Stderr " key: ") + 7935 (print-int32-buffered Stderr *ecx) + 7936 (write-buffered Stderr ",") + 7937 (print-int32-buffered Stderr *(ecx+4)) + 7938 (write-buffered Stderr " = '") + 7939 (lookup *ecx *(ecx+4)) + 7940 (write-buffered Stderr %eax) + 7941 (write-buffered Stderr "' @ ") + 7942 (print-int32-buffered Stderr %eax) + 7943 (write-buffered Stderr Newline) + 7944 (flush Stderr) + 7945 (write-buffered Stderr " value: ") + 7946 (print-int32-buffered Stderr *(ecx+8)) + 7947 (write-buffered Stderr ",") + 7948 (print-int32-buffered Stderr *(ecx+0xc)) + 7949 (write-buffered Stderr " = typeinfo-entry@") + 7950 (lookup *(ecx+8) *(ecx+0xc)) + 7951 (print-int32-buffered Stderr %eax) + 7952 (write-buffered Stderr Newline) + 7953 (flush Stderr) + 7954 (write-buffered Stderr " input var@") + 7955 (print-int32-buffered Stderr *eax) + 7956 (write-buffered Stderr ",") + 7957 (print-int32-buffered Stderr *(eax+4)) + 7958 (write-buffered Stderr "->") + 7959 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var + 7960 (print-int32-buffered Stderr %eax) + 7961 { + 7962 3d/compare-eax-and 0/imm32 + 7963 74/jump-if-= break/disp8 + 7964 (write-buffered Stderr " ") + 7965 # TODO + 7966 } + 7967 (write-buffered Stderr Newline) + 7968 (flush Stderr) + 7969 (lookup *(ecx+8) *(ecx+0xc)) + 7970 (write-buffered Stderr " index: ") + 7971 (print-int32-buffered Stderr *(eax+8)) + 7972 (write-buffered Stderr Newline) + 7973 (flush Stderr) + 7974 (write-buffered Stderr " output var@") + 7975 (print-int32-buffered Stderr *(eax+0xc)) + 7976 (write-buffered Stderr ",") + 7977 (print-int32-buffered Stderr *(eax+0x10)) + 7978 (write-buffered Stderr "->") + 7979 (lookup *(eax+0xc) *(eax+0x10)) # Typeinfo-entry-output-var + 7980 (print-int32-buffered Stderr %eax) + 7981 (write-buffered Stderr Newline) + 7982 (flush Stderr) + 7983 { + 7984 3d/compare-eax-and 0/imm32 + 7985 0f 84/jump-if-= break/disp32 + 7986 (write-buffered Stderr " name: ") + 7987 89/<- %ebx 0/r32/eax + 7988 (print-int32-buffered Stderr *ebx) # Var-name + 7989 (write-buffered Stderr ",") + 7990 (print-int32-buffered Stderr *(ebx+4)) # Var-name + 7991 (write-buffered Stderr "->") + 7992 (lookup *ebx *(ebx+4)) # Var-name + 7993 (print-int32-buffered Stderr %eax) + 7994 { + 7995 3d/compare-eax-and 0/imm32 + 7996 74/jump-if-= break/disp8 + 7997 (write-buffered Stderr Space) + 7998 (write-buffered Stderr %eax) + 7999 } + 8000 (write-buffered Stderr Newline) + 8001 (flush Stderr) + 8002 (write-buffered Stderr " block depth: ") + 8003 (print-int32-buffered Stderr *(ebx+0x10)) # Var-block-depth + 8004 (write-buffered Stderr Newline) + 8005 (flush Stderr) + 8006 (write-buffered Stderr " stack offset: ") + 8007 (print-int32-buffered Stderr *(ebx+0x14)) # Var-offset + 8008 (write-buffered Stderr Newline) 8009 (flush Stderr) - 8010 } - 8011 (flush Stderr) - 8012 # curr += row-size - 8013 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size - 8014 # - 8015 e9/jump loop/disp32 - 8016 } - 8017 $dump-typeinfo:end: - 8018 # . restore registers - 8019 5f/pop-to-edi - 8020 5e/pop-to-esi - 8021 5b/pop-to-ebx - 8022 5a/pop-to-edx - 8023 59/pop-to-ecx - 8024 58/pop-to-eax - 8025 # . epilogue - 8026 89/<- %esp 5/r32/ebp - 8027 5d/pop-to-ebp - 8028 c3/return - 8029 - 8030 ####################################################### - 8031 # Type-checking - 8032 ####################################################### - 8033 - 8034 check-mu-types: - 8035 # . prologue - 8036 55/push-ebp - 8037 89/<- %ebp 4/r32/esp - 8038 # - 8039 $check-mu-types:end: - 8040 # . epilogue - 8041 89/<- %esp 5/r32/ebp - 8042 5d/pop-to-ebp - 8043 c3/return - 8044 - 8045 size-of: # v: (addr var) -> result/eax: int - 8046 # . prologue - 8047 55/push-ebp - 8048 89/<- %ebp 4/r32/esp - 8049 # . save registers - 8050 51/push-ecx - 8051 # var t/ecx: (addr tree type-id) = lookup(v->type) - 8052 8b/-> *(ebp+8) 1/r32/ecx - 8053 #? (write-buffered Stderr "size-of ") - 8054 #? (print-int32-buffered Stderr %ecx) - 8055 #? (write-buffered Stderr Newline) - 8056 #? (write-buffered Stderr "type allocid: ") - 8057 #? (print-int32-buffered Stderr *(ecx+8)) - 8058 #? (write-buffered Stderr Newline) - 8059 #? (flush Stderr) - 8060 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 8061 89/<- %ecx 0/r32/eax - 8062 # if is-mu-array?(t) return size-of-array(t) - 8063 { - 8064 (is-mu-array? %ecx) # => eax - 8065 3d/compare-eax-and 0/imm32/false - 8066 74/jump-if-= break/disp8 - 8067 (size-of-array %ecx) # => eax - 8068 eb/jump $size-of:end/disp8 - 8069 } - 8070 # if (!t->is-atom?) t = lookup(t->left) - 8071 { - 8072 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom - 8073 75/jump-if-!= break/disp8 - 8074 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax - 8075 89/<- %ecx 0/r32/eax - 8076 } - 8077 # TODO: assert t->is-atom? - 8078 (size-of-type-id *(ecx+4)) # Tree-value => eax - 8079 $size-of:end: - 8080 # . restore registers - 8081 59/pop-to-ecx - 8082 # . epilogue - 8083 89/<- %esp 5/r32/ebp - 8084 5d/pop-to-ebp - 8085 c3/return - 8086 - 8087 size-of-deref: # v: (addr var) -> result/eax: int - 8088 # . prologue - 8089 55/push-ebp - 8090 89/<- %ebp 4/r32/esp - 8091 # . save registers - 8092 51/push-ecx - 8093 # var t/ecx: (addr tree type-id) = lookup(v->type) - 8094 8b/-> *(ebp+8) 1/r32/ecx - 8095 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 8096 89/<- %ecx 0/r32/eax - 8097 # TODO: assert(t is an addr) - 8098 # t = lookup(t->right) - 8099 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax - 8100 89/<- %ecx 0/r32/eax - 8101 # if is-mu-array?(t) return size-of-array(t) - 8102 { - 8103 (is-mu-array? %ecx) # => eax - 8104 3d/compare-eax-and 0/imm32/false - 8105 74/jump-if-= break/disp8 - 8106 (size-of-array %ecx) # => eax - 8107 eb/jump $size-of:end/disp8 - 8108 } - 8109 # if (!t->is-atom?) t = lookup(t->left) - 8110 { - 8111 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom - 8112 75/jump-if-!= break/disp8 - 8113 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax - 8114 89/<- %ecx 0/r32/eax - 8115 } - 8116 # TODO: assert t->is-atom? - 8117 (size-of-type-id *(ecx+4)) # Tree-value => eax - 8118 $size-of-deref:end: - 8119 # . restore registers - 8120 59/pop-to-ecx - 8121 # . epilogue - 8122 89/<- %esp 5/r32/ebp - 8123 5d/pop-to-ebp - 8124 c3/return - 8125 - 8126 is-mu-array?: # t: (addr tree type-id) -> result/eax: boolean - 8127 # . prologue - 8128 55/push-ebp - 8129 89/<- %ebp 4/r32/esp - 8130 # . save registers - 8131 51/push-ecx - 8132 # ecx = t - 8133 8b/-> *(ebp+8) 1/r32/ecx - 8134 # if t->is-atom?, return false - 8135 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom - 8136 75/jump-if-!= $is-mu-array?:return-false/disp8 - 8137 # if !t->left->is-atom?, return false - 8138 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax - 8139 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom - 8140 74/jump-if-= $is-mu-array?:return-false/disp8 - 8141 # return t->left->value == array - 8142 81 7/subop/compare *(eax+4) 3/imm32/array-type-id # Tree-value - 8143 0f 94/set-if-= %al - 8144 81 4/subop/and %eax 0xff/imm32 - 8145 eb/jump $is-mu-array?:end/disp8 - 8146 $is-mu-array?:return-false: - 8147 b8/copy-to-eax 0/imm32/false - 8148 $is-mu-array?:end: - 8149 # . restore registers - 8150 59/pop-to-ecx - 8151 # . epilogue - 8152 89/<- %esp 5/r32/ebp - 8153 5d/pop-to-ebp - 8154 c3/return - 8155 - 8156 size-of-array: # a: (addr tree type-id) -> result/eax: int - 8157 # . prologue - 8158 55/push-ebp - 8159 89/<- %ebp 4/r32/esp - 8160 # . save registers - 8161 51/push-ecx - 8162 52/push-edx - 8163 # - 8164 8b/-> *(ebp+8) 1/r32/ecx - 8165 # TODO: assert that a->left is 'array' - 8166 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax - 8167 89/<- %ecx 0/r32/eax - 8168 # var elem-type/edx: type-id = a->right->left->value - 8169 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax - 8170 8b/-> *(eax+4) 2/r32/edx # Tree-value - 8171 # var array-size/ecx: int = a->right->right->left->value - 8172 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax - 8173 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax - 8174 8b/-> *(eax+4) 1/r32/ecx # Tree-value - 8175 # return array-size * size-of(elem-type) - 8176 (size-of-type-id %edx) # => eax - 8177 f7 4/subop/multiply-into-eax %ecx - 8178 05/add-to-eax 4/imm32 # for array size - 8179 $size-of-array:end: - 8180 # . restore registers - 8181 5a/pop-to-edx - 8182 59/pop-to-ecx - 8183 # . epilogue - 8184 89/<- %esp 5/r32/ebp - 8185 5d/pop-to-ebp - 8186 c3/return - 8187 - 8188 size-of-type-id: # t: type-id -> result/eax: int - 8189 # . prologue - 8190 55/push-ebp - 8191 89/<- %ebp 4/r32/esp - 8192 # . save registers - 8193 51/push-ecx - 8194 # var out/ecx: (handle typeinfo) - 8195 68/push 0/imm32 - 8196 68/push 0/imm32 - 8197 89/<- %ecx 4/r32/esp - 8198 # eax = t - 8199 8b/-> *(ebp+8) 0/r32/eax - 8200 # if t is a literal, return 0 - 8201 3d/compare-eax-and 0/imm32 - 8202 74/jump-if-= $size-of-type-id:end/disp8 # eax changes type from type-id to int - 8203 # if t is a handle, return 8 - 8204 3d/compare-eax-and 4/imm32/handle - 8205 { - 8206 75/jump-if-!= break/disp8 - 8207 b8/copy-to-eax 8/imm32 - 8208 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int - 8209 } - 8210 # if t is a user-defined type, return its size - 8211 # TODO: support non-atom type - 8212 (find-typeinfo %eax %ecx) - 8213 { - 8214 81 7/subop/compare *ecx 0/imm32 - 8215 74/jump-if-= break/disp8 - 8216 $size-of-type-id:user-defined: - 8217 (lookup *ecx *(ecx+4)) # => eax - 8218 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes - 8219 eb/jump $size-of-type-id:end/disp8 - 8220 } - 8221 # otherwise return the word size - 8222 b8/copy-to-eax 4/imm32 - 8223 $size-of-type-id:end: - 8224 # . reclaim locals - 8225 81 0/subop/add %esp 8/imm32 - 8226 # . restore registers - 8227 59/pop-to-ecx - 8228 # . epilogue - 8229 89/<- %esp 5/r32/ebp - 8230 5d/pop-to-ebp - 8231 c3/return - 8232 - 8233 type-equal?: # a: (addr tree type-id), b: (addr tree type-id) -> result/eax: boolean - 8234 # . prologue - 8235 55/push-ebp - 8236 89/<- %ebp 4/r32/esp - 8237 # . save registers - 8238 51/push-ecx - 8239 52/push-edx - 8240 # ecx = a - 8241 8b/-> *(ebp+8) 1/r32/ecx - 8242 # edx = b - 8243 8b/-> *(ebp+0xc) 2/r32/edx - 8244 # if (a == b) return true - 8245 8b/-> %ecx 0/r32/eax # Var-type - 8246 39/compare %edx 0/r32/eax # Var-type - 8247 b8/copy-to-eax 1/imm32/true - 8248 74/jump-if-= $type-equal?:end/disp8 - 8249 # if (a < MAX_TYPE_ID) return false - 8250 81 7/subop/compare %ecx 0x10000/imm32 - 8251 b8/copy-to-eax 0/imm32/false - 8252 72/jump-if-addr< $type-equal?:end/disp8 - 8253 # if (b < MAX_TYPE_ID) return false - 8254 81 7/subop/compare %edx 0x10000/imm32 - 8255 b8/copy-to-eax 0/imm32/false - 8256 72/jump-if-addr< $type-equal?:end/disp8 - 8257 # if (!type-equal?(a->left, b->left)) return false - 8258 (type-equal? *(ecx+4) *(edx+4)) # Tree-left, Tree-left => eax - 8259 3d/compare-eax-and 0/imm32/false - 8260 74/jump-if-= $type-equal?:end/disp8 - 8261 # return type-equal?(a->right, b->right) - 8262 (type-equal? *(ecx+8) *(edx+8)) # Tree-right, Tree-right => eax - 8263 $type-equal?:end: - 8264 # . restore registers - 8265 5a/pop-to-edx - 8266 59/pop-to-ecx - 8267 # . epilogue - 8268 89/<- %esp 5/r32/ebp - 8269 5d/pop-to-ebp - 8270 c3/return - 8271 - 8272 ####################################################### - 8273 # Code-generation - 8274 ####################################################### - 8275 - 8276 == data - 8277 - 8278 Curr-block-depth: # (addr int) - 8279 0/imm32 - 8280 Curr-local-stack-offset: # (addr int) - 8281 0/imm32 - 8282 - 8283 == code - 8284 - 8285 emit-subx: # out: (addr buffered-file) - 8286 # . prologue - 8287 55/push-ebp - 8288 89/<- %ebp 4/r32/esp - 8289 # . save registers - 8290 50/push-eax - 8291 # var curr/eax: (addr function) = *Program->functions - 8292 (lookup *_Program-functions *_Program-functions->payload) # => eax - 8293 { - 8294 # if (curr == null) break - 8295 3d/compare-eax-and 0/imm32 - 8296 0f 84/jump-if-= break/disp32 - 8297 (emit-subx-function *(ebp+8) %eax) - 8298 # curr = lookup(curr->next) - 8299 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax - 8300 e9/jump loop/disp32 - 8301 } - 8302 $emit-subx:end: - 8303 # . restore registers - 8304 58/pop-to-eax - 8305 # . epilogue - 8306 89/<- %esp 5/r32/ebp - 8307 5d/pop-to-ebp - 8308 c3/return - 8309 - 8310 emit-subx-function: # out: (addr buffered-file), f: (addr function) - 8311 # . prologue - 8312 55/push-ebp - 8313 89/<- %ebp 4/r32/esp - 8314 # some preprocessing - 8315 (populate-mu-type-offsets-in-inouts *(ebp+0xc)) - 8316 # . save registers - 8317 50/push-eax - 8318 51/push-ecx - 8319 52/push-edx - 8320 57/push-edi - 8321 # initialize some global state - 8322 c7 0/subop/copy *Curr-block-depth 1/imm32 - 8323 c7 0/subop/copy *Curr-local-stack-offset 0/imm32 - 8324 # ecx = f - 8325 8b/-> *(ebp+0xc) 1/r32/ecx - 8326 # var vars/edx: (stack (addr var) 256) - 8327 81 5/subop/subtract %esp 0xc00/imm32 - 8328 68/push 0xc00/imm32/size - 8329 68/push 0/imm32/top - 8330 89/<- %edx 4/r32/esp - 8331 # var name/eax: (addr array byte) = lookup(f->name) - 8332 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax - 8333 # - 8334 (write-buffered *(ebp+8) %eax) - 8335 (write-buffered *(ebp+8) ":\n") - 8336 (emit-subx-prologue *(ebp+8)) - 8337 # var outputs/edi: (addr list var) = lookup(f->outputs) - 8338 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax - 8339 89/<- %edi 0/r32/eax - 8340 # var body/eax: (addr block) = lookup(f->body) - 8341 (lookup *(ecx+0x18) *(ecx+0x1c)) # Function-body Function-body => eax - 8342 # - 8343 (emit-subx-block *(ebp+8) %eax %edx %edi) - 8344 (emit-subx-epilogue *(ebp+8)) - 8345 # TODO: validate that *Curr-block-depth and *Curr-local-stack-offset have - 8346 # been cleaned up - 8347 $emit-subx-function:end: - 8348 # . reclaim locals - 8349 81 0/subop/add %esp 0xc08/imm32 - 8350 # . restore registers - 8351 5f/pop-to-edi - 8352 5a/pop-to-edx - 8353 59/pop-to-ecx - 8354 58/pop-to-eax - 8355 # . epilogue - 8356 89/<- %esp 5/r32/ebp - 8357 5d/pop-to-ebp - 8358 c3/return - 8359 - 8360 populate-mu-type-offsets-in-inouts: # f: (addr function) - 8361 # . prologue - 8362 55/push-ebp - 8363 89/<- %ebp 4/r32/esp - 8364 # . save registers - 8365 50/push-eax - 8366 51/push-ecx - 8367 52/push-edx - 8368 53/push-ebx - 8369 57/push-edi - 8370 # var next-offset/edx: int = 8 - 8371 ba/copy-to-edx 8/imm32 - 8372 # var curr/ecx: (addr list var) = lookup(f->inouts) - 8373 8b/-> *(ebp+8) 1/r32/ecx - 8374 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax - 8375 89/<- %ecx 0/r32/eax - 8376 { - 8377 $populate-mu-type-offsets-in-inouts:loop: - 8378 81 7/subop/compare %ecx 0/imm32 - 8379 74/jump-if-= break/disp8 - 8380 # var v/ebx: (addr var) = lookup(curr->value) - 8381 (lookup *ecx *(ecx+4)) # List-value List-value => eax - 8382 89/<- %ebx 0/r32/eax - 8383 #? (lookup *ebx *(ebx+4)) - 8384 #? (write-buffered Stderr "setting offset of fn inout ") - 8385 #? (write-buffered Stderr %eax) - 8386 #? (write-buffered Stderr "@") - 8387 #? (print-int32-buffered Stderr %ebx) - 8388 #? (write-buffered Stderr " to ") - 8389 #? (print-int32-buffered Stderr %edx) - 8390 #? (write-buffered Stderr Newline) - 8391 #? (flush Stderr) - 8392 # v->offset = next-offset - 8393 89/<- *(ebx+0x14) 2/r32/edx # Var-offset - 8394 # next-offset += size-of(v) - 8395 (size-of %ebx) # => eax - 8396 01/add-to %edx 0/r32/eax - 8397 # curr = lookup(curr->next) - 8398 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax - 8399 89/<- %ecx 0/r32/eax - 8400 # - 8401 eb/jump loop/disp8 - 8402 } - 8403 $populate-mu-type-offsets-in-inouts:end: - 8404 # . restore registers - 8405 5f/pop-to-edi - 8406 5b/pop-to-ebx - 8407 5a/pop-to-edx - 8408 59/pop-to-ecx - 8409 58/pop-to-eax - 8410 # . epilogue - 8411 89/<- %esp 5/r32/ebp - 8412 5d/pop-to-ebp - 8413 c3/return - 8414 - 8415 emit-subx-stmt-list: # out: (addr buffered-file), stmts: (addr list stmt), vars: (addr stack live-var), fn-outputs: (addr list var) - 8416 # . prologue - 8417 55/push-ebp - 8418 89/<- %ebp 4/r32/esp - 8419 # . save registers - 8420 50/push-eax - 8421 51/push-ecx - 8422 53/push-ebx - 8423 56/push-esi - 8424 # esi = stmts - 8425 8b/-> *(ebp+0xc) 6/r32/esi - 8426 # - 8427 { - 8428 $emit-subx-stmt-list:loop: - 8429 81 7/subop/compare %esi 0/imm32 - 8430 0f 84/jump-if-= break/disp32 - 8431 # var curr-stmt/ecx: (addr stmt) = lookup(stmts->value) - 8432 (lookup *esi *(esi+4)) # List-value List-value => eax - 8433 89/<- %ecx 0/r32/eax - 8434 { - 8435 $emit-subx-stmt-list:check-for-block: - 8436 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag - 8437 75/jump-if-!= break/disp8 - 8438 $emit-subx-stmt-list:block: - 8439 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10) *(ebp+0x14)) - 8440 } - 8441 { - 8442 $emit-subx-stmt-list:check-for-stmt: - 8443 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag - 8444 0f 85/jump-if-!= break/disp32 - 8445 $emit-subx-stmt-list:stmt1: - 8446 { - 8447 (is-mu-branch? %ecx) # => eax - 8448 3d/compare-eax-and 0/imm32/false - 8449 0f 84/jump-if-= break/disp32 - 8450 $emit-subx-stmt-list:branch-stmt: - 8451 +-- 27 lines: # unconditional loops ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8478 +-- 16 lines: # unconditional breaks --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8494 +-- 38 lines: # simple conditional branches without a target --------------------------------------------------------------------------------------------------------------------------------------------------- - 8532 +-- 19 lines: # conditional branches with an explicit target --------------------------------------------------------------------------------------------------------------------------------------------------- - 8551 } - 8552 $emit-subx-stmt-list:1-to-1: - 8553 (emit-subx-stmt *(ebp+8) %ecx Primitives) - 8554 e9/jump $emit-subx-stmt-list:continue/disp32 - 8555 } - 8556 { - 8557 $emit-subx-stmt-list:check-for-var-def: - 8558 81 7/subop/compare *ecx 2/imm32/var-def # Stmt-tag - 8559 75/jump-if-!= break/disp8 - 8560 $emit-subx-stmt-list:var-def: - 8561 (emit-subx-var-def *(ebp+8) %ecx) - 8562 (push *(ebp+0x10) *(ecx+4)) # Vardef-var - 8563 (push *(ebp+0x10) *(ecx+8)) # Vardef-var - 8564 (push *(ebp+0x10) 0) # Live-var-register-spilled = 0 for vars on the stack - 8565 # - 8566 eb/jump $emit-subx-stmt-list:continue/disp8 - 8567 } - 8568 { - 8569 $emit-subx-stmt-list:check-for-reg-var-def: - 8570 81 7/subop/compare *ecx 3/imm32/reg-var-def # Stmt-tag - 8571 0f 85/jump-if-!= break/disp32 - 8572 $emit-subx-stmt-list:reg-var-def: - 8573 # TODO: ensure that there's exactly one output - 8574 (push-output-and-maybe-emit-spill *(ebp+8) %ecx *(ebp+0x10) %esi *(ebp+0x14)) - 8575 # emit the instruction as usual - 8576 (emit-subx-stmt *(ebp+8) %ecx Primitives) - 8577 # - 8578 eb/jump $emit-subx-stmt-list:continue/disp8 - 8579 } - 8580 $emit-subx-stmt-list:continue: - 8581 # TODO: raise an error on unrecognized Stmt-tag - 8582 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax - 8583 89/<- %esi 0/r32/eax - 8584 e9/jump loop/disp32 - 8585 } - 8586 $emit-subx-stmt-list:emit-cleanup: - 8587 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth) - 8588 $emit-subx-stmt-list:clean-up: - 8589 (clean-up-blocks *(ebp+0x10) *Curr-block-depth) - 8590 $emit-subx-stmt-list:end: - 8591 # . restore registers - 8592 5e/pop-to-esi - 8593 5b/pop-to-ebx - 8594 59/pop-to-ecx - 8595 58/pop-to-eax - 8596 # . epilogue - 8597 89/<- %esp 5/r32/ebp - 8598 5d/pop-to-ebp - 8599 c3/return - 8600 - 8601 # 'later-stmts' includes 'stmt', but will behave the same even without it; reg-var-def stmts are guaranteed not to write to function outputs. - 8602 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-outputs: (addr list var) - 8603 # . prologue - 8604 55/push-ebp - 8605 89/<- %ebp 4/r32/esp - 8606 # . save registers - 8607 50/push-eax - 8608 51/push-ecx - 8609 52/push-edx - 8610 # ecx = stmt - 8611 8b/-> *(ebp+0xc) 1/r32/ecx - 8612 # var sv/eax: (addr stmt-var) = lookup(curr-stmt->outputs) - 8613 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax - 8614 # TODO: assert !sv->is-deref? - 8615 # var v/ecx: (addr var) = lookup(sv->value) - 8616 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 8617 89/<- %ecx 0/r32/eax - 8618 # v->block-depth = *Curr-block-depth - 8619 8b/-> *Curr-block-depth 0/r32/eax - 8620 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth - 8621 #? (write-buffered Stderr "var ") - 8622 #? (lookup *ecx *(ecx+4)) - 8623 #? (write-buffered Stderr %eax) - 8624 #? (write-buffered Stderr " at depth ") - 8625 #? (print-int32-buffered Stderr *(ecx+0x10)) - 8626 #? (write-buffered Stderr Newline) - 8627 #? (flush Stderr) - 8628 # ensure that v is in a register - 8629 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register - 8630 0f 84/jump-if-= $push-output-and-maybe-emit-spill:abort/disp32 - 8631 # var emit-spill?/edx: boolean = not-yet-spilled-this-block? && will-not-write-some-register?(fn-outputs) - 8632 (not-yet-spilled-this-block? %ecx *(ebp+0x10)) # => eax - 8633 89/<- %edx 0/r32/eax - 8634 3d/compare-eax-and 0/imm32/false - 8635 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 - 8636 (will-not-write-some-register? %ecx *(ebp+0x14) *(ebp+0x18)) # => eax - 8637 89/<- %edx 0/r32/eax - 8638 # check emit-spill? - 8639 3d/compare-eax-and 0/imm32/false - 8640 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 - 8641 # TODO: assert(size-of(output) == 4) - 8642 # *Curr-local-stack-offset -= 4 - 8643 81 5/subop/subtract *Curr-local-stack-offset 4/imm32 - 8644 # emit spill - 8645 (emit-indent *(ebp+8) *Curr-block-depth) - 8646 (write-buffered *(ebp+8) "ff 6/subop/push %") - 8647 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax - 8648 (write-buffered *(ebp+8) %eax) - 8649 (write-buffered *(ebp+8) Newline) - 8650 $push-output-and-maybe-emit-spill:push: - 8651 8b/-> *(ebp+0xc) 1/r32/ecx - 8652 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax - 8653 # push(vars, {sv->value, emit-spill?}) - 8654 (push *(ebp+0x10) *eax) # Stmt-var-value - 8655 (push *(ebp+0x10) *(eax+4)) # Stmt-var-value - 8656 (push *(ebp+0x10) %edx) - 8657 $push-output-and-maybe-emit-spill:end: - 8658 # . restore registers - 8659 5a/pop-to-edx - 8660 59/pop-to-ecx - 8661 58/pop-to-eax - 8662 # . epilogue - 8663 89/<- %esp 5/r32/ebp - 8664 5d/pop-to-ebp - 8665 c3/return - 8666 - 8667 $push-output-and-maybe-emit-spill:abort: - 8668 # error("var '" var->name "' initialized from an instruction must live in a register\n") - 8669 (write-buffered Stderr "var '") - 8670 (write-buffered Stderr *eax) # Var-name - 8671 (write-buffered Stderr "' initialized from an instruction must live in a register\n") - 8672 (flush Stderr) - 8673 # . syscall(exit, 1) - 8674 bb/copy-to-ebx 1/imm32 - 8675 b8/copy-to-eax 1/imm32/exit - 8676 cd/syscall 0x80/imm8 - 8677 # never gets here - 8678 - 8679 emit-subx-cleanup-and-unconditional-nonlocal-branch: # out: (addr buffered-file), stmt: (addr stmt1), vars: (addr stack live-var) - 8680 # . prologue - 8681 55/push-ebp - 8682 89/<- %ebp 4/r32/esp - 8683 # . save registers - 8684 50/push-eax - 8685 51/push-ecx - 8686 # ecx = stmt - 8687 8b/-> *(ebp+0xc) 1/r32/ecx - 8688 # var target/eax: (addr array byte) = curr-stmt->inouts->value->name - 8689 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 8690 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 8691 (lookup *eax *(eax+4)) # Var-name Var-name => eax - 8692 # clean up until target block - 8693 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %eax) - 8694 # emit jump to target block - 8695 (emit-indent *(ebp+8) *Curr-block-depth) - 8696 (write-buffered *(ebp+8) "e9/jump ") - 8697 (write-buffered *(ebp+8) %eax) - 8698 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax - 8699 (string-starts-with? %eax "break") - 8700 3d/compare-eax-and 0/imm32/false - 8701 { - 8702 74/jump-if-= break/disp8 - 8703 (write-buffered *(ebp+8) ":break/disp32\n") - 8704 } - 8705 3d/compare-eax-and 0/imm32/false # just in case the function call modified flags - 8706 { - 8707 75/jump-if-!= break/disp8 - 8708 (write-buffered *(ebp+8) ":loop/disp32\n") - 8709 } - 8710 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end: - 8711 # . restore registers - 8712 59/pop-to-ecx - 8713 58/pop-to-eax - 8714 # . epilogue - 8715 89/<- %esp 5/r32/ebp - 8716 5d/pop-to-ebp - 8717 c3/return - 8718 - 8719 is-mu-branch?: # stmt: (addr stmt1) -> result/eax: boolean - 8720 # . prologue - 8721 55/push-ebp - 8722 89/<- %ebp 4/r32/esp - 8723 # . save registers - 8724 51/push-ecx - 8725 # ecx = lookup(stmt->operation) - 8726 8b/-> *(ebp+8) 1/r32/ecx - 8727 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax - 8728 89/<- %ecx 0/r32/eax - 8729 # if (stmt->operation starts with "loop") return true - 8730 (string-starts-with? %ecx "loop") # => eax - 8731 3d/compare-eax-and 0/imm32/false - 8732 75/jump-if-not-equal $is-mu-branch?:end/disp8 - 8733 # otherwise return (stmt->operation starts with "break") - 8734 (string-starts-with? %ecx "break") # => eax - 8735 $is-mu-branch?:end: - 8736 # . restore registers - 8737 59/pop-to-ecx - 8738 # . epilogue - 8739 89/<- %esp 5/r32/ebp - 8740 5d/pop-to-ebp - 8741 c3/return - 8742 - 8743 emit-reverse-break: # out: (addr buffered-file), stmt: (addr stmt1) - 8744 # . prologue - 8745 55/push-ebp - 8746 89/<- %ebp 4/r32/esp - 8747 # . save registers - 8748 50/push-eax - 8749 # eax = stmt - 8750 8b/-> *(ebp+0xc) 0/r32/eax - 8751 # - 8752 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax - 8753 (get Reverse-branch %eax 0x10 "reverse-branch: ") # => eax: (addr handle array byte) - 8754 (emit-indent *(ebp+8) *Curr-block-depth) - 8755 (lookup *eax *(eax+4)) # => eax - 8756 (write-buffered *(ebp+8) %eax) - 8757 (write-buffered *(ebp+8) " break/disp32\n") - 8758 $emit-reverse-break:end: - 8759 # . restore registers - 8760 58/pop-to-eax - 8761 # . epilogue - 8762 89/<- %esp 5/r32/ebp - 8763 5d/pop-to-ebp - 8764 c3/return - 8765 - 8766 == data - 8767 - 8768 # Table from Mu branch instructions to the reverse SubX opcodes for them. - 8769 Reverse-branch: # (table (handle array byte) (handle array byte)) - 8770 # a table is a stream - 8771 0x140/imm32/write - 8772 0/imm32/read - 8773 0x140/imm32/size - 8774 # data - 8775 0x11/imm32/alloc-id _string-break-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 - 8776 0x11/imm32/alloc-id _string-loop-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 - 8777 0x11/imm32/alloc-id _string-break-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 - 8778 0x11/imm32/alloc-id _string-loop-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 - 8779 0x11/imm32/alloc-id _string-break-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 - 8780 0x11/imm32/alloc-id _string-loop-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 - 8781 0x11/imm32/alloc-id _string-break-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 - 8782 0x11/imm32/alloc-id _string-loop-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 - 8783 0x11/imm32/alloc-id _string-break-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 - 8784 0x11/imm32/alloc-id _string-loop-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 - 8785 0x11/imm32/alloc-id _string-break-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 - 8786 0x11/imm32/alloc-id _string-loop-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 - 8787 0x11/imm32/alloc-id _string-break-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 - 8788 0x11/imm32/alloc-id _string-loop-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 - 8789 0x11/imm32/alloc-id _string-break-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 - 8790 0x11/imm32/alloc-id _string-loop-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 - 8791 0x11/imm32/alloc-id _string-break-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 - 8792 0x11/imm32/alloc-id _string-loop-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 - 8793 0x11/imm32/alloc-id _string-break-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 - 8794 0x11/imm32/alloc-id _string-loop-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 - 8795 - 8796 == code - 8797 - 8798 emit-unconditional-jump-to-depth: # out: (addr buffered-file), vars: (addr stack live-var), depth: int, label-suffix: (addr array byte) - 8799 # . prologue - 8800 55/push-ebp - 8801 89/<- %ebp 4/r32/esp - 8802 # . save registers - 8803 50/push-eax - 8804 51/push-ecx - 8805 52/push-edx - 8806 53/push-ebx - 8807 56/push-esi - 8808 # ecx = vars - 8809 8b/-> *(ebp+0xc) 1/r32/ecx - 8810 # var eax: int = vars->top - 8811 8b/-> *ecx 0/r32/eax - 8812 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] - 8813 8d/copy-address *(ecx+eax-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size - 8814 # var min/ecx: (addr handle var) = vars->data - 8815 8d/copy-address *(ecx+8) 1/r32/ecx - 8816 # edx = depth - 8817 8b/-> *(ebp+0x10) 2/r32/edx - 8818 { - 8819 $emit-unconditional-jump-to-depth:loop: - 8820 # if (curr < min) break - 8821 39/compare %esi 1/r32/ecx - 8822 0f 82/jump-if-addr< break/disp32 - 8823 # var v/ebx: (addr var) = lookup(*curr) - 8824 (lookup *esi *(esi+4)) # => eax - 8825 89/<- %ebx 0/r32/eax - 8826 # if (v->block-depth < until-block-depth) break - 8827 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth - 8828 0f 8c/jump-if-< break/disp32 - 8829 { - 8830 $emit-unconditional-jump-to-depth:check: - 8831 # if v->block-depth != until-block-depth, continue - 8832 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth - 8833 0f 85/jump-if-!= break/disp32 - 8834 $emit-unconditional-jump-to-depth:depth-found: - 8835 # if v is not a literal, continue - 8836 (size-of %ebx) # => eax - 8837 3d/compare-eax-and 0/imm32 - 8838 0f 85/jump-if-!= break/disp32 - 8839 $emit-unconditional-jump-to-depth:label-found: - 8840 # emit unconditional jump, then return - 8841 (emit-indent *(ebp+8) *Curr-block-depth) - 8842 (write-buffered *(ebp+8) "e9/jump ") - 8843 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 8844 (write-buffered *(ebp+8) %eax) - 8845 (write-buffered *(ebp+8) ":") - 8846 (write-buffered *(ebp+8) *(ebp+0x14)) - 8847 (write-buffered *(ebp+8) "/disp32\n") - 8848 eb/jump $emit-unconditional-jump-to-depth:end/disp8 - 8849 } - 8850 # curr -= 12 - 8851 81 5/subop/subtract %esi 0xc/imm32 - 8852 e9/jump loop/disp32 - 8853 } - 8854 # TODO: error if no label at 'depth' was found - 8855 $emit-unconditional-jump-to-depth:end: - 8856 # . restore registers - 8857 5e/pop-to-esi - 8858 5b/pop-to-ebx - 8859 5a/pop-to-edx - 8860 59/pop-to-ecx - 8861 58/pop-to-eax - 8862 # . epilogue - 8863 89/<- %esp 5/r32/ebp - 8864 5d/pop-to-ebp - 8865 c3/return - 8866 - 8867 # emit clean-up code for 'vars' until some block depth - 8868 # doesn't actually modify 'vars' so we need traverse manually inside the stack - 8869 emit-cleanup-code-until-depth: # out: (addr buffered-file), vars: (addr stack live-var), until-block-depth: int - 8870 # . prologue - 8871 55/push-ebp - 8872 89/<- %ebp 4/r32/esp - 8873 # . save registers - 8874 50/push-eax - 8875 51/push-ecx - 8876 52/push-edx - 8877 53/push-ebx - 8878 56/push-esi - 8879 #? (write-buffered Stderr "--- cleanup\n") - 8880 #? (flush Stderr) - 8881 # ecx = vars - 8882 8b/-> *(ebp+0xc) 1/r32/ecx - 8883 # var esi: int = vars->top - 8884 8b/-> *ecx 6/r32/esi - 8885 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] - 8886 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size - 8887 # var min/ecx: (addr handle var) = vars->data - 8888 81 0/subop/add %ecx 8/imm32 - 8889 # edx = until-block-depth - 8890 8b/-> *(ebp+0x10) 2/r32/edx - 8891 { - 8892 $emit-cleanup-code-until-depth:loop: - 8893 # if (curr < min) break - 8894 39/compare %esi 1/r32/ecx - 8895 0f 82/jump-if-addr< break/disp32 - 8896 # var v/ebx: (addr var) = lookup(*curr) - 8897 (lookup *esi *(esi+4)) # => eax - 8898 89/<- %ebx 0/r32/eax - 8899 #? (lookup *ebx *(ebx+4)) # Var-name - 8900 #? (write-buffered Stderr "var ") - 8901 #? (write-buffered Stderr %eax) - 8902 #? (write-buffered Stderr Newline) - 8903 #? (flush Stderr) - 8904 # if (v->block-depth < until-block-depth) break - 8905 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth - 8906 0f 8c/jump-if-< break/disp32 - 8907 # if v is in a register - 8908 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register - 8909 { - 8910 0f 84/jump-if-= break/disp32 - 8911 { - 8912 $emit-cleanup-code-until-depth:check-for-previous-spill: - 8913 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled - 8914 3d/compare-eax-and 0/imm32/false - 8915 74/jump-if-= break/disp8 - 8916 $emit-cleanup-code-until-depth:reclaim-var-in-register: - 8917 (emit-indent *(ebp+8) *Curr-block-depth) - 8918 (write-buffered *(ebp+8) "8f 0/subop/pop %") - 8919 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax - 8920 (write-buffered *(ebp+8) %eax) - 8921 (write-buffered *(ebp+8) Newline) - 8922 } - 8923 eb/jump $emit-cleanup-code-until-depth:continue/disp8 - 8924 } - 8925 # otherwise v is on the stack - 8926 { - 8927 75/jump-if-!= break/disp8 - 8928 $emit-cleanup-code-until-depth:var-on-stack: - 8929 (size-of %ebx) # => eax - 8930 # don't emit code for labels - 8931 3d/compare-eax-and 0/imm32 - 8932 74/jump-if-= break/disp8 - 8933 $emit-cleanup-code-until-depth:reclaim-var-on-stack: - 8934 (emit-indent *(ebp+8) *Curr-block-depth) - 8935 (write-buffered *(ebp+8) "81 0/subop/add %esp ") - 8936 (print-int32-buffered *(ebp+8) %eax) - 8937 (write-buffered *(ebp+8) "/imm32\n") - 8938 } - 8939 $emit-cleanup-code-until-depth:continue: - 8940 # curr -= 12 - 8941 81 5/subop/subtract %esi 0xc/imm32 - 8942 e9/jump loop/disp32 - 8943 } - 8944 $emit-cleanup-code-until-depth:end: - 8945 # . restore registers - 8946 5e/pop-to-esi - 8947 5b/pop-to-ebx - 8948 5a/pop-to-edx - 8949 59/pop-to-ecx - 8950 58/pop-to-eax - 8951 # . epilogue - 8952 89/<- %esp 5/r32/ebp - 8953 5d/pop-to-ebp - 8954 c3/return - 8955 - 8956 # emit clean-up code for 'vars' until a given label is encountered - 8957 # doesn't actually modify 'vars' so we need traverse manually inside the stack - 8958 emit-cleanup-code-until-target: # out: (addr buffered-file), vars: (addr stack live-var), until-block-label: (addr array byte) - 8959 # . prologue - 8960 55/push-ebp - 8961 89/<- %ebp 4/r32/esp - 8962 # . save registers - 8963 50/push-eax - 8964 51/push-ecx - 8965 52/push-edx - 8966 53/push-ebx - 8967 # ecx = vars - 8968 8b/-> *(ebp+0xc) 1/r32/ecx - 8969 # var eax: int = vars->top - 8970 8b/-> *ecx 0/r32/eax - 8971 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] - 8972 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size - 8973 # var min/ecx: (addr handle var) = vars->data - 8974 81 0/subop/add %ecx 8/imm32 - 8975 { - 8976 $emit-cleanup-code-until-target:loop: - 8977 # if (curr < min) break - 8978 39/compare %edx 1/r32/ecx - 8979 0f 82/jump-if-addr< break/disp32 - 8980 # var v/ebx: (handle var) = lookup(*curr) - 8981 (lookup *edx *(edx+4)) # => eax - 8982 89/<- %ebx 0/r32/eax - 8983 # if (v->name == until-block-label) break - 8984 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 8985 (string-equal? %eax *(ebp+0x10)) # => eax - 8986 3d/compare-eax-and 0/imm32/false - 8987 0f 85/jump-if-!= break/disp32 - 8988 # if v is in a register - 8989 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register - 8990 { - 8991 0f 84/jump-if-= break/disp32 - 8992 { - 8993 $emit-cleanup-code-until-target:check-for-previous-spill: - 8994 8b/-> *(edx+8) 0/r32/eax # Live-var-register-spilled - 8995 3d/compare-eax-and 0/imm32/false - 8996 74/jump-if-= break/disp8 - 8997 $emit-cleanup-code-until-target:reclaim-var-in-register: - 8998 (emit-indent *(ebp+8) *Curr-block-depth) - 8999 (write-buffered *(ebp+8) "8f 0/subop/pop %") - 9000 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax - 9001 (write-buffered *(ebp+8) %eax) - 9002 (write-buffered *(ebp+8) Newline) - 9003 } - 9004 eb/jump $emit-cleanup-code-until-target:continue/disp8 - 9005 } - 9006 # otherwise v is on the stack - 9007 { - 9008 75/jump-if-!= break/disp8 - 9009 $emit-cleanup-code-until-target:reclaim-var-on-stack: - 9010 (size-of %ebx) # => eax - 9011 # don't emit code for labels - 9012 3d/compare-eax-and 0/imm32 - 9013 74/jump-if-= break/disp8 - 9014 # - 9015 (emit-indent *(ebp+8) *Curr-block-depth) - 9016 (write-buffered *(ebp+8) "81 0/subop/add %esp ") - 9017 (print-int32-buffered *(ebp+8) %eax) - 9018 (write-buffered *(ebp+8) "/imm32\n") - 9019 } - 9020 $emit-cleanup-code-until-target:continue: - 9021 # curr -= 12 - 9022 81 5/subop/subtract %edx 0xc/imm32 - 9023 e9/jump loop/disp32 - 9024 } - 9025 $emit-cleanup-code-until-target:end: - 9026 # . restore registers - 9027 5b/pop-to-ebx - 9028 5a/pop-to-edx - 9029 59/pop-to-ecx - 9030 58/pop-to-eax - 9031 # . epilogue - 9032 89/<- %esp 5/r32/ebp - 9033 5d/pop-to-ebp - 9034 c3/return - 9035 - 9036 # Return true if there isn't a variable in 'vars' with the same block-depth - 9037 # and register as 'v'. - 9038 # 'v' is guaranteed not to be within 'vars'. - 9039 not-yet-spilled-this-block?: # v: (addr var), vars: (addr stack live-var) -> result/eax: boolean - 9040 # . prologue - 9041 55/push-ebp - 9042 89/<- %ebp 4/r32/esp - 9043 # . save registers - 9044 51/push-ecx - 9045 52/push-edx - 9046 53/push-ebx - 9047 56/push-esi - 9048 57/push-edi - 9049 # ecx = vars - 9050 8b/-> *(ebp+0xc) 1/r32/ecx - 9051 # var eax: int = vars->top - 9052 8b/-> *ecx 0/r32/eax - 9053 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] - 9054 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size - 9055 # var min/ecx: (addr handle var) = vars->data - 9056 8d/copy-address *(ecx+8) 1/r32/ecx - 9057 # var depth/ebx: int = v->block-depth - 9058 8b/-> *(ebp+8) 3/r32/ebx - 9059 8b/-> *(ebx+0x10) 3/r32/ebx # Var-block-depth - 9060 # var needle/esi: (addr array byte) = v->register - 9061 8b/-> *(ebp+8) 6/r32/esi - 9062 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax - 9063 89/<- %esi 0/r32/eax - 9064 { - 9065 $not-yet-spilled-this-block?:loop: - 9066 # if (curr < min) break - 9067 39/compare %edx 1/r32/ecx - 9068 0f 82/jump-if-addr< break/disp32 - 9069 # var cand/edi: (addr var) = lookup(*curr) - 9070 (lookup *edx *(edx+4)) # => eax - 9071 89/<- %edi 0/r32/eax - 9072 # if (cand->block-depth < depth) break - 9073 39/compare *(edi+0x10) 3/r32/ebx # Var-block-depth - 9074 0f 8c/jump-if-< break/disp32 - 9075 # var cand-reg/edi: (array array byte) = cand->reg - 9076 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax - 9077 89/<- %edi 0/r32/eax - 9078 # if (cand-reg == null) continue - 9079 { - 9080 $not-yet-spilled-this-block?:check-reg: - 9081 81 7/subop/compare %edi 0/imm32 - 9082 0f 84/jump-if-= break/disp32 - 9083 # if (cand-reg == needle) return true - 9084 (string-equal? %esi %edi) # => eax - 9085 3d/compare-eax-and 0/imm32/false - 9086 74/jump-if-= break/disp8 - 9087 $not-yet-spilled-this-block?:return-false: - 9088 b8/copy-to-eax 0/imm32/false - 9089 eb/jump $not-yet-spilled-this-block?:end/disp8 - 9090 } - 9091 $not-yet-spilled-this-block?:continue: - 9092 # curr -= 12 - 9093 81 5/subop/subtract %edx 0xc/imm32 - 9094 e9/jump loop/disp32 - 9095 } - 9096 $not-yet-spilled-this-block?:return-true: - 9097 # return true - 9098 b8/copy-to-eax 1/imm32/true - 9099 $not-yet-spilled-this-block?:end: - 9100 # . restore registers - 9101 5f/pop-to-edi - 9102 5e/pop-to-esi - 9103 5b/pop-to-ebx - 9104 5a/pop-to-edx - 9105 59/pop-to-ecx - 9106 # . epilogue - 9107 89/<- %esp 5/r32/ebp - 9108 5d/pop-to-ebp - 9109 c3/return - 9110 - 9111 # could the register of 'v' ever be written to by one of the vars in fn-outputs? - 9112 will-not-write-some-register?: # v: (addr var), stmts: (addr list stmt), fn-outputs: (addr list var) -> result/eax: boolean - 9113 # . prologue - 9114 55/push-ebp - 9115 89/<- %ebp 4/r32/esp - 9116 # eax = v - 9117 8b/-> *(ebp+8) 0/r32/eax - 9118 # var reg/eax: (addr array byte) = lookup(v->register) - 9119 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax - 9120 # var target/eax: (addr var) = find-register(fn-outputs, reg) - 9121 (find-register *(ebp+0x10) %eax) # => eax - 9122 # if (target == 0) return true - 9123 { - 9124 3d/compare-eax-and 0/imm32 - 9125 75/jump-if-!= break/disp8 - 9126 b8/copy-to-eax 1/imm32/true - 9127 eb/jump $will-not-write-some-register?:end/disp8 - 9128 } - 9129 # return !assigns-in-stmts?(stmts, target) - 9130 (assigns-in-stmts? *(ebp+0xc) %eax) # => eax - 9131 3d/compare-eax-and 0/imm32/false - 9132 # assume: true = 1, so no need to mask with 0x000000ff - 9133 0f 94/set-if-= %al - 9134 $will-not-write-some-register?:end: - 9135 # . epilogue - 9136 89/<- %esp 5/r32/ebp - 9137 5d/pop-to-ebp - 9138 c3/return - 9139 - 9140 # return output var with matching register - 9141 # always returns false if 'reg' is null - 9142 find-register: # fn-outputs: (addr list var), reg: (addr array byte) -> result/eax: (addr var) - 9143 # . prologue - 9144 55/push-ebp - 9145 89/<- %ebp 4/r32/esp - 9146 # . save registers - 9147 51/push-ecx - 9148 # var curr/ecx: (addr list var) = fn-outputs - 9149 8b/-> *(ebp+8) 1/r32/ecx - 9150 { - 9151 $find-register:loop: - 9152 # if (curr == 0) break - 9153 81 7/subop/compare %ecx 0/imm32 - 9154 74/jump-if-= break/disp8 - 9155 # eax = curr->value->register - 9156 (lookup *ecx *(ecx+4)) # List-value List-value => eax - 9157 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax - 9158 # if (eax == reg) return curr->value - 9159 $find-register:compare: - 9160 (string-equal? *(ebp+0xc) %eax) # => eax - 9161 { - 9162 3d/compare-eax-and 0/imm32/false - 9163 74/jump-if-= break/disp8 - 9164 $find-register:found: - 9165 (lookup *ecx *(ecx+4)) # List-value List-value => eax - 9166 eb/jump $find-register:end/disp8 - 9167 } - 9168 # curr = lookup(curr->next) - 9169 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax - 9170 89/<- %ecx 0/r32/eax - 9171 # - 9172 eb/jump loop/disp8 - 9173 } - 9174 $find-register:end: - 9175 # . restore registers - 9176 59/pop-to-ecx - 9177 # . epilogue - 9178 89/<- %esp 5/r32/ebp - 9179 5d/pop-to-ebp - 9180 c3/return - 9181 - 9182 assigns-in-stmts?: # stmts: (addr list stmt), v: (addr var) -> result/eax: boolean - 9183 # . prologue - 9184 55/push-ebp - 9185 89/<- %ebp 4/r32/esp - 9186 # . save registers - 9187 51/push-ecx - 9188 # var curr/ecx: (addr list stmt) = stmts - 9189 8b/-> *(ebp+8) 1/r32/ecx - 9190 { - 9191 # if (curr == 0) break - 9192 81 7/subop/compare %ecx 0/imm32 - 9193 74/jump-if-= break/disp8 - 9194 # if assigns-in-stmt?(curr->value, v) return true - 9195 (lookup *ecx *(ecx+4)) # List-value List-value => eax - 9196 (assigns-in-stmt? %eax *(ebp+0xc)) # => eax - 9197 3d/compare-eax-and 0/imm32/false - 9198 75/jump-if-!= break/disp8 - 9199 # curr = lookup(curr->next) - 9200 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax - 9201 89/<- %ecx 0/r32/eax - 9202 # - 9203 eb/jump loop/disp8 - 9204 } - 9205 $assigns-in-stmts?:end: - 9206 # . restore registers - 9207 59/pop-to-ecx - 9208 # . epilogue - 9209 89/<- %esp 5/r32/ebp - 9210 5d/pop-to-ebp - 9211 c3/return - 9212 - 9213 assigns-in-stmt?: # stmt: (addr stmt), v: (addr var) -> result/eax: boolean - 9214 # . prologue - 9215 55/push-ebp - 9216 89/<- %ebp 4/r32/esp - 9217 # . save registers - 9218 51/push-ecx - 9219 # ecx = stmt - 9220 8b/-> *(ebp+8) 1/r32/ecx - 9221 # if stmt is a stmt1, return assigns-in-stmt-vars?(stmt->outputs, v) - 9222 { - 9223 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag - 9224 75/jump-if-!= break/disp8 - 9225 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax - 9226 (assigns-in-stmt-vars? %eax *(ebp+0xc)) # => eax - 9227 eb/jump $assigns-in-stmt?:end/disp8 - 9228 } - 9229 # if stmt is a block, return assigns-in-stmts?(stmt->stmts, v) - 9230 { - 9231 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag - 9232 75/jump-if-!= break/disp8 - 9233 (lookup *(ecx+4) *(ecx+8)) # Block-stmts Block-stmts => eax - 9234 (assigns-in-stmts? %eax *(ebp+0xc)) # => eax - 9235 eb/jump $assigns-in-stmt?:end/disp8 - 9236 } - 9237 # otherwise return false - 9238 b8/copy 0/imm32/false - 9239 $assigns-in-stmt?:end: - 9240 # . restore registers - 9241 59/pop-to-ecx - 9242 # . epilogue - 9243 89/<- %esp 5/r32/ebp - 9244 5d/pop-to-ebp - 9245 c3/return - 9246 - 9247 assigns-in-stmt-vars?: # stmt-var: (addr stmt-var), v: (addr var) -> result/eax: boolean - 9248 # . prologue - 9249 55/push-ebp - 9250 89/<- %ebp 4/r32/esp - 9251 # . save registers - 9252 51/push-ecx - 9253 # var curr/ecx: (addr stmt-var) = stmt-var - 9254 8b/-> *(ebp+8) 1/r32/ecx - 9255 { - 9256 # if (curr == 0) break - 9257 81 7/subop/compare %ecx 0/imm32 - 9258 74/jump-if-= break/disp8 - 9259 # eax = lookup(curr->value) - 9260 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax - 9261 # if (eax == v && curr->is-deref? == false) return true - 9262 { - 9263 39/compare *(ebp+0xc) 0/r32/eax - 9264 75/jump-if-!= break/disp8 - 9265 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref - 9266 75/jump-if-!= break/disp8 - 9267 b8/copy-to-eax 1/imm32/true - 9268 eb/jump $assigns-in-stmt-vars?:end/disp8 - 9269 } - 9270 # curr = lookup(curr->next) - 9271 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax - 9272 89/<- %ecx 0/r32/eax - 9273 # - 9274 eb/jump loop/disp8 - 9275 } - 9276 $assigns-in-stmt-vars?:end: - 9277 # . restore registers - 9278 59/pop-to-ecx - 9279 # . epilogue - 9280 89/<- %esp 5/r32/ebp - 9281 5d/pop-to-ebp - 9282 c3/return - 9283 - 9284 # is there a var before 'v' with the same block-depth and register on the 'vars' stack? - 9285 # v is guaranteed to be within vars - 9286 # 'start' is provided as an optimization, a pointer within vars - 9287 # *start == v - 9288 same-register-spilled-before?: # v: (addr var), vars: (addr stack (handle var)), start: (addr var) -> result/eax: boolean - 9289 # . prologue - 9290 55/push-ebp - 9291 89/<- %ebp 4/r32/esp - 9292 # . save registers - 9293 51/push-ecx - 9294 52/push-edx - 9295 53/push-ebx - 9296 56/push-esi - 9297 57/push-edi - 9298 # ecx = v - 9299 8b/-> *(ebp+8) 1/r32/ecx - 9300 # var reg/edx: (addr array byte) = lookup(v->register) - 9301 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax - 9302 89/<- %edx 0/r32/eax - 9303 # var depth/ebx: int = v->block-depth - 9304 8b/-> *(ecx+0x10) 3/r32/ebx # Var-block-depth - 9305 # var min/ecx: (addr handle var) = vars->data - 9306 8b/-> *(ebp+0xc) 1/r32/ecx - 9307 81 0/subop/add %ecx 8/imm32 - 9308 # TODO: check that start >= min and start < &vars->data[top] - 9309 # TODO: check that *start == v - 9310 # var curr/esi: (addr handle var) = start - 9311 8b/-> *(ebp+0x10) 6/r32/esi - 9312 # curr -= 8 - 9313 81 5/subop/subtract %esi 8/imm32 - 9314 { - 9315 $same-register-spilled-before?:loop: - 9316 # if (curr < min) break - 9317 39/compare %esi 1/r32/ecx - 9318 0f 82/jump-if-addr< break/disp32 - 9319 # var x/eax: (addr var) = lookup(*curr) - 9320 (lookup *esi *(esi+4)) # => eax - 9321 # if (x->block-depth < depth) break - 9322 39/compare *(eax+0x10) 3/r32/ebx # Var-block-depth - 9323 0f 8c/jump-if-< break/disp32 - 9324 # if (x->register == 0) continue - 9325 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register - 9326 74/jump-if-= $same-register-spilled-before?:continue/disp8 - 9327 # if (x->register == reg) return true - 9328 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax - 9329 (string-equal? %eax %edx) # => eax - 9330 3d/compare-eax-and 0/imm32/false - 9331 b8/copy-to-eax 1/imm32/true - 9332 75/jump-if-!= $same-register-spilled-before?:end/disp8 - 9333 $same-register-spilled-before?:continue: - 9334 # curr -= 8 - 9335 81 5/subop/subtract %esi 8/imm32 - 9336 e9/jump loop/disp32 - 9337 } - 9338 $same-register-spilled-before?:false: - 9339 b8/copy-to-eax 0/imm32/false - 9340 $same-register-spilled-before?:end: - 9341 # . restore registers - 9342 5f/pop-to-edi - 9343 5e/pop-to-esi - 9344 5b/pop-to-ebx - 9345 5a/pop-to-edx - 9346 59/pop-to-ecx - 9347 # . epilogue - 9348 89/<- %esp 5/r32/ebp - 9349 5d/pop-to-ebp - 9350 c3/return - 9351 - 9352 # clean up global state for 'vars' until some block depth - 9353 clean-up-blocks: # vars: (addr stack live-var), until-block-depth: int - 9354 # . prologue - 9355 55/push-ebp - 9356 89/<- %ebp 4/r32/esp - 9357 # . save registers - 9358 50/push-eax - 9359 51/push-ecx - 9360 56/push-esi - 9361 # esi = vars - 9362 8b/-> *(ebp+8) 6/r32/esi - 9363 # ecx = until-block-depth - 9364 8b/-> *(ebp+0xc) 1/r32/ecx - 9365 { - 9366 $clean-up-blocks:reclaim-loop: - 9367 # if (vars->top <= 0) break - 9368 8b/-> *esi 0/r32/eax # Stack-top - 9369 3d/compare-eax-and 0/imm32 - 9370 0f 8e/jump-if-<= break/disp32 - 9371 # var v/eax: (addr var) = lookup(vars[vars->top-12]) - 9372 #? (print-int32-buffered Stderr %eax) - 9373 #? (write-buffered Stderr ": ") - 9374 #? (print-int32-buffered Stderr *(esi+eax-4)) - 9375 #? (write-buffered Stderr " ") - 9376 #? (print-int32-buffered Stderr *(esi+eax)) - 9377 #? (write-buffered Stderr " ") - 9378 #? (print-int32-buffered Stderr *(esi+eax+4)) - 9379 #? (write-buffered Stderr Newline) - 9380 #? (flush Stderr) - 9381 (lookup *(esi+eax-4) *(esi+eax)) # vars + 8 + vars->top - 12 => eax - 9382 # if (v->block-depth < until-block-depth) break - 9383 39/compare *(eax+0x10) 1/r32/ecx # Var-block-depth - 9384 7c/jump-if-< break/disp8 - 9385 # if v is on the stack, update Curr-local-stack-offset - 9386 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register - 9387 { - 9388 75/jump-if-!= break/disp8 - 9389 $clean-up-blocks:reclaim-var-on-stack: - 9390 (size-of %eax) # => eax - 9391 01/add-to *Curr-local-stack-offset 0/r32/eax - 9392 } - 9393 (pop %esi) # => eax - 9394 (pop %esi) # => eax - 9395 (pop %esi) # => eax - 9396 e9/jump loop/disp32 - 9397 } - 9398 $clean-up-blocks:end: - 9399 # . restore registers - 9400 5e/pop-to-esi - 9401 59/pop-to-ecx - 9402 58/pop-to-eax - 9403 # . epilogue - 9404 89/<- %esp 5/r32/ebp - 9405 5d/pop-to-ebp - 9406 c3/return - 9407 - 9408 emit-subx-var-def: # out: (addr buffered-file), stmt: (addr stmt) - 9409 # . prologue - 9410 55/push-ebp - 9411 89/<- %ebp 4/r32/esp - 9412 # . save registers - 9413 50/push-eax - 9414 51/push-ecx - 9415 52/push-edx - 9416 # eax = stmt - 9417 8b/-> *(ebp+0xc) 0/r32/eax - 9418 # var v/ecx: (addr var) - 9419 (lookup *(eax+4) *(eax+8)) # Vardef-var Vardef-var => eax - 9420 89/<- %ecx 0/r32/eax - 9421 # v->block-depth = *Curr-block-depth - 9422 8b/-> *Curr-block-depth 0/r32/eax - 9423 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth - 9424 # var n/edx: int = size-of(stmt->var) - 9425 (size-of %ecx) # => eax - 9426 89/<- %edx 0/r32/eax - 9427 # *Curr-local-stack-offset -= n - 9428 29/subtract-from *Curr-local-stack-offset 2/r32/edx - 9429 # v->offset = *Curr-local-stack-offset - 9430 8b/-> *Curr-local-stack-offset 0/r32/eax - 9431 89/<- *(ecx+0x14) 0/r32/eax # Var-offset - 9432 # if v is an array, do something special - 9433 { - 9434 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 9435 (is-mu-array? %eax) # => eax - 9436 3d/compare-eax-and 0/imm32/false - 9437 0f 84/jump-if-= break/disp32 - 9438 # var array-size-without-size/edx: int = n-4 - 9439 81 5/subop/subtract %edx 4/imm32 - 9440 (emit-indent *(ebp+8) *Curr-block-depth) - 9441 (write-buffered *(ebp+8) "(push-n-zero-bytes ") - 9442 (print-int32-buffered *(ebp+8) %edx) - 9443 (write-buffered *(ebp+8) ")\n") - 9444 (emit-indent *(ebp+8) *Curr-block-depth) - 9445 (write-buffered *(ebp+8) "68/push ") - 9446 (print-int32-buffered *(ebp+8) %edx) - 9447 (write-buffered *(ebp+8) "/imm32\n") - 9448 eb/jump $emit-subx-var-def:end/disp8 - 9449 } - 9450 # while n > 0 - 9451 { - 9452 81 7/subop/compare %edx 0/imm32 - 9453 7e/jump-if-<= break/disp8 - 9454 (emit-indent *(ebp+8) *Curr-block-depth) - 9455 (write-buffered *(ebp+8) "68/push 0/imm32\n") - 9456 # n -= 4 - 9457 81 5/subop/subtract %edx 4/imm32 - 9458 # - 9459 eb/jump loop/disp8 - 9460 } - 9461 $emit-subx-var-def:end: - 9462 # . restore registers - 9463 5a/pop-to-edx - 9464 59/pop-to-ecx - 9465 58/pop-to-eax - 9466 # . epilogue - 9467 89/<- %esp 5/r32/ebp - 9468 5d/pop-to-ebp - 9469 c3/return - 9470 - 9471 emit-subx-stmt: # out: (addr buffered-file), stmt: (addr stmt), primitives: (addr primitive) - 9472 # . prologue - 9473 55/push-ebp - 9474 89/<- %ebp 4/r32/esp - 9475 # . save registers - 9476 50/push-eax - 9477 51/push-ecx - 9478 # - some special-case primitives that don't actually use the 'primitives' data structure - 9479 # var op/ecx: (addr array byte) = lookup(stmt->operation) - 9480 8b/-> *(ebp+0xc) 1/r32/ecx - 9481 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax - 9482 89/<- %ecx 0/r32/eax - 9483 # array size - 9484 { - 9485 # if (!string-equal?(stmt->operation, "length")) break - 9486 (string-equal? %ecx "length") # => eax - 9487 3d/compare-eax-and 0/imm32 - 9488 0f 84/jump-if-= break/disp32 - 9489 (translate-mu-length-stmt *(ebp+8) *(ebp+0xc)) - 9490 e9/jump $emit-subx-stmt:end/disp32 - 9491 } - 9492 # index into array - 9493 { - 9494 # if (!string-equal?(stmt->operation, "index")) break - 9495 (string-equal? %ecx "index") # => eax - 9496 3d/compare-eax-and 0/imm32 - 9497 0f 84/jump-if-= break/disp32 - 9498 (translate-mu-index-stmt *(ebp+8) *(ebp+0xc)) - 9499 e9/jump $emit-subx-stmt:end/disp32 - 9500 } - 9501 # compute-offset for index into array - 9502 { - 9503 # if (!string-equal?(stmt->operation, "compute-offset")) break - 9504 (string-equal? %ecx "compute-offset") # => eax - 9505 3d/compare-eax-and 0/imm32 - 9506 0f 84/jump-if-= break/disp32 - 9507 (translate-mu-compute-index-stmt *(ebp+8) *(ebp+0xc)) - 9508 e9/jump $emit-subx-stmt:end/disp32 - 9509 } - 9510 # get field from record - 9511 { - 9512 # if (!string-equal?(stmt->operation, "get")) break - 9513 (string-equal? %ecx "get") # => eax - 9514 3d/compare-eax-and 0/imm32 - 9515 0f 84/jump-if-= break/disp32 - 9516 (translate-mu-get-stmt *(ebp+8) *(ebp+0xc)) - 9517 e9/jump $emit-subx-stmt:end/disp32 - 9518 } - 9519 # - if stmt matches a primitive, emit it - 9520 { - 9521 $emit-subx-stmt:check-for-primitive: - 9522 # var curr/eax: (addr primitive) - 9523 (find-matching-primitive *(ebp+0x10) *(ebp+0xc)) # primitives, stmt => eax - 9524 3d/compare-eax-and 0/imm32 - 9525 74/jump-if-= break/disp8 - 9526 $emit-subx-stmt:primitive: - 9527 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax) # out, stmt, curr - 9528 e9/jump $emit-subx-stmt:end/disp32 - 9529 } - 9530 # - otherwise emit a call - 9531 # TODO: type-checking - 9532 $emit-subx-stmt:call: - 9533 (emit-call *(ebp+8) *(ebp+0xc)) - 9534 $emit-subx-stmt:end: - 9535 # . restore registers - 9536 59/pop-to-ecx - 9537 58/pop-to-eax - 9538 # . epilogue - 9539 89/<- %esp 5/r32/ebp - 9540 5d/pop-to-ebp - 9541 c3/return - 9542 - 9543 translate-mu-length-stmt: # out: (addr buffered-file), stmt: (addr stmt) - 9544 # . prologue - 9545 55/push-ebp - 9546 89/<- %ebp 4/r32/esp - 9547 # . save registers - 9548 50/push-eax - 9549 51/push-ecx - 9550 52/push-edx - 9551 53/push-ebx - 9552 56/push-esi - 9553 # esi = stmt - 9554 8b/-> *(ebp+0xc) 6/r32/esi - 9555 # var base/ebx: (addr var) = stmt->inouts[0]->value - 9556 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 9557 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 9558 89/<- %ebx 0/r32/eax - 9559 # var elemsize/ecx: int = element-size(base) - 9560 (array-element-type-id %ebx) # => eax - 9561 (size-of-type-id %eax) # => eax - 9562 89/<- %ecx 0/r32/eax - 9563 # var outreg/edx: (addr array byte) = stmt->outputs[0]->value->register - 9564 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax - 9565 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 9566 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax - 9567 89/<- %edx 0/r32/eax - 9568 # if elemsize == 1 - 9569 { - 9570 81 7/subop/compare %ecx 1/imm32 - 9571 75/jump-if-!= break/disp8 - 9572 (emit-save-size-to *(ebp+8) %ebx %edx) - 9573 e9/jump $translate-mu-length-stmt:end/disp32 - 9574 } - 9575 # if elemsize is a power of 2 less than 256 - 9576 { - 9577 (power-of-2? %ecx) # => eax - 9578 3d/compare-eax-and 0/imm32/false - 9579 74/jump-if-= break/disp8 - 9580 81 7/subop/compare %ecx 0xff/imm32 - 9581 7f/jump-if-> break/disp8 - 9582 (emit-save-size-to *(ebp+8) %ebx %edx) - 9583 (emit-divide-by-shift-right *(ebp+8) %edx %ecx) - 9584 e9/jump $translate-mu-length-stmt:end/disp32 - 9585 } - 9586 # otherwise, the complex case - 9587 # . emit register spills - 9588 { - 9589 (string-equal? %edx "eax") # => eax - 9590 3d/compare-eax-and 0/imm32/false - 9591 75/break-if-!= break/disp8 - 9592 (emit-indent *(ebp+8) *Curr-block-depth) - 9593 (write-buffered *(ebp+8) "50/push-eax\n") - 9594 } - 9595 { - 9596 (string-equal? %edx "ecx") # => eax - 9597 3d/compare-eax-and 0/imm32/false - 9598 75/break-if-!= break/disp8 - 9599 (emit-indent *(ebp+8) *Curr-block-depth) - 9600 (write-buffered *(ebp+8) "51/push-ecx\n") - 9601 } - 9602 { - 9603 (string-equal? %edx "edx") # => eax - 9604 3d/compare-eax-and 0/imm32/false - 9605 75/break-if-!= break/disp8 - 9606 (emit-indent *(ebp+8) *Curr-block-depth) - 9607 (write-buffered *(ebp+8) "52/push-edx\n") - 9608 } - 9609 # . - 9610 (emit-save-size-to *(ebp+8) %ebx "eax") - 9611 (emit-indent *(ebp+8) *Curr-block-depth) - 9612 (write-buffered *(ebp+8) "31/xor %edx 2/r32/edx\n") - 9613 (emit-indent *(ebp+8) *Curr-block-depth) - 9614 (write-buffered *(ebp+8) "b9/copy-to-ecx ") - 9615 (print-int32-buffered *(ebp+8) %ecx) - 9616 (write-buffered *(ebp+8) "/imm32\n") - 9617 (emit-indent *(ebp+8) *Curr-block-depth) - 9618 (write-buffered *(ebp+8) "f7 7/subop/idiv-eax-edx-by %ecx\n") - 9619 { - 9620 (string-equal? %edx "eax") # => eax - 9621 3d/compare-eax-and 0/imm32/false - 9622 75/break-if-!= break/disp8 - 9623 (emit-indent *(ebp+8) *Curr-block-depth) - 9624 (write-buffered *(ebp+8) "89/<- %") - 9625 (write-buffered *(ebp+8) %edx) - 9626 (write-buffered *(ebp+8) " 0/r32/eax\n") - 9627 } - 9628 # . emit register restores - 9629 { - 9630 (string-equal? %edx "edx") # => eax - 9631 3d/compare-eax-and 0/imm32/false - 9632 75/break-if-!= break/disp8 - 9633 (emit-indent *(ebp+8) *Curr-block-depth) - 9634 (write-buffered *(ebp+8) "5a/pop-to-edx\n") - 9635 } - 9636 { - 9637 (string-equal? %edx "ecx") # => eax - 9638 3d/compare-eax-and 0/imm32/false - 9639 75/break-if-!= break/disp8 - 9640 (emit-indent *(ebp+8) *Curr-block-depth) - 9641 (write-buffered *(ebp+8) "59/pop-to-ecx\n") - 9642 } - 9643 { - 9644 (string-equal? %edx "eax") # => eax - 9645 3d/compare-eax-and 0/imm32/false - 9646 75/break-if-!= break/disp8 - 9647 (emit-indent *(ebp+8) *Curr-block-depth) - 9648 (write-buffered *(ebp+8) "58/pop-to-eax\n") - 9649 } - 9650 $translate-mu-length-stmt:end: - 9651 # . restore registers - 9652 5e/pop-to-esi - 9653 5b/pop-to-ebx - 9654 5a/pop-to-edx - 9655 59/pop-to-ecx - 9656 58/pop-to-eax - 9657 # . epilogue - 9658 89/<- %esp 5/r32/ebp - 9659 5d/pop-to-ebp - 9660 c3/return - 9661 - 9662 emit-save-size-to: # out: (addr buffered-file), base: (addr var), outreg: (addr array byte) - 9663 # . prologue - 9664 55/push-ebp - 9665 89/<- %ebp 4/r32/esp - 9666 # . save registers - 9667 50/push-eax - 9668 53/push-ebx - 9669 # ebx = base - 9670 8b/-> *(ebp+0xc) 3/r32/ebx - 9671 (emit-indent *(ebp+8) *Curr-block-depth) - 9672 (write-buffered *(ebp+8) "8b/-> *") - 9673 # if base is an (addr array ...) in a register - 9674 { - 9675 81 7/subop/compare *(ebx+0x18)) 0/imm32 # Var-register - 9676 74/jump-if-= break/disp8 - 9677 $emit-save-size-to:emit-base-from-register: - 9678 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax - 9679 (write-buffered *(ebp+8) %eax) - 9680 eb/jump $emit-save-size-to:emit-output/disp8 - 9681 } - 9682 # otherwise if base is an (array ...) on the stack - 9683 { - 9684 81 7/subop/compare *(ebx+0x14)) 0/imm32 # Var-offset - 9685 74/jump-if-= break/disp8 - 9686 $emit-save-size-to:emit-base-from-stack: - 9687 (write-buffered *(ebp+8) "(ebp+") - 9688 (print-int32-buffered *(ebp+8) *(ebx+0x14)) # Var-offset - 9689 (write-buffered *(ebp+8) ")") - 9690 } - 9691 $emit-save-size-to:emit-output: - 9692 (write-buffered *(ebp+8) " ") - 9693 (get Registers *(ebp+0x10) 0xc "Registers") # => eax - 9694 (print-int32-buffered *(ebp+8) *eax) - 9695 (write-buffered *(ebp+8) "/r32\n") - 9696 $emit-save-size-to:end: - 9697 # . restore registers - 9698 5b/pop-to-ebx - 9699 58/pop-to-eax - 9700 # . epilogue - 9701 89/<- %esp 5/r32/ebp - 9702 5d/pop-to-ebp - 9703 c3/return - 9704 - 9705 emit-divide-by-shift-right: # out: (addr buffered-file), reg: (addr array byte), size: int - 9706 # . prologue - 9707 55/push-ebp - 9708 89/<- %ebp 4/r32/esp - 9709 # . save registers - 9710 50/push-eax - 9711 # - 9712 (emit-indent *(ebp+8) *Curr-block-depth) - 9713 (write-buffered *(ebp+8) "c1/shift 5/subop/>> %") - 9714 (write-buffered *(ebp+8) *(ebp+0xc)) - 9715 (write-buffered *(ebp+8) Space) - 9716 (num-shift-rights *(ebp+0x10)) # => eax - 9717 (print-int32-buffered *(ebp+8) %eax) - 9718 (write-buffered *(ebp+8) "/imm8\n") - 9719 $emit-divide-by-shift-right:end: - 9720 # . restore registers - 9721 58/pop-to-eax - 9722 # . epilogue - 9723 89/<- %esp 5/r32/ebp - 9724 5d/pop-to-ebp - 9725 c3/return - 9726 - 9727 translate-mu-index-stmt: # out: (addr buffered-file), stmt: (addr stmt) - 9728 # . prologue - 9729 55/push-ebp - 9730 89/<- %ebp 4/r32/esp - 9731 # . save registers - 9732 51/push-ecx - 9733 # ecx = stmt - 9734 8b/-> *(ebp+0xc) 1/r32/ecx - 9735 # var base/ecx: (addr var) = stmt->inouts[0] - 9736 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 9737 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 9738 89/<- %ecx 0/r32/eax - 9739 # if (var->register) do one thing - 9740 { - 9741 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register - 9742 74/jump-if-= break/disp8 - 9743 # TODO: ensure there's no dereference - 9744 (translate-mu-index-stmt-with-array-in-register *(ebp+8) *(ebp+0xc)) - 9745 eb/jump $translate-mu-index-stmt:end/disp8 - 9746 } - 9747 # if (var->offset) do a different thing - 9748 { - 9749 81 7/subop/compare *(ecx+0x14) 0/imm32 # Var-offset - 9750 74/jump-if-= break/disp8 - 9751 # TODO: ensure there's no dereference - 9752 (translate-mu-index-stmt-with-array-on-stack *(ebp+8) *(ebp+0xc)) - 9753 eb/jump $translate-mu-index-stmt:end/disp8 - 9754 } - 9755 $translate-mu-index-stmt:end: - 9756 # . restore registers - 9757 59/pop-to-ecx - 9758 # . epilogue - 9759 89/<- %esp 5/r32/ebp - 9760 5d/pop-to-ebp - 9761 c3/return - 9762 - 9763 $translate-mu-index-stmt-with-array:error1: - 9764 (write-buffered Stderr "couldn't translate an index instruction. second (index) input must either lie in a register or be a literal\n") - 9765 (flush Stderr) - 9766 # . syscall(exit, 1) - 9767 bb/copy-to-ebx 1/imm32 - 9768 b8/copy-to-eax 1/imm32/exit - 9769 cd/syscall 0x80/imm8 - 9770 # never gets here - 9771 - 9772 $translate-mu-index-stmt-with-array:error2: - 9773 (write-buffered Stderr "couldn't translate an index instruction. second (index) input when in a register must be an int or offset\n") - 9774 (flush Stderr) - 9775 # . syscall(exit, 1) - 9776 bb/copy-to-ebx 1/imm32 - 9777 b8/copy-to-eax 1/imm32/exit - 9778 cd/syscall 0x80/imm8 - 9779 # never gets here - 9780 - 9781 translate-mu-index-stmt-with-array-in-register: # out: (addr buffered-file), stmt: (addr stmt) - 9782 # . prologue - 9783 55/push-ebp - 9784 89/<- %ebp 4/r32/esp - 9785 # . save registers - 9786 50/push-eax - 9787 51/push-ecx - 9788 52/push-edx - 9789 53/push-ebx - 9790 # - 9791 (emit-indent *(ebp+8) *Curr-block-depth) - 9792 (write-buffered *(ebp+8) "8d/copy-address *(") - 9793 # TODO: ensure inouts[0] is in a register and not dereferenced - 9794 $translate-mu-index-stmt-with-array-in-register:emit-base: - 9795 # ecx = stmt - 9796 8b/-> *(ebp+0xc) 1/r32/ecx - 9797 # var base/ebx: (addr var) = inouts[0] - 9798 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 9799 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 9800 89/<- %ebx 0/r32/eax - 9801 # print base->register " + " - 9802 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax - 9803 (write-buffered *(ebp+8) %eax) - 9804 (write-buffered *(ebp+8) " + ") - 9805 # var index/edx: (addr var) = inouts[1] - 9806 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 9807 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax - 9808 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 9809 89/<- %edx 0/r32/eax - 9810 # if index->register - 9811 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register - 9812 { - 9813 0f 84/jump-if-= break/disp32 - 9814 $translate-mu-index-stmt-with-array-in-register:emit-register-index: - 9815 # if index is an int - 9816 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 9817 (is-simple-mu-type? %eax 1) # int => eax - 9818 3d/compare-eax-and 0/imm32/false - 9819 { - 9820 0f 84/jump-if-= break/disp32 - 9821 $translate-mu-index-stmt-with-array-in-register:emit-int-register-index: - 9822 # print index->register "<<" log2(size-of(element(base->type))) " + 4) " - 9823 # . index->register "<<" - 9824 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax - 9825 (write-buffered *(ebp+8) %eax) - 9826 (write-buffered *(ebp+8) "<<") - 9827 # . log2(size-of(element(base->type))) - 9828 # TODO: ensure size is a power of 2 - 9829 (array-element-type-id %ebx) # => eax - 9830 (size-of-type-id %eax) # => eax - 9831 (num-shift-rights %eax) # => eax - 9832 (print-int32-buffered *(ebp+8) %eax) - 9833 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-register-index-done/disp32 - 9834 } - 9835 # if index->type is any other atom, abort - 9836 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 9837 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom - 9838 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 - 9839 # if index has type (offset ...) - 9840 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax - 9841 (is-simple-mu-type? %eax 7) # => eax - 9842 3d/compare-eax-and 0/imm32/false - 9843 { - 9844 0f 84/jump-if-= break/disp32 - 9845 # print index->register - 9846 $translate-mu-index-stmt-with-array-in-register:emit-offset-register-index: - 9847 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax - 9848 (write-buffered *(ebp+8) %eax) - 9849 } - 9850 $translate-mu-index-stmt-with-array-in-register:emit-register-index-done: - 9851 (write-buffered *(ebp+8) " + 4) ") - 9852 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 - 9853 } - 9854 # otherwise if index is a literal - 9855 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 9856 (is-simple-mu-type? %eax 0) # => eax - 9857 3d/compare-eax-and 0/imm32/false - 9858 { - 9859 0f 84/jump-if-= break/disp32 - 9860 $translate-mu-index-stmt-with-array-in-register:emit-literal-index: - 9861 # var index-value/edx: int = parse-hex-int(index->name) - 9862 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 9863 (parse-hex-int %eax) # => eax - 9864 89/<- %edx 0/r32/eax - 9865 # offset = idx-value * size-of(element(base->type)) - 9866 (array-element-type-id %ebx) # => eax - 9867 (size-of-type-id %eax) # => eax - 9868 f7 4/subop/multiply-into-eax %edx # clobbers edx - 9869 # offset += 4 for array size - 9870 05/add-to-eax 4/imm32 - 9871 # TODO: check edx for overflow - 9872 # print offset - 9873 (print-int32-buffered *(ebp+8) %eax) - 9874 (write-buffered *(ebp+8) ") ") - 9875 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 - 9876 } - 9877 # otherwise abort - 9878 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 - 9879 $translate-mu-index-stmt-with-array-in-register:emit-output: - 9880 # outputs[0] "/r32" - 9881 8b/-> *(ebp+0xc) 1/r32/ecx - 9882 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax - 9883 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 9884 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax - 9885 (get Registers %eax 0xc "Registers") # => eax: (addr int) - 9886 (print-int32-buffered *(ebp+8) *eax) - 9887 (write-buffered *(ebp+8) "/r32\n") - 9888 $translate-mu-index-stmt-with-array-in-register:end: - 9889 # . restore registers - 9890 5b/pop-to-ebx - 9891 5a/pop-to-edx - 9892 59/pop-to-ecx - 9893 58/pop-to-eax - 9894 # . epilogue - 9895 89/<- %esp 5/r32/ebp - 9896 5d/pop-to-ebp - 9897 c3/return - 9898 - 9899 translate-mu-index-stmt-with-array-on-stack: # out: (addr buffered-file), stmt: (addr stmt) - 9900 # . prologue - 9901 55/push-ebp - 9902 89/<- %ebp 4/r32/esp - 9903 # . save registers - 9904 50/push-eax - 9905 51/push-ecx - 9906 52/push-edx - 9907 53/push-ebx - 9908 # - 9909 (emit-indent *(ebp+8) *Curr-block-depth) - 9910 (write-buffered *(ebp+8) "8d/copy-address *(ebp + ") - 9911 # var curr/edx: (addr stmt-var) = lookup(stmt->inouts) - 9912 8b/-> *(ebp+0xc) 0/r32/eax - 9913 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 9914 89/<- %edx 0/r32/eax - 9915 # var base/ecx: (addr var) = lookup(curr->value) - 9916 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 9917 89/<- %ecx 0/r32/eax - 9918 # var curr2/eax: (addr stmt-var) = lookup(curr->next) - 9919 (lookup *(edx+8) *(edx+0xc)) # Stmt-var-next Stmt-var-next => eax - 9920 # var index/edx: (handle var) = curr2->value - 9921 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 9922 89/<- %edx 0/r32/eax - 9923 # if index->register - 9924 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register - 9925 { - 9926 0f 84/jump-if-= break/disp32 - 9927 $translate-mu-index-stmt-with-array-on-stack:emit-register-index: - 9928 # if index is an int - 9929 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 9930 (is-simple-mu-type? %eax 1) # int => eax - 9931 3d/compare-eax-and 0/imm32/false - 9932 { - 9933 0f 84/jump-if-= break/disp32 - 9934 $translate-mu-index-stmt-with-array-on-stack:emit-int-register-index: - 9935 # print index->register "<<" log2(size-of(element-type(base))) " + " base->offset+4 - 9936 # . inouts[1]->register "<<" - 9937 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax - 9938 (write-buffered *(ebp+8) %eax) - 9939 (write-buffered *(ebp+8) "<<") - 9940 # . log2(size-of(element(base))) - 9941 # TODO: ensure size is a power of 2 - 9942 (array-element-type-id %ecx) # => eax - 9943 (size-of-type-id %eax) # => eax - 9944 (num-shift-rights %eax) # => eax - 9945 (print-int32-buffered *(ebp+8) %eax) - 9946 # - 9947 (write-buffered *(ebp+8) " + ") - 9948 # - 9949 8b/-> *(ecx+0x14) 0/r32/eax # Var-offset - 9950 05/add-to-eax 4/imm32 # for array length - 9951 (print-int32-buffered *(ebp+8) %eax) - 9952 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done/disp32 - 9953 } - 9954 # if index->type is any other atom, abort - 9955 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 9956 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom - 9957 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 - 9958 # if index has type (offset ...) - 9959 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax - 9960 (is-simple-mu-type? %eax 7) # => eax - 9961 3d/compare-eax-and 0/imm32/false - 9962 { - 9963 0f 84/jump-if-= break/disp32 - 9964 # print index->register - 9965 $translate-mu-index-stmt-with-array-on-stack:emit-offset-register-index: - 9966 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax - 9967 (write-buffered *(ebp+8) %eax) - 9968 } - 9969 $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done: - 9970 (write-buffered *(ebp+8) ") ") - 9971 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 - 9972 } - 9973 # otherwise if index is a literal - 9974 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 9975 (is-simple-mu-type? %eax 0) # => eax - 9976 3d/compare-eax-and 0/imm32/false - 9977 { - 9978 0f 84/jump-if-= break/disp32 - 9979 $translate-mu-index-stmt-with-array-on-stack:emit-literal-index: - 9980 # var idx-value/edx: int = parse-hex-int(index->name) - 9981 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 9982 (parse-hex-int %eax) # Var-name => eax - 9983 89/<- %edx 0/r32/eax - 9984 # offset = idx-value * size-of(element-type(base->type)) - 9985 (array-element-type-id %ecx) # => eax - 9986 (size-of-type-id %eax) # => eax - 9987 f7 4/subop/multiply-into-eax %edx # clobbers edx - 9988 # offset += base->offset - 9989 03/add *(ecx+0x14) 0/r32/eax # Var-offset - 9990 # offset += 4 for array size - 9991 05/add-to-eax 4/imm32 - 9992 # TODO: check edx for overflow - 9993 # print offset - 9994 (print-int32-buffered *(ebp+8) %eax) - 9995 (write-buffered *(ebp+8) ") ") - 9996 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 - 9997 } - 9998 # otherwise abort - 9999 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 -10000 $translate-mu-index-stmt-with-array-on-stack:emit-output: -10001 # outputs[0] "/r32" -10002 8b/-> *(ebp+0xc) 0/r32/eax -10003 (lookup *(eax+0x14) *(eax+0x18)) # Stmt1-outputs Stmt1-outputs => eax -10004 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10005 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -10006 (get Registers %eax 0xc "Registers") # => eax: (addr int) -10007 (print-int32-buffered *(ebp+8) *eax) -10008 (write-buffered *(ebp+8) "/r32\n") -10009 $translate-mu-index-stmt-with-array-on-stack:end: -10010 # . restore registers -10011 5b/pop-to-ebx -10012 5a/pop-to-edx -10013 59/pop-to-ecx -10014 58/pop-to-eax -10015 # . epilogue -10016 89/<- %esp 5/r32/ebp -10017 5d/pop-to-ebp -10018 c3/return -10019 -10020 translate-mu-compute-index-stmt: # out: (addr buffered-file), stmt: (addr stmt) -10021 # . prologue -10022 55/push-ebp -10023 89/<- %ebp 4/r32/esp -10024 # . save registers -10025 50/push-eax -10026 51/push-ecx -10027 52/push-edx -10028 53/push-ebx -10029 # -10030 (emit-indent *(ebp+8) *Curr-block-depth) -10031 (write-buffered *(ebp+8) "69/multiply") -10032 # ecx = stmt -10033 8b/-> *(ebp+0xc) 1/r32/ecx -10034 # var first-inout/ebx: (addr stmt-var) = stmt->inouts[0] -10035 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -10036 89/<- %ebx 0/r32/eax -10037 $translate-mu-compute-index-stmt:emit-index: -10038 (lookup *(ebx+8) *(ebx+0xc)) # Stmt-var-next Stmt-var-next => eax -10039 (emit-subx-var-as-rm32 *(ebp+8) %eax) -10040 (write-buffered *(ebp+8) Space) -10041 $translate-mu-compute-index-stmt:emit-elem-size: -10042 # var base/ebx: (addr var) -10043 (lookup *ebx *(ebx+4)) # Stmt-var-value Stmt-var-value => eax -10044 89/<- %ebx 0/r32/eax -10045 # print size-of(element(base->type)) -10046 (array-element-type-id %ebx) # => eax -10047 (size-of-type-id %eax) # => eax -10048 (print-int32-buffered *(ebp+8) %eax) -10049 (write-buffered *(ebp+8) "/imm32 ") -10050 $translate-mu-compute-index-stmt:emit-output: -10051 # outputs[0] "/r32" -10052 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -10053 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10054 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -10055 (get Registers %eax 0xc "Registers") # => eax: (addr int) -10056 (print-int32-buffered *(ebp+8) *eax) -10057 (write-buffered *(ebp+8) "/r32\n") -10058 $translate-mu-compute-index-stmt:end: -10059 # . restore registers -10060 5b/pop-to-ebx -10061 5a/pop-to-edx -10062 59/pop-to-ecx -10063 58/pop-to-eax -10064 # . epilogue -10065 89/<- %esp 5/r32/ebp -10066 5d/pop-to-ebp -10067 c3/return -10068 -10069 translate-mu-get-stmt: # out: (addr buffered-file), stmt: (addr stmt) -10070 # . prologue -10071 55/push-ebp -10072 89/<- %ebp 4/r32/esp -10073 # . save registers -10074 50/push-eax -10075 51/push-ecx -10076 52/push-edx -10077 # -10078 (emit-indent *(ebp+8) *Curr-block-depth) -10079 (write-buffered *(ebp+8) "8d/copy-address ") -10080 # ecx = stmt -10081 8b/-> *(ebp+0xc) 1/r32/ecx -10082 # var offset/edx: int = get offset of stmt -10083 (mu-get-offset %ecx) # => eax -10084 89/<- %edx 0/r32/eax -10085 # var base/eax: (addr var) = stmt->inouts->value -10086 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -10087 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10088 # if base is in a register -10089 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -10090 { -10091 0f 84/jump-if-= break/disp32 -10092 $translate-mu-get-stmt:emit-register-input: -10093 # emit "*(" base->register " + " offset ") " -10094 (write-buffered *(ebp+8) "*(") -10095 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -10096 (write-buffered *(ebp+8) %eax) -10097 (write-buffered *(ebp+8) " + ") -10098 (print-int32-buffered *(ebp+8) %edx) -10099 (write-buffered *(ebp+8) ") ") -10100 e9/jump $translate-mu-get-stmt:emit-output/disp32 -10101 } -10102 # otherwise base is on the stack -10103 { -10104 $translate-mu-get-stmt:emit-stack-input: -10105 # emit "*(ebp + " inouts[0]->stack-offset + offset ") " -10106 (write-buffered *(ebp+8) "*(ebp+") -10107 03/add *(eax+0x14) 2/r32/edx # Var-offset -10108 (print-int32-buffered *(ebp+8) %edx) -10109 (write-buffered *(ebp+8) ") ") -10110 eb/jump $translate-mu-get-stmt:emit-output/disp8 -10111 } -10112 $translate-mu-get-stmt:emit-output: -10113 # var output/eax: (addr var) = stmt->outputs->value -10114 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -10115 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10116 # emit offset->register "/r32" -10117 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -10118 (get Registers %eax 0xc "Registers") # => eax: (addr int) -10119 (print-int32-buffered *(ebp+8) *eax) -10120 (write-buffered *(ebp+8) "/r32\n") -10121 $translate-mu-get-stmt:end: -10122 # . restore registers -10123 5a/pop-to-edx -10124 59/pop-to-ecx -10125 58/pop-to-eax -10126 # . epilogue -10127 89/<- %esp 5/r32/ebp -10128 5d/pop-to-ebp -10129 c3/return -10130 -10131 array-element-type-id: # v: (addr var) -> result/eax: type-id -10132 # precondition: n is positive -10133 # . prologue -10134 55/push-ebp -10135 89/<- %ebp 4/r32/esp -10136 # -10137 8b/-> *(ebp+8) 0/r32/eax -10138 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -10139 # TODO: ensure type->left is 'addr' -10140 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax -10141 # TODO: ensure that type->right is non-null -10142 # TODO: ensure that type->right->left is 'array' -10143 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax -10144 # TODO: ensure that type->right->right is non-null -10145 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax -10146 8b/-> *(eax+4) 0/r32/eax # Tree-value -10147 $array-element-type-id:end: -10148 # . epilogue -10149 89/<- %esp 5/r32/ebp -10150 5d/pop-to-ebp -10151 c3/return -10152 -10153 power-of-2?: # n: int -> result/eax: boolean -10154 # precondition: n is positive -10155 # . prologue -10156 55/push-ebp -10157 89/<- %ebp 4/r32/esp -10158 # eax = n -10159 8b/-> *(ebp+8) 0/r32/eax -10160 # if (n < 0) abort -10161 3d/compare-eax-with 0/imm32 -10162 0f 8c/jump-if-< $power-of-2?:abort/disp32 -10163 # var tmp/eax: int = n-1 -10164 48/decrement-eax -10165 # var tmp2/eax: int = n & tmp -10166 23/and-> *(ebp+8) 0/r32/eax -10167 # return (tmp2 == 0) -10168 3d/compare-eax-and 0/imm32 -10169 0f 94/set-byte-if-= %al -10170 81 4/subop/and %eax 0xff/imm32 -10171 $power-of-2?:end: -10172 # . epilogue -10173 89/<- %esp 5/r32/ebp -10174 5d/pop-to-ebp -10175 c3/return -10176 -10177 $power-of-2?:abort: -10178 (write-buffered Stderr "power-of-2?: negative number\n") -10179 (flush Stderr) -10180 # . syscall(exit, 1) -10181 bb/copy-to-ebx 1/imm32 -10182 b8/copy-to-eax 1/imm32/exit -10183 cd/syscall 0x80/imm8 -10184 # never gets here -10185 -10186 num-shift-rights: # n: int -> result/eax: int -10187 # precondition: n is a positive power of 2 -10188 # . prologue -10189 55/push-ebp -10190 89/<- %ebp 4/r32/esp -10191 # . save registers -10192 51/push-ecx -10193 # var curr/ecx: int = n -10194 8b/-> *(ebp+8) 1/r32/ecx -10195 # result = 0 -10196 b8/copy-to-eax 0/imm32 -10197 { -10198 # if (curr <= 1) break -10199 81 7/subop/compare %ecx 1/imm32 -10200 7e/jump-if-<= break/disp8 -10201 40/increment-eax -10202 c1/shift 5/subop/arithmetic-right %ecx 1/imm8 -10203 eb/jump loop/disp8 -10204 } -10205 $num-shift-rights:end: -10206 # . restore registers -10207 59/pop-to-ecx -10208 # . epilogue -10209 89/<- %esp 5/r32/ebp -10210 5d/pop-to-ebp -10211 c3/return -10212 -10213 mu-get-offset: # stmt: (addr stmt) -> result/eax: int -10214 # . prologue -10215 55/push-ebp -10216 89/<- %ebp 4/r32/esp -10217 # var second-inout/eax: (addr stmt-var) = stmt->inouts->next -10218 8b/-> *(ebp+8) 0/r32/eax -10219 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -10220 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -10221 # var output-var/eax: (addr var) = second-inout->value -10222 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10223 #? (write-buffered Stderr "mu-get-offset: ") -10224 #? (print-int32-buffered Stderr %eax) -10225 #? (write-buffered Stderr " name: ") -10226 #? 50/push-eax -10227 #? (lookup *eax *(eax+4)) # Var-name -10228 #? (write-buffered Stderr %eax) -10229 #? 58/pop-to-eax -10230 #? (write-buffered Stderr Newline) -10231 #? (flush Stderr) -10232 # return output-var->stack-offset -10233 8b/-> *(eax+0x14) 0/r32/eax # Var-offset -10234 #? (write-buffered Stderr "=> ") -10235 #? (print-int32-buffered Stderr %eax) -10236 #? (write-buffered Stderr Newline) -10237 #? (flush Stderr) -10238 $emit-get-offset:end: -10239 # . epilogue -10240 89/<- %esp 5/r32/ebp -10241 5d/pop-to-ebp -10242 c3/return -10243 -10244 emit-subx-block: # out: (addr buffered-file), block: (addr block), vars: (addr stack live-var), fn-outputs: (addr list var) -10245 # . prologue -10246 55/push-ebp -10247 89/<- %ebp 4/r32/esp -10248 # . save registers -10249 50/push-eax -10250 51/push-ecx -10251 56/push-esi -10252 # esi = block -10253 8b/-> *(ebp+0xc) 6/r32/esi -10254 # block->var->block-depth = *Curr-block-depth -10255 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax -10256 8b/-> *Curr-block-depth 1/r32/ecx -10257 89/<- *(eax+0x10) 1/r32/ecx # Var-block-depth -10258 # var stmts/eax: (addr list stmt) = lookup(block->statements) -10259 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax -10260 # -10261 { -10262 $emit-subx-block:check-empty: -10263 3d/compare-eax-and 0/imm32 -10264 0f 84/jump-if-= break/disp32 -10265 (emit-indent *(ebp+8) *Curr-block-depth) -10266 (write-buffered *(ebp+8) "{\n") -10267 # var v/ecx: (addr var) = lookup(block->var) -10268 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax -10269 89/<- %ecx 0/r32/eax -10270 # -10271 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -10272 (write-buffered *(ebp+8) %eax) -10273 (write-buffered *(ebp+8) ":loop:\n") -10274 ff 0/subop/increment *Curr-block-depth -10275 (push *(ebp+0x10) *(esi+0xc)) # Block-var -10276 (push *(ebp+0x10) *(esi+0x10)) # Block-var -10277 (push *(ebp+0x10) 0) # false -10278 # emit block->statements -10279 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax -10280 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10) *(ebp+0x14)) -10281 (pop *(ebp+0x10)) # => eax -10282 (pop *(ebp+0x10)) # => eax -10283 (pop *(ebp+0x10)) # => eax -10284 ff 1/subop/decrement *Curr-block-depth -10285 (emit-indent *(ebp+8) *Curr-block-depth) -10286 (write-buffered *(ebp+8) "}\n") -10287 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -10288 (write-buffered *(ebp+8) %eax) -10289 (write-buffered *(ebp+8) ":break:\n") -10290 } -10291 $emit-subx-block:end: -10292 # . restore registers -10293 5e/pop-to-esi -10294 59/pop-to-ecx -10295 58/pop-to-eax -10296 # . epilogue -10297 89/<- %esp 5/r32/ebp -10298 5d/pop-to-ebp -10299 c3/return -10300 -10301 # Primitives supported -10302 # See mu_instructions for a summary of this linked-list data structure. -10303 # -10304 # For each operation, put variants with hard-coded registers before flexible ones. -10305 # -10306 # Unfortunately, our restrictions on addresses require that various fields in -10307 # primitives be handles, which complicates these definitions. -10308 # - we need to insert dummy fields all over the place for fake alloc-ids -10309 # - we can't use our syntax sugar of quoted literals for string fields -10310 # -10311 # Fake alloc-ids are needed because our type definitions up top require -10312 # handles but it's clearer to statically allocate these long-lived objects. -10313 # Fake alloc-ids are perfectly safe, but they can't be reclaimed. + 8010 (write-buffered Stderr " reg: ") + 8011 (print-int32-buffered Stderr *(ebx+0x18)) # Var-register + 8012 (write-buffered Stderr ",") + 8013 (print-int32-buffered Stderr *(ebx+0x1c)) # Var-register + 8014 (write-buffered Stderr "->") + 8015 (flush Stderr) + 8016 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register + 8017 (print-int32-buffered Stderr %eax) + 8018 { + 8019 3d/compare-eax-and 0/imm32 + 8020 74/jump-if-= break/disp8 + 8021 (write-buffered Stderr Space) + 8022 (write-buffered Stderr %eax) + 8023 } + 8024 (write-buffered Stderr Newline) + 8025 (flush Stderr) + 8026 } + 8027 (flush Stderr) + 8028 # curr += row-size + 8029 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size + 8030 # + 8031 e9/jump loop/disp32 + 8032 } + 8033 $dump-typeinfo:end: + 8034 # . restore registers + 8035 5f/pop-to-edi + 8036 5e/pop-to-esi + 8037 5b/pop-to-ebx + 8038 5a/pop-to-edx + 8039 59/pop-to-ecx + 8040 58/pop-to-eax + 8041 # . epilogue + 8042 89/<- %esp 5/r32/ebp + 8043 5d/pop-to-ebp + 8044 c3/return + 8045 + 8046 ####################################################### + 8047 # Type-checking + 8048 ####################################################### + 8049 + 8050 check-mu-types: + 8051 # . prologue + 8052 55/push-ebp + 8053 89/<- %ebp 4/r32/esp + 8054 # + 8055 $check-mu-types:end: + 8056 # . epilogue + 8057 89/<- %esp 5/r32/ebp + 8058 5d/pop-to-ebp + 8059 c3/return + 8060 + 8061 size-of: # v: (addr var) -> result/eax: int + 8062 # . prologue + 8063 55/push-ebp + 8064 89/<- %ebp 4/r32/esp + 8065 # . save registers + 8066 51/push-ecx + 8067 # var t/ecx: (addr tree type-id) = lookup(v->type) + 8068 8b/-> *(ebp+8) 1/r32/ecx + 8069 #? (write-buffered Stderr "size-of ") + 8070 #? (print-int32-buffered Stderr %ecx) + 8071 #? (write-buffered Stderr Newline) + 8072 #? (write-buffered Stderr "type allocid: ") + 8073 #? (print-int32-buffered Stderr *(ecx+8)) + 8074 #? (write-buffered Stderr Newline) + 8075 #? (flush Stderr) + 8076 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 8077 89/<- %ecx 0/r32/eax + 8078 # if is-mu-array?(t) return size-of-array(t) + 8079 { + 8080 (is-mu-array? %ecx) # => eax + 8081 3d/compare-eax-and 0/imm32/false + 8082 74/jump-if-= break/disp8 + 8083 (size-of-array %ecx) # => eax + 8084 eb/jump $size-of:end/disp8 + 8085 } + 8086 # if (!t->is-atom?) t = lookup(t->left) + 8087 { + 8088 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom + 8089 75/jump-if-!= break/disp8 + 8090 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax + 8091 89/<- %ecx 0/r32/eax + 8092 } + 8093 # TODO: assert t->is-atom? + 8094 (size-of-type-id *(ecx+4)) # Tree-value => eax + 8095 $size-of:end: + 8096 # . restore registers + 8097 59/pop-to-ecx + 8098 # . epilogue + 8099 89/<- %esp 5/r32/ebp + 8100 5d/pop-to-ebp + 8101 c3/return + 8102 + 8103 size-of-deref: # v: (addr var) -> result/eax: int + 8104 # . prologue + 8105 55/push-ebp + 8106 89/<- %ebp 4/r32/esp + 8107 # . save registers + 8108 51/push-ecx + 8109 # var t/ecx: (addr tree type-id) = lookup(v->type) + 8110 8b/-> *(ebp+8) 1/r32/ecx + 8111 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 8112 89/<- %ecx 0/r32/eax + 8113 # TODO: assert(t is an addr) + 8114 # t = lookup(t->right) + 8115 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax + 8116 89/<- %ecx 0/r32/eax + 8117 # if is-mu-array?(t) return size-of-array(t) + 8118 { + 8119 (is-mu-array? %ecx) # => eax + 8120 3d/compare-eax-and 0/imm32/false + 8121 74/jump-if-= break/disp8 + 8122 (size-of-array %ecx) # => eax + 8123 eb/jump $size-of:end/disp8 + 8124 } + 8125 # if (!t->is-atom?) t = lookup(t->left) + 8126 { + 8127 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom + 8128 75/jump-if-!= break/disp8 + 8129 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax + 8130 89/<- %ecx 0/r32/eax + 8131 } + 8132 # TODO: assert t->is-atom? + 8133 (size-of-type-id *(ecx+4)) # Tree-value => eax + 8134 $size-of-deref:end: + 8135 # . restore registers + 8136 59/pop-to-ecx + 8137 # . epilogue + 8138 89/<- %esp 5/r32/ebp + 8139 5d/pop-to-ebp + 8140 c3/return + 8141 + 8142 is-mu-array?: # t: (addr tree type-id) -> result/eax: boolean + 8143 # . prologue + 8144 55/push-ebp + 8145 89/<- %ebp 4/r32/esp + 8146 # . save registers + 8147 51/push-ecx + 8148 # ecx = t + 8149 8b/-> *(ebp+8) 1/r32/ecx + 8150 # if t->is-atom?, return false + 8151 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom + 8152 75/jump-if-!= $is-mu-array?:return-false/disp8 + 8153 # if !t->left->is-atom?, return false + 8154 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax + 8155 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom + 8156 74/jump-if-= $is-mu-array?:return-false/disp8 + 8157 # return t->left->value == array + 8158 81 7/subop/compare *(eax+4) 3/imm32/array-type-id # Tree-value + 8159 0f 94/set-if-= %al + 8160 81 4/subop/and %eax 0xff/imm32 + 8161 eb/jump $is-mu-array?:end/disp8 + 8162 $is-mu-array?:return-false: + 8163 b8/copy-to-eax 0/imm32/false + 8164 $is-mu-array?:end: + 8165 # . restore registers + 8166 59/pop-to-ecx + 8167 # . epilogue + 8168 89/<- %esp 5/r32/ebp + 8169 5d/pop-to-ebp + 8170 c3/return + 8171 + 8172 size-of-array: # a: (addr tree type-id) -> result/eax: int + 8173 # . prologue + 8174 55/push-ebp + 8175 89/<- %ebp 4/r32/esp + 8176 # . save registers + 8177 51/push-ecx + 8178 52/push-edx + 8179 # + 8180 8b/-> *(ebp+8) 1/r32/ecx + 8181 # TODO: assert that a->left is 'array' + 8182 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax + 8183 89/<- %ecx 0/r32/eax + 8184 # var elem-type/edx: type-id = a->right->left->value + 8185 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax + 8186 8b/-> *(eax+4) 2/r32/edx # Tree-value + 8187 # var array-size/ecx: int = a->right->right->left->value + 8188 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax + 8189 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax + 8190 8b/-> *(eax+4) 1/r32/ecx # Tree-value + 8191 # return array-size * size-of(elem-type) + 8192 (size-of-type-id %edx) # => eax + 8193 f7 4/subop/multiply-into-eax %ecx + 8194 05/add-to-eax 4/imm32 # for array size + 8195 $size-of-array:end: + 8196 # . restore registers + 8197 5a/pop-to-edx + 8198 59/pop-to-ecx + 8199 # . epilogue + 8200 89/<- %esp 5/r32/ebp + 8201 5d/pop-to-ebp + 8202 c3/return + 8203 + 8204 size-of-type-id: # t: type-id -> result/eax: int + 8205 # . prologue + 8206 55/push-ebp + 8207 89/<- %ebp 4/r32/esp + 8208 # . save registers + 8209 51/push-ecx + 8210 # var out/ecx: (handle typeinfo) + 8211 68/push 0/imm32 + 8212 68/push 0/imm32 + 8213 89/<- %ecx 4/r32/esp + 8214 # eax = t + 8215 8b/-> *(ebp+8) 0/r32/eax + 8216 # if t is a literal, return 0 + 8217 3d/compare-eax-and 0/imm32 + 8218 74/jump-if-= $size-of-type-id:end/disp8 # eax changes type from type-id to int + 8219 # if t is a handle, return 8 + 8220 3d/compare-eax-and 4/imm32/handle + 8221 { + 8222 75/jump-if-!= break/disp8 + 8223 b8/copy-to-eax 8/imm32 + 8224 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int + 8225 } + 8226 # if t is a user-defined type, return its size + 8227 # TODO: support non-atom type + 8228 (find-typeinfo %eax %ecx) + 8229 { + 8230 81 7/subop/compare *ecx 0/imm32 + 8231 74/jump-if-= break/disp8 + 8232 $size-of-type-id:user-defined: + 8233 (lookup *ecx *(ecx+4)) # => eax + 8234 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes + 8235 eb/jump $size-of-type-id:end/disp8 + 8236 } + 8237 # otherwise return the word size + 8238 b8/copy-to-eax 4/imm32 + 8239 $size-of-type-id:end: + 8240 # . reclaim locals + 8241 81 0/subop/add %esp 8/imm32 + 8242 # . restore registers + 8243 59/pop-to-ecx + 8244 # . epilogue + 8245 89/<- %esp 5/r32/ebp + 8246 5d/pop-to-ebp + 8247 c3/return + 8248 + 8249 type-equal?: # a: (addr tree type-id), b: (addr tree type-id) -> result/eax: boolean + 8250 # . prologue + 8251 55/push-ebp + 8252 89/<- %ebp 4/r32/esp + 8253 # . save registers + 8254 51/push-ecx + 8255 52/push-edx + 8256 # ecx = a + 8257 8b/-> *(ebp+8) 1/r32/ecx + 8258 # edx = b + 8259 8b/-> *(ebp+0xc) 2/r32/edx + 8260 # if (a == b) return true + 8261 8b/-> %ecx 0/r32/eax # Var-type + 8262 39/compare %edx 0/r32/eax # Var-type + 8263 b8/copy-to-eax 1/imm32/true + 8264 74/jump-if-= $type-equal?:end/disp8 + 8265 # if (a < MAX_TYPE_ID) return false + 8266 81 7/subop/compare %ecx 0x10000/imm32 + 8267 b8/copy-to-eax 0/imm32/false + 8268 72/jump-if-addr< $type-equal?:end/disp8 + 8269 # if (b < MAX_TYPE_ID) return false + 8270 81 7/subop/compare %edx 0x10000/imm32 + 8271 b8/copy-to-eax 0/imm32/false + 8272 72/jump-if-addr< $type-equal?:end/disp8 + 8273 # if (!type-equal?(a->left, b->left)) return false + 8274 (type-equal? *(ecx+4) *(edx+4)) # Tree-left, Tree-left => eax + 8275 3d/compare-eax-and 0/imm32/false + 8276 74/jump-if-= $type-equal?:end/disp8 + 8277 # return type-equal?(a->right, b->right) + 8278 (type-equal? *(ecx+8) *(edx+8)) # Tree-right, Tree-right => eax + 8279 $type-equal?:end: + 8280 # . restore registers + 8281 5a/pop-to-edx + 8282 59/pop-to-ecx + 8283 # . epilogue + 8284 89/<- %esp 5/r32/ebp + 8285 5d/pop-to-ebp + 8286 c3/return + 8287 + 8288 ####################################################### + 8289 # Code-generation + 8290 ####################################################### + 8291 + 8292 == data + 8293 + 8294 Curr-block-depth: # (addr int) + 8295 0/imm32 + 8296 Curr-local-stack-offset: # (addr int) + 8297 0/imm32 + 8298 + 8299 == code + 8300 + 8301 emit-subx: # out: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) + 8302 # . prologue + 8303 55/push-ebp + 8304 89/<- %ebp 4/r32/esp + 8305 # . save registers + 8306 50/push-eax + 8307 # var curr/eax: (addr function) = *Program->functions + 8308 (lookup *_Program-functions *_Program-functions->payload) # => eax + 8309 { + 8310 # if (curr == null) break + 8311 3d/compare-eax-and 0/imm32 + 8312 0f 84/jump-if-= break/disp32 + 8313 (emit-subx-function *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) + 8314 # curr = lookup(curr->next) + 8315 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax + 8316 e9/jump loop/disp32 + 8317 } + 8318 $emit-subx:end: + 8319 # . restore registers + 8320 58/pop-to-eax + 8321 # . epilogue + 8322 89/<- %esp 5/r32/ebp + 8323 5d/pop-to-ebp + 8324 c3/return + 8325 + 8326 emit-subx-function: # out: (addr buffered-file), f: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) + 8327 # . prologue + 8328 55/push-ebp + 8329 89/<- %ebp 4/r32/esp + 8330 # some preprocessing + 8331 (populate-mu-type-offsets-in-inouts *(ebp+0xc)) + 8332 # . save registers + 8333 50/push-eax + 8334 51/push-ecx + 8335 52/push-edx + 8336 57/push-edi + 8337 # initialize some global state + 8338 c7 0/subop/copy *Curr-block-depth 1/imm32 + 8339 c7 0/subop/copy *Curr-local-stack-offset 0/imm32 + 8340 # ecx = f + 8341 8b/-> *(ebp+0xc) 1/r32/ecx + 8342 # var vars/edx: (stack (addr var) 256) + 8343 81 5/subop/subtract %esp 0xc00/imm32 + 8344 68/push 0xc00/imm32/size + 8345 68/push 0/imm32/top + 8346 89/<- %edx 4/r32/esp + 8347 # var name/eax: (addr array byte) = lookup(f->name) + 8348 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax + 8349 # + 8350 (write-buffered *(ebp+8) %eax) + 8351 (write-buffered *(ebp+8) ":\n") + 8352 (emit-subx-prologue *(ebp+8)) + 8353 # var outputs/edi: (addr list var) = lookup(f->outputs) + 8354 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax + 8355 89/<- %edi 0/r32/eax + 8356 # var body/eax: (addr block) = lookup(f->body) + 8357 (lookup *(ecx+0x18) *(ecx+0x1c)) # Function-body Function-body => eax + 8358 # + 8359 (emit-subx-block *(ebp+8) %eax %edx %edi *(ebp+0x10) *(ebp+0x14)) + 8360 (emit-subx-epilogue *(ebp+8)) + 8361 # TODO: validate that *Curr-block-depth and *Curr-local-stack-offset have + 8362 # been cleaned up + 8363 $emit-subx-function:end: + 8364 # . reclaim locals + 8365 81 0/subop/add %esp 0xc08/imm32 + 8366 # . restore registers + 8367 5f/pop-to-edi + 8368 5a/pop-to-edx + 8369 59/pop-to-ecx + 8370 58/pop-to-eax + 8371 # . epilogue + 8372 89/<- %esp 5/r32/ebp + 8373 5d/pop-to-ebp + 8374 c3/return + 8375 + 8376 populate-mu-type-offsets-in-inouts: # f: (addr function) + 8377 # . prologue + 8378 55/push-ebp + 8379 89/<- %ebp 4/r32/esp + 8380 # . save registers + 8381 50/push-eax + 8382 51/push-ecx + 8383 52/push-edx + 8384 53/push-ebx + 8385 57/push-edi + 8386 # var next-offset/edx: int = 8 + 8387 ba/copy-to-edx 8/imm32 + 8388 # var curr/ecx: (addr list var) = lookup(f->inouts) + 8389 8b/-> *(ebp+8) 1/r32/ecx + 8390 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax + 8391 89/<- %ecx 0/r32/eax + 8392 { + 8393 $populate-mu-type-offsets-in-inouts:loop: + 8394 81 7/subop/compare %ecx 0/imm32 + 8395 74/jump-if-= break/disp8 + 8396 # var v/ebx: (addr var) = lookup(curr->value) + 8397 (lookup *ecx *(ecx+4)) # List-value List-value => eax + 8398 89/<- %ebx 0/r32/eax + 8399 #? (lookup *ebx *(ebx+4)) + 8400 #? (write-buffered Stderr "setting offset of fn inout ") + 8401 #? (write-buffered Stderr %eax) + 8402 #? (write-buffered Stderr "@") + 8403 #? (print-int32-buffered Stderr %ebx) + 8404 #? (write-buffered Stderr " to ") + 8405 #? (print-int32-buffered Stderr %edx) + 8406 #? (write-buffered Stderr Newline) + 8407 #? (flush Stderr) + 8408 # v->offset = next-offset + 8409 89/<- *(ebx+0x14) 2/r32/edx # Var-offset + 8410 # next-offset += size-of(v) + 8411 (size-of %ebx) # => eax + 8412 01/add-to %edx 0/r32/eax + 8413 # curr = lookup(curr->next) + 8414 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax + 8415 89/<- %ecx 0/r32/eax + 8416 # + 8417 eb/jump loop/disp8 + 8418 } + 8419 $populate-mu-type-offsets-in-inouts:end: + 8420 # . restore registers + 8421 5f/pop-to-edi + 8422 5b/pop-to-ebx + 8423 5a/pop-to-edx + 8424 59/pop-to-ecx + 8425 58/pop-to-eax + 8426 # . epilogue + 8427 89/<- %esp 5/r32/ebp + 8428 5d/pop-to-ebp + 8429 c3/return + 8430 + 8431 emit-subx-stmt-list: # out: (addr buffered-file), stmts: (addr list stmt), vars: (addr stack live-var), fn-outputs: (addr list var), err: (addr buffered-file), ed: (addr exit-descriptor) + 8432 # . prologue + 8433 55/push-ebp + 8434 89/<- %ebp 4/r32/esp + 8435 # . save registers + 8436 50/push-eax + 8437 51/push-ecx + 8438 53/push-ebx + 8439 56/push-esi + 8440 # esi = stmts + 8441 8b/-> *(ebp+0xc) 6/r32/esi + 8442 # + 8443 { + 8444 $emit-subx-stmt-list:loop: + 8445 81 7/subop/compare %esi 0/imm32 + 8446 0f 84/jump-if-= break/disp32 + 8447 # var curr-stmt/ecx: (addr stmt) = lookup(stmts->value) + 8448 (lookup *esi *(esi+4)) # List-value List-value => eax + 8449 89/<- %ecx 0/r32/eax + 8450 { + 8451 $emit-subx-stmt-list:check-for-block: + 8452 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag + 8453 75/jump-if-!= break/disp8 + 8454 $emit-subx-stmt-list:block: + 8455 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) + 8456 } + 8457 { + 8458 $emit-subx-stmt-list:check-for-stmt: + 8459 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag + 8460 0f 85/jump-if-!= break/disp32 + 8461 $emit-subx-stmt-list:stmt1: + 8462 { + 8463 (is-mu-branch? %ecx) # => eax + 8464 3d/compare-eax-and 0/imm32/false + 8465 0f 84/jump-if-= break/disp32 + 8466 $emit-subx-stmt-list:branch-stmt: + 8467 +-- 27 lines: # unconditional loops ----------------------------------------------------------------------------------------------------------------------------------------------------- + 8494 +-- 16 lines: # unconditional breaks ---------------------------------------------------------------------------------------------------------------------------------------------------- + 8510 +-- 38 lines: # simple conditional branches without a target ---------------------------------------------------------------------------------------------------------------------------- + 8548 +-- 19 lines: # conditional branches with an explicit target ---------------------------------------------------------------------------------------------------------------------------- + 8567 } + 8568 $emit-subx-stmt-list:1-to-1: + 8569 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x18) *(ebp+0x1c)) + 8570 e9/jump $emit-subx-stmt-list:continue/disp32 + 8571 } + 8572 { + 8573 $emit-subx-stmt-list:check-for-var-def: + 8574 81 7/subop/compare *ecx 2/imm32/var-def # Stmt-tag + 8575 75/jump-if-!= break/disp8 + 8576 $emit-subx-stmt-list:var-def: + 8577 (emit-subx-var-def *(ebp+8) %ecx) + 8578 (push *(ebp+0x10) *(ecx+4)) # Vardef-var + 8579 (push *(ebp+0x10) *(ecx+8)) # Vardef-var + 8580 (push *(ebp+0x10) 0) # Live-var-register-spilled = 0 for vars on the stack + 8581 # + 8582 eb/jump $emit-subx-stmt-list:continue/disp8 + 8583 } + 8584 { + 8585 $emit-subx-stmt-list:check-for-reg-var-def: + 8586 81 7/subop/compare *ecx 3/imm32/reg-var-def # Stmt-tag + 8587 0f 85/jump-if-!= break/disp32 + 8588 $emit-subx-stmt-list:reg-var-def: + 8589 # TODO: ensure that there's exactly one output + 8590 (push-output-and-maybe-emit-spill *(ebp+8) %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) + 8591 # emit the instruction as usual + 8592 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x18) *(ebp+0x1c)) + 8593 # + 8594 eb/jump $emit-subx-stmt-list:continue/disp8 + 8595 } + 8596 $emit-subx-stmt-list:continue: + 8597 # TODO: raise an error on unrecognized Stmt-tag + 8598 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax + 8599 89/<- %esi 0/r32/eax + 8600 e9/jump loop/disp32 + 8601 } + 8602 $emit-subx-stmt-list:emit-cleanup: + 8603 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth) + 8604 $emit-subx-stmt-list:clean-up: + 8605 (clean-up-blocks *(ebp+0x10) *Curr-block-depth) + 8606 $emit-subx-stmt-list:end: + 8607 # . restore registers + 8608 5e/pop-to-esi + 8609 5b/pop-to-ebx + 8610 59/pop-to-ecx + 8611 58/pop-to-eax + 8612 # . epilogue + 8613 89/<- %esp 5/r32/ebp + 8614 5d/pop-to-ebp + 8615 c3/return + 8616 + 8617 # 'later-stmts' includes 'stmt', but will behave the same even without it; reg-var-def stmts are guaranteed not to write to function outputs. + 8618 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-outputs: (addr list var), err: (addr buffered-file), ed: (addr exit-descriptor) + 8619 # . prologue + 8620 55/push-ebp + 8621 89/<- %ebp 4/r32/esp + 8622 # . save registers + 8623 50/push-eax + 8624 51/push-ecx + 8625 52/push-edx + 8626 # ecx = stmt + 8627 8b/-> *(ebp+0xc) 1/r32/ecx + 8628 # var sv/eax: (addr stmt-var) = lookup(curr-stmt->outputs) + 8629 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax + 8630 # TODO: assert !sv->is-deref? + 8631 # var v/ecx: (addr var) = lookup(sv->value) + 8632 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 8633 89/<- %ecx 0/r32/eax + 8634 # v->block-depth = *Curr-block-depth + 8635 8b/-> *Curr-block-depth 0/r32/eax + 8636 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth + 8637 #? (write-buffered Stderr "var ") + 8638 #? (lookup *ecx *(ecx+4)) + 8639 #? (write-buffered Stderr %eax) + 8640 #? (write-buffered Stderr " at depth ") + 8641 #? (print-int32-buffered Stderr *(ecx+0x10)) + 8642 #? (write-buffered Stderr Newline) + 8643 #? (flush Stderr) + 8644 # ensure that v is in a register + 8645 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register + 8646 0f 84/jump-if-= $push-output-and-maybe-emit-spill:abort/disp32 + 8647 # var emit-spill?/edx: boolean = not-yet-spilled-this-block? && will-not-write-some-register?(fn-outputs) + 8648 (not-yet-spilled-this-block? %ecx *(ebp+0x10)) # => eax + 8649 89/<- %edx 0/r32/eax + 8650 3d/compare-eax-and 0/imm32/false + 8651 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 + 8652 (will-not-write-some-register? %ecx *(ebp+0x14) *(ebp+0x18)) # => eax + 8653 89/<- %edx 0/r32/eax + 8654 # check emit-spill? + 8655 3d/compare-eax-and 0/imm32/false + 8656 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 + 8657 # TODO: assert(size-of(output) == 4) + 8658 # *Curr-local-stack-offset -= 4 + 8659 81 5/subop/subtract *Curr-local-stack-offset 4/imm32 + 8660 # emit spill + 8661 (emit-indent *(ebp+8) *Curr-block-depth) + 8662 (write-buffered *(ebp+8) "ff 6/subop/push %") + 8663 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax + 8664 (write-buffered *(ebp+8) %eax) + 8665 (write-buffered *(ebp+8) Newline) + 8666 $push-output-and-maybe-emit-spill:push: + 8667 8b/-> *(ebp+0xc) 1/r32/ecx + 8668 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax + 8669 # push(vars, {sv->value, emit-spill?}) + 8670 (push *(ebp+0x10) *eax) # Stmt-var-value + 8671 (push *(ebp+0x10) *(eax+4)) # Stmt-var-value + 8672 (push *(ebp+0x10) %edx) + 8673 $push-output-and-maybe-emit-spill:end: + 8674 # . restore registers + 8675 5a/pop-to-edx + 8676 59/pop-to-ecx + 8677 58/pop-to-eax + 8678 # . epilogue + 8679 89/<- %esp 5/r32/ebp + 8680 5d/pop-to-ebp + 8681 c3/return + 8682 + 8683 $push-output-and-maybe-emit-spill:abort: + 8684 # error("var '" var->name "' initialized from an instruction must live in a register\n") + 8685 (write-buffered *(ebp+0x1c) "var '") + 8686 (write-buffered *(ebp+0x1c) *eax) # Var-name + 8687 (write-buffered *(ebp+0x1c) "' initialized from an instruction must live in a register\n") + 8688 (flush *(ebp+0x1c)) + 8689 (stop *(ebp+0x20) 1) + 8690 # never gets here + 8691 + 8692 emit-subx-cleanup-and-unconditional-nonlocal-branch: # out: (addr buffered-file), stmt: (addr stmt1), vars: (addr stack live-var) + 8693 # . prologue + 8694 55/push-ebp + 8695 89/<- %ebp 4/r32/esp + 8696 # . save registers + 8697 50/push-eax + 8698 51/push-ecx + 8699 # ecx = stmt + 8700 8b/-> *(ebp+0xc) 1/r32/ecx + 8701 # var target/eax: (addr array byte) = curr-stmt->inouts->value->name + 8702 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 8703 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 8704 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 8705 # clean up until target block + 8706 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %eax) + 8707 # emit jump to target block + 8708 (emit-indent *(ebp+8) *Curr-block-depth) + 8709 (write-buffered *(ebp+8) "e9/jump ") + 8710 (write-buffered *(ebp+8) %eax) + 8711 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax + 8712 (string-starts-with? %eax "break") + 8713 3d/compare-eax-and 0/imm32/false + 8714 { + 8715 74/jump-if-= break/disp8 + 8716 (write-buffered *(ebp+8) ":break/disp32\n") + 8717 } + 8718 3d/compare-eax-and 0/imm32/false # just in case the function call modified flags + 8719 { + 8720 75/jump-if-!= break/disp8 + 8721 (write-buffered *(ebp+8) ":loop/disp32\n") + 8722 } + 8723 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end: + 8724 # . restore registers + 8725 59/pop-to-ecx + 8726 58/pop-to-eax + 8727 # . epilogue + 8728 89/<- %esp 5/r32/ebp + 8729 5d/pop-to-ebp + 8730 c3/return + 8731 + 8732 is-mu-branch?: # stmt: (addr stmt1) -> result/eax: boolean + 8733 # . prologue + 8734 55/push-ebp + 8735 89/<- %ebp 4/r32/esp + 8736 # . save registers + 8737 51/push-ecx + 8738 # ecx = lookup(stmt->operation) + 8739 8b/-> *(ebp+8) 1/r32/ecx + 8740 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax + 8741 89/<- %ecx 0/r32/eax + 8742 # if (stmt->operation starts with "loop") return true + 8743 (string-starts-with? %ecx "loop") # => eax + 8744 3d/compare-eax-and 0/imm32/false + 8745 75/jump-if-not-equal $is-mu-branch?:end/disp8 + 8746 # otherwise return (stmt->operation starts with "break") + 8747 (string-starts-with? %ecx "break") # => eax + 8748 $is-mu-branch?:end: + 8749 # . restore registers + 8750 59/pop-to-ecx + 8751 # . epilogue + 8752 89/<- %esp 5/r32/ebp + 8753 5d/pop-to-ebp + 8754 c3/return + 8755 + 8756 emit-reverse-break: # out: (addr buffered-file), stmt: (addr stmt1) + 8757 # . prologue + 8758 55/push-ebp + 8759 89/<- %ebp 4/r32/esp + 8760 # . save registers + 8761 50/push-eax + 8762 # eax = stmt + 8763 8b/-> *(ebp+0xc) 0/r32/eax + 8764 # + 8765 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax + 8766 (get Reverse-branch %eax 0x10 "reverse-branch: ") # => eax: (addr handle array byte) + 8767 (emit-indent *(ebp+8) *Curr-block-depth) + 8768 (lookup *eax *(eax+4)) # => eax + 8769 (write-buffered *(ebp+8) %eax) + 8770 (write-buffered *(ebp+8) " break/disp32\n") + 8771 $emit-reverse-break:end: + 8772 # . restore registers + 8773 58/pop-to-eax + 8774 # . epilogue + 8775 89/<- %esp 5/r32/ebp + 8776 5d/pop-to-ebp + 8777 c3/return + 8778 + 8779 == data + 8780 + 8781 # Table from Mu branch instructions to the reverse SubX opcodes for them. + 8782 Reverse-branch: # (table (handle array byte) (handle array byte)) + 8783 # a table is a stream + 8784 0x140/imm32/write + 8785 0/imm32/read + 8786 0x140/imm32/size + 8787 # data + 8788 0x11/imm32/alloc-id _string-break-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 + 8789 0x11/imm32/alloc-id _string-loop-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 + 8790 0x11/imm32/alloc-id _string-break-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 + 8791 0x11/imm32/alloc-id _string-loop-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 + 8792 0x11/imm32/alloc-id _string-break-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 + 8793 0x11/imm32/alloc-id _string-loop-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 + 8794 0x11/imm32/alloc-id _string-break-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 + 8795 0x11/imm32/alloc-id _string-loop-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 + 8796 0x11/imm32/alloc-id _string-break-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 + 8797 0x11/imm32/alloc-id _string-loop-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 + 8798 0x11/imm32/alloc-id _string-break-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 + 8799 0x11/imm32/alloc-id _string-loop-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 + 8800 0x11/imm32/alloc-id _string-break-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 + 8801 0x11/imm32/alloc-id _string-loop-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 + 8802 0x11/imm32/alloc-id _string-break-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 + 8803 0x11/imm32/alloc-id _string-loop-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 + 8804 0x11/imm32/alloc-id _string-break-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 + 8805 0x11/imm32/alloc-id _string-loop-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 + 8806 0x11/imm32/alloc-id _string-break-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 + 8807 0x11/imm32/alloc-id _string-loop-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 + 8808 + 8809 == code + 8810 + 8811 emit-unconditional-jump-to-depth: # out: (addr buffered-file), vars: (addr stack live-var), depth: int, label-suffix: (addr array byte) + 8812 # . prologue + 8813 55/push-ebp + 8814 89/<- %ebp 4/r32/esp + 8815 # . save registers + 8816 50/push-eax + 8817 51/push-ecx + 8818 52/push-edx + 8819 53/push-ebx + 8820 56/push-esi + 8821 # ecx = vars + 8822 8b/-> *(ebp+0xc) 1/r32/ecx + 8823 # var eax: int = vars->top + 8824 8b/-> *ecx 0/r32/eax + 8825 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] + 8826 8d/copy-address *(ecx+eax-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size + 8827 # var min/ecx: (addr handle var) = vars->data + 8828 8d/copy-address *(ecx+8) 1/r32/ecx + 8829 # edx = depth + 8830 8b/-> *(ebp+0x10) 2/r32/edx + 8831 { + 8832 $emit-unconditional-jump-to-depth:loop: + 8833 # if (curr < min) break + 8834 39/compare %esi 1/r32/ecx + 8835 0f 82/jump-if-addr< break/disp32 + 8836 # var v/ebx: (addr var) = lookup(*curr) + 8837 (lookup *esi *(esi+4)) # => eax + 8838 89/<- %ebx 0/r32/eax + 8839 # if (v->block-depth < until-block-depth) break + 8840 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth + 8841 0f 8c/jump-if-< break/disp32 + 8842 { + 8843 $emit-unconditional-jump-to-depth:check: + 8844 # if v->block-depth != until-block-depth, continue + 8845 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth + 8846 0f 85/jump-if-!= break/disp32 + 8847 $emit-unconditional-jump-to-depth:depth-found: + 8848 # if v is not a literal, continue + 8849 (size-of %ebx) # => eax + 8850 3d/compare-eax-and 0/imm32 + 8851 0f 85/jump-if-!= break/disp32 + 8852 $emit-unconditional-jump-to-depth:label-found: + 8853 # emit unconditional jump, then return + 8854 (emit-indent *(ebp+8) *Curr-block-depth) + 8855 (write-buffered *(ebp+8) "e9/jump ") + 8856 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 8857 (write-buffered *(ebp+8) %eax) + 8858 (write-buffered *(ebp+8) ":") + 8859 (write-buffered *(ebp+8) *(ebp+0x14)) + 8860 (write-buffered *(ebp+8) "/disp32\n") + 8861 eb/jump $emit-unconditional-jump-to-depth:end/disp8 + 8862 } + 8863 # curr -= 12 + 8864 81 5/subop/subtract %esi 0xc/imm32 + 8865 e9/jump loop/disp32 + 8866 } + 8867 # TODO: error if no label at 'depth' was found + 8868 $emit-unconditional-jump-to-depth:end: + 8869 # . restore registers + 8870 5e/pop-to-esi + 8871 5b/pop-to-ebx + 8872 5a/pop-to-edx + 8873 59/pop-to-ecx + 8874 58/pop-to-eax + 8875 # . epilogue + 8876 89/<- %esp 5/r32/ebp + 8877 5d/pop-to-ebp + 8878 c3/return + 8879 + 8880 # emit clean-up code for 'vars' until some block depth + 8881 # doesn't actually modify 'vars' so we need traverse manually inside the stack + 8882 emit-cleanup-code-until-depth: # out: (addr buffered-file), vars: (addr stack live-var), until-block-depth: int + 8883 # . prologue + 8884 55/push-ebp + 8885 89/<- %ebp 4/r32/esp + 8886 # . save registers + 8887 50/push-eax + 8888 51/push-ecx + 8889 52/push-edx + 8890 53/push-ebx + 8891 56/push-esi + 8892 #? (write-buffered Stderr "--- cleanup\n") + 8893 #? (flush Stderr) + 8894 # ecx = vars + 8895 8b/-> *(ebp+0xc) 1/r32/ecx + 8896 # var esi: int = vars->top + 8897 8b/-> *ecx 6/r32/esi + 8898 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] + 8899 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size + 8900 # var min/ecx: (addr handle var) = vars->data + 8901 81 0/subop/add %ecx 8/imm32 + 8902 # edx = until-block-depth + 8903 8b/-> *(ebp+0x10) 2/r32/edx + 8904 { + 8905 $emit-cleanup-code-until-depth:loop: + 8906 # if (curr < min) break + 8907 39/compare %esi 1/r32/ecx + 8908 0f 82/jump-if-addr< break/disp32 + 8909 # var v/ebx: (addr var) = lookup(*curr) + 8910 (lookup *esi *(esi+4)) # => eax + 8911 89/<- %ebx 0/r32/eax + 8912 #? (lookup *ebx *(ebx+4)) # Var-name + 8913 #? (write-buffered Stderr "var ") + 8914 #? (write-buffered Stderr %eax) + 8915 #? (write-buffered Stderr Newline) + 8916 #? (flush Stderr) + 8917 # if (v->block-depth < until-block-depth) break + 8918 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth + 8919 0f 8c/jump-if-< break/disp32 + 8920 # if v is in a register + 8921 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register + 8922 { + 8923 0f 84/jump-if-= break/disp32 + 8924 { + 8925 $emit-cleanup-code-until-depth:check-for-previous-spill: + 8926 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled + 8927 3d/compare-eax-and 0/imm32/false + 8928 74/jump-if-= break/disp8 + 8929 $emit-cleanup-code-until-depth:reclaim-var-in-register: + 8930 (emit-indent *(ebp+8) *Curr-block-depth) + 8931 (write-buffered *(ebp+8) "8f 0/subop/pop %") + 8932 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax + 8933 (write-buffered *(ebp+8) %eax) + 8934 (write-buffered *(ebp+8) Newline) + 8935 } + 8936 eb/jump $emit-cleanup-code-until-depth:continue/disp8 + 8937 } + 8938 # otherwise v is on the stack + 8939 { + 8940 75/jump-if-!= break/disp8 + 8941 $emit-cleanup-code-until-depth:var-on-stack: + 8942 (size-of %ebx) # => eax + 8943 # don't emit code for labels + 8944 3d/compare-eax-and 0/imm32 + 8945 74/jump-if-= break/disp8 + 8946 $emit-cleanup-code-until-depth:reclaim-var-on-stack: + 8947 (emit-indent *(ebp+8) *Curr-block-depth) + 8948 (write-buffered *(ebp+8) "81 0/subop/add %esp ") + 8949 (print-int32-buffered *(ebp+8) %eax) + 8950 (write-buffered *(ebp+8) "/imm32\n") + 8951 } + 8952 $emit-cleanup-code-until-depth:continue: + 8953 # curr -= 12 + 8954 81 5/subop/subtract %esi 0xc/imm32 + 8955 e9/jump loop/disp32 + 8956 } + 8957 $emit-cleanup-code-until-depth:end: + 8958 # . restore registers + 8959 5e/pop-to-esi + 8960 5b/pop-to-ebx + 8961 5a/pop-to-edx + 8962 59/pop-to-ecx + 8963 58/pop-to-eax + 8964 # . epilogue + 8965 89/<- %esp 5/r32/ebp + 8966 5d/pop-to-ebp + 8967 c3/return + 8968 + 8969 # emit clean-up code for 'vars' until a given label is encountered + 8970 # doesn't actually modify 'vars' so we need traverse manually inside the stack + 8971 emit-cleanup-code-until-target: # out: (addr buffered-file), vars: (addr stack live-var), until-block-label: (addr array byte) + 8972 # . prologue + 8973 55/push-ebp + 8974 89/<- %ebp 4/r32/esp + 8975 # . save registers + 8976 50/push-eax + 8977 51/push-ecx + 8978 52/push-edx + 8979 53/push-ebx + 8980 # ecx = vars + 8981 8b/-> *(ebp+0xc) 1/r32/ecx + 8982 # var eax: int = vars->top + 8983 8b/-> *ecx 0/r32/eax + 8984 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] + 8985 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size + 8986 # var min/ecx: (addr handle var) = vars->data + 8987 81 0/subop/add %ecx 8/imm32 + 8988 { + 8989 $emit-cleanup-code-until-target:loop: + 8990 # if (curr < min) break + 8991 39/compare %edx 1/r32/ecx + 8992 0f 82/jump-if-addr< break/disp32 + 8993 # var v/ebx: (handle var) = lookup(*curr) + 8994 (lookup *edx *(edx+4)) # => eax + 8995 89/<- %ebx 0/r32/eax + 8996 # if (v->name == until-block-label) break + 8997 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 8998 (string-equal? %eax *(ebp+0x10)) # => eax + 8999 3d/compare-eax-and 0/imm32/false + 9000 0f 85/jump-if-!= break/disp32 + 9001 # if v is in a register + 9002 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register + 9003 { + 9004 0f 84/jump-if-= break/disp32 + 9005 { + 9006 $emit-cleanup-code-until-target:check-for-previous-spill: + 9007 8b/-> *(edx+8) 0/r32/eax # Live-var-register-spilled + 9008 3d/compare-eax-and 0/imm32/false + 9009 74/jump-if-= break/disp8 + 9010 $emit-cleanup-code-until-target:reclaim-var-in-register: + 9011 (emit-indent *(ebp+8) *Curr-block-depth) + 9012 (write-buffered *(ebp+8) "8f 0/subop/pop %") + 9013 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax + 9014 (write-buffered *(ebp+8) %eax) + 9015 (write-buffered *(ebp+8) Newline) + 9016 } + 9017 eb/jump $emit-cleanup-code-until-target:continue/disp8 + 9018 } + 9019 # otherwise v is on the stack + 9020 { + 9021 75/jump-if-!= break/disp8 + 9022 $emit-cleanup-code-until-target:reclaim-var-on-stack: + 9023 (size-of %ebx) # => eax + 9024 # don't emit code for labels + 9025 3d/compare-eax-and 0/imm32 + 9026 74/jump-if-= break/disp8 + 9027 # + 9028 (emit-indent *(ebp+8) *Curr-block-depth) + 9029 (write-buffered *(ebp+8) "81 0/subop/add %esp ") + 9030 (print-int32-buffered *(ebp+8) %eax) + 9031 (write-buffered *(ebp+8) "/imm32\n") + 9032 } + 9033 $emit-cleanup-code-until-target:continue: + 9034 # curr -= 12 + 9035 81 5/subop/subtract %edx 0xc/imm32 + 9036 e9/jump loop/disp32 + 9037 } + 9038 $emit-cleanup-code-until-target:end: + 9039 # . restore registers + 9040 5b/pop-to-ebx + 9041 5a/pop-to-edx + 9042 59/pop-to-ecx + 9043 58/pop-to-eax + 9044 # . epilogue + 9045 89/<- %esp 5/r32/ebp + 9046 5d/pop-to-ebp + 9047 c3/return + 9048 + 9049 # Return true if there isn't a variable in 'vars' with the same block-depth + 9050 # and register as 'v'. + 9051 # 'v' is guaranteed not to be within 'vars'. + 9052 not-yet-spilled-this-block?: # v: (addr var), vars: (addr stack live-var) -> result/eax: boolean + 9053 # . prologue + 9054 55/push-ebp + 9055 89/<- %ebp 4/r32/esp + 9056 # . save registers + 9057 51/push-ecx + 9058 52/push-edx + 9059 53/push-ebx + 9060 56/push-esi + 9061 57/push-edi + 9062 # ecx = vars + 9063 8b/-> *(ebp+0xc) 1/r32/ecx + 9064 # var eax: int = vars->top + 9065 8b/-> *ecx 0/r32/eax + 9066 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] + 9067 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size + 9068 # var min/ecx: (addr handle var) = vars->data + 9069 8d/copy-address *(ecx+8) 1/r32/ecx + 9070 # var depth/ebx: int = v->block-depth + 9071 8b/-> *(ebp+8) 3/r32/ebx + 9072 8b/-> *(ebx+0x10) 3/r32/ebx # Var-block-depth + 9073 # var needle/esi: (addr array byte) = v->register + 9074 8b/-> *(ebp+8) 6/r32/esi + 9075 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax + 9076 89/<- %esi 0/r32/eax + 9077 { + 9078 $not-yet-spilled-this-block?:loop: + 9079 # if (curr < min) break + 9080 39/compare %edx 1/r32/ecx + 9081 0f 82/jump-if-addr< break/disp32 + 9082 # var cand/edi: (addr var) = lookup(*curr) + 9083 (lookup *edx *(edx+4)) # => eax + 9084 89/<- %edi 0/r32/eax + 9085 # if (cand->block-depth < depth) break + 9086 39/compare *(edi+0x10) 3/r32/ebx # Var-block-depth + 9087 0f 8c/jump-if-< break/disp32 + 9088 # var cand-reg/edi: (array array byte) = cand->reg + 9089 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax + 9090 89/<- %edi 0/r32/eax + 9091 # if (cand-reg == null) continue + 9092 { + 9093 $not-yet-spilled-this-block?:check-reg: + 9094 81 7/subop/compare %edi 0/imm32 + 9095 0f 84/jump-if-= break/disp32 + 9096 # if (cand-reg == needle) return true + 9097 (string-equal? %esi %edi) # => eax + 9098 3d/compare-eax-and 0/imm32/false + 9099 74/jump-if-= break/disp8 + 9100 $not-yet-spilled-this-block?:return-false: + 9101 b8/copy-to-eax 0/imm32/false + 9102 eb/jump $not-yet-spilled-this-block?:end/disp8 + 9103 } + 9104 $not-yet-spilled-this-block?:continue: + 9105 # curr -= 12 + 9106 81 5/subop/subtract %edx 0xc/imm32 + 9107 e9/jump loop/disp32 + 9108 } + 9109 $not-yet-spilled-this-block?:return-true: + 9110 # return true + 9111 b8/copy-to-eax 1/imm32/true + 9112 $not-yet-spilled-this-block?:end: + 9113 # . restore registers + 9114 5f/pop-to-edi + 9115 5e/pop-to-esi + 9116 5b/pop-to-ebx + 9117 5a/pop-to-edx + 9118 59/pop-to-ecx + 9119 # . epilogue + 9120 89/<- %esp 5/r32/ebp + 9121 5d/pop-to-ebp + 9122 c3/return + 9123 + 9124 # could the register of 'v' ever be written to by one of the vars in fn-outputs? + 9125 will-not-write-some-register?: # v: (addr var), stmts: (addr list stmt), fn-outputs: (addr list var) -> result/eax: boolean + 9126 # . prologue + 9127 55/push-ebp + 9128 89/<- %ebp 4/r32/esp + 9129 # eax = v + 9130 8b/-> *(ebp+8) 0/r32/eax + 9131 # var reg/eax: (addr array byte) = lookup(v->register) + 9132 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax + 9133 # var target/eax: (addr var) = find-register(fn-outputs, reg) + 9134 (find-register *(ebp+0x10) %eax) # => eax + 9135 # if (target == 0) return true + 9136 { + 9137 3d/compare-eax-and 0/imm32 + 9138 75/jump-if-!= break/disp8 + 9139 b8/copy-to-eax 1/imm32/true + 9140 eb/jump $will-not-write-some-register?:end/disp8 + 9141 } + 9142 # return !assigns-in-stmts?(stmts, target) + 9143 (assigns-in-stmts? *(ebp+0xc) %eax) # => eax + 9144 3d/compare-eax-and 0/imm32/false + 9145 # assume: true = 1, so no need to mask with 0x000000ff + 9146 0f 94/set-if-= %al + 9147 $will-not-write-some-register?:end: + 9148 # . epilogue + 9149 89/<- %esp 5/r32/ebp + 9150 5d/pop-to-ebp + 9151 c3/return + 9152 + 9153 # return output var with matching register + 9154 # always returns false if 'reg' is null + 9155 find-register: # fn-outputs: (addr list var), reg: (addr array byte) -> result/eax: (addr var) + 9156 # . prologue + 9157 55/push-ebp + 9158 89/<- %ebp 4/r32/esp + 9159 # . save registers + 9160 51/push-ecx + 9161 # var curr/ecx: (addr list var) = fn-outputs + 9162 8b/-> *(ebp+8) 1/r32/ecx + 9163 { + 9164 $find-register:loop: + 9165 # if (curr == 0) break + 9166 81 7/subop/compare %ecx 0/imm32 + 9167 74/jump-if-= break/disp8 + 9168 # eax = curr->value->register + 9169 (lookup *ecx *(ecx+4)) # List-value List-value => eax + 9170 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax + 9171 # if (eax == reg) return curr->value + 9172 $find-register:compare: + 9173 (string-equal? *(ebp+0xc) %eax) # => eax + 9174 { + 9175 3d/compare-eax-and 0/imm32/false + 9176 74/jump-if-= break/disp8 + 9177 $find-register:found: + 9178 (lookup *ecx *(ecx+4)) # List-value List-value => eax + 9179 eb/jump $find-register:end/disp8 + 9180 } + 9181 # curr = lookup(curr->next) + 9182 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax + 9183 89/<- %ecx 0/r32/eax + 9184 # + 9185 eb/jump loop/disp8 + 9186 } + 9187 $find-register:end: + 9188 # . restore registers + 9189 59/pop-to-ecx + 9190 # . epilogue + 9191 89/<- %esp 5/r32/ebp + 9192 5d/pop-to-ebp + 9193 c3/return + 9194 + 9195 assigns-in-stmts?: # stmts: (addr list stmt), v: (addr var) -> result/eax: boolean + 9196 # . prologue + 9197 55/push-ebp + 9198 89/<- %ebp 4/r32/esp + 9199 # . save registers + 9200 51/push-ecx + 9201 # var curr/ecx: (addr list stmt) = stmts + 9202 8b/-> *(ebp+8) 1/r32/ecx + 9203 { + 9204 # if (curr == 0) break + 9205 81 7/subop/compare %ecx 0/imm32 + 9206 74/jump-if-= break/disp8 + 9207 # if assigns-in-stmt?(curr->value, v) return true + 9208 (lookup *ecx *(ecx+4)) # List-value List-value => eax + 9209 (assigns-in-stmt? %eax *(ebp+0xc)) # => eax + 9210 3d/compare-eax-and 0/imm32/false + 9211 75/jump-if-!= break/disp8 + 9212 # curr = lookup(curr->next) + 9213 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax + 9214 89/<- %ecx 0/r32/eax + 9215 # + 9216 eb/jump loop/disp8 + 9217 } + 9218 $assigns-in-stmts?:end: + 9219 # . restore registers + 9220 59/pop-to-ecx + 9221 # . epilogue + 9222 89/<- %esp 5/r32/ebp + 9223 5d/pop-to-ebp + 9224 c3/return + 9225 + 9226 assigns-in-stmt?: # stmt: (addr stmt), v: (addr var) -> result/eax: boolean + 9227 # . prologue + 9228 55/push-ebp + 9229 89/<- %ebp 4/r32/esp + 9230 # . save registers + 9231 51/push-ecx + 9232 # ecx = stmt + 9233 8b/-> *(ebp+8) 1/r32/ecx + 9234 # if stmt is a stmt1, return assigns-in-stmt-vars?(stmt->outputs, v) + 9235 { + 9236 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag + 9237 75/jump-if-!= break/disp8 + 9238 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax + 9239 (assigns-in-stmt-vars? %eax *(ebp+0xc)) # => eax + 9240 eb/jump $assigns-in-stmt?:end/disp8 + 9241 } + 9242 # if stmt is a block, return assigns-in-stmts?(stmt->stmts, v) + 9243 { + 9244 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag + 9245 75/jump-if-!= break/disp8 + 9246 (lookup *(ecx+4) *(ecx+8)) # Block-stmts Block-stmts => eax + 9247 (assigns-in-stmts? %eax *(ebp+0xc)) # => eax + 9248 eb/jump $assigns-in-stmt?:end/disp8 + 9249 } + 9250 # otherwise return false + 9251 b8/copy 0/imm32/false + 9252 $assigns-in-stmt?:end: + 9253 # . restore registers + 9254 59/pop-to-ecx + 9255 # . epilogue + 9256 89/<- %esp 5/r32/ebp + 9257 5d/pop-to-ebp + 9258 c3/return + 9259 + 9260 assigns-in-stmt-vars?: # stmt-var: (addr stmt-var), v: (addr var) -> result/eax: boolean + 9261 # . prologue + 9262 55/push-ebp + 9263 89/<- %ebp 4/r32/esp + 9264 # . save registers + 9265 51/push-ecx + 9266 # var curr/ecx: (addr stmt-var) = stmt-var + 9267 8b/-> *(ebp+8) 1/r32/ecx + 9268 { + 9269 # if (curr == 0) break + 9270 81 7/subop/compare %ecx 0/imm32 + 9271 74/jump-if-= break/disp8 + 9272 # eax = lookup(curr->value) + 9273 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax + 9274 # if (eax == v && curr->is-deref? == false) return true + 9275 { + 9276 39/compare *(ebp+0xc) 0/r32/eax + 9277 75/jump-if-!= break/disp8 + 9278 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref + 9279 75/jump-if-!= break/disp8 + 9280 b8/copy-to-eax 1/imm32/true + 9281 eb/jump $assigns-in-stmt-vars?:end/disp8 + 9282 } + 9283 # curr = lookup(curr->next) + 9284 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax + 9285 89/<- %ecx 0/r32/eax + 9286 # + 9287 eb/jump loop/disp8 + 9288 } + 9289 $assigns-in-stmt-vars?:end: + 9290 # . restore registers + 9291 59/pop-to-ecx + 9292 # . epilogue + 9293 89/<- %esp 5/r32/ebp + 9294 5d/pop-to-ebp + 9295 c3/return + 9296 + 9297 # is there a var before 'v' with the same block-depth and register on the 'vars' stack? + 9298 # v is guaranteed to be within vars + 9299 # 'start' is provided as an optimization, a pointer within vars + 9300 # *start == v + 9301 same-register-spilled-before?: # v: (addr var), vars: (addr stack (handle var)), start: (addr var) -> result/eax: boolean + 9302 # . prologue + 9303 55/push-ebp + 9304 89/<- %ebp 4/r32/esp + 9305 # . save registers + 9306 51/push-ecx + 9307 52/push-edx + 9308 53/push-ebx + 9309 56/push-esi + 9310 57/push-edi + 9311 # ecx = v + 9312 8b/-> *(ebp+8) 1/r32/ecx + 9313 # var reg/edx: (addr array byte) = lookup(v->register) + 9314 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax + 9315 89/<- %edx 0/r32/eax + 9316 # var depth/ebx: int = v->block-depth + 9317 8b/-> *(ecx+0x10) 3/r32/ebx # Var-block-depth + 9318 # var min/ecx: (addr handle var) = vars->data + 9319 8b/-> *(ebp+0xc) 1/r32/ecx + 9320 81 0/subop/add %ecx 8/imm32 + 9321 # TODO: check that start >= min and start < &vars->data[top] + 9322 # TODO: check that *start == v + 9323 # var curr/esi: (addr handle var) = start + 9324 8b/-> *(ebp+0x10) 6/r32/esi + 9325 # curr -= 8 + 9326 81 5/subop/subtract %esi 8/imm32 + 9327 { + 9328 $same-register-spilled-before?:loop: + 9329 # if (curr < min) break + 9330 39/compare %esi 1/r32/ecx + 9331 0f 82/jump-if-addr< break/disp32 + 9332 # var x/eax: (addr var) = lookup(*curr) + 9333 (lookup *esi *(esi+4)) # => eax + 9334 # if (x->block-depth < depth) break + 9335 39/compare *(eax+0x10) 3/r32/ebx # Var-block-depth + 9336 0f 8c/jump-if-< break/disp32 + 9337 # if (x->register == 0) continue + 9338 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register + 9339 74/jump-if-= $same-register-spilled-before?:continue/disp8 + 9340 # if (x->register == reg) return true + 9341 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax + 9342 (string-equal? %eax %edx) # => eax + 9343 3d/compare-eax-and 0/imm32/false + 9344 b8/copy-to-eax 1/imm32/true + 9345 75/jump-if-!= $same-register-spilled-before?:end/disp8 + 9346 $same-register-spilled-before?:continue: + 9347 # curr -= 8 + 9348 81 5/subop/subtract %esi 8/imm32 + 9349 e9/jump loop/disp32 + 9350 } + 9351 $same-register-spilled-before?:false: + 9352 b8/copy-to-eax 0/imm32/false + 9353 $same-register-spilled-before?:end: + 9354 # . restore registers + 9355 5f/pop-to-edi + 9356 5e/pop-to-esi + 9357 5b/pop-to-ebx + 9358 5a/pop-to-edx + 9359 59/pop-to-ecx + 9360 # . epilogue + 9361 89/<- %esp 5/r32/ebp + 9362 5d/pop-to-ebp + 9363 c3/return + 9364 + 9365 # clean up global state for 'vars' until some block depth + 9366 clean-up-blocks: # vars: (addr stack live-var), until-block-depth: int + 9367 # . prologue + 9368 55/push-ebp + 9369 89/<- %ebp 4/r32/esp + 9370 # . save registers + 9371 50/push-eax + 9372 51/push-ecx + 9373 56/push-esi + 9374 # esi = vars + 9375 8b/-> *(ebp+8) 6/r32/esi + 9376 # ecx = until-block-depth + 9377 8b/-> *(ebp+0xc) 1/r32/ecx + 9378 { + 9379 $clean-up-blocks:reclaim-loop: + 9380 # if (vars->top <= 0) break + 9381 8b/-> *esi 0/r32/eax # Stack-top + 9382 3d/compare-eax-and 0/imm32 + 9383 0f 8e/jump-if-<= break/disp32 + 9384 # var v/eax: (addr var) = lookup(vars[vars->top-12]) + 9385 #? (print-int32-buffered Stderr %eax) + 9386 #? (write-buffered Stderr ": ") + 9387 #? (print-int32-buffered Stderr *(esi+eax-4)) + 9388 #? (write-buffered Stderr " ") + 9389 #? (print-int32-buffered Stderr *(esi+eax)) + 9390 #? (write-buffered Stderr " ") + 9391 #? (print-int32-buffered Stderr *(esi+eax+4)) + 9392 #? (write-buffered Stderr Newline) + 9393 #? (flush Stderr) + 9394 (lookup *(esi+eax-4) *(esi+eax)) # vars + 8 + vars->top - 12 => eax + 9395 # if (v->block-depth < until-block-depth) break + 9396 39/compare *(eax+0x10) 1/r32/ecx # Var-block-depth + 9397 7c/jump-if-< break/disp8 + 9398 # if v is on the stack, update Curr-local-stack-offset + 9399 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register + 9400 { + 9401 75/jump-if-!= break/disp8 + 9402 $clean-up-blocks:reclaim-var-on-stack: + 9403 (size-of %eax) # => eax + 9404 01/add-to *Curr-local-stack-offset 0/r32/eax + 9405 } + 9406 (pop %esi) # => eax + 9407 (pop %esi) # => eax + 9408 (pop %esi) # => eax + 9409 e9/jump loop/disp32 + 9410 } + 9411 $clean-up-blocks:end: + 9412 # . restore registers + 9413 5e/pop-to-esi + 9414 59/pop-to-ecx + 9415 58/pop-to-eax + 9416 # . epilogue + 9417 89/<- %esp 5/r32/ebp + 9418 5d/pop-to-ebp + 9419 c3/return + 9420 + 9421 emit-subx-var-def: # out: (addr buffered-file), stmt: (addr stmt) + 9422 # . prologue + 9423 55/push-ebp + 9424 89/<- %ebp 4/r32/esp + 9425 # . save registers + 9426 50/push-eax + 9427 51/push-ecx + 9428 52/push-edx + 9429 # eax = stmt + 9430 8b/-> *(ebp+0xc) 0/r32/eax + 9431 # var v/ecx: (addr var) + 9432 (lookup *(eax+4) *(eax+8)) # Vardef-var Vardef-var => eax + 9433 89/<- %ecx 0/r32/eax + 9434 # v->block-depth = *Curr-block-depth + 9435 8b/-> *Curr-block-depth 0/r32/eax + 9436 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth + 9437 # var n/edx: int = size-of(stmt->var) + 9438 (size-of %ecx) # => eax + 9439 89/<- %edx 0/r32/eax + 9440 # *Curr-local-stack-offset -= n + 9441 29/subtract-from *Curr-local-stack-offset 2/r32/edx + 9442 # v->offset = *Curr-local-stack-offset + 9443 8b/-> *Curr-local-stack-offset 0/r32/eax + 9444 89/<- *(ecx+0x14) 0/r32/eax # Var-offset + 9445 # if v is an array, do something special + 9446 { + 9447 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 9448 (is-mu-array? %eax) # => eax + 9449 3d/compare-eax-and 0/imm32/false + 9450 0f 84/jump-if-= break/disp32 + 9451 # var array-size-without-size/edx: int = n-4 + 9452 81 5/subop/subtract %edx 4/imm32 + 9453 (emit-indent *(ebp+8) *Curr-block-depth) + 9454 (write-buffered *(ebp+8) "(push-n-zero-bytes ") + 9455 (print-int32-buffered *(ebp+8) %edx) + 9456 (write-buffered *(ebp+8) ")\n") + 9457 (emit-indent *(ebp+8) *Curr-block-depth) + 9458 (write-buffered *(ebp+8) "68/push ") + 9459 (print-int32-buffered *(ebp+8) %edx) + 9460 (write-buffered *(ebp+8) "/imm32\n") + 9461 eb/jump $emit-subx-var-def:end/disp8 + 9462 } + 9463 # while n > 0 + 9464 { + 9465 81 7/subop/compare %edx 0/imm32 + 9466 7e/jump-if-<= break/disp8 + 9467 (emit-indent *(ebp+8) *Curr-block-depth) + 9468 (write-buffered *(ebp+8) "68/push 0/imm32\n") + 9469 # n -= 4 + 9470 81 5/subop/subtract %edx 4/imm32 + 9471 # + 9472 eb/jump loop/disp8 + 9473 } + 9474 $emit-subx-var-def:end: + 9475 # . restore registers + 9476 5a/pop-to-edx + 9477 59/pop-to-ecx + 9478 58/pop-to-eax + 9479 # . epilogue + 9480 89/<- %esp 5/r32/ebp + 9481 5d/pop-to-ebp + 9482 c3/return + 9483 + 9484 emit-subx-stmt: # out: (addr buffered-file), stmt: (addr stmt), primitives: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) + 9485 # . prologue + 9486 55/push-ebp + 9487 89/<- %ebp 4/r32/esp + 9488 # . save registers + 9489 50/push-eax + 9490 51/push-ecx + 9491 # - some special-case primitives that don't actually use the 'primitives' data structure + 9492 # var op/ecx: (addr array byte) = lookup(stmt->operation) + 9493 8b/-> *(ebp+0xc) 1/r32/ecx + 9494 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax + 9495 89/<- %ecx 0/r32/eax + 9496 # array size + 9497 { + 9498 # if (!string-equal?(stmt->operation, "length")) break + 9499 (string-equal? %ecx "length") # => eax + 9500 3d/compare-eax-and 0/imm32 + 9501 0f 84/jump-if-= break/disp32 + 9502 (translate-mu-length-stmt *(ebp+8) *(ebp+0xc)) + 9503 e9/jump $emit-subx-stmt:end/disp32 + 9504 } + 9505 # index into array + 9506 { + 9507 # if (!string-equal?(stmt->operation, "index")) break + 9508 (string-equal? %ecx "index") # => eax + 9509 3d/compare-eax-and 0/imm32 + 9510 0f 84/jump-if-= break/disp32 + 9511 (translate-mu-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) + 9512 e9/jump $emit-subx-stmt:end/disp32 + 9513 } + 9514 # compute-offset for index into array + 9515 { + 9516 # if (!string-equal?(stmt->operation, "compute-offset")) break + 9517 (string-equal? %ecx "compute-offset") # => eax + 9518 3d/compare-eax-and 0/imm32 + 9519 0f 84/jump-if-= break/disp32 + 9520 (translate-mu-compute-index-stmt *(ebp+8) *(ebp+0xc)) + 9521 e9/jump $emit-subx-stmt:end/disp32 + 9522 } + 9523 # get field from record + 9524 { + 9525 # if (!string-equal?(stmt->operation, "get")) break + 9526 (string-equal? %ecx "get") # => eax + 9527 3d/compare-eax-and 0/imm32 + 9528 0f 84/jump-if-= break/disp32 + 9529 (translate-mu-get-stmt *(ebp+8) *(ebp+0xc)) + 9530 e9/jump $emit-subx-stmt:end/disp32 + 9531 } + 9532 # - if stmt matches a primitive, emit it + 9533 { + 9534 $emit-subx-stmt:check-for-primitive: + 9535 # var curr/eax: (addr primitive) + 9536 (find-matching-primitive *(ebp+0x10) *(ebp+0xc)) # primitives, stmt => eax + 9537 3d/compare-eax-and 0/imm32 + 9538 74/jump-if-= break/disp8 + 9539 $emit-subx-stmt:primitive: + 9540 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax) # out, stmt, curr + 9541 e9/jump $emit-subx-stmt:end/disp32 + 9542 } + 9543 # - otherwise emit a call + 9544 # TODO: type-checking + 9545 $emit-subx-stmt:call: + 9546 (emit-call *(ebp+8) *(ebp+0xc)) + 9547 $emit-subx-stmt:end: + 9548 # . restore registers + 9549 59/pop-to-ecx + 9550 58/pop-to-eax + 9551 # . epilogue + 9552 89/<- %esp 5/r32/ebp + 9553 5d/pop-to-ebp + 9554 c3/return + 9555 + 9556 translate-mu-length-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) + 9557 # . prologue + 9558 55/push-ebp + 9559 89/<- %ebp 4/r32/esp + 9560 # . save registers + 9561 50/push-eax + 9562 51/push-ecx + 9563 52/push-edx + 9564 53/push-ebx + 9565 56/push-esi + 9566 # esi = stmt + 9567 8b/-> *(ebp+0xc) 6/r32/esi + 9568 # var base/ebx: (addr var) = stmt->inouts[0]->value + 9569 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 9570 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 9571 89/<- %ebx 0/r32/eax + 9572 # var elemsize/ecx: int = element-size(base) + 9573 (array-element-type-id %ebx) # => eax + 9574 (size-of-type-id %eax) # => eax + 9575 89/<- %ecx 0/r32/eax + 9576 # var outreg/edx: (addr array byte) = stmt->outputs[0]->value->register + 9577 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax + 9578 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 9579 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax + 9580 89/<- %edx 0/r32/eax + 9581 # if elemsize == 1 + 9582 { + 9583 81 7/subop/compare %ecx 1/imm32 + 9584 75/jump-if-!= break/disp8 + 9585 (emit-save-size-to *(ebp+8) %ebx %edx) + 9586 e9/jump $translate-mu-length-stmt:end/disp32 + 9587 } + 9588 # if elemsize is a power of 2 less than 256 + 9589 { + 9590 (power-of-2? %ecx *(ebp+0x10) *(ebp+0x14)) # => eax + 9591 3d/compare-eax-and 0/imm32/false + 9592 74/jump-if-= break/disp8 + 9593 81 7/subop/compare %ecx 0xff/imm32 + 9594 7f/jump-if-> break/disp8 + 9595 (emit-save-size-to *(ebp+8) %ebx %edx) + 9596 (emit-divide-by-shift-right *(ebp+8) %edx %ecx) + 9597 e9/jump $translate-mu-length-stmt:end/disp32 + 9598 } + 9599 # otherwise, the complex case + 9600 # . emit register spills + 9601 { + 9602 (string-equal? %edx "eax") # => eax + 9603 3d/compare-eax-and 0/imm32/false + 9604 75/break-if-!= break/disp8 + 9605 (emit-indent *(ebp+8) *Curr-block-depth) + 9606 (write-buffered *(ebp+8) "50/push-eax\n") + 9607 } + 9608 { + 9609 (string-equal? %edx "ecx") # => eax + 9610 3d/compare-eax-and 0/imm32/false + 9611 75/break-if-!= break/disp8 + 9612 (emit-indent *(ebp+8) *Curr-block-depth) + 9613 (write-buffered *(ebp+8) "51/push-ecx\n") + 9614 } + 9615 { + 9616 (string-equal? %edx "edx") # => eax + 9617 3d/compare-eax-and 0/imm32/false + 9618 75/break-if-!= break/disp8 + 9619 (emit-indent *(ebp+8) *Curr-block-depth) + 9620 (write-buffered *(ebp+8) "52/push-edx\n") + 9621 } + 9622 # . + 9623 (emit-save-size-to *(ebp+8) %ebx "eax") + 9624 (emit-indent *(ebp+8) *Curr-block-depth) + 9625 (write-buffered *(ebp+8) "31/xor %edx 2/r32/edx\n") + 9626 (emit-indent *(ebp+8) *Curr-block-depth) + 9627 (write-buffered *(ebp+8) "b9/copy-to-ecx ") + 9628 (print-int32-buffered *(ebp+8) %ecx) + 9629 (write-buffered *(ebp+8) "/imm32\n") + 9630 (emit-indent *(ebp+8) *Curr-block-depth) + 9631 (write-buffered *(ebp+8) "f7 7/subop/idiv-eax-edx-by %ecx\n") + 9632 { + 9633 (string-equal? %edx "eax") # => eax + 9634 3d/compare-eax-and 0/imm32/false + 9635 75/break-if-!= break/disp8 + 9636 (emit-indent *(ebp+8) *Curr-block-depth) + 9637 (write-buffered *(ebp+8) "89/<- %") + 9638 (write-buffered *(ebp+8) %edx) + 9639 (write-buffered *(ebp+8) " 0/r32/eax\n") + 9640 } + 9641 # . emit register restores + 9642 { + 9643 (string-equal? %edx "edx") # => eax + 9644 3d/compare-eax-and 0/imm32/false + 9645 75/break-if-!= break/disp8 + 9646 (emit-indent *(ebp+8) *Curr-block-depth) + 9647 (write-buffered *(ebp+8) "5a/pop-to-edx\n") + 9648 } + 9649 { + 9650 (string-equal? %edx "ecx") # => eax + 9651 3d/compare-eax-and 0/imm32/false + 9652 75/break-if-!= break/disp8 + 9653 (emit-indent *(ebp+8) *Curr-block-depth) + 9654 (write-buffered *(ebp+8) "59/pop-to-ecx\n") + 9655 } + 9656 { + 9657 (string-equal? %edx "eax") # => eax + 9658 3d/compare-eax-and 0/imm32/false + 9659 75/break-if-!= break/disp8 + 9660 (emit-indent *(ebp+8) *Curr-block-depth) + 9661 (write-buffered *(ebp+8) "58/pop-to-eax\n") + 9662 } + 9663 $translate-mu-length-stmt:end: + 9664 # . restore registers + 9665 5e/pop-to-esi + 9666 5b/pop-to-ebx + 9667 5a/pop-to-edx + 9668 59/pop-to-ecx + 9669 58/pop-to-eax + 9670 # . epilogue + 9671 89/<- %esp 5/r32/ebp + 9672 5d/pop-to-ebp + 9673 c3/return + 9674 + 9675 emit-save-size-to: # out: (addr buffered-file), base: (addr var), outreg: (addr array byte) + 9676 # . prologue + 9677 55/push-ebp + 9678 89/<- %ebp 4/r32/esp + 9679 # . save registers + 9680 50/push-eax + 9681 53/push-ebx + 9682 # ebx = base + 9683 8b/-> *(ebp+0xc) 3/r32/ebx + 9684 (emit-indent *(ebp+8) *Curr-block-depth) + 9685 (write-buffered *(ebp+8) "8b/-> *") + 9686 # if base is an (addr array ...) in a register + 9687 { + 9688 81 7/subop/compare *(ebx+0x18)) 0/imm32 # Var-register + 9689 74/jump-if-= break/disp8 + 9690 $emit-save-size-to:emit-base-from-register: + 9691 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax + 9692 (write-buffered *(ebp+8) %eax) + 9693 eb/jump $emit-save-size-to:emit-output/disp8 + 9694 } + 9695 # otherwise if base is an (array ...) on the stack + 9696 { + 9697 81 7/subop/compare *(ebx+0x14)) 0/imm32 # Var-offset + 9698 74/jump-if-= break/disp8 + 9699 $emit-save-size-to:emit-base-from-stack: + 9700 (write-buffered *(ebp+8) "(ebp+") + 9701 (print-int32-buffered *(ebp+8) *(ebx+0x14)) # Var-offset + 9702 (write-buffered *(ebp+8) ")") + 9703 } + 9704 $emit-save-size-to:emit-output: + 9705 (write-buffered *(ebp+8) " ") + 9706 (get Registers *(ebp+0x10) 0xc "Registers") # => eax + 9707 (print-int32-buffered *(ebp+8) *eax) + 9708 (write-buffered *(ebp+8) "/r32\n") + 9709 $emit-save-size-to:end: + 9710 # . restore registers + 9711 5b/pop-to-ebx + 9712 58/pop-to-eax + 9713 # . epilogue + 9714 89/<- %esp 5/r32/ebp + 9715 5d/pop-to-ebp + 9716 c3/return + 9717 + 9718 emit-divide-by-shift-right: # out: (addr buffered-file), reg: (addr array byte), size: int + 9719 # . prologue + 9720 55/push-ebp + 9721 89/<- %ebp 4/r32/esp + 9722 # . save registers + 9723 50/push-eax + 9724 # + 9725 (emit-indent *(ebp+8) *Curr-block-depth) + 9726 (write-buffered *(ebp+8) "c1/shift 5/subop/>> %") + 9727 (write-buffered *(ebp+8) *(ebp+0xc)) + 9728 (write-buffered *(ebp+8) Space) + 9729 (num-shift-rights *(ebp+0x10)) # => eax + 9730 (print-int32-buffered *(ebp+8) %eax) + 9731 (write-buffered *(ebp+8) "/imm8\n") + 9732 $emit-divide-by-shift-right:end: + 9733 # . restore registers + 9734 58/pop-to-eax + 9735 # . epilogue + 9736 89/<- %esp 5/r32/ebp + 9737 5d/pop-to-ebp + 9738 c3/return + 9739 + 9740 translate-mu-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) + 9741 # . prologue + 9742 55/push-ebp + 9743 89/<- %ebp 4/r32/esp + 9744 # . save registers + 9745 51/push-ecx + 9746 # ecx = stmt + 9747 8b/-> *(ebp+0xc) 1/r32/ecx + 9748 # var base/ecx: (addr var) = stmt->inouts[0] + 9749 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 9750 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 9751 89/<- %ecx 0/r32/eax + 9752 # if (var->register) do one thing + 9753 { + 9754 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register + 9755 74/jump-if-= break/disp8 + 9756 # TODO: ensure there's no dereference + 9757 (translate-mu-index-stmt-with-array-in-register *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) + 9758 eb/jump $translate-mu-index-stmt:end/disp8 + 9759 } + 9760 # if (var->offset) do a different thing + 9761 { + 9762 81 7/subop/compare *(ecx+0x14) 0/imm32 # Var-offset + 9763 74/jump-if-= break/disp8 + 9764 # TODO: ensure there's no dereference + 9765 (translate-mu-index-stmt-with-array-on-stack *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) + 9766 eb/jump $translate-mu-index-stmt:end/disp8 + 9767 } + 9768 $translate-mu-index-stmt:end: + 9769 # . restore registers + 9770 59/pop-to-ecx + 9771 # . epilogue + 9772 89/<- %esp 5/r32/ebp + 9773 5d/pop-to-ebp + 9774 c3/return + 9775 + 9776 $translate-mu-index-stmt-with-array:error1: + 9777 (write-buffered *(ebp+0x10) "couldn't translate an index instruction. second (index) input must either lie in a register or be a literal\n") + 9778 (flush *(ebp+0x10)) + 9779 (stop *(ebp+0x14) 1) + 9780 # never gets here + 9781 + 9782 $translate-mu-index-stmt-with-array:error2: + 9783 (write-buffered *(ebp+0x10) "couldn't translate an index instruction. second (index) input when in a register must be an int or offset\n") + 9784 (flush *(ebp+0x10)) + 9785 (stop *(ebp+0x14) 1) + 9786 # never gets here + 9787 + 9788 translate-mu-index-stmt-with-array-in-register: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) + 9789 # . prologue + 9790 55/push-ebp + 9791 89/<- %ebp 4/r32/esp + 9792 # . save registers + 9793 50/push-eax + 9794 51/push-ecx + 9795 52/push-edx + 9796 53/push-ebx + 9797 # + 9798 (emit-indent *(ebp+8) *Curr-block-depth) + 9799 (write-buffered *(ebp+8) "8d/copy-address *(") + 9800 # TODO: ensure inouts[0] is in a register and not dereferenced + 9801 $translate-mu-index-stmt-with-array-in-register:emit-base: + 9802 # ecx = stmt + 9803 8b/-> *(ebp+0xc) 1/r32/ecx + 9804 # var base/ebx: (addr var) = inouts[0] + 9805 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 9806 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 9807 89/<- %ebx 0/r32/eax + 9808 # print base->register " + " + 9809 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax + 9810 (write-buffered *(ebp+8) %eax) + 9811 (write-buffered *(ebp+8) " + ") + 9812 # var index/edx: (addr var) = inouts[1] + 9813 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 9814 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax + 9815 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 9816 89/<- %edx 0/r32/eax + 9817 # if index->register + 9818 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register + 9819 { + 9820 0f 84/jump-if-= break/disp32 + 9821 $translate-mu-index-stmt-with-array-in-register:emit-register-index: + 9822 # if index is an int + 9823 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 9824 (is-simple-mu-type? %eax 1) # int => eax + 9825 3d/compare-eax-and 0/imm32/false + 9826 { + 9827 0f 84/jump-if-= break/disp32 + 9828 $translate-mu-index-stmt-with-array-in-register:emit-int-register-index: + 9829 # print index->register "<<" log2(size-of(element(base->type))) " + 4) " + 9830 # . index->register "<<" + 9831 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax + 9832 (write-buffered *(ebp+8) %eax) + 9833 (write-buffered *(ebp+8) "<<") + 9834 # . log2(size-of(element(base->type))) + 9835 # TODO: ensure size is a power of 2 + 9836 (array-element-type-id %ebx) # => eax + 9837 (size-of-type-id %eax) # => eax + 9838 (num-shift-rights %eax) # => eax + 9839 (print-int32-buffered *(ebp+8) %eax) + 9840 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-register-index-done/disp32 + 9841 } + 9842 # if index->type is any other atom, abort + 9843 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 9844 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom + 9845 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 + 9846 # if index has type (offset ...) + 9847 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax + 9848 (is-simple-mu-type? %eax 7) # => eax + 9849 3d/compare-eax-and 0/imm32/false + 9850 { + 9851 0f 84/jump-if-= break/disp32 + 9852 # print index->register + 9853 $translate-mu-index-stmt-with-array-in-register:emit-offset-register-index: + 9854 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax + 9855 (write-buffered *(ebp+8) %eax) + 9856 } + 9857 $translate-mu-index-stmt-with-array-in-register:emit-register-index-done: + 9858 (write-buffered *(ebp+8) " + 4) ") + 9859 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 + 9860 } + 9861 # otherwise if index is a literal + 9862 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 9863 (is-simple-mu-type? %eax 0) # => eax + 9864 3d/compare-eax-and 0/imm32/false + 9865 { + 9866 0f 84/jump-if-= break/disp32 + 9867 $translate-mu-index-stmt-with-array-in-register:emit-literal-index: + 9868 # var index-value/edx: int = parse-hex-int(index->name) + 9869 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 9870 (parse-hex-int %eax) # => eax + 9871 89/<- %edx 0/r32/eax + 9872 # offset = idx-value * size-of(element(base->type)) + 9873 (array-element-type-id %ebx) # => eax + 9874 (size-of-type-id %eax) # => eax + 9875 f7 4/subop/multiply-into-eax %edx # clobbers edx + 9876 # offset += 4 for array size + 9877 05/add-to-eax 4/imm32 + 9878 # TODO: check edx for overflow + 9879 # print offset + 9880 (print-int32-buffered *(ebp+8) %eax) + 9881 (write-buffered *(ebp+8) ") ") + 9882 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 + 9883 } + 9884 # otherwise abort + 9885 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 + 9886 $translate-mu-index-stmt-with-array-in-register:emit-output: + 9887 # outputs[0] "/r32" + 9888 8b/-> *(ebp+0xc) 1/r32/ecx + 9889 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax + 9890 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 9891 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax + 9892 (get Registers %eax 0xc "Registers") # => eax: (addr int) + 9893 (print-int32-buffered *(ebp+8) *eax) + 9894 (write-buffered *(ebp+8) "/r32\n") + 9895 $translate-mu-index-stmt-with-array-in-register:end: + 9896 # . restore registers + 9897 5b/pop-to-ebx + 9898 5a/pop-to-edx + 9899 59/pop-to-ecx + 9900 58/pop-to-eax + 9901 # . epilogue + 9902 89/<- %esp 5/r32/ebp + 9903 5d/pop-to-ebp + 9904 c3/return + 9905 + 9906 translate-mu-index-stmt-with-array-on-stack: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) + 9907 # . prologue + 9908 55/push-ebp + 9909 89/<- %ebp 4/r32/esp + 9910 # . save registers + 9911 50/push-eax + 9912 51/push-ecx + 9913 52/push-edx + 9914 53/push-ebx + 9915 # + 9916 (emit-indent *(ebp+8) *Curr-block-depth) + 9917 (write-buffered *(ebp+8) "8d/copy-address *(ebp + ") + 9918 # var curr/edx: (addr stmt-var) = lookup(stmt->inouts) + 9919 8b/-> *(ebp+0xc) 0/r32/eax + 9920 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 9921 89/<- %edx 0/r32/eax + 9922 # var base/ecx: (addr var) = lookup(curr->value) + 9923 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 9924 89/<- %ecx 0/r32/eax + 9925 # var curr2/eax: (addr stmt-var) = lookup(curr->next) + 9926 (lookup *(edx+8) *(edx+0xc)) # Stmt-var-next Stmt-var-next => eax + 9927 # var index/edx: (handle var) = curr2->value + 9928 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 9929 89/<- %edx 0/r32/eax + 9930 # if index->register + 9931 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register + 9932 { + 9933 0f 84/jump-if-= break/disp32 + 9934 $translate-mu-index-stmt-with-array-on-stack:emit-register-index: + 9935 # if index is an int + 9936 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 9937 (is-simple-mu-type? %eax 1) # int => eax + 9938 3d/compare-eax-and 0/imm32/false + 9939 { + 9940 0f 84/jump-if-= break/disp32 + 9941 $translate-mu-index-stmt-with-array-on-stack:emit-int-register-index: + 9942 # print index->register "<<" log2(size-of(element-type(base))) " + " base->offset+4 + 9943 # . inouts[1]->register "<<" + 9944 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax + 9945 (write-buffered *(ebp+8) %eax) + 9946 (write-buffered *(ebp+8) "<<") + 9947 # . log2(size-of(element(base))) + 9948 # TODO: ensure size is a power of 2 + 9949 (array-element-type-id %ecx) # => eax + 9950 (size-of-type-id %eax) # => eax + 9951 (num-shift-rights %eax) # => eax + 9952 (print-int32-buffered *(ebp+8) %eax) + 9953 # + 9954 (write-buffered *(ebp+8) " + ") + 9955 # + 9956 8b/-> *(ecx+0x14) 0/r32/eax # Var-offset + 9957 05/add-to-eax 4/imm32 # for array length + 9958 (print-int32-buffered *(ebp+8) %eax) + 9959 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done/disp32 + 9960 } + 9961 # if index->type is any other atom, abort + 9962 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 9963 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom + 9964 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 + 9965 # if index has type (offset ...) + 9966 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax + 9967 (is-simple-mu-type? %eax 7) # => eax + 9968 3d/compare-eax-and 0/imm32/false + 9969 { + 9970 0f 84/jump-if-= break/disp32 + 9971 # print index->register + 9972 $translate-mu-index-stmt-with-array-on-stack:emit-offset-register-index: + 9973 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax + 9974 (write-buffered *(ebp+8) %eax) + 9975 } + 9976 $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done: + 9977 (write-buffered *(ebp+8) ") ") + 9978 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 + 9979 } + 9980 # otherwise if index is a literal + 9981 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 9982 (is-simple-mu-type? %eax 0) # => eax + 9983 3d/compare-eax-and 0/imm32/false + 9984 { + 9985 0f 84/jump-if-= break/disp32 + 9986 $translate-mu-index-stmt-with-array-on-stack:emit-literal-index: + 9987 # var idx-value/edx: int = parse-hex-int(index->name) + 9988 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 9989 (parse-hex-int %eax) # Var-name => eax + 9990 89/<- %edx 0/r32/eax + 9991 # offset = idx-value * size-of(element-type(base->type)) + 9992 (array-element-type-id %ecx) # => eax + 9993 (size-of-type-id %eax) # => eax + 9994 f7 4/subop/multiply-into-eax %edx # clobbers edx + 9995 # offset += base->offset + 9996 03/add *(ecx+0x14) 0/r32/eax # Var-offset + 9997 # offset += 4 for array size + 9998 05/add-to-eax 4/imm32 + 9999 # TODO: check edx for overflow +10000 # print offset +10001 (print-int32-buffered *(ebp+8) %eax) +10002 (write-buffered *(ebp+8) ") ") +10003 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 +10004 } +10005 # otherwise abort +10006 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 +10007 $translate-mu-index-stmt-with-array-on-stack:emit-output: +10008 # outputs[0] "/r32" +10009 8b/-> *(ebp+0xc) 0/r32/eax +10010 (lookup *(eax+0x14) *(eax+0x18)) # Stmt1-outputs Stmt1-outputs => eax +10011 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +10012 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +10013 (get Registers %eax 0xc "Registers") # => eax: (addr int) +10014 (print-int32-buffered *(ebp+8) *eax) +10015 (write-buffered *(ebp+8) "/r32\n") +10016 $translate-mu-index-stmt-with-array-on-stack:end: +10017 # . restore registers +10018 5b/pop-to-ebx +10019 5a/pop-to-edx +10020 59/pop-to-ecx +10021 58/pop-to-eax +10022 # . epilogue +10023 89/<- %esp 5/r32/ebp +10024 5d/pop-to-ebp +10025 c3/return +10026 +10027 translate-mu-compute-index-stmt: # out: (addr buffered-file), stmt: (addr stmt) +10028 # . prologue +10029 55/push-ebp +10030 89/<- %ebp 4/r32/esp +10031 # . save registers +10032 50/push-eax +10033 51/push-ecx +10034 52/push-edx +10035 53/push-ebx +10036 # +10037 (emit-indent *(ebp+8) *Curr-block-depth) +10038 (write-buffered *(ebp+8) "69/multiply") +10039 # ecx = stmt +10040 8b/-> *(ebp+0xc) 1/r32/ecx +10041 # var first-inout/ebx: (addr stmt-var) = stmt->inouts[0] +10042 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +10043 89/<- %ebx 0/r32/eax +10044 $translate-mu-compute-index-stmt:emit-index: +10045 (lookup *(ebx+8) *(ebx+0xc)) # Stmt-var-next Stmt-var-next => eax +10046 (emit-subx-var-as-rm32 *(ebp+8) %eax) +10047 (write-buffered *(ebp+8) Space) +10048 $translate-mu-compute-index-stmt:emit-elem-size: +10049 # var base/ebx: (addr var) +10050 (lookup *ebx *(ebx+4)) # Stmt-var-value Stmt-var-value => eax +10051 89/<- %ebx 0/r32/eax +10052 # print size-of(element(base->type)) +10053 (array-element-type-id %ebx) # => eax +10054 (size-of-type-id %eax) # => eax +10055 (print-int32-buffered *(ebp+8) %eax) +10056 (write-buffered *(ebp+8) "/imm32 ") +10057 $translate-mu-compute-index-stmt:emit-output: +10058 # outputs[0] "/r32" +10059 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +10060 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +10061 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +10062 (get Registers %eax 0xc "Registers") # => eax: (addr int) +10063 (print-int32-buffered *(ebp+8) *eax) +10064 (write-buffered *(ebp+8) "/r32\n") +10065 $translate-mu-compute-index-stmt:end: +10066 # . restore registers +10067 5b/pop-to-ebx +10068 5a/pop-to-edx +10069 59/pop-to-ecx +10070 58/pop-to-eax +10071 # . epilogue +10072 89/<- %esp 5/r32/ebp +10073 5d/pop-to-ebp +10074 c3/return +10075 +10076 translate-mu-get-stmt: # out: (addr buffered-file), stmt: (addr stmt) +10077 # . prologue +10078 55/push-ebp +10079 89/<- %ebp 4/r32/esp +10080 # . save registers +10081 50/push-eax +10082 51/push-ecx +10083 52/push-edx +10084 # +10085 (emit-indent *(ebp+8) *Curr-block-depth) +10086 (write-buffered *(ebp+8) "8d/copy-address ") +10087 # ecx = stmt +10088 8b/-> *(ebp+0xc) 1/r32/ecx +10089 # var offset/edx: int = get offset of stmt +10090 (mu-get-offset %ecx) # => eax +10091 89/<- %edx 0/r32/eax +10092 # var base/eax: (addr var) = stmt->inouts->value +10093 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +10094 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +10095 # if base is in a register +10096 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +10097 { +10098 0f 84/jump-if-= break/disp32 +10099 $translate-mu-get-stmt:emit-register-input: +10100 # emit "*(" base->register " + " offset ") " +10101 (write-buffered *(ebp+8) "*(") +10102 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +10103 (write-buffered *(ebp+8) %eax) +10104 (write-buffered *(ebp+8) " + ") +10105 (print-int32-buffered *(ebp+8) %edx) +10106 (write-buffered *(ebp+8) ") ") +10107 e9/jump $translate-mu-get-stmt:emit-output/disp32 +10108 } +10109 # otherwise base is on the stack +10110 { +10111 $translate-mu-get-stmt:emit-stack-input: +10112 # emit "*(ebp + " inouts[0]->stack-offset + offset ") " +10113 (write-buffered *(ebp+8) "*(ebp+") +10114 03/add *(eax+0x14) 2/r32/edx # Var-offset +10115 (print-int32-buffered *(ebp+8) %edx) +10116 (write-buffered *(ebp+8) ") ") +10117 eb/jump $translate-mu-get-stmt:emit-output/disp8 +10118 } +10119 $translate-mu-get-stmt:emit-output: +10120 # var output/eax: (addr var) = stmt->outputs->value +10121 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +10122 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +10123 # emit offset->register "/r32" +10124 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +10125 (get Registers %eax 0xc "Registers") # => eax: (addr int) +10126 (print-int32-buffered *(ebp+8) *eax) +10127 (write-buffered *(ebp+8) "/r32\n") +10128 $translate-mu-get-stmt:end: +10129 # . restore registers +10130 5a/pop-to-edx +10131 59/pop-to-ecx +10132 58/pop-to-eax +10133 # . epilogue +10134 89/<- %esp 5/r32/ebp +10135 5d/pop-to-ebp +10136 c3/return +10137 +10138 array-element-type-id: # v: (addr var) -> result/eax: type-id +10139 # precondition: n is positive +10140 # . prologue +10141 55/push-ebp +10142 89/<- %ebp 4/r32/esp +10143 # +10144 8b/-> *(ebp+8) 0/r32/eax +10145 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +10146 # TODO: ensure type->left is 'addr' +10147 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax +10148 # TODO: ensure that type->right is non-null +10149 # TODO: ensure that type->right->left is 'array' +10150 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax +10151 # TODO: ensure that type->right->right is non-null +10152 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax +10153 8b/-> *(eax+4) 0/r32/eax # Tree-value +10154 $array-element-type-id:end: +10155 # . epilogue +10156 89/<- %esp 5/r32/ebp +10157 5d/pop-to-ebp +10158 c3/return +10159 +10160 power-of-2?: # n: int, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: boolean +10161 # precondition: n is positive +10162 # . prologue +10163 55/push-ebp +10164 89/<- %ebp 4/r32/esp +10165 # eax = n +10166 8b/-> *(ebp+8) 0/r32/eax +10167 # if (n < 0) abort +10168 3d/compare-eax-with 0/imm32 +10169 0f 8c/jump-if-< $power-of-2?:abort/disp32 +10170 # var tmp/eax: int = n-1 +10171 48/decrement-eax +10172 # var tmp2/eax: int = n & tmp +10173 23/and-> *(ebp+8) 0/r32/eax +10174 # return (tmp2 == 0) +10175 3d/compare-eax-and 0/imm32 +10176 0f 94/set-byte-if-= %al +10177 81 4/subop/and %eax 0xff/imm32 +10178 $power-of-2?:end: +10179 # . epilogue +10180 89/<- %esp 5/r32/ebp +10181 5d/pop-to-ebp +10182 c3/return +10183 +10184 $power-of-2?:abort: +10185 (write-buffered *(ebp+0xc) "power-of-2?: negative number\n") +10186 (flush *(ebp+0xc)) +10187 (stop *(ebp+0x10) 1) +10188 # never gets here +10189 +10190 num-shift-rights: # n: int -> result/eax: int +10191 # precondition: n is a positive power of 2 +10192 # . prologue +10193 55/push-ebp +10194 89/<- %ebp 4/r32/esp +10195 # . save registers +10196 51/push-ecx +10197 # var curr/ecx: int = n +10198 8b/-> *(ebp+8) 1/r32/ecx +10199 # result = 0 +10200 b8/copy-to-eax 0/imm32 +10201 { +10202 # if (curr <= 1) break +10203 81 7/subop/compare %ecx 1/imm32 +10204 7e/jump-if-<= break/disp8 +10205 40/increment-eax +10206 c1/shift 5/subop/arithmetic-right %ecx 1/imm8 +10207 eb/jump loop/disp8 +10208 } +10209 $num-shift-rights:end: +10210 # . restore registers +10211 59/pop-to-ecx +10212 # . epilogue +10213 89/<- %esp 5/r32/ebp +10214 5d/pop-to-ebp +10215 c3/return +10216 +10217 mu-get-offset: # stmt: (addr stmt) -> result/eax: int +10218 # . prologue +10219 55/push-ebp +10220 89/<- %ebp 4/r32/esp +10221 # var second-inout/eax: (addr stmt-var) = stmt->inouts->next +10222 8b/-> *(ebp+8) 0/r32/eax +10223 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +10224 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +10225 # var output-var/eax: (addr var) = second-inout->value +10226 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +10227 #? (write-buffered Stderr "mu-get-offset: ") +10228 #? (print-int32-buffered Stderr %eax) +10229 #? (write-buffered Stderr " name: ") +10230 #? 50/push-eax +10231 #? (lookup *eax *(eax+4)) # Var-name +10232 #? (write-buffered Stderr %eax) +10233 #? 58/pop-to-eax +10234 #? (write-buffered Stderr Newline) +10235 #? (flush Stderr) +10236 # return output-var->stack-offset +10237 8b/-> *(eax+0x14) 0/r32/eax # Var-offset +10238 #? (write-buffered Stderr "=> ") +10239 #? (print-int32-buffered Stderr %eax) +10240 #? (write-buffered Stderr Newline) +10241 #? (flush Stderr) +10242 $emit-get-offset:end: +10243 # . epilogue +10244 89/<- %esp 5/r32/ebp +10245 5d/pop-to-ebp +10246 c3/return +10247 +10248 emit-subx-block: # out: (addr buffered-file), block: (addr block), vars: (addr stack live-var), fn-outputs: (addr list var), err: (addr buffered-file), ed: (addr exit-descriptor) +10249 # . prologue +10250 55/push-ebp +10251 89/<- %ebp 4/r32/esp +10252 # . save registers +10253 50/push-eax +10254 51/push-ecx +10255 56/push-esi +10256 # esi = block +10257 8b/-> *(ebp+0xc) 6/r32/esi +10258 # block->var->block-depth = *Curr-block-depth +10259 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax +10260 8b/-> *Curr-block-depth 1/r32/ecx +10261 89/<- *(eax+0x10) 1/r32/ecx # Var-block-depth +10262 # var stmts/eax: (addr list stmt) = lookup(block->statements) +10263 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax +10264 # +10265 { +10266 $emit-subx-block:check-empty: +10267 3d/compare-eax-and 0/imm32 +10268 0f 84/jump-if-= break/disp32 +10269 (emit-indent *(ebp+8) *Curr-block-depth) +10270 (write-buffered *(ebp+8) "{\n") +10271 # var v/ecx: (addr var) = lookup(block->var) +10272 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax +10273 89/<- %ecx 0/r32/eax +10274 # +10275 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +10276 (write-buffered *(ebp+8) %eax) +10277 (write-buffered *(ebp+8) ":loop:\n") +10278 ff 0/subop/increment *Curr-block-depth +10279 (push *(ebp+0x10) *(esi+0xc)) # Block-var +10280 (push *(ebp+0x10) *(esi+0x10)) # Block-var +10281 (push *(ebp+0x10) 0) # false +10282 # emit block->statements +10283 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax +10284 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +10285 (pop *(ebp+0x10)) # => eax +10286 (pop *(ebp+0x10)) # => eax +10287 (pop *(ebp+0x10)) # => eax +10288 ff 1/subop/decrement *Curr-block-depth +10289 (emit-indent *(ebp+8) *Curr-block-depth) +10290 (write-buffered *(ebp+8) "}\n") +10291 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +10292 (write-buffered *(ebp+8) %eax) +10293 (write-buffered *(ebp+8) ":break:\n") +10294 } +10295 $emit-subx-block:end: +10296 # . restore registers +10297 5e/pop-to-esi +10298 59/pop-to-ecx +10299 58/pop-to-eax +10300 # . epilogue +10301 89/<- %esp 5/r32/ebp +10302 5d/pop-to-ebp +10303 c3/return +10304 +10305 # Primitives supported +10306 # See mu_instructions for a summary of this linked-list data structure. +10307 # +10308 # For each operation, put variants with hard-coded registers before flexible ones. +10309 # +10310 # Unfortunately, our restrictions on addresses require that various fields in +10311 # primitives be handles, which complicates these definitions. +10312 # - we need to insert dummy fields all over the place for fake alloc-ids +10313 # - we can't use our syntax sugar of quoted literals for string fields 10314 # -10315 # Every 'object' below starts with a fake alloc-id. It may also contain other -10316 # fake alloc-ids for various handle fields. -10317 # -10318 # I think of objects starting with a fake alloc-id as having type 'payload'. -10319 # It's not really intended to be created dynamically; for that use `allocate` -10320 # as usual. +10315 # Fake alloc-ids are needed because our type definitions up top require +10316 # handles but it's clearer to statically allocate these long-lived objects. +10317 # Fake alloc-ids are perfectly safe, but they can't be reclaimed. +10318 # +10319 # Every 'object' below starts with a fake alloc-id. It may also contain other +10320 # fake alloc-ids for various handle fields. 10321 # -10322 # Idea for a notation to simplify such definitions: -10323 # _Primitive-increment-eax: # (payload primitive) -10324 # 0x11/alloc-id:fake:payload -10325 # 0x11 @(0x11 "increment") # name -10326 # 0 0 # inouts -10327 # 0x11 @(0x11/payload -10328 # 0x11 @(0x11/payload # List-value -10329 # 0 0 # Var-name -10330 # 0x11 @(0x11 # Var-type -10331 # 1/is-atom -10332 # 1/value 0/unused # Tree-left -10333 # 0 0 # Tree-right -10334 # ) -10335 # 1 # block-depth -10336 # 0 # stack-offset -10337 # 0x11 @(0x11 "eax") # Var-register -10338 # ) -10339 # 0 0) # List-next -10340 # ... -10341 # _Primitive-increment-ecx/imm32/next -10342 # ... -10343 # Awfully complex and non-obvious. But also clearly signals there's something -10344 # to learn here, so may be worth trying. -10345 # -10346 # '@' is just an initial thought. Punctuation used so far in Mu: () * % # / " -10347 # -10348 # For now we'll continue to just use comments and manually ensure they stay up -10349 # to date. -10350 == data -10351 Primitives: # (addr primitive) -10352 # - increment/decrement -10353 _Primitive-increment-eax: # (addr primitive) -10354 # var/eax <- increment => 40/increment-eax -10355 0x11/imm32/alloc-id:fake -10356 _string-increment/imm32/name -10357 0/imm32/no-inouts -10358 0/imm32/no-inouts +10322 # I think of objects starting with a fake alloc-id as having type 'payload'. +10323 # It's not really intended to be created dynamically; for that use `allocate` +10324 # as usual. +10325 # +10326 # Idea for a notation to simplify such definitions: +10327 # _Primitive-increment-eax: # (payload primitive) +10328 # 0x11/alloc-id:fake:payload +10329 # 0x11 @(0x11 "increment") # name +10330 # 0 0 # inouts +10331 # 0x11 @(0x11/payload +10332 # 0x11 @(0x11/payload # List-value +10333 # 0 0 # Var-name +10334 # 0x11 @(0x11 # Var-type +10335 # 1/is-atom +10336 # 1/value 0/unused # Tree-left +10337 # 0 0 # Tree-right +10338 # ) +10339 # 1 # block-depth +10340 # 0 # stack-offset +10341 # 0x11 @(0x11 "eax") # Var-register +10342 # ) +10343 # 0 0) # List-next +10344 # ... +10345 # _Primitive-increment-ecx/imm32/next +10346 # ... +10347 # Awfully complex and non-obvious. But also clearly signals there's something +10348 # to learn here, so may be worth trying. +10349 # +10350 # '@' is just an initial thought. Punctuation used so far in Mu: () * % # / " +10351 # +10352 # For now we'll continue to just use comments and manually ensure they stay up +10353 # to date. +10354 == data +10355 Primitives: # (addr primitive) +10356 # - increment/decrement +10357 _Primitive-increment-eax: # (addr primitive) +10358 # var/eax <- increment => 40/increment-eax 10359 0x11/imm32/alloc-id:fake -10360 Single-int-var-in-eax/imm32/outputs -10361 0x11/imm32/alloc-id:fake -10362 _string_40_increment_eax/imm32/subx-name -10363 0/imm32/no-rm32 -10364 0/imm32/no-r32 -10365 0/imm32/no-imm32 -10366 0/imm32/no-disp32 -10367 0/imm32/output-is-write-only -10368 0x11/imm32/alloc-id:fake -10369 _Primitive-increment-ecx/imm32/next -10370 _Primitive-increment-ecx: # (payload primitive) -10371 0x11/imm32/alloc-id:fake:payload -10372 # var/ecx <- increment => 41/increment-ecx -10373 0x11/imm32/alloc-id:fake -10374 _string-increment/imm32/name -10375 0/imm32/no-inouts -10376 0/imm32/no-inouts +10360 _string-increment/imm32/name +10361 0/imm32/no-inouts +10362 0/imm32/no-inouts +10363 0x11/imm32/alloc-id:fake +10364 Single-int-var-in-eax/imm32/outputs +10365 0x11/imm32/alloc-id:fake +10366 _string_40_increment_eax/imm32/subx-name +10367 0/imm32/no-rm32 +10368 0/imm32/no-r32 +10369 0/imm32/no-imm32 +10370 0/imm32/no-disp32 +10371 0/imm32/output-is-write-only +10372 0x11/imm32/alloc-id:fake +10373 _Primitive-increment-ecx/imm32/next +10374 _Primitive-increment-ecx: # (payload primitive) +10375 0x11/imm32/alloc-id:fake:payload +10376 # var/ecx <- increment => 41/increment-ecx 10377 0x11/imm32/alloc-id:fake -10378 Single-int-var-in-ecx/imm32/outputs -10379 0x11/imm32/alloc-id:fake -10380 _string_41_increment_ecx/imm32/subx-name -10381 0/imm32/no-rm32 -10382 0/imm32/no-r32 -10383 0/imm32/no-imm32 -10384 0/imm32/no-disp32 -10385 0/imm32/output-is-write-only -10386 0x11/imm32/alloc-id:fake -10387 _Primitive-increment-edx/imm32/next -10388 _Primitive-increment-edx: # (payload primitive) -10389 0x11/imm32/alloc-id:fake:payload -10390 # var/edx <- increment => 42/increment-edx -10391 0x11/imm32/alloc-id:fake -10392 _string-increment/imm32/name -10393 0/imm32/no-inouts -10394 0/imm32/no-inouts +10378 _string-increment/imm32/name +10379 0/imm32/no-inouts +10380 0/imm32/no-inouts +10381 0x11/imm32/alloc-id:fake +10382 Single-int-var-in-ecx/imm32/outputs +10383 0x11/imm32/alloc-id:fake +10384 _string_41_increment_ecx/imm32/subx-name +10385 0/imm32/no-rm32 +10386 0/imm32/no-r32 +10387 0/imm32/no-imm32 +10388 0/imm32/no-disp32 +10389 0/imm32/output-is-write-only +10390 0x11/imm32/alloc-id:fake +10391 _Primitive-increment-edx/imm32/next +10392 _Primitive-increment-edx: # (payload primitive) +10393 0x11/imm32/alloc-id:fake:payload +10394 # var/edx <- increment => 42/increment-edx 10395 0x11/imm32/alloc-id:fake -10396 Single-int-var-in-edx/imm32/outputs -10397 0x11/imm32/alloc-id:fake -10398 _string_42_increment_edx/imm32/subx-name -10399 0/imm32/no-rm32 -10400 0/imm32/no-r32 -10401 0/imm32/no-imm32 -10402 0/imm32/no-disp32 -10403 0/imm32/output-is-write-only -10404 0x11/imm32/alloc-id:fake -10405 _Primitive-increment-ebx/imm32/next -10406 _Primitive-increment-ebx: # (payload primitive) -10407 0x11/imm32/alloc-id:fake:payload -10408 # var/ebx <- increment => 43/increment-ebx -10409 0x11/imm32/alloc-id:fake -10410 _string-increment/imm32/name -10411 0/imm32/no-inouts -10412 0/imm32/no-inouts +10396 _string-increment/imm32/name +10397 0/imm32/no-inouts +10398 0/imm32/no-inouts +10399 0x11/imm32/alloc-id:fake +10400 Single-int-var-in-edx/imm32/outputs +10401 0x11/imm32/alloc-id:fake +10402 _string_42_increment_edx/imm32/subx-name +10403 0/imm32/no-rm32 +10404 0/imm32/no-r32 +10405 0/imm32/no-imm32 +10406 0/imm32/no-disp32 +10407 0/imm32/output-is-write-only +10408 0x11/imm32/alloc-id:fake +10409 _Primitive-increment-ebx/imm32/next +10410 _Primitive-increment-ebx: # (payload primitive) +10411 0x11/imm32/alloc-id:fake:payload +10412 # var/ebx <- increment => 43/increment-ebx 10413 0x11/imm32/alloc-id:fake -10414 Single-int-var-in-ebx/imm32/outputs -10415 0x11/imm32/alloc-id:fake -10416 _string_43_increment_ebx/imm32/subx-name -10417 0/imm32/no-rm32 -10418 0/imm32/no-r32 -10419 0/imm32/no-imm32 -10420 0/imm32/no-disp32 -10421 0/imm32/output-is-write-only -10422 0x11/imm32/alloc-id:fake -10423 _Primitive-increment-esi/imm32/next -10424 _Primitive-increment-esi: # (payload primitive) -10425 0x11/imm32/alloc-id:fake:payload -10426 # var/esi <- increment => 46/increment-esi -10427 0x11/imm32/alloc-id:fake -10428 _string-increment/imm32/name -10429 0/imm32/no-inouts -10430 0/imm32/no-inouts +10414 _string-increment/imm32/name +10415 0/imm32/no-inouts +10416 0/imm32/no-inouts +10417 0x11/imm32/alloc-id:fake +10418 Single-int-var-in-ebx/imm32/outputs +10419 0x11/imm32/alloc-id:fake +10420 _string_43_increment_ebx/imm32/subx-name +10421 0/imm32/no-rm32 +10422 0/imm32/no-r32 +10423 0/imm32/no-imm32 +10424 0/imm32/no-disp32 +10425 0/imm32/output-is-write-only +10426 0x11/imm32/alloc-id:fake +10427 _Primitive-increment-esi/imm32/next +10428 _Primitive-increment-esi: # (payload primitive) +10429 0x11/imm32/alloc-id:fake:payload +10430 # var/esi <- increment => 46/increment-esi 10431 0x11/imm32/alloc-id:fake -10432 Single-int-var-in-esi/imm32/outputs -10433 0x11/imm32/alloc-id:fake -10434 _string_46_increment_esi/imm32/subx-name -10435 0/imm32/no-rm32 -10436 0/imm32/no-r32 -10437 0/imm32/no-imm32 -10438 0/imm32/no-disp32 -10439 0/imm32/output-is-write-only -10440 0x11/imm32/alloc-id:fake -10441 _Primitive-increment-edi/imm32/next -10442 _Primitive-increment-edi: # (payload primitive) -10443 0x11/imm32/alloc-id:fake:payload -10444 # var/edi <- increment => 47/increment-edi -10445 0x11/imm32/alloc-id:fake -10446 _string-increment/imm32/name -10447 0/imm32/no-inouts -10448 0/imm32/no-inouts +10432 _string-increment/imm32/name +10433 0/imm32/no-inouts +10434 0/imm32/no-inouts +10435 0x11/imm32/alloc-id:fake +10436 Single-int-var-in-esi/imm32/outputs +10437 0x11/imm32/alloc-id:fake +10438 _string_46_increment_esi/imm32/subx-name +10439 0/imm32/no-rm32 +10440 0/imm32/no-r32 +10441 0/imm32/no-imm32 +10442 0/imm32/no-disp32 +10443 0/imm32/output-is-write-only +10444 0x11/imm32/alloc-id:fake +10445 _Primitive-increment-edi/imm32/next +10446 _Primitive-increment-edi: # (payload primitive) +10447 0x11/imm32/alloc-id:fake:payload +10448 # var/edi <- increment => 47/increment-edi 10449 0x11/imm32/alloc-id:fake -10450 Single-int-var-in-edi/imm32/outputs -10451 0x11/imm32/alloc-id:fake -10452 _string_47_increment_edi/imm32/subx-name -10453 0/imm32/no-rm32 -10454 0/imm32/no-r32 -10455 0/imm32/no-imm32 -10456 0/imm32/no-disp32 -10457 0/imm32/output-is-write-only -10458 0x11/imm32/alloc-id:fake -10459 _Primitive-decrement-eax/imm32/next -10460 _Primitive-decrement-eax: # (payload primitive) -10461 0x11/imm32/alloc-id:fake:payload -10462 # var/eax <- decrement => 48/decrement-eax -10463 0x11/imm32/alloc-id:fake -10464 _string-decrement/imm32/name -10465 0/imm32/no-inouts -10466 0/imm32/no-inouts +10450 _string-increment/imm32/name +10451 0/imm32/no-inouts +10452 0/imm32/no-inouts +10453 0x11/imm32/alloc-id:fake +10454 Single-int-var-in-edi/imm32/outputs +10455 0x11/imm32/alloc-id:fake +10456 _string_47_increment_edi/imm32/subx-name +10457 0/imm32/no-rm32 +10458 0/imm32/no-r32 +10459 0/imm32/no-imm32 +10460 0/imm32/no-disp32 +10461 0/imm32/output-is-write-only +10462 0x11/imm32/alloc-id:fake +10463 _Primitive-decrement-eax/imm32/next +10464 _Primitive-decrement-eax: # (payload primitive) +10465 0x11/imm32/alloc-id:fake:payload +10466 # var/eax <- decrement => 48/decrement-eax 10467 0x11/imm32/alloc-id:fake -10468 Single-int-var-in-eax/imm32/outputs -10469 0x11/imm32/alloc-id:fake -10470 _string_48_decrement_eax/imm32/subx-name -10471 0/imm32/no-rm32 -10472 0/imm32/no-r32 -10473 0/imm32/no-imm32 -10474 0/imm32/no-disp32 -10475 0/imm32/output-is-write-only -10476 0x11/imm32/alloc-id:fake -10477 _Primitive-decrement-ecx/imm32/next -10478 _Primitive-decrement-ecx: # (payload primitive) -10479 0x11/imm32/alloc-id:fake:payload -10480 # var/ecx <- decrement => 49/decrement-ecx -10481 0x11/imm32/alloc-id:fake -10482 _string-decrement/imm32/name -10483 0/imm32/no-inouts -10484 0/imm32/no-inouts +10468 _string-decrement/imm32/name +10469 0/imm32/no-inouts +10470 0/imm32/no-inouts +10471 0x11/imm32/alloc-id:fake +10472 Single-int-var-in-eax/imm32/outputs +10473 0x11/imm32/alloc-id:fake +10474 _string_48_decrement_eax/imm32/subx-name +10475 0/imm32/no-rm32 +10476 0/imm32/no-r32 +10477 0/imm32/no-imm32 +10478 0/imm32/no-disp32 +10479 0/imm32/output-is-write-only +10480 0x11/imm32/alloc-id:fake +10481 _Primitive-decrement-ecx/imm32/next +10482 _Primitive-decrement-ecx: # (payload primitive) +10483 0x11/imm32/alloc-id:fake:payload +10484 # var/ecx <- decrement => 49/decrement-ecx 10485 0x11/imm32/alloc-id:fake -10486 Single-int-var-in-ecx/imm32/outputs -10487 0x11/imm32/alloc-id:fake -10488 _string_49_decrement_ecx/imm32/subx-name -10489 0/imm32/no-rm32 -10490 0/imm32/no-r32 -10491 0/imm32/no-imm32 -10492 0/imm32/no-disp32 -10493 0/imm32/output-is-write-only -10494 0x11/imm32/alloc-id:fake -10495 _Primitive-decrement-edx/imm32/next -10496 _Primitive-decrement-edx: # (payload primitive) -10497 0x11/imm32/alloc-id:fake:payload -10498 # var/edx <- decrement => 4a/decrement-edx -10499 0x11/imm32/alloc-id:fake -10500 _string-decrement/imm32/name -10501 0/imm32/no-inouts -10502 0/imm32/no-inouts +10486 _string-decrement/imm32/name +10487 0/imm32/no-inouts +10488 0/imm32/no-inouts +10489 0x11/imm32/alloc-id:fake +10490 Single-int-var-in-ecx/imm32/outputs +10491 0x11/imm32/alloc-id:fake +10492 _string_49_decrement_ecx/imm32/subx-name +10493 0/imm32/no-rm32 +10494 0/imm32/no-r32 +10495 0/imm32/no-imm32 +10496 0/imm32/no-disp32 +10497 0/imm32/output-is-write-only +10498 0x11/imm32/alloc-id:fake +10499 _Primitive-decrement-edx/imm32/next +10500 _Primitive-decrement-edx: # (payload primitive) +10501 0x11/imm32/alloc-id:fake:payload +10502 # var/edx <- decrement => 4a/decrement-edx 10503 0x11/imm32/alloc-id:fake -10504 Single-int-var-in-edx/imm32/outputs -10505 0x11/imm32/alloc-id:fake -10506 _string_4a_decrement_edx/imm32/subx-name -10507 0/imm32/no-rm32 -10508 0/imm32/no-r32 -10509 0/imm32/no-imm32 -10510 0/imm32/no-disp32 -10511 0/imm32/output-is-write-only -10512 0x11/imm32/alloc-id:fake -10513 _Primitive-decrement-ebx/imm32/next -10514 _Primitive-decrement-ebx: # (payload primitive) -10515 0x11/imm32/alloc-id:fake:payload -10516 # var/ebx <- decrement => 4b/decrement-ebx -10517 0x11/imm32/alloc-id:fake -10518 _string-decrement/imm32/name -10519 0/imm32/no-inouts -10520 0/imm32/no-inouts +10504 _string-decrement/imm32/name +10505 0/imm32/no-inouts +10506 0/imm32/no-inouts +10507 0x11/imm32/alloc-id:fake +10508 Single-int-var-in-edx/imm32/outputs +10509 0x11/imm32/alloc-id:fake +10510 _string_4a_decrement_edx/imm32/subx-name +10511 0/imm32/no-rm32 +10512 0/imm32/no-r32 +10513 0/imm32/no-imm32 +10514 0/imm32/no-disp32 +10515 0/imm32/output-is-write-only +10516 0x11/imm32/alloc-id:fake +10517 _Primitive-decrement-ebx/imm32/next +10518 _Primitive-decrement-ebx: # (payload primitive) +10519 0x11/imm32/alloc-id:fake:payload +10520 # var/ebx <- decrement => 4b/decrement-ebx 10521 0x11/imm32/alloc-id:fake -10522 Single-int-var-in-ebx/imm32/outputs -10523 0x11/imm32/alloc-id:fake -10524 _string_4b_decrement_ebx/imm32/subx-name -10525 0/imm32/no-rm32 -10526 0/imm32/no-r32 -10527 0/imm32/no-imm32 -10528 0/imm32/no-disp32 -10529 0/imm32/output-is-write-only -10530 0x11/imm32/alloc-id:fake -10531 _Primitive-decrement-esi/imm32/next -10532 _Primitive-decrement-esi: # (payload primitive) -10533 0x11/imm32/alloc-id:fake:payload -10534 # var/esi <- decrement => 4e/decrement-esi -10535 0x11/imm32/alloc-id:fake -10536 _string-decrement/imm32/name -10537 0/imm32/no-inouts -10538 0/imm32/no-inouts +10522 _string-decrement/imm32/name +10523 0/imm32/no-inouts +10524 0/imm32/no-inouts +10525 0x11/imm32/alloc-id:fake +10526 Single-int-var-in-ebx/imm32/outputs +10527 0x11/imm32/alloc-id:fake +10528 _string_4b_decrement_ebx/imm32/subx-name +10529 0/imm32/no-rm32 +10530 0/imm32/no-r32 +10531 0/imm32/no-imm32 +10532 0/imm32/no-disp32 +10533 0/imm32/output-is-write-only +10534 0x11/imm32/alloc-id:fake +10535 _Primitive-decrement-esi/imm32/next +10536 _Primitive-decrement-esi: # (payload primitive) +10537 0x11/imm32/alloc-id:fake:payload +10538 # var/esi <- decrement => 4e/decrement-esi 10539 0x11/imm32/alloc-id:fake -10540 Single-int-var-in-esi/imm32/outputs -10541 0x11/imm32/alloc-id:fake -10542 _string_4e_decrement_esi/imm32/subx-name -10543 0/imm32/no-rm32 -10544 0/imm32/no-r32 -10545 0/imm32/no-imm32 -10546 0/imm32/no-disp32 -10547 0/imm32/output-is-write-only -10548 0x11/imm32/alloc-id:fake -10549 _Primitive-decrement-edi/imm32/next -10550 _Primitive-decrement-edi: # (payload primitive) -10551 0x11/imm32/alloc-id:fake:payload -10552 # var/edi <- decrement => 4f/decrement-edi -10553 0x11/imm32/alloc-id:fake -10554 _string-decrement/imm32/name -10555 0/imm32/no-inouts -10556 0/imm32/no-inouts +10540 _string-decrement/imm32/name +10541 0/imm32/no-inouts +10542 0/imm32/no-inouts +10543 0x11/imm32/alloc-id:fake +10544 Single-int-var-in-esi/imm32/outputs +10545 0x11/imm32/alloc-id:fake +10546 _string_4e_decrement_esi/imm32/subx-name +10547 0/imm32/no-rm32 +10548 0/imm32/no-r32 +10549 0/imm32/no-imm32 +10550 0/imm32/no-disp32 +10551 0/imm32/output-is-write-only +10552 0x11/imm32/alloc-id:fake +10553 _Primitive-decrement-edi/imm32/next +10554 _Primitive-decrement-edi: # (payload primitive) +10555 0x11/imm32/alloc-id:fake:payload +10556 # var/edi <- decrement => 4f/decrement-edi 10557 0x11/imm32/alloc-id:fake -10558 Single-int-var-in-edi/imm32/outputs -10559 0x11/imm32/alloc-id:fake -10560 _string_4f_decrement_edi/imm32/subx-name -10561 0/imm32/no-rm32 -10562 0/imm32/no-r32 -10563 0/imm32/no-imm32 -10564 0/imm32/no-disp32 -10565 0/imm32/output-is-write-only -10566 0x11/imm32/alloc-id:fake -10567 _Primitive-increment-mem/imm32/next -10568 _Primitive-increment-mem: # (payload primitive) -10569 0x11/imm32/alloc-id:fake:payload -10570 # increment var => ff 0/subop/increment *(ebp+__) -10571 0x11/imm32/alloc-id:fake -10572 _string-increment/imm32/name -10573 0x11/imm32/alloc-id:fake -10574 Single-int-var-in-mem/imm32/inouts -10575 0/imm32/no-outputs -10576 0/imm32/no-outputs +10558 _string-decrement/imm32/name +10559 0/imm32/no-inouts +10560 0/imm32/no-inouts +10561 0x11/imm32/alloc-id:fake +10562 Single-int-var-in-edi/imm32/outputs +10563 0x11/imm32/alloc-id:fake +10564 _string_4f_decrement_edi/imm32/subx-name +10565 0/imm32/no-rm32 +10566 0/imm32/no-r32 +10567 0/imm32/no-imm32 +10568 0/imm32/no-disp32 +10569 0/imm32/output-is-write-only +10570 0x11/imm32/alloc-id:fake +10571 _Primitive-increment-mem/imm32/next +10572 _Primitive-increment-mem: # (payload primitive) +10573 0x11/imm32/alloc-id:fake:payload +10574 # increment var => ff 0/subop/increment *(ebp+__) +10575 0x11/imm32/alloc-id:fake +10576 _string-increment/imm32/name 10577 0x11/imm32/alloc-id:fake -10578 _string_ff_subop_increment/imm32/subx-name -10579 1/imm32/rm32-is-first-inout -10580 0/imm32/no-r32 -10581 0/imm32/no-imm32 -10582 0/imm32/no-disp32 -10583 0/imm32/output-is-write-only -10584 0x11/imm32/alloc-id:fake -10585 _Primitive-increment-reg/imm32/next -10586 _Primitive-increment-reg: # (payload primitive) -10587 0x11/imm32/alloc-id:fake:payload -10588 # var/reg <- increment => ff 0/subop/increment %__ -10589 0x11/imm32/alloc-id:fake -10590 _string-increment/imm32/name -10591 0/imm32/no-inouts -10592 0/imm32/no-inouts +10578 Single-int-var-in-mem/imm32/inouts +10579 0/imm32/no-outputs +10580 0/imm32/no-outputs +10581 0x11/imm32/alloc-id:fake +10582 _string_ff_subop_increment/imm32/subx-name +10583 1/imm32/rm32-is-first-inout +10584 0/imm32/no-r32 +10585 0/imm32/no-imm32 +10586 0/imm32/no-disp32 +10587 0/imm32/output-is-write-only +10588 0x11/imm32/alloc-id:fake +10589 _Primitive-increment-reg/imm32/next +10590 _Primitive-increment-reg: # (payload primitive) +10591 0x11/imm32/alloc-id:fake:payload +10592 # var/reg <- increment => ff 0/subop/increment %__ 10593 0x11/imm32/alloc-id:fake -10594 Single-int-var-in-some-register/imm32/outputs -10595 0x11/imm32/alloc-id:fake -10596 _string_ff_subop_increment/imm32/subx-name -10597 3/imm32/rm32-is-first-output -10598 0/imm32/no-r32 -10599 0/imm32/no-imm32 -10600 0/imm32/no-disp32 -10601 0/imm32/output-is-write-only -10602 0x11/imm32/alloc-id:fake -10603 _Primitive-decrement-mem/imm32/next -10604 _Primitive-decrement-mem: # (payload primitive) -10605 0x11/imm32/alloc-id:fake:payload -10606 # decrement var => ff 1/subop/decrement *(ebp+__) -10607 0x11/imm32/alloc-id:fake -10608 _string-decrement/imm32/name -10609 0x11/imm32/alloc-id:fake -10610 Single-int-var-in-mem/imm32/inouts -10611 0/imm32/no-outputs -10612 0/imm32/no-outputs +10594 _string-increment/imm32/name +10595 0/imm32/no-inouts +10596 0/imm32/no-inouts +10597 0x11/imm32/alloc-id:fake +10598 Single-int-var-in-some-register/imm32/outputs +10599 0x11/imm32/alloc-id:fake +10600 _string_ff_subop_increment/imm32/subx-name +10601 3/imm32/rm32-is-first-output +10602 0/imm32/no-r32 +10603 0/imm32/no-imm32 +10604 0/imm32/no-disp32 +10605 0/imm32/output-is-write-only +10606 0x11/imm32/alloc-id:fake +10607 _Primitive-decrement-mem/imm32/next +10608 _Primitive-decrement-mem: # (payload primitive) +10609 0x11/imm32/alloc-id:fake:payload +10610 # decrement var => ff 1/subop/decrement *(ebp+__) +10611 0x11/imm32/alloc-id:fake +10612 _string-decrement/imm32/name 10613 0x11/imm32/alloc-id:fake -10614 _string_ff_subop_decrement/imm32/subx-name -10615 1/imm32/rm32-is-first-inout -10616 0/imm32/no-r32 -10617 0/imm32/no-imm32 -10618 0/imm32/no-disp32 -10619 0/imm32/output-is-write-only -10620 0x11/imm32/alloc-id:fake -10621 _Primitive-decrement-reg/imm32/next -10622 _Primitive-decrement-reg: # (payload primitive) -10623 0x11/imm32/alloc-id:fake:payload -10624 # var/reg <- decrement => ff 1/subop/decrement %__ -10625 0x11/imm32/alloc-id:fake -10626 _string-decrement/imm32/name -10627 0/imm32/no-inouts -10628 0/imm32/no-inouts +10614 Single-int-var-in-mem/imm32/inouts +10615 0/imm32/no-outputs +10616 0/imm32/no-outputs +10617 0x11/imm32/alloc-id:fake +10618 _string_ff_subop_decrement/imm32/subx-name +10619 1/imm32/rm32-is-first-inout +10620 0/imm32/no-r32 +10621 0/imm32/no-imm32 +10622 0/imm32/no-disp32 +10623 0/imm32/output-is-write-only +10624 0x11/imm32/alloc-id:fake +10625 _Primitive-decrement-reg/imm32/next +10626 _Primitive-decrement-reg: # (payload primitive) +10627 0x11/imm32/alloc-id:fake:payload +10628 # var/reg <- decrement => ff 1/subop/decrement %__ 10629 0x11/imm32/alloc-id:fake -10630 Single-int-var-in-some-register/imm32/outputs -10631 0x11/imm32/alloc-id:fake -10632 _string_ff_subop_decrement/imm32/subx-name -10633 3/imm32/rm32-is-first-output -10634 0/imm32/no-r32 -10635 0/imm32/no-imm32 -10636 0/imm32/no-disp32 -10637 0/imm32/output-is-write-only -10638 0x11/imm32/alloc-id:fake -10639 _Primitive-add-to-eax/imm32/next -10640 # - add -10641 _Primitive-add-to-eax: # (payload primitive) -10642 0x11/imm32/alloc-id:fake:payload -10643 # var/eax <- add lit => 05/add-to-eax lit/imm32 -10644 0x11/imm32/alloc-id:fake -10645 _string-add/imm32/name -10646 0x11/imm32/alloc-id:fake -10647 Single-lit-var/imm32/inouts +10630 _string-decrement/imm32/name +10631 0/imm32/no-inouts +10632 0/imm32/no-inouts +10633 0x11/imm32/alloc-id:fake +10634 Single-int-var-in-some-register/imm32/outputs +10635 0x11/imm32/alloc-id:fake +10636 _string_ff_subop_decrement/imm32/subx-name +10637 3/imm32/rm32-is-first-output +10638 0/imm32/no-r32 +10639 0/imm32/no-imm32 +10640 0/imm32/no-disp32 +10641 0/imm32/output-is-write-only +10642 0x11/imm32/alloc-id:fake +10643 _Primitive-add-to-eax/imm32/next +10644 # - add +10645 _Primitive-add-to-eax: # (payload primitive) +10646 0x11/imm32/alloc-id:fake:payload +10647 # var/eax <- add lit => 05/add-to-eax lit/imm32 10648 0x11/imm32/alloc-id:fake -10649 Single-int-var-in-eax/imm32/outputs +10649 _string-add/imm32/name 10650 0x11/imm32/alloc-id:fake -10651 _string_05_add_to_eax/imm32/subx-name -10652 0/imm32/no-rm32 -10653 0/imm32/no-r32 -10654 1/imm32/imm32-is-first-inout -10655 0/imm32/no-disp32 -10656 0/imm32/output-is-write-only -10657 0x11/imm32/alloc-id:fake -10658 _Primitive-add-reg-to-reg/imm32/next -10659 _Primitive-add-reg-to-reg: # (payload primitive) -10660 0x11/imm32/alloc-id:fake:payload -10661 # var1/reg <- add var2/reg => 01/add-to var1/rm32 var2/r32 -10662 0x11/imm32/alloc-id:fake -10663 _string-add/imm32/name -10664 0x11/imm32/alloc-id:fake -10665 Single-int-var-in-some-register/imm32/inouts +10651 Single-lit-var/imm32/inouts +10652 0x11/imm32/alloc-id:fake +10653 Single-int-var-in-eax/imm32/outputs +10654 0x11/imm32/alloc-id:fake +10655 _string_05_add_to_eax/imm32/subx-name +10656 0/imm32/no-rm32 +10657 0/imm32/no-r32 +10658 1/imm32/imm32-is-first-inout +10659 0/imm32/no-disp32 +10660 0/imm32/output-is-write-only +10661 0x11/imm32/alloc-id:fake +10662 _Primitive-add-reg-to-reg/imm32/next +10663 _Primitive-add-reg-to-reg: # (payload primitive) +10664 0x11/imm32/alloc-id:fake:payload +10665 # var1/reg <- add var2/reg => 01/add-to var1/rm32 var2/r32 10666 0x11/imm32/alloc-id:fake -10667 Single-int-var-in-some-register/imm32/outputs +10667 _string-add/imm32/name 10668 0x11/imm32/alloc-id:fake -10669 _string_01_add_to/imm32/subx-name -10670 3/imm32/rm32-is-first-output -10671 1/imm32/r32-is-first-inout -10672 0/imm32/no-imm32 -10673 0/imm32/no-disp32 -10674 0/imm32/output-is-write-only -10675 0x11/imm32/alloc-id:fake -10676 _Primitive-add-reg-to-mem/imm32/next -10677 _Primitive-add-reg-to-mem: # (payload primitive) -10678 0x11/imm32/alloc-id:fake:payload -10679 # add-to var1 var2/reg => 01/add-to var1 var2/r32 -10680 0x11/imm32/alloc-id:fake -10681 _string-add-to/imm32/name -10682 0x11/imm32/alloc-id:fake -10683 Two-args-int-stack-int-reg/imm32/inouts -10684 0/imm32/no-outputs -10685 0/imm32/no-outputs +10669 Single-int-var-in-some-register/imm32/inouts +10670 0x11/imm32/alloc-id:fake +10671 Single-int-var-in-some-register/imm32/outputs +10672 0x11/imm32/alloc-id:fake +10673 _string_01_add_to/imm32/subx-name +10674 3/imm32/rm32-is-first-output +10675 1/imm32/r32-is-first-inout +10676 0/imm32/no-imm32 +10677 0/imm32/no-disp32 +10678 0/imm32/output-is-write-only +10679 0x11/imm32/alloc-id:fake +10680 _Primitive-add-reg-to-mem/imm32/next +10681 _Primitive-add-reg-to-mem: # (payload primitive) +10682 0x11/imm32/alloc-id:fake:payload +10683 # add-to var1 var2/reg => 01/add-to var1 var2/r32 +10684 0x11/imm32/alloc-id:fake +10685 _string-add-to/imm32/name 10686 0x11/imm32/alloc-id:fake -10687 _string_01_add_to/imm32/subx-name -10688 1/imm32/rm32-is-first-inout -10689 2/imm32/r32-is-second-inout -10690 0/imm32/no-imm32 -10691 0/imm32/no-disp32 -10692 0/imm32/output-is-write-only -10693 0x11/imm32/alloc-id:fake -10694 _Primitive-add-mem-to-reg/imm32/next -10695 _Primitive-add-mem-to-reg: # (payload primitive) -10696 0x11/imm32/alloc-id:fake:payload -10697 # var1/reg <- add var2 => 03/add var2/rm32 var1/r32 -10698 0x11/imm32/alloc-id:fake -10699 _string-add/imm32/name -10700 0x11/imm32/alloc-id:fake -10701 Single-int-var-in-mem/imm32/inouts +10687 Two-args-int-stack-int-reg/imm32/inouts +10688 0/imm32/no-outputs +10689 0/imm32/no-outputs +10690 0x11/imm32/alloc-id:fake +10691 _string_01_add_to/imm32/subx-name +10692 1/imm32/rm32-is-first-inout +10693 2/imm32/r32-is-second-inout +10694 0/imm32/no-imm32 +10695 0/imm32/no-disp32 +10696 0/imm32/output-is-write-only +10697 0x11/imm32/alloc-id:fake +10698 _Primitive-add-mem-to-reg/imm32/next +10699 _Primitive-add-mem-to-reg: # (payload primitive) +10700 0x11/imm32/alloc-id:fake:payload +10701 # var1/reg <- add var2 => 03/add var2/rm32 var1/r32 10702 0x11/imm32/alloc-id:fake -10703 Single-int-var-in-some-register/imm32/outputs +10703 _string-add/imm32/name 10704 0x11/imm32/alloc-id:fake -10705 _string_03_add/imm32/subx-name -10706 1/imm32/rm32-is-first-inout -10707 3/imm32/r32-is-first-output -10708 0/imm32/no-imm32 -10709 0/imm32/no-disp32 -10710 0/imm32/output-is-write-only -10711 0x11/imm32/alloc-id:fake -10712 _Primitive-add-lit-to-reg/imm32/next -10713 _Primitive-add-lit-to-reg: # (payload primitive) -10714 0x11/imm32/alloc-id:fake:payload -10715 # var1/reg <- add lit => 81 0/subop/add var1/rm32 lit/imm32 -10716 0x11/imm32/alloc-id:fake -10717 _string-add/imm32/name -10718 0x11/imm32/alloc-id:fake -10719 Single-lit-var/imm32/inouts +10705 Single-int-var-in-mem/imm32/inouts +10706 0x11/imm32/alloc-id:fake +10707 Single-int-var-in-some-register/imm32/outputs +10708 0x11/imm32/alloc-id:fake +10709 _string_03_add/imm32/subx-name +10710 1/imm32/rm32-is-first-inout +10711 3/imm32/r32-is-first-output +10712 0/imm32/no-imm32 +10713 0/imm32/no-disp32 +10714 0/imm32/output-is-write-only +10715 0x11/imm32/alloc-id:fake +10716 _Primitive-add-lit-to-reg/imm32/next +10717 _Primitive-add-lit-to-reg: # (payload primitive) +10718 0x11/imm32/alloc-id:fake:payload +10719 # var1/reg <- add lit => 81 0/subop/add var1/rm32 lit/imm32 10720 0x11/imm32/alloc-id:fake -10721 Single-int-var-in-some-register/imm32/outputs +10721 _string-add/imm32/name 10722 0x11/imm32/alloc-id:fake -10723 _string_81_subop_add/imm32/subx-name -10724 3/imm32/rm32-is-first-output -10725 0/imm32/no-r32 -10726 1/imm32/imm32-is-first-inout -10727 0/imm32/no-disp32 -10728 0/imm32/output-is-write-only -10729 0x11/imm32/alloc-id:fake -10730 _Primitive-add-lit-to-mem/imm32/next -10731 _Primitive-add-lit-to-mem: # (payload primitive) -10732 0x11/imm32/alloc-id:fake:payload -10733 # add-to var1, lit => 81 0/subop/add var1/rm32 lit/imm32 -10734 0x11/imm32/alloc-id:fake -10735 _string-add-to/imm32/name -10736 0x11/imm32/alloc-id:fake -10737 Int-var-and-literal/imm32/inouts -10738 0/imm32/no-outputs -10739 0/imm32/no-outputs +10723 Single-lit-var/imm32/inouts +10724 0x11/imm32/alloc-id:fake +10725 Single-int-var-in-some-register/imm32/outputs +10726 0x11/imm32/alloc-id:fake +10727 _string_81_subop_add/imm32/subx-name +10728 3/imm32/rm32-is-first-output +10729 0/imm32/no-r32 +10730 1/imm32/imm32-is-first-inout +10731 0/imm32/no-disp32 +10732 0/imm32/output-is-write-only +10733 0x11/imm32/alloc-id:fake +10734 _Primitive-add-lit-to-mem/imm32/next +10735 _Primitive-add-lit-to-mem: # (payload primitive) +10736 0x11/imm32/alloc-id:fake:payload +10737 # add-to var1, lit => 81 0/subop/add var1/rm32 lit/imm32 +10738 0x11/imm32/alloc-id:fake +10739 _string-add-to/imm32/name 10740 0x11/imm32/alloc-id:fake -10741 _string_81_subop_add/imm32/subx-name -10742 1/imm32/rm32-is-first-inout -10743 0/imm32/no-r32 -10744 2/imm32/imm32-is-second-inout -10745 0/imm32/no-disp32 -10746 0/imm32/output-is-write-only -10747 0x11/imm32/alloc-id:fake -10748 _Primitive-subtract-from-eax/imm32/next -10749 # - subtract -10750 _Primitive-subtract-from-eax: # (payload primitive) -10751 0x11/imm32/alloc-id:fake:payload -10752 # var/eax <- subtract lit => 2d/subtract-from-eax lit/imm32 -10753 0x11/imm32/alloc-id:fake -10754 _string-subtract/imm32/name -10755 0x11/imm32/alloc-id:fake -10756 Single-lit-var/imm32/inouts +10741 Int-var-and-literal/imm32/inouts +10742 0/imm32/no-outputs +10743 0/imm32/no-outputs +10744 0x11/imm32/alloc-id:fake +10745 _string_81_subop_add/imm32/subx-name +10746 1/imm32/rm32-is-first-inout +10747 0/imm32/no-r32 +10748 2/imm32/imm32-is-second-inout +10749 0/imm32/no-disp32 +10750 0/imm32/output-is-write-only +10751 0x11/imm32/alloc-id:fake +10752 _Primitive-subtract-from-eax/imm32/next +10753 # - subtract +10754 _Primitive-subtract-from-eax: # (payload primitive) +10755 0x11/imm32/alloc-id:fake:payload +10756 # var/eax <- subtract lit => 2d/subtract-from-eax lit/imm32 10757 0x11/imm32/alloc-id:fake -10758 Single-int-var-in-eax/imm32/outputs +10758 _string-subtract/imm32/name 10759 0x11/imm32/alloc-id:fake -10760 _string_2d_subtract_from_eax/imm32/subx-name -10761 0/imm32/no-rm32 -10762 0/imm32/no-r32 -10763 1/imm32/imm32-is-first-inout -10764 0/imm32/no-disp32 -10765 0/imm32/output-is-write-only -10766 0x11/imm32/alloc-id:fake -10767 _Primitive-subtract-reg-from-reg/imm32/next -10768 _Primitive-subtract-reg-from-reg: # (payload primitive) -10769 0x11/imm32/alloc-id:fake:payload -10770 # var1/reg <- subtract var2/reg => 29/subtract-from var1/rm32 var2/r32 -10771 0x11/imm32/alloc-id:fake -10772 _string-subtract/imm32/name -10773 0x11/imm32/alloc-id:fake -10774 Single-int-var-in-some-register/imm32/inouts +10760 Single-lit-var/imm32/inouts +10761 0x11/imm32/alloc-id:fake +10762 Single-int-var-in-eax/imm32/outputs +10763 0x11/imm32/alloc-id:fake +10764 _string_2d_subtract_from_eax/imm32/subx-name +10765 0/imm32/no-rm32 +10766 0/imm32/no-r32 +10767 1/imm32/imm32-is-first-inout +10768 0/imm32/no-disp32 +10769 0/imm32/output-is-write-only +10770 0x11/imm32/alloc-id:fake +10771 _Primitive-subtract-reg-from-reg/imm32/next +10772 _Primitive-subtract-reg-from-reg: # (payload primitive) +10773 0x11/imm32/alloc-id:fake:payload +10774 # var1/reg <- subtract var2/reg => 29/subtract-from var1/rm32 var2/r32 10775 0x11/imm32/alloc-id:fake -10776 Single-int-var-in-some-register/imm32/outputs +10776 _string-subtract/imm32/name 10777 0x11/imm32/alloc-id:fake -10778 _string_29_subtract_from/imm32/subx-name -10779 3/imm32/rm32-is-first-output -10780 1/imm32/r32-is-first-inout -10781 0/imm32/no-imm32 -10782 0/imm32/no-disp32 -10783 0/imm32/output-is-write-only -10784 0x11/imm32/alloc-id:fake -10785 _Primitive-subtract-reg-from-mem/imm32/next -10786 _Primitive-subtract-reg-from-mem: # (payload primitive) -10787 0x11/imm32/alloc-id:fake:payload -10788 # subtract-from var1 var2/reg => 29/subtract-from var1 var2/r32 -10789 0x11/imm32/alloc-id:fake -10790 _string-subtract-from/imm32/name -10791 0x11/imm32/alloc-id:fake -10792 Two-args-int-stack-int-reg/imm32/inouts -10793 0/imm32/no-outputs -10794 0/imm32/no-outputs +10778 Single-int-var-in-some-register/imm32/inouts +10779 0x11/imm32/alloc-id:fake +10780 Single-int-var-in-some-register/imm32/outputs +10781 0x11/imm32/alloc-id:fake +10782 _string_29_subtract_from/imm32/subx-name +10783 3/imm32/rm32-is-first-output +10784 1/imm32/r32-is-first-inout +10785 0/imm32/no-imm32 +10786 0/imm32/no-disp32 +10787 0/imm32/output-is-write-only +10788 0x11/imm32/alloc-id:fake +10789 _Primitive-subtract-reg-from-mem/imm32/next +10790 _Primitive-subtract-reg-from-mem: # (payload primitive) +10791 0x11/imm32/alloc-id:fake:payload +10792 # subtract-from var1 var2/reg => 29/subtract-from var1 var2/r32 +10793 0x11/imm32/alloc-id:fake +10794 _string-subtract-from/imm32/name 10795 0x11/imm32/alloc-id:fake -10796 _string_29_subtract_from/imm32/subx-name -10797 1/imm32/rm32-is-first-inout -10798 2/imm32/r32-is-second-inout -10799 0/imm32/no-imm32 -10800 0/imm32/no-disp32 -10801 0/imm32/output-is-write-only -10802 0x11/imm32/alloc-id:fake -10803 _Primitive-subtract-mem-from-reg/imm32/next -10804 _Primitive-subtract-mem-from-reg: # (payload primitive) -10805 0x11/imm32/alloc-id:fake:payload -10806 # var1/reg <- subtract var2 => 2b/subtract var2/rm32 var1/r32 -10807 0x11/imm32/alloc-id:fake -10808 _string-subtract/imm32/name -10809 0x11/imm32/alloc-id:fake -10810 Single-int-var-in-mem/imm32/inouts +10796 Two-args-int-stack-int-reg/imm32/inouts +10797 0/imm32/no-outputs +10798 0/imm32/no-outputs +10799 0x11/imm32/alloc-id:fake +10800 _string_29_subtract_from/imm32/subx-name +10801 1/imm32/rm32-is-first-inout +10802 2/imm32/r32-is-second-inout +10803 0/imm32/no-imm32 +10804 0/imm32/no-disp32 +10805 0/imm32/output-is-write-only +10806 0x11/imm32/alloc-id:fake +10807 _Primitive-subtract-mem-from-reg/imm32/next +10808 _Primitive-subtract-mem-from-reg: # (payload primitive) +10809 0x11/imm32/alloc-id:fake:payload +10810 # var1/reg <- subtract var2 => 2b/subtract var2/rm32 var1/r32 10811 0x11/imm32/alloc-id:fake -10812 Single-int-var-in-some-register/imm32/outputs +10812 _string-subtract/imm32/name 10813 0x11/imm32/alloc-id:fake -10814 _string_2b_subtract/imm32/subx-name -10815 1/imm32/rm32-is-first-inout -10816 3/imm32/r32-is-first-output -10817 0/imm32/no-imm32 -10818 0/imm32/no-disp32 -10819 0/imm32/output-is-write-only -10820 0x11/imm32/alloc-id:fake -10821 _Primitive-subtract-lit-from-reg/imm32/next -10822 _Primitive-subtract-lit-from-reg: # (payload primitive) -10823 0x11/imm32/alloc-id:fake:payload -10824 # var1/reg <- subtract lit => 81 5/subop/subtract var1/rm32 lit/imm32 -10825 0x11/imm32/alloc-id:fake -10826 _string-subtract/imm32/name -10827 0x11/imm32/alloc-id:fake -10828 Single-lit-var/imm32/inouts +10814 Single-int-var-in-mem/imm32/inouts +10815 0x11/imm32/alloc-id:fake +10816 Single-int-var-in-some-register/imm32/outputs +10817 0x11/imm32/alloc-id:fake +10818 _string_2b_subtract/imm32/subx-name +10819 1/imm32/rm32-is-first-inout +10820 3/imm32/r32-is-first-output +10821 0/imm32/no-imm32 +10822 0/imm32/no-disp32 +10823 0/imm32/output-is-write-only +10824 0x11/imm32/alloc-id:fake +10825 _Primitive-subtract-lit-from-reg/imm32/next +10826 _Primitive-subtract-lit-from-reg: # (payload primitive) +10827 0x11/imm32/alloc-id:fake:payload +10828 # var1/reg <- subtract lit => 81 5/subop/subtract var1/rm32 lit/imm32 10829 0x11/imm32/alloc-id:fake -10830 Single-int-var-in-some-register/imm32/outputs +10830 _string-subtract/imm32/name 10831 0x11/imm32/alloc-id:fake -10832 _string_81_subop_subtract/imm32/subx-name -10833 3/imm32/rm32-is-first-output -10834 0/imm32/no-r32 -10835 1/imm32/imm32-is-first-inout -10836 0/imm32/no-disp32 -10837 0/imm32/output-is-write-only -10838 0x11/imm32/alloc-id:fake -10839 _Primitive-subtract-lit-from-mem/imm32/next -10840 _Primitive-subtract-lit-from-mem: # (payload primitive) -10841 0x11/imm32/alloc-id:fake:payload -10842 # subtract-from var1, lit => 81 5/subop/subtract var1/rm32 lit/imm32 -10843 0x11/imm32/alloc-id:fake -10844 _string-subtract-from/imm32/name -10845 0x11/imm32/alloc-id:fake -10846 Int-var-and-literal/imm32/inouts -10847 0/imm32/no-outputs -10848 0/imm32/no-outputs +10832 Single-lit-var/imm32/inouts +10833 0x11/imm32/alloc-id:fake +10834 Single-int-var-in-some-register/imm32/outputs +10835 0x11/imm32/alloc-id:fake +10836 _string_81_subop_subtract/imm32/subx-name +10837 3/imm32/rm32-is-first-output +10838 0/imm32/no-r32 +10839 1/imm32/imm32-is-first-inout +10840 0/imm32/no-disp32 +10841 0/imm32/output-is-write-only +10842 0x11/imm32/alloc-id:fake +10843 _Primitive-subtract-lit-from-mem/imm32/next +10844 _Primitive-subtract-lit-from-mem: # (payload primitive) +10845 0x11/imm32/alloc-id:fake:payload +10846 # subtract-from var1, lit => 81 5/subop/subtract var1/rm32 lit/imm32 +10847 0x11/imm32/alloc-id:fake +10848 _string-subtract-from/imm32/name 10849 0x11/imm32/alloc-id:fake -10850 _string_81_subop_subtract/imm32/subx-name -10851 1/imm32/rm32-is-first-inout -10852 0/imm32/no-r32 -10853 2/imm32/imm32-is-first-inout -10854 0/imm32/no-disp32 -10855 0/imm32/output-is-write-only -10856 0x11/imm32/alloc-id:fake -10857 _Primitive-and-with-eax/imm32/next -10858 # - and -10859 _Primitive-and-with-eax: # (payload primitive) -10860 0x11/imm32/alloc-id:fake:payload -10861 # var/eax <- and lit => 25/and-with-eax lit/imm32 -10862 0x11/imm32/alloc-id:fake -10863 _string-and/imm32/name -10864 0x11/imm32/alloc-id:fake -10865 Single-lit-var/imm32/inouts +10850 Int-var-and-literal/imm32/inouts +10851 0/imm32/no-outputs +10852 0/imm32/no-outputs +10853 0x11/imm32/alloc-id:fake +10854 _string_81_subop_subtract/imm32/subx-name +10855 1/imm32/rm32-is-first-inout +10856 0/imm32/no-r32 +10857 2/imm32/imm32-is-first-inout +10858 0/imm32/no-disp32 +10859 0/imm32/output-is-write-only +10860 0x11/imm32/alloc-id:fake +10861 _Primitive-and-with-eax/imm32/next +10862 # - and +10863 _Primitive-and-with-eax: # (payload primitive) +10864 0x11/imm32/alloc-id:fake:payload +10865 # var/eax <- and lit => 25/and-with-eax lit/imm32 10866 0x11/imm32/alloc-id:fake -10867 Single-int-var-in-eax/imm32/outputs +10867 _string-and/imm32/name 10868 0x11/imm32/alloc-id:fake -10869 _string_25_and_with_eax/imm32/subx-name -10870 0/imm32/no-rm32 -10871 0/imm32/no-r32 -10872 1/imm32/imm32-is-first-inout -10873 0/imm32/no-disp32 -10874 0/imm32/output-is-write-only -10875 0x11/imm32/alloc-id:fake -10876 _Primitive-and-reg-with-reg/imm32/next -10877 _Primitive-and-reg-with-reg: # (payload primitive) -10878 0x11/imm32/alloc-id:fake:payload -10879 # var1/reg <- and var2/reg => 21/and-with var1/rm32 var2/r32 -10880 0x11/imm32/alloc-id:fake -10881 _string-and/imm32/name -10882 0x11/imm32/alloc-id:fake -10883 Single-int-var-in-some-register/imm32/inouts +10869 Single-lit-var/imm32/inouts +10870 0x11/imm32/alloc-id:fake +10871 Single-int-var-in-eax/imm32/outputs +10872 0x11/imm32/alloc-id:fake +10873 _string_25_and_with_eax/imm32/subx-name +10874 0/imm32/no-rm32 +10875 0/imm32/no-r32 +10876 1/imm32/imm32-is-first-inout +10877 0/imm32/no-disp32 +10878 0/imm32/output-is-write-only +10879 0x11/imm32/alloc-id:fake +10880 _Primitive-and-reg-with-reg/imm32/next +10881 _Primitive-and-reg-with-reg: # (payload primitive) +10882 0x11/imm32/alloc-id:fake:payload +10883 # var1/reg <- and var2/reg => 21/and-with var1/rm32 var2/r32 10884 0x11/imm32/alloc-id:fake -10885 Single-int-var-in-some-register/imm32/outputs +10885 _string-and/imm32/name 10886 0x11/imm32/alloc-id:fake -10887 _string_21_and_with/imm32/subx-name -10888 3/imm32/rm32-is-first-output -10889 1/imm32/r32-is-first-inout -10890 0/imm32/no-imm32 -10891 0/imm32/no-disp32 -10892 0/imm32/output-is-write-only -10893 0x11/imm32/alloc-id:fake -10894 _Primitive-and-reg-with-mem/imm32/next -10895 _Primitive-and-reg-with-mem: # (payload primitive) -10896 0x11/imm32/alloc-id:fake:payload -10897 # and-with var1 var2/reg => 21/and-with var1 var2/r32 -10898 0x11/imm32/alloc-id:fake -10899 _string-and-with/imm32/name -10900 0x11/imm32/alloc-id:fake -10901 Two-args-int-stack-int-reg/imm32/inouts -10902 0/imm32/no-outputs -10903 0/imm32/no-outputs +10887 Single-int-var-in-some-register/imm32/inouts +10888 0x11/imm32/alloc-id:fake +10889 Single-int-var-in-some-register/imm32/outputs +10890 0x11/imm32/alloc-id:fake +10891 _string_21_and_with/imm32/subx-name +10892 3/imm32/rm32-is-first-output +10893 1/imm32/r32-is-first-inout +10894 0/imm32/no-imm32 +10895 0/imm32/no-disp32 +10896 0/imm32/output-is-write-only +10897 0x11/imm32/alloc-id:fake +10898 _Primitive-and-reg-with-mem/imm32/next +10899 _Primitive-and-reg-with-mem: # (payload primitive) +10900 0x11/imm32/alloc-id:fake:payload +10901 # and-with var1 var2/reg => 21/and-with var1 var2/r32 +10902 0x11/imm32/alloc-id:fake +10903 _string-and-with/imm32/name 10904 0x11/imm32/alloc-id:fake -10905 _string_21_and_with/imm32/subx-name -10906 1/imm32/rm32-is-first-inout -10907 2/imm32/r32-is-second-inout -10908 0/imm32/no-imm32 -10909 0/imm32/no-disp32 -10910 0/imm32/output-is-write-only -10911 0x11/imm32/alloc-id:fake -10912 _Primitive-and-mem-with-reg/imm32/next -10913 _Primitive-and-mem-with-reg: # (payload primitive) -10914 0x11/imm32/alloc-id:fake:payload -10915 # var1/reg <- and var2 => 23/and var2/rm32 var1/r32 -10916 0x11/imm32/alloc-id:fake -10917 _string-and/imm32/name -10918 0x11/imm32/alloc-id:fake -10919 Single-int-var-in-mem/imm32/inouts +10905 Two-args-int-stack-int-reg/imm32/inouts +10906 0/imm32/no-outputs +10907 0/imm32/no-outputs +10908 0x11/imm32/alloc-id:fake +10909 _string_21_and_with/imm32/subx-name +10910 1/imm32/rm32-is-first-inout +10911 2/imm32/r32-is-second-inout +10912 0/imm32/no-imm32 +10913 0/imm32/no-disp32 +10914 0/imm32/output-is-write-only +10915 0x11/imm32/alloc-id:fake +10916 _Primitive-and-mem-with-reg/imm32/next +10917 _Primitive-and-mem-with-reg: # (payload primitive) +10918 0x11/imm32/alloc-id:fake:payload +10919 # var1/reg <- and var2 => 23/and var2/rm32 var1/r32 10920 0x11/imm32/alloc-id:fake -10921 Single-int-var-in-some-register/imm32/outputs +10921 _string-and/imm32/name 10922 0x11/imm32/alloc-id:fake -10923 _string_23_and/imm32/subx-name -10924 1/imm32/rm32-is-first-inout -10925 3/imm32/r32-is-first-output -10926 0/imm32/no-imm32 -10927 0/imm32/no-disp32 -10928 0/imm32/output-is-write-only -10929 0x11/imm32/alloc-id:fake -10930 _Primitive-and-lit-with-reg/imm32/next -10931 _Primitive-and-lit-with-reg: # (payload primitive) -10932 0x11/imm32/alloc-id:fake:payload -10933 # var1/reg <- and lit => 81 4/subop/and var1/rm32 lit/imm32 -10934 0x11/imm32/alloc-id:fake -10935 _string-and/imm32/name -10936 0x11/imm32/alloc-id:fake -10937 Single-lit-var/imm32/inouts +10923 Single-int-var-in-mem/imm32/inouts +10924 0x11/imm32/alloc-id:fake +10925 Single-int-var-in-some-register/imm32/outputs +10926 0x11/imm32/alloc-id:fake +10927 _string_23_and/imm32/subx-name +10928 1/imm32/rm32-is-first-inout +10929 3/imm32/r32-is-first-output +10930 0/imm32/no-imm32 +10931 0/imm32/no-disp32 +10932 0/imm32/output-is-write-only +10933 0x11/imm32/alloc-id:fake +10934 _Primitive-and-lit-with-reg/imm32/next +10935 _Primitive-and-lit-with-reg: # (payload primitive) +10936 0x11/imm32/alloc-id:fake:payload +10937 # var1/reg <- and lit => 81 4/subop/and var1/rm32 lit/imm32 10938 0x11/imm32/alloc-id:fake -10939 Single-int-var-in-some-register/imm32/outputs +10939 _string-and/imm32/name 10940 0x11/imm32/alloc-id:fake -10941 _string_81_subop_and/imm32/subx-name -10942 3/imm32/rm32-is-first-output -10943 0/imm32/no-r32 -10944 1/imm32/imm32-is-first-inout -10945 0/imm32/no-disp32 -10946 0/imm32/output-is-write-only -10947 0x11/imm32/alloc-id:fake -10948 _Primitive-and-lit-with-mem/imm32/next -10949 _Primitive-and-lit-with-mem: # (payload primitive) -10950 0x11/imm32/alloc-id:fake:payload -10951 # and-with var1, lit => 81 4/subop/and var1/rm32 lit/imm32 -10952 0x11/imm32/alloc-id:fake -10953 _string-and-with/imm32/name -10954 0x11/imm32/alloc-id:fake -10955 Int-var-and-literal/imm32/inouts -10956 0/imm32/no-outputs -10957 0/imm32/no-outputs +10941 Single-lit-var/imm32/inouts +10942 0x11/imm32/alloc-id:fake +10943 Single-int-var-in-some-register/imm32/outputs +10944 0x11/imm32/alloc-id:fake +10945 _string_81_subop_and/imm32/subx-name +10946 3/imm32/rm32-is-first-output +10947 0/imm32/no-r32 +10948 1/imm32/imm32-is-first-inout +10949 0/imm32/no-disp32 +10950 0/imm32/output-is-write-only +10951 0x11/imm32/alloc-id:fake +10952 _Primitive-and-lit-with-mem/imm32/next +10953 _Primitive-and-lit-with-mem: # (payload primitive) +10954 0x11/imm32/alloc-id:fake:payload +10955 # and-with var1, lit => 81 4/subop/and var1/rm32 lit/imm32 +10956 0x11/imm32/alloc-id:fake +10957 _string-and-with/imm32/name 10958 0x11/imm32/alloc-id:fake -10959 _string_81_subop_and/imm32/subx-name -10960 1/imm32/rm32-is-first-inout -10961 0/imm32/no-r32 -10962 2/imm32/imm32-is-first-inout -10963 0/imm32/no-disp32 -10964 0/imm32/output-is-write-only -10965 0x11/imm32/alloc-id:fake -10966 _Primitive-or-with-eax/imm32/next -10967 # - or -10968 _Primitive-or-with-eax: # (payload primitive) -10969 0x11/imm32/alloc-id:fake:payload -10970 # var/eax <- or lit => 0d/or-with-eax lit/imm32 -10971 0x11/imm32/alloc-id:fake -10972 _string-or/imm32/name -10973 0x11/imm32/alloc-id:fake -10974 Single-lit-var/imm32/inouts +10959 Int-var-and-literal/imm32/inouts +10960 0/imm32/no-outputs +10961 0/imm32/no-outputs +10962 0x11/imm32/alloc-id:fake +10963 _string_81_subop_and/imm32/subx-name +10964 1/imm32/rm32-is-first-inout +10965 0/imm32/no-r32 +10966 2/imm32/imm32-is-first-inout +10967 0/imm32/no-disp32 +10968 0/imm32/output-is-write-only +10969 0x11/imm32/alloc-id:fake +10970 _Primitive-or-with-eax/imm32/next +10971 # - or +10972 _Primitive-or-with-eax: # (payload primitive) +10973 0x11/imm32/alloc-id:fake:payload +10974 # var/eax <- or lit => 0d/or-with-eax lit/imm32 10975 0x11/imm32/alloc-id:fake -10976 Single-int-var-in-eax/imm32/outputs +10976 _string-or/imm32/name 10977 0x11/imm32/alloc-id:fake -10978 _string_0d_or_with_eax/imm32/subx-name -10979 0/imm32/no-rm32 -10980 0/imm32/no-r32 -10981 1/imm32/imm32-is-first-inout -10982 0/imm32/no-disp32 -10983 0/imm32/output-is-write-only -10984 0x11/imm32/alloc-id:fake -10985 _Primitive-or-reg-with-reg/imm32/next -10986 _Primitive-or-reg-with-reg: # (payload primitive) -10987 0x11/imm32/alloc-id:fake:payload -10988 # var1/reg <- or var2/reg => 09/or-with var1/rm32 var2/r32 -10989 0x11/imm32/alloc-id:fake -10990 _string-or/imm32/name -10991 0x11/imm32/alloc-id:fake -10992 Single-int-var-in-some-register/imm32/inouts +10978 Single-lit-var/imm32/inouts +10979 0x11/imm32/alloc-id:fake +10980 Single-int-var-in-eax/imm32/outputs +10981 0x11/imm32/alloc-id:fake +10982 _string_0d_or_with_eax/imm32/subx-name +10983 0/imm32/no-rm32 +10984 0/imm32/no-r32 +10985 1/imm32/imm32-is-first-inout +10986 0/imm32/no-disp32 +10987 0/imm32/output-is-write-only +10988 0x11/imm32/alloc-id:fake +10989 _Primitive-or-reg-with-reg/imm32/next +10990 _Primitive-or-reg-with-reg: # (payload primitive) +10991 0x11/imm32/alloc-id:fake:payload +10992 # var1/reg <- or var2/reg => 09/or-with var1/rm32 var2/r32 10993 0x11/imm32/alloc-id:fake -10994 Single-int-var-in-some-register/imm32/outputs +10994 _string-or/imm32/name 10995 0x11/imm32/alloc-id:fake -10996 _string_09_or_with/imm32/subx-name -10997 3/imm32/rm32-is-first-output -10998 1/imm32/r32-is-first-inout -10999 0/imm32/no-imm32 -11000 0/imm32/no-disp32 -11001 0/imm32/output-is-write-only -11002 0x11/imm32/alloc-id:fake -11003 _Primitive-or-reg-with-mem/imm32/next -11004 _Primitive-or-reg-with-mem: # (payload primitive) -11005 0x11/imm32/alloc-id:fake:payload -11006 # or-with var1 var2/reg => 09/or-with var1 var2/r32 -11007 0x11/imm32/alloc-id:fake -11008 _string-or-with/imm32/name -11009 0x11/imm32/alloc-id:fake -11010 Two-args-int-stack-int-reg/imm32/inouts -11011 0/imm32/no-outputs -11012 0/imm32/no-outputs +10996 Single-int-var-in-some-register/imm32/inouts +10997 0x11/imm32/alloc-id:fake +10998 Single-int-var-in-some-register/imm32/outputs +10999 0x11/imm32/alloc-id:fake +11000 _string_09_or_with/imm32/subx-name +11001 3/imm32/rm32-is-first-output +11002 1/imm32/r32-is-first-inout +11003 0/imm32/no-imm32 +11004 0/imm32/no-disp32 +11005 0/imm32/output-is-write-only +11006 0x11/imm32/alloc-id:fake +11007 _Primitive-or-reg-with-mem/imm32/next +11008 _Primitive-or-reg-with-mem: # (payload primitive) +11009 0x11/imm32/alloc-id:fake:payload +11010 # or-with var1 var2/reg => 09/or-with var1 var2/r32 +11011 0x11/imm32/alloc-id:fake +11012 _string-or-with/imm32/name 11013 0x11/imm32/alloc-id:fake -11014 _string_09_or_with/imm32/subx-name -11015 1/imm32/rm32-is-first-inout -11016 2/imm32/r32-is-second-inout -11017 0/imm32/no-imm32 -11018 0/imm32/no-disp32 -11019 0/imm32/output-is-write-only -11020 0x11/imm32/alloc-id:fake -11021 _Primitive-or-mem-with-reg/imm32/next -11022 _Primitive-or-mem-with-reg: # (payload primitive) -11023 0x11/imm32/alloc-id:fake:payload -11024 # var1/reg <- or var2 => 0b/or var2/rm32 var1/r32 -11025 0x11/imm32/alloc-id:fake -11026 _string-or/imm32/name -11027 0x11/imm32/alloc-id:fake -11028 Single-int-var-in-mem/imm32/inouts +11014 Two-args-int-stack-int-reg/imm32/inouts +11015 0/imm32/no-outputs +11016 0/imm32/no-outputs +11017 0x11/imm32/alloc-id:fake +11018 _string_09_or_with/imm32/subx-name +11019 1/imm32/rm32-is-first-inout +11020 2/imm32/r32-is-second-inout +11021 0/imm32/no-imm32 +11022 0/imm32/no-disp32 +11023 0/imm32/output-is-write-only +11024 0x11/imm32/alloc-id:fake +11025 _Primitive-or-mem-with-reg/imm32/next +11026 _Primitive-or-mem-with-reg: # (payload primitive) +11027 0x11/imm32/alloc-id:fake:payload +11028 # var1/reg <- or var2 => 0b/or var2/rm32 var1/r32 11029 0x11/imm32/alloc-id:fake -11030 Single-int-var-in-some-register/imm32/outputs +11030 _string-or/imm32/name 11031 0x11/imm32/alloc-id:fake -11032 _string_0b_or/imm32/subx-name -11033 1/imm32/rm32-is-first-inout -11034 3/imm32/r32-is-first-output -11035 0/imm32/no-imm32 -11036 0/imm32/no-disp32 -11037 0/imm32/output-is-write-only -11038 0x11/imm32/alloc-id:fake -11039 _Primitive-or-lit-with-reg/imm32/next -11040 _Primitive-or-lit-with-reg: # (payload primitive) -11041 0x11/imm32/alloc-id:fake:payload -11042 # var1/reg <- or lit => 81 1/subop/or var1/rm32 lit/imm32 -11043 0x11/imm32/alloc-id:fake -11044 _string-or/imm32/name -11045 0x11/imm32/alloc-id:fake -11046 Single-lit-var/imm32/inouts +11032 Single-int-var-in-mem/imm32/inouts +11033 0x11/imm32/alloc-id:fake +11034 Single-int-var-in-some-register/imm32/outputs +11035 0x11/imm32/alloc-id:fake +11036 _string_0b_or/imm32/subx-name +11037 1/imm32/rm32-is-first-inout +11038 3/imm32/r32-is-first-output +11039 0/imm32/no-imm32 +11040 0/imm32/no-disp32 +11041 0/imm32/output-is-write-only +11042 0x11/imm32/alloc-id:fake +11043 _Primitive-or-lit-with-reg/imm32/next +11044 _Primitive-or-lit-with-reg: # (payload primitive) +11045 0x11/imm32/alloc-id:fake:payload +11046 # var1/reg <- or lit => 81 1/subop/or var1/rm32 lit/imm32 11047 0x11/imm32/alloc-id:fake -11048 Single-int-var-in-some-register/imm32/outputs +11048 _string-or/imm32/name 11049 0x11/imm32/alloc-id:fake -11050 _string_81_subop_or/imm32/subx-name -11051 3/imm32/rm32-is-first-output -11052 0/imm32/no-r32 -11053 1/imm32/imm32-is-first-inout -11054 0/imm32/no-disp32 -11055 0/imm32/output-is-write-only -11056 0x11/imm32/alloc-id:fake -11057 _Primitive-or-lit-with-mem/imm32/next -11058 _Primitive-or-lit-with-mem: # (payload primitive) -11059 0x11/imm32/alloc-id:fake:payload -11060 # or-with var1, lit => 81 1/subop/or var1/rm32 lit/imm32 -11061 0x11/imm32/alloc-id:fake -11062 _string-or-with/imm32/name -11063 0x11/imm32/alloc-id:fake -11064 Int-var-and-literal/imm32/inouts -11065 0/imm32/no-outputs -11066 0/imm32/no-outputs +11050 Single-lit-var/imm32/inouts +11051 0x11/imm32/alloc-id:fake +11052 Single-int-var-in-some-register/imm32/outputs +11053 0x11/imm32/alloc-id:fake +11054 _string_81_subop_or/imm32/subx-name +11055 3/imm32/rm32-is-first-output +11056 0/imm32/no-r32 +11057 1/imm32/imm32-is-first-inout +11058 0/imm32/no-disp32 +11059 0/imm32/output-is-write-only +11060 0x11/imm32/alloc-id:fake +11061 _Primitive-or-lit-with-mem/imm32/next +11062 _Primitive-or-lit-with-mem: # (payload primitive) +11063 0x11/imm32/alloc-id:fake:payload +11064 # or-with var1, lit => 81 1/subop/or var1/rm32 lit/imm32 +11065 0x11/imm32/alloc-id:fake +11066 _string-or-with/imm32/name 11067 0x11/imm32/alloc-id:fake -11068 _string_81_subop_or/imm32/subx-name -11069 1/imm32/rm32-is-first-inout -11070 0/imm32/no-r32 -11071 2/imm32/imm32-is-second-inout -11072 0/imm32/no-disp32 -11073 0/imm32/output-is-write-only -11074 0x11/imm32/alloc-id:fake -11075 _Primitive-xor-with-eax/imm32/next -11076 # - xor -11077 _Primitive-xor-with-eax: # (payload primitive) -11078 0x11/imm32/alloc-id:fake:payload -11079 # var/eax <- xor lit => 35/xor-with-eax lit/imm32 -11080 0x11/imm32/alloc-id:fake -11081 _string-xor/imm32/name -11082 0x11/imm32/alloc-id:fake -11083 Single-lit-var/imm32/inouts +11068 Int-var-and-literal/imm32/inouts +11069 0/imm32/no-outputs +11070 0/imm32/no-outputs +11071 0x11/imm32/alloc-id:fake +11072 _string_81_subop_or/imm32/subx-name +11073 1/imm32/rm32-is-first-inout +11074 0/imm32/no-r32 +11075 2/imm32/imm32-is-second-inout +11076 0/imm32/no-disp32 +11077 0/imm32/output-is-write-only +11078 0x11/imm32/alloc-id:fake +11079 _Primitive-xor-with-eax/imm32/next +11080 # - xor +11081 _Primitive-xor-with-eax: # (payload primitive) +11082 0x11/imm32/alloc-id:fake:payload +11083 # var/eax <- xor lit => 35/xor-with-eax lit/imm32 11084 0x11/imm32/alloc-id:fake -11085 Single-int-var-in-eax/imm32/outputs +11085 _string-xor/imm32/name 11086 0x11/imm32/alloc-id:fake -11087 _string_35_xor_with_eax/imm32/subx-name -11088 0/imm32/no-rm32 -11089 0/imm32/no-r32 -11090 1/imm32/imm32-is-first-inout -11091 0/imm32/no-disp32 -11092 0/imm32/output-is-write-only -11093 0x11/imm32/alloc-id:fake -11094 _Primitive-xor-reg-with-reg/imm32/next -11095 _Primitive-xor-reg-with-reg: # (payload primitive) -11096 0x11/imm32/alloc-id:fake:payload -11097 # var1/reg <- xor var2/reg => 31/xor-with var1/rm32 var2/r32 -11098 0x11/imm32/alloc-id:fake -11099 _string-xor/imm32/name -11100 0x11/imm32/alloc-id:fake -11101 Single-int-var-in-some-register/imm32/inouts +11087 Single-lit-var/imm32/inouts +11088 0x11/imm32/alloc-id:fake +11089 Single-int-var-in-eax/imm32/outputs +11090 0x11/imm32/alloc-id:fake +11091 _string_35_xor_with_eax/imm32/subx-name +11092 0/imm32/no-rm32 +11093 0/imm32/no-r32 +11094 1/imm32/imm32-is-first-inout +11095 0/imm32/no-disp32 +11096 0/imm32/output-is-write-only +11097 0x11/imm32/alloc-id:fake +11098 _Primitive-xor-reg-with-reg/imm32/next +11099 _Primitive-xor-reg-with-reg: # (payload primitive) +11100 0x11/imm32/alloc-id:fake:payload +11101 # var1/reg <- xor var2/reg => 31/xor-with var1/rm32 var2/r32 11102 0x11/imm32/alloc-id:fake -11103 Single-int-var-in-some-register/imm32/outputs +11103 _string-xor/imm32/name 11104 0x11/imm32/alloc-id:fake -11105 _string_31_xor_with/imm32/subx-name -11106 3/imm32/rm32-is-first-output -11107 1/imm32/r32-is-first-inout -11108 0/imm32/no-imm32 -11109 0/imm32/no-disp32 -11110 0/imm32/output-is-write-only -11111 0x11/imm32/alloc-id:fake -11112 _Primitive-xor-reg-with-mem/imm32/next -11113 _Primitive-xor-reg-with-mem: # (payload primitive) -11114 0x11/imm32/alloc-id:fake:payload -11115 # xor-with var1 var2/reg => 31/xor-with var1 var2/r32 -11116 0x11/imm32/alloc-id:fake -11117 _string-xor-with/imm32/name -11118 0x11/imm32/alloc-id:fake -11119 Two-args-int-stack-int-reg/imm32/inouts -11120 0/imm32/no-outputs -11121 0/imm32/no-outputs +11105 Single-int-var-in-some-register/imm32/inouts +11106 0x11/imm32/alloc-id:fake +11107 Single-int-var-in-some-register/imm32/outputs +11108 0x11/imm32/alloc-id:fake +11109 _string_31_xor_with/imm32/subx-name +11110 3/imm32/rm32-is-first-output +11111 1/imm32/r32-is-first-inout +11112 0/imm32/no-imm32 +11113 0/imm32/no-disp32 +11114 0/imm32/output-is-write-only +11115 0x11/imm32/alloc-id:fake +11116 _Primitive-xor-reg-with-mem/imm32/next +11117 _Primitive-xor-reg-with-mem: # (payload primitive) +11118 0x11/imm32/alloc-id:fake:payload +11119 # xor-with var1 var2/reg => 31/xor-with var1 var2/r32 +11120 0x11/imm32/alloc-id:fake +11121 _string-xor-with/imm32/name 11122 0x11/imm32/alloc-id:fake -11123 _string_31_xor_with/imm32/subx-name -11124 1/imm32/rm32-is-first-inout -11125 2/imm32/r32-is-second-inout -11126 0/imm32/no-imm32 -11127 0/imm32/no-disp32 -11128 0/imm32/output-is-write-only -11129 0x11/imm32/alloc-id:fake -11130 _Primitive-xor-mem-with-reg/imm32/next -11131 _Primitive-xor-mem-with-reg: # (payload primitive) -11132 0x11/imm32/alloc-id:fake:payload -11133 # var1/reg <- xor var2 => 33/xor var2/rm32 var1/r32 -11134 0x11/imm32/alloc-id:fake -11135 _string-xor/imm32/name -11136 0x11/imm32/alloc-id:fake -11137 Single-int-var-in-mem/imm32/inouts +11123 Two-args-int-stack-int-reg/imm32/inouts +11124 0/imm32/no-outputs +11125 0/imm32/no-outputs +11126 0x11/imm32/alloc-id:fake +11127 _string_31_xor_with/imm32/subx-name +11128 1/imm32/rm32-is-first-inout +11129 2/imm32/r32-is-second-inout +11130 0/imm32/no-imm32 +11131 0/imm32/no-disp32 +11132 0/imm32/output-is-write-only +11133 0x11/imm32/alloc-id:fake +11134 _Primitive-xor-mem-with-reg/imm32/next +11135 _Primitive-xor-mem-with-reg: # (payload primitive) +11136 0x11/imm32/alloc-id:fake:payload +11137 # var1/reg <- xor var2 => 33/xor var2/rm32 var1/r32 11138 0x11/imm32/alloc-id:fake -11139 Single-int-var-in-some-register/imm32/outputs +11139 _string-xor/imm32/name 11140 0x11/imm32/alloc-id:fake -11141 _string_33_xor/imm32/subx-name -11142 1/imm32/rm32-is-first-inout -11143 3/imm32/r32-is-first-output -11144 0/imm32/no-imm32 -11145 0/imm32/no-disp32 -11146 0/imm32/output-is-write-only -11147 0x11/imm32/alloc-id:fake -11148 _Primitive-xor-lit-with-reg/imm32/next -11149 _Primitive-xor-lit-with-reg: # (payload primitive) -11150 0x11/imm32/alloc-id:fake:payload -11151 # var1/reg <- xor lit => 81 6/subop/xor var1/rm32 lit/imm32 -11152 0x11/imm32/alloc-id:fake -11153 _string-xor/imm32/name -11154 0x11/imm32/alloc-id:fake -11155 Single-lit-var/imm32/inouts +11141 Single-int-var-in-mem/imm32/inouts +11142 0x11/imm32/alloc-id:fake +11143 Single-int-var-in-some-register/imm32/outputs +11144 0x11/imm32/alloc-id:fake +11145 _string_33_xor/imm32/subx-name +11146 1/imm32/rm32-is-first-inout +11147 3/imm32/r32-is-first-output +11148 0/imm32/no-imm32 +11149 0/imm32/no-disp32 +11150 0/imm32/output-is-write-only +11151 0x11/imm32/alloc-id:fake +11152 _Primitive-xor-lit-with-reg/imm32/next +11153 _Primitive-xor-lit-with-reg: # (payload primitive) +11154 0x11/imm32/alloc-id:fake:payload +11155 # var1/reg <- xor lit => 81 6/subop/xor var1/rm32 lit/imm32 11156 0x11/imm32/alloc-id:fake -11157 Single-int-var-in-some-register/imm32/outputs +11157 _string-xor/imm32/name 11158 0x11/imm32/alloc-id:fake -11159 _string_81_subop_xor/imm32/subx-name -11160 3/imm32/rm32-is-first-output -11161 0/imm32/no-r32 -11162 1/imm32/imm32-is-first-inout -11163 0/imm32/no-disp32 -11164 0/imm32/output-is-write-only -11165 0x11/imm32/alloc-id:fake -11166 _Primitive-xor-lit-with-mem/imm32/next -11167 _Primitive-xor-lit-with-mem: # (payload primitive) -11168 0x11/imm32/alloc-id:fake:payload -11169 # xor-with var1, lit => 81 6/subop/xor var1/rm32 lit/imm32 -11170 0x11/imm32/alloc-id:fake -11171 _string-xor-with/imm32/name -11172 0x11/imm32/alloc-id:fake -11173 Int-var-and-literal/imm32/inouts -11174 0/imm32/no-outputs -11175 0/imm32/no-outputs +11159 Single-lit-var/imm32/inouts +11160 0x11/imm32/alloc-id:fake +11161 Single-int-var-in-some-register/imm32/outputs +11162 0x11/imm32/alloc-id:fake +11163 _string_81_subop_xor/imm32/subx-name +11164 3/imm32/rm32-is-first-output +11165 0/imm32/no-r32 +11166 1/imm32/imm32-is-first-inout +11167 0/imm32/no-disp32 +11168 0/imm32/output-is-write-only +11169 0x11/imm32/alloc-id:fake +11170 _Primitive-xor-lit-with-mem/imm32/next +11171 _Primitive-xor-lit-with-mem: # (payload primitive) +11172 0x11/imm32/alloc-id:fake:payload +11173 # xor-with var1, lit => 81 6/subop/xor var1/rm32 lit/imm32 +11174 0x11/imm32/alloc-id:fake +11175 _string-xor-with/imm32/name 11176 0x11/imm32/alloc-id:fake -11177 _string_81_subop_xor/imm32/subx-name -11178 1/imm32/rm32-is-first-inout -11179 0/imm32/no-r32 -11180 2/imm32/imm32-is-first-inout -11181 0/imm32/no-disp32 -11182 0/imm32/output-is-write-only -11183 0x11/imm32/alloc-id:fake -11184 _Primitive-copy-to-eax/imm32/next -11185 # - copy -11186 _Primitive-copy-to-eax: # (payload primitive) -11187 0x11/imm32/alloc-id:fake:payload -11188 # var/eax <- copy lit => b8/copy-to-eax lit/imm32 -11189 0x11/imm32/alloc-id:fake -11190 _string-copy/imm32/name -11191 0x11/imm32/alloc-id:fake -11192 Single-lit-var/imm32/inouts +11177 Int-var-and-literal/imm32/inouts +11178 0/imm32/no-outputs +11179 0/imm32/no-outputs +11180 0x11/imm32/alloc-id:fake +11181 _string_81_subop_xor/imm32/subx-name +11182 1/imm32/rm32-is-first-inout +11183 0/imm32/no-r32 +11184 2/imm32/imm32-is-first-inout +11185 0/imm32/no-disp32 +11186 0/imm32/output-is-write-only +11187 0x11/imm32/alloc-id:fake +11188 _Primitive-copy-to-eax/imm32/next +11189 # - copy +11190 _Primitive-copy-to-eax: # (payload primitive) +11191 0x11/imm32/alloc-id:fake:payload +11192 # var/eax <- copy lit => b8/copy-to-eax lit/imm32 11193 0x11/imm32/alloc-id:fake -11194 Single-int-var-in-eax/imm32/outputs +11194 _string-copy/imm32/name 11195 0x11/imm32/alloc-id:fake -11196 _string_b8_copy_to_eax/imm32/subx-name -11197 0/imm32/no-rm32 -11198 0/imm32/no-r32 -11199 1/imm32/imm32-is-first-inout -11200 0/imm32/no-disp32 -11201 1/imm32/output-is-write-only -11202 0x11/imm32/alloc-id:fake -11203 _Primitive-copy-to-ecx/imm32/next -11204 _Primitive-copy-to-ecx: # (payload primitive) -11205 0x11/imm32/alloc-id:fake:payload -11206 # var/ecx <- copy lit => b9/copy-to-ecx lit/imm32 -11207 0x11/imm32/alloc-id:fake -11208 _string-copy/imm32/name -11209 0x11/imm32/alloc-id:fake -11210 Single-lit-var/imm32/inouts +11196 Single-lit-var/imm32/inouts +11197 0x11/imm32/alloc-id:fake +11198 Single-int-var-in-eax/imm32/outputs +11199 0x11/imm32/alloc-id:fake +11200 _string_b8_copy_to_eax/imm32/subx-name +11201 0/imm32/no-rm32 +11202 0/imm32/no-r32 +11203 1/imm32/imm32-is-first-inout +11204 0/imm32/no-disp32 +11205 1/imm32/output-is-write-only +11206 0x11/imm32/alloc-id:fake +11207 _Primitive-copy-to-ecx/imm32/next +11208 _Primitive-copy-to-ecx: # (payload primitive) +11209 0x11/imm32/alloc-id:fake:payload +11210 # var/ecx <- copy lit => b9/copy-to-ecx lit/imm32 11211 0x11/imm32/alloc-id:fake -11212 Single-int-var-in-ecx/imm32/outputs +11212 _string-copy/imm32/name 11213 0x11/imm32/alloc-id:fake -11214 _string_b9_copy_to_ecx/imm32/subx-name -11215 0/imm32/no-rm32 -11216 0/imm32/no-r32 -11217 1/imm32/imm32-is-first-inout -11218 0/imm32/no-disp32 -11219 1/imm32/output-is-write-only -11220 0x11/imm32/alloc-id:fake -11221 _Primitive-copy-to-edx/imm32/next -11222 _Primitive-copy-to-edx: # (payload primitive) -11223 0x11/imm32/alloc-id:fake:payload -11224 # var/edx <- copy lit => ba/copy-to-edx lit/imm32 -11225 0x11/imm32/alloc-id:fake -11226 _string-copy/imm32/name -11227 0x11/imm32/alloc-id:fake -11228 Single-lit-var/imm32/inouts +11214 Single-lit-var/imm32/inouts +11215 0x11/imm32/alloc-id:fake +11216 Single-int-var-in-ecx/imm32/outputs +11217 0x11/imm32/alloc-id:fake +11218 _string_b9_copy_to_ecx/imm32/subx-name +11219 0/imm32/no-rm32 +11220 0/imm32/no-r32 +11221 1/imm32/imm32-is-first-inout +11222 0/imm32/no-disp32 +11223 1/imm32/output-is-write-only +11224 0x11/imm32/alloc-id:fake +11225 _Primitive-copy-to-edx/imm32/next +11226 _Primitive-copy-to-edx: # (payload primitive) +11227 0x11/imm32/alloc-id:fake:payload +11228 # var/edx <- copy lit => ba/copy-to-edx lit/imm32 11229 0x11/imm32/alloc-id:fake -11230 Single-int-var-in-edx/imm32/outputs +11230 _string-copy/imm32/name 11231 0x11/imm32/alloc-id:fake -11232 _string_ba_copy_to_edx/imm32/subx-name -11233 0/imm32/no-rm32 -11234 0/imm32/no-r32 -11235 1/imm32/imm32-is-first-inout -11236 0/imm32/no-disp32 -11237 1/imm32/output-is-write-only -11238 0x11/imm32/alloc-id:fake -11239 _Primitive-copy-to-ebx/imm32/next -11240 _Primitive-copy-to-ebx: # (payload primitive) -11241 0x11/imm32/alloc-id:fake:payload -11242 # var/ebx <- copy lit => bb/copy-to-ebx lit/imm32 -11243 0x11/imm32/alloc-id:fake -11244 _string-copy/imm32/name -11245 0x11/imm32/alloc-id:fake -11246 Single-lit-var/imm32/inouts +11232 Single-lit-var/imm32/inouts +11233 0x11/imm32/alloc-id:fake +11234 Single-int-var-in-edx/imm32/outputs +11235 0x11/imm32/alloc-id:fake +11236 _string_ba_copy_to_edx/imm32/subx-name +11237 0/imm32/no-rm32 +11238 0/imm32/no-r32 +11239 1/imm32/imm32-is-first-inout +11240 0/imm32/no-disp32 +11241 1/imm32/output-is-write-only +11242 0x11/imm32/alloc-id:fake +11243 _Primitive-copy-to-ebx/imm32/next +11244 _Primitive-copy-to-ebx: # (payload primitive) +11245 0x11/imm32/alloc-id:fake:payload +11246 # var/ebx <- copy lit => bb/copy-to-ebx lit/imm32 11247 0x11/imm32/alloc-id:fake -11248 Single-int-var-in-ebx/imm32/outputs +11248 _string-copy/imm32/name 11249 0x11/imm32/alloc-id:fake -11250 _string_bb_copy_to_ebx/imm32/subx-name -11251 0/imm32/no-rm32 -11252 0/imm32/no-r32 -11253 1/imm32/imm32-is-first-inout -11254 0/imm32/no-disp32 -11255 1/imm32/output-is-write-only -11256 0x11/imm32/alloc-id:fake -11257 _Primitive-copy-to-esi/imm32/next -11258 _Primitive-copy-to-esi: # (payload primitive) -11259 0x11/imm32/alloc-id:fake:payload -11260 # var/esi <- copy lit => be/copy-to-esi lit/imm32 -11261 0x11/imm32/alloc-id:fake -11262 _string-copy/imm32/name -11263 0x11/imm32/alloc-id:fake -11264 Single-lit-var/imm32/inouts +11250 Single-lit-var/imm32/inouts +11251 0x11/imm32/alloc-id:fake +11252 Single-int-var-in-ebx/imm32/outputs +11253 0x11/imm32/alloc-id:fake +11254 _string_bb_copy_to_ebx/imm32/subx-name +11255 0/imm32/no-rm32 +11256 0/imm32/no-r32 +11257 1/imm32/imm32-is-first-inout +11258 0/imm32/no-disp32 +11259 1/imm32/output-is-write-only +11260 0x11/imm32/alloc-id:fake +11261 _Primitive-copy-to-esi/imm32/next +11262 _Primitive-copy-to-esi: # (payload primitive) +11263 0x11/imm32/alloc-id:fake:payload +11264 # var/esi <- copy lit => be/copy-to-esi lit/imm32 11265 0x11/imm32/alloc-id:fake -11266 Single-int-var-in-esi/imm32/outputs +11266 _string-copy/imm32/name 11267 0x11/imm32/alloc-id:fake -11268 _string_be_copy_to_esi/imm32/subx-name -11269 0/imm32/no-rm32 -11270 0/imm32/no-r32 -11271 1/imm32/imm32-is-first-inout -11272 0/imm32/no-disp32 -11273 1/imm32/output-is-write-only -11274 0x11/imm32/alloc-id:fake -11275 _Primitive-copy-to-edi/imm32/next -11276 _Primitive-copy-to-edi: # (payload primitive) -11277 0x11/imm32/alloc-id:fake:payload -11278 # var/edi <- copy lit => bf/copy-to-edi lit/imm32 -11279 0x11/imm32/alloc-id:fake -11280 _string-copy/imm32/name -11281 0x11/imm32/alloc-id:fake -11282 Single-lit-var/imm32/inouts +11268 Single-lit-var/imm32/inouts +11269 0x11/imm32/alloc-id:fake +11270 Single-int-var-in-esi/imm32/outputs +11271 0x11/imm32/alloc-id:fake +11272 _string_be_copy_to_esi/imm32/subx-name +11273 0/imm32/no-rm32 +11274 0/imm32/no-r32 +11275 1/imm32/imm32-is-first-inout +11276 0/imm32/no-disp32 +11277 1/imm32/output-is-write-only +11278 0x11/imm32/alloc-id:fake +11279 _Primitive-copy-to-edi/imm32/next +11280 _Primitive-copy-to-edi: # (payload primitive) +11281 0x11/imm32/alloc-id:fake:payload +11282 # var/edi <- copy lit => bf/copy-to-edi lit/imm32 11283 0x11/imm32/alloc-id:fake -11284 Single-int-var-in-edi/imm32/outputs +11284 _string-copy/imm32/name 11285 0x11/imm32/alloc-id:fake -11286 _string_bf_copy_to_edi/imm32/subx-name -11287 0/imm32/no-rm32 -11288 0/imm32/no-r32 -11289 1/imm32/imm32-is-first-inout -11290 0/imm32/no-disp32 -11291 1/imm32/output-is-write-only -11292 0x11/imm32/alloc-id:fake -11293 _Primitive-copy-reg-to-reg/imm32/next -11294 _Primitive-copy-reg-to-reg: # (payload primitive) -11295 0x11/imm32/alloc-id:fake:payload -11296 # var1/reg <- copy var2/reg => 89/<- var1/rm32 var2/r32 -11297 0x11/imm32/alloc-id:fake -11298 _string-copy/imm32/name -11299 0x11/imm32/alloc-id:fake -11300 Single-int-var-in-some-register/imm32/inouts +11286 Single-lit-var/imm32/inouts +11287 0x11/imm32/alloc-id:fake +11288 Single-int-var-in-edi/imm32/outputs +11289 0x11/imm32/alloc-id:fake +11290 _string_bf_copy_to_edi/imm32/subx-name +11291 0/imm32/no-rm32 +11292 0/imm32/no-r32 +11293 1/imm32/imm32-is-first-inout +11294 0/imm32/no-disp32 +11295 1/imm32/output-is-write-only +11296 0x11/imm32/alloc-id:fake +11297 _Primitive-copy-reg-to-reg/imm32/next +11298 _Primitive-copy-reg-to-reg: # (payload primitive) +11299 0x11/imm32/alloc-id:fake:payload +11300 # var1/reg <- copy var2/reg => 89/<- var1/rm32 var2/r32 11301 0x11/imm32/alloc-id:fake -11302 Single-int-var-in-some-register/imm32/outputs +11302 _string-copy/imm32/name 11303 0x11/imm32/alloc-id:fake -11304 _string_89_<-/imm32/subx-name -11305 3/imm32/rm32-is-first-output -11306 1/imm32/r32-is-first-inout -11307 0/imm32/no-imm32 -11308 0/imm32/no-disp32 -11309 1/imm32/output-is-write-only -11310 0x11/imm32/alloc-id:fake -11311 _Primitive-copy-reg-to-mem/imm32/next -11312 _Primitive-copy-reg-to-mem: # (payload primitive) -11313 0x11/imm32/alloc-id:fake:payload -11314 # copy-to var1 var2/reg => 89/<- var1 var2/r32 -11315 0x11/imm32/alloc-id:fake -11316 _string-copy-to/imm32/name -11317 0x11/imm32/alloc-id:fake -11318 Two-args-int-stack-int-reg/imm32/inouts -11319 0/imm32/no-outputs -11320 0/imm32/no-outputs +11304 Single-int-var-in-some-register/imm32/inouts +11305 0x11/imm32/alloc-id:fake +11306 Single-int-var-in-some-register/imm32/outputs +11307 0x11/imm32/alloc-id:fake +11308 _string_89_<-/imm32/subx-name +11309 3/imm32/rm32-is-first-output +11310 1/imm32/r32-is-first-inout +11311 0/imm32/no-imm32 +11312 0/imm32/no-disp32 +11313 1/imm32/output-is-write-only +11314 0x11/imm32/alloc-id:fake +11315 _Primitive-copy-reg-to-mem/imm32/next +11316 _Primitive-copy-reg-to-mem: # (payload primitive) +11317 0x11/imm32/alloc-id:fake:payload +11318 # copy-to var1 var2/reg => 89/<- var1 var2/r32 +11319 0x11/imm32/alloc-id:fake +11320 _string-copy-to/imm32/name 11321 0x11/imm32/alloc-id:fake -11322 _string_89_<-/imm32/subx-name -11323 1/imm32/rm32-is-first-inout -11324 2/imm32/r32-is-second-inout -11325 0/imm32/no-imm32 -11326 0/imm32/no-disp32 -11327 1/imm32/output-is-write-only -11328 0x11/imm32/alloc-id:fake -11329 _Primitive-copy-mem-to-reg/imm32/next -11330 _Primitive-copy-mem-to-reg: # (payload primitive) -11331 0x11/imm32/alloc-id:fake:payload -11332 # var1/reg <- copy var2 => 8b/-> var2/rm32 var1/r32 -11333 0x11/imm32/alloc-id:fake -11334 _string-copy/imm32/name -11335 0x11/imm32/alloc-id:fake -11336 Single-int-var-in-mem/imm32/inouts +11322 Two-args-int-stack-int-reg/imm32/inouts +11323 0/imm32/no-outputs +11324 0/imm32/no-outputs +11325 0x11/imm32/alloc-id:fake +11326 _string_89_<-/imm32/subx-name +11327 1/imm32/rm32-is-first-inout +11328 2/imm32/r32-is-second-inout +11329 0/imm32/no-imm32 +11330 0/imm32/no-disp32 +11331 1/imm32/output-is-write-only +11332 0x11/imm32/alloc-id:fake +11333 _Primitive-copy-mem-to-reg/imm32/next +11334 _Primitive-copy-mem-to-reg: # (payload primitive) +11335 0x11/imm32/alloc-id:fake:payload +11336 # var1/reg <- copy var2 => 8b/-> var2/rm32 var1/r32 11337 0x11/imm32/alloc-id:fake -11338 Single-int-var-in-some-register/imm32/outputs +11338 _string-copy/imm32/name 11339 0x11/imm32/alloc-id:fake -11340 _string_8b_->/imm32/subx-name -11341 1/imm32/rm32-is-first-inout -11342 3/imm32/r32-is-first-output -11343 0/imm32/no-imm32 -11344 0/imm32/no-disp32 -11345 1/imm32/output-is-write-only -11346 0x11/imm32/alloc-id:fake -11347 _Primitive-copy-lit-to-reg/imm32/next -11348 _Primitive-copy-lit-to-reg: # (payload primitive) -11349 0x11/imm32/alloc-id:fake:payload -11350 # var1/reg <- copy lit => c7 0/subop/copy var1/rm32 lit/imm32 -11351 0x11/imm32/alloc-id:fake -11352 _string-copy/imm32/name -11353 0x11/imm32/alloc-id:fake -11354 Single-lit-var/imm32/inouts +11340 Single-int-var-in-mem/imm32/inouts +11341 0x11/imm32/alloc-id:fake +11342 Single-int-var-in-some-register/imm32/outputs +11343 0x11/imm32/alloc-id:fake +11344 _string_8b_->/imm32/subx-name +11345 1/imm32/rm32-is-first-inout +11346 3/imm32/r32-is-first-output +11347 0/imm32/no-imm32 +11348 0/imm32/no-disp32 +11349 1/imm32/output-is-write-only +11350 0x11/imm32/alloc-id:fake +11351 _Primitive-copy-lit-to-reg/imm32/next +11352 _Primitive-copy-lit-to-reg: # (payload primitive) +11353 0x11/imm32/alloc-id:fake:payload +11354 # var1/reg <- copy lit => c7 0/subop/copy var1/rm32 lit/imm32 11355 0x11/imm32/alloc-id:fake -11356 Single-int-var-in-some-register/imm32/outputs +11356 _string-copy/imm32/name 11357 0x11/imm32/alloc-id:fake -11358 _string_c7_subop_copy/imm32/subx-name -11359 3/imm32/rm32-is-first-output -11360 0/imm32/no-r32 -11361 1/imm32/imm32-is-first-inout -11362 0/imm32/no-disp32 -11363 1/imm32/output-is-write-only -11364 0x11/imm32/alloc-id:fake -11365 _Primitive-copy-lit-to-mem/imm32/next -11366 _Primitive-copy-lit-to-mem: # (payload primitive) -11367 0x11/imm32/alloc-id:fake:payload -11368 # copy-to var1, lit => c7 0/subop/copy var1/rm32 lit/imm32 -11369 0x11/imm32/alloc-id:fake -11370 _string-copy-to/imm32/name -11371 0x11/imm32/alloc-id:fake -11372 Int-var-and-literal/imm32/inouts -11373 0/imm32/no-outputs -11374 0/imm32/no-outputs +11358 Single-lit-var/imm32/inouts +11359 0x11/imm32/alloc-id:fake +11360 Single-int-var-in-some-register/imm32/outputs +11361 0x11/imm32/alloc-id:fake +11362 _string_c7_subop_copy/imm32/subx-name +11363 3/imm32/rm32-is-first-output +11364 0/imm32/no-r32 +11365 1/imm32/imm32-is-first-inout +11366 0/imm32/no-disp32 +11367 1/imm32/output-is-write-only +11368 0x11/imm32/alloc-id:fake +11369 _Primitive-copy-lit-to-mem/imm32/next +11370 _Primitive-copy-lit-to-mem: # (payload primitive) +11371 0x11/imm32/alloc-id:fake:payload +11372 # copy-to var1, lit => c7 0/subop/copy var1/rm32 lit/imm32 +11373 0x11/imm32/alloc-id:fake +11374 _string-copy-to/imm32/name 11375 0x11/imm32/alloc-id:fake -11376 _string_c7_subop_copy/imm32/subx-name -11377 1/imm32/rm32-is-first-inout -11378 0/imm32/no-r32 -11379 2/imm32/imm32-is-first-inout -11380 0/imm32/no-disp32 -11381 1/imm32/output-is-write-only -11382 0x11/imm32/alloc-id:fake -11383 _Primitive-address/imm32/next -11384 # - address -11385 _Primitive-address: # (payload primitive) -11386 0x11/imm32/alloc-id:fake:payload -11387 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 -11388 0x11/imm32/alloc-id:fake -11389 _string-address/imm32/name -11390 0x11/imm32/alloc-id:fake -11391 Single-int-var-in-mem/imm32/inouts +11376 Int-var-and-literal/imm32/inouts +11377 0/imm32/no-outputs +11378 0/imm32/no-outputs +11379 0x11/imm32/alloc-id:fake +11380 _string_c7_subop_copy/imm32/subx-name +11381 1/imm32/rm32-is-first-inout +11382 0/imm32/no-r32 +11383 2/imm32/imm32-is-first-inout +11384 0/imm32/no-disp32 +11385 1/imm32/output-is-write-only +11386 0x11/imm32/alloc-id:fake +11387 _Primitive-address/imm32/next +11388 # - address +11389 _Primitive-address: # (payload primitive) +11390 0x11/imm32/alloc-id:fake:payload +11391 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 11392 0x11/imm32/alloc-id:fake -11393 Single-addr-var-in-some-register/imm32/outputs +11393 _string-address/imm32/name 11394 0x11/imm32/alloc-id:fake -11395 _string_8d_copy_address/imm32/subx-name -11396 1/imm32/rm32-is-first-inout -11397 3/imm32/r32-is-first-output -11398 0/imm32/no-imm32 -11399 0/imm32/no-disp32 -11400 1/imm32/output-is-write-only -11401 0x11/imm32/alloc-id:fake -11402 _Primitive-compare-mem-with-reg/imm32/next -11403 # - compare -11404 _Primitive-compare-mem-with-reg: # (payload primitive) -11405 0x11/imm32/alloc-id:fake:payload -11406 # compare var1 var2/reg => 39/compare var1/rm32 var2/r32 -11407 0x11/imm32/alloc-id:fake -11408 _string-compare/imm32/name -11409 0x11/imm32/alloc-id:fake -11410 Two-args-int-stack-int-reg/imm32/inouts -11411 0/imm32/no-outputs -11412 0/imm32/no-outputs +11395 Single-int-var-in-mem/imm32/inouts +11396 0x11/imm32/alloc-id:fake +11397 Single-addr-var-in-some-register/imm32/outputs +11398 0x11/imm32/alloc-id:fake +11399 _string_8d_copy_address/imm32/subx-name +11400 1/imm32/rm32-is-first-inout +11401 3/imm32/r32-is-first-output +11402 0/imm32/no-imm32 +11403 0/imm32/no-disp32 +11404 1/imm32/output-is-write-only +11405 0x11/imm32/alloc-id:fake +11406 _Primitive-compare-mem-with-reg/imm32/next +11407 # - compare +11408 _Primitive-compare-mem-with-reg: # (payload primitive) +11409 0x11/imm32/alloc-id:fake:payload +11410 # compare var1 var2/reg => 39/compare var1/rm32 var2/r32 +11411 0x11/imm32/alloc-id:fake +11412 _string-compare/imm32/name 11413 0x11/imm32/alloc-id:fake -11414 _string_39_compare->/imm32/subx-name -11415 1/imm32/rm32-is-first-inout -11416 2/imm32/r32-is-second-inout -11417 0/imm32/no-imm32 -11418 0/imm32/no-disp32 -11419 0/imm32/output-is-write-only -11420 0x11/imm32/alloc-id:fake -11421 _Primitive-compare-reg-with-mem/imm32/next -11422 _Primitive-compare-reg-with-mem: # (payload primitive) -11423 0x11/imm32/alloc-id:fake:payload -11424 # compare var1/reg var2 => 3b/compare<- var2/rm32 var1/r32 -11425 0x11/imm32/alloc-id:fake -11426 _string-compare/imm32/name -11427 0x11/imm32/alloc-id:fake -11428 Two-args-int-reg-int-stack/imm32/inouts -11429 0/imm32/no-outputs -11430 0/imm32/no-outputs +11414 Two-args-int-stack-int-reg/imm32/inouts +11415 0/imm32/no-outputs +11416 0/imm32/no-outputs +11417 0x11/imm32/alloc-id:fake +11418 _string_39_compare->/imm32/subx-name +11419 1/imm32/rm32-is-first-inout +11420 2/imm32/r32-is-second-inout +11421 0/imm32/no-imm32 +11422 0/imm32/no-disp32 +11423 0/imm32/output-is-write-only +11424 0x11/imm32/alloc-id:fake +11425 _Primitive-compare-reg-with-mem/imm32/next +11426 _Primitive-compare-reg-with-mem: # (payload primitive) +11427 0x11/imm32/alloc-id:fake:payload +11428 # compare var1/reg var2 => 3b/compare<- var2/rm32 var1/r32 +11429 0x11/imm32/alloc-id:fake +11430 _string-compare/imm32/name 11431 0x11/imm32/alloc-id:fake -11432 _string_3b_compare<-/imm32/subx-name -11433 2/imm32/rm32-is-second-inout -11434 1/imm32/r32-is-first-inout -11435 0/imm32/no-imm32 -11436 0/imm32/no-disp32 -11437 0/imm32/output-is-write-only -11438 0x11/imm32/alloc-id:fake -11439 _Primitive-compare-eax-with-literal/imm32/next -11440 _Primitive-compare-eax-with-literal: # (payload primitive) -11441 0x11/imm32/alloc-id:fake:payload -11442 # compare var1/eax n => 3d/compare-eax-with n/imm32 -11443 0x11/imm32/alloc-id:fake -11444 _string-compare/imm32/name -11445 0x11/imm32/alloc-id:fake -11446 Two-args-int-eax-int-literal/imm32/inouts -11447 0/imm32/no-outputs -11448 0/imm32/no-outputs +11432 Two-args-int-reg-int-stack/imm32/inouts +11433 0/imm32/no-outputs +11434 0/imm32/no-outputs +11435 0x11/imm32/alloc-id:fake +11436 _string_3b_compare<-/imm32/subx-name +11437 2/imm32/rm32-is-second-inout +11438 1/imm32/r32-is-first-inout +11439 0/imm32/no-imm32 +11440 0/imm32/no-disp32 +11441 0/imm32/output-is-write-only +11442 0x11/imm32/alloc-id:fake +11443 _Primitive-compare-eax-with-literal/imm32/next +11444 _Primitive-compare-eax-with-literal: # (payload primitive) +11445 0x11/imm32/alloc-id:fake:payload +11446 # compare var1/eax n => 3d/compare-eax-with n/imm32 +11447 0x11/imm32/alloc-id:fake +11448 _string-compare/imm32/name 11449 0x11/imm32/alloc-id:fake -11450 _string_3d_compare_eax_with/imm32/subx-name -11451 0/imm32/no-rm32 -11452 0/imm32/no-r32 -11453 2/imm32/imm32-is-second-inout -11454 0/imm32/no-disp32 -11455 0/imm32/output-is-write-only -11456 0x11/imm32/alloc-id:fake -11457 _Primitive-compare-reg-with-literal/imm32/next -11458 _Primitive-compare-reg-with-literal: # (payload primitive) -11459 0x11/imm32/alloc-id:fake:payload -11460 # compare var1/reg n => 81 7/subop/compare %reg n/imm32 -11461 0x11/imm32/alloc-id:fake -11462 _string-compare/imm32/name -11463 0x11/imm32/alloc-id:fake -11464 Int-var-in-register-and-literal/imm32/inouts -11465 0/imm32/no-outputs -11466 0/imm32/no-outputs +11450 Two-args-int-eax-int-literal/imm32/inouts +11451 0/imm32/no-outputs +11452 0/imm32/no-outputs +11453 0x11/imm32/alloc-id:fake +11454 _string_3d_compare_eax_with/imm32/subx-name +11455 0/imm32/no-rm32 +11456 0/imm32/no-r32 +11457 2/imm32/imm32-is-second-inout +11458 0/imm32/no-disp32 +11459 0/imm32/output-is-write-only +11460 0x11/imm32/alloc-id:fake +11461 _Primitive-compare-reg-with-literal/imm32/next +11462 _Primitive-compare-reg-with-literal: # (payload primitive) +11463 0x11/imm32/alloc-id:fake:payload +11464 # compare var1/reg n => 81 7/subop/compare %reg n/imm32 +11465 0x11/imm32/alloc-id:fake +11466 _string-compare/imm32/name 11467 0x11/imm32/alloc-id:fake -11468 _string_81_subop_compare/imm32/subx-name -11469 1/imm32/rm32-is-first-inout -11470 0/imm32/no-r32 -11471 2/imm32/imm32-is-second-inout -11472 0/imm32/no-disp32 -11473 0/imm32/output-is-write-only -11474 0x11/imm32/alloc-id:fake -11475 _Primitive-compare-mem-with-literal/imm32/next -11476 _Primitive-compare-mem-with-literal: # (payload primitive) -11477 0x11/imm32/alloc-id:fake:payload -11478 # compare var1 n => 81 7/subop/compare *(ebp+___) n/imm32 -11479 0x11/imm32/alloc-id:fake -11480 _string-compare/imm32/name -11481 0x11/imm32/alloc-id:fake -11482 Int-var-and-literal/imm32/inouts -11483 0/imm32/no-outputs -11484 0/imm32/no-outputs +11468 Int-var-in-register-and-literal/imm32/inouts +11469 0/imm32/no-outputs +11470 0/imm32/no-outputs +11471 0x11/imm32/alloc-id:fake +11472 _string_81_subop_compare/imm32/subx-name +11473 1/imm32/rm32-is-first-inout +11474 0/imm32/no-r32 +11475 2/imm32/imm32-is-second-inout +11476 0/imm32/no-disp32 +11477 0/imm32/output-is-write-only +11478 0x11/imm32/alloc-id:fake +11479 _Primitive-compare-mem-with-literal/imm32/next +11480 _Primitive-compare-mem-with-literal: # (payload primitive) +11481 0x11/imm32/alloc-id:fake:payload +11482 # compare var1 n => 81 7/subop/compare *(ebp+___) n/imm32 +11483 0x11/imm32/alloc-id:fake +11484 _string-compare/imm32/name 11485 0x11/imm32/alloc-id:fake -11486 _string_81_subop_compare/imm32/subx-name -11487 1/imm32/rm32-is-first-inout -11488 0/imm32/no-r32 -11489 2/imm32/imm32-is-second-inout -11490 0/imm32/no-disp32 -11491 0/imm32/output-is-write-only -11492 0x11/imm32/alloc-id:fake -11493 _Primitive-multiply-reg-by-mem/imm32/next -11494 # - multiply -11495 _Primitive-multiply-reg-by-mem: # (payload primitive) -11496 0x11/imm32/alloc-id:fake:payload -11497 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 -11498 0x11/imm32/alloc-id:fake -11499 _string-multiply/imm32/name -11500 0x11/imm32/alloc-id:fake -11501 Single-int-var-in-mem/imm32/inouts +11486 Int-var-and-literal/imm32/inouts +11487 0/imm32/no-outputs +11488 0/imm32/no-outputs +11489 0x11/imm32/alloc-id:fake +11490 _string_81_subop_compare/imm32/subx-name +11491 1/imm32/rm32-is-first-inout +11492 0/imm32/no-r32 +11493 2/imm32/imm32-is-second-inout +11494 0/imm32/no-disp32 +11495 0/imm32/output-is-write-only +11496 0x11/imm32/alloc-id:fake +11497 _Primitive-multiply-reg-by-mem/imm32/next +11498 # - multiply +11499 _Primitive-multiply-reg-by-mem: # (payload primitive) +11500 0x11/imm32/alloc-id:fake:payload +11501 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 11502 0x11/imm32/alloc-id:fake -11503 Single-int-var-in-some-register/imm32/outputs +11503 _string-multiply/imm32/name 11504 0x11/imm32/alloc-id:fake -11505 _string_0f_af_multiply/imm32/subx-name -11506 1/imm32/rm32-is-first-inout -11507 3/imm32/r32-is-first-output -11508 0/imm32/no-imm32 -11509 0/imm32/no-disp32 -11510 0/imm32/output-is-write-only -11511 0x11/imm32/alloc-id:fake -11512 _Primitive-break-if-addr</imm32/next -11513 # - branches -11514 _Primitive-break-if-addr<: # (payload primitive) -11515 0x11/imm32/alloc-id:fake:payload -11516 0x11/imm32/alloc-id:fake -11517 _string-break-if-addr</imm32/name -11518 0/imm32/no-inouts -11519 0/imm32/no-inouts -11520 0/imm32/no-outputs -11521 0/imm32/no-outputs -11522 0x11/imm32/alloc-id:fake -11523 _string_0f_82_jump_break/imm32/subx-name -11524 0/imm32/no-rm32 -11525 0/imm32/no-r32 -11526 0/imm32/no-imm32 -11527 0/imm32/no-disp32 -11528 0/imm32/no-output -11529 0x11/imm32/alloc-id:fake -11530 _Primitive-break-if-addr>=/imm32/next -11531 _Primitive-break-if-addr>=: # (payload primitive) -11532 0x11/imm32/alloc-id:fake:payload +11505 Single-int-var-in-mem/imm32/inouts +11506 0x11/imm32/alloc-id:fake +11507 Single-int-var-in-some-register/imm32/outputs +11508 0x11/imm32/alloc-id:fake +11509 _string_0f_af_multiply/imm32/subx-name +11510 1/imm32/rm32-is-first-inout +11511 3/imm32/r32-is-first-output +11512 0/imm32/no-imm32 +11513 0/imm32/no-disp32 +11514 0/imm32/output-is-write-only +11515 0x11/imm32/alloc-id:fake +11516 _Primitive-break-if-addr</imm32/next +11517 # - branches +11518 _Primitive-break-if-addr<: # (payload primitive) +11519 0x11/imm32/alloc-id:fake:payload +11520 0x11/imm32/alloc-id:fake +11521 _string-break-if-addr</imm32/name +11522 0/imm32/no-inouts +11523 0/imm32/no-inouts +11524 0/imm32/no-outputs +11525 0/imm32/no-outputs +11526 0x11/imm32/alloc-id:fake +11527 _string_0f_82_jump_break/imm32/subx-name +11528 0/imm32/no-rm32 +11529 0/imm32/no-r32 +11530 0/imm32/no-imm32 +11531 0/imm32/no-disp32 +11532 0/imm32/no-output 11533 0x11/imm32/alloc-id:fake -11534 _string-break-if-addr>=/imm32/name -11535 0/imm32/no-inouts -11536 0/imm32/no-inouts -11537 0/imm32/no-outputs -11538 0/imm32/no-outputs -11539 0x11/imm32/alloc-id:fake -11540 _string_0f_83_jump_break/imm32/subx-name -11541 0/imm32/no-rm32 -11542 0/imm32/no-r32 -11543 0/imm32/no-imm32 -11544 0/imm32/no-disp32 -11545 0/imm32/no-output -11546 0x11/imm32/alloc-id:fake -11547 _Primitive-break-if-=/imm32/next -11548 _Primitive-break-if-=: # (payload primitive) -11549 0x11/imm32/alloc-id:fake:payload +11534 _Primitive-break-if-addr>=/imm32/next +11535 _Primitive-break-if-addr>=: # (payload primitive) +11536 0x11/imm32/alloc-id:fake:payload +11537 0x11/imm32/alloc-id:fake +11538 _string-break-if-addr>=/imm32/name +11539 0/imm32/no-inouts +11540 0/imm32/no-inouts +11541 0/imm32/no-outputs +11542 0/imm32/no-outputs +11543 0x11/imm32/alloc-id:fake +11544 _string_0f_83_jump_break/imm32/subx-name +11545 0/imm32/no-rm32 +11546 0/imm32/no-r32 +11547 0/imm32/no-imm32 +11548 0/imm32/no-disp32 +11549 0/imm32/no-output 11550 0x11/imm32/alloc-id:fake -11551 _string-break-if-=/imm32/name -11552 0/imm32/no-inouts -11553 0/imm32/no-inouts -11554 0/imm32/no-outputs -11555 0/imm32/no-outputs -11556 0x11/imm32/alloc-id:fake -11557 _string_0f_84_jump_break/imm32/subx-name -11558 0/imm32/no-rm32 -11559 0/imm32/no-r32 -11560 0/imm32/no-imm32 -11561 0/imm32/no-disp32 -11562 0/imm32/no-output -11563 0x11/imm32/alloc-id:fake -11564 _Primitive-break-if-!=/imm32/next -11565 _Primitive-break-if-!=: # (payload primitive) -11566 0x11/imm32/alloc-id:fake:payload +11551 _Primitive-break-if-=/imm32/next +11552 _Primitive-break-if-=: # (payload primitive) +11553 0x11/imm32/alloc-id:fake:payload +11554 0x11/imm32/alloc-id:fake +11555 _string-break-if-=/imm32/name +11556 0/imm32/no-inouts +11557 0/imm32/no-inouts +11558 0/imm32/no-outputs +11559 0/imm32/no-outputs +11560 0x11/imm32/alloc-id:fake +11561 _string_0f_84_jump_break/imm32/subx-name +11562 0/imm32/no-rm32 +11563 0/imm32/no-r32 +11564 0/imm32/no-imm32 +11565 0/imm32/no-disp32 +11566 0/imm32/no-output 11567 0x11/imm32/alloc-id:fake -11568 _string-break-if-!=/imm32/name -11569 0/imm32/no-inouts -11570 0/imm32/no-inouts -11571 0/imm32/no-outputs -11572 0/imm32/no-outputs -11573 0x11/imm32/alloc-id:fake -11574 _string_0f_85_jump_break/imm32/subx-name -11575 0/imm32/no-rm32 -11576 0/imm32/no-r32 -11577 0/imm32/no-imm32 -11578 0/imm32/no-disp32 -11579 0/imm32/no-output -11580 0x11/imm32/alloc-id:fake -11581 _Primitive-break-if-addr<=/imm32/next -11582 _Primitive-break-if-addr<=: # (payload primitive) -11583 0x11/imm32/alloc-id:fake:payload +11568 _Primitive-break-if-!=/imm32/next +11569 _Primitive-break-if-!=: # (payload primitive) +11570 0x11/imm32/alloc-id:fake:payload +11571 0x11/imm32/alloc-id:fake +11572 _string-break-if-!=/imm32/name +11573 0/imm32/no-inouts +11574 0/imm32/no-inouts +11575 0/imm32/no-outputs +11576 0/imm32/no-outputs +11577 0x11/imm32/alloc-id:fake +11578 _string_0f_85_jump_break/imm32/subx-name +11579 0/imm32/no-rm32 +11580 0/imm32/no-r32 +11581 0/imm32/no-imm32 +11582 0/imm32/no-disp32 +11583 0/imm32/no-output 11584 0x11/imm32/alloc-id:fake -11585 _string-break-if-addr<=/imm32/name -11586 0/imm32/no-inouts -11587 0/imm32/no-inouts -11588 0/imm32/no-outputs -11589 0/imm32/no-outputs -11590 0x11/imm32/alloc-id:fake -11591 _string_0f_86_jump_break/imm32/subx-name -11592 0/imm32/no-rm32 -11593 0/imm32/no-r32 -11594 0/imm32/no-imm32 -11595 0/imm32/no-disp32 -11596 0/imm32/no-output -11597 0x11/imm32/alloc-id:fake -11598 _Primitive-break-if-addr>/imm32/next -11599 _Primitive-break-if-addr>: # (payload primitive) -11600 0x11/imm32/alloc-id:fake:payload +11585 _Primitive-break-if-addr<=/imm32/next +11586 _Primitive-break-if-addr<=: # (payload primitive) +11587 0x11/imm32/alloc-id:fake:payload +11588 0x11/imm32/alloc-id:fake +11589 _string-break-if-addr<=/imm32/name +11590 0/imm32/no-inouts +11591 0/imm32/no-inouts +11592 0/imm32/no-outputs +11593 0/imm32/no-outputs +11594 0x11/imm32/alloc-id:fake +11595 _string_0f_86_jump_break/imm32/subx-name +11596 0/imm32/no-rm32 +11597 0/imm32/no-r32 +11598 0/imm32/no-imm32 +11599 0/imm32/no-disp32 +11600 0/imm32/no-output 11601 0x11/imm32/alloc-id:fake -11602 _string-break-if-addr>/imm32/name -11603 0/imm32/no-inouts -11604 0/imm32/no-inouts -11605 0/imm32/no-outputs -11606 0/imm32/no-outputs -11607 0x11/imm32/alloc-id:fake -11608 _string_0f_87_jump_break/imm32/subx-name -11609 0/imm32/no-rm32 -11610 0/imm32/no-r32 -11611 0/imm32/no-imm32 -11612 0/imm32/no-disp32 -11613 0/imm32/no-output -11614 0x11/imm32/alloc-id:fake -11615 _Primitive-break-if-</imm32/next -11616 _Primitive-break-if-<: # (payload primitive) -11617 0x11/imm32/alloc-id:fake:payload +11602 _Primitive-break-if-addr>/imm32/next +11603 _Primitive-break-if-addr>: # (payload primitive) +11604 0x11/imm32/alloc-id:fake:payload +11605 0x11/imm32/alloc-id:fake +11606 _string-break-if-addr>/imm32/name +11607 0/imm32/no-inouts +11608 0/imm32/no-inouts +11609 0/imm32/no-outputs +11610 0/imm32/no-outputs +11611 0x11/imm32/alloc-id:fake +11612 _string_0f_87_jump_break/imm32/subx-name +11613 0/imm32/no-rm32 +11614 0/imm32/no-r32 +11615 0/imm32/no-imm32 +11616 0/imm32/no-disp32 +11617 0/imm32/no-output 11618 0x11/imm32/alloc-id:fake -11619 _string-break-if-</imm32/name -11620 0/imm32/no-inouts -11621 0/imm32/no-inouts -11622 0/imm32/no-outputs -11623 0/imm32/no-outputs -11624 0x11/imm32/alloc-id:fake -11625 _string_0f_8c_jump_break/imm32/subx-name -11626 0/imm32/no-rm32 -11627 0/imm32/no-r32 -11628 0/imm32/no-imm32 -11629 0/imm32/no-disp32 -11630 0/imm32/no-output -11631 0x11/imm32/alloc-id:fake -11632 _Primitive-break-if->=/imm32/next -11633 _Primitive-break-if->=: # (payload primitive) -11634 0x11/imm32/alloc-id:fake:payload +11619 _Primitive-break-if-</imm32/next +11620 _Primitive-break-if-<: # (payload primitive) +11621 0x11/imm32/alloc-id:fake:payload +11622 0x11/imm32/alloc-id:fake +11623 _string-break-if-</imm32/name +11624 0/imm32/no-inouts +11625 0/imm32/no-inouts +11626 0/imm32/no-outputs +11627 0/imm32/no-outputs +11628 0x11/imm32/alloc-id:fake +11629 _string_0f_8c_jump_break/imm32/subx-name +11630 0/imm32/no-rm32 +11631 0/imm32/no-r32 +11632 0/imm32/no-imm32 +11633 0/imm32/no-disp32 +11634 0/imm32/no-output 11635 0x11/imm32/alloc-id:fake -11636 _string-break-if->=/imm32/name -11637 0/imm32/no-inouts -11638 0/imm32/no-inouts -11639 0/imm32/no-outputs -11640 0/imm32/no-outputs -11641 0x11/imm32/alloc-id:fake -11642 _string_0f_8d_jump_break/imm32/subx-name -11643 0/imm32/no-rm32 -11644 0/imm32/no-r32 -11645 0/imm32/no-imm32 -11646 0/imm32/no-disp32 -11647 0/imm32/no-output -11648 0x11/imm32/alloc-id:fake -11649 _Primitive-break-if-<=/imm32/next -11650 _Primitive-break-if-<=: # (payload primitive) -11651 0x11/imm32/alloc-id:fake:payload +11636 _Primitive-break-if->=/imm32/next +11637 _Primitive-break-if->=: # (payload primitive) +11638 0x11/imm32/alloc-id:fake:payload +11639 0x11/imm32/alloc-id:fake +11640 _string-break-if->=/imm32/name +11641 0/imm32/no-inouts +11642 0/imm32/no-inouts +11643 0/imm32/no-outputs +11644 0/imm32/no-outputs +11645 0x11/imm32/alloc-id:fake +11646 _string_0f_8d_jump_break/imm32/subx-name +11647 0/imm32/no-rm32 +11648 0/imm32/no-r32 +11649 0/imm32/no-imm32 +11650 0/imm32/no-disp32 +11651 0/imm32/no-output 11652 0x11/imm32/alloc-id:fake -11653 _string-break-if-<=/imm32/name -11654 0/imm32/no-inouts -11655 0/imm32/no-inouts -11656 0/imm32/no-outputs -11657 0/imm32/no-outputs -11658 0x11/imm32/alloc-id:fake -11659 _string_0f_8e_jump_break/imm32/subx-name -11660 0/imm32/no-rm32 -11661 0/imm32/no-r32 -11662 0/imm32/no-imm32 -11663 0/imm32/no-disp32 -11664 0/imm32/no-output -11665 0x11/imm32/alloc-id:fake -11666 _Primitive-break-if->/imm32/next -11667 _Primitive-break-if->: # (payload primitive) -11668 0x11/imm32/alloc-id:fake:payload +11653 _Primitive-break-if-<=/imm32/next +11654 _Primitive-break-if-<=: # (payload primitive) +11655 0x11/imm32/alloc-id:fake:payload +11656 0x11/imm32/alloc-id:fake +11657 _string-break-if-<=/imm32/name +11658 0/imm32/no-inouts +11659 0/imm32/no-inouts +11660 0/imm32/no-outputs +11661 0/imm32/no-outputs +11662 0x11/imm32/alloc-id:fake +11663 _string_0f_8e_jump_break/imm32/subx-name +11664 0/imm32/no-rm32 +11665 0/imm32/no-r32 +11666 0/imm32/no-imm32 +11667 0/imm32/no-disp32 +11668 0/imm32/no-output 11669 0x11/imm32/alloc-id:fake -11670 _string-break-if->/imm32/name -11671 0/imm32/no-inouts -11672 0/imm32/no-inouts -11673 0/imm32/no-outputs -11674 0/imm32/no-outputs -11675 0x11/imm32/alloc-id:fake -11676 _string_0f_8f_jump_break/imm32/subx-name -11677 0/imm32/no-rm32 -11678 0/imm32/no-r32 -11679 0/imm32/no-imm32 -11680 0/imm32/no-disp32 -11681 0/imm32/no-output -11682 0x11/imm32/alloc-id:fake -11683 _Primitive-break/imm32/next -11684 _Primitive-break: # (payload primitive) -11685 0x11/imm32/alloc-id:fake:payload +11670 _Primitive-break-if->/imm32/next +11671 _Primitive-break-if->: # (payload primitive) +11672 0x11/imm32/alloc-id:fake:payload +11673 0x11/imm32/alloc-id:fake +11674 _string-break-if->/imm32/name +11675 0/imm32/no-inouts +11676 0/imm32/no-inouts +11677 0/imm32/no-outputs +11678 0/imm32/no-outputs +11679 0x11/imm32/alloc-id:fake +11680 _string_0f_8f_jump_break/imm32/subx-name +11681 0/imm32/no-rm32 +11682 0/imm32/no-r32 +11683 0/imm32/no-imm32 +11684 0/imm32/no-disp32 +11685 0/imm32/no-output 11686 0x11/imm32/alloc-id:fake -11687 _string-break/imm32/name -11688 0/imm32/no-inouts -11689 0/imm32/no-inouts -11690 0/imm32/no-outputs -11691 0/imm32/no-outputs -11692 0x11/imm32/alloc-id:fake -11693 _string_e9_jump_break/imm32/subx-name -11694 0/imm32/no-rm32 -11695 0/imm32/no-r32 -11696 0/imm32/no-imm32 -11697 0/imm32/no-disp32 -11698 0/imm32/no-output -11699 0x11/imm32/alloc-id:fake -11700 _Primitive-loop-if-addr</imm32/next -11701 _Primitive-loop-if-addr<: # (payload primitive) -11702 0x11/imm32/alloc-id:fake:payload +11687 _Primitive-break/imm32/next +11688 _Primitive-break: # (payload primitive) +11689 0x11/imm32/alloc-id:fake:payload +11690 0x11/imm32/alloc-id:fake +11691 _string-break/imm32/name +11692 0/imm32/no-inouts +11693 0/imm32/no-inouts +11694 0/imm32/no-outputs +11695 0/imm32/no-outputs +11696 0x11/imm32/alloc-id:fake +11697 _string_e9_jump_break/imm32/subx-name +11698 0/imm32/no-rm32 +11699 0/imm32/no-r32 +11700 0/imm32/no-imm32 +11701 0/imm32/no-disp32 +11702 0/imm32/no-output 11703 0x11/imm32/alloc-id:fake -11704 _string-loop-if-addr</imm32/name -11705 0/imm32/no-inouts -11706 0/imm32/no-inouts -11707 0/imm32/no-outputs -11708 0/imm32/no-outputs -11709 0x11/imm32/alloc-id:fake -11710 _string_0f_82_jump_loop/imm32/subx-name -11711 0/imm32/no-rm32 -11712 0/imm32/no-r32 -11713 0/imm32/no-imm32 -11714 0/imm32/no-disp32 -11715 0/imm32/no-output -11716 0x11/imm32/alloc-id:fake -11717 _Primitive-loop-if-addr>=/imm32/next -11718 _Primitive-loop-if-addr>=: # (payload primitive) -11719 0x11/imm32/alloc-id:fake:payload +11704 _Primitive-loop-if-addr</imm32/next +11705 _Primitive-loop-if-addr<: # (payload primitive) +11706 0x11/imm32/alloc-id:fake:payload +11707 0x11/imm32/alloc-id:fake +11708 _string-loop-if-addr</imm32/name +11709 0/imm32/no-inouts +11710 0/imm32/no-inouts +11711 0/imm32/no-outputs +11712 0/imm32/no-outputs +11713 0x11/imm32/alloc-id:fake +11714 _string_0f_82_jump_loop/imm32/subx-name +11715 0/imm32/no-rm32 +11716 0/imm32/no-r32 +11717 0/imm32/no-imm32 +11718 0/imm32/no-disp32 +11719 0/imm32/no-output 11720 0x11/imm32/alloc-id:fake -11721 _string-loop-if-addr>=/imm32/name -11722 0/imm32/no-inouts -11723 0/imm32/no-inouts -11724 0/imm32/no-outputs -11725 0/imm32/no-outputs -11726 0x11/imm32/alloc-id:fake -11727 _string_0f_83_jump_loop/imm32/subx-name -11728 0/imm32/no-rm32 -11729 0/imm32/no-r32 -11730 0/imm32/no-imm32 -11731 0/imm32/no-disp32 -11732 0/imm32/no-output -11733 0x11/imm32/alloc-id:fake -11734 _Primitive-loop-if-=/imm32/next -11735 _Primitive-loop-if-=: # (payload primitive) -11736 0x11/imm32/alloc-id:fake:payload +11721 _Primitive-loop-if-addr>=/imm32/next +11722 _Primitive-loop-if-addr>=: # (payload primitive) +11723 0x11/imm32/alloc-id:fake:payload +11724 0x11/imm32/alloc-id:fake +11725 _string-loop-if-addr>=/imm32/name +11726 0/imm32/no-inouts +11727 0/imm32/no-inouts +11728 0/imm32/no-outputs +11729 0/imm32/no-outputs +11730 0x11/imm32/alloc-id:fake +11731 _string_0f_83_jump_loop/imm32/subx-name +11732 0/imm32/no-rm32 +11733 0/imm32/no-r32 +11734 0/imm32/no-imm32 +11735 0/imm32/no-disp32 +11736 0/imm32/no-output 11737 0x11/imm32/alloc-id:fake -11738 _string-loop-if-=/imm32/name -11739 0/imm32/no-inouts -11740 0/imm32/no-inouts -11741 0/imm32/no-outputs -11742 0/imm32/no-outputs -11743 0x11/imm32/alloc-id:fake -11744 _string_0f_84_jump_loop/imm32/subx-name -11745 0/imm32/no-rm32 -11746 0/imm32/no-r32 -11747 0/imm32/no-imm32 -11748 0/imm32/no-disp32 -11749 0/imm32/no-output -11750 0x11/imm32/alloc-id:fake -11751 _Primitive-loop-if-!=/imm32/next -11752 _Primitive-loop-if-!=: # (payload primitive) -11753 0x11/imm32/alloc-id:fake:payload +11738 _Primitive-loop-if-=/imm32/next +11739 _Primitive-loop-if-=: # (payload primitive) +11740 0x11/imm32/alloc-id:fake:payload +11741 0x11/imm32/alloc-id:fake +11742 _string-loop-if-=/imm32/name +11743 0/imm32/no-inouts +11744 0/imm32/no-inouts +11745 0/imm32/no-outputs +11746 0/imm32/no-outputs +11747 0x11/imm32/alloc-id:fake +11748 _string_0f_84_jump_loop/imm32/subx-name +11749 0/imm32/no-rm32 +11750 0/imm32/no-r32 +11751 0/imm32/no-imm32 +11752 0/imm32/no-disp32 +11753 0/imm32/no-output 11754 0x11/imm32/alloc-id:fake -11755 _string-loop-if-!=/imm32/name -11756 0/imm32/no-inouts -11757 0/imm32/no-inouts -11758 0/imm32/no-outputs -11759 0/imm32/no-outputs -11760 0x11/imm32/alloc-id:fake -11761 _string_0f_85_jump_loop/imm32/subx-name -11762 0/imm32/no-rm32 -11763 0/imm32/no-r32 -11764 0/imm32/no-imm32 -11765 0/imm32/no-disp32 -11766 0/imm32/no-output -11767 0x11/imm32/alloc-id:fake -11768 _Primitive-loop-if-addr<=/imm32/next -11769 _Primitive-loop-if-addr<=: # (payload primitive) -11770 0x11/imm32/alloc-id:fake:payload +11755 _Primitive-loop-if-!=/imm32/next +11756 _Primitive-loop-if-!=: # (payload primitive) +11757 0x11/imm32/alloc-id:fake:payload +11758 0x11/imm32/alloc-id:fake +11759 _string-loop-if-!=/imm32/name +11760 0/imm32/no-inouts +11761 0/imm32/no-inouts +11762 0/imm32/no-outputs +11763 0/imm32/no-outputs +11764 0x11/imm32/alloc-id:fake +11765 _string_0f_85_jump_loop/imm32/subx-name +11766 0/imm32/no-rm32 +11767 0/imm32/no-r32 +11768 0/imm32/no-imm32 +11769 0/imm32/no-disp32 +11770 0/imm32/no-output 11771 0x11/imm32/alloc-id:fake -11772 _string-loop-if-addr<=/imm32/name -11773 0/imm32/no-inouts -11774 0/imm32/no-inouts -11775 0/imm32/no-outputs -11776 0/imm32/no-outputs -11777 0x11/imm32/alloc-id:fake -11778 _string_0f_86_jump_loop/imm32/subx-name -11779 0/imm32/no-rm32 -11780 0/imm32/no-r32 -11781 0/imm32/no-imm32 -11782 0/imm32/no-disp32 -11783 0/imm32/no-output -11784 0x11/imm32/alloc-id:fake -11785 _Primitive-loop-if-addr>/imm32/next -11786 _Primitive-loop-if-addr>: # (payload primitive) -11787 0x11/imm32/alloc-id:fake:payload +11772 _Primitive-loop-if-addr<=/imm32/next +11773 _Primitive-loop-if-addr<=: # (payload primitive) +11774 0x11/imm32/alloc-id:fake:payload +11775 0x11/imm32/alloc-id:fake +11776 _string-loop-if-addr<=/imm32/name +11777 0/imm32/no-inouts +11778 0/imm32/no-inouts +11779 0/imm32/no-outputs +11780 0/imm32/no-outputs +11781 0x11/imm32/alloc-id:fake +11782 _string_0f_86_jump_loop/imm32/subx-name +11783 0/imm32/no-rm32 +11784 0/imm32/no-r32 +11785 0/imm32/no-imm32 +11786 0/imm32/no-disp32 +11787 0/imm32/no-output 11788 0x11/imm32/alloc-id:fake -11789 _string-loop-if-addr>/imm32/name -11790 0/imm32/no-inouts -11791 0/imm32/no-inouts -11792 0/imm32/no-outputs -11793 0/imm32/no-outputs -11794 0x11/imm32/alloc-id:fake -11795 _string_0f_87_jump_loop/imm32/subx-name -11796 0/imm32/no-rm32 -11797 0/imm32/no-r32 -11798 0/imm32/no-imm32 -11799 0/imm32/no-disp32 -11800 0/imm32/no-output -11801 0x11/imm32/alloc-id:fake -11802 _Primitive-loop-if-</imm32/next -11803 _Primitive-loop-if-<: # (payload primitive) -11804 0x11/imm32/alloc-id:fake:payload +11789 _Primitive-loop-if-addr>/imm32/next +11790 _Primitive-loop-if-addr>: # (payload primitive) +11791 0x11/imm32/alloc-id:fake:payload +11792 0x11/imm32/alloc-id:fake +11793 _string-loop-if-addr>/imm32/name +11794 0/imm32/no-inouts +11795 0/imm32/no-inouts +11796 0/imm32/no-outputs +11797 0/imm32/no-outputs +11798 0x11/imm32/alloc-id:fake +11799 _string_0f_87_jump_loop/imm32/subx-name +11800 0/imm32/no-rm32 +11801 0/imm32/no-r32 +11802 0/imm32/no-imm32 +11803 0/imm32/no-disp32 +11804 0/imm32/no-output 11805 0x11/imm32/alloc-id:fake -11806 _string-loop-if-</imm32/name -11807 0/imm32/no-inouts -11808 0/imm32/no-inouts -11809 0/imm32/no-outputs -11810 0/imm32/no-outputs -11811 0x11/imm32/alloc-id:fake -11812 _string_0f_8c_jump_loop/imm32/subx-name -11813 0/imm32/no-rm32 -11814 0/imm32/no-r32 -11815 0/imm32/no-imm32 -11816 0/imm32/no-disp32 -11817 0/imm32/no-output -11818 0x11/imm32/alloc-id:fake -11819 _Primitive-loop-if->=/imm32/next -11820 _Primitive-loop-if->=: # (payload primitive) -11821 0x11/imm32/alloc-id:fake:payload +11806 _Primitive-loop-if-</imm32/next +11807 _Primitive-loop-if-<: # (payload primitive) +11808 0x11/imm32/alloc-id:fake:payload +11809 0x11/imm32/alloc-id:fake +11810 _string-loop-if-</imm32/name +11811 0/imm32/no-inouts +11812 0/imm32/no-inouts +11813 0/imm32/no-outputs +11814 0/imm32/no-outputs +11815 0x11/imm32/alloc-id:fake +11816 _string_0f_8c_jump_loop/imm32/subx-name +11817 0/imm32/no-rm32 +11818 0/imm32/no-r32 +11819 0/imm32/no-imm32 +11820 0/imm32/no-disp32 +11821 0/imm32/no-output 11822 0x11/imm32/alloc-id:fake -11823 _string-loop-if->=/imm32/name -11824 0/imm32/no-inouts -11825 0/imm32/no-inouts -11826 0/imm32/no-outputs -11827 0/imm32/no-outputs -11828 0x11/imm32/alloc-id:fake -11829 _string_0f_8d_jump_loop/imm32/subx-name -11830 0/imm32/no-rm32 -11831 0/imm32/no-r32 -11832 0/imm32/no-imm32 -11833 0/imm32/no-disp32 -11834 0/imm32/no-output -11835 0x11/imm32/alloc-id:fake -11836 _Primitive-loop-if-<=/imm32/next -11837 _Primitive-loop-if-<=: # (payload primitive) -11838 0x11/imm32/alloc-id:fake:payload +11823 _Primitive-loop-if->=/imm32/next +11824 _Primitive-loop-if->=: # (payload primitive) +11825 0x11/imm32/alloc-id:fake:payload +11826 0x11/imm32/alloc-id:fake +11827 _string-loop-if->=/imm32/name +11828 0/imm32/no-inouts +11829 0/imm32/no-inouts +11830 0/imm32/no-outputs +11831 0/imm32/no-outputs +11832 0x11/imm32/alloc-id:fake +11833 _string_0f_8d_jump_loop/imm32/subx-name +11834 0/imm32/no-rm32 +11835 0/imm32/no-r32 +11836 0/imm32/no-imm32 +11837 0/imm32/no-disp32 +11838 0/imm32/no-output 11839 0x11/imm32/alloc-id:fake -11840 _string-loop-if-<=/imm32/name -11841 0/imm32/no-inouts -11842 0/imm32/no-inouts -11843 0/imm32/no-outputs -11844 0/imm32/no-outputs -11845 0x11/imm32/alloc-id:fake -11846 _string_0f_8e_jump_loop/imm32/subx-name -11847 0/imm32/no-rm32 -11848 0/imm32/no-r32 -11849 0/imm32/no-imm32 -11850 0/imm32/no-disp32 -11851 0/imm32/no-output -11852 0x11/imm32/alloc-id:fake -11853 _Primitive-loop-if->/imm32/next -11854 _Primitive-loop-if->: # (payload primitive) -11855 0x11/imm32/alloc-id:fake:payload +11840 _Primitive-loop-if-<=/imm32/next +11841 _Primitive-loop-if-<=: # (payload primitive) +11842 0x11/imm32/alloc-id:fake:payload +11843 0x11/imm32/alloc-id:fake +11844 _string-loop-if-<=/imm32/name +11845 0/imm32/no-inouts +11846 0/imm32/no-inouts +11847 0/imm32/no-outputs +11848 0/imm32/no-outputs +11849 0x11/imm32/alloc-id:fake +11850 _string_0f_8e_jump_loop/imm32/subx-name +11851 0/imm32/no-rm32 +11852 0/imm32/no-r32 +11853 0/imm32/no-imm32 +11854 0/imm32/no-disp32 +11855 0/imm32/no-output 11856 0x11/imm32/alloc-id:fake -11857 _string-loop-if->/imm32/name -11858 0/imm32/no-inouts -11859 0/imm32/no-inouts -11860 0/imm32/no-outputs -11861 0/imm32/no-outputs -11862 0x11/imm32/alloc-id:fake -11863 _string_0f_8f_jump_loop/imm32/subx-name -11864 0/imm32/no-rm32 -11865 0/imm32/no-r32 -11866 0/imm32/no-imm32 -11867 0/imm32/no-disp32 -11868 0/imm32/no-output -11869 0x11/imm32/alloc-id:fake -11870 _Primitive-loop/imm32/next # we probably don't need an unconditional break -11871 _Primitive-loop: # (payload primitive) -11872 0x11/imm32/alloc-id:fake:payload +11857 _Primitive-loop-if->/imm32/next +11858 _Primitive-loop-if->: # (payload primitive) +11859 0x11/imm32/alloc-id:fake:payload +11860 0x11/imm32/alloc-id:fake +11861 _string-loop-if->/imm32/name +11862 0/imm32/no-inouts +11863 0/imm32/no-inouts +11864 0/imm32/no-outputs +11865 0/imm32/no-outputs +11866 0x11/imm32/alloc-id:fake +11867 _string_0f_8f_jump_loop/imm32/subx-name +11868 0/imm32/no-rm32 +11869 0/imm32/no-r32 +11870 0/imm32/no-imm32 +11871 0/imm32/no-disp32 +11872 0/imm32/no-output 11873 0x11/imm32/alloc-id:fake -11874 _string-loop/imm32/name -11875 0/imm32/no-inouts -11876 0/imm32/no-inouts -11877 0/imm32/no-outputs -11878 0/imm32/no-outputs -11879 0x11/imm32/alloc-id:fake -11880 _string_e9_jump_loop/imm32/subx-name -11881 0/imm32/no-rm32 -11882 0/imm32/no-r32 -11883 0/imm32/no-imm32 -11884 0/imm32/no-disp32 -11885 0/imm32/no-output -11886 0x11/imm32/alloc-id:fake -11887 _Primitive-break-if-addr<-named/imm32/next -11888 # - branches to named blocks -11889 _Primitive-break-if-addr<-named: # (payload primitive) -11890 0x11/imm32/alloc-id:fake:payload -11891 0x11/imm32/alloc-id:fake -11892 _string-break-if-addr</imm32/name -11893 0x11/imm32/alloc-id:fake -11894 Single-lit-var/imm32/inouts -11895 0/imm32/no-outputs -11896 0/imm32/no-outputs +11874 _Primitive-loop/imm32/next # we probably don't need an unconditional break +11875 _Primitive-loop: # (payload primitive) +11876 0x11/imm32/alloc-id:fake:payload +11877 0x11/imm32/alloc-id:fake +11878 _string-loop/imm32/name +11879 0/imm32/no-inouts +11880 0/imm32/no-inouts +11881 0/imm32/no-outputs +11882 0/imm32/no-outputs +11883 0x11/imm32/alloc-id:fake +11884 _string_e9_jump_loop/imm32/subx-name +11885 0/imm32/no-rm32 +11886 0/imm32/no-r32 +11887 0/imm32/no-imm32 +11888 0/imm32/no-disp32 +11889 0/imm32/no-output +11890 0x11/imm32/alloc-id:fake +11891 _Primitive-break-if-addr<-named/imm32/next +11892 # - branches to named blocks +11893 _Primitive-break-if-addr<-named: # (payload primitive) +11894 0x11/imm32/alloc-id:fake:payload +11895 0x11/imm32/alloc-id:fake +11896 _string-break-if-addr</imm32/name 11897 0x11/imm32/alloc-id:fake -11898 _string_0f_82_jump_label/imm32/subx-name -11899 0/imm32/no-rm32 -11900 0/imm32/no-r32 -11901 0/imm32/no-imm32 -11902 1/imm32/disp32-is-first-inout -11903 0/imm32/no-output -11904 0x11/imm32/alloc-id:fake -11905 _Primitive-break-if-addr>=-named/imm32/next -11906 _Primitive-break-if-addr>=-named: # (payload primitive) -11907 0x11/imm32/alloc-id:fake:payload +11898 Single-lit-var/imm32/inouts +11899 0/imm32/no-outputs +11900 0/imm32/no-outputs +11901 0x11/imm32/alloc-id:fake +11902 _string_0f_82_jump_label/imm32/subx-name +11903 0/imm32/no-rm32 +11904 0/imm32/no-r32 +11905 0/imm32/no-imm32 +11906 1/imm32/disp32-is-first-inout +11907 0/imm32/no-output 11908 0x11/imm32/alloc-id:fake -11909 _string-break-if-addr>=/imm32/name -11910 0x11/imm32/alloc-id:fake -11911 Single-lit-var/imm32/inouts -11912 0/imm32/no-outputs -11913 0/imm32/no-outputs +11909 _Primitive-break-if-addr>=-named/imm32/next +11910 _Primitive-break-if-addr>=-named: # (payload primitive) +11911 0x11/imm32/alloc-id:fake:payload +11912 0x11/imm32/alloc-id:fake +11913 _string-break-if-addr>=/imm32/name 11914 0x11/imm32/alloc-id:fake -11915 _string_0f_83_jump_label/imm32/subx-name -11916 0/imm32/no-rm32 -11917 0/imm32/no-r32 -11918 0/imm32/no-imm32 -11919 1/imm32/disp32-is-first-inout -11920 0/imm32/no-output -11921 0x11/imm32/alloc-id:fake -11922 _Primitive-break-if-=-named/imm32/next -11923 _Primitive-break-if-=-named: # (payload primitive) -11924 0x11/imm32/alloc-id:fake:payload +11915 Single-lit-var/imm32/inouts +11916 0/imm32/no-outputs +11917 0/imm32/no-outputs +11918 0x11/imm32/alloc-id:fake +11919 _string_0f_83_jump_label/imm32/subx-name +11920 0/imm32/no-rm32 +11921 0/imm32/no-r32 +11922 0/imm32/no-imm32 +11923 1/imm32/disp32-is-first-inout +11924 0/imm32/no-output 11925 0x11/imm32/alloc-id:fake -11926 _string-break-if-=/imm32/name -11927 0x11/imm32/alloc-id:fake -11928 Single-lit-var/imm32/inouts -11929 0/imm32/no-outputs -11930 0/imm32/no-outputs +11926 _Primitive-break-if-=-named/imm32/next +11927 _Primitive-break-if-=-named: # (payload primitive) +11928 0x11/imm32/alloc-id:fake:payload +11929 0x11/imm32/alloc-id:fake +11930 _string-break-if-=/imm32/name 11931 0x11/imm32/alloc-id:fake -11932 _string_0f_84_jump_label/imm32/subx-name -11933 0/imm32/no-rm32 -11934 0/imm32/no-r32 -11935 0/imm32/no-imm32 -11936 1/imm32/disp32-is-first-inout -11937 0/imm32/no-output -11938 0x11/imm32/alloc-id:fake -11939 _Primitive-break-if-!=-named/imm32/next -11940 _Primitive-break-if-!=-named: # (payload primitive) -11941 0x11/imm32/alloc-id:fake:payload +11932 Single-lit-var/imm32/inouts +11933 0/imm32/no-outputs +11934 0/imm32/no-outputs +11935 0x11/imm32/alloc-id:fake +11936 _string_0f_84_jump_label/imm32/subx-name +11937 0/imm32/no-rm32 +11938 0/imm32/no-r32 +11939 0/imm32/no-imm32 +11940 1/imm32/disp32-is-first-inout +11941 0/imm32/no-output 11942 0x11/imm32/alloc-id:fake -11943 _string-break-if-!=/imm32/name -11944 0x11/imm32/alloc-id:fake -11945 Single-lit-var/imm32/inouts -11946 0/imm32/no-outputs -11947 0/imm32/no-outputs +11943 _Primitive-break-if-!=-named/imm32/next +11944 _Primitive-break-if-!=-named: # (payload primitive) +11945 0x11/imm32/alloc-id:fake:payload +11946 0x11/imm32/alloc-id:fake +11947 _string-break-if-!=/imm32/name 11948 0x11/imm32/alloc-id:fake -11949 _string_0f_85_jump_label/imm32/subx-name -11950 0/imm32/no-rm32 -11951 0/imm32/no-r32 -11952 0/imm32/no-imm32 -11953 1/imm32/disp32-is-first-inout -11954 0/imm32/no-output -11955 0x11/imm32/alloc-id:fake -11956 _Primitive-break-if-addr<=-named/imm32/next -11957 _Primitive-break-if-addr<=-named: # (payload primitive) -11958 0x11/imm32/alloc-id:fake:payload +11949 Single-lit-var/imm32/inouts +11950 0/imm32/no-outputs +11951 0/imm32/no-outputs +11952 0x11/imm32/alloc-id:fake +11953 _string_0f_85_jump_label/imm32/subx-name +11954 0/imm32/no-rm32 +11955 0/imm32/no-r32 +11956 0/imm32/no-imm32 +11957 1/imm32/disp32-is-first-inout +11958 0/imm32/no-output 11959 0x11/imm32/alloc-id:fake -11960 _string-break-if-addr<=/imm32/name -11961 0x11/imm32/alloc-id:fake -11962 Single-lit-var/imm32/inouts -11963 0/imm32/no-outputs -11964 0/imm32/no-outputs +11960 _Primitive-break-if-addr<=-named/imm32/next +11961 _Primitive-break-if-addr<=-named: # (payload primitive) +11962 0x11/imm32/alloc-id:fake:payload +11963 0x11/imm32/alloc-id:fake +11964 _string-break-if-addr<=/imm32/name 11965 0x11/imm32/alloc-id:fake -11966 _string_0f_86_jump_label/imm32/subx-name -11967 0/imm32/no-rm32 -11968 0/imm32/no-r32 -11969 0/imm32/no-imm32 -11970 1/imm32/disp32-is-first-inout -11971 0/imm32/no-output -11972 0x11/imm32/alloc-id:fake -11973 _Primitive-break-if-addr>-named/imm32/next -11974 _Primitive-break-if-addr>-named: # (payload primitive) -11975 0x11/imm32/alloc-id:fake:payload +11966 Single-lit-var/imm32/inouts +11967 0/imm32/no-outputs +11968 0/imm32/no-outputs +11969 0x11/imm32/alloc-id:fake +11970 _string_0f_86_jump_label/imm32/subx-name +11971 0/imm32/no-rm32 +11972 0/imm32/no-r32 +11973 0/imm32/no-imm32 +11974 1/imm32/disp32-is-first-inout +11975 0/imm32/no-output 11976 0x11/imm32/alloc-id:fake -11977 _string-break-if-addr>/imm32/name -11978 0x11/imm32/alloc-id:fake -11979 Single-lit-var/imm32/inouts -11980 0/imm32/no-outputs -11981 0/imm32/no-outputs +11977 _Primitive-break-if-addr>-named/imm32/next +11978 _Primitive-break-if-addr>-named: # (payload primitive) +11979 0x11/imm32/alloc-id:fake:payload +11980 0x11/imm32/alloc-id:fake +11981 _string-break-if-addr>/imm32/name 11982 0x11/imm32/alloc-id:fake -11983 _string_0f_87_jump_label/imm32/subx-name -11984 0/imm32/no-rm32 -11985 0/imm32/no-r32 -11986 0/imm32/no-imm32 -11987 1/imm32/disp32-is-first-inout -11988 0/imm32/no-output -11989 0x11/imm32/alloc-id:fake -11990 _Primitive-break-if-<-named/imm32/next -11991 _Primitive-break-if-<-named: # (payload primitive) -11992 0x11/imm32/alloc-id:fake:payload +11983 Single-lit-var/imm32/inouts +11984 0/imm32/no-outputs +11985 0/imm32/no-outputs +11986 0x11/imm32/alloc-id:fake +11987 _string_0f_87_jump_label/imm32/subx-name +11988 0/imm32/no-rm32 +11989 0/imm32/no-r32 +11990 0/imm32/no-imm32 +11991 1/imm32/disp32-is-first-inout +11992 0/imm32/no-output 11993 0x11/imm32/alloc-id:fake -11994 _string-break-if-</imm32/name -11995 0x11/imm32/alloc-id:fake -11996 Single-lit-var/imm32/inouts -11997 0/imm32/no-outputs -11998 0/imm32/no-outputs +11994 _Primitive-break-if-<-named/imm32/next +11995 _Primitive-break-if-<-named: # (payload primitive) +11996 0x11/imm32/alloc-id:fake:payload +11997 0x11/imm32/alloc-id:fake +11998 _string-break-if-</imm32/name 11999 0x11/imm32/alloc-id:fake -12000 _string_0f_8c_jump_label/imm32/subx-name -12001 0/imm32/no-rm32 -12002 0/imm32/no-r32 -12003 0/imm32/no-imm32 -12004 1/imm32/disp32-is-first-inout -12005 0/imm32/no-output -12006 0x11/imm32/alloc-id:fake -12007 _Primitive-break-if->=-named/imm32/next -12008 _Primitive-break-if->=-named: # (payload primitive) -12009 0x11/imm32/alloc-id:fake:payload +12000 Single-lit-var/imm32/inouts +12001 0/imm32/no-outputs +12002 0/imm32/no-outputs +12003 0x11/imm32/alloc-id:fake +12004 _string_0f_8c_jump_label/imm32/subx-name +12005 0/imm32/no-rm32 +12006 0/imm32/no-r32 +12007 0/imm32/no-imm32 +12008 1/imm32/disp32-is-first-inout +12009 0/imm32/no-output 12010 0x11/imm32/alloc-id:fake -12011 _string-break-if->=/imm32/name -12012 0x11/imm32/alloc-id:fake -12013 Single-lit-var/imm32/inouts -12014 0/imm32/no-outputs -12015 0/imm32/no-outputs +12011 _Primitive-break-if->=-named/imm32/next +12012 _Primitive-break-if->=-named: # (payload primitive) +12013 0x11/imm32/alloc-id:fake:payload +12014 0x11/imm32/alloc-id:fake +12015 _string-break-if->=/imm32/name 12016 0x11/imm32/alloc-id:fake -12017 _string_0f_8d_jump_label/imm32/subx-name -12018 0/imm32/no-rm32 -12019 0/imm32/no-r32 -12020 0/imm32/no-imm32 -12021 1/imm32/disp32-is-first-inout -12022 0/imm32/no-output -12023 0x11/imm32/alloc-id:fake -12024 _Primitive-break-if-<=-named/imm32/next -12025 _Primitive-break-if-<=-named: # (payload primitive) -12026 0x11/imm32/alloc-id:fake:payload +12017 Single-lit-var/imm32/inouts +12018 0/imm32/no-outputs +12019 0/imm32/no-outputs +12020 0x11/imm32/alloc-id:fake +12021 _string_0f_8d_jump_label/imm32/subx-name +12022 0/imm32/no-rm32 +12023 0/imm32/no-r32 +12024 0/imm32/no-imm32 +12025 1/imm32/disp32-is-first-inout +12026 0/imm32/no-output 12027 0x11/imm32/alloc-id:fake -12028 _string-break-if-<=/imm32/name -12029 0x11/imm32/alloc-id:fake -12030 Single-lit-var/imm32/inouts -12031 0/imm32/no-outputs -12032 0/imm32/no-outputs +12028 _Primitive-break-if-<=-named/imm32/next +12029 _Primitive-break-if-<=-named: # (payload primitive) +12030 0x11/imm32/alloc-id:fake:payload +12031 0x11/imm32/alloc-id:fake +12032 _string-break-if-<=/imm32/name 12033 0x11/imm32/alloc-id:fake -12034 _string_0f_8e_jump_label/imm32/subx-name -12035 0/imm32/no-rm32 -12036 0/imm32/no-r32 -12037 0/imm32/no-imm32 -12038 1/imm32/disp32-is-first-inout -12039 0/imm32/no-output -12040 0x11/imm32/alloc-id:fake -12041 _Primitive-break-if->-named/imm32/next -12042 _Primitive-break-if->-named: # (payload primitive) -12043 0x11/imm32/alloc-id:fake:payload +12034 Single-lit-var/imm32/inouts +12035 0/imm32/no-outputs +12036 0/imm32/no-outputs +12037 0x11/imm32/alloc-id:fake +12038 _string_0f_8e_jump_label/imm32/subx-name +12039 0/imm32/no-rm32 +12040 0/imm32/no-r32 +12041 0/imm32/no-imm32 +12042 1/imm32/disp32-is-first-inout +12043 0/imm32/no-output 12044 0x11/imm32/alloc-id:fake -12045 _string-break-if->/imm32/name -12046 0x11/imm32/alloc-id:fake -12047 Single-lit-var/imm32/inouts -12048 0/imm32/no-outputs -12049 0/imm32/no-outputs +12045 _Primitive-break-if->-named/imm32/next +12046 _Primitive-break-if->-named: # (payload primitive) +12047 0x11/imm32/alloc-id:fake:payload +12048 0x11/imm32/alloc-id:fake +12049 _string-break-if->/imm32/name 12050 0x11/imm32/alloc-id:fake -12051 _string_0f_8f_jump_label/imm32/subx-name -12052 0/imm32/no-rm32 -12053 0/imm32/no-r32 -12054 0/imm32/no-imm32 -12055 1/imm32/disp32-is-first-inout -12056 0/imm32/no-output -12057 0x11/imm32/alloc-id:fake -12058 _Primitive-break-named/imm32/next -12059 _Primitive-break-named: # (payload primitive) -12060 0x11/imm32/alloc-id:fake:payload +12051 Single-lit-var/imm32/inouts +12052 0/imm32/no-outputs +12053 0/imm32/no-outputs +12054 0x11/imm32/alloc-id:fake +12055 _string_0f_8f_jump_label/imm32/subx-name +12056 0/imm32/no-rm32 +12057 0/imm32/no-r32 +12058 0/imm32/no-imm32 +12059 1/imm32/disp32-is-first-inout +12060 0/imm32/no-output 12061 0x11/imm32/alloc-id:fake -12062 _string-break/imm32/name -12063 0x11/imm32/alloc-id:fake -12064 Single-lit-var/imm32/inouts -12065 0/imm32/no-outputs -12066 0/imm32/no-outputs +12062 _Primitive-break-named/imm32/next +12063 _Primitive-break-named: # (payload primitive) +12064 0x11/imm32/alloc-id:fake:payload +12065 0x11/imm32/alloc-id:fake +12066 _string-break/imm32/name 12067 0x11/imm32/alloc-id:fake -12068 _string_e9_jump_label/imm32/subx-name -12069 0/imm32/no-rm32 -12070 0/imm32/no-r32 -12071 0/imm32/no-imm32 -12072 1/imm32/disp32-is-first-inout -12073 0/imm32/no-output -12074 0x11/imm32/alloc-id:fake -12075 _Primitive-loop-if-addr<-named/imm32/next -12076 _Primitive-loop-if-addr<-named: # (payload primitive) -12077 0x11/imm32/alloc-id:fake:payload +12068 Single-lit-var/imm32/inouts +12069 0/imm32/no-outputs +12070 0/imm32/no-outputs +12071 0x11/imm32/alloc-id:fake +12072 _string_e9_jump_label/imm32/subx-name +12073 0/imm32/no-rm32 +12074 0/imm32/no-r32 +12075 0/imm32/no-imm32 +12076 1/imm32/disp32-is-first-inout +12077 0/imm32/no-output 12078 0x11/imm32/alloc-id:fake -12079 _string-loop-if-addr</imm32/name -12080 0x11/imm32/alloc-id:fake -12081 Single-lit-var/imm32/inouts -12082 0/imm32/no-outputs -12083 0/imm32/no-outputs +12079 _Primitive-loop-if-addr<-named/imm32/next +12080 _Primitive-loop-if-addr<-named: # (payload primitive) +12081 0x11/imm32/alloc-id:fake:payload +12082 0x11/imm32/alloc-id:fake +12083 _string-loop-if-addr</imm32/name 12084 0x11/imm32/alloc-id:fake -12085 _string_0f_82_jump_label/imm32/subx-name -12086 0/imm32/no-rm32 -12087 0/imm32/no-r32 -12088 0/imm32/no-imm32 -12089 1/imm32/disp32-is-first-inout -12090 0/imm32/no-output -12091 0x11/imm32/alloc-id:fake -12092 _Primitive-loop-if-addr>=-named/imm32/next -12093 _Primitive-loop-if-addr>=-named: # (payload primitive) -12094 0x11/imm32/alloc-id:fake:payload +12085 Single-lit-var/imm32/inouts +12086 0/imm32/no-outputs +12087 0/imm32/no-outputs +12088 0x11/imm32/alloc-id:fake +12089 _string_0f_82_jump_label/imm32/subx-name +12090 0/imm32/no-rm32 +12091 0/imm32/no-r32 +12092 0/imm32/no-imm32 +12093 1/imm32/disp32-is-first-inout +12094 0/imm32/no-output 12095 0x11/imm32/alloc-id:fake -12096 _string-loop-if-addr>=/imm32/name -12097 0x11/imm32/alloc-id:fake -12098 Single-lit-var/imm32/inouts -12099 0/imm32/no-outputs -12100 0/imm32/no-outputs +12096 _Primitive-loop-if-addr>=-named/imm32/next +12097 _Primitive-loop-if-addr>=-named: # (payload primitive) +12098 0x11/imm32/alloc-id:fake:payload +12099 0x11/imm32/alloc-id:fake +12100 _string-loop-if-addr>=/imm32/name 12101 0x11/imm32/alloc-id:fake -12102 _string_0f_83_jump_label/imm32/subx-name -12103 0/imm32/no-rm32 -12104 0/imm32/no-r32 -12105 0/imm32/no-imm32 -12106 1/imm32/disp32-is-first-inout -12107 0/imm32/no-output -12108 0x11/imm32/alloc-id:fake -12109 _Primitive-loop-if-=-named/imm32/next -12110 _Primitive-loop-if-=-named: # (payload primitive) -12111 0x11/imm32/alloc-id:fake:payload +12102 Single-lit-var/imm32/inouts +12103 0/imm32/no-outputs +12104 0/imm32/no-outputs +12105 0x11/imm32/alloc-id:fake +12106 _string_0f_83_jump_label/imm32/subx-name +12107 0/imm32/no-rm32 +12108 0/imm32/no-r32 +12109 0/imm32/no-imm32 +12110 1/imm32/disp32-is-first-inout +12111 0/imm32/no-output 12112 0x11/imm32/alloc-id:fake -12113 _string-loop-if-=/imm32/name -12114 0x11/imm32/alloc-id:fake -12115 Single-lit-var/imm32/inouts -12116 0/imm32/no-outputs -12117 0/imm32/no-outputs +12113 _Primitive-loop-if-=-named/imm32/next +12114 _Primitive-loop-if-=-named: # (payload primitive) +12115 0x11/imm32/alloc-id:fake:payload +12116 0x11/imm32/alloc-id:fake +12117 _string-loop-if-=/imm32/name 12118 0x11/imm32/alloc-id:fake -12119 _string_0f_84_jump_label/imm32/subx-name -12120 0/imm32/no-rm32 -12121 0/imm32/no-r32 -12122 0/imm32/no-imm32 -12123 1/imm32/disp32-is-first-inout -12124 0/imm32/no-output -12125 0x11/imm32/alloc-id:fake -12126 _Primitive-loop-if-!=-named/imm32/next -12127 _Primitive-loop-if-!=-named: # (payload primitive) -12128 0x11/imm32/alloc-id:fake:payload +12119 Single-lit-var/imm32/inouts +12120 0/imm32/no-outputs +12121 0/imm32/no-outputs +12122 0x11/imm32/alloc-id:fake +12123 _string_0f_84_jump_label/imm32/subx-name +12124 0/imm32/no-rm32 +12125 0/imm32/no-r32 +12126 0/imm32/no-imm32 +12127 1/imm32/disp32-is-first-inout +12128 0/imm32/no-output 12129 0x11/imm32/alloc-id:fake -12130 _string-loop-if-!=/imm32/name -12131 0x11/imm32/alloc-id:fake -12132 Single-lit-var/imm32/inouts -12133 0/imm32/no-outputs -12134 0/imm32/no-outputs +12130 _Primitive-loop-if-!=-named/imm32/next +12131 _Primitive-loop-if-!=-named: # (payload primitive) +12132 0x11/imm32/alloc-id:fake:payload +12133 0x11/imm32/alloc-id:fake +12134 _string-loop-if-!=/imm32/name 12135 0x11/imm32/alloc-id:fake -12136 _string_0f_85_jump_label/imm32/subx-name -12137 0/imm32/no-rm32 -12138 0/imm32/no-r32 -12139 0/imm32/no-imm32 -12140 1/imm32/disp32-is-first-inout -12141 0/imm32/no-output -12142 0x11/imm32/alloc-id:fake -12143 _Primitive-loop-if-addr<=-named/imm32/next -12144 _Primitive-loop-if-addr<=-named: # (payload primitive) -12145 0x11/imm32/alloc-id:fake:payload +12136 Single-lit-var/imm32/inouts +12137 0/imm32/no-outputs +12138 0/imm32/no-outputs +12139 0x11/imm32/alloc-id:fake +12140 _string_0f_85_jump_label/imm32/subx-name +12141 0/imm32/no-rm32 +12142 0/imm32/no-r32 +12143 0/imm32/no-imm32 +12144 1/imm32/disp32-is-first-inout +12145 0/imm32/no-output 12146 0x11/imm32/alloc-id:fake -12147 _string-loop-if-addr<=/imm32/name -12148 0x11/imm32/alloc-id:fake -12149 Single-lit-var/imm32/inouts -12150 0/imm32/no-outputs -12151 0/imm32/no-outputs +12147 _Primitive-loop-if-addr<=-named/imm32/next +12148 _Primitive-loop-if-addr<=-named: # (payload primitive) +12149 0x11/imm32/alloc-id:fake:payload +12150 0x11/imm32/alloc-id:fake +12151 _string-loop-if-addr<=/imm32/name 12152 0x11/imm32/alloc-id:fake -12153 _string_0f_86_jump_label/imm32/subx-name -12154 0/imm32/no-rm32 -12155 0/imm32/no-r32 -12156 0/imm32/no-imm32 -12157 1/imm32/disp32-is-first-inout -12158 0/imm32/no-output -12159 0x11/imm32/alloc-id:fake -12160 _Primitive-loop-if-addr>-named/imm32/next -12161 _Primitive-loop-if-addr>-named: # (payload primitive) -12162 0x11/imm32/alloc-id:fake:payload +12153 Single-lit-var/imm32/inouts +12154 0/imm32/no-outputs +12155 0/imm32/no-outputs +12156 0x11/imm32/alloc-id:fake +12157 _string_0f_86_jump_label/imm32/subx-name +12158 0/imm32/no-rm32 +12159 0/imm32/no-r32 +12160 0/imm32/no-imm32 +12161 1/imm32/disp32-is-first-inout +12162 0/imm32/no-output 12163 0x11/imm32/alloc-id:fake -12164 _string-loop-if-addr>/imm32/name -12165 0x11/imm32/alloc-id:fake -12166 Single-lit-var/imm32/inouts -12167 0/imm32/no-outputs -12168 0/imm32/no-outputs +12164 _Primitive-loop-if-addr>-named/imm32/next +12165 _Primitive-loop-if-addr>-named: # (payload primitive) +12166 0x11/imm32/alloc-id:fake:payload +12167 0x11/imm32/alloc-id:fake +12168 _string-loop-if-addr>/imm32/name 12169 0x11/imm32/alloc-id:fake -12170 _string_0f_87_jump_label/imm32/subx-name -12171 0/imm32/no-rm32 -12172 0/imm32/no-r32 -12173 0/imm32/no-imm32 -12174 1/imm32/disp32-is-first-inout -12175 0/imm32/no-output -12176 0x11/imm32/alloc-id:fake -12177 _Primitive-loop-if-<-named/imm32/next -12178 _Primitive-loop-if-<-named: # (payload primitive) -12179 0x11/imm32/alloc-id:fake:payload +12170 Single-lit-var/imm32/inouts +12171 0/imm32/no-outputs +12172 0/imm32/no-outputs +12173 0x11/imm32/alloc-id:fake +12174 _string_0f_87_jump_label/imm32/subx-name +12175 0/imm32/no-rm32 +12176 0/imm32/no-r32 +12177 0/imm32/no-imm32 +12178 1/imm32/disp32-is-first-inout +12179 0/imm32/no-output 12180 0x11/imm32/alloc-id:fake -12181 _string-loop-if-</imm32/name -12182 0x11/imm32/alloc-id:fake -12183 Single-lit-var/imm32/inouts -12184 0/imm32/no-outputs -12185 0/imm32/no-outputs +12181 _Primitive-loop-if-<-named/imm32/next +12182 _Primitive-loop-if-<-named: # (payload primitive) +12183 0x11/imm32/alloc-id:fake:payload +12184 0x11/imm32/alloc-id:fake +12185 _string-loop-if-</imm32/name 12186 0x11/imm32/alloc-id:fake -12187 _string_0f_8c_jump_label/imm32/subx-name -12188 0/imm32/no-rm32 -12189 0/imm32/no-r32 -12190 0/imm32/no-imm32 -12191 1/imm32/disp32-is-first-inout -12192 0/imm32/no-output -12193 0x11/imm32/alloc-id:fake -12194 _Primitive-loop-if->=-named/imm32/next -12195 _Primitive-loop-if->=-named: # (payload primitive) -12196 0x11/imm32/alloc-id:fake:payload +12187 Single-lit-var/imm32/inouts +12188 0/imm32/no-outputs +12189 0/imm32/no-outputs +12190 0x11/imm32/alloc-id:fake +12191 _string_0f_8c_jump_label/imm32/subx-name +12192 0/imm32/no-rm32 +12193 0/imm32/no-r32 +12194 0/imm32/no-imm32 +12195 1/imm32/disp32-is-first-inout +12196 0/imm32/no-output 12197 0x11/imm32/alloc-id:fake -12198 _string-loop-if->=/imm32/name -12199 0x11/imm32/alloc-id:fake -12200 Single-lit-var/imm32/inouts -12201 0/imm32/no-outputs -12202 0/imm32/no-outputs +12198 _Primitive-loop-if->=-named/imm32/next +12199 _Primitive-loop-if->=-named: # (payload primitive) +12200 0x11/imm32/alloc-id:fake:payload +12201 0x11/imm32/alloc-id:fake +12202 _string-loop-if->=/imm32/name 12203 0x11/imm32/alloc-id:fake -12204 _string_0f_8d_jump_label/imm32/subx-name -12205 0/imm32/no-rm32 -12206 0/imm32/no-r32 -12207 0/imm32/no-imm32 -12208 1/imm32/disp32-is-first-inout -12209 0/imm32/no-output -12210 0x11/imm32/alloc-id:fake -12211 _Primitive-loop-if-<=-named/imm32/next -12212 _Primitive-loop-if-<=-named: # (payload primitive) -12213 0x11/imm32/alloc-id:fake:payload +12204 Single-lit-var/imm32/inouts +12205 0/imm32/no-outputs +12206 0/imm32/no-outputs +12207 0x11/imm32/alloc-id:fake +12208 _string_0f_8d_jump_label/imm32/subx-name +12209 0/imm32/no-rm32 +12210 0/imm32/no-r32 +12211 0/imm32/no-imm32 +12212 1/imm32/disp32-is-first-inout +12213 0/imm32/no-output 12214 0x11/imm32/alloc-id:fake -12215 _string-loop-if-<=/imm32/name -12216 0x11/imm32/alloc-id:fake -12217 Single-lit-var/imm32/inouts -12218 0/imm32/no-outputs -12219 0/imm32/no-outputs +12215 _Primitive-loop-if-<=-named/imm32/next +12216 _Primitive-loop-if-<=-named: # (payload primitive) +12217 0x11/imm32/alloc-id:fake:payload +12218 0x11/imm32/alloc-id:fake +12219 _string-loop-if-<=/imm32/name 12220 0x11/imm32/alloc-id:fake -12221 _string_0f_8e_jump_label/imm32/subx-name -12222 0/imm32/no-rm32 -12223 0/imm32/no-r32 -12224 0/imm32/no-imm32 -12225 1/imm32/disp32-is-first-inout -12226 0/imm32/no-output -12227 0x11/imm32/alloc-id:fake -12228 _Primitive-loop-if->-named/imm32/next -12229 _Primitive-loop-if->-named: # (payload primitive) -12230 0x11/imm32/alloc-id:fake:payload +12221 Single-lit-var/imm32/inouts +12222 0/imm32/no-outputs +12223 0/imm32/no-outputs +12224 0x11/imm32/alloc-id:fake +12225 _string_0f_8e_jump_label/imm32/subx-name +12226 0/imm32/no-rm32 +12227 0/imm32/no-r32 +12228 0/imm32/no-imm32 +12229 1/imm32/disp32-is-first-inout +12230 0/imm32/no-output 12231 0x11/imm32/alloc-id:fake -12232 _string-loop-if->/imm32/name -12233 0x11/imm32/alloc-id:fake -12234 Single-lit-var/imm32/inouts -12235 0/imm32/no-outputs -12236 0/imm32/no-outputs +12232 _Primitive-loop-if->-named/imm32/next +12233 _Primitive-loop-if->-named: # (payload primitive) +12234 0x11/imm32/alloc-id:fake:payload +12235 0x11/imm32/alloc-id:fake +12236 _string-loop-if->/imm32/name 12237 0x11/imm32/alloc-id:fake -12238 _string_0f_8f_jump_label/imm32/subx-name -12239 0/imm32/no-rm32 -12240 0/imm32/no-r32 -12241 0/imm32/no-imm32 -12242 1/imm32/disp32-is-first-inout -12243 0/imm32/no-output -12244 0x11/imm32/alloc-id:fake -12245 _Primitive-loop-named/imm32/next # we probably don't need an unconditional break -12246 _Primitive-loop-named: # (payload primitive) -12247 0x11/imm32/alloc-id:fake:payload +12238 Single-lit-var/imm32/inouts +12239 0/imm32/no-outputs +12240 0/imm32/no-outputs +12241 0x11/imm32/alloc-id:fake +12242 _string_0f_8f_jump_label/imm32/subx-name +12243 0/imm32/no-rm32 +12244 0/imm32/no-r32 +12245 0/imm32/no-imm32 +12246 1/imm32/disp32-is-first-inout +12247 0/imm32/no-output 12248 0x11/imm32/alloc-id:fake -12249 _string-loop/imm32/name -12250 0x11/imm32/alloc-id:fake -12251 Single-lit-var/imm32/inouts -12252 0/imm32/no-outputs -12253 0/imm32/no-outputs +12249 _Primitive-loop-named/imm32/next # we probably don't need an unconditional break +12250 _Primitive-loop-named: # (payload primitive) +12251 0x11/imm32/alloc-id:fake:payload +12252 0x11/imm32/alloc-id:fake +12253 _string-loop/imm32/name 12254 0x11/imm32/alloc-id:fake -12255 _string_e9_jump_label/imm32/subx-name -12256 0/imm32/no-rm32 -12257 0/imm32/no-r32 -12258 0/imm32/no-imm32 -12259 1/imm32/disp32-is-first-inout -12260 0/imm32/no-output -12261 0/imm32/next -12262 0/imm32/next -12263 -12264 # string literals for Mu instructions -12265 _string-add: # (payload array byte) -12266 0x11/imm32/alloc-id:fake:payload -12267 # "add" -12268 0x3/imm32/size -12269 0x61/a 0x64/d 0x64/d -12270 _string-address: # (payload array byte) -12271 0x11/imm32/alloc-id:fake:payload -12272 # "address" -12273 0x7/imm32/size -12274 0x61/a 0x64/d 0x64/d 0x72/r 0x65/e 0x73/s 0x73/s -12275 _string-add-to: # (payload array byte) -12276 0x11/imm32/alloc-id:fake:payload -12277 # "add-to" -12278 0x6/imm32/size -12279 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o -12280 _string-and: # (payload array byte) -12281 0x11/imm32/alloc-id:fake:payload -12282 # "and" -12283 0x3/imm32/size -12284 0x61/a 0x6e/n 0x64/d -12285 _string-and-with: # (payload array byte) -12286 0x11/imm32/alloc-id:fake:payload -12287 # "and-with" -12288 0x8/imm32/size -12289 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -12290 _string-break: # (payload array byte) -12291 0x11/imm32/alloc-id:fake:payload -12292 # "break" -12293 0x5/imm32/size -12294 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k -12295 _string-break-if-<: # (payload array byte) -12296 0x11/imm32/alloc-id:fake:payload -12297 # "break-if-<" -12298 0xa/imm32/size -12299 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< -12300 _string-break-if-<=: # (payload array byte) -12301 0x11/imm32/alloc-id:fake:payload -12302 # "break-if-<=" -12303 0xb/imm32/size -12304 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= -12305 _string-break-if-=: # (payload array byte) -12306 0x11/imm32/alloc-id:fake:payload -12307 # "break-if-=" -12308 0xa/imm32/size -12309 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= -12310 _string-break-if->: # (payload array byte) -12311 0x11/imm32/alloc-id:fake:payload -12312 # "break-if->" -12313 0xa/imm32/size -12314 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> -12315 _string-break-if->=: # (payload array byte) -12316 0x11/imm32/alloc-id:fake:payload -12317 # "break-if->=" -12318 0xb/imm32/size -12319 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= -12320 _string-break-if-!=: # (payload array byte) -12321 0x11/imm32/alloc-id:fake:payload -12322 # "break-if-!=" -12323 0xb/imm32/size -12324 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= -12325 _string-break-if-addr<: # (payload array byte) -12326 0x11/imm32/alloc-id:fake:payload -12327 # "break-if-addr<" -12328 0xe/imm32/size -12329 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/< -12330 _string-break-if-addr<=: # (payload array byte) -12331 0x11/imm32/alloc-id:fake:payload -12332 # "break-if-addr<=" -12333 0xf/imm32/size -12334 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/= -12335 _string-break-if-addr>: # (payload array byte) -12336 0x11/imm32/alloc-id:fake:payload -12337 # "break-if-addr>" -12338 0xe/imm32/size -12339 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/> -12340 _string-break-if-addr>=: # (payload array byte) -12341 0x11/imm32/alloc-id:fake:payload -12342 # "break-if-addr>=" -12343 0xf/imm32/size -12344 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/= -12345 _string-compare: # (payload array byte) -12346 0x11/imm32/alloc-id:fake:payload -12347 # "compare" -12348 0x7/imm32/size -12349 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e -12350 _string-copy: # (payload array byte) -12351 0x11/imm32/alloc-id:fake:payload -12352 # "copy" -12353 0x4/imm32/size -12354 0x63/c 0x6f/o 0x70/p 0x79/y -12355 _string-copy-to: # (payload array byte) -12356 0x11/imm32/alloc-id:fake:payload -12357 # "copy-to" -12358 0x7/imm32/size -12359 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o -12360 _string-decrement: # (payload array byte) -12361 0x11/imm32/alloc-id:fake:payload -12362 # "decrement" -12363 0x9/imm32/size -12364 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t -12365 _string-increment: # (payload array byte) -12366 0x11/imm32/alloc-id:fake:payload -12367 # "increment" -12368 0x9/imm32/size -12369 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t -12370 _string-loop: # (payload array byte) -12371 0x11/imm32/alloc-id:fake:payload -12372 # "loop" -12373 0x4/imm32/size -12374 0x6c/l 0x6f/o 0x6f/o 0x70/p -12375 _string-loop-if-<: # (payload array byte) -12376 0x11/imm32/alloc-id:fake:payload -12377 # "loop-if-<" -12378 0x9/imm32/size -12379 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< -12380 _string-loop-if-<=: # (payload array byte) -12381 0x11/imm32/alloc-id:fake:payload -12382 # "loop-if-<=" -12383 0xa/imm32/size -12384 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= -12385 _string-loop-if-=: # (payload array byte) -12386 0x11/imm32/alloc-id:fake:payload -12387 # "loop-if-=" -12388 0x9/imm32/size -12389 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= -12390 _string-loop-if->: # (payload array byte) -12391 0x11/imm32/alloc-id:fake:payload -12392 # "loop-if->" -12393 0x9/imm32/size -12394 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> -12395 _string-loop-if->=: # (payload array byte) -12396 0x11/imm32/alloc-id:fake:payload -12397 # "loop-if->=" -12398 0xa/imm32/size -12399 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= -12400 _string-loop-if-!=: # (payload array byte) -12401 0x11/imm32/alloc-id:fake:payload -12402 # "loop-if-!=" -12403 0xa/imm32/size -12404 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= -12405 _string-loop-if-addr<: # (payload array byte) -12406 0x11/imm32/alloc-id:fake:payload -12407 # "loop-if-addr<" -12408 0xd/imm32/size -12409 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/< -12410 _string-loop-if-addr<=: # (payload array byte) -12411 0x11/imm32/alloc-id:fake:payload -12412 # "loop-if-addr<=" -12413 0xe/imm32/size -12414 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/= -12415 _string-loop-if-addr>: # (payload array byte) -12416 0x11/imm32/alloc-id:fake:payload -12417 # "loop-if-addr>" -12418 0xd/imm32/size -12419 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/> -12420 _string-loop-if-addr>=: # (payload array byte) -12421 0x11/imm32/alloc-id:fake:payload -12422 # "loop-if-addr>=" -12423 0xe/imm32/size -12424 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/= -12425 _string-multiply: # (payload array byte) -12426 0x11/imm32/alloc-id:fake:payload -12427 # "multiply" -12428 0x8/imm32/size -12429 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y -12430 _string-or: # (payload array byte) -12431 0x11/imm32/alloc-id:fake:payload -12432 # "or" -12433 0x2/imm32/size -12434 0x6f/o 0x72/r -12435 _string-or-with: # (payload array byte) -12436 0x11/imm32/alloc-id:fake:payload -12437 # "or-with" -12438 0x7/imm32/size -12439 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -12440 _string-subtract: # (payload array byte) -12441 0x11/imm32/alloc-id:fake:payload -12442 # "subtract" -12443 0x8/imm32/size -12444 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t -12445 _string-subtract-from: # (payload array byte) -12446 0x11/imm32/alloc-id:fake:payload -12447 # "subtract-from" -12448 0xd/imm32/size -12449 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 -12450 _string-xor: # (payload array byte) -12451 0x11/imm32/alloc-id:fake:payload -12452 # "xor" -12453 0x3/imm32/size -12454 0x78/x 0x6f/o 0x72/r -12455 _string-xor-with: # (payload array byte) -12456 0x11/imm32/alloc-id:fake:payload -12457 # "xor-with" -12458 0x8/imm32/size -12459 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -12460 -12461 # string literals for SubX instructions -12462 _string_01_add_to: # (payload array byte) -12463 0x11/imm32/alloc-id:fake:payload -12464 # "01/add-to" -12465 0x9/imm32/size -12466 0x30/0 0x31/1 0x2f/slash 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o -12467 _string_03_add: # (payload array byte) -12468 0x11/imm32/alloc-id:fake:payload -12469 # "03/add" -12470 0x6/imm32/size -12471 0x30/0 0x33/3 0x2f/slash 0x61/a 0x64/d 0x64/d -12472 _string_05_add_to_eax: # (payload array byte) -12473 0x11/imm32/alloc-id:fake:payload -12474 # "05/add-to-eax" -12475 0xd/imm32/size -12476 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 -12477 _string_09_or_with: # (payload array byte) -12478 0x11/imm32/alloc-id:fake:payload -12479 # "09/or-with" -12480 0xa/imm32/size -12481 0x30/0 0x39/9 0x2f/slash 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -12482 _string_0b_or: # (payload array byte) -12483 0x11/imm32/alloc-id:fake:payload -12484 # "0b/or" -12485 0x5/imm32/size -12486 0x30/0 0x62/b 0x2f/slash 0x6f/o 0x72/r -12487 _string_0d_or_with_eax: # (payload array byte) -12488 0x11/imm32/alloc-id:fake:payload -12489 # "0d/or-with-eax" -12490 0xe/imm32/size -12491 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 -12492 _string_0f_82_jump_label: # (payload array byte) -12493 0x11/imm32/alloc-id:fake:payload -12494 # "0f 82/jump-if-addr<" -12495 0x13/imm32/size -12496 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/< -12497 _string_0f_82_jump_break: # (payload array byte) -12498 0x11/imm32/alloc-id:fake:payload -12499 # "0f 82/jump-if-addr< break/disp32" -12500 0x20/imm32/size -12501 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 -12502 _string_0f_82_jump_loop: # (payload array byte) -12503 0x11/imm32/alloc-id:fake:payload -12504 # "0f 82/jump-if-addr< loop/disp32" -12505 0x1f/imm32/size -12506 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 -12507 _string_0f_83_jump_label: # (payload array byte) -12508 0x11/imm32/alloc-id:fake:payload -12509 # "0f 83/jump-if-addr>=" -12510 0x14/imm32/size -12511 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/= -12512 _string_0f_83_jump_break: # (payload array byte) -12513 0x11/imm32/alloc-id:fake:payload -12514 # "0f 83/jump-if-addr>= break/disp32" -12515 0x21/imm32/size -12516 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 -12517 _string_0f_83_jump_loop: # (payload array byte) -12518 0x11/imm32/alloc-id:fake:payload -12519 # "0f 83/jump-if-addr>= loop/disp32" -12520 0x20/imm32/size -12521 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 -12522 _string_0f_84_jump_label: # (payload array byte) -12523 0x11/imm32/alloc-id:fake:payload -12524 # "0f 84/jump-if-=" -12525 0xf/imm32/size -12526 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/= -12527 _string_0f_84_jump_break: # (payload array byte) -12528 0x11/imm32/alloc-id:fake:payload -12529 # "0f 84/jump-if-= break/disp32" -12530 0x1c/imm32/size -12531 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 -12532 _string_0f_84_jump_loop: # (payload array byte) -12533 0x11/imm32/alloc-id:fake:payload -12534 # "0f 84/jump-if-= loop/disp32" -12535 0x1b/imm32/size -12536 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 -12537 _string_0f_85_jump_label: # (payload array byte) -12538 0x11/imm32/alloc-id:fake:payload -12539 # "0f 85/jump-if-!=" -12540 0x10/imm32/size -12541 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/= -12542 _string_0f_85_jump_break: # (payload array byte) -12543 0x11/imm32/alloc-id:fake:payload -12544 # "0f 85/jump-if-!= break/disp32" -12545 0x1d/imm32/size -12546 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 -12547 _string_0f_85_jump_loop: # (payload array byte) -12548 0x11/imm32/alloc-id:fake:payload -12549 # "0f 85/jump-if-!= loop/disp32" -12550 0x1c/imm32/size -12551 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 -12552 _string_0f_86_jump_label: # (payload array byte) -12553 0x11/imm32/alloc-id:fake:payload -12554 # "0f 86/jump-if-addr<=" -12555 0x14/imm32/size -12556 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/= -12557 _string_0f_86_jump_break: # (payload array byte) -12558 0x11/imm32/alloc-id:fake:payload -12559 # "0f 86/jump-if-addr<= break/disp32" -12560 0x21/imm32/size -12561 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 -12562 _string_0f_86_jump_loop: # (payload array byte) -12563 0x11/imm32/alloc-id:fake:payload -12564 # "0f 86/jump-if-addr<= loop/disp32" -12565 0x20/imm32/size -12566 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 -12567 _string_0f_87_jump_label: # (payload array byte) -12568 0x11/imm32/alloc-id:fake:payload -12569 # "0f 87/jump-if-addr>" -12570 0x13/imm32/size -12571 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/> -12572 _string_0f_87_jump_break: # (payload array byte) -12573 0x11/imm32/alloc-id:fake:payload -12574 # "0f 87/jump-if-addr> break/disp32" -12575 0x20/imm32/size -12576 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 -12577 _string_0f_87_jump_loop: # (payload array byte) -12578 0x11/imm32/alloc-id:fake:payload -12579 # "0f 87/jump-if-addr> loop/disp32" -12580 0x1f/imm32/size -12581 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 -12582 _string_0f_8c_jump_label: # (payload array byte) -12583 0x11/imm32/alloc-id:fake:payload -12584 # "0f 8c/jump-if-<" -12585 0xf/imm32/size -12586 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/< -12587 _string_0f_8c_jump_break: # (payload array byte) -12588 0x11/imm32/alloc-id:fake:payload -12589 # "0f 8c/jump-if-< break/disp32" -12590 0x1c/imm32/size -12591 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 -12592 _string_0f_8c_jump_loop: # (payload array byte) -12593 0x11/imm32/alloc-id:fake:payload -12594 # "0f 8c/jump-if-< loop/disp32" -12595 0x1b/imm32/size -12596 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 -12597 _string_0f_8d_jump_label: # (payload array byte) -12598 0x11/imm32/alloc-id:fake:payload -12599 # "0f 8d/jump-if->=" -12600 0x10/imm32/size -12601 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/= -12602 _string_0f_8d_jump_break: # (payload array byte) -12603 0x11/imm32/alloc-id:fake:payload -12604 # "0f 8d/jump-if->= break/disp32" -12605 0x1d/imm32/size -12606 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 -12607 _string_0f_8d_jump_loop: # (payload array byte) -12608 0x11/imm32/alloc-id:fake:payload -12609 # "0f 8d/jump-if->= loop/disp32" -12610 0x1c/imm32/size -12611 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 -12612 _string_0f_8e_jump_label: # (payload array byte) -12613 0x11/imm32/alloc-id:fake:payload -12614 # "0f 8e/jump-if-<=" -12615 0x10/imm32/size -12616 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/= -12617 _string_0f_8e_jump_break: # (payload array byte) -12618 0x11/imm32/alloc-id:fake:payload -12619 # "0f 8e/jump-if-<= break/disp32" -12620 0x1d/imm32/size -12621 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 -12622 _string_0f_8e_jump_loop: # (payload array byte) -12623 0x11/imm32/alloc-id:fake:payload -12624 # "0f 8e/jump-if-<= loop/disp32" -12625 0x1c/imm32/size -12626 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 -12627 _string_0f_8f_jump_label: # (payload array byte) -12628 0x11/imm32/alloc-id:fake:payload -12629 # "0f 8f/jump-if->" -12630 0xf/imm32/size -12631 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/> -12632 _string_0f_8f_jump_break: # (payload array byte) -12633 0x11/imm32/alloc-id:fake:payload -12634 # "0f 8f/jump-if-> break/disp32" -12635 0x1c/imm32/size -12636 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 -12637 _string_0f_8f_jump_loop: # (payload array byte) -12638 0x11/imm32/alloc-id:fake:payload -12639 # "0f 8f/jump-if-> loop/disp32" -12640 0x1b/imm32/size -12641 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 -12642 _string_0f_af_multiply: # (payload array byte) -12643 0x11/imm32/alloc-id:fake:payload -12644 # "0f af/multiply" -12645 0xe/imm32/size -12646 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 -12647 _string_21_and_with: # (payload array byte) -12648 0x11/imm32/alloc-id:fake:payload -12649 # "21/and-with" -12650 0xb/imm32/size -12651 0x32/2 0x31/1 0x2f/slash 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -12652 _string_23_and: # (payload array byte) -12653 0x11/imm32/alloc-id:fake:payload -12654 # "23/and" -12655 0x6/imm32/size -12656 0x32/2 0x33/3 0x2f/slash 0x61/a 0x6e/n 0x64/d -12657 _string_25_and_with_eax: # (payload array byte) -12658 0x11/imm32/alloc-id:fake:payload -12659 # "25/and-with-eax" -12660 0xf/imm32/size -12661 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 -12662 _string_29_subtract_from: # (payload array byte) -12663 0x11/imm32/alloc-id:fake:payload -12664 # "29/subtract-from" -12665 0x10/imm32/size -12666 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 -12667 _string_2b_subtract: # (payload array byte) -12668 0x11/imm32/alloc-id:fake:payload -12669 # "2b/subtract" -12670 0xb/imm32/size -12671 0x32/2 0x62/b 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t -12672 _string_2d_subtract_from_eax: # (payload array byte) -12673 0x11/imm32/alloc-id:fake:payload -12674 # "2d/subtract-from-eax" -12675 0x14/imm32/size -12676 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 -12677 _string_31_xor_with: # (payload array byte) -12678 0x11/imm32/alloc-id:fake:payload -12679 # "31/xor-with" -12680 0xb/imm32/size -12681 0x33/3 0x31/1 0x2f/slash 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -12682 _string_33_xor: # (payload array byte) -12683 0x11/imm32/alloc-id:fake:payload -12684 # "33/xor" -12685 0x6/imm32/size -12686 0x33/3 0x33/3 0x2f/slash 0x78/x 0x6f/o 0x72/r -12687 _string_35_xor_with_eax: # (payload array byte) -12688 0x11/imm32/alloc-id:fake:payload -12689 # "35/xor-with-eax" -12690 0xf/imm32/size -12691 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 -12692 _string_39_compare->: # (payload array byte) -12693 0x11/imm32/alloc-id:fake:payload -12694 # "39/compare->" -12695 0xc/imm32/size -12696 0x33/3 0x39/9 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x2d/dash 0x3e/> -12697 _string_3b_compare<-: # (payload array byte) -12698 0x11/imm32/alloc-id:fake:payload -12699 # "3b/compare<-" -12700 0xc/imm32/size -12701 0x33/3 0x62/b 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x3c/< 0x2d/dash -12702 _string_3d_compare_eax_with: # (payload array byte) -12703 0x11/imm32/alloc-id:fake:payload -12704 # "3d/compare-eax-with" -12705 0x13/imm32/size -12706 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 -12707 _string_40_increment_eax: # (payload array byte) -12708 0x11/imm32/alloc-id:fake:payload -12709 # "40/increment-eax" -12710 0x10/imm32/size -12711 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 -12712 _string_41_increment_ecx: # (payload array byte) -12713 0x11/imm32/alloc-id:fake:payload -12714 # "41/increment-ecx" -12715 0x10/imm32/size -12716 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 -12717 _string_42_increment_edx: # (payload array byte) -12718 0x11/imm32/alloc-id:fake:payload -12719 # "42/increment-edx" -12720 0x10/imm32/size -12721 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 -12722 _string_43_increment_ebx: # (payload array byte) -12723 0x11/imm32/alloc-id:fake:payload -12724 # "43/increment-ebx" -12725 0x10/imm32/size -12726 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 -12727 _string_46_increment_esi: # (payload array byte) -12728 0x11/imm32/alloc-id:fake:payload -12729 # "46/increment-esi" -12730 0x10/imm32/size -12731 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 -12732 _string_47_increment_edi: # (payload array byte) -12733 0x11/imm32/alloc-id:fake:payload -12734 # "47/increment-edi" -12735 0x10/imm32/size -12736 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 -12737 _string_48_decrement_eax: # (payload array byte) -12738 0x11/imm32/alloc-id:fake:payload -12739 # "48/decrement-eax" -12740 0x10/imm32/size -12741 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 -12742 _string_49_decrement_ecx: # (payload array byte) -12743 0x11/imm32/alloc-id:fake:payload -12744 # "49/decrement-ecx" -12745 0x10/imm32/size -12746 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 -12747 _string_4a_decrement_edx: # (payload array byte) -12748 0x11/imm32/alloc-id:fake:payload -12749 # "4a/decrement-edx" -12750 0x10/imm32/size -12751 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 -12752 _string_4b_decrement_ebx: # (payload array byte) -12753 0x11/imm32/alloc-id:fake:payload -12754 # "4b/decrement-ebx" -12755 0x10/imm32/size -12756 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 -12757 _string_4e_decrement_esi: # (payload array byte) -12758 0x11/imm32/alloc-id:fake:payload -12759 # "4e/decrement-esi" -12760 0x10/imm32/size -12761 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 -12762 _string_4f_decrement_edi: # (payload array byte) -12763 0x11/imm32/alloc-id:fake:payload -12764 # "4f/decrement-edi" -12765 0x10/imm32/size -12766 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 -12767 _string_81_subop_add: # (payload array byte) -12768 0x11/imm32/alloc-id:fake:payload -12769 # "81 0/subop/add" -12770 0xe/imm32/size -12771 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 -12772 _string_81_subop_or: # (payload array byte) -12773 0x11/imm32/alloc-id:fake:payload -12774 # "81 1/subop/or" -12775 0xd/imm32/size -12776 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 -12777 _string_81_subop_and: # (payload array byte) -12778 0x11/imm32/alloc-id:fake:payload -12779 # "81 4/subop/and" -12780 0xe/imm32/size -12781 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 -12782 _string_81_subop_subtract: # (payload array byte) -12783 0x11/imm32/alloc-id:fake:payload -12784 # "81 5/subop/subtract" -12785 0x13/imm32/size -12786 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 -12787 _string_81_subop_xor: # (payload array byte) -12788 0x11/imm32/alloc-id:fake:payload -12789 # "81 6/subop/xor" -12790 0xe/imm32/size -12791 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 -12792 _string_81_subop_compare: # (payload array byte) -12793 0x11/imm32/alloc-id:fake:payload -12794 # "81 7/subop/compare" -12795 0x12/imm32/size -12796 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 -12797 _string_89_<-: # (payload array byte) -12798 0x11/imm32/alloc-id:fake:payload -12799 # "89/<-" -12800 0x5/imm32/size -12801 0x38/8 0x39/9 0x2f/slash 0x3c/< 0x2d/dash -12802 _string_8b_->: # (payload array byte) -12803 0x11/imm32/alloc-id:fake:payload -12804 # "8b/->" -12805 0x5/imm32/size -12806 0x38/8 0x62/b 0x2f/slash 0x2d/dash 0x3e/> -12807 _string_8d_copy_address: # (payload array byte) -12808 0x11/imm32/alloc-id:fake:payload -12809 # "8d/copy-address" -12810 0xf/imm32/size -12811 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 -12812 _string_b8_copy_to_eax: # (payload array byte) -12813 0x11/imm32/alloc-id:fake:payload -12814 # "b8/copy-to-eax" -12815 0xe/imm32/size -12816 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 -12817 _string_b9_copy_to_ecx: # (payload array byte) -12818 0x11/imm32/alloc-id:fake:payload -12819 # "b9/copy-to-ecx" -12820 0xe/imm32/size -12821 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 -12822 _string_ba_copy_to_edx: # (payload array byte) -12823 0x11/imm32/alloc-id:fake:payload -12824 # "ba/copy-to-edx" -12825 0xe/imm32/size -12826 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 -12827 _string_bb_copy_to_ebx: # (payload array byte) -12828 0x11/imm32/alloc-id:fake:payload -12829 # "bb/copy-to-ebx" -12830 0xe/imm32/size -12831 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 -12832 _string_be_copy_to_esi: # (payload array byte) -12833 0x11/imm32/alloc-id:fake:payload -12834 # "be/copy-to-esi" -12835 0xe/imm32/size -12836 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 -12837 _string_bf_copy_to_edi: # (payload array byte) -12838 0x11/imm32/alloc-id:fake:payload -12839 # "bf/copy-to-edi" -12840 0xe/imm32/size -12841 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 -12842 _string_c7_subop_copy: # (payload array byte) -12843 0x11/imm32/alloc-id:fake:payload -12844 # "c7 0/subop/copy" -12845 0xf/imm32/size -12846 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 -12847 _string_e9_jump_label: # (payload array byte) -12848 0x11/imm32/alloc-id:fake:payload -12849 # "e9/jump" -12850 0x7/imm32/size -12851 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p -12852 _string_e9_jump_break: # (payload array byte) -12853 0x11/imm32/alloc-id:fake:payload -12854 # "e9/jump break/disp32" -12855 0x14/imm32/size -12856 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 -12857 _string_e9_jump_loop: # (payload array byte) -12858 0x11/imm32/alloc-id:fake:payload -12859 # "e9/jump loop/disp32" -12860 0x13/imm32/size -12861 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 -12862 _string_ff_subop_increment: # (payload array byte) -12863 0x11/imm32/alloc-id:fake:payload -12864 # "ff 0/subop/increment" -12865 0x14/imm32/size -12866 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 -12867 _string_ff_subop_decrement: # (payload array byte) -12868 0x11/imm32/alloc-id:fake:payload -12869 # "ff 1/subop/decrement" -12870 0x14/imm32/size -12871 0x66/f 0x66/f 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 -12872 -12873 Single-int-var-in-mem: # (payload list var) -12874 0x11/imm32/alloc-id:fake:payload -12875 0x11/imm32/alloc-id:fake -12876 Int-var-in-mem/imm32 -12877 0/imm32/next -12878 0/imm32/next -12879 -12880 Int-var-in-mem: # (payload var) -12881 0x11/imm32/alloc-id:fake:payload -12882 0/imm32/name -12883 0/imm32/name -12884 0x11/imm32/alloc-id:fake -12885 Type-int/imm32 -12886 1/imm32/some-block-depth -12887 1/imm32/some-stack-offset -12888 0/imm32/no-register -12889 0/imm32/no-register -12890 -12891 Two-args-int-stack-int-reg: # (payload list var) -12892 0x11/imm32/alloc-id:fake:payload -12893 0x11/imm32/alloc-id:fake -12894 Int-var-in-mem/imm32 -12895 0x11/imm32/alloc-id:fake -12896 Single-int-var-in-some-register/imm32/next -12897 -12898 Two-args-int-reg-int-stack: # (payload list var) -12899 0x11/imm32/alloc-id:fake:payload -12900 0x11/imm32/alloc-id:fake -12901 Int-var-in-some-register/imm32 -12902 0x11/imm32/alloc-id:fake -12903 Single-int-var-in-mem/imm32/next -12904 -12905 Two-args-int-eax-int-literal: # (payload list var) -12906 0x11/imm32/alloc-id:fake:payload -12907 0x11/imm32/alloc-id:fake -12908 Int-var-in-eax/imm32 -12909 0x11/imm32/alloc-id:fake -12910 Single-lit-var/imm32/next -12911 -12912 Int-var-and-literal: # (payload list var) -12913 0x11/imm32/alloc-id:fake:payload -12914 0x11/imm32/alloc-id:fake -12915 Int-var-in-mem/imm32 -12916 0x11/imm32/alloc-id:fake -12917 Single-lit-var/imm32/next -12918 -12919 Int-var-in-register-and-literal: # (payload list var) -12920 0x11/imm32/alloc-id:fake:payload -12921 0x11/imm32/alloc-id:fake -12922 Int-var-in-some-register/imm32 -12923 0x11/imm32/alloc-id:fake -12924 Single-lit-var/imm32/next -12925 -12926 Single-int-var-in-some-register: # (payload list var) -12927 0x11/imm32/alloc-id:fake:payload -12928 0x11/imm32/alloc-id:fake -12929 Int-var-in-some-register/imm32 -12930 0/imm32/next -12931 0/imm32/next -12932 -12933 Single-addr-var-in-some-register: # (payload list var) -12934 0x11/imm32/alloc-id:fake:payload -12935 0x11/imm32/alloc-id:fake -12936 Addr-var-in-some-register/imm32 -12937 0/imm32/next -12938 0/imm32/next -12939 -12940 Int-var-in-some-register: # (payload var) -12941 0x11/imm32/alloc-id:fake:payload -12942 0/imm32/name -12943 0/imm32/name -12944 0x11/imm32/alloc-id:fake -12945 Type-int/imm32 -12946 1/imm32/some-block-depth -12947 0/imm32/no-stack-offset +12255 Single-lit-var/imm32/inouts +12256 0/imm32/no-outputs +12257 0/imm32/no-outputs +12258 0x11/imm32/alloc-id:fake +12259 _string_e9_jump_label/imm32/subx-name +12260 0/imm32/no-rm32 +12261 0/imm32/no-r32 +12262 0/imm32/no-imm32 +12263 1/imm32/disp32-is-first-inout +12264 0/imm32/no-output +12265 0/imm32/next +12266 0/imm32/next +12267 +12268 # string literals for Mu instructions +12269 _string-add: # (payload array byte) +12270 0x11/imm32/alloc-id:fake:payload +12271 # "add" +12272 0x3/imm32/size +12273 0x61/a 0x64/d 0x64/d +12274 _string-address: # (payload array byte) +12275 0x11/imm32/alloc-id:fake:payload +12276 # "address" +12277 0x7/imm32/size +12278 0x61/a 0x64/d 0x64/d 0x72/r 0x65/e 0x73/s 0x73/s +12279 _string-add-to: # (payload array byte) +12280 0x11/imm32/alloc-id:fake:payload +12281 # "add-to" +12282 0x6/imm32/size +12283 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o +12284 _string-and: # (payload array byte) +12285 0x11/imm32/alloc-id:fake:payload +12286 # "and" +12287 0x3/imm32/size +12288 0x61/a 0x6e/n 0x64/d +12289 _string-and-with: # (payload array byte) +12290 0x11/imm32/alloc-id:fake:payload +12291 # "and-with" +12292 0x8/imm32/size +12293 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +12294 _string-break: # (payload array byte) +12295 0x11/imm32/alloc-id:fake:payload +12296 # "break" +12297 0x5/imm32/size +12298 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k +12299 _string-break-if-<: # (payload array byte) +12300 0x11/imm32/alloc-id:fake:payload +12301 # "break-if-<" +12302 0xa/imm32/size +12303 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< +12304 _string-break-if-<=: # (payload array byte) +12305 0x11/imm32/alloc-id:fake:payload +12306 # "break-if-<=" +12307 0xb/imm32/size +12308 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= +12309 _string-break-if-=: # (payload array byte) +12310 0x11/imm32/alloc-id:fake:payload +12311 # "break-if-=" +12312 0xa/imm32/size +12313 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= +12314 _string-break-if->: # (payload array byte) +12315 0x11/imm32/alloc-id:fake:payload +12316 # "break-if->" +12317 0xa/imm32/size +12318 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> +12319 _string-break-if->=: # (payload array byte) +12320 0x11/imm32/alloc-id:fake:payload +12321 # "break-if->=" +12322 0xb/imm32/size +12323 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= +12324 _string-break-if-!=: # (payload array byte) +12325 0x11/imm32/alloc-id:fake:payload +12326 # "break-if-!=" +12327 0xb/imm32/size +12328 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= +12329 _string-break-if-addr<: # (payload array byte) +12330 0x11/imm32/alloc-id:fake:payload +12331 # "break-if-addr<" +12332 0xe/imm32/size +12333 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/< +12334 _string-break-if-addr<=: # (payload array byte) +12335 0x11/imm32/alloc-id:fake:payload +12336 # "break-if-addr<=" +12337 0xf/imm32/size +12338 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/= +12339 _string-break-if-addr>: # (payload array byte) +12340 0x11/imm32/alloc-id:fake:payload +12341 # "break-if-addr>" +12342 0xe/imm32/size +12343 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/> +12344 _string-break-if-addr>=: # (payload array byte) +12345 0x11/imm32/alloc-id:fake:payload +12346 # "break-if-addr>=" +12347 0xf/imm32/size +12348 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/= +12349 _string-compare: # (payload array byte) +12350 0x11/imm32/alloc-id:fake:payload +12351 # "compare" +12352 0x7/imm32/size +12353 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e +12354 _string-copy: # (payload array byte) +12355 0x11/imm32/alloc-id:fake:payload +12356 # "copy" +12357 0x4/imm32/size +12358 0x63/c 0x6f/o 0x70/p 0x79/y +12359 _string-copy-to: # (payload array byte) +12360 0x11/imm32/alloc-id:fake:payload +12361 # "copy-to" +12362 0x7/imm32/size +12363 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o +12364 _string-decrement: # (payload array byte) +12365 0x11/imm32/alloc-id:fake:payload +12366 # "decrement" +12367 0x9/imm32/size +12368 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t +12369 _string-increment: # (payload array byte) +12370 0x11/imm32/alloc-id:fake:payload +12371 # "increment" +12372 0x9/imm32/size +12373 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t +12374 _string-loop: # (payload array byte) +12375 0x11/imm32/alloc-id:fake:payload +12376 # "loop" +12377 0x4/imm32/size +12378 0x6c/l 0x6f/o 0x6f/o 0x70/p +12379 _string-loop-if-<: # (payload array byte) +12380 0x11/imm32/alloc-id:fake:payload +12381 # "loop-if-<" +12382 0x9/imm32/size +12383 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< +12384 _string-loop-if-<=: # (payload array byte) +12385 0x11/imm32/alloc-id:fake:payload +12386 # "loop-if-<=" +12387 0xa/imm32/size +12388 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= +12389 _string-loop-if-=: # (payload array byte) +12390 0x11/imm32/alloc-id:fake:payload +12391 # "loop-if-=" +12392 0x9/imm32/size +12393 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= +12394 _string-loop-if->: # (payload array byte) +12395 0x11/imm32/alloc-id:fake:payload +12396 # "loop-if->" +12397 0x9/imm32/size +12398 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> +12399 _string-loop-if->=: # (payload array byte) +12400 0x11/imm32/alloc-id:fake:payload +12401 # "loop-if->=" +12402 0xa/imm32/size +12403 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= +12404 _string-loop-if-!=: # (payload array byte) +12405 0x11/imm32/alloc-id:fake:payload +12406 # "loop-if-!=" +12407 0xa/imm32/size +12408 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= +12409 _string-loop-if-addr<: # (payload array byte) +12410 0x11/imm32/alloc-id:fake:payload +12411 # "loop-if-addr<" +12412 0xd/imm32/size +12413 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/< +12414 _string-loop-if-addr<=: # (payload array byte) +12415 0x11/imm32/alloc-id:fake:payload +12416 # "loop-if-addr<=" +12417 0xe/imm32/size +12418 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/= +12419 _string-loop-if-addr>: # (payload array byte) +12420 0x11/imm32/alloc-id:fake:payload +12421 # "loop-if-addr>" +12422 0xd/imm32/size +12423 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/> +12424 _string-loop-if-addr>=: # (payload array byte) +12425 0x11/imm32/alloc-id:fake:payload +12426 # "loop-if-addr>=" +12427 0xe/imm32/size +12428 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/= +12429 _string-multiply: # (payload array byte) +12430 0x11/imm32/alloc-id:fake:payload +12431 # "multiply" +12432 0x8/imm32/size +12433 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y +12434 _string-or: # (payload array byte) +12435 0x11/imm32/alloc-id:fake:payload +12436 # "or" +12437 0x2/imm32/size +12438 0x6f/o 0x72/r +12439 _string-or-with: # (payload array byte) +12440 0x11/imm32/alloc-id:fake:payload +12441 # "or-with" +12442 0x7/imm32/size +12443 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +12444 _string-subtract: # (payload array byte) +12445 0x11/imm32/alloc-id:fake:payload +12446 # "subtract" +12447 0x8/imm32/size +12448 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t +12449 _string-subtract-from: # (payload array byte) +12450 0x11/imm32/alloc-id:fake:payload +12451 # "subtract-from" +12452 0xd/imm32/size +12453 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 +12454 _string-xor: # (payload array byte) +12455 0x11/imm32/alloc-id:fake:payload +12456 # "xor" +12457 0x3/imm32/size +12458 0x78/x 0x6f/o 0x72/r +12459 _string-xor-with: # (payload array byte) +12460 0x11/imm32/alloc-id:fake:payload +12461 # "xor-with" +12462 0x8/imm32/size +12463 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +12464 +12465 # string literals for SubX instructions +12466 _string_01_add_to: # (payload array byte) +12467 0x11/imm32/alloc-id:fake:payload +12468 # "01/add-to" +12469 0x9/imm32/size +12470 0x30/0 0x31/1 0x2f/slash 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o +12471 _string_03_add: # (payload array byte) +12472 0x11/imm32/alloc-id:fake:payload +12473 # "03/add" +12474 0x6/imm32/size +12475 0x30/0 0x33/3 0x2f/slash 0x61/a 0x64/d 0x64/d +12476 _string_05_add_to_eax: # (payload array byte) +12477 0x11/imm32/alloc-id:fake:payload +12478 # "05/add-to-eax" +12479 0xd/imm32/size +12480 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 +12481 _string_09_or_with: # (payload array byte) +12482 0x11/imm32/alloc-id:fake:payload +12483 # "09/or-with" +12484 0xa/imm32/size +12485 0x30/0 0x39/9 0x2f/slash 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +12486 _string_0b_or: # (payload array byte) +12487 0x11/imm32/alloc-id:fake:payload +12488 # "0b/or" +12489 0x5/imm32/size +12490 0x30/0 0x62/b 0x2f/slash 0x6f/o 0x72/r +12491 _string_0d_or_with_eax: # (payload array byte) +12492 0x11/imm32/alloc-id:fake:payload +12493 # "0d/or-with-eax" +12494 0xe/imm32/size +12495 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 +12496 _string_0f_82_jump_label: # (payload array byte) +12497 0x11/imm32/alloc-id:fake:payload +12498 # "0f 82/jump-if-addr<" +12499 0x13/imm32/size +12500 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/< +12501 _string_0f_82_jump_break: # (payload array byte) +12502 0x11/imm32/alloc-id:fake:payload +12503 # "0f 82/jump-if-addr< break/disp32" +12504 0x20/imm32/size +12505 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 +12506 _string_0f_82_jump_loop: # (payload array byte) +12507 0x11/imm32/alloc-id:fake:payload +12508 # "0f 82/jump-if-addr< loop/disp32" +12509 0x1f/imm32/size +12510 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 +12511 _string_0f_83_jump_label: # (payload array byte) +12512 0x11/imm32/alloc-id:fake:payload +12513 # "0f 83/jump-if-addr>=" +12514 0x14/imm32/size +12515 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/= +12516 _string_0f_83_jump_break: # (payload array byte) +12517 0x11/imm32/alloc-id:fake:payload +12518 # "0f 83/jump-if-addr>= break/disp32" +12519 0x21/imm32/size +12520 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 +12521 _string_0f_83_jump_loop: # (payload array byte) +12522 0x11/imm32/alloc-id:fake:payload +12523 # "0f 83/jump-if-addr>= loop/disp32" +12524 0x20/imm32/size +12525 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 +12526 _string_0f_84_jump_label: # (payload array byte) +12527 0x11/imm32/alloc-id:fake:payload +12528 # "0f 84/jump-if-=" +12529 0xf/imm32/size +12530 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/= +12531 _string_0f_84_jump_break: # (payload array byte) +12532 0x11/imm32/alloc-id:fake:payload +12533 # "0f 84/jump-if-= break/disp32" +12534 0x1c/imm32/size +12535 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 +12536 _string_0f_84_jump_loop: # (payload array byte) +12537 0x11/imm32/alloc-id:fake:payload +12538 # "0f 84/jump-if-= loop/disp32" +12539 0x1b/imm32/size +12540 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 +12541 _string_0f_85_jump_label: # (payload array byte) +12542 0x11/imm32/alloc-id:fake:payload +12543 # "0f 85/jump-if-!=" +12544 0x10/imm32/size +12545 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/= +12546 _string_0f_85_jump_break: # (payload array byte) +12547 0x11/imm32/alloc-id:fake:payload +12548 # "0f 85/jump-if-!= break/disp32" +12549 0x1d/imm32/size +12550 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 +12551 _string_0f_85_jump_loop: # (payload array byte) +12552 0x11/imm32/alloc-id:fake:payload +12553 # "0f 85/jump-if-!= loop/disp32" +12554 0x1c/imm32/size +12555 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 +12556 _string_0f_86_jump_label: # (payload array byte) +12557 0x11/imm32/alloc-id:fake:payload +12558 # "0f 86/jump-if-addr<=" +12559 0x14/imm32/size +12560 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/= +12561 _string_0f_86_jump_break: # (payload array byte) +12562 0x11/imm32/alloc-id:fake:payload +12563 # "0f 86/jump-if-addr<= break/disp32" +12564 0x21/imm32/size +12565 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 +12566 _string_0f_86_jump_loop: # (payload array byte) +12567 0x11/imm32/alloc-id:fake:payload +12568 # "0f 86/jump-if-addr<= loop/disp32" +12569 0x20/imm32/size +12570 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 +12571 _string_0f_87_jump_label: # (payload array byte) +12572 0x11/imm32/alloc-id:fake:payload +12573 # "0f 87/jump-if-addr>" +12574 0x13/imm32/size +12575 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/> +12576 _string_0f_87_jump_break: # (payload array byte) +12577 0x11/imm32/alloc-id:fake:payload +12578 # "0f 87/jump-if-addr> break/disp32" +12579 0x20/imm32/size +12580 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 +12581 _string_0f_87_jump_loop: # (payload array byte) +12582 0x11/imm32/alloc-id:fake:payload +12583 # "0f 87/jump-if-addr> loop/disp32" +12584 0x1f/imm32/size +12585 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 +12586 _string_0f_8c_jump_label: # (payload array byte) +12587 0x11/imm32/alloc-id:fake:payload +12588 # "0f 8c/jump-if-<" +12589 0xf/imm32/size +12590 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/< +12591 _string_0f_8c_jump_break: # (payload array byte) +12592 0x11/imm32/alloc-id:fake:payload +12593 # "0f 8c/jump-if-< break/disp32" +12594 0x1c/imm32/size +12595 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 +12596 _string_0f_8c_jump_loop: # (payload array byte) +12597 0x11/imm32/alloc-id:fake:payload +12598 # "0f 8c/jump-if-< loop/disp32" +12599 0x1b/imm32/size +12600 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 +12601 _string_0f_8d_jump_label: # (payload array byte) +12602 0x11/imm32/alloc-id:fake:payload +12603 # "0f 8d/jump-if->=" +12604 0x10/imm32/size +12605 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/= +12606 _string_0f_8d_jump_break: # (payload array byte) +12607 0x11/imm32/alloc-id:fake:payload +12608 # "0f 8d/jump-if->= break/disp32" +12609 0x1d/imm32/size +12610 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 +12611 _string_0f_8d_jump_loop: # (payload array byte) +12612 0x11/imm32/alloc-id:fake:payload +12613 # "0f 8d/jump-if->= loop/disp32" +12614 0x1c/imm32/size +12615 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 +12616 _string_0f_8e_jump_label: # (payload array byte) +12617 0x11/imm32/alloc-id:fake:payload +12618 # "0f 8e/jump-if-<=" +12619 0x10/imm32/size +12620 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/= +12621 _string_0f_8e_jump_break: # (payload array byte) +12622 0x11/imm32/alloc-id:fake:payload +12623 # "0f 8e/jump-if-<= break/disp32" +12624 0x1d/imm32/size +12625 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 +12626 _string_0f_8e_jump_loop: # (payload array byte) +12627 0x11/imm32/alloc-id:fake:payload +12628 # "0f 8e/jump-if-<= loop/disp32" +12629 0x1c/imm32/size +12630 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 +12631 _string_0f_8f_jump_label: # (payload array byte) +12632 0x11/imm32/alloc-id:fake:payload +12633 # "0f 8f/jump-if->" +12634 0xf/imm32/size +12635 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/> +12636 _string_0f_8f_jump_break: # (payload array byte) +12637 0x11/imm32/alloc-id:fake:payload +12638 # "0f 8f/jump-if-> break/disp32" +12639 0x1c/imm32/size +12640 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 +12641 _string_0f_8f_jump_loop: # (payload array byte) +12642 0x11/imm32/alloc-id:fake:payload +12643 # "0f 8f/jump-if-> loop/disp32" +12644 0x1b/imm32/size +12645 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 +12646 _string_0f_af_multiply: # (payload array byte) +12647 0x11/imm32/alloc-id:fake:payload +12648 # "0f af/multiply" +12649 0xe/imm32/size +12650 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 +12651 _string_21_and_with: # (payload array byte) +12652 0x11/imm32/alloc-id:fake:payload +12653 # "21/and-with" +12654 0xb/imm32/size +12655 0x32/2 0x31/1 0x2f/slash 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +12656 _string_23_and: # (payload array byte) +12657 0x11/imm32/alloc-id:fake:payload +12658 # "23/and" +12659 0x6/imm32/size +12660 0x32/2 0x33/3 0x2f/slash 0x61/a 0x6e/n 0x64/d +12661 _string_25_and_with_eax: # (payload array byte) +12662 0x11/imm32/alloc-id:fake:payload +12663 # "25/and-with-eax" +12664 0xf/imm32/size +12665 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 +12666 _string_29_subtract_from: # (payload array byte) +12667 0x11/imm32/alloc-id:fake:payload +12668 # "29/subtract-from" +12669 0x10/imm32/size +12670 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 +12671 _string_2b_subtract: # (payload array byte) +12672 0x11/imm32/alloc-id:fake:payload +12673 # "2b/subtract" +12674 0xb/imm32/size +12675 0x32/2 0x62/b 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t +12676 _string_2d_subtract_from_eax: # (payload array byte) +12677 0x11/imm32/alloc-id:fake:payload +12678 # "2d/subtract-from-eax" +12679 0x14/imm32/size +12680 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 +12681 _string_31_xor_with: # (payload array byte) +12682 0x11/imm32/alloc-id:fake:payload +12683 # "31/xor-with" +12684 0xb/imm32/size +12685 0x33/3 0x31/1 0x2f/slash 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +12686 _string_33_xor: # (payload array byte) +12687 0x11/imm32/alloc-id:fake:payload +12688 # "33/xor" +12689 0x6/imm32/size +12690 0x33/3 0x33/3 0x2f/slash 0x78/x 0x6f/o 0x72/r +12691 _string_35_xor_with_eax: # (payload array byte) +12692 0x11/imm32/alloc-id:fake:payload +12693 # "35/xor-with-eax" +12694 0xf/imm32/size +12695 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 +12696 _string_39_compare->: # (payload array byte) +12697 0x11/imm32/alloc-id:fake:payload +12698 # "39/compare->" +12699 0xc/imm32/size +12700 0x33/3 0x39/9 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x2d/dash 0x3e/> +12701 _string_3b_compare<-: # (payload array byte) +12702 0x11/imm32/alloc-id:fake:payload +12703 # "3b/compare<-" +12704 0xc/imm32/size +12705 0x33/3 0x62/b 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x3c/< 0x2d/dash +12706 _string_3d_compare_eax_with: # (payload array byte) +12707 0x11/imm32/alloc-id:fake:payload +12708 # "3d/compare-eax-with" +12709 0x13/imm32/size +12710 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 +12711 _string_40_increment_eax: # (payload array byte) +12712 0x11/imm32/alloc-id:fake:payload +12713 # "40/increment-eax" +12714 0x10/imm32/size +12715 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 +12716 _string_41_increment_ecx: # (payload array byte) +12717 0x11/imm32/alloc-id:fake:payload +12718 # "41/increment-ecx" +12719 0x10/imm32/size +12720 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 +12721 _string_42_increment_edx: # (payload array byte) +12722 0x11/imm32/alloc-id:fake:payload +12723 # "42/increment-edx" +12724 0x10/imm32/size +12725 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 +12726 _string_43_increment_ebx: # (payload array byte) +12727 0x11/imm32/alloc-id:fake:payload +12728 # "43/increment-ebx" +12729 0x10/imm32/size +12730 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 +12731 _string_46_increment_esi: # (payload array byte) +12732 0x11/imm32/alloc-id:fake:payload +12733 # "46/increment-esi" +12734 0x10/imm32/size +12735 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 +12736 _string_47_increment_edi: # (payload array byte) +12737 0x11/imm32/alloc-id:fake:payload +12738 # "47/increment-edi" +12739 0x10/imm32/size +12740 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 +12741 _string_48_decrement_eax: # (payload array byte) +12742 0x11/imm32/alloc-id:fake:payload +12743 # "48/decrement-eax" +12744 0x10/imm32/size +12745 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 +12746 _string_49_decrement_ecx: # (payload array byte) +12747 0x11/imm32/alloc-id:fake:payload +12748 # "49/decrement-ecx" +12749 0x10/imm32/size +12750 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 +12751 _string_4a_decrement_edx: # (payload array byte) +12752 0x11/imm32/alloc-id:fake:payload +12753 # "4a/decrement-edx" +12754 0x10/imm32/size +12755 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 +12756 _string_4b_decrement_ebx: # (payload array byte) +12757 0x11/imm32/alloc-id:fake:payload +12758 # "4b/decrement-ebx" +12759 0x10/imm32/size +12760 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 +12761 _string_4e_decrement_esi: # (payload array byte) +12762 0x11/imm32/alloc-id:fake:payload +12763 # "4e/decrement-esi" +12764 0x10/imm32/size +12765 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 +12766 _string_4f_decrement_edi: # (payload array byte) +12767 0x11/imm32/alloc-id:fake:payload +12768 # "4f/decrement-edi" +12769 0x10/imm32/size +12770 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 +12771 _string_81_subop_add: # (payload array byte) +12772 0x11/imm32/alloc-id:fake:payload +12773 # "81 0/subop/add" +12774 0xe/imm32/size +12775 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 +12776 _string_81_subop_or: # (payload array byte) +12777 0x11/imm32/alloc-id:fake:payload +12778 # "81 1/subop/or" +12779 0xd/imm32/size +12780 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 +12781 _string_81_subop_and: # (payload array byte) +12782 0x11/imm32/alloc-id:fake:payload +12783 # "81 4/subop/and" +12784 0xe/imm32/size +12785 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 +12786 _string_81_subop_subtract: # (payload array byte) +12787 0x11/imm32/alloc-id:fake:payload +12788 # "81 5/subop/subtract" +12789 0x13/imm32/size +12790 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 +12791 _string_81_subop_xor: # (payload array byte) +12792 0x11/imm32/alloc-id:fake:payload +12793 # "81 6/subop/xor" +12794 0xe/imm32/size +12795 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 +12796 _string_81_subop_compare: # (payload array byte) +12797 0x11/imm32/alloc-id:fake:payload +12798 # "81 7/subop/compare" +12799 0x12/imm32/size +12800 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 +12801 _string_89_<-: # (payload array byte) +12802 0x11/imm32/alloc-id:fake:payload +12803 # "89/<-" +12804 0x5/imm32/size +12805 0x38/8 0x39/9 0x2f/slash 0x3c/< 0x2d/dash +12806 _string_8b_->: # (payload array byte) +12807 0x11/imm32/alloc-id:fake:payload +12808 # "8b/->" +12809 0x5/imm32/size +12810 0x38/8 0x62/b 0x2f/slash 0x2d/dash 0x3e/> +12811 _string_8d_copy_address: # (payload array byte) +12812 0x11/imm32/alloc-id:fake:payload +12813 # "8d/copy-address" +12814 0xf/imm32/size +12815 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 +12816 _string_b8_copy_to_eax: # (payload array byte) +12817 0x11/imm32/alloc-id:fake:payload +12818 # "b8/copy-to-eax" +12819 0xe/imm32/size +12820 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 +12821 _string_b9_copy_to_ecx: # (payload array byte) +12822 0x11/imm32/alloc-id:fake:payload +12823 # "b9/copy-to-ecx" +12824 0xe/imm32/size +12825 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 +12826 _string_ba_copy_to_edx: # (payload array byte) +12827 0x11/imm32/alloc-id:fake:payload +12828 # "ba/copy-to-edx" +12829 0xe/imm32/size +12830 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 +12831 _string_bb_copy_to_ebx: # (payload array byte) +12832 0x11/imm32/alloc-id:fake:payload +12833 # "bb/copy-to-ebx" +12834 0xe/imm32/size +12835 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 +12836 _string_be_copy_to_esi: # (payload array byte) +12837 0x11/imm32/alloc-id:fake:payload +12838 # "be/copy-to-esi" +12839 0xe/imm32/size +12840 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 +12841 _string_bf_copy_to_edi: # (payload array byte) +12842 0x11/imm32/alloc-id:fake:payload +12843 # "bf/copy-to-edi" +12844 0xe/imm32/size +12845 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 +12846 _string_c7_subop_copy: # (payload array byte) +12847 0x11/imm32/alloc-id:fake:payload +12848 # "c7 0/subop/copy" +12849 0xf/imm32/size +12850 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 +12851 _string_e9_jump_label: # (payload array byte) +12852 0x11/imm32/alloc-id:fake:payload +12853 # "e9/jump" +12854 0x7/imm32/size +12855 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p +12856 _string_e9_jump_break: # (payload array byte) +12857 0x11/imm32/alloc-id:fake:payload +12858 # "e9/jump break/disp32" +12859 0x14/imm32/size +12860 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 +12861 _string_e9_jump_loop: # (payload array byte) +12862 0x11/imm32/alloc-id:fake:payload +12863 # "e9/jump loop/disp32" +12864 0x13/imm32/size +12865 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 +12866 _string_ff_subop_increment: # (payload array byte) +12867 0x11/imm32/alloc-id:fake:payload +12868 # "ff 0/subop/increment" +12869 0x14/imm32/size +12870 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 +12871 _string_ff_subop_decrement: # (payload array byte) +12872 0x11/imm32/alloc-id:fake:payload +12873 # "ff 1/subop/decrement" +12874 0x14/imm32/size +12875 0x66/f 0x66/f 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 +12876 +12877 Single-int-var-in-mem: # (payload list var) +12878 0x11/imm32/alloc-id:fake:payload +12879 0x11/imm32/alloc-id:fake +12880 Int-var-in-mem/imm32 +12881 0/imm32/next +12882 0/imm32/next +12883 +12884 Int-var-in-mem: # (payload var) +12885 0x11/imm32/alloc-id:fake:payload +12886 0/imm32/name +12887 0/imm32/name +12888 0x11/imm32/alloc-id:fake +12889 Type-int/imm32 +12890 1/imm32/some-block-depth +12891 1/imm32/some-stack-offset +12892 0/imm32/no-register +12893 0/imm32/no-register +12894 +12895 Two-args-int-stack-int-reg: # (payload list var) +12896 0x11/imm32/alloc-id:fake:payload +12897 0x11/imm32/alloc-id:fake +12898 Int-var-in-mem/imm32 +12899 0x11/imm32/alloc-id:fake +12900 Single-int-var-in-some-register/imm32/next +12901 +12902 Two-args-int-reg-int-stack: # (payload list var) +12903 0x11/imm32/alloc-id:fake:payload +12904 0x11/imm32/alloc-id:fake +12905 Int-var-in-some-register/imm32 +12906 0x11/imm32/alloc-id:fake +12907 Single-int-var-in-mem/imm32/next +12908 +12909 Two-args-int-eax-int-literal: # (payload list var) +12910 0x11/imm32/alloc-id:fake:payload +12911 0x11/imm32/alloc-id:fake +12912 Int-var-in-eax/imm32 +12913 0x11/imm32/alloc-id:fake +12914 Single-lit-var/imm32/next +12915 +12916 Int-var-and-literal: # (payload list var) +12917 0x11/imm32/alloc-id:fake:payload +12918 0x11/imm32/alloc-id:fake +12919 Int-var-in-mem/imm32 +12920 0x11/imm32/alloc-id:fake +12921 Single-lit-var/imm32/next +12922 +12923 Int-var-in-register-and-literal: # (payload list var) +12924 0x11/imm32/alloc-id:fake:payload +12925 0x11/imm32/alloc-id:fake +12926 Int-var-in-some-register/imm32 +12927 0x11/imm32/alloc-id:fake +12928 Single-lit-var/imm32/next +12929 +12930 Single-int-var-in-some-register: # (payload list var) +12931 0x11/imm32/alloc-id:fake:payload +12932 0x11/imm32/alloc-id:fake +12933 Int-var-in-some-register/imm32 +12934 0/imm32/next +12935 0/imm32/next +12936 +12937 Single-addr-var-in-some-register: # (payload list var) +12938 0x11/imm32/alloc-id:fake:payload +12939 0x11/imm32/alloc-id:fake +12940 Addr-var-in-some-register/imm32 +12941 0/imm32/next +12942 0/imm32/next +12943 +12944 Int-var-in-some-register: # (payload var) +12945 0x11/imm32/alloc-id:fake:payload +12946 0/imm32/name +12947 0/imm32/name 12948 0x11/imm32/alloc-id:fake -12949 Any-register/imm32 -12950 -12951 Any-register: # (payload array byte) -12952 0x11/imm32/alloc-id:fake:payload -12953 1/imm32/size -12954 # data -12955 2a/asterisk -12956 -12957 Addr-var-in-some-register: # (payload var) -12958 0x11/imm32/alloc-id:fake:payload -12959 0/imm32/name -12960 0/imm32/name -12961 0x11/imm32/alloc-id:fake -12962 Type-addr/imm32 -12963 1/imm32/some-block-depth -12964 0/imm32/no-stack-offset +12949 Type-int/imm32 +12950 1/imm32/some-block-depth +12951 0/imm32/no-stack-offset +12952 0x11/imm32/alloc-id:fake +12953 Any-register/imm32 +12954 +12955 Any-register: # (payload array byte) +12956 0x11/imm32/alloc-id:fake:payload +12957 1/imm32/size +12958 # data +12959 2a/asterisk +12960 +12961 Addr-var-in-some-register: # (payload var) +12962 0x11/imm32/alloc-id:fake:payload +12963 0/imm32/name +12964 0/imm32/name 12965 0x11/imm32/alloc-id:fake -12966 Any-register/imm32 -12967 -12968 Single-int-var-in-eax: # (payload list var) -12969 0x11/imm32/alloc-id:fake:payload -12970 0x11/imm32/alloc-id:fake -12971 Int-var-in-eax/imm32 -12972 0/imm32/next -12973 0/imm32/next -12974 -12975 Int-var-in-eax: -12976 0x11/imm32/alloc-id:fake:payload -12977 0/imm32/name -12978 0/imm32/name -12979 0x11/imm32/alloc-id:fake -12980 Type-int/imm32 -12981 1/imm32/some-block-depth -12982 0/imm32/no-stack-offset +12966 Type-addr/imm32 +12967 1/imm32/some-block-depth +12968 0/imm32/no-stack-offset +12969 0x11/imm32/alloc-id:fake +12970 Any-register/imm32 +12971 +12972 Single-int-var-in-eax: # (payload list var) +12973 0x11/imm32/alloc-id:fake:payload +12974 0x11/imm32/alloc-id:fake +12975 Int-var-in-eax/imm32 +12976 0/imm32/next +12977 0/imm32/next +12978 +12979 Int-var-in-eax: +12980 0x11/imm32/alloc-id:fake:payload +12981 0/imm32/name +12982 0/imm32/name 12983 0x11/imm32/alloc-id:fake -12984 $Register-eax/imm32 -12985 -12986 Single-int-var-in-ecx: # (payload list var) -12987 0x11/imm32/alloc-id:fake:payload -12988 0x11/imm32/alloc-id:fake -12989 Int-var-in-ecx/imm32 -12990 0/imm32/next -12991 0/imm32/next -12992 -12993 Int-var-in-ecx: -12994 0x11/imm32/alloc-id:fake:payload -12995 0/imm32/name -12996 0/imm32/name -12997 0x11/imm32/alloc-id:fake -12998 Type-int/imm32 -12999 1/imm32/some-block-depth -13000 0/imm32/no-stack-offset +12984 Type-int/imm32 +12985 1/imm32/some-block-depth +12986 0/imm32/no-stack-offset +12987 0x11/imm32/alloc-id:fake +12988 $Register-eax/imm32 +12989 +12990 Single-int-var-in-ecx: # (payload list var) +12991 0x11/imm32/alloc-id:fake:payload +12992 0x11/imm32/alloc-id:fake +12993 Int-var-in-ecx/imm32 +12994 0/imm32/next +12995 0/imm32/next +12996 +12997 Int-var-in-ecx: +12998 0x11/imm32/alloc-id:fake:payload +12999 0/imm32/name +13000 0/imm32/name 13001 0x11/imm32/alloc-id:fake -13002 $Register-ecx/imm32/register -13003 -13004 Single-int-var-in-edx: # (payload list var) -13005 0x11/imm32/alloc-id:fake:payload -13006 0x11/imm32/alloc-id:fake -13007 Int-var-in-edx/imm32 -13008 0/imm32/next -13009 0/imm32/next -13010 -13011 Int-var-in-edx: # (payload list var) -13012 0x11/imm32/alloc-id:fake:payload -13013 0/imm32/name -13014 0/imm32/name -13015 0x11/imm32/alloc-id:fake -13016 Type-int/imm32 -13017 1/imm32/some-block-depth -13018 0/imm32/no-stack-offset +13002 Type-int/imm32 +13003 1/imm32/some-block-depth +13004 0/imm32/no-stack-offset +13005 0x11/imm32/alloc-id:fake +13006 $Register-ecx/imm32/register +13007 +13008 Single-int-var-in-edx: # (payload list var) +13009 0x11/imm32/alloc-id:fake:payload +13010 0x11/imm32/alloc-id:fake +13011 Int-var-in-edx/imm32 +13012 0/imm32/next +13013 0/imm32/next +13014 +13015 Int-var-in-edx: # (payload list var) +13016 0x11/imm32/alloc-id:fake:payload +13017 0/imm32/name +13018 0/imm32/name 13019 0x11/imm32/alloc-id:fake -13020 $Register-edx/imm32/register -13021 -13022 Single-int-var-in-ebx: # (payload list var) -13023 0x11/imm32/alloc-id:fake:payload -13024 0x11/imm32/alloc-id:fake -13025 Int-var-in-ebx/imm32 -13026 0/imm32/next -13027 0/imm32/next -13028 -13029 Int-var-in-ebx: # (payload list var) -13030 0x11/imm32/alloc-id:fake:payload -13031 0/imm32/name -13032 0/imm32/name -13033 0x11/imm32/alloc-id:fake -13034 Type-int/imm32 -13035 1/imm32/some-block-depth -13036 0/imm32/no-stack-offset +13020 Type-int/imm32 +13021 1/imm32/some-block-depth +13022 0/imm32/no-stack-offset +13023 0x11/imm32/alloc-id:fake +13024 $Register-edx/imm32/register +13025 +13026 Single-int-var-in-ebx: # (payload list var) +13027 0x11/imm32/alloc-id:fake:payload +13028 0x11/imm32/alloc-id:fake +13029 Int-var-in-ebx/imm32 +13030 0/imm32/next +13031 0/imm32/next +13032 +13033 Int-var-in-ebx: # (payload list var) +13034 0x11/imm32/alloc-id:fake:payload +13035 0/imm32/name +13036 0/imm32/name 13037 0x11/imm32/alloc-id:fake -13038 $Register-ebx/imm32/register -13039 -13040 Single-int-var-in-esi: # (payload list var) -13041 0x11/imm32/alloc-id:fake:payload -13042 0x11/imm32/alloc-id:fake -13043 Int-var-in-esi/imm32 -13044 0/imm32/next -13045 0/imm32/next -13046 -13047 Int-var-in-esi: # (payload list var) -13048 0x11/imm32/alloc-id:fake:payload -13049 0/imm32/name -13050 0/imm32/name -13051 0x11/imm32/alloc-id:fake -13052 Type-int/imm32 -13053 1/imm32/some-block-depth -13054 0/imm32/no-stack-offset +13038 Type-int/imm32 +13039 1/imm32/some-block-depth +13040 0/imm32/no-stack-offset +13041 0x11/imm32/alloc-id:fake +13042 $Register-ebx/imm32/register +13043 +13044 Single-int-var-in-esi: # (payload list var) +13045 0x11/imm32/alloc-id:fake:payload +13046 0x11/imm32/alloc-id:fake +13047 Int-var-in-esi/imm32 +13048 0/imm32/next +13049 0/imm32/next +13050 +13051 Int-var-in-esi: # (payload list var) +13052 0x11/imm32/alloc-id:fake:payload +13053 0/imm32/name +13054 0/imm32/name 13055 0x11/imm32/alloc-id:fake -13056 $Register-esi/imm32/register -13057 -13058 Single-int-var-in-edi: # (payload list var) -13059 0x11/imm32/alloc-id:fake:payload -13060 0x11/imm32/alloc-id:fake -13061 Int-var-in-edi/imm32 -13062 0/imm32/next -13063 0/imm32/next -13064 -13065 Int-var-in-edi: # (payload list var) -13066 0x11/imm32/alloc-id:fake:payload -13067 0/imm32/name -13068 0/imm32/name -13069 0x11/imm32/alloc-id:fake -13070 Type-int/imm32 -13071 1/imm32/some-block-depth -13072 0/imm32/no-stack-offset +13056 Type-int/imm32 +13057 1/imm32/some-block-depth +13058 0/imm32/no-stack-offset +13059 0x11/imm32/alloc-id:fake +13060 $Register-esi/imm32/register +13061 +13062 Single-int-var-in-edi: # (payload list var) +13063 0x11/imm32/alloc-id:fake:payload +13064 0x11/imm32/alloc-id:fake +13065 Int-var-in-edi/imm32 +13066 0/imm32/next +13067 0/imm32/next +13068 +13069 Int-var-in-edi: # (payload list var) +13070 0x11/imm32/alloc-id:fake:payload +13071 0/imm32/name +13072 0/imm32/name 13073 0x11/imm32/alloc-id:fake -13074 $Register-edi/imm32/register -13075 -13076 Single-lit-var: # (payload list var) -13077 0x11/imm32/alloc-id:fake:payload -13078 0x11/imm32/alloc-id:fake -13079 Lit-var/imm32 -13080 0/imm32/next -13081 0/imm32/next -13082 -13083 Lit-var: # (payload var) -13084 0x11/imm32/alloc-id:fake:payload -13085 0/imm32/name -13086 0/imm32/name -13087 0x11/imm32/alloc-id:fake -13088 Type-literal/imm32 -13089 1/imm32/some-block-depth -13090 0/imm32/no-stack-offset -13091 0/imm32/no-register -13092 0/imm32/no-register -13093 -13094 Type-int: # (payload tree type-id) -13095 0x11/imm32/alloc-id:fake:payload -13096 1/imm32/left-is-atom -13097 1/imm32/value:int -13098 0/imm32/left:unused -13099 0/imm32/right:null -13100 0/imm32/right:null -13101 -13102 Type-literal: # (payload tree type-id) -13103 0x11/imm32/alloc-id:fake:payload -13104 1/imm32/is-atom -13105 0/imm32/value:literal -13106 0/imm32/left:unused -13107 0/imm32/right:null -13108 0/imm32/right:null -13109 -13110 Type-addr: # (payload tree type-id) -13111 0x11/imm32/alloc-id:fake:payload -13112 1/imm32/is-atom -13113 2/imm32/value:addr -13114 0/imm32/left:unused -13115 0/imm32/right:null -13116 0/imm32/right:null -13117 -13118 == code -13119 emit-subx-primitive: # out: (addr buffered-file), stmt: (addr stmt), primitive: (addr primitive) -13120 # . prologue -13121 55/push-ebp -13122 89/<- %ebp 4/r32/esp -13123 # . save registers -13124 50/push-eax -13125 51/push-ecx -13126 # ecx = primitive -13127 8b/-> *(ebp+0x10) 1/r32/ecx -13128 # emit primitive name -13129 (emit-indent *(ebp+8) *Curr-block-depth) -13130 (lookup *(ecx+0x18) *(ecx+0x1c)) # Primitive-subx-name Primitive-subx-name => eax -13131 (write-buffered *(ebp+8) %eax) -13132 # emit rm32 if necessary -13133 (emit-subx-rm32 *(ebp+8) *(ecx+0x20) *(ebp+0xc)) # out, Primitive-subx-rm32, stmt -13134 # emit r32 if necessary -13135 (emit-subx-r32 *(ebp+8) *(ecx+0x24) *(ebp+0xc)) # out, Primitive-subx-r32, stmt -13136 # emit imm32 if necessary -13137 (emit-subx-imm32 *(ebp+8) *(ecx+0x28) *(ebp+0xc)) # out, Primitive-subx-imm32, stmt -13138 # emit disp32 if necessary -13139 (emit-subx-disp32 *(ebp+8) *(ecx+0x2c) *(ebp+0xc)) # out, Primitive-subx-disp32, stmt -13140 (write-buffered *(ebp+8) Newline) -13141 $emit-subx-primitive:end: -13142 # . restore registers -13143 59/pop-to-ecx -13144 58/pop-to-eax -13145 # . epilogue -13146 89/<- %esp 5/r32/ebp -13147 5d/pop-to-ebp -13148 c3/return -13149 -13150 emit-subx-rm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -13151 # . prologue -13152 55/push-ebp -13153 89/<- %ebp 4/r32/esp -13154 # . save registers -13155 50/push-eax -13156 # if (l == 0) return -13157 81 7/subop/compare *(ebp+0xc) 0/imm32 -13158 74/jump-if-= $emit-subx-rm32:end/disp8 -13159 # var v/eax: (addr stmt-var) -13160 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -13161 (emit-subx-var-as-rm32 *(ebp+8) %eax) -13162 $emit-subx-rm32:end: -13163 # . restore registers -13164 58/pop-to-eax -13165 # . epilogue -13166 89/<- %esp 5/r32/ebp -13167 5d/pop-to-ebp -13168 c3/return -13169 -13170 get-stmt-operand-from-arg-location: # stmt: (addr stmt), l: arg-location -> var/eax: (addr stmt-var) -13171 # . prologue -13172 55/push-ebp -13173 89/<- %ebp 4/r32/esp -13174 # . save registers -13175 51/push-ecx -13176 # eax = l -13177 8b/-> *(ebp+0xc) 0/r32/eax -13178 # ecx = stmt -13179 8b/-> *(ebp+8) 1/r32/ecx -13180 # if (l == 1) return stmt->inouts -13181 { -13182 3d/compare-eax-and 1/imm32 -13183 75/jump-if-!= break/disp8 -13184 $get-stmt-operand-from-arg-location:1: -13185 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -13186 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -13187 } -13188 # if (l == 2) return stmt->inouts->next -13189 { -13190 3d/compare-eax-and 2/imm32 -13191 75/jump-if-!= break/disp8 -13192 $get-stmt-operand-from-arg-location:2: -13193 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -13194 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -13195 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -13196 } -13197 # if (l == 3) return stmt->outputs -13198 { -13199 3d/compare-eax-and 3/imm32 -13200 75/jump-if-!= break/disp8 -13201 $get-stmt-operand-from-arg-location:3: -13202 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -13203 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -13204 } -13205 # abort -13206 e9/jump $get-stmt-operand-from-arg-location:abort/disp32 -13207 $get-stmt-operand-from-arg-location:end: -13208 # . restore registers -13209 59/pop-to-ecx -13210 # . epilogue -13211 89/<- %esp 5/r32/ebp -13212 5d/pop-to-ebp -13213 c3/return -13214 -13215 $get-stmt-operand-from-arg-location:abort: -13216 # error("invalid arg-location " eax) -13217 (write-buffered Stderr "invalid arg-location ") -13218 (print-int32-buffered Stderr %eax) -13219 (write-buffered Stderr Newline) -13220 (flush Stderr) -13221 # . syscall(exit, 1) -13222 bb/copy-to-ebx 1/imm32 -13223 b8/copy-to-eax 1/imm32/exit -13224 cd/syscall 0x80/imm8 -13225 # never gets here -13226 -13227 emit-subx-r32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -13228 # . prologue -13229 55/push-ebp -13230 89/<- %ebp 4/r32/esp -13231 # . save registers -13232 50/push-eax -13233 51/push-ecx -13234 # if (l == 0) return -13235 81 7/subop/compare *(ebp+0xc) 0/imm32 -13236 0f 84/jump-if-= $emit-subx-r32:end/disp32 -13237 # var v/eax: (addr stmt-var) -13238 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -13239 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -13240 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -13241 (maybe-get Registers %eax 0xc) # => eax: (addr register-index) -13242 (write-buffered *(ebp+8) Space) -13243 (print-int32-buffered *(ebp+8) *eax) -13244 (write-buffered *(ebp+8) "/r32") -13245 $emit-subx-r32:end: -13246 # . restore registers -13247 59/pop-to-ecx -13248 58/pop-to-eax -13249 # . epilogue -13250 89/<- %esp 5/r32/ebp -13251 5d/pop-to-ebp -13252 c3/return -13253 -13254 emit-subx-imm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -13255 # . prologue -13256 55/push-ebp -13257 89/<- %ebp 4/r32/esp -13258 # . save registers -13259 50/push-eax -13260 51/push-ecx -13261 # if (l == 0) return -13262 81 7/subop/compare *(ebp+0xc) 0/imm32 -13263 0f 84/jump-if-= $emit-subx-imm32:end/disp32 -13264 # var v/eax: (handle var) -13265 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -13266 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -13267 (lookup *eax *(eax+4)) # Var-name Var-name => eax -13268 (write-buffered *(ebp+8) Space) -13269 (write-buffered *(ebp+8) %eax) -13270 (write-buffered *(ebp+8) "/imm32") -13271 $emit-subx-imm32:end: -13272 # . restore registers -13273 59/pop-to-ecx -13274 58/pop-to-eax -13275 # . epilogue -13276 89/<- %esp 5/r32/ebp -13277 5d/pop-to-ebp -13278 c3/return -13279 -13280 emit-subx-disp32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -13281 # . prologue -13282 55/push-ebp -13283 89/<- %ebp 4/r32/esp -13284 # . save registers -13285 50/push-eax -13286 51/push-ecx -13287 # if (location == 0) return -13288 81 7/subop/compare *(ebp+0xc) 0/imm32 -13289 0f 84/jump-if-= $emit-subx-disp32:end/disp32 -13290 # var v/eax: (addr stmt-var) -13291 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -13292 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -13293 (lookup *eax *(eax+4)) # Var-name Var-name => eax -13294 (write-buffered *(ebp+8) Space) -13295 (write-buffered *(ebp+8) %eax) -13296 # hack: if instruction operation starts with "break", emit ":break" -13297 # var name/ecx: (addr array byte) = lookup(stmt->operation) -13298 8b/-> *(ebp+0x10) 0/r32/eax -13299 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -13300 89/<- %ecx 0/r32/eax -13301 { -13302 (string-starts-with? %ecx "break") # => eax -13303 3d/compare-eax-and 0/imm32/false -13304 74/jump-if-= break/disp8 -13305 (write-buffered *(ebp+8) ":break") -13306 } -13307 # hack: if instruction operation starts with "loop", emit ":loop" -13308 { -13309 (string-starts-with? %ecx "loop") # => eax -13310 3d/compare-eax-and 0/imm32/false -13311 74/jump-if-= break/disp8 -13312 (write-buffered *(ebp+8) ":loop") -13313 } -13314 (write-buffered *(ebp+8) "/disp32") -13315 $emit-subx-disp32:end: -13316 # . restore registers -13317 59/pop-to-ecx -13318 58/pop-to-eax -13319 # . epilogue -13320 89/<- %esp 5/r32/ebp -13321 5d/pop-to-ebp -13322 c3/return -13323 -13324 emit-call: # out: (addr buffered-file), stmt: (addr stmt) -13325 # . prologue -13326 55/push-ebp -13327 89/<- %ebp 4/r32/esp -13328 # . save registers -13329 50/push-eax -13330 51/push-ecx -13331 # -13332 (emit-indent *(ebp+8) *Curr-block-depth) -13333 (write-buffered *(ebp+8) "(") -13334 # ecx = stmt -13335 8b/-> *(ebp+0xc) 1/r32/ecx -13336 # - emit function name -13337 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -13338 (write-buffered *(ebp+8) %eax) -13339 # - emit arguments -13340 # var curr/eax: (addr stmt-var) = lookup(stmt->inouts) -13341 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -13342 { -13343 # if (curr == null) break -13344 3d/compare-eax-and 0/imm32 -13345 74/jump-if-= break/disp8 -13346 # -13347 (emit-subx-call-operand *(ebp+8) %eax) -13348 # curr = lookup(curr->next) -13349 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -13350 eb/jump loop/disp8 -13351 } -13352 # -13353 (write-buffered *(ebp+8) ")\n") -13354 $emit-call:end: -13355 # . restore registers -13356 59/pop-to-ecx -13357 58/pop-to-eax -13358 # . epilogue -13359 89/<- %esp 5/r32/ebp -13360 5d/pop-to-ebp -13361 c3/return -13362 -13363 emit-subx-call-operand: # out: (addr buffered-file), s: (addr stmt-var) -13364 # shares code with emit-subx-var-as-rm32 -13365 # . prologue -13366 55/push-ebp -13367 89/<- %ebp 4/r32/esp -13368 # . save registers -13369 50/push-eax -13370 51/push-ecx -13371 56/push-esi -13372 # ecx = s -13373 8b/-> *(ebp+0xc) 1/r32/ecx -13374 # var operand/esi: (addr var) = lookup(s->value) -13375 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -13376 89/<- %esi 0/r32/eax -13377 # if (operand->register && !s->is-deref?) emit "%__" -13378 { -13379 $emit-subx-call-operand:check-for-register-direct: -13380 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -13381 74/jump-if-= break/disp8 -13382 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -13383 75/jump-if-!= break/disp8 -13384 $emit-subx-call-operand:register-direct: -13385 (write-buffered *(ebp+8) " %") -13386 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -13387 (write-buffered *(ebp+8) %eax) -13388 e9/jump $emit-subx-call-operand:end/disp32 -13389 } -13390 # else if (operand->register && s->is-deref?) emit "*__" -13391 { -13392 $emit-subx-call-operand:check-for-register-indirect: -13393 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -13394 74/jump-if-= break/disp8 -13395 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -13396 74/jump-if-= break/disp8 -13397 $emit-subx-call-operand:register-indirect: -13398 (emit-subx-call-operand-register-indirect *(ebp+8) %esi) -13399 e9/jump $emit-subx-call-operand:end/disp32 -13400 } -13401 # else if (operand->stack-offset) emit "*(ebp+__)" -13402 { -13403 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset -13404 74/jump-if-= break/disp8 -13405 $emit-subx-call-operand:stack: -13406 (emit-subx-call-operand-stack *(ebp+8) %esi) -13407 e9/jump $emit-subx-call-operand:end/disp32 -13408 } -13409 # else if (operand->type == literal) emit "__" -13410 { -13411 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax -13412 81 7/subop/compare *(eax+4) 0/imm32 # Tree-left -13413 75/jump-if-!= break/disp8 -13414 $emit-subx-call-operand:literal: -13415 (write-buffered *(ebp+8) Space) -13416 (lookup *esi *(esi+4)) # Var-name Var-name => eax -13417 (write-buffered *(ebp+8) %eax) -13418 } -13419 $emit-subx-call-operand:end: -13420 # . restore registers -13421 5e/pop-to-esi -13422 59/pop-to-ecx -13423 58/pop-to-eax -13424 # . epilogue -13425 89/<- %esp 5/r32/ebp -13426 5d/pop-to-ebp -13427 c3/return -13428 -13429 emit-subx-call-operand-register-indirect: # out: (addr buffered-file), v: (addr var) -13430 # . prologue -13431 55/push-ebp -13432 89/<- %ebp 4/r32/esp -13433 # . save registers -13434 50/push-eax -13435 51/push-ecx -13436 56/push-esi -13437 # esi = v -13438 8b/-> *(ebp+0xc) 6/r32/esi -13439 # var size/ecx: int = size-of-deref(v) -13440 (size-of-deref %esi) # => eax -13441 89/<- %ecx 0/r32/eax -13442 # var reg-name/esi: (addr array byte) = lookup(v->register) -13443 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -13444 89/<- %esi 0/r32/eax -13445 # TODO: assert size is a multiple of 4 -13446 # var i/eax: int = 0 -13447 b8/copy-to-eax 0/imm32 -13448 { -13449 $emit-subx-call-operand-register-indirect:loop: -13450 # if (i >= size) break -13451 39/compare %eax 1/r32/ecx -13452 7d/jump-if->= break/disp8 -13453 # emit " *(" v->register "+" i ")" -13454 (write-buffered *(ebp+8) " *(") -13455 (write-buffered *(ebp+8) %esi) -13456 (write-buffered *(ebp+8) "+") -13457 (print-int32-buffered *(ebp+8) %eax) -13458 (write-buffered *(ebp+8) ")") -13459 # i += 4 -13460 05/add-to-eax 4/imm32 -13461 # -13462 eb/jump loop/disp8 -13463 } -13464 $emit-subx-call-operand-register-indirect:end: -13465 # . restore registers -13466 5e/pop-to-esi -13467 59/pop-to-ecx -13468 58/pop-to-eax -13469 # . epilogue -13470 89/<- %esp 5/r32/ebp -13471 5d/pop-to-ebp -13472 c3/return -13473 -13474 emit-subx-call-operand-stack: # out: (addr buffered-file), v: (addr var) -13475 # . prologue -13476 55/push-ebp -13477 89/<- %ebp 4/r32/esp -13478 # . save registers -13479 50/push-eax -13480 51/push-ecx -13481 56/push-esi -13482 # esi = v -13483 8b/-> *(ebp+0xc) 6/r32/esi -13484 # var curr/ecx: int = v->offset -13485 8b/-> *(esi+0x14) 1/r32/ecx # Var-offset -13486 # var max/eax: int = v->offset + size-of(v) -13487 (size-of %esi) # => eax -13488 # TODO: assert size is a multiple of 4 -13489 01/add-to %eax 1/r32/ecx -13490 { -13491 $emit-subx-call-operand-stack:loop: -13492 # if (curr >= max) break -13493 39/compare %ecx 0/r32/eax -13494 7d/jump-if->= break/disp8 -13495 # emit " *(ebp+" curr ")" -13496 (write-buffered *(ebp+8) " *(ebp+") -13497 (print-int32-buffered *(ebp+8) %ecx) -13498 (write-buffered *(ebp+8) ")") -13499 # i += 4 -13500 81 0/subop/add %ecx 4/imm32 -13501 # -13502 eb/jump loop/disp8 -13503 } -13504 $emit-subx-call-operand-stack:end: -13505 # . restore registers -13506 5e/pop-to-esi -13507 59/pop-to-ecx -13508 58/pop-to-eax -13509 # . epilogue -13510 89/<- %esp 5/r32/ebp -13511 5d/pop-to-ebp -13512 c3/return -13513 -13514 emit-subx-var-as-rm32: # out: (addr buffered-file), s: (addr stmt-var) -13515 # . prologue -13516 55/push-ebp -13517 89/<- %ebp 4/r32/esp -13518 # . save registers -13519 50/push-eax -13520 51/push-ecx -13521 56/push-esi -13522 # ecx = s -13523 8b/-> *(ebp+0xc) 1/r32/ecx -13524 # var operand/esi: (addr var) = lookup(s->value) -13525 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -13526 89/<- %esi 0/r32/eax -13527 # if (operand->register && s->is-deref?) emit "*__" -13528 { -13529 $emit-subx-var-as-rm32:check-for-register-indirect: -13530 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -13531 74/jump-if-= break/disp8 -13532 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -13533 74/jump-if-= break/disp8 -13534 $emit-subx-var-as-rm32:register-indirect: -13535 (write-buffered *(ebp+8) " *") -13536 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -13537 (write-buffered *(ebp+8) %eax) -13538 e9/jump $emit-subx-var-as-rm32:end/disp32 -13539 } -13540 # if (operand->register && !s->is-deref?) emit "%__" -13541 { -13542 $emit-subx-var-as-rm32:check-for-register-direct: -13543 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -13544 74/jump-if-= break/disp8 -13545 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -13546 75/jump-if-!= break/disp8 -13547 $emit-subx-var-as-rm32:register-direct: -13548 (write-buffered *(ebp+8) " %") -13549 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -13550 (write-buffered *(ebp+8) %eax) -13551 e9/jump $emit-subx-var-as-rm32:end/disp32 -13552 } -13553 # else if (operand->stack-offset) emit "*(ebp+__)" -13554 { -13555 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset -13556 74/jump-if-= break/disp8 -13557 $emit-subx-var-as-rm32:stack: -13558 (write-buffered *(ebp+8) Space) -13559 (write-buffered *(ebp+8) "*(ebp+") -13560 (print-int32-buffered *(ebp+8) *(esi+0x14)) # Var-offset -13561 (write-buffered *(ebp+8) ")") -13562 } -13563 $emit-subx-var-as-rm32:end: -13564 # . restore registers -13565 5e/pop-to-esi -13566 59/pop-to-ecx -13567 58/pop-to-eax -13568 # . epilogue -13569 89/<- %esp 5/r32/ebp -13570 5d/pop-to-ebp -13571 c3/return -13572 -13573 find-matching-primitive: # primitives: (addr primitive), stmt: (addr stmt) -> result/eax: (addr primitive) -13574 # . prologue -13575 55/push-ebp -13576 89/<- %ebp 4/r32/esp -13577 # . save registers -13578 51/push-ecx -13579 # var curr/ecx: (addr primitive) = primitives -13580 8b/-> *(ebp+8) 1/r32/ecx -13581 { -13582 $find-matching-primitive:loop: -13583 # if (curr == null) break -13584 81 7/subop/compare %ecx 0/imm32 -13585 0f 84/jump-if-= break/disp32 -13586 # if match(curr, stmt) return curr -13587 { -13588 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx) # => eax -13589 3d/compare-eax-and 0/imm32/false -13590 74/jump-if-= break/disp8 -13591 89/<- %eax 1/r32/ecx -13592 eb/jump $find-matching-primitive:end/disp8 -13593 } -13594 $find-matching-primitive:next-primitive: -13595 # curr = curr->next -13596 (lookup *(ecx+0x34) *(ecx+0x38)) # Primitive-next Primitive-next => eax -13597 89/<- %ecx 0/r32/eax -13598 # -13599 e9/jump loop/disp32 -13600 } -13601 # return null -13602 b8/copy-to-eax 0/imm32 -13603 $find-matching-primitive:end: -13604 # . restore registers -13605 59/pop-to-ecx -13606 # . epilogue -13607 89/<- %esp 5/r32/ebp -13608 5d/pop-to-ebp -13609 c3/return -13610 -13611 mu-stmt-matches-primitive?: # stmt: (addr stmt), primitive: (addr primitive) -> result/eax: boolean -13612 # A mu stmt matches a primitive if the name matches, all the inout vars -13613 # match, and all the output vars match. -13614 # Vars match if types match and registers match. -13615 # In addition, a stmt output matches a primitive's output if types match -13616 # and the primitive has a wildcard register. -13617 # . prologue -13618 55/push-ebp -13619 89/<- %ebp 4/r32/esp -13620 # . save registers -13621 51/push-ecx -13622 52/push-edx -13623 53/push-ebx -13624 56/push-esi -13625 57/push-edi -13626 # ecx = stmt -13627 8b/-> *(ebp+8) 1/r32/ecx -13628 # edx = primitive -13629 8b/-> *(ebp+0xc) 2/r32/edx -13630 { -13631 $mu-stmt-matches-primitive?:check-name: -13632 # if (primitive->name != stmt->operation) return false -13633 # . var esi: (addr array byte) = lookup(stmt->operation) -13634 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -13635 89/<- %esi 0/r32/eax -13636 # . var edi: (addr array byte) = lookup(primitive->name) -13637 (lookup *edx *(edx+4)) # Primitive-name Primitive-name => eax -13638 89/<- %edi 0/r32/eax -13639 (string-equal? %esi %edi) # => eax -13640 3d/compare-eax-and 0/imm32/false -13641 75/jump-if-!= break/disp8 -13642 b8/copy-to-eax 0/imm32 -13643 e9/jump $mu-stmt-matches-primitive?:end/disp32 -13644 } -13645 # var curr/esi: (addr stmt-var) = lookup(stmt->inouts) -13646 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -13647 89/<- %esi 0/r32/eax -13648 # var curr2/edi: (addr list var) = lookup(primitive->inouts) -13649 (lookup *(edx+8) *(edx+0xc)) # Primitive-inouts Primitive-inouts => eax -13650 89/<- %edi 0/r32/eax -13651 { -13652 $mu-stmt-matches-primitive?:inouts-loop: -13653 # if (curr == 0 && curr2 == 0) move on to check outputs -13654 { -13655 $mu-stmt-matches-primitive?:check-both-inouts-null: -13656 81 7/subop/compare %esi 0/imm32 -13657 75/jump-if-!= break/disp8 -13658 $mu-stmt-matches-primitive?:stmt-inout-null: -13659 81 7/subop/compare %edi 0/imm32 -13660 0f 84/jump-if-= $mu-stmt-matches-primitive?:check-outputs/disp32 -13661 $mu-stmt-matches-primitive?:stmt-inout-null-and-prim-inout-not-null: -13662 # return false -13663 b8/copy-to-eax 0/imm32/false -13664 e9/jump $mu-stmt-matches-primitive?:end/disp32 -13665 } -13666 # if (curr2 == 0) return false -13667 { -13668 $mu-stmt-matches-primitive?:check-prim-inout-null: -13669 81 7/subop/compare %edi 0/imm32 -13670 75/jump-if-!= break/disp8 -13671 $mu-stmt-matches-primitive?:prim-inout-null: -13672 b8/copy-to-eax 0/imm32/false -13673 e9/jump $mu-stmt-matches-primitive?:end/disp32 -13674 } -13675 # if (curr != curr2) return false -13676 { -13677 $mu-stmt-matches-primitive?:check-inouts-match: -13678 (lookup *edi *(edi+4)) # List-value List-value => eax -13679 (operand-matches-primitive? %esi %eax) # => eax -13680 3d/compare-eax-and 0/imm32/false -13681 75/jump-if-!= break/disp8 -13682 $mu-stmt-matches-primitive?:inouts-match: -13683 b8/copy-to-eax 0/imm32/false -13684 e9/jump $mu-stmt-matches-primitive?:end/disp32 -13685 } -13686 $mu-stmt-matches-primitive?:next-inout: -13687 # curr = lookup(curr->next) -13688 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -13689 89/<- %esi 0/r32/eax -13690 # curr2 = lookup(curr2->next) -13691 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -13692 89/<- %edi 0/r32/eax -13693 # -13694 e9/jump loop/disp32 -13695 } -13696 $mu-stmt-matches-primitive?:check-outputs: -13697 # var curr/esi: (addr stmt-var) = lookup(stmt->outputs) -13698 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -13699 89/<- %esi 0/r32/eax -13700 # var curr2/edi: (addr list var) = lookup(primitive->outputs) -13701 (lookup *(edx+0x10) *(edx+0x14)) # Primitive-outputs Primitive-outputs => eax -13702 89/<- %edi 0/r32/eax -13703 { -13704 $mu-stmt-matches-primitive?:outputs-loop: -13705 # if (curr == 0) return (curr2 == 0) -13706 { -13707 $mu-stmt-matches-primitive?:check-both-outputs-null: -13708 81 7/subop/compare %esi 0/imm32 -13709 75/jump-if-!= break/disp8 -13710 { -13711 $mu-stmt-matches-primitive?:stmt-output-null: -13712 81 7/subop/compare %edi 0/imm32 -13713 75/jump-if-!= break/disp8 -13714 $mu-stmt-matches-primitive?:both-outputs-null: -13715 # return true -13716 b8/copy-to-eax 1/imm32 -13717 e9/jump $mu-stmt-matches-primitive?:end/disp32 -13718 } -13719 $mu-stmt-matches-primitive?:stmt-output-null-and-prim-output-not-null: -13720 # return false -13721 b8/copy-to-eax 0/imm32 -13722 e9/jump $mu-stmt-matches-primitive?:end/disp32 -13723 } -13724 # if (curr2 == 0) return false -13725 { -13726 $mu-stmt-matches-primitive?:check-prim-output-null: -13727 81 7/subop/compare %edi 0/imm32 -13728 75/jump-if-!= break/disp8 -13729 $mu-stmt-matches-primitive?:prim-output-is-null: -13730 b8/copy-to-eax 0/imm32 -13731 e9/jump $mu-stmt-matches-primitive?:end/disp32 -13732 } -13733 # if (curr != curr2) return false -13734 { -13735 $mu-stmt-matches-primitive?:check-outputs-match: -13736 (lookup *edi *(edi+4)) # List-value List-value => eax -13737 (operand-matches-primitive? %esi %eax) # => eax -13738 3d/compare-eax-and 0/imm32/false -13739 75/jump-if-!= break/disp8 -13740 $mu-stmt-matches-primitive?:outputs-match: -13741 b8/copy-to-eax 0/imm32 -13742 e9/jump $mu-stmt-matches-primitive?:end/disp32 -13743 } -13744 $mu-stmt-matches-primitive?:next-output: -13745 # curr = lookup(curr->next) -13746 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -13747 89/<- %esi 0/r32/eax -13748 # curr2 = lookup(curr2->next) -13749 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -13750 89/<- %edi 0/r32/eax -13751 # -13752 e9/jump loop/disp32 -13753 } -13754 $mu-stmt-matches-primitive?:return-true: -13755 b8/copy-to-eax 1/imm32 -13756 $mu-stmt-matches-primitive?:end: -13757 # . restore registers -13758 5f/pop-to-edi -13759 5e/pop-to-esi -13760 5b/pop-to-ebx -13761 5a/pop-to-edx -13762 59/pop-to-ecx -13763 # . epilogue -13764 89/<- %esp 5/r32/ebp -13765 5d/pop-to-ebp -13766 c3/return -13767 -13768 operand-matches-primitive?: # s: (addr stmt-var), prim-var: (addr var) -> result/eax: boolean -13769 # . prologue -13770 55/push-ebp -13771 89/<- %ebp 4/r32/esp -13772 # . save registers -13773 51/push-ecx -13774 52/push-edx -13775 53/push-ebx -13776 56/push-esi -13777 57/push-edi -13778 # ecx = s -13779 8b/-> *(ebp+8) 1/r32/ecx -13780 # var var/esi: (addr var) = lookup(s->value) -13781 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -13782 89/<- %esi 0/r32/eax -13783 # edi = prim-var -13784 8b/-> *(ebp+0xc) 7/r32/edi -13785 $operand-matches-primitive?:check-type: -13786 # if (var->type != prim-var->type) return false -13787 # . var vtype/ebx: (addr tree type-id) = lookup(var->type) -13788 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax -13789 89/<- %ebx 0/r32/eax -13790 # . var ptype/eax: (addr tree type-id) = lookup(prim-var->type) -13791 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -13792 (subx-type-equal? %ebx %eax) # => eax -13793 3d/compare-eax-and 0/imm32/false -13794 0f 84/jump-if-= $operand-matches-primitive?:return-false/disp32 -13795 { -13796 $operand-matches-primitive?:check-register: -13797 # if prim-var is in memory and var is in register but dereference, match -13798 { -13799 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register -13800 0f 85/jump-if-!= break/disp32 -13801 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -13802 74/jump-if-= break/disp8 -13803 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -13804 74/jump-if-= break/disp8 -13805 $operand-matches-primitive?:var-deref-match: -13806 e9/jump $operand-matches-primitive?:return-true/disp32 -13807 } -13808 # if prim-var is in register and var is in register but dereference, no match -13809 { -13810 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register -13811 0f 84/jump-if-= break/disp32 -13812 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -13813 0f 84/jump-if-= break/disp32 -13814 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -13815 74/jump-if-= break/disp8 -13816 $operand-matches-primitive?:var-deref-no-match: -13817 e9/jump $operand-matches-primitive?:return-false/disp32 -13818 } -13819 # return false if var->register doesn't match prim-var->register -13820 { -13821 # if register addresses are equal, it's a match -13822 # var vreg/ebx: (addr array byte) = lookup(var->register) -13823 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -13824 89/<- %ebx 0/r32/eax -13825 # var preg/ecx: (addr array byte) = lookup(prim-var->register) -13826 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax -13827 89/<- %ecx 0/r32/eax -13828 # if (vreg == preg) break -13829 39/compare %ecx 3/r32/ebx -13830 74/jump-if-= break/disp8 -13831 $operand-matches-primitive?:var-register-no-match: -13832 # if either address is 0, return false -13833 81 7/subop/compare %ebx 0/imm32 -13834 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -13835 81 7/subop/compare %ecx 0/imm32 -13836 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -13837 # if prim-var->register is wildcard, it's a match -13838 (string-equal? %ecx "*") # Any-register => eax -13839 3d/compare-eax-and 0/imm32/false -13840 75/jump-if-!= break/disp8 -13841 $operand-matches-primitive?:wildcard-no-match: -13842 # if string contents aren't equal, return false -13843 (string-equal? %ecx %ebx) # => eax -13844 3d/compare-eax-and 0/imm32/false -13845 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -13846 } -13847 } -13848 $operand-matches-primitive?:return-true: -13849 b8/copy-to-eax 1/imm32/true -13850 eb/jump $operand-matches-primitive?:end/disp8 -13851 $operand-matches-primitive?:return-false: -13852 b8/copy-to-eax 0/imm32/false -13853 $operand-matches-primitive?:end: -13854 # . restore registers -13855 5f/pop-to-edi -13856 5e/pop-to-esi -13857 5b/pop-to-ebx -13858 5a/pop-to-edx -13859 59/pop-to-ecx -13860 # . epilogue -13861 89/<- %esp 5/r32/ebp -13862 5d/pop-to-ebp -13863 c3/return -13864 -13865 subx-type-equal?: # a: (addr tree type-id), b: (addr tree type-id) -> result/eax: boolean -13866 # . prologue -13867 55/push-ebp -13868 89/<- %ebp 4/r32/esp -13869 # . save registers -13870 51/push-ecx -13871 # var alit/ecx: boolean = is-literal-type?(a) -13872 (is-simple-mu-type? *(ebp+8) 0) # => eax -13873 89/<- %ecx 0/r32/eax -13874 # var blit/eax: boolean = is-literal-type?(b) -13875 (is-simple-mu-type? *(ebp+0xc) 0) # => eax -13876 # return alit == blit -13877 39/compare %eax 1/r32/ecx -13878 0f 94/set-byte-if-= %al -13879 81 4/subop/and %eax 0xff/imm32 -13880 $subx-type-equal?:end: -13881 # . restore registers -13882 59/pop-to-ecx -13883 # . epilogue -13884 89/<- %esp 5/r32/ebp -13885 5d/pop-to-ebp -13886 c3/return -13887 -13888 is-simple-mu-type?: # a: (addr tree type-id), n: type-id -> result/eax: boolean -13889 # . prologue -13890 55/push-ebp -13891 89/<- %ebp 4/r32/esp -13892 # . save registers -13893 51/push-ecx -13894 # ecx = n -13895 8b/-> *(ebp+0xc) 1/r32/ecx -13896 # return (a->value == n) -13897 8b/-> *(ebp+8) 0/r32/eax -13898 39/compare *(eax+4) 1/r32/ecx # Tree-value -13899 0f 94/set-byte-if-= %al -13900 81 4/subop/and %eax 0xff/imm32 -13901 $is-simple-mu-type?:end: -13902 # . restore registers -13903 59/pop-to-ecx -13904 # . epilogue -13905 89/<- %esp 5/r32/ebp -13906 5d/pop-to-ebp -13907 c3/return -13908 -13909 test-emit-subx-stmt-primitive: -13910 # Primitive operation on a variable on the stack. -13911 # increment foo -13912 # => -13913 # ff 0/subop/increment *(ebp-8) -13914 # -13915 # There's a variable on the var stack as follows: -13916 # name: 'foo' -13917 # type: int -13918 # stack-offset: -8 -13919 # -13920 # There's a primitive with this info: -13921 # name: 'increment' -13922 # inouts: int/mem -13923 # value: 'ff 0/subop/increment' -13924 # -13925 # . prologue -13926 55/push-ebp -13927 89/<- %ebp 4/r32/esp -13928 # setup -13929 (clear-stream _test-output-stream) -13930 (clear-stream $_test-output-buffered-file->buffer) -13931 # simulate allocated payloads starting with an initial fake alloc-id (0x11) -13932 $test-emit-subx-stmt-primitive:initialize-type: -13933 # var type/ecx: (payload tree type-id) = int -13934 68/push 0/imm32/right:null +13074 Type-int/imm32 +13075 1/imm32/some-block-depth +13076 0/imm32/no-stack-offset +13077 0x11/imm32/alloc-id:fake +13078 $Register-edi/imm32/register +13079 +13080 Single-lit-var: # (payload list var) +13081 0x11/imm32/alloc-id:fake:payload +13082 0x11/imm32/alloc-id:fake +13083 Lit-var/imm32 +13084 0/imm32/next +13085 0/imm32/next +13086 +13087 Lit-var: # (payload var) +13088 0x11/imm32/alloc-id:fake:payload +13089 0/imm32/name +13090 0/imm32/name +13091 0x11/imm32/alloc-id:fake +13092 Type-literal/imm32 +13093 1/imm32/some-block-depth +13094 0/imm32/no-stack-offset +13095 0/imm32/no-register +13096 0/imm32/no-register +13097 +13098 Type-int: # (payload tree type-id) +13099 0x11/imm32/alloc-id:fake:payload +13100 1/imm32/left-is-atom +13101 1/imm32/value:int +13102 0/imm32/left:unused +13103 0/imm32/right:null +13104 0/imm32/right:null +13105 +13106 Type-literal: # (payload tree type-id) +13107 0x11/imm32/alloc-id:fake:payload +13108 1/imm32/is-atom +13109 0/imm32/value:literal +13110 0/imm32/left:unused +13111 0/imm32/right:null +13112 0/imm32/right:null +13113 +13114 Type-addr: # (payload tree type-id) +13115 0x11/imm32/alloc-id:fake:payload +13116 1/imm32/is-atom +13117 2/imm32/value:addr +13118 0/imm32/left:unused +13119 0/imm32/right:null +13120 0/imm32/right:null +13121 +13122 == code +13123 emit-subx-primitive: # out: (addr buffered-file), stmt: (addr stmt), primitive: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) +13124 # . prologue +13125 55/push-ebp +13126 89/<- %ebp 4/r32/esp +13127 # . save registers +13128 50/push-eax +13129 51/push-ecx +13130 # ecx = primitive +13131 8b/-> *(ebp+0x10) 1/r32/ecx +13132 # emit primitive name +13133 (emit-indent *(ebp+8) *Curr-block-depth) +13134 (lookup *(ecx+0x18) *(ecx+0x1c)) # Primitive-subx-name Primitive-subx-name => eax +13135 (write-buffered *(ebp+8) %eax) +13136 # emit rm32 if necessary +13137 (emit-subx-rm32 *(ebp+8) *(ecx+0x20) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-rm32 +13138 # emit r32 if necessary +13139 (emit-subx-r32 *(ebp+8) *(ecx+0x24) *(ebp+0xc)) # Primitive-subx-r32 +13140 # emit imm32 if necessary +13141 (emit-subx-imm32 *(ebp+8) *(ecx+0x28) *(ebp+0xc)) # Primitive-subx-imm32 +13142 # emit disp32 if necessary +13143 (emit-subx-disp32 *(ebp+8) *(ecx+0x2c) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-disp32 +13144 (write-buffered *(ebp+8) Newline) +13145 $emit-subx-primitive:end: +13146 # . restore registers +13147 59/pop-to-ecx +13148 58/pop-to-eax +13149 # . epilogue +13150 89/<- %esp 5/r32/ebp +13151 5d/pop-to-ebp +13152 c3/return +13153 +13154 emit-subx-rm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +13155 # . prologue +13156 55/push-ebp +13157 89/<- %ebp 4/r32/esp +13158 # . save registers +13159 50/push-eax +13160 # if (l == 0) return +13161 81 7/subop/compare *(ebp+0xc) 0/imm32 +13162 74/jump-if-= $emit-subx-rm32:end/disp8 +13163 # var v/eax: (addr stmt-var) +13164 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax +13165 (emit-subx-var-as-rm32 *(ebp+8) %eax) +13166 $emit-subx-rm32:end: +13167 # . restore registers +13168 58/pop-to-eax +13169 # . epilogue +13170 89/<- %esp 5/r32/ebp +13171 5d/pop-to-ebp +13172 c3/return +13173 +13174 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) +13175 # . prologue +13176 55/push-ebp +13177 89/<- %ebp 4/r32/esp +13178 # . save registers +13179 51/push-ecx +13180 # eax = l +13181 8b/-> *(ebp+0xc) 0/r32/eax +13182 # ecx = stmt +13183 8b/-> *(ebp+8) 1/r32/ecx +13184 # if (l == 1) return stmt->inouts +13185 { +13186 3d/compare-eax-and 1/imm32 +13187 75/jump-if-!= break/disp8 +13188 $get-stmt-operand-from-arg-location:1: +13189 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +13190 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +13191 } +13192 # if (l == 2) return stmt->inouts->next +13193 { +13194 3d/compare-eax-and 2/imm32 +13195 75/jump-if-!= break/disp8 +13196 $get-stmt-operand-from-arg-location:2: +13197 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +13198 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +13199 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +13200 } +13201 # if (l == 3) return stmt->outputs +13202 { +13203 3d/compare-eax-and 3/imm32 +13204 75/jump-if-!= break/disp8 +13205 $get-stmt-operand-from-arg-location:3: +13206 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +13207 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +13208 } +13209 # abort +13210 e9/jump $get-stmt-operand-from-arg-location:abort/disp32 +13211 $get-stmt-operand-from-arg-location:end: +13212 # . restore registers +13213 59/pop-to-ecx +13214 # . epilogue +13215 89/<- %esp 5/r32/ebp +13216 5d/pop-to-ebp +13217 c3/return +13218 +13219 $get-stmt-operand-from-arg-location:abort: +13220 # error("invalid arg-location " eax) +13221 (write-buffered *(ebp+0x10) "invalid arg-location ") +13222 (print-int32-buffered *(ebp+0x10) %eax) +13223 (write-buffered *(ebp+0x10) Newline) +13224 (flush *(ebp+0x10)) +13225 (stop *(ebp+0x14) 1) +13226 # never gets here +13227 +13228 emit-subx-r32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +13229 # . prologue +13230 55/push-ebp +13231 89/<- %ebp 4/r32/esp +13232 # . save registers +13233 50/push-eax +13234 51/push-ecx +13235 # if (l == 0) return +13236 81 7/subop/compare *(ebp+0xc) 0/imm32 +13237 0f 84/jump-if-= $emit-subx-r32:end/disp32 +13238 # var v/eax: (addr stmt-var) +13239 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +13240 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +13241 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +13242 (maybe-get Registers %eax 0xc) # => eax: (addr register-index) +13243 (write-buffered *(ebp+8) Space) +13244 (print-int32-buffered *(ebp+8) *eax) +13245 (write-buffered *(ebp+8) "/r32") +13246 $emit-subx-r32:end: +13247 # . restore registers +13248 59/pop-to-ecx +13249 58/pop-to-eax +13250 # . epilogue +13251 89/<- %esp 5/r32/ebp +13252 5d/pop-to-ebp +13253 c3/return +13254 +13255 emit-subx-imm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +13256 # . prologue +13257 55/push-ebp +13258 89/<- %ebp 4/r32/esp +13259 # . save registers +13260 50/push-eax +13261 51/push-ecx +13262 # if (l == 0) return +13263 81 7/subop/compare *(ebp+0xc) 0/imm32 +13264 0f 84/jump-if-= $emit-subx-imm32:end/disp32 +13265 # var v/eax: (handle var) +13266 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +13267 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +13268 (lookup *eax *(eax+4)) # Var-name Var-name => eax +13269 (write-buffered *(ebp+8) Space) +13270 (write-buffered *(ebp+8) %eax) +13271 (write-buffered *(ebp+8) "/imm32") +13272 $emit-subx-imm32:end: +13273 # . restore registers +13274 59/pop-to-ecx +13275 58/pop-to-eax +13276 # . epilogue +13277 89/<- %esp 5/r32/ebp +13278 5d/pop-to-ebp +13279 c3/return +13280 +13281 emit-subx-disp32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +13282 # . prologue +13283 55/push-ebp +13284 89/<- %ebp 4/r32/esp +13285 # . save registers +13286 50/push-eax +13287 51/push-ecx +13288 # if (location == 0) return +13289 81 7/subop/compare *(ebp+0xc) 0/imm32 +13290 0f 84/jump-if-= $emit-subx-disp32:end/disp32 +13291 # var v/eax: (addr stmt-var) +13292 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax +13293 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +13294 (lookup *eax *(eax+4)) # Var-name Var-name => eax +13295 (write-buffered *(ebp+8) Space) +13296 (write-buffered *(ebp+8) %eax) +13297 # hack: if instruction operation starts with "break", emit ":break" +13298 # var name/ecx: (addr array byte) = lookup(stmt->operation) +13299 8b/-> *(ebp+0x10) 0/r32/eax +13300 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +13301 89/<- %ecx 0/r32/eax +13302 { +13303 (string-starts-with? %ecx "break") # => eax +13304 3d/compare-eax-and 0/imm32/false +13305 74/jump-if-= break/disp8 +13306 (write-buffered *(ebp+8) ":break") +13307 } +13308 # hack: if instruction operation starts with "loop", emit ":loop" +13309 { +13310 (string-starts-with? %ecx "loop") # => eax +13311 3d/compare-eax-and 0/imm32/false +13312 74/jump-if-= break/disp8 +13313 (write-buffered *(ebp+8) ":loop") +13314 } +13315 (write-buffered *(ebp+8) "/disp32") +13316 $emit-subx-disp32:end: +13317 # . restore registers +13318 59/pop-to-ecx +13319 58/pop-to-eax +13320 # . epilogue +13321 89/<- %esp 5/r32/ebp +13322 5d/pop-to-ebp +13323 c3/return +13324 +13325 emit-call: # out: (addr buffered-file), stmt: (addr stmt) +13326 # . prologue +13327 55/push-ebp +13328 89/<- %ebp 4/r32/esp +13329 # . save registers +13330 50/push-eax +13331 51/push-ecx +13332 # +13333 (emit-indent *(ebp+8) *Curr-block-depth) +13334 (write-buffered *(ebp+8) "(") +13335 # ecx = stmt +13336 8b/-> *(ebp+0xc) 1/r32/ecx +13337 # - emit function name +13338 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +13339 (write-buffered *(ebp+8) %eax) +13340 # - emit arguments +13341 # var curr/eax: (addr stmt-var) = lookup(stmt->inouts) +13342 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +13343 { +13344 # if (curr == null) break +13345 3d/compare-eax-and 0/imm32 +13346 74/jump-if-= break/disp8 +13347 # +13348 (emit-subx-call-operand *(ebp+8) %eax) +13349 # curr = lookup(curr->next) +13350 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +13351 eb/jump loop/disp8 +13352 } +13353 # +13354 (write-buffered *(ebp+8) ")\n") +13355 $emit-call:end: +13356 # . restore registers +13357 59/pop-to-ecx +13358 58/pop-to-eax +13359 # . epilogue +13360 89/<- %esp 5/r32/ebp +13361 5d/pop-to-ebp +13362 c3/return +13363 +13364 emit-subx-call-operand: # out: (addr buffered-file), s: (addr stmt-var) +13365 # shares code with emit-subx-var-as-rm32 +13366 # . prologue +13367 55/push-ebp +13368 89/<- %ebp 4/r32/esp +13369 # . save registers +13370 50/push-eax +13371 51/push-ecx +13372 56/push-esi +13373 # ecx = s +13374 8b/-> *(ebp+0xc) 1/r32/ecx +13375 # var operand/esi: (addr var) = lookup(s->value) +13376 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +13377 89/<- %esi 0/r32/eax +13378 # if (operand->register && !s->is-deref?) emit "%__" +13379 { +13380 $emit-subx-call-operand:check-for-register-direct: +13381 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +13382 74/jump-if-= break/disp8 +13383 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +13384 75/jump-if-!= break/disp8 +13385 $emit-subx-call-operand:register-direct: +13386 (write-buffered *(ebp+8) " %") +13387 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +13388 (write-buffered *(ebp+8) %eax) +13389 e9/jump $emit-subx-call-operand:end/disp32 +13390 } +13391 # else if (operand->register && s->is-deref?) emit "*__" +13392 { +13393 $emit-subx-call-operand:check-for-register-indirect: +13394 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +13395 74/jump-if-= break/disp8 +13396 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +13397 74/jump-if-= break/disp8 +13398 $emit-subx-call-operand:register-indirect: +13399 (emit-subx-call-operand-register-indirect *(ebp+8) %esi) +13400 e9/jump $emit-subx-call-operand:end/disp32 +13401 } +13402 # else if (operand->stack-offset) emit "*(ebp+__)" +13403 { +13404 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset +13405 74/jump-if-= break/disp8 +13406 $emit-subx-call-operand:stack: +13407 (emit-subx-call-operand-stack *(ebp+8) %esi) +13408 e9/jump $emit-subx-call-operand:end/disp32 +13409 } +13410 # else if (operand->type == literal) emit "__" +13411 { +13412 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +13413 81 7/subop/compare *(eax+4) 0/imm32 # Tree-left +13414 75/jump-if-!= break/disp8 +13415 $emit-subx-call-operand:literal: +13416 (write-buffered *(ebp+8) Space) +13417 (lookup *esi *(esi+4)) # Var-name Var-name => eax +13418 (write-buffered *(ebp+8) %eax) +13419 } +13420 $emit-subx-call-operand:end: +13421 # . restore registers +13422 5e/pop-to-esi +13423 59/pop-to-ecx +13424 58/pop-to-eax +13425 # . epilogue +13426 89/<- %esp 5/r32/ebp +13427 5d/pop-to-ebp +13428 c3/return +13429 +13430 emit-subx-call-operand-register-indirect: # out: (addr buffered-file), v: (addr var) +13431 # . prologue +13432 55/push-ebp +13433 89/<- %ebp 4/r32/esp +13434 # . save registers +13435 50/push-eax +13436 51/push-ecx +13437 56/push-esi +13438 # esi = v +13439 8b/-> *(ebp+0xc) 6/r32/esi +13440 # var size/ecx: int = size-of-deref(v) +13441 (size-of-deref %esi) # => eax +13442 89/<- %ecx 0/r32/eax +13443 # var reg-name/esi: (addr array byte) = lookup(v->register) +13444 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +13445 89/<- %esi 0/r32/eax +13446 # TODO: assert size is a multiple of 4 +13447 # var i/eax: int = 0 +13448 b8/copy-to-eax 0/imm32 +13449 { +13450 $emit-subx-call-operand-register-indirect:loop: +13451 # if (i >= size) break +13452 39/compare %eax 1/r32/ecx +13453 7d/jump-if->= break/disp8 +13454 # emit " *(" v->register "+" i ")" +13455 (write-buffered *(ebp+8) " *(") +13456 (write-buffered *(ebp+8) %esi) +13457 (write-buffered *(ebp+8) "+") +13458 (print-int32-buffered *(ebp+8) %eax) +13459 (write-buffered *(ebp+8) ")") +13460 # i += 4 +13461 05/add-to-eax 4/imm32 +13462 # +13463 eb/jump loop/disp8 +13464 } +13465 $emit-subx-call-operand-register-indirect:end: +13466 # . restore registers +13467 5e/pop-to-esi +13468 59/pop-to-ecx +13469 58/pop-to-eax +13470 # . epilogue +13471 89/<- %esp 5/r32/ebp +13472 5d/pop-to-ebp +13473 c3/return +13474 +13475 emit-subx-call-operand-stack: # out: (addr buffered-file), v: (addr var) +13476 # . prologue +13477 55/push-ebp +13478 89/<- %ebp 4/r32/esp +13479 # . save registers +13480 50/push-eax +13481 51/push-ecx +13482 56/push-esi +13483 # esi = v +13484 8b/-> *(ebp+0xc) 6/r32/esi +13485 # var curr/ecx: int = v->offset +13486 8b/-> *(esi+0x14) 1/r32/ecx # Var-offset +13487 # var max/eax: int = v->offset + size-of(v) +13488 (size-of %esi) # => eax +13489 # TODO: assert size is a multiple of 4 +13490 01/add-to %eax 1/r32/ecx +13491 { +13492 $emit-subx-call-operand-stack:loop: +13493 # if (curr >= max) break +13494 39/compare %ecx 0/r32/eax +13495 7d/jump-if->= break/disp8 +13496 # emit " *(ebp+" curr ")" +13497 (write-buffered *(ebp+8) " *(ebp+") +13498 (print-int32-buffered *(ebp+8) %ecx) +13499 (write-buffered *(ebp+8) ")") +13500 # i += 4 +13501 81 0/subop/add %ecx 4/imm32 +13502 # +13503 eb/jump loop/disp8 +13504 } +13505 $emit-subx-call-operand-stack:end: +13506 # . restore registers +13507 5e/pop-to-esi +13508 59/pop-to-ecx +13509 58/pop-to-eax +13510 # . epilogue +13511 89/<- %esp 5/r32/ebp +13512 5d/pop-to-ebp +13513 c3/return +13514 +13515 emit-subx-var-as-rm32: # out: (addr buffered-file), s: (addr stmt-var) +13516 # . prologue +13517 55/push-ebp +13518 89/<- %ebp 4/r32/esp +13519 # . save registers +13520 50/push-eax +13521 51/push-ecx +13522 56/push-esi +13523 # ecx = s +13524 8b/-> *(ebp+0xc) 1/r32/ecx +13525 # var operand/esi: (addr var) = lookup(s->value) +13526 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +13527 89/<- %esi 0/r32/eax +13528 # if (operand->register && s->is-deref?) emit "*__" +13529 { +13530 $emit-subx-var-as-rm32:check-for-register-indirect: +13531 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +13532 74/jump-if-= break/disp8 +13533 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +13534 74/jump-if-= break/disp8 +13535 $emit-subx-var-as-rm32:register-indirect: +13536 (write-buffered *(ebp+8) " *") +13537 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +13538 (write-buffered *(ebp+8) %eax) +13539 e9/jump $emit-subx-var-as-rm32:end/disp32 +13540 } +13541 # if (operand->register && !s->is-deref?) emit "%__" +13542 { +13543 $emit-subx-var-as-rm32:check-for-register-direct: +13544 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +13545 74/jump-if-= break/disp8 +13546 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +13547 75/jump-if-!= break/disp8 +13548 $emit-subx-var-as-rm32:register-direct: +13549 (write-buffered *(ebp+8) " %") +13550 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +13551 (write-buffered *(ebp+8) %eax) +13552 e9/jump $emit-subx-var-as-rm32:end/disp32 +13553 } +13554 # else if (operand->stack-offset) emit "*(ebp+__)" +13555 { +13556 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset +13557 74/jump-if-= break/disp8 +13558 $emit-subx-var-as-rm32:stack: +13559 (write-buffered *(ebp+8) Space) +13560 (write-buffered *(ebp+8) "*(ebp+") +13561 (print-int32-buffered *(ebp+8) *(esi+0x14)) # Var-offset +13562 (write-buffered *(ebp+8) ")") +13563 } +13564 $emit-subx-var-as-rm32:end: +13565 # . restore registers +13566 5e/pop-to-esi +13567 59/pop-to-ecx +13568 58/pop-to-eax +13569 # . epilogue +13570 89/<- %esp 5/r32/ebp +13571 5d/pop-to-ebp +13572 c3/return +13573 +13574 find-matching-primitive: # primitives: (addr primitive), stmt: (addr stmt) -> result/eax: (addr primitive) +13575 # . prologue +13576 55/push-ebp +13577 89/<- %ebp 4/r32/esp +13578 # . save registers +13579 51/push-ecx +13580 # var curr/ecx: (addr primitive) = primitives +13581 8b/-> *(ebp+8) 1/r32/ecx +13582 { +13583 $find-matching-primitive:loop: +13584 # if (curr == null) break +13585 81 7/subop/compare %ecx 0/imm32 +13586 0f 84/jump-if-= break/disp32 +13587 # if match(curr, stmt) return curr +13588 { +13589 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx) # => eax +13590 3d/compare-eax-and 0/imm32/false +13591 74/jump-if-= break/disp8 +13592 89/<- %eax 1/r32/ecx +13593 eb/jump $find-matching-primitive:end/disp8 +13594 } +13595 $find-matching-primitive:next-primitive: +13596 # curr = curr->next +13597 (lookup *(ecx+0x34) *(ecx+0x38)) # Primitive-next Primitive-next => eax +13598 89/<- %ecx 0/r32/eax +13599 # +13600 e9/jump loop/disp32 +13601 } +13602 # return null +13603 b8/copy-to-eax 0/imm32 +13604 $find-matching-primitive:end: +13605 # . restore registers +13606 59/pop-to-ecx +13607 # . epilogue +13608 89/<- %esp 5/r32/ebp +13609 5d/pop-to-ebp +13610 c3/return +13611 +13612 mu-stmt-matches-primitive?: # stmt: (addr stmt), primitive: (addr primitive) -> result/eax: boolean +13613 # A mu stmt matches a primitive if the name matches, all the inout vars +13614 # match, and all the output vars match. +13615 # Vars match if types match and registers match. +13616 # In addition, a stmt output matches a primitive's output if types match +13617 # and the primitive has a wildcard register. +13618 # . prologue +13619 55/push-ebp +13620 89/<- %ebp 4/r32/esp +13621 # . save registers +13622 51/push-ecx +13623 52/push-edx +13624 53/push-ebx +13625 56/push-esi +13626 57/push-edi +13627 # ecx = stmt +13628 8b/-> *(ebp+8) 1/r32/ecx +13629 # edx = primitive +13630 8b/-> *(ebp+0xc) 2/r32/edx +13631 { +13632 $mu-stmt-matches-primitive?:check-name: +13633 # if (primitive->name != stmt->operation) return false +13634 # . var esi: (addr array byte) = lookup(stmt->operation) +13635 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +13636 89/<- %esi 0/r32/eax +13637 # . var edi: (addr array byte) = lookup(primitive->name) +13638 (lookup *edx *(edx+4)) # Primitive-name Primitive-name => eax +13639 89/<- %edi 0/r32/eax +13640 (string-equal? %esi %edi) # => eax +13641 3d/compare-eax-and 0/imm32/false +13642 75/jump-if-!= break/disp8 +13643 b8/copy-to-eax 0/imm32 +13644 e9/jump $mu-stmt-matches-primitive?:end/disp32 +13645 } +13646 # var curr/esi: (addr stmt-var) = lookup(stmt->inouts) +13647 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +13648 89/<- %esi 0/r32/eax +13649 # var curr2/edi: (addr list var) = lookup(primitive->inouts) +13650 (lookup *(edx+8) *(edx+0xc)) # Primitive-inouts Primitive-inouts => eax +13651 89/<- %edi 0/r32/eax +13652 { +13653 $mu-stmt-matches-primitive?:inouts-loop: +13654 # if (curr == 0 && curr2 == 0) move on to check outputs +13655 { +13656 $mu-stmt-matches-primitive?:check-both-inouts-null: +13657 81 7/subop/compare %esi 0/imm32 +13658 75/jump-if-!= break/disp8 +13659 $mu-stmt-matches-primitive?:stmt-inout-null: +13660 81 7/subop/compare %edi 0/imm32 +13661 0f 84/jump-if-= $mu-stmt-matches-primitive?:check-outputs/disp32 +13662 $mu-stmt-matches-primitive?:stmt-inout-null-and-prim-inout-not-null: +13663 # return false +13664 b8/copy-to-eax 0/imm32/false +13665 e9/jump $mu-stmt-matches-primitive?:end/disp32 +13666 } +13667 # if (curr2 == 0) return false +13668 { +13669 $mu-stmt-matches-primitive?:check-prim-inout-null: +13670 81 7/subop/compare %edi 0/imm32 +13671 75/jump-if-!= break/disp8 +13672 $mu-stmt-matches-primitive?:prim-inout-null: +13673 b8/copy-to-eax 0/imm32/false +13674 e9/jump $mu-stmt-matches-primitive?:end/disp32 +13675 } +13676 # if (curr != curr2) return false +13677 { +13678 $mu-stmt-matches-primitive?:check-inouts-match: +13679 (lookup *edi *(edi+4)) # List-value List-value => eax +13680 (operand-matches-primitive? %esi %eax) # => eax +13681 3d/compare-eax-and 0/imm32/false +13682 75/jump-if-!= break/disp8 +13683 $mu-stmt-matches-primitive?:inouts-match: +13684 b8/copy-to-eax 0/imm32/false +13685 e9/jump $mu-stmt-matches-primitive?:end/disp32 +13686 } +13687 $mu-stmt-matches-primitive?:next-inout: +13688 # curr = lookup(curr->next) +13689 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +13690 89/<- %esi 0/r32/eax +13691 # curr2 = lookup(curr2->next) +13692 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +13693 89/<- %edi 0/r32/eax +13694 # +13695 e9/jump loop/disp32 +13696 } +13697 $mu-stmt-matches-primitive?:check-outputs: +13698 # var curr/esi: (addr stmt-var) = lookup(stmt->outputs) +13699 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +13700 89/<- %esi 0/r32/eax +13701 # var curr2/edi: (addr list var) = lookup(primitive->outputs) +13702 (lookup *(edx+0x10) *(edx+0x14)) # Primitive-outputs Primitive-outputs => eax +13703 89/<- %edi 0/r32/eax +13704 { +13705 $mu-stmt-matches-primitive?:outputs-loop: +13706 # if (curr == 0) return (curr2 == 0) +13707 { +13708 $mu-stmt-matches-primitive?:check-both-outputs-null: +13709 81 7/subop/compare %esi 0/imm32 +13710 75/jump-if-!= break/disp8 +13711 { +13712 $mu-stmt-matches-primitive?:stmt-output-null: +13713 81 7/subop/compare %edi 0/imm32 +13714 75/jump-if-!= break/disp8 +13715 $mu-stmt-matches-primitive?:both-outputs-null: +13716 # return true +13717 b8/copy-to-eax 1/imm32 +13718 e9/jump $mu-stmt-matches-primitive?:end/disp32 +13719 } +13720 $mu-stmt-matches-primitive?:stmt-output-null-and-prim-output-not-null: +13721 # return false +13722 b8/copy-to-eax 0/imm32 +13723 e9/jump $mu-stmt-matches-primitive?:end/disp32 +13724 } +13725 # if (curr2 == 0) return false +13726 { +13727 $mu-stmt-matches-primitive?:check-prim-output-null: +13728 81 7/subop/compare %edi 0/imm32 +13729 75/jump-if-!= break/disp8 +13730 $mu-stmt-matches-primitive?:prim-output-is-null: +13731 b8/copy-to-eax 0/imm32 +13732 e9/jump $mu-stmt-matches-primitive?:end/disp32 +13733 } +13734 # if (curr != curr2) return false +13735 { +13736 $mu-stmt-matches-primitive?:check-outputs-match: +13737 (lookup *edi *(edi+4)) # List-value List-value => eax +13738 (operand-matches-primitive? %esi %eax) # => eax +13739 3d/compare-eax-and 0/imm32/false +13740 75/jump-if-!= break/disp8 +13741 $mu-stmt-matches-primitive?:outputs-match: +13742 b8/copy-to-eax 0/imm32 +13743 e9/jump $mu-stmt-matches-primitive?:end/disp32 +13744 } +13745 $mu-stmt-matches-primitive?:next-output: +13746 # curr = lookup(curr->next) +13747 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +13748 89/<- %esi 0/r32/eax +13749 # curr2 = lookup(curr2->next) +13750 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +13751 89/<- %edi 0/r32/eax +13752 # +13753 e9/jump loop/disp32 +13754 } +13755 $mu-stmt-matches-primitive?:return-true: +13756 b8/copy-to-eax 1/imm32 +13757 $mu-stmt-matches-primitive?:end: +13758 # . restore registers +13759 5f/pop-to-edi +13760 5e/pop-to-esi +13761 5b/pop-to-ebx +13762 5a/pop-to-edx +13763 59/pop-to-ecx +13764 # . epilogue +13765 89/<- %esp 5/r32/ebp +13766 5d/pop-to-ebp +13767 c3/return +13768 +13769 operand-matches-primitive?: # s: (addr stmt-var), prim-var: (addr var) -> result/eax: boolean +13770 # . prologue +13771 55/push-ebp +13772 89/<- %ebp 4/r32/esp +13773 # . save registers +13774 51/push-ecx +13775 52/push-edx +13776 53/push-ebx +13777 56/push-esi +13778 57/push-edi +13779 # ecx = s +13780 8b/-> *(ebp+8) 1/r32/ecx +13781 # var var/esi: (addr var) = lookup(s->value) +13782 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +13783 89/<- %esi 0/r32/eax +13784 # edi = prim-var +13785 8b/-> *(ebp+0xc) 7/r32/edi +13786 $operand-matches-primitive?:check-type: +13787 # if (var->type != prim-var->type) return false +13788 # . var vtype/ebx: (addr tree type-id) = lookup(var->type) +13789 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +13790 89/<- %ebx 0/r32/eax +13791 # . var ptype/eax: (addr tree type-id) = lookup(prim-var->type) +13792 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +13793 (subx-type-equal? %ebx %eax) # => eax +13794 3d/compare-eax-and 0/imm32/false +13795 0f 84/jump-if-= $operand-matches-primitive?:return-false/disp32 +13796 { +13797 $operand-matches-primitive?:check-register: +13798 # if prim-var is in memory and var is in register but dereference, match +13799 { +13800 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register +13801 0f 85/jump-if-!= break/disp32 +13802 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +13803 74/jump-if-= break/disp8 +13804 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +13805 74/jump-if-= break/disp8 +13806 $operand-matches-primitive?:var-deref-match: +13807 e9/jump $operand-matches-primitive?:return-true/disp32 +13808 } +13809 # if prim-var is in register and var is in register but dereference, no match +13810 { +13811 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register +13812 0f 84/jump-if-= break/disp32 +13813 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +13814 0f 84/jump-if-= break/disp32 +13815 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +13816 74/jump-if-= break/disp8 +13817 $operand-matches-primitive?:var-deref-no-match: +13818 e9/jump $operand-matches-primitive?:return-false/disp32 +13819 } +13820 # return false if var->register doesn't match prim-var->register +13821 { +13822 # if register addresses are equal, it's a match +13823 # var vreg/ebx: (addr array byte) = lookup(var->register) +13824 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +13825 89/<- %ebx 0/r32/eax +13826 # var preg/ecx: (addr array byte) = lookup(prim-var->register) +13827 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax +13828 89/<- %ecx 0/r32/eax +13829 # if (vreg == preg) break +13830 39/compare %ecx 3/r32/ebx +13831 74/jump-if-= break/disp8 +13832 $operand-matches-primitive?:var-register-no-match: +13833 # if either address is 0, return false +13834 81 7/subop/compare %ebx 0/imm32 +13835 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +13836 81 7/subop/compare %ecx 0/imm32 +13837 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +13838 # if prim-var->register is wildcard, it's a match +13839 (string-equal? %ecx "*") # Any-register => eax +13840 3d/compare-eax-and 0/imm32/false +13841 75/jump-if-!= break/disp8 +13842 $operand-matches-primitive?:wildcard-no-match: +13843 # if string contents aren't equal, return false +13844 (string-equal? %ecx %ebx) # => eax +13845 3d/compare-eax-and 0/imm32/false +13846 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +13847 } +13848 } +13849 $operand-matches-primitive?:return-true: +13850 b8/copy-to-eax 1/imm32/true +13851 eb/jump $operand-matches-primitive?:end/disp8 +13852 $operand-matches-primitive?:return-false: +13853 b8/copy-to-eax 0/imm32/false +13854 $operand-matches-primitive?:end: +13855 # . restore registers +13856 5f/pop-to-edi +13857 5e/pop-to-esi +13858 5b/pop-to-ebx +13859 5a/pop-to-edx +13860 59/pop-to-ecx +13861 # . epilogue +13862 89/<- %esp 5/r32/ebp +13863 5d/pop-to-ebp +13864 c3/return +13865 +13866 subx-type-equal?: # a: (addr tree type-id), b: (addr tree type-id) -> result/eax: boolean +13867 # . prologue +13868 55/push-ebp +13869 89/<- %ebp 4/r32/esp +13870 # . save registers +13871 51/push-ecx +13872 # var alit/ecx: boolean = is-literal-type?(a) +13873 (is-simple-mu-type? *(ebp+8) 0) # => eax +13874 89/<- %ecx 0/r32/eax +13875 # var blit/eax: boolean = is-literal-type?(b) +13876 (is-simple-mu-type? *(ebp+0xc) 0) # => eax +13877 # return alit == blit +13878 39/compare %eax 1/r32/ecx +13879 0f 94/set-byte-if-= %al +13880 81 4/subop/and %eax 0xff/imm32 +13881 $subx-type-equal?:end: +13882 # . restore registers +13883 59/pop-to-ecx +13884 # . epilogue +13885 89/<- %esp 5/r32/ebp +13886 5d/pop-to-ebp +13887 c3/return +13888 +13889 is-simple-mu-type?: # a: (addr tree type-id), n: type-id -> result/eax: boolean +13890 # . prologue +13891 55/push-ebp +13892 89/<- %ebp 4/r32/esp +13893 # . save registers +13894 51/push-ecx +13895 # ecx = n +13896 8b/-> *(ebp+0xc) 1/r32/ecx +13897 # return (a->value == n) +13898 8b/-> *(ebp+8) 0/r32/eax +13899 39/compare *(eax+4) 1/r32/ecx # Tree-value +13900 0f 94/set-byte-if-= %al +13901 81 4/subop/and %eax 0xff/imm32 +13902 $is-simple-mu-type?:end: +13903 # . restore registers +13904 59/pop-to-ecx +13905 # . epilogue +13906 89/<- %esp 5/r32/ebp +13907 5d/pop-to-ebp +13908 c3/return +13909 +13910 test-emit-subx-stmt-primitive: +13911 # Primitive operation on a variable on the stack. +13912 # increment foo +13913 # => +13914 # ff 0/subop/increment *(ebp-8) +13915 # +13916 # There's a variable on the var stack as follows: +13917 # name: 'foo' +13918 # type: int +13919 # stack-offset: -8 +13920 # +13921 # There's a primitive with this info: +13922 # name: 'increment' +13923 # inouts: int/mem +13924 # value: 'ff 0/subop/increment' +13925 # +13926 # . prologue +13927 55/push-ebp +13928 89/<- %ebp 4/r32/esp +13929 # setup +13930 (clear-stream _test-output-stream) +13931 (clear-stream $_test-output-buffered-file->buffer) +13932 # simulate allocated payloads starting with an initial fake alloc-id (0x11) +13933 $test-emit-subx-stmt-primitive:initialize-type: +13934 # var type/ecx: (payload tree type-id) = int 13935 68/push 0/imm32/right:null -13936 68/push 0/imm32/left:unused -13937 68/push 1/imm32/value:int -13938 68/push 1/imm32/is-atom?:true -13939 68/push 0x11/imm32/alloc-id:fake:payload -13940 89/<- %ecx 4/r32/esp -13941 $test-emit-subx-stmt-primitive:initialize-var: -13942 # var var-foo/ecx: (payload var) = var(type) -13943 68/push 0/imm32/no-register +13936 68/push 0/imm32/right:null +13937 68/push 0/imm32/left:unused +13938 68/push 1/imm32/value:int +13939 68/push 1/imm32/is-atom?:true +13940 68/push 0x11/imm32/alloc-id:fake:payload +13941 89/<- %ecx 4/r32/esp +13942 $test-emit-subx-stmt-primitive:initialize-var: +13943 # var var-foo/ecx: (payload var) = var(type) 13944 68/push 0/imm32/no-register -13945 68/push -8/imm32/stack-offset -13946 68/push 1/imm32/block-depth -13947 51/push-ecx/type -13948 68/push 0x11/imm32/alloc-id:fake -13949 68/push 0/imm32/name +13945 68/push 0/imm32/no-register +13946 68/push -8/imm32/stack-offset +13947 68/push 1/imm32/block-depth +13948 51/push-ecx/type +13949 68/push 0x11/imm32/alloc-id:fake 13950 68/push 0/imm32/name -13951 68/push 0x11/imm32/alloc-id:fake:payload -13952 89/<- %ecx 4/r32/esp -13953 $test-emit-subx-stmt-primitive:initialize-var-name: -13954 # var-foo->name = "foo" -13955 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -13956 (copy-array Heap "foo" %eax) -13957 $test-emit-subx-stmt-primitive:initialize-stmt-var: -13958 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -13959 68/push 0/imm32/is-deref:false -13960 68/push 0/imm32/next +13951 68/push 0/imm32/name +13952 68/push 0x11/imm32/alloc-id:fake:payload +13953 89/<- %ecx 4/r32/esp +13954 $test-emit-subx-stmt-primitive:initialize-var-name: +13955 # var-foo->name = "foo" +13956 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +13957 (copy-array Heap "foo" %eax) +13958 $test-emit-subx-stmt-primitive:initialize-stmt-var: +13959 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +13960 68/push 0/imm32/is-deref:false 13961 68/push 0/imm32/next -13962 51/push-ecx/var-foo -13963 68/push 0x11/imm32/alloc-id:fake -13964 68/push 0x11/imm32/alloc-id:fake:payload -13965 89/<- %ebx 4/r32/esp -13966 $test-emit-subx-stmt-primitive:initialize-stmt: -13967 # var stmt/esi: (addr statement) -13968 68/push 0/imm32/no-outputs +13962 68/push 0/imm32/next +13963 51/push-ecx/var-foo +13964 68/push 0x11/imm32/alloc-id:fake +13965 68/push 0x11/imm32/alloc-id:fake:payload +13966 89/<- %ebx 4/r32/esp +13967 $test-emit-subx-stmt-primitive:initialize-stmt: +13968 # var stmt/esi: (addr statement) 13969 68/push 0/imm32/no-outputs -13970 53/push-ebx/inouts -13971 68/push 0x11/imm32/alloc-id:fake -13972 68/push 0/imm32/operation +13970 68/push 0/imm32/no-outputs +13971 53/push-ebx/inouts +13972 68/push 0x11/imm32/alloc-id:fake 13973 68/push 0/imm32/operation -13974 68/push 1/imm32/tag -13975 89/<- %esi 4/r32/esp -13976 $test-emit-subx-stmt-primitive:initialize-stmt-operation: -13977 # stmt->operation = "increment" -13978 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -13979 (copy-array Heap "increment" %eax) -13980 $test-emit-subx-stmt-primitive:initialize-primitive: -13981 # var primitives/ebx: (addr primitive) -13982 68/push 0/imm32/next +13974 68/push 0/imm32/operation +13975 68/push 1/imm32/tag +13976 89/<- %esi 4/r32/esp +13977 $test-emit-subx-stmt-primitive:initialize-stmt-operation: +13978 # stmt->operation = "increment" +13979 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +13980 (copy-array Heap "increment" %eax) +13981 $test-emit-subx-stmt-primitive:initialize-primitive: +13982 # var primitives/ebx: (addr primitive) 13983 68/push 0/imm32/next -13984 68/push 0/imm32/output-is-write-only -13985 68/push 0/imm32/no-disp32 -13986 68/push 0/imm32/no-imm32 -13987 68/push 0/imm32/no-r32 -13988 68/push 1/imm32/rm32-is-first-inout -13989 68/push 0/imm32/subx-name +13984 68/push 0/imm32/next +13985 68/push 0/imm32/output-is-write-only +13986 68/push 0/imm32/no-disp32 +13987 68/push 0/imm32/no-imm32 +13988 68/push 0/imm32/no-r32 +13989 68/push 1/imm32/rm32-is-first-inout 13990 68/push 0/imm32/subx-name -13991 68/push 0/imm32/no-outputs +13991 68/push 0/imm32/subx-name 13992 68/push 0/imm32/no-outputs -13993 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -13994 68/push 0x11/imm32/alloc-id:fake -13995 68/push 0/imm32/name +13993 68/push 0/imm32/no-outputs +13994 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +13995 68/push 0x11/imm32/alloc-id:fake 13996 68/push 0/imm32/name -13997 89/<- %ebx 4/r32/esp -13998 $test-emit-subx-stmt-primitive:initialize-primitive-name: -13999 # primitives->name = "increment" -14000 (copy-array Heap "increment" %ebx) # Primitive-name -14001 $test-emit-subx-stmt-primitive:initialize-primitive-subx-name: -14002 # primitives->subx-name = "ff 0/subop/increment" -14003 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -14004 (copy-array Heap "ff 0/subop/increment" %eax) -14005 # convert -14006 c7 0/subop/copy *Curr-block-depth 0/imm32 -14007 (emit-subx-stmt _test-output-buffered-file %esi %ebx) -14008 (flush _test-output-buffered-file) -14009 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -14015 # check output -14016 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive") -14017 # . epilogue -14018 89/<- %esp 5/r32/ebp -14019 5d/pop-to-ebp -14020 c3/return -14021 -14022 test-emit-subx-stmt-primitive-register: -14023 # Primitive operation on a variable in a register. -14024 # foo <- increment -14025 # => -14026 # ff 0/subop/increment %eax # sub-optimal, but should suffice -14027 # -14028 # There's a variable on the var stack as follows: -14029 # name: 'foo' -14030 # type: int -14031 # register: 'eax' -14032 # -14033 # There's a primitive with this info: -14034 # name: 'increment' -14035 # out: int/reg -14036 # value: 'ff 0/subop/increment' -14037 # -14038 # . prologue -14039 55/push-ebp -14040 89/<- %ebp 4/r32/esp -14041 # setup -14042 (clear-stream _test-output-stream) -14043 (clear-stream $_test-output-buffered-file->buffer) -14044 $test-emit-subx-stmt-primitive-register:initialize-type: -14045 # var type/ecx: (payload tree type-id) = int -14046 68/push 0/imm32/right:null +13997 68/push 0/imm32/name +13998 89/<- %ebx 4/r32/esp +13999 $test-emit-subx-stmt-primitive:initialize-primitive-name: +14000 # primitives->name = "increment" +14001 (copy-array Heap "increment" %ebx) # Primitive-name +14002 $test-emit-subx-stmt-primitive:initialize-primitive-subx-name: +14003 # primitives->subx-name = "ff 0/subop/increment" +14004 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +14005 (copy-array Heap "ff 0/subop/increment" %eax) +14006 # convert +14007 c7 0/subop/copy *Curr-block-depth 0/imm32 +14008 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +14009 (flush _test-output-buffered-file) +14010 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +14016 # check output +14017 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive") +14018 # . epilogue +14019 89/<- %esp 5/r32/ebp +14020 5d/pop-to-ebp +14021 c3/return +14022 +14023 test-emit-subx-stmt-primitive-register: +14024 # Primitive operation on a variable in a register. +14025 # foo <- increment +14026 # => +14027 # ff 0/subop/increment %eax # sub-optimal, but should suffice +14028 # +14029 # There's a variable on the var stack as follows: +14030 # name: 'foo' +14031 # type: int +14032 # register: 'eax' +14033 # +14034 # There's a primitive with this info: +14035 # name: 'increment' +14036 # out: int/reg +14037 # value: 'ff 0/subop/increment' +14038 # +14039 # . prologue +14040 55/push-ebp +14041 89/<- %ebp 4/r32/esp +14042 # setup +14043 (clear-stream _test-output-stream) +14044 (clear-stream $_test-output-buffered-file->buffer) +14045 $test-emit-subx-stmt-primitive-register:initialize-type: +14046 # var type/ecx: (payload tree type-id) = int 14047 68/push 0/imm32/right:null -14048 68/push 0/imm32/left:unused -14049 68/push 1/imm32/value:int -14050 68/push 1/imm32/is-atom?:true -14051 68/push 0x11/imm32/alloc-id:fake:payload -14052 89/<- %ecx 4/r32/esp -14053 $test-emit-subx-stmt-primitive-register:initialize-var: -14054 # var var-foo/ecx: (payload var) -14055 68/push 0/imm32/register +14048 68/push 0/imm32/right:null +14049 68/push 0/imm32/left:unused +14050 68/push 1/imm32/value:int +14051 68/push 1/imm32/is-atom?:true +14052 68/push 0x11/imm32/alloc-id:fake:payload +14053 89/<- %ecx 4/r32/esp +14054 $test-emit-subx-stmt-primitive-register:initialize-var: +14055 # var var-foo/ecx: (payload var) 14056 68/push 0/imm32/register -14057 68/push 0/imm32/no-stack-offset -14058 68/push 1/imm32/block-depth -14059 51/push-ecx -14060 68/push 0x11/imm32/alloc-id:fake -14061 68/push 0/imm32/name +14057 68/push 0/imm32/register +14058 68/push 0/imm32/no-stack-offset +14059 68/push 1/imm32/block-depth +14060 51/push-ecx +14061 68/push 0x11/imm32/alloc-id:fake 14062 68/push 0/imm32/name -14063 68/push 0x11/imm32/alloc-id:fake:payload -14064 89/<- %ecx 4/r32/esp -14065 $test-emit-subx-stmt-primitive-register:initialize-var-name: -14066 # var-foo->name = "foo" -14067 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -14068 (copy-array Heap "foo" %eax) -14069 $test-emit-subx-stmt-primitive-register:initialize-var-register: -14070 # var-foo->register = "eax" -14071 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -14072 (copy-array Heap "eax" %eax) -14073 $test-emit-subx-stmt-primitive-register:initialize-stmt-var: -14074 # var operand/ebx: (payload stmt-var) -14075 68/push 0/imm32/is-deref:false -14076 68/push 0/imm32/next +14063 68/push 0/imm32/name +14064 68/push 0x11/imm32/alloc-id:fake:payload +14065 89/<- %ecx 4/r32/esp +14066 $test-emit-subx-stmt-primitive-register:initialize-var-name: +14067 # var-foo->name = "foo" +14068 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +14069 (copy-array Heap "foo" %eax) +14070 $test-emit-subx-stmt-primitive-register:initialize-var-register: +14071 # var-foo->register = "eax" +14072 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +14073 (copy-array Heap "eax" %eax) +14074 $test-emit-subx-stmt-primitive-register:initialize-stmt-var: +14075 # var operand/ebx: (payload stmt-var) +14076 68/push 0/imm32/is-deref:false 14077 68/push 0/imm32/next -14078 51/push-ecx/var-foo -14079 68/push 0x11/imm32/alloc-id:fake -14080 68/push 0x11/imm32/alloc-id:fake:payload -14081 89/<- %ebx 4/r32/esp -14082 $test-emit-subx-stmt-primitive-register:initialize-stmt: -14083 # var stmt/esi: (addr statement) -14084 53/push-ebx/outputs -14085 68/push 0x11/imm32/alloc-id:fake -14086 68/push 0/imm32/no-inouts +14078 68/push 0/imm32/next +14079 51/push-ecx/var-foo +14080 68/push 0x11/imm32/alloc-id:fake +14081 68/push 0x11/imm32/alloc-id:fake:payload +14082 89/<- %ebx 4/r32/esp +14083 $test-emit-subx-stmt-primitive-register:initialize-stmt: +14084 # var stmt/esi: (addr statement) +14085 53/push-ebx/outputs +14086 68/push 0x11/imm32/alloc-id:fake 14087 68/push 0/imm32/no-inouts -14088 68/push 0/imm32/operation +14088 68/push 0/imm32/no-inouts 14089 68/push 0/imm32/operation -14090 68/push 1/imm32 -14091 89/<- %esi 4/r32/esp -14092 $test-emit-subx-stmt-primitive-register:initialize-stmt-operation: -14093 # stmt->operation = "increment" -14094 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -14095 (copy-array Heap "increment" %eax) -14096 $test-emit-subx-stmt-primitive-register:initialize-formal-var: -14097 # var formal-var/ebx: (payload var) -14098 68/push 0/imm32/register +14090 68/push 0/imm32/operation +14091 68/push 1/imm32 +14092 89/<- %esi 4/r32/esp +14093 $test-emit-subx-stmt-primitive-register:initialize-stmt-operation: +14094 # stmt->operation = "increment" +14095 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +14096 (copy-array Heap "increment" %eax) +14097 $test-emit-subx-stmt-primitive-register:initialize-formal-var: +14098 # var formal-var/ebx: (payload var) 14099 68/push 0/imm32/register -14100 68/push 0/imm32/no-stack-offset -14101 68/push 1/imm32/block-depth -14102 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -14103 68/push 0x11/imm32/alloc-id:fake -14104 68/push 0/imm32/name +14100 68/push 0/imm32/register +14101 68/push 0/imm32/no-stack-offset +14102 68/push 1/imm32/block-depth +14103 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +14104 68/push 0x11/imm32/alloc-id:fake 14105 68/push 0/imm32/name -14106 68/push 0x11/imm32/alloc-id:fake:payload -14107 89/<- %ebx 4/r32/esp -14108 $test-emit-subx-stmt-primitive-register:initialize-formal-var-name: -14109 # formal-var->name = "dummy" -14110 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -14111 (copy-array Heap "dummy" %eax) -14112 $test-emit-subx-stmt-primitive-register:initialize-formal-register: -14113 # formal-var->register = "*" -14114 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -14115 (copy-array Heap "*" %eax) # Any-register -14116 $test-emit-subx-stmt-primitive-register:initialize-var-list: -14117 # var formal-outputs/ebx: (payload list var) -14118 68/push 0/imm32/next +14106 68/push 0/imm32/name +14107 68/push 0x11/imm32/alloc-id:fake:payload +14108 89/<- %ebx 4/r32/esp +14109 $test-emit-subx-stmt-primitive-register:initialize-formal-var-name: +14110 # formal-var->name = "dummy" +14111 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +14112 (copy-array Heap "dummy" %eax) +14113 $test-emit-subx-stmt-primitive-register:initialize-formal-register: +14114 # formal-var->register = "*" +14115 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +14116 (copy-array Heap "*" %eax) # Any-register +14117 $test-emit-subx-stmt-primitive-register:initialize-var-list: +14118 # var formal-outputs/ebx: (payload list var) 14119 68/push 0/imm32/next -14120 53/push-ebx/formal-var -14121 68/push 0x11/imm32/alloc-id:fake -14122 68/push 0x11/imm32/alloc-id:fake:payload -14123 89/<- %ebx 4/r32/esp -14124 $test-emit-subx-stmt-primitive-register:initialize-primitive: -14125 # var primitives/ebx: (addr primitive) -14126 68/push 0/imm32/next +14120 68/push 0/imm32/next +14121 53/push-ebx/formal-var +14122 68/push 0x11/imm32/alloc-id:fake +14123 68/push 0x11/imm32/alloc-id:fake:payload +14124 89/<- %ebx 4/r32/esp +14125 $test-emit-subx-stmt-primitive-register:initialize-primitive: +14126 # var primitives/ebx: (addr primitive) 14127 68/push 0/imm32/next -14128 68/push 0/imm32/output-is-write-only -14129 68/push 0/imm32/no-disp32 -14130 68/push 0/imm32/no-imm32 -14131 68/push 0/imm32/no-r32 -14132 68/push 3/imm32/rm32-is-first-output -14133 68/push 0/imm32/subx-name +14128 68/push 0/imm32/next +14129 68/push 0/imm32/output-is-write-only +14130 68/push 0/imm32/no-disp32 +14131 68/push 0/imm32/no-imm32 +14132 68/push 0/imm32/no-r32 +14133 68/push 3/imm32/rm32-is-first-output 14134 68/push 0/imm32/subx-name -14135 53/push-ebx/outputs -14136 68/push 0x11/imm32/alloc-id:fake -14137 68/push 0/imm32/no-inouts +14135 68/push 0/imm32/subx-name +14136 53/push-ebx/outputs +14137 68/push 0x11/imm32/alloc-id:fake 14138 68/push 0/imm32/no-inouts -14139 68/push 0/imm32/name +14139 68/push 0/imm32/no-inouts 14140 68/push 0/imm32/name -14141 89/<- %ebx 4/r32/esp -14142 $test-emit-subx-stmt-primitive-register:initialize-primitive-name: -14143 # primitives->name = "increment" -14144 (copy-array Heap "increment" %ebx) # Primitive-name -14145 $test-emit-subx-stmt-primitive-register:initialize-primitive-subx-name: -14146 # primitives->subx-name = "ff 0/subop/increment" -14147 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -14148 (copy-array Heap "ff 0/subop/increment" %eax) -14149 # convert -14150 c7 0/subop/copy *Curr-block-depth 0/imm32 -14151 (emit-subx-stmt _test-output-buffered-file %esi %ebx) -14152 (flush _test-output-buffered-file) -14153 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -14159 # check output -14160 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register") -14161 # . epilogue -14162 89/<- %esp 5/r32/ebp -14163 5d/pop-to-ebp -14164 c3/return -14165 -14166 test-emit-subx-stmt-select-primitive: -14167 # Select the right primitive between overloads. -14168 # foo <- increment -14169 # => -14170 # ff 0/subop/increment %eax # sub-optimal, but should suffice -14171 # -14172 # There's a variable on the var stack as follows: -14173 # name: 'foo' -14174 # type: int -14175 # register: 'eax' -14176 # -14177 # There's two primitives, as follows: -14178 # - name: 'increment' -14179 # out: int/reg -14180 # value: 'ff 0/subop/increment' -14181 # - name: 'increment' -14182 # inout: int/mem -14183 # value: 'ff 0/subop/increment' -14184 # -14185 # . prologue -14186 55/push-ebp -14187 89/<- %ebp 4/r32/esp -14188 # setup -14189 (clear-stream _test-output-stream) -14190 (clear-stream $_test-output-buffered-file->buffer) -14191 $test-emit-subx-stmt-select-primitive:initialize-type: -14192 # var type/ecx: (payload tree type-id) = int -14193 68/push 0/imm32/right:null +14141 68/push 0/imm32/name +14142 89/<- %ebx 4/r32/esp +14143 $test-emit-subx-stmt-primitive-register:initialize-primitive-name: +14144 # primitives->name = "increment" +14145 (copy-array Heap "increment" %ebx) # Primitive-name +14146 $test-emit-subx-stmt-primitive-register:initialize-primitive-subx-name: +14147 # primitives->subx-name = "ff 0/subop/increment" +14148 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +14149 (copy-array Heap "ff 0/subop/increment" %eax) +14150 # convert +14151 c7 0/subop/copy *Curr-block-depth 0/imm32 +14152 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +14153 (flush _test-output-buffered-file) +14154 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +14160 # check output +14161 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register") +14162 # . epilogue +14163 89/<- %esp 5/r32/ebp +14164 5d/pop-to-ebp +14165 c3/return +14166 +14167 test-emit-subx-stmt-select-primitive: +14168 # Select the right primitive between overloads. +14169 # foo <- increment +14170 # => +14171 # ff 0/subop/increment %eax # sub-optimal, but should suffice +14172 # +14173 # There's a variable on the var stack as follows: +14174 # name: 'foo' +14175 # type: int +14176 # register: 'eax' +14177 # +14178 # There's two primitives, as follows: +14179 # - name: 'increment' +14180 # out: int/reg +14181 # value: 'ff 0/subop/increment' +14182 # - name: 'increment' +14183 # inout: int/mem +14184 # value: 'ff 0/subop/increment' +14185 # +14186 # . prologue +14187 55/push-ebp +14188 89/<- %ebp 4/r32/esp +14189 # setup +14190 (clear-stream _test-output-stream) +14191 (clear-stream $_test-output-buffered-file->buffer) +14192 $test-emit-subx-stmt-select-primitive:initialize-type: +14193 # var type/ecx: (payload tree type-id) = int 14194 68/push 0/imm32/right:null -14195 68/push 0/imm32/left:unused -14196 68/push 1/imm32/value:int -14197 68/push 1/imm32/is-atom?:true -14198 68/push 0x11/imm32/alloc-id:fake:payload -14199 89/<- %ecx 4/r32/esp -14200 $test-emit-subx-stmt-select-primitive:initialize-var: -14201 # var var-foo/ecx: (payload var) -14202 68/push 0/imm32/register +14195 68/push 0/imm32/right:null +14196 68/push 0/imm32/left:unused +14197 68/push 1/imm32/value:int +14198 68/push 1/imm32/is-atom?:true +14199 68/push 0x11/imm32/alloc-id:fake:payload +14200 89/<- %ecx 4/r32/esp +14201 $test-emit-subx-stmt-select-primitive:initialize-var: +14202 # var var-foo/ecx: (payload var) 14203 68/push 0/imm32/register -14204 68/push 0/imm32/no-stack-offset -14205 68/push 1/imm32/block-depth -14206 51/push-ecx -14207 68/push 0x11/imm32/alloc-id:fake -14208 68/push 0/imm32/name +14204 68/push 0/imm32/register +14205 68/push 0/imm32/no-stack-offset +14206 68/push 1/imm32/block-depth +14207 51/push-ecx +14208 68/push 0x11/imm32/alloc-id:fake 14209 68/push 0/imm32/name -14210 68/push 0x11/imm32/alloc-id:fake:payload -14211 89/<- %ecx 4/r32/esp -14212 $test-emit-subx-stmt-select-primitive:initialize-var-name: -14213 # var-foo->name = "foo" -14214 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -14215 (copy-array Heap "foo" %eax) -14216 $test-emit-subx-stmt-select-primitive:initialize-var-register: -14217 # var-foo->register = "eax" -14218 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -14219 (copy-array Heap "eax" %eax) -14220 $test-emit-subx-stmt-select-primitive:initialize-stmt-var: -14221 # var operand/ebx: (payload stmt-var) -14222 68/push 0/imm32/is-deref:false -14223 68/push 0/imm32/next +14210 68/push 0/imm32/name +14211 68/push 0x11/imm32/alloc-id:fake:payload +14212 89/<- %ecx 4/r32/esp +14213 $test-emit-subx-stmt-select-primitive:initialize-var-name: +14214 # var-foo->name = "foo" +14215 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +14216 (copy-array Heap "foo" %eax) +14217 $test-emit-subx-stmt-select-primitive:initialize-var-register: +14218 # var-foo->register = "eax" +14219 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +14220 (copy-array Heap "eax" %eax) +14221 $test-emit-subx-stmt-select-primitive:initialize-stmt-var: +14222 # var operand/ebx: (payload stmt-var) +14223 68/push 0/imm32/is-deref:false 14224 68/push 0/imm32/next -14225 51/push-ecx/var-foo -14226 68/push 0x11/imm32/alloc-id:fake -14227 68/push 0x11/imm32/alloc-id:fake:payload -14228 89/<- %ebx 4/r32/esp -14229 $test-emit-subx-stmt-select-primitive:initialize-stmt: -14230 # var stmt/esi: (addr statement) -14231 53/push-ebx/outputs -14232 68/push 0x11/imm32/alloc-id:fake -14233 68/push 0/imm32/no-inouts +14225 68/push 0/imm32/next +14226 51/push-ecx/var-foo +14227 68/push 0x11/imm32/alloc-id:fake +14228 68/push 0x11/imm32/alloc-id:fake:payload +14229 89/<- %ebx 4/r32/esp +14230 $test-emit-subx-stmt-select-primitive:initialize-stmt: +14231 # var stmt/esi: (addr statement) +14232 53/push-ebx/outputs +14233 68/push 0x11/imm32/alloc-id:fake 14234 68/push 0/imm32/no-inouts -14235 68/push 0/imm32/operation +14235 68/push 0/imm32/no-inouts 14236 68/push 0/imm32/operation -14237 68/push 1/imm32 -14238 89/<- %esi 4/r32/esp -14239 $test-emit-subx-stmt-select-primitive:initialize-stmt-operation: -14240 # stmt->operation = "increment" -14241 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -14242 (copy-array Heap "increment" %eax) -14243 $test-emit-subx-stmt-select-primitive:initialize-formal-var: -14244 # var formal-var/ebx: (payload var) -14245 68/push 0/imm32/register +14237 68/push 0/imm32/operation +14238 68/push 1/imm32 +14239 89/<- %esi 4/r32/esp +14240 $test-emit-subx-stmt-select-primitive:initialize-stmt-operation: +14241 # stmt->operation = "increment" +14242 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +14243 (copy-array Heap "increment" %eax) +14244 $test-emit-subx-stmt-select-primitive:initialize-formal-var: +14245 # var formal-var/ebx: (payload var) 14246 68/push 0/imm32/register -14247 68/push 0/imm32/no-stack-offset -14248 68/push 1/imm32/block-depth -14249 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -14250 68/push 0x11/imm32/alloc-id:fake -14251 68/push 0/imm32/name +14247 68/push 0/imm32/register +14248 68/push 0/imm32/no-stack-offset +14249 68/push 1/imm32/block-depth +14250 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +14251 68/push 0x11/imm32/alloc-id:fake 14252 68/push 0/imm32/name -14253 68/push 0x11/imm32/alloc-id:fake:payload -14254 89/<- %ebx 4/r32/esp -14255 $test-emit-subx-stmt-select-primitive:initialize-formal-var-name: -14256 # formal-var->name = "dummy" -14257 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -14258 (copy-array Heap "dummy" %eax) -14259 $test-emit-subx-stmt-select-primitive:initialize-formal-register: -14260 # formal-var->register = "*" -14261 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -14262 (copy-array Heap "*" %eax) # Any-register -14263 $test-emit-subx-stmt-select-primitive:initialize-var-list: -14264 # var formal-outputs/ebx: (payload list var) -14265 68/push 0/imm32/next +14253 68/push 0/imm32/name +14254 68/push 0x11/imm32/alloc-id:fake:payload +14255 89/<- %ebx 4/r32/esp +14256 $test-emit-subx-stmt-select-primitive:initialize-formal-var-name: +14257 # formal-var->name = "dummy" +14258 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +14259 (copy-array Heap "dummy" %eax) +14260 $test-emit-subx-stmt-select-primitive:initialize-formal-register: +14261 # formal-var->register = "*" +14262 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +14263 (copy-array Heap "*" %eax) # Any-register +14264 $test-emit-subx-stmt-select-primitive:initialize-var-list: +14265 # var formal-outputs/ebx: (payload list var) 14266 68/push 0/imm32/next -14267 53/push-ebx/formal-var -14268 68/push 0x11/imm32/alloc-id:fake -14269 68/push 0x11/imm32/alloc-id:fake:payload -14270 89/<- %ebx 4/r32/esp -14271 $test-emit-subx-stmt-select-primitive:initialize-primitive2: -14272 # var primitive2/edi: (payload primitive) -14273 68/push 0/imm32/next +14267 68/push 0/imm32/next +14268 53/push-ebx/formal-var +14269 68/push 0x11/imm32/alloc-id:fake +14270 68/push 0x11/imm32/alloc-id:fake:payload +14271 89/<- %ebx 4/r32/esp +14272 $test-emit-subx-stmt-select-primitive:initialize-primitive2: +14273 # var primitive2/edi: (payload primitive) 14274 68/push 0/imm32/next -14275 68/push 0/imm32/output-is-write-only -14276 68/push 0/imm32/no-disp32 -14277 68/push 0/imm32/no-imm32 -14278 68/push 0/imm32/no-r32 -14279 68/push 3/imm32/rm32-is-first-output -14280 68/push 0/imm32/subx-name +14275 68/push 0/imm32/next +14276 68/push 0/imm32/output-is-write-only +14277 68/push 0/imm32/no-disp32 +14278 68/push 0/imm32/no-imm32 +14279 68/push 0/imm32/no-r32 +14280 68/push 3/imm32/rm32-is-first-output 14281 68/push 0/imm32/subx-name -14282 53/push-ebx/outputs -14283 68/push 0x11/imm32/alloc-id:fake -14284 68/push 0/imm32/no-inouts +14282 68/push 0/imm32/subx-name +14283 53/push-ebx/outputs +14284 68/push 0x11/imm32/alloc-id:fake 14285 68/push 0/imm32/no-inouts -14286 68/push 0/imm32/name +14286 68/push 0/imm32/no-inouts 14287 68/push 0/imm32/name -14288 68/push 0x11/imm32/alloc-id:fake:payload -14289 89/<- %edi 4/r32/esp -14290 $test-emit-subx-stmt-select-primitive:initialize-primitive2-name: -14291 # primitives->name = "increment" -14292 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 -14293 (copy-array Heap "increment" %eax) -14294 $test-emit-subx-stmt-select-primitive:initialize-primitive2-subx-name: -14295 # primitives->subx-name = "ff 0/subop/increment" -14296 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 -14297 (copy-array Heap "ff 0/subop/increment" %eax) -14298 $test-emit-subx-stmt-select-primitive:initialize-primitive: -14299 # var primitives/ebx: (addr primitive) -14300 57/push-edi -14301 68/push 0x11/imm32/alloc-id:fake -14302 68/push 0/imm32/output-is-write-only -14303 68/push 0/imm32/no-disp32 -14304 68/push 0/imm32/no-imm32 -14305 68/push 0/imm32/no-r32 -14306 68/push 1/imm32/rm32-is-first-inout -14307 68/push 0/imm32/subx-name +14288 68/push 0/imm32/name +14289 68/push 0x11/imm32/alloc-id:fake:payload +14290 89/<- %edi 4/r32/esp +14291 $test-emit-subx-stmt-select-primitive:initialize-primitive2-name: +14292 # primitives->name = "increment" +14293 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 +14294 (copy-array Heap "increment" %eax) +14295 $test-emit-subx-stmt-select-primitive:initialize-primitive2-subx-name: +14296 # primitives->subx-name = "ff 0/subop/increment" +14297 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 +14298 (copy-array Heap "ff 0/subop/increment" %eax) +14299 $test-emit-subx-stmt-select-primitive:initialize-primitive: +14300 # var primitives/ebx: (addr primitive) +14301 57/push-edi +14302 68/push 0x11/imm32/alloc-id:fake +14303 68/push 0/imm32/output-is-write-only +14304 68/push 0/imm32/no-disp32 +14305 68/push 0/imm32/no-imm32 +14306 68/push 0/imm32/no-r32 +14307 68/push 1/imm32/rm32-is-first-inout 14308 68/push 0/imm32/subx-name -14309 68/push 0/imm32/no-outputs +14309 68/push 0/imm32/subx-name 14310 68/push 0/imm32/no-outputs -14311 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -14312 68/push 0x11/imm32/alloc-id:fake -14313 68/push 0/imm32/name +14311 68/push 0/imm32/no-outputs +14312 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +14313 68/push 0x11/imm32/alloc-id:fake 14314 68/push 0/imm32/name -14315 89/<- %ebx 4/r32/esp -14316 $test-emit-subx-stmt-select-primitive:initialize-primitive-name: -14317 # primitives->name = "increment" -14318 (copy-array Heap "increment" %ebx) # Primitive-name -14319 $test-emit-subx-stmt-select-primitive:initialize-primitive-subx-name: -14320 # primitives->subx-name = "ff 0/subop/increment" -14321 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -14322 (copy-array Heap "ff 0/subop/increment" %eax) -14323 # convert -14324 c7 0/subop/copy *Curr-block-depth 0/imm32 -14325 (emit-subx-stmt _test-output-buffered-file %esi %ebx) -14326 (flush _test-output-buffered-file) -14327 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -14333 # check output -14334 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive") -14335 # . epilogue -14336 89/<- %esp 5/r32/ebp -14337 5d/pop-to-ebp -14338 c3/return -14339 -14340 test-emit-subx-stmt-select-primitive-2: -14341 # Select the right primitive between overloads. -14342 # increment foo -14343 # => -14344 # ff 0/subop/increment %eax # sub-optimal, but should suffice -14345 # -14346 # There's a variable on the var stack as follows: -14347 # name: 'foo' -14348 # type: int -14349 # register: 'eax' -14350 # -14351 # There's two primitives, as follows: -14352 # - name: 'increment' -14353 # out: int/reg -14354 # value: 'ff 0/subop/increment' -14355 # - name: 'increment' -14356 # inout: int/mem -14357 # value: 'ff 0/subop/increment' -14358 # -14359 # . prologue -14360 55/push-ebp -14361 89/<- %ebp 4/r32/esp -14362 # setup -14363 (clear-stream _test-output-stream) -14364 (clear-stream $_test-output-buffered-file->buffer) -14365 $test-emit-subx-stmt-select-primitive-2:initialize-type: -14366 # var type/ecx: (payload tree type-id) = int -14367 68/push 0/imm32/right:null +14315 68/push 0/imm32/name +14316 89/<- %ebx 4/r32/esp +14317 $test-emit-subx-stmt-select-primitive:initialize-primitive-name: +14318 # primitives->name = "increment" +14319 (copy-array Heap "increment" %ebx) # Primitive-name +14320 $test-emit-subx-stmt-select-primitive:initialize-primitive-subx-name: +14321 # primitives->subx-name = "ff 0/subop/increment" +14322 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +14323 (copy-array Heap "ff 0/subop/increment" %eax) +14324 # convert +14325 c7 0/subop/copy *Curr-block-depth 0/imm32 +14326 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +14327 (flush _test-output-buffered-file) +14328 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +14334 # check output +14335 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive") +14336 # . epilogue +14337 89/<- %esp 5/r32/ebp +14338 5d/pop-to-ebp +14339 c3/return +14340 +14341 test-emit-subx-stmt-select-primitive-2: +14342 # Select the right primitive between overloads. +14343 # increment foo +14344 # => +14345 # ff 0/subop/increment %eax # sub-optimal, but should suffice +14346 # +14347 # There's a variable on the var stack as follows: +14348 # name: 'foo' +14349 # type: int +14350 # register: 'eax' +14351 # +14352 # There's two primitives, as follows: +14353 # - name: 'increment' +14354 # out: int/reg +14355 # value: 'ff 0/subop/increment' +14356 # - name: 'increment' +14357 # inout: int/mem +14358 # value: 'ff 0/subop/increment' +14359 # +14360 # . prologue +14361 55/push-ebp +14362 89/<- %ebp 4/r32/esp +14363 # setup +14364 (clear-stream _test-output-stream) +14365 (clear-stream $_test-output-buffered-file->buffer) +14366 $test-emit-subx-stmt-select-primitive-2:initialize-type: +14367 # var type/ecx: (payload tree type-id) = int 14368 68/push 0/imm32/right:null -14369 68/push 0/imm32/left:unused -14370 68/push 1/imm32/value:int -14371 68/push 1/imm32/is-atom?:true -14372 68/push 0x11/imm32/alloc-id:fake:payload -14373 89/<- %ecx 4/r32/esp -14374 $test-emit-subx-stmt-select-primitive-2:initialize-var: -14375 # var var-foo/ecx: (payload var) -14376 68/push 0/imm32/register +14369 68/push 0/imm32/right:null +14370 68/push 0/imm32/left:unused +14371 68/push 1/imm32/value:int +14372 68/push 1/imm32/is-atom?:true +14373 68/push 0x11/imm32/alloc-id:fake:payload +14374 89/<- %ecx 4/r32/esp +14375 $test-emit-subx-stmt-select-primitive-2:initialize-var: +14376 # var var-foo/ecx: (payload var) 14377 68/push 0/imm32/register -14378 68/push 0/imm32/no-stack-offset -14379 68/push 1/imm32/block-depth -14380 51/push-ecx -14381 68/push 0x11/imm32/alloc-id:fake -14382 68/push 0/imm32/name +14378 68/push 0/imm32/register +14379 68/push 0/imm32/no-stack-offset +14380 68/push 1/imm32/block-depth +14381 51/push-ecx +14382 68/push 0x11/imm32/alloc-id:fake 14383 68/push 0/imm32/name -14384 68/push 0x11/imm32/alloc-id:fake:payload -14385 89/<- %ecx 4/r32/esp -14386 $test-emit-subx-stmt-select-primitive-2:initialize-var-name: -14387 # var-foo->name = "foo" -14388 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -14389 (copy-array Heap "foo" %eax) -14390 $test-emit-subx-stmt-select-primitive-2:initialize-var-register: -14391 # var-foo->register = "eax" -14392 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -14393 (copy-array Heap "eax" %eax) -14394 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-var: -14395 # var operand/ebx: (payload stmt-var) -14396 68/push 0/imm32/is-deref:false -14397 68/push 0/imm32/next +14384 68/push 0/imm32/name +14385 68/push 0x11/imm32/alloc-id:fake:payload +14386 89/<- %ecx 4/r32/esp +14387 $test-emit-subx-stmt-select-primitive-2:initialize-var-name: +14388 # var-foo->name = "foo" +14389 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +14390 (copy-array Heap "foo" %eax) +14391 $test-emit-subx-stmt-select-primitive-2:initialize-var-register: +14392 # var-foo->register = "eax" +14393 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +14394 (copy-array Heap "eax" %eax) +14395 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-var: +14396 # var operand/ebx: (payload stmt-var) +14397 68/push 0/imm32/is-deref:false 14398 68/push 0/imm32/next -14399 51/push-ecx/var-foo -14400 68/push 0x11/imm32/alloc-id:fake -14401 68/push 0x11/imm32/alloc-id:fake:payload -14402 89/<- %ebx 4/r32/esp -14403 $test-emit-subx-stmt-select-primitive-2:initialize-stmt: -14404 # var stmt/esi: (addr statement) -14405 68/push 0/imm32/no-outputs +14399 68/push 0/imm32/next +14400 51/push-ecx/var-foo +14401 68/push 0x11/imm32/alloc-id:fake +14402 68/push 0x11/imm32/alloc-id:fake:payload +14403 89/<- %ebx 4/r32/esp +14404 $test-emit-subx-stmt-select-primitive-2:initialize-stmt: +14405 # var stmt/esi: (addr statement) 14406 68/push 0/imm32/no-outputs -14407 53/push-ebx/inouts -14408 68/push 0x11/imm32/alloc-id:fake -14409 68/push 0/imm32/operation +14407 68/push 0/imm32/no-outputs +14408 53/push-ebx/inouts +14409 68/push 0x11/imm32/alloc-id:fake 14410 68/push 0/imm32/operation -14411 68/push 1/imm32 -14412 89/<- %esi 4/r32/esp -14413 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-operation: -14414 # stmt->operation = "increment" -14415 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -14416 (copy-array Heap "increment" %eax) -14417 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var: -14418 # var formal-var/ebx: (payload var) -14419 68/push 0/imm32/register +14411 68/push 0/imm32/operation +14412 68/push 1/imm32 +14413 89/<- %esi 4/r32/esp +14414 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-operation: +14415 # stmt->operation = "increment" +14416 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +14417 (copy-array Heap "increment" %eax) +14418 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var: +14419 # var formal-var/ebx: (payload var) 14420 68/push 0/imm32/register -14421 68/push 0/imm32/no-stack-offset -14422 68/push 1/imm32/block-depth -14423 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -14424 68/push 0x11/imm32/alloc-id:fake -14425 68/push 0/imm32/name +14421 68/push 0/imm32/register +14422 68/push 0/imm32/no-stack-offset +14423 68/push 1/imm32/block-depth +14424 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +14425 68/push 0x11/imm32/alloc-id:fake 14426 68/push 0/imm32/name -14427 68/push 0x11/imm32/alloc-id:fake:payload -14428 89/<- %ebx 4/r32/esp -14429 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var-name: -14430 # formal-var->name = "dummy" -14431 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -14432 (copy-array Heap "dummy" %eax) -14433 $test-emit-subx-stmt-select-primitive-2:initialize-formal-register: -14434 # formal-var->register = "*" -14435 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -14436 (copy-array Heap "*" %eax) # Any-register -14437 $test-emit-subx-stmt-select-primitive-2:initialize-var-list: -14438 # var formal-outputs/ebx: (payload list stmt-var) -14439 68/push 0/imm32/next +14427 68/push 0/imm32/name +14428 68/push 0x11/imm32/alloc-id:fake:payload +14429 89/<- %ebx 4/r32/esp +14430 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var-name: +14431 # formal-var->name = "dummy" +14432 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +14433 (copy-array Heap "dummy" %eax) +14434 $test-emit-subx-stmt-select-primitive-2:initialize-formal-register: +14435 # formal-var->register = "*" +14436 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +14437 (copy-array Heap "*" %eax) # Any-register +14438 $test-emit-subx-stmt-select-primitive-2:initialize-var-list: +14439 # var formal-outputs/ebx: (payload list stmt-var) 14440 68/push 0/imm32/next -14441 53/push-ebx/formal-var -14442 68/push 0x11/imm32/alloc-id:fake -14443 68/push 0x11/imm32/alloc-id:fake:payload -14444 89/<- %ebx 4/r32/esp -14445 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2: -14446 # var primitive2/edi: (payload primitive) -14447 68/push 0/imm32/next +14441 68/push 0/imm32/next +14442 53/push-ebx/formal-var +14443 68/push 0x11/imm32/alloc-id:fake +14444 68/push 0x11/imm32/alloc-id:fake:payload +14445 89/<- %ebx 4/r32/esp +14446 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2: +14447 # var primitive2/edi: (payload primitive) 14448 68/push 0/imm32/next -14449 68/push 0/imm32/output-is-write-only -14450 68/push 0/imm32/no-disp32 -14451 68/push 0/imm32/no-imm32 -14452 68/push 0/imm32/no-r32 -14453 68/push 3/imm32/rm32-is-first-output -14454 68/push 0/imm32/subx-name +14449 68/push 0/imm32/next +14450 68/push 0/imm32/output-is-write-only +14451 68/push 0/imm32/no-disp32 +14452 68/push 0/imm32/no-imm32 +14453 68/push 0/imm32/no-r32 +14454 68/push 3/imm32/rm32-is-first-output 14455 68/push 0/imm32/subx-name -14456 53/push-ebx/outputs -14457 68/push 0x11/imm32/alloc-id:fake -14458 68/push 0/imm32/no-inouts +14456 68/push 0/imm32/subx-name +14457 53/push-ebx/outputs +14458 68/push 0x11/imm32/alloc-id:fake 14459 68/push 0/imm32/no-inouts -14460 68/push 0/imm32/name +14460 68/push 0/imm32/no-inouts 14461 68/push 0/imm32/name -14462 68/push 0x11/imm32/alloc-id:fake:payload -14463 89/<- %edi 4/r32/esp -14464 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-name: -14465 # primitives->name = "increment" -14466 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 -14467 (copy-array Heap "increment" %eax) -14468 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-subx-name: -14469 # primitives->subx-name = "ff 0/subop/increment" -14470 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 -14471 (copy-array Heap "ff 0/subop/increment" %eax) -14472 $test-emit-subx-stmt-select-primitive-2:initialize-primitive: -14473 # var primitives/ebx: (addr primitive) -14474 57/push-edi -14475 68/push 0x11/imm32/alloc-id:fake -14476 68/push 0/imm32/output-is-write-only -14477 68/push 0/imm32/no-disp32 -14478 68/push 0/imm32/no-imm32 -14479 68/push 0/imm32/no-r32 -14480 68/push 1/imm32/rm32-is-first-inout -14481 68/push 0/imm32/subx-name +14462 68/push 0/imm32/name +14463 68/push 0x11/imm32/alloc-id:fake:payload +14464 89/<- %edi 4/r32/esp +14465 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-name: +14466 # primitives->name = "increment" +14467 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 +14468 (copy-array Heap "increment" %eax) +14469 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-subx-name: +14470 # primitives->subx-name = "ff 0/subop/increment" +14471 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 +14472 (copy-array Heap "ff 0/subop/increment" %eax) +14473 $test-emit-subx-stmt-select-primitive-2:initialize-primitive: +14474 # var primitives/ebx: (addr primitive) +14475 57/push-edi +14476 68/push 0x11/imm32/alloc-id:fake +14477 68/push 0/imm32/output-is-write-only +14478 68/push 0/imm32/no-disp32 +14479 68/push 0/imm32/no-imm32 +14480 68/push 0/imm32/no-r32 +14481 68/push 1/imm32/rm32-is-first-inout 14482 68/push 0/imm32/subx-name -14483 68/push 0/imm32/no-outputs +14483 68/push 0/imm32/subx-name 14484 68/push 0/imm32/no-outputs -14485 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -14486 68/push 0x11/imm32/alloc-id:fake -14487 68/push 0/imm32/name +14485 68/push 0/imm32/no-outputs +14486 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +14487 68/push 0x11/imm32/alloc-id:fake 14488 68/push 0/imm32/name -14489 89/<- %ebx 4/r32/esp -14490 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-name: -14491 # primitives->name = "increment" -14492 (copy-array Heap "increment" %ebx) # Primitive-name -14493 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-subx-name: -14494 # primitives->subx-name = "ff 0/subop/increment" -14495 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -14496 (copy-array Heap "ff 0/subop/increment" %eax) -14497 # convert -14498 c7 0/subop/copy *Curr-block-depth 0/imm32 -14499 (emit-subx-stmt _test-output-buffered-file %esi %ebx) -14500 (flush _test-output-buffered-file) -14501 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -14507 # check output -14508 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2") -14509 # . epilogue -14510 89/<- %esp 5/r32/ebp -14511 5d/pop-to-ebp -14512 c3/return -14513 -14514 test-increment-register: -14515 # Select the right register between overloads. -14516 # foo <- increment -14517 # => -14518 # 50/increment-eax -14519 # -14520 # There's a variable on the var stack as follows: -14521 # name: 'foo' -14522 # type: int -14523 # register: 'eax' -14524 # -14525 # Primitives are the global definitions. -14526 # -14527 # . prologue -14528 55/push-ebp -14529 89/<- %ebp 4/r32/esp -14530 # setup -14531 (clear-stream _test-output-stream) -14532 (clear-stream $_test-output-buffered-file->buffer) -14533 $test-increment-register:initialize-type: -14534 # var type/ecx: (payload tree type-id) = int -14535 68/push 0/imm32/right:null +14489 68/push 0/imm32/name +14490 89/<- %ebx 4/r32/esp +14491 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-name: +14492 # primitives->name = "increment" +14493 (copy-array Heap "increment" %ebx) # Primitive-name +14494 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-subx-name: +14495 # primitives->subx-name = "ff 0/subop/increment" +14496 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +14497 (copy-array Heap "ff 0/subop/increment" %eax) +14498 # convert +14499 c7 0/subop/copy *Curr-block-depth 0/imm32 +14500 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +14501 (flush _test-output-buffered-file) +14502 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +14508 # check output +14509 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2") +14510 # . epilogue +14511 89/<- %esp 5/r32/ebp +14512 5d/pop-to-ebp +14513 c3/return +14514 +14515 test-increment-register: +14516 # Select the right register between overloads. +14517 # foo <- increment +14518 # => +14519 # 50/increment-eax +14520 # +14521 # There's a variable on the var stack as follows: +14522 # name: 'foo' +14523 # type: int +14524 # register: 'eax' +14525 # +14526 # Primitives are the global definitions. +14527 # +14528 # . prologue +14529 55/push-ebp +14530 89/<- %ebp 4/r32/esp +14531 # setup +14532 (clear-stream _test-output-stream) +14533 (clear-stream $_test-output-buffered-file->buffer) +14534 $test-increment-register:initialize-type: +14535 # var type/ecx: (payload tree type-id) = int 14536 68/push 0/imm32/right:null -14537 68/push 0/imm32/left:unused -14538 68/push 1/imm32/value:int -14539 68/push 1/imm32/is-atom?:true -14540 68/push 0x11/imm32/alloc-id:fake:payload -14541 89/<- %ecx 4/r32/esp -14542 $test-increment-register:initialize-var: -14543 # var var-foo/ecx: (payload var) -14544 68/push 0/imm32/register +14537 68/push 0/imm32/right:null +14538 68/push 0/imm32/left:unused +14539 68/push 1/imm32/value:int +14540 68/push 1/imm32/is-atom?:true +14541 68/push 0x11/imm32/alloc-id:fake:payload +14542 89/<- %ecx 4/r32/esp +14543 $test-increment-register:initialize-var: +14544 # var var-foo/ecx: (payload var) 14545 68/push 0/imm32/register -14546 68/push 0/imm32/no-stack-offset -14547 68/push 1/imm32/block-depth -14548 51/push-ecx -14549 68/push 0x11/imm32/alloc-id:fake -14550 68/push 0/imm32/name +14546 68/push 0/imm32/register +14547 68/push 0/imm32/no-stack-offset +14548 68/push 1/imm32/block-depth +14549 51/push-ecx +14550 68/push 0x11/imm32/alloc-id:fake 14551 68/push 0/imm32/name -14552 68/push 0x11/imm32/alloc-id:fake:payload -14553 89/<- %ecx 4/r32/esp -14554 $test-increment-register:initialize-var-name: -14555 # var-foo->name = "foo" -14556 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -14557 (copy-array Heap "foo" %eax) -14558 $test-increment-register:initialize-var-register: -14559 # var-foo->register = "eax" -14560 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -14561 (copy-array Heap "eax" %eax) -14562 $test-increment-register:initialize-stmt-var: -14563 # var operand/ebx: (payload stmt-var) -14564 68/push 0/imm32/is-deref:false -14565 68/push 0/imm32/next +14552 68/push 0/imm32/name +14553 68/push 0x11/imm32/alloc-id:fake:payload +14554 89/<- %ecx 4/r32/esp +14555 $test-increment-register:initialize-var-name: +14556 # var-foo->name = "foo" +14557 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +14558 (copy-array Heap "foo" %eax) +14559 $test-increment-register:initialize-var-register: +14560 # var-foo->register = "eax" +14561 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +14562 (copy-array Heap "eax" %eax) +14563 $test-increment-register:initialize-stmt-var: +14564 # var operand/ebx: (payload stmt-var) +14565 68/push 0/imm32/is-deref:false 14566 68/push 0/imm32/next -14567 51/push-ecx/var-foo -14568 68/push 0x11/imm32/alloc-id:fake -14569 68/push 0x11/imm32/alloc-id:fake:payload -14570 89/<- %ebx 4/r32/esp -14571 $test-increment-register:initialize-stmt: -14572 # var stmt/esi: (addr statement) -14573 53/push-ebx/outputs -14574 68/push 0x11/imm32/alloc-id:fake -14575 68/push 0/imm32/no-inouts +14567 68/push 0/imm32/next +14568 51/push-ecx/var-foo +14569 68/push 0x11/imm32/alloc-id:fake +14570 68/push 0x11/imm32/alloc-id:fake:payload +14571 89/<- %ebx 4/r32/esp +14572 $test-increment-register:initialize-stmt: +14573 # var stmt/esi: (addr statement) +14574 53/push-ebx/outputs +14575 68/push 0x11/imm32/alloc-id:fake 14576 68/push 0/imm32/no-inouts -14577 68/push 0/imm32/operation +14577 68/push 0/imm32/no-inouts 14578 68/push 0/imm32/operation -14579 68/push 1/imm32 -14580 89/<- %esi 4/r32/esp -14581 $test-increment-register:initialize-stmt-operation: -14582 # stmt->operation = "increment" -14583 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -14584 (copy-array Heap "increment" %eax) -14585 # convert -14586 c7 0/subop/copy *Curr-block-depth 0/imm32 -14587 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -14588 (flush _test-output-buffered-file) -14589 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -14595 # check output -14596 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register") -14597 # . epilogue -14598 89/<- %esp 5/r32/ebp -14599 5d/pop-to-ebp -14600 c3/return -14601 -14602 test-add-reg-to-reg: -14603 # var1/reg <- add var2/reg -14604 # => -14605 # 01/add-to %var1 var2 -14606 # -14607 # . prologue -14608 55/push-ebp -14609 89/<- %ebp 4/r32/esp -14610 # setup -14611 (clear-stream _test-output-stream) -14612 (clear-stream $_test-output-buffered-file->buffer) -14613 $test-add-reg-to-reg:initialize-type: -14614 # var type/ecx: (payload tree type-id) = int -14615 68/push 0/imm32/right:null +14579 68/push 0/imm32/operation +14580 68/push 1/imm32 +14581 89/<- %esi 4/r32/esp +14582 $test-increment-register:initialize-stmt-operation: +14583 # stmt->operation = "increment" +14584 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +14585 (copy-array Heap "increment" %eax) +14586 # convert +14587 c7 0/subop/copy *Curr-block-depth 0/imm32 +14588 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +14589 (flush _test-output-buffered-file) +14590 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +14596 # check output +14597 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register") +14598 # . epilogue +14599 89/<- %esp 5/r32/ebp +14600 5d/pop-to-ebp +14601 c3/return +14602 +14603 test-add-reg-to-reg: +14604 # var1/reg <- add var2/reg +14605 # => +14606 # 01/add-to %var1 var2 +14607 # +14608 # . prologue +14609 55/push-ebp +14610 89/<- %ebp 4/r32/esp +14611 # setup +14612 (clear-stream _test-output-stream) +14613 (clear-stream $_test-output-buffered-file->buffer) +14614 $test-add-reg-to-reg:initialize-type: +14615 # var type/ecx: (payload tree type-id) = int 14616 68/push 0/imm32/right:null -14617 68/push 0/imm32/left:unused -14618 68/push 1/imm32/value:int -14619 68/push 1/imm32/is-atom?:true -14620 68/push 0x11/imm32/alloc-id:fake:payload -14621 89/<- %ecx 4/r32/esp -14622 $test-add-reg-to-reg:initialize-var1: -14623 # var var1/ecx: (payload var) -14624 68/push 0/imm32/register +14617 68/push 0/imm32/right:null +14618 68/push 0/imm32/left:unused +14619 68/push 1/imm32/value:int +14620 68/push 1/imm32/is-atom?:true +14621 68/push 0x11/imm32/alloc-id:fake:payload +14622 89/<- %ecx 4/r32/esp +14623 $test-add-reg-to-reg:initialize-var1: +14624 # var var1/ecx: (payload var) 14625 68/push 0/imm32/register -14626 68/push 0/imm32/no-stack-offset -14627 68/push 1/imm32/block-depth -14628 51/push-ecx -14629 68/push 0x11/imm32/alloc-id:fake -14630 68/push 0/imm32/name +14626 68/push 0/imm32/register +14627 68/push 0/imm32/no-stack-offset +14628 68/push 1/imm32/block-depth +14629 51/push-ecx +14630 68/push 0x11/imm32/alloc-id:fake 14631 68/push 0/imm32/name -14632 68/push 0x11/imm32/alloc-id:fake:payload -14633 89/<- %ecx 4/r32/esp -14634 $test-add-reg-to-reg:initialize-var1-name: -14635 # var1->name = "var1" -14636 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -14637 (copy-array Heap "var1" %eax) -14638 $test-add-reg-to-reg:initialize-var1-register: -14639 # var1->register = "eax" -14640 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -14641 (copy-array Heap "eax" %eax) -14642 $test-add-reg-to-reg:initialize-var2: -14643 # var var2/edx: (payload var) -14644 68/push 0/imm32/register +14632 68/push 0/imm32/name +14633 68/push 0x11/imm32/alloc-id:fake:payload +14634 89/<- %ecx 4/r32/esp +14635 $test-add-reg-to-reg:initialize-var1-name: +14636 # var1->name = "var1" +14637 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +14638 (copy-array Heap "var1" %eax) +14639 $test-add-reg-to-reg:initialize-var1-register: +14640 # var1->register = "eax" +14641 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +14642 (copy-array Heap "eax" %eax) +14643 $test-add-reg-to-reg:initialize-var2: +14644 # var var2/edx: (payload var) 14645 68/push 0/imm32/register -14646 68/push 0/imm32/no-stack-offset -14647 68/push 1/imm32/block-depth -14648 ff 6/subop/push *(ecx+0x10) -14649 68/push 0x11/imm32/alloc-id:fake -14650 68/push 0/imm32/name +14646 68/push 0/imm32/register +14647 68/push 0/imm32/no-stack-offset +14648 68/push 1/imm32/block-depth +14649 ff 6/subop/push *(ecx+0x10) +14650 68/push 0x11/imm32/alloc-id:fake 14651 68/push 0/imm32/name -14652 68/push 0x11/imm32/alloc-id:fake:payload -14653 89/<- %edx 4/r32/esp -14654 $test-add-reg-to-reg:initialize-var2-name: -14655 # var2->name = "var2" -14656 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -14657 (copy-array Heap "var2" %eax) -14658 $test-add-reg-to-reg:initialize-var2-register: -14659 # var2->register = "ecx" -14660 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -14661 (copy-array Heap "ecx" %eax) -14662 $test-add-reg-to-reg:initialize-inouts: -14663 # var inouts/esi: (payload stmt-var) = [var2] -14664 68/push 0/imm32/is-deref:false -14665 68/push 0/imm32/next +14652 68/push 0/imm32/name +14653 68/push 0x11/imm32/alloc-id:fake:payload +14654 89/<- %edx 4/r32/esp +14655 $test-add-reg-to-reg:initialize-var2-name: +14656 # var2->name = "var2" +14657 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +14658 (copy-array Heap "var2" %eax) +14659 $test-add-reg-to-reg:initialize-var2-register: +14660 # var2->register = "ecx" +14661 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +14662 (copy-array Heap "ecx" %eax) +14663 $test-add-reg-to-reg:initialize-inouts: +14664 # var inouts/esi: (payload stmt-var) = [var2] +14665 68/push 0/imm32/is-deref:false 14666 68/push 0/imm32/next -14667 52/push-edx/var2 -14668 68/push 0x11/imm32/alloc-id:fake -14669 68/push 0x11/imm32/alloc-id:fake:payload -14670 89/<- %esi 4/r32/esp -14671 $test-add-reg-to-reg:initialize-outputs: -14672 # var outputs/edi: (payload stmt-var) = [var1] -14673 68/push 0/imm32/is-deref:false -14674 68/push 0/imm32/next +14667 68/push 0/imm32/next +14668 52/push-edx/var2 +14669 68/push 0x11/imm32/alloc-id:fake +14670 68/push 0x11/imm32/alloc-id:fake:payload +14671 89/<- %esi 4/r32/esp +14672 $test-add-reg-to-reg:initialize-outputs: +14673 # var outputs/edi: (payload stmt-var) = [var1] +14674 68/push 0/imm32/is-deref:false 14675 68/push 0/imm32/next -14676 51/push-ecx/var1 -14677 68/push 0x11/imm32/alloc-id:fake -14678 68/push 0x11/imm32/alloc-id:fake:payload -14679 89/<- %edi 4/r32/esp -14680 $test-add-reg-to-reg:initialize-stmt: -14681 # var stmt/esi: (addr statement) -14682 68/push 0/imm32/next +14676 68/push 0/imm32/next +14677 51/push-ecx/var1 +14678 68/push 0x11/imm32/alloc-id:fake +14679 68/push 0x11/imm32/alloc-id:fake:payload +14680 89/<- %edi 4/r32/esp +14681 $test-add-reg-to-reg:initialize-stmt: +14682 # var stmt/esi: (addr statement) 14683 68/push 0/imm32/next -14684 57/push-edi/outputs -14685 68/push 0x11/imm32/alloc-id:fake -14686 56/push-esi/inouts -14687 68/push 0x11/imm32/alloc-id:fake -14688 68/push 0/imm32/operation +14684 68/push 0/imm32/next +14685 57/push-edi/outputs +14686 68/push 0x11/imm32/alloc-id:fake +14687 56/push-esi/inouts +14688 68/push 0x11/imm32/alloc-id:fake 14689 68/push 0/imm32/operation -14690 68/push 1/imm32/tag:stmt1 -14691 89/<- %esi 4/r32/esp -14692 $test-add-reg-to-reg:initialize-stmt-operation: -14693 # stmt->operation = "add" -14694 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -14695 (copy-array Heap "add" %eax) -14696 # convert -14697 c7 0/subop/copy *Curr-block-depth 0/imm32 -14698 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -14699 (flush _test-output-buffered-file) -14700 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -14706 # check output -14707 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg") -14708 # . epilogue -14709 89/<- %esp 5/r32/ebp -14710 5d/pop-to-ebp -14711 c3/return -14712 -14713 test-add-reg-to-mem: -14714 # add-to var1 var2/reg -14715 # => -14716 # 01/add-to *(ebp+__) var2 -14717 # -14718 # . prologue -14719 55/push-ebp -14720 89/<- %ebp 4/r32/esp -14721 # setup -14722 (clear-stream _test-output-stream) -14723 (clear-stream $_test-output-buffered-file->buffer) -14724 $test-add-reg-to-mem:initialize-type: -14725 # var type/ecx: (payload tree type-id) = int -14726 68/push 0/imm32/right:null +14690 68/push 0/imm32/operation +14691 68/push 1/imm32/tag:stmt1 +14692 89/<- %esi 4/r32/esp +14693 $test-add-reg-to-reg:initialize-stmt-operation: +14694 # stmt->operation = "add" +14695 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +14696 (copy-array Heap "add" %eax) +14697 # convert +14698 c7 0/subop/copy *Curr-block-depth 0/imm32 +14699 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +14700 (flush _test-output-buffered-file) +14701 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +14707 # check output +14708 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg") +14709 # . epilogue +14710 89/<- %esp 5/r32/ebp +14711 5d/pop-to-ebp +14712 c3/return +14713 +14714 test-add-reg-to-mem: +14715 # add-to var1 var2/reg +14716 # => +14717 # 01/add-to *(ebp+__) var2 +14718 # +14719 # . prologue +14720 55/push-ebp +14721 89/<- %ebp 4/r32/esp +14722 # setup +14723 (clear-stream _test-output-stream) +14724 (clear-stream $_test-output-buffered-file->buffer) +14725 $test-add-reg-to-mem:initialize-type: +14726 # var type/ecx: (payload tree type-id) = int 14727 68/push 0/imm32/right:null -14728 68/push 0/imm32/left:unused -14729 68/push 1/imm32/value:int -14730 68/push 1/imm32/is-atom?:true -14731 68/push 0x11/imm32/alloc-id:fake:payload -14732 89/<- %ecx 4/r32/esp -14733 $test-add-reg-to-mem:initialize-var1: -14734 # var var1/ecx: (payload var) -14735 68/push 0/imm32/register +14728 68/push 0/imm32/right:null +14729 68/push 0/imm32/left:unused +14730 68/push 1/imm32/value:int +14731 68/push 1/imm32/is-atom?:true +14732 68/push 0x11/imm32/alloc-id:fake:payload +14733 89/<- %ecx 4/r32/esp +14734 $test-add-reg-to-mem:initialize-var1: +14735 # var var1/ecx: (payload var) 14736 68/push 0/imm32/register -14737 68/push 8/imm32/stack-offset -14738 68/push 1/imm32/block-depth -14739 51/push-ecx -14740 68/push 0x11/imm32/alloc-id:fake -14741 68/push 0/imm32/name +14737 68/push 0/imm32/register +14738 68/push 8/imm32/stack-offset +14739 68/push 1/imm32/block-depth +14740 51/push-ecx +14741 68/push 0x11/imm32/alloc-id:fake 14742 68/push 0/imm32/name -14743 68/push 0x11/imm32/alloc-id:fake:payload -14744 89/<- %ecx 4/r32/esp -14745 $test-add-reg-to-mem:initialize-var1-name: -14746 # var1->name = "var1" -14747 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -14748 (copy-array Heap "var1" %eax) -14749 $test-add-reg-to-mem:initialize-var2: -14750 # var var2/edx: (payload var) -14751 68/push 0/imm32/register +14743 68/push 0/imm32/name +14744 68/push 0x11/imm32/alloc-id:fake:payload +14745 89/<- %ecx 4/r32/esp +14746 $test-add-reg-to-mem:initialize-var1-name: +14747 # var1->name = "var1" +14748 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +14749 (copy-array Heap "var1" %eax) +14750 $test-add-reg-to-mem:initialize-var2: +14751 # var var2/edx: (payload var) 14752 68/push 0/imm32/register -14753 68/push 0/imm32/no-stack-offset -14754 68/push 1/imm32/block-depth -14755 ff 6/subop/push *(ecx+0x10) -14756 68/push 0x11/imm32/alloc-id:fake -14757 68/push 0/imm32/name +14753 68/push 0/imm32/register +14754 68/push 0/imm32/no-stack-offset +14755 68/push 1/imm32/block-depth +14756 ff 6/subop/push *(ecx+0x10) +14757 68/push 0x11/imm32/alloc-id:fake 14758 68/push 0/imm32/name -14759 68/push 0x11/imm32/alloc-id:fake:payload -14760 89/<- %edx 4/r32/esp -14761 $test-add-reg-to-mem:initialize-var2-name: -14762 # var2->name = "var2" -14763 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -14764 (copy-array Heap "var2" %eax) -14765 $test-add-reg-to-mem:initialize-var2-register: -14766 # var2->register = "ecx" -14767 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -14768 (copy-array Heap "ecx" %eax) -14769 $test-add-reg-to-mem:initialize-inouts: -14770 # var inouts/esi: (payload stmt-var) = [var2] -14771 68/push 0/imm32/is-deref:false -14772 68/push 0/imm32/next +14759 68/push 0/imm32/name +14760 68/push 0x11/imm32/alloc-id:fake:payload +14761 89/<- %edx 4/r32/esp +14762 $test-add-reg-to-mem:initialize-var2-name: +14763 # var2->name = "var2" +14764 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +14765 (copy-array Heap "var2" %eax) +14766 $test-add-reg-to-mem:initialize-var2-register: +14767 # var2->register = "ecx" +14768 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +14769 (copy-array Heap "ecx" %eax) +14770 $test-add-reg-to-mem:initialize-inouts: +14771 # var inouts/esi: (payload stmt-var) = [var2] +14772 68/push 0/imm32/is-deref:false 14773 68/push 0/imm32/next -14774 52/push-edx/var2 -14775 68/push 0x11/imm32/alloc-id:fake -14776 68/push 0x11/imm32/alloc-id:fake:payload -14777 89/<- %esi 4/r32/esp -14778 # inouts = [var1, var2] -14779 68/push 0/imm32/is-deref:false -14780 56/push-esi/next -14781 68/push 0x11/imm32/alloc-id:fake -14782 51/push-ecx/var1 -14783 68/push 0x11/imm32/alloc-id:fake -14784 68/push 0x11/imm32/alloc-id:fake:payload -14785 89/<- %esi 4/r32/esp -14786 $test-add-reg-to-mem:initialize-stmt: -14787 # var stmt/esi: (addr statement) -14788 68/push 0/imm32/next +14774 68/push 0/imm32/next +14775 52/push-edx/var2 +14776 68/push 0x11/imm32/alloc-id:fake +14777 68/push 0x11/imm32/alloc-id:fake:payload +14778 89/<- %esi 4/r32/esp +14779 # inouts = [var1, var2] +14780 68/push 0/imm32/is-deref:false +14781 56/push-esi/next +14782 68/push 0x11/imm32/alloc-id:fake +14783 51/push-ecx/var1 +14784 68/push 0x11/imm32/alloc-id:fake +14785 68/push 0x11/imm32/alloc-id:fake:payload +14786 89/<- %esi 4/r32/esp +14787 $test-add-reg-to-mem:initialize-stmt: +14788 # var stmt/esi: (addr statement) 14789 68/push 0/imm32/next -14790 68/push 0/imm32/outputs +14790 68/push 0/imm32/next 14791 68/push 0/imm32/outputs -14792 56/push-esi/inouts -14793 68/push 0x11/imm32/alloc-id:fake -14794 68/push 0/imm32/operation +14792 68/push 0/imm32/outputs +14793 56/push-esi/inouts +14794 68/push 0x11/imm32/alloc-id:fake 14795 68/push 0/imm32/operation -14796 68/push 1/imm32/tag:stmt1 -14797 89/<- %esi 4/r32/esp -14798 $test-add-reg-to-mem:initialize-stmt-operation: -14799 # stmt->operation = "add-to" -14800 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -14801 (copy-array Heap "add-to" %eax) -14802 # convert -14803 c7 0/subop/copy *Curr-block-depth 0/imm32 -14804 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -14805 (flush _test-output-buffered-file) -14806 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -14812 # check output -14813 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem") -14814 # . epilogue -14815 89/<- %esp 5/r32/ebp -14816 5d/pop-to-ebp -14817 c3/return -14818 -14819 test-add-mem-to-reg: -14820 # var1/reg <- add var2 -14821 # => -14822 # 03/add *(ebp+__) var1 -14823 # -14824 # . prologue -14825 55/push-ebp -14826 89/<- %ebp 4/r32/esp -14827 # setup -14828 (clear-stream _test-output-stream) -14829 (clear-stream $_test-output-buffered-file->buffer) -14830 $test-add-mem-to-reg:initialize-type: -14831 # var type/ecx: (payload tree type-id) = int -14832 68/push 0/imm32/right:null +14796 68/push 0/imm32/operation +14797 68/push 1/imm32/tag:stmt1 +14798 89/<- %esi 4/r32/esp +14799 $test-add-reg-to-mem:initialize-stmt-operation: +14800 # stmt->operation = "add-to" +14801 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +14802 (copy-array Heap "add-to" %eax) +14803 # convert +14804 c7 0/subop/copy *Curr-block-depth 0/imm32 +14805 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +14806 (flush _test-output-buffered-file) +14807 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +14813 # check output +14814 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem") +14815 # . epilogue +14816 89/<- %esp 5/r32/ebp +14817 5d/pop-to-ebp +14818 c3/return +14819 +14820 test-add-mem-to-reg: +14821 # var1/reg <- add var2 +14822 # => +14823 # 03/add *(ebp+__) var1 +14824 # +14825 # . prologue +14826 55/push-ebp +14827 89/<- %ebp 4/r32/esp +14828 # setup +14829 (clear-stream _test-output-stream) +14830 (clear-stream $_test-output-buffered-file->buffer) +14831 $test-add-mem-to-reg:initialize-type: +14832 # var type/ecx: (payload tree type-id) = int 14833 68/push 0/imm32/right:null -14834 68/push 0/imm32/left:unused -14835 68/push 1/imm32/value:int -14836 68/push 1/imm32/is-atom?:true -14837 68/push 0x11/imm32/alloc-id:fake:payload -14838 89/<- %ecx 4/r32/esp -14839 $test-add-mem-to-reg:initialize-var: -14840 # var var1/ecx: (payload var) -14841 68/push 0/imm32/register +14834 68/push 0/imm32/right:null +14835 68/push 0/imm32/left:unused +14836 68/push 1/imm32/value:int +14837 68/push 1/imm32/is-atom?:true +14838 68/push 0x11/imm32/alloc-id:fake:payload +14839 89/<- %ecx 4/r32/esp +14840 $test-add-mem-to-reg:initialize-var: +14841 # var var1/ecx: (payload var) 14842 68/push 0/imm32/register -14843 68/push 0/imm32/no-stack-offset -14844 68/push 1/imm32/block-depth -14845 51/push-ecx -14846 68/push 0x11/imm32/alloc-id:fake -14847 68/push 0/imm32/name +14843 68/push 0/imm32/register +14844 68/push 0/imm32/no-stack-offset +14845 68/push 1/imm32/block-depth +14846 51/push-ecx +14847 68/push 0x11/imm32/alloc-id:fake 14848 68/push 0/imm32/name -14849 68/push 0x11/imm32/alloc-id:fake:payload -14850 89/<- %ecx 4/r32/esp -14851 $test-add-mem-to-reg:initialize-var-name: -14852 # var1->name = "foo" -14853 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -14854 (copy-array Heap "var1" %eax) -14855 $test-add-mem-to-reg:initialize-var-register: -14856 # var1->register = "eax" -14857 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -14858 (copy-array Heap "eax" %eax) -14859 $test-add-mem-to-reg:initialize-var2: -14860 # var var2/edx: (payload var) -14861 68/push 0/imm32/register +14849 68/push 0/imm32/name +14850 68/push 0x11/imm32/alloc-id:fake:payload +14851 89/<- %ecx 4/r32/esp +14852 $test-add-mem-to-reg:initialize-var-name: +14853 # var1->name = "foo" +14854 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +14855 (copy-array Heap "var1" %eax) +14856 $test-add-mem-to-reg:initialize-var-register: +14857 # var1->register = "eax" +14858 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +14859 (copy-array Heap "eax" %eax) +14860 $test-add-mem-to-reg:initialize-var2: +14861 # var var2/edx: (payload var) 14862 68/push 0/imm32/register -14863 68/push 8/imm32/stack-offset -14864 68/push 1/imm32/block-depth -14865 ff 6/subop/push *(ecx+0x10) -14866 68/push 0x11/imm32/alloc-id:fake -14867 68/push 0/imm32/name +14863 68/push 0/imm32/register +14864 68/push 8/imm32/stack-offset +14865 68/push 1/imm32/block-depth +14866 ff 6/subop/push *(ecx+0x10) +14867 68/push 0x11/imm32/alloc-id:fake 14868 68/push 0/imm32/name -14869 68/push 0x11/imm32/alloc-id:fake:payload -14870 89/<- %edx 4/r32/esp -14871 $test-add-mem-to-reg:initialize-var2-name: -14872 # var2->name = "var2" -14873 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -14874 (copy-array Heap "var2" %eax) -14875 $test-add-mem-to-reg:initialize-inouts: -14876 # var inouts/esi: (payload stmt-var) = [var2] -14877 68/push 0/imm32/is-deref:false -14878 68/push 0/imm32/next +14869 68/push 0/imm32/name +14870 68/push 0x11/imm32/alloc-id:fake:payload +14871 89/<- %edx 4/r32/esp +14872 $test-add-mem-to-reg:initialize-var2-name: +14873 # var2->name = "var2" +14874 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +14875 (copy-array Heap "var2" %eax) +14876 $test-add-mem-to-reg:initialize-inouts: +14877 # var inouts/esi: (payload stmt-var) = [var2] +14878 68/push 0/imm32/is-deref:false 14879 68/push 0/imm32/next -14880 52/push-edx/var2 -14881 68/push 0x11/imm32/alloc-id:fake -14882 68/push 0x11/imm32/alloc-id:fake:payload -14883 89/<- %esi 4/r32/esp -14884 $test-add-mem-to-reg:initialize-outputs: -14885 # var outputs/edi: (payload stmt-var) = [var1] -14886 68/push 0/imm32/is-deref:false -14887 68/push 0/imm32/next +14880 68/push 0/imm32/next +14881 52/push-edx/var2 +14882 68/push 0x11/imm32/alloc-id:fake +14883 68/push 0x11/imm32/alloc-id:fake:payload +14884 89/<- %esi 4/r32/esp +14885 $test-add-mem-to-reg:initialize-outputs: +14886 # var outputs/edi: (payload stmt-var) = [var1] +14887 68/push 0/imm32/is-deref:false 14888 68/push 0/imm32/next -14889 51/push-ecx/var1 -14890 68/push 0x11/imm32/alloc-id:fake -14891 68/push 0x11/imm32/alloc-id:fake:payload -14892 89/<- %edi 4/r32/esp -14893 $test-add-mem-to-reg:initialize-stmt: -14894 # var stmt/esi: (addr statement) -14895 68/push 0/imm32/next +14889 68/push 0/imm32/next +14890 51/push-ecx/var1 +14891 68/push 0x11/imm32/alloc-id:fake +14892 68/push 0x11/imm32/alloc-id:fake:payload +14893 89/<- %edi 4/r32/esp +14894 $test-add-mem-to-reg:initialize-stmt: +14895 # var stmt/esi: (addr statement) 14896 68/push 0/imm32/next -14897 57/push-edi/outputs -14898 68/push 0x11/imm32/alloc-id:fake -14899 56/push-esi/inouts -14900 68/push 0x11/imm32/alloc-id:fake -14901 68/push 0/imm32/operation +14897 68/push 0/imm32/next +14898 57/push-edi/outputs +14899 68/push 0x11/imm32/alloc-id:fake +14900 56/push-esi/inouts +14901 68/push 0x11/imm32/alloc-id:fake 14902 68/push 0/imm32/operation -14903 68/push 1/imm32/tag:stmt1 -14904 89/<- %esi 4/r32/esp -14905 $test-add-mem-to-reg:initialize-stmt-operation: -14906 # stmt->operation = "add" -14907 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -14908 (copy-array Heap "add" %eax) -14909 # convert -14910 c7 0/subop/copy *Curr-block-depth 0/imm32 -14911 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -14912 (flush _test-output-buffered-file) -14913 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -14919 # check output -14920 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg") -14921 # . epilogue -14922 89/<- %esp 5/r32/ebp -14923 5d/pop-to-ebp -14924 c3/return -14925 -14926 test-add-literal-to-eax: -14927 # var1/eax <- add 0x34 -14928 # => -14929 # 05/add-to-eax 0x34/imm32 -14930 # -14931 # . prologue -14932 55/push-ebp -14933 89/<- %ebp 4/r32/esp -14934 # setup -14935 (clear-stream _test-output-stream) -14936 (clear-stream $_test-output-buffered-file->buffer) -14937 $test-add-literal-to-eax:initialize-var-type: -14938 # var type/ecx: (payload tree type-id) = int -14939 68/push 0/imm32/right:null +14903 68/push 0/imm32/operation +14904 68/push 1/imm32/tag:stmt1 +14905 89/<- %esi 4/r32/esp +14906 $test-add-mem-to-reg:initialize-stmt-operation: +14907 # stmt->operation = "add" +14908 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +14909 (copy-array Heap "add" %eax) +14910 # convert +14911 c7 0/subop/copy *Curr-block-depth 0/imm32 +14912 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +14913 (flush _test-output-buffered-file) +14914 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +14920 # check output +14921 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg") +14922 # . epilogue +14923 89/<- %esp 5/r32/ebp +14924 5d/pop-to-ebp +14925 c3/return +14926 +14927 test-add-literal-to-eax: +14928 # var1/eax <- add 0x34 +14929 # => +14930 # 05/add-to-eax 0x34/imm32 +14931 # +14932 # . prologue +14933 55/push-ebp +14934 89/<- %ebp 4/r32/esp +14935 # setup +14936 (clear-stream _test-output-stream) +14937 (clear-stream $_test-output-buffered-file->buffer) +14938 $test-add-literal-to-eax:initialize-var-type: +14939 # var type/ecx: (payload tree type-id) = int 14940 68/push 0/imm32/right:null -14941 68/push 0/imm32/left:unused -14942 68/push 1/imm32/value:int -14943 68/push 1/imm32/is-atom?:true -14944 68/push 0x11/imm32/alloc-id:fake:payload -14945 89/<- %ecx 4/r32/esp -14946 $test-add-literal-to-eax:initialize-var: -14947 # var v/ecx: (payload var) -14948 68/push 0/imm32/register +14941 68/push 0/imm32/right:null +14942 68/push 0/imm32/left:unused +14943 68/push 1/imm32/value:int +14944 68/push 1/imm32/is-atom?:true +14945 68/push 0x11/imm32/alloc-id:fake:payload +14946 89/<- %ecx 4/r32/esp +14947 $test-add-literal-to-eax:initialize-var: +14948 # var v/ecx: (payload var) 14949 68/push 0/imm32/register -14950 68/push 0/imm32/no-stack-offset -14951 68/push 1/imm32/block-depth -14952 51/push-ecx -14953 68/push 0x11/imm32/alloc-id:fake -14954 68/push 0/imm32/name +14950 68/push 0/imm32/register +14951 68/push 0/imm32/no-stack-offset +14952 68/push 1/imm32/block-depth +14953 51/push-ecx +14954 68/push 0x11/imm32/alloc-id:fake 14955 68/push 0/imm32/name -14956 68/push 0x11/imm32/alloc-id:fake:payload -14957 89/<- %ecx 4/r32/esp -14958 $test-add-literal-to-eax:initialize-var-name: -14959 # v->name = "v" -14960 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -14961 (copy-array Heap "v" %eax) -14962 $test-add-literal-to-eax:initialize-var-register: -14963 # v->register = "eax" -14964 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -14965 (copy-array Heap "eax" %eax) -14966 $test-add-literal-to-eax:initialize-literal-type: -14967 # var type/edx: (payload tree type-id) = literal -14968 68/push 0/imm32/right:null +14956 68/push 0/imm32/name +14957 68/push 0x11/imm32/alloc-id:fake:payload +14958 89/<- %ecx 4/r32/esp +14959 $test-add-literal-to-eax:initialize-var-name: +14960 # v->name = "v" +14961 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +14962 (copy-array Heap "v" %eax) +14963 $test-add-literal-to-eax:initialize-var-register: +14964 # v->register = "eax" +14965 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +14966 (copy-array Heap "eax" %eax) +14967 $test-add-literal-to-eax:initialize-literal-type: +14968 # var type/edx: (payload tree type-id) = literal 14969 68/push 0/imm32/right:null -14970 68/push 0/imm32/left:unused -14971 68/push 0/imm32/value:literal -14972 68/push 1/imm32/is-atom?:true -14973 68/push 0x11/imm32/alloc-id:fake:payload -14974 89/<- %edx 4/r32/esp -14975 $test-add-literal-to-eax:initialize-literal: -14976 # var l/edx: (payload var) -14977 68/push 0/imm32/register +14970 68/push 0/imm32/right:null +14971 68/push 0/imm32/left:unused +14972 68/push 0/imm32/value:literal +14973 68/push 1/imm32/is-atom?:true +14974 68/push 0x11/imm32/alloc-id:fake:payload +14975 89/<- %edx 4/r32/esp +14976 $test-add-literal-to-eax:initialize-literal: +14977 # var l/edx: (payload var) 14978 68/push 0/imm32/register -14979 68/push 0/imm32/no-stack-offset -14980 68/push 1/imm32/block-depth -14981 52/push-edx -14982 68/push 0x11/imm32/alloc-id:fake -14983 68/push 0/imm32/name +14979 68/push 0/imm32/register +14980 68/push 0/imm32/no-stack-offset +14981 68/push 1/imm32/block-depth +14982 52/push-edx +14983 68/push 0x11/imm32/alloc-id:fake 14984 68/push 0/imm32/name -14985 68/push 0x11/imm32/alloc-id:fake:payload -14986 89/<- %edx 4/r32/esp -14987 $test-add-literal-to-eax:initialize-literal-value: -14988 # l->name = "0x34" -14989 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -14990 (copy-array Heap "0x34" %eax) -14991 $test-add-literal-to-eax:initialize-inouts: -14992 # var inouts/esi: (payload stmt-var) = [l] -14993 68/push 0/imm32/is-deref:false -14994 68/push 0/imm32/next +14985 68/push 0/imm32/name +14986 68/push 0x11/imm32/alloc-id:fake:payload +14987 89/<- %edx 4/r32/esp +14988 $test-add-literal-to-eax:initialize-literal-value: +14989 # l->name = "0x34" +14990 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +14991 (copy-array Heap "0x34" %eax) +14992 $test-add-literal-to-eax:initialize-inouts: +14993 # var inouts/esi: (payload stmt-var) = [l] +14994 68/push 0/imm32/is-deref:false 14995 68/push 0/imm32/next -14996 52/push-edx/l -14997 68/push 0x11/imm32/alloc-id:fake -14998 68/push 0x11/imm32/alloc-id:fake:payload -14999 89/<- %esi 4/r32/esp -15000 $test-add-literal-to-eax:initialize-outputs: -15001 # var outputs/edi: (payload stmt-var) = [v] -15002 68/push 0/imm32/is-deref:false -15003 68/push 0/imm32/next +14996 68/push 0/imm32/next +14997 52/push-edx/l +14998 68/push 0x11/imm32/alloc-id:fake +14999 68/push 0x11/imm32/alloc-id:fake:payload +15000 89/<- %esi 4/r32/esp +15001 $test-add-literal-to-eax:initialize-outputs: +15002 # var outputs/edi: (payload stmt-var) = [v] +15003 68/push 0/imm32/is-deref:false 15004 68/push 0/imm32/next -15005 51/push-ecx/v -15006 68/push 0x11/imm32/alloc-id:fake -15007 68/push 0x11/imm32/alloc-id:fake:payload -15008 89/<- %edi 4/r32/esp -15009 $test-add-literal-to-eax:initialize-stmt: -15010 # var stmt/esi: (addr statement) -15011 68/push 0/imm32/next +15005 68/push 0/imm32/next +15006 51/push-ecx/v +15007 68/push 0x11/imm32/alloc-id:fake +15008 68/push 0x11/imm32/alloc-id:fake:payload +15009 89/<- %edi 4/r32/esp +15010 $test-add-literal-to-eax:initialize-stmt: +15011 # var stmt/esi: (addr statement) 15012 68/push 0/imm32/next -15013 57/push-edi/outputs -15014 68/push 0x11/imm32/alloc-id:fake -15015 56/push-esi/inouts -15016 68/push 0x11/imm32/alloc-id:fake -15017 68/push 0/imm32/operation +15013 68/push 0/imm32/next +15014 57/push-edi/outputs +15015 68/push 0x11/imm32/alloc-id:fake +15016 56/push-esi/inouts +15017 68/push 0x11/imm32/alloc-id:fake 15018 68/push 0/imm32/operation -15019 68/push 1/imm32/tag:stmt1 -15020 89/<- %esi 4/r32/esp -15021 $test-add-literal-to-eax:initialize-stmt-operation: -15022 # stmt->operation = "add" -15023 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15024 (copy-array Heap "add" %eax) -15025 # convert -15026 c7 0/subop/copy *Curr-block-depth 0/imm32 -15027 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -15028 (flush _test-output-buffered-file) -15029 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -15035 # check output -15036 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax") -15037 # . epilogue -15038 89/<- %esp 5/r32/ebp -15039 5d/pop-to-ebp -15040 c3/return -15041 -15042 test-add-literal-to-reg: -15043 # var1/ecx <- add 0x34 -15044 # => -15045 # 81 0/subop/add %ecx 0x34/imm32 -15046 # -15047 # . prologue -15048 55/push-ebp -15049 89/<- %ebp 4/r32/esp -15050 # setup -15051 (clear-stream _test-output-stream) -15052 (clear-stream $_test-output-buffered-file->buffer) -15053 $test-add-literal-to-reg:initialize-var-type: -15054 # var type/ecx: (payload tree type-id) = int -15055 68/push 0/imm32/right:null +15019 68/push 0/imm32/operation +15020 68/push 1/imm32/tag:stmt1 +15021 89/<- %esi 4/r32/esp +15022 $test-add-literal-to-eax:initialize-stmt-operation: +15023 # stmt->operation = "add" +15024 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15025 (copy-array Heap "add" %eax) +15026 # convert +15027 c7 0/subop/copy *Curr-block-depth 0/imm32 +15028 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +15029 (flush _test-output-buffered-file) +15030 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15036 # check output +15037 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax") +15038 # . epilogue +15039 89/<- %esp 5/r32/ebp +15040 5d/pop-to-ebp +15041 c3/return +15042 +15043 test-add-literal-to-reg: +15044 # var1/ecx <- add 0x34 +15045 # => +15046 # 81 0/subop/add %ecx 0x34/imm32 +15047 # +15048 # . prologue +15049 55/push-ebp +15050 89/<- %ebp 4/r32/esp +15051 # setup +15052 (clear-stream _test-output-stream) +15053 (clear-stream $_test-output-buffered-file->buffer) +15054 $test-add-literal-to-reg:initialize-var-type: +15055 # var type/ecx: (payload tree type-id) = int 15056 68/push 0/imm32/right:null -15057 68/push 0/imm32/left:unused -15058 68/push 1/imm32/value:int -15059 68/push 1/imm32/is-atom?:true -15060 68/push 0x11/imm32/alloc-id:fake:payload -15061 89/<- %ecx 4/r32/esp -15062 $test-add-literal-to-reg:initialize-var: -15063 # var v/ecx: (payload var) -15064 68/push 0/imm32/register +15057 68/push 0/imm32/right:null +15058 68/push 0/imm32/left:unused +15059 68/push 1/imm32/value:int +15060 68/push 1/imm32/is-atom?:true +15061 68/push 0x11/imm32/alloc-id:fake:payload +15062 89/<- %ecx 4/r32/esp +15063 $test-add-literal-to-reg:initialize-var: +15064 # var v/ecx: (payload var) 15065 68/push 0/imm32/register -15066 68/push 0/imm32/no-stack-offset -15067 68/push 1/imm32/block-depth -15068 51/push-ecx -15069 68/push 0x11/imm32/alloc-id:fake -15070 68/push 0/imm32/name +15066 68/push 0/imm32/register +15067 68/push 0/imm32/no-stack-offset +15068 68/push 1/imm32/block-depth +15069 51/push-ecx +15070 68/push 0x11/imm32/alloc-id:fake 15071 68/push 0/imm32/name -15072 68/push 0x11/imm32/alloc-id:fake:payload -15073 89/<- %ecx 4/r32/esp -15074 $test-add-literal-to-reg:initialize-var-name: -15075 # v->name = "v" -15076 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15077 (copy-array Heap "v" %eax) -15078 $test-add-literal-to-reg:initialize-var-register: -15079 # v->register = "ecx" -15080 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -15081 (copy-array Heap "ecx" %eax) -15082 $test-add-literal-to-reg:initialize-literal-type: -15083 # var type/edx: (payload tree type-id) = literal -15084 68/push 0/imm32/right:null +15072 68/push 0/imm32/name +15073 68/push 0x11/imm32/alloc-id:fake:payload +15074 89/<- %ecx 4/r32/esp +15075 $test-add-literal-to-reg:initialize-var-name: +15076 # v->name = "v" +15077 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +15078 (copy-array Heap "v" %eax) +15079 $test-add-literal-to-reg:initialize-var-register: +15080 # v->register = "ecx" +15081 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +15082 (copy-array Heap "ecx" %eax) +15083 $test-add-literal-to-reg:initialize-literal-type: +15084 # var type/edx: (payload tree type-id) = literal 15085 68/push 0/imm32/right:null -15086 68/push 0/imm32/left:unused -15087 68/push 0/imm32/value:literal -15088 68/push 1/imm32/is-atom?:true -15089 68/push 0x11/imm32/alloc-id:fake:payload -15090 89/<- %edx 4/r32/esp -15091 $test-add-literal-to-reg:initialize-literal: -15092 # var l/edx: (payload var) -15093 68/push 0/imm32/register +15086 68/push 0/imm32/right:null +15087 68/push 0/imm32/left:unused +15088 68/push 0/imm32/value:literal +15089 68/push 1/imm32/is-atom?:true +15090 68/push 0x11/imm32/alloc-id:fake:payload +15091 89/<- %edx 4/r32/esp +15092 $test-add-literal-to-reg:initialize-literal: +15093 # var l/edx: (payload var) 15094 68/push 0/imm32/register -15095 68/push 0/imm32/no-stack-offset -15096 68/push 1/imm32/block-depth -15097 52/push-edx -15098 68/push 0x11/imm32/alloc-id:fake -15099 68/push 0/imm32/name +15095 68/push 0/imm32/register +15096 68/push 0/imm32/no-stack-offset +15097 68/push 1/imm32/block-depth +15098 52/push-edx +15099 68/push 0x11/imm32/alloc-id:fake 15100 68/push 0/imm32/name -15101 68/push 0x11/imm32/alloc-id:fake:payload -15102 89/<- %edx 4/r32/esp -15103 $test-add-literal-to-reg:initialize-literal-value: -15104 # l->name = "0x34" -15105 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -15106 (copy-array Heap "0x34" %eax) -15107 $test-add-literal-to-reg:initialize-inouts: -15108 # var inouts/esi: (payload stmt-var) = [l] -15109 68/push 0/imm32/is-deref:false -15110 68/push 0/imm32/next +15101 68/push 0/imm32/name +15102 68/push 0x11/imm32/alloc-id:fake:payload +15103 89/<- %edx 4/r32/esp +15104 $test-add-literal-to-reg:initialize-literal-value: +15105 # l->name = "0x34" +15106 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +15107 (copy-array Heap "0x34" %eax) +15108 $test-add-literal-to-reg:initialize-inouts: +15109 # var inouts/esi: (payload stmt-var) = [l] +15110 68/push 0/imm32/is-deref:false 15111 68/push 0/imm32/next -15112 52/push-edx/l -15113 68/push 0x11/imm32/alloc-id:fake -15114 68/push 0x11/imm32/alloc-id:fake:payload -15115 89/<- %esi 4/r32/esp -15116 $test-add-literal-to-reg:initialize-outputs: -15117 # var outputs/edi: (payload stmt-var) = [v] -15118 68/push 0/imm32/is-deref:false -15119 68/push 0/imm32/next +15112 68/push 0/imm32/next +15113 52/push-edx/l +15114 68/push 0x11/imm32/alloc-id:fake +15115 68/push 0x11/imm32/alloc-id:fake:payload +15116 89/<- %esi 4/r32/esp +15117 $test-add-literal-to-reg:initialize-outputs: +15118 # var outputs/edi: (payload stmt-var) = [v] +15119 68/push 0/imm32/is-deref:false 15120 68/push 0/imm32/next -15121 51/push-ecx/v -15122 68/push 0x11/imm32/alloc-id:fake -15123 68/push 0x11/imm32/alloc-id:fake:payload -15124 89/<- %edi 4/r32/esp -15125 $test-add-literal-to-reg:initialize-stmt: -15126 # var stmt/esi: (addr statement) -15127 68/push 0/imm32/next +15121 68/push 0/imm32/next +15122 51/push-ecx/v +15123 68/push 0x11/imm32/alloc-id:fake +15124 68/push 0x11/imm32/alloc-id:fake:payload +15125 89/<- %edi 4/r32/esp +15126 $test-add-literal-to-reg:initialize-stmt: +15127 # var stmt/esi: (addr statement) 15128 68/push 0/imm32/next -15129 57/push-edi/outputs -15130 68/push 0x11/imm32/alloc-id:fake -15131 56/push-esi/inouts -15132 68/push 0x11/imm32/alloc-id:fake -15133 68/push 0/imm32/operation +15129 68/push 0/imm32/next +15130 57/push-edi/outputs +15131 68/push 0x11/imm32/alloc-id:fake +15132 56/push-esi/inouts +15133 68/push 0x11/imm32/alloc-id:fake 15134 68/push 0/imm32/operation -15135 68/push 1/imm32/tag:stmt1 -15136 89/<- %esi 4/r32/esp -15137 $test-add-literal-to-reg:initialize-stmt-operation: -15138 # stmt->operation = "add" -15139 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15140 (copy-array Heap "add" %eax) -15141 # convert -15142 c7 0/subop/copy *Curr-block-depth 0/imm32 -15143 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -15144 (flush _test-output-buffered-file) -15145 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -15151 # check output -15152 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg") -15153 # . epilogue -15154 89/<- %esp 5/r32/ebp -15155 5d/pop-to-ebp -15156 c3/return -15157 -15158 test-add-literal-to-mem: -15159 # add-to var1, 0x34 -15160 # => -15161 # 81 0/subop/add %eax 0x34/imm32 -15162 # -15163 # . prologue -15164 55/push-ebp -15165 89/<- %ebp 4/r32/esp -15166 # setup -15167 (clear-stream _test-output-stream) -15168 (clear-stream $_test-output-buffered-file->buffer) -15169 $test-add-literal-to-mem:initialize-type: -15170 # var type/ecx: (payload tree type-id) = int -15171 68/push 0/imm32/right:null +15135 68/push 0/imm32/operation +15136 68/push 1/imm32/tag:stmt1 +15137 89/<- %esi 4/r32/esp +15138 $test-add-literal-to-reg:initialize-stmt-operation: +15139 # stmt->operation = "add" +15140 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15141 (copy-array Heap "add" %eax) +15142 # convert +15143 c7 0/subop/copy *Curr-block-depth 0/imm32 +15144 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +15145 (flush _test-output-buffered-file) +15146 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15152 # check output +15153 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg") +15154 # . epilogue +15155 89/<- %esp 5/r32/ebp +15156 5d/pop-to-ebp +15157 c3/return +15158 +15159 test-add-literal-to-mem: +15160 # add-to var1, 0x34 +15161 # => +15162 # 81 0/subop/add %eax 0x34/imm32 +15163 # +15164 # . prologue +15165 55/push-ebp +15166 89/<- %ebp 4/r32/esp +15167 # setup +15168 (clear-stream _test-output-stream) +15169 (clear-stream $_test-output-buffered-file->buffer) +15170 $test-add-literal-to-mem:initialize-type: +15171 # var type/ecx: (payload tree type-id) = int 15172 68/push 0/imm32/right:null -15173 68/push 0/imm32/left:unused -15174 68/push 1/imm32/value:int -15175 68/push 1/imm32/is-atom?:true -15176 68/push 0x11/imm32/alloc-id:fake:payload -15177 89/<- %ecx 4/r32/esp -15178 $test-add-literal-to-mem:initialize-var1: -15179 # var var1/ecx: (payload var) -15180 68/push 0/imm32/register +15173 68/push 0/imm32/right:null +15174 68/push 0/imm32/left:unused +15175 68/push 1/imm32/value:int +15176 68/push 1/imm32/is-atom?:true +15177 68/push 0x11/imm32/alloc-id:fake:payload +15178 89/<- %ecx 4/r32/esp +15179 $test-add-literal-to-mem:initialize-var1: +15180 # var var1/ecx: (payload var) 15181 68/push 0/imm32/register -15182 68/push 8/imm32/stack-offset -15183 68/push 1/imm32/block-depth -15184 51/push-ecx -15185 68/push 0x11/imm32/alloc-id:fake -15186 68/push 0/imm32/name +15182 68/push 0/imm32/register +15183 68/push 8/imm32/stack-offset +15184 68/push 1/imm32/block-depth +15185 51/push-ecx +15186 68/push 0x11/imm32/alloc-id:fake 15187 68/push 0/imm32/name -15188 68/push 0x11/imm32/alloc-id:fake:payload -15189 89/<- %ecx 4/r32/esp -15190 $test-add-literal-to-mem:initialize-var1-name: -15191 # var1->name = "var1" -15192 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15193 (copy-array Heap "var1" %eax) -15194 $test-add-literal-to-mem:initialize-literal-type: -15195 # var type/edx: (payload tree type-id) = literal -15196 68/push 0/imm32/right:null +15188 68/push 0/imm32/name +15189 68/push 0x11/imm32/alloc-id:fake:payload +15190 89/<- %ecx 4/r32/esp +15191 $test-add-literal-to-mem:initialize-var1-name: +15192 # var1->name = "var1" +15193 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +15194 (copy-array Heap "var1" %eax) +15195 $test-add-literal-to-mem:initialize-literal-type: +15196 # var type/edx: (payload tree type-id) = literal 15197 68/push 0/imm32/right:null -15198 68/push 0/imm32/left:unused -15199 68/push 0/imm32/value:literal -15200 68/push 1/imm32/is-atom?:true -15201 68/push 0x11/imm32/alloc-id:fake:payload -15202 89/<- %edx 4/r32/esp -15203 $test-add-literal-to-mem:initialize-literal: -15204 # var l/edx: (payload var) -15205 68/push 0/imm32/register +15198 68/push 0/imm32/right:null +15199 68/push 0/imm32/left:unused +15200 68/push 0/imm32/value:literal +15201 68/push 1/imm32/is-atom?:true +15202 68/push 0x11/imm32/alloc-id:fake:payload +15203 89/<- %edx 4/r32/esp +15204 $test-add-literal-to-mem:initialize-literal: +15205 # var l/edx: (payload var) 15206 68/push 0/imm32/register -15207 68/push 0/imm32/no-stack-offset -15208 68/push 1/imm32/block-depth -15209 52/push-edx -15210 68/push 0x11/imm32/alloc-id:fake -15211 68/push 0/imm32/name +15207 68/push 0/imm32/register +15208 68/push 0/imm32/no-stack-offset +15209 68/push 1/imm32/block-depth +15210 52/push-edx +15211 68/push 0x11/imm32/alloc-id:fake 15212 68/push 0/imm32/name -15213 68/push 0x11/imm32/alloc-id:fake:payload -15214 89/<- %edx 4/r32/esp -15215 $test-add-literal-to-mem:initialize-literal-value: -15216 # l->name = "0x34" -15217 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -15218 (copy-array Heap "0x34" %eax) -15219 $test-add-literal-to-mem:initialize-inouts: -15220 # var inouts/esi: (payload stmt-var) = [l] -15221 68/push 0/imm32/is-deref:false -15222 68/push 0/imm32/next +15213 68/push 0/imm32/name +15214 68/push 0x11/imm32/alloc-id:fake:payload +15215 89/<- %edx 4/r32/esp +15216 $test-add-literal-to-mem:initialize-literal-value: +15217 # l->name = "0x34" +15218 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +15219 (copy-array Heap "0x34" %eax) +15220 $test-add-literal-to-mem:initialize-inouts: +15221 # var inouts/esi: (payload stmt-var) = [l] +15222 68/push 0/imm32/is-deref:false 15223 68/push 0/imm32/next -15224 52/push-edx/l -15225 68/push 0x11/imm32/alloc-id:fake -15226 68/push 0x11/imm32/alloc-id:fake:payload -15227 89/<- %esi 4/r32/esp -15228 # var inouts = (handle stmt-var) = [var1, var2] -15229 68/push 0/imm32/is-deref:false -15230 56/push-esi/next -15231 68/push 0x11/imm32/alloc-id:fake -15232 51/push-ecx/var1 -15233 68/push 0x11/imm32/alloc-id:fake -15234 68/push 0x11/imm32/alloc-id:fake:payload -15235 89/<- %esi 4/r32/esp -15236 $test-add-literal-to-mem:initialize-stmt: -15237 # var stmt/esi: (addr statement) -15238 68/push 0/imm32/next +15224 68/push 0/imm32/next +15225 52/push-edx/l +15226 68/push 0x11/imm32/alloc-id:fake +15227 68/push 0x11/imm32/alloc-id:fake:payload +15228 89/<- %esi 4/r32/esp +15229 # var inouts = (handle stmt-var) = [var1, var2] +15230 68/push 0/imm32/is-deref:false +15231 56/push-esi/next +15232 68/push 0x11/imm32/alloc-id:fake +15233 51/push-ecx/var1 +15234 68/push 0x11/imm32/alloc-id:fake +15235 68/push 0x11/imm32/alloc-id:fake:payload +15236 89/<- %esi 4/r32/esp +15237 $test-add-literal-to-mem:initialize-stmt: +15238 # var stmt/esi: (addr statement) 15239 68/push 0/imm32/next -15240 68/push 0/imm32/outputs +15240 68/push 0/imm32/next 15241 68/push 0/imm32/outputs -15242 56/push-esi/inouts -15243 68/push 0x11/imm32/alloc-id:fake -15244 68/push 0/imm32/operation +15242 68/push 0/imm32/outputs +15243 56/push-esi/inouts +15244 68/push 0x11/imm32/alloc-id:fake 15245 68/push 0/imm32/operation -15246 68/push 1/imm32/tag:stmt1 -15247 89/<- %esi 4/r32/esp -15248 $test-add-literal-to-mem:initialize-stmt-operation: -15249 # stmt->operation = "add-to" -15250 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15251 (copy-array Heap "add-to" %eax) -15252 # convert -15253 c7 0/subop/copy *Curr-block-depth 0/imm32 -15254 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -15255 (flush _test-output-buffered-file) -15256 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -15262 # check output -15263 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem") -15264 # . epilogue -15265 89/<- %esp 5/r32/ebp -15266 5d/pop-to-ebp -15267 c3/return -15268 -15269 test-compare-mem-with-reg: -15270 # compare var1, var2/eax -15271 # => -15272 # 39/compare *(ebp+___) 0/r32/eax -15273 # -15274 # . prologue -15275 55/push-ebp -15276 89/<- %ebp 4/r32/esp -15277 # setup -15278 (clear-stream _test-output-stream) -15279 (clear-stream $_test-output-buffered-file->buffer) -15280 $test-compare-mem-with-reg:initialize-type: -15281 # var type/ecx: (payload tree type-id) = int -15282 68/push 0/imm32/right:null +15246 68/push 0/imm32/operation +15247 68/push 1/imm32/tag:stmt1 +15248 89/<- %esi 4/r32/esp +15249 $test-add-literal-to-mem:initialize-stmt-operation: +15250 # stmt->operation = "add-to" +15251 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15252 (copy-array Heap "add-to" %eax) +15253 # convert +15254 c7 0/subop/copy *Curr-block-depth 0/imm32 +15255 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +15256 (flush _test-output-buffered-file) +15257 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15263 # check output +15264 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem") +15265 # . epilogue +15266 89/<- %esp 5/r32/ebp +15267 5d/pop-to-ebp +15268 c3/return +15269 +15270 test-compare-mem-with-reg: +15271 # compare var1, var2/eax +15272 # => +15273 # 39/compare *(ebp+___) 0/r32/eax +15274 # +15275 # . prologue +15276 55/push-ebp +15277 89/<- %ebp 4/r32/esp +15278 # setup +15279 (clear-stream _test-output-stream) +15280 (clear-stream $_test-output-buffered-file->buffer) +15281 $test-compare-mem-with-reg:initialize-type: +15282 # var type/ecx: (payload tree type-id) = int 15283 68/push 0/imm32/right:null -15284 68/push 0/imm32/left:unused -15285 68/push 1/imm32/value:int -15286 68/push 1/imm32/is-atom?:true -15287 68/push 0x11/imm32/alloc-id:fake:payload -15288 89/<- %ecx 4/r32/esp -15289 $test-compare-mem-with-reg:initialize-var1: -15290 # var var1/ecx: (payload var) -15291 68/push 0/imm32/register +15284 68/push 0/imm32/right:null +15285 68/push 0/imm32/left:unused +15286 68/push 1/imm32/value:int +15287 68/push 1/imm32/is-atom?:true +15288 68/push 0x11/imm32/alloc-id:fake:payload +15289 89/<- %ecx 4/r32/esp +15290 $test-compare-mem-with-reg:initialize-var1: +15291 # var var1/ecx: (payload var) 15292 68/push 0/imm32/register -15293 68/push 8/imm32/stack-offset -15294 68/push 1/imm32/block-depth -15295 51/push-ecx -15296 68/push 0x11/imm32/alloc-id:fake -15297 68/push 0/imm32/name +15293 68/push 0/imm32/register +15294 68/push 8/imm32/stack-offset +15295 68/push 1/imm32/block-depth +15296 51/push-ecx +15297 68/push 0x11/imm32/alloc-id:fake 15298 68/push 0/imm32/name -15299 68/push 0x11/imm32/alloc-id:fake:payload -15300 89/<- %ecx 4/r32/esp -15301 $test-compare-mem-with-reg:initialize-var1-name: -15302 # var1->name = "var1" -15303 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15304 (copy-array Heap "var1" %eax) -15305 $test-compare-mem-with-reg:initialize-var2: -15306 # var var2/edx: (payload var) -15307 68/push 0/imm32/register +15299 68/push 0/imm32/name +15300 68/push 0x11/imm32/alloc-id:fake:payload +15301 89/<- %ecx 4/r32/esp +15302 $test-compare-mem-with-reg:initialize-var1-name: +15303 # var1->name = "var1" +15304 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +15305 (copy-array Heap "var1" %eax) +15306 $test-compare-mem-with-reg:initialize-var2: +15307 # var var2/edx: (payload var) 15308 68/push 0/imm32/register -15309 68/push 0/imm32/no-stack-offset -15310 68/push 1/imm32/block-depth -15311 ff 6/subop/push *(ecx+0x10) -15312 68/push 0x11/imm32/alloc-id:fake -15313 68/push 0/imm32/name +15309 68/push 0/imm32/register +15310 68/push 0/imm32/no-stack-offset +15311 68/push 1/imm32/block-depth +15312 ff 6/subop/push *(ecx+0x10) +15313 68/push 0x11/imm32/alloc-id:fake 15314 68/push 0/imm32/name -15315 68/push 0x11/imm32/alloc-id:fake:payload -15316 89/<- %edx 4/r32/esp -15317 $test-compare-mem-with-reg:initialize-var2-name: -15318 # var2->name = "var2" -15319 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -15320 (copy-array Heap "var2" %eax) -15321 $test-compare-mem-with-reg:initialize-var2-register: -15322 # var2->register = "eax" -15323 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -15324 (copy-array Heap "eax" %eax) -15325 $test-compare-mem-with-reg:initialize-inouts: -15326 # var inouts/esi: (payload stmt-var) = [var2] -15327 68/push 0/imm32/is-deref:false -15328 68/push 0/imm32/next +15315 68/push 0/imm32/name +15316 68/push 0x11/imm32/alloc-id:fake:payload +15317 89/<- %edx 4/r32/esp +15318 $test-compare-mem-with-reg:initialize-var2-name: +15319 # var2->name = "var2" +15320 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +15321 (copy-array Heap "var2" %eax) +15322 $test-compare-mem-with-reg:initialize-var2-register: +15323 # var2->register = "eax" +15324 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +15325 (copy-array Heap "eax" %eax) +15326 $test-compare-mem-with-reg:initialize-inouts: +15327 # var inouts/esi: (payload stmt-var) = [var2] +15328 68/push 0/imm32/is-deref:false 15329 68/push 0/imm32/next -15330 52/push-edx/var2 -15331 68/push 0x11/imm32/alloc-id:fake -15332 68/push 0x11/imm32/alloc-id:fake:payload -15333 89/<- %esi 4/r32/esp -15334 # inouts = [var1, var2] -15335 68/push 0/imm32/is-deref:false -15336 56/push-esi/next -15337 68/push 0x11/imm32/alloc-id:fake -15338 51/push-ecx/var1 -15339 68/push 0x11/imm32/alloc-id:fake -15340 68/push 0x11/imm32/alloc-id:fake:payload -15341 89/<- %esi 4/r32/esp -15342 $test-compare-mem-with-reg:initialize-stmt: -15343 # var stmt/esi: (addr statement) -15344 68/push 0/imm32/next +15330 68/push 0/imm32/next +15331 52/push-edx/var2 +15332 68/push 0x11/imm32/alloc-id:fake +15333 68/push 0x11/imm32/alloc-id:fake:payload +15334 89/<- %esi 4/r32/esp +15335 # inouts = [var1, var2] +15336 68/push 0/imm32/is-deref:false +15337 56/push-esi/next +15338 68/push 0x11/imm32/alloc-id:fake +15339 51/push-ecx/var1 +15340 68/push 0x11/imm32/alloc-id:fake +15341 68/push 0x11/imm32/alloc-id:fake:payload +15342 89/<- %esi 4/r32/esp +15343 $test-compare-mem-with-reg:initialize-stmt: +15344 # var stmt/esi: (addr statement) 15345 68/push 0/imm32/next -15346 68/push 0/imm32/outputs +15346 68/push 0/imm32/next 15347 68/push 0/imm32/outputs -15348 56/push-esi/inouts -15349 68/push 0x11/imm32/alloc-id:fake -15350 68/push 0/imm32/operation +15348 68/push 0/imm32/outputs +15349 56/push-esi/inouts +15350 68/push 0x11/imm32/alloc-id:fake 15351 68/push 0/imm32/operation -15352 68/push 1/imm32/tag:stmt1 -15353 89/<- %esi 4/r32/esp -15354 $test-compare-mem-with-reg:initialize-stmt-operation: -15355 # stmt->operation = "compare" -15356 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15357 (copy-array Heap "compare" %eax) -15358 # convert -15359 c7 0/subop/copy *Curr-block-depth 0/imm32 -15360 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -15361 (flush _test-output-buffered-file) -15362 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -15368 # check output -15369 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg") -15370 # . epilogue -15371 89/<- %esp 5/r32/ebp -15372 5d/pop-to-ebp -15373 c3/return -15374 -15375 test-compare-reg-with-mem: -15376 # compare var1/eax, var2 -15377 # => -15378 # 3b/compare<- *(ebp+___) 0/r32/eax -15379 # -15380 # . prologue -15381 55/push-ebp -15382 89/<- %ebp 4/r32/esp -15383 # setup -15384 (clear-stream _test-output-stream) -15385 (clear-stream $_test-output-buffered-file->buffer) -15386 $test-compare-reg-with-mem:initialize-type: -15387 # var type/ecx: (payload tree type-id) = int -15388 68/push 0/imm32/right:null +15352 68/push 0/imm32/operation +15353 68/push 1/imm32/tag:stmt1 +15354 89/<- %esi 4/r32/esp +15355 $test-compare-mem-with-reg:initialize-stmt-operation: +15356 # stmt->operation = "compare" +15357 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15358 (copy-array Heap "compare" %eax) +15359 # convert +15360 c7 0/subop/copy *Curr-block-depth 0/imm32 +15361 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +15362 (flush _test-output-buffered-file) +15363 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15369 # check output +15370 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg") +15371 # . epilogue +15372 89/<- %esp 5/r32/ebp +15373 5d/pop-to-ebp +15374 c3/return +15375 +15376 test-compare-reg-with-mem: +15377 # compare var1/eax, var2 +15378 # => +15379 # 3b/compare<- *(ebp+___) 0/r32/eax +15380 # +15381 # . prologue +15382 55/push-ebp +15383 89/<- %ebp 4/r32/esp +15384 # setup +15385 (clear-stream _test-output-stream) +15386 (clear-stream $_test-output-buffered-file->buffer) +15387 $test-compare-reg-with-mem:initialize-type: +15388 # var type/ecx: (payload tree type-id) = int 15389 68/push 0/imm32/right:null -15390 68/push 0/imm32/left:unused -15391 68/push 1/imm32/value:int -15392 68/push 1/imm32/is-atom?:true -15393 68/push 0x11/imm32/alloc-id:fake:payload -15394 89/<- %ecx 4/r32/esp -15395 $test-compare-reg-with-mem:initialize-var1: -15396 # var var1/ecx: (payload var) -15397 68/push 0/imm32/register +15390 68/push 0/imm32/right:null +15391 68/push 0/imm32/left:unused +15392 68/push 1/imm32/value:int +15393 68/push 1/imm32/is-atom?:true +15394 68/push 0x11/imm32/alloc-id:fake:payload +15395 89/<- %ecx 4/r32/esp +15396 $test-compare-reg-with-mem:initialize-var1: +15397 # var var1/ecx: (payload var) 15398 68/push 0/imm32/register -15399 68/push 0/imm32/no-stack-offset -15400 68/push 1/imm32/block-depth -15401 51/push-ecx -15402 68/push 0x11/imm32/alloc-id:fake -15403 68/push 0/imm32/name +15399 68/push 0/imm32/register +15400 68/push 0/imm32/no-stack-offset +15401 68/push 1/imm32/block-depth +15402 51/push-ecx +15403 68/push 0x11/imm32/alloc-id:fake 15404 68/push 0/imm32/name -15405 68/push 0x11/imm32/alloc-id:fake:payload -15406 89/<- %ecx 4/r32/esp -15407 $test-compare-reg-with-mem:initialize-var1-name: -15408 # var1->name = "var1" -15409 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15410 (copy-array Heap "var1" %eax) -15411 $test-compare-reg-with-mem:initialize-var1-register: -15412 # var1->register = "eax" -15413 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -15414 (copy-array Heap "eax" %eax) -15415 $test-compare-reg-with-mem:initialize-var2: -15416 # var var2/edx: (payload var) -15417 68/push 0/imm32/register +15405 68/push 0/imm32/name +15406 68/push 0x11/imm32/alloc-id:fake:payload +15407 89/<- %ecx 4/r32/esp +15408 $test-compare-reg-with-mem:initialize-var1-name: +15409 # var1->name = "var1" +15410 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +15411 (copy-array Heap "var1" %eax) +15412 $test-compare-reg-with-mem:initialize-var1-register: +15413 # var1->register = "eax" +15414 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +15415 (copy-array Heap "eax" %eax) +15416 $test-compare-reg-with-mem:initialize-var2: +15417 # var var2/edx: (payload var) 15418 68/push 0/imm32/register -15419 68/push 8/imm32/stack-offset -15420 68/push 1/imm32/block-depth -15421 ff 6/subop/push *(ecx+0x10) -15422 68/push 0x11/imm32/alloc-id:fake -15423 68/push 0/imm32/name +15419 68/push 0/imm32/register +15420 68/push 8/imm32/stack-offset +15421 68/push 1/imm32/block-depth +15422 ff 6/subop/push *(ecx+0x10) +15423 68/push 0x11/imm32/alloc-id:fake 15424 68/push 0/imm32/name -15425 68/push 0x11/imm32/alloc-id:fake:payload -15426 89/<- %edx 4/r32/esp -15427 $test-compare-reg-with-mem:initialize-var2-name: -15428 # var2->name = "var2" -15429 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -15430 (copy-array Heap "var2" %eax) -15431 $test-compare-reg-with-mem:initialize-inouts: -15432 # var inouts/esi: (payload stmt-var) = [var2] -15433 68/push 0/imm32/is-deref:false -15434 68/push 0/imm32/next +15425 68/push 0/imm32/name +15426 68/push 0x11/imm32/alloc-id:fake:payload +15427 89/<- %edx 4/r32/esp +15428 $test-compare-reg-with-mem:initialize-var2-name: +15429 # var2->name = "var2" +15430 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +15431 (copy-array Heap "var2" %eax) +15432 $test-compare-reg-with-mem:initialize-inouts: +15433 # var inouts/esi: (payload stmt-var) = [var2] +15434 68/push 0/imm32/is-deref:false 15435 68/push 0/imm32/next -15436 52/push-edx/var2 -15437 68/push 0x11/imm32/alloc-id:fake -15438 68/push 0x11/imm32/alloc-id:fake:payload -15439 89/<- %esi 4/r32/esp -15440 # inouts = [var1, var2] -15441 68/push 0/imm32/is-deref:false -15442 56/push-esi/next -15443 68/push 0x11/imm32/alloc-id:fake -15444 51/push-ecx/var1 -15445 68/push 0x11/imm32/alloc-id:fake -15446 68/push 0x11/imm32/alloc-id:fake:payload -15447 89/<- %esi 4/r32/esp -15448 $test-compare-reg-with-mem:initialize-stmt: -15449 # var stmt/esi: (addr statement) -15450 68/push 0/imm32/next +15436 68/push 0/imm32/next +15437 52/push-edx/var2 +15438 68/push 0x11/imm32/alloc-id:fake +15439 68/push 0x11/imm32/alloc-id:fake:payload +15440 89/<- %esi 4/r32/esp +15441 # inouts = [var1, var2] +15442 68/push 0/imm32/is-deref:false +15443 56/push-esi/next +15444 68/push 0x11/imm32/alloc-id:fake +15445 51/push-ecx/var1 +15446 68/push 0x11/imm32/alloc-id:fake +15447 68/push 0x11/imm32/alloc-id:fake:payload +15448 89/<- %esi 4/r32/esp +15449 $test-compare-reg-with-mem:initialize-stmt: +15450 # var stmt/esi: (addr statement) 15451 68/push 0/imm32/next -15452 68/push 0/imm32/outputs +15452 68/push 0/imm32/next 15453 68/push 0/imm32/outputs -15454 56/push-esi/inouts -15455 68/push 0x11/imm32/alloc-id:fake -15456 68/push 0/imm32/operation +15454 68/push 0/imm32/outputs +15455 56/push-esi/inouts +15456 68/push 0x11/imm32/alloc-id:fake 15457 68/push 0/imm32/operation -15458 68/push 1/imm32/tag:stmt1 -15459 89/<- %esi 4/r32/esp -15460 $test-compare-reg-with-mem:initialize-stmt-operation: -15461 # stmt->operation = "compare" -15462 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15463 (copy-array Heap "compare" %eax) -15464 # convert -15465 c7 0/subop/copy *Curr-block-depth 0/imm32 -15466 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -15467 (flush _test-output-buffered-file) -15468 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -15474 # check output -15475 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem") -15476 # . epilogue -15477 89/<- %esp 5/r32/ebp -15478 5d/pop-to-ebp -15479 c3/return -15480 -15481 test-compare-mem-with-literal: -15482 # compare var1, 0x34 -15483 # => -15484 # 81 7/subop/compare *(ebp+___) 0x34/imm32 -15485 # -15486 # . prologue -15487 55/push-ebp -15488 89/<- %ebp 4/r32/esp -15489 # setup -15490 (clear-stream _test-output-stream) -15491 (clear-stream $_test-output-buffered-file->buffer) -15492 $test-compare-mem-with-literal:initialize-type: -15493 # var type/ecx: (payload tree type-id) = int -15494 68/push 0/imm32/right:null +15458 68/push 0/imm32/operation +15459 68/push 1/imm32/tag:stmt1 +15460 89/<- %esi 4/r32/esp +15461 $test-compare-reg-with-mem:initialize-stmt-operation: +15462 # stmt->operation = "compare" +15463 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15464 (copy-array Heap "compare" %eax) +15465 # convert +15466 c7 0/subop/copy *Curr-block-depth 0/imm32 +15467 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +15468 (flush _test-output-buffered-file) +15469 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15475 # check output +15476 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem") +15477 # . epilogue +15478 89/<- %esp 5/r32/ebp +15479 5d/pop-to-ebp +15480 c3/return +15481 +15482 test-compare-mem-with-literal: +15483 # compare var1, 0x34 +15484 # => +15485 # 81 7/subop/compare *(ebp+___) 0x34/imm32 +15486 # +15487 # . prologue +15488 55/push-ebp +15489 89/<- %ebp 4/r32/esp +15490 # setup +15491 (clear-stream _test-output-stream) +15492 (clear-stream $_test-output-buffered-file->buffer) +15493 $test-compare-mem-with-literal:initialize-type: +15494 # var type/ecx: (payload tree type-id) = int 15495 68/push 0/imm32/right:null -15496 68/push 0/imm32/left:unused -15497 68/push 1/imm32/value:int -15498 68/push 1/imm32/is-atom?:true -15499 68/push 0x11/imm32/alloc-id:fake:payload -15500 89/<- %ecx 4/r32/esp -15501 $test-compare-mem-with-literal:initialize-var1: -15502 # var var1/ecx: (payload var) -15503 68/push 0/imm32/register +15496 68/push 0/imm32/right:null +15497 68/push 0/imm32/left:unused +15498 68/push 1/imm32/value:int +15499 68/push 1/imm32/is-atom?:true +15500 68/push 0x11/imm32/alloc-id:fake:payload +15501 89/<- %ecx 4/r32/esp +15502 $test-compare-mem-with-literal:initialize-var1: +15503 # var var1/ecx: (payload var) 15504 68/push 0/imm32/register -15505 68/push 8/imm32/stack-offset -15506 68/push 1/imm32/block-depth -15507 51/push-ecx -15508 68/push 0x11/imm32/alloc-id:fake -15509 68/push 0/imm32/name +15505 68/push 0/imm32/register +15506 68/push 8/imm32/stack-offset +15507 68/push 1/imm32/block-depth +15508 51/push-ecx +15509 68/push 0x11/imm32/alloc-id:fake 15510 68/push 0/imm32/name -15511 68/push 0x11/imm32/alloc-id:fake:payload -15512 89/<- %ecx 4/r32/esp -15513 $test-compare-mem-with-literal:initialize-var1-name: -15514 # var1->name = "var1" -15515 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15516 (copy-array Heap "var1" %eax) -15517 $test-compare-mem-with-literal:initialize-literal-type: -15518 # var type/edx: (payload tree type-id) = literal -15519 68/push 0/imm32/right:null +15511 68/push 0/imm32/name +15512 68/push 0x11/imm32/alloc-id:fake:payload +15513 89/<- %ecx 4/r32/esp +15514 $test-compare-mem-with-literal:initialize-var1-name: +15515 # var1->name = "var1" +15516 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +15517 (copy-array Heap "var1" %eax) +15518 $test-compare-mem-with-literal:initialize-literal-type: +15519 # var type/edx: (payload tree type-id) = literal 15520 68/push 0/imm32/right:null -15521 68/push 0/imm32/left:unused -15522 68/push 0/imm32/value:literal -15523 68/push 1/imm32/is-atom?:true -15524 68/push 0x11/imm32/alloc-id:fake:payload -15525 89/<- %edx 4/r32/esp -15526 $test-compare-mem-with-literal:initialize-literal: -15527 # var l/edx: (payload var) -15528 68/push 0/imm32/register +15521 68/push 0/imm32/right:null +15522 68/push 0/imm32/left:unused +15523 68/push 0/imm32/value:literal +15524 68/push 1/imm32/is-atom?:true +15525 68/push 0x11/imm32/alloc-id:fake:payload +15526 89/<- %edx 4/r32/esp +15527 $test-compare-mem-with-literal:initialize-literal: +15528 # var l/edx: (payload var) 15529 68/push 0/imm32/register -15530 68/push 0/imm32/no-stack-offset -15531 68/push 1/imm32/block-depth -15532 52/push-edx -15533 68/push 0x11/imm32/alloc-id:fake -15534 68/push 0/imm32/name +15530 68/push 0/imm32/register +15531 68/push 0/imm32/no-stack-offset +15532 68/push 1/imm32/block-depth +15533 52/push-edx +15534 68/push 0x11/imm32/alloc-id:fake 15535 68/push 0/imm32/name -15536 68/push 0x11/imm32/alloc-id:fake:payload -15537 89/<- %edx 4/r32/esp -15538 $test-compare-mem-with-literal:initialize-literal-value: -15539 # l->name = "0x34" -15540 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -15541 (copy-array Heap "0x34" %eax) -15542 $test-compare-mem-with-literal:initialize-inouts: -15543 # var inouts/esi: (payload stmt-var) = [l] -15544 68/push 0/imm32/is-deref:false -15545 68/push 0/imm32/next +15536 68/push 0/imm32/name +15537 68/push 0x11/imm32/alloc-id:fake:payload +15538 89/<- %edx 4/r32/esp +15539 $test-compare-mem-with-literal:initialize-literal-value: +15540 # l->name = "0x34" +15541 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +15542 (copy-array Heap "0x34" %eax) +15543 $test-compare-mem-with-literal:initialize-inouts: +15544 # var inouts/esi: (payload stmt-var) = [l] +15545 68/push 0/imm32/is-deref:false 15546 68/push 0/imm32/next -15547 52/push-edx/l -15548 68/push 0x11/imm32/alloc-id:fake -15549 68/push 0x11/imm32/alloc-id:fake:payload -15550 89/<- %esi 4/r32/esp -15551 # var inouts = (handle stmt-var) = [var1, var2] -15552 68/push 0/imm32/is-deref:false -15553 56/push-esi/next -15554 68/push 0x11/imm32/alloc-id:fake -15555 51/push-ecx/var1 -15556 68/push 0x11/imm32/alloc-id:fake -15557 68/push 0x11/imm32/alloc-id:fake:payload -15558 89/<- %esi 4/r32/esp -15559 $test-compare-mem-with-literal:initialize-stmt: -15560 # var stmt/esi: (addr statement) -15561 68/push 0/imm32/next +15547 68/push 0/imm32/next +15548 52/push-edx/l +15549 68/push 0x11/imm32/alloc-id:fake +15550 68/push 0x11/imm32/alloc-id:fake:payload +15551 89/<- %esi 4/r32/esp +15552 # var inouts = (handle stmt-var) = [var1, var2] +15553 68/push 0/imm32/is-deref:false +15554 56/push-esi/next +15555 68/push 0x11/imm32/alloc-id:fake +15556 51/push-ecx/var1 +15557 68/push 0x11/imm32/alloc-id:fake +15558 68/push 0x11/imm32/alloc-id:fake:payload +15559 89/<- %esi 4/r32/esp +15560 $test-compare-mem-with-literal:initialize-stmt: +15561 # var stmt/esi: (addr statement) 15562 68/push 0/imm32/next -15563 68/push 0/imm32/outputs +15563 68/push 0/imm32/next 15564 68/push 0/imm32/outputs -15565 56/push-esi/inouts -15566 68/push 0x11/imm32/alloc-id:fake -15567 68/push 0/imm32/operation +15565 68/push 0/imm32/outputs +15566 56/push-esi/inouts +15567 68/push 0x11/imm32/alloc-id:fake 15568 68/push 0/imm32/operation -15569 68/push 1/imm32/tag:stmt1 -15570 89/<- %esi 4/r32/esp -15571 $test-compare-mem-with-literal:initialize-stmt-operation: -15572 # stmt->operation = "compare" -15573 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15574 (copy-array Heap "compare" %eax) -15575 # convert -15576 c7 0/subop/copy *Curr-block-depth 0/imm32 -15577 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -15578 (flush _test-output-buffered-file) -15579 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -15585 # check output -15586 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal") -15587 # . epilogue -15588 89/<- %esp 5/r32/ebp -15589 5d/pop-to-ebp -15590 c3/return -15591 -15592 test-compare-eax-with-literal: -15593 # compare var1/eax 0x34 -15594 # => -15595 # 3d/compare-eax-with 0x34/imm32 -15596 # -15597 # . prologue -15598 55/push-ebp -15599 89/<- %ebp 4/r32/esp -15600 # setup -15601 (clear-stream _test-output-stream) -15602 (clear-stream $_test-output-buffered-file->buffer) -15603 $test-compare-eax-with-literal:initialize-type: -15604 # var type/ecx: (payload tree type-id) = int -15605 68/push 0/imm32/right:null +15569 68/push 0/imm32/operation +15570 68/push 1/imm32/tag:stmt1 +15571 89/<- %esi 4/r32/esp +15572 $test-compare-mem-with-literal:initialize-stmt-operation: +15573 # stmt->operation = "compare" +15574 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15575 (copy-array Heap "compare" %eax) +15576 # convert +15577 c7 0/subop/copy *Curr-block-depth 0/imm32 +15578 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +15579 (flush _test-output-buffered-file) +15580 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15586 # check output +15587 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal") +15588 # . epilogue +15589 89/<- %esp 5/r32/ebp +15590 5d/pop-to-ebp +15591 c3/return +15592 +15593 test-compare-eax-with-literal: +15594 # compare var1/eax 0x34 +15595 # => +15596 # 3d/compare-eax-with 0x34/imm32 +15597 # +15598 # . prologue +15599 55/push-ebp +15600 89/<- %ebp 4/r32/esp +15601 # setup +15602 (clear-stream _test-output-stream) +15603 (clear-stream $_test-output-buffered-file->buffer) +15604 $test-compare-eax-with-literal:initialize-type: +15605 # var type/ecx: (payload tree type-id) = int 15606 68/push 0/imm32/right:null -15607 68/push 0/imm32/left:unused -15608 68/push 1/imm32/value:int -15609 68/push 1/imm32/is-atom?:true -15610 68/push 0x11/imm32/alloc-id:fake:payload -15611 89/<- %ecx 4/r32/esp -15612 $test-compare-eax-with-literal:initialize-var1: -15613 # var var1/ecx: (payload var) -15614 68/push 0/imm32/register +15607 68/push 0/imm32/right:null +15608 68/push 0/imm32/left:unused +15609 68/push 1/imm32/value:int +15610 68/push 1/imm32/is-atom?:true +15611 68/push 0x11/imm32/alloc-id:fake:payload +15612 89/<- %ecx 4/r32/esp +15613 $test-compare-eax-with-literal:initialize-var1: +15614 # var var1/ecx: (payload var) 15615 68/push 0/imm32/register -15616 68/push 0/imm32/no-stack-offset -15617 68/push 1/imm32/block-depth -15618 51/push-ecx -15619 68/push 0x11/imm32/alloc-id:fake -15620 68/push 0/imm32/name +15616 68/push 0/imm32/register +15617 68/push 0/imm32/no-stack-offset +15618 68/push 1/imm32/block-depth +15619 51/push-ecx +15620 68/push 0x11/imm32/alloc-id:fake 15621 68/push 0/imm32/name -15622 68/push 0x11/imm32/alloc-id:fake:payload -15623 89/<- %ecx 4/r32/esp -15624 $test-compare-eax-with-literal:initialize-var1-name: -15625 # var1->name = "var1" -15626 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15627 (copy-array Heap "var1" %eax) -15628 $test-compare-eax-with-literal:initialize-var1-register: -15629 # v->register = "eax" -15630 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -15631 (copy-array Heap "eax" %eax) -15632 $test-compare-eax-with-literal:initialize-literal-type: -15633 # var type/edx: (payload tree type-id) = literal -15634 68/push 0/imm32/right:null +15622 68/push 0/imm32/name +15623 68/push 0x11/imm32/alloc-id:fake:payload +15624 89/<- %ecx 4/r32/esp +15625 $test-compare-eax-with-literal:initialize-var1-name: +15626 # var1->name = "var1" +15627 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +15628 (copy-array Heap "var1" %eax) +15629 $test-compare-eax-with-literal:initialize-var1-register: +15630 # v->register = "eax" +15631 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +15632 (copy-array Heap "eax" %eax) +15633 $test-compare-eax-with-literal:initialize-literal-type: +15634 # var type/edx: (payload tree type-id) = literal 15635 68/push 0/imm32/right:null -15636 68/push 0/imm32/left:unused -15637 68/push 0/imm32/value:literal -15638 68/push 1/imm32/is-atom?:true -15639 68/push 0x11/imm32/alloc-id:fake:payload -15640 89/<- %edx 4/r32/esp -15641 $test-compare-eax-with-literal:initialize-literal: -15642 # var l/edx: (payload var) -15643 68/push 0/imm32/register +15636 68/push 0/imm32/right:null +15637 68/push 0/imm32/left:unused +15638 68/push 0/imm32/value:literal +15639 68/push 1/imm32/is-atom?:true +15640 68/push 0x11/imm32/alloc-id:fake:payload +15641 89/<- %edx 4/r32/esp +15642 $test-compare-eax-with-literal:initialize-literal: +15643 # var l/edx: (payload var) 15644 68/push 0/imm32/register -15645 68/push 0/imm32/no-stack-offset -15646 68/push 1/imm32/block-depth -15647 52/push-edx -15648 68/push 0x11/imm32/alloc-id:fake -15649 68/push 0/imm32/name +15645 68/push 0/imm32/register +15646 68/push 0/imm32/no-stack-offset +15647 68/push 1/imm32/block-depth +15648 52/push-edx +15649 68/push 0x11/imm32/alloc-id:fake 15650 68/push 0/imm32/name -15651 68/push 0x11/imm32/alloc-id:fake:payload -15652 89/<- %edx 4/r32/esp -15653 $test-compare-eax-with-literal:initialize-literal-value: -15654 # l->name = "0x34" -15655 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -15656 (copy-array Heap "0x34" %eax) -15657 $test-compare-eax-with-literal:initialize-inouts: -15658 # var inouts/esi: (payload stmt-var) = [l] -15659 68/push 0/imm32/is-deref:false -15660 68/push 0/imm32/next +15651 68/push 0/imm32/name +15652 68/push 0x11/imm32/alloc-id:fake:payload +15653 89/<- %edx 4/r32/esp +15654 $test-compare-eax-with-literal:initialize-literal-value: +15655 # l->name = "0x34" +15656 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +15657 (copy-array Heap "0x34" %eax) +15658 $test-compare-eax-with-literal:initialize-inouts: +15659 # var inouts/esi: (payload stmt-var) = [l] +15660 68/push 0/imm32/is-deref:false 15661 68/push 0/imm32/next -15662 52/push-edx/l -15663 68/push 0x11/imm32/alloc-id:fake -15664 68/push 0x11/imm32/alloc-id:fake:payload -15665 89/<- %esi 4/r32/esp -15666 # var inouts = (handle stmt-var) = [var1, var2] -15667 68/push 0/imm32/is-deref:false -15668 56/push-esi/next -15669 68/push 0x11/imm32/alloc-id:fake -15670 51/push-ecx/var1 -15671 68/push 0x11/imm32/alloc-id:fake -15672 68/push 0x11/imm32/alloc-id:fake:payload -15673 89/<- %esi 4/r32/esp -15674 $test-compare-eax-with-literal:initialize-stmt: -15675 # var stmt/esi: (addr statement) -15676 68/push 0/imm32/next +15662 68/push 0/imm32/next +15663 52/push-edx/l +15664 68/push 0x11/imm32/alloc-id:fake +15665 68/push 0x11/imm32/alloc-id:fake:payload +15666 89/<- %esi 4/r32/esp +15667 # var inouts = (handle stmt-var) = [var1, var2] +15668 68/push 0/imm32/is-deref:false +15669 56/push-esi/next +15670 68/push 0x11/imm32/alloc-id:fake +15671 51/push-ecx/var1 +15672 68/push 0x11/imm32/alloc-id:fake +15673 68/push 0x11/imm32/alloc-id:fake:payload +15674 89/<- %esi 4/r32/esp +15675 $test-compare-eax-with-literal:initialize-stmt: +15676 # var stmt/esi: (addr statement) 15677 68/push 0/imm32/next -15678 68/push 0/imm32/outputs +15678 68/push 0/imm32/next 15679 68/push 0/imm32/outputs -15680 56/push-esi/inouts -15681 68/push 0x11/imm32/alloc-id:fake -15682 68/push 0/imm32/operation +15680 68/push 0/imm32/outputs +15681 56/push-esi/inouts +15682 68/push 0x11/imm32/alloc-id:fake 15683 68/push 0/imm32/operation -15684 68/push 1/imm32/tag:stmt1 -15685 89/<- %esi 4/r32/esp -15686 $test-compare-eax-with-literal:initialize-stmt-operation: -15687 # stmt->operation = "compare" -15688 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15689 (copy-array Heap "compare" %eax) -15690 # convert -15691 c7 0/subop/copy *Curr-block-depth 0/imm32 -15692 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -15693 (flush _test-output-buffered-file) -15694 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -15700 # check output -15701 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal") -15702 # . epilogue -15703 89/<- %esp 5/r32/ebp -15704 5d/pop-to-ebp -15705 c3/return -15706 -15707 test-compare-reg-with-literal: -15708 # compare var1/ecx 0x34 -15709 # => -15710 # 81 7/subop/compare %ecx 0x34/imm32 -15711 # -15712 # . prologue -15713 55/push-ebp -15714 89/<- %ebp 4/r32/esp -15715 # setup -15716 (clear-stream _test-output-stream) -15717 (clear-stream $_test-output-buffered-file->buffer) -15718 $test-compare-reg-with-literal:initialize-type: -15719 # var type/ecx: (payload tree type-id) = int -15720 68/push 0/imm32/right:null +15684 68/push 0/imm32/operation +15685 68/push 1/imm32/tag:stmt1 +15686 89/<- %esi 4/r32/esp +15687 $test-compare-eax-with-literal:initialize-stmt-operation: +15688 # stmt->operation = "compare" +15689 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15690 (copy-array Heap "compare" %eax) +15691 # convert +15692 c7 0/subop/copy *Curr-block-depth 0/imm32 +15693 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +15694 (flush _test-output-buffered-file) +15695 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15701 # check output +15702 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal") +15703 # . epilogue +15704 89/<- %esp 5/r32/ebp +15705 5d/pop-to-ebp +15706 c3/return +15707 +15708 test-compare-reg-with-literal: +15709 # compare var1/ecx 0x34 +15710 # => +15711 # 81 7/subop/compare %ecx 0x34/imm32 +15712 # +15713 # . prologue +15714 55/push-ebp +15715 89/<- %ebp 4/r32/esp +15716 # setup +15717 (clear-stream _test-output-stream) +15718 (clear-stream $_test-output-buffered-file->buffer) +15719 $test-compare-reg-with-literal:initialize-type: +15720 # var type/ecx: (payload tree type-id) = int 15721 68/push 0/imm32/right:null -15722 68/push 0/imm32/left:unused -15723 68/push 1/imm32/value:int -15724 68/push 1/imm32/is-atom?:true -15725 68/push 0x11/imm32/alloc-id:fake:payload -15726 89/<- %ecx 4/r32/esp -15727 $test-compare-reg-with-literal:initialize-var1: -15728 # var var1/ecx: (payload var) -15729 68/push 0/imm32/register +15722 68/push 0/imm32/right:null +15723 68/push 0/imm32/left:unused +15724 68/push 1/imm32/value:int +15725 68/push 1/imm32/is-atom?:true +15726 68/push 0x11/imm32/alloc-id:fake:payload +15727 89/<- %ecx 4/r32/esp +15728 $test-compare-reg-with-literal:initialize-var1: +15729 # var var1/ecx: (payload var) 15730 68/push 0/imm32/register -15731 68/push 0/imm32/no-stack-offset -15732 68/push 1/imm32/block-depth -15733 51/push-ecx -15734 68/push 0x11/imm32/alloc-id:fake -15735 68/push 0/imm32/name +15731 68/push 0/imm32/register +15732 68/push 0/imm32/no-stack-offset +15733 68/push 1/imm32/block-depth +15734 51/push-ecx +15735 68/push 0x11/imm32/alloc-id:fake 15736 68/push 0/imm32/name -15737 68/push 0x11/imm32/alloc-id:fake:payload -15738 89/<- %ecx 4/r32/esp -15739 $test-compare-reg-with-literal:initialize-var1-name: -15740 # var1->name = "var1" -15741 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15742 (copy-array Heap "var1" %eax) -15743 $test-compare-reg-with-literal:initialize-var1-register: -15744 # v->register = "ecx" -15745 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -15746 (copy-array Heap "ecx" %eax) -15747 $test-compare-reg-with-literal:initialize-literal-type: -15748 # var type/edx: (payload tree type-id) = literal -15749 68/push 0/imm32/right:null +15737 68/push 0/imm32/name +15738 68/push 0x11/imm32/alloc-id:fake:payload +15739 89/<- %ecx 4/r32/esp +15740 $test-compare-reg-with-literal:initialize-var1-name: +15741 # var1->name = "var1" +15742 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +15743 (copy-array Heap "var1" %eax) +15744 $test-compare-reg-with-literal:initialize-var1-register: +15745 # v->register = "ecx" +15746 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +15747 (copy-array Heap "ecx" %eax) +15748 $test-compare-reg-with-literal:initialize-literal-type: +15749 # var type/edx: (payload tree type-id) = literal 15750 68/push 0/imm32/right:null -15751 68/push 0/imm32/left:unused -15752 68/push 0/imm32/value:literal -15753 68/push 1/imm32/is-atom?:true -15754 68/push 0x11/imm32/alloc-id:fake:payload -15755 89/<- %edx 4/r32/esp -15756 $test-compare-reg-with-literal:initialize-literal: -15757 # var l/edx: (payload var) -15758 68/push 0/imm32/register +15751 68/push 0/imm32/right:null +15752 68/push 0/imm32/left:unused +15753 68/push 0/imm32/value:literal +15754 68/push 1/imm32/is-atom?:true +15755 68/push 0x11/imm32/alloc-id:fake:payload +15756 89/<- %edx 4/r32/esp +15757 $test-compare-reg-with-literal:initialize-literal: +15758 # var l/edx: (payload var) 15759 68/push 0/imm32/register -15760 68/push 0/imm32/no-stack-offset -15761 68/push 1/imm32/block-depth -15762 52/push-edx -15763 68/push 0x11/imm32/alloc-id:fake -15764 68/push 0/imm32/name +15760 68/push 0/imm32/register +15761 68/push 0/imm32/no-stack-offset +15762 68/push 1/imm32/block-depth +15763 52/push-edx +15764 68/push 0x11/imm32/alloc-id:fake 15765 68/push 0/imm32/name -15766 68/push 0x11/imm32/alloc-id:fake:payload -15767 89/<- %edx 4/r32/esp -15768 $test-compare-reg-with-literal:initialize-literal-value: -15769 # l->name = "0x34" -15770 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -15771 (copy-array Heap "0x34" %eax) -15772 $test-compare-reg-with-literal:initialize-inouts: -15773 # var inouts/esi: (payload stmt-var) = [l] -15774 68/push 0/imm32/is-deref:false -15775 68/push 0/imm32/next +15766 68/push 0/imm32/name +15767 68/push 0x11/imm32/alloc-id:fake:payload +15768 89/<- %edx 4/r32/esp +15769 $test-compare-reg-with-literal:initialize-literal-value: +15770 # l->name = "0x34" +15771 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +15772 (copy-array Heap "0x34" %eax) +15773 $test-compare-reg-with-literal:initialize-inouts: +15774 # var inouts/esi: (payload stmt-var) = [l] +15775 68/push 0/imm32/is-deref:false 15776 68/push 0/imm32/next -15777 52/push-edx/l -15778 68/push 0x11/imm32/alloc-id:fake -15779 68/push 0x11/imm32/alloc-id:fake:payload -15780 89/<- %esi 4/r32/esp -15781 # var inouts = (handle stmt-var) = [var1, var2] -15782 68/push 0/imm32/is-deref:false -15783 56/push-esi/next -15784 68/push 0x11/imm32/alloc-id:fake -15785 51/push-ecx/var1 -15786 68/push 0x11/imm32/alloc-id:fake -15787 68/push 0x11/imm32/alloc-id:fake:payload -15788 89/<- %esi 4/r32/esp -15789 $test-compare-reg-with-literal:initialize-stmt: -15790 # var stmt/esi: (addr statement) -15791 68/push 0/imm32/next +15777 68/push 0/imm32/next +15778 52/push-edx/l +15779 68/push 0x11/imm32/alloc-id:fake +15780 68/push 0x11/imm32/alloc-id:fake:payload +15781 89/<- %esi 4/r32/esp +15782 # var inouts = (handle stmt-var) = [var1, var2] +15783 68/push 0/imm32/is-deref:false +15784 56/push-esi/next +15785 68/push 0x11/imm32/alloc-id:fake +15786 51/push-ecx/var1 +15787 68/push 0x11/imm32/alloc-id:fake +15788 68/push 0x11/imm32/alloc-id:fake:payload +15789 89/<- %esi 4/r32/esp +15790 $test-compare-reg-with-literal:initialize-stmt: +15791 # var stmt/esi: (addr statement) 15792 68/push 0/imm32/next -15793 68/push 0/imm32/outputs +15793 68/push 0/imm32/next 15794 68/push 0/imm32/outputs -15795 56/push-esi/inouts -15796 68/push 0x11/imm32/alloc-id:fake -15797 68/push 0/imm32/operation +15795 68/push 0/imm32/outputs +15796 56/push-esi/inouts +15797 68/push 0x11/imm32/alloc-id:fake 15798 68/push 0/imm32/operation -15799 68/push 1/imm32/tag:stmt1 -15800 89/<- %esi 4/r32/esp -15801 $test-compare-reg-with-literal:initialize-stmt-operation: -15802 # stmt->operation = "compare" -15803 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15804 (copy-array Heap "compare" %eax) -15805 # convert -15806 c7 0/subop/copy *Curr-block-depth 0/imm32 -15807 (emit-subx-stmt _test-output-buffered-file %esi Primitives) -15808 (flush _test-output-buffered-file) -15809 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -15815 # check output -15816 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal") -15817 # . epilogue -15818 89/<- %esp 5/r32/ebp -15819 5d/pop-to-ebp -15820 c3/return -15821 -15822 test-emit-subx-stmt-function-call: -15823 # Call a function on a variable on the stack. -15824 # f foo -15825 # => -15826 # (f *(ebp-8)) -15827 # (Changing the function name supports overloading in general, but here it -15828 # just serves to help disambiguate things.) -15829 # -15830 # There's a variable on the var stack as follows: -15831 # name: 'foo' -15832 # type: int -15833 # stack-offset: -8 -15834 # -15835 # There's nothing in primitives. -15836 # -15837 # We don't perform any checking here on the type of 'f'. -15838 # -15839 # . prologue -15840 55/push-ebp -15841 89/<- %ebp 4/r32/esp -15842 # setup -15843 (clear-stream _test-output-stream) -15844 (clear-stream $_test-output-buffered-file->buffer) -15845 $test-emit-subx-function-call:initialize-type: -15846 # var type/ecx: (payload tree type-id) = int -15847 68/push 0/imm32/right:null +15799 68/push 0/imm32/operation +15800 68/push 1/imm32/tag:stmt1 +15801 89/<- %esi 4/r32/esp +15802 $test-compare-reg-with-literal:initialize-stmt-operation: +15803 # stmt->operation = "compare" +15804 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15805 (copy-array Heap "compare" %eax) +15806 # convert +15807 c7 0/subop/copy *Curr-block-depth 0/imm32 +15808 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +15809 (flush _test-output-buffered-file) +15810 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15816 # check output +15817 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal") +15818 # . epilogue +15819 89/<- %esp 5/r32/ebp +15820 5d/pop-to-ebp +15821 c3/return +15822 +15823 test-emit-subx-stmt-function-call: +15824 # Call a function on a variable on the stack. +15825 # f foo +15826 # => +15827 # (f *(ebp-8)) +15828 # (Changing the function name supports overloading in general, but here it +15829 # just serves to help disambiguate things.) +15830 # +15831 # There's a variable on the var stack as follows: +15832 # name: 'foo' +15833 # type: int +15834 # stack-offset: -8 +15835 # +15836 # There's nothing in primitives. +15837 # +15838 # We don't perform any checking here on the type of 'f'. +15839 # +15840 # . prologue +15841 55/push-ebp +15842 89/<- %ebp 4/r32/esp +15843 # setup +15844 (clear-stream _test-output-stream) +15845 (clear-stream $_test-output-buffered-file->buffer) +15846 $test-emit-subx-function-call:initialize-type: +15847 # var type/ecx: (payload tree type-id) = int 15848 68/push 0/imm32/right:null -15849 68/push 0/imm32/left:unused -15850 68/push 1/imm32/value:int -15851 68/push 1/imm32/is-atom?:true -15852 68/push 0x11/imm32/alloc-id:fake:payload -15853 89/<- %ecx 4/r32/esp -15854 $test-emit-subx-function-call:initialize-var: -15855 # var var-foo/ecx: (payload var) = var(type) -15856 68/push 0/imm32/no-register +15849 68/push 0/imm32/right:null +15850 68/push 0/imm32/left:unused +15851 68/push 1/imm32/value:int +15852 68/push 1/imm32/is-atom?:true +15853 68/push 0x11/imm32/alloc-id:fake:payload +15854 89/<- %ecx 4/r32/esp +15855 $test-emit-subx-function-call:initialize-var: +15856 # var var-foo/ecx: (payload var) = var(type) 15857 68/push 0/imm32/no-register -15858 68/push -8/imm32/stack-offset -15859 68/push 1/imm32/block-depth -15860 51/push-ecx/type -15861 68/push 0x11/imm32/alloc-id:fake -15862 68/push 0/imm32/name +15858 68/push 0/imm32/no-register +15859 68/push -8/imm32/stack-offset +15860 68/push 1/imm32/block-depth +15861 51/push-ecx/type +15862 68/push 0x11/imm32/alloc-id:fake 15863 68/push 0/imm32/name -15864 68/push 0x11/imm32/alloc-id:fake:payload -15865 89/<- %ecx 4/r32/esp -15866 $test-emit-subx-function-call:initialize-var-name: -15867 # var-foo->name = "foo" -15868 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15869 (copy-array Heap "foo" %eax) -15870 $test-emit-subx-function-call:initialize-stmt-var: -15871 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -15872 68/push 0/imm32/is-deref:false -15873 68/push 0/imm32/next +15864 68/push 0/imm32/name +15865 68/push 0x11/imm32/alloc-id:fake:payload +15866 89/<- %ecx 4/r32/esp +15867 $test-emit-subx-function-call:initialize-var-name: +15868 # var-foo->name = "foo" +15869 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +15870 (copy-array Heap "foo" %eax) +15871 $test-emit-subx-function-call:initialize-stmt-var: +15872 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +15873 68/push 0/imm32/is-deref:false 15874 68/push 0/imm32/next -15875 51/push-ecx/var-foo -15876 68/push 0x11/imm32/alloc-id:fake -15877 68/push 0x11/imm32/alloc-id:fake:payload -15878 89/<- %ebx 4/r32/esp -15879 $test-emit-subx-function-call:initialize-stmt: -15880 # var stmt/esi: (addr statement) -15881 68/push 0/imm32/no-outputs +15875 68/push 0/imm32/next +15876 51/push-ecx/var-foo +15877 68/push 0x11/imm32/alloc-id:fake +15878 68/push 0x11/imm32/alloc-id:fake:payload +15879 89/<- %ebx 4/r32/esp +15880 $test-emit-subx-function-call:initialize-stmt: +15881 # var stmt/esi: (addr statement) 15882 68/push 0/imm32/no-outputs -15883 53/push-ebx/inouts -15884 68/push 0x11/imm32/alloc-id:fake -15885 68/push 0/imm32/operation +15883 68/push 0/imm32/no-outputs +15884 53/push-ebx/inouts +15885 68/push 0x11/imm32/alloc-id:fake 15886 68/push 0/imm32/operation -15887 68/push 1/imm32/tag -15888 89/<- %esi 4/r32/esp -15889 $test-emit-subx-function-call:initialize-stmt-operation: -15890 # stmt->operation = "f" -15891 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15892 (copy-array Heap "f" %eax) -15893 # convert -15894 c7 0/subop/copy *Curr-block-depth 0/imm32 -15895 (emit-subx-stmt _test-output-buffered-file %esi 0) -15896 (flush _test-output-buffered-file) -15897 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -15903 # check output -15904 (check-next-stream-line-equal _test-output-stream "(f *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call") -15905 # . epilogue -15906 89/<- %esp 5/r32/ebp -15907 5d/pop-to-ebp -15908 c3/return -15909 -15910 test-emit-subx-stmt-function-call-with-literal-arg: -15911 # Call a function on a literal. -15912 # f 0x34 -15913 # => -15914 # (f2 0x34) -15915 # -15916 # . prologue -15917 55/push-ebp -15918 89/<- %ebp 4/r32/esp -15919 # setup -15920 (clear-stream _test-output-stream) -15921 (clear-stream $_test-output-buffered-file->buffer) -15922 $test-emit-subx-function-call-with-literal-arg:initialize-type: -15923 # var type/ecx: (payload tree type-id) = int -15924 68/push 0/imm32/right:null +15887 68/push 0/imm32/operation +15888 68/push 1/imm32/tag +15889 89/<- %esi 4/r32/esp +15890 $test-emit-subx-function-call:initialize-stmt-operation: +15891 # stmt->operation = "f" +15892 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15893 (copy-array Heap "f" %eax) +15894 # convert +15895 c7 0/subop/copy *Curr-block-depth 0/imm32 +15896 (emit-subx-stmt _test-output-buffered-file %esi 0 Stderr 0) +15897 (flush _test-output-buffered-file) +15898 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15904 # check output +15905 (check-next-stream-line-equal _test-output-stream "(f *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call") +15906 # . epilogue +15907 89/<- %esp 5/r32/ebp +15908 5d/pop-to-ebp +15909 c3/return +15910 +15911 test-emit-subx-stmt-function-call-with-literal-arg: +15912 # Call a function on a literal. +15913 # f 0x34 +15914 # => +15915 # (f2 0x34) +15916 # +15917 # . prologue +15918 55/push-ebp +15919 89/<- %ebp 4/r32/esp +15920 # setup +15921 (clear-stream _test-output-stream) +15922 (clear-stream $_test-output-buffered-file->buffer) +15923 $test-emit-subx-function-call-with-literal-arg:initialize-type: +15924 # var type/ecx: (payload tree type-id) = int 15925 68/push 0/imm32/right:null -15926 68/push 0/imm32/left:unused -15927 68/push 0/imm32/value:literal -15928 68/push 1/imm32/is-atom?:true -15929 68/push 0x11/imm32/alloc-id:fake:payload -15930 89/<- %ecx 4/r32/esp -15931 $test-emit-subx-function-call-with-literal-arg:initialize-var: -15932 # var var-foo/ecx: (payload var) = var(lit) -15933 68/push 0/imm32/no-register +15926 68/push 0/imm32/right:null +15927 68/push 0/imm32/left:unused +15928 68/push 0/imm32/value:literal +15929 68/push 1/imm32/is-atom?:true +15930 68/push 0x11/imm32/alloc-id:fake:payload +15931 89/<- %ecx 4/r32/esp +15932 $test-emit-subx-function-call-with-literal-arg:initialize-var: +15933 # var var-foo/ecx: (payload var) = var(lit) 15934 68/push 0/imm32/no-register -15935 68/push 0/imm32/no-stack-offset -15936 68/push 1/imm32/block-depth -15937 51/push-ecx/type -15938 68/push 0x11/imm32/alloc-id:fake -15939 68/push 0/imm32/name +15935 68/push 0/imm32/no-register +15936 68/push 0/imm32/no-stack-offset +15937 68/push 1/imm32/block-depth +15938 51/push-ecx/type +15939 68/push 0x11/imm32/alloc-id:fake 15940 68/push 0/imm32/name -15941 68/push 0x11/imm32/alloc-id:fake:payload -15942 89/<- %ecx 4/r32/esp -15943 $test-emit-subx-function-call-with-literal-arg:initialize-var-name: -15944 # var-foo->name = "0x34" -15945 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15946 (copy-array Heap "0x34" %eax) -15947 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-var: -15948 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -15949 68/push 0/imm32/is-deref:false -15950 68/push 0/imm32/next +15941 68/push 0/imm32/name +15942 68/push 0x11/imm32/alloc-id:fake:payload +15943 89/<- %ecx 4/r32/esp +15944 $test-emit-subx-function-call-with-literal-arg:initialize-var-name: +15945 # var-foo->name = "0x34" +15946 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +15947 (copy-array Heap "0x34" %eax) +15948 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-var: +15949 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +15950 68/push 0/imm32/is-deref:false 15951 68/push 0/imm32/next -15952 51/push-ecx/var-foo -15953 68/push 0x11/imm32/alloc-id:fake -15954 68/push 0x11/imm32/alloc-id:fake:payload -15955 89/<- %ebx 4/r32/esp -15956 $test-emit-subx-function-call-with-literal-arg:initialize-stmt: -15957 # var stmt/esi: (addr statement) -15958 68/push 0/imm32/no-outputs +15952 68/push 0/imm32/next +15953 51/push-ecx/var-foo +15954 68/push 0x11/imm32/alloc-id:fake +15955 68/push 0x11/imm32/alloc-id:fake:payload +15956 89/<- %ebx 4/r32/esp +15957 $test-emit-subx-function-call-with-literal-arg:initialize-stmt: +15958 # var stmt/esi: (addr statement) 15959 68/push 0/imm32/no-outputs -15960 53/push-ebx/inouts -15961 68/push 0x11/imm32/alloc-id:fake -15962 68/push 0/imm32/operation +15960 68/push 0/imm32/no-outputs +15961 53/push-ebx/inouts +15962 68/push 0x11/imm32/alloc-id:fake 15963 68/push 0/imm32/operation -15964 68/push 1/imm32/tag -15965 89/<- %esi 4/r32/esp -15966 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-operation: -15967 # stmt->operation = "f" -15968 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15969 (copy-array Heap "f" %eax) -15970 # convert -15971 c7 0/subop/copy *Curr-block-depth 0/imm32 -15972 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx) -15973 (flush _test-output-buffered-file) -15974 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -15980 # check output -15981 (check-next-stream-line-equal _test-output-stream "(f 0x34)" "F - test-emit-subx-stmt-function-call-with-literal-arg") -15982 # . epilogue -15983 89/<- %esp 5/r32/ebp -15984 5d/pop-to-ebp -15985 c3/return -15986 -15987 emit-indent: # out: (addr buffered-file), n: int -15988 # . prologue -15989 55/push-ebp -15990 89/<- %ebp 4/r32/esp -15991 # . save registers -15992 50/push-eax -15993 # var i/eax: int = n -15994 8b/-> *(ebp+0xc) 0/r32/eax -15995 { -15996 # if (i <= 0) break -15997 3d/compare-eax-with 0/imm32 -15998 7e/jump-if-<= break/disp8 -15999 (write-buffered *(ebp+8) " ") -16000 48/decrement-eax -16001 eb/jump loop/disp8 -16002 } -16003 $emit-indent:end: -16004 # . restore registers -16005 58/pop-to-eax -16006 # . epilogue -16007 89/<- %esp 5/r32/ebp -16008 5d/pop-to-ebp -16009 c3/return -16010 -16011 emit-subx-prologue: # out: (addr buffered-file) -16012 # . prologue -16013 55/push-ebp -16014 89/<- %ebp 4/r32/esp -16015 # -16016 (write-buffered *(ebp+8) " # . prologue\n") -16017 (write-buffered *(ebp+8) " 55/push-ebp\n") -16018 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n") -16019 $emit-subx-prologue:end: -16020 # . epilogue -16021 89/<- %esp 5/r32/ebp -16022 5d/pop-to-ebp -16023 c3/return -16024 -16025 emit-subx-epilogue: # out: (addr buffered-file) -16026 # . prologue -16027 55/push-ebp -16028 89/<- %ebp 4/r32/esp -16029 # -16030 (write-buffered *(ebp+8) " # . epilogue\n") -16031 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n") -16032 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n") -16033 (write-buffered *(ebp+8) " c3/return\n") -16034 $emit-subx-epilogue:end: -16035 # . epilogue -16036 89/<- %esp 5/r32/ebp -16037 5d/pop-to-ebp -16038 c3/return +15964 68/push 0/imm32/operation +15965 68/push 1/imm32/tag +15966 89/<- %esi 4/r32/esp +15967 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-operation: +15968 # stmt->operation = "f" +15969 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15970 (copy-array Heap "f" %eax) +15971 # convert +15972 c7 0/subop/copy *Curr-block-depth 0/imm32 +15973 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx Stderr 0) +15974 (flush _test-output-buffered-file) +15975 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15981 # check output +15982 (check-next-stream-line-equal _test-output-stream "(f 0x34)" "F - test-emit-subx-stmt-function-call-with-literal-arg") +15983 # . epilogue +15984 89/<- %esp 5/r32/ebp +15985 5d/pop-to-ebp +15986 c3/return +15987 +15988 emit-indent: # out: (addr buffered-file), n: int +15989 # . prologue +15990 55/push-ebp +15991 89/<- %ebp 4/r32/esp +15992 # . save registers +15993 50/push-eax +15994 # var i/eax: int = n +15995 8b/-> *(ebp+0xc) 0/r32/eax +15996 { +15997 # if (i <= 0) break +15998 3d/compare-eax-with 0/imm32 +15999 7e/jump-if-<= break/disp8 +16000 (write-buffered *(ebp+8) " ") +16001 48/decrement-eax +16002 eb/jump loop/disp8 +16003 } +16004 $emit-indent:end: +16005 # . restore registers +16006 58/pop-to-eax +16007 # . epilogue +16008 89/<- %esp 5/r32/ebp +16009 5d/pop-to-ebp +16010 c3/return +16011 +16012 emit-subx-prologue: # out: (addr buffered-file) +16013 # . prologue +16014 55/push-ebp +16015 89/<- %ebp 4/r32/esp +16016 # +16017 (write-buffered *(ebp+8) " # . prologue\n") +16018 (write-buffered *(ebp+8) " 55/push-ebp\n") +16019 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n") +16020 $emit-subx-prologue:end: +16021 # . epilogue +16022 89/<- %esp 5/r32/ebp +16023 5d/pop-to-ebp +16024 c3/return +16025 +16026 emit-subx-epilogue: # out: (addr buffered-file) +16027 # . prologue +16028 55/push-ebp +16029 89/<- %ebp 4/r32/esp +16030 # +16031 (write-buffered *(ebp+8) " # . epilogue\n") +16032 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n") +16033 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n") +16034 (write-buffered *(ebp+8) " c3/return\n") +16035 $emit-subx-epilogue:end: +16036 # . epilogue +16037 89/<- %esp 5/r32/ebp +16038 5d/pop-to-ebp +16039 c3/return -- cgit 1.4.1-2-gfad0