From 04da2a7d102881753dc8f701650f869420a50440 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Thu, 18 Jun 2020 08:59:30 -0700 Subject: 6551 --- html/apps/mu.subx.html | 31415 ++++++++++++++++++++++++----------------------- 1 file changed, 16102 insertions(+), 15313 deletions(-) (limited to 'html/apps/*.subx.html') diff --git a/html/apps/mu.subx.html b/html/apps/mu.subx.html index 74c517e3..eab9d813 100644 --- a/html/apps/mu.subx.html +++ b/html/apps/mu.subx.html @@ -542,18 +542,18 @@ if ('onhashchange' in window) { 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 + 483 c7 0/subop/copy *Next-block-index 1/imm32 484 c7 0/subop/copy *Type-id 0x24/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)) + 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)) + 493 (check-mu-types *(ebp+0x10) *(ebp+0x14)) + 494 (emit-subx *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) 495 $convert-mu:end: 496 # . epilogue 497 89/<- %esp 5/r32/ebp @@ -594,7 +594,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -626,7 +626,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -665,7 +665,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -696,7 +696,7 @@ if ('onhashchange' in window) { 649 # convert 650 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) 651 (flush _test-output-buffered-file) - 652 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 652 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- 658 # check output 659 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0") 660 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1") @@ -732,7 +732,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -769,7 +769,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -807,7 +807,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -845,7 +845,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -886,7 +886,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -937,7 +937,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -987,7 +987,7 @@ if ('onhashchange' in window) { 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 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -1016,7 +1016,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -1055,7 +1055,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -1096,7 +1096,7 @@ if ('onhashchange' in window) { 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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") @@ -1120,7 +1120,7 @@ if ('onhashchange' in window) { 1128 5d/pop-to-ebp 1129 c3/return 1130 - 1131 test-convert-function-with-local-var-dereferenced: + 1131 test-convert-function-call: 1132 # . prologue 1133 55/push-ebp 1134 89/<- %ebp 4/r32/esp @@ -1130,171 +1130,171 @@ if ('onhashchange' in window) { 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 # variables of type 'byte' are not allowed on the stack - 1177 test-convert-function-with-byte-operations: - 1178 # . prologue - 1179 55/push-ebp - 1180 89/<- %ebp 4/r32/esp - 1181 # setup - 1182 (clear-stream _test-input-stream) - 1183 (clear-stream $_test-input-buffered-file->buffer) - 1184 (clear-stream _test-output-stream) - 1185 (clear-stream $_test-output-buffered-file->buffer) - 1186 # - 1187 (write _test-input-stream "fn foo {\n") - 1188 (write _test-input-stream " var x/eax: byte <- copy 0\n") - 1189 (write _test-input-stream " var y/ecx: byte <- copy 0\n") - 1190 (write _test-input-stream " y <- copy-byte x\n") - 1191 (write _test-input-stream " var z/edx: (addr byte) <- copy 0\n") - 1192 (write _test-input-stream " y <- copy-byte *z\n") - 1193 (write _test-input-stream " copy-byte-to *z, x\n") - 1194 (write _test-input-stream "}\n") - 1195 # convert - 1196 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1197 (flush _test-output-buffered-file) - 1198 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1204 # check output - 1205 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-byte-operations/0") - 1206 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-byte-operations/1") - 1207 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-byte-operations/2") - 1208 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-byte-operations/3") - 1209 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-byte-operations/4") - 1210 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-byte-operations/5") - 1211 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-byte-operations/6") - 1212 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-with-byte-operations/7") - 1213 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-byte-operations/8") - 1214 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-byte-operations/9") - 1215 (check-next-stream-line-equal _test-output-stream " 8a/byte-> %eax 0x00000001/r32" "F - test-convert-function-with-byte-operations/10") - 1216 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-convert-function-with-byte-operations/11") - 1217 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 0/imm32" "F - test-convert-function-with-byte-operations/12") - 1218 (check-next-stream-line-equal _test-output-stream " 8a/byte-> *edx 0x00000001/r32" "F - test-convert-function-with-byte-operations/13") - 1219 (check-next-stream-line-equal _test-output-stream " 88/byte<- *edx 0x00000000/r32" "F - test-convert-function-with-byte-operations/14") - 1220 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-convert-function-with-byte-operations/15") - 1221 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-byte-operations/16") - 1222 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-byte-operations/17") - 1223 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-byte-operations/18") - 1224 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-byte-operations/19") - 1225 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-byte-operations/20") - 1226 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-byte-operations/21") - 1227 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-byte-operations/22") - 1228 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-byte-operations/23") - 1229 # . epilogue - 1230 89/<- %esp 5/r32/ebp + 1141 (write _test-input-stream "fn main -> result/ebx: int {\n") + 1142 (write _test-input-stream " result <- foo\n") + 1143 (write _test-input-stream "}\n") + 1144 (write _test-input-stream "fn foo -> result/ebx: int {\n") + 1145 (write _test-input-stream " result <- copy 3\n") + 1146 (write _test-input-stream "}\n") + 1147 # convert + 1148 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1149 (flush _test-output-buffered-file) + 1150 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1156 # check output + 1157 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call/0") + 1158 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call/1") + 1159 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call/2") + 1160 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call/3") + 1161 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call/4") + 1162 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call/5") + 1163 (check-next-stream-line-equal _test-output-stream " (foo)" "F - test-convert-function-call/6") + 1164 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call/7") + 1165 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call/8") + 1166 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call/9") + 1167 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call/10") + 1168 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call/11") + 1169 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call/12") + 1170 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call/13") + 1171 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call/14") + 1172 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call/15") + 1173 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call/16") + 1174 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call/17") + 1175 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-call/18") + 1176 (check-next-stream-line-equal _test-output-stream " bb/copy-to-ebx 3/imm32" "F - test-convert-function-call/19") + 1177 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call/20") + 1178 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-call/21") + 1179 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call/22") + 1180 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call/23") + 1181 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call/24") + 1182 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call/25") + 1183 # . epilogue + 1184 89/<- %esp 5/r32/ebp + 1185 5d/pop-to-ebp + 1186 c3/return + 1187 + 1188 test-convert-function-call-with-incorrect-inout-type: + 1189 # . prologue + 1190 55/push-ebp + 1191 89/<- %ebp 4/r32/esp + 1192 # setup + 1193 (clear-stream _test-input-stream) + 1194 (clear-stream $_test-input-buffered-file->buffer) + 1195 (clear-stream _test-output-stream) + 1196 (clear-stream $_test-output-buffered-file->buffer) + 1197 (clear-stream _test-error-stream) + 1198 (clear-stream $_test-error-buffered-file->buffer) + 1199 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1200 68/push 0/imm32 + 1201 68/push 0/imm32 + 1202 89/<- %edx 4/r32/esp + 1203 (tailor-exit-descriptor %edx 0x10) + 1204 # + 1205 (write _test-input-stream "fn f {\n") + 1206 (write _test-input-stream " var x: int\n") + 1207 (write _test-input-stream " g x\n") + 1208 (write _test-input-stream "}\n") + 1209 (write _test-input-stream "fn g a: foo {\n") + 1210 (write _test-input-stream "}\n") + 1211 # convert + 1212 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1213 # registers except esp clobbered at this point + 1214 # restore ed + 1215 89/<- %edx 4/r32/esp + 1216 (flush _test-output-buffered-file) + 1217 (flush _test-error-buffered-file) + 1218 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1224 # check output + 1225 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-inout-type: output should be empty") + 1226 (check-next-stream-line-equal _test-error-stream "call g: type for inout 'x' is not right" "F - test-convert-function-call-with-incorrect-inout-type: error message") + 1227 # check that stop(1) was called + 1228 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-inout-type: exit status") + 1229 # don't restore from ebp + 1230 81 0/subop/add %esp 8/imm32 1231 5d/pop-to-ebp 1232 c3/return 1233 - 1234 # variables of type 'byte' _can_ be function args. They then occupy 4 bytes. - 1235 test-copy-byte-var-from-fn-arg: - 1236 # . prologue - 1237 55/push-ebp - 1238 89/<- %ebp 4/r32/esp - 1239 # setup - 1240 (clear-stream _test-input-stream) - 1241 (clear-stream $_test-input-buffered-file->buffer) - 1242 (clear-stream _test-output-stream) - 1243 (clear-stream $_test-output-buffered-file->buffer) - 1244 # - 1245 (write _test-input-stream "fn foo x: byte, y: int {\n") - 1246 (write _test-input-stream " var a/eax: byte <- copy x\n") - 1247 (write _test-input-stream " var b/eax: int <- copy y\n") - 1248 (write _test-input-stream "}\n") - 1249 # convert - 1250 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1251 (flush _test-output-buffered-file) - 1252 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1258 # check output - 1259 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-copy-byte-from-fn-arg/0") - 1260 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-copy-byte-from-fn-arg/1") - 1261 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-copy-byte-from-fn-arg/2") - 1262 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-copy-byte-from-fn-arg/3") - 1263 (check-next-stream-line-equal _test-output-stream " {" "F - test-copy-byte-from-fn-arg/4") - 1264 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-copy-byte-from-fn-arg/5") - 1265 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-copy-byte-from-fn-arg/6") - 1266 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/7") - 1267 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x0000000c) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/8") - 1268 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-copy-byte-from-fn-arg/9") - 1269 (check-next-stream-line-equal _test-output-stream " }" "F - test-copy-byte-from-fn-arg/10") - 1270 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-copy-byte-from-fn-arg/11") - 1271 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-copy-byte-from-fn-arg/12") - 1272 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-copy-byte-from-fn-arg/13") - 1273 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-copy-byte-from-fn-arg/14") - 1274 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-copy-byte-from-fn-arg/15") - 1275 # . epilogue - 1276 89/<- %esp 5/r32/ebp - 1277 5d/pop-to-ebp - 1278 c3/return - 1279 - 1280 test-convert-compare-register-with-literal: - 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 0\n") - 1292 (write _test-input-stream " compare x, 0\n") - 1293 (write _test-input-stream "}\n") - 1294 # convert - 1295 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1296 (flush _test-output-buffered-file) - 1297 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1303 # check output - 1304 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0") - 1305 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1") - 1306 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2") - 1307 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3") - 1308 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4") - 1309 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5") - 1310 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") - 1311 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7") - 1312 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8") - 1313 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") - 1314 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10") - 1315 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11") - 1316 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12") - 1317 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13") - 1318 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14") - 1319 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15") - 1320 # . epilogue - 1321 89/<- %esp 5/r32/ebp + 1234 test-convert-function-call-with-too-few-inouts: + 1235 # . prologue + 1236 55/push-ebp + 1237 89/<- %ebp 4/r32/esp + 1238 # setup + 1239 (clear-stream _test-input-stream) + 1240 (clear-stream $_test-input-buffered-file->buffer) + 1241 (clear-stream _test-output-stream) + 1242 (clear-stream $_test-output-buffered-file->buffer) + 1243 (clear-stream _test-error-stream) + 1244 (clear-stream $_test-error-buffered-file->buffer) + 1245 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1246 68/push 0/imm32 + 1247 68/push 0/imm32 + 1248 89/<- %edx 4/r32/esp + 1249 (tailor-exit-descriptor %edx 0x10) + 1250 # + 1251 (write _test-input-stream "fn f {\n") + 1252 (write _test-input-stream " g\n") + 1253 (write _test-input-stream "}\n") + 1254 (write _test-input-stream "fn g a: int {\n") + 1255 (write _test-input-stream "}\n") + 1256 # convert + 1257 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1258 # registers except esp clobbered at this point + 1259 # restore ed + 1260 89/<- %edx 4/r32/esp + 1261 (flush _test-output-buffered-file) + 1262 (flush _test-error-buffered-file) + 1263 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1269 # check output + 1270 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-few-inouts: output should be empty") + 1271 (check-next-stream-line-equal _test-error-stream "call g: too few inouts" "F - test-convert-function-call-with-too-few-inouts: error message") + 1272 # check that stop(1) was called + 1273 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-few-inouts: exit status") + 1274 # don't restore from ebp + 1275 81 0/subop/add %esp 8/imm32 + 1276 5d/pop-to-ebp + 1277 c3/return + 1278 + 1279 test-convert-function-call-with-too-many-inouts: + 1280 # . prologue + 1281 55/push-ebp + 1282 89/<- %ebp 4/r32/esp + 1283 # setup + 1284 (clear-stream _test-input-stream) + 1285 (clear-stream $_test-input-buffered-file->buffer) + 1286 (clear-stream _test-output-stream) + 1287 (clear-stream $_test-output-buffered-file->buffer) + 1288 (clear-stream _test-error-stream) + 1289 (clear-stream $_test-error-buffered-file->buffer) + 1290 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1291 68/push 0/imm32 + 1292 68/push 0/imm32 + 1293 89/<- %edx 4/r32/esp + 1294 (tailor-exit-descriptor %edx 0x10) + 1295 # + 1296 (write _test-input-stream "fn f {\n") + 1297 (write _test-input-stream " var x: int\n") + 1298 (write _test-input-stream " g x\n") + 1299 (write _test-input-stream "}\n") + 1300 (write _test-input-stream "fn g {\n") + 1301 (write _test-input-stream "}\n") + 1302 # convert + 1303 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1304 # registers except esp clobbered at this point + 1305 # restore ed + 1306 89/<- %edx 4/r32/esp + 1307 (flush _test-output-buffered-file) + 1308 (flush _test-error-buffered-file) + 1309 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1315 # check output + 1316 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-many-inouts: output should be empty") + 1317 (check-next-stream-line-equal _test-error-stream "call g: too many inouts" "F - test-convert-function-call-with-too-many-inouts: error message") + 1318 # check that stop(1) was called + 1319 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-many-inouts: exit status") + 1320 # don't restore from ebp + 1321 81 0/subop/add %esp 8/imm32 1322 5d/pop-to-ebp 1323 c3/return 1324 - 1325 test-unknown-variable: + 1325 test-convert-function-call-with-incorrect-output-type: 1326 # . prologue 1327 55/push-ebp 1328 89/<- %ebp 4/r32/esp @@ -1311,244 +1311,244 @@ if ('onhashchange' in window) { 1339 89/<- %edx 4/r32/esp 1340 (tailor-exit-descriptor %edx 0x10) 1341 # - 1342 (write _test-input-stream "fn foo {\n") - 1343 (write _test-input-stream " compare x, 0\n") + 1342 (write _test-input-stream "fn f {\n") + 1343 (write _test-input-stream " var x/eax: int <- g\n") 1344 (write _test-input-stream "}\n") - 1345 # convert - 1346 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1347 # registers except esp clobbered at this point - 1348 # restore ed - 1349 89/<- %edx 4/r32/esp - 1350 (flush _test-output-buffered-file) - 1351 (flush _test-error-buffered-file) - 1352 +-- 6 lines: #? # dump _test-error-stream ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1358 # check output - 1359 (check-stream-equal _test-output-stream "" "F - test-unknown-variable: output should be empty") - 1360 (check-next-stream-line-equal _test-error-stream "unknown variable 'x'" "F - test-unknown-variable: error message") - 1361 # check that stop(1) was called - 1362 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable: exit status") - 1363 # don't restore from ebp - 1364 81 0/subop/add %esp 8/imm32 - 1365 # . epilogue - 1366 5d/pop-to-ebp - 1367 c3/return - 1368 - 1369 test-convert-function-with-local-var-in-block: - 1370 # . prologue - 1371 55/push-ebp - 1372 89/<- %ebp 4/r32/esp - 1373 # setup - 1374 (clear-stream _test-input-stream) - 1375 (clear-stream $_test-input-buffered-file->buffer) - 1376 (clear-stream _test-output-stream) - 1377 (clear-stream $_test-output-buffered-file->buffer) - 1378 # - 1379 (write _test-input-stream "fn foo {\n") - 1380 (write _test-input-stream " {\n") - 1381 (write _test-input-stream " var x: int\n") - 1382 (write _test-input-stream " increment x\n") - 1383 (write _test-input-stream " }\n") - 1384 (write _test-input-stream "}\n") - 1385 # convert - 1386 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1387 (flush _test-output-buffered-file) - 1388 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1394 # check output - 1395 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0") - 1396 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1") - 1397 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2") - 1398 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3") - 1399 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4") - 1400 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5") - 1401 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6") - 1402 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7") - 1403 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8") - 1404 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9") - 1405 (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") - 1406 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11") - 1407 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12") - 1408 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13") - 1409 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14") - 1410 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15") - 1411 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16") - 1412 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17") - 1413 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18") - 1414 # . epilogue - 1415 89/<- %esp 5/r32/ebp - 1416 5d/pop-to-ebp - 1417 c3/return - 1418 - 1419 test-convert-function-with-local-var-in-named-block: - 1420 # . prologue - 1421 55/push-ebp - 1422 89/<- %ebp 4/r32/esp - 1423 # setup - 1424 (clear-stream _test-input-stream) - 1425 (clear-stream $_test-input-buffered-file->buffer) - 1426 (clear-stream _test-output-stream) - 1427 (clear-stream $_test-output-buffered-file->buffer) - 1428 # - 1429 (write _test-input-stream "fn foo {\n") - 1430 (write _test-input-stream " $bar: {\n") - 1431 (write _test-input-stream " var x: int\n") - 1432 (write _test-input-stream " increment x\n") - 1433 (write _test-input-stream " }\n") + 1345 (write _test-input-stream "fn g -> a/eax: foo {\n") + 1346 (write _test-input-stream "}\n") + 1347 # convert + 1348 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1349 # registers except esp clobbered at this point + 1350 # restore ed + 1351 89/<- %edx 4/r32/esp + 1352 (flush _test-output-buffered-file) + 1353 (flush _test-error-buffered-file) + 1354 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1360 # check output + 1361 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-output-type: output should be empty") + 1362 (check-next-stream-line-equal _test-error-stream "call g: type for output 'x' is not right" "F - test-convert-function-call-with-incorrect-output-type: error message") + 1363 # check that stop(1) was called + 1364 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-output-type: exit status") + 1365 # don't restore from ebp + 1366 81 0/subop/add %esp 8/imm32 + 1367 5d/pop-to-ebp + 1368 c3/return + 1369 + 1370 test-convert-function-call-with-too-few-outputs: + 1371 # . prologue + 1372 55/push-ebp + 1373 89/<- %ebp 4/r32/esp + 1374 # setup + 1375 (clear-stream _test-input-stream) + 1376 (clear-stream $_test-input-buffered-file->buffer) + 1377 (clear-stream _test-output-stream) + 1378 (clear-stream $_test-output-buffered-file->buffer) + 1379 (clear-stream _test-error-stream) + 1380 (clear-stream $_test-error-buffered-file->buffer) + 1381 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1382 68/push 0/imm32 + 1383 68/push 0/imm32 + 1384 89/<- %edx 4/r32/esp + 1385 (tailor-exit-descriptor %edx 0x10) + 1386 # + 1387 (write _test-input-stream "fn f {\n") + 1388 (write _test-input-stream " g\n") + 1389 (write _test-input-stream "}\n") + 1390 (write _test-input-stream "fn g -> a/eax: int {\n") + 1391 (write _test-input-stream "}\n") + 1392 # convert + 1393 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1394 # registers except esp clobbered at this point + 1395 # restore ed + 1396 89/<- %edx 4/r32/esp + 1397 (flush _test-output-buffered-file) + 1398 (flush _test-error-buffered-file) + 1399 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1405 # check output + 1406 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-few-outputs: output should be empty") + 1407 (check-next-stream-line-equal _test-error-stream "call g: too few outputs" "F - test-convert-function-call-with-too-few-outputs: error message") + 1408 # check that stop(1) was called + 1409 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-few-outputs: exit status") + 1410 # don't restore from ebp + 1411 81 0/subop/add %esp 8/imm32 + 1412 5d/pop-to-ebp + 1413 c3/return + 1414 + 1415 test-convert-function-call-with-too-many-outputs: + 1416 # . prologue + 1417 55/push-ebp + 1418 89/<- %ebp 4/r32/esp + 1419 # setup + 1420 (clear-stream _test-input-stream) + 1421 (clear-stream $_test-input-buffered-file->buffer) + 1422 (clear-stream _test-output-stream) + 1423 (clear-stream $_test-output-buffered-file->buffer) + 1424 (clear-stream _test-error-stream) + 1425 (clear-stream $_test-error-buffered-file->buffer) + 1426 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1427 68/push 0/imm32 + 1428 68/push 0/imm32 + 1429 89/<- %edx 4/r32/esp + 1430 (tailor-exit-descriptor %edx 0x10) + 1431 # + 1432 (write _test-input-stream "fn f {\n") + 1433 (write _test-input-stream " var x/eax: int <- g\n") 1434 (write _test-input-stream "}\n") - 1435 # convert - 1436 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1437 (flush _test-output-buffered-file) - 1438 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1444 # check output - 1445 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0") - 1446 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1") - 1447 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2") - 1448 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3") - 1449 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4") - 1450 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5") - 1451 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6") - 1452 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7") - 1453 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8") - 1454 (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") - 1455 (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") - 1456 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11") - 1457 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12") - 1458 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13") - 1459 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14") - 1460 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15") - 1461 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16") - 1462 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17") - 1463 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18") - 1464 # . epilogue - 1465 89/<- %esp 5/r32/ebp - 1466 5d/pop-to-ebp - 1467 c3/return - 1468 - 1469 test-unknown-variable-in-named-block: - 1470 # . prologue - 1471 55/push-ebp - 1472 89/<- %ebp 4/r32/esp - 1473 # setup - 1474 (clear-stream _test-input-stream) - 1475 (clear-stream $_test-input-buffered-file->buffer) - 1476 (clear-stream _test-output-stream) - 1477 (clear-stream $_test-output-buffered-file->buffer) - 1478 (clear-stream _test-error-stream) - 1479 (clear-stream $_test-error-buffered-file->buffer) - 1480 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1481 68/push 0/imm32 - 1482 68/push 0/imm32 - 1483 89/<- %edx 4/r32/esp - 1484 (tailor-exit-descriptor %edx 0x10) - 1485 # - 1486 (write _test-input-stream "fn foo {\n") - 1487 (write _test-input-stream " $a: {\n") - 1488 (write _test-input-stream " compare x, 0\n") - 1489 (write _test-input-stream " }\n") - 1490 (write _test-input-stream "}\n") - 1491 # convert - 1492 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1493 # registers except esp clobbered at this point - 1494 # restore ed - 1495 89/<- %edx 4/r32/esp - 1496 (flush _test-output-buffered-file) - 1497 (flush _test-error-buffered-file) - 1498 +-- 6 lines: #? # dump _test-error-stream ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1504 # check output - 1505 (check-stream-equal _test-output-stream "" "F - test-unknown-variable-in-named-block: output should be empty") - 1506 (check-next-stream-line-equal _test-error-stream "unknown variable 'x'" "F - test-unknown-variable-in-named-block: error message") - 1507 # check that stop(1) was called - 1508 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable-in-named-block: exit status") - 1509 # don't restore from ebp - 1510 81 0/subop/add %esp 8/imm32 - 1511 # . epilogue - 1512 5d/pop-to-ebp - 1513 c3/return - 1514 - 1515 test-always-shadow-outermost-reg-vars-in-function: - 1516 # . prologue - 1517 55/push-ebp - 1518 89/<- %ebp 4/r32/esp - 1519 # setup - 1520 (clear-stream _test-input-stream) - 1521 (clear-stream $_test-input-buffered-file->buffer) - 1522 (clear-stream _test-output-stream) - 1523 (clear-stream $_test-output-buffered-file->buffer) - 1524 # - 1525 (write _test-input-stream "fn foo {\n") - 1526 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1527 (write _test-input-stream "}\n") - 1528 # convert - 1529 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1530 (flush _test-output-buffered-file) - 1531 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1537 # check output - 1538 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-always-shadow-outermost-reg-vars-in-function/0") - 1539 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-always-shadow-outermost-reg-vars-in-function/1") - 1540 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/2") - 1541 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-always-shadow-outermost-reg-vars-in-function/3") - 1542 (check-next-stream-line-equal _test-output-stream " {" "F - test-always-shadow-outermost-reg-vars-in-function/4") - 1543 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-always-shadow-outermost-reg-vars-in-function/5") - 1544 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") - 1545 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-always-shadow-outermost-reg-vars-in-function/8") - 1546 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") - 1547 (check-next-stream-line-equal _test-output-stream " }" "F - test-always-shadow-outermost-reg-vars-in-function/12") - 1548 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-always-shadow-outermost-reg-vars-in-function/13") - 1549 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-always-shadow-outermost-reg-vars-in-function/14") - 1550 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-always-shadow-outermost-reg-vars-in-function/15") - 1551 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/16") - 1552 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-always-shadow-outermost-reg-vars-in-function/17") - 1553 # . epilogue - 1554 89/<- %esp 5/r32/ebp - 1555 5d/pop-to-ebp - 1556 c3/return - 1557 - 1558 _pending-test-clobber-dead-local: - 1559 # . prologue - 1560 55/push-ebp - 1561 89/<- %ebp 4/r32/esp - 1562 # setup - 1563 (clear-stream _test-input-stream) - 1564 (clear-stream $_test-input-buffered-file->buffer) - 1565 (clear-stream _test-output-stream) - 1566 (clear-stream $_test-output-buffered-file->buffer) - 1567 # - 1568 (write _test-input-stream "fn foo {\n") - 1569 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1570 (write _test-input-stream " {\n") - 1571 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1572 (write _test-input-stream " }\n") - 1573 (write _test-input-stream "}\n") - 1574 # convert - 1575 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1576 (flush _test-output-buffered-file) - 1577 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1583 # check output - 1584 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-clobber-dead-local/0") - 1585 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-clobber-dead-local/1") - 1586 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-clobber-dead-local/2") - 1587 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-clobber-dead-local/3") - 1588 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/4") - 1589 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-clobber-dead-local/5") - 1590 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-clobber-dead-local/6") - 1591 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-clobber-dead-local/7") - 1592 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/8") - 1593 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-clobber-dead-local/9") - 1594 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-clobber-dead-local/10") # no push/pop here - 1595 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/11") - 1596 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-clobber-dead-local/12") - 1597 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-clobber-dead-local/13") - 1598 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/14") - 1599 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-clobber-dead-local/15") - 1600 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-clobber-dead-local/16") - 1601 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-clobber-dead-local/17") - 1602 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-clobber-dead-local/18") - 1603 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-clobber-dead-local/19") - 1604 # . epilogue - 1605 89/<- %esp 5/r32/ebp - 1606 5d/pop-to-ebp - 1607 c3/return - 1608 - 1609 test-shadow-live-local: + 1435 (write _test-input-stream "fn g {\n") + 1436 (write _test-input-stream "}\n") + 1437 # convert + 1438 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1439 # registers except esp clobbered at this point + 1440 # restore ed + 1441 89/<- %edx 4/r32/esp + 1442 (flush _test-output-buffered-file) + 1443 (flush _test-error-buffered-file) + 1444 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1450 # check output + 1451 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-many-outputs: output should be empty") + 1452 (check-next-stream-line-equal _test-error-stream "call g: too many outputs" "F - test-convert-function-call-with-too-many-outputs: error message") + 1453 # check that stop(1) was called + 1454 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-many-outputs: exit status") + 1455 # don't restore from ebp + 1456 81 0/subop/add %esp 8/imm32 + 1457 5d/pop-to-ebp + 1458 c3/return + 1459 + 1460 test-convert-function-call-with-incorrect-output-register: + 1461 # . prologue + 1462 55/push-ebp + 1463 89/<- %ebp 4/r32/esp + 1464 # setup + 1465 (clear-stream _test-input-stream) + 1466 (clear-stream $_test-input-buffered-file->buffer) + 1467 (clear-stream _test-output-stream) + 1468 (clear-stream $_test-output-buffered-file->buffer) + 1469 (clear-stream _test-error-stream) + 1470 (clear-stream $_test-error-buffered-file->buffer) + 1471 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1472 68/push 0/imm32 + 1473 68/push 0/imm32 + 1474 89/<- %edx 4/r32/esp + 1475 (tailor-exit-descriptor %edx 0x10) + 1476 # + 1477 (write _test-input-stream "fn f {\n") + 1478 (write _test-input-stream " var x/ecx: int <- g\n") + 1479 (write _test-input-stream "}\n") + 1480 (write _test-input-stream "fn g -> a/eax: int {\n") + 1481 (write _test-input-stream "}\n") + 1482 # convert + 1483 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1484 # registers except esp clobbered at this point + 1485 # restore ed + 1486 89/<- %edx 4/r32/esp + 1487 (flush _test-output-buffered-file) + 1488 (flush _test-error-buffered-file) + 1489 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1495 # check output + 1496 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-output-register: output should be empty") + 1497 (check-next-stream-line-equal _test-error-stream "call g: register for output 'x' is not right" "F - test-convert-function-call-with-incorrect-output-register: error message") + 1498 # check that stop(1) was called + 1499 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-output-register: exit status") + 1500 # don't restore from ebp + 1501 81 0/subop/add %esp 8/imm32 + 1502 5d/pop-to-ebp + 1503 c3/return + 1504 + 1505 test-convert-function-with-local-var-dereferenced: + 1506 # . prologue + 1507 55/push-ebp + 1508 89/<- %ebp 4/r32/esp + 1509 # setup + 1510 (clear-stream _test-input-stream) + 1511 (clear-stream $_test-input-buffered-file->buffer) + 1512 (clear-stream _test-output-stream) + 1513 (clear-stream $_test-output-buffered-file->buffer) + 1514 # + 1515 (write _test-input-stream "fn foo {\n") + 1516 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n") + 1517 (write _test-input-stream " increment *x\n") + 1518 (write _test-input-stream "}\n") + 1519 # convert + 1520 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1521 (flush _test-output-buffered-file) + 1522 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1528 # check output + 1529 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0") + 1530 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1") + 1531 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2") + 1532 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3") + 1533 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4") + 1534 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5") + 1535 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6") + 1536 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7") + 1537 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8") + 1538 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9") + 1539 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10") + 1540 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11") + 1541 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12") + 1542 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13") + 1543 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14") + 1544 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15") + 1545 # . epilogue + 1546 89/<- %esp 5/r32/ebp + 1547 5d/pop-to-ebp + 1548 c3/return + 1549 + 1550 # variables of type 'byte' are not allowed on the stack + 1551 test-convert-function-with-byte-operations: + 1552 # . prologue + 1553 55/push-ebp + 1554 89/<- %ebp 4/r32/esp + 1555 # setup + 1556 (clear-stream _test-input-stream) + 1557 (clear-stream $_test-input-buffered-file->buffer) + 1558 (clear-stream _test-output-stream) + 1559 (clear-stream $_test-output-buffered-file->buffer) + 1560 # + 1561 (write _test-input-stream "fn foo {\n") + 1562 (write _test-input-stream " var x/eax: byte <- copy 0\n") + 1563 (write _test-input-stream " var y/ecx: byte <- copy 0\n") + 1564 (write _test-input-stream " y <- copy-byte x\n") + 1565 (write _test-input-stream " var z/edx: (addr byte) <- copy 0\n") + 1566 (write _test-input-stream " y <- copy-byte *z\n") + 1567 (write _test-input-stream " copy-byte-to *z, x\n") + 1568 (write _test-input-stream "}\n") + 1569 # convert + 1570 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1571 (flush _test-output-buffered-file) + 1572 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1578 # check output + 1579 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-byte-operations/0") + 1580 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-byte-operations/1") + 1581 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-byte-operations/2") + 1582 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-byte-operations/3") + 1583 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-byte-operations/4") + 1584 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-byte-operations/5") + 1585 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-byte-operations/6") + 1586 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-with-byte-operations/7") + 1587 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-byte-operations/8") + 1588 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-byte-operations/9") + 1589 (check-next-stream-line-equal _test-output-stream " 8a/byte-> %eax 0x00000001/r32" "F - test-convert-function-with-byte-operations/10") + 1590 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-convert-function-with-byte-operations/11") + 1591 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 0/imm32" "F - test-convert-function-with-byte-operations/12") + 1592 (check-next-stream-line-equal _test-output-stream " 8a/byte-> *edx 0x00000001/r32" "F - test-convert-function-with-byte-operations/13") + 1593 (check-next-stream-line-equal _test-output-stream " 88/byte<- *edx 0x00000000/r32" "F - test-convert-function-with-byte-operations/14") + 1594 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-convert-function-with-byte-operations/15") + 1595 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-byte-operations/16") + 1596 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-byte-operations/17") + 1597 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-byte-operations/18") + 1598 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-byte-operations/19") + 1599 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-byte-operations/20") + 1600 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-byte-operations/21") + 1601 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-byte-operations/22") + 1602 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-byte-operations/23") + 1603 # . epilogue + 1604 89/<- %esp 5/r32/ebp + 1605 5d/pop-to-ebp + 1606 c3/return + 1607 + 1608 # variables of type 'byte' _can_ be function args. They then occupy 4 bytes. + 1609 test-copy-byte-var-from-fn-arg: 1610 # . prologue 1611 55/push-ebp 1612 89/<- %ebp 4/r32/esp @@ -1558,15038 +1558,15827 @@ if ('onhashchange' in window) { 1616 (clear-stream _test-output-stream) 1617 (clear-stream $_test-output-buffered-file->buffer) 1618 # - 1619 (write _test-input-stream "fn foo {\n") - 1620 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1621 (write _test-input-stream " {\n") - 1622 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1623 (write _test-input-stream " }\n") - 1624 (write _test-input-stream " x <- increment\n") - 1625 (write _test-input-stream "}\n") - 1626 # convert - 1627 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1628 (flush _test-output-buffered-file) - 1629 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1635 # check output - 1636 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-local/0") - 1637 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-local/1") - 1638 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-local/2") - 1639 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-local/3") - 1640 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/4") - 1641 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-local/5") - 1642 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/6") - 1643 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-local/7") - 1644 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/8") - 1645 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-local/9") - 1646 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/10") - 1647 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-local/11") - 1648 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/12") - 1649 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/13") - 1650 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-local/14") - 1651 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-local/15") - 1652 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/16") - 1653 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/17") - 1654 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-local/18") - 1655 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-local/19") - 1656 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-local/20") - 1657 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-local/21") - 1658 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-local/21") - 1659 # . epilogue - 1660 89/<- %esp 5/r32/ebp - 1661 5d/pop-to-ebp - 1662 c3/return - 1663 - 1664 test-do-not-spill-same-register-in-block: - 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 {\n") - 1675 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1676 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1677 (write _test-input-stream " y <- increment\n") - 1678 (write _test-input-stream "}\n") - 1679 # convert - 1680 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1681 (flush _test-output-buffered-file) - 1682 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1688 # check output - 1689 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-do-not-spill-same-register-in-block/0") - 1690 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-do-not-spill-same-register-in-block/1") - 1691 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-do-not-spill-same-register-in-block/2") - 1692 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-do-not-spill-same-register-in-block/3") - 1693 (check-next-stream-line-equal _test-output-stream " {" "F - test-do-not-spill-same-register-in-block/4") - 1694 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-do-not-spill-same-register-in-block/5") - 1695 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-do-not-spill-same-register-in-block/6") - 1696 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-do-not-spill-same-register-in-block/7") - 1697 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-do-not-spill-same-register-in-block/8") - 1698 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-do-not-spill-same-register-in-block/9") - 1699 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-do-not-spill-same-register-in-block/10") - 1700 (check-next-stream-line-equal _test-output-stream " }" "F - test-do-not-spill-same-register-in-block/11") - 1701 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-do-not-spill-same-register-in-block/12") - 1702 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-do-not-spill-same-register-in-block/13") - 1703 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-do-not-spill-same-register-in-block/14") - 1704 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-do-not-spill-same-register-in-block/15") - 1705 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-do-not-spill-same-register-in-block/16") - 1706 # . epilogue - 1707 89/<- %esp 5/r32/ebp - 1708 5d/pop-to-ebp - 1709 c3/return - 1710 - 1711 test-spill-different-register-in-block: - 1712 # . prologue - 1713 55/push-ebp - 1714 89/<- %ebp 4/r32/esp - 1715 # setup - 1716 (clear-stream _test-input-stream) - 1717 (clear-stream $_test-input-buffered-file->buffer) - 1718 (clear-stream _test-output-stream) - 1719 (clear-stream $_test-output-buffered-file->buffer) - 1720 # - 1721 (write _test-input-stream "fn foo {\n") - 1722 (write _test-input-stream " var x/eax: int <- copy 3\n") - 1723 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1724 (write _test-input-stream " y <- increment\n") - 1725 (write _test-input-stream "}\n") - 1726 # convert - 1727 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1728 (flush _test-output-buffered-file) - 1729 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1735 # check output - 1736 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-spill-different-register-in-block/0") - 1737 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-spill-different-register-in-block/1") - 1738 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-spill-different-register-in-block/2") - 1739 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-spill-different-register-in-block/3") - 1740 (check-next-stream-line-equal _test-output-stream " {" "F - test-spill-different-register-in-block/4") - 1741 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-spill-different-register-in-block/5") - 1742 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-spill-different-register-in-block/6") - 1743 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-spill-different-register-in-block/7") - 1744 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-spill-different-register-in-block/8") - 1745 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-spill-different-register-in-block/9") - 1746 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-spill-different-register-in-block/10") - 1747 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-spill-different-register-in-block/11") - 1748 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-spill-different-register-in-block/12") - 1749 (check-next-stream-line-equal _test-output-stream " }" "F - test-spill-different-register-in-block/13") - 1750 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-spill-different-register-in-block/14") - 1751 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-spill-different-register-in-block/15") - 1752 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-spill-different-register-in-block/16") - 1753 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-spill-different-register-in-block/17") - 1754 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-spill-different-register-in-block/18") - 1755 # . epilogue - 1756 89/<- %esp 5/r32/ebp - 1757 5d/pop-to-ebp - 1758 c3/return - 1759 - 1760 test-shadow-live-output: - 1761 # . prologue - 1762 55/push-ebp - 1763 89/<- %ebp 4/r32/esp - 1764 # setup - 1765 (clear-stream _test-input-stream) - 1766 (clear-stream $_test-input-buffered-file->buffer) - 1767 (clear-stream _test-output-stream) - 1768 (clear-stream $_test-output-buffered-file->buffer) - 1769 # - 1770 (write _test-input-stream "fn foo -> x/ecx: int {\n") - 1771 (write _test-input-stream " x <- copy 3\n") - 1772 (write _test-input-stream " {\n") - 1773 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1774 (write _test-input-stream " }\n") - 1775 (write _test-input-stream " x <- increment\n") - 1776 (write _test-input-stream "}\n") - 1777 # convert - 1778 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1779 (flush _test-output-buffered-file) - 1780 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1786 # check output - 1787 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-output/0") - 1788 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-output/1") - 1789 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-output/2") - 1790 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-output/3") - 1791 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/4") - 1792 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-output/5") - 1793 (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 - 1794 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/8") - 1795 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-output/9") - 1796 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-output/10") - 1797 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-output/11") - 1798 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-output/12") - 1799 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/13") - 1800 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-output/14") - 1801 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-output/15") - 1802 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/17") - 1803 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-output/18") - 1804 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-output/19") - 1805 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-output/20") - 1806 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-output/21") - 1807 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-output/21") - 1808 # . epilogue - 1809 89/<- %esp 5/r32/ebp - 1810 5d/pop-to-ebp - 1811 c3/return - 1812 - 1813 test-local-clobbered-by-output: - 1814 # also doesn't spill - 1815 # . prologue - 1816 55/push-ebp - 1817 89/<- %ebp 4/r32/esp - 1818 # setup - 1819 (clear-stream _test-input-stream) - 1820 (clear-stream $_test-input-buffered-file->buffer) - 1821 (clear-stream _test-output-stream) - 1822 (clear-stream $_test-output-buffered-file->buffer) - 1823 # - 1824 (write _test-input-stream "fn foo -> x/ecx: int {\n") - 1825 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1826 (write _test-input-stream " x <- copy y\n") - 1827 (write _test-input-stream "}\n") - 1828 # convert - 1829 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1830 (flush _test-output-buffered-file) - 1831 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1837 # check output - 1838 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-local-clobbered-by-output/0") - 1839 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-local-clobbered-by-output/1") - 1840 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-local-clobbered-by-output/2") - 1841 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-local-clobbered-by-output/3") - 1842 (check-next-stream-line-equal _test-output-stream " {" "F - test-local-clobbered-by-output/4") - 1843 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-local-clobbered-by-output/5") - 1844 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-local-clobbered-by-output/6") - 1845 (check-next-stream-line-equal _test-output-stream " 89/<- %ecx 0x00000001/r32" "F - test-local-clobbered-by-output/7") - 1846 (check-next-stream-line-equal _test-output-stream " }" "F - test-local-clobbered-by-output/8") - 1847 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-local-clobbered-by-output/9") - 1848 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-local-clobbered-by-output/10") - 1849 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-local-clobbered-by-output/11") - 1850 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-local-clobbered-by-output/12") - 1851 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-local-clobbered-by-output/13") - 1852 # . epilogue - 1853 89/<- %esp 5/r32/ebp - 1854 5d/pop-to-ebp - 1855 c3/return - 1856 - 1857 test-read-output: - 1858 # also doesn't spill - 1859 # . prologue - 1860 55/push-ebp - 1861 89/<- %ebp 4/r32/esp - 1862 # setup - 1863 (clear-stream _test-input-stream) - 1864 (clear-stream $_test-input-buffered-file->buffer) - 1865 (clear-stream _test-output-stream) - 1866 (clear-stream $_test-output-buffered-file->buffer) - 1867 # - 1868 (write _test-input-stream "fn foo -> x/ecx: int {\n") - 1869 (write _test-input-stream " x <- copy 0x34\n") - 1870 (write _test-input-stream " compare x, 0x35\n") - 1871 (write _test-input-stream "}\n") - 1872 # convert - 1873 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1874 (flush _test-output-buffered-file) - 1875 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1881 # check output - 1882 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-read-output/0") - 1883 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-read-output/1") - 1884 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-read-output/2") - 1885 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-read-output/3") - 1886 (check-next-stream-line-equal _test-output-stream " {" "F - test-read-output/4") - 1887 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-read-output/5") - 1888 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x34/imm32" "F - test-read-output/6") - 1889 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0x35/imm32" "F - test-read-output/7") - 1890 (check-next-stream-line-equal _test-output-stream " }" "F - test-read-output/8") - 1891 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-read-output/9") - 1892 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-read-output/10") - 1893 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-read-output/11") - 1894 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-read-output/12") - 1895 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-read-output/13") - 1896 # . epilogue - 1897 89/<- %esp 5/r32/ebp - 1898 5d/pop-to-ebp - 1899 c3/return - 1900 - 1901 test-convert-function-with-branches-in-block: - 1902 # . prologue - 1903 55/push-ebp - 1904 89/<- %ebp 4/r32/esp - 1905 # setup - 1906 (clear-stream _test-input-stream) - 1907 (clear-stream $_test-input-buffered-file->buffer) - 1908 (clear-stream _test-output-stream) - 1909 (clear-stream $_test-output-buffered-file->buffer) - 1910 # - 1911 (write _test-input-stream "fn foo x: int {\n") - 1912 (write _test-input-stream " {\n") - 1913 (write _test-input-stream " break-if->=\n") - 1914 (write _test-input-stream " loop-if-addr<\n") - 1915 (write _test-input-stream " increment x\n") - 1916 (write _test-input-stream " loop\n") - 1917 (write _test-input-stream " }\n") - 1918 (write _test-input-stream "}\n") - 1919 # convert - 1920 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1921 (flush _test-output-buffered-file) - 1922 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1928 # check output - 1929 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") - 1930 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") - 1931 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") - 1932 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") - 1933 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") - 1934 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") - 1935 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") - 1936 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") - 1937 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") - 1938 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") - 1939 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") - 1940 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") - 1941 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") - 1942 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") - 1943 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") - 1944 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") - 1945 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") - 1946 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") - 1947 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") - 1948 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") - 1949 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") - 1950 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") - 1951 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") - 1952 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") - 1953 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") - 1954 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") - 1955 # . epilogue - 1956 89/<- %esp 5/r32/ebp - 1957 5d/pop-to-ebp - 1958 c3/return - 1959 - 1960 test-convert-function-with-branches-in-named-block: - 1961 # . prologue - 1962 55/push-ebp - 1963 89/<- %ebp 4/r32/esp - 1964 # setup - 1965 (clear-stream _test-input-stream) - 1966 (clear-stream $_test-input-buffered-file->buffer) - 1967 (clear-stream _test-output-stream) - 1968 (clear-stream $_test-output-buffered-file->buffer) - 1969 # - 1970 (write _test-input-stream "fn foo x: int {\n") - 1971 (write _test-input-stream " $bar: {\n") - 1972 (write _test-input-stream " break-if->= $bar\n") - 1973 (write _test-input-stream " loop-if-addr< $bar\n") - 1974 (write _test-input-stream " increment x\n") - 1975 (write _test-input-stream " loop\n") - 1976 (write _test-input-stream " }\n") - 1977 (write _test-input-stream "}\n") - 1978 # convert - 1979 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1980 (flush _test-output-buffered-file) - 1981 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1987 # check output - 1988 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0") - 1989 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1") - 1990 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2") - 1991 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3") - 1992 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4") - 1993 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5") - 1994 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6") - 1995 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7") - 1996 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/8") - 1997 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-named-block/9") - 1998 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/10") - 1999 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/11") - 2000 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/12") - 2001 (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") - 2002 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:loop/disp32" "F - test-convert-function-with-branches-in-named-block/14") - 2003 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/15") - 2004 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/16") - 2005 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/17") - 2006 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/18") - 2007 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/19") - 2008 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/20") - 2009 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/21") - 2010 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/22") - 2011 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/23") - 2012 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/24") - 2013 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/25") - 2014 # . epilogue - 2015 89/<- %esp 5/r32/ebp - 2016 5d/pop-to-ebp - 2017 c3/return - 2018 - 2019 test-convert-function-with-var-in-nested-block: - 2020 # . prologue - 2021 55/push-ebp - 2022 89/<- %ebp 4/r32/esp - 2023 # setup - 2024 (clear-stream _test-input-stream) - 2025 (clear-stream $_test-input-buffered-file->buffer) - 2026 (clear-stream _test-output-stream) - 2027 (clear-stream $_test-output-buffered-file->buffer) - 2028 # - 2029 (write _test-input-stream "fn foo x: int {\n") - 2030 (write _test-input-stream " {\n") - 2031 (write _test-input-stream " {\n") - 2032 (write _test-input-stream " var x: int\n") - 2033 (write _test-input-stream " increment x\n") - 2034 (write _test-input-stream " }\n") - 2035 (write _test-input-stream " }\n") - 2036 (write _test-input-stream "}\n") - 2037 # convert - 2038 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2039 (flush _test-output-buffered-file) - 2040 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2046 # check output - 2047 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") - 2048 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1") - 2049 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") - 2050 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") - 2051 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4") - 2052 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5") - 2053 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6") - 2054 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7") - 2055 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8") - 2056 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9") - 2057 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10") - 2058 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11") - 2059 (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") - 2060 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13") - 2061 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14") - 2062 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15") - 2063 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16") - 2064 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17") - 2065 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18") - 2066 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19") - 2067 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20") - 2068 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21") - 2069 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22") - 2070 # . epilogue - 2071 89/<- %esp 5/r32/ebp - 2072 5d/pop-to-ebp - 2073 c3/return - 2074 - 2075 test-convert-function-with-multiple-vars-in-nested-blocks: - 2076 # . prologue - 2077 55/push-ebp - 2078 89/<- %ebp 4/r32/esp - 2079 # setup - 2080 (clear-stream _test-input-stream) - 2081 (clear-stream $_test-input-buffered-file->buffer) - 2082 (clear-stream _test-output-stream) - 2083 (clear-stream $_test-output-buffered-file->buffer) - 2084 # - 2085 (write _test-input-stream "fn foo x: int {\n") - 2086 (write _test-input-stream " {\n") - 2087 (write _test-input-stream " var x/eax: int <- copy 0\n") - 2088 (write _test-input-stream " {\n") - 2089 (write _test-input-stream " var y: int\n") - 2090 (write _test-input-stream " x <- add y\n") - 2091 (write _test-input-stream " }\n") - 2092 (write _test-input-stream " }\n") - 2093 (write _test-input-stream "}\n") - 2094 # convert - 2095 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2096 (flush _test-output-buffered-file) - 2097 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2103 # check output - 2104 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0") - 2105 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1") - 2106 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2") - 2107 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3") - 2108 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4") - 2109 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5") - 2110 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6") - 2111 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7") - 2112 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8") - 2113 (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") - 2114 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10") - 2115 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11") - 2116 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12") - 2117 (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") - 2118 (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") - 2119 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15") - 2120 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16") - 2121 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17") - 2122 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18") - 2123 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19") - 2124 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20") - 2125 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21") - 2126 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22") - 2127 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23") - 2128 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24") - 2129 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25") - 2130 # . epilogue - 2131 89/<- %esp 5/r32/ebp - 2132 5d/pop-to-ebp - 2133 c3/return - 2134 - 2135 test-convert-function-with-branches-and-local-vars: - 2136 # A conditional 'break' after a 'var' in a block is converted into a - 2137 # nested block that performs all necessary cleanup before jumping. This - 2138 # results in some ugly code duplication. - 2139 # . prologue - 2140 55/push-ebp - 2141 89/<- %ebp 4/r32/esp - 2142 # setup - 2143 (clear-stream _test-input-stream) - 2144 (clear-stream $_test-input-buffered-file->buffer) - 2145 (clear-stream _test-output-stream) - 2146 (clear-stream $_test-output-buffered-file->buffer) - 2147 # - 2148 (write _test-input-stream "fn foo {\n") - 2149 (write _test-input-stream " {\n") - 2150 (write _test-input-stream " var x: int\n") - 2151 (write _test-input-stream " break-if->=\n") - 2152 (write _test-input-stream " increment x\n") - 2153 (write _test-input-stream " }\n") - 2154 (write _test-input-stream "}\n") - 2155 # convert - 2156 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2157 (flush _test-output-buffered-file) - 2158 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2164 # check output - 2165 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0") - 2166 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1") - 2167 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2") - 2168 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3") - 2169 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4") - 2170 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5") - 2171 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6") - 2172 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7") - 2173 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8") - 2174 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9") - 2175 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10") - 2176 (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") - 2177 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12") - 2178 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13") - 2179 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14") - 2180 (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") - 2181 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16") - 2182 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17") - 2183 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18") - 2184 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19") - 2185 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20") - 2186 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21") - 2187 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22") - 2188 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23") - 2189 # . epilogue - 2190 89/<- %esp 5/r32/ebp - 2191 5d/pop-to-ebp - 2192 c3/return - 2193 - 2194 test-convert-function-with-conditional-loops-and-local-vars: - 2195 # A conditional 'loop' after a 'var' in a block is converted into a nested - 2196 # block that performs all necessary cleanup before jumping. This results - 2197 # in some ugly code duplication. - 2198 # . prologue - 2199 55/push-ebp - 2200 89/<- %ebp 4/r32/esp - 2201 # setup - 2202 (clear-stream _test-input-stream) - 2203 (clear-stream $_test-input-buffered-file->buffer) - 2204 (clear-stream _test-output-stream) - 2205 (clear-stream $_test-output-buffered-file->buffer) - 2206 # - 2207 (write _test-input-stream "fn foo {\n") - 2208 (write _test-input-stream " {\n") - 2209 (write _test-input-stream " var x: int\n") - 2210 (write _test-input-stream " loop-if->=\n") - 2211 (write _test-input-stream " increment x\n") - 2212 (write _test-input-stream " }\n") - 2213 (write _test-input-stream "}\n") - 2214 # convert - 2215 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2216 (flush _test-output-buffered-file) - 2217 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2223 # check output - 2224 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0") - 2225 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1") - 2226 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2") - 2227 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3") - 2228 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4") - 2229 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5") - 2230 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6") - 2231 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7") - 2232 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8") - 2233 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9") - 2234 (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") - 2235 (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") - 2236 (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") - 2237 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13") - 2238 (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") - 2239 (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") - 2240 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16") - 2241 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17") - 2242 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18") - 2243 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19") - 2244 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20") - 2245 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21") - 2246 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22") - 2247 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23") - 2248 # . epilogue - 2249 89/<- %esp 5/r32/ebp - 2250 5d/pop-to-ebp - 2251 c3/return - 2252 - 2253 test-convert-function-with-unconditional-loops-and-local-vars: - 2254 # An unconditional 'loop' after a 'var' in a block is emitted _after_ the - 2255 # regular block cleanup. Any instructions after 'loop' are dead and - 2256 # therefore skipped. - 2257 # . prologue - 2258 55/push-ebp - 2259 89/<- %ebp 4/r32/esp - 2260 # setup - 2261 (clear-stream _test-input-stream) - 2262 (clear-stream $_test-input-buffered-file->buffer) - 2263 (clear-stream _test-output-stream) - 2264 (clear-stream $_test-output-buffered-file->buffer) - 2265 # - 2266 (write _test-input-stream "fn foo {\n") - 2267 (write _test-input-stream " {\n") - 2268 (write _test-input-stream " var x: int\n") - 2269 (write _test-input-stream " loop\n") - 2270 (write _test-input-stream " increment x\n") - 2271 (write _test-input-stream " }\n") - 2272 (write _test-input-stream "}\n") - 2273 # convert - 2274 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2275 (flush _test-output-buffered-file) - 2276 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2282 # check output - 2283 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0") - 2284 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1") - 2285 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2") - 2286 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3") - 2287 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4") - 2288 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5") - 2289 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6") - 2290 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7") - 2291 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8") - 2292 (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") - 2293 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10") - 2294 # not emitted: ff 0/subop/increment *(ebp+0xfffffffc) - 2295 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11") - 2296 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12") - 2297 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13") - 2298 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14") - 2299 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15") - 2300 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16") - 2301 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17") - 2302 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18") - 2303 # . epilogue - 2304 89/<- %esp 5/r32/ebp - 2305 5d/pop-to-ebp - 2306 c3/return - 2307 - 2308 test-convert-function-with-branches-and-loops-and-local-vars: - 2309 # . prologue - 2310 55/push-ebp - 2311 89/<- %ebp 4/r32/esp - 2312 # setup - 2313 (clear-stream _test-input-stream) - 2314 (clear-stream $_test-input-buffered-file->buffer) - 2315 (clear-stream _test-output-stream) - 2316 (clear-stream $_test-output-buffered-file->buffer) - 2317 # - 2318 (write _test-input-stream "fn foo {\n") - 2319 (write _test-input-stream " {\n") - 2320 (write _test-input-stream " var x: int\n") - 2321 (write _test-input-stream " break-if->=\n") - 2322 (write _test-input-stream " increment x\n") - 2323 (write _test-input-stream " loop\n") - 2324 (write _test-input-stream " }\n") - 2325 (write _test-input-stream "}\n") - 2326 # convert - 2327 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2328 (flush _test-output-buffered-file) - 2329 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2335 # check output - 2336 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0") - 2337 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1") - 2338 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2") - 2339 (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") - 2340 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4") - 2341 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5") - 2342 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6") - 2343 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7") - 2344 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8") - 2345 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9") - 2346 (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") - 2347 (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") - 2348 (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") - 2349 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13") - 2350 (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") - 2351 (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") - 2352 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16") - 2353 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17") - 2354 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18") - 2355 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19") - 2356 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20") - 2357 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21") - 2358 (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") - 2359 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23") - 2360 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24") - 2361 # . epilogue - 2362 89/<- %esp 5/r32/ebp - 2363 5d/pop-to-ebp - 2364 c3/return - 2365 - 2366 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars: - 2367 # . prologue - 2368 55/push-ebp - 2369 89/<- %ebp 4/r32/esp - 2370 # setup - 2371 (clear-stream _test-input-stream) - 2372 (clear-stream $_test-input-buffered-file->buffer) - 2373 (clear-stream _test-output-stream) - 2374 (clear-stream $_test-output-buffered-file->buffer) - 2375 # - 2376 (write _test-input-stream "fn foo {\n") - 2377 (write _test-input-stream " a: {\n") - 2378 (write _test-input-stream " var x: int\n") - 2379 (write _test-input-stream " {\n") - 2380 (write _test-input-stream " var y: int\n") - 2381 (write _test-input-stream " break-if->= a\n") - 2382 (write _test-input-stream " increment x\n") - 2383 (write _test-input-stream " loop\n") - 2384 (write _test-input-stream " }\n") - 2385 (write _test-input-stream " }\n") - 2386 (write _test-input-stream "}\n") - 2387 # convert - 2388 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2389 (flush _test-output-buffered-file) - 2390 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2396 # check output - 2397 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0") - 2398 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1") - 2399 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2") - 2400 (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") - 2401 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4") - 2402 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5") - 2403 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6") - 2404 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7") - 2405 (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") - 2406 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9") - 2407 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10") - 2408 (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") - 2409 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12") - 2410 (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") - 2411 (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") - 2412 (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") - 2413 (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") - 2414 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17") - 2415 (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") - 2416 (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") - 2417 (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") - 2418 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21") - 2419 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22") - 2420 (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") - 2421 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24") - 2422 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25") - 2423 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26") - 2424 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27") - 2425 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28") - 2426 (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") - 2427 (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") - 2428 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31") - 2429 # . epilogue - 2430 89/<- %esp 5/r32/ebp - 2431 5d/pop-to-ebp - 2432 c3/return - 2433 - 2434 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2: - 2435 # . prologue - 2436 55/push-ebp - 2437 89/<- %ebp 4/r32/esp - 2438 # setup - 2439 (clear-stream _test-input-stream) - 2440 (clear-stream $_test-input-buffered-file->buffer) - 2441 (clear-stream _test-output-stream) - 2442 (clear-stream $_test-output-buffered-file->buffer) - 2443 # non-local conditional branch from a block without a local variable, - 2444 # unwinding a local on the stack - 2445 (write _test-input-stream "fn foo {\n") - 2446 (write _test-input-stream " a: {\n") - 2447 (write _test-input-stream " var x: int\n") - 2448 (write _test-input-stream " {\n") - 2449 (write _test-input-stream " break-if->= a\n") - 2450 (write _test-input-stream " }\n") - 2451 (write _test-input-stream " }\n") - 2452 (write _test-input-stream "}\n") - 2453 # convert - 2454 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2455 (flush _test-output-buffered-file) - 2456 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2462 # check output - 2463 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/0") - 2464 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/1") - 2465 (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") - 2466 (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") - 2467 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/4") - 2468 (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") - 2469 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/6") - 2470 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/7") - 2471 (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") - 2472 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/9") - 2473 (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") - 2474 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/11") - 2475 (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") - 2476 (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") - 2477 (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") - 2478 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/15") - 2479 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/16") - 2480 (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") - 2481 (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") - 2482 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/19") - 2483 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/20") - 2484 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/21") - 2485 (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") - 2486 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/23") - 2487 (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") - 2488 (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") - 2489 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/26") - 2490 # . epilogue - 2491 89/<- %esp 5/r32/ebp - 2492 5d/pop-to-ebp - 2493 c3/return - 2494 - 2495 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3: - 2496 # . prologue - 2497 55/push-ebp - 2498 89/<- %ebp 4/r32/esp - 2499 # setup - 2500 (clear-stream _test-input-stream) - 2501 (clear-stream $_test-input-buffered-file->buffer) - 2502 (clear-stream _test-output-stream) - 2503 (clear-stream $_test-output-buffered-file->buffer) - 2504 # non-local unconditional branch from a block without a local variable, - 2505 # unwinding a local on the stack - 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 " break a\n") - 2511 (write _test-input-stream " }\n") - 2512 (write _test-input-stream " }\n") - 2513 (write _test-input-stream "}\n") - 2514 # convert - 2515 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2516 (flush _test-output-buffered-file) - 2517 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2523 # check output - 2524 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/0") - 2525 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/1") - 2526 (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") - 2527 (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") - 2528 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/4") - 2529 (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") - 2530 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/6") - 2531 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/7") - 2532 (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") - 2533 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/9") - 2534 (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") - 2535 (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") - 2536 (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") - 2537 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/14") - 2538 (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") - 2539 (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") - 2540 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/17") - 2541 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/18") - 2542 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/19") - 2543 (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") - 2544 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/21") - 2545 (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") - 2546 (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") - 2547 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/24") - 2548 # . epilogue - 2549 89/<- %esp 5/r32/ebp - 2550 5d/pop-to-ebp - 2551 c3/return - 2552 - 2553 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4: - 2554 # . prologue - 2555 55/push-ebp - 2556 89/<- %ebp 4/r32/esp - 2557 # setup - 2558 (clear-stream _test-input-stream) - 2559 (clear-stream $_test-input-buffered-file->buffer) - 2560 (clear-stream _test-output-stream) - 2561 (clear-stream $_test-output-buffered-file->buffer) - 2562 # - 2563 (write _test-input-stream "fn foo {\n") - 2564 (write _test-input-stream " a: {\n") - 2565 (write _test-input-stream " var x/esi: int <- copy 0\n") - 2566 (write _test-input-stream " {\n") - 2567 (write _test-input-stream " break a\n") - 2568 (write _test-input-stream " }\n") - 2569 (write _test-input-stream " }\n") - 2570 (write _test-input-stream "}\n") - 2571 # convert - 2572 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2573 (flush _test-output-buffered-file) - 2574 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2580 # check output - 2581 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/0") - 2582 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/1") - 2583 (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") - 2584 (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") - 2585 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/4") - 2586 (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") - 2587 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/6") - 2588 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/7") - 2589 (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") - 2590 (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") - 2591 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/10") - 2592 (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") - 2593 (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") - 2594 (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") - 2595 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/14") - 2596 (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") - 2597 (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") - 2598 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/17") - 2599 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/18") - 2600 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/19") - 2601 (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") - 2602 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/21") - 2603 (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") - 2604 (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") - 2605 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/24") - 2606 # . epilogue - 2607 89/<- %esp 5/r32/ebp - 2608 5d/pop-to-ebp - 2609 c3/return - 2610 - 2611 test-convert-function-with-nonlocal-unconditional-break-and-local-vars: - 2612 # . prologue - 2613 55/push-ebp - 2614 89/<- %ebp 4/r32/esp - 2615 # setup - 2616 (clear-stream _test-input-stream) - 2617 (clear-stream $_test-input-buffered-file->buffer) - 2618 (clear-stream _test-output-stream) - 2619 (clear-stream $_test-output-buffered-file->buffer) - 2620 # - 2621 (write _test-input-stream "fn foo {\n") - 2622 (write _test-input-stream " a: {\n") - 2623 (write _test-input-stream " var x: int\n") - 2624 (write _test-input-stream " {\n") - 2625 (write _test-input-stream " var y: int\n") - 2626 (write _test-input-stream " break a\n") - 2627 (write _test-input-stream " increment x\n") - 2628 (write _test-input-stream " }\n") - 2629 (write _test-input-stream " }\n") - 2630 (write _test-input-stream "}\n") - 2631 # convert - 2632 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2633 (flush _test-output-buffered-file) - 2634 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2640 # check output - 2641 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0") - 2642 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1") - 2643 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2") - 2644 (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") - 2645 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4") - 2646 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5") - 2647 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6") - 2648 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7") - 2649 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8") - 2650 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9") - 2651 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10") - 2652 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11") - 2653 (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") - 2654 (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") - 2655 (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") - 2656 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15") - 2657 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16") - 2658 (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") - 2659 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18") - 2660 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19") - 2661 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20") - 2662 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21") - 2663 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22") - 2664 (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") - 2665 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24") - 2666 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25") - 2667 # . epilogue - 2668 89/<- %esp 5/r32/ebp - 2669 5d/pop-to-ebp - 2670 c3/return - 2671 - 2672 test-convert-function-with-unconditional-break-and-local-vars: - 2673 # . prologue - 2674 55/push-ebp - 2675 89/<- %ebp 4/r32/esp - 2676 # setup - 2677 (clear-stream _test-input-stream) - 2678 (clear-stream $_test-input-buffered-file->buffer) - 2679 (clear-stream _test-output-stream) - 2680 (clear-stream $_test-output-buffered-file->buffer) - 2681 # - 2682 (write _test-input-stream "fn foo {\n") - 2683 (write _test-input-stream " {\n") - 2684 (write _test-input-stream " var x: int\n") - 2685 (write _test-input-stream " {\n") - 2686 (write _test-input-stream " var y: int\n") - 2687 (write _test-input-stream " break\n") - 2688 (write _test-input-stream " increment x\n") - 2689 (write _test-input-stream " }\n") - 2690 (write _test-input-stream " }\n") - 2691 (write _test-input-stream "}\n") - 2692 # convert - 2693 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2694 (flush _test-output-buffered-file) - 2695 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2701 # check output - 2702 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0") - 2703 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1") - 2704 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2") - 2705 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3") - 2706 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4") - 2707 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5") - 2708 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6") - 2709 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7") - 2710 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8") - 2711 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9") - 2712 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10") - 2713 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11") - 2714 (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") - 2715 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13") - 2716 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14") - 2717 (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") - 2718 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16") - 2719 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17") - 2720 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18") - 2721 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19") - 2722 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20") - 2723 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21") - 2724 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22") - 2725 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23") - 2726 # . epilogue - 2727 89/<- %esp 5/r32/ebp - 2728 5d/pop-to-ebp - 2729 c3/return - 2730 - 2731 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars: - 2732 # . prologue - 2733 55/push-ebp - 2734 89/<- %ebp 4/r32/esp - 2735 # setup - 2736 (clear-stream _test-input-stream) - 2737 (clear-stream $_test-input-buffered-file->buffer) - 2738 (clear-stream _test-output-stream) - 2739 (clear-stream $_test-output-buffered-file->buffer) - 2740 # - 2741 (write _test-input-stream "fn foo {\n") - 2742 (write _test-input-stream " a: {\n") - 2743 (write _test-input-stream " var x: int\n") - 2744 (write _test-input-stream " {\n") - 2745 (write _test-input-stream " var y: int\n") - 2746 (write _test-input-stream " loop a\n") - 2747 (write _test-input-stream " increment x\n") - 2748 (write _test-input-stream " }\n") - 2749 (write _test-input-stream " }\n") - 2750 (write _test-input-stream "}\n") - 2751 # convert - 2752 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2753 (flush _test-output-buffered-file) - 2754 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2760 # check output - 2761 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0") - 2762 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1") - 2763 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2") - 2764 (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") - 2765 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4") - 2766 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5") - 2767 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6") - 2768 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7") - 2769 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8") - 2770 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9") - 2771 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10") - 2772 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11") - 2773 (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") - 2774 (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") - 2775 (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") - 2776 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15") - 2777 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16") - 2778 (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") - 2779 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18") - 2780 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19") - 2781 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20") - 2782 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21") - 2783 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22") - 2784 (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") - 2785 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24") - 2786 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25") - 2787 # . epilogue - 2788 89/<- %esp 5/r32/ebp - 2789 5d/pop-to-ebp - 2790 c3/return - 2791 - 2792 test-convert-function-with-local-array-var-in-mem: - 2793 # . prologue - 2794 55/push-ebp - 2795 89/<- %ebp 4/r32/esp - 2796 # setup - 2797 (clear-stream _test-input-stream) - 2798 (clear-stream $_test-input-buffered-file->buffer) - 2799 (clear-stream _test-output-stream) - 2800 (clear-stream $_test-output-buffered-file->buffer) - 2801 # - 2802 (write _test-input-stream "fn foo {\n") - 2803 (write _test-input-stream " var x: (array int 3)\n") - 2804 (write _test-input-stream "}\n") - 2805 # convert - 2806 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2807 (flush _test-output-buffered-file) - 2808 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2814 # check output - 2815 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-var-in-mem/0") - 2816 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-var-in-mem/1") - 2817 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-var-in-mem/2") - 2818 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-var-in-mem/3") - 2819 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-var-in-mem/4") - 2820 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-var-in-mem/5") - 2821 # define x - 2822 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-function-with-local-array-var-in-mem/7") - 2823 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-function-with-local-array-var-in-mem/8") - 2824 # reclaim x - 2825 (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") - 2826 # - 2827 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-var-in-mem/10") - 2828 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-var-in-mem/11") - 2829 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-var-in-mem/12") - 2830 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-var-in-mem/13") - 2831 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-var-in-mem/14") - 2832 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-var-in-mem/15") - 2833 # . epilogue - 2834 89/<- %esp 5/r32/ebp - 2835 5d/pop-to-ebp - 2836 c3/return - 2837 - 2838 # special-case for size(byte) when allocating array - 2839 test-convert-function-with-local-array-of-bytes-in-mem: - 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 x: (array byte 3)\n") - 2851 (write _test-input-stream "}\n") - 2852 # convert - 2853 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2854 (flush _test-output-buffered-file) - 2855 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2861 # check output - 2862 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-of-bytes-in-mem/0") - 2863 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-of-bytes-in-mem/1") - 2864 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/2") - 2865 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-of-bytes-in-mem/3") - 2866 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-of-bytes-in-mem/4") - 2867 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-of-bytes-in-mem/5") - 2868 # define x - 2869 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x00000003)" "F - test-convert-function-with-local-array-of-bytes-in-mem/7") - 2870 (check-next-stream-line-equal _test-output-stream " 68/push 0x00000003/imm32" "F - test-convert-function-with-local-array-of-bytes-in-mem/8") - 2871 # reclaim x - 2872 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000007/imm32" "F - test-convert-function-with-local-array-of-bytes-in-mem/9") - 2873 # - 2874 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-of-bytes-in-mem/10") - 2875 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-of-bytes-in-mem/11") - 2876 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-of-bytes-in-mem/12") - 2877 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/13") - 2878 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/14") - 2879 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-of-bytes-in-mem/15") - 2880 # . epilogue - 2881 89/<- %esp 5/r32/ebp - 2882 5d/pop-to-ebp - 2883 c3/return - 2884 - 2885 test-convert-address: - 2886 # . prologue - 2887 55/push-ebp - 2888 89/<- %ebp 4/r32/esp - 2889 # setup - 2890 (clear-stream _test-input-stream) - 2891 (clear-stream $_test-input-buffered-file->buffer) - 2892 (clear-stream _test-output-stream) - 2893 (clear-stream $_test-output-buffered-file->buffer) - 2894 # - 2895 (write _test-input-stream "fn foo {\n") - 2896 (write _test-input-stream " var a: int\n") - 2897 (write _test-input-stream " var b/eax: (addr int) <- address a\n") - 2898 (write _test-input-stream "}\n") - 2899 # convert - 2900 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2901 (flush _test-output-buffered-file) - 2902 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2908 # check output - 2909 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-address/0") - 2910 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-address/1") - 2911 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-address/2") - 2912 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-address/3") - 2913 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-address/4") - 2914 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-address/5") - 2915 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-address/6") - 2916 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-address/7") - 2917 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-address/8") - 2918 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-address/9") - 2919 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-address/10") - 2920 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-address/11") - 2921 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-address/12") - 2922 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-address/13") - 2923 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-address/14") - 2924 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-address/15") - 2925 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-address/16") - 2926 # . epilogue - 2927 89/<- %esp 5/r32/ebp - 2928 5d/pop-to-ebp - 2929 c3/return - 2930 - 2931 test-convert-length-of-array: - 2932 # . prologue - 2933 55/push-ebp - 2934 89/<- %ebp 4/r32/esp - 2935 # setup - 2936 (clear-stream _test-input-stream) - 2937 (clear-stream $_test-input-buffered-file->buffer) - 2938 (clear-stream _test-output-stream) - 2939 (clear-stream $_test-output-buffered-file->buffer) - 2940 # - 2941 (write _test-input-stream "fn foo a: (addr array int) {\n") - 2942 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n") - 2943 (write _test-input-stream " var c/eax: int <- length b\n") + 1619 (write _test-input-stream "fn foo x: byte, y: int {\n") + 1620 (write _test-input-stream " var a/eax: byte <- copy x\n") + 1621 (write _test-input-stream " var b/eax: int <- copy y\n") + 1622 (write _test-input-stream "}\n") + 1623 # convert + 1624 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1625 (flush _test-output-buffered-file) + 1626 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1632 # check output + 1633 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-copy-byte-from-fn-arg/0") + 1634 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-copy-byte-from-fn-arg/1") + 1635 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-copy-byte-from-fn-arg/2") + 1636 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-copy-byte-from-fn-arg/3") + 1637 (check-next-stream-line-equal _test-output-stream " {" "F - test-copy-byte-from-fn-arg/4") + 1638 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-copy-byte-from-fn-arg/5") + 1639 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-copy-byte-from-fn-arg/6") + 1640 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/7") + 1641 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x0000000c) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/8") + 1642 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-copy-byte-from-fn-arg/9") + 1643 (check-next-stream-line-equal _test-output-stream " }" "F - test-copy-byte-from-fn-arg/10") + 1644 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-copy-byte-from-fn-arg/11") + 1645 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-copy-byte-from-fn-arg/12") + 1646 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-copy-byte-from-fn-arg/13") + 1647 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-copy-byte-from-fn-arg/14") + 1648 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-copy-byte-from-fn-arg/15") + 1649 # . epilogue + 1650 89/<- %esp 5/r32/ebp + 1651 5d/pop-to-ebp + 1652 c3/return + 1653 + 1654 test-convert-compare-register-with-literal: + 1655 # . prologue + 1656 55/push-ebp + 1657 89/<- %ebp 4/r32/esp + 1658 # setup + 1659 (clear-stream _test-input-stream) + 1660 (clear-stream $_test-input-buffered-file->buffer) + 1661 (clear-stream _test-output-stream) + 1662 (clear-stream $_test-output-buffered-file->buffer) + 1663 # + 1664 (write _test-input-stream "fn foo {\n") + 1665 (write _test-input-stream " var x/ecx: int <- copy 0\n") + 1666 (write _test-input-stream " compare x, 0\n") + 1667 (write _test-input-stream "}\n") + 1668 # convert + 1669 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1670 (flush _test-output-buffered-file) + 1671 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1677 # check output + 1678 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0") + 1679 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1") + 1680 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2") + 1681 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3") + 1682 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4") + 1683 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5") + 1684 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") + 1685 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7") + 1686 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8") + 1687 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") + 1688 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10") + 1689 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11") + 1690 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12") + 1691 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13") + 1692 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14") + 1693 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15") + 1694 # . epilogue + 1695 89/<- %esp 5/r32/ebp + 1696 5d/pop-to-ebp + 1697 c3/return + 1698 + 1699 test-unknown-variable: + 1700 # . prologue + 1701 55/push-ebp + 1702 89/<- %ebp 4/r32/esp + 1703 # setup + 1704 (clear-stream _test-input-stream) + 1705 (clear-stream $_test-input-buffered-file->buffer) + 1706 (clear-stream _test-output-stream) + 1707 (clear-stream $_test-output-buffered-file->buffer) + 1708 (clear-stream _test-error-stream) + 1709 (clear-stream $_test-error-buffered-file->buffer) + 1710 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1711 68/push 0/imm32 + 1712 68/push 0/imm32 + 1713 89/<- %edx 4/r32/esp + 1714 (tailor-exit-descriptor %edx 0x10) + 1715 # + 1716 (write _test-input-stream "fn foo {\n") + 1717 (write _test-input-stream " compare x, 0\n") + 1718 (write _test-input-stream "}\n") + 1719 # convert + 1720 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1721 # registers except esp clobbered at this point + 1722 # restore ed + 1723 89/<- %edx 4/r32/esp + 1724 (flush _test-output-buffered-file) + 1725 (flush _test-error-buffered-file) + 1726 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1732 # check output + 1733 (check-stream-equal _test-output-stream "" "F - test-unknown-variable: output should be empty") + 1734 (check-next-stream-line-equal _test-error-stream "unknown variable 'x'" "F - test-unknown-variable: error message") + 1735 # check that stop(1) was called + 1736 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable: exit status") + 1737 # don't restore from ebp + 1738 81 0/subop/add %esp 8/imm32 + 1739 # . epilogue + 1740 5d/pop-to-ebp + 1741 c3/return + 1742 + 1743 test-convert-function-with-local-var-in-block: + 1744 # . prologue + 1745 55/push-ebp + 1746 89/<- %ebp 4/r32/esp + 1747 # setup + 1748 (clear-stream _test-input-stream) + 1749 (clear-stream $_test-input-buffered-file->buffer) + 1750 (clear-stream _test-output-stream) + 1751 (clear-stream $_test-output-buffered-file->buffer) + 1752 # + 1753 (write _test-input-stream "fn foo {\n") + 1754 (write _test-input-stream " {\n") + 1755 (write _test-input-stream " var x: int\n") + 1756 (write _test-input-stream " increment x\n") + 1757 (write _test-input-stream " }\n") + 1758 (write _test-input-stream "}\n") + 1759 # convert + 1760 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1761 (flush _test-output-buffered-file) + 1762 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1768 # check output + 1769 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0") + 1770 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1") + 1771 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2") + 1772 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3") + 1773 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4") + 1774 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5") + 1775 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6") + 1776 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7") + 1777 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8") + 1778 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9") + 1779 (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") + 1780 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11") + 1781 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12") + 1782 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13") + 1783 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14") + 1784 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15") + 1785 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16") + 1786 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17") + 1787 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18") + 1788 # . epilogue + 1789 89/<- %esp 5/r32/ebp + 1790 5d/pop-to-ebp + 1791 c3/return + 1792 + 1793 test-convert-function-with-local-var-in-named-block: + 1794 # . prologue + 1795 55/push-ebp + 1796 89/<- %ebp 4/r32/esp + 1797 # setup + 1798 (clear-stream _test-input-stream) + 1799 (clear-stream $_test-input-buffered-file->buffer) + 1800 (clear-stream _test-output-stream) + 1801 (clear-stream $_test-output-buffered-file->buffer) + 1802 # + 1803 (write _test-input-stream "fn foo {\n") + 1804 (write _test-input-stream " $bar: {\n") + 1805 (write _test-input-stream " var x: int\n") + 1806 (write _test-input-stream " increment x\n") + 1807 (write _test-input-stream " }\n") + 1808 (write _test-input-stream "}\n") + 1809 # convert + 1810 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1811 (flush _test-output-buffered-file) + 1812 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1818 # check output + 1819 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0") + 1820 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1") + 1821 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2") + 1822 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3") + 1823 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4") + 1824 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5") + 1825 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6") + 1826 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7") + 1827 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8") + 1828 (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") + 1829 (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") + 1830 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11") + 1831 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12") + 1832 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13") + 1833 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14") + 1834 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15") + 1835 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16") + 1836 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17") + 1837 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18") + 1838 # . epilogue + 1839 89/<- %esp 5/r32/ebp + 1840 5d/pop-to-ebp + 1841 c3/return + 1842 + 1843 test-unknown-variable-in-named-block: + 1844 # . prologue + 1845 55/push-ebp + 1846 89/<- %ebp 4/r32/esp + 1847 # setup + 1848 (clear-stream _test-input-stream) + 1849 (clear-stream $_test-input-buffered-file->buffer) + 1850 (clear-stream _test-output-stream) + 1851 (clear-stream $_test-output-buffered-file->buffer) + 1852 (clear-stream _test-error-stream) + 1853 (clear-stream $_test-error-buffered-file->buffer) + 1854 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1855 68/push 0/imm32 + 1856 68/push 0/imm32 + 1857 89/<- %edx 4/r32/esp + 1858 (tailor-exit-descriptor %edx 0x10) + 1859 # + 1860 (write _test-input-stream "fn foo {\n") + 1861 (write _test-input-stream " $a: {\n") + 1862 (write _test-input-stream " compare x, 0\n") + 1863 (write _test-input-stream " }\n") + 1864 (write _test-input-stream "}\n") + 1865 # convert + 1866 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1867 # registers except esp clobbered at this point + 1868 # restore ed + 1869 89/<- %edx 4/r32/esp + 1870 (flush _test-output-buffered-file) + 1871 (flush _test-error-buffered-file) + 1872 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 1878 # check output + 1879 (check-stream-equal _test-output-stream "" "F - test-unknown-variable-in-named-block: output should be empty") + 1880 (check-next-stream-line-equal _test-error-stream "unknown variable 'x'" "F - test-unknown-variable-in-named-block: error message") + 1881 # check that stop(1) was called + 1882 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable-in-named-block: exit status") + 1883 # don't restore from ebp + 1884 81 0/subop/add %esp 8/imm32 + 1885 # . epilogue + 1886 5d/pop-to-ebp + 1887 c3/return + 1888 + 1889 test-always-shadow-outermost-reg-vars-in-function: + 1890 # . prologue + 1891 55/push-ebp + 1892 89/<- %ebp 4/r32/esp + 1893 # setup + 1894 (clear-stream _test-input-stream) + 1895 (clear-stream $_test-input-buffered-file->buffer) + 1896 (clear-stream _test-output-stream) + 1897 (clear-stream $_test-output-buffered-file->buffer) + 1898 # + 1899 (write _test-input-stream "fn foo {\n") + 1900 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 1901 (write _test-input-stream "}\n") + 1902 # convert + 1903 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1904 (flush _test-output-buffered-file) + 1905 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1911 # check output + 1912 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-always-shadow-outermost-reg-vars-in-function/0") + 1913 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-always-shadow-outermost-reg-vars-in-function/1") + 1914 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/2") + 1915 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-always-shadow-outermost-reg-vars-in-function/3") + 1916 (check-next-stream-line-equal _test-output-stream " {" "F - test-always-shadow-outermost-reg-vars-in-function/4") + 1917 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-always-shadow-outermost-reg-vars-in-function/5") + 1918 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") + 1919 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-always-shadow-outermost-reg-vars-in-function/8") + 1920 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") + 1921 (check-next-stream-line-equal _test-output-stream " }" "F - test-always-shadow-outermost-reg-vars-in-function/12") + 1922 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-always-shadow-outermost-reg-vars-in-function/13") + 1923 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-always-shadow-outermost-reg-vars-in-function/14") + 1924 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-always-shadow-outermost-reg-vars-in-function/15") + 1925 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/16") + 1926 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-always-shadow-outermost-reg-vars-in-function/17") + 1927 # . epilogue + 1928 89/<- %esp 5/r32/ebp + 1929 5d/pop-to-ebp + 1930 c3/return + 1931 + 1932 _pending-test-clobber-dead-local: + 1933 # . prologue + 1934 55/push-ebp + 1935 89/<- %ebp 4/r32/esp + 1936 # setup + 1937 (clear-stream _test-input-stream) + 1938 (clear-stream $_test-input-buffered-file->buffer) + 1939 (clear-stream _test-output-stream) + 1940 (clear-stream $_test-output-buffered-file->buffer) + 1941 # + 1942 (write _test-input-stream "fn foo {\n") + 1943 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 1944 (write _test-input-stream " {\n") + 1945 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 1946 (write _test-input-stream " }\n") + 1947 (write _test-input-stream "}\n") + 1948 # convert + 1949 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1950 (flush _test-output-buffered-file) + 1951 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 1957 # check output + 1958 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-clobber-dead-local/0") + 1959 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-clobber-dead-local/1") + 1960 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-clobber-dead-local/2") + 1961 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-clobber-dead-local/3") + 1962 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/4") + 1963 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-clobber-dead-local/5") + 1964 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-clobber-dead-local/6") + 1965 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-clobber-dead-local/7") + 1966 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/8") + 1967 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-clobber-dead-local/9") + 1968 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-clobber-dead-local/10") # no push/pop here + 1969 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/11") + 1970 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-clobber-dead-local/12") + 1971 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-clobber-dead-local/13") + 1972 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/14") + 1973 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-clobber-dead-local/15") + 1974 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-clobber-dead-local/16") + 1975 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-clobber-dead-local/17") + 1976 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-clobber-dead-local/18") + 1977 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-clobber-dead-local/19") + 1978 # . epilogue + 1979 89/<- %esp 5/r32/ebp + 1980 5d/pop-to-ebp + 1981 c3/return + 1982 + 1983 test-shadow-live-local: + 1984 # . prologue + 1985 55/push-ebp + 1986 89/<- %ebp 4/r32/esp + 1987 # setup + 1988 (clear-stream _test-input-stream) + 1989 (clear-stream $_test-input-buffered-file->buffer) + 1990 (clear-stream _test-output-stream) + 1991 (clear-stream $_test-output-buffered-file->buffer) + 1992 # + 1993 (write _test-input-stream "fn foo {\n") + 1994 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 1995 (write _test-input-stream " {\n") + 1996 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 1997 (write _test-input-stream " }\n") + 1998 (write _test-input-stream " x <- increment\n") + 1999 (write _test-input-stream "}\n") + 2000 # convert + 2001 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2002 (flush _test-output-buffered-file) + 2003 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2009 # check output + 2010 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-local/0") + 2011 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-local/1") + 2012 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-local/2") + 2013 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-local/3") + 2014 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/4") + 2015 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-local/5") + 2016 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/6") + 2017 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-local/7") + 2018 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/8") + 2019 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-local/9") + 2020 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/10") + 2021 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-local/11") + 2022 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/12") + 2023 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/13") + 2024 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-local/14") + 2025 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-local/15") + 2026 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/16") + 2027 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/17") + 2028 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-local/18") + 2029 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-local/19") + 2030 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-local/20") + 2031 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-local/21") + 2032 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-local/21") + 2033 # . epilogue + 2034 89/<- %esp 5/r32/ebp + 2035 5d/pop-to-ebp + 2036 c3/return + 2037 + 2038 test-do-not-spill-same-register-in-block: + 2039 # . prologue + 2040 55/push-ebp + 2041 89/<- %ebp 4/r32/esp + 2042 # setup + 2043 (clear-stream _test-input-stream) + 2044 (clear-stream $_test-input-buffered-file->buffer) + 2045 (clear-stream _test-output-stream) + 2046 (clear-stream $_test-output-buffered-file->buffer) + 2047 # + 2048 (write _test-input-stream "fn foo {\n") + 2049 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 2050 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 2051 (write _test-input-stream " y <- increment\n") + 2052 (write _test-input-stream "}\n") + 2053 # convert + 2054 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2055 (flush _test-output-buffered-file) + 2056 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2062 # check output + 2063 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-do-not-spill-same-register-in-block/0") + 2064 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-do-not-spill-same-register-in-block/1") + 2065 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-do-not-spill-same-register-in-block/2") + 2066 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-do-not-spill-same-register-in-block/3") + 2067 (check-next-stream-line-equal _test-output-stream " {" "F - test-do-not-spill-same-register-in-block/4") + 2068 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-do-not-spill-same-register-in-block/5") + 2069 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-do-not-spill-same-register-in-block/6") + 2070 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-do-not-spill-same-register-in-block/7") + 2071 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-do-not-spill-same-register-in-block/8") + 2072 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-do-not-spill-same-register-in-block/9") + 2073 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-do-not-spill-same-register-in-block/10") + 2074 (check-next-stream-line-equal _test-output-stream " }" "F - test-do-not-spill-same-register-in-block/11") + 2075 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-do-not-spill-same-register-in-block/12") + 2076 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-do-not-spill-same-register-in-block/13") + 2077 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-do-not-spill-same-register-in-block/14") + 2078 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-do-not-spill-same-register-in-block/15") + 2079 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-do-not-spill-same-register-in-block/16") + 2080 # . epilogue + 2081 89/<- %esp 5/r32/ebp + 2082 5d/pop-to-ebp + 2083 c3/return + 2084 + 2085 test-spill-different-register-in-block: + 2086 # . prologue + 2087 55/push-ebp + 2088 89/<- %ebp 4/r32/esp + 2089 # setup + 2090 (clear-stream _test-input-stream) + 2091 (clear-stream $_test-input-buffered-file->buffer) + 2092 (clear-stream _test-output-stream) + 2093 (clear-stream $_test-output-buffered-file->buffer) + 2094 # + 2095 (write _test-input-stream "fn foo {\n") + 2096 (write _test-input-stream " var x/eax: int <- copy 3\n") + 2097 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 2098 (write _test-input-stream " y <- increment\n") + 2099 (write _test-input-stream "}\n") + 2100 # convert + 2101 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2102 (flush _test-output-buffered-file) + 2103 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2109 # check output + 2110 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-spill-different-register-in-block/0") + 2111 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-spill-different-register-in-block/1") + 2112 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-spill-different-register-in-block/2") + 2113 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-spill-different-register-in-block/3") + 2114 (check-next-stream-line-equal _test-output-stream " {" "F - test-spill-different-register-in-block/4") + 2115 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-spill-different-register-in-block/5") + 2116 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-spill-different-register-in-block/6") + 2117 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-spill-different-register-in-block/7") + 2118 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-spill-different-register-in-block/8") + 2119 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-spill-different-register-in-block/9") + 2120 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-spill-different-register-in-block/10") + 2121 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-spill-different-register-in-block/11") + 2122 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-spill-different-register-in-block/12") + 2123 (check-next-stream-line-equal _test-output-stream " }" "F - test-spill-different-register-in-block/13") + 2124 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-spill-different-register-in-block/14") + 2125 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-spill-different-register-in-block/15") + 2126 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-spill-different-register-in-block/16") + 2127 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-spill-different-register-in-block/17") + 2128 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-spill-different-register-in-block/18") + 2129 # . epilogue + 2130 89/<- %esp 5/r32/ebp + 2131 5d/pop-to-ebp + 2132 c3/return + 2133 + 2134 test-shadow-live-output: + 2135 # . prologue + 2136 55/push-ebp + 2137 89/<- %ebp 4/r32/esp + 2138 # setup + 2139 (clear-stream _test-input-stream) + 2140 (clear-stream $_test-input-buffered-file->buffer) + 2141 (clear-stream _test-output-stream) + 2142 (clear-stream $_test-output-buffered-file->buffer) + 2143 # + 2144 (write _test-input-stream "fn foo -> x/ecx: int {\n") + 2145 (write _test-input-stream " x <- copy 3\n") + 2146 (write _test-input-stream " {\n") + 2147 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 2148 (write _test-input-stream " }\n") + 2149 (write _test-input-stream " x <- increment\n") + 2150 (write _test-input-stream "}\n") + 2151 # convert + 2152 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2153 (flush _test-output-buffered-file) + 2154 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2160 # check output + 2161 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-output/0") + 2162 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-output/1") + 2163 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-output/2") + 2164 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-output/3") + 2165 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/4") + 2166 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-output/5") + 2167 (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 + 2168 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/8") + 2169 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-output/9") + 2170 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-output/10") + 2171 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-output/11") + 2172 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-output/12") + 2173 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/13") + 2174 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-output/14") + 2175 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-output/15") + 2176 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/17") + 2177 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-output/18") + 2178 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-output/19") + 2179 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-output/20") + 2180 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-output/21") + 2181 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-output/21") + 2182 # . epilogue + 2183 89/<- %esp 5/r32/ebp + 2184 5d/pop-to-ebp + 2185 c3/return + 2186 + 2187 test-local-clobbered-by-output: + 2188 # also doesn't spill + 2189 # . prologue + 2190 55/push-ebp + 2191 89/<- %ebp 4/r32/esp + 2192 # setup + 2193 (clear-stream _test-input-stream) + 2194 (clear-stream $_test-input-buffered-file->buffer) + 2195 (clear-stream _test-output-stream) + 2196 (clear-stream $_test-output-buffered-file->buffer) + 2197 # + 2198 (write _test-input-stream "fn foo -> x/ecx: int {\n") + 2199 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 2200 (write _test-input-stream " x <- copy y\n") + 2201 (write _test-input-stream "}\n") + 2202 # convert + 2203 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2204 (flush _test-output-buffered-file) + 2205 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2211 # check output + 2212 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-local-clobbered-by-output/0") + 2213 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-local-clobbered-by-output/1") + 2214 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-local-clobbered-by-output/2") + 2215 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-local-clobbered-by-output/3") + 2216 (check-next-stream-line-equal _test-output-stream " {" "F - test-local-clobbered-by-output/4") + 2217 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-local-clobbered-by-output/5") + 2218 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-local-clobbered-by-output/6") + 2219 (check-next-stream-line-equal _test-output-stream " 89/<- %ecx 0x00000001/r32" "F - test-local-clobbered-by-output/7") + 2220 (check-next-stream-line-equal _test-output-stream " }" "F - test-local-clobbered-by-output/8") + 2221 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-local-clobbered-by-output/9") + 2222 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-local-clobbered-by-output/10") + 2223 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-local-clobbered-by-output/11") + 2224 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-local-clobbered-by-output/12") + 2225 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-local-clobbered-by-output/13") + 2226 # . epilogue + 2227 89/<- %esp 5/r32/ebp + 2228 5d/pop-to-ebp + 2229 c3/return + 2230 + 2231 test-read-output: + 2232 # also doesn't spill + 2233 # . prologue + 2234 55/push-ebp + 2235 89/<- %ebp 4/r32/esp + 2236 # setup + 2237 (clear-stream _test-input-stream) + 2238 (clear-stream $_test-input-buffered-file->buffer) + 2239 (clear-stream _test-output-stream) + 2240 (clear-stream $_test-output-buffered-file->buffer) + 2241 # + 2242 (write _test-input-stream "fn foo -> x/ecx: int {\n") + 2243 (write _test-input-stream " x <- copy 0x34\n") + 2244 (write _test-input-stream " compare x, 0x35\n") + 2245 (write _test-input-stream "}\n") + 2246 # convert + 2247 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2248 (flush _test-output-buffered-file) + 2249 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2255 # check output + 2256 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-read-output/0") + 2257 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-read-output/1") + 2258 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-read-output/2") + 2259 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-read-output/3") + 2260 (check-next-stream-line-equal _test-output-stream " {" "F - test-read-output/4") + 2261 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-read-output/5") + 2262 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x34/imm32" "F - test-read-output/6") + 2263 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0x35/imm32" "F - test-read-output/7") + 2264 (check-next-stream-line-equal _test-output-stream " }" "F - test-read-output/8") + 2265 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-read-output/9") + 2266 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-read-output/10") + 2267 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-read-output/11") + 2268 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-read-output/12") + 2269 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-read-output/13") + 2270 # . epilogue + 2271 89/<- %esp 5/r32/ebp + 2272 5d/pop-to-ebp + 2273 c3/return + 2274 + 2275 test-convert-function-with-branches-in-block: + 2276 # . prologue + 2277 55/push-ebp + 2278 89/<- %ebp 4/r32/esp + 2279 # setup + 2280 (clear-stream _test-input-stream) + 2281 (clear-stream $_test-input-buffered-file->buffer) + 2282 (clear-stream _test-output-stream) + 2283 (clear-stream $_test-output-buffered-file->buffer) + 2284 # + 2285 (write _test-input-stream "fn foo x: int {\n") + 2286 (write _test-input-stream " {\n") + 2287 (write _test-input-stream " break-if->=\n") + 2288 (write _test-input-stream " loop-if-addr<\n") + 2289 (write _test-input-stream " increment x\n") + 2290 (write _test-input-stream " loop\n") + 2291 (write _test-input-stream " }\n") + 2292 (write _test-input-stream "}\n") + 2293 # convert + 2294 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2295 (flush _test-output-buffered-file) + 2296 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2302 # check output + 2303 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") + 2304 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") + 2305 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") + 2306 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") + 2307 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") + 2308 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") + 2309 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") + 2310 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") + 2311 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") + 2312 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") + 2313 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") + 2314 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") + 2315 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") + 2316 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") + 2317 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") + 2318 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") + 2319 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") + 2320 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") + 2321 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") + 2322 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") + 2323 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") + 2324 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") + 2325 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") + 2326 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") + 2327 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") + 2328 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") + 2329 # . epilogue + 2330 89/<- %esp 5/r32/ebp + 2331 5d/pop-to-ebp + 2332 c3/return + 2333 + 2334 test-convert-function-with-branches-in-named-block: + 2335 # . prologue + 2336 55/push-ebp + 2337 89/<- %ebp 4/r32/esp + 2338 # setup + 2339 (clear-stream _test-input-stream) + 2340 (clear-stream $_test-input-buffered-file->buffer) + 2341 (clear-stream _test-output-stream) + 2342 (clear-stream $_test-output-buffered-file->buffer) + 2343 # + 2344 (write _test-input-stream "fn foo x: int {\n") + 2345 (write _test-input-stream " $bar: {\n") + 2346 (write _test-input-stream " break-if->= $bar\n") + 2347 (write _test-input-stream " loop-if-addr< $bar\n") + 2348 (write _test-input-stream " increment x\n") + 2349 (write _test-input-stream " loop\n") + 2350 (write _test-input-stream " }\n") + 2351 (write _test-input-stream "}\n") + 2352 # convert + 2353 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2354 (flush _test-output-buffered-file) + 2355 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2361 # check output + 2362 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0") + 2363 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1") + 2364 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2") + 2365 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3") + 2366 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4") + 2367 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5") + 2368 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6") + 2369 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7") + 2370 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/8") + 2371 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-named-block/9") + 2372 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/10") + 2373 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/11") + 2374 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/12") + 2375 (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") + 2376 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:loop/disp32" "F - test-convert-function-with-branches-in-named-block/14") + 2377 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/15") + 2378 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/16") + 2379 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/17") + 2380 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/18") + 2381 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/19") + 2382 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/20") + 2383 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/21") + 2384 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/22") + 2385 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/23") + 2386 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/24") + 2387 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/25") + 2388 # . epilogue + 2389 89/<- %esp 5/r32/ebp + 2390 5d/pop-to-ebp + 2391 c3/return + 2392 + 2393 test-convert-function-with-var-in-nested-block: + 2394 # . prologue + 2395 55/push-ebp + 2396 89/<- %ebp 4/r32/esp + 2397 # setup + 2398 (clear-stream _test-input-stream) + 2399 (clear-stream $_test-input-buffered-file->buffer) + 2400 (clear-stream _test-output-stream) + 2401 (clear-stream $_test-output-buffered-file->buffer) + 2402 # + 2403 (write _test-input-stream "fn foo x: int {\n") + 2404 (write _test-input-stream " {\n") + 2405 (write _test-input-stream " {\n") + 2406 (write _test-input-stream " var x: int\n") + 2407 (write _test-input-stream " increment x\n") + 2408 (write _test-input-stream " }\n") + 2409 (write _test-input-stream " }\n") + 2410 (write _test-input-stream "}\n") + 2411 # convert + 2412 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2413 (flush _test-output-buffered-file) + 2414 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2420 # check output + 2421 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") + 2422 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1") + 2423 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") + 2424 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") + 2425 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4") + 2426 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5") + 2427 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6") + 2428 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7") + 2429 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8") + 2430 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9") + 2431 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10") + 2432 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11") + 2433 (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") + 2434 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13") + 2435 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14") + 2436 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15") + 2437 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16") + 2438 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17") + 2439 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18") + 2440 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19") + 2441 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20") + 2442 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21") + 2443 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22") + 2444 # . epilogue + 2445 89/<- %esp 5/r32/ebp + 2446 5d/pop-to-ebp + 2447 c3/return + 2448 + 2449 test-convert-function-with-multiple-vars-in-nested-blocks: + 2450 # . prologue + 2451 55/push-ebp + 2452 89/<- %ebp 4/r32/esp + 2453 # setup + 2454 (clear-stream _test-input-stream) + 2455 (clear-stream $_test-input-buffered-file->buffer) + 2456 (clear-stream _test-output-stream) + 2457 (clear-stream $_test-output-buffered-file->buffer) + 2458 # + 2459 (write _test-input-stream "fn foo x: int {\n") + 2460 (write _test-input-stream " {\n") + 2461 (write _test-input-stream " var x/eax: int <- copy 0\n") + 2462 (write _test-input-stream " {\n") + 2463 (write _test-input-stream " var y: int\n") + 2464 (write _test-input-stream " x <- add y\n") + 2465 (write _test-input-stream " }\n") + 2466 (write _test-input-stream " }\n") + 2467 (write _test-input-stream "}\n") + 2468 # convert + 2469 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2470 (flush _test-output-buffered-file) + 2471 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2477 # check output + 2478 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0") + 2479 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1") + 2480 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2") + 2481 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3") + 2482 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4") + 2483 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5") + 2484 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6") + 2485 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7") + 2486 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8") + 2487 (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") + 2488 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10") + 2489 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11") + 2490 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12") + 2491 (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") + 2492 (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") + 2493 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15") + 2494 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16") + 2495 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17") + 2496 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18") + 2497 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19") + 2498 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20") + 2499 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21") + 2500 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22") + 2501 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23") + 2502 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24") + 2503 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25") + 2504 # . epilogue + 2505 89/<- %esp 5/r32/ebp + 2506 5d/pop-to-ebp + 2507 c3/return + 2508 + 2509 test-convert-function-with-branches-and-local-vars: + 2510 # A conditional 'break' after a 'var' in a block is converted into a + 2511 # nested block that performs all necessary cleanup before jumping. This + 2512 # results in some ugly code duplication. + 2513 # . prologue + 2514 55/push-ebp + 2515 89/<- %ebp 4/r32/esp + 2516 # setup + 2517 (clear-stream _test-input-stream) + 2518 (clear-stream $_test-input-buffered-file->buffer) + 2519 (clear-stream _test-output-stream) + 2520 (clear-stream $_test-output-buffered-file->buffer) + 2521 # + 2522 (write _test-input-stream "fn foo {\n") + 2523 (write _test-input-stream " {\n") + 2524 (write _test-input-stream " var x: int\n") + 2525 (write _test-input-stream " break-if->=\n") + 2526 (write _test-input-stream " increment x\n") + 2527 (write _test-input-stream " }\n") + 2528 (write _test-input-stream "}\n") + 2529 # convert + 2530 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2531 (flush _test-output-buffered-file) + 2532 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2538 # check output + 2539 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0") + 2540 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1") + 2541 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2") + 2542 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3") + 2543 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4") + 2544 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5") + 2545 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6") + 2546 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7") + 2547 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8") + 2548 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9") + 2549 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10") + 2550 (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") + 2551 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12") + 2552 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13") + 2553 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14") + 2554 (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") + 2555 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16") + 2556 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17") + 2557 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18") + 2558 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19") + 2559 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20") + 2560 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21") + 2561 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22") + 2562 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23") + 2563 # . epilogue + 2564 89/<- %esp 5/r32/ebp + 2565 5d/pop-to-ebp + 2566 c3/return + 2567 + 2568 test-convert-function-with-conditional-loops-and-local-vars: + 2569 # A conditional 'loop' after a 'var' in a block is converted into a nested + 2570 # block that performs all necessary cleanup before jumping. This results + 2571 # in some ugly code duplication. + 2572 # . prologue + 2573 55/push-ebp + 2574 89/<- %ebp 4/r32/esp + 2575 # setup + 2576 (clear-stream _test-input-stream) + 2577 (clear-stream $_test-input-buffered-file->buffer) + 2578 (clear-stream _test-output-stream) + 2579 (clear-stream $_test-output-buffered-file->buffer) + 2580 # + 2581 (write _test-input-stream "fn foo {\n") + 2582 (write _test-input-stream " {\n") + 2583 (write _test-input-stream " var x: int\n") + 2584 (write _test-input-stream " loop-if->=\n") + 2585 (write _test-input-stream " increment x\n") + 2586 (write _test-input-stream " }\n") + 2587 (write _test-input-stream "}\n") + 2588 # convert + 2589 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2590 (flush _test-output-buffered-file) + 2591 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2597 # check output + 2598 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0") + 2599 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1") + 2600 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2") + 2601 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3") + 2602 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4") + 2603 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5") + 2604 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6") + 2605 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7") + 2606 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8") + 2607 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9") + 2608 (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") + 2609 (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") + 2610 (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") + 2611 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13") + 2612 (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") + 2613 (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") + 2614 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16") + 2615 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17") + 2616 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18") + 2617 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19") + 2618 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20") + 2619 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21") + 2620 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22") + 2621 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23") + 2622 # . epilogue + 2623 89/<- %esp 5/r32/ebp + 2624 5d/pop-to-ebp + 2625 c3/return + 2626 + 2627 test-convert-function-with-unconditional-loops-and-local-vars: + 2628 # An unconditional 'loop' after a 'var' in a block is emitted _after_ the + 2629 # regular block cleanup. Any instructions after 'loop' are dead and + 2630 # therefore skipped. + 2631 # . prologue + 2632 55/push-ebp + 2633 89/<- %ebp 4/r32/esp + 2634 # setup + 2635 (clear-stream _test-input-stream) + 2636 (clear-stream $_test-input-buffered-file->buffer) + 2637 (clear-stream _test-output-stream) + 2638 (clear-stream $_test-output-buffered-file->buffer) + 2639 # + 2640 (write _test-input-stream "fn foo {\n") + 2641 (write _test-input-stream " {\n") + 2642 (write _test-input-stream " var x: int\n") + 2643 (write _test-input-stream " loop\n") + 2644 (write _test-input-stream " increment x\n") + 2645 (write _test-input-stream " }\n") + 2646 (write _test-input-stream "}\n") + 2647 # convert + 2648 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2649 (flush _test-output-buffered-file) + 2650 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2656 # check output + 2657 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0") + 2658 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1") + 2659 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2") + 2660 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3") + 2661 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4") + 2662 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5") + 2663 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6") + 2664 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7") + 2665 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8") + 2666 (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") + 2667 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10") + 2668 # not emitted: ff 0/subop/increment *(ebp+0xfffffffc) + 2669 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11") + 2670 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12") + 2671 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13") + 2672 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14") + 2673 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15") + 2674 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16") + 2675 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17") + 2676 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18") + 2677 # . epilogue + 2678 89/<- %esp 5/r32/ebp + 2679 5d/pop-to-ebp + 2680 c3/return + 2681 + 2682 test-convert-function-with-branches-and-loops-and-local-vars: + 2683 # . prologue + 2684 55/push-ebp + 2685 89/<- %ebp 4/r32/esp + 2686 # setup + 2687 (clear-stream _test-input-stream) + 2688 (clear-stream $_test-input-buffered-file->buffer) + 2689 (clear-stream _test-output-stream) + 2690 (clear-stream $_test-output-buffered-file->buffer) + 2691 # + 2692 (write _test-input-stream "fn foo {\n") + 2693 (write _test-input-stream " {\n") + 2694 (write _test-input-stream " var x: int\n") + 2695 (write _test-input-stream " break-if->=\n") + 2696 (write _test-input-stream " increment x\n") + 2697 (write _test-input-stream " loop\n") + 2698 (write _test-input-stream " }\n") + 2699 (write _test-input-stream "}\n") + 2700 # convert + 2701 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2702 (flush _test-output-buffered-file) + 2703 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2709 # check output + 2710 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0") + 2711 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1") + 2712 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2") + 2713 (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") + 2714 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4") + 2715 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5") + 2716 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6") + 2717 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7") + 2718 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8") + 2719 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9") + 2720 (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") + 2721 (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") + 2722 (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") + 2723 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13") + 2724 (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") + 2725 (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") + 2726 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16") + 2727 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17") + 2728 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18") + 2729 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19") + 2730 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20") + 2731 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21") + 2732 (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") + 2733 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23") + 2734 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24") + 2735 # . epilogue + 2736 89/<- %esp 5/r32/ebp + 2737 5d/pop-to-ebp + 2738 c3/return + 2739 + 2740 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars: + 2741 # . prologue + 2742 55/push-ebp + 2743 89/<- %ebp 4/r32/esp + 2744 # setup + 2745 (clear-stream _test-input-stream) + 2746 (clear-stream $_test-input-buffered-file->buffer) + 2747 (clear-stream _test-output-stream) + 2748 (clear-stream $_test-output-buffered-file->buffer) + 2749 # + 2750 (write _test-input-stream "fn foo {\n") + 2751 (write _test-input-stream " a: {\n") + 2752 (write _test-input-stream " var x: int\n") + 2753 (write _test-input-stream " {\n") + 2754 (write _test-input-stream " var y: int\n") + 2755 (write _test-input-stream " break-if->= a\n") + 2756 (write _test-input-stream " increment x\n") + 2757 (write _test-input-stream " loop\n") + 2758 (write _test-input-stream " }\n") + 2759 (write _test-input-stream " }\n") + 2760 (write _test-input-stream "}\n") + 2761 # convert + 2762 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2763 (flush _test-output-buffered-file) + 2764 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2770 # check output + 2771 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0") + 2772 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1") + 2773 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2") + 2774 (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") + 2775 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4") + 2776 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5") + 2777 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6") + 2778 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7") + 2779 (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") + 2780 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9") + 2781 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10") + 2782 (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") + 2783 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12") + 2784 (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") + 2785 (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") + 2786 (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") + 2787 (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") + 2788 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17") + 2789 (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") + 2790 (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") + 2791 (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") + 2792 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21") + 2793 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22") + 2794 (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") + 2795 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24") + 2796 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25") + 2797 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26") + 2798 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27") + 2799 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28") + 2800 (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") + 2801 (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") + 2802 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31") + 2803 # . epilogue + 2804 89/<- %esp 5/r32/ebp + 2805 5d/pop-to-ebp + 2806 c3/return + 2807 + 2808 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2: + 2809 # . prologue + 2810 55/push-ebp + 2811 89/<- %ebp 4/r32/esp + 2812 # setup + 2813 (clear-stream _test-input-stream) + 2814 (clear-stream $_test-input-buffered-file->buffer) + 2815 (clear-stream _test-output-stream) + 2816 (clear-stream $_test-output-buffered-file->buffer) + 2817 # non-local conditional branch from a block without a local variable, + 2818 # unwinding a local on the stack + 2819 (write _test-input-stream "fn foo {\n") + 2820 (write _test-input-stream " a: {\n") + 2821 (write _test-input-stream " var x: int\n") + 2822 (write _test-input-stream " {\n") + 2823 (write _test-input-stream " break-if->= a\n") + 2824 (write _test-input-stream " }\n") + 2825 (write _test-input-stream " }\n") + 2826 (write _test-input-stream "}\n") + 2827 # convert + 2828 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2829 (flush _test-output-buffered-file) + 2830 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2836 # check output + 2837 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/0") + 2838 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/1") + 2839 (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") + 2840 (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") + 2841 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/4") + 2842 (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") + 2843 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/6") + 2844 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/7") + 2845 (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") + 2846 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/9") + 2847 (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") + 2848 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/11") + 2849 (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") + 2850 (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") + 2851 (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") + 2852 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/15") + 2853 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/16") + 2854 (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") + 2855 (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") + 2856 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/19") + 2857 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/20") + 2858 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/21") + 2859 (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") + 2860 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/23") + 2861 (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") + 2862 (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") + 2863 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/26") + 2864 # . epilogue + 2865 89/<- %esp 5/r32/ebp + 2866 5d/pop-to-ebp + 2867 c3/return + 2868 + 2869 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3: + 2870 # . prologue + 2871 55/push-ebp + 2872 89/<- %ebp 4/r32/esp + 2873 # setup + 2874 (clear-stream _test-input-stream) + 2875 (clear-stream $_test-input-buffered-file->buffer) + 2876 (clear-stream _test-output-stream) + 2877 (clear-stream $_test-output-buffered-file->buffer) + 2878 # non-local unconditional branch from a block without a local variable, + 2879 # unwinding a local on the stack + 2880 (write _test-input-stream "fn foo {\n") + 2881 (write _test-input-stream " a: {\n") + 2882 (write _test-input-stream " var x: int\n") + 2883 (write _test-input-stream " {\n") + 2884 (write _test-input-stream " break a\n") + 2885 (write _test-input-stream " }\n") + 2886 (write _test-input-stream " }\n") + 2887 (write _test-input-stream "}\n") + 2888 # convert + 2889 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2890 (flush _test-output-buffered-file) + 2891 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 2897 # check output + 2898 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/0") + 2899 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/1") + 2900 (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") + 2901 (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") + 2902 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/4") + 2903 (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") + 2904 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/6") + 2905 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/7") + 2906 (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") + 2907 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/9") + 2908 (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") + 2909 (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") + 2910 (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") + 2911 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/14") + 2912 (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") + 2913 (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") + 2914 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/17") + 2915 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/18") + 2916 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/19") + 2917 (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") + 2918 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/21") + 2919 (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") + 2920 (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") + 2921 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/24") + 2922 # . epilogue + 2923 89/<- %esp 5/r32/ebp + 2924 5d/pop-to-ebp + 2925 c3/return + 2926 + 2927 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4: + 2928 # . prologue + 2929 55/push-ebp + 2930 89/<- %ebp 4/r32/esp + 2931 # setup + 2932 (clear-stream _test-input-stream) + 2933 (clear-stream $_test-input-buffered-file->buffer) + 2934 (clear-stream _test-output-stream) + 2935 (clear-stream $_test-output-buffered-file->buffer) + 2936 # + 2937 (write _test-input-stream "fn foo {\n") + 2938 (write _test-input-stream " a: {\n") + 2939 (write _test-input-stream " var x/esi: int <- copy 0\n") + 2940 (write _test-input-stream " {\n") + 2941 (write _test-input-stream " break a\n") + 2942 (write _test-input-stream " }\n") + 2943 (write _test-input-stream " }\n") 2944 (write _test-input-stream "}\n") 2945 # convert 2946 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) 2947 (flush _test-output-buffered-file) - 2948 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2948 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- 2954 # check output - 2955 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0") - 2956 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1") - 2957 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2") - 2958 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3") - 2959 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4") - 2960 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5") - 2961 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6") - 2962 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7") - 2963 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array/8") - 2964 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array/9") - 2965 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/10") - 2966 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/11") - 2967 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/12") - 2968 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/13") - 2969 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/14") - 2970 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/15") - 2971 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/16") - 2972 # . epilogue - 2973 89/<- %esp 5/r32/ebp - 2974 5d/pop-to-ebp - 2975 c3/return - 2976 - 2977 # special-case for size(byte) when computing array length - 2978 test-convert-length-of-array-of-bytes: - 2979 # . prologue - 2980 55/push-ebp - 2981 89/<- %ebp 4/r32/esp - 2982 # setup - 2983 (clear-stream _test-input-stream) - 2984 (clear-stream $_test-input-buffered-file->buffer) - 2985 (clear-stream _test-output-stream) - 2986 (clear-stream $_test-output-buffered-file->buffer) - 2987 # - 2988 (write _test-input-stream "fn foo a: (addr array byte) {\n") - 2989 (write _test-input-stream " var b/eax: (addr array byte) <- copy a\n") - 2990 (write _test-input-stream " var c/eax: int <- length b\n") - 2991 (write _test-input-stream "}\n") - 2992 # convert - 2993 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2994 (flush _test-output-buffered-file) - 2995 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3001 # check output - 3002 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-bytes/0") - 3003 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-bytes/1") - 3004 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-bytes/2") - 3005 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-bytes/3") - 3006 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-bytes/4") - 3007 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-bytes/5") - 3008 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-bytes/6") - 3009 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/7") - 3010 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/8") - 3011 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-bytes/9") - 3012 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-bytes/10") - 3013 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-bytes/11") - 3014 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-bytes/12") - 3015 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-bytes/13") - 3016 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-bytes/14") - 3017 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-bytes/15") - 3018 # . epilogue - 3019 89/<- %esp 5/r32/ebp - 3020 5d/pop-to-ebp - 3021 c3/return - 3022 - 3023 test-convert-length-of-array-on-stack: - 3024 # . prologue - 3025 55/push-ebp - 3026 89/<- %ebp 4/r32/esp - 3027 # setup - 3028 (clear-stream _test-input-stream) - 3029 (clear-stream $_test-input-buffered-file->buffer) - 3030 (clear-stream _test-output-stream) - 3031 (clear-stream $_test-output-buffered-file->buffer) - 3032 # - 3033 (write _test-input-stream "fn foo {\n") - 3034 (write _test-input-stream " var a: (array int 3)\n") - 3035 (write _test-input-stream " var b/eax: int <- length a\n") - 3036 (write _test-input-stream "}\n") - 3037 # convert - 3038 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3039 (flush _test-output-buffered-file) - 3040 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3046 # check output - 3047 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-on-stack/0") - 3048 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-on-stack/1") - 3049 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-on-stack/2") - 3050 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-on-stack/3") - 3051 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-on-stack/4") - 3052 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-on-stack/5") - 3053 # define x - 3054 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-length-of-array-on-stack/6") - 3055 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-length-of-array-on-stack/7") - 3056 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-on-stack/8") - 3057 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff0) 0x00000000/r32" "F - test-convert-length-of-array-on-stack/9") - 3058 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array-on-stack/10") - 3059 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-on-stack/11") - 3060 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-length-of-array-on-stack/12") - 3061 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-on-stack/13") - 3062 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-on-stack/14") - 3063 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-on-stack/15") - 3064 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-on-stack/16") - 3065 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-on-stack/17") - 3066 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-on-stack/18") - 3067 # . epilogue - 3068 89/<- %esp 5/r32/ebp - 3069 5d/pop-to-ebp - 3070 c3/return - 3071 - 3072 test-convert-index-into-array: - 3073 # . prologue - 3074 55/push-ebp - 3075 89/<- %ebp 4/r32/esp - 3076 # setup - 3077 (clear-stream _test-input-stream) - 3078 (clear-stream $_test-input-buffered-file->buffer) - 3079 (clear-stream _test-output-stream) - 3080 (clear-stream $_test-output-buffered-file->buffer) - 3081 # - 3082 (write _test-input-stream "fn foo {\n") - 3083 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 3084 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 3085 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") - 3086 (write _test-input-stream "}\n") - 3087 # convert - 3088 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3089 (flush _test-output-buffered-file) - 3090 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3096 # check output - 3097 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0") - 3098 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1") - 3099 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2") - 3100 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3") - 3101 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4") - 3102 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5") - 3103 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6") - 3104 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7") - 3105 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8") - 3106 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9") - 3107 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-convert-index-into-array/11") - 3108 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/13") - 3109 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/14") - 3110 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/15") - 3111 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/16") - 3112 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/17") - 3113 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/18") - 3114 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/19") - 3115 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/20") - 3116 # . epilogue - 3117 89/<- %esp 5/r32/ebp - 3118 5d/pop-to-ebp - 3119 c3/return - 3120 - 3121 test-convert-index-into-array-of-bytes: - 3122 # . prologue - 3123 55/push-ebp - 3124 89/<- %ebp 4/r32/esp - 3125 # setup - 3126 (clear-stream _test-input-stream) - 3127 (clear-stream $_test-input-buffered-file->buffer) - 3128 (clear-stream _test-output-stream) - 3129 (clear-stream $_test-output-buffered-file->buffer) - 3130 # - 3131 (write _test-input-stream "fn foo {\n") - 3132 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 3133 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 3134 (write _test-input-stream " var x/eax: (addr byte) <- index arr, idx\n") - 3135 (write _test-input-stream "}\n") - 3136 # convert - 3137 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3138 (flush _test-output-buffered-file) - 3139 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3145 # check output - 3146 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes/0") - 3147 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes/1") - 3148 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes/2") - 3149 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes/3") - 3150 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes/4") - 3151 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes/5") - 3152 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes/6") - 3153 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes/7") - 3154 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes/8") - 3155 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-of-bytes/9") - 3156 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000000 + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes/11") - 3157 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes/13") - 3158 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes/14") - 3159 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes/15") - 3160 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes/16") - 3161 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes/17") - 3162 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes/18") - 3163 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes/19") - 3164 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes/20") - 3165 # . epilogue - 3166 89/<- %esp 5/r32/ebp - 3167 5d/pop-to-ebp - 3168 c3/return - 3169 - 3170 test-convert-index-into-array-with-literal: - 3171 # . prologue - 3172 55/push-ebp - 3173 89/<- %ebp 4/r32/esp - 3174 # setup - 3175 (clear-stream _test-input-stream) - 3176 (clear-stream $_test-input-buffered-file->buffer) - 3177 (clear-stream _test-output-stream) - 3178 (clear-stream $_test-output-buffered-file->buffer) - 3179 # - 3180 (write _test-input-stream "fn foo {\n") - 3181 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 3182 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") - 3183 (write _test-input-stream "}\n") - 3184 # convert - 3185 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3186 (flush _test-output-buffered-file) - 3187 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3193 # check output - 3194 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-with-literal/0") - 3195 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-with-literal/1") - 3196 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-with-literal/2") - 3197 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-with-literal/3") - 3198 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-with-literal/4") - 3199 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5") - 3200 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6") - 3201 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7") - 3202 # 2 * 4 bytes/elem + 4 bytes for size = offset 12 - 3203 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/8") - 3204 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/9") - 3205 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/10") - 3206 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-with-literal/11") - 3207 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-with-literal/12") - 3208 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-with-literal/13") - 3209 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-with-literal/14") - 3210 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-with-literal/15") - 3211 # . epilogue - 3212 89/<- %esp 5/r32/ebp - 3213 5d/pop-to-ebp - 3214 c3/return - 3215 - 3216 test-convert-index-into-array-of-bytes-with-literal: - 3217 # . prologue - 3218 55/push-ebp - 3219 89/<- %ebp 4/r32/esp - 3220 # setup - 3221 (clear-stream _test-input-stream) - 3222 (clear-stream $_test-input-buffered-file->buffer) - 3223 (clear-stream _test-output-stream) - 3224 (clear-stream $_test-output-buffered-file->buffer) - 3225 # - 3226 (write _test-input-stream "fn foo {\n") - 3227 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 3228 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") - 3229 (write _test-input-stream "}\n") - 3230 # convert - 3231 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3232 (flush _test-output-buffered-file) - 3233 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3239 # check output - 3240 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-with-literal/0") - 3241 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-with-literal/1") - 3242 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/2") - 3243 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-with-literal/3") - 3244 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-with-literal/4") - 3245 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-with-literal/5") - 3246 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-with-literal/6") - 3247 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-with-literal/7") - 3248 # 2 * 1 byte/elem + 4 bytes for size = offset 6 - 3249 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000006) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-with-literal/8") - 3250 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-with-literal/9") - 3251 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-with-literal/10") - 3252 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-with-literal/11") - 3253 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-with-literal/12") - 3254 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-with-literal/13") - 3255 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/14") - 3256 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-with-literal/15") - 3257 # . epilogue - 3258 89/<- %esp 5/r32/ebp - 3259 5d/pop-to-ebp - 3260 c3/return - 3261 - 3262 test-convert-index-into-array-on-stack: - 3263 # . prologue - 3264 55/push-ebp - 3265 89/<- %ebp 4/r32/esp - 3266 # setup - 3267 (clear-stream _test-input-stream) - 3268 (clear-stream $_test-input-buffered-file->buffer) - 3269 (clear-stream _test-output-stream) - 3270 (clear-stream $_test-output-buffered-file->buffer) - 3271 # - 3272 (write _test-input-stream "fn foo {\n") - 3273 (write _test-input-stream " var arr: (array int 3)\n") - 3274 (write _test-input-stream " var idx/eax: int <- copy 2\n") - 3275 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") - 3276 (write _test-input-stream "}\n") - 3277 # convert - 3278 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3279 (flush _test-output-buffered-file) - 3280 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3286 # check output - 3287 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack/0") - 3288 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack/1") - 3289 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack/2") - 3290 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack/3") - 3291 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack/4") - 3292 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack/5") - 3293 # var arr - 3294 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack/6") - 3295 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack/7") - 3296 # var idx - 3297 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack/8") - 3298 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 2/imm32" "F - test-convert-index-into-array-on-stack/9") - 3299 # var x is at (ebp-0x10) + idx<<2 + 4 = ebp + idx<<2 - 0xc - 3300 (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") - 3301 # reclaim idx - 3302 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack/11") - 3303 # reclaim arr - 3304 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack/12") - 3305 # - 3306 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack/13") - 3307 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack/14") - 3308 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack/15") - 3309 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack/16") - 3310 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack/17") - 3311 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack/18") - 3312 # . epilogue - 3313 89/<- %esp 5/r32/ebp - 3314 5d/pop-to-ebp - 3315 c3/return - 3316 - 3317 test-convert-index-into-array-on-stack-with-literal: - 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 foo {\n") - 3328 (write _test-input-stream " var arr: (array int 3)\n") - 3329 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") - 3330 (write _test-input-stream "}\n") - 3331 # convert - 3332 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3333 (flush _test-output-buffered-file) - 3334 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3340 # check output - 3341 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack-with-literal/0") - 3342 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack-with-literal/1") - 3343 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack-with-literal/2") - 3344 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack-with-literal/3") - 3345 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack-with-literal/4") - 3346 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack-with-literal/5") - 3347 # var arr - 3348 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack-with-literal/6") - 3349 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack-with-literal/7") - 3350 # var x - 3351 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack-with-literal/8") - 3352 # x is at (ebp-0x10) + 4 + 2*4 = ebp-4 - 3353 (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") - 3354 # reclaim x - 3355 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack-with-literal/10") - 3356 # reclaim arr - 3357 (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") - 3358 # - 3359 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack-with-literal/12") - 3360 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack-with-literal/13") - 3361 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack-with-literal/14") - 3362 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack-with-literal/15") - 3363 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack-with-literal/16") - 3364 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack-with-literal/17") - 3365 # . epilogue - 3366 89/<- %esp 5/r32/ebp - 3367 5d/pop-to-ebp - 3368 c3/return - 3369 - 3370 test-convert-index-into-array-of-bytes-on-stack-with-literal: - 3371 # . prologue - 3372 55/push-ebp - 3373 89/<- %ebp 4/r32/esp - 3374 # setup - 3375 (clear-stream _test-input-stream) - 3376 (clear-stream $_test-input-buffered-file->buffer) - 3377 (clear-stream _test-output-stream) - 3378 (clear-stream $_test-output-buffered-file->buffer) - 3379 # - 3380 (write _test-input-stream "fn foo {\n") - 3381 (write _test-input-stream " var arr: (array byte 3)\n") - 3382 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") - 3383 (write _test-input-stream "}\n") - 3384 # convert - 3385 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3386 (flush _test-output-buffered-file) - 3387 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3393 # check output - 3394 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/0") - 3395 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/1") - 3396 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/2") - 3397 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/3") - 3398 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/4") - 3399 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/5") - 3400 # var arr - 3401 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x00000003)" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/6") - 3402 (check-next-stream-line-equal _test-output-stream " 68/push 0x00000003/imm32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/7") - 3403 # var x - 3404 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/8") - 3405 # x is at (ebp-7) + 4 + 2 = ebp-1 - 3406 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + 0xffffffff) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/9") - 3407 # reclaim x - 3408 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/10") - 3409 # reclaim arr - 3410 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000007/imm32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/11") - 3411 # - 3412 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/12") - 3413 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/13") - 3414 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/14") - 3415 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/15") - 3416 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/16") - 3417 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/17") - 3418 # . epilogue - 3419 89/<- %esp 5/r32/ebp - 3420 5d/pop-to-ebp - 3421 c3/return - 3422 - 3423 test-convert-index-into-array-using-offset: - 3424 # . prologue - 3425 55/push-ebp - 3426 89/<- %ebp 4/r32/esp - 3427 # setup - 3428 (clear-stream _test-input-stream) - 3429 (clear-stream $_test-input-buffered-file->buffer) - 3430 (clear-stream _test-output-stream) - 3431 (clear-stream $_test-output-buffered-file->buffer) - 3432 # - 3433 (write _test-input-stream "fn foo {\n") - 3434 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 3435 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 3436 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") - 3437 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") - 3438 (write _test-input-stream "}\n") - 3439 # convert - 3440 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3441 (flush _test-output-buffered-file) - 3442 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3448 # check output - 3449 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset/0") - 3450 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset/1") - 3451 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset/2") - 3452 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset/3") - 3453 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset/4") - 3454 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset/5") - 3455 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset/6") - 3456 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset/7") - 3457 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset/8") - 3458 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-using-offset/9") - 3459 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset/10") - 3460 (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") - 3461 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset/12") - 3462 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset/13") - 3463 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset/14") - 3464 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset/15") - 3465 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset/16") - 3466 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset/17") - 3467 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset/18") - 3468 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset/19") - 3469 # . epilogue - 3470 89/<- %esp 5/r32/ebp - 3471 5d/pop-to-ebp - 3472 c3/return - 3473 - 3474 test-convert-index-into-array-of-bytes-using-offset: - 3475 # . prologue - 3476 55/push-ebp - 3477 89/<- %ebp 4/r32/esp - 3478 # setup - 3479 (clear-stream _test-input-stream) - 3480 (clear-stream $_test-input-buffered-file->buffer) - 3481 (clear-stream _test-output-stream) - 3482 (clear-stream $_test-output-buffered-file->buffer) - 3483 # - 3484 (write _test-input-stream "fn foo {\n") - 3485 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 3486 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 3487 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") - 3488 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") - 3489 (write _test-input-stream "}\n") - 3490 # convert - 3491 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3492 (flush _test-output-buffered-file) - 3493 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3499 # check output - 3500 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset/0") - 3501 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset/1") - 3502 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/2") - 3503 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-using-offset/3") - 3504 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset/4") - 3505 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset/5") - 3506 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-using-offset/6") - 3507 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset/7") - 3508 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/8") - 3509 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-of-bytes-using-offset/9") - 3510 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000001/imm32 0x00000001/r32" "F - test-convert-index-into-array-of-bytes-using-offset/10") - 3511 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-using-offset/11") - 3512 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/12") - 3513 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-using-offset/13") - 3514 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset/14") - 3515 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset/15") - 3516 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset/16") - 3517 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-using-offset/17") - 3518 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/18") - 3519 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset/19") - 3520 # . epilogue - 3521 89/<- %esp 5/r32/ebp - 3522 5d/pop-to-ebp - 3523 c3/return - 3524 - 3525 test-convert-index-into-array-using-offset-on-stack: - 3526 # . prologue - 3527 55/push-ebp - 3528 89/<- %ebp 4/r32/esp - 3529 # setup - 3530 (clear-stream _test-input-stream) - 3531 (clear-stream $_test-input-buffered-file->buffer) - 3532 (clear-stream _test-output-stream) - 3533 (clear-stream $_test-output-buffered-file->buffer) - 3534 # - 3535 (write _test-input-stream "fn foo {\n") - 3536 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 3537 (write _test-input-stream " var idx: int\n") - 3538 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") - 3539 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") - 3540 (write _test-input-stream "}\n") - 3541 # convert - 3542 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3543 (flush _test-output-buffered-file) - 3544 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3550 # check output - 3551 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset-on-stack/0") - 3552 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset-on-stack/1") - 3553 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset-on-stack/2") - 3554 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset-on-stack/3") - 3555 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset-on-stack/4") - 3556 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset-on-stack/5") - 3557 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset-on-stack/6") - 3558 (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") - 3559 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/8") - 3560 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset-on-stack/9") - 3561 (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") - 3562 (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") - 3563 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset-on-stack/12") - 3564 (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") - 3565 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset-on-stack/14") - 3566 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset-on-stack/15") - 3567 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset-on-stack/16") - 3568 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset-on-stack/17") - 3569 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset-on-stack/18") - 3570 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset-on-stack/19") - 3571 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset-on-stack/20") - 3572 # . epilogue - 3573 89/<- %esp 5/r32/ebp - 3574 5d/pop-to-ebp - 3575 c3/return - 3576 - 3577 test-convert-index-into-array-of-bytes-using-offset-on-stack: - 3578 # . prologue - 3579 55/push-ebp - 3580 89/<- %ebp 4/r32/esp - 3581 # setup - 3582 (clear-stream _test-input-stream) - 3583 (clear-stream $_test-input-buffered-file->buffer) - 3584 (clear-stream _test-output-stream) - 3585 (clear-stream $_test-output-buffered-file->buffer) - 3586 # - 3587 (write _test-input-stream "fn foo {\n") - 3588 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 3589 (write _test-input-stream " var idx: int\n") - 3590 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") - 3591 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") - 3592 (write _test-input-stream "}\n") - 3593 # convert - 3594 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3595 (flush _test-output-buffered-file) - 3596 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3602 # check output - 3603 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/0") - 3604 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/1") - 3605 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/2") - 3606 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/3") - 3607 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/4") - 3608 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/5") - 3609 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/6") - 3610 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/7") - 3611 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/8") - 3612 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/9") - 3613 (check-next-stream-line-equal _test-output-stream " 69/multiply *(ebp+0xfffffff8) 0x00000001/imm32 0x00000001/r32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/10") - 3614 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/11") - 3615 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/12") - 3616 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/13") - 3617 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/14") - 3618 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/15") - 3619 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/16") - 3620 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/17") - 3621 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/18") - 3622 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/19") - 3623 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/20") - 3624 # . epilogue - 3625 89/<- %esp 5/r32/ebp - 3626 5d/pop-to-ebp - 3627 c3/return - 3628 - 3629 test-convert-function-and-type-definition: - 3630 # . prologue - 3631 55/push-ebp - 3632 89/<- %ebp 4/r32/esp - 3633 # setup - 3634 (clear-stream _test-input-stream) - 3635 (clear-stream $_test-input-buffered-file->buffer) - 3636 (clear-stream _test-output-stream) - 3637 (clear-stream $_test-output-buffered-file->buffer) - 3638 # - 3639 (write _test-input-stream "fn foo a: (addr t) {\n") - 3640 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n") - 3641 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n") - 3642 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n") - 3643 (write _test-input-stream "}\n") - 3644 (write _test-input-stream "type t {\n") - 3645 (write _test-input-stream " x: int\n") - 3646 (write _test-input-stream " y: int\n") - 3647 (write _test-input-stream "}\n") - 3648 # convert - 3649 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3650 (flush _test-output-buffered-file) - 3651 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3657 # check output - 3658 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0") - 3659 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1") - 3660 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2") - 3661 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3") - 3662 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4") - 3663 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5") - 3664 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6") - 3665 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7") - 3666 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8") - 3667 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9") - 3668 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11") - 3669 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13") - 3670 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14") - 3671 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15") - 3672 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16") - 3673 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17") - 3674 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18") - 3675 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19") - 3676 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20") - 3677 # . epilogue - 3678 89/<- %esp 5/r32/ebp - 3679 5d/pop-to-ebp - 3680 c3/return - 3681 - 3682 test-convert-function-with-local-var-with-user-defined-type: - 3683 # . prologue - 3684 55/push-ebp - 3685 89/<- %ebp 4/r32/esp - 3686 # setup - 3687 (clear-stream _test-input-stream) - 3688 (clear-stream $_test-input-buffered-file->buffer) - 3689 (clear-stream _test-output-stream) - 3690 (clear-stream $_test-output-buffered-file->buffer) - 3691 # - 3692 (write _test-input-stream "fn foo {\n") - 3693 (write _test-input-stream " var a: t\n") - 3694 (write _test-input-stream "}\n") - 3695 (write _test-input-stream "type t {\n") - 3696 (write _test-input-stream " x: int\n") - 3697 (write _test-input-stream " y: int\n") - 3698 (write _test-input-stream "}\n") - 3699 # convert - 3700 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3701 (flush _test-output-buffered-file) - 3702 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3708 # check output - 3709 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0") - 3710 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1") - 3711 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2") - 3712 (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") - 3713 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4") - 3714 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5") - 3715 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6") - 3716 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7") - 3717 (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") - 3718 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9") - 3719 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10") - 3720 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11") - 3721 (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") - 3722 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13") - 3723 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14") - 3724 # . epilogue - 3725 89/<- %esp 5/r32/ebp - 3726 5d/pop-to-ebp - 3727 c3/return - 3728 - 3729 test-convert-function-call-with-arg-of-user-defined-type: - 3730 # . prologue - 3731 55/push-ebp - 3732 89/<- %ebp 4/r32/esp - 3733 # setup - 3734 (clear-stream _test-input-stream) - 3735 (clear-stream $_test-input-buffered-file->buffer) - 3736 (clear-stream _test-output-stream) - 3737 (clear-stream $_test-output-buffered-file->buffer) - 3738 # - 3739 (write _test-input-stream "fn f {\n") - 3740 (write _test-input-stream " var a: t\n") - 3741 (write _test-input-stream " foo a\n") - 3742 (write _test-input-stream "}\n") - 3743 (write _test-input-stream "fn foo x: t {\n") - 3744 (write _test-input-stream "}\n") - 3745 (write _test-input-stream "type t {\n") - 3746 (write _test-input-stream " x: int\n") - 3747 (write _test-input-stream " y: int\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 "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") - 3760 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") - 3761 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") - 3762 (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") - 3763 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") - 3764 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") - 3765 # var a: t - 3766 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/6") - 3767 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7") - 3768 # foo a - 3769 (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") - 3770 # - 3771 (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") - 3772 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") - 3773 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") - 3774 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") - 3775 (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") - 3776 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") - 3777 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") - 3778 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") - 3779 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") - 3780 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") - 3781 (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") - 3782 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") - 3783 (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") - 3784 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") - 3785 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") - 3786 # . epilogue - 3787 89/<- %esp 5/r32/ebp - 3788 5d/pop-to-ebp - 3789 c3/return - 3790 - 3791 test-convert-function-call-with-arg-of-user-defined-type-register-indirect: - 3792 # . prologue - 3793 55/push-ebp - 3794 89/<- %ebp 4/r32/esp - 3795 # setup - 3796 (clear-stream _test-input-stream) - 3797 (clear-stream $_test-input-buffered-file->buffer) - 3798 (clear-stream _test-output-stream) - 3799 (clear-stream $_test-output-buffered-file->buffer) - 3800 # - 3801 (write _test-input-stream "fn f {\n") - 3802 (write _test-input-stream " var a/eax: (addr t) <- copy 0\n") - 3803 (write _test-input-stream " foo *a\n") - 3804 (write _test-input-stream "}\n") - 3805 (write _test-input-stream "fn foo x: t {\n") - 3806 (write _test-input-stream "}\n") - 3807 (write _test-input-stream "type t {\n") - 3808 (write _test-input-stream " x: int\n") - 3809 (write _test-input-stream " y: int\n") - 3810 (write _test-input-stream "}\n") - 3811 # convert - 3812 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3813 (flush _test-output-buffered-file) - 3814 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3820 # check output - 3821 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") - 3822 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") - 3823 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") - 3824 (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") - 3825 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") - 3826 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") - 3827 # var a - 3828 (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") - 3829 (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") - 3830 # foo a - 3831 (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") - 3832 # - 3833 (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") - 3834 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") - 3835 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") - 3836 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") - 3837 (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") - 3838 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") - 3839 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") - 3840 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") - 3841 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") - 3842 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") - 3843 (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") - 3844 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") - 3845 (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") - 3846 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") - 3847 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") - 3848 # . epilogue - 3849 89/<- %esp 5/r32/ebp - 3850 5d/pop-to-ebp - 3851 c3/return - 3852 - 3853 # we don't have special support for call-by-reference; just explicitly create - 3854 # a new variable with the address of the arg - 3855 test-convert-function-call-with-arg-of-user-defined-type-by-reference: - 3856 # . prologue - 3857 55/push-ebp - 3858 89/<- %ebp 4/r32/esp - 3859 # setup - 3860 (clear-stream _test-input-stream) - 3861 (clear-stream $_test-input-buffered-file->buffer) - 3862 (clear-stream _test-output-stream) - 3863 (clear-stream $_test-output-buffered-file->buffer) - 3864 # - 3865 (write _test-input-stream "fn f {\n") - 3866 (write _test-input-stream " var a: t\n") - 3867 (write _test-input-stream " var b/eax: (addr t) <- address a\n") - 3868 (write _test-input-stream " foo b\n") - 3869 (write _test-input-stream "}\n") - 3870 (write _test-input-stream "fn foo x: (addr t) {\n") - 3871 (write _test-input-stream " var x/ecx: (addr int) <- copy x\n") - 3872 (write _test-input-stream " increment *x\n") - 3873 (write _test-input-stream "}\n") - 3874 (write _test-input-stream "type t {\n") - 3875 (write _test-input-stream " x: int\n") - 3876 (write _test-input-stream " y: int\n") - 3877 (write _test-input-stream "}\n") - 3878 # convert - 3879 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3880 (flush _test-output-buffered-file) - 3881 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3887 # check output - 3888 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/0") - 3889 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/1") - 3890 (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") - 3891 (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") - 3892 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/4") - 3893 (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") - 3894 # var a: t - 3895 (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") - 3896 (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") - 3897 # var b/eax: (addr t) - 3898 (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") - 3899 (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") - 3900 # foo a - 3901 (check-next-stream-line-equal _test-output-stream " (foo %eax)" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/10") - 3902 # - 3903 (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") - 3904 (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") - 3905 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/13") - 3906 (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") - 3907 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/15") - 3908 (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") - 3909 (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") - 3910 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/18") - 3911 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/19") - 3912 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/20") - 3913 (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") - 3914 (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") - 3915 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/23") - 3916 (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") - 3917 (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") - 3918 (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") - 3919 (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") - 3920 (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") - 3921 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/29") - 3922 (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") - 3923 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/31") - 3924 (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") - 3925 (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") - 3926 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/34") - 3927 # . epilogue - 3928 89/<- %esp 5/r32/ebp - 3929 5d/pop-to-ebp - 3930 c3/return - 3931 - 3932 test-convert-get-on-local-variable: - 3933 # . prologue - 3934 55/push-ebp - 3935 89/<- %ebp 4/r32/esp - 3936 # setup - 3937 (clear-stream _test-input-stream) - 3938 (clear-stream $_test-input-buffered-file->buffer) - 3939 (clear-stream _test-output-stream) - 3940 (clear-stream $_test-output-buffered-file->buffer) - 3941 # - 3942 (write _test-input-stream "fn foo {\n") - 3943 (write _test-input-stream " var a: t\n") - 3944 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 3945 (write _test-input-stream "}\n") - 3946 (write _test-input-stream "type t {\n") - 3947 (write _test-input-stream " x: int\n") - 3948 (write _test-input-stream " y: int\n") - 3949 (write _test-input-stream "}\n") - 3950 # convert - 3951 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3952 (flush _test-output-buffered-file) - 3953 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3959 # check output - 3960 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-local-variable/0") - 3961 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-local-variable/1") - 3962 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-local-variable/2") - 3963 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-local-variable/3") - 3964 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-local-variable/4") - 3965 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-local-variable/5") - 3966 # var a - 3967 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/6") - 3968 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/7") - 3969 # var c - 3970 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-local-variable/8") - 3971 # get - 3972 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000001/r32" "F - test-convert-get-on-local-variable/9") - 3973 # reclaim c - 3974 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-local-variable/10") - 3975 # reclaim a - 3976 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-get-on-local-variable/11") - 3977 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-local-variable/12") - 3978 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-local-variable/13") - 3979 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-local-variable/14") - 3980 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-local-variable/15") - 3981 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-local-variable/16") - 3982 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-local-variable/17") - 3983 # . epilogue - 3984 89/<- %esp 5/r32/ebp - 3985 5d/pop-to-ebp - 3986 c3/return - 3987 - 3988 test-convert-get-on-function-argument: - 3989 # . prologue - 3990 55/push-ebp - 3991 89/<- %ebp 4/r32/esp - 3992 # setup - 3993 (clear-stream _test-input-stream) - 3994 (clear-stream $_test-input-buffered-file->buffer) - 3995 (clear-stream _test-output-stream) - 3996 (clear-stream $_test-output-buffered-file->buffer) - 3997 # - 3998 (write _test-input-stream "fn foo a: t {\n") - 3999 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 4000 (write _test-input-stream "}\n") - 4001 (write _test-input-stream "type t {\n") - 4002 (write _test-input-stream " x: int\n") - 4003 (write _test-input-stream " y: int\n") - 4004 (write _test-input-stream "}\n") - 4005 # convert - 4006 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4007 (flush _test-output-buffered-file) - 4008 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 4014 # check output - 4015 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument/0") - 4016 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument/1") - 4017 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument/2") - 4018 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument/3") - 4019 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument/4") - 4020 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument/5") - 4021 # var c - 4022 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument/6") - 4023 # get - 4024 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0x0000000c) 0x00000001/r32" "F - test-convert-get-on-function-argument/7") - 4025 # reclaim c - 4026 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument/8") - 4027 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument/9") - 4028 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument/10") - 4029 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument/11") - 4030 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument/12") - 4031 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument/13") - 4032 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument/14") - 4033 # . epilogue - 4034 89/<- %esp 5/r32/ebp - 4035 5d/pop-to-ebp - 4036 c3/return - 4037 - 4038 test-convert-get-on-function-argument-with-known-type: - 4039 # . prologue - 4040 55/push-ebp - 4041 89/<- %ebp 4/r32/esp - 4042 # setup - 4043 (clear-stream _test-input-stream) - 4044 (clear-stream $_test-input-buffered-file->buffer) - 4045 (clear-stream _test-output-stream) - 4046 (clear-stream $_test-output-buffered-file->buffer) - 4047 # - 4048 (write _test-input-stream "type t {\n") - 4049 (write _test-input-stream " x: int\n") - 4050 (write _test-input-stream " y: int\n") - 4051 (write _test-input-stream "}\n") - 4052 (write _test-input-stream "fn foo a: t {\n") - 4053 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 4054 (write _test-input-stream "}\n") - 4055 # convert - 4056 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4057 (flush _test-output-buffered-file) - 4058 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 4064 # check output - 4065 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument-with-known-type/0") - 4066 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument-with-known-type/1") - 4067 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument-with-known-type/2") - 4068 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument-with-known-type/3") - 4069 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument-with-known-type/4") - 4070 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument-with-known-type/5") - 4071 # var c - 4072 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument-with-known-type/6") - 4073 # get - 4074 (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") - 4075 # reclaim c - 4076 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument-with-known-type/8") - 4077 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument-with-known-type/9") - 4078 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument-with-known-type/10") - 4079 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument-with-known-type/11") - 4080 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument-with-known-type/12") - 4081 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument-with-known-type/13") - 4082 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument-with-known-type/14") - 4083 # . epilogue - 4084 89/<- %esp 5/r32/ebp - 4085 5d/pop-to-ebp - 4086 c3/return - 4087 - 4088 test-get-with-wrong-field: - 4089 # . prologue - 4090 55/push-ebp - 4091 89/<- %ebp 4/r32/esp - 4092 # setup - 4093 (clear-stream _test-input-stream) - 4094 (clear-stream $_test-input-buffered-file->buffer) - 4095 (clear-stream _test-output-stream) - 4096 (clear-stream $_test-output-buffered-file->buffer) - 4097 (clear-stream _test-error-stream) - 4098 (clear-stream $_test-error-buffered-file->buffer) - 4099 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 4100 68/push 0/imm32 - 4101 68/push 0/imm32 - 4102 89/<- %edx 4/r32/esp - 4103 (tailor-exit-descriptor %edx 0x10) - 4104 # - 4105 (write _test-input-stream "fn foo {\n") - 4106 (write _test-input-stream " var a: t\n") - 4107 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 4108 (write _test-input-stream "}\n") - 4109 (write _test-input-stream "type t {\n") - 4110 (write _test-input-stream " x: int\n") - 4111 (write _test-input-stream "}\n") - 4112 # convert - 4113 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 4114 # registers except esp clobbered at this point - 4115 # restore ed - 4116 89/<- %edx 4/r32/esp - 4117 (flush _test-output-buffered-file) - 4118 (flush _test-error-buffered-file) - 4119 +-- 6 lines: #? # dump _test-error-stream ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 4125 # check output - 4126 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-field: output should be empty") - 4127 (check-next-stream-line-equal _test-error-stream "type 't' has no member called 'y'" "F - test-get-with-wrong-field: error message") - 4128 # check that stop(1) was called - 4129 (check-ints-equal *(edx+4) 2 "F - test-var-in-mem-has-no-initializer: exit status") - 4130 # don't restore from ebp - 4131 81 0/subop/add %esp 8/imm32 - 4132 # . epilogue - 4133 5d/pop-to-ebp - 4134 c3/return - 4135 - 4136 test-convert-array-of-user-defined-types: - 4137 # . prologue - 4138 55/push-ebp - 4139 89/<- %ebp 4/r32/esp - 4140 # setup - 4141 (clear-stream _test-input-stream) - 4142 (clear-stream $_test-input-buffered-file->buffer) - 4143 (clear-stream _test-output-stream) - 4144 (clear-stream $_test-output-buffered-file->buffer) - 4145 # - 4146 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 - 4147 (write _test-input-stream " x: int\n") - 4148 (write _test-input-stream " y: int\n") - 4149 (write _test-input-stream "}\n") - 4150 (write _test-input-stream "fn foo {\n") - 4151 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 4152 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 4153 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") - 4154 (write _test-input-stream "}\n") - 4155 # convert - 4156 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4157 (flush _test-output-buffered-file) - 4158 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 4164 # check output - 4165 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-array-of-user-defined-types/0") - 4166 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-array-of-user-defined-types/1") - 4167 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-array-of-user-defined-types/2") - 4168 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-array-of-user-defined-types/3") - 4169 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-array-of-user-defined-types/4") - 4170 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-array-of-user-defined-types/5") - 4171 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-array-of-user-defined-types/6") - 4172 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-array-of-user-defined-types/7") - 4173 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-array-of-user-defined-types/8") - 4174 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-array-of-user-defined-types/9") - 4175 (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") - 4176 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-array-of-user-defined-types/13") - 4177 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-array-of-user-defined-types/14") - 4178 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-array-of-user-defined-types/15") - 4179 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-array-of-user-defined-types/16") - 4180 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-array-of-user-defined-types/17") - 4181 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-array-of-user-defined-types/18") - 4182 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-array-of-user-defined-types/19") - 4183 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-array-of-user-defined-types/20") - 4184 # . epilogue - 4185 89/<- %esp 5/r32/ebp - 4186 5d/pop-to-ebp - 4187 c3/return - 4188 - 4189 test-convert-length-of-array-of-user-defined-types-to-eax: - 4190 # . prologue - 4191 55/push-ebp - 4192 89/<- %ebp 4/r32/esp - 4193 # setup - 4194 (clear-stream _test-input-stream) - 4195 (clear-stream $_test-input-buffered-file->buffer) - 4196 (clear-stream _test-output-stream) - 4197 (clear-stream $_test-output-buffered-file->buffer) - 4198 # - 4199 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 - 4200 (write _test-input-stream " x: int\n") - 4201 (write _test-input-stream " y: int\n") - 4202 (write _test-input-stream " z: int\n") - 4203 (write _test-input-stream "}\n") - 4204 (write _test-input-stream "fn foo {\n") - 4205 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 4206 (write _test-input-stream " var x/eax: (addr t) <- length arr\n") - 4207 (write _test-input-stream "}\n") - 4208 # convert - 4209 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4210 (flush _test-output-buffered-file) - 4211 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 4217 # check output - 4218 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/0") - 4219 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/1") - 4220 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/2") - 4221 (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") - 4222 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-eax/4") - 4223 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/5") - 4224 # var arr - 4225 (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") - 4226 (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") - 4227 # length instruction - 4228 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/8") - 4229 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/9") - 4230 (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") - 4231 (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") - 4232 (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") - 4233 (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") - 4234 (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") - 4235 (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") - 4236 # reclaim arr - 4237 (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") + 2955 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/0") + 2956 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/1") + 2957 (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") + 2958 (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") + 2959 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/4") + 2960 (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") + 2961 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/6") + 2962 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/7") + 2963 (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") + 2964 (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") + 2965 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/10") + 2966 (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") + 2967 (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") + 2968 (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") + 2969 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/14") + 2970 (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") + 2971 (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") + 2972 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/17") + 2973 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/18") + 2974 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/19") + 2975 (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") + 2976 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/21") + 2977 (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") + 2978 (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") + 2979 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/24") + 2980 # . epilogue + 2981 89/<- %esp 5/r32/ebp + 2982 5d/pop-to-ebp + 2983 c3/return + 2984 + 2985 test-convert-function-with-nonlocal-unconditional-break-and-local-vars: + 2986 # . prologue + 2987 55/push-ebp + 2988 89/<- %ebp 4/r32/esp + 2989 # setup + 2990 (clear-stream _test-input-stream) + 2991 (clear-stream $_test-input-buffered-file->buffer) + 2992 (clear-stream _test-output-stream) + 2993 (clear-stream $_test-output-buffered-file->buffer) + 2994 # + 2995 (write _test-input-stream "fn foo {\n") + 2996 (write _test-input-stream " a: {\n") + 2997 (write _test-input-stream " var x: int\n") + 2998 (write _test-input-stream " {\n") + 2999 (write _test-input-stream " var y: int\n") + 3000 (write _test-input-stream " break a\n") + 3001 (write _test-input-stream " increment x\n") + 3002 (write _test-input-stream " }\n") + 3003 (write _test-input-stream " }\n") + 3004 (write _test-input-stream "}\n") + 3005 # convert + 3006 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3007 (flush _test-output-buffered-file) + 3008 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3014 # check output + 3015 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0") + 3016 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1") + 3017 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2") + 3018 (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") + 3019 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4") + 3020 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5") + 3021 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6") + 3022 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7") + 3023 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8") + 3024 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9") + 3025 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10") + 3026 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11") + 3027 (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") + 3028 (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") + 3029 (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") + 3030 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15") + 3031 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16") + 3032 (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") + 3033 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18") + 3034 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19") + 3035 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20") + 3036 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21") + 3037 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22") + 3038 (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") + 3039 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24") + 3040 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25") + 3041 # . epilogue + 3042 89/<- %esp 5/r32/ebp + 3043 5d/pop-to-ebp + 3044 c3/return + 3045 + 3046 test-convert-function-with-unconditional-break-and-local-vars: + 3047 # . prologue + 3048 55/push-ebp + 3049 89/<- %ebp 4/r32/esp + 3050 # setup + 3051 (clear-stream _test-input-stream) + 3052 (clear-stream $_test-input-buffered-file->buffer) + 3053 (clear-stream _test-output-stream) + 3054 (clear-stream $_test-output-buffered-file->buffer) + 3055 # + 3056 (write _test-input-stream "fn foo {\n") + 3057 (write _test-input-stream " {\n") + 3058 (write _test-input-stream " var x: int\n") + 3059 (write _test-input-stream " {\n") + 3060 (write _test-input-stream " var y: int\n") + 3061 (write _test-input-stream " break\n") + 3062 (write _test-input-stream " increment x\n") + 3063 (write _test-input-stream " }\n") + 3064 (write _test-input-stream " }\n") + 3065 (write _test-input-stream "}\n") + 3066 # convert + 3067 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3068 (flush _test-output-buffered-file) + 3069 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3075 # check output + 3076 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0") + 3077 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1") + 3078 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2") + 3079 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3") + 3080 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4") + 3081 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5") + 3082 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6") + 3083 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7") + 3084 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8") + 3085 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9") + 3086 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10") + 3087 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11") + 3088 (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") + 3089 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13") + 3090 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14") + 3091 (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") + 3092 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16") + 3093 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17") + 3094 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18") + 3095 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19") + 3096 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20") + 3097 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21") + 3098 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22") + 3099 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23") + 3100 # . epilogue + 3101 89/<- %esp 5/r32/ebp + 3102 5d/pop-to-ebp + 3103 c3/return + 3104 + 3105 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars: + 3106 # . prologue + 3107 55/push-ebp + 3108 89/<- %ebp 4/r32/esp + 3109 # setup + 3110 (clear-stream _test-input-stream) + 3111 (clear-stream $_test-input-buffered-file->buffer) + 3112 (clear-stream _test-output-stream) + 3113 (clear-stream $_test-output-buffered-file->buffer) + 3114 # + 3115 (write _test-input-stream "fn foo {\n") + 3116 (write _test-input-stream " a: {\n") + 3117 (write _test-input-stream " var x: int\n") + 3118 (write _test-input-stream " {\n") + 3119 (write _test-input-stream " var y: int\n") + 3120 (write _test-input-stream " loop a\n") + 3121 (write _test-input-stream " increment x\n") + 3122 (write _test-input-stream " }\n") + 3123 (write _test-input-stream " }\n") + 3124 (write _test-input-stream "}\n") + 3125 # convert + 3126 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3127 (flush _test-output-buffered-file) + 3128 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3134 # check output + 3135 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0") + 3136 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1") + 3137 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2") + 3138 (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") + 3139 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4") + 3140 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5") + 3141 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6") + 3142 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7") + 3143 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8") + 3144 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9") + 3145 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10") + 3146 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11") + 3147 (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") + 3148 (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") + 3149 (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") + 3150 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15") + 3151 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16") + 3152 (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") + 3153 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18") + 3154 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19") + 3155 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20") + 3156 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21") + 3157 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22") + 3158 (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") + 3159 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24") + 3160 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25") + 3161 # . epilogue + 3162 89/<- %esp 5/r32/ebp + 3163 5d/pop-to-ebp + 3164 c3/return + 3165 + 3166 test-convert-function-with-local-array-var-in-mem: + 3167 # . prologue + 3168 55/push-ebp + 3169 89/<- %ebp 4/r32/esp + 3170 # setup + 3171 (clear-stream _test-input-stream) + 3172 (clear-stream $_test-input-buffered-file->buffer) + 3173 (clear-stream _test-output-stream) + 3174 (clear-stream $_test-output-buffered-file->buffer) + 3175 # + 3176 (write _test-input-stream "fn foo {\n") + 3177 (write _test-input-stream " var x: (array int 3)\n") + 3178 (write _test-input-stream "}\n") + 3179 # convert + 3180 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3181 (flush _test-output-buffered-file) + 3182 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3188 # check output + 3189 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-var-in-mem/0") + 3190 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-var-in-mem/1") + 3191 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-var-in-mem/2") + 3192 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-var-in-mem/3") + 3193 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-var-in-mem/4") + 3194 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-var-in-mem/5") + 3195 # define x + 3196 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-function-with-local-array-var-in-mem/7") + 3197 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-function-with-local-array-var-in-mem/8") + 3198 # reclaim x + 3199 (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") + 3200 # + 3201 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-var-in-mem/10") + 3202 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-var-in-mem/11") + 3203 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-var-in-mem/12") + 3204 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-var-in-mem/13") + 3205 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-var-in-mem/14") + 3206 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-var-in-mem/15") + 3207 # . epilogue + 3208 89/<- %esp 5/r32/ebp + 3209 5d/pop-to-ebp + 3210 c3/return + 3211 + 3212 # special-case for size(byte) when allocating array + 3213 test-convert-function-with-local-array-of-bytes-in-mem: + 3214 # . prologue + 3215 55/push-ebp + 3216 89/<- %ebp 4/r32/esp + 3217 # setup + 3218 (clear-stream _test-input-stream) + 3219 (clear-stream $_test-input-buffered-file->buffer) + 3220 (clear-stream _test-output-stream) + 3221 (clear-stream $_test-output-buffered-file->buffer) + 3222 # + 3223 (write _test-input-stream "fn foo {\n") + 3224 (write _test-input-stream " var x: (array byte 3)\n") + 3225 (write _test-input-stream "}\n") + 3226 # convert + 3227 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3228 (flush _test-output-buffered-file) + 3229 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3235 # check output + 3236 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-of-bytes-in-mem/0") + 3237 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-of-bytes-in-mem/1") + 3238 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/2") + 3239 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-of-bytes-in-mem/3") + 3240 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-of-bytes-in-mem/4") + 3241 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-of-bytes-in-mem/5") + 3242 # define x + 3243 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x00000003)" "F - test-convert-function-with-local-array-of-bytes-in-mem/7") + 3244 (check-next-stream-line-equal _test-output-stream " 68/push 0x00000003/imm32" "F - test-convert-function-with-local-array-of-bytes-in-mem/8") + 3245 # reclaim x + 3246 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000007/imm32" "F - test-convert-function-with-local-array-of-bytes-in-mem/9") + 3247 # + 3248 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-of-bytes-in-mem/10") + 3249 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-of-bytes-in-mem/11") + 3250 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-of-bytes-in-mem/12") + 3251 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/13") + 3252 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/14") + 3253 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-of-bytes-in-mem/15") + 3254 # . epilogue + 3255 89/<- %esp 5/r32/ebp + 3256 5d/pop-to-ebp + 3257 c3/return + 3258 + 3259 test-convert-address: + 3260 # . prologue + 3261 55/push-ebp + 3262 89/<- %ebp 4/r32/esp + 3263 # setup + 3264 (clear-stream _test-input-stream) + 3265 (clear-stream $_test-input-buffered-file->buffer) + 3266 (clear-stream _test-output-stream) + 3267 (clear-stream $_test-output-buffered-file->buffer) + 3268 # + 3269 (write _test-input-stream "fn foo {\n") + 3270 (write _test-input-stream " var a: int\n") + 3271 (write _test-input-stream " var b/eax: (addr int) <- address a\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 "foo:" "F - test-convert-address/0") + 3284 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-address/1") + 3285 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-address/2") + 3286 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-address/3") + 3287 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-address/4") + 3288 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-address/5") + 3289 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-address/6") + 3290 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-address/7") + 3291 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-address/8") + 3292 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-address/9") + 3293 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-address/10") + 3294 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-address/11") + 3295 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-address/12") + 3296 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-address/13") + 3297 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-address/14") + 3298 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-address/15") + 3299 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-address/16") + 3300 # . epilogue + 3301 89/<- %esp 5/r32/ebp + 3302 5d/pop-to-ebp + 3303 c3/return + 3304 + 3305 test-convert-length-of-array: + 3306 # . prologue + 3307 55/push-ebp + 3308 89/<- %ebp 4/r32/esp + 3309 # setup + 3310 (clear-stream _test-input-stream) + 3311 (clear-stream $_test-input-buffered-file->buffer) + 3312 (clear-stream _test-output-stream) + 3313 (clear-stream $_test-output-buffered-file->buffer) + 3314 # + 3315 (write _test-input-stream "fn foo a: (addr array int) {\n") + 3316 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n") + 3317 (write _test-input-stream " var c/eax: int <- length b\n") + 3318 (write _test-input-stream "}\n") + 3319 # convert + 3320 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3321 (flush _test-output-buffered-file) + 3322 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3328 # check output + 3329 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0") + 3330 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1") + 3331 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2") + 3332 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3") + 3333 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4") + 3334 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5") + 3335 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6") + 3336 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7") + 3337 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array/8") + 3338 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array/9") + 3339 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/10") + 3340 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/11") + 3341 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/12") + 3342 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/13") + 3343 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/14") + 3344 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/15") + 3345 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/16") + 3346 # . epilogue + 3347 89/<- %esp 5/r32/ebp + 3348 5d/pop-to-ebp + 3349 c3/return + 3350 + 3351 # special-case for size(byte) when computing array length + 3352 test-convert-length-of-array-of-bytes: + 3353 # . prologue + 3354 55/push-ebp + 3355 89/<- %ebp 4/r32/esp + 3356 # setup + 3357 (clear-stream _test-input-stream) + 3358 (clear-stream $_test-input-buffered-file->buffer) + 3359 (clear-stream _test-output-stream) + 3360 (clear-stream $_test-output-buffered-file->buffer) + 3361 # + 3362 (write _test-input-stream "fn foo a: (addr array byte) {\n") + 3363 (write _test-input-stream " var b/eax: (addr array byte) <- copy a\n") + 3364 (write _test-input-stream " var c/eax: int <- length b\n") + 3365 (write _test-input-stream "}\n") + 3366 # convert + 3367 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3368 (flush _test-output-buffered-file) + 3369 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3375 # check output + 3376 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-bytes/0") + 3377 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-bytes/1") + 3378 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-bytes/2") + 3379 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-bytes/3") + 3380 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-bytes/4") + 3381 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-bytes/5") + 3382 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-bytes/6") + 3383 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/7") + 3384 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/8") + 3385 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-bytes/9") + 3386 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-bytes/10") + 3387 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-bytes/11") + 3388 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-bytes/12") + 3389 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-bytes/13") + 3390 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-bytes/14") + 3391 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-bytes/15") + 3392 # . epilogue + 3393 89/<- %esp 5/r32/ebp + 3394 5d/pop-to-ebp + 3395 c3/return + 3396 + 3397 test-convert-length-of-array-on-stack: + 3398 # . prologue + 3399 55/push-ebp + 3400 89/<- %ebp 4/r32/esp + 3401 # setup + 3402 (clear-stream _test-input-stream) + 3403 (clear-stream $_test-input-buffered-file->buffer) + 3404 (clear-stream _test-output-stream) + 3405 (clear-stream $_test-output-buffered-file->buffer) + 3406 # + 3407 (write _test-input-stream "fn foo {\n") + 3408 (write _test-input-stream " var a: (array int 3)\n") + 3409 (write _test-input-stream " var b/eax: int <- length a\n") + 3410 (write _test-input-stream "}\n") + 3411 # convert + 3412 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3413 (flush _test-output-buffered-file) + 3414 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3420 # check output + 3421 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-on-stack/0") + 3422 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-on-stack/1") + 3423 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-on-stack/2") + 3424 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-on-stack/3") + 3425 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-on-stack/4") + 3426 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-on-stack/5") + 3427 # define x + 3428 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-length-of-array-on-stack/6") + 3429 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-length-of-array-on-stack/7") + 3430 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-on-stack/8") + 3431 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff0) 0x00000000/r32" "F - test-convert-length-of-array-on-stack/9") + 3432 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array-on-stack/10") + 3433 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-on-stack/11") + 3434 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-length-of-array-on-stack/12") + 3435 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-on-stack/13") + 3436 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-on-stack/14") + 3437 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-on-stack/15") + 3438 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-on-stack/16") + 3439 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-on-stack/17") + 3440 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-on-stack/18") + 3441 # . epilogue + 3442 89/<- %esp 5/r32/ebp + 3443 5d/pop-to-ebp + 3444 c3/return + 3445 + 3446 test-convert-index-into-array: + 3447 # . prologue + 3448 55/push-ebp + 3449 89/<- %ebp 4/r32/esp + 3450 # setup + 3451 (clear-stream _test-input-stream) + 3452 (clear-stream $_test-input-buffered-file->buffer) + 3453 (clear-stream _test-output-stream) + 3454 (clear-stream $_test-output-buffered-file->buffer) + 3455 # + 3456 (write _test-input-stream "fn foo {\n") + 3457 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 3458 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 3459 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") + 3460 (write _test-input-stream "}\n") + 3461 # convert + 3462 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3463 (flush _test-output-buffered-file) + 3464 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3470 # check output + 3471 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0") + 3472 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1") + 3473 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2") + 3474 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3") + 3475 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4") + 3476 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5") + 3477 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6") + 3478 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7") + 3479 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8") + 3480 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9") + 3481 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-convert-index-into-array/11") + 3482 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/13") + 3483 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/14") + 3484 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/15") + 3485 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/16") + 3486 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/17") + 3487 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/18") + 3488 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/19") + 3489 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/20") + 3490 # . epilogue + 3491 89/<- %esp 5/r32/ebp + 3492 5d/pop-to-ebp + 3493 c3/return + 3494 + 3495 test-convert-index-into-array-of-bytes: + 3496 # . prologue + 3497 55/push-ebp + 3498 89/<- %ebp 4/r32/esp + 3499 # setup + 3500 (clear-stream _test-input-stream) + 3501 (clear-stream $_test-input-buffered-file->buffer) + 3502 (clear-stream _test-output-stream) + 3503 (clear-stream $_test-output-buffered-file->buffer) + 3504 # + 3505 (write _test-input-stream "fn foo {\n") + 3506 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 3507 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 3508 (write _test-input-stream " var x/eax: (addr byte) <- index arr, idx\n") + 3509 (write _test-input-stream "}\n") + 3510 # convert + 3511 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3512 (flush _test-output-buffered-file) + 3513 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3519 # check output + 3520 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes/0") + 3521 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes/1") + 3522 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes/2") + 3523 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes/3") + 3524 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes/4") + 3525 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes/5") + 3526 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes/6") + 3527 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes/7") + 3528 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes/8") + 3529 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-of-bytes/9") + 3530 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000000 + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes/11") + 3531 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes/13") + 3532 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes/14") + 3533 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes/15") + 3534 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes/16") + 3535 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes/17") + 3536 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes/18") + 3537 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes/19") + 3538 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes/20") + 3539 # . epilogue + 3540 89/<- %esp 5/r32/ebp + 3541 5d/pop-to-ebp + 3542 c3/return + 3543 + 3544 test-convert-index-into-array-with-literal: + 3545 # . prologue + 3546 55/push-ebp + 3547 89/<- %ebp 4/r32/esp + 3548 # setup + 3549 (clear-stream _test-input-stream) + 3550 (clear-stream $_test-input-buffered-file->buffer) + 3551 (clear-stream _test-output-stream) + 3552 (clear-stream $_test-output-buffered-file->buffer) + 3553 # + 3554 (write _test-input-stream "fn foo {\n") + 3555 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 3556 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") + 3557 (write _test-input-stream "}\n") + 3558 # convert + 3559 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3560 (flush _test-output-buffered-file) + 3561 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3567 # check output + 3568 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-with-literal/0") + 3569 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-with-literal/1") + 3570 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-with-literal/2") + 3571 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-with-literal/3") + 3572 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-with-literal/4") + 3573 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5") + 3574 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6") + 3575 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7") + 3576 # 2 * 4 bytes/elem + 4 bytes for size = offset 12 + 3577 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/8") + 3578 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/9") + 3579 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/10") + 3580 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-with-literal/11") + 3581 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-with-literal/12") + 3582 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-with-literal/13") + 3583 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-with-literal/14") + 3584 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-with-literal/15") + 3585 # . epilogue + 3586 89/<- %esp 5/r32/ebp + 3587 5d/pop-to-ebp + 3588 c3/return + 3589 + 3590 test-convert-index-into-array-of-bytes-with-literal: + 3591 # . prologue + 3592 55/push-ebp + 3593 89/<- %ebp 4/r32/esp + 3594 # setup + 3595 (clear-stream _test-input-stream) + 3596 (clear-stream $_test-input-buffered-file->buffer) + 3597 (clear-stream _test-output-stream) + 3598 (clear-stream $_test-output-buffered-file->buffer) + 3599 # + 3600 (write _test-input-stream "fn foo {\n") + 3601 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 3602 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") + 3603 (write _test-input-stream "}\n") + 3604 # convert + 3605 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3606 (flush _test-output-buffered-file) + 3607 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3613 # check output + 3614 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-with-literal/0") + 3615 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-with-literal/1") + 3616 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/2") + 3617 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-with-literal/3") + 3618 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-with-literal/4") + 3619 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-with-literal/5") + 3620 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-with-literal/6") + 3621 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-with-literal/7") + 3622 # 2 * 1 byte/elem + 4 bytes for size = offset 6 + 3623 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000006) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-with-literal/8") + 3624 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-with-literal/9") + 3625 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-with-literal/10") + 3626 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-with-literal/11") + 3627 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-with-literal/12") + 3628 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-with-literal/13") + 3629 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/14") + 3630 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-with-literal/15") + 3631 # . epilogue + 3632 89/<- %esp 5/r32/ebp + 3633 5d/pop-to-ebp + 3634 c3/return + 3635 + 3636 test-convert-index-into-array-on-stack: + 3637 # . prologue + 3638 55/push-ebp + 3639 89/<- %ebp 4/r32/esp + 3640 # setup + 3641 (clear-stream _test-input-stream) + 3642 (clear-stream $_test-input-buffered-file->buffer) + 3643 (clear-stream _test-output-stream) + 3644 (clear-stream $_test-output-buffered-file->buffer) + 3645 # + 3646 (write _test-input-stream "fn foo {\n") + 3647 (write _test-input-stream " var arr: (array int 3)\n") + 3648 (write _test-input-stream " var idx/eax: int <- copy 2\n") + 3649 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") + 3650 (write _test-input-stream "}\n") + 3651 # convert + 3652 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3653 (flush _test-output-buffered-file) + 3654 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3660 # check output + 3661 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack/0") + 3662 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack/1") + 3663 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack/2") + 3664 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack/3") + 3665 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack/4") + 3666 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack/5") + 3667 # var arr + 3668 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack/6") + 3669 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack/7") + 3670 # var idx + 3671 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack/8") + 3672 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 2/imm32" "F - test-convert-index-into-array-on-stack/9") + 3673 # var x is at (ebp-0x10) + idx<<2 + 4 = ebp + idx<<2 - 0xc + 3674 (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") + 3675 # reclaim idx + 3676 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack/11") + 3677 # reclaim arr + 3678 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack/12") + 3679 # + 3680 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack/13") + 3681 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack/14") + 3682 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack/15") + 3683 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack/16") + 3684 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack/17") + 3685 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack/18") + 3686 # . epilogue + 3687 89/<- %esp 5/r32/ebp + 3688 5d/pop-to-ebp + 3689 c3/return + 3690 + 3691 test-convert-index-into-array-on-stack-with-literal: + 3692 # . prologue + 3693 55/push-ebp + 3694 89/<- %ebp 4/r32/esp + 3695 # setup + 3696 (clear-stream _test-input-stream) + 3697 (clear-stream $_test-input-buffered-file->buffer) + 3698 (clear-stream _test-output-stream) + 3699 (clear-stream $_test-output-buffered-file->buffer) + 3700 # + 3701 (write _test-input-stream "fn foo {\n") + 3702 (write _test-input-stream " var arr: (array int 3)\n") + 3703 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") + 3704 (write _test-input-stream "}\n") + 3705 # convert + 3706 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3707 (flush _test-output-buffered-file) + 3708 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3714 # check output + 3715 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack-with-literal/0") + 3716 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack-with-literal/1") + 3717 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack-with-literal/2") + 3718 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack-with-literal/3") + 3719 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack-with-literal/4") + 3720 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack-with-literal/5") + 3721 # var arr + 3722 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack-with-literal/6") + 3723 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack-with-literal/7") + 3724 # var x + 3725 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack-with-literal/8") + 3726 # x is at (ebp-0x10) + 4 + 2*4 = ebp-4 + 3727 (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") + 3728 # reclaim x + 3729 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack-with-literal/10") + 3730 # reclaim arr + 3731 (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") + 3732 # + 3733 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack-with-literal/12") + 3734 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack-with-literal/13") + 3735 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack-with-literal/14") + 3736 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack-with-literal/15") + 3737 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack-with-literal/16") + 3738 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack-with-literal/17") + 3739 # . epilogue + 3740 89/<- %esp 5/r32/ebp + 3741 5d/pop-to-ebp + 3742 c3/return + 3743 + 3744 test-convert-index-into-array-of-bytes-on-stack-with-literal: + 3745 # . prologue + 3746 55/push-ebp + 3747 89/<- %ebp 4/r32/esp + 3748 # setup + 3749 (clear-stream _test-input-stream) + 3750 (clear-stream $_test-input-buffered-file->buffer) + 3751 (clear-stream _test-output-stream) + 3752 (clear-stream $_test-output-buffered-file->buffer) + 3753 # + 3754 (write _test-input-stream "fn foo {\n") + 3755 (write _test-input-stream " var arr: (array byte 3)\n") + 3756 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") + 3757 (write _test-input-stream "}\n") + 3758 # convert + 3759 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3760 (flush _test-output-buffered-file) + 3761 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3767 # check output + 3768 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/0") + 3769 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/1") + 3770 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/2") + 3771 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/3") + 3772 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/4") + 3773 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/5") + 3774 # var arr + 3775 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x00000003)" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/6") + 3776 (check-next-stream-line-equal _test-output-stream " 68/push 0x00000003/imm32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/7") + 3777 # var x + 3778 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/8") + 3779 # x is at (ebp-7) + 4 + 2 = ebp-1 + 3780 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + 0xffffffff) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/9") + 3781 # reclaim x + 3782 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/10") + 3783 # reclaim arr + 3784 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000007/imm32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/11") + 3785 # + 3786 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/12") + 3787 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/13") + 3788 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/14") + 3789 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/15") + 3790 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/16") + 3791 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/17") + 3792 # . epilogue + 3793 89/<- %esp 5/r32/ebp + 3794 5d/pop-to-ebp + 3795 c3/return + 3796 + 3797 test-convert-index-into-array-using-offset: + 3798 # . prologue + 3799 55/push-ebp + 3800 89/<- %ebp 4/r32/esp + 3801 # setup + 3802 (clear-stream _test-input-stream) + 3803 (clear-stream $_test-input-buffered-file->buffer) + 3804 (clear-stream _test-output-stream) + 3805 (clear-stream $_test-output-buffered-file->buffer) + 3806 # + 3807 (write _test-input-stream "fn foo {\n") + 3808 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 3809 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 3810 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") + 3811 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") + 3812 (write _test-input-stream "}\n") + 3813 # convert + 3814 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3815 (flush _test-output-buffered-file) + 3816 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3822 # check output + 3823 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset/0") + 3824 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset/1") + 3825 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset/2") + 3826 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset/3") + 3827 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset/4") + 3828 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset/5") + 3829 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset/6") + 3830 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset/7") + 3831 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset/8") + 3832 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-using-offset/9") + 3833 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset/10") + 3834 (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") + 3835 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset/12") + 3836 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset/13") + 3837 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset/14") + 3838 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset/15") + 3839 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset/16") + 3840 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset/17") + 3841 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset/18") + 3842 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset/19") + 3843 # . epilogue + 3844 89/<- %esp 5/r32/ebp + 3845 5d/pop-to-ebp + 3846 c3/return + 3847 + 3848 test-convert-index-into-array-of-bytes-using-offset: + 3849 # . prologue + 3850 55/push-ebp + 3851 89/<- %ebp 4/r32/esp + 3852 # setup + 3853 (clear-stream _test-input-stream) + 3854 (clear-stream $_test-input-buffered-file->buffer) + 3855 (clear-stream _test-output-stream) + 3856 (clear-stream $_test-output-buffered-file->buffer) + 3857 # + 3858 (write _test-input-stream "fn foo {\n") + 3859 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 3860 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 3861 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") + 3862 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") + 3863 (write _test-input-stream "}\n") + 3864 # convert + 3865 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3866 (flush _test-output-buffered-file) + 3867 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3873 # check output + 3874 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset/0") + 3875 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset/1") + 3876 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/2") + 3877 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-using-offset/3") + 3878 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset/4") + 3879 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset/5") + 3880 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-using-offset/6") + 3881 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset/7") + 3882 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/8") + 3883 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-of-bytes-using-offset/9") + 3884 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000001/imm32 0x00000001/r32" "F - test-convert-index-into-array-of-bytes-using-offset/10") + 3885 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-using-offset/11") + 3886 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/12") + 3887 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-using-offset/13") + 3888 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset/14") + 3889 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset/15") + 3890 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset/16") + 3891 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-using-offset/17") + 3892 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/18") + 3893 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset/19") + 3894 # . epilogue + 3895 89/<- %esp 5/r32/ebp + 3896 5d/pop-to-ebp + 3897 c3/return + 3898 + 3899 test-convert-index-into-array-using-offset-on-stack: + 3900 # . prologue + 3901 55/push-ebp + 3902 89/<- %ebp 4/r32/esp + 3903 # setup + 3904 (clear-stream _test-input-stream) + 3905 (clear-stream $_test-input-buffered-file->buffer) + 3906 (clear-stream _test-output-stream) + 3907 (clear-stream $_test-output-buffered-file->buffer) + 3908 # + 3909 (write _test-input-stream "fn foo {\n") + 3910 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 3911 (write _test-input-stream " var idx: int\n") + 3912 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") + 3913 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") + 3914 (write _test-input-stream "}\n") + 3915 # convert + 3916 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3917 (flush _test-output-buffered-file) + 3918 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3924 # check output + 3925 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset-on-stack/0") + 3926 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset-on-stack/1") + 3927 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset-on-stack/2") + 3928 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset-on-stack/3") + 3929 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset-on-stack/4") + 3930 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset-on-stack/5") + 3931 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset-on-stack/6") + 3932 (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") + 3933 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/8") + 3934 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset-on-stack/9") + 3935 (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") + 3936 (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") + 3937 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset-on-stack/12") + 3938 (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") + 3939 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset-on-stack/14") + 3940 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset-on-stack/15") + 3941 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset-on-stack/16") + 3942 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset-on-stack/17") + 3943 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset-on-stack/18") + 3944 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset-on-stack/19") + 3945 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset-on-stack/20") + 3946 # . epilogue + 3947 89/<- %esp 5/r32/ebp + 3948 5d/pop-to-ebp + 3949 c3/return + 3950 + 3951 test-convert-index-into-array-of-bytes-using-offset-on-stack: + 3952 # . prologue + 3953 55/push-ebp + 3954 89/<- %ebp 4/r32/esp + 3955 # setup + 3956 (clear-stream _test-input-stream) + 3957 (clear-stream $_test-input-buffered-file->buffer) + 3958 (clear-stream _test-output-stream) + 3959 (clear-stream $_test-output-buffered-file->buffer) + 3960 # + 3961 (write _test-input-stream "fn foo {\n") + 3962 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 3963 (write _test-input-stream " var idx: int\n") + 3964 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") + 3965 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") + 3966 (write _test-input-stream "}\n") + 3967 # convert + 3968 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3969 (flush _test-output-buffered-file) + 3970 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 3976 # check output + 3977 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/0") + 3978 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/1") + 3979 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/2") + 3980 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/3") + 3981 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/4") + 3982 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/5") + 3983 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/6") + 3984 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/7") + 3985 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/8") + 3986 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/9") + 3987 (check-next-stream-line-equal _test-output-stream " 69/multiply *(ebp+0xfffffff8) 0x00000001/imm32 0x00000001/r32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/10") + 3988 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/11") + 3989 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/12") + 3990 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/13") + 3991 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/14") + 3992 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/15") + 3993 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/16") + 3994 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/17") + 3995 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/18") + 3996 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/19") + 3997 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/20") + 3998 # . epilogue + 3999 89/<- %esp 5/r32/ebp + 4000 5d/pop-to-ebp + 4001 c3/return + 4002 + 4003 test-convert-function-and-type-definition: + 4004 # . prologue + 4005 55/push-ebp + 4006 89/<- %ebp 4/r32/esp + 4007 # setup + 4008 (clear-stream _test-input-stream) + 4009 (clear-stream $_test-input-buffered-file->buffer) + 4010 (clear-stream _test-output-stream) + 4011 (clear-stream $_test-output-buffered-file->buffer) + 4012 # + 4013 (write _test-input-stream "fn foo a: (addr t) {\n") + 4014 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n") + 4015 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n") + 4016 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n") + 4017 (write _test-input-stream "}\n") + 4018 (write _test-input-stream "type t {\n") + 4019 (write _test-input-stream " x: int\n") + 4020 (write _test-input-stream " y: int\n") + 4021 (write _test-input-stream "}\n") + 4022 # convert + 4023 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4024 (flush _test-output-buffered-file) + 4025 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4031 # check output + 4032 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0") + 4033 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1") + 4034 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2") + 4035 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3") + 4036 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4") + 4037 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5") + 4038 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6") + 4039 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7") + 4040 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8") + 4041 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9") + 4042 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11") + 4043 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13") + 4044 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14") + 4045 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15") + 4046 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16") + 4047 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17") + 4048 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18") + 4049 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19") + 4050 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20") + 4051 # . epilogue + 4052 89/<- %esp 5/r32/ebp + 4053 5d/pop-to-ebp + 4054 c3/return + 4055 + 4056 test-convert-function-with-local-var-with-user-defined-type: + 4057 # . prologue + 4058 55/push-ebp + 4059 89/<- %ebp 4/r32/esp + 4060 # setup + 4061 (clear-stream _test-input-stream) + 4062 (clear-stream $_test-input-buffered-file->buffer) + 4063 (clear-stream _test-output-stream) + 4064 (clear-stream $_test-output-buffered-file->buffer) + 4065 # + 4066 (write _test-input-stream "fn foo {\n") + 4067 (write _test-input-stream " var a: t\n") + 4068 (write _test-input-stream "}\n") + 4069 (write _test-input-stream "type t {\n") + 4070 (write _test-input-stream " x: int\n") + 4071 (write _test-input-stream " y: int\n") + 4072 (write _test-input-stream "}\n") + 4073 # convert + 4074 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4075 (flush _test-output-buffered-file) + 4076 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4082 # check output + 4083 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0") + 4084 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1") + 4085 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2") + 4086 (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") + 4087 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4") + 4088 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5") + 4089 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6") + 4090 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7") + 4091 (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") + 4092 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9") + 4093 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10") + 4094 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11") + 4095 (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") + 4096 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13") + 4097 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14") + 4098 # . epilogue + 4099 89/<- %esp 5/r32/ebp + 4100 5d/pop-to-ebp + 4101 c3/return + 4102 + 4103 test-convert-function-call-with-arg-of-user-defined-type: + 4104 # . prologue + 4105 55/push-ebp + 4106 89/<- %ebp 4/r32/esp + 4107 # setup + 4108 (clear-stream _test-input-stream) + 4109 (clear-stream $_test-input-buffered-file->buffer) + 4110 (clear-stream _test-output-stream) + 4111 (clear-stream $_test-output-buffered-file->buffer) + 4112 # + 4113 (write _test-input-stream "fn f {\n") + 4114 (write _test-input-stream " var a: t\n") + 4115 (write _test-input-stream " foo a\n") + 4116 (write _test-input-stream "}\n") + 4117 (write _test-input-stream "fn foo x: t {\n") + 4118 (write _test-input-stream "}\n") + 4119 (write _test-input-stream "type t {\n") + 4120 (write _test-input-stream " x: int\n") + 4121 (write _test-input-stream " y: int\n") + 4122 (write _test-input-stream "}\n") + 4123 # convert + 4124 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4125 (flush _test-output-buffered-file) + 4126 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4132 # check output + 4133 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") + 4134 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") + 4135 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") + 4136 (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") + 4137 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") + 4138 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") + 4139 # var a: t + 4140 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/6") + 4141 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7") + 4142 # foo a + 4143 (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") + 4144 # + 4145 (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") + 4146 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") + 4147 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") + 4148 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") + 4149 (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") + 4150 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") + 4151 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") + 4152 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") + 4153 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") + 4154 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") + 4155 (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") + 4156 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") + 4157 (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") + 4158 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") + 4159 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") + 4160 # . epilogue + 4161 89/<- %esp 5/r32/ebp + 4162 5d/pop-to-ebp + 4163 c3/return + 4164 + 4165 test-convert-function-call-with-arg-of-user-defined-type-register-indirect: + 4166 # . prologue + 4167 55/push-ebp + 4168 89/<- %ebp 4/r32/esp + 4169 # setup + 4170 (clear-stream _test-input-stream) + 4171 (clear-stream $_test-input-buffered-file->buffer) + 4172 (clear-stream _test-output-stream) + 4173 (clear-stream $_test-output-buffered-file->buffer) + 4174 # + 4175 (write _test-input-stream "fn f {\n") + 4176 (write _test-input-stream " var a/eax: (addr t) <- copy 0\n") + 4177 (write _test-input-stream " foo *a\n") + 4178 (write _test-input-stream "}\n") + 4179 (write _test-input-stream "fn foo x: t {\n") + 4180 (write _test-input-stream "}\n") + 4181 (write _test-input-stream "type t {\n") + 4182 (write _test-input-stream " x: int\n") + 4183 (write _test-input-stream " y: int\n") + 4184 (write _test-input-stream "}\n") + 4185 # convert + 4186 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4187 (flush _test-output-buffered-file) + 4188 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4194 # check output + 4195 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") + 4196 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") + 4197 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") + 4198 (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") + 4199 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") + 4200 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") + 4201 # var a + 4202 (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") + 4203 (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") + 4204 # foo a + 4205 (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") + 4206 # + 4207 (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") + 4208 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") + 4209 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") + 4210 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") + 4211 (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") + 4212 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") + 4213 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") + 4214 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") + 4215 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") + 4216 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") + 4217 (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") + 4218 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") + 4219 (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") + 4220 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") + 4221 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") + 4222 # . epilogue + 4223 89/<- %esp 5/r32/ebp + 4224 5d/pop-to-ebp + 4225 c3/return + 4226 + 4227 # we don't have special support for call-by-reference; just explicitly create + 4228 # a new variable with the address of the arg + 4229 test-convert-function-call-with-arg-of-user-defined-type-by-reference: + 4230 # . prologue + 4231 55/push-ebp + 4232 89/<- %ebp 4/r32/esp + 4233 # setup + 4234 (clear-stream _test-input-stream) + 4235 (clear-stream $_test-input-buffered-file->buffer) + 4236 (clear-stream _test-output-stream) + 4237 (clear-stream $_test-output-buffered-file->buffer) 4238 # - 4239 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-eax/17") - 4240 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/18") - 4241 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/19") - 4242 (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") - 4243 (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") - 4244 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-eax/22") - 4245 # . epilogue - 4246 89/<- %esp 5/r32/ebp - 4247 5d/pop-to-ebp - 4248 c3/return - 4249 - 4250 test-convert-length-of-array-of-user-defined-types-to-ecx: - 4251 # . prologue - 4252 55/push-ebp - 4253 89/<- %ebp 4/r32/esp - 4254 # setup - 4255 (clear-stream _test-input-stream) - 4256 (clear-stream $_test-input-buffered-file->buffer) - 4257 (clear-stream _test-output-stream) - 4258 (clear-stream $_test-output-buffered-file->buffer) - 4259 # - 4260 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 - 4261 (write _test-input-stream " x: int\n") - 4262 (write _test-input-stream " y: int\n") - 4263 (write _test-input-stream " z: int\n") - 4264 (write _test-input-stream "}\n") - 4265 (write _test-input-stream "fn foo {\n") - 4266 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 4267 (write _test-input-stream " var x/ecx: (addr t) <- length arr\n") - 4268 (write _test-input-stream "}\n") - 4269 # convert - 4270 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4271 (flush _test-output-buffered-file) - 4272 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 4278 # check output - 4279 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/0") - 4280 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/1") - 4281 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/2") - 4282 (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") - 4283 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/4") - 4284 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/5") - 4285 # var a - 4286 (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") - 4287 (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") - 4288 # var x - 4289 (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") - 4290 # length instruction - 4291 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/9") - 4292 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/10") - 4293 (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") - 4294 (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") - 4295 (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") - 4296 (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") - 4297 (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") - 4298 (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") - 4299 (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") - 4300 # reclaim x - 4301 (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") - 4302 # reclaim a - 4303 (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") - 4304 # - 4305 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/20") - 4306 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/21") - 4307 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/22") - 4308 (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") - 4309 (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") - 4310 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/25") - 4311 # . epilogue - 4312 89/<- %esp 5/r32/ebp - 4313 5d/pop-to-ebp - 4314 c3/return - 4315 - 4316 test-convert-length-of-array-of-user-defined-types-to-edx: - 4317 # . prologue - 4318 55/push-ebp - 4319 89/<- %ebp 4/r32/esp - 4320 # setup - 4321 (clear-stream _test-input-stream) - 4322 (clear-stream $_test-input-buffered-file->buffer) - 4323 (clear-stream _test-output-stream) - 4324 (clear-stream $_test-output-buffered-file->buffer) - 4325 # - 4326 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 - 4327 (write _test-input-stream " x: int\n") - 4328 (write _test-input-stream " y: int\n") - 4329 (write _test-input-stream " z: int\n") - 4330 (write _test-input-stream "}\n") - 4331 (write _test-input-stream "fn foo {\n") - 4332 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 4333 (write _test-input-stream " var x/edx: (addr t) <- length arr\n") - 4334 (write _test-input-stream "}\n") - 4335 # convert - 4336 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4337 (flush _test-output-buffered-file) - 4338 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 4344 # check output - 4345 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/0") - 4346 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/1") - 4347 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/2") - 4348 (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") - 4349 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-edx/4") - 4350 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/5") - 4351 # var a - 4352 (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") - 4353 (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") - 4354 # var x - 4355 (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") - 4356 # length instruction - 4357 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/9") - 4358 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/10") - 4359 (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") - 4360 (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") - 4361 (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") - 4362 (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") - 4363 (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") - 4364 (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") - 4365 (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") - 4366 # reclaim x - 4367 (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") - 4368 # reclaim a - 4369 (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") - 4370 # - 4371 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-edx/20") - 4372 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/21") - 4373 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/22") - 4374 (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") - 4375 (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") - 4376 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-edx/25") - 4377 # . epilogue - 4378 89/<- %esp 5/r32/ebp - 4379 5d/pop-to-ebp - 4380 c3/return - 4381 - 4382 test-convert-length-of-array-of-user-defined-types: - 4383 # . prologue - 4384 55/push-ebp - 4385 89/<- %ebp 4/r32/esp - 4386 # setup - 4387 (clear-stream _test-input-stream) - 4388 (clear-stream $_test-input-buffered-file->buffer) - 4389 (clear-stream _test-output-stream) - 4390 (clear-stream $_test-output-buffered-file->buffer) - 4391 # - 4392 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 - 4393 (write _test-input-stream " x: int\n") - 4394 (write _test-input-stream " y: int\n") - 4395 (write _test-input-stream " z: int\n") - 4396 (write _test-input-stream "}\n") - 4397 (write _test-input-stream "fn foo {\n") - 4398 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 4399 (write _test-input-stream " var x/ebx: (addr t) <- length arr\n") - 4400 (write _test-input-stream "}\n") - 4401 # convert - 4402 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4403 (flush _test-output-buffered-file) - 4404 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 4410 # check output - 4411 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types/0") - 4412 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types/1") - 4413 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types/2") - 4414 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types/3") - 4415 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types/4") - 4416 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types/5") - 4417 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types/6") - 4418 (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") - 4419 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-length-of-array-of-user-defined-types/8") - 4420 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types/9") - 4421 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types/10") - 4422 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types/11") - 4423 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types/12") - 4424 (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") - 4425 (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") - 4426 (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") - 4427 (check-next-stream-line-equal _test-output-stream " 89/<- %ebx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types/16") - 4428 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types/17") - 4429 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types/18") - 4430 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types/19") - 4431 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ebx" "F - test-convert-length-of-array-of-user-defined-types/20") - 4432 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types/21") - 4433 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types/22") - 4434 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types/23") - 4435 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types/24") - 4436 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types/25") - 4437 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types/26") - 4438 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types/27") - 4439 # . epilogue - 4440 89/<- %esp 5/r32/ebp - 4441 5d/pop-to-ebp - 4442 c3/return - 4443 - 4444 ####################################################### - 4445 # Parsing - 4446 ####################################################### - 4447 - 4448 parse-mu: # in: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) - 4449 # pseudocode - 4450 # var curr-function: (addr handle function) = Program->functions - 4451 # var curr-type: (addr handle typeinfo) = Program->types - 4452 # var line: (stream byte 512) - 4453 # var word-slice: slice - 4454 # while true # line loop - 4455 # clear-stream(line) - 4456 # read-line-buffered(in, line) - 4457 # if (line->write == 0) break # end of file - 4458 # word-slice = next-mu-token(line) - 4459 # if slice-empty?(word-slice) # end of line - 4460 # continue - 4461 # else if slice-starts-with?(word-slice, "#") # comment - 4462 # continue # end of line - 4463 # else if slice-equal?(word-slice, "fn") - 4464 # var new-function: (handle function) = allocate(function) - 4465 # var vars: (stack live-var 256) - 4466 # populate-mu-function-header(line, new-function, vars) - 4467 # populate-mu-function-body(in, new-function, vars) - 4468 # assert(vars->top == 0) - 4469 # *curr-function = new-function - 4470 # curr-function = &new-function->next - 4471 # else if slice-equal?(word-slice, "type") - 4472 # word-slice = next-mu-token(line) - 4473 # type-id = pos-or-insert-slice(Type-id, word-slice) - 4474 # var new-type: (handle typeinfo) = find-or-create-typeinfo(type-id) - 4475 # assert(next-word(line) == "{") - 4476 # populate-mu-type(in, new-type) - 4477 # else - 4478 # abort() - 4479 # - 4480 # . prologue - 4481 55/push-ebp - 4482 89/<- %ebp 4/r32/esp - 4483 # . save registers - 4484 50/push-eax - 4485 51/push-ecx - 4486 52/push-edx - 4487 53/push-ebx - 4488 56/push-esi - 4489 57/push-edi - 4490 # var line/ecx: (stream byte 512) - 4491 81 5/subop/subtract %esp 0x200/imm32 - 4492 68/push 0x200/imm32/size - 4493 68/push 0/imm32/read - 4494 68/push 0/imm32/write - 4495 89/<- %ecx 4/r32/esp - 4496 # var word-slice/edx: slice - 4497 68/push 0/imm32/end - 4498 68/push 0/imm32/start - 4499 89/<- %edx 4/r32/esp - 4500 # var curr-function/edi: (addr handle function) - 4501 bf/copy-to-edi _Program-functions/imm32 - 4502 # var vars/ebx: (stack live-var 256) - 4503 81 5/subop/subtract %esp 0xc00/imm32 - 4504 68/push 0xc00/imm32/size - 4505 68/push 0/imm32/top - 4506 89/<- %ebx 4/r32/esp - 4507 { - 4508 $parse-mu:line-loop: - 4509 (clear-stream %ecx) - 4510 (read-line-buffered *(ebp+8) %ecx) - 4511 # if (line->write == 0) break - 4512 81 7/subop/compare *ecx 0/imm32 - 4513 0f 84/jump-if-= break/disp32 - 4514 +-- 6 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 4520 (next-mu-token %ecx %edx) - 4521 # if slice-empty?(word-slice) continue - 4522 (slice-empty? %edx) # => eax - 4523 3d/compare-eax-and 0/imm32/false - 4524 0f 85/jump-if-!= loop/disp32 - 4525 # if (*word-slice->start == "#") continue - 4526 # . eax = *word-slice->start - 4527 8b/-> *edx 0/r32/eax - 4528 8a/copy-byte *eax 0/r32/AL - 4529 81 4/subop/and %eax 0xff/imm32 - 4530 # . if (eax == '#') continue - 4531 3d/compare-eax-and 0x23/imm32/hash - 4532 0f 84/jump-if-= loop/disp32 - 4533 # if (slice-equal?(word-slice, "fn")) parse a function - 4534 { - 4535 $parse-mu:fn: - 4536 (slice-equal? %edx "fn") # => eax - 4537 3d/compare-eax-and 0/imm32/false - 4538 0f 84/jump-if-= break/disp32 - 4539 # var new-function/esi: (handle function) - 4540 68/push 0/imm32 - 4541 68/push 0/imm32 - 4542 89/<- %esi 4/r32/esp - 4543 # populate-mu-function(line, in, vars, new-function) - 4544 (allocate Heap *Function-size %esi) - 4545 # var new-function-addr/eax: (addr function) - 4546 (lookup *esi *(esi+4)) # => eax - 4547 (clear-stack %ebx) - 4548 (populate-mu-function-header %ecx %eax %ebx *(ebp+0xc) *(ebp+0x10)) - 4549 (populate-mu-function-body *(ebp+8) %eax %ebx *(ebp+0xc) *(ebp+0x10)) - 4550 # *curr-function = new-function - 4551 8b/-> *esi 0/r32/eax - 4552 89/<- *edi 0/r32/eax - 4553 8b/-> *(esi+4) 0/r32/eax - 4554 89/<- *(edi+4) 0/r32/eax - 4555 # curr-function = &new-function->next - 4556 # . var tmp/eax: (addr function) = lookup(new-function) - 4557 (lookup *esi *(esi+4)) # => eax - 4558 # . curr-function = &tmp->next - 4559 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next - 4560 # reclaim new-function - 4561 81 0/subop/add %esp 8/imm32 - 4562 # - 4563 e9/jump $parse-mu:line-loop/disp32 - 4564 } - 4565 # if (slice-equal?(word-slice, "type")) parse a type (struct/record) definition - 4566 { - 4567 $parse-mu:type: - 4568 (slice-equal? %edx "type") # => eax - 4569 3d/compare-eax-and 0/imm32 - 4570 0f 84/jump-if-= break/disp32 - 4571 (next-mu-token %ecx %edx) - 4572 # var type-id/eax: int - 4573 (pos-or-insert-slice Type-id %edx) # => eax - 4574 # spill - 4575 51/push-ecx - 4576 # var new-type/ecx: (handle typeinfo) - 4577 68/push 0/imm32 - 4578 68/push 0/imm32 - 4579 89/<- %ecx 4/r32/esp - 4580 (find-or-create-typeinfo %eax %ecx) - 4581 # - 4582 (lookup *ecx *(ecx+4)) # => eax - 4583 # TODO: ensure that 'line' has nothing else but '{' - 4584 #? (dump-typeinfos "=== aaa\n") - 4585 (populate-mu-type *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) # => eax - 4586 #? (dump-typeinfos "=== zzz\n") - 4587 # reclaim new-type - 4588 81 0/subop/add %esp 8/imm32 - 4589 # restore - 4590 59/pop-to-ecx - 4591 e9/jump $parse-mu:line-loop/disp32 - 4592 } - 4593 # otherwise abort - 4594 e9/jump $parse-mu:error1/disp32 - 4595 } # end line loop - 4596 $parse-mu:end: - 4597 # . reclaim locals - 4598 81 0/subop/add %esp 0xe1c/imm32 - 4599 # . restore registers - 4600 5f/pop-to-edi - 4601 5e/pop-to-esi - 4602 5b/pop-to-ebx - 4603 5a/pop-to-edx - 4604 59/pop-to-ecx - 4605 58/pop-to-eax - 4606 # . epilogue - 4607 89/<- %esp 5/r32/ebp - 4608 5d/pop-to-ebp - 4609 c3/return - 4610 - 4611 $parse-mu:error1: - 4612 # error("unexpected top-level command: " word-slice "\n") - 4613 (write-buffered *(ebp+0xc) "unexpected top-level command: ") - 4614 (write-slice-buffered *(ebp+0xc) %edx) - 4615 (write-buffered *(ebp+0xc) "\n") - 4616 (flush *(ebp+0xc)) - 4617 (stop *(ebp+0x10) 1) - 4618 # never gets here - 4619 - 4620 $parse-mu:error2: - 4621 # error(vars->top " vars not reclaimed after fn '" new-function->name "'\n") - 4622 (print-int32-buffered *(ebp+0xc) *ebx) - 4623 (write-buffered *(ebp+0xc) " vars not reclaimed after fn '") - 4624 (write-slice-buffered *(ebp+0xc) *eax) # Function-name - 4625 (write-buffered *(ebp+0xc) "'\n") - 4626 (flush *(ebp+0xc)) - 4627 (stop *(ebp+0x10) 1) - 4628 # never gets here - 4629 - 4630 # scenarios considered: - 4631 # ✗ fn foo # no block - 4632 # ✓ fn foo { - 4633 # ✗ fn foo { { - 4634 # ✗ fn foo { } - 4635 # ✗ fn foo { } { - 4636 # ✗ fn foo x { - 4637 # ✗ fn foo x: { - 4638 # ✓ fn foo x: int { - 4639 # ✓ fn foo x: int { - 4640 # ✓ fn foo x: int -> y/eax: int { - 4641 # TODO: - 4642 # disallow outputs of type `(... addr ...)` - 4643 # disallow inputs of type `(... addr ... addr ...)` - 4644 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) - 4645 # pseudocode: - 4646 # var name: slice - 4647 # next-mu-token(first-line, name) - 4648 # assert(name not in '{' '}' '->') - 4649 # out->name = slice-to-string(name) - 4650 # ## inouts - 4651 # while true - 4652 # ## name - 4653 # name = next-mu-token(first-line) - 4654 # if (name == '{') goto done - 4655 # if (name == '->') break - 4656 # assert(name != '}') - 4657 # var v: (handle var) = parse-var-with-type(name, first-line) - 4658 # assert(v->register == null) - 4659 # # v->block-depth is implicitly 0 - 4660 # out->inouts = append(v, out->inouts) - 4661 # push(vars, {v, false}) - 4662 # ## outputs - 4663 # while true - 4664 # ## name - 4665 # name = next-mu-token(first-line) - 4666 # assert(name not in '{' '}' '->') - 4667 # var v: (handle var) = parse-var-with-type(name, first-line) - 4668 # assert(v->register != null) - 4669 # out->outputs = append(v, out->outputs) - 4670 # done: - 4671 # - 4672 # . prologue - 4673 55/push-ebp - 4674 89/<- %ebp 4/r32/esp - 4675 # . save registers - 4676 50/push-eax - 4677 51/push-ecx - 4678 52/push-edx - 4679 53/push-ebx - 4680 57/push-edi - 4681 # edi = out - 4682 8b/-> *(ebp+0xc) 7/r32/edi - 4683 # var word-slice/ecx: slice - 4684 68/push 0/imm32/end - 4685 68/push 0/imm32/start - 4686 89/<- %ecx 4/r32/esp - 4687 # var v/ebx: (handle var) - 4688 68/push 0/imm32 - 4689 68/push 0/imm32 - 4690 89/<- %ebx 4/r32/esp - 4691 # read function name - 4692 (next-mu-token *(ebp+8) %ecx) - 4693 # error checking - 4694 # TODO: error if name starts with 'break' or 'loop' - 4695 # if (word-slice == '{') abort - 4696 (slice-equal? %ecx "{") # => eax - 4697 3d/compare-eax-and 0/imm32/false - 4698 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 - 4699 # if (word-slice == '->') abort - 4700 (slice-equal? %ecx "->") # => eax - 4701 3d/compare-eax-and 0/imm32/false - 4702 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 - 4703 # if (word-slice == '}') abort - 4704 (slice-equal? %ecx "}") # => eax - 4705 3d/compare-eax-and 0/imm32/false - 4706 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 - 4707 # save function name - 4708 (slice-to-string Heap %ecx %edi) # Function-name - 4709 # save function inouts - 4710 { - 4711 $populate-mu-function-header:check-for-inout: - 4712 (next-mu-token *(ebp+8) %ecx) - 4713 # if (word-slice == '{') goto done - 4714 (slice-equal? %ecx "{") # => eax - 4715 3d/compare-eax-and 0/imm32/false - 4716 0f 85/jump-if-!= $populate-mu-function-header:done/disp32 - 4717 # if (word-slice == '->') break - 4718 (slice-equal? %ecx "->") # => eax - 4719 3d/compare-eax-and 0/imm32/false - 4720 0f 85/jump-if-!= break/disp32 - 4721 # if (word-slice == '}') abort - 4722 (slice-equal? %ecx "}") # => eax - 4723 3d/compare-eax-and 0/imm32/false - 4724 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 - 4725 # v = parse-var-with-type(word-slice, first-line) - 4726 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x14) *(ebp+0x18)) - 4727 # assert(v->register == null) - 4728 # . eax: (addr var) = lookup(v) - 4729 (lookup *ebx *(ebx+4)) # => eax - 4730 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register - 4731 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32 - 4732 # v->block-depth is implicitly 0 - 4733 # - 4734 # out->inouts = append(v, out->inouts) - 4735 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts - 4736 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts - 4737 # push(vars, {v, false}) - 4738 (push *(ebp+0x10) *ebx) - 4739 (push *(ebp+0x10) *(ebx+4)) - 4740 (push *(ebp+0x10) 0) # false - 4741 # - 4742 e9/jump loop/disp32 - 4743 } - 4744 # save function outputs - 4745 { - 4746 $populate-mu-function-header:check-for-out: - 4747 (next-mu-token *(ebp+8) %ecx) - 4748 # if (word-slice == '{') break - 4749 (slice-equal? %ecx "{") # => eax - 4750 3d/compare-eax-and 0/imm32/false - 4751 0f 85/jump-if-!= break/disp32 - 4752 # if (word-slice == '->') abort - 4753 (slice-equal? %ecx "->") # => eax - 4754 3d/compare-eax-and 0/imm32/false - 4755 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 - 4756 # if (word-slice == '}') abort - 4757 (slice-equal? %ecx "}") # => eax - 4758 3d/compare-eax-and 0/imm32/false - 4759 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 - 4760 # v = parse-var-with-type(word-slice, first-line) - 4761 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x14) *(ebp+0x18)) - 4762 # assert(var->register != null) - 4763 # . eax: (addr var) = lookup(v) - 4764 (lookup *ebx *(ebx+4)) # => eax - 4765 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register - 4766 0f 84/jump-if-= $populate-mu-function-header:error3/disp32 - 4767 # out->outputs = append(v, out->outputs) - 4768 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs - 4769 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs - 4770 # - 4771 e9/jump loop/disp32 - 4772 } - 4773 $populate-mu-function-header:done: - 4774 (check-no-tokens-left *(ebp+8)) - 4775 $populate-mu-function-header:end: - 4776 # . reclaim locals - 4777 81 0/subop/add %esp 0x10/imm32 - 4778 # . restore registers - 4779 5f/pop-to-edi - 4780 5b/pop-to-ebx - 4781 5a/pop-to-edx - 4782 59/pop-to-ecx - 4783 58/pop-to-eax - 4784 # . epilogue - 4785 89/<- %esp 5/r32/ebp - 4786 5d/pop-to-ebp - 4787 c3/return - 4788 - 4789 $populate-mu-function-header:error1: - 4790 # error("function header not in form 'fn <name> {'") - 4791 (write-buffered *(ebp+0x14) "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '") - 4792 (flush *(ebp+0x14)) - 4793 (rewind-stream *(ebp+8)) - 4794 (write-stream 2 *(ebp+8)) - 4795 (write-buffered *(ebp+0x14) "'\n") - 4796 (flush *(ebp+0x14)) - 4797 (stop *(ebp+0x18) 1) - 4798 # never gets here - 4799 - 4800 $populate-mu-function-header:error2: - 4801 # error("function input '" var "' cannot be in a register") - 4802 (write-buffered *(ebp+0x14) "function input '") - 4803 (write-buffered *(ebp+0x14) *ebx) # Var-name - 4804 (write-buffered *(ebp+0x14) "' cannot be in a register") - 4805 (flush *(ebp+0x14)) - 4806 (stop *(ebp+0x18) 1) - 4807 # never gets here - 4808 - 4809 $populate-mu-function-header:error3: - 4810 # error("function input '" var "' must be in a register") - 4811 (write-buffered *(ebp+0x14) "function input '") - 4812 (lookup *ebx *(ebx+4)) # => eax - 4813 (lookup *eax *(eax+4)) # Var-name Var-name => eax - 4814 (write-buffered *(ebp+0x14) %eax) - 4815 (write-buffered *(ebp+0x14) "' must be in a register, in instruction '") - 4816 (flush *(ebp+0x14)) - 4817 (rewind-stream *(ebp+8)) - 4818 (write-stream 2 *(ebp+8)) - 4819 (write-buffered *(ebp+0x14) "'\n") - 4820 (flush *(ebp+0x14)) - 4821 (stop *(ebp+0x18) 1) - 4822 # never gets here - 4823 - 4824 test-function-header-with-arg: - 4825 # . prologue - 4826 55/push-ebp - 4827 89/<- %ebp 4/r32/esp - 4828 # setup - 4829 (clear-stream _test-input-stream) - 4830 (write _test-input-stream "foo n: int {\n") - 4831 # var result/ecx: function - 4832 2b/subtract *Function-size 4/r32/esp - 4833 89/<- %ecx 4/r32/esp - 4834 (zero-out %ecx *Function-size) - 4835 # var vars/ebx: (stack live-var 16) - 4836 81 5/subop/subtract %esp 0xc0/imm32 - 4837 68/push 0xc0/imm32/size - 4838 68/push 0/imm32/top - 4839 89/<- %ebx 4/r32/esp - 4840 # convert - 4841 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) - 4842 # check result->name - 4843 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax - 4844 (check-strings-equal %eax "foo" "F - test-function-header-with-arg/name") - 4845 # var v/edx: (addr var) = result->inouts->value - 4846 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax - 4847 (lookup *eax *(eax+4)) # List-value List-value => eax - 4848 89/<- %edx 0/r32/eax - 4849 # check v->name - 4850 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 4851 (check-strings-equal %eax "n" "F - test-function-header-with-arg/inout:0") - 4852 # check v->type - 4853 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 4854 (check-ints-equal *eax 1 "F - test-function-header-with-arg/inout:0/type:0") # Tree-is-atom - 4855 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-arg/inout:0/type:1") # Tree-value - 4856 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-arg/inout:0/type:2") # Tree-right - 4857 # . epilogue - 4858 89/<- %esp 5/r32/ebp - 4859 5d/pop-to-ebp - 4860 c3/return - 4861 - 4862 test-function-header-with-multiple-args: - 4863 # . prologue - 4864 55/push-ebp - 4865 89/<- %ebp 4/r32/esp - 4866 # setup - 4867 (clear-stream _test-input-stream) - 4868 (write _test-input-stream "foo a: int, b: int c: int {\n") - 4869 # result/ecx: function - 4870 2b/subtract *Function-size 4/r32/esp - 4871 89/<- %ecx 4/r32/esp - 4872 (zero-out %ecx *Function-size) - 4873 # var vars/ebx: (stack live-var 16) - 4874 81 5/subop/subtract %esp 0xc0/imm32 - 4875 68/push 0xc0/imm32/size - 4876 68/push 0/imm32/top - 4877 89/<- %ebx 4/r32/esp - 4878 # convert - 4879 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) - 4880 # check result->name - 4881 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax - 4882 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args/name") - 4883 # var inouts/edx: (addr list var) = lookup(result->inouts) - 4884 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax - 4885 89/<- %edx 0/r32/eax - 4886 $test-function-header-with-multiple-args:inout0: - 4887 # var v/ebx: (addr var) = lookup(inouts->value) - 4888 (lookup *edx *(edx+4)) # List-value List-value => eax - 4889 89/<- %ebx 0/r32/eax - 4890 # check v->name - 4891 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4892 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args/inout:0") # Var-name - 4893 # check v->type - 4894 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4895 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:0/type:0") # Tree-is-atom - 4896 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:0/type:1") # Tree-value - 4897 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:0/type:2") # Tree-right - 4898 $test-function-header-with-multiple-args:inout1: - 4899 # inouts = lookup(inouts->next) - 4900 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax - 4901 89/<- %edx 0/r32/eax - 4902 # v = lookup(inouts->value) - 4903 (lookup *edx *(edx+4)) # List-value List-value => eax - 4904 89/<- %ebx 0/r32/eax - 4905 # check v->name - 4906 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4907 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args/inout:1") # Var-name - 4908 # check v->type - 4909 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4910 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:1/type:0") # Tree-is-atom - 4911 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:1/type:1") # Tree-value - 4912 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:1/type:2") # Tree-right - 4913 $test-function-header-with-multiple-args:inout2: - 4914 # inouts = lookup(inouts->next) - 4915 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax - 4916 89/<- %edx 0/r32/eax - 4917 # v = lookup(inouts->value) - 4918 (lookup *edx *(edx+4)) # List-value List-value => eax - 4919 89/<- %ebx 0/r32/eax - 4920 # check v->name - 4921 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4922 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args/inout:2") # Var-name - 4923 # check v->type - 4924 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4925 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:2/type:0") # Tree-is-atom - 4926 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:2/type:1") # Tree-value - 4927 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:2/type:2") # Tree-right - 4928 # . epilogue - 4929 89/<- %esp 5/r32/ebp - 4930 5d/pop-to-ebp - 4931 c3/return - 4932 - 4933 test-function-header-with-multiple-args-and-outputs: - 4934 # . prologue - 4935 55/push-ebp - 4936 89/<- %ebp 4/r32/esp - 4937 # setup - 4938 (clear-stream _test-input-stream) - 4939 (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx: int {\n") - 4940 # result/ecx: function - 4941 2b/subtract *Function-size 4/r32/esp - 4942 89/<- %ecx 4/r32/esp - 4943 (zero-out %ecx *Function-size) - 4944 # var vars/ebx: (stack live-var 16) - 4945 81 5/subop/subtract %esp 0xc0/imm32 - 4946 68/push 0xc0/imm32/size - 4947 68/push 0/imm32/top - 4948 89/<- %ebx 4/r32/esp - 4949 # convert - 4950 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) - 4951 # check result->name - 4952 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax - 4953 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args-and-outputs/name") - 4954 # var inouts/edx: (addr list var) = lookup(result->inouts) - 4955 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax - 4956 89/<- %edx 0/r32/eax - 4957 $test-function-header-with-multiple-args-and-outputs:inout0: - 4958 # var v/ebx: (addr var) = lookup(inouts->value) - 4959 (lookup *edx *(edx+4)) # List-value List-value => eax - 4960 89/<- %ebx 0/r32/eax - 4961 # check v->name - 4962 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4963 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0") - 4964 # check v->type - 4965 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4966 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0") # Tree-is-atom - 4967 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1") # Tree-value - 4968 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:2") # Tree-right - 4969 $test-function-header-with-multiple-args-and-outputs:inout1: - 4970 # inouts = lookup(inouts->next) - 4971 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax - 4972 89/<- %edx 0/r32/eax - 4973 # v = lookup(inouts->value) - 4974 (lookup *edx *(edx+4)) # List-value List-value => eax - 4975 89/<- %ebx 0/r32/eax - 4976 # check v->name - 4977 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4978 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1") - 4979 # check v->type - 4980 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4981 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0") # Tree-is-atom - 4982 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1") # Tree-value - 4983 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:2") # Tree-right - 4984 $test-function-header-with-multiple-args-and-outputs:inout2: - 4985 # inouts = lookup(inouts->next) - 4986 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax - 4987 89/<- %edx 0/r32/eax - 4988 # v = lookup(inouts->value) - 4989 (lookup *edx *(edx+4)) # List-value List-value => eax - 4990 89/<- %ebx 0/r32/eax - 4991 # check v->name - 4992 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 4993 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2") - 4994 # check v->type - 4995 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 4996 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0") # Tree-is-atom - 4997 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1") # Tree-value - 4998 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:2") # Tree-right - 4999 $test-function-header-with-multiple-args-and-outputs:out0: - 5000 # var outputs/edx: (addr list var) = lookup(result->outputs) - 5001 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax - 5002 89/<- %edx 0/r32/eax - 5003 # v = lookup(outputs->value) - 5004 (lookup *edx *(edx+4)) # List-value List-value => eax - 5005 89/<- %ebx 0/r32/eax - 5006 # check v->name - 5007 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 5008 (check-strings-equal %eax "x" "F - test-function-header-with-multiple-args-and-outputs/output:0") - 5009 # check v->register - 5010 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax - 5011 (check-strings-equal %eax "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register") - 5012 # check v->type - 5013 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 5014 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:0") # Tree-is-atom - 5015 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1") # Tree-value - 5016 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:2") # Tree-right - 5017 $test-function-header-with-multiple-args-and-outputs:out1: - 5018 # outputs = lookup(outputs->next) - 5019 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax - 5020 89/<- %edx 0/r32/eax - 5021 # v = lookup(inouts->value) - 5022 (lookup *edx *(edx+4)) # List-value List-value => eax - 5023 89/<- %ebx 0/r32/eax - 5024 # check v->name - 5025 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 5026 (check-strings-equal %eax "y" "F - test-function-header-with-multiple-args-and-outputs/output:1") - 5027 # check v->register - 5028 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax - 5029 (check-strings-equal %eax "edx" "F - test-function-header-with-multiple-args-and-outputs/output:1/register") - 5030 # check v->type - 5031 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax - 5032 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:0") # Tree-is-atom - 5033 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1") # Tree-value - 5034 (check-ints-equal *(eax+0c) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:2") # Tree-right - 5035 # . epilogue - 5036 89/<- %esp 5/r32/ebp - 5037 5d/pop-to-ebp - 5038 c3/return - 5039 - 5040 # format for variables with types - 5041 # x: int - 5042 # x: int, - 5043 # x/eax: int - 5044 # x/eax: int, - 5045 # ignores at most one trailing comma - 5046 # WARNING: modifies name - 5047 parse-var-with-type: # name: (addr slice), first-line: (addr stream byte), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) - 5048 # pseudocode: - 5049 # var s: slice - 5050 # if (!slice-ends-with(name, ":")) - 5051 # abort - 5052 # --name->end to skip ':' - 5053 # next-token-from-slice(name->start, name->end, '/', s) - 5054 # new-var-from-slice(s, out) - 5055 # ## register - 5056 # next-token-from-slice(s->end, name->end, '/', s) - 5057 # if (!slice-empty?(s)) - 5058 # out->register = slice-to-string(s) - 5059 # ## type - 5060 # var type: (handle tree type-id) = parse-type(first-line) - 5061 # out->type = type - 5062 # - 5063 # . prologue - 5064 55/push-ebp - 5065 89/<- %ebp 4/r32/esp - 5066 # . save registers - 5067 50/push-eax - 5068 51/push-ecx - 5069 52/push-edx - 5070 53/push-ebx - 5071 56/push-esi - 5072 57/push-edi - 5073 # esi = name - 5074 8b/-> *(ebp+8) 6/r32/esi - 5075 # if (!slice-ends-with?(name, ":")) abort - 5076 8b/-> *(esi+4) 1/r32/ecx # Slice-end - 5077 49/decrement-ecx - 5078 8a/copy-byte *ecx 1/r32/CL - 5079 81 4/subop/and %ecx 0xff/imm32 - 5080 81 7/subop/compare %ecx 0x3a/imm32/colon - 5081 0f 85/jump-if-!= $parse-var-with-type:abort/disp32 - 5082 # --name->end to skip ':' - 5083 ff 1/subop/decrement *(esi+4) - 5084 # var s/ecx: slice - 5085 68/push 0/imm32/end - 5086 68/push 0/imm32/start - 5087 89/<- %ecx 4/r32/esp - 5088 $parse-var-with-type:parse-name: - 5089 (next-token-from-slice *esi *(esi+4) 0x2f %ecx) # Slice-start, Slice-end, '/' - 5090 $parse-var-with-type:create-var: - 5091 # new-var-from-slice(s, out) - 5092 (new-var-from-slice Heap %ecx *(ebp+0x10)) - 5093 # save out->register - 5094 $parse-var-with-type:save-register: - 5095 # . var out-addr/edi: (addr var) = lookup(*out) - 5096 8b/-> *(ebp+0x10) 7/r32/edi - 5097 (lookup *edi *(edi+4)) # => eax - 5098 89/<- %edi 0/r32/eax - 5099 # . s = next-token(...) - 5100 (next-token-from-slice *(ecx+4) *(esi+4) 0x2f %ecx) # s->end, name->end, '/' - 5101 # . if (!slice-empty?(s)) out->register = slice-to-string(s) - 5102 { - 5103 $parse-var-with-type:write-register: - 5104 (slice-empty? %ecx) # => eax - 5105 3d/compare-eax-and 0/imm32/false - 5106 75/jump-if-!= break/disp8 - 5107 # out->register = slice-to-string(s) - 5108 8d/copy-address *(edi+0x18) 0/r32/eax # Var-register - 5109 (slice-to-string Heap %ecx %eax) - 5110 } - 5111 $parse-var-with-type:save-type: - 5112 8d/copy-address *(edi+8) 0/r32/eax # Var-type - 5113 (parse-type Heap *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) - 5114 $parse-var-with-type:end: - 5115 # . reclaim locals - 5116 81 0/subop/add %esp 8/imm32 - 5117 # . restore registers - 5118 5f/pop-to-edi - 5119 5e/pop-to-esi - 5120 5b/pop-to-ebx - 5121 5a/pop-to-edx - 5122 59/pop-to-ecx - 5123 58/pop-to-eax - 5124 # . epilogue - 5125 89/<- %esp 5/r32/ebp - 5126 5d/pop-to-ebp - 5127 c3/return - 5128 - 5129 $parse-var-with-type:abort: - 5130 # error("var should have form 'name: type' in '" line "'\n") - 5131 (write-buffered *(ebp+0x14) "var should have form 'name: type' in '") - 5132 (flush *(ebp+0x14)) - 5133 (rewind-stream *(ebp+0xc)) - 5134 (write-stream 2 *(ebp+0xc)) - 5135 (write-buffered *(ebp+0x14) "'\n") - 5136 (flush *(ebp+0x14)) - 5137 (stop *(ebp+0x18) 1) - 5138 # never gets here - 5139 - 5140 parse-type: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle tree type-id), err: (addr buffered-file), ed: (addr exit-descriptor) - 5141 # pseudocode: - 5142 # var s: slice = next-mu-token(in) - 5143 # assert s != "" - 5144 # assert s != "->" - 5145 # assert s != "{" - 5146 # assert s != "}" - 5147 # if s == ")" - 5148 # return - 5149 # out = allocate(Tree) - 5150 # if s != "(" - 5151 # HACK: if s is an int, parse and return it - 5152 # out->left-is-atom? = true - 5153 # out->value = pos-or-insert-slice(Type-id, s) - 5154 # return - 5155 # out->left = parse-type(ad, in) - 5156 # out->right = parse-type-tree(ad, in) - 5157 # - 5158 # . prologue - 5159 55/push-ebp - 5160 89/<- %ebp 4/r32/esp - 5161 # . save registers - 5162 50/push-eax - 5163 51/push-ecx - 5164 52/push-edx - 5165 # clear out - 5166 (zero-out *(ebp+0x10) *Handle-size) - 5167 # var s/ecx: slice - 5168 68/push 0/imm32 - 5169 68/push 0/imm32 - 5170 89/<- %ecx 4/r32/esp - 5171 # s = next-mu-token(in) - 5172 (next-mu-token *(ebp+0xc) %ecx) - 5173 #? (write-buffered Stderr "tok: ") - 5174 #? (write-slice-buffered Stderr %ecx) - 5175 #? (write-buffered Stderr "$\n") - 5176 #? (flush Stderr) - 5177 # assert s != "" - 5178 (slice-equal? %ecx "") # => eax - 5179 3d/compare-eax-and 0/imm32/false - 5180 0f 85/jump-if-!= $parse-type:abort/disp32 - 5181 # assert s != "{" - 5182 (slice-equal? %ecx "{") # => eax - 5183 3d/compare-eax-and 0/imm32/false - 5184 0f 85/jump-if-!= $parse-type:abort/disp32 - 5185 # assert s != "}" - 5186 (slice-equal? %ecx "}") # => eax - 5187 3d/compare-eax-and 0/imm32/false - 5188 0f 85/jump-if-!= $parse-type:abort/disp32 - 5189 # assert s != "->" - 5190 (slice-equal? %ecx "->") # => eax - 5191 3d/compare-eax-and 0/imm32/false - 5192 0f 85/jump-if-!= $parse-type:abort/disp32 - 5193 # if (s == ")") return - 5194 (slice-equal? %ecx ")") # => eax - 5195 3d/compare-eax-and 0/imm32/false - 5196 0f 85/jump-if-!= $parse-type:end/disp32 - 5197 # out = new tree - 5198 (allocate *(ebp+8) *Tree-size *(ebp+0x10)) - 5199 # var out-addr/edx: (addr tree type-id) = lookup(*out) - 5200 8b/-> *(ebp+0x10) 2/r32/edx - 5201 (lookup *edx *(edx+4)) # => eax - 5202 89/<- %edx 0/r32/eax - 5203 { - 5204 # if (s != "(") break - 5205 (slice-equal? %ecx "(") # => eax - 5206 3d/compare-eax-and 0/imm32/false - 5207 75/jump-if-!= break/disp8 - 5208 # EGREGIOUS HACK for static array sizes: if s is a number, parse it - 5209 { - 5210 $parse-type:check-for-int: - 5211 (is-hex-int? %ecx) # => eax - 5212 3d/compare-eax-and 0/imm32/false - 5213 74/jump-if-= break/disp8 - 5214 $parse-type:int: - 5215 (parse-hex-int-from-slice %ecx) # => eax - 5216 89/<- *(edx+4) 0/r32/eax # Tree-value - 5217 e9/jump $parse-type:end/disp32 - 5218 } - 5219 $parse-type:atom: - 5220 # out->left-is-atom? = true - 5221 c7 0/subop/copy *edx 1/imm32/true # Tree-is-atom - 5222 # out->value = pos-or-insert-slice(Type-id, s) - 5223 (pos-or-insert-slice Type-id %ecx) # => eax - 5224 89/<- *(edx+4) 0/r32/eax # Tree-value - 5225 e9/jump $parse-type:end/disp32 - 5226 } - 5227 $parse-type:non-atom: - 5228 # otherwise s == "(" - 5229 # out->left = parse-type(ad, in) - 5230 8d/copy-address *(edx+4) 0/r32/eax # Tree-left - 5231 (parse-type *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) - 5232 # out->right = parse-type-tree(ad, in) - 5233 8d/copy-address *(edx+0xc) 0/r32/eax # Tree-right - 5234 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) - 5235 $parse-type:end: - 5236 # . reclaim locals - 5237 81 0/subop/add %esp 8/imm32 - 5238 # . restore registers - 5239 5a/pop-to-edx - 5240 59/pop-to-ecx - 5241 58/pop-to-eax - 5242 # . epilogue - 5243 89/<- %esp 5/r32/ebp - 5244 5d/pop-to-ebp - 5245 c3/return - 5246 - 5247 $parse-type:abort: - 5248 # error("unexpected token when parsing type: '" s "'\n") - 5249 (write-buffered *(ebp+0x14) "unexpected token when parsing type: '") - 5250 (write-slice-buffered *(ebp+0x14) %ecx) - 5251 (write-buffered *(ebp+0x14) "'\n") - 5252 (flush *(ebp+0x14)) - 5253 (stop *(ebp+0x18) 1) - 5254 # never gets here - 5255 - 5256 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) - 5257 # pseudocode: - 5258 # var tmp: (handle tree type-id) = parse-type(ad, in) - 5259 # if tmp == 0 - 5260 # return 0 - 5261 # out = allocate(Tree) - 5262 # out->left = tmp - 5263 # out->right = parse-type-tree(ad, in) - 5264 # - 5265 # . prologue - 5266 55/push-ebp - 5267 89/<- %ebp 4/r32/esp - 5268 # . save registers - 5269 50/push-eax - 5270 51/push-ecx - 5271 52/push-edx - 5272 # - 5273 (zero-out *(ebp+0x10) *Handle-size) - 5274 # var tmp/ecx: (handle tree type-id) - 5275 68/push 0/imm32 - 5276 68/push 0/imm32 - 5277 89/<- %ecx 4/r32/esp - 5278 # tmp = parse-type(ad, in) - 5279 (parse-type *(ebp+8) *(ebp+0xc) %ecx *(ebp+0x14) *(ebp+0x18)) - 5280 # if (tmp == 0) return - 5281 81 7/subop/compare *ecx 0/imm32 - 5282 74/jump-if-= $parse-type-tree:end/disp8 - 5283 # out = new tree - 5284 (allocate *(ebp+8) *Tree-size *(ebp+0x10)) - 5285 # var out-addr/edx: (addr tree) = lookup(*out) - 5286 8b/-> *(ebp+0x10) 2/r32/edx - 5287 (lookup *edx *(edx+4)) # => eax - 5288 89/<- %edx 0/r32/eax - 5289 # out->left = tmp - 5290 8b/-> *ecx 0/r32/eax - 5291 89/<- *(edx+4) 0/r32/eax # Tree-left - 5292 8b/-> *(ecx+4) 0/r32/eax - 5293 89/<- *(edx+8) 0/r32/eax # Tree-left - 5294 # out->right = parse-type-tree(ad, in) - 5295 8d/copy-address *(edx+0xc) 0/r32/eax # Tree-right - 5296 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) - 5297 $parse-type-tree:end: - 5298 # . reclaim locals - 5299 81 0/subop/add %esp 8/imm32 - 5300 # . restore registers - 5301 5a/pop-to-edx - 5302 59/pop-to-ecx - 5303 58/pop-to-eax - 5304 # . epilogue - 5305 89/<- %esp 5/r32/ebp - 5306 5d/pop-to-ebp - 5307 c3/return - 5308 - 5309 next-mu-token: # in: (addr stream byte), out: (addr slice) - 5310 # pseudocode: - 5311 # start: - 5312 # skip-chars-matching-whitespace(in) - 5313 # if in->read >= in->write # end of in - 5314 # out = {0, 0} - 5315 # return - 5316 # out->start = &in->data[in->read] - 5317 # var curr-byte/eax: byte = in->data[in->read] - 5318 # if curr->byte == ',' # comment token - 5319 # ++in->read - 5320 # goto start - 5321 # if curr-byte == '#' # comment - 5322 # goto done # treat as eof - 5323 # if curr-byte == '"' # string literal - 5324 # skip-string(in) - 5325 # goto done # no metadata - 5326 # if curr-byte == '(' - 5327 # ++in->read - 5328 # goto done - 5329 # if curr-byte == ')' - 5330 # ++in->read - 5331 # goto done - 5332 # # read a word - 5333 # while true - 5334 # if in->read >= in->write - 5335 # break - 5336 # curr-byte = in->data[in->read] - 5337 # if curr-byte == ' ' - 5338 # break - 5339 # if curr-byte == '\r' - 5340 # break - 5341 # if curr-byte == '\n' - 5342 # break - 5343 # if curr-byte == '(' - 5344 # break - 5345 # if curr-byte == ')' - 5346 # break - 5347 # if curr-byte == ',' - 5348 # break - 5349 # ++in->read - 5350 # done: - 5351 # out->end = &in->data[in->read] - 5352 # - 5353 # . prologue - 5354 55/push-ebp - 5355 89/<- %ebp 4/r32/esp - 5356 # . save registers - 5357 50/push-eax - 5358 51/push-ecx - 5359 56/push-esi - 5360 57/push-edi - 5361 # esi = in - 5362 8b/-> *(ebp+8) 6/r32/esi - 5363 # edi = out - 5364 8b/-> *(ebp+0xc) 7/r32/edi - 5365 $next-mu-token:start: - 5366 (skip-chars-matching-whitespace %esi) - 5367 $next-mu-token:check0: - 5368 # if (in->read >= in->write) return out = {0, 0} - 5369 # . ecx = in->read - 5370 8b/-> *(esi+4) 1/r32/ecx - 5371 # . if (ecx >= in->write) return out = {0, 0} - 5372 3b/compare<- *esi 1/r32/ecx - 5373 c7 0/subop/copy *edi 0/imm32 - 5374 c7 0/subop/copy *(edi+4) 0/imm32 - 5375 0f 8d/jump-if->= $next-mu-token:end/disp32 - 5376 # out->start = &in->data[in->read] - 5377 8d/copy-address *(esi+ecx+0xc) 0/r32/eax - 5378 89/<- *edi 0/r32/eax - 5379 # var curr-byte/eax: byte = in->data[in->read] - 5380 31/xor-with %eax 0/r32/eax - 5381 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL - 5382 { - 5383 $next-mu-token:check-for-comma: - 5384 # if (curr-byte != ',') break - 5385 3d/compare-eax-and 0x2c/imm32/comma - 5386 75/jump-if-!= break/disp8 - 5387 # ++in->read - 5388 ff 0/subop/increment *(esi+4) - 5389 # restart - 5390 e9/jump $next-mu-token:start/disp32 - 5391 } - 5392 { - 5393 $next-mu-token:check-for-comment: - 5394 # if (curr-byte != '#') break - 5395 3d/compare-eax-and 0x23/imm32/pound - 5396 75/jump-if-!= break/disp8 - 5397 # return eof - 5398 e9/jump $next-mu-token:done/disp32 - 5399 } - 5400 { - 5401 $next-mu-token:check-for-string-literal: - 5402 # if (curr-byte != '"') break - 5403 3d/compare-eax-and 0x22/imm32/dquote - 5404 75/jump-if-!= break/disp8 - 5405 (skip-string %esi) - 5406 # return - 5407 e9/jump $next-mu-token:done/disp32 - 5408 } - 5409 { - 5410 $next-mu-token:check-for-open-paren: - 5411 # if (curr-byte != '(') break - 5412 3d/compare-eax-and 0x28/imm32/open-paren - 5413 75/jump-if-!= break/disp8 - 5414 # ++in->read - 5415 ff 0/subop/increment *(esi+4) - 5416 # return - 5417 e9/jump $next-mu-token:done/disp32 - 5418 } - 5419 { - 5420 $next-mu-token:check-for-close-paren: - 5421 # if (curr-byte != ')') break - 5422 3d/compare-eax-and 0x29/imm32/close-paren - 5423 75/jump-if-!= break/disp8 - 5424 # ++in->read - 5425 ff 0/subop/increment *(esi+4) - 5426 # return - 5427 e9/jump $next-mu-token:done/disp32 - 5428 } - 5429 { - 5430 $next-mu-token:regular-word-without-metadata: - 5431 # if (in->read >= in->write) break - 5432 # . ecx = in->read - 5433 8b/-> *(esi+4) 1/r32/ecx - 5434 # . if (ecx >= in->write) break - 5435 3b/compare<- *esi 1/r32/ecx - 5436 7d/jump-if->= break/disp8 - 5437 # var c/eax: byte = in->data[in->read] - 5438 31/xor-with %eax 0/r32/eax - 5439 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL - 5440 # if (c == ' ') break - 5441 3d/compare-eax-and 0x20/imm32/space - 5442 74/jump-if-= break/disp8 - 5443 # if (c == '\r') break - 5444 3d/compare-eax-and 0xd/imm32/carriage-return - 5445 74/jump-if-= break/disp8 - 5446 # if (c == '\n') break - 5447 3d/compare-eax-and 0xa/imm32/newline - 5448 74/jump-if-= break/disp8 - 5449 # if (c == '(') break - 5450 3d/compare-eax-and 0x28/imm32/open-paren - 5451 0f 84/jump-if-= break/disp32 - 5452 # if (c == ')') break - 5453 3d/compare-eax-and 0x29/imm32/close-paren - 5454 0f 84/jump-if-= break/disp32 - 5455 # if (c == ',') break - 5456 3d/compare-eax-and 0x2c/imm32/comma - 5457 0f 84/jump-if-= break/disp32 - 5458 # ++in->read - 5459 ff 0/subop/increment *(esi+4) - 5460 # - 5461 e9/jump loop/disp32 - 5462 } - 5463 $next-mu-token:done: - 5464 # out->end = &in->data[in->read] - 5465 8b/-> *(esi+4) 1/r32/ecx - 5466 8d/copy-address *(esi+ecx+0xc) 0/r32/eax - 5467 89/<- *(edi+4) 0/r32/eax - 5468 $next-mu-token:end: - 5469 # . restore registers - 5470 5f/pop-to-edi - 5471 5e/pop-to-esi - 5472 59/pop-to-ecx - 5473 58/pop-to-eax - 5474 # . epilogue - 5475 89/<- %esp 5/r32/ebp - 5476 5d/pop-to-ebp - 5477 c3/return - 5478 - 5479 pos-or-insert-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int - 5480 # . prologue - 5481 55/push-ebp - 5482 89/<- %ebp 4/r32/esp - 5483 # if (pos-slice(arr, s) != -1) return it - 5484 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax - 5485 3d/compare-eax-and -1/imm32 - 5486 75/jump-if-!= $pos-or-insert-slice:end/disp8 - 5487 $pos-or-insert-slice:insert: - 5488 # var s2/eax: (handle array byte) - 5489 68/push 0/imm32 - 5490 68/push 0/imm32 - 5491 89/<- %eax 4/r32/esp - 5492 (slice-to-string Heap *(ebp+0xc) %eax) - 5493 # throw away alloc-id - 5494 (lookup *eax *(eax+4)) # => eax - 5495 (write-int *(ebp+8) %eax) - 5496 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax - 5497 $pos-or-insert-slice:end: - 5498 # . reclaim locals - 5499 81 0/subop/add %esp 8/imm32 - 5500 # . epilogue - 5501 89/<- %esp 5/r32/ebp - 5502 5d/pop-to-ebp - 5503 c3/return - 5504 - 5505 # return the index in an array of strings matching 's', -1 if not found - 5506 # index is denominated in elements, not bytes - 5507 pos-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int - 5508 # . prologue - 5509 55/push-ebp - 5510 89/<- %ebp 4/r32/esp - 5511 # . save registers - 5512 51/push-ecx - 5513 52/push-edx - 5514 53/push-ebx - 5515 56/push-esi - 5516 #? (write-buffered Stderr "pos-slice: ") - 5517 #? (write-slice-buffered Stderr *(ebp+0xc)) - 5518 #? (write-buffered Stderr "\n") - 5519 #? (flush Stderr) - 5520 # esi = arr - 5521 8b/-> *(ebp+8) 6/r32/esi - 5522 # var index/ecx: int = 0 - 5523 b9/copy-to-ecx 0/imm32 - 5524 # var curr/edx: (addr (addr array byte)) = arr->data - 5525 8d/copy-address *(esi+0xc) 2/r32/edx - 5526 # var max/ebx: (addr (addr array byte)) = &arr->data[arr->write] - 5527 8b/-> *esi 3/r32/ebx - 5528 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx - 5529 { - 5530 #? (write-buffered Stderr " ") - 5531 #? (print-int32-buffered Stderr %ecx) - 5532 #? (write-buffered Stderr "\n") - 5533 #? (flush Stderr) - 5534 # if (curr >= max) return -1 - 5535 39/compare %edx 3/r32/ebx - 5536 b8/copy-to-eax -1/imm32 - 5537 73/jump-if-addr>= $pos-slice:end/disp8 - 5538 # if (slice-equal?(s, *curr)) break - 5539 (slice-equal? *(ebp+0xc) *edx) # => eax - 5540 3d/compare-eax-and 0/imm32/false - 5541 75/jump-if-!= break/disp8 - 5542 # ++index - 5543 41/increment-ecx - 5544 # curr += 4 - 5545 81 0/subop/add %edx 4/imm32 - 5546 # - 5547 eb/jump loop/disp8 - 5548 } - 5549 # return index - 5550 89/<- %eax 1/r32/ecx - 5551 $pos-slice:end: - 5552 #? (write-buffered Stderr "=> ") - 5553 #? (print-int32-buffered Stderr %eax) - 5554 #? (write-buffered Stderr "\n") - 5555 # . restore registers - 5556 5e/pop-to-esi - 5557 5b/pop-to-ebx - 5558 5a/pop-to-edx - 5559 59/pop-to-ecx - 5560 # . epilogue - 5561 89/<- %esp 5/r32/ebp - 5562 5d/pop-to-ebp - 5563 c3/return - 5564 - 5565 test-parse-var-with-type: - 5566 # . prologue - 5567 55/push-ebp - 5568 89/<- %ebp 4/r32/esp - 5569 # (eax..ecx) = "x:" - 5570 b8/copy-to-eax "x:"/imm32 - 5571 8b/-> *eax 1/r32/ecx - 5572 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5573 05/add-to-eax 4/imm32 - 5574 # var slice/ecx: slice = {eax, ecx} - 5575 51/push-ecx - 5576 50/push-eax - 5577 89/<- %ecx 4/r32/esp - 5578 # _test-input-stream contains "int" - 5579 (clear-stream _test-input-stream) - 5580 (write _test-input-stream "int") - 5581 # var v/edx: (handle var) - 5582 68/push 0/imm32 - 5583 68/push 0/imm32 - 5584 89/<- %edx 4/r32/esp - 5585 # - 5586 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) - 5587 # var v-addr/edx: (addr var) = lookup(v) - 5588 (lookup *edx *(edx+4)) # => eax - 5589 89/<- %edx 0/r32/eax - 5590 # check v-addr->name - 5591 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 5592 (check-strings-equal %eax "x" "F - test-parse-var-with-type/name") - 5593 # check v-addr->type - 5594 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 5595 (check-ints-equal *eax 1 "F - test-parse-var-with-type/type:0") # Tree-is-atom - 5596 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type/type:1") # Tree-value - 5597 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type/type:2") # Tree-right - 5598 # . epilogue - 5599 89/<- %esp 5/r32/ebp - 5600 5d/pop-to-ebp - 5601 c3/return - 5602 - 5603 test-parse-var-with-type-and-register: - 5604 # . prologue - 5605 55/push-ebp - 5606 89/<- %ebp 4/r32/esp - 5607 # (eax..ecx) = "x/eax:" - 5608 b8/copy-to-eax "x/eax:"/imm32 - 5609 8b/-> *eax 1/r32/ecx - 5610 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5611 05/add-to-eax 4/imm32 - 5612 # var slice/ecx: slice = {eax, ecx} - 5613 51/push-ecx - 5614 50/push-eax - 5615 89/<- %ecx 4/r32/esp - 5616 # _test-input-stream contains "int" - 5617 (clear-stream _test-input-stream) - 5618 (write _test-input-stream "int") - 5619 # var v/edx: (handle var) - 5620 68/push 0/imm32 - 5621 68/push 0/imm32 - 5622 89/<- %edx 4/r32/esp - 5623 # - 5624 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) - 5625 # var v-addr/edx: (addr var) = lookup(v) - 5626 (lookup *edx *(edx+4)) # => eax - 5627 89/<- %edx 0/r32/eax - 5628 # check v-addr->name - 5629 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 5630 (check-strings-equal %eax "x" "F - test-parse-var-with-type-and-register/name") - 5631 # check v-addr->register - 5632 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax - 5633 (check-strings-equal %eax "eax" "F - test-parse-var-with-type-and-register/register") - 5634 # check v-addr->type - 5635 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 5636 (check-ints-equal *eax 1 "F - test-parse-var-with-type-and-register/type:0") # Tree-is-atom - 5637 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type-and-register/type:1") # Tree-left - 5638 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type-and-register/type:2") # Tree-right - 5639 # . epilogue - 5640 89/<- %esp 5/r32/ebp - 5641 5d/pop-to-ebp - 5642 c3/return - 5643 - 5644 test-parse-var-with-trailing-characters: - 5645 # . prologue - 5646 55/push-ebp - 5647 89/<- %ebp 4/r32/esp - 5648 # (eax..ecx) = "x:" - 5649 b8/copy-to-eax "x:"/imm32 - 5650 8b/-> *eax 1/r32/ecx - 5651 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5652 05/add-to-eax 4/imm32 - 5653 # var slice/ecx: slice = {eax, ecx} - 5654 51/push-ecx - 5655 50/push-eax - 5656 89/<- %ecx 4/r32/esp - 5657 # _test-input-stream contains "int," - 5658 (clear-stream _test-input-stream) - 5659 (write _test-input-stream "int,") - 5660 # var v/edx: (handle var) - 5661 68/push 0/imm32 - 5662 68/push 0/imm32 - 5663 89/<- %edx 4/r32/esp - 5664 # - 5665 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) - 5666 # var v-addr/edx: (addr var) = lookup(v) - 5667 (lookup *edx *(edx+4)) # => eax - 5668 89/<- %edx 0/r32/eax - 5669 # check v-addr->name - 5670 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 5671 (check-strings-equal %eax "x" "F - test-parse-var-with-trailing-characters/name") - 5672 # check v-addr->register - 5673 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-trailing-characters/register") # Var-register - 5674 # check v-addr->type - 5675 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 5676 (check-ints-equal *eax 1 "F - test-parse-var-with-trailing-characters/type:0") # Tree-is-atom - 5677 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-trailing-characters/type:1") # Tree-left - 5678 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-trailing-characters/type:1") # Tree-right - 5679 # . epilogue - 5680 89/<- %esp 5/r32/ebp - 5681 5d/pop-to-ebp - 5682 c3/return - 5683 - 5684 test-parse-var-with-register-and-trailing-characters: - 5685 # . prologue - 5686 55/push-ebp - 5687 89/<- %ebp 4/r32/esp - 5688 # (eax..ecx) = "x/eax:" - 5689 b8/copy-to-eax "x/eax:"/imm32 - 5690 8b/-> *eax 1/r32/ecx - 5691 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5692 05/add-to-eax 4/imm32 - 5693 # var slice/ecx: slice = {eax, ecx} - 5694 51/push-ecx - 5695 50/push-eax - 5696 89/<- %ecx 4/r32/esp - 5697 # _test-input-stream contains "int," - 5698 (clear-stream _test-input-stream) - 5699 (write _test-input-stream "int,") - 5700 # var v/edx: (handle var) - 5701 68/push 0/imm32 - 5702 68/push 0/imm32 - 5703 89/<- %edx 4/r32/esp - 5704 # - 5705 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) - 5706 # var v-addr/edx: (addr var) = lookup(v) - 5707 (lookup *edx *(edx+4)) # => eax - 5708 89/<- %edx 0/r32/eax - 5709 # check v-addr->name - 5710 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 5711 (check-strings-equal %eax "x" "F - test-parse-var-with-register-and-trailing-characters/name") - 5712 # check v-addr->register - 5713 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax - 5714 (check-strings-equal %eax "eax" "F - test-parse-var-with-register-and-trailing-characters/register") - 5715 # check v-addr->type - 5716 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 5717 (check-ints-equal *eax 1 "F - test-parse-var-with-register-and-trailing-characters/type:0") # Tree-is-atom - 5718 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-register-and-trailing-characters/type:1") # Tree-left - 5719 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-register-and-trailing-characters/type:2") # Tree-right - 5720 # . epilogue - 5721 89/<- %esp 5/r32/ebp - 5722 5d/pop-to-ebp - 5723 c3/return - 5724 - 5725 test-parse-var-with-compound-type: + 4239 (write _test-input-stream "fn f {\n") + 4240 (write _test-input-stream " var a: t\n") + 4241 (write _test-input-stream " var b/eax: (addr t) <- address a\n") + 4242 (write _test-input-stream " foo b\n") + 4243 (write _test-input-stream "}\n") + 4244 (write _test-input-stream "fn foo x: (addr t) {\n") + 4245 (write _test-input-stream " var x/ecx: (addr int) <- copy x\n") + 4246 (write _test-input-stream " increment *x\n") + 4247 (write _test-input-stream "}\n") + 4248 (write _test-input-stream "type t {\n") + 4249 (write _test-input-stream " x: int\n") + 4250 (write _test-input-stream " y: int\n") + 4251 (write _test-input-stream "}\n") + 4252 # convert + 4253 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4254 (flush _test-output-buffered-file) + 4255 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4261 # check output + 4262 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/0") + 4263 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/1") + 4264 (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") + 4265 (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") + 4266 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/4") + 4267 (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") + 4268 # var a: t + 4269 (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") + 4270 (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") + 4271 # var b/eax: (addr t) + 4272 (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") + 4273 (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") + 4274 # foo a + 4275 (check-next-stream-line-equal _test-output-stream " (foo %eax)" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/10") + 4276 # + 4277 (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") + 4278 (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") + 4279 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/13") + 4280 (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") + 4281 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/15") + 4282 (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") + 4283 (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") + 4284 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/18") + 4285 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/19") + 4286 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/20") + 4287 (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") + 4288 (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") + 4289 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/23") + 4290 (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") + 4291 (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") + 4292 (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") + 4293 (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") + 4294 (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") + 4295 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/29") + 4296 (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") + 4297 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/31") + 4298 (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") + 4299 (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") + 4300 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/34") + 4301 # . epilogue + 4302 89/<- %esp 5/r32/ebp + 4303 5d/pop-to-ebp + 4304 c3/return + 4305 + 4306 test-convert-get-on-local-variable: + 4307 # . prologue + 4308 55/push-ebp + 4309 89/<- %ebp 4/r32/esp + 4310 # setup + 4311 (clear-stream _test-input-stream) + 4312 (clear-stream $_test-input-buffered-file->buffer) + 4313 (clear-stream _test-output-stream) + 4314 (clear-stream $_test-output-buffered-file->buffer) + 4315 # + 4316 (write _test-input-stream "fn foo {\n") + 4317 (write _test-input-stream " var a: t\n") + 4318 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 4319 (write _test-input-stream "}\n") + 4320 (write _test-input-stream "type t {\n") + 4321 (write _test-input-stream " x: int\n") + 4322 (write _test-input-stream " y: int\n") + 4323 (write _test-input-stream "}\n") + 4324 # convert + 4325 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4326 (flush _test-output-buffered-file) + 4327 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4333 # check output + 4334 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-local-variable/0") + 4335 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-local-variable/1") + 4336 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-local-variable/2") + 4337 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-local-variable/3") + 4338 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-local-variable/4") + 4339 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-local-variable/5") + 4340 # var a + 4341 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/6") + 4342 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/7") + 4343 # var c + 4344 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-local-variable/8") + 4345 # get + 4346 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000001/r32" "F - test-convert-get-on-local-variable/9") + 4347 # reclaim c + 4348 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-local-variable/10") + 4349 # reclaim a + 4350 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-get-on-local-variable/11") + 4351 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-local-variable/12") + 4352 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-local-variable/13") + 4353 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-local-variable/14") + 4354 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-local-variable/15") + 4355 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-local-variable/16") + 4356 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-local-variable/17") + 4357 # . epilogue + 4358 89/<- %esp 5/r32/ebp + 4359 5d/pop-to-ebp + 4360 c3/return + 4361 + 4362 test-convert-get-on-function-argument: + 4363 # . prologue + 4364 55/push-ebp + 4365 89/<- %ebp 4/r32/esp + 4366 # setup + 4367 (clear-stream _test-input-stream) + 4368 (clear-stream $_test-input-buffered-file->buffer) + 4369 (clear-stream _test-output-stream) + 4370 (clear-stream $_test-output-buffered-file->buffer) + 4371 # + 4372 (write _test-input-stream "fn foo a: t {\n") + 4373 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 4374 (write _test-input-stream "}\n") + 4375 (write _test-input-stream "type t {\n") + 4376 (write _test-input-stream " x: int\n") + 4377 (write _test-input-stream " y: int\n") + 4378 (write _test-input-stream "}\n") + 4379 # convert + 4380 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4381 (flush _test-output-buffered-file) + 4382 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4388 # check output + 4389 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument/0") + 4390 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument/1") + 4391 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument/2") + 4392 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument/3") + 4393 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument/4") + 4394 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument/5") + 4395 # var c + 4396 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument/6") + 4397 # get + 4398 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0x0000000c) 0x00000001/r32" "F - test-convert-get-on-function-argument/7") + 4399 # reclaim c + 4400 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument/8") + 4401 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument/9") + 4402 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument/10") + 4403 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument/11") + 4404 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument/12") + 4405 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument/13") + 4406 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument/14") + 4407 # . epilogue + 4408 89/<- %esp 5/r32/ebp + 4409 5d/pop-to-ebp + 4410 c3/return + 4411 + 4412 test-convert-get-on-function-argument-with-known-type: + 4413 # . prologue + 4414 55/push-ebp + 4415 89/<- %ebp 4/r32/esp + 4416 # setup + 4417 (clear-stream _test-input-stream) + 4418 (clear-stream $_test-input-buffered-file->buffer) + 4419 (clear-stream _test-output-stream) + 4420 (clear-stream $_test-output-buffered-file->buffer) + 4421 # + 4422 (write _test-input-stream "type t {\n") + 4423 (write _test-input-stream " x: int\n") + 4424 (write _test-input-stream " y: int\n") + 4425 (write _test-input-stream "}\n") + 4426 (write _test-input-stream "fn foo a: t {\n") + 4427 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 4428 (write _test-input-stream "}\n") + 4429 # convert + 4430 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4431 (flush _test-output-buffered-file) + 4432 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4438 # check output + 4439 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument-with-known-type/0") + 4440 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument-with-known-type/1") + 4441 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument-with-known-type/2") + 4442 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument-with-known-type/3") + 4443 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument-with-known-type/4") + 4444 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument-with-known-type/5") + 4445 # var c + 4446 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument-with-known-type/6") + 4447 # get + 4448 (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") + 4449 # reclaim c + 4450 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument-with-known-type/8") + 4451 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument-with-known-type/9") + 4452 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument-with-known-type/10") + 4453 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument-with-known-type/11") + 4454 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument-with-known-type/12") + 4455 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument-with-known-type/13") + 4456 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument-with-known-type/14") + 4457 # . epilogue + 4458 89/<- %esp 5/r32/ebp + 4459 5d/pop-to-ebp + 4460 c3/return + 4461 + 4462 test-get-with-wrong-field: + 4463 # . prologue + 4464 55/push-ebp + 4465 89/<- %ebp 4/r32/esp + 4466 # setup + 4467 (clear-stream _test-input-stream) + 4468 (clear-stream $_test-input-buffered-file->buffer) + 4469 (clear-stream _test-output-stream) + 4470 (clear-stream $_test-output-buffered-file->buffer) + 4471 (clear-stream _test-error-stream) + 4472 (clear-stream $_test-error-buffered-file->buffer) + 4473 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 4474 68/push 0/imm32 + 4475 68/push 0/imm32 + 4476 89/<- %edx 4/r32/esp + 4477 (tailor-exit-descriptor %edx 0x10) + 4478 # + 4479 (write _test-input-stream "fn foo {\n") + 4480 (write _test-input-stream " var a: t\n") + 4481 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 4482 (write _test-input-stream "}\n") + 4483 (write _test-input-stream "type t {\n") + 4484 (write _test-input-stream " x: int\n") + 4485 (write _test-input-stream "}\n") + 4486 # convert + 4487 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 4488 # registers except esp clobbered at this point + 4489 # restore ed + 4490 89/<- %edx 4/r32/esp + 4491 (flush _test-output-buffered-file) + 4492 (flush _test-error-buffered-file) + 4493 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------ + 4499 # check output + 4500 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-field: output should be empty") + 4501 (check-next-stream-line-equal _test-error-stream "type 't' has no member called 'y'" "F - test-get-with-wrong-field: error message") + 4502 # check that stop(1) was called + 4503 (check-ints-equal *(edx+4) 2 "F - test-var-in-mem-has-no-initializer: exit status") + 4504 # don't restore from ebp + 4505 81 0/subop/add %esp 8/imm32 + 4506 # . epilogue + 4507 5d/pop-to-ebp + 4508 c3/return + 4509 + 4510 test-convert-array-of-user-defined-types: + 4511 # . prologue + 4512 55/push-ebp + 4513 89/<- %ebp 4/r32/esp + 4514 # setup + 4515 (clear-stream _test-input-stream) + 4516 (clear-stream $_test-input-buffered-file->buffer) + 4517 (clear-stream _test-output-stream) + 4518 (clear-stream $_test-output-buffered-file->buffer) + 4519 # + 4520 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 + 4521 (write _test-input-stream " x: int\n") + 4522 (write _test-input-stream " y: int\n") + 4523 (write _test-input-stream "}\n") + 4524 (write _test-input-stream "fn foo {\n") + 4525 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 4526 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 4527 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") + 4528 (write _test-input-stream "}\n") + 4529 # convert + 4530 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4531 (flush _test-output-buffered-file) + 4532 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4538 # check output + 4539 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-array-of-user-defined-types/0") + 4540 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-array-of-user-defined-types/1") + 4541 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-array-of-user-defined-types/2") + 4542 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-array-of-user-defined-types/3") + 4543 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-array-of-user-defined-types/4") + 4544 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-array-of-user-defined-types/5") + 4545 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-array-of-user-defined-types/6") + 4546 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-array-of-user-defined-types/7") + 4547 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-array-of-user-defined-types/8") + 4548 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-array-of-user-defined-types/9") + 4549 (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") + 4550 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-array-of-user-defined-types/13") + 4551 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-array-of-user-defined-types/14") + 4552 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-array-of-user-defined-types/15") + 4553 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-array-of-user-defined-types/16") + 4554 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-array-of-user-defined-types/17") + 4555 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-array-of-user-defined-types/18") + 4556 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-array-of-user-defined-types/19") + 4557 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-array-of-user-defined-types/20") + 4558 # . epilogue + 4559 89/<- %esp 5/r32/ebp + 4560 5d/pop-to-ebp + 4561 c3/return + 4562 + 4563 test-convert-length-of-array-of-user-defined-types-to-eax: + 4564 # . prologue + 4565 55/push-ebp + 4566 89/<- %ebp 4/r32/esp + 4567 # setup + 4568 (clear-stream _test-input-stream) + 4569 (clear-stream $_test-input-buffered-file->buffer) + 4570 (clear-stream _test-output-stream) + 4571 (clear-stream $_test-output-buffered-file->buffer) + 4572 # + 4573 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 + 4574 (write _test-input-stream " x: int\n") + 4575 (write _test-input-stream " y: int\n") + 4576 (write _test-input-stream " z: int\n") + 4577 (write _test-input-stream "}\n") + 4578 (write _test-input-stream "fn foo {\n") + 4579 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 4580 (write _test-input-stream " var x/eax: (addr t) <- length arr\n") + 4581 (write _test-input-stream "}\n") + 4582 # convert + 4583 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4584 (flush _test-output-buffered-file) + 4585 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4591 # check output + 4592 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/0") + 4593 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/1") + 4594 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/2") + 4595 (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") + 4596 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-eax/4") + 4597 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/5") + 4598 # var arr + 4599 (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") + 4600 (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") + 4601 # length instruction + 4602 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/8") + 4603 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/9") + 4604 (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") + 4605 (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") + 4606 (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") + 4607 (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") + 4608 (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") + 4609 (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") + 4610 # reclaim arr + 4611 (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") + 4612 # + 4613 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-eax/17") + 4614 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/18") + 4615 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/19") + 4616 (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") + 4617 (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") + 4618 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-eax/22") + 4619 # . epilogue + 4620 89/<- %esp 5/r32/ebp + 4621 5d/pop-to-ebp + 4622 c3/return + 4623 + 4624 test-convert-length-of-array-of-user-defined-types-to-ecx: + 4625 # . prologue + 4626 55/push-ebp + 4627 89/<- %ebp 4/r32/esp + 4628 # setup + 4629 (clear-stream _test-input-stream) + 4630 (clear-stream $_test-input-buffered-file->buffer) + 4631 (clear-stream _test-output-stream) + 4632 (clear-stream $_test-output-buffered-file->buffer) + 4633 # + 4634 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 + 4635 (write _test-input-stream " x: int\n") + 4636 (write _test-input-stream " y: int\n") + 4637 (write _test-input-stream " z: int\n") + 4638 (write _test-input-stream "}\n") + 4639 (write _test-input-stream "fn foo {\n") + 4640 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 4641 (write _test-input-stream " var x/ecx: (addr t) <- length arr\n") + 4642 (write _test-input-stream "}\n") + 4643 # convert + 4644 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4645 (flush _test-output-buffered-file) + 4646 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4652 # check output + 4653 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/0") + 4654 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/1") + 4655 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/2") + 4656 (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") + 4657 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/4") + 4658 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/5") + 4659 # var a + 4660 (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") + 4661 (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") + 4662 # var x + 4663 (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") + 4664 # length instruction + 4665 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/9") + 4666 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/10") + 4667 (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") + 4668 (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") + 4669 (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") + 4670 (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") + 4671 (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") + 4672 (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") + 4673 (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") + 4674 # reclaim x + 4675 (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") + 4676 # reclaim a + 4677 (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") + 4678 # + 4679 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/20") + 4680 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/21") + 4681 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/22") + 4682 (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") + 4683 (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") + 4684 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/25") + 4685 # . epilogue + 4686 89/<- %esp 5/r32/ebp + 4687 5d/pop-to-ebp + 4688 c3/return + 4689 + 4690 test-convert-length-of-array-of-user-defined-types-to-edx: + 4691 # . prologue + 4692 55/push-ebp + 4693 89/<- %ebp 4/r32/esp + 4694 # setup + 4695 (clear-stream _test-input-stream) + 4696 (clear-stream $_test-input-buffered-file->buffer) + 4697 (clear-stream _test-output-stream) + 4698 (clear-stream $_test-output-buffered-file->buffer) + 4699 # + 4700 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 + 4701 (write _test-input-stream " x: int\n") + 4702 (write _test-input-stream " y: int\n") + 4703 (write _test-input-stream " z: int\n") + 4704 (write _test-input-stream "}\n") + 4705 (write _test-input-stream "fn foo {\n") + 4706 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 4707 (write _test-input-stream " var x/edx: (addr t) <- length arr\n") + 4708 (write _test-input-stream "}\n") + 4709 # convert + 4710 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4711 (flush _test-output-buffered-file) + 4712 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4718 # check output + 4719 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/0") + 4720 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/1") + 4721 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/2") + 4722 (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") + 4723 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-edx/4") + 4724 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/5") + 4725 # var a + 4726 (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") + 4727 (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") + 4728 # var x + 4729 (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") + 4730 # length instruction + 4731 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/9") + 4732 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/10") + 4733 (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") + 4734 (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") + 4735 (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") + 4736 (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") + 4737 (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") + 4738 (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") + 4739 (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") + 4740 # reclaim x + 4741 (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") + 4742 # reclaim a + 4743 (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") + 4744 # + 4745 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-edx/20") + 4746 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/21") + 4747 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/22") + 4748 (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") + 4749 (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") + 4750 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-edx/25") + 4751 # . epilogue + 4752 89/<- %esp 5/r32/ebp + 4753 5d/pop-to-ebp + 4754 c3/return + 4755 + 4756 test-convert-length-of-array-of-user-defined-types: + 4757 # . prologue + 4758 55/push-ebp + 4759 89/<- %ebp 4/r32/esp + 4760 # setup + 4761 (clear-stream _test-input-stream) + 4762 (clear-stream $_test-input-buffered-file->buffer) + 4763 (clear-stream _test-output-stream) + 4764 (clear-stream $_test-output-buffered-file->buffer) + 4765 # + 4766 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 + 4767 (write _test-input-stream " x: int\n") + 4768 (write _test-input-stream " y: int\n") + 4769 (write _test-input-stream " z: int\n") + 4770 (write _test-input-stream "}\n") + 4771 (write _test-input-stream "fn foo {\n") + 4772 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 4773 (write _test-input-stream " var x/ebx: (addr t) <- length arr\n") + 4774 (write _test-input-stream "}\n") + 4775 # convert + 4776 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4777 (flush _test-output-buffered-file) + 4778 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- + 4784 # check output + 4785 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types/0") + 4786 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types/1") + 4787 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types/2") + 4788 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types/3") + 4789 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types/4") + 4790 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types/5") + 4791 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types/6") + 4792 (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") + 4793 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-length-of-array-of-user-defined-types/8") + 4794 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types/9") + 4795 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types/10") + 4796 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types/11") + 4797 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types/12") + 4798 (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") + 4799 (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") + 4800 (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") + 4801 (check-next-stream-line-equal _test-output-stream " 89/<- %ebx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types/16") + 4802 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types/17") + 4803 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types/18") + 4804 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types/19") + 4805 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ebx" "F - test-convert-length-of-array-of-user-defined-types/20") + 4806 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types/21") + 4807 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types/22") + 4808 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types/23") + 4809 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types/24") + 4810 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types/25") + 4811 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types/26") + 4812 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types/27") + 4813 # . epilogue + 4814 89/<- %esp 5/r32/ebp + 4815 5d/pop-to-ebp + 4816 c3/return + 4817 + 4818 ####################################################### + 4819 # Parsing + 4820 ####################################################### + 4821 + 4822 parse-mu: # in: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) + 4823 # pseudocode + 4824 # var curr-function: (addr handle function) = Program->functions + 4825 # var curr-type: (addr handle typeinfo) = Program->types + 4826 # var line: (stream byte 512) + 4827 # var word-slice: slice + 4828 # while true # line loop + 4829 # clear-stream(line) + 4830 # read-line-buffered(in, line) + 4831 # if (line->write == 0) break # end of file + 4832 # word-slice = next-mu-token(line) + 4833 # if slice-empty?(word-slice) # end of line + 4834 # continue + 4835 # else if slice-starts-with?(word-slice, "#") # comment + 4836 # continue # end of line + 4837 # else if slice-equal?(word-slice, "fn") + 4838 # var new-function: (handle function) = allocate(function) + 4839 # var vars: (stack live-var 256) + 4840 # populate-mu-function-header(line, new-function, vars) + 4841 # populate-mu-function-body(in, new-function, vars) + 4842 # assert(vars->top == 0) + 4843 # *curr-function = new-function + 4844 # curr-function = &new-function->next + 4845 # else if slice-equal?(word-slice, "type") + 4846 # word-slice = next-mu-token(line) + 4847 # type-id = pos-or-insert-slice(Type-id, word-slice) + 4848 # var new-type: (handle typeinfo) = find-or-create-typeinfo(type-id) + 4849 # assert(next-word(line) == "{") + 4850 # populate-mu-type(in, new-type) + 4851 # else + 4852 # abort() + 4853 # + 4854 # . prologue + 4855 55/push-ebp + 4856 89/<- %ebp 4/r32/esp + 4857 # . save registers + 4858 50/push-eax + 4859 51/push-ecx + 4860 52/push-edx + 4861 53/push-ebx + 4862 56/push-esi + 4863 57/push-edi + 4864 # var line/ecx: (stream byte 512) + 4865 81 5/subop/subtract %esp 0x200/imm32 + 4866 68/push 0x200/imm32/size + 4867 68/push 0/imm32/read + 4868 68/push 0/imm32/write + 4869 89/<- %ecx 4/r32/esp + 4870 # var word-slice/edx: slice + 4871 68/push 0/imm32/end + 4872 68/push 0/imm32/start + 4873 89/<- %edx 4/r32/esp + 4874 # var curr-function/edi: (addr handle function) + 4875 bf/copy-to-edi _Program-functions/imm32 + 4876 # var vars/ebx: (stack live-var 256) + 4877 81 5/subop/subtract %esp 0xc00/imm32 + 4878 68/push 0xc00/imm32/size + 4879 68/push 0/imm32/top + 4880 89/<- %ebx 4/r32/esp + 4881 { + 4882 $parse-mu:line-loop: + 4883 (clear-stream %ecx) + 4884 (read-line-buffered *(ebp+8) %ecx) + 4885 # if (line->write == 0) break + 4886 81 7/subop/compare *ecx 0/imm32 + 4887 0f 84/jump-if-= break/disp32 + 4888 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------ + 4894 (next-mu-token %ecx %edx) + 4895 # if slice-empty?(word-slice) continue + 4896 (slice-empty? %edx) # => eax + 4897 3d/compare-eax-and 0/imm32/false + 4898 0f 85/jump-if-!= loop/disp32 + 4899 # if (*word-slice->start == "#") continue + 4900 # . eax = *word-slice->start + 4901 8b/-> *edx 0/r32/eax + 4902 8a/copy-byte *eax 0/r32/AL + 4903 81 4/subop/and %eax 0xff/imm32 + 4904 # . if (eax == '#') continue + 4905 3d/compare-eax-and 0x23/imm32/hash + 4906 0f 84/jump-if-= loop/disp32 + 4907 # if (slice-equal?(word-slice, "fn")) parse a function + 4908 { + 4909 $parse-mu:fn: + 4910 (slice-equal? %edx "fn") # => eax + 4911 3d/compare-eax-and 0/imm32/false + 4912 0f 84/jump-if-= break/disp32 + 4913 # var new-function/esi: (handle function) + 4914 68/push 0/imm32 + 4915 68/push 0/imm32 + 4916 89/<- %esi 4/r32/esp + 4917 # populate-mu-function(line, in, vars, new-function) + 4918 (allocate Heap *Function-size %esi) + 4919 # var new-function-addr/eax: (addr function) + 4920 (lookup *esi *(esi+4)) # => eax + 4921 (clear-stack %ebx) + 4922 (populate-mu-function-header %ecx %eax %ebx *(ebp+0xc) *(ebp+0x10)) + 4923 (populate-mu-function-body *(ebp+8) %eax %ebx *(ebp+0xc) *(ebp+0x10)) + 4924 # *curr-function = new-function + 4925 8b/-> *esi 0/r32/eax + 4926 89/<- *edi 0/r32/eax + 4927 8b/-> *(esi+4) 0/r32/eax + 4928 89/<- *(edi+4) 0/r32/eax + 4929 # curr-function = &new-function->next + 4930 # . var tmp/eax: (addr function) = lookup(new-function) + 4931 (lookup *esi *(esi+4)) # => eax + 4932 # . curr-function = &tmp->next + 4933 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next + 4934 # reclaim new-function + 4935 81 0/subop/add %esp 8/imm32 + 4936 # + 4937 e9/jump $parse-mu:line-loop/disp32 + 4938 } + 4939 # if (slice-equal?(word-slice, "type")) parse a type (struct/record) definition + 4940 { + 4941 $parse-mu:type: + 4942 (slice-equal? %edx "type") # => eax + 4943 3d/compare-eax-and 0/imm32 + 4944 0f 84/jump-if-= break/disp32 + 4945 (next-mu-token %ecx %edx) + 4946 # var type-id/eax: int + 4947 (pos-or-insert-slice Type-id %edx) # => eax + 4948 # spill + 4949 51/push-ecx + 4950 # var new-type/ecx: (handle typeinfo) + 4951 68/push 0/imm32 + 4952 68/push 0/imm32 + 4953 89/<- %ecx 4/r32/esp + 4954 (find-or-create-typeinfo %eax %ecx) + 4955 # + 4956 (lookup *ecx *(ecx+4)) # => eax + 4957 # TODO: ensure that 'line' has nothing else but '{' + 4958 #? (dump-typeinfos "=== aaa\n") + 4959 (populate-mu-type *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) # => eax + 4960 #? (dump-typeinfos "=== zzz\n") + 4961 # reclaim new-type + 4962 81 0/subop/add %esp 8/imm32 + 4963 # restore + 4964 59/pop-to-ecx + 4965 e9/jump $parse-mu:line-loop/disp32 + 4966 } + 4967 # otherwise abort + 4968 e9/jump $parse-mu:error1/disp32 + 4969 } # end line loop + 4970 $parse-mu:end: + 4971 # . reclaim locals + 4972 81 0/subop/add %esp 0xe1c/imm32 + 4973 # . restore registers + 4974 5f/pop-to-edi + 4975 5e/pop-to-esi + 4976 5b/pop-to-ebx + 4977 5a/pop-to-edx + 4978 59/pop-to-ecx + 4979 58/pop-to-eax + 4980 # . epilogue + 4981 89/<- %esp 5/r32/ebp + 4982 5d/pop-to-ebp + 4983 c3/return + 4984 + 4985 $parse-mu:error1: + 4986 # error("unexpected top-level command: " word-slice "\n") + 4987 (write-buffered *(ebp+0xc) "unexpected top-level command: ") + 4988 (write-slice-buffered *(ebp+0xc) %edx) + 4989 (write-buffered *(ebp+0xc) "\n") + 4990 (flush *(ebp+0xc)) + 4991 (stop *(ebp+0x10) 1) + 4992 # never gets here + 4993 + 4994 $parse-mu:error2: + 4995 # error(vars->top " vars not reclaimed after fn '" new-function->name "'\n") + 4996 (print-int32-buffered *(ebp+0xc) *ebx) + 4997 (write-buffered *(ebp+0xc) " vars not reclaimed after fn '") + 4998 (write-slice-buffered *(ebp+0xc) *eax) # Function-name + 4999 (write-buffered *(ebp+0xc) "'\n") + 5000 (flush *(ebp+0xc)) + 5001 (stop *(ebp+0x10) 1) + 5002 # never gets here + 5003 + 5004 # scenarios considered: + 5005 # ✗ fn foo # no block + 5006 # ✓ fn foo { + 5007 # ✗ fn foo { { + 5008 # ✗ fn foo { } + 5009 # ✗ fn foo { } { + 5010 # ✗ fn foo x { + 5011 # ✗ fn foo x: { + 5012 # ✓ fn foo x: int { + 5013 # ✓ fn foo x: int { + 5014 # ✓ fn foo x: int -> y/eax: int { + 5015 # TODO: + 5016 # disallow outputs of type `(... addr ...)` + 5017 # disallow inputs of type `(... addr ... addr ...)` + 5018 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) + 5019 # pseudocode: + 5020 # var name: slice + 5021 # next-mu-token(first-line, name) + 5022 # assert(name not in '{' '}' '->') + 5023 # out->name = slice-to-string(name) + 5024 # ## inouts + 5025 # while true + 5026 # ## name + 5027 # name = next-mu-token(first-line) + 5028 # if (name == '{') goto done + 5029 # if (name == '->') break + 5030 # assert(name != '}') + 5031 # var v: (handle var) = parse-var-with-type(name, first-line) + 5032 # assert(v->register == null) + 5033 # # v->block-depth is implicitly 0 + 5034 # out->inouts = append(v, out->inouts) + 5035 # push(vars, {v, false}) + 5036 # ## outputs + 5037 # while true + 5038 # ## name + 5039 # name = next-mu-token(first-line) + 5040 # assert(name not in '{' '}' '->') + 5041 # var v: (handle var) = parse-var-with-type(name, first-line) + 5042 # assert(v->register != null) + 5043 # out->outputs = append(v, out->outputs) + 5044 # done: + 5045 # + 5046 # . prologue + 5047 55/push-ebp + 5048 89/<- %ebp 4/r32/esp + 5049 # . save registers + 5050 50/push-eax + 5051 51/push-ecx + 5052 52/push-edx + 5053 53/push-ebx + 5054 57/push-edi + 5055 # edi = out + 5056 8b/-> *(ebp+0xc) 7/r32/edi + 5057 # var word-slice/ecx: slice + 5058 68/push 0/imm32/end + 5059 68/push 0/imm32/start + 5060 89/<- %ecx 4/r32/esp + 5061 # var v/ebx: (handle var) + 5062 68/push 0/imm32 + 5063 68/push 0/imm32 + 5064 89/<- %ebx 4/r32/esp + 5065 # read function name + 5066 (next-mu-token *(ebp+8) %ecx) + 5067 # error checking + 5068 # TODO: error if name starts with 'break' or 'loop' + 5069 # if (word-slice == '{') abort + 5070 (slice-equal? %ecx "{") # => eax + 5071 3d/compare-eax-and 0/imm32/false + 5072 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 5073 # if (word-slice == '->') abort + 5074 (slice-equal? %ecx "->") # => eax + 5075 3d/compare-eax-and 0/imm32/false + 5076 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 5077 # if (word-slice == '}') abort + 5078 (slice-equal? %ecx "}") # => eax + 5079 3d/compare-eax-and 0/imm32/false + 5080 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 5081 # save function name + 5082 (slice-to-string Heap %ecx %edi) # Function-name + 5083 # save function inouts + 5084 { + 5085 $populate-mu-function-header:check-for-inout: + 5086 (next-mu-token *(ebp+8) %ecx) + 5087 # if (word-slice == '{') goto done + 5088 (slice-equal? %ecx "{") # => eax + 5089 3d/compare-eax-and 0/imm32/false + 5090 0f 85/jump-if-!= $populate-mu-function-header:done/disp32 + 5091 # if (word-slice == '->') break + 5092 (slice-equal? %ecx "->") # => eax + 5093 3d/compare-eax-and 0/imm32/false + 5094 0f 85/jump-if-!= break/disp32 + 5095 # if (word-slice == '}') abort + 5096 (slice-equal? %ecx "}") # => eax + 5097 3d/compare-eax-and 0/imm32/false + 5098 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 5099 # v = parse-var-with-type(word-slice, first-line) + 5100 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x14) *(ebp+0x18)) + 5101 # assert(v->register == null) + 5102 # . eax: (addr var) = lookup(v) + 5103 (lookup *ebx *(ebx+4)) # => eax + 5104 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register + 5105 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32 + 5106 # v->block-depth is implicitly 0 + 5107 # + 5108 # out->inouts = append(v, out->inouts) + 5109 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts + 5110 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts + 5111 # push(vars, {v, false}) + 5112 (push *(ebp+0x10) *ebx) + 5113 (push *(ebp+0x10) *(ebx+4)) + 5114 (push *(ebp+0x10) 0) # false + 5115 # + 5116 e9/jump loop/disp32 + 5117 } + 5118 # save function outputs + 5119 { + 5120 $populate-mu-function-header:check-for-out: + 5121 (next-mu-token *(ebp+8) %ecx) + 5122 # if (word-slice == '{') break + 5123 (slice-equal? %ecx "{") # => eax + 5124 3d/compare-eax-and 0/imm32/false + 5125 0f 85/jump-if-!= break/disp32 + 5126 # if (word-slice == '->') abort + 5127 (slice-equal? %ecx "->") # => eax + 5128 3d/compare-eax-and 0/imm32/false + 5129 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 5130 # if (word-slice == '}') abort + 5131 (slice-equal? %ecx "}") # => eax + 5132 3d/compare-eax-and 0/imm32/false + 5133 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 + 5134 # v = parse-var-with-type(word-slice, first-line) + 5135 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x14) *(ebp+0x18)) + 5136 # assert(var->register != null) + 5137 # . eax: (addr var) = lookup(v) + 5138 (lookup *ebx *(ebx+4)) # => eax + 5139 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register + 5140 0f 84/jump-if-= $populate-mu-function-header:error3/disp32 + 5141 # out->outputs = append(v, out->outputs) + 5142 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs + 5143 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs + 5144 # + 5145 e9/jump loop/disp32 + 5146 } + 5147 $populate-mu-function-header:done: + 5148 (check-no-tokens-left *(ebp+8)) + 5149 $populate-mu-function-header:end: + 5150 # . reclaim locals + 5151 81 0/subop/add %esp 0x10/imm32 + 5152 # . restore registers + 5153 5f/pop-to-edi + 5154 5b/pop-to-ebx + 5155 5a/pop-to-edx + 5156 59/pop-to-ecx + 5157 58/pop-to-eax + 5158 # . epilogue + 5159 89/<- %esp 5/r32/ebp + 5160 5d/pop-to-ebp + 5161 c3/return + 5162 + 5163 $populate-mu-function-header:error1: + 5164 # error("function header not in form 'fn <name> {'") + 5165 (write-buffered *(ebp+0x14) "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '") + 5166 (flush *(ebp+0x14)) + 5167 (rewind-stream *(ebp+8)) + 5168 (write-stream-data *(ebp+0x14) *(ebp+8)) + 5169 (write-buffered *(ebp+0x14) "'\n") + 5170 (flush *(ebp+0x14)) + 5171 (stop *(ebp+0x18) 1) + 5172 # never gets here + 5173 + 5174 $populate-mu-function-header:error2: + 5175 # error("function inout '" var "' cannot be in a register") + 5176 (write-buffered *(ebp+0x14) "function inout '") + 5177 (write-buffered *(ebp+0x14) *ebx) # Var-name + 5178 (write-buffered *(ebp+0x14) "' cannot be in a register") + 5179 (flush *(ebp+0x14)) + 5180 (stop *(ebp+0x18) 1) + 5181 # never gets here + 5182 + 5183 $populate-mu-function-header:error3: + 5184 # error("function output '" var "' must be in a register") + 5185 (write-buffered *(ebp+0x14) "function output '") + 5186 (lookup *ebx *(ebx+4)) # => eax + 5187 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 5188 (write-buffered *(ebp+0x14) %eax) + 5189 (write-buffered *(ebp+0x14) "' must be in a register, in instruction '") + 5190 (rewind-stream *(ebp+8)) + 5191 (write-stream-data *(ebp+0x14) *(ebp+8)) + 5192 (write-buffered *(ebp+0x14) "'\n") + 5193 (flush *(ebp+0x14)) + 5194 (stop *(ebp+0x18) 1) + 5195 # never gets here + 5196 + 5197 test-function-header-with-arg: + 5198 # . prologue + 5199 55/push-ebp + 5200 89/<- %ebp 4/r32/esp + 5201 # setup + 5202 (clear-stream _test-input-stream) + 5203 (write _test-input-stream "foo n: int {\n") + 5204 # var result/ecx: function + 5205 2b/subtract *Function-size 4/r32/esp + 5206 89/<- %ecx 4/r32/esp + 5207 (zero-out %ecx *Function-size) + 5208 # var vars/ebx: (stack live-var 16) + 5209 81 5/subop/subtract %esp 0xc0/imm32 + 5210 68/push 0xc0/imm32/size + 5211 68/push 0/imm32/top + 5212 89/<- %ebx 4/r32/esp + 5213 # convert + 5214 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) + 5215 # check result->name + 5216 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax + 5217 (check-strings-equal %eax "foo" "F - test-function-header-with-arg/name") + 5218 # var v/edx: (addr var) = result->inouts->value + 5219 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax + 5220 (lookup *eax *(eax+4)) # List-value List-value => eax + 5221 89/<- %edx 0/r32/eax + 5222 # check v->name + 5223 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 5224 (check-strings-equal %eax "n" "F - test-function-header-with-arg/inout:0") + 5225 # check v->type + 5226 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 5227 (check-ints-equal *eax 1 "F - test-function-header-with-arg/inout:0/type:0") # Tree-is-atom + 5228 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-arg/inout:0/type:1") # Tree-value + 5229 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-arg/inout:0/type:2") # Tree-right + 5230 # . epilogue + 5231 89/<- %esp 5/r32/ebp + 5232 5d/pop-to-ebp + 5233 c3/return + 5234 + 5235 test-function-header-with-multiple-args: + 5236 # . prologue + 5237 55/push-ebp + 5238 89/<- %ebp 4/r32/esp + 5239 # setup + 5240 (clear-stream _test-input-stream) + 5241 (write _test-input-stream "foo a: int, b: int c: int {\n") + 5242 # result/ecx: function + 5243 2b/subtract *Function-size 4/r32/esp + 5244 89/<- %ecx 4/r32/esp + 5245 (zero-out %ecx *Function-size) + 5246 # var vars/ebx: (stack live-var 16) + 5247 81 5/subop/subtract %esp 0xc0/imm32 + 5248 68/push 0xc0/imm32/size + 5249 68/push 0/imm32/top + 5250 89/<- %ebx 4/r32/esp + 5251 # convert + 5252 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) + 5253 # check result->name + 5254 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax + 5255 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args/name") + 5256 # var inouts/edx: (addr list var) = lookup(result->inouts) + 5257 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax + 5258 89/<- %edx 0/r32/eax + 5259 $test-function-header-with-multiple-args:inout0: + 5260 # var v/ebx: (addr var) = lookup(inouts->value) + 5261 (lookup *edx *(edx+4)) # List-value List-value => eax + 5262 89/<- %ebx 0/r32/eax + 5263 # check v->name + 5264 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 5265 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args/inout:0") # Var-name + 5266 # check v->type + 5267 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 5268 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:0/type:0") # Tree-is-atom + 5269 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:0/type:1") # Tree-value + 5270 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:0/type:2") # Tree-right + 5271 $test-function-header-with-multiple-args:inout1: + 5272 # inouts = lookup(inouts->next) + 5273 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 5274 89/<- %edx 0/r32/eax + 5275 # v = lookup(inouts->value) + 5276 (lookup *edx *(edx+4)) # List-value List-value => eax + 5277 89/<- %ebx 0/r32/eax + 5278 # check v->name + 5279 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 5280 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args/inout:1") # Var-name + 5281 # check v->type + 5282 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 5283 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:1/type:0") # Tree-is-atom + 5284 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:1/type:1") # Tree-value + 5285 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:1/type:2") # Tree-right + 5286 $test-function-header-with-multiple-args:inout2: + 5287 # inouts = lookup(inouts->next) + 5288 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 5289 89/<- %edx 0/r32/eax + 5290 # v = lookup(inouts->value) + 5291 (lookup *edx *(edx+4)) # List-value List-value => eax + 5292 89/<- %ebx 0/r32/eax + 5293 # check v->name + 5294 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 5295 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args/inout:2") # Var-name + 5296 # check v->type + 5297 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 5298 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:2/type:0") # Tree-is-atom + 5299 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:2/type:1") # Tree-value + 5300 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:2/type:2") # Tree-right + 5301 # . epilogue + 5302 89/<- %esp 5/r32/ebp + 5303 5d/pop-to-ebp + 5304 c3/return + 5305 + 5306 test-function-header-with-multiple-args-and-outputs: + 5307 # . prologue + 5308 55/push-ebp + 5309 89/<- %ebp 4/r32/esp + 5310 # setup + 5311 (clear-stream _test-input-stream) + 5312 (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx: int {\n") + 5313 # result/ecx: function + 5314 2b/subtract *Function-size 4/r32/esp + 5315 89/<- %ecx 4/r32/esp + 5316 (zero-out %ecx *Function-size) + 5317 # var vars/ebx: (stack live-var 16) + 5318 81 5/subop/subtract %esp 0xc0/imm32 + 5319 68/push 0xc0/imm32/size + 5320 68/push 0/imm32/top + 5321 89/<- %ebx 4/r32/esp + 5322 # convert + 5323 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) + 5324 # check result->name + 5325 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax + 5326 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args-and-outputs/name") + 5327 # var inouts/edx: (addr list var) = lookup(result->inouts) + 5328 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax + 5329 89/<- %edx 0/r32/eax + 5330 $test-function-header-with-multiple-args-and-outputs:inout0: + 5331 # var v/ebx: (addr var) = lookup(inouts->value) + 5332 (lookup *edx *(edx+4)) # List-value List-value => eax + 5333 89/<- %ebx 0/r32/eax + 5334 # check v->name + 5335 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 5336 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0") + 5337 # check v->type + 5338 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 5339 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0") # Tree-is-atom + 5340 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1") # Tree-value + 5341 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:2") # Tree-right + 5342 $test-function-header-with-multiple-args-and-outputs:inout1: + 5343 # inouts = lookup(inouts->next) + 5344 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 5345 89/<- %edx 0/r32/eax + 5346 # v = lookup(inouts->value) + 5347 (lookup *edx *(edx+4)) # List-value List-value => eax + 5348 89/<- %ebx 0/r32/eax + 5349 # check v->name + 5350 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 5351 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1") + 5352 # check v->type + 5353 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 5354 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0") # Tree-is-atom + 5355 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1") # Tree-value + 5356 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:2") # Tree-right + 5357 $test-function-header-with-multiple-args-and-outputs:inout2: + 5358 # inouts = lookup(inouts->next) + 5359 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 5360 89/<- %edx 0/r32/eax + 5361 # v = lookup(inouts->value) + 5362 (lookup *edx *(edx+4)) # List-value List-value => eax + 5363 89/<- %ebx 0/r32/eax + 5364 # check v->name + 5365 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 5366 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2") + 5367 # check v->type + 5368 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 5369 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0") # Tree-is-atom + 5370 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1") # Tree-value + 5371 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:2") # Tree-right + 5372 $test-function-header-with-multiple-args-and-outputs:out0: + 5373 # var outputs/edx: (addr list var) = lookup(result->outputs) + 5374 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax + 5375 89/<- %edx 0/r32/eax + 5376 # v = lookup(outputs->value) + 5377 (lookup *edx *(edx+4)) # List-value List-value => eax + 5378 89/<- %ebx 0/r32/eax + 5379 # check v->name + 5380 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 5381 (check-strings-equal %eax "x" "F - test-function-header-with-multiple-args-and-outputs/output:0") + 5382 # check v->register + 5383 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax + 5384 (check-strings-equal %eax "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register") + 5385 # check v->type + 5386 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 5387 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:0") # Tree-is-atom + 5388 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1") # Tree-value + 5389 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:2") # Tree-right + 5390 $test-function-header-with-multiple-args-and-outputs:out1: + 5391 # outputs = lookup(outputs->next) + 5392 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 5393 89/<- %edx 0/r32/eax + 5394 # v = lookup(inouts->value) + 5395 (lookup *edx *(edx+4)) # List-value List-value => eax + 5396 89/<- %ebx 0/r32/eax + 5397 # check v->name + 5398 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax + 5399 (check-strings-equal %eax "y" "F - test-function-header-with-multiple-args-and-outputs/output:1") + 5400 # check v->register + 5401 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax + 5402 (check-strings-equal %eax "edx" "F - test-function-header-with-multiple-args-and-outputs/output:1/register") + 5403 # check v->type + 5404 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax + 5405 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:0") # Tree-is-atom + 5406 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1") # Tree-value + 5407 (check-ints-equal *(eax+0c) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:2") # Tree-right + 5408 # . epilogue + 5409 89/<- %esp 5/r32/ebp + 5410 5d/pop-to-ebp + 5411 c3/return + 5412 + 5413 # format for variables with types + 5414 # x: int + 5415 # x: int, + 5416 # x/eax: int + 5417 # x/eax: int, + 5418 # ignores at most one trailing comma + 5419 # WARNING: modifies name + 5420 parse-var-with-type: # name: (addr slice), first-line: (addr stream byte), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) + 5421 # pseudocode: + 5422 # var s: slice + 5423 # if (!slice-ends-with(name, ":")) + 5424 # abort + 5425 # --name->end to skip ':' + 5426 # next-token-from-slice(name->start, name->end, '/', s) + 5427 # new-var-from-slice(s, out) + 5428 # ## register + 5429 # next-token-from-slice(s->end, name->end, '/', s) + 5430 # if (!slice-empty?(s)) + 5431 # out->register = slice-to-string(s) + 5432 # ## type + 5433 # var type: (handle tree type-id) = parse-type(first-line) + 5434 # out->type = type + 5435 # + 5436 # . prologue + 5437 55/push-ebp + 5438 89/<- %ebp 4/r32/esp + 5439 # . save registers + 5440 50/push-eax + 5441 51/push-ecx + 5442 52/push-edx + 5443 53/push-ebx + 5444 56/push-esi + 5445 57/push-edi + 5446 # esi = name + 5447 8b/-> *(ebp+8) 6/r32/esi + 5448 # if (!slice-ends-with?(name, ":")) abort + 5449 8b/-> *(esi+4) 1/r32/ecx # Slice-end + 5450 49/decrement-ecx + 5451 8a/copy-byte *ecx 1/r32/CL + 5452 81 4/subop/and %ecx 0xff/imm32 + 5453 81 7/subop/compare %ecx 0x3a/imm32/colon + 5454 0f 85/jump-if-!= $parse-var-with-type:abort/disp32 + 5455 # --name->end to skip ':' + 5456 ff 1/subop/decrement *(esi+4) + 5457 # var s/ecx: slice + 5458 68/push 0/imm32/end + 5459 68/push 0/imm32/start + 5460 89/<- %ecx 4/r32/esp + 5461 $parse-var-with-type:parse-name: + 5462 (next-token-from-slice *esi *(esi+4) 0x2f %ecx) # Slice-start, Slice-end, '/' + 5463 $parse-var-with-type:create-var: + 5464 # new-var-from-slice(s, out) + 5465 (new-var-from-slice Heap %ecx *(ebp+0x10)) + 5466 # save out->register + 5467 $parse-var-with-type:save-register: + 5468 # . var out-addr/edi: (addr var) = lookup(*out) + 5469 8b/-> *(ebp+0x10) 7/r32/edi + 5470 (lookup *edi *(edi+4)) # => eax + 5471 89/<- %edi 0/r32/eax + 5472 # . s = next-token(...) + 5473 (next-token-from-slice *(ecx+4) *(esi+4) 0x2f %ecx) # s->end, name->end, '/' + 5474 # . if (!slice-empty?(s)) out->register = slice-to-string(s) + 5475 { + 5476 $parse-var-with-type:write-register: + 5477 (slice-empty? %ecx) # => eax + 5478 3d/compare-eax-and 0/imm32/false + 5479 75/jump-if-!= break/disp8 + 5480 # out->register = slice-to-string(s) + 5481 8d/copy-address *(edi+0x18) 0/r32/eax # Var-register + 5482 (slice-to-string Heap %ecx %eax) + 5483 } + 5484 $parse-var-with-type:save-type: + 5485 8d/copy-address *(edi+8) 0/r32/eax # Var-type + 5486 (parse-type Heap *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) + 5487 $parse-var-with-type:end: + 5488 # . reclaim locals + 5489 81 0/subop/add %esp 8/imm32 + 5490 # . restore registers + 5491 5f/pop-to-edi + 5492 5e/pop-to-esi + 5493 5b/pop-to-ebx + 5494 5a/pop-to-edx + 5495 59/pop-to-ecx + 5496 58/pop-to-eax + 5497 # . epilogue + 5498 89/<- %esp 5/r32/ebp + 5499 5d/pop-to-ebp + 5500 c3/return + 5501 + 5502 $parse-var-with-type:abort: + 5503 # error("var should have form 'name: type' in '" line "'\n") + 5504 (write-buffered *(ebp+0x14) "var should have form 'name: type' in '") + 5505 (flush *(ebp+0x14)) + 5506 (rewind-stream *(ebp+0xc)) + 5507 (write-stream-data *(ebp+0x14) *(ebp+0xc)) + 5508 (write-buffered *(ebp+0x14) "'\n") + 5509 (flush *(ebp+0x14)) + 5510 (stop *(ebp+0x18) 1) + 5511 # never gets here + 5512 + 5513 parse-type: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle tree type-id), err: (addr buffered-file), ed: (addr exit-descriptor) + 5514 # pseudocode: + 5515 # var s: slice = next-mu-token(in) + 5516 # assert s != "" + 5517 # assert s != "->" + 5518 # assert s != "{" + 5519 # assert s != "}" + 5520 # if s == ")" + 5521 # return + 5522 # out = allocate(Tree) + 5523 # if s != "(" + 5524 # HACK: if s is an int, parse and return it + 5525 # out->left-is-atom? = true + 5526 # out->value = pos-or-insert-slice(Type-id, s) + 5527 # return + 5528 # out->left = parse-type(ad, in) + 5529 # out->right = parse-type-tree(ad, in) + 5530 # + 5531 # . prologue + 5532 55/push-ebp + 5533 89/<- %ebp 4/r32/esp + 5534 # . save registers + 5535 50/push-eax + 5536 51/push-ecx + 5537 52/push-edx + 5538 # clear out + 5539 (zero-out *(ebp+0x10) *Handle-size) + 5540 # var s/ecx: slice + 5541 68/push 0/imm32 + 5542 68/push 0/imm32 + 5543 89/<- %ecx 4/r32/esp + 5544 # s = next-mu-token(in) + 5545 (next-mu-token *(ebp+0xc) %ecx) + 5546 #? (write-buffered Stderr "tok: ") + 5547 #? (write-slice-buffered Stderr %ecx) + 5548 #? (write-buffered Stderr "$\n") + 5549 #? (flush Stderr) + 5550 # assert s != "" + 5551 (slice-equal? %ecx "") # => eax + 5552 3d/compare-eax-and 0/imm32/false + 5553 0f 85/jump-if-!= $parse-type:abort/disp32 + 5554 # assert s != "{" + 5555 (slice-equal? %ecx "{") # => eax + 5556 3d/compare-eax-and 0/imm32/false + 5557 0f 85/jump-if-!= $parse-type:abort/disp32 + 5558 # assert s != "}" + 5559 (slice-equal? %ecx "}") # => eax + 5560 3d/compare-eax-and 0/imm32/false + 5561 0f 85/jump-if-!= $parse-type:abort/disp32 + 5562 # assert s != "->" + 5563 (slice-equal? %ecx "->") # => eax + 5564 3d/compare-eax-and 0/imm32/false + 5565 0f 85/jump-if-!= $parse-type:abort/disp32 + 5566 # if (s == ")") return + 5567 (slice-equal? %ecx ")") # => eax + 5568 3d/compare-eax-and 0/imm32/false + 5569 0f 85/jump-if-!= $parse-type:end/disp32 + 5570 # out = new tree + 5571 (allocate *(ebp+8) *Tree-size *(ebp+0x10)) + 5572 # var out-addr/edx: (addr tree type-id) = lookup(*out) + 5573 8b/-> *(ebp+0x10) 2/r32/edx + 5574 (lookup *edx *(edx+4)) # => eax + 5575 89/<- %edx 0/r32/eax + 5576 { + 5577 # if (s != "(") break + 5578 (slice-equal? %ecx "(") # => eax + 5579 3d/compare-eax-and 0/imm32/false + 5580 75/jump-if-!= break/disp8 + 5581 # EGREGIOUS HACK for static array sizes: if s is a number, parse it + 5582 { + 5583 $parse-type:check-for-int: + 5584 (is-hex-int? %ecx) # => eax + 5585 3d/compare-eax-and 0/imm32/false + 5586 74/jump-if-= break/disp8 + 5587 $parse-type:int: + 5588 (parse-hex-int-from-slice %ecx) # => eax + 5589 89/<- *(edx+4) 0/r32/eax # Tree-value + 5590 e9/jump $parse-type:end/disp32 + 5591 } + 5592 $parse-type:atom: + 5593 # out->left-is-atom? = true + 5594 c7 0/subop/copy *edx 1/imm32/true # Tree-is-atom + 5595 # out->value = pos-or-insert-slice(Type-id, s) + 5596 (pos-or-insert-slice Type-id %ecx) # => eax + 5597 89/<- *(edx+4) 0/r32/eax # Tree-value + 5598 e9/jump $parse-type:end/disp32 + 5599 } + 5600 $parse-type:non-atom: + 5601 # otherwise s == "(" + 5602 # out->left = parse-type(ad, in) + 5603 8d/copy-address *(edx+4) 0/r32/eax # Tree-left + 5604 (parse-type *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) + 5605 # out->right = parse-type-tree(ad, in) + 5606 8d/copy-address *(edx+0xc) 0/r32/eax # Tree-right + 5607 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) + 5608 $parse-type:end: + 5609 # . reclaim locals + 5610 81 0/subop/add %esp 8/imm32 + 5611 # . restore registers + 5612 5a/pop-to-edx + 5613 59/pop-to-ecx + 5614 58/pop-to-eax + 5615 # . epilogue + 5616 89/<- %esp 5/r32/ebp + 5617 5d/pop-to-ebp + 5618 c3/return + 5619 + 5620 $parse-type:abort: + 5621 # error("unexpected token when parsing type: '" s "'\n") + 5622 (write-buffered *(ebp+0x14) "unexpected token when parsing type: '") + 5623 (write-slice-buffered *(ebp+0x14) %ecx) + 5624 (write-buffered *(ebp+0x14) "'\n") + 5625 (flush *(ebp+0x14)) + 5626 (stop *(ebp+0x18) 1) + 5627 # never gets here + 5628 + 5629 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) + 5630 # pseudocode: + 5631 # var tmp: (handle tree type-id) = parse-type(ad, in) + 5632 # if tmp == 0 + 5633 # return 0 + 5634 # out = allocate(Tree) + 5635 # out->left = tmp + 5636 # out->right = parse-type-tree(ad, in) + 5637 # + 5638 # . prologue + 5639 55/push-ebp + 5640 89/<- %ebp 4/r32/esp + 5641 # . save registers + 5642 50/push-eax + 5643 51/push-ecx + 5644 52/push-edx + 5645 # + 5646 (zero-out *(ebp+0x10) *Handle-size) + 5647 # var tmp/ecx: (handle tree type-id) + 5648 68/push 0/imm32 + 5649 68/push 0/imm32 + 5650 89/<- %ecx 4/r32/esp + 5651 # tmp = parse-type(ad, in) + 5652 (parse-type *(ebp+8) *(ebp+0xc) %ecx *(ebp+0x14) *(ebp+0x18)) + 5653 # if (tmp == 0) return + 5654 81 7/subop/compare *ecx 0/imm32 + 5655 74/jump-if-= $parse-type-tree:end/disp8 + 5656 # out = new tree + 5657 (allocate *(ebp+8) *Tree-size *(ebp+0x10)) + 5658 # var out-addr/edx: (addr tree) = lookup(*out) + 5659 8b/-> *(ebp+0x10) 2/r32/edx + 5660 (lookup *edx *(edx+4)) # => eax + 5661 89/<- %edx 0/r32/eax + 5662 # out->left = tmp + 5663 8b/-> *ecx 0/r32/eax + 5664 89/<- *(edx+4) 0/r32/eax # Tree-left + 5665 8b/-> *(ecx+4) 0/r32/eax + 5666 89/<- *(edx+8) 0/r32/eax # Tree-left + 5667 # out->right = parse-type-tree(ad, in) + 5668 8d/copy-address *(edx+0xc) 0/r32/eax # Tree-right + 5669 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) + 5670 $parse-type-tree:end: + 5671 # . reclaim locals + 5672 81 0/subop/add %esp 8/imm32 + 5673 # . restore registers + 5674 5a/pop-to-edx + 5675 59/pop-to-ecx + 5676 58/pop-to-eax + 5677 # . epilogue + 5678 89/<- %esp 5/r32/ebp + 5679 5d/pop-to-ebp + 5680 c3/return + 5681 + 5682 next-mu-token: # in: (addr stream byte), out: (addr slice) + 5683 # pseudocode: + 5684 # start: + 5685 # skip-chars-matching-whitespace(in) + 5686 # if in->read >= in->write # end of in + 5687 # out = {0, 0} + 5688 # return + 5689 # out->start = &in->data[in->read] + 5690 # var curr-byte/eax: byte = in->data[in->read] + 5691 # if curr->byte == ',' # comment token + 5692 # ++in->read + 5693 # goto start + 5694 # if curr-byte == '#' # comment + 5695 # goto done # treat as eof + 5696 # if curr-byte == '"' # string literal + 5697 # skip-string(in) + 5698 # goto done # no metadata + 5699 # if curr-byte == '(' + 5700 # ++in->read + 5701 # goto done + 5702 # if curr-byte == ')' + 5703 # ++in->read + 5704 # goto done + 5705 # # read a word + 5706 # while true + 5707 # if in->read >= in->write + 5708 # break + 5709 # curr-byte = in->data[in->read] + 5710 # if curr-byte == ' ' + 5711 # break + 5712 # if curr-byte == '\r' + 5713 # break + 5714 # if curr-byte == '\n' + 5715 # break + 5716 # if curr-byte == '(' + 5717 # break + 5718 # if curr-byte == ')' + 5719 # break + 5720 # if curr-byte == ',' + 5721 # break + 5722 # ++in->read + 5723 # done: + 5724 # out->end = &in->data[in->read] + 5725 # 5726 # . prologue 5727 55/push-ebp 5728 89/<- %ebp 4/r32/esp - 5729 # (eax..ecx) = "x:" - 5730 b8/copy-to-eax "x:"/imm32 - 5731 8b/-> *eax 1/r32/ecx - 5732 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5733 05/add-to-eax 4/imm32 - 5734 # var slice/ecx: slice = {eax, ecx} - 5735 51/push-ecx - 5736 50/push-eax - 5737 89/<- %ecx 4/r32/esp - 5738 # _test-input-stream contains "(addr int)" - 5739 (clear-stream _test-input-stream) - 5740 (write _test-input-stream "(addr int)") - 5741 # var v/edx: (handle var) - 5742 68/push 0/imm32 - 5743 68/push 0/imm32 - 5744 89/<- %edx 4/r32/esp - 5745 # - 5746 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) - 5747 # var v-addr/edx: (addr var) = lookup(v) - 5748 (lookup *edx *(edx+4)) # => eax - 5749 89/<- %edx 0/r32/eax - 5750 # check v-addr->name - 5751 (lookup *edx *(edx+4)) # Var-name Var-name => eax - 5752 (check-strings-equal %eax "x" "F - test-parse-var-with-compound-type/name") - 5753 # check v-addr->register - 5754 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-compound-type/register") # Var-register - 5755 # - check v-addr->type - 5756 # var type/edx: (addr tree type-id) = var->type - 5757 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax - 5758 89/<- %edx 0/r32/eax - 5759 # type is a non-atom - 5760 (check-ints-equal *edx 0 "F - test-parse-var-with-compound-type/type:0") # Tree-is-atom - 5761 # type->left == atom(addr) - 5762 (lookup *(edx+4) *(edx+8)) # Tree-left Tree-left => eax - 5763 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:1") # Tree-is-atom - 5764 (check-ints-equal *(eax+4) 2 "F - test-parse-var-with-compound-type/type:2") # Tree-value - 5765 # type->right->left == atom(int) - 5766 (lookup *(edx+0xc) *(edx+0x10)) # Tree-right Tree-right => eax - 5767 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax - 5768 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:3") # Tree-is-atom - 5769 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-compound-type/type:4") # Tree-value - 5770 # type->right->right == null - 5771 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-compound-type/type:5") # Tree-right - 5772 # . epilogue - 5773 89/<- %esp 5/r32/ebp - 5774 5d/pop-to-ebp - 5775 c3/return - 5776 - 5777 # identifier starts with a letter or '$' or '_' - 5778 # no constraints at the moment on later letters - 5779 # all we really want to do so far is exclude '{', '}' and '->' - 5780 is-identifier?: # in: (addr slice) -> result/eax: boolean - 5781 # . prologue - 5782 55/push-ebp - 5783 89/<- %ebp 4/r32/esp - 5784 # if (slice-empty?(in)) return false - 5785 (slice-empty? *(ebp+8)) # => eax - 5786 3d/compare-eax-and 0/imm32/false - 5787 75/jump-if-!= $is-identifier?:false/disp8 - 5788 # var c/eax: byte = *in->start - 5789 8b/-> *(ebp+8) 0/r32/eax - 5790 8b/-> *eax 0/r32/eax - 5791 8a/copy-byte *eax 0/r32/AL - 5792 81 4/subop/and %eax 0xff/imm32 - 5793 # if (c == '$') return true - 5794 3d/compare-eax-and 0x24/imm32/$ - 5795 74/jump-if-= $is-identifier?:true/disp8 - 5796 # if (c == '_') return true - 5797 3d/compare-eax-and 0x5f/imm32/_ - 5798 74/jump-if-= $is-identifier?:true/disp8 - 5799 # drop case - 5800 25/and-eax-with 0x5f/imm32 - 5801 # if (c < 'A') return false - 5802 3d/compare-eax-and 0x41/imm32/A - 5803 7c/jump-if-< $is-identifier?:false/disp8 - 5804 # if (c > 'Z') return false - 5805 3d/compare-eax-and 0x5a/imm32/Z - 5806 7f/jump-if-> $is-identifier?:false/disp8 - 5807 # otherwise return true - 5808 $is-identifier?:true: - 5809 b8/copy-to-eax 1/imm32/true - 5810 eb/jump $is-identifier?:end/disp8 - 5811 $is-identifier?:false: - 5812 b8/copy-to-eax 0/imm32/false - 5813 $is-identifier?:end: - 5814 # . epilogue - 5815 89/<- %esp 5/r32/ebp - 5816 5d/pop-to-ebp - 5817 c3/return - 5818 - 5819 test-is-identifier-dollar: - 5820 # . prologue - 5821 55/push-ebp - 5822 89/<- %ebp 4/r32/esp - 5823 # (eax..ecx) = "$a" - 5824 b8/copy-to-eax "$a"/imm32 - 5825 8b/-> *eax 1/r32/ecx - 5826 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5827 05/add-to-eax 4/imm32 - 5828 # var slice/ecx: slice = {eax, ecx} - 5829 51/push-ecx - 5830 50/push-eax - 5831 89/<- %ecx 4/r32/esp - 5832 # - 5833 (is-identifier? %ecx) - 5834 (check-ints-equal %eax 1 "F - test-is-identifier-dollar") - 5835 # . epilogue - 5836 89/<- %esp 5/r32/ebp - 5837 5d/pop-to-ebp - 5838 c3/return - 5839 - 5840 test-is-identifier-underscore: - 5841 # . prologue - 5842 55/push-ebp - 5843 89/<- %ebp 4/r32/esp - 5844 # (eax..ecx) = "_a" - 5845 b8/copy-to-eax "_a"/imm32 - 5846 8b/-> *eax 1/r32/ecx - 5847 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5848 05/add-to-eax 4/imm32 - 5849 # var slice/ecx: slice = {eax, ecx} - 5850 51/push-ecx - 5851 50/push-eax - 5852 89/<- %ecx 4/r32/esp - 5853 # - 5854 (is-identifier? %ecx) - 5855 (check-ints-equal %eax 1 "F - test-is-identifier-underscore") - 5856 # . epilogue - 5857 89/<- %esp 5/r32/ebp - 5858 5d/pop-to-ebp - 5859 c3/return - 5860 - 5861 test-is-identifier-a: - 5862 # . prologue - 5863 55/push-ebp - 5864 89/<- %ebp 4/r32/esp - 5865 # (eax..ecx) = "a$" - 5866 b8/copy-to-eax "a$"/imm32 - 5867 8b/-> *eax 1/r32/ecx - 5868 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5869 05/add-to-eax 4/imm32 - 5870 # var slice/ecx: slice = {eax, ecx} - 5871 51/push-ecx - 5872 50/push-eax - 5873 89/<- %ecx 4/r32/esp - 5874 # - 5875 (is-identifier? %ecx) - 5876 (check-ints-equal %eax 1 "F - test-is-identifier-a") - 5877 # . epilogue - 5878 89/<- %esp 5/r32/ebp - 5879 5d/pop-to-ebp - 5880 c3/return - 5881 - 5882 test-is-identifier-z: - 5883 # . prologue - 5884 55/push-ebp - 5885 89/<- %ebp 4/r32/esp - 5886 # (eax..ecx) = "z$" - 5887 b8/copy-to-eax "z$"/imm32 - 5888 8b/-> *eax 1/r32/ecx - 5889 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5890 05/add-to-eax 4/imm32 - 5891 # var slice/ecx: slice = {eax, ecx} - 5892 51/push-ecx - 5893 50/push-eax - 5894 89/<- %ecx 4/r32/esp - 5895 # - 5896 (is-identifier? %ecx) - 5897 (check-ints-equal %eax 1 "F - test-is-identifier-z") - 5898 # . epilogue - 5899 89/<- %esp 5/r32/ebp - 5900 5d/pop-to-ebp - 5901 c3/return - 5902 - 5903 test-is-identifier-A: - 5904 # . prologue - 5905 55/push-ebp - 5906 89/<- %ebp 4/r32/esp - 5907 # (eax..ecx) = "A$" - 5908 b8/copy-to-eax "A$"/imm32 - 5909 8b/-> *eax 1/r32/ecx - 5910 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5911 05/add-to-eax 4/imm32 - 5912 # var slice/ecx: slice = {eax, ecx} - 5913 51/push-ecx - 5914 50/push-eax - 5915 89/<- %ecx 4/r32/esp - 5916 # - 5917 (is-identifier? %ecx) - 5918 (check-ints-equal %eax 1 "F - test-is-identifier-A") - 5919 # . epilogue - 5920 89/<- %esp 5/r32/ebp - 5921 5d/pop-to-ebp - 5922 c3/return - 5923 - 5924 test-is-identifier-Z: - 5925 # . prologue - 5926 55/push-ebp - 5927 89/<- %ebp 4/r32/esp - 5928 # (eax..ecx) = "Z$" - 5929 b8/copy-to-eax "Z$"/imm32 - 5930 8b/-> *eax 1/r32/ecx - 5931 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5932 05/add-to-eax 4/imm32 - 5933 # var slice/ecx: slice = {eax, ecx} - 5934 51/push-ecx - 5935 50/push-eax - 5936 89/<- %ecx 4/r32/esp - 5937 # - 5938 (is-identifier? %ecx) - 5939 (check-ints-equal %eax 1 "F - test-is-identifier-Z") - 5940 # . epilogue - 5941 89/<- %esp 5/r32/ebp - 5942 5d/pop-to-ebp - 5943 c3/return - 5944 - 5945 test-is-identifier-at: - 5946 # character before 'A' is invalid - 5947 # . prologue - 5948 55/push-ebp - 5949 89/<- %ebp 4/r32/esp - 5950 # (eax..ecx) = "@a" - 5951 b8/copy-to-eax "@a"/imm32 - 5952 8b/-> *eax 1/r32/ecx - 5953 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5954 05/add-to-eax 4/imm32 - 5955 # var slice/ecx: slice = {eax, ecx} - 5956 51/push-ecx - 5957 50/push-eax - 5958 89/<- %ecx 4/r32/esp - 5959 # - 5960 (is-identifier? %ecx) - 5961 (check-ints-equal %eax 0 "F - test-is-identifier-@") - 5962 # . epilogue - 5963 89/<- %esp 5/r32/ebp - 5964 5d/pop-to-ebp - 5965 c3/return - 5966 - 5967 test-is-identifier-square-bracket: - 5968 # character after 'Z' is invalid - 5969 # . prologue - 5970 55/push-ebp - 5971 89/<- %ebp 4/r32/esp - 5972 # (eax..ecx) = "[a" - 5973 b8/copy-to-eax "[a"/imm32 - 5974 8b/-> *eax 1/r32/ecx - 5975 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5976 05/add-to-eax 4/imm32 - 5977 # var slice/ecx: slice = {eax, ecx} - 5978 51/push-ecx - 5979 50/push-eax - 5980 89/<- %ecx 4/r32/esp - 5981 # - 5982 (is-identifier? %ecx) - 5983 (check-ints-equal %eax 0 "F - test-is-identifier-@") - 5984 # . epilogue - 5985 89/<- %esp 5/r32/ebp - 5986 5d/pop-to-ebp - 5987 c3/return - 5988 - 5989 test-is-identifier-backtick: - 5990 # character before 'a' is invalid - 5991 # . prologue - 5992 55/push-ebp - 5993 89/<- %ebp 4/r32/esp - 5994 # (eax..ecx) = "`a" - 5995 b8/copy-to-eax "`a"/imm32 - 5996 8b/-> *eax 1/r32/ecx - 5997 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 5998 05/add-to-eax 4/imm32 - 5999 # var slice/ecx: slice = {eax, ecx} - 6000 51/push-ecx - 6001 50/push-eax - 6002 89/<- %ecx 4/r32/esp - 6003 # - 6004 (is-identifier? %ecx) - 6005 (check-ints-equal %eax 0 "F - test-is-identifier-backtick") - 6006 # . epilogue - 6007 89/<- %esp 5/r32/ebp - 6008 5d/pop-to-ebp - 6009 c3/return - 6010 - 6011 test-is-identifier-curly-brace-open: - 6012 # character after 'z' is invalid; also used for blocks - 6013 # . prologue - 6014 55/push-ebp - 6015 89/<- %ebp 4/r32/esp - 6016 # (eax..ecx) = "{a" - 6017 b8/copy-to-eax "{a"/imm32 - 6018 8b/-> *eax 1/r32/ecx - 6019 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 6020 05/add-to-eax 4/imm32 - 6021 # var slice/ecx: slice = {eax, ecx} - 6022 51/push-ecx - 6023 50/push-eax - 6024 89/<- %ecx 4/r32/esp - 6025 # - 6026 (is-identifier? %ecx) - 6027 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open") - 6028 # . epilogue - 6029 89/<- %esp 5/r32/ebp - 6030 5d/pop-to-ebp - 6031 c3/return - 6032 - 6033 test-is-identifier-curly-brace-close: - 6034 # . prologue - 6035 55/push-ebp - 6036 89/<- %ebp 4/r32/esp - 6037 # (eax..ecx) = "}a" - 6038 b8/copy-to-eax "}a"/imm32 - 6039 8b/-> *eax 1/r32/ecx - 6040 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 6041 05/add-to-eax 4/imm32 - 6042 # var slice/ecx: slice = {eax, ecx} - 6043 51/push-ecx - 6044 50/push-eax - 6045 89/<- %ecx 4/r32/esp - 6046 # - 6047 (is-identifier? %ecx) - 6048 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close") - 6049 # . epilogue - 6050 89/<- %esp 5/r32/ebp - 6051 5d/pop-to-ebp - 6052 c3/return - 6053 - 6054 test-is-identifier-hyphen: - 6055 # disallow leading '-' since '->' has special meaning - 6056 # . prologue - 6057 55/push-ebp - 6058 89/<- %ebp 4/r32/esp - 6059 # (eax..ecx) = "-a" - 6060 b8/copy-to-eax "-a"/imm32 - 6061 8b/-> *eax 1/r32/ecx - 6062 8d/copy-address *(eax+ecx+4) 1/r32/ecx - 6063 05/add-to-eax 4/imm32 - 6064 # var slice/ecx: slice = {eax, ecx} - 6065 51/push-ecx - 6066 50/push-eax - 6067 89/<- %ecx 4/r32/esp - 6068 # - 6069 (is-identifier? %ecx) - 6070 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen") - 6071 # . epilogue - 6072 89/<- %esp 5/r32/ebp - 6073 5d/pop-to-ebp - 6074 c3/return - 6075 - 6076 populate-mu-function-body: # in: (addr buffered-file), out: (addr function), vars: (addr stack live-var), err: (addr buffered-file), ed: (addr exit-descriptor) - 6077 # . prologue - 6078 55/push-ebp - 6079 89/<- %ebp 4/r32/esp - 6080 # . save registers - 6081 50/push-eax - 6082 56/push-esi - 6083 57/push-edi - 6084 # esi = in - 6085 8b/-> *(ebp+8) 6/r32/esi - 6086 # edi = out - 6087 8b/-> *(ebp+0xc) 7/r32/edi - 6088 # parse-mu-block(in, vars, out, out->body) - 6089 8d/copy-address *(edi+0x18) 0/r32/eax # Function-body - 6090 (parse-mu-block %esi *(ebp+0x10) %edi %eax *(ebp+0x14) *(ebp+0x18)) - 6091 $populate-mu-function-body:end: - 6092 # . restore registers - 6093 5f/pop-to-edi - 6094 5e/pop-to-esi - 6095 58/pop-to-eax - 6096 # . epilogue - 6097 89/<- %esp 5/r32/ebp - 6098 5d/pop-to-ebp - 6099 c3/return - 6100 - 6101 # parses a block, assuming that the leading '{' has already been read by the caller - 6102 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) - 6103 # pseudocode: - 6104 # var line: (stream byte 512) - 6105 # var word-slice: slice - 6106 # allocate(Heap, Stmt-size, out) - 6107 # var out-addr: (addr block) = lookup(*out) - 6108 # out-addr->tag = 0/block - 6109 # out-addr->var = some unique name - 6110 # push(vars, {out-addr->var, false}) - 6111 # while true # line loop - 6112 # clear-stream(line) - 6113 # read-line-buffered(in, line) - 6114 # if (line->write == 0) break # end of file - 6115 # word-slice = next-mu-token(line) - 6116 # if slice-empty?(word-slice) # end of line - 6117 # continue - 6118 # else if slice-starts-with?(word-slice, "#") - 6119 # continue - 6120 # else if slice-equal?(word-slice, "{") - 6121 # assert(no-tokens-in(line)) - 6122 # block = parse-mu-block(in, vars, fn) - 6123 # append-to-block(out-addr, block) - 6124 # else if slice-equal?(word-slice, "}") - 6125 # break - 6126 # else if slice-ends-with?(word-slice, ":") - 6127 # # TODO: error-check the rest of 'line' - 6128 # --word-slice->end to skip ':' - 6129 # named-block = parse-mu-named-block(word-slice, in, vars, fn) - 6130 # append-to-block(out-addr, named-block) - 6131 # else if slice-equal?(word-slice, "var") - 6132 # var-def = parse-mu-var-def(line, vars, fn) - 6133 # append-to-block(out-addr, var-def) - 6134 # else - 6135 # stmt = parse-mu-stmt(line, vars, fn) - 6136 # append-to-block(out-addr, stmt) - 6137 # pop(vars) - 6138 # - 6139 # . prologue - 6140 55/push-ebp - 6141 89/<- %ebp 4/r32/esp - 6142 # . save registers - 6143 50/push-eax - 6144 51/push-ecx - 6145 52/push-edx - 6146 53/push-ebx - 6147 57/push-edi - 6148 # var line/ecx: (stream byte 512) - 6149 81 5/subop/subtract %esp 0x200/imm32 - 6150 68/push 0x200/imm32/size - 6151 68/push 0/imm32/read - 6152 68/push 0/imm32/write - 6153 89/<- %ecx 4/r32/esp - 6154 # var word-slice/edx: slice - 6155 68/push 0/imm32/end - 6156 68/push 0/imm32/start - 6157 89/<- %edx 4/r32/esp - 6158 # allocate into out - 6159 (allocate Heap *Stmt-size *(ebp+0x14)) - 6160 # var out-addr/edi: (addr block) = lookup(*out) - 6161 8b/-> *(ebp+0x14) 7/r32/edi - 6162 (lookup *edi *(edi+4)) # => eax - 6163 89/<- %edi 0/r32/eax - 6164 # out-addr->tag is 0 (block) by default - 6165 # set out-addr->var - 6166 8d/copy-address *(edi+0xc) 0/r32/eax # Block-var - 6167 (new-block-name *(ebp+0x10) %eax) - 6168 # push(vars, out-addr->var) - 6169 (push *(ebp+0xc) *(edi+0xc)) # Block-var - 6170 (push *(ebp+0xc) *(edi+0x10)) # Block-var - 6171 (push *(ebp+0xc) 0) # false - 6172 { - 6173 $parse-mu-block:line-loop: - 6174 # line = read-line-buffered(in) - 6175 (clear-stream %ecx) - 6176 (read-line-buffered *(ebp+8) %ecx) - 6177 #? (write-buffered Stderr "line: ") - 6178 #? (write-stream-data Stderr %ecx) - 6179 #? (write-buffered Stderr Newline) - 6180 #? (flush Stderr) - 6181 # if (line->write == 0) break - 6182 81 7/subop/compare *ecx 0/imm32 - 6183 0f 84/jump-if-= break/disp32 - 6184 # word-slice = next-mu-token(line) - 6185 (next-mu-token %ecx %edx) - 6186 #? (write-buffered Stderr "word: ") - 6187 #? (write-slice-buffered Stderr %edx) - 6188 #? (write-buffered Stderr Newline) - 6189 #? (flush Stderr) - 6190 # if slice-empty?(word-slice) continue - 6191 (slice-empty? %edx) - 6192 3d/compare-eax-and 0/imm32/false - 6193 0f 85/jump-if-!= loop/disp32 - 6194 # if (slice-starts-with?(word-slice, '#') continue - 6195 # . eax = *word-slice->start - 6196 8b/-> *edx 0/r32/eax - 6197 8a/copy-byte *eax 0/r32/AL - 6198 81 4/subop/and %eax 0xff/imm32 - 6199 # . if (eax == '#') continue - 6200 3d/compare-eax-and 0x23/imm32/hash - 6201 0f 84/jump-if-= loop/disp32 - 6202 # if slice-equal?(word-slice, "{") - 6203 { - 6204 $parse-mu-block:check-for-block: - 6205 (slice-equal? %edx "{") - 6206 3d/compare-eax-and 0/imm32/false - 6207 74/jump-if-= break/disp8 - 6208 (check-no-tokens-left %ecx) - 6209 # parse new block and append - 6210 # . var tmp/eax: (handle block) - 6211 68/push 0/imm32 - 6212 68/push 0/imm32 - 6213 89/<- %eax 4/r32/esp - 6214 # . - 6215 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) - 6216 (append-to-block Heap %edi *eax *(eax+4)) - 6217 # . reclaim tmp - 6218 81 0/subop/add %esp 8/imm32 - 6219 # . - 6220 e9/jump $parse-mu-block:line-loop/disp32 - 6221 } - 6222 # if slice-equal?(word-slice, "}") break - 6223 $parse-mu-block:check-for-end: - 6224 (slice-equal? %edx "}") - 6225 3d/compare-eax-and 0/imm32/false - 6226 0f 85/jump-if-!= break/disp32 - 6227 # if slice-ends-with?(word-slice, ":") parse named block and append - 6228 { - 6229 $parse-mu-block:check-for-named-block: - 6230 # . eax = *(word-slice->end-1) - 6231 8b/-> *(edx+4) 0/r32/eax - 6232 48/decrement-eax - 6233 8a/copy-byte *eax 0/r32/AL - 6234 81 4/subop/and %eax 0xff/imm32 - 6235 # . if (eax != ':') break - 6236 3d/compare-eax-and 0x3a/imm32/colon - 6237 0f 85/jump-if-!= break/disp32 - 6238 # TODO: error-check the rest of 'line' - 6239 # - 6240 # skip ':' - 6241 ff 1/subop/decrement *(edx+4) # Slice-end - 6242 # var tmp/eax: (handle block) - 6243 68/push 0/imm32 - 6244 68/push 0/imm32 - 6245 89/<- %eax 4/r32/esp - 6246 # - 6247 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) - 6248 (append-to-block Heap %edi *eax *(eax+4)) - 6249 # reclaim tmp - 6250 81 0/subop/add %esp 8/imm32 - 6251 # - 6252 e9/jump $parse-mu-block:line-loop/disp32 - 6253 } - 6254 # if slice-equal?(word-slice, "var") - 6255 { - 6256 $parse-mu-block:check-for-var: - 6257 (slice-equal? %edx "var") - 6258 3d/compare-eax-and 0/imm32/false - 6259 74/jump-if-= break/disp8 - 6260 # var tmp/eax: (handle block) - 6261 68/push 0/imm32 - 6262 68/push 0/imm32 - 6263 89/<- %eax 4/r32/esp - 6264 # - 6265 (parse-mu-var-def %ecx *(ebp+0xc) %eax *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) - 6266 (append-to-block Heap %edi *eax *(eax+4)) - 6267 # reclaim tmp - 6268 81 0/subop/add %esp 8/imm32 - 6269 # - 6270 e9/jump $parse-mu-block:line-loop/disp32 - 6271 } - 6272 $parse-mu-block:regular-stmt: - 6273 # otherwise - 6274 # var tmp/eax: (handle block) - 6275 68/push 0/imm32 - 6276 68/push 0/imm32 - 6277 89/<- %eax 4/r32/esp - 6278 # - 6279 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) - 6280 (append-to-block Heap %edi *eax *(eax+4)) - 6281 # reclaim tmp - 6282 81 0/subop/add %esp 8/imm32 - 6283 # - 6284 e9/jump loop/disp32 - 6285 } # end line loop - 6286 # pop(vars) - 6287 (pop *(ebp+0xc)) # => eax - 6288 (pop *(ebp+0xc)) # => eax - 6289 (pop *(ebp+0xc)) # => eax - 6290 $parse-mu-block:end: - 6291 # . reclaim locals - 6292 81 0/subop/add %esp 0x214/imm32 - 6293 # . restore registers - 6294 5f/pop-to-edi - 6295 5b/pop-to-ebx - 6296 5a/pop-to-edx - 6297 59/pop-to-ecx - 6298 58/pop-to-eax - 6299 # . epilogue - 6300 89/<- %esp 5/r32/ebp - 6301 5d/pop-to-ebp - 6302 c3/return - 6303 - 6304 $parse-mu-block:abort: - 6305 # error("'{' or '}' should be on its own line, but got '") - 6306 (write-buffered *(ebp+0x18) "'{' or '}' should be on its own line, but got '") - 6307 (rewind-stream %ecx) - 6308 (write-stream 2 %ecx) - 6309 (write-buffered *(ebp+0x18) "'\n") - 6310 (flush *(ebp+0x18)) - 6311 (stop *(ebp+0x1c) 1) - 6312 # never gets here - 6313 - 6314 new-block-name: # fn: (addr function), out: (addr handle var) - 6315 # . prologue - 6316 55/push-ebp - 6317 89/<- %ebp 4/r32/esp - 6318 # . save registers - 6319 50/push-eax - 6320 51/push-ecx - 6321 52/push-edx - 6322 # var n/ecx: int = len(fn->name) + 10 for an int + 2 for '$:' - 6323 8b/-> *(ebp+8) 0/r32/eax - 6324 (lookup *eax *(eax+4)) # Function-name Function-name => eax - 6325 8b/-> *eax 0/r32/eax # String-size - 6326 05/add-to-eax 0xd/imm32 # 10 + 2 for '$:' - 6327 89/<- %ecx 0/r32/eax - 6328 # var name/edx: (stream byte n) - 6329 29/subtract-from %esp 1/r32/ecx - 6330 ff 6/subop/push %ecx - 6331 68/push 0/imm32/read - 6332 68/push 0/imm32/write - 6333 89/<- %edx 4/r32/esp - 6334 (clear-stream %edx) - 6335 # eax = fn->name - 6336 8b/-> *(ebp+8) 0/r32/eax - 6337 (lookup *eax *(eax+4)) # Function-name Function-name => eax - 6338 # construct result using Next-block-index (and increment it) - 6339 (write %edx "$") - 6340 (write %edx %eax) - 6341 (write %edx ":") - 6342 (print-int32 %edx *Next-block-index) - 6343 ff 0/subop/increment *Next-block-index - 6344 # var s/eax: slice = {name->data, name->data + name->write} (clobbering edx) - 6345 # . eax = name->write - 6346 8b/-> *edx 0/r32/eax - 6347 # . edx = name->data - 6348 8d/copy-address *(edx+0xc) 2/r32/edx - 6349 # . eax = name->write + name->data - 6350 01/add-to %eax 2/r32/edx - 6351 # . push {edx, eax} - 6352 ff 6/subop/push %eax - 6353 ff 6/subop/push %edx - 6354 89/<- %eax 4/r32/esp - 6355 # out = new literal(s) - 6356 (new-literal Heap %eax *(ebp+0xc)) - 6357 #? 8b/-> *(ebp+0xc) 0/r32/eax - 6358 #? (write-buffered Stderr "type allocid in caller after new-literal: ") - 6359 #? (print-int32-buffered Stderr *(eax+8)) - 6360 #? (write-buffered Stderr " for var ") - 6361 #? (print-int32-buffered Stderr %eax) - 6362 #? (write-buffered Stderr Newline) - 6363 #? (flush Stderr) - 6364 $new-block-name:end: - 6365 # . reclaim locals - 6366 81 0/subop/add %ecx 0xc/imm32 # name.{read/write/len} - 6367 81 0/subop/add %ecx 8/imm32 # slice - 6368 01/add-to %esp 1/r32/ecx - 6369 # . restore registers - 6370 5a/pop-to-edx - 6371 59/pop-to-ecx - 6372 58/pop-to-eax - 6373 # . epilogue - 6374 89/<- %esp 5/r32/ebp - 6375 5d/pop-to-ebp - 6376 c3/return - 6377 - 6378 == data - 6379 - 6380 # Global state added to each var record when parsing a function - 6381 Next-block-index: # (addr int) - 6382 1/imm32 + 5729 # . save registers + 5730 50/push-eax + 5731 51/push-ecx + 5732 56/push-esi + 5733 57/push-edi + 5734 # esi = in + 5735 8b/-> *(ebp+8) 6/r32/esi + 5736 # edi = out + 5737 8b/-> *(ebp+0xc) 7/r32/edi + 5738 $next-mu-token:start: + 5739 (skip-chars-matching-whitespace %esi) + 5740 $next-mu-token:check0: + 5741 # if (in->read >= in->write) return out = {0, 0} + 5742 # . ecx = in->read + 5743 8b/-> *(esi+4) 1/r32/ecx + 5744 # . if (ecx >= in->write) return out = {0, 0} + 5745 3b/compare<- *esi 1/r32/ecx + 5746 c7 0/subop/copy *edi 0/imm32 + 5747 c7 0/subop/copy *(edi+4) 0/imm32 + 5748 0f 8d/jump-if->= $next-mu-token:end/disp32 + 5749 # out->start = &in->data[in->read] + 5750 8d/copy-address *(esi+ecx+0xc) 0/r32/eax + 5751 89/<- *edi 0/r32/eax + 5752 # var curr-byte/eax: byte = in->data[in->read] + 5753 31/xor-with %eax 0/r32/eax + 5754 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL + 5755 { + 5756 $next-mu-token:check-for-comma: + 5757 # if (curr-byte != ',') break + 5758 3d/compare-eax-and 0x2c/imm32/comma + 5759 75/jump-if-!= break/disp8 + 5760 # ++in->read + 5761 ff 0/subop/increment *(esi+4) + 5762 # restart + 5763 e9/jump $next-mu-token:start/disp32 + 5764 } + 5765 { + 5766 $next-mu-token:check-for-comment: + 5767 # if (curr-byte != '#') break + 5768 3d/compare-eax-and 0x23/imm32/pound + 5769 75/jump-if-!= break/disp8 + 5770 # return eof + 5771 e9/jump $next-mu-token:done/disp32 + 5772 } + 5773 { + 5774 $next-mu-token:check-for-string-literal: + 5775 # if (curr-byte != '"') break + 5776 3d/compare-eax-and 0x22/imm32/dquote + 5777 75/jump-if-!= break/disp8 + 5778 (skip-string %esi) + 5779 # return + 5780 e9/jump $next-mu-token:done/disp32 + 5781 } + 5782 { + 5783 $next-mu-token:check-for-open-paren: + 5784 # if (curr-byte != '(') break + 5785 3d/compare-eax-and 0x28/imm32/open-paren + 5786 75/jump-if-!= break/disp8 + 5787 # ++in->read + 5788 ff 0/subop/increment *(esi+4) + 5789 # return + 5790 e9/jump $next-mu-token:done/disp32 + 5791 } + 5792 { + 5793 $next-mu-token:check-for-close-paren: + 5794 # if (curr-byte != ')') break + 5795 3d/compare-eax-and 0x29/imm32/close-paren + 5796 75/jump-if-!= break/disp8 + 5797 # ++in->read + 5798 ff 0/subop/increment *(esi+4) + 5799 # return + 5800 e9/jump $next-mu-token:done/disp32 + 5801 } + 5802 { + 5803 $next-mu-token:regular-word-without-metadata: + 5804 # if (in->read >= in->write) break + 5805 # . ecx = in->read + 5806 8b/-> *(esi+4) 1/r32/ecx + 5807 # . if (ecx >= in->write) break + 5808 3b/compare<- *esi 1/r32/ecx + 5809 7d/jump-if->= break/disp8 + 5810 # var c/eax: byte = in->data[in->read] + 5811 31/xor-with %eax 0/r32/eax + 5812 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL + 5813 # if (c == ' ') break + 5814 3d/compare-eax-and 0x20/imm32/space + 5815 74/jump-if-= break/disp8 + 5816 # if (c == '\r') break + 5817 3d/compare-eax-and 0xd/imm32/carriage-return + 5818 74/jump-if-= break/disp8 + 5819 # if (c == '\n') break + 5820 3d/compare-eax-and 0xa/imm32/newline + 5821 74/jump-if-= break/disp8 + 5822 # if (c == '(') break + 5823 3d/compare-eax-and 0x28/imm32/open-paren + 5824 0f 84/jump-if-= break/disp32 + 5825 # if (c == ')') break + 5826 3d/compare-eax-and 0x29/imm32/close-paren + 5827 0f 84/jump-if-= break/disp32 + 5828 # if (c == ',') break + 5829 3d/compare-eax-and 0x2c/imm32/comma + 5830 0f 84/jump-if-= break/disp32 + 5831 # ++in->read + 5832 ff 0/subop/increment *(esi+4) + 5833 # + 5834 e9/jump loop/disp32 + 5835 } + 5836 $next-mu-token:done: + 5837 # out->end = &in->data[in->read] + 5838 8b/-> *(esi+4) 1/r32/ecx + 5839 8d/copy-address *(esi+ecx+0xc) 0/r32/eax + 5840 89/<- *(edi+4) 0/r32/eax + 5841 $next-mu-token:end: + 5842 # . restore registers + 5843 5f/pop-to-edi + 5844 5e/pop-to-esi + 5845 59/pop-to-ecx + 5846 58/pop-to-eax + 5847 # . epilogue + 5848 89/<- %esp 5/r32/ebp + 5849 5d/pop-to-ebp + 5850 c3/return + 5851 + 5852 pos-or-insert-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int + 5853 # . prologue + 5854 55/push-ebp + 5855 89/<- %ebp 4/r32/esp + 5856 # if (pos-slice(arr, s) != -1) return it + 5857 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax + 5858 3d/compare-eax-and -1/imm32 + 5859 75/jump-if-!= $pos-or-insert-slice:end/disp8 + 5860 $pos-or-insert-slice:insert: + 5861 # var s2/eax: (handle array byte) + 5862 68/push 0/imm32 + 5863 68/push 0/imm32 + 5864 89/<- %eax 4/r32/esp + 5865 (slice-to-string Heap *(ebp+0xc) %eax) + 5866 # throw away alloc-id + 5867 (lookup *eax *(eax+4)) # => eax + 5868 (write-int *(ebp+8) %eax) + 5869 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax + 5870 $pos-or-insert-slice:end: + 5871 # . reclaim locals + 5872 81 0/subop/add %esp 8/imm32 + 5873 # . epilogue + 5874 89/<- %esp 5/r32/ebp + 5875 5d/pop-to-ebp + 5876 c3/return + 5877 + 5878 # return the index in an array of strings matching 's', -1 if not found + 5879 # index is denominated in elements, not bytes + 5880 pos-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int + 5881 # . prologue + 5882 55/push-ebp + 5883 89/<- %ebp 4/r32/esp + 5884 # . save registers + 5885 51/push-ecx + 5886 52/push-edx + 5887 53/push-ebx + 5888 56/push-esi + 5889 #? (write-buffered Stderr "pos-slice: ") + 5890 #? (write-slice-buffered Stderr *(ebp+0xc)) + 5891 #? (write-buffered Stderr "\n") + 5892 #? (flush Stderr) + 5893 # esi = arr + 5894 8b/-> *(ebp+8) 6/r32/esi + 5895 # var index/ecx: int = 0 + 5896 b9/copy-to-ecx 0/imm32 + 5897 # var curr/edx: (addr (addr array byte)) = arr->data + 5898 8d/copy-address *(esi+0xc) 2/r32/edx + 5899 # var max/ebx: (addr (addr array byte)) = &arr->data[arr->write] + 5900 8b/-> *esi 3/r32/ebx + 5901 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx + 5902 { + 5903 #? (write-buffered Stderr " ") + 5904 #? (print-int32-buffered Stderr %ecx) + 5905 #? (write-buffered Stderr "\n") + 5906 #? (flush Stderr) + 5907 # if (curr >= max) return -1 + 5908 39/compare %edx 3/r32/ebx + 5909 b8/copy-to-eax -1/imm32 + 5910 73/jump-if-addr>= $pos-slice:end/disp8 + 5911 # if (slice-equal?(s, *curr)) break + 5912 (slice-equal? *(ebp+0xc) *edx) # => eax + 5913 3d/compare-eax-and 0/imm32/false + 5914 75/jump-if-!= break/disp8 + 5915 # ++index + 5916 41/increment-ecx + 5917 # curr += 4 + 5918 81 0/subop/add %edx 4/imm32 + 5919 # + 5920 eb/jump loop/disp8 + 5921 } + 5922 # return index + 5923 89/<- %eax 1/r32/ecx + 5924 $pos-slice:end: + 5925 #? (write-buffered Stderr "=> ") + 5926 #? (print-int32-buffered Stderr %eax) + 5927 #? (write-buffered Stderr "\n") + 5928 # . restore registers + 5929 5e/pop-to-esi + 5930 5b/pop-to-ebx + 5931 5a/pop-to-edx + 5932 59/pop-to-ecx + 5933 # . epilogue + 5934 89/<- %esp 5/r32/ebp + 5935 5d/pop-to-ebp + 5936 c3/return + 5937 + 5938 test-parse-var-with-type: + 5939 # . prologue + 5940 55/push-ebp + 5941 89/<- %ebp 4/r32/esp + 5942 # (eax..ecx) = "x:" + 5943 b8/copy-to-eax "x:"/imm32 + 5944 8b/-> *eax 1/r32/ecx + 5945 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5946 05/add-to-eax 4/imm32 + 5947 # var slice/ecx: slice = {eax, ecx} + 5948 51/push-ecx + 5949 50/push-eax + 5950 89/<- %ecx 4/r32/esp + 5951 # _test-input-stream contains "int" + 5952 (clear-stream _test-input-stream) + 5953 (write _test-input-stream "int") + 5954 # var v/edx: (handle var) + 5955 68/push 0/imm32 + 5956 68/push 0/imm32 + 5957 89/<- %edx 4/r32/esp + 5958 # + 5959 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) + 5960 # var v-addr/edx: (addr var) = lookup(v) + 5961 (lookup *edx *(edx+4)) # => eax + 5962 89/<- %edx 0/r32/eax + 5963 # check v-addr->name + 5964 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 5965 (check-strings-equal %eax "x" "F - test-parse-var-with-type/name") + 5966 # check v-addr->type + 5967 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 5968 (check-ints-equal *eax 1 "F - test-parse-var-with-type/type:0") # Tree-is-atom + 5969 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type/type:1") # Tree-value + 5970 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type/type:2") # Tree-right + 5971 # . epilogue + 5972 89/<- %esp 5/r32/ebp + 5973 5d/pop-to-ebp + 5974 c3/return + 5975 + 5976 test-parse-var-with-type-and-register: + 5977 # . prologue + 5978 55/push-ebp + 5979 89/<- %ebp 4/r32/esp + 5980 # (eax..ecx) = "x/eax:" + 5981 b8/copy-to-eax "x/eax:"/imm32 + 5982 8b/-> *eax 1/r32/ecx + 5983 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 5984 05/add-to-eax 4/imm32 + 5985 # var slice/ecx: slice = {eax, ecx} + 5986 51/push-ecx + 5987 50/push-eax + 5988 89/<- %ecx 4/r32/esp + 5989 # _test-input-stream contains "int" + 5990 (clear-stream _test-input-stream) + 5991 (write _test-input-stream "int") + 5992 # var v/edx: (handle var) + 5993 68/push 0/imm32 + 5994 68/push 0/imm32 + 5995 89/<- %edx 4/r32/esp + 5996 # + 5997 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) + 5998 # var v-addr/edx: (addr var) = lookup(v) + 5999 (lookup *edx *(edx+4)) # => eax + 6000 89/<- %edx 0/r32/eax + 6001 # check v-addr->name + 6002 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 6003 (check-strings-equal %eax "x" "F - test-parse-var-with-type-and-register/name") + 6004 # check v-addr->register + 6005 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax + 6006 (check-strings-equal %eax "eax" "F - test-parse-var-with-type-and-register/register") + 6007 # check v-addr->type + 6008 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 6009 (check-ints-equal *eax 1 "F - test-parse-var-with-type-and-register/type:0") # Tree-is-atom + 6010 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type-and-register/type:1") # Tree-left + 6011 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type-and-register/type:2") # Tree-right + 6012 # . epilogue + 6013 89/<- %esp 5/r32/ebp + 6014 5d/pop-to-ebp + 6015 c3/return + 6016 + 6017 test-parse-var-with-trailing-characters: + 6018 # . prologue + 6019 55/push-ebp + 6020 89/<- %ebp 4/r32/esp + 6021 # (eax..ecx) = "x:" + 6022 b8/copy-to-eax "x:"/imm32 + 6023 8b/-> *eax 1/r32/ecx + 6024 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6025 05/add-to-eax 4/imm32 + 6026 # var slice/ecx: slice = {eax, ecx} + 6027 51/push-ecx + 6028 50/push-eax + 6029 89/<- %ecx 4/r32/esp + 6030 # _test-input-stream contains "int," + 6031 (clear-stream _test-input-stream) + 6032 (write _test-input-stream "int,") + 6033 # var v/edx: (handle var) + 6034 68/push 0/imm32 + 6035 68/push 0/imm32 + 6036 89/<- %edx 4/r32/esp + 6037 # + 6038 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) + 6039 # var v-addr/edx: (addr var) = lookup(v) + 6040 (lookup *edx *(edx+4)) # => eax + 6041 89/<- %edx 0/r32/eax + 6042 # check v-addr->name + 6043 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 6044 (check-strings-equal %eax "x" "F - test-parse-var-with-trailing-characters/name") + 6045 # check v-addr->register + 6046 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-trailing-characters/register") # Var-register + 6047 # check v-addr->type + 6048 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 6049 (check-ints-equal *eax 1 "F - test-parse-var-with-trailing-characters/type:0") # Tree-is-atom + 6050 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-trailing-characters/type:1") # Tree-left + 6051 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-trailing-characters/type:1") # Tree-right + 6052 # . epilogue + 6053 89/<- %esp 5/r32/ebp + 6054 5d/pop-to-ebp + 6055 c3/return + 6056 + 6057 test-parse-var-with-register-and-trailing-characters: + 6058 # . prologue + 6059 55/push-ebp + 6060 89/<- %ebp 4/r32/esp + 6061 # (eax..ecx) = "x/eax:" + 6062 b8/copy-to-eax "x/eax:"/imm32 + 6063 8b/-> *eax 1/r32/ecx + 6064 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6065 05/add-to-eax 4/imm32 + 6066 # var slice/ecx: slice = {eax, ecx} + 6067 51/push-ecx + 6068 50/push-eax + 6069 89/<- %ecx 4/r32/esp + 6070 # _test-input-stream contains "int," + 6071 (clear-stream _test-input-stream) + 6072 (write _test-input-stream "int,") + 6073 # var v/edx: (handle var) + 6074 68/push 0/imm32 + 6075 68/push 0/imm32 + 6076 89/<- %edx 4/r32/esp + 6077 # + 6078 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) + 6079 # var v-addr/edx: (addr var) = lookup(v) + 6080 (lookup *edx *(edx+4)) # => eax + 6081 89/<- %edx 0/r32/eax + 6082 # check v-addr->name + 6083 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 6084 (check-strings-equal %eax "x" "F - test-parse-var-with-register-and-trailing-characters/name") + 6085 # check v-addr->register + 6086 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax + 6087 (check-strings-equal %eax "eax" "F - test-parse-var-with-register-and-trailing-characters/register") + 6088 # check v-addr->type + 6089 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 6090 (check-ints-equal *eax 1 "F - test-parse-var-with-register-and-trailing-characters/type:0") # Tree-is-atom + 6091 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-register-and-trailing-characters/type:1") # Tree-left + 6092 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-register-and-trailing-characters/type:2") # Tree-right + 6093 # . epilogue + 6094 89/<- %esp 5/r32/ebp + 6095 5d/pop-to-ebp + 6096 c3/return + 6097 + 6098 test-parse-var-with-compound-type: + 6099 # . prologue + 6100 55/push-ebp + 6101 89/<- %ebp 4/r32/esp + 6102 # (eax..ecx) = "x:" + 6103 b8/copy-to-eax "x:"/imm32 + 6104 8b/-> *eax 1/r32/ecx + 6105 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6106 05/add-to-eax 4/imm32 + 6107 # var slice/ecx: slice = {eax, ecx} + 6108 51/push-ecx + 6109 50/push-eax + 6110 89/<- %ecx 4/r32/esp + 6111 # _test-input-stream contains "(addr int)" + 6112 (clear-stream _test-input-stream) + 6113 (write _test-input-stream "(addr int)") + 6114 # var v/edx: (handle var) + 6115 68/push 0/imm32 + 6116 68/push 0/imm32 + 6117 89/<- %edx 4/r32/esp + 6118 # + 6119 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) + 6120 # var v-addr/edx: (addr var) = lookup(v) + 6121 (lookup *edx *(edx+4)) # => eax + 6122 89/<- %edx 0/r32/eax + 6123 # check v-addr->name + 6124 (lookup *edx *(edx+4)) # Var-name Var-name => eax + 6125 (check-strings-equal %eax "x" "F - test-parse-var-with-compound-type/name") + 6126 # check v-addr->register + 6127 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-compound-type/register") # Var-register + 6128 # - check v-addr->type + 6129 # var type/edx: (addr tree type-id) = var->type + 6130 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax + 6131 89/<- %edx 0/r32/eax + 6132 # type is a non-atom + 6133 (check-ints-equal *edx 0 "F - test-parse-var-with-compound-type/type:0") # Tree-is-atom + 6134 # type->left == atom(addr) + 6135 (lookup *(edx+4) *(edx+8)) # Tree-left Tree-left => eax + 6136 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:1") # Tree-is-atom + 6137 (check-ints-equal *(eax+4) 2 "F - test-parse-var-with-compound-type/type:2") # Tree-value + 6138 # type->right->left == atom(int) + 6139 (lookup *(edx+0xc) *(edx+0x10)) # Tree-right Tree-right => eax + 6140 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax + 6141 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:3") # Tree-is-atom + 6142 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-compound-type/type:4") # Tree-value + 6143 # type->right->right == null + 6144 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-compound-type/type:5") # Tree-right + 6145 # . epilogue + 6146 89/<- %esp 5/r32/ebp + 6147 5d/pop-to-ebp + 6148 c3/return + 6149 + 6150 # identifier starts with a letter or '$' or '_' + 6151 # no constraints at the moment on later letters + 6152 # all we really want to do so far is exclude '{', '}' and '->' + 6153 is-identifier?: # in: (addr slice) -> result/eax: boolean + 6154 # . prologue + 6155 55/push-ebp + 6156 89/<- %ebp 4/r32/esp + 6157 # if (slice-empty?(in)) return false + 6158 (slice-empty? *(ebp+8)) # => eax + 6159 3d/compare-eax-and 0/imm32/false + 6160 75/jump-if-!= $is-identifier?:false/disp8 + 6161 # var c/eax: byte = *in->start + 6162 8b/-> *(ebp+8) 0/r32/eax + 6163 8b/-> *eax 0/r32/eax + 6164 8a/copy-byte *eax 0/r32/AL + 6165 81 4/subop/and %eax 0xff/imm32 + 6166 # if (c == '$') return true + 6167 3d/compare-eax-and 0x24/imm32/$ + 6168 74/jump-if-= $is-identifier?:true/disp8 + 6169 # if (c == '_') return true + 6170 3d/compare-eax-and 0x5f/imm32/_ + 6171 74/jump-if-= $is-identifier?:true/disp8 + 6172 # drop case + 6173 25/and-eax-with 0x5f/imm32 + 6174 # if (c < 'A') return false + 6175 3d/compare-eax-and 0x41/imm32/A + 6176 7c/jump-if-< $is-identifier?:false/disp8 + 6177 # if (c > 'Z') return false + 6178 3d/compare-eax-and 0x5a/imm32/Z + 6179 7f/jump-if-> $is-identifier?:false/disp8 + 6180 # otherwise return true + 6181 $is-identifier?:true: + 6182 b8/copy-to-eax 1/imm32/true + 6183 eb/jump $is-identifier?:end/disp8 + 6184 $is-identifier?:false: + 6185 b8/copy-to-eax 0/imm32/false + 6186 $is-identifier?:end: + 6187 # . epilogue + 6188 89/<- %esp 5/r32/ebp + 6189 5d/pop-to-ebp + 6190 c3/return + 6191 + 6192 test-is-identifier-dollar: + 6193 # . prologue + 6194 55/push-ebp + 6195 89/<- %ebp 4/r32/esp + 6196 # (eax..ecx) = "$a" + 6197 b8/copy-to-eax "$a"/imm32 + 6198 8b/-> *eax 1/r32/ecx + 6199 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6200 05/add-to-eax 4/imm32 + 6201 # var slice/ecx: slice = {eax, ecx} + 6202 51/push-ecx + 6203 50/push-eax + 6204 89/<- %ecx 4/r32/esp + 6205 # + 6206 (is-identifier? %ecx) + 6207 (check-ints-equal %eax 1 "F - test-is-identifier-dollar") + 6208 # . epilogue + 6209 89/<- %esp 5/r32/ebp + 6210 5d/pop-to-ebp + 6211 c3/return + 6212 + 6213 test-is-identifier-underscore: + 6214 # . prologue + 6215 55/push-ebp + 6216 89/<- %ebp 4/r32/esp + 6217 # (eax..ecx) = "_a" + 6218 b8/copy-to-eax "_a"/imm32 + 6219 8b/-> *eax 1/r32/ecx + 6220 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6221 05/add-to-eax 4/imm32 + 6222 # var slice/ecx: slice = {eax, ecx} + 6223 51/push-ecx + 6224 50/push-eax + 6225 89/<- %ecx 4/r32/esp + 6226 # + 6227 (is-identifier? %ecx) + 6228 (check-ints-equal %eax 1 "F - test-is-identifier-underscore") + 6229 # . epilogue + 6230 89/<- %esp 5/r32/ebp + 6231 5d/pop-to-ebp + 6232 c3/return + 6233 + 6234 test-is-identifier-a: + 6235 # . prologue + 6236 55/push-ebp + 6237 89/<- %ebp 4/r32/esp + 6238 # (eax..ecx) = "a$" + 6239 b8/copy-to-eax "a$"/imm32 + 6240 8b/-> *eax 1/r32/ecx + 6241 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6242 05/add-to-eax 4/imm32 + 6243 # var slice/ecx: slice = {eax, ecx} + 6244 51/push-ecx + 6245 50/push-eax + 6246 89/<- %ecx 4/r32/esp + 6247 # + 6248 (is-identifier? %ecx) + 6249 (check-ints-equal %eax 1 "F - test-is-identifier-a") + 6250 # . epilogue + 6251 89/<- %esp 5/r32/ebp + 6252 5d/pop-to-ebp + 6253 c3/return + 6254 + 6255 test-is-identifier-z: + 6256 # . prologue + 6257 55/push-ebp + 6258 89/<- %ebp 4/r32/esp + 6259 # (eax..ecx) = "z$" + 6260 b8/copy-to-eax "z$"/imm32 + 6261 8b/-> *eax 1/r32/ecx + 6262 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6263 05/add-to-eax 4/imm32 + 6264 # var slice/ecx: slice = {eax, ecx} + 6265 51/push-ecx + 6266 50/push-eax + 6267 89/<- %ecx 4/r32/esp + 6268 # + 6269 (is-identifier? %ecx) + 6270 (check-ints-equal %eax 1 "F - test-is-identifier-z") + 6271 # . epilogue + 6272 89/<- %esp 5/r32/ebp + 6273 5d/pop-to-ebp + 6274 c3/return + 6275 + 6276 test-is-identifier-A: + 6277 # . prologue + 6278 55/push-ebp + 6279 89/<- %ebp 4/r32/esp + 6280 # (eax..ecx) = "A$" + 6281 b8/copy-to-eax "A$"/imm32 + 6282 8b/-> *eax 1/r32/ecx + 6283 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6284 05/add-to-eax 4/imm32 + 6285 # var slice/ecx: slice = {eax, ecx} + 6286 51/push-ecx + 6287 50/push-eax + 6288 89/<- %ecx 4/r32/esp + 6289 # + 6290 (is-identifier? %ecx) + 6291 (check-ints-equal %eax 1 "F - test-is-identifier-A") + 6292 # . epilogue + 6293 89/<- %esp 5/r32/ebp + 6294 5d/pop-to-ebp + 6295 c3/return + 6296 + 6297 test-is-identifier-Z: + 6298 # . prologue + 6299 55/push-ebp + 6300 89/<- %ebp 4/r32/esp + 6301 # (eax..ecx) = "Z$" + 6302 b8/copy-to-eax "Z$"/imm32 + 6303 8b/-> *eax 1/r32/ecx + 6304 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6305 05/add-to-eax 4/imm32 + 6306 # var slice/ecx: slice = {eax, ecx} + 6307 51/push-ecx + 6308 50/push-eax + 6309 89/<- %ecx 4/r32/esp + 6310 # + 6311 (is-identifier? %ecx) + 6312 (check-ints-equal %eax 1 "F - test-is-identifier-Z") + 6313 # . epilogue + 6314 89/<- %esp 5/r32/ebp + 6315 5d/pop-to-ebp + 6316 c3/return + 6317 + 6318 test-is-identifier-at: + 6319 # character before 'A' is invalid + 6320 # . prologue + 6321 55/push-ebp + 6322 89/<- %ebp 4/r32/esp + 6323 # (eax..ecx) = "@a" + 6324 b8/copy-to-eax "@a"/imm32 + 6325 8b/-> *eax 1/r32/ecx + 6326 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6327 05/add-to-eax 4/imm32 + 6328 # var slice/ecx: slice = {eax, ecx} + 6329 51/push-ecx + 6330 50/push-eax + 6331 89/<- %ecx 4/r32/esp + 6332 # + 6333 (is-identifier? %ecx) + 6334 (check-ints-equal %eax 0 "F - test-is-identifier-@") + 6335 # . epilogue + 6336 89/<- %esp 5/r32/ebp + 6337 5d/pop-to-ebp + 6338 c3/return + 6339 + 6340 test-is-identifier-square-bracket: + 6341 # character after 'Z' is invalid + 6342 # . prologue + 6343 55/push-ebp + 6344 89/<- %ebp 4/r32/esp + 6345 # (eax..ecx) = "[a" + 6346 b8/copy-to-eax "[a"/imm32 + 6347 8b/-> *eax 1/r32/ecx + 6348 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6349 05/add-to-eax 4/imm32 + 6350 # var slice/ecx: slice = {eax, ecx} + 6351 51/push-ecx + 6352 50/push-eax + 6353 89/<- %ecx 4/r32/esp + 6354 # + 6355 (is-identifier? %ecx) + 6356 (check-ints-equal %eax 0 "F - test-is-identifier-@") + 6357 # . epilogue + 6358 89/<- %esp 5/r32/ebp + 6359 5d/pop-to-ebp + 6360 c3/return + 6361 + 6362 test-is-identifier-backtick: + 6363 # character before 'a' is invalid + 6364 # . prologue + 6365 55/push-ebp + 6366 89/<- %ebp 4/r32/esp + 6367 # (eax..ecx) = "`a" + 6368 b8/copy-to-eax "`a"/imm32 + 6369 8b/-> *eax 1/r32/ecx + 6370 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6371 05/add-to-eax 4/imm32 + 6372 # var slice/ecx: slice = {eax, ecx} + 6373 51/push-ecx + 6374 50/push-eax + 6375 89/<- %ecx 4/r32/esp + 6376 # + 6377 (is-identifier? %ecx) + 6378 (check-ints-equal %eax 0 "F - test-is-identifier-backtick") + 6379 # . epilogue + 6380 89/<- %esp 5/r32/ebp + 6381 5d/pop-to-ebp + 6382 c3/return 6383 - 6384 == code - 6385 - 6386 check-no-tokens-left: # line: (addr stream byte) - 6387 # . prologue - 6388 55/push-ebp - 6389 89/<- %ebp 4/r32/esp - 6390 # . save registers - 6391 50/push-eax - 6392 51/push-ecx - 6393 # var s/ecx: slice - 6394 68/push 0/imm32/end - 6395 68/push 0/imm32/start - 6396 89/<- %ecx 4/r32/esp - 6397 # - 6398 (next-mu-token *(ebp+8) %ecx) - 6399 # if slice-empty?(s) return - 6400 (slice-empty? %ecx) - 6401 3d/compare-eax-and 0/imm32/false - 6402 75/jump-if-!= $check-no-tokens-left:end/disp8 - 6403 # if (slice-starts-with?(s, '#') return - 6404 # . eax = *s->start - 6405 8b/-> *edx 0/r32/eax - 6406 8a/copy-byte *eax 0/r32/AL - 6407 81 4/subop/and %eax 0xff/imm32 - 6408 # . if (eax == '#') continue - 6409 3d/compare-eax-and 0x23/imm32/hash - 6410 74/jump-if-= $check-no-tokens-left:end/disp8 - 6411 # abort - 6412 (write-buffered Stderr "'{' or '}' should be on its own line, but got '") - 6413 (rewind-stream %ecx) - 6414 (write-stream 2 %ecx) - 6415 (write-buffered Stderr "'\n") - 6416 (flush Stderr) - 6417 # . syscall(exit, 1) - 6418 bb/copy-to-ebx 1/imm32 - 6419 e8/call syscall_exit/disp32 - 6420 # never gets here - 6421 $check-no-tokens-left:end: - 6422 # . reclaim locals - 6423 81 0/subop/add %esp 8/imm32 - 6424 # . restore registers - 6425 59/pop-to-ecx - 6426 58/pop-to-eax - 6427 # . epilogue - 6428 89/<- %esp 5/r32/ebp - 6429 5d/pop-to-ebp - 6430 c3/return - 6431 - 6432 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) - 6433 # pseudocode: - 6434 # var v: (handle var) - 6435 # new-literal(name, v) - 6436 # push(vars, {v, false}) - 6437 # parse-mu-block(in, vars, fn, out) - 6438 # pop(vars) - 6439 # out->tag = block - 6440 # out->var = v + 6384 test-is-identifier-curly-brace-open: + 6385 # character after 'z' is invalid; also used for blocks + 6386 # . prologue + 6387 55/push-ebp + 6388 89/<- %ebp 4/r32/esp + 6389 # (eax..ecx) = "{a" + 6390 b8/copy-to-eax "{a"/imm32 + 6391 8b/-> *eax 1/r32/ecx + 6392 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6393 05/add-to-eax 4/imm32 + 6394 # var slice/ecx: slice = {eax, ecx} + 6395 51/push-ecx + 6396 50/push-eax + 6397 89/<- %ecx 4/r32/esp + 6398 # + 6399 (is-identifier? %ecx) + 6400 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open") + 6401 # . epilogue + 6402 89/<- %esp 5/r32/ebp + 6403 5d/pop-to-ebp + 6404 c3/return + 6405 + 6406 test-is-identifier-curly-brace-close: + 6407 # . prologue + 6408 55/push-ebp + 6409 89/<- %ebp 4/r32/esp + 6410 # (eax..ecx) = "}a" + 6411 b8/copy-to-eax "}a"/imm32 + 6412 8b/-> *eax 1/r32/ecx + 6413 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6414 05/add-to-eax 4/imm32 + 6415 # var slice/ecx: slice = {eax, ecx} + 6416 51/push-ecx + 6417 50/push-eax + 6418 89/<- %ecx 4/r32/esp + 6419 # + 6420 (is-identifier? %ecx) + 6421 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close") + 6422 # . epilogue + 6423 89/<- %esp 5/r32/ebp + 6424 5d/pop-to-ebp + 6425 c3/return + 6426 + 6427 test-is-identifier-hyphen: + 6428 # disallow leading '-' since '->' has special meaning + 6429 # . prologue + 6430 55/push-ebp + 6431 89/<- %ebp 4/r32/esp + 6432 # (eax..ecx) = "-a" + 6433 b8/copy-to-eax "-a"/imm32 + 6434 8b/-> *eax 1/r32/ecx + 6435 8d/copy-address *(eax+ecx+4) 1/r32/ecx + 6436 05/add-to-eax 4/imm32 + 6437 # var slice/ecx: slice = {eax, ecx} + 6438 51/push-ecx + 6439 50/push-eax + 6440 89/<- %ecx 4/r32/esp 6441 # - 6442 # . prologue - 6443 55/push-ebp - 6444 89/<- %ebp 4/r32/esp - 6445 # . save registers - 6446 50/push-eax - 6447 51/push-ecx - 6448 57/push-edi - 6449 # var v/ecx: (handle var) - 6450 68/push 0/imm32 - 6451 68/push 0/imm32 - 6452 89/<- %ecx 4/r32/esp - 6453 # - 6454 (new-literal Heap *(ebp+8) %ecx) - 6455 # push(vars, v) - 6456 (push *(ebp+0x10) *ecx) - 6457 (push *(ebp+0x10) *(ecx+4)) - 6458 (push *(ebp+0x10) 0) # false - 6459 # - 6460 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20)) - 6461 # pop v off vars - 6462 (pop *(ebp+0x10)) # => eax - 6463 (pop *(ebp+0x10)) # => eax - 6464 (pop *(ebp+0x10)) # => eax - 6465 # var out-addr/edi: (addr stmt) = lookup(*out) - 6466 8b/-> *(ebp+0x18) 7/r32/edi - 6467 (lookup *edi *(edi+4)) # => eax - 6468 89/<- %edi 0/r32/eax - 6469 # out-addr->tag = named-block - 6470 c7 0/subop/copy *edi 0/imm32/block # Stmt-tag - 6471 # out-addr->var = v - 6472 8b/-> *ecx 0/r32/eax - 6473 89/<- *(edi+0xc) 0/r32/eax # Block-var - 6474 8b/-> *(ecx+4) 0/r32/eax - 6475 89/<- *(edi+0x10) 0/r32/eax # Block-var - 6476 $parse-mu-named-block:end: - 6477 # . reclaim locals - 6478 81 0/subop/add %esp 8/imm32 - 6479 # . restore registers - 6480 5f/pop-to-edi - 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 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) - 6489 # . prologue - 6490 55/push-ebp - 6491 89/<- %ebp 4/r32/esp - 6492 # . save registers - 6493 50/push-eax - 6494 51/push-ecx - 6495 52/push-edx - 6496 57/push-edi - 6497 # edi = out - 6498 8b/-> *(ebp+0x10) 7/r32/edi - 6499 # var word-slice/ecx: slice - 6500 68/push 0/imm32/end - 6501 68/push 0/imm32/start - 6502 89/<- %ecx 4/r32/esp - 6503 # var v/edx: (handle var) - 6504 68/push 0/imm32 - 6505 68/push 0/imm32 - 6506 89/<- %edx 4/r32/esp - 6507 # v = parse-var-with-type(next-mu-token(line)) - 6508 (next-mu-token *(ebp+8) %ecx) - 6509 (parse-var-with-type %ecx *(ebp+8) %edx *(ebp+0x18) *(ebp+0x1c)) - 6510 # - 6511 (push *(ebp+0xc) *edx) - 6512 (push *(ebp+0xc) *(edx+4)) - 6513 (push *(ebp+0xc) 0) # Live-var-register-spilled is unused during parsing - 6514 # either v has no register and there's no more to this line - 6515 (lookup *edx *(edx+4)) # => eax - 6516 8b/-> *(eax+0x18) 0/r32/eax # Var-register - 6517 3d/compare-eax-and 0/imm32 - 6518 { - 6519 75/jump-if-!= break/disp8 - 6520 # TODO: disallow vars of type 'byte' on the stack - 6521 # ensure that there's nothing else on this line - 6522 (next-mu-token *(ebp+8) %ecx) - 6523 (slice-empty? %ecx) # => eax - 6524 3d/compare-eax-and 0/imm32/false - 6525 0f 84/jump-if-= $parse-mu-var-def:error2/disp32 - 6526 # - 6527 (new-var-def Heap *edx *(edx+4) %edi) - 6528 e9/jump $parse-mu-var-def:end/disp32 - 6529 } - 6530 # or v has a register and there's more to this line - 6531 { - 6532 0f 84/jump-if-= break/disp32 - 6533 # TODO: disallow vars of type 'byte' in registers 'esi' or 'edi' - 6534 # TODO: vars of type 'byte' should only be initialized by clearing to 0 - 6535 # ensure that the next word is '<-' - 6536 (next-mu-token *(ebp+8) %ecx) - 6537 (slice-equal? %ecx "<-") # => eax - 6538 3d/compare-eax-and 0/imm32/false - 6539 74/jump-if-= $parse-mu-var-def:error1/disp8 - 6540 # - 6541 (new-reg-var-def Heap *edx *(edx+4) %edi) - 6542 (lookup *edi *(edi+4)) # => eax - 6543 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) - 6544 } - 6545 $parse-mu-var-def:end: - 6546 # . reclaim locals - 6547 81 0/subop/add %esp 0x10/imm32 - 6548 # . restore registers - 6549 5f/pop-to-edi - 6550 5a/pop-to-edx - 6551 59/pop-to-ecx - 6552 58/pop-to-eax - 6553 # . epilogue - 6554 89/<- %esp 5/r32/ebp - 6555 5d/pop-to-ebp - 6556 c3/return - 6557 - 6558 $parse-mu-var-def:error1: - 6559 (rewind-stream *(ebp+8)) - 6560 # error("register variable requires a valid instruction to initialize but got '" line "'\n") - 6561 (write-buffered *(ebp+0x18) "register variable requires a valid instruction to initialize but got '") - 6562 (flush *(ebp+0x18)) - 6563 (write-stream 2 *(ebp+8)) - 6564 (write-buffered *(ebp+0x18) "'\n") - 6565 (flush *(ebp+0x18)) - 6566 (stop *(ebp+0x1c) 1) - 6567 # never gets here - 6568 - 6569 $parse-mu-var-def:error2: - 6570 (rewind-stream *(ebp+8)) - 6571 # error("fn " fn ": var " var ": variables on the stack can't take an initializer\n") - 6572 (write-buffered *(ebp+0x18) "fn ") - 6573 8b/-> *(ebp+0x14) 0/r32/eax - 6574 (lookup *eax *(eax+4)) # Function-name Function-name => eax - 6575 (write-buffered *(ebp+0x18) %eax) - 6576 (write-buffered *(ebp+0x18) ": var ") - 6577 # var v-addr/eax: (addr var) = lookup(v) - 6578 (lookup *edx *(edx+4)) # => eax - 6579 (lookup *eax *(eax+4)) # Var-name Var-name => eax - 6580 (write-buffered *(ebp+0x18) %eax) - 6581 (write-buffered *(ebp+0x18) ": variables on the stack can't take an initializer\n") - 6582 (flush *(ebp+0x18)) - 6583 (stop *(ebp+0x1c) 1) - 6584 # never gets here - 6585 - 6586 test-parse-mu-var-def: - 6587 # 'var n: int' - 6588 # . prologue - 6589 55/push-ebp - 6590 89/<- %ebp 4/r32/esp - 6591 # setup - 6592 (clear-stream _test-input-stream) - 6593 (write _test-input-stream "n: int\n") # caller has consumed the 'var' - 6594 # var out/esi: (handle stmt) - 6595 68/push 0/imm32 - 6596 68/push 0/imm32 - 6597 89/<- %esi 4/r32/esp - 6598 # var vars/ecx: (stack (addr var) 16) - 6599 81 5/subop/subtract %esp 0xc0/imm32 - 6600 68/push 0xc0/imm32/size - 6601 68/push 0/imm32/top - 6602 89/<- %ecx 4/r32/esp - 6603 (clear-stack %ecx) - 6604 # convert - 6605 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) - 6606 # var out-addr/esi: (addr stmt) - 6607 (lookup *esi *(esi+4)) # => eax - 6608 89/<- %esi 0/r32/eax - 6609 # - 6610 (check-ints-equal *esi 2 "F - test-parse-mu-var-def/tag") # Stmt-tag is var-def - 6611 # var v/ecx: (addr var) = lookup(out->var) - 6612 (lookup *(esi+4) *(esi+8)) # Vardef-var Vardef-var => eax - 6613 89/<- %ecx 0/r32/eax - 6614 # v->name - 6615 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax - 6616 (check-strings-equal %eax "n" "F - test-parse-mu-var-def/var-name") - 6617 # v->register - 6618 (check-ints-equal *(ecx+0x18) 0 "F - test-parse-mu-var-def/var-register") # Var-register - 6619 # v->type == int - 6620 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 6621 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0") # Tree-is-atom - 6622 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-var-def/var-type:1") # Tree-value - 6623 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-var-def/var-type:2") # Tree-right - 6624 # . epilogue - 6625 89/<- %esp 5/r32/ebp - 6626 5d/pop-to-ebp - 6627 c3/return - 6628 - 6629 test-parse-mu-reg-var-def: - 6630 # 'var n/eax: int <- copy 0' - 6631 # . prologue - 6632 55/push-ebp - 6633 89/<- %ebp 4/r32/esp - 6634 # setup - 6635 (clear-stream _test-input-stream) - 6636 (write _test-input-stream "n/eax: int <- copy 0\n") # caller has consumed the 'var' - 6637 # var out/esi: (handle stmt) - 6638 68/push 0/imm32 - 6639 68/push 0/imm32 - 6640 89/<- %esi 4/r32/esp - 6641 # var vars/ecx: (stack (addr var) 16) - 6642 81 5/subop/subtract %esp 0xc0/imm32 - 6643 68/push 0xc0/imm32/size - 6644 68/push 0/imm32/top - 6645 89/<- %ecx 4/r32/esp - 6646 (clear-stack %ecx) - 6647 # convert - 6648 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) - 6649 # var out-addr/esi: (addr stmt) - 6650 (lookup *esi *(esi+4)) # => eax - 6651 89/<- %esi 0/r32/eax - 6652 # - 6653 (check-ints-equal *esi 3 "F - test-parse-mu-reg-var-def/tag") # Stmt-tag is reg-var-def - 6654 # var v/ecx: (addr var) = lookup(out->outputs->value) - 6655 # . eax: (addr stmt-var) = lookup(out->outputs) - 6656 (lookup *(esi+0x14) *(esi+0x18)) # Regvardef-outputs Regvardef-outputs => eax - 6657 # . - 6658 (check-ints-equal *(eax+8) 0 "F - test-parse-mu-reg-var-def/single-output") # Stmt-var-next - 6659 # . eax: (addr var) = lookup(eax->value) - 6660 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 6661 # . ecx = eax - 6662 89/<- %ecx 0/r32/eax - 6663 # v->name - 6664 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax - 6665 (check-strings-equal %eax "n" "F - test-parse-mu-reg-var-def/output-name") # Var-name - 6666 # v->register - 6667 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax - 6668 (check-strings-equal %eax "eax" "F - test-parse-mu-reg-var-def/output-register") - 6669 # v->type == int - 6670 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 6671 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0") # Tree-is-atom - 6672 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-reg-var-def/output-type:1") # Tree-value - 6673 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-reg-var-def/output-type:2") # Tree-right - 6674 # . epilogue - 6675 89/<- %esp 5/r32/ebp - 6676 5d/pop-to-ebp - 6677 c3/return - 6678 - 6679 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) - 6680 # pseudocode: - 6681 # var name: slice - 6682 # allocate(Heap, Stmt-size, out) - 6683 # var out-addr: (addr stmt) = lookup(*out) - 6684 # out-addr->tag = stmt - 6685 # if stmt-has-outputs?(line) - 6686 # while true - 6687 # name = next-mu-token(line) - 6688 # if (name == '<-') break - 6689 # assert(is-identifier?(name)) - 6690 # var v: (handle var) = lookup-or-define-var(name, vars, fn) # regular stmts may define vars in fn outputs - 6691 # out-addr->outputs = append(v, out-addr->outputs) - 6692 # add-operation-and-inputs-to-stmt(out-addr, line, vars) - 6693 # - 6694 # . prologue - 6695 55/push-ebp - 6696 89/<- %ebp 4/r32/esp - 6697 # . save registers - 6698 50/push-eax - 6699 51/push-ecx - 6700 52/push-edx - 6701 53/push-ebx - 6702 57/push-edi - 6703 # var name/ecx: slice - 6704 68/push 0/imm32/end - 6705 68/push 0/imm32/start - 6706 89/<- %ecx 4/r32/esp - 6707 # var is-deref?/edx: boolean = false - 6708 ba/copy-to-edx 0/imm32/false - 6709 # var v: (handle var) - 6710 68/push 0/imm32 - 6711 68/push 0/imm32 - 6712 89/<- %ebx 4/r32/esp - 6713 # - 6714 (allocate Heap *Stmt-size *(ebp+0x14)) - 6715 # var out-addr/edi: (addr stmt) = lookup(*out) - 6716 8b/-> *(ebp+0x14) 7/r32/edi - 6717 (lookup *edi *(edi+4)) # => eax - 6718 89/<- %edi 0/r32/eax - 6719 # out-addr->tag = 1/stmt - 6720 c7 0/subop/copy *edi 1/imm32/stmt1 # Stmt-tag - 6721 { - 6722 (stmt-has-outputs? *(ebp+8)) - 6723 3d/compare-eax-and 0/imm32/false - 6724 0f 84/jump-if-= break/disp32 - 6725 { - 6726 $parse-mu-stmt:read-outputs: - 6727 # name = next-mu-token(line) - 6728 (next-mu-token *(ebp+8) %ecx) - 6729 # if slice-empty?(word-slice) break - 6730 (slice-empty? %ecx) # => eax - 6731 3d/compare-eax-and 0/imm32/false - 6732 0f 85/jump-if-!= break/disp32 - 6733 # if (name == "<-") break - 6734 (slice-equal? %ecx "<-") # => eax - 6735 3d/compare-eax-and 0/imm32/false - 6736 0f 85/jump-if-!= break/disp32 - 6737 # is-deref? = false - 6738 ba/copy-to-edx 0/imm32/false - 6739 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? - 6740 8b/-> *ecx 0/r32/eax # Slice-start - 6741 8a/copy-byte *eax 0/r32/AL - 6742 81 4/subop/and %eax 0xff/imm32 - 6743 3d/compare-eax-and 0x2a/imm32/asterisk - 6744 { - 6745 75/jump-if-!= break/disp8 - 6746 ff 0/subop/increment *ecx - 6747 ba/copy-to-edx 1/imm32/true - 6748 } - 6749 # assert(is-identifier?(name)) - 6750 (is-identifier? %ecx) # => eax - 6751 3d/compare-eax-and 0/imm32/false - 6752 0f 84/jump-if-= $parse-mu-stmt:abort/disp32 - 6753 # - 6754 (lookup-or-define-var %ecx *(ebp+0xc) *(ebp+0x10) %ebx *(ebp+0x18) *(ebp+0x1c)) - 6755 8d/copy-address *(edi+0x14) 0/r32/eax # Stmt1-outputs - 6756 (append-stmt-var Heap *ebx *(ebx+4) *(edi+0x14) *(edi+0x18) %edx %eax) # Stmt1-outputs - 6757 # - 6758 e9/jump loop/disp32 - 6759 } - 6760 } - 6761 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) - 6762 $parse-mu-stmt:end: - 6763 # . reclaim locals - 6764 81 0/subop/add %esp 0x10/imm32 - 6765 # . restore registers - 6766 5f/pop-to-edi - 6767 5b/pop-to-ebx - 6768 5a/pop-to-edx - 6769 59/pop-to-ecx - 6770 58/pop-to-eax - 6771 # . epilogue - 6772 89/<- %esp 5/r32/ebp - 6773 5d/pop-to-ebp - 6774 c3/return - 6775 - 6776 $parse-mu-stmt:abort: - 6777 # error("invalid identifier '" name "'\n") - 6778 (write-buffered *(ebp+0x18) "invalid identifier '") - 6779 (write-slice-buffered *(ebp+0x18) %ecx) - 6780 (write-buffered *(ebp+0x18) "'\n") - 6781 (flush *(ebp+0x18)) - 6782 (stop *(ebp+0x1c) 1) - 6783 # never gets here - 6784 - 6785 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) - 6786 # pseudocode: - 6787 # stmt->name = slice-to-string(next-mu-token(line)) - 6788 # while true - 6789 # name = next-mu-token(line) - 6790 # v = lookup-var-or-literal(name) - 6791 # stmt->inouts = append(v, stmt->inouts) - 6792 # - 6793 # . prologue - 6794 55/push-ebp - 6795 89/<- %ebp 4/r32/esp - 6796 # . save registers - 6797 50/push-eax - 6798 51/push-ecx - 6799 52/push-edx - 6800 53/push-ebx - 6801 56/push-esi - 6802 57/push-edi - 6803 # edi = stmt - 6804 8b/-> *(ebp+8) 7/r32/edi - 6805 # var name/ecx: slice - 6806 68/push 0/imm32/end - 6807 68/push 0/imm32/start - 6808 89/<- %ecx 4/r32/esp - 6809 # var is-deref?/edx: boolean = false - 6810 ba/copy-to-edx 0/imm32/false - 6811 # var v/esi: (handle var) - 6812 68/push 0/imm32 - 6813 68/push 0/imm32 - 6814 89/<- %esi 4/r32/esp - 6815 $add-operation-and-inputs-to-stmt:read-operation: - 6816 (next-mu-token *(ebp+0xc) %ecx) - 6817 8d/copy-address *(edi+4) 0/r32/eax # Stmt1-operation or Regvardef-operationStmt1-operation or Regvardef-operation - 6818 (slice-to-string Heap %ecx %eax) - 6819 # var is-get?/ebx: boolean = (name == "get") - 6820 (slice-equal? %ecx "get") # => eax - 6821 89/<- %ebx 0/r32/eax - 6822 { - 6823 $add-operation-and-inputs-to-stmt:read-inouts: - 6824 # name = next-mu-token(line) - 6825 (next-mu-token *(ebp+0xc) %ecx) - 6826 # if slice-empty?(word-slice) break - 6827 (slice-empty? %ecx) # => eax - 6828 3d/compare-eax-and 0/imm32/false - 6829 0f 85/jump-if-!= break/disp32 - 6830 # if (name == "<-") abort - 6831 (slice-equal? %ecx "<-") - 6832 3d/compare-eax-and 0/imm32/false - 6833 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32 - 6834 # if (is-get? && second operand) lookup or create offset - 6835 { - 6836 81 7/subop/compare %ebx 0/imm32/false - 6837 74/jump-if-= break/disp8 - 6838 (lookup *(edi+0xc) *(edi+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 6839 3d/compare-eax-and 0/imm32 - 6840 74/jump-if-= break/disp8 - 6841 (lookup-or-create-constant %eax %ecx %esi) - 6842 #? (lookup *esi *(esi+4)) - 6843 #? (write-buffered Stderr "creating new output var ") - 6844 #? (print-int32-buffered Stderr %eax) - 6845 #? (write-buffered Stderr " for field called ") - 6846 #? (write-slice-buffered Stderr %ecx) - 6847 #? (write-buffered Stderr "; var name ") - 6848 #? (lookup *eax *(eax+4)) # Var-name - 6849 #? (write-buffered Stderr %eax) - 6850 #? (write-buffered Stderr Newline) - 6851 #? (flush Stderr) - 6852 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32 - 6853 } - 6854 # is-deref? = false - 6855 ba/copy-to-edx 0/imm32/false - 6856 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? - 6857 8b/-> *ecx 0/r32/eax # Slice-start - 6858 8a/copy-byte *eax 0/r32/AL - 6859 81 4/subop/and %eax 0xff/imm32 - 6860 3d/compare-eax-and 0x2a/imm32/asterisk - 6861 { - 6862 75/jump-if-!= break/disp8 - 6863 $add-operation-and-inputs-to-stmt:inout-is-deref: - 6864 ff 0/subop/increment *ecx - 6865 ba/copy-to-edx 1/imm32/true - 6866 } - 6867 (lookup-var-or-literal %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18)) - 6868 $add-operation-and-inputs-to-stmt:save-var: - 6869 8d/copy-address *(edi+0xc) 0/r32/eax - 6870 (append-stmt-var Heap *esi *(esi+4) *(edi+0xc) *(edi+0x10) %edx %eax) # Stmt1-inouts or Regvardef-inouts - 6871 # - 6872 e9/jump loop/disp32 - 6873 } - 6874 $add-operation-and-inputs-to-stmt:end: - 6875 # . reclaim locals - 6876 81 0/subop/add %esp 0x10/imm32 - 6877 # . restore registers - 6878 5f/pop-to-edi - 6879 5e/pop-to-esi - 6880 5b/pop-to-ebx - 6881 5a/pop-to-edx - 6882 59/pop-to-ecx - 6883 58/pop-to-eax - 6884 # . epilogue - 6885 89/<- %esp 5/r32/ebp - 6886 5d/pop-to-ebp - 6887 c3/return - 6888 - 6889 $add-operation-and-inputs-to-stmt:abort: - 6890 # error("invalid statement '" line "'\n") - 6891 (rewind-stream *(ebp+8)) - 6892 (write-buffered *(ebp+0x14) "invalid identifier '") - 6893 (flush *(ebp+0x14)) - 6894 (write-stream 2 *(ebp+8)) - 6895 (write-buffered *(ebp+0x14) "'\n") - 6896 (flush *(ebp+0x14)) - 6897 (stop *(ebp+0x18) 1) - 6898 # never gets here - 6899 - 6900 stmt-has-outputs?: # line: (addr stream byte) -> result/eax: boolean - 6901 # . prologue - 6902 55/push-ebp - 6903 89/<- %ebp 4/r32/esp - 6904 # . save registers - 6905 51/push-ecx - 6906 # var word-slice/ecx: slice - 6907 68/push 0/imm32/end - 6908 68/push 0/imm32/start - 6909 89/<- %ecx 4/r32/esp - 6910 # result = false - 6911 b8/copy-to-eax 0/imm32/false - 6912 (rewind-stream *(ebp+8)) - 6913 { - 6914 (next-mu-token *(ebp+8) %ecx) - 6915 # if slice-empty?(word-slice) break - 6916 (slice-empty? %ecx) - 6917 3d/compare-eax-and 0/imm32/false - 6918 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) - 6919 0f 85/jump-if-!= break/disp32 - 6920 # if slice-starts-with?(word-slice, '#') break - 6921 # . eax = *word-slice->start - 6922 8b/-> *ecx 0/r32/eax - 6923 8a/copy-byte *eax 0/r32/AL - 6924 81 4/subop/and %eax 0xff/imm32 - 6925 # . if (eax == '#') break - 6926 3d/compare-eax-and 0x23/imm32/hash - 6927 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) - 6928 0f 84/jump-if-= break/disp32 - 6929 # if slice-equal?(word-slice, '<-') return true - 6930 (slice-equal? %ecx "<-") - 6931 3d/compare-eax-and 0/imm32/false - 6932 74/jump-if-= loop/disp8 - 6933 b8/copy-to-eax 1/imm32/true - 6934 } - 6935 $stmt-has-outputs:end: - 6936 (rewind-stream *(ebp+8)) - 6937 # . reclaim locals - 6938 81 0/subop/add %esp 8/imm32 - 6939 # . restore registers - 6940 59/pop-to-ecx - 6941 # . epilogue - 6942 89/<- %esp 5/r32/ebp - 6943 5d/pop-to-ebp - 6944 c3/return - 6945 - 6946 # if 'name' starts with a digit, create a new literal var for it - 6947 # otherwise return first 'name' from the top (back) of 'vars' and abort if not found - 6948 lookup-var-or-literal: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) - 6949 # . prologue - 6950 55/push-ebp - 6951 89/<- %ebp 4/r32/esp - 6952 # . save registers - 6953 50/push-eax - 6954 51/push-ecx - 6955 56/push-esi - 6956 # esi = name - 6957 8b/-> *(ebp+8) 6/r32/esi - 6958 # if slice-empty?(name) abort - 6959 (slice-empty? %esi) # => eax - 6960 3d/compare-eax-and 0/imm32/false - 6961 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32 - 6962 # var c/ecx: byte = *name->start - 6963 8b/-> *esi 1/r32/ecx - 6964 8a/copy-byte *ecx 1/r32/CL - 6965 81 4/subop/and %ecx 0xff/imm32 - 6966 # if is-decimal-digit?(c) return new var(name) - 6967 { - 6968 (is-decimal-digit? %ecx) # => eax - 6969 3d/compare-eax-and 0/imm32/false - 6970 74/jump-if-= break/disp8 - 6971 $lookup-var-or-literal:literal: - 6972 (new-literal-integer Heap %esi *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) - 6973 eb/jump $lookup-var-or-literal:end/disp8 - 6974 } - 6975 # else if (c == '"') return new var(name) - 6976 { - 6977 81 7/subop/compare %ecx 0x22/imm32/dquote - 6978 75/jump-if-!= break/disp8 - 6979 $lookup-var-or-literal:literal-string: - 6980 (new-literal Heap %esi *(ebp+0x10)) - 6981 eb/jump $lookup-var-or-literal:end/disp8 - 6982 } - 6983 # otherwise return lookup-var(name, vars) - 6984 { - 6985 $lookup-var-or-literal:var: - 6986 (lookup-var %esi *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) - 6987 } - 6988 $lookup-var-or-literal:end: - 6989 # . restore registers - 6990 5e/pop-to-esi - 6991 59/pop-to-ecx - 6992 58/pop-to-eax - 6993 # . epilogue - 6994 89/<- %esp 5/r32/ebp - 6995 5d/pop-to-ebp - 6996 c3/return - 6997 - 6998 $lookup-var-or-literal:abort: - 6999 (write-buffered *(ebp+0x14) "empty variable!") - 7000 (flush *(ebp+0x14)) - 7001 (stop *(ebp+0x18) 1) - 7002 # never gets here - 7003 - 7004 # return first 'name' from the top (back) of 'vars' and abort if not found - 7005 lookup-var: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) - 7006 # . prologue - 7007 55/push-ebp - 7008 89/<- %ebp 4/r32/esp - 7009 # . save registers - 7010 50/push-eax - 7011 # - 7012 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) - 7013 # if (*out == 0) abort - 7014 8b/-> *(ebp+0x10) 0/r32/eax - 7015 81 7/subop/compare *eax 0/imm32 - 7016 74/jump-if-= $lookup-var:abort/disp8 - 7017 $lookup-var:end: - 7018 # . restore registers - 7019 58/pop-to-eax - 7020 # . epilogue - 7021 89/<- %esp 5/r32/ebp - 7022 5d/pop-to-ebp - 7023 c3/return - 7024 - 7025 $lookup-var:abort: - 7026 (write-buffered *(ebp+0x14) "unknown variable '") - 7027 (write-slice-buffered *(ebp+0x14) *(ebp+8)) - 7028 (write-buffered *(ebp+0x14) "'\n") - 7029 (flush *(ebp+0x14)) - 7030 (stop *(ebp+0x18) 1) - 7031 # never gets here - 7032 - 7033 # return first 'name' from the top (back) of 'vars', and 0/null if not found - 7034 lookup-var-helper: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) - 7035 # pseudocode: - 7036 # var curr: (addr handle var) = &vars->data[vars->top - 12] - 7037 # var min = vars->data - 7038 # while curr >= min - 7039 # var v: (handle var) = *curr - 7040 # if v->name == name - 7041 # return - 7042 # curr -= 12 - 7043 # - 7044 # . prologue - 7045 55/push-ebp - 7046 89/<- %ebp 4/r32/esp - 7047 # . save registers - 7048 50/push-eax - 7049 51/push-ecx - 7050 52/push-edx - 7051 53/push-ebx - 7052 56/push-esi - 7053 # clear out - 7054 (zero-out *(ebp+0x10) *Handle-size) - 7055 # esi = vars - 7056 8b/-> *(ebp+0xc) 6/r32/esi - 7057 # ebx = vars->top - 7058 8b/-> *esi 3/r32/ebx - 7059 # if (vars->top > vars->size) abort - 7060 3b/compare<- *(esi+4) 0/r32/eax - 7061 0f 8f/jump-if-> $lookup-var-helper:error1/disp32 - 7062 # var min/edx: (addr handle var) = vars->data - 7063 8d/copy-address *(esi+8) 2/r32/edx - 7064 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] - 7065 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 - 7066 { - 7067 # if (curr < min) return - 7068 39/compare %ebx 2/r32/edx - 7069 0f 82/jump-if-addr< break/disp32 - 7070 # var v/ecx: (addr var) = lookup(*curr) - 7071 (lookup *ebx *(ebx+4)) # => eax - 7072 89/<- %ecx 0/r32/eax - 7073 # var vn/eax: (addr array byte) = lookup(v->name) - 7074 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax - 7075 # if (vn == name) return curr - 7076 (slice-equal? *(ebp+8) %eax) # => eax - 7077 3d/compare-eax-and 0/imm32/false - 7078 { - 7079 74/jump-if-= break/disp8 - 7080 # esi = out - 7081 8b/-> *(ebp+0x10) 6/r32/esi - 7082 # *out = *curr - 7083 8b/-> *ebx 0/r32/eax - 7084 89/<- *esi 0/r32/eax - 7085 8b/-> *(ebx+4) 0/r32/eax - 7086 89/<- *(esi+4) 0/r32/eax - 7087 # return - 7088 eb/jump $lookup-var-helper:end/disp8 - 7089 } - 7090 # curr -= 12 - 7091 81 5/subop/subtract %ebx 0xc/imm32 - 7092 e9/jump loop/disp32 - 7093 } - 7094 $lookup-var-helper:end: - 7095 # . restore registers - 7096 5e/pop-to-esi - 7097 5b/pop-to-ebx - 7098 5a/pop-to-edx - 7099 59/pop-to-ecx - 7100 58/pop-to-eax - 7101 # . epilogue - 7102 89/<- %esp 5/r32/ebp - 7103 5d/pop-to-ebp - 7104 c3/return - 7105 - 7106 $lookup-var-helper:error1: - 7107 (write-buffered *(ebp+0x14) "malformed stack when looking up '") - 7108 (write-slice-buffered *(ebp+0x14) *(ebp+8)) - 7109 (write-buffered *(ebp+0x14) "'\n") - 7110 (flush *(ebp+0x14)) - 7111 (stop *(ebp+0x18) 1) - 7112 # never gets here - 7113 - 7114 # return first 'name' from the top (back) of 'vars' and create a new var for a fn output if not found - 7115 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) - 7116 # . prologue - 7117 55/push-ebp - 7118 89/<- %ebp 4/r32/esp - 7119 # . save registers - 7120 50/push-eax - 7121 # - 7122 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x14)) - 7123 { - 7124 # if (out != 0) return - 7125 8b/-> *(ebp+0x14) 0/r32/eax - 7126 81 7/subop/compare *eax 0/imm32 - 7127 75/jump-if-!= break/disp8 - 7128 # if name is one of fn's outputs, return it - 7129 { - 7130 (find-in-function-outputs *(ebp+0x10) *(ebp+8) *(ebp+0x14)) - 7131 8b/-> *(ebp+0x14) 0/r32/eax - 7132 81 7/subop/compare *eax 0/imm32 - 7133 # otherwise abort - 7134 0f 84/jump-if-= $lookup-or-define-var:abort/disp32 - 7135 # update vars - 7136 (push *(ebp+0xc) *eax) - 7137 (push *(ebp+0xc) *(eax+4)) - 7138 (push *(ebp+0xc) 0) # never spill fn-outputs - 7139 } - 7140 } - 7141 $lookup-or-define-var:end: - 7142 # . restore registers + 6442 (is-identifier? %ecx) + 6443 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen") + 6444 # . epilogue + 6445 89/<- %esp 5/r32/ebp + 6446 5d/pop-to-ebp + 6447 c3/return + 6448 + 6449 populate-mu-function-body: # in: (addr buffered-file), out: (addr function), vars: (addr stack live-var), err: (addr buffered-file), ed: (addr exit-descriptor) + 6450 # . prologue + 6451 55/push-ebp + 6452 89/<- %ebp 4/r32/esp + 6453 # . save registers + 6454 50/push-eax + 6455 56/push-esi + 6456 57/push-edi + 6457 # esi = in + 6458 8b/-> *(ebp+8) 6/r32/esi + 6459 # edi = out + 6460 8b/-> *(ebp+0xc) 7/r32/edi + 6461 # parse-mu-block(in, vars, out, out->body) + 6462 8d/copy-address *(edi+0x18) 0/r32/eax # Function-body + 6463 (parse-mu-block %esi *(ebp+0x10) %edi %eax *(ebp+0x14) *(ebp+0x18)) + 6464 $populate-mu-function-body:end: + 6465 # . restore registers + 6466 5f/pop-to-edi + 6467 5e/pop-to-esi + 6468 58/pop-to-eax + 6469 # . epilogue + 6470 89/<- %esp 5/r32/ebp + 6471 5d/pop-to-ebp + 6472 c3/return + 6473 + 6474 # parses a block, assuming that the leading '{' has already been read by the caller + 6475 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) + 6476 # pseudocode: + 6477 # var line: (stream byte 512) + 6478 # var word-slice: slice + 6479 # allocate(Heap, Stmt-size, out) + 6480 # var out-addr: (addr block) = lookup(*out) + 6481 # out-addr->tag = 0/block + 6482 # out-addr->var = some unique name + 6483 # push(vars, {out-addr->var, false}) + 6484 # while true # line loop + 6485 # clear-stream(line) + 6486 # read-line-buffered(in, line) + 6487 # if (line->write == 0) break # end of file + 6488 # word-slice = next-mu-token(line) + 6489 # if slice-empty?(word-slice) # end of line + 6490 # continue + 6491 # else if slice-starts-with?(word-slice, "#") + 6492 # continue + 6493 # else if slice-equal?(word-slice, "{") + 6494 # assert(no-tokens-in(line)) + 6495 # block = parse-mu-block(in, vars, fn) + 6496 # append-to-block(out-addr, block) + 6497 # else if slice-equal?(word-slice, "}") + 6498 # break + 6499 # else if slice-ends-with?(word-slice, ":") + 6500 # # TODO: error-check the rest of 'line' + 6501 # --word-slice->end to skip ':' + 6502 # named-block = parse-mu-named-block(word-slice, in, vars, fn) + 6503 # append-to-block(out-addr, named-block) + 6504 # else if slice-equal?(word-slice, "var") + 6505 # var-def = parse-mu-var-def(line, vars, fn) + 6506 # append-to-block(out-addr, var-def) + 6507 # else + 6508 # stmt = parse-mu-stmt(line, vars, fn) + 6509 # append-to-block(out-addr, stmt) + 6510 # pop(vars) + 6511 # + 6512 # . prologue + 6513 55/push-ebp + 6514 89/<- %ebp 4/r32/esp + 6515 # . save registers + 6516 50/push-eax + 6517 51/push-ecx + 6518 52/push-edx + 6519 53/push-ebx + 6520 57/push-edi + 6521 # var line/ecx: (stream byte 512) + 6522 81 5/subop/subtract %esp 0x200/imm32 + 6523 68/push 0x200/imm32/size + 6524 68/push 0/imm32/read + 6525 68/push 0/imm32/write + 6526 89/<- %ecx 4/r32/esp + 6527 # var word-slice/edx: slice + 6528 68/push 0/imm32/end + 6529 68/push 0/imm32/start + 6530 89/<- %edx 4/r32/esp + 6531 # allocate into out + 6532 (allocate Heap *Stmt-size *(ebp+0x14)) + 6533 # var out-addr/edi: (addr block) = lookup(*out) + 6534 8b/-> *(ebp+0x14) 7/r32/edi + 6535 (lookup *edi *(edi+4)) # => eax + 6536 89/<- %edi 0/r32/eax + 6537 # out-addr->tag is 0 (block) by default + 6538 # set out-addr->var + 6539 8d/copy-address *(edi+0xc) 0/r32/eax # Block-var + 6540 (new-block-name *(ebp+0x10) %eax) + 6541 # push(vars, out-addr->var) + 6542 (push *(ebp+0xc) *(edi+0xc)) # Block-var + 6543 (push *(ebp+0xc) *(edi+0x10)) # Block-var + 6544 (push *(ebp+0xc) 0) # false + 6545 { + 6546 $parse-mu-block:line-loop: + 6547 # line = read-line-buffered(in) + 6548 (clear-stream %ecx) + 6549 (read-line-buffered *(ebp+8) %ecx) + 6550 #? (write-buffered Stderr "line: ") + 6551 #? (write-stream-data Stderr %ecx) + 6552 #? (write-buffered Stderr Newline) + 6553 #? (flush Stderr) + 6554 # if (line->write == 0) break + 6555 81 7/subop/compare *ecx 0/imm32 + 6556 0f 84/jump-if-= break/disp32 + 6557 # word-slice = next-mu-token(line) + 6558 (next-mu-token %ecx %edx) + 6559 #? (write-buffered Stderr "word: ") + 6560 #? (write-slice-buffered Stderr %edx) + 6561 #? (write-buffered Stderr Newline) + 6562 #? (flush Stderr) + 6563 # if slice-empty?(word-slice) continue + 6564 (slice-empty? %edx) + 6565 3d/compare-eax-and 0/imm32/false + 6566 0f 85/jump-if-!= loop/disp32 + 6567 # if (slice-starts-with?(word-slice, '#') continue + 6568 # . eax = *word-slice->start + 6569 8b/-> *edx 0/r32/eax + 6570 8a/copy-byte *eax 0/r32/AL + 6571 81 4/subop/and %eax 0xff/imm32 + 6572 # . if (eax == '#') continue + 6573 3d/compare-eax-and 0x23/imm32/hash + 6574 0f 84/jump-if-= loop/disp32 + 6575 # if slice-equal?(word-slice, "{") + 6576 { + 6577 $parse-mu-block:check-for-block: + 6578 (slice-equal? %edx "{") + 6579 3d/compare-eax-and 0/imm32/false + 6580 74/jump-if-= break/disp8 + 6581 (check-no-tokens-left %ecx) + 6582 # parse new block and append + 6583 # . var tmp/eax: (handle block) + 6584 68/push 0/imm32 + 6585 68/push 0/imm32 + 6586 89/<- %eax 4/r32/esp + 6587 # . + 6588 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) + 6589 (append-to-block Heap %edi *eax *(eax+4)) + 6590 # . reclaim tmp + 6591 81 0/subop/add %esp 8/imm32 + 6592 # . + 6593 e9/jump $parse-mu-block:line-loop/disp32 + 6594 } + 6595 # if slice-equal?(word-slice, "}") break + 6596 $parse-mu-block:check-for-end: + 6597 (slice-equal? %edx "}") + 6598 3d/compare-eax-and 0/imm32/false + 6599 0f 85/jump-if-!= break/disp32 + 6600 # if slice-ends-with?(word-slice, ":") parse named block and append + 6601 { + 6602 $parse-mu-block:check-for-named-block: + 6603 # . eax = *(word-slice->end-1) + 6604 8b/-> *(edx+4) 0/r32/eax + 6605 48/decrement-eax + 6606 8a/copy-byte *eax 0/r32/AL + 6607 81 4/subop/and %eax 0xff/imm32 + 6608 # . if (eax != ':') break + 6609 3d/compare-eax-and 0x3a/imm32/colon + 6610 0f 85/jump-if-!= break/disp32 + 6611 # TODO: error-check the rest of 'line' + 6612 # + 6613 # skip ':' + 6614 ff 1/subop/decrement *(edx+4) # Slice-end + 6615 # var tmp/eax: (handle block) + 6616 68/push 0/imm32 + 6617 68/push 0/imm32 + 6618 89/<- %eax 4/r32/esp + 6619 # + 6620 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) + 6621 (append-to-block Heap %edi *eax *(eax+4)) + 6622 # reclaim tmp + 6623 81 0/subop/add %esp 8/imm32 + 6624 # + 6625 e9/jump $parse-mu-block:line-loop/disp32 + 6626 } + 6627 # if slice-equal?(word-slice, "var") + 6628 { + 6629 $parse-mu-block:check-for-var: + 6630 (slice-equal? %edx "var") + 6631 3d/compare-eax-and 0/imm32/false + 6632 74/jump-if-= break/disp8 + 6633 # var tmp/eax: (handle block) + 6634 68/push 0/imm32 + 6635 68/push 0/imm32 + 6636 89/<- %eax 4/r32/esp + 6637 # + 6638 (parse-mu-var-def %ecx *(ebp+0xc) %eax *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) + 6639 (append-to-block Heap %edi *eax *(eax+4)) + 6640 # reclaim tmp + 6641 81 0/subop/add %esp 8/imm32 + 6642 # + 6643 e9/jump $parse-mu-block:line-loop/disp32 + 6644 } + 6645 $parse-mu-block:regular-stmt: + 6646 # otherwise + 6647 # var tmp/eax: (handle block) + 6648 68/push 0/imm32 + 6649 68/push 0/imm32 + 6650 89/<- %eax 4/r32/esp + 6651 # + 6652 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) + 6653 (append-to-block Heap %edi *eax *(eax+4)) + 6654 # reclaim tmp + 6655 81 0/subop/add %esp 8/imm32 + 6656 # + 6657 e9/jump loop/disp32 + 6658 } # end line loop + 6659 # pop(vars) + 6660 (pop *(ebp+0xc)) # => eax + 6661 (pop *(ebp+0xc)) # => eax + 6662 (pop *(ebp+0xc)) # => eax + 6663 $parse-mu-block:end: + 6664 # . reclaim locals + 6665 81 0/subop/add %esp 0x214/imm32 + 6666 # . restore registers + 6667 5f/pop-to-edi + 6668 5b/pop-to-ebx + 6669 5a/pop-to-edx + 6670 59/pop-to-ecx + 6671 58/pop-to-eax + 6672 # . epilogue + 6673 89/<- %esp 5/r32/ebp + 6674 5d/pop-to-ebp + 6675 c3/return + 6676 + 6677 $parse-mu-block:abort: + 6678 # error("'{' or '}' should be on its own line, but got '") + 6679 (write-buffered *(ebp+0x18) "'{' or '}' should be on its own line, but got '") + 6680 (rewind-stream %ecx) + 6681 (write-stream-data *(ebp+0x18) %ecx) + 6682 (write-buffered *(ebp+0x18) "'\n") + 6683 (flush *(ebp+0x18)) + 6684 (stop *(ebp+0x1c) 1) + 6685 # never gets here + 6686 + 6687 new-block-name: # fn: (addr function), out: (addr handle var) + 6688 # . prologue + 6689 55/push-ebp + 6690 89/<- %ebp 4/r32/esp + 6691 # . save registers + 6692 50/push-eax + 6693 51/push-ecx + 6694 52/push-edx + 6695 # var n/ecx: int = len(fn->name) + 10 for an int + 2 for '$:' + 6696 8b/-> *(ebp+8) 0/r32/eax + 6697 (lookup *eax *(eax+4)) # Function-name Function-name => eax + 6698 8b/-> *eax 0/r32/eax # String-size + 6699 05/add-to-eax 0xd/imm32 # 10 + 2 for '$:' + 6700 89/<- %ecx 0/r32/eax + 6701 # var name/edx: (stream byte n) + 6702 29/subtract-from %esp 1/r32/ecx + 6703 ff 6/subop/push %ecx + 6704 68/push 0/imm32/read + 6705 68/push 0/imm32/write + 6706 89/<- %edx 4/r32/esp + 6707 (clear-stream %edx) + 6708 # eax = fn->name + 6709 8b/-> *(ebp+8) 0/r32/eax + 6710 (lookup *eax *(eax+4)) # Function-name Function-name => eax + 6711 # construct result using Next-block-index (and increment it) + 6712 (write %edx "$") + 6713 (write %edx %eax) + 6714 (write %edx ":") + 6715 (print-int32 %edx *Next-block-index) + 6716 ff 0/subop/increment *Next-block-index + 6717 # var s/eax: slice = {name->data, name->data + name->write} (clobbering edx) + 6718 # . eax = name->write + 6719 8b/-> *edx 0/r32/eax + 6720 # . edx = name->data + 6721 8d/copy-address *(edx+0xc) 2/r32/edx + 6722 # . eax = name->write + name->data + 6723 01/add-to %eax 2/r32/edx + 6724 # . push {edx, eax} + 6725 ff 6/subop/push %eax + 6726 ff 6/subop/push %edx + 6727 89/<- %eax 4/r32/esp + 6728 # out = new literal(s) + 6729 (new-literal Heap %eax *(ebp+0xc)) + 6730 #? 8b/-> *(ebp+0xc) 0/r32/eax + 6731 #? (write-buffered Stderr "type allocid in caller after new-literal: ") + 6732 #? (print-int32-buffered Stderr *(eax+8)) + 6733 #? (write-buffered Stderr " for var ") + 6734 #? (print-int32-buffered Stderr %eax) + 6735 #? (write-buffered Stderr Newline) + 6736 #? (flush Stderr) + 6737 $new-block-name:end: + 6738 # . reclaim locals + 6739 81 0/subop/add %ecx 0xc/imm32 # name.{read/write/len} + 6740 81 0/subop/add %ecx 8/imm32 # slice + 6741 01/add-to %esp 1/r32/ecx + 6742 # . restore registers + 6743 5a/pop-to-edx + 6744 59/pop-to-ecx + 6745 58/pop-to-eax + 6746 # . epilogue + 6747 89/<- %esp 5/r32/ebp + 6748 5d/pop-to-ebp + 6749 c3/return + 6750 + 6751 == data + 6752 + 6753 # Global state added to each var record when parsing a function + 6754 Next-block-index: # (addr int) + 6755 1/imm32 + 6756 + 6757 == code + 6758 + 6759 check-no-tokens-left: # line: (addr stream byte) + 6760 # . prologue + 6761 55/push-ebp + 6762 89/<- %ebp 4/r32/esp + 6763 # . save registers + 6764 50/push-eax + 6765 51/push-ecx + 6766 # var s/ecx: slice + 6767 68/push 0/imm32/end + 6768 68/push 0/imm32/start + 6769 89/<- %ecx 4/r32/esp + 6770 # + 6771 (next-mu-token *(ebp+8) %ecx) + 6772 # if slice-empty?(s) return + 6773 (slice-empty? %ecx) + 6774 3d/compare-eax-and 0/imm32/false + 6775 75/jump-if-!= $check-no-tokens-left:end/disp8 + 6776 # if (slice-starts-with?(s, '#') return + 6777 # . eax = *s->start + 6778 8b/-> *edx 0/r32/eax + 6779 8a/copy-byte *eax 0/r32/AL + 6780 81 4/subop/and %eax 0xff/imm32 + 6781 # . if (eax == '#') continue + 6782 3d/compare-eax-and 0x23/imm32/hash + 6783 74/jump-if-= $check-no-tokens-left:end/disp8 + 6784 # abort + 6785 (write-buffered Stderr "'{' or '}' should be on its own line, but got '") + 6786 (rewind-stream %ecx) + 6787 (write-stream 2 %ecx) + 6788 (write-buffered Stderr "'\n") + 6789 (flush Stderr) + 6790 # . syscall(exit, 1) + 6791 bb/copy-to-ebx 1/imm32 + 6792 e8/call syscall_exit/disp32 + 6793 # never gets here + 6794 $check-no-tokens-left:end: + 6795 # . reclaim locals + 6796 81 0/subop/add %esp 8/imm32 + 6797 # . restore registers + 6798 59/pop-to-ecx + 6799 58/pop-to-eax + 6800 # . epilogue + 6801 89/<- %esp 5/r32/ebp + 6802 5d/pop-to-ebp + 6803 c3/return + 6804 + 6805 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) + 6806 # pseudocode: + 6807 # var v: (handle var) + 6808 # new-literal(name, v) + 6809 # push(vars, {v, false}) + 6810 # parse-mu-block(in, vars, fn, out) + 6811 # pop(vars) + 6812 # out->tag = block + 6813 # out->var = v + 6814 # + 6815 # . prologue + 6816 55/push-ebp + 6817 89/<- %ebp 4/r32/esp + 6818 # . save registers + 6819 50/push-eax + 6820 51/push-ecx + 6821 57/push-edi + 6822 # var v/ecx: (handle var) + 6823 68/push 0/imm32 + 6824 68/push 0/imm32 + 6825 89/<- %ecx 4/r32/esp + 6826 # + 6827 (new-literal Heap *(ebp+8) %ecx) + 6828 # push(vars, v) + 6829 (push *(ebp+0x10) *ecx) + 6830 (push *(ebp+0x10) *(ecx+4)) + 6831 (push *(ebp+0x10) 0) # false + 6832 # + 6833 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20)) + 6834 # pop v off vars + 6835 (pop *(ebp+0x10)) # => eax + 6836 (pop *(ebp+0x10)) # => eax + 6837 (pop *(ebp+0x10)) # => eax + 6838 # var out-addr/edi: (addr stmt) = lookup(*out) + 6839 8b/-> *(ebp+0x18) 7/r32/edi + 6840 (lookup *edi *(edi+4)) # => eax + 6841 89/<- %edi 0/r32/eax + 6842 # out-addr->tag = named-block + 6843 c7 0/subop/copy *edi 0/imm32/block # Stmt-tag + 6844 # out-addr->var = v + 6845 8b/-> *ecx 0/r32/eax + 6846 89/<- *(edi+0xc) 0/r32/eax # Block-var + 6847 8b/-> *(ecx+4) 0/r32/eax + 6848 89/<- *(edi+0x10) 0/r32/eax # Block-var + 6849 $parse-mu-named-block:end: + 6850 # . reclaim locals + 6851 81 0/subop/add %esp 8/imm32 + 6852 # . restore registers + 6853 5f/pop-to-edi + 6854 59/pop-to-ecx + 6855 58/pop-to-eax + 6856 # . epilogue + 6857 89/<- %esp 5/r32/ebp + 6858 5d/pop-to-ebp + 6859 c3/return + 6860 + 6861 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) + 6862 # . prologue + 6863 55/push-ebp + 6864 89/<- %ebp 4/r32/esp + 6865 # . save registers + 6866 50/push-eax + 6867 51/push-ecx + 6868 52/push-edx + 6869 57/push-edi + 6870 # edi = out + 6871 8b/-> *(ebp+0x10) 7/r32/edi + 6872 # var word-slice/ecx: slice + 6873 68/push 0/imm32/end + 6874 68/push 0/imm32/start + 6875 89/<- %ecx 4/r32/esp + 6876 # var v/edx: (handle var) + 6877 68/push 0/imm32 + 6878 68/push 0/imm32 + 6879 89/<- %edx 4/r32/esp + 6880 # v = parse-var-with-type(next-mu-token(line)) + 6881 (next-mu-token *(ebp+8) %ecx) + 6882 (parse-var-with-type %ecx *(ebp+8) %edx *(ebp+0x18) *(ebp+0x1c)) + 6883 # + 6884 (push *(ebp+0xc) *edx) + 6885 (push *(ebp+0xc) *(edx+4)) + 6886 (push *(ebp+0xc) 0) # Live-var-register-spilled is unused during parsing + 6887 # either v has no register and there's no more to this line + 6888 (lookup *edx *(edx+4)) # => eax + 6889 8b/-> *(eax+0x18) 0/r32/eax # Var-register + 6890 3d/compare-eax-and 0/imm32 + 6891 { + 6892 75/jump-if-!= break/disp8 + 6893 # TODO: disallow vars of type 'byte' on the stack + 6894 # ensure that there's nothing else on this line + 6895 (next-mu-token *(ebp+8) %ecx) + 6896 (slice-empty? %ecx) # => eax + 6897 3d/compare-eax-and 0/imm32/false + 6898 0f 84/jump-if-= $parse-mu-var-def:error2/disp32 + 6899 # + 6900 (new-var-def Heap *edx *(edx+4) %edi) + 6901 e9/jump $parse-mu-var-def:end/disp32 + 6902 } + 6903 # or v has a register and there's more to this line + 6904 { + 6905 0f 84/jump-if-= break/disp32 + 6906 # TODO: disallow vars of type 'byte' in registers 'esi' or 'edi' + 6907 # TODO: vars of type 'byte' should only be initialized by clearing to 0 + 6908 # ensure that the next word is '<-' + 6909 (next-mu-token *(ebp+8) %ecx) + 6910 (slice-equal? %ecx "<-") # => eax + 6911 3d/compare-eax-and 0/imm32/false + 6912 74/jump-if-= $parse-mu-var-def:error1/disp8 + 6913 # + 6914 (new-reg-var-def Heap *edx *(edx+4) %edi) + 6915 (lookup *edi *(edi+4)) # => eax + 6916 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) + 6917 } + 6918 $parse-mu-var-def:end: + 6919 # . reclaim locals + 6920 81 0/subop/add %esp 0x10/imm32 + 6921 # . restore registers + 6922 5f/pop-to-edi + 6923 5a/pop-to-edx + 6924 59/pop-to-ecx + 6925 58/pop-to-eax + 6926 # . epilogue + 6927 89/<- %esp 5/r32/ebp + 6928 5d/pop-to-ebp + 6929 c3/return + 6930 + 6931 $parse-mu-var-def:error1: + 6932 (rewind-stream *(ebp+8)) + 6933 # error("register variable requires a valid instruction to initialize but got '" line "'\n") + 6934 (write-buffered *(ebp+0x18) "register variable requires a valid instruction to initialize but got '") + 6935 (flush *(ebp+0x18)) + 6936 (write-stream-data *(ebp+0x18) *(ebp+8)) + 6937 (write-buffered *(ebp+0x18) "'\n") + 6938 (flush *(ebp+0x18)) + 6939 (stop *(ebp+0x1c) 1) + 6940 # never gets here + 6941 + 6942 $parse-mu-var-def:error2: + 6943 (rewind-stream *(ebp+8)) + 6944 # error("fn " fn ": var " var ": variables on the stack can't take an initializer\n") + 6945 (write-buffered *(ebp+0x18) "fn ") + 6946 8b/-> *(ebp+0x14) 0/r32/eax + 6947 (lookup *eax *(eax+4)) # Function-name Function-name => eax + 6948 (write-buffered *(ebp+0x18) %eax) + 6949 (write-buffered *(ebp+0x18) ": var ") + 6950 # var v-addr/eax: (addr var) = lookup(v) + 6951 (lookup *edx *(edx+4)) # => eax + 6952 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 6953 (write-buffered *(ebp+0x18) %eax) + 6954 (write-buffered *(ebp+0x18) ": variables on the stack can't take an initializer\n") + 6955 (flush *(ebp+0x18)) + 6956 (stop *(ebp+0x1c) 1) + 6957 # never gets here + 6958 + 6959 test-parse-mu-var-def: + 6960 # 'var n: int' + 6961 # . prologue + 6962 55/push-ebp + 6963 89/<- %ebp 4/r32/esp + 6964 # setup + 6965 (clear-stream _test-input-stream) + 6966 (write _test-input-stream "n: int\n") # caller has consumed the 'var' + 6967 # var out/esi: (handle stmt) + 6968 68/push 0/imm32 + 6969 68/push 0/imm32 + 6970 89/<- %esi 4/r32/esp + 6971 # var vars/ecx: (stack (addr var) 16) + 6972 81 5/subop/subtract %esp 0xc0/imm32 + 6973 68/push 0xc0/imm32/size + 6974 68/push 0/imm32/top + 6975 89/<- %ecx 4/r32/esp + 6976 (clear-stack %ecx) + 6977 # convert + 6978 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) + 6979 # var out-addr/esi: (addr stmt) + 6980 (lookup *esi *(esi+4)) # => eax + 6981 89/<- %esi 0/r32/eax + 6982 # + 6983 (check-ints-equal *esi 2 "F - test-parse-mu-var-def/tag") # Stmt-tag is var-def + 6984 # var v/ecx: (addr var) = lookup(out->var) + 6985 (lookup *(esi+4) *(esi+8)) # Vardef-var Vardef-var => eax + 6986 89/<- %ecx 0/r32/eax + 6987 # v->name + 6988 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax + 6989 (check-strings-equal %eax "n" "F - test-parse-mu-var-def/var-name") + 6990 # v->register + 6991 (check-ints-equal *(ecx+0x18) 0 "F - test-parse-mu-var-def/var-register") # Var-register + 6992 # v->type == int + 6993 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 6994 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0") # Tree-is-atom + 6995 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-var-def/var-type:1") # Tree-value + 6996 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-var-def/var-type:2") # Tree-right + 6997 # . epilogue + 6998 89/<- %esp 5/r32/ebp + 6999 5d/pop-to-ebp + 7000 c3/return + 7001 + 7002 test-parse-mu-reg-var-def: + 7003 # 'var n/eax: int <- copy 0' + 7004 # . prologue + 7005 55/push-ebp + 7006 89/<- %ebp 4/r32/esp + 7007 # setup + 7008 (clear-stream _test-input-stream) + 7009 (write _test-input-stream "n/eax: int <- copy 0\n") # caller has consumed the 'var' + 7010 # var out/esi: (handle stmt) + 7011 68/push 0/imm32 + 7012 68/push 0/imm32 + 7013 89/<- %esi 4/r32/esp + 7014 # var vars/ecx: (stack (addr var) 16) + 7015 81 5/subop/subtract %esp 0xc0/imm32 + 7016 68/push 0xc0/imm32/size + 7017 68/push 0/imm32/top + 7018 89/<- %ecx 4/r32/esp + 7019 (clear-stack %ecx) + 7020 # convert + 7021 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) + 7022 # var out-addr/esi: (addr stmt) + 7023 (lookup *esi *(esi+4)) # => eax + 7024 89/<- %esi 0/r32/eax + 7025 # + 7026 (check-ints-equal *esi 3 "F - test-parse-mu-reg-var-def/tag") # Stmt-tag is reg-var-def + 7027 # var v/ecx: (addr var) = lookup(out->outputs->value) + 7028 # . eax: (addr stmt-var) = lookup(out->outputs) + 7029 (lookup *(esi+0x14) *(esi+0x18)) # Regvardef-outputs Regvardef-outputs => eax + 7030 # . + 7031 (check-ints-equal *(eax+8) 0 "F - test-parse-mu-reg-var-def/single-output") # Stmt-var-next + 7032 # . eax: (addr var) = lookup(eax->value) + 7033 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 7034 # . ecx = eax + 7035 89/<- %ecx 0/r32/eax + 7036 # v->name + 7037 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax + 7038 (check-strings-equal %eax "n" "F - test-parse-mu-reg-var-def/output-name") # Var-name + 7039 # v->register + 7040 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax + 7041 (check-strings-equal %eax "eax" "F - test-parse-mu-reg-var-def/output-register") + 7042 # v->type == int + 7043 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 7044 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0") # Tree-is-atom + 7045 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-reg-var-def/output-type:1") # Tree-value + 7046 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-reg-var-def/output-type:2") # Tree-right + 7047 # . epilogue + 7048 89/<- %esp 5/r32/ebp + 7049 5d/pop-to-ebp + 7050 c3/return + 7051 + 7052 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) + 7053 # pseudocode: + 7054 # var name: slice + 7055 # allocate(Heap, Stmt-size, out) + 7056 # var out-addr: (addr stmt) = lookup(*out) + 7057 # out-addr->tag = stmt + 7058 # if stmt-has-outputs?(line) + 7059 # while true + 7060 # name = next-mu-token(line) + 7061 # if (name == '<-') break + 7062 # assert(is-identifier?(name)) + 7063 # var v: (handle var) = lookup-or-define-var(name, vars, fn) # regular stmts may define vars in fn outputs + 7064 # out-addr->outputs = append(v, out-addr->outputs) + 7065 # add-operation-and-inputs-to-stmt(out-addr, line, vars) + 7066 # + 7067 # . prologue + 7068 55/push-ebp + 7069 89/<- %ebp 4/r32/esp + 7070 # . save registers + 7071 50/push-eax + 7072 51/push-ecx + 7073 52/push-edx + 7074 53/push-ebx + 7075 57/push-edi + 7076 # var name/ecx: slice + 7077 68/push 0/imm32/end + 7078 68/push 0/imm32/start + 7079 89/<- %ecx 4/r32/esp + 7080 # var is-deref?/edx: boolean = false + 7081 ba/copy-to-edx 0/imm32/false + 7082 # var v: (handle var) + 7083 68/push 0/imm32 + 7084 68/push 0/imm32 + 7085 89/<- %ebx 4/r32/esp + 7086 # + 7087 (allocate Heap *Stmt-size *(ebp+0x14)) + 7088 # var out-addr/edi: (addr stmt) = lookup(*out) + 7089 8b/-> *(ebp+0x14) 7/r32/edi + 7090 (lookup *edi *(edi+4)) # => eax + 7091 89/<- %edi 0/r32/eax + 7092 # out-addr->tag = 1/stmt + 7093 c7 0/subop/copy *edi 1/imm32/stmt1 # Stmt-tag + 7094 { + 7095 (stmt-has-outputs? *(ebp+8)) + 7096 3d/compare-eax-and 0/imm32/false + 7097 0f 84/jump-if-= break/disp32 + 7098 { + 7099 $parse-mu-stmt:read-outputs: + 7100 # name = next-mu-token(line) + 7101 (next-mu-token *(ebp+8) %ecx) + 7102 # if slice-empty?(word-slice) break + 7103 (slice-empty? %ecx) # => eax + 7104 3d/compare-eax-and 0/imm32/false + 7105 0f 85/jump-if-!= break/disp32 + 7106 # if (name == "<-") break + 7107 (slice-equal? %ecx "<-") # => eax + 7108 3d/compare-eax-and 0/imm32/false + 7109 0f 85/jump-if-!= break/disp32 + 7110 # is-deref? = false + 7111 ba/copy-to-edx 0/imm32/false + 7112 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? + 7113 8b/-> *ecx 0/r32/eax # Slice-start + 7114 8a/copy-byte *eax 0/r32/AL + 7115 81 4/subop/and %eax 0xff/imm32 + 7116 3d/compare-eax-and 0x2a/imm32/asterisk + 7117 { + 7118 75/jump-if-!= break/disp8 + 7119 ff 0/subop/increment *ecx + 7120 ba/copy-to-edx 1/imm32/true + 7121 } + 7122 # assert(is-identifier?(name)) + 7123 (is-identifier? %ecx) # => eax + 7124 3d/compare-eax-and 0/imm32/false + 7125 0f 84/jump-if-= $parse-mu-stmt:abort/disp32 + 7126 # + 7127 (lookup-or-define-var %ecx *(ebp+0xc) *(ebp+0x10) %ebx *(ebp+0x18) *(ebp+0x1c)) + 7128 8d/copy-address *(edi+0x14) 0/r32/eax # Stmt1-outputs + 7129 (append-stmt-var Heap *ebx *(ebx+4) *(edi+0x14) *(edi+0x18) %edx %eax) # Stmt1-outputs + 7130 # + 7131 e9/jump loop/disp32 + 7132 } + 7133 } + 7134 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) + 7135 $parse-mu-stmt:end: + 7136 # . reclaim locals + 7137 81 0/subop/add %esp 0x10/imm32 + 7138 # . restore registers + 7139 5f/pop-to-edi + 7140 5b/pop-to-ebx + 7141 5a/pop-to-edx + 7142 59/pop-to-ecx 7143 58/pop-to-eax 7144 # . epilogue 7145 89/<- %esp 5/r32/ebp 7146 5d/pop-to-ebp 7147 c3/return 7148 - 7149 $lookup-or-define-var:abort: - 7150 (write-buffered *(ebp+0x18) "unknown variable '") - 7151 (write-slice-buffered *(ebp+0x18) *(ebp+8)) - 7152 (write-buffered *(ebp+0x18) "'\n") - 7153 (flush *(ebp+0x18)) - 7154 (stop *(ebp+0x1c) 1) - 7155 # never gets here - 7156 - 7157 find-in-function-outputs: # fn: (addr function), name: (addr slice), out: (addr handle var) - 7158 # . prologue - 7159 55/push-ebp - 7160 89/<- %ebp 4/r32/esp - 7161 # . save registers - 7162 50/push-eax - 7163 51/push-ecx - 7164 # var curr/ecx: (addr list var) = lookup(fn->outputs) - 7165 8b/-> *(ebp+8) 1/r32/ecx - 7166 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax - 7167 89/<- %ecx 0/r32/eax - 7168 # while curr != null - 7169 { - 7170 81 7/subop/compare %ecx 0/imm32 - 7171 74/jump-if-= break/disp8 - 7172 # var v/eax: (addr var) = lookup(curr->value) - 7173 (lookup *ecx *(ecx+4)) # List-value List-value => eax - 7174 # var s/eax: (addr array byte) = lookup(v->name) - 7175 (lookup *eax *(eax+4)) # Var-name Var-name => eax - 7176 # if (s == name) return curr->value - 7177 (slice-equal? *(ebp+0xc) %eax) # => eax - 7178 3d/compare-eax-and 0/imm32/false - 7179 { - 7180 74/jump-if-= break/disp8 - 7181 # var edi = out - 7182 57/push-edi - 7183 8b/-> *(ebp+0x10) 7/r32/edi - 7184 # *out = curr->value - 7185 8b/-> *ecx 0/r32/eax - 7186 89/<- *edi 0/r32/eax - 7187 8b/-> *(ecx+4) 0/r32/eax - 7188 89/<- *(edi+4) 0/r32/eax - 7189 # - 7190 5f/pop-to-edi - 7191 eb/jump $find-in-function-outputs:end/disp8 - 7192 } - 7193 # curr = curr->next - 7194 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax - 7195 89/<- %ecx 0/r32/eax - 7196 # - 7197 eb/jump loop/disp8 - 7198 } - 7199 b8/copy-to-eax 0/imm32 - 7200 $find-in-function-outputs:end: - 7201 # . restore registers - 7202 59/pop-to-ecx - 7203 58/pop-to-eax - 7204 # . epilogue - 7205 89/<- %esp 5/r32/ebp - 7206 5d/pop-to-ebp - 7207 c3/return - 7208 - 7209 test-parse-mu-stmt: - 7210 # . prologue - 7211 55/push-ebp - 7212 89/<- %ebp 4/r32/esp - 7213 # setup - 7214 (clear-stream _test-input-stream) - 7215 (write _test-input-stream "increment n\n") - 7216 # var vars/ecx: (stack (addr var) 16) - 7217 81 5/subop/subtract %esp 0xc0/imm32 - 7218 68/push 0xc0/imm32/size - 7219 68/push 0/imm32/top - 7220 89/<- %ecx 4/r32/esp - 7221 (clear-stack %ecx) - 7222 # var v/edx: (handle var) - 7223 68/push 0/imm32 - 7224 68/push 0/imm32 - 7225 89/<- %edx 4/r32/esp - 7226 # var s/eax: (handle array byte) - 7227 68/push 0/imm32 - 7228 68/push 0/imm32 - 7229 89/<- %eax 4/r32/esp - 7230 # v = new var("n") - 7231 (copy-array Heap "n" %eax) - 7232 (new-var Heap *eax *(eax+4) %edx) - 7233 # - 7234 (push %ecx *edx) - 7235 (push %ecx *(edx+4)) - 7236 (push %ecx 0) - 7237 # var out/eax: (handle stmt) - 7238 68/push 0/imm32 - 7239 68/push 0/imm32 - 7240 89/<- %eax 4/r32/esp - 7241 # convert - 7242 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) - 7243 # var out-addr/edx: (addr stmt) = lookup(*out) - 7244 (lookup *eax *(eax+4)) # => eax - 7245 89/<- %edx 0/r32/eax - 7246 # out->tag - 7247 (check-ints-equal *edx 1 "F - test-parse-mu-stmt/tag") # Stmt-tag is Stmt1 - 7248 # out->operation - 7249 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax - 7250 (check-strings-equal %eax "increment" "F - test-parse-mu-stmt/name") # Stmt1-operation - 7251 # out->inouts->value->name - 7252 # . eax = out->inouts - 7253 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 7254 # . eax = out->inouts->value - 7255 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 7256 # . eax = out->inouts->value->name - 7257 (lookup *eax *(eax+4)) # Var-name Var-name => eax - 7258 # . - 7259 (check-strings-equal %eax "n" "F - test-parse-mu-stmt/inout:0") - 7260 # . epilogue - 7261 89/<- %esp 5/r32/ebp - 7262 5d/pop-to-ebp - 7263 c3/return - 7264 - 7265 test-parse-mu-stmt-with-comma: - 7266 # . prologue - 7267 55/push-ebp - 7268 89/<- %ebp 4/r32/esp - 7269 # setup - 7270 (clear-stream _test-input-stream) - 7271 (write _test-input-stream "copy-to n, 3\n") - 7272 # var vars/ecx: (stack (addr var) 16) - 7273 81 5/subop/subtract %esp 0xc0/imm32 - 7274 68/push 0xc0/imm32/size - 7275 68/push 0/imm32/top - 7276 89/<- %ecx 4/r32/esp - 7277 (clear-stack %ecx) - 7278 # var v/edx: (handle var) - 7279 68/push 0/imm32 - 7280 68/push 0/imm32 - 7281 89/<- %edx 4/r32/esp - 7282 # var s/eax: (handle array byte) - 7283 68/push 0/imm32 - 7284 68/push 0/imm32 - 7285 89/<- %eax 4/r32/esp - 7286 # v = new var("n") - 7287 (copy-array Heap "n" %eax) - 7288 (new-var Heap *eax *(eax+4) %edx) - 7289 # - 7290 (push %ecx *edx) - 7291 (push %ecx *(edx+4)) - 7292 (push %ecx 0) - 7293 # var out/eax: (handle stmt) - 7294 68/push 0/imm32 - 7295 68/push 0/imm32 - 7296 89/<- %eax 4/r32/esp - 7297 # convert - 7298 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) - 7299 # var out-addr/edx: (addr stmt) = lookup(*out) - 7300 (lookup *eax *(eax+4)) # => eax - 7301 89/<- %edx 0/r32/eax - 7302 # out->tag - 7303 (check-ints-equal *edx 1 "F - test-parse-mu-stmt-with-comma/tag") # Stmt-tag is Stmt1 - 7304 # out->operation - 7305 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax - 7306 (check-strings-equal %eax "copy-to" "F - test-parse-mu-stmt-with-comma/name") # Stmt1-operation - 7307 # out->inouts->value->name - 7308 # . eax = out->inouts - 7309 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 7310 # . eax = out->inouts->value - 7311 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 7312 # . eax = out->inouts->value->name - 7313 (lookup *eax *(eax+4)) # Var-name Var-name => eax - 7314 # . - 7315 (check-strings-equal %eax "n" "F - test-parse-mu-stmt-with-comma/inout:0") - 7316 # . epilogue - 7317 89/<- %esp 5/r32/ebp - 7318 5d/pop-to-ebp - 7319 c3/return - 7320 - 7321 new-var: # ad: (addr allocation-descriptor), name: (handle array byte), out: (addr handle var) - 7322 # . prologue - 7323 55/push-ebp - 7324 89/<- %ebp 4/r32/esp - 7325 # . save registers - 7326 50/push-eax - 7327 51/push-ecx - 7328 # ecx = out - 7329 8b/-> *(ebp+0x14) 1/r32/ecx - 7330 # - 7331 (allocate *(ebp+8) *Var-size %ecx) - 7332 # var out-addr/eax: (addr var) - 7333 (lookup *ecx *(ecx+4)) # => eax - 7334 # out-addr->name = name - 7335 8b/-> *(ebp+0xc) 1/r32/ecx - 7336 89/<- *eax 1/r32/ecx # Var-name - 7337 8b/-> *(ebp+0x10) 1/r32/ecx - 7338 89/<- *(eax+4) 1/r32/ecx # Var-name - 7339 #? (write-buffered Stderr "var ") - 7340 #? (lookup *(ebp+0xc) *(ebp+0x10)) - 7341 #? (write-buffered Stderr %eax) - 7342 #? (write-buffered Stderr " at ") - 7343 #? 8b/-> *(ebp+0x14) 1/r32/ecx - 7344 #? (lookup *ecx *(ecx+4)) # => eax - 7345 #? (print-int32-buffered Stderr %eax) - 7346 #? (write-buffered Stderr Newline) - 7347 #? (flush Stderr) - 7348 $new-var:end: - 7349 # . restore registers - 7350 59/pop-to-ecx - 7351 58/pop-to-eax - 7352 # . epilogue - 7353 89/<- %esp 5/r32/ebp - 7354 5d/pop-to-ebp - 7355 c3/return - 7356 - 7357 new-literal-integer: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) - 7358 # . prologue - 7359 55/push-ebp - 7360 89/<- %ebp 4/r32/esp - 7361 # . save registers - 7362 50/push-eax - 7363 51/push-ecx - 7364 # if (!is-hex-int?(name)) abort - 7365 (is-hex-int? *(ebp+0xc)) # => eax - 7366 3d/compare-eax-and 0/imm32/false - 7367 0f 84/jump-if-= $new-literal-integer:abort/disp32 - 7368 # out = new var(s) - 7369 (new-var-from-slice *(ebp+8) *(ebp+0xc) *(ebp+0x10)) - 7370 # var out-addr/ecx: (addr var) = lookup(*out) - 7371 8b/-> *(ebp+0x10) 0/r32/eax - 7372 (lookup *eax *(eax+4)) # => eax - 7373 89/<- %ecx 0/r32/eax - 7374 # out-addr->type = new tree() - 7375 8d/copy-address *(ecx+8) 0/r32/eax # Var-type - 7376 (allocate *(ebp+8) *Tree-size %eax) - 7377 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 7378 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom - 7379 # nothing else to do; default type is 'literal' - 7380 $new-literal-integer:end: - 7381 # . reclaim locals - 7382 81 0/subop/add %esp 8/imm32 - 7383 # . restore registers - 7384 59/pop-to-ecx - 7385 58/pop-to-eax - 7386 # . epilogue - 7387 89/<- %esp 5/r32/ebp - 7388 5d/pop-to-ebp - 7389 c3/return - 7390 - 7391 $new-literal-integer:abort: - 7392 (write-buffered *(ebp+0x14) "variable cannot begin with a digit '") - 7393 (write-slice-buffered *(ebp+0x14) *(ebp+0xc)) - 7394 (write-buffered *(ebp+0x14) "'\n") - 7395 (flush *(ebp+0x14)) - 7396 (stop *(ebp+0x18) 1) - 7397 # never gets here - 7398 - 7399 new-literal: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) - 7400 # . prologue - 7401 55/push-ebp - 7402 89/<- %ebp 4/r32/esp - 7403 # . save registers - 7404 50/push-eax - 7405 51/push-ecx - 7406 # var s/ecx: (handle array byte) - 7407 68/push 0/imm32 - 7408 68/push 0/imm32 - 7409 89/<- %ecx 4/r32/esp - 7410 # s = slice-to-string(name) - 7411 (slice-to-string Heap *(ebp+0xc) %ecx) - 7412 # allocate to out - 7413 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) - 7414 # var out-addr/ecx: (addr var) = lookup(*out) - 7415 8b/-> *(ebp+0x10) 1/r32/ecx - 7416 (lookup *ecx *(ecx+4)) # => eax - 7417 89/<- %ecx 0/r32/eax - 7418 # out-addr->type/eax = new type - 7419 8d/copy-address *(ecx+8) 0/r32/eax # Var-type - 7420 (allocate *(ebp+8) *Tree-size %eax) - 7421 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 7422 # nothing else to do; default type is 'literal' - 7423 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom - 7424 $new-literal:end: - 7425 # . reclaim locals - 7426 81 0/subop/add %esp 8/imm32 - 7427 # . restore registers - 7428 59/pop-to-ecx - 7429 58/pop-to-eax - 7430 # . epilogue - 7431 89/<- %esp 5/r32/ebp - 7432 5d/pop-to-ebp - 7433 c3/return - 7434 - 7435 new-var-from-slice: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) - 7436 # . prologue - 7437 55/push-ebp - 7438 89/<- %ebp 4/r32/esp - 7439 # . save registers - 7440 51/push-ecx - 7441 # var tmp/ecx: (handle array byte) - 7442 68/push 0/imm32 - 7443 68/push 0/imm32 - 7444 89/<- %ecx 4/r32/esp - 7445 # tmp = slice-to-string(name) - 7446 (slice-to-string Heap *(ebp+0xc) %ecx) - 7447 # out = new-var(tmp) - 7448 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) - 7449 $new-var-from-slice:end: - 7450 # . reclaim locals - 7451 81 0/subop/add %esp 8/imm32 - 7452 # . restore registers - 7453 59/pop-to-ecx - 7454 # . epilogue - 7455 89/<- %esp 5/r32/ebp - 7456 5d/pop-to-ebp - 7457 c3/return - 7458 - 7459 new-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) - 7460 # . prologue - 7461 55/push-ebp - 7462 89/<- %ebp 4/r32/esp - 7463 # . save registers - 7464 50/push-eax - 7465 51/push-ecx - 7466 # - 7467 (allocate *(ebp+8) *Stmt-size *(ebp+0x14)) - 7468 # var out-addr/eax: (addr stmt) = lookup(*out) - 7469 8b/-> *(ebp+0x14) 0/r32/eax - 7470 (lookup *eax *(eax+4)) # => eax - 7471 # out-addr->tag = stmt - 7472 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack # Stmt-tag - 7473 # result->var = var - 7474 8b/-> *(ebp+0xc) 1/r32/ecx - 7475 89/<- *(eax+4) 1/r32/ecx # Vardef-var - 7476 8b/-> *(ebp+0x10) 1/r32/ecx - 7477 89/<- *(eax+8) 1/r32/ecx # Vardef-var - 7478 $new-var-def:end: - 7479 # . restore registers - 7480 59/pop-to-ecx - 7481 58/pop-to-eax - 7482 # . epilogue - 7483 89/<- %esp 5/r32/ebp - 7484 5d/pop-to-ebp - 7485 c3/return - 7486 - 7487 new-reg-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) + 7149 $parse-mu-stmt:abort: + 7150 # error("invalid identifier '" name "'\n") + 7151 (write-buffered *(ebp+0x18) "invalid identifier '") + 7152 (write-slice-buffered *(ebp+0x18) %ecx) + 7153 (write-buffered *(ebp+0x18) "'\n") + 7154 (flush *(ebp+0x18)) + 7155 (stop *(ebp+0x1c) 1) + 7156 # never gets here + 7157 + 7158 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) + 7159 # pseudocode: + 7160 # stmt->name = slice-to-string(next-mu-token(line)) + 7161 # while true + 7162 # name = next-mu-token(line) + 7163 # v = lookup-var-or-literal(name) + 7164 # stmt->inouts = append(v, stmt->inouts) + 7165 # + 7166 # . prologue + 7167 55/push-ebp + 7168 89/<- %ebp 4/r32/esp + 7169 # . save registers + 7170 50/push-eax + 7171 51/push-ecx + 7172 52/push-edx + 7173 53/push-ebx + 7174 56/push-esi + 7175 57/push-edi + 7176 # edi = stmt + 7177 8b/-> *(ebp+8) 7/r32/edi + 7178 # var name/ecx: slice + 7179 68/push 0/imm32/end + 7180 68/push 0/imm32/start + 7181 89/<- %ecx 4/r32/esp + 7182 # var is-deref?/edx: boolean = false + 7183 ba/copy-to-edx 0/imm32/false + 7184 # var v/esi: (handle var) + 7185 68/push 0/imm32 + 7186 68/push 0/imm32 + 7187 89/<- %esi 4/r32/esp + 7188 $add-operation-and-inputs-to-stmt:read-operation: + 7189 (next-mu-token *(ebp+0xc) %ecx) + 7190 8d/copy-address *(edi+4) 0/r32/eax # Stmt1-operation or Regvardef-operationStmt1-operation or Regvardef-operation + 7191 (slice-to-string Heap %ecx %eax) + 7192 # var is-get?/ebx: boolean = (name == "get") + 7193 (slice-equal? %ecx "get") # => eax + 7194 89/<- %ebx 0/r32/eax + 7195 { + 7196 $add-operation-and-inputs-to-stmt:read-inouts: + 7197 # name = next-mu-token(line) + 7198 (next-mu-token *(ebp+0xc) %ecx) + 7199 # if slice-empty?(word-slice) break + 7200 (slice-empty? %ecx) # => eax + 7201 3d/compare-eax-and 0/imm32/false + 7202 0f 85/jump-if-!= break/disp32 + 7203 # if (name == "<-") abort + 7204 (slice-equal? %ecx "<-") + 7205 3d/compare-eax-and 0/imm32/false + 7206 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32 + 7207 # if (is-get? && second operand) lookup or create offset + 7208 { + 7209 81 7/subop/compare %ebx 0/imm32/false + 7210 74/jump-if-= break/disp8 + 7211 (lookup *(edi+0xc) *(edi+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 7212 3d/compare-eax-and 0/imm32 + 7213 74/jump-if-= break/disp8 + 7214 (lookup-or-create-constant %eax %ecx %esi) + 7215 #? (lookup *esi *(esi+4)) + 7216 #? (write-buffered Stderr "creating new output var ") + 7217 #? (print-int32-buffered Stderr %eax) + 7218 #? (write-buffered Stderr " for field called ") + 7219 #? (write-slice-buffered Stderr %ecx) + 7220 #? (write-buffered Stderr "; var name ") + 7221 #? (lookup *eax *(eax+4)) # Var-name + 7222 #? (write-buffered Stderr %eax) + 7223 #? (write-buffered Stderr Newline) + 7224 #? (flush Stderr) + 7225 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32 + 7226 } + 7227 # is-deref? = false + 7228 ba/copy-to-edx 0/imm32/false + 7229 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? + 7230 8b/-> *ecx 0/r32/eax # Slice-start + 7231 8a/copy-byte *eax 0/r32/AL + 7232 81 4/subop/and %eax 0xff/imm32 + 7233 3d/compare-eax-and 0x2a/imm32/asterisk + 7234 { + 7235 75/jump-if-!= break/disp8 + 7236 $add-operation-and-inputs-to-stmt:inout-is-deref: + 7237 ff 0/subop/increment *ecx + 7238 ba/copy-to-edx 1/imm32/true + 7239 } + 7240 (lookup-var-or-literal %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18)) + 7241 $add-operation-and-inputs-to-stmt:save-var: + 7242 8d/copy-address *(edi+0xc) 0/r32/eax + 7243 (append-stmt-var Heap *esi *(esi+4) *(edi+0xc) *(edi+0x10) %edx %eax) # Stmt1-inouts or Regvardef-inouts + 7244 # + 7245 e9/jump loop/disp32 + 7246 } + 7247 $add-operation-and-inputs-to-stmt:end: + 7248 # . reclaim locals + 7249 81 0/subop/add %esp 0x10/imm32 + 7250 # . restore registers + 7251 5f/pop-to-edi + 7252 5e/pop-to-esi + 7253 5b/pop-to-ebx + 7254 5a/pop-to-edx + 7255 59/pop-to-ecx + 7256 58/pop-to-eax + 7257 # . epilogue + 7258 89/<- %esp 5/r32/ebp + 7259 5d/pop-to-ebp + 7260 c3/return + 7261 + 7262 $add-operation-and-inputs-to-stmt:abort: + 7263 # error("invalid statement '" line "'\n") + 7264 (rewind-stream *(ebp+8)) + 7265 (write-buffered *(ebp+0x14) "invalid identifier '") + 7266 (write-stream-data *(ebp+0x14) *(ebp+8)) + 7267 (write-buffered *(ebp+0x14) "'\n") + 7268 (flush *(ebp+0x14)) + 7269 (stop *(ebp+0x18) 1) + 7270 # never gets here + 7271 + 7272 stmt-has-outputs?: # line: (addr stream byte) -> result/eax: boolean + 7273 # . prologue + 7274 55/push-ebp + 7275 89/<- %ebp 4/r32/esp + 7276 # . save registers + 7277 51/push-ecx + 7278 # var word-slice/ecx: slice + 7279 68/push 0/imm32/end + 7280 68/push 0/imm32/start + 7281 89/<- %ecx 4/r32/esp + 7282 # result = false + 7283 b8/copy-to-eax 0/imm32/false + 7284 (rewind-stream *(ebp+8)) + 7285 { + 7286 (next-mu-token *(ebp+8) %ecx) + 7287 # if slice-empty?(word-slice) break + 7288 (slice-empty? %ecx) + 7289 3d/compare-eax-and 0/imm32/false + 7290 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) + 7291 0f 85/jump-if-!= break/disp32 + 7292 # if slice-starts-with?(word-slice, '#') break + 7293 # . eax = *word-slice->start + 7294 8b/-> *ecx 0/r32/eax + 7295 8a/copy-byte *eax 0/r32/AL + 7296 81 4/subop/and %eax 0xff/imm32 + 7297 # . if (eax == '#') break + 7298 3d/compare-eax-and 0x23/imm32/hash + 7299 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) + 7300 0f 84/jump-if-= break/disp32 + 7301 # if slice-equal?(word-slice, '<-') return true + 7302 (slice-equal? %ecx "<-") + 7303 3d/compare-eax-and 0/imm32/false + 7304 74/jump-if-= loop/disp8 + 7305 b8/copy-to-eax 1/imm32/true + 7306 } + 7307 $stmt-has-outputs:end: + 7308 (rewind-stream *(ebp+8)) + 7309 # . reclaim locals + 7310 81 0/subop/add %esp 8/imm32 + 7311 # . restore registers + 7312 59/pop-to-ecx + 7313 # . epilogue + 7314 89/<- %esp 5/r32/ebp + 7315 5d/pop-to-ebp + 7316 c3/return + 7317 + 7318 # if 'name' starts with a digit, create a new literal var for it + 7319 # otherwise return first 'name' from the top (back) of 'vars' and abort if not found + 7320 lookup-var-or-literal: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) + 7321 # . prologue + 7322 55/push-ebp + 7323 89/<- %ebp 4/r32/esp + 7324 # . save registers + 7325 50/push-eax + 7326 51/push-ecx + 7327 56/push-esi + 7328 # esi = name + 7329 8b/-> *(ebp+8) 6/r32/esi + 7330 # if slice-empty?(name) abort + 7331 (slice-empty? %esi) # => eax + 7332 3d/compare-eax-and 0/imm32/false + 7333 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32 + 7334 # var c/ecx: byte = *name->start + 7335 8b/-> *esi 1/r32/ecx + 7336 8a/copy-byte *ecx 1/r32/CL + 7337 81 4/subop/and %ecx 0xff/imm32 + 7338 # if is-decimal-digit?(c) return new var(name) + 7339 { + 7340 (is-decimal-digit? %ecx) # => eax + 7341 3d/compare-eax-and 0/imm32/false + 7342 74/jump-if-= break/disp8 + 7343 $lookup-var-or-literal:literal: + 7344 (new-literal-integer Heap %esi *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) + 7345 eb/jump $lookup-var-or-literal:end/disp8 + 7346 } + 7347 # else if (c == '"') return new var(name) + 7348 { + 7349 81 7/subop/compare %ecx 0x22/imm32/dquote + 7350 75/jump-if-!= break/disp8 + 7351 $lookup-var-or-literal:literal-string: + 7352 (new-literal Heap %esi *(ebp+0x10)) + 7353 eb/jump $lookup-var-or-literal:end/disp8 + 7354 } + 7355 # otherwise return lookup-var(name, vars) + 7356 { + 7357 $lookup-var-or-literal:var: + 7358 (lookup-var %esi *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) + 7359 } + 7360 $lookup-var-or-literal:end: + 7361 # . restore registers + 7362 5e/pop-to-esi + 7363 59/pop-to-ecx + 7364 58/pop-to-eax + 7365 # . epilogue + 7366 89/<- %esp 5/r32/ebp + 7367 5d/pop-to-ebp + 7368 c3/return + 7369 + 7370 $lookup-var-or-literal:abort: + 7371 (write-buffered *(ebp+0x14) "empty variable!") + 7372 (flush *(ebp+0x14)) + 7373 (stop *(ebp+0x18) 1) + 7374 # never gets here + 7375 + 7376 # return first 'name' from the top (back) of 'vars' and abort if not found + 7377 lookup-var: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) + 7378 # . prologue + 7379 55/push-ebp + 7380 89/<- %ebp 4/r32/esp + 7381 # . save registers + 7382 50/push-eax + 7383 # + 7384 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) + 7385 # if (*out == 0) abort + 7386 8b/-> *(ebp+0x10) 0/r32/eax + 7387 81 7/subop/compare *eax 0/imm32 + 7388 74/jump-if-= $lookup-var:abort/disp8 + 7389 $lookup-var:end: + 7390 # . restore registers + 7391 58/pop-to-eax + 7392 # . epilogue + 7393 89/<- %esp 5/r32/ebp + 7394 5d/pop-to-ebp + 7395 c3/return + 7396 + 7397 $lookup-var:abort: + 7398 (write-buffered *(ebp+0x14) "unknown variable '") + 7399 (write-slice-buffered *(ebp+0x14) *(ebp+8)) + 7400 (write-buffered *(ebp+0x14) "'\n") + 7401 (flush *(ebp+0x14)) + 7402 (stop *(ebp+0x18) 1) + 7403 # never gets here + 7404 + 7405 # return first 'name' from the top (back) of 'vars', and 0/null if not found + 7406 lookup-var-helper: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) + 7407 # pseudocode: + 7408 # var curr: (addr handle var) = &vars->data[vars->top - 12] + 7409 # var min = vars->data + 7410 # while curr >= min + 7411 # var v: (handle var) = *curr + 7412 # if v->name == name + 7413 # return + 7414 # curr -= 12 + 7415 # + 7416 # . prologue + 7417 55/push-ebp + 7418 89/<- %ebp 4/r32/esp + 7419 # . save registers + 7420 50/push-eax + 7421 51/push-ecx + 7422 52/push-edx + 7423 53/push-ebx + 7424 56/push-esi + 7425 # clear out + 7426 (zero-out *(ebp+0x10) *Handle-size) + 7427 # esi = vars + 7428 8b/-> *(ebp+0xc) 6/r32/esi + 7429 # ebx = vars->top + 7430 8b/-> *esi 3/r32/ebx + 7431 # if (vars->top > vars->size) abort + 7432 3b/compare<- *(esi+4) 0/r32/eax + 7433 0f 8f/jump-if-> $lookup-var-helper:error1/disp32 + 7434 # var min/edx: (addr handle var) = vars->data + 7435 8d/copy-address *(esi+8) 2/r32/edx + 7436 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] + 7437 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 + 7438 { + 7439 # if (curr < min) return + 7440 39/compare %ebx 2/r32/edx + 7441 0f 82/jump-if-addr< break/disp32 + 7442 # var v/ecx: (addr var) = lookup(*curr) + 7443 (lookup *ebx *(ebx+4)) # => eax + 7444 89/<- %ecx 0/r32/eax + 7445 # var vn/eax: (addr array byte) = lookup(v->name) + 7446 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax + 7447 # if (vn == name) return curr + 7448 (slice-equal? *(ebp+8) %eax) # => eax + 7449 3d/compare-eax-and 0/imm32/false + 7450 { + 7451 74/jump-if-= break/disp8 + 7452 # esi = out + 7453 8b/-> *(ebp+0x10) 6/r32/esi + 7454 # *out = *curr + 7455 8b/-> *ebx 0/r32/eax + 7456 89/<- *esi 0/r32/eax + 7457 8b/-> *(ebx+4) 0/r32/eax + 7458 89/<- *(esi+4) 0/r32/eax + 7459 # return + 7460 eb/jump $lookup-var-helper:end/disp8 + 7461 } + 7462 # curr -= 12 + 7463 81 5/subop/subtract %ebx 0xc/imm32 + 7464 e9/jump loop/disp32 + 7465 } + 7466 $lookup-var-helper:end: + 7467 # . restore registers + 7468 5e/pop-to-esi + 7469 5b/pop-to-ebx + 7470 5a/pop-to-edx + 7471 59/pop-to-ecx + 7472 58/pop-to-eax + 7473 # . epilogue + 7474 89/<- %esp 5/r32/ebp + 7475 5d/pop-to-ebp + 7476 c3/return + 7477 + 7478 $lookup-var-helper:error1: + 7479 (write-buffered *(ebp+0x14) "malformed stack when looking up '") + 7480 (write-slice-buffered *(ebp+0x14) *(ebp+8)) + 7481 (write-buffered *(ebp+0x14) "'\n") + 7482 (flush *(ebp+0x14)) + 7483 (stop *(ebp+0x18) 1) + 7484 # never gets here + 7485 + 7486 # return first 'name' from the top (back) of 'vars' and create a new var for a fn output if not found + 7487 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) 7488 # . prologue 7489 55/push-ebp 7490 89/<- %ebp 4/r32/esp 7491 # . save registers 7492 50/push-eax - 7493 # eax = out - 7494 8b/-> *(ebp+0x14) 0/r32/eax - 7495 # - 7496 (allocate *(ebp+8) *Stmt-size %eax) - 7497 # var out-addr/eax: (addr stmt) = lookup(*out) - 7498 (lookup *eax *(eax+4)) # => eax - 7499 # set tag - 7500 c7 0/subop/copy *eax 3/imm32/tag/var-in-register # Stmt-tag - 7501 # set output - 7502 8d/copy-address *(eax+0x14) 0/r32/eax # Regvardef-outputs - 7503 (append-stmt-var Heap *(ebp+0xc) *(ebp+0x10) 0 0 0 %eax) - 7504 $new-reg-var-def:end: - 7505 # . restore registers - 7506 58/pop-to-eax - 7507 # . epilogue - 7508 89/<- %esp 5/r32/ebp - 7509 5d/pop-to-ebp - 7510 c3/return - 7511 - 7512 append-list: # ad: (addr allocation-descriptor), value: (handle _type), list: (handle list _type), out: (addr handle list _type) - 7513 # . prologue - 7514 55/push-ebp - 7515 89/<- %ebp 4/r32/esp - 7516 # . save registers - 7517 50/push-eax - 7518 51/push-ecx - 7519 57/push-edi - 7520 # edi = out - 7521 8b/-> *(ebp+0x1c) 7/r32/edi - 7522 # *out = new list - 7523 (allocate *(ebp+8) *List-size %edi) - 7524 # var out-addr/edi: (addr list _type) = lookup(*out) - 7525 (lookup *edi *(edi+4)) # => eax - 7526 89/<- %edi 0/r32/eax - 7527 # out-addr->value = value - 7528 8b/-> *(ebp+0xc) 0/r32/eax - 7529 89/<- *edi 0/r32/eax # List-value - 7530 8b/-> *(ebp+0x10) 0/r32/eax - 7531 89/<- *(edi+4) 0/r32/eax # List-value - 7532 # if (list == null) return - 7533 81 7/subop/compare *(ebp+0x14) 0/imm32 - 7534 74/jump-if-= $append-list:end/disp8 - 7535 # otherwise append - 7536 $append-list:non-empty-list: - 7537 # var curr/eax: (addr list _type) = lookup(list) - 7538 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax - 7539 # while (curr->next != null) curr = curr->next - 7540 { - 7541 81 7/subop/compare *(eax+8) 0/imm32 # List-next - 7542 74/jump-if-= break/disp8 - 7543 # curr = lookup(curr->next) - 7544 (lookup *(eax+8) *(eax+0xc)) # List-next, List-next => eax - 7545 # - 7546 eb/jump loop/disp8 - 7547 } - 7548 # edi = out - 7549 8b/-> *(ebp+0x1c) 7/r32/edi - 7550 # curr->next = out - 7551 8b/-> *edi 1/r32/ecx - 7552 89/<- *(eax+8) 1/r32/ecx # List-next - 7553 8b/-> *(edi+4) 1/r32/ecx - 7554 89/<- *(eax+0xc) 1/r32/ecx # List-next - 7555 # out = list - 7556 8b/-> *(ebp+0x14) 1/r32/ecx - 7557 89/<- *edi 1/r32/ecx - 7558 8b/-> *(ebp+0x18) 1/r32/ecx - 7559 89/<- *(edi+4) 1/r32/ecx - 7560 $append-list:end: - 7561 # . restore registers - 7562 5f/pop-to-edi - 7563 59/pop-to-ecx - 7564 58/pop-to-eax - 7565 # . epilogue - 7566 89/<- %esp 5/r32/ebp - 7567 5d/pop-to-ebp - 7568 c3/return - 7569 - 7570 append-stmt-var: # ad: (addr allocation-descriptor), v: (handle var), vars: (handle stmt-var), is-deref?: boolean, out: (addr handle stmt-var) - 7571 # . prologue - 7572 55/push-ebp - 7573 89/<- %ebp 4/r32/esp - 7574 # . save registers - 7575 50/push-eax - 7576 51/push-ecx - 7577 57/push-edi - 7578 # edi = out - 7579 8b/-> *(ebp+0x20) 7/r32/edi - 7580 # out = new stmt-var - 7581 (allocate *(ebp+8) *Stmt-var-size %edi) - 7582 # var out-addr/ecx: (addr stmt-var) = lookup(*out) - 7583 (lookup *edi *(edi+4)) # => eax - 7584 89/<- %ecx 0/r32/eax - 7585 # out-addr->value = v - 7586 8b/-> *(ebp+0xc) 0/r32/eax - 7587 89/<- *ecx 0/r32/eax # Stmt-var-value - 7588 8b/-> *(ebp+0x10) 0/r32/eax - 7589 89/<- *(ecx+4) 0/r32/eax # Stmt-var-value - 7590 # out-addr->is-deref? = is-deref? - 7591 8b/-> *(ebp+0x1c) 0/r32/eax - 7592 89/<- *(ecx+0x10) 0/r32/eax # Stmt-var-is-deref - 7593 # if (vars == null) return result - 7594 81 7/subop/compare *(ebp+0x14) 0/imm32/null - 7595 74/jump-if-= $append-stmt-var:end/disp8 - 7596 # otherwise append - 7597 # var curr/eax: (addr stmt-var) = lookup(vars) - 7598 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax - 7599 # while (curr->next != null) curr = curr->next - 7600 { - 7601 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next - 7602 74/jump-if-= break/disp8 - 7603 # curr = lookup(curr->next) - 7604 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next, Stmt-var-next => eax - 7605 # - 7606 eb/jump loop/disp8 - 7607 } - 7608 # curr->next = out - 7609 8b/-> *edi 1/r32/ecx - 7610 89/<- *(eax+8) 1/r32/ecx # Stmt-var-next - 7611 8b/-> *(edi+4) 1/r32/ecx - 7612 89/<- *(eax+0xc) 1/r32/ecx # Stmt-var-next - 7613 # out = vars - 7614 8b/-> *(ebp+0x14) 1/r32/ecx - 7615 89/<- *edi 1/r32/ecx - 7616 8b/-> *(ebp+0x18) 1/r32/ecx - 7617 89/<- *(edi+4) 1/r32/ecx - 7618 $append-stmt-var:end: - 7619 # . restore registers - 7620 5f/pop-to-edi - 7621 59/pop-to-ecx - 7622 58/pop-to-eax - 7623 # . epilogue - 7624 89/<- %esp 5/r32/ebp - 7625 5d/pop-to-ebp - 7626 c3/return - 7627 - 7628 append-to-block: # ad: (addr allocation-descriptor), block: (addr block), x: (handle stmt) - 7629 # . prologue - 7630 55/push-ebp - 7631 89/<- %ebp 4/r32/esp - 7632 # . save registers - 7633 50/push-eax - 7634 56/push-esi - 7635 # esi = block - 7636 8b/-> *(ebp+0xc) 6/r32/esi - 7637 # block->stmts = append(x, block->stmts) - 7638 8d/copy-address *(esi+4) 0/r32/eax # Block-stmts - 7639 (append-list *(ebp+8) *(ebp+0x10) *(ebp+0x14) *(esi+4) *(esi+8) %eax) # ad, x, x, Block-stmts, Block-stmts - 7640 $append-to-block:end: - 7641 # . restore registers - 7642 5e/pop-to-esi - 7643 58/pop-to-eax - 7644 # . epilogue - 7645 89/<- %esp 5/r32/ebp - 7646 5d/pop-to-ebp - 7647 c3/return - 7648 - 7649 ## Parsing types - 7650 # We need to create metadata on user-defined types, and we need to use this - 7651 # metadata as we parse instructions. - 7652 # However, we also want to allow types to be used before their definitions. - 7653 # This means we can't ever assume any type data structures exist. - 7654 - 7655 lookup-or-create-constant: # container: (addr stmt-var), field-name: (addr slice), out: (addr handle var) - 7656 # . prologue - 7657 55/push-ebp - 7658 89/<- %ebp 4/r32/esp - 7659 # . save registers - 7660 50/push-eax - 7661 56/push-esi - 7662 # var container-type/esi: type-id - 7663 (container-type *(ebp+8)) # => eax - 7664 89/<- %esi 0/r32/eax - 7665 # var tmp/eax: (handle typeinfo) = find-or-create-typeinfo(container-type) + 7493 # + 7494 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x14)) + 7495 { + 7496 # if (out != 0) return + 7497 8b/-> *(ebp+0x14) 0/r32/eax + 7498 81 7/subop/compare *eax 0/imm32 + 7499 75/jump-if-!= break/disp8 + 7500 # if name is one of fn's outputs, return it + 7501 { + 7502 (find-in-function-outputs *(ebp+0x10) *(ebp+8) *(ebp+0x14)) + 7503 8b/-> *(ebp+0x14) 0/r32/eax + 7504 81 7/subop/compare *eax 0/imm32 + 7505 # otherwise abort + 7506 0f 84/jump-if-= $lookup-or-define-var:abort/disp32 + 7507 # update vars + 7508 (push *(ebp+0xc) *eax) + 7509 (push *(ebp+0xc) *(eax+4)) + 7510 (push *(ebp+0xc) 0) # never spill fn-outputs + 7511 } + 7512 } + 7513 $lookup-or-define-var:end: + 7514 # . restore registers + 7515 58/pop-to-eax + 7516 # . epilogue + 7517 89/<- %esp 5/r32/ebp + 7518 5d/pop-to-ebp + 7519 c3/return + 7520 + 7521 $lookup-or-define-var:abort: + 7522 (write-buffered *(ebp+0x18) "unknown variable '") + 7523 (write-slice-buffered *(ebp+0x18) *(ebp+8)) + 7524 (write-buffered *(ebp+0x18) "'\n") + 7525 (flush *(ebp+0x18)) + 7526 (stop *(ebp+0x1c) 1) + 7527 # never gets here + 7528 + 7529 find-in-function-outputs: # fn: (addr function), name: (addr slice), out: (addr handle var) + 7530 # . prologue + 7531 55/push-ebp + 7532 89/<- %ebp 4/r32/esp + 7533 # . save registers + 7534 50/push-eax + 7535 51/push-ecx + 7536 # var curr/ecx: (addr list var) = lookup(fn->outputs) + 7537 8b/-> *(ebp+8) 1/r32/ecx + 7538 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax + 7539 89/<- %ecx 0/r32/eax + 7540 # while curr != null + 7541 { + 7542 81 7/subop/compare %ecx 0/imm32 + 7543 74/jump-if-= break/disp8 + 7544 # var v/eax: (addr var) = lookup(curr->value) + 7545 (lookup *ecx *(ecx+4)) # List-value List-value => eax + 7546 # var s/eax: (addr array byte) = lookup(v->name) + 7547 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 7548 # if (s == name) return curr->value + 7549 (slice-equal? *(ebp+0xc) %eax) # => eax + 7550 3d/compare-eax-and 0/imm32/false + 7551 { + 7552 74/jump-if-= break/disp8 + 7553 # var edi = out + 7554 57/push-edi + 7555 8b/-> *(ebp+0x10) 7/r32/edi + 7556 # *out = curr->value + 7557 8b/-> *ecx 0/r32/eax + 7558 89/<- *edi 0/r32/eax + 7559 8b/-> *(ecx+4) 0/r32/eax + 7560 89/<- *(edi+4) 0/r32/eax + 7561 # + 7562 5f/pop-to-edi + 7563 eb/jump $find-in-function-outputs:end/disp8 + 7564 } + 7565 # curr = curr->next + 7566 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax + 7567 89/<- %ecx 0/r32/eax + 7568 # + 7569 eb/jump loop/disp8 + 7570 } + 7571 b8/copy-to-eax 0/imm32 + 7572 $find-in-function-outputs:end: + 7573 # . restore registers + 7574 59/pop-to-ecx + 7575 58/pop-to-eax + 7576 # . epilogue + 7577 89/<- %esp 5/r32/ebp + 7578 5d/pop-to-ebp + 7579 c3/return + 7580 + 7581 test-parse-mu-stmt: + 7582 # . prologue + 7583 55/push-ebp + 7584 89/<- %ebp 4/r32/esp + 7585 # setup + 7586 (clear-stream _test-input-stream) + 7587 (write _test-input-stream "increment n\n") + 7588 # var vars/ecx: (stack (addr var) 16) + 7589 81 5/subop/subtract %esp 0xc0/imm32 + 7590 68/push 0xc0/imm32/size + 7591 68/push 0/imm32/top + 7592 89/<- %ecx 4/r32/esp + 7593 (clear-stack %ecx) + 7594 # var v/edx: (handle var) + 7595 68/push 0/imm32 + 7596 68/push 0/imm32 + 7597 89/<- %edx 4/r32/esp + 7598 # var s/eax: (handle array byte) + 7599 68/push 0/imm32 + 7600 68/push 0/imm32 + 7601 89/<- %eax 4/r32/esp + 7602 # v = new var("n") + 7603 (copy-array Heap "n" %eax) + 7604 (new-var Heap *eax *(eax+4) %edx) + 7605 # + 7606 (push %ecx *edx) + 7607 (push %ecx *(edx+4)) + 7608 (push %ecx 0) + 7609 # var out/eax: (handle stmt) + 7610 68/push 0/imm32 + 7611 68/push 0/imm32 + 7612 89/<- %eax 4/r32/esp + 7613 # convert + 7614 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) + 7615 # var out-addr/edx: (addr stmt) = lookup(*out) + 7616 (lookup *eax *(eax+4)) # => eax + 7617 89/<- %edx 0/r32/eax + 7618 # out->tag + 7619 (check-ints-equal *edx 1 "F - test-parse-mu-stmt/tag") # Stmt-tag is Stmt1 + 7620 # out->operation + 7621 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax + 7622 (check-strings-equal %eax "increment" "F - test-parse-mu-stmt/name") # Stmt1-operation + 7623 # out->inouts->value->name + 7624 # . eax = out->inouts + 7625 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 7626 # . eax = out->inouts->value + 7627 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 7628 # . eax = out->inouts->value->name + 7629 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 7630 # . + 7631 (check-strings-equal %eax "n" "F - test-parse-mu-stmt/inout:0") + 7632 # . epilogue + 7633 89/<- %esp 5/r32/ebp + 7634 5d/pop-to-ebp + 7635 c3/return + 7636 + 7637 test-parse-mu-stmt-with-comma: + 7638 # . prologue + 7639 55/push-ebp + 7640 89/<- %ebp 4/r32/esp + 7641 # setup + 7642 (clear-stream _test-input-stream) + 7643 (write _test-input-stream "copy-to n, 3\n") + 7644 # var vars/ecx: (stack (addr var) 16) + 7645 81 5/subop/subtract %esp 0xc0/imm32 + 7646 68/push 0xc0/imm32/size + 7647 68/push 0/imm32/top + 7648 89/<- %ecx 4/r32/esp + 7649 (clear-stack %ecx) + 7650 # var v/edx: (handle var) + 7651 68/push 0/imm32 + 7652 68/push 0/imm32 + 7653 89/<- %edx 4/r32/esp + 7654 # var s/eax: (handle array byte) + 7655 68/push 0/imm32 + 7656 68/push 0/imm32 + 7657 89/<- %eax 4/r32/esp + 7658 # v = new var("n") + 7659 (copy-array Heap "n" %eax) + 7660 (new-var Heap *eax *(eax+4) %edx) + 7661 # + 7662 (push %ecx *edx) + 7663 (push %ecx *(edx+4)) + 7664 (push %ecx 0) + 7665 # var out/eax: (handle stmt) 7666 68/push 0/imm32 7667 68/push 0/imm32 7668 89/<- %eax 4/r32/esp - 7669 (find-or-create-typeinfo %esi %eax) - 7670 # var tmp-addr/eax: (addr typeinfo) = lookup(tmp) - 7671 (lookup *eax *(eax+4)) # => eax - 7672 # result = find-or-create-typeinfo-output-var(typeinfo, field-name) - 7673 #? (write-buffered Stderr "constant: ") - 7674 #? (write-slice-buffered Stderr *(ebp+0xc)) - 7675 #? (write-buffered Stderr Newline) - 7676 #? (flush Stderr) - 7677 (find-or-create-typeinfo-output-var %eax *(ebp+0xc) *(ebp+0x10)) - 7678 #? 8b/-> *(ebp+0x10) 0/r32/eax - 7679 #? (write-buffered Stderr "@") - 7680 #? (lookup *eax *(eax+4)) - 7681 #? (print-int32-buffered Stderr %eax) - 7682 #? (lookup *eax *(eax+4)) - 7683 #? (write-buffered Stderr %eax) - 7684 #? (write-buffered Stderr Newline) - 7685 #? (flush Stderr) - 7686 #? (write-buffered Stderr "offset: ") - 7687 #? 8b/-> *(eax+0x14) 0/r32/eax - 7688 #? (print-int32-buffered Stderr %eax) - 7689 #? (write-buffered Stderr Newline) - 7690 #? (flush Stderr) - 7691 $lookup-or-create-constant:end: - 7692 # . reclaim locals - 7693 81 0/subop/add %esp 8/imm32 - 7694 # . restore registers - 7695 5e/pop-to-esi - 7696 58/pop-to-eax - 7697 # . epilogue - 7698 89/<- %esp 5/r32/ebp - 7699 5d/pop-to-ebp - 7700 c3/return - 7701 - 7702 # if addr var: - 7703 # container->var->type->right->left->value - 7704 # otherwise - 7705 # container->var->type->value - 7706 container-type: # container: (addr stmt-var) -> result/eax: type-id - 7707 # . prologue - 7708 55/push-ebp - 7709 89/<- %ebp 4/r32/esp - 7710 # - 7711 8b/-> *(ebp+8) 0/r32/eax - 7712 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 7713 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax - 7714 { - 7715 81 7/subop/compare *(eax+8) 0/imm32 # Tree-right - 7716 74/jump-if-= break/disp8 - 7717 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax - 7718 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax - 7719 } - 7720 8b/-> *(eax+4) 0/r32/eax # Tree-value - 7721 $container-type:end: - 7722 # . epilogue - 7723 89/<- %esp 5/r32/ebp - 7724 5d/pop-to-ebp - 7725 c3/return - 7726 - 7727 find-or-create-typeinfo: # t: type-id, out: (addr handle typeinfo) - 7728 # . prologue - 7729 55/push-ebp - 7730 89/<- %ebp 4/r32/esp - 7731 # . save registers - 7732 50/push-eax - 7733 51/push-ecx - 7734 52/push-edx - 7735 57/push-edi - 7736 # edi = out - 7737 8b/-> *(ebp+0xc) 7/r32/edi - 7738 # var fields/ecx: (handle table (handle array byte) (handle typeinfo-entry)) - 7739 68/push 0/imm32 - 7740 68/push 0/imm32 - 7741 89/<- %ecx 4/r32/esp - 7742 # find-typeinfo(t, out) - 7743 (find-typeinfo *(ebp+8) %edi) - 7744 { - 7745 # if (*out != 0) break - 7746 81 7/subop/compare *edi 0/imm32 - 7747 0f 85/jump-if-!= break/disp32 - 7748 $find-or-create-typeinfo:create: - 7749 # *out = allocate - 7750 (allocate Heap *Typeinfo-size %edi) - 7751 # var tmp/eax: (addr typeinfo) = lookup(*out) - 7752 (lookup *edi *(edi+4)) # => eax - 7753 #? (write-buffered Stderr "created typeinfo at ") - 7754 #? (print-int32-buffered Stderr %eax) - 7755 #? (write-buffered Stderr " for type-id ") - 7756 #? (print-int32-buffered Stderr *(ebp+8)) - 7757 #? (write-buffered Stderr Newline) - 7758 #? (flush Stderr) - 7759 # tmp->id = t - 7760 8b/-> *(ebp+8) 2/r32/edx - 7761 89/<- *eax 2/r32/edx # Typeinfo-id - 7762 # tmp->fields = new table - 7763 # . fields = new table - 7764 (new-stream Heap 0x40 *Typeinfo-fields-row-size %ecx) - 7765 # . tmp->fields = fields - 7766 8b/-> *ecx 2/r32/edx - 7767 89/<- *(eax+4) 2/r32/edx # Typeinfo-fields - 7768 8b/-> *(ecx+4) 2/r32/edx - 7769 89/<- *(eax+8) 2/r32/edx # Typeinfo-fields - 7770 # tmp->next = Program->types - 7771 8b/-> *_Program-types 1/r32/ecx - 7772 89/<- *(eax+0x10) 1/r32/ecx # Typeinfo-next - 7773 8b/-> *_Program-types->payload 1/r32/ecx - 7774 89/<- *(eax+0x14) 1/r32/ecx # Typeinfo-next - 7775 # Program->types = out - 7776 8b/-> *edi 1/r32/ecx - 7777 89/<- *_Program-types 1/r32/ecx - 7778 8b/-> *(edi+4) 1/r32/ecx - 7779 89/<- *_Program-types->payload 1/r32/ecx - 7780 } - 7781 $find-or-create-typeinfo:end: - 7782 # . reclaim locals - 7783 81 0/subop/add %esp 8/imm32 - 7784 # . restore registers - 7785 5f/pop-to-edi - 7786 5a/pop-to-edx - 7787 59/pop-to-ecx - 7788 58/pop-to-eax - 7789 # . epilogue - 7790 89/<- %esp 5/r32/ebp - 7791 5d/pop-to-ebp - 7792 c3/return - 7793 - 7794 find-typeinfo: # t: type-id, out: (addr handle typeinfo) - 7795 # . prologue - 7796 55/push-ebp - 7797 89/<- %ebp 4/r32/esp - 7798 # . save registers - 7799 50/push-eax - 7800 51/push-ecx - 7801 52/push-edx - 7802 57/push-edi - 7803 # ecx = t - 7804 8b/-> *(ebp+8) 1/r32/ecx - 7805 # edi = out - 7806 8b/-> *(ebp+0xc) 7/r32/edi - 7807 # *out = Program->types - 7808 8b/-> *_Program-types 0/r32/eax - 7809 89/<- *edi 0/r32/eax - 7810 8b/-> *_Program-types->payload 0/r32/eax - 7811 89/<- *(edi+4) 0/r32/eax - 7812 { - 7813 # if (*out == 0) break - 7814 81 7/subop/compare *edi 0/imm32 - 7815 74/jump-if-= break/disp8 - 7816 # var tmp/eax: (addr typeinfo) = lookup(*out) - 7817 (lookup *edi *(edi+4)) # => eax - 7818 # if (tmp->id == t) break - 7819 39/compare *eax 1/r32/ecx # Typeinfo-id - 7820 74/jump-if-= break/disp8 - 7821 # *out = tmp->next - 7822 8b/-> *(eax+0x10) 2/r32/edx # Typeinfo-next - 7823 89/<- *edi 2/r32/edx - 7824 8b/-> *(eax+0x14) 2/r32/edx # Typeinfo-next - 7825 89/<- *(edi+4) 2/r32/edx - 7826 # - 7827 eb/jump loop/disp8 - 7828 } - 7829 $find-typeinfo:end: - 7830 # . restore registers - 7831 5f/pop-to-edi - 7832 5a/pop-to-edx - 7833 59/pop-to-ecx - 7834 58/pop-to-eax - 7835 # . epilogue - 7836 89/<- %esp 5/r32/ebp - 7837 5d/pop-to-ebp - 7838 c3/return - 7839 - 7840 find-or-create-typeinfo-output-var: # T: (addr typeinfo), f: (addr slice), out: (addr handle var) - 7841 # . prologue - 7842 55/push-ebp - 7843 89/<- %ebp 4/r32/esp - 7844 # . save registers - 7845 50/push-eax - 7846 52/push-edx - 7847 57/push-edi - 7848 # var dest/edi: (handle typeinfo-entry) - 7849 68/push 0/imm32 - 7850 68/push 0/imm32 - 7851 89/<- %edi 4/r32/esp - 7852 # find-or-create-typeinfo-fields(T, f, dest) - 7853 (find-or-create-typeinfo-fields *(ebp+8) *(ebp+0xc) %edi) - 7854 # var dest-addr/edi: (addr typeinfo-entry) = lookup(dest) - 7855 (lookup *edi *(edi+4)) # => eax - 7856 89/<- %edi 0/r32/eax - 7857 # if dest-addr->output-var doesn't exist, create it - 7858 { - 7859 81 7/subop/compare *(edi+0xc) 0/imm32 # Typeinfo-entry-output-var - 7860 0f 85/jump-if-!= break/disp32 - 7861 # dest-addr->output-var = new var(dummy name, type, -1 offset) - 7862 # . var name/eax: (handle array byte) = "field" - 7863 68/push 0/imm32 - 7864 68/push 0/imm32 - 7865 89/<- %eax 4/r32/esp - 7866 (copy-array Heap "field" %eax) - 7867 # . new var - 7868 8d/copy-address *(edi+0xc) 2/r32/edx - 7869 (new-var Heap *eax *(eax+4) %edx) - 7870 # . reclaim name - 7871 81 0/subop/add %esp 8/imm32 - 7872 # var result/edx: (addr var) = lookup(dest-addr->output-var) - 7873 (lookup *(edi+0xc) *(edi+0x10)) # => eax - 7874 89/<- %edx 0/r32/eax - 7875 # result->type = new constant type - 7876 8d/copy-address *(edx+8) 0/r32/eax # Var-type - 7877 (allocate Heap *Tree-size %eax) - 7878 (lookup *(edx+8) *(edx+0xc)) # => eax - 7879 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom - 7880 c7 0/subop/copy *(eax+4) 6/imm32/constant # Tree-value - 7881 c7 0/subop/copy *(eax+8) 0/imm32 # Tree-left - 7882 c7 0/subop/copy *(eax+0xc) 0/imm32 # Tree-right - 7883 c7 0/subop/copy *(eax+0x10) 0/imm32 # Tree-right - 7884 # result->offset isn't filled out yet - 7885 c7 0/subop/copy *(edx+0x14) -1/imm32/uninitialized # Var-offset - 7886 } - 7887 # out = dest-addr->output-var - 7888 8b/-> *(ebp+0x10) 2/r32/edx - 7889 8b/-> *(edi+0xc) 0/r32/eax # Typeinfo-entry-output-var - 7890 89/<- *edx 0/r32/eax - 7891 8b/-> *(edi+0x10) 0/r32/eax # Typeinfo-entry-output-var - 7892 89/<- *(edx+4) 0/r32/eax - 7893 $find-or-create-typeinfo-output-var:end: - 7894 # . reclaim locals - 7895 81 0/subop/add %esp 8/imm32 - 7896 # . restore registers - 7897 5f/pop-to-edi - 7898 5a/pop-to-edx - 7899 58/pop-to-eax - 7900 # . epilogue - 7901 89/<- %esp 5/r32/ebp - 7902 5d/pop-to-ebp - 7903 c3/return - 7904 - 7905 find-or-create-typeinfo-fields: # T: (addr typeinfo), f: (addr slice), out: (addr handle typeinfo-entry) - 7906 # . prologue - 7907 55/push-ebp - 7908 89/<- %ebp 4/r32/esp - 7909 # . save registers - 7910 50/push-eax - 7911 56/push-esi - 7912 57/push-edi - 7913 # eax = lookup(T->fields) - 7914 8b/-> *(ebp+8) 0/r32/eax - 7915 (lookup *(eax+4) *(eax+8)) # Typeinfo-fields Typeinfo-fields => eax - 7916 # edi = out - 7917 8b/-> *(ebp+0x10) 7/r32/edi - 7918 # var src/esi: (addr handle typeinfo-entry) = get-or-insert-slice(T->fields, f) - 7919 (get-or-insert-slice %eax *(ebp+0xc) *Typeinfo-fields-row-size Heap) # => eax - 7920 89/<- %esi 0/r32/eax - 7921 # if src doesn't exist, allocate it - 7922 { - 7923 81 7/subop/compare *esi 0/imm32 - 7924 75/jump-if-!= break/disp8 - 7925 (allocate Heap *Typeinfo-entry-size %esi) - 7926 #? (write-buffered Stderr "handle at ") - 7927 #? (print-int32-buffered Stderr %esi) - 7928 #? (write-buffered Stderr ": ") - 7929 #? (print-int32-buffered Stderr *esi) - 7930 #? (write-buffered Stderr " ") - 7931 #? (print-int32-buffered Stderr *(esi+4)) - 7932 #? (write-buffered Stderr Newline) - 7933 #? (flush Stderr) - 7934 #? (lookup *esi *(esi+4)) - 7935 #? (write-buffered Stderr "created typeinfo fields at ") - 7936 #? (print-int32-buffered Stderr %esi) - 7937 #? (write-buffered Stderr " for ") - 7938 #? (print-int32-buffered Stderr *(ebp+8)) - 7939 #? (write-buffered Stderr Newline) - 7940 #? (flush Stderr) - 7941 } - 7942 # *out = src - 7943 # . *edi = *src - 7944 8b/-> *esi 0/r32/eax - 7945 89/<- *edi 0/r32/eax - 7946 8b/-> *(esi+4) 0/r32/eax - 7947 89/<- *(edi+4) 0/r32/eax - 7948 $find-or-create-typeinfo-fields:end: - 7949 # . restore registers - 7950 5f/pop-to-edi - 7951 5e/pop-to-esi - 7952 58/pop-to-eax - 7953 # . epilogue - 7954 89/<- %esp 5/r32/ebp - 7955 5d/pop-to-ebp - 7956 c3/return - 7957 - 7958 populate-mu-type: # in: (addr stream byte), t: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) - 7959 # pseudocode: - 7960 # var line: (stream byte 512) - 7961 # curr-index = 0 - 7962 # while true - 7963 # clear-stream(line) - 7964 # read-line-buffered(in, line) - 7965 # if line->write == 0 - 7966 # abort - 7967 # word-slice = next-mu-token(line) - 7968 # if slice-empty?(word-slice) # end of line - 7969 # continue - 7970 # if slice-equal?(word-slice, "}") - 7971 # break - 7972 # var v: (handle var) = parse-var-with-type(word-slice, line) - 7973 # var r: (handle typeinfo-fields) = find-or-create-typeinfo-fields(t, word-slice/v->name) - 7974 # TODO: ensure that r->first is null - 7975 # r->index = curr-index - 7976 # curr-index++ - 7977 # r->input-var = v - 7978 # if r->output-var == 0 - 7979 # r->output-var = new literal - 7980 # TODO: ensure nothing else in line - 7981 # t->total-size-in-bytes = -2 (not yet initialized) - 7982 # check-input-vars(t, err, ed) - 7983 # - 7984 # . prologue - 7985 55/push-ebp - 7986 89/<- %ebp 4/r32/esp - 7987 # var curr-index: int at *(ebp-4) - 7988 68/push 0/imm32 - 7989 # . save registers - 7990 50/push-eax - 7991 51/push-ecx - 7992 52/push-edx - 7993 53/push-ebx - 7994 56/push-esi - 7995 57/push-edi - 7996 # edi = t - 7997 8b/-> *(ebp+0xc) 7/r32/edi - 7998 # var line/ecx: (stream byte 512) - 7999 81 5/subop/subtract %esp 0x200/imm32 - 8000 68/push 0x200/imm32/size - 8001 68/push 0/imm32/read - 8002 68/push 0/imm32/write - 8003 89/<- %ecx 4/r32/esp - 8004 # var word-slice/edx: slice - 8005 68/push 0/imm32/end - 8006 68/push 0/imm32/start - 8007 89/<- %edx 4/r32/esp - 8008 # var v/esi: (handle var) - 8009 68/push 0/imm32 - 8010 68/push 0/imm32 - 8011 89/<- %esi 4/r32/esp - 8012 # var r/ebx: (handle typeinfo-entry) - 8013 68/push 0/imm32 - 8014 68/push 0/imm32 - 8015 89/<- %ebx 4/r32/esp - 8016 { - 8017 $populate-mu-type:line-loop: - 8018 (clear-stream %ecx) - 8019 (read-line-buffered *(ebp+8) %ecx) - 8020 # if (line->write == 0) abort - 8021 81 7/subop/compare *ecx 0/imm32 - 8022 0f 84/jump-if-= $populate-mu-type:abort/disp32 - 8023 +-- 6 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8029 (next-mu-token %ecx %edx) - 8030 # if slice-empty?(word-slice) continue - 8031 (slice-empty? %edx) # => eax - 8032 3d/compare-eax-and 0/imm32 - 8033 0f 85/jump-if-!= loop/disp32 - 8034 # if slice-equal?(word-slice, "}") break - 8035 (slice-equal? %edx "}") - 8036 3d/compare-eax-and 0/imm32 - 8037 0f 85/jump-if-!= break/disp32 - 8038 $populate-mu-type:parse-element: - 8039 # v = parse-var-with-type(word-slice, first-line) - 8040 # must do this first to strip the trailing ':' from word-slice before - 8041 # using it in find-or-create-typeinfo-fields below - 8042 # TODO: clean up that mutation in parse-var-with-type - 8043 (parse-var-with-type %edx %ecx %esi *(ebp+0x10) *(ebp+0x14)) # => eax - 8044 # var tmp/ecx - 8045 51/push-ecx - 8046 $populate-mu-type:create-typeinfo-fields: - 8047 # var r/ebx: (handle typeinfo-entry) - 8048 (find-or-create-typeinfo-fields %edi %edx %ebx) - 8049 # r->index = curr-index - 8050 (lookup *ebx *(ebx+4)) # => eax - 8051 8b/-> *(ebp-4) 1/r32/ecx - 8052 #? (write-buffered Stderr "saving index ") - 8053 #? (print-int32-buffered Stderr %ecx) - 8054 #? (write-buffered Stderr " at ") - 8055 #? (print-int32-buffered Stderr %edi) - 8056 #? (write-buffered Stderr Newline) - 8057 #? (flush Stderr) - 8058 89/<- *(eax+8) 1/r32/ecx # Typeinfo-entry-index - 8059 # ++curr-index - 8060 ff 0/subop/increment *(ebp-4) - 8061 $populate-mu-type:set-input-type: - 8062 # r->input-var = v - 8063 8b/-> *esi 1/r32/ecx - 8064 89/<- *eax 1/r32/ecx # Typeinfo-entry-input-var - 8065 8b/-> *(esi+4) 1/r32/ecx - 8066 89/<- *(eax+4) 1/r32/ecx # Typeinfo-entry-input-var - 8067 59/pop-to-ecx - 8068 { - 8069 $populate-mu-type:create-output-type: - 8070 # if (r->output-var == 0) create a new var with some placeholder data - 8071 81 7/subop/compare *(eax+0xc) 0/imm32 # Typeinfo-entry-output-var - 8072 75/jump-if-!= break/disp8 - 8073 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var - 8074 (new-literal Heap %edx %eax) - 8075 } - 8076 e9/jump loop/disp32 - 8077 } - 8078 $populate-mu-type:invalidate-total-size-in-bytes: - 8079 # Offsets and total size may not be accurate here since we may not yet - 8080 # have encountered the element types. - 8081 # We'll recompute them separately after parsing the entire program. - 8082 c7 0/subop/copy *(edi+0xc) -2/imm32/uninitialized # Typeinfo-total-size-in-bytes - 8083 $populate-mu-type:validate: - 8084 (check-input-vars *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) - 8085 $populate-mu-type:end: - 8086 # . reclaim locals - 8087 81 0/subop/add %esp 0x224/imm32 - 8088 # . restore registers - 8089 5f/pop-to-edi - 8090 5e/pop-to-esi - 8091 5b/pop-to-ebx - 8092 5a/pop-to-edx - 8093 59/pop-to-ecx - 8094 58/pop-to-eax - 8095 # reclaim curr-index - 8096 81 0/subop/add %esp 4/imm32 - 8097 # . epilogue - 8098 89/<- %esp 5/r32/ebp - 8099 5d/pop-to-ebp - 8100 c3/return - 8101 - 8102 $populate-mu-type:abort: - 8103 # error("unexpected top-level command: " word-slice "\n") - 8104 (write-buffered *(ebp+0x10) "incomplete type definition '") - 8105 (type-name *edi) # Typeinfo-id => eax - 8106 (write-buffered *(ebp+0x10) %eax) - 8107 (write-buffered *(ebp+0x10) "\n") - 8108 (flush *(ebp+0x10)) - 8109 (stop *(ebp+0x14) 1) - 8110 # never gets here - 8111 - 8112 check-input-vars: # t: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) - 8113 # . prologue - 8114 55/push-ebp - 8115 89/<- %ebp 4/r32/esp - 8116 # . save registers - 8117 50/push-eax - 8118 51/push-ecx - 8119 52/push-edx - 8120 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(t->fields) - 8121 8b/-> *(ebp+8) 0/r32/eax - 8122 (lookup *(eax+4) *(eax+8)) # Typeinfo-fields Typeinfo-fields => eax - 8123 89/<- %ecx 0/r32/eax - 8124 # var table-size/edx: int = table->write - 8125 8b/-> *ecx 2/r32/edx # stream-write - 8126 # var curr/ecx: (addr table_row) = table->data - 8127 8d/copy-address *(ecx+0xc) 1/r32/ecx - 8128 # var max/edx: (addr table_row) = table->data + table->write - 8129 8d/copy-address *(ecx+edx) 2/r32/edx - 8130 { - 8131 $check-input-vars:loop: - 8132 # if (curr >= max) break - 8133 39/compare %ecx 2/r32/edx - 8134 73/jump-if-addr>= break/disp8 - 8135 (lookup *ecx *(ecx+4)) # => eax - 8136 # var t2/eax: (addr typeinfo-entry) = lookup(curr->value) - 8137 (lookup *(ecx+8) *(ecx+0xc)) # => eax - 8138 # if (t2->input-var == null) raise an error - 8139 8b/-> *eax 0/r32/eax # Typeinfo-entry-input-var - 8140 3d/compare-eax-and 0/imm32/null - 8141 0f 84/jump-if-= $check-input-vars:abort/disp32 - 8142 # curr += row-size - 8143 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size - 8144 # - 8145 eb/jump loop/disp8 - 8146 } - 8147 $check-input-vars:end: - 8148 # . restore registers - 8149 5a/pop-to-edx - 8150 59/pop-to-ecx - 8151 58/pop-to-eax - 8152 # . epilogue - 8153 89/<- %esp 5/r32/ebp - 8154 5d/pop-to-ebp - 8155 c3/return - 8156 - 8157 $check-input-vars:abort: - 8158 # error("type " type " has no member called '" curr->name "'\n") - 8159 (write-buffered *(ebp+0xc) "type '") - 8160 # . var tmp/edx: int = t->id << 2 - 8161 8b/-> *(ebp+8) 0/r32/eax - 8162 8b/-> *eax 2/r32/edx # Typeinfo-id - 8163 c1/shift 4/subop/left %edx 2/imm8 - 8164 # . var a/edx: (addr array byte) = Type-id->data[tmp] - 8165 b8/copy-to-eax Type-id/imm32 - 8166 8b/-> *(eax+edx+0xc) 2/r32/edx - 8167 (write-buffered *(ebp+0xc) %edx) - 8168 (write-buffered *(ebp+0xc) "' has no member called '") - 8169 (lookup *ecx *(ecx+4)) # => eax - 8170 (write-buffered *(ebp+0xc) %eax) - 8171 (write-buffered *(ebp+0xc) "'\n") - 8172 (flush *(ebp+0xc)) - 8173 (stop *(ebp+0x10) 1) - 8174 # never gets here - 8175 - 8176 type-name: # index: int -> result/eax: (addr array byte) - 8177 # . prologue - 8178 55/push-ebp - 8179 89/<- %ebp 4/r32/esp - 8180 # - 8181 (index Type-id *(ebp+8)) - 8182 $type-name:end: - 8183 # . epilogue - 8184 89/<- %esp 5/r32/ebp - 8185 5d/pop-to-ebp - 8186 c3/return - 8187 - 8188 index: # arr: (addr stream (handle array byte)), index: int -> result/eax: (addr array byte) - 8189 # . prologue - 8190 55/push-ebp - 8191 89/<- %ebp 4/r32/esp - 8192 # . save registers - 8193 56/push-esi - 8194 # TODO: bounds-check index - 8195 # esi = arr - 8196 8b/-> *(ebp+8) 6/r32/esi - 8197 # eax = index - 8198 8b/-> *(ebp+0xc) 0/r32/eax - 8199 # eax = *(arr + 12 + index) - 8200 8b/-> *(esi+eax+0xc) 0/r32/eax - 8201 $index:end: + 7669 # convert + 7670 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) + 7671 # var out-addr/edx: (addr stmt) = lookup(*out) + 7672 (lookup *eax *(eax+4)) # => eax + 7673 89/<- %edx 0/r32/eax + 7674 # out->tag + 7675 (check-ints-equal *edx 1 "F - test-parse-mu-stmt-with-comma/tag") # Stmt-tag is Stmt1 + 7676 # out->operation + 7677 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax + 7678 (check-strings-equal %eax "copy-to" "F - test-parse-mu-stmt-with-comma/name") # Stmt1-operation + 7679 # out->inouts->value->name + 7680 # . eax = out->inouts + 7681 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 7682 # . eax = out->inouts->value + 7683 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 7684 # . eax = out->inouts->value->name + 7685 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 7686 # . + 7687 (check-strings-equal %eax "n" "F - test-parse-mu-stmt-with-comma/inout:0") + 7688 # . epilogue + 7689 89/<- %esp 5/r32/ebp + 7690 5d/pop-to-ebp + 7691 c3/return + 7692 + 7693 new-var: # ad: (addr allocation-descriptor), name: (handle array byte), out: (addr handle var) + 7694 # . prologue + 7695 55/push-ebp + 7696 89/<- %ebp 4/r32/esp + 7697 # . save registers + 7698 50/push-eax + 7699 51/push-ecx + 7700 # ecx = out + 7701 8b/-> *(ebp+0x14) 1/r32/ecx + 7702 # + 7703 (allocate *(ebp+8) *Var-size %ecx) + 7704 # var out-addr/eax: (addr var) + 7705 (lookup *ecx *(ecx+4)) # => eax + 7706 # out-addr->name = name + 7707 8b/-> *(ebp+0xc) 1/r32/ecx + 7708 89/<- *eax 1/r32/ecx # Var-name + 7709 8b/-> *(ebp+0x10) 1/r32/ecx + 7710 89/<- *(eax+4) 1/r32/ecx # Var-name + 7711 #? (write-buffered Stderr "var ") + 7712 #? (lookup *(ebp+0xc) *(ebp+0x10)) + 7713 #? (write-buffered Stderr %eax) + 7714 #? (write-buffered Stderr " at ") + 7715 #? 8b/-> *(ebp+0x14) 1/r32/ecx + 7716 #? (lookup *ecx *(ecx+4)) # => eax + 7717 #? (print-int32-buffered Stderr %eax) + 7718 #? (write-buffered Stderr Newline) + 7719 #? (flush Stderr) + 7720 $new-var:end: + 7721 # . restore registers + 7722 59/pop-to-ecx + 7723 58/pop-to-eax + 7724 # . epilogue + 7725 89/<- %esp 5/r32/ebp + 7726 5d/pop-to-ebp + 7727 c3/return + 7728 + 7729 new-literal-integer: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) + 7730 # . prologue + 7731 55/push-ebp + 7732 89/<- %ebp 4/r32/esp + 7733 # . save registers + 7734 50/push-eax + 7735 51/push-ecx + 7736 # if (!is-hex-int?(name)) abort + 7737 (is-hex-int? *(ebp+0xc)) # => eax + 7738 3d/compare-eax-and 0/imm32/false + 7739 0f 84/jump-if-= $new-literal-integer:abort/disp32 + 7740 # out = new var(s) + 7741 (new-var-from-slice *(ebp+8) *(ebp+0xc) *(ebp+0x10)) + 7742 # var out-addr/ecx: (addr var) = lookup(*out) + 7743 8b/-> *(ebp+0x10) 0/r32/eax + 7744 (lookup *eax *(eax+4)) # => eax + 7745 89/<- %ecx 0/r32/eax + 7746 # out-addr->type = new tree() + 7747 8d/copy-address *(ecx+8) 0/r32/eax # Var-type + 7748 (allocate *(ebp+8) *Tree-size %eax) + 7749 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 7750 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom + 7751 # nothing else to do; default type is 'literal' + 7752 $new-literal-integer:end: + 7753 # . reclaim locals + 7754 81 0/subop/add %esp 8/imm32 + 7755 # . restore registers + 7756 59/pop-to-ecx + 7757 58/pop-to-eax + 7758 # . epilogue + 7759 89/<- %esp 5/r32/ebp + 7760 5d/pop-to-ebp + 7761 c3/return + 7762 + 7763 $new-literal-integer:abort: + 7764 (write-buffered *(ebp+0x14) "variable cannot begin with a digit '") + 7765 (write-slice-buffered *(ebp+0x14) *(ebp+0xc)) + 7766 (write-buffered *(ebp+0x14) "'\n") + 7767 (flush *(ebp+0x14)) + 7768 (stop *(ebp+0x18) 1) + 7769 # never gets here + 7770 + 7771 new-literal: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) + 7772 # . prologue + 7773 55/push-ebp + 7774 89/<- %ebp 4/r32/esp + 7775 # . save registers + 7776 50/push-eax + 7777 51/push-ecx + 7778 # var s/ecx: (handle array byte) + 7779 68/push 0/imm32 + 7780 68/push 0/imm32 + 7781 89/<- %ecx 4/r32/esp + 7782 # s = slice-to-string(name) + 7783 (slice-to-string Heap *(ebp+0xc) %ecx) + 7784 # allocate to out + 7785 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) + 7786 # var out-addr/ecx: (addr var) = lookup(*out) + 7787 8b/-> *(ebp+0x10) 1/r32/ecx + 7788 (lookup *ecx *(ecx+4)) # => eax + 7789 89/<- %ecx 0/r32/eax + 7790 # out-addr->type/eax = new type + 7791 8d/copy-address *(ecx+8) 0/r32/eax # Var-type + 7792 (allocate *(ebp+8) *Tree-size %eax) + 7793 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 7794 # nothing else to do; default type is 'literal' + 7795 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom + 7796 $new-literal:end: + 7797 # . reclaim locals + 7798 81 0/subop/add %esp 8/imm32 + 7799 # . restore registers + 7800 59/pop-to-ecx + 7801 58/pop-to-eax + 7802 # . epilogue + 7803 89/<- %esp 5/r32/ebp + 7804 5d/pop-to-ebp + 7805 c3/return + 7806 + 7807 new-var-from-slice: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) + 7808 # . prologue + 7809 55/push-ebp + 7810 89/<- %ebp 4/r32/esp + 7811 # . save registers + 7812 51/push-ecx + 7813 # var tmp/ecx: (handle array byte) + 7814 68/push 0/imm32 + 7815 68/push 0/imm32 + 7816 89/<- %ecx 4/r32/esp + 7817 # tmp = slice-to-string(name) + 7818 (slice-to-string Heap *(ebp+0xc) %ecx) + 7819 # out = new-var(tmp) + 7820 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) + 7821 $new-var-from-slice:end: + 7822 # . reclaim locals + 7823 81 0/subop/add %esp 8/imm32 + 7824 # . restore registers + 7825 59/pop-to-ecx + 7826 # . epilogue + 7827 89/<- %esp 5/r32/ebp + 7828 5d/pop-to-ebp + 7829 c3/return + 7830 + 7831 new-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) + 7832 # . prologue + 7833 55/push-ebp + 7834 89/<- %ebp 4/r32/esp + 7835 # . save registers + 7836 50/push-eax + 7837 51/push-ecx + 7838 # + 7839 (allocate *(ebp+8) *Stmt-size *(ebp+0x14)) + 7840 # var out-addr/eax: (addr stmt) = lookup(*out) + 7841 8b/-> *(ebp+0x14) 0/r32/eax + 7842 (lookup *eax *(eax+4)) # => eax + 7843 # out-addr->tag = stmt + 7844 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack # Stmt-tag + 7845 # result->var = var + 7846 8b/-> *(ebp+0xc) 1/r32/ecx + 7847 89/<- *(eax+4) 1/r32/ecx # Vardef-var + 7848 8b/-> *(ebp+0x10) 1/r32/ecx + 7849 89/<- *(eax+8) 1/r32/ecx # Vardef-var + 7850 $new-var-def:end: + 7851 # . restore registers + 7852 59/pop-to-ecx + 7853 58/pop-to-eax + 7854 # . epilogue + 7855 89/<- %esp 5/r32/ebp + 7856 5d/pop-to-ebp + 7857 c3/return + 7858 + 7859 new-reg-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) + 7860 # . prologue + 7861 55/push-ebp + 7862 89/<- %ebp 4/r32/esp + 7863 # . save registers + 7864 50/push-eax + 7865 # eax = out + 7866 8b/-> *(ebp+0x14) 0/r32/eax + 7867 # + 7868 (allocate *(ebp+8) *Stmt-size %eax) + 7869 # var out-addr/eax: (addr stmt) = lookup(*out) + 7870 (lookup *eax *(eax+4)) # => eax + 7871 # set tag + 7872 c7 0/subop/copy *eax 3/imm32/tag/var-in-register # Stmt-tag + 7873 # set output + 7874 8d/copy-address *(eax+0x14) 0/r32/eax # Regvardef-outputs + 7875 (append-stmt-var Heap *(ebp+0xc) *(ebp+0x10) 0 0 0 %eax) + 7876 $new-reg-var-def:end: + 7877 # . restore registers + 7878 58/pop-to-eax + 7879 # . epilogue + 7880 89/<- %esp 5/r32/ebp + 7881 5d/pop-to-ebp + 7882 c3/return + 7883 + 7884 append-list: # ad: (addr allocation-descriptor), value: (handle _type), list: (handle list _type), out: (addr handle list _type) + 7885 # . prologue + 7886 55/push-ebp + 7887 89/<- %ebp 4/r32/esp + 7888 # . save registers + 7889 50/push-eax + 7890 51/push-ecx + 7891 57/push-edi + 7892 # edi = out + 7893 8b/-> *(ebp+0x1c) 7/r32/edi + 7894 # *out = new list + 7895 (allocate *(ebp+8) *List-size %edi) + 7896 # var out-addr/edi: (addr list _type) = lookup(*out) + 7897 (lookup *edi *(edi+4)) # => eax + 7898 89/<- %edi 0/r32/eax + 7899 # out-addr->value = value + 7900 8b/-> *(ebp+0xc) 0/r32/eax + 7901 89/<- *edi 0/r32/eax # List-value + 7902 8b/-> *(ebp+0x10) 0/r32/eax + 7903 89/<- *(edi+4) 0/r32/eax # List-value + 7904 # if (list == null) return + 7905 81 7/subop/compare *(ebp+0x14) 0/imm32 + 7906 74/jump-if-= $append-list:end/disp8 + 7907 # otherwise append + 7908 $append-list:non-empty-list: + 7909 # var curr/eax: (addr list _type) = lookup(list) + 7910 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax + 7911 # while (curr->next != null) curr = curr->next + 7912 { + 7913 81 7/subop/compare *(eax+8) 0/imm32 # List-next + 7914 74/jump-if-= break/disp8 + 7915 # curr = lookup(curr->next) + 7916 (lookup *(eax+8) *(eax+0xc)) # List-next, List-next => eax + 7917 # + 7918 eb/jump loop/disp8 + 7919 } + 7920 # edi = out + 7921 8b/-> *(ebp+0x1c) 7/r32/edi + 7922 # curr->next = out + 7923 8b/-> *edi 1/r32/ecx + 7924 89/<- *(eax+8) 1/r32/ecx # List-next + 7925 8b/-> *(edi+4) 1/r32/ecx + 7926 89/<- *(eax+0xc) 1/r32/ecx # List-next + 7927 # out = list + 7928 8b/-> *(ebp+0x14) 1/r32/ecx + 7929 89/<- *edi 1/r32/ecx + 7930 8b/-> *(ebp+0x18) 1/r32/ecx + 7931 89/<- *(edi+4) 1/r32/ecx + 7932 $append-list:end: + 7933 # . restore registers + 7934 5f/pop-to-edi + 7935 59/pop-to-ecx + 7936 58/pop-to-eax + 7937 # . epilogue + 7938 89/<- %esp 5/r32/ebp + 7939 5d/pop-to-ebp + 7940 c3/return + 7941 + 7942 append-stmt-var: # ad: (addr allocation-descriptor), v: (handle var), vars: (handle stmt-var), is-deref?: boolean, out: (addr handle stmt-var) + 7943 # . prologue + 7944 55/push-ebp + 7945 89/<- %ebp 4/r32/esp + 7946 # . save registers + 7947 50/push-eax + 7948 51/push-ecx + 7949 57/push-edi + 7950 # edi = out + 7951 8b/-> *(ebp+0x20) 7/r32/edi + 7952 # out = new stmt-var + 7953 (allocate *(ebp+8) *Stmt-var-size %edi) + 7954 # var out-addr/ecx: (addr stmt-var) = lookup(*out) + 7955 (lookup *edi *(edi+4)) # => eax + 7956 89/<- %ecx 0/r32/eax + 7957 # out-addr->value = v + 7958 8b/-> *(ebp+0xc) 0/r32/eax + 7959 89/<- *ecx 0/r32/eax # Stmt-var-value + 7960 8b/-> *(ebp+0x10) 0/r32/eax + 7961 89/<- *(ecx+4) 0/r32/eax # Stmt-var-value + 7962 # out-addr->is-deref? = is-deref? + 7963 8b/-> *(ebp+0x1c) 0/r32/eax + 7964 89/<- *(ecx+0x10) 0/r32/eax # Stmt-var-is-deref + 7965 # if (vars == null) return result + 7966 81 7/subop/compare *(ebp+0x14) 0/imm32/null + 7967 74/jump-if-= $append-stmt-var:end/disp8 + 7968 # otherwise append + 7969 # var curr/eax: (addr stmt-var) = lookup(vars) + 7970 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax + 7971 # while (curr->next != null) curr = curr->next + 7972 { + 7973 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next + 7974 74/jump-if-= break/disp8 + 7975 # curr = lookup(curr->next) + 7976 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next, Stmt-var-next => eax + 7977 # + 7978 eb/jump loop/disp8 + 7979 } + 7980 # curr->next = out + 7981 8b/-> *edi 1/r32/ecx + 7982 89/<- *(eax+8) 1/r32/ecx # Stmt-var-next + 7983 8b/-> *(edi+4) 1/r32/ecx + 7984 89/<- *(eax+0xc) 1/r32/ecx # Stmt-var-next + 7985 # out = vars + 7986 8b/-> *(ebp+0x14) 1/r32/ecx + 7987 89/<- *edi 1/r32/ecx + 7988 8b/-> *(ebp+0x18) 1/r32/ecx + 7989 89/<- *(edi+4) 1/r32/ecx + 7990 $append-stmt-var:end: + 7991 # . restore registers + 7992 5f/pop-to-edi + 7993 59/pop-to-ecx + 7994 58/pop-to-eax + 7995 # . epilogue + 7996 89/<- %esp 5/r32/ebp + 7997 5d/pop-to-ebp + 7998 c3/return + 7999 + 8000 append-to-block: # ad: (addr allocation-descriptor), block: (addr block), x: (handle stmt) + 8001 # . prologue + 8002 55/push-ebp + 8003 89/<- %ebp 4/r32/esp + 8004 # . save registers + 8005 50/push-eax + 8006 56/push-esi + 8007 # esi = block + 8008 8b/-> *(ebp+0xc) 6/r32/esi + 8009 # block->stmts = append(x, block->stmts) + 8010 8d/copy-address *(esi+4) 0/r32/eax # Block-stmts + 8011 (append-list *(ebp+8) *(ebp+0x10) *(ebp+0x14) *(esi+4) *(esi+8) %eax) # ad, x, x, Block-stmts, Block-stmts + 8012 $append-to-block:end: + 8013 # . restore registers + 8014 5e/pop-to-esi + 8015 58/pop-to-eax + 8016 # . epilogue + 8017 89/<- %esp 5/r32/ebp + 8018 5d/pop-to-ebp + 8019 c3/return + 8020 + 8021 ## Parsing types + 8022 # We need to create metadata on user-defined types, and we need to use this + 8023 # metadata as we parse instructions. + 8024 # However, we also want to allow types to be used before their definitions. + 8025 # This means we can't ever assume any type data structures exist. + 8026 + 8027 lookup-or-create-constant: # container: (addr stmt-var), field-name: (addr slice), out: (addr handle var) + 8028 # . prologue + 8029 55/push-ebp + 8030 89/<- %ebp 4/r32/esp + 8031 # . save registers + 8032 50/push-eax + 8033 56/push-esi + 8034 # var container-type/esi: type-id + 8035 (container-type *(ebp+8)) # => eax + 8036 89/<- %esi 0/r32/eax + 8037 # var tmp/eax: (handle typeinfo) = find-or-create-typeinfo(container-type) + 8038 68/push 0/imm32 + 8039 68/push 0/imm32 + 8040 89/<- %eax 4/r32/esp + 8041 (find-or-create-typeinfo %esi %eax) + 8042 # var tmp-addr/eax: (addr typeinfo) = lookup(tmp) + 8043 (lookup *eax *(eax+4)) # => eax + 8044 # result = find-or-create-typeinfo-output-var(typeinfo, field-name) + 8045 #? (write-buffered Stderr "constant: ") + 8046 #? (write-slice-buffered Stderr *(ebp+0xc)) + 8047 #? (write-buffered Stderr Newline) + 8048 #? (flush Stderr) + 8049 (find-or-create-typeinfo-output-var %eax *(ebp+0xc) *(ebp+0x10)) + 8050 #? 8b/-> *(ebp+0x10) 0/r32/eax + 8051 #? (write-buffered Stderr "@") + 8052 #? (lookup *eax *(eax+4)) + 8053 #? (print-int32-buffered Stderr %eax) + 8054 #? (lookup *eax *(eax+4)) + 8055 #? (write-buffered Stderr %eax) + 8056 #? (write-buffered Stderr Newline) + 8057 #? (flush Stderr) + 8058 #? (write-buffered Stderr "offset: ") + 8059 #? 8b/-> *(eax+0x14) 0/r32/eax + 8060 #? (print-int32-buffered Stderr %eax) + 8061 #? (write-buffered Stderr Newline) + 8062 #? (flush Stderr) + 8063 $lookup-or-create-constant:end: + 8064 # . reclaim locals + 8065 81 0/subop/add %esp 8/imm32 + 8066 # . restore registers + 8067 5e/pop-to-esi + 8068 58/pop-to-eax + 8069 # . epilogue + 8070 89/<- %esp 5/r32/ebp + 8071 5d/pop-to-ebp + 8072 c3/return + 8073 + 8074 # if addr var: + 8075 # container->var->type->right->left->value + 8076 # otherwise + 8077 # container->var->type->value + 8078 container-type: # container: (addr stmt-var) -> result/eax: type-id + 8079 # . prologue + 8080 55/push-ebp + 8081 89/<- %ebp 4/r32/esp + 8082 # + 8083 8b/-> *(ebp+8) 0/r32/eax + 8084 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax + 8085 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax + 8086 { + 8087 81 7/subop/compare *(eax+8) 0/imm32 # Tree-right + 8088 74/jump-if-= break/disp8 + 8089 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax + 8090 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax + 8091 } + 8092 8b/-> *(eax+4) 0/r32/eax # Tree-value + 8093 $container-type:end: + 8094 # . epilogue + 8095 89/<- %esp 5/r32/ebp + 8096 5d/pop-to-ebp + 8097 c3/return + 8098 + 8099 find-or-create-typeinfo: # t: type-id, out: (addr handle typeinfo) + 8100 # . prologue + 8101 55/push-ebp + 8102 89/<- %ebp 4/r32/esp + 8103 # . save registers + 8104 50/push-eax + 8105 51/push-ecx + 8106 52/push-edx + 8107 57/push-edi + 8108 # edi = out + 8109 8b/-> *(ebp+0xc) 7/r32/edi + 8110 # var fields/ecx: (handle table (handle array byte) (handle typeinfo-entry)) + 8111 68/push 0/imm32 + 8112 68/push 0/imm32 + 8113 89/<- %ecx 4/r32/esp + 8114 # find-typeinfo(t, out) + 8115 (find-typeinfo *(ebp+8) %edi) + 8116 { + 8117 # if (*out != 0) break + 8118 81 7/subop/compare *edi 0/imm32 + 8119 0f 85/jump-if-!= break/disp32 + 8120 $find-or-create-typeinfo:create: + 8121 # *out = allocate + 8122 (allocate Heap *Typeinfo-size %edi) + 8123 # var tmp/eax: (addr typeinfo) = lookup(*out) + 8124 (lookup *edi *(edi+4)) # => eax + 8125 #? (write-buffered Stderr "created typeinfo at ") + 8126 #? (print-int32-buffered Stderr %eax) + 8127 #? (write-buffered Stderr " for type-id ") + 8128 #? (print-int32-buffered Stderr *(ebp+8)) + 8129 #? (write-buffered Stderr Newline) + 8130 #? (flush Stderr) + 8131 # tmp->id = t + 8132 8b/-> *(ebp+8) 2/r32/edx + 8133 89/<- *eax 2/r32/edx # Typeinfo-id + 8134 # tmp->fields = new table + 8135 # . fields = new table + 8136 (new-stream Heap 0x40 *Typeinfo-fields-row-size %ecx) + 8137 # . tmp->fields = fields + 8138 8b/-> *ecx 2/r32/edx + 8139 89/<- *(eax+4) 2/r32/edx # Typeinfo-fields + 8140 8b/-> *(ecx+4) 2/r32/edx + 8141 89/<- *(eax+8) 2/r32/edx # Typeinfo-fields + 8142 # tmp->next = Program->types + 8143 8b/-> *_Program-types 1/r32/ecx + 8144 89/<- *(eax+0x10) 1/r32/ecx # Typeinfo-next + 8145 8b/-> *_Program-types->payload 1/r32/ecx + 8146 89/<- *(eax+0x14) 1/r32/ecx # Typeinfo-next + 8147 # Program->types = out + 8148 8b/-> *edi 1/r32/ecx + 8149 89/<- *_Program-types 1/r32/ecx + 8150 8b/-> *(edi+4) 1/r32/ecx + 8151 89/<- *_Program-types->payload 1/r32/ecx + 8152 } + 8153 $find-or-create-typeinfo:end: + 8154 # . reclaim locals + 8155 81 0/subop/add %esp 8/imm32 + 8156 # . restore registers + 8157 5f/pop-to-edi + 8158 5a/pop-to-edx + 8159 59/pop-to-ecx + 8160 58/pop-to-eax + 8161 # . epilogue + 8162 89/<- %esp 5/r32/ebp + 8163 5d/pop-to-ebp + 8164 c3/return + 8165 + 8166 find-typeinfo: # t: type-id, out: (addr handle typeinfo) + 8167 # . prologue + 8168 55/push-ebp + 8169 89/<- %ebp 4/r32/esp + 8170 # . save registers + 8171 50/push-eax + 8172 51/push-ecx + 8173 52/push-edx + 8174 57/push-edi + 8175 # ecx = t + 8176 8b/-> *(ebp+8) 1/r32/ecx + 8177 # edi = out + 8178 8b/-> *(ebp+0xc) 7/r32/edi + 8179 # *out = Program->types + 8180 8b/-> *_Program-types 0/r32/eax + 8181 89/<- *edi 0/r32/eax + 8182 8b/-> *_Program-types->payload 0/r32/eax + 8183 89/<- *(edi+4) 0/r32/eax + 8184 { + 8185 # if (*out == 0) break + 8186 81 7/subop/compare *edi 0/imm32 + 8187 74/jump-if-= break/disp8 + 8188 # var tmp/eax: (addr typeinfo) = lookup(*out) + 8189 (lookup *edi *(edi+4)) # => eax + 8190 # if (tmp->id == t) break + 8191 39/compare *eax 1/r32/ecx # Typeinfo-id + 8192 74/jump-if-= break/disp8 + 8193 # *out = tmp->next + 8194 8b/-> *(eax+0x10) 2/r32/edx # Typeinfo-next + 8195 89/<- *edi 2/r32/edx + 8196 8b/-> *(eax+0x14) 2/r32/edx # Typeinfo-next + 8197 89/<- *(edi+4) 2/r32/edx + 8198 # + 8199 eb/jump loop/disp8 + 8200 } + 8201 $find-typeinfo:end: 8202 # . restore registers - 8203 5e/pop-to-esi - 8204 # . epilogue - 8205 89/<- %esp 5/r32/ebp - 8206 5d/pop-to-ebp - 8207 c3/return - 8208 - 8209 ####################################################### - 8210 # Compute type sizes - 8211 ####################################################### - 8212 - 8213 # Compute the sizes of all user-defined types. - 8214 # We'll need the sizes of their elements, which may be other user-defined - 8215 # types, which we will compute as needed. - 8216 - 8217 # Initially, all user-defined types have their sizes set to -2 (invalid) - 8218 populate-mu-type-sizes: # err: (addr buffered-file), ed: (addr exit-descriptor) - 8219 # . prologue - 8220 55/push-ebp - 8221 89/<- %ebp 4/r32/esp - 8222 $populate-mu-type-sizes:total-sizes: - 8223 # var curr/eax: (addr typeinfo) = lookup(Program->types) - 8224 (lookup *_Program-types *_Program-types->payload) # => eax - 8225 { - 8226 # if (curr == null) break - 8227 3d/compare-eax-and 0/imm32/null - 8228 74/jump-if-= break/disp8 - 8229 (populate-mu-type-sizes-in-type %eax *(ebp+8) *(ebp+0xc)) - 8230 # curr = lookup(curr->next) - 8231 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax - 8232 eb/jump loop/disp8 - 8233 } - 8234 $populate-mu-type-sizes:offsets: - 8235 # curr = *Program->types - 8236 (lookup *_Program-types *_Program-types->payload) # => eax - 8237 { - 8238 # if (curr == null) break - 8239 3d/compare-eax-and 0/imm32/null - 8240 74/jump-if-= break/disp8 - 8241 (populate-mu-type-offsets %eax *(ebp+8) *(ebp+0xc)) - 8242 # curr = curr->next - 8243 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax - 8244 eb/jump loop/disp8 - 8245 } - 8246 $populate-mu-type-sizes:end: - 8247 # . epilogue - 8248 89/<- %esp 5/r32/ebp - 8249 5d/pop-to-ebp - 8250 c3/return - 8251 - 8252 # compute sizes of all fields, recursing as necessary - 8253 # sum up all their sizes to arrive at total size - 8254 # fields may be out of order, but that doesn't affect the answer - 8255 populate-mu-type-sizes-in-type: # T: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) - 8256 # . prologue - 8257 55/push-ebp - 8258 89/<- %ebp 4/r32/esp - 8259 # . save registers - 8260 50/push-eax - 8261 51/push-ecx - 8262 52/push-edx - 8263 56/push-esi - 8264 57/push-edi - 8265 # esi = T - 8266 8b/-> *(ebp+8) 6/r32/esi - 8267 # if T is already computed, return - 8268 81 7/subop/compare *(esi+0xc) 0/imm32 # Typeinfo-total-size-in-bytes - 8269 0f 8d/jump-if->= $populate-mu-type-sizes-in-type:end/disp32 - 8270 # if T is being computed, abort - 8271 81 7/subop/compare *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes - 8272 0f 84/jump-if-= $populate-mu-type-sizes-in-type:abort/disp32 - 8273 # tag T (-2 to -1) to avoid infinite recursion - 8274 c7 0/subop/copy *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes - 8275 # var total-size/edi: int = 0 - 8276 bf/copy-to-edi 0/imm32 - 8277 # - for every field, if it's a user-defined type, compute its size - 8278 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) - 8279 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax - 8280 89/<- %ecx 0/r32/eax - 8281 # var table-size/edx: int = table->write - 8282 8b/-> *ecx 2/r32/edx # stream-write - 8283 # var curr/ecx: (addr table_row) = table->data - 8284 8d/copy-address *(ecx+0xc) 1/r32/ecx - 8285 # var max/edx: (addr table_row) = table->data + table->write - 8286 8d/copy-address *(ecx+edx) 2/r32/edx - 8287 { - 8288 $populate-mu-type-sizes-in-type:loop: - 8289 # if (curr >= max) break - 8290 39/compare %ecx 2/r32/edx - 8291 73/jump-if-addr>= break/disp8 - 8292 # var t/eax: (addr typeinfo-entry) = lookup(curr->value) - 8293 (lookup *(ecx+8) *(ecx+0xc)) # => eax - 8294 # compute size of t->input-var - 8295 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax - 8296 (compute-size-of-var %eax) # => eax - 8297 # result += eax - 8298 01/add-to %edi 0/r32/eax - 8299 # curr += row-size - 8300 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size - 8301 # - 8302 eb/jump loop/disp8 - 8303 } - 8304 # - save result - 8305 89/<- *(esi+0xc) 7/r32/edi # Typeinfo-total-size-in-bytes - 8306 $populate-mu-type-sizes-in-type:end: - 8307 # . restore registers - 8308 5f/pop-to-edi - 8309 5e/pop-to-esi - 8310 5a/pop-to-edx - 8311 59/pop-to-ecx - 8312 58/pop-to-eax - 8313 # . epilogue - 8314 89/<- %esp 5/r32/ebp - 8315 5d/pop-to-ebp - 8316 c3/return - 8317 - 8318 $populate-mu-type-sizes-in-type:abort: - 8319 (write-buffered *(ebp+0xc) "cycle in type definitions\n") - 8320 (flush *(ebp+0xc)) - 8321 (stop *(ebp+0x10) 1) - 8322 # never gets here - 8323 - 8324 # Analogous to size-of, except we need to compute what size-of can just read - 8325 # off the right data structures. - 8326 compute-size-of-var: # in: (addr var) -> result/eax: int - 8327 # . prologue - 8328 55/push-ebp - 8329 89/<- %ebp 4/r32/esp - 8330 # . push registers - 8331 51/push-ecx - 8332 # var t/ecx: (addr tree type-id) = lookup(v->type) - 8333 8b/-> *(ebp+8) 1/r32/ecx - 8334 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 8335 89/<- %ecx 0/r32/eax - 8336 # if (t->is-atom == false) t = lookup(t->left) - 8337 { - 8338 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom - 8339 75/jump-if-!= break/disp8 - 8340 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax - 8341 89/<- %ecx 0/r32/eax - 8342 } - 8343 # TODO: ensure t is an atom - 8344 (compute-size-of-type-id *(ecx+4)) # Tree-value => eax - 8345 $compute-size-of-var:end: - 8346 # . restore registers - 8347 59/pop-to-ecx - 8348 # . epilogue - 8349 89/<- %esp 5/r32/ebp - 8350 5d/pop-to-ebp - 8351 c3/return - 8352 - 8353 compute-size-of-type-id: # t: type-id -> result/eax: int - 8354 # . prologue - 8355 55/push-ebp - 8356 89/<- %ebp 4/r32/esp - 8357 # . save registers - 8358 51/push-ecx - 8359 # var out/ecx: (handle typeinfo) + 8203 5f/pop-to-edi + 8204 5a/pop-to-edx + 8205 59/pop-to-ecx + 8206 58/pop-to-eax + 8207 # . epilogue + 8208 89/<- %esp 5/r32/ebp + 8209 5d/pop-to-ebp + 8210 c3/return + 8211 + 8212 find-or-create-typeinfo-output-var: # T: (addr typeinfo), f: (addr slice), out: (addr handle var) + 8213 # . prologue + 8214 55/push-ebp + 8215 89/<- %ebp 4/r32/esp + 8216 # . save registers + 8217 50/push-eax + 8218 52/push-edx + 8219 57/push-edi + 8220 # var dest/edi: (handle typeinfo-entry) + 8221 68/push 0/imm32 + 8222 68/push 0/imm32 + 8223 89/<- %edi 4/r32/esp + 8224 # find-or-create-typeinfo-fields(T, f, dest) + 8225 (find-or-create-typeinfo-fields *(ebp+8) *(ebp+0xc) %edi) + 8226 # var dest-addr/edi: (addr typeinfo-entry) = lookup(dest) + 8227 (lookup *edi *(edi+4)) # => eax + 8228 89/<- %edi 0/r32/eax + 8229 # if dest-addr->output-var doesn't exist, create it + 8230 { + 8231 81 7/subop/compare *(edi+0xc) 0/imm32 # Typeinfo-entry-output-var + 8232 0f 85/jump-if-!= break/disp32 + 8233 # dest-addr->output-var = new var(dummy name, type, -1 offset) + 8234 # . var name/eax: (handle array byte) = "field" + 8235 68/push 0/imm32 + 8236 68/push 0/imm32 + 8237 89/<- %eax 4/r32/esp + 8238 (copy-array Heap "field" %eax) + 8239 # . new var + 8240 8d/copy-address *(edi+0xc) 2/r32/edx + 8241 (new-var Heap *eax *(eax+4) %edx) + 8242 # . reclaim name + 8243 81 0/subop/add %esp 8/imm32 + 8244 # var result/edx: (addr var) = lookup(dest-addr->output-var) + 8245 (lookup *(edi+0xc) *(edi+0x10)) # => eax + 8246 89/<- %edx 0/r32/eax + 8247 # result->type = new constant type + 8248 8d/copy-address *(edx+8) 0/r32/eax # Var-type + 8249 (allocate Heap *Tree-size %eax) + 8250 (lookup *(edx+8) *(edx+0xc)) # => eax + 8251 c7 0/subop/copy *eax 1/imm32/true # Tree-is-atom + 8252 c7 0/subop/copy *(eax+4) 6/imm32/constant # Tree-value + 8253 c7 0/subop/copy *(eax+8) 0/imm32 # Tree-left + 8254 c7 0/subop/copy *(eax+0xc) 0/imm32 # Tree-right + 8255 c7 0/subop/copy *(eax+0x10) 0/imm32 # Tree-right + 8256 # result->offset isn't filled out yet + 8257 c7 0/subop/copy *(edx+0x14) -1/imm32/uninitialized # Var-offset + 8258 } + 8259 # out = dest-addr->output-var + 8260 8b/-> *(ebp+0x10) 2/r32/edx + 8261 8b/-> *(edi+0xc) 0/r32/eax # Typeinfo-entry-output-var + 8262 89/<- *edx 0/r32/eax + 8263 8b/-> *(edi+0x10) 0/r32/eax # Typeinfo-entry-output-var + 8264 89/<- *(edx+4) 0/r32/eax + 8265 $find-or-create-typeinfo-output-var:end: + 8266 # . reclaim locals + 8267 81 0/subop/add %esp 8/imm32 + 8268 # . restore registers + 8269 5f/pop-to-edi + 8270 5a/pop-to-edx + 8271 58/pop-to-eax + 8272 # . epilogue + 8273 89/<- %esp 5/r32/ebp + 8274 5d/pop-to-ebp + 8275 c3/return + 8276 + 8277 find-or-create-typeinfo-fields: # T: (addr typeinfo), f: (addr slice), out: (addr handle typeinfo-entry) + 8278 # . prologue + 8279 55/push-ebp + 8280 89/<- %ebp 4/r32/esp + 8281 # . save registers + 8282 50/push-eax + 8283 56/push-esi + 8284 57/push-edi + 8285 # eax = lookup(T->fields) + 8286 8b/-> *(ebp+8) 0/r32/eax + 8287 (lookup *(eax+4) *(eax+8)) # Typeinfo-fields Typeinfo-fields => eax + 8288 # edi = out + 8289 8b/-> *(ebp+0x10) 7/r32/edi + 8290 # var src/esi: (addr handle typeinfo-entry) = get-or-insert-slice(T->fields, f) + 8291 (get-or-insert-slice %eax *(ebp+0xc) *Typeinfo-fields-row-size Heap) # => eax + 8292 89/<- %esi 0/r32/eax + 8293 # if src doesn't exist, allocate it + 8294 { + 8295 81 7/subop/compare *esi 0/imm32 + 8296 75/jump-if-!= break/disp8 + 8297 (allocate Heap *Typeinfo-entry-size %esi) + 8298 #? (write-buffered Stderr "handle at ") + 8299 #? (print-int32-buffered Stderr %esi) + 8300 #? (write-buffered Stderr ": ") + 8301 #? (print-int32-buffered Stderr *esi) + 8302 #? (write-buffered Stderr " ") + 8303 #? (print-int32-buffered Stderr *(esi+4)) + 8304 #? (write-buffered Stderr Newline) + 8305 #? (flush Stderr) + 8306 #? (lookup *esi *(esi+4)) + 8307 #? (write-buffered Stderr "created typeinfo fields at ") + 8308 #? (print-int32-buffered Stderr %esi) + 8309 #? (write-buffered Stderr " for ") + 8310 #? (print-int32-buffered Stderr *(ebp+8)) + 8311 #? (write-buffered Stderr Newline) + 8312 #? (flush Stderr) + 8313 } + 8314 # *out = src + 8315 # . *edi = *src + 8316 8b/-> *esi 0/r32/eax + 8317 89/<- *edi 0/r32/eax + 8318 8b/-> *(esi+4) 0/r32/eax + 8319 89/<- *(edi+4) 0/r32/eax + 8320 $find-or-create-typeinfo-fields:end: + 8321 # . restore registers + 8322 5f/pop-to-edi + 8323 5e/pop-to-esi + 8324 58/pop-to-eax + 8325 # . epilogue + 8326 89/<- %esp 5/r32/ebp + 8327 5d/pop-to-ebp + 8328 c3/return + 8329 + 8330 populate-mu-type: # in: (addr stream byte), t: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) + 8331 # pseudocode: + 8332 # var line: (stream byte 512) + 8333 # curr-index = 0 + 8334 # while true + 8335 # clear-stream(line) + 8336 # read-line-buffered(in, line) + 8337 # if line->write == 0 + 8338 # abort + 8339 # word-slice = next-mu-token(line) + 8340 # if slice-empty?(word-slice) # end of line + 8341 # continue + 8342 # if slice-equal?(word-slice, "}") + 8343 # break + 8344 # var v: (handle var) = parse-var-with-type(word-slice, line) + 8345 # var r: (handle typeinfo-fields) = find-or-create-typeinfo-fields(t, word-slice/v->name) + 8346 # TODO: ensure that r->first is null + 8347 # r->index = curr-index + 8348 # curr-index++ + 8349 # r->input-var = v + 8350 # if r->output-var == 0 + 8351 # r->output-var = new literal + 8352 # TODO: ensure nothing else in line + 8353 # t->total-size-in-bytes = -2 (not yet initialized) + 8354 # check-input-vars(t, err, ed) + 8355 # + 8356 # . prologue + 8357 55/push-ebp + 8358 89/<- %ebp 4/r32/esp + 8359 # var curr-index: int at *(ebp-4) 8360 68/push 0/imm32 - 8361 68/push 0/imm32 - 8362 89/<- %ecx 4/r32/esp - 8363 # eax = t - 8364 8b/-> *(ebp+8) 0/r32/eax - 8365 # if t is a literal, return 0 - 8366 3d/compare-eax-and 0/imm32/literal - 8367 0f 84/jump-if-= $compute-size-of-type-id:end/disp32 # eax changes type from type-id to int - 8368 # if t is a byte, return 4 (because we don't really support non-multiples of 4) - 8369 3d/compare-eax-and 8/imm32/byte - 8370 { - 8371 75/jump-if-!= break/disp8 - 8372 b8/copy-to-eax 4/imm32 - 8373 eb/jump $compute-size-of-type-id:end/disp8 - 8374 } - 8375 # if t is a handle, return 8 - 8376 3d/compare-eax-and 4/imm32/handle - 8377 { - 8378 75/jump-if-!= break/disp8 - 8379 b8/copy-to-eax 8/imm32 - 8380 eb/jump $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int - 8381 } - 8382 # if t is a user-defined type, compute its size - 8383 # TODO: support non-atom type - 8384 (find-typeinfo %eax %ecx) - 8385 { - 8386 81 7/subop/compare *ecx 0/imm32 - 8387 74/jump-if-= break/disp8 - 8388 $compute-size-of-type-id:user-defined: - 8389 (populate-mu-type-sizes %eax) - 8390 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes - 8391 eb/jump $compute-size-of-type-id:end/disp8 - 8392 } - 8393 # otherwise return the word size - 8394 b8/copy-to-eax 4/imm32 - 8395 $compute-size-of-type-id:end: - 8396 # . reclaim locals - 8397 81 0/subop/add %esp 8/imm32 - 8398 # . restore registers - 8399 59/pop-to-ecx - 8400 # . epilogue - 8401 89/<- %esp 5/r32/ebp - 8402 5d/pop-to-ebp - 8403 c3/return - 8404 - 8405 # at this point we have total sizes for all user-defined types - 8406 # compute offsets for each element - 8407 # complication: fields may be out of order - 8408 populate-mu-type-offsets: # in: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) - 8409 # . prologue - 8410 55/push-ebp - 8411 89/<- %ebp 4/r32/esp - 8412 # . save registers - 8413 50/push-eax - 8414 51/push-ecx - 8415 52/push-edx - 8416 53/push-ebx - 8417 56/push-esi - 8418 57/push-edi - 8419 #? (dump-typeinfos "aaa\n") - 8420 # var curr-offset/edi: int = 0 - 8421 bf/copy-to-edi 0/imm32 - 8422 # var table/ecx: (addr table string_key (handle typeinfo-entry)) = lookup(in->fields) - 8423 8b/-> *(ebp+8) 1/r32/ecx - 8424 (lookup *(ecx+4) *(ecx+8)) # Typeinfo-fields Typeinfo-fields => eax - 8425 89/<- %ecx 0/r32/eax - 8426 # var num-elems/edx: int = table->write / Typeinfo-fields-row-size - 8427 8b/-> *ecx 2/r32/edx # stream-write - 8428 c1 5/subop/shift-right-logical %edx 4/imm8 - 8429 # var i/ebx: int = 0 - 8430 bb/copy-to-ebx 0/imm32 - 8431 { - 8432 $populate-mu-type-offsets:loop: - 8433 39/compare %ebx 2/r32/edx - 8434 7d/jump-if->= break/disp8 - 8435 #? (write-buffered Stderr "looking up index ") - 8436 #? (print-int32-buffered Stderr %ebx) - 8437 #? (write-buffered Stderr " in ") - 8438 #? (print-int32-buffered Stderr *(ebp+8)) - 8439 #? (write-buffered Stderr Newline) - 8440 #? (flush Stderr) - 8441 # var v/esi: (addr typeinfo-entry) - 8442 (locate-typeinfo-entry-with-index %ecx %ebx *(ebp+0xc) *(ebp+0x10)) # => eax - 8443 89/<- %esi 0/r32/eax - 8444 # v->output-var->offset = curr-offset - 8445 # . eax: (addr var) - 8446 (lookup *(esi+0xc) *(esi+0x10)) # Typeinfo-entry-output-var Typeinfo-entry-output-var => eax - 8447 89/<- *(eax+0x14) 7/r32/edi # Var-offset - 8448 # curr-offset += size-of(v->input-var) - 8449 (lookup *esi *(esi+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax - 8450 (size-of %eax) # => eax - 8451 01/add-to %edi 0/r32/eax - 8452 # ++i - 8453 43/increment-ebx - 8454 eb/jump loop/disp8 - 8455 } - 8456 $populate-mu-type-offsets:end: - 8457 # . restore registers - 8458 5f/pop-to-edi - 8459 5e/pop-to-esi - 8460 5b/pop-to-ebx - 8461 5a/pop-to-edx - 8462 59/pop-to-ecx - 8463 58/pop-to-eax - 8464 # . epilogue - 8465 89/<- %esp 5/r32/ebp - 8466 5d/pop-to-ebp - 8467 c3/return - 8468 - 8469 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) - 8470 # . prologue - 8471 55/push-ebp - 8472 89/<- %ebp 4/r32/esp - 8473 # . save registers - 8474 51/push-ecx - 8475 52/push-edx - 8476 53/push-ebx - 8477 56/push-esi - 8478 57/push-edi - 8479 # esi = table - 8480 8b/-> *(ebp+8) 6/r32/esi - 8481 # var curr/ecx: (addr row (handle array byte) (handle typeinfo-entry)) = table->data - 8482 8d/copy-address *(esi+0xc) 1/r32/ecx - 8483 # var max/edx: (addr byte) = &table->data[table->write] - 8484 8b/-> *esi 2/r32/edx - 8485 8d/copy-address *(ecx+edx) 2/r32/edx - 8486 { - 8487 $locate-typeinfo-entry-with-index:loop: - 8488 39/compare %ecx 2/r32/edx - 8489 73/jump-if-addr>= $locate-typeinfo-entry-with-index:abort/disp8 - 8490 # var v/eax: (addr typeinfo-entry) - 8491 (lookup *(ecx+8) *(ecx+0xc)) # => eax - 8492 # if (v->index == idx) return v - 8493 8b/-> *(eax+8) 3/r32/ebx # Typeinfo-entry-index - 8494 #? (write-buffered Stderr "comparing ") - 8495 #? (print-int32-buffered Stderr %ebx) - 8496 #? (write-buffered Stderr " and ") - 8497 #? (print-int32-buffered Stderr *(ebp+0xc)) - 8498 #? (write-buffered Stderr Newline) - 8499 #? (flush Stderr) - 8500 39/compare *(ebp+0xc) 3/r32/ebx - 8501 74/jump-if-= $locate-typeinfo-entry-with-index:end/disp8 - 8502 # curr += Typeinfo-entry-size - 8503 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-entry-size - 8504 # - 8505 eb/jump loop/disp8 - 8506 } - 8507 # return 0 - 8508 b8/copy-to-eax 0/imm32 - 8509 $locate-typeinfo-entry-with-index:end: - 8510 #? (write-buffered Stderr "returning ") - 8511 #? (print-int32-buffered Stderr %eax) - 8512 #? (write-buffered Stderr Newline) - 8513 #? (flush Stderr) - 8514 # . restore registers - 8515 5f/pop-to-edi - 8516 5e/pop-to-esi - 8517 5b/pop-to-ebx - 8518 5a/pop-to-edx - 8519 59/pop-to-ecx - 8520 # . epilogue - 8521 89/<- %esp 5/r32/ebp - 8522 5d/pop-to-ebp - 8523 c3/return - 8524 - 8525 $locate-typeinfo-entry-with-index:abort: - 8526 (write-buffered *(ebp+0x10) "overflowing typeinfo-entry->index ") - 8527 (print-int32-buffered *(ebp+0x10) %ecx) - 8528 (write-buffered *(ebp+0x10) "\n") - 8529 (flush *(ebp+0x10)) - 8530 (stop *(ebp+0x14) 1) - 8531 # never gets here - 8532 - 8533 dump-typeinfos: # hdr: (addr array byte) - 8534 # . prologue - 8535 55/push-ebp - 8536 89/<- %ebp 4/r32/esp - 8537 # . save registers - 8538 50/push-eax - 8539 # - 8540 (write-buffered Stderr *(ebp+8)) - 8541 (flush Stderr) - 8542 # var curr/eax: (addr typeinfo) = lookup(Program->types) - 8543 (lookup *_Program-types *_Program-types->payload) # => eax - 8544 { - 8545 # if (curr == null) break - 8546 3d/compare-eax-and 0/imm32 - 8547 74/jump-if-= break/disp8 - 8548 (write-buffered Stderr "---\n") - 8549 (flush Stderr) - 8550 (dump-typeinfo %eax) - 8551 # curr = lookup(curr->next) - 8552 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax - 8553 eb/jump loop/disp8 - 8554 } - 8555 $dump-typeinfos:end: - 8556 # . restore registers - 8557 58/pop-to-eax - 8558 # . epilogue - 8559 89/<- %esp 5/r32/ebp - 8560 5d/pop-to-ebp - 8561 c3/return - 8562 - 8563 dump-typeinfo: # in: (addr typeinfo) - 8564 # . prologue - 8565 55/push-ebp - 8566 89/<- %ebp 4/r32/esp - 8567 # . save registers - 8568 50/push-eax - 8569 51/push-ecx - 8570 52/push-edx - 8571 53/push-ebx - 8572 56/push-esi - 8573 57/push-edi - 8574 # esi = in - 8575 8b/-> *(ebp+8) 6/r32/esi - 8576 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) - 8577 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax - 8578 89/<- %ecx 0/r32/eax - 8579 (write-buffered Stderr "id:") - 8580 (print-int32-buffered Stderr *esi) - 8581 (write-buffered Stderr "\n") - 8582 (write-buffered Stderr "fields @ ") - 8583 (print-int32-buffered Stderr %ecx) - 8584 (write-buffered Stderr Newline) - 8585 (flush Stderr) - 8586 (write-buffered Stderr " write: ") - 8587 (print-int32-buffered Stderr *ecx) - 8588 (write-buffered Stderr Newline) - 8589 (flush Stderr) - 8590 (write-buffered Stderr " read: ") - 8591 (print-int32-buffered Stderr *(ecx+4)) - 8592 (write-buffered Stderr Newline) - 8593 (flush Stderr) - 8594 (write-buffered Stderr " size: ") - 8595 (print-int32-buffered Stderr *(ecx+8)) - 8596 (write-buffered Stderr Newline) - 8597 (flush Stderr) - 8598 # var table-size/edx: int = table->write - 8599 8b/-> *ecx 2/r32/edx # stream-write - 8600 # var curr/ecx: (addr table_row) = table->data - 8601 8d/copy-address *(ecx+0xc) 1/r32/ecx - 8602 # var max/edx: (addr table_row) = table->data + table->write - 8603 8d/copy-address *(ecx+edx) 2/r32/edx - 8604 { - 8605 $dump-typeinfo:loop: - 8606 # if (curr >= max) break - 8607 39/compare %ecx 2/r32/edx - 8608 0f 83/jump-if-addr>= break/disp32 - 8609 (write-buffered Stderr " row:\n") - 8610 (write-buffered Stderr " key: ") - 8611 (print-int32-buffered Stderr *ecx) - 8612 (write-buffered Stderr ",") - 8613 (print-int32-buffered Stderr *(ecx+4)) - 8614 (write-buffered Stderr " = '") - 8615 (lookup *ecx *(ecx+4)) - 8616 (write-buffered Stderr %eax) - 8617 (write-buffered Stderr "' @ ") - 8618 (print-int32-buffered Stderr %eax) - 8619 (write-buffered Stderr Newline) - 8620 (flush Stderr) - 8621 (write-buffered Stderr " value: ") - 8622 (print-int32-buffered Stderr *(ecx+8)) - 8623 (write-buffered Stderr ",") - 8624 (print-int32-buffered Stderr *(ecx+0xc)) - 8625 (write-buffered Stderr " = typeinfo-entry@") - 8626 (lookup *(ecx+8) *(ecx+0xc)) - 8627 (print-int32-buffered Stderr %eax) - 8628 (write-buffered Stderr Newline) - 8629 (flush Stderr) - 8630 (write-buffered Stderr " input var@") - 8631 (print-int32-buffered Stderr *eax) - 8632 (write-buffered Stderr ",") - 8633 (print-int32-buffered Stderr *(eax+4)) - 8634 (write-buffered Stderr "->") - 8635 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var - 8636 (print-int32-buffered Stderr %eax) - 8637 { - 8638 3d/compare-eax-and 0/imm32 - 8639 74/jump-if-= break/disp8 - 8640 (write-buffered Stderr " ") - 8641 # TODO - 8642 } - 8643 (write-buffered Stderr Newline) - 8644 (flush Stderr) - 8645 (lookup *(ecx+8) *(ecx+0xc)) - 8646 (write-buffered Stderr " index: ") - 8647 (print-int32-buffered Stderr *(eax+8)) - 8648 (write-buffered Stderr Newline) - 8649 (flush Stderr) - 8650 (write-buffered Stderr " output var@") - 8651 (print-int32-buffered Stderr *(eax+0xc)) - 8652 (write-buffered Stderr ",") - 8653 (print-int32-buffered Stderr *(eax+0x10)) - 8654 (write-buffered Stderr "->") - 8655 (lookup *(eax+0xc) *(eax+0x10)) # Typeinfo-entry-output-var - 8656 (print-int32-buffered Stderr %eax) - 8657 (write-buffered Stderr Newline) - 8658 (flush Stderr) - 8659 { - 8660 3d/compare-eax-and 0/imm32 - 8661 0f 84/jump-if-= break/disp32 - 8662 (write-buffered Stderr " name: ") - 8663 89/<- %ebx 0/r32/eax - 8664 (print-int32-buffered Stderr *ebx) # Var-name - 8665 (write-buffered Stderr ",") - 8666 (print-int32-buffered Stderr *(ebx+4)) # Var-name - 8667 (write-buffered Stderr "->") - 8668 (lookup *ebx *(ebx+4)) # Var-name - 8669 (print-int32-buffered Stderr %eax) - 8670 { - 8671 3d/compare-eax-and 0/imm32 - 8672 74/jump-if-= break/disp8 - 8673 (write-buffered Stderr Space) - 8674 (write-buffered Stderr %eax) - 8675 } - 8676 (write-buffered Stderr Newline) - 8677 (flush Stderr) - 8678 (write-buffered Stderr " block depth: ") - 8679 (print-int32-buffered Stderr *(ebx+0x10)) # Var-block-depth - 8680 (write-buffered Stderr Newline) - 8681 (flush Stderr) - 8682 (write-buffered Stderr " stack offset: ") - 8683 (print-int32-buffered Stderr *(ebx+0x14)) # Var-offset - 8684 (write-buffered Stderr Newline) - 8685 (flush Stderr) - 8686 (write-buffered Stderr " reg: ") - 8687 (print-int32-buffered Stderr *(ebx+0x18)) # Var-register - 8688 (write-buffered Stderr ",") - 8689 (print-int32-buffered Stderr *(ebx+0x1c)) # Var-register - 8690 (write-buffered Stderr "->") - 8691 (flush Stderr) - 8692 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register - 8693 (print-int32-buffered Stderr %eax) - 8694 { - 8695 3d/compare-eax-and 0/imm32 - 8696 74/jump-if-= break/disp8 - 8697 (write-buffered Stderr Space) - 8698 (write-buffered Stderr %eax) - 8699 } - 8700 (write-buffered Stderr Newline) - 8701 (flush Stderr) - 8702 } - 8703 (flush Stderr) - 8704 # curr += row-size - 8705 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size - 8706 # - 8707 e9/jump loop/disp32 - 8708 } - 8709 $dump-typeinfo:end: - 8710 # . restore registers - 8711 5f/pop-to-edi - 8712 5e/pop-to-esi - 8713 5b/pop-to-ebx - 8714 5a/pop-to-edx - 8715 59/pop-to-ecx - 8716 58/pop-to-eax - 8717 # . epilogue - 8718 89/<- %esp 5/r32/ebp - 8719 5d/pop-to-ebp - 8720 c3/return - 8721 - 8722 ####################################################### - 8723 # Type-checking - 8724 ####################################################### - 8725 - 8726 check-mu-types: - 8727 # . prologue - 8728 55/push-ebp - 8729 89/<- %ebp 4/r32/esp - 8730 # - 8731 $check-mu-types:end: - 8732 # . epilogue - 8733 89/<- %esp 5/r32/ebp - 8734 5d/pop-to-ebp - 8735 c3/return - 8736 - 8737 size-of: # v: (addr var) -> result/eax: int - 8738 # . prologue - 8739 55/push-ebp - 8740 89/<- %ebp 4/r32/esp - 8741 # . save registers - 8742 51/push-ecx - 8743 # var t/ecx: (addr tree type-id) = lookup(v->type) - 8744 8b/-> *(ebp+8) 1/r32/ecx - 8745 #? (write-buffered Stderr "size-of ") - 8746 #? (print-int32-buffered Stderr %ecx) - 8747 #? (write-buffered Stderr Newline) - 8748 #? (write-buffered Stderr "type allocid: ") - 8749 #? (print-int32-buffered Stderr *(ecx+8)) - 8750 #? (write-buffered Stderr Newline) - 8751 #? (flush Stderr) - 8752 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 8753 89/<- %ecx 0/r32/eax - 8754 # if is-mu-array?(t) return size-of-array(t) - 8755 { - 8756 (is-mu-array? %ecx) # => eax - 8757 3d/compare-eax-and 0/imm32/false - 8758 74/jump-if-= break/disp8 - 8759 (size-of-array %ecx) # => eax - 8760 eb/jump $size-of:end/disp8 - 8761 } - 8762 # if (!t->is-atom?) t = lookup(t->left) - 8763 { - 8764 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom - 8765 75/jump-if-!= break/disp8 - 8766 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax - 8767 89/<- %ecx 0/r32/eax - 8768 } - 8769 # TODO: assert t->is-atom? - 8770 (size-of-type-id *(ecx+4)) # Tree-value => eax - 8771 $size-of:end: - 8772 # . restore registers - 8773 59/pop-to-ecx - 8774 # . epilogue - 8775 89/<- %esp 5/r32/ebp - 8776 5d/pop-to-ebp - 8777 c3/return - 8778 - 8779 size-of-deref: # v: (addr var) -> result/eax: int - 8780 # . prologue - 8781 55/push-ebp - 8782 89/<- %ebp 4/r32/esp - 8783 # . save registers - 8784 51/push-ecx - 8785 # var t/ecx: (addr tree type-id) = lookup(v->type) - 8786 8b/-> *(ebp+8) 1/r32/ecx - 8787 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax - 8788 89/<- %ecx 0/r32/eax - 8789 # TODO: assert(t is an addr) - 8790 # t = lookup(t->right) - 8791 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax - 8792 89/<- %ecx 0/r32/eax - 8793 # if is-mu-array?(t) return size-of-array(t) - 8794 { - 8795 (is-mu-array? %ecx) # => eax - 8796 3d/compare-eax-and 0/imm32/false - 8797 74/jump-if-= break/disp8 - 8798 (size-of-array %ecx) # => eax - 8799 eb/jump $size-of:end/disp8 - 8800 } - 8801 # if (!t->is-atom?) t = lookup(t->left) - 8802 { - 8803 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom - 8804 75/jump-if-!= break/disp8 - 8805 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax - 8806 89/<- %ecx 0/r32/eax - 8807 } - 8808 # TODO: assert t->is-atom? - 8809 (size-of-type-id *(ecx+4)) # Tree-value => eax - 8810 $size-of-deref:end: - 8811 # . restore registers - 8812 59/pop-to-ecx - 8813 # . epilogue - 8814 89/<- %esp 5/r32/ebp - 8815 5d/pop-to-ebp - 8816 c3/return - 8817 - 8818 is-mu-array?: # t: (addr tree type-id) -> result/eax: boolean - 8819 # . prologue - 8820 55/push-ebp - 8821 89/<- %ebp 4/r32/esp - 8822 # . save registers - 8823 51/push-ecx - 8824 # ecx = t - 8825 8b/-> *(ebp+8) 1/r32/ecx - 8826 # if t->is-atom?, return false - 8827 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom - 8828 75/jump-if-!= $is-mu-array?:return-false/disp8 - 8829 # if !t->left->is-atom?, return false - 8830 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax - 8831 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom - 8832 74/jump-if-= $is-mu-array?:return-false/disp8 - 8833 # return t->left->value == array - 8834 81 7/subop/compare *(eax+4) 3/imm32/array-type-id # Tree-value - 8835 0f 94/set-if-= %al - 8836 81 4/subop/and %eax 0xff/imm32 - 8837 eb/jump $is-mu-array?:end/disp8 - 8838 $is-mu-array?:return-false: - 8839 b8/copy-to-eax 0/imm32/false - 8840 $is-mu-array?:end: - 8841 # . restore registers - 8842 59/pop-to-ecx - 8843 # . epilogue - 8844 89/<- %esp 5/r32/ebp - 8845 5d/pop-to-ebp - 8846 c3/return - 8847 - 8848 size-of-array: # a: (addr tree type-id) -> result/eax: int - 8849 # . prologue - 8850 55/push-ebp - 8851 89/<- %ebp 4/r32/esp - 8852 # . save registers - 8853 51/push-ecx - 8854 52/push-edx - 8855 # - 8856 8b/-> *(ebp+8) 1/r32/ecx - 8857 # TODO: assert that a->left is 'array' - 8858 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax - 8859 89/<- %ecx 0/r32/eax - 8860 # var elem-type/edx: type-id = a->right->left->value - 8861 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax - 8862 8b/-> *(eax+4) 2/r32/edx # Tree-value - 8863 # var array-size/ecx: int = a->right->right->left->value - 8864 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax - 8865 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax - 8866 8b/-> *(eax+4) 1/r32/ecx # Tree-value - 8867 # return array-size * size-of(elem-type) - 8868 (size-of-type-id-as-array-element %edx) # => eax - 8869 f7 4/subop/multiply-into-eax %ecx - 8870 05/add-to-eax 4/imm32 # for array size - 8871 $size-of-array:end: - 8872 # . restore registers - 8873 5a/pop-to-edx - 8874 59/pop-to-ecx - 8875 # . epilogue - 8876 89/<- %esp 5/r32/ebp - 8877 5d/pop-to-ebp - 8878 c3/return - 8879 - 8880 size-of-type-id: # t: type-id -> result/eax: int - 8881 # . prologue - 8882 55/push-ebp - 8883 89/<- %ebp 4/r32/esp - 8884 # . save registers - 8885 51/push-ecx - 8886 # var out/ecx: (handle typeinfo) - 8887 68/push 0/imm32 - 8888 68/push 0/imm32 - 8889 89/<- %ecx 4/r32/esp - 8890 # eax = t - 8891 8b/-> *(ebp+8) 0/r32/eax - 8892 # if t is a literal, return 0 - 8893 3d/compare-eax-and 0/imm32 - 8894 0f 84/jump-if-= $size-of-type-id:end/disp32 # eax changes type from type-id to int - 8895 # if t is a byte, return 4 (because we don't really support non-multiples of 4) - 8896 3d/compare-eax-and 8/imm32/byte - 8897 { - 8898 75/jump-if-!= break/disp8 - 8899 b8/copy-to-eax 4/imm32 - 8900 eb/jump $size-of-type-id:end/disp8 - 8901 } - 8902 # if t is a handle, return 8 - 8903 3d/compare-eax-and 4/imm32/handle - 8904 { - 8905 75/jump-if-!= break/disp8 - 8906 b8/copy-to-eax 8/imm32 - 8907 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int - 8908 } - 8909 # if t is a user-defined type, return its size - 8910 # TODO: support non-atom type - 8911 (find-typeinfo %eax %ecx) - 8912 { - 8913 81 7/subop/compare *ecx 0/imm32 - 8914 74/jump-if-= break/disp8 - 8915 $size-of-type-id:user-defined: - 8916 (lookup *ecx *(ecx+4)) # => eax - 8917 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes - 8918 eb/jump $size-of-type-id:end/disp8 - 8919 } - 8920 # otherwise return the word size - 8921 b8/copy-to-eax 4/imm32 - 8922 $size-of-type-id:end: - 8923 # . reclaim locals - 8924 81 0/subop/add %esp 8/imm32 - 8925 # . restore registers - 8926 59/pop-to-ecx - 8927 # . epilogue - 8928 89/<- %esp 5/r32/ebp - 8929 5d/pop-to-ebp - 8930 c3/return - 8931 - 8932 type-equal?: # a: (addr tree type-id), b: (addr tree type-id) -> result/eax: boolean - 8933 # . prologue - 8934 55/push-ebp - 8935 89/<- %ebp 4/r32/esp - 8936 # . save registers - 8937 51/push-ecx - 8938 52/push-edx - 8939 # ecx = a - 8940 8b/-> *(ebp+8) 1/r32/ecx - 8941 # edx = b - 8942 8b/-> *(ebp+0xc) 2/r32/edx - 8943 # if (a == b) return true - 8944 8b/-> %ecx 0/r32/eax # Var-type - 8945 39/compare %edx 0/r32/eax # Var-type - 8946 b8/copy-to-eax 1/imm32/true - 8947 74/jump-if-= $type-equal?:end/disp8 - 8948 # if (a < MAX_TYPE_ID) return false - 8949 81 7/subop/compare %ecx 0x10000/imm32 - 8950 b8/copy-to-eax 0/imm32/false - 8951 72/jump-if-addr< $type-equal?:end/disp8 - 8952 # if (b < MAX_TYPE_ID) return false - 8953 81 7/subop/compare %edx 0x10000/imm32 - 8954 b8/copy-to-eax 0/imm32/false - 8955 72/jump-if-addr< $type-equal?:end/disp8 - 8956 # if (!type-equal?(a->left, b->left)) return false - 8957 (type-equal? *(ecx+4) *(edx+4)) # Tree-left, Tree-left => eax - 8958 3d/compare-eax-and 0/imm32/false - 8959 74/jump-if-= $type-equal?:end/disp8 - 8960 # return type-equal?(a->right, b->right) - 8961 (type-equal? *(ecx+8) *(edx+8)) # Tree-right, Tree-right => eax - 8962 $type-equal?:end: - 8963 # . restore registers - 8964 5a/pop-to-edx - 8965 59/pop-to-ecx - 8966 # . epilogue - 8967 89/<- %esp 5/r32/ebp - 8968 5d/pop-to-ebp - 8969 c3/return - 8970 - 8971 ####################################################### - 8972 # Code-generation - 8973 ####################################################### - 8974 - 8975 == data - 8976 - 8977 Curr-block-depth: # (addr int) - 8978 0/imm32 - 8979 Curr-local-stack-offset: # (addr int) - 8980 0/imm32 - 8981 - 8982 == code - 8983 - 8984 emit-subx: # out: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) - 8985 # . prologue - 8986 55/push-ebp - 8987 89/<- %ebp 4/r32/esp - 8988 # . save registers - 8989 50/push-eax - 8990 # var curr/eax: (addr function) = *Program->functions - 8991 (lookup *_Program-functions *_Program-functions->payload) # => eax - 8992 { - 8993 # if (curr == null) break - 8994 3d/compare-eax-and 0/imm32 - 8995 0f 84/jump-if-= break/disp32 - 8996 (emit-subx-function *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) - 8997 # curr = lookup(curr->next) - 8998 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax - 8999 e9/jump loop/disp32 - 9000 } - 9001 $emit-subx:end: - 9002 # . restore registers - 9003 58/pop-to-eax - 9004 # . epilogue - 9005 89/<- %esp 5/r32/ebp - 9006 5d/pop-to-ebp - 9007 c3/return - 9008 - 9009 emit-subx-function: # out: (addr buffered-file), f: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) - 9010 # . prologue - 9011 55/push-ebp - 9012 89/<- %ebp 4/r32/esp - 9013 # some preprocessing - 9014 (populate-mu-type-offsets-in-inouts *(ebp+0xc)) - 9015 # . save registers - 9016 50/push-eax - 9017 51/push-ecx - 9018 52/push-edx - 9019 57/push-edi - 9020 # initialize some global state - 9021 c7 0/subop/copy *Curr-block-depth 1/imm32 - 9022 c7 0/subop/copy *Curr-local-stack-offset 0/imm32 - 9023 # ecx = f - 9024 8b/-> *(ebp+0xc) 1/r32/ecx - 9025 # var vars/edx: (stack (addr var) 256) - 9026 81 5/subop/subtract %esp 0xc00/imm32 - 9027 68/push 0xc00/imm32/size - 9028 68/push 0/imm32/top - 9029 89/<- %edx 4/r32/esp - 9030 # var name/eax: (addr array byte) = lookup(f->name) - 9031 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax - 9032 # - 9033 (write-buffered *(ebp+8) %eax) - 9034 (write-buffered *(ebp+8) ":\n") - 9035 (emit-subx-prologue *(ebp+8)) - 9036 # var outputs/edi: (addr list var) = lookup(f->outputs) - 9037 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax - 9038 89/<- %edi 0/r32/eax - 9039 # var body/eax: (addr block) = lookup(f->body) - 9040 (lookup *(ecx+0x18) *(ecx+0x1c)) # Function-body Function-body => eax - 9041 # - 9042 (emit-subx-block *(ebp+8) %eax %edx %edi *(ebp+0x10) *(ebp+0x14)) - 9043 (emit-subx-epilogue *(ebp+8)) - 9044 # TODO: validate that *Curr-block-depth and *Curr-local-stack-offset have - 9045 # been cleaned up - 9046 $emit-subx-function:end: - 9047 # . reclaim locals - 9048 81 0/subop/add %esp 0xc08/imm32 - 9049 # . restore registers - 9050 5f/pop-to-edi - 9051 5a/pop-to-edx - 9052 59/pop-to-ecx - 9053 58/pop-to-eax - 9054 # . epilogue - 9055 89/<- %esp 5/r32/ebp - 9056 5d/pop-to-ebp - 9057 c3/return - 9058 - 9059 populate-mu-type-offsets-in-inouts: # f: (addr function) - 9060 # . prologue - 9061 55/push-ebp - 9062 89/<- %ebp 4/r32/esp - 9063 # . save registers - 9064 50/push-eax - 9065 51/push-ecx - 9066 52/push-edx - 9067 53/push-ebx - 9068 57/push-edi - 9069 # var next-offset/edx: int = 8 - 9070 ba/copy-to-edx 8/imm32 - 9071 # var curr/ecx: (addr list var) = lookup(f->inouts) - 9072 8b/-> *(ebp+8) 1/r32/ecx - 9073 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax - 9074 89/<- %ecx 0/r32/eax - 9075 { - 9076 $populate-mu-type-offsets-in-inouts:loop: - 9077 81 7/subop/compare %ecx 0/imm32 - 9078 74/jump-if-= break/disp8 - 9079 # var v/ebx: (addr var) = lookup(curr->value) - 9080 (lookup *ecx *(ecx+4)) # List-value List-value => eax - 9081 89/<- %ebx 0/r32/eax - 9082 #? (lookup *ebx *(ebx+4)) - 9083 #? (write-buffered Stderr "setting offset of fn inout ") - 9084 #? (write-buffered Stderr %eax) - 9085 #? (write-buffered Stderr "@") - 9086 #? (print-int32-buffered Stderr %ebx) - 9087 #? (write-buffered Stderr " to ") - 9088 #? (print-int32-buffered Stderr %edx) - 9089 #? (write-buffered Stderr Newline) - 9090 #? (flush Stderr) - 9091 # v->offset = next-offset - 9092 89/<- *(ebx+0x14) 2/r32/edx # Var-offset - 9093 # next-offset += size-of(v) - 9094 (size-of %ebx) # => eax - 9095 01/add-to %edx 0/r32/eax - 9096 # curr = lookup(curr->next) - 9097 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax - 9098 89/<- %ecx 0/r32/eax - 9099 # - 9100 eb/jump loop/disp8 - 9101 } - 9102 $populate-mu-type-offsets-in-inouts:end: - 9103 # . restore registers - 9104 5f/pop-to-edi - 9105 5b/pop-to-ebx - 9106 5a/pop-to-edx - 9107 59/pop-to-ecx - 9108 58/pop-to-eax - 9109 # . epilogue - 9110 89/<- %esp 5/r32/ebp - 9111 5d/pop-to-ebp - 9112 c3/return - 9113 - 9114 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) - 9115 # . prologue - 9116 55/push-ebp - 9117 89/<- %ebp 4/r32/esp - 9118 # . save registers - 9119 50/push-eax - 9120 51/push-ecx - 9121 53/push-ebx - 9122 56/push-esi - 9123 # esi = stmts - 9124 8b/-> *(ebp+0xc) 6/r32/esi - 9125 # - 9126 { - 9127 $emit-subx-stmt-list:loop: - 9128 81 7/subop/compare %esi 0/imm32 - 9129 0f 84/jump-if-= break/disp32 - 9130 # var curr-stmt/ecx: (addr stmt) = lookup(stmts->value) - 9131 (lookup *esi *(esi+4)) # List-value List-value => eax - 9132 89/<- %ecx 0/r32/eax - 9133 { - 9134 $emit-subx-stmt-list:check-for-block: - 9135 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag - 9136 75/jump-if-!= break/disp8 - 9137 $emit-subx-stmt-list:block: - 9138 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) - 9139 } - 9140 { - 9141 $emit-subx-stmt-list:check-for-stmt: - 9142 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag - 9143 0f 85/jump-if-!= break/disp32 - 9144 $emit-subx-stmt-list:stmt1: - 9145 { - 9146 (is-mu-branch? %ecx) # => eax - 9147 3d/compare-eax-and 0/imm32/false - 9148 0f 84/jump-if-= break/disp32 - 9149 $emit-subx-stmt-list:branch-stmt: - 9150 +-- 27 lines: # unconditional loops ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9177 +-- 16 lines: # unconditional breaks --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9193 +-- 38 lines: # simple conditional branches without a target --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9231 +-- 19 lines: # conditional branches with an explicit target --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9250 } - 9251 $emit-subx-stmt-list:1-to-1: - 9252 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x18) *(ebp+0x1c)) - 9253 e9/jump $emit-subx-stmt-list:continue/disp32 - 9254 } - 9255 { - 9256 $emit-subx-stmt-list:check-for-var-def: - 9257 81 7/subop/compare *ecx 2/imm32/var-def # Stmt-tag - 9258 75/jump-if-!= break/disp8 - 9259 $emit-subx-stmt-list:var-def: - 9260 (emit-subx-var-def *(ebp+8) %ecx) - 9261 (push *(ebp+0x10) *(ecx+4)) # Vardef-var - 9262 (push *(ebp+0x10) *(ecx+8)) # Vardef-var - 9263 (push *(ebp+0x10) 0) # Live-var-register-spilled = 0 for vars on the stack - 9264 # - 9265 eb/jump $emit-subx-stmt-list:continue/disp8 - 9266 } - 9267 { - 9268 $emit-subx-stmt-list:check-for-reg-var-def: - 9269 81 7/subop/compare *ecx 3/imm32/reg-var-def # Stmt-tag - 9270 0f 85/jump-if-!= break/disp32 - 9271 $emit-subx-stmt-list:reg-var-def: - 9272 # TODO: ensure that there's exactly one output - 9273 (push-output-and-maybe-emit-spill *(ebp+8) %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) - 9274 # emit the instruction as usual - 9275 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x18) *(ebp+0x1c)) - 9276 # - 9277 eb/jump $emit-subx-stmt-list:continue/disp8 - 9278 } - 9279 $emit-subx-stmt-list:continue: - 9280 # TODO: raise an error on unrecognized Stmt-tag - 9281 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax - 9282 89/<- %esi 0/r32/eax - 9283 e9/jump loop/disp32 - 9284 } - 9285 $emit-subx-stmt-list:emit-cleanup: - 9286 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth) - 9287 $emit-subx-stmt-list:clean-up: - 9288 (clean-up-blocks *(ebp+0x10) *Curr-block-depth) - 9289 $emit-subx-stmt-list:end: - 9290 # . restore registers - 9291 5e/pop-to-esi - 9292 5b/pop-to-ebx - 9293 59/pop-to-ecx - 9294 58/pop-to-eax - 9295 # . epilogue - 9296 89/<- %esp 5/r32/ebp - 9297 5d/pop-to-ebp - 9298 c3/return - 9299 - 9300 # 'later-stmts' includes 'stmt', but will behave the same even without it; reg-var-def stmts are guaranteed not to write to function outputs. - 9301 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) - 9302 # . prologue - 9303 55/push-ebp - 9304 89/<- %ebp 4/r32/esp - 9305 # . save registers - 9306 50/push-eax - 9307 51/push-ecx - 9308 52/push-edx - 9309 # ecx = stmt - 9310 8b/-> *(ebp+0xc) 1/r32/ecx - 9311 # var sv/eax: (addr stmt-var) = lookup(curr-stmt->outputs) - 9312 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax - 9313 # TODO: assert !sv->is-deref? - 9314 # var v/ecx: (addr var) = lookup(sv->value) - 9315 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 9316 89/<- %ecx 0/r32/eax - 9317 # v->block-depth = *Curr-block-depth - 9318 8b/-> *Curr-block-depth 0/r32/eax - 9319 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth - 9320 #? (write-buffered Stderr "var ") - 9321 #? (lookup *ecx *(ecx+4)) - 9322 #? (write-buffered Stderr %eax) - 9323 #? (write-buffered Stderr " at depth ") - 9324 #? (print-int32-buffered Stderr *(ecx+0x10)) - 9325 #? (write-buffered Stderr Newline) - 9326 #? (flush Stderr) - 9327 # ensure that v is in a register - 9328 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register - 9329 0f 84/jump-if-= $push-output-and-maybe-emit-spill:abort/disp32 - 9330 # var emit-spill?/edx: boolean = not-yet-spilled-this-block? && will-not-write-some-register?(fn-outputs) - 9331 (not-yet-spilled-this-block? %ecx *(ebp+0x10)) # => eax - 9332 89/<- %edx 0/r32/eax - 9333 3d/compare-eax-and 0/imm32/false - 9334 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 - 9335 (will-not-write-some-register? %ecx *(ebp+0x14) *(ebp+0x18)) # => eax - 9336 89/<- %edx 0/r32/eax - 9337 # check emit-spill? - 9338 3d/compare-eax-and 0/imm32/false - 9339 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 - 9340 # TODO: assert(size-of(output) == 4) - 9341 # *Curr-local-stack-offset -= 4 - 9342 81 5/subop/subtract *Curr-local-stack-offset 4/imm32 - 9343 # emit spill - 9344 (emit-indent *(ebp+8) *Curr-block-depth) - 9345 (write-buffered *(ebp+8) "ff 6/subop/push %") - 9346 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax - 9347 (write-buffered *(ebp+8) %eax) - 9348 (write-buffered *(ebp+8) Newline) - 9349 $push-output-and-maybe-emit-spill:push: - 9350 8b/-> *(ebp+0xc) 1/r32/ecx - 9351 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax - 9352 # push(vars, {sv->value, emit-spill?}) - 9353 (push *(ebp+0x10) *eax) # Stmt-var-value - 9354 (push *(ebp+0x10) *(eax+4)) # Stmt-var-value - 9355 (push *(ebp+0x10) %edx) - 9356 $push-output-and-maybe-emit-spill:end: - 9357 # . restore registers - 9358 5a/pop-to-edx - 9359 59/pop-to-ecx - 9360 58/pop-to-eax - 9361 # . epilogue - 9362 89/<- %esp 5/r32/ebp - 9363 5d/pop-to-ebp - 9364 c3/return - 9365 - 9366 $push-output-and-maybe-emit-spill:abort: - 9367 # error("var '" var->name "' initialized from an instruction must live in a register\n") - 9368 (write-buffered *(ebp+0x1c) "var '") - 9369 (write-buffered *(ebp+0x1c) *eax) # Var-name - 9370 (write-buffered *(ebp+0x1c) "' initialized from an instruction must live in a register\n") - 9371 (flush *(ebp+0x1c)) - 9372 (stop *(ebp+0x20) 1) - 9373 # never gets here - 9374 - 9375 emit-subx-cleanup-and-unconditional-nonlocal-branch: # out: (addr buffered-file), stmt: (addr stmt1), vars: (addr stack live-var) - 9376 # . prologue - 9377 55/push-ebp - 9378 89/<- %ebp 4/r32/esp - 9379 # . save registers - 9380 50/push-eax - 9381 51/push-ecx - 9382 # ecx = stmt - 9383 8b/-> *(ebp+0xc) 1/r32/ecx - 9384 # var target/eax: (addr array byte) = curr-stmt->inouts->value->name - 9385 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax - 9386 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax - 9387 (lookup *eax *(eax+4)) # Var-name Var-name => eax - 9388 # clean up until target block - 9389 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %eax) - 9390 # emit jump to target block - 9391 (emit-indent *(ebp+8) *Curr-block-depth) - 9392 (write-buffered *(ebp+8) "e9/jump ") - 9393 (write-buffered *(ebp+8) %eax) - 9394 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax - 9395 (string-starts-with? %eax "break") - 9396 3d/compare-eax-and 0/imm32/false - 9397 { - 9398 74/jump-if-= break/disp8 - 9399 (write-buffered *(ebp+8) ":break/disp32\n") - 9400 } - 9401 3d/compare-eax-and 0/imm32/false # just in case the function call modified flags - 9402 { - 9403 75/jump-if-!= break/disp8 - 9404 (write-buffered *(ebp+8) ":loop/disp32\n") - 9405 } - 9406 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end: - 9407 # . restore registers - 9408 59/pop-to-ecx - 9409 58/pop-to-eax - 9410 # . epilogue - 9411 89/<- %esp 5/r32/ebp - 9412 5d/pop-to-ebp - 9413 c3/return - 9414 - 9415 is-mu-branch?: # stmt: (addr stmt1) -> result/eax: boolean - 9416 # . prologue - 9417 55/push-ebp - 9418 89/<- %ebp 4/r32/esp - 9419 # . save registers - 9420 51/push-ecx - 9421 # ecx = lookup(stmt->operation) - 9422 8b/-> *(ebp+8) 1/r32/ecx - 9423 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax - 9424 89/<- %ecx 0/r32/eax - 9425 # if (stmt->operation starts with "loop") return true - 9426 (string-starts-with? %ecx "loop") # => eax - 9427 3d/compare-eax-and 0/imm32/false - 9428 75/jump-if-not-equal $is-mu-branch?:end/disp8 - 9429 # otherwise return (stmt->operation starts with "break") - 9430 (string-starts-with? %ecx "break") # => eax - 9431 $is-mu-branch?:end: - 9432 # . restore registers - 9433 59/pop-to-ecx - 9434 # . epilogue - 9435 89/<- %esp 5/r32/ebp - 9436 5d/pop-to-ebp - 9437 c3/return - 9438 - 9439 emit-reverse-break: # out: (addr buffered-file), stmt: (addr stmt1) - 9440 # . prologue - 9441 55/push-ebp - 9442 89/<- %ebp 4/r32/esp - 9443 # . save registers - 9444 50/push-eax - 9445 # eax = stmt - 9446 8b/-> *(ebp+0xc) 0/r32/eax - 9447 # - 9448 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax - 9449 (get Reverse-branch %eax 0x10 "reverse-branch: ") # => eax: (addr handle array byte) - 9450 (emit-indent *(ebp+8) *Curr-block-depth) - 9451 (lookup *eax *(eax+4)) # => eax - 9452 (write-buffered *(ebp+8) %eax) - 9453 (write-buffered *(ebp+8) " break/disp32\n") - 9454 $emit-reverse-break:end: - 9455 # . restore registers - 9456 58/pop-to-eax - 9457 # . epilogue - 9458 89/<- %esp 5/r32/ebp - 9459 5d/pop-to-ebp - 9460 c3/return - 9461 - 9462 == data + 8361 # . save registers + 8362 50/push-eax + 8363 51/push-ecx + 8364 52/push-edx + 8365 53/push-ebx + 8366 56/push-esi + 8367 57/push-edi + 8368 # edi = t + 8369 8b/-> *(ebp+0xc) 7/r32/edi + 8370 # var line/ecx: (stream byte 512) + 8371 81 5/subop/subtract %esp 0x200/imm32 + 8372 68/push 0x200/imm32/size + 8373 68/push 0/imm32/read + 8374 68/push 0/imm32/write + 8375 89/<- %ecx 4/r32/esp + 8376 # var word-slice/edx: slice + 8377 68/push 0/imm32/end + 8378 68/push 0/imm32/start + 8379 89/<- %edx 4/r32/esp + 8380 # var v/esi: (handle var) + 8381 68/push 0/imm32 + 8382 68/push 0/imm32 + 8383 89/<- %esi 4/r32/esp + 8384 # var r/ebx: (handle typeinfo-entry) + 8385 68/push 0/imm32 + 8386 68/push 0/imm32 + 8387 89/<- %ebx 4/r32/esp + 8388 { + 8389 $populate-mu-type:line-loop: + 8390 (clear-stream %ecx) + 8391 (read-line-buffered *(ebp+8) %ecx) + 8392 # if (line->write == 0) abort + 8393 81 7/subop/compare *ecx 0/imm32 + 8394 0f 84/jump-if-= $populate-mu-type:abort/disp32 + 8395 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------ + 8401 (next-mu-token %ecx %edx) + 8402 # if slice-empty?(word-slice) continue + 8403 (slice-empty? %edx) # => eax + 8404 3d/compare-eax-and 0/imm32 + 8405 0f 85/jump-if-!= loop/disp32 + 8406 # if slice-equal?(word-slice, "}") break + 8407 (slice-equal? %edx "}") + 8408 3d/compare-eax-and 0/imm32 + 8409 0f 85/jump-if-!= break/disp32 + 8410 $populate-mu-type:parse-element: + 8411 # v = parse-var-with-type(word-slice, first-line) + 8412 # must do this first to strip the trailing ':' from word-slice before + 8413 # using it in find-or-create-typeinfo-fields below + 8414 # TODO: clean up that mutation in parse-var-with-type + 8415 (parse-var-with-type %edx %ecx %esi *(ebp+0x10) *(ebp+0x14)) # => eax + 8416 # var tmp/ecx + 8417 51/push-ecx + 8418 $populate-mu-type:create-typeinfo-fields: + 8419 # var r/ebx: (handle typeinfo-entry) + 8420 (find-or-create-typeinfo-fields %edi %edx %ebx) + 8421 # r->index = curr-index + 8422 (lookup *ebx *(ebx+4)) # => eax + 8423 8b/-> *(ebp-4) 1/r32/ecx + 8424 #? (write-buffered Stderr "saving index ") + 8425 #? (print-int32-buffered Stderr %ecx) + 8426 #? (write-buffered Stderr " at ") + 8427 #? (print-int32-buffered Stderr %edi) + 8428 #? (write-buffered Stderr Newline) + 8429 #? (flush Stderr) + 8430 89/<- *(eax+8) 1/r32/ecx # Typeinfo-entry-index + 8431 # ++curr-index + 8432 ff 0/subop/increment *(ebp-4) + 8433 $populate-mu-type:set-input-type: + 8434 # r->input-var = v + 8435 8b/-> *esi 1/r32/ecx + 8436 89/<- *eax 1/r32/ecx # Typeinfo-entry-input-var + 8437 8b/-> *(esi+4) 1/r32/ecx + 8438 89/<- *(eax+4) 1/r32/ecx # Typeinfo-entry-input-var + 8439 59/pop-to-ecx + 8440 { + 8441 $populate-mu-type:create-output-type: + 8442 # if (r->output-var == 0) create a new var with some placeholder data + 8443 81 7/subop/compare *(eax+0xc) 0/imm32 # Typeinfo-entry-output-var + 8444 75/jump-if-!= break/disp8 + 8445 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var + 8446 (new-literal Heap %edx %eax) + 8447 } + 8448 e9/jump loop/disp32 + 8449 } + 8450 $populate-mu-type:invalidate-total-size-in-bytes: + 8451 # Offsets and total size may not be accurate here since we may not yet + 8452 # have encountered the element types. + 8453 # We'll recompute them separately after parsing the entire program. + 8454 c7 0/subop/copy *(edi+0xc) -2/imm32/uninitialized # Typeinfo-total-size-in-bytes + 8455 $populate-mu-type:validate: + 8456 (check-input-vars *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) + 8457 $populate-mu-type:end: + 8458 # . reclaim locals + 8459 81 0/subop/add %esp 0x224/imm32 + 8460 # . restore registers + 8461 5f/pop-to-edi + 8462 5e/pop-to-esi + 8463 5b/pop-to-ebx + 8464 5a/pop-to-edx + 8465 59/pop-to-ecx + 8466 58/pop-to-eax + 8467 # reclaim curr-index + 8468 81 0/subop/add %esp 4/imm32 + 8469 # . epilogue + 8470 89/<- %esp 5/r32/ebp + 8471 5d/pop-to-ebp + 8472 c3/return + 8473 + 8474 $populate-mu-type:abort: + 8475 # error("unexpected top-level command: " word-slice "\n") + 8476 (write-buffered *(ebp+0x10) "incomplete type definition '") + 8477 (type-name *edi) # Typeinfo-id => eax + 8478 (write-buffered *(ebp+0x10) %eax) + 8479 (write-buffered *(ebp+0x10) "\n") + 8480 (flush *(ebp+0x10)) + 8481 (stop *(ebp+0x14) 1) + 8482 # never gets here + 8483 + 8484 check-input-vars: # t: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) + 8485 # . prologue + 8486 55/push-ebp + 8487 89/<- %ebp 4/r32/esp + 8488 # . save registers + 8489 50/push-eax + 8490 51/push-ecx + 8491 52/push-edx + 8492 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(t->fields) + 8493 8b/-> *(ebp+8) 0/r32/eax + 8494 (lookup *(eax+4) *(eax+8)) # Typeinfo-fields Typeinfo-fields => eax + 8495 89/<- %ecx 0/r32/eax + 8496 # var table-size/edx: int = table->write + 8497 8b/-> *ecx 2/r32/edx # stream-write + 8498 # var curr/ecx: (addr table_row) = table->data + 8499 8d/copy-address *(ecx+0xc) 1/r32/ecx + 8500 # var max/edx: (addr table_row) = table->data + table->write + 8501 8d/copy-address *(ecx+edx) 2/r32/edx + 8502 { + 8503 $check-input-vars:loop: + 8504 # if (curr >= max) break + 8505 39/compare %ecx 2/r32/edx + 8506 73/jump-if-addr>= break/disp8 + 8507 (lookup *ecx *(ecx+4)) # => eax + 8508 # var t2/eax: (addr typeinfo-entry) = lookup(curr->value) + 8509 (lookup *(ecx+8) *(ecx+0xc)) # => eax + 8510 # if (t2->input-var == null) raise an error + 8511 8b/-> *eax 0/r32/eax # Typeinfo-entry-input-var + 8512 3d/compare-eax-and 0/imm32/null + 8513 0f 84/jump-if-= $check-input-vars:abort/disp32 + 8514 # curr += row-size + 8515 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size + 8516 # + 8517 eb/jump loop/disp8 + 8518 } + 8519 $check-input-vars:end: + 8520 # . restore registers + 8521 5a/pop-to-edx + 8522 59/pop-to-ecx + 8523 58/pop-to-eax + 8524 # . epilogue + 8525 89/<- %esp 5/r32/ebp + 8526 5d/pop-to-ebp + 8527 c3/return + 8528 + 8529 $check-input-vars:abort: + 8530 # error("type " type " has no member called '" curr->name "'\n") + 8531 (write-buffered *(ebp+0xc) "type '") + 8532 # . var tmp/edx: int = t->id << 2 + 8533 8b/-> *(ebp+8) 0/r32/eax + 8534 8b/-> *eax 2/r32/edx # Typeinfo-id + 8535 c1/shift 4/subop/left %edx 2/imm8 + 8536 # . var a/edx: (addr array byte) = Type-id->data[tmp] + 8537 b8/copy-to-eax Type-id/imm32 + 8538 8b/-> *(eax+edx+0xc) 2/r32/edx + 8539 (write-buffered *(ebp+0xc) %edx) + 8540 (write-buffered *(ebp+0xc) "' has no member called '") + 8541 (lookup *ecx *(ecx+4)) # => eax + 8542 (write-buffered *(ebp+0xc) %eax) + 8543 (write-buffered *(ebp+0xc) "'\n") + 8544 (flush *(ebp+0xc)) + 8545 (stop *(ebp+0x10) 1) + 8546 # never gets here + 8547 + 8548 type-name: # index: int -> result/eax: (addr array byte) + 8549 # . prologue + 8550 55/push-ebp + 8551 89/<- %ebp 4/r32/esp + 8552 # + 8553 (index Type-id *(ebp+8)) + 8554 $type-name:end: + 8555 # . epilogue + 8556 89/<- %esp 5/r32/ebp + 8557 5d/pop-to-ebp + 8558 c3/return + 8559 + 8560 index: # arr: (addr stream (handle array byte)), index: int -> result/eax: (addr array byte) + 8561 # . prologue + 8562 55/push-ebp + 8563 89/<- %ebp 4/r32/esp + 8564 # . save registers + 8565 56/push-esi + 8566 # TODO: bounds-check index + 8567 # esi = arr + 8568 8b/-> *(ebp+8) 6/r32/esi + 8569 # eax = index + 8570 8b/-> *(ebp+0xc) 0/r32/eax + 8571 # eax = *(arr + 12 + index) + 8572 8b/-> *(esi+eax+0xc) 0/r32/eax + 8573 $index:end: + 8574 # . restore registers + 8575 5e/pop-to-esi + 8576 # . epilogue + 8577 89/<- %esp 5/r32/ebp + 8578 5d/pop-to-ebp + 8579 c3/return + 8580 + 8581 ####################################################### + 8582 # Compute type sizes + 8583 ####################################################### + 8584 + 8585 # Compute the sizes of all user-defined types. + 8586 # We'll need the sizes of their elements, which may be other user-defined + 8587 # types, which we will compute as needed. + 8588 + 8589 # Initially, all user-defined types have their sizes set to -2 (invalid) + 8590 populate-mu-type-sizes: # err: (addr buffered-file), ed: (addr exit-descriptor) + 8591 # . prologue + 8592 55/push-ebp + 8593 89/<- %ebp 4/r32/esp + 8594 $populate-mu-type-sizes:total-sizes: + 8595 # var curr/eax: (addr typeinfo) = lookup(Program->types) + 8596 (lookup *_Program-types *_Program-types->payload) # => eax + 8597 { + 8598 # if (curr == null) break + 8599 3d/compare-eax-and 0/imm32/null + 8600 74/jump-if-= break/disp8 + 8601 (populate-mu-type-sizes-in-type %eax *(ebp+8) *(ebp+0xc)) + 8602 # curr = lookup(curr->next) + 8603 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax + 8604 eb/jump loop/disp8 + 8605 } + 8606 $populate-mu-type-sizes:offsets: + 8607 # curr = *Program->types + 8608 (lookup *_Program-types *_Program-types->payload) # => eax + 8609 { + 8610 # if (curr == null) break + 8611 3d/compare-eax-and 0/imm32/null + 8612 74/jump-if-= break/disp8 + 8613 (populate-mu-type-offsets %eax *(ebp+8) *(ebp+0xc)) + 8614 # curr = curr->next + 8615 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax + 8616 eb/jump loop/disp8 + 8617 } + 8618 $populate-mu-type-sizes:end: + 8619 # . epilogue + 8620 89/<- %esp 5/r32/ebp + 8621 5d/pop-to-ebp + 8622 c3/return + 8623 + 8624 # compute sizes of all fields, recursing as necessary + 8625 # sum up all their sizes to arrive at total size + 8626 # fields may be out of order, but that doesn't affect the answer + 8627 populate-mu-type-sizes-in-type: # T: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) + 8628 # . prologue + 8629 55/push-ebp + 8630 89/<- %ebp 4/r32/esp + 8631 # . save registers + 8632 50/push-eax + 8633 51/push-ecx + 8634 52/push-edx + 8635 56/push-esi + 8636 57/push-edi + 8637 # esi = T + 8638 8b/-> *(ebp+8) 6/r32/esi + 8639 # if T is already computed, return + 8640 81 7/subop/compare *(esi+0xc) 0/imm32 # Typeinfo-total-size-in-bytes + 8641 0f 8d/jump-if->= $populate-mu-type-sizes-in-type:end/disp32 + 8642 # if T is being computed, abort + 8643 81 7/subop/compare *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes + 8644 0f 84/jump-if-= $populate-mu-type-sizes-in-type:abort/disp32 + 8645 # tag T (-2 to -1) to avoid infinite recursion + 8646 c7 0/subop/copy *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes + 8647 # var total-size/edi: int = 0 + 8648 bf/copy-to-edi 0/imm32 + 8649 # - for every field, if it's a user-defined type, compute its size + 8650 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) + 8651 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax + 8652 89/<- %ecx 0/r32/eax + 8653 # var table-size/edx: int = table->write + 8654 8b/-> *ecx 2/r32/edx # stream-write + 8655 # var curr/ecx: (addr table_row) = table->data + 8656 8d/copy-address *(ecx+0xc) 1/r32/ecx + 8657 # var max/edx: (addr table_row) = table->data + table->write + 8658 8d/copy-address *(ecx+edx) 2/r32/edx + 8659 { + 8660 $populate-mu-type-sizes-in-type:loop: + 8661 # if (curr >= max) break + 8662 39/compare %ecx 2/r32/edx + 8663 73/jump-if-addr>= break/disp8 + 8664 # var t/eax: (addr typeinfo-entry) = lookup(curr->value) + 8665 (lookup *(ecx+8) *(ecx+0xc)) # => eax + 8666 # compute size of t->input-var + 8667 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax + 8668 (compute-size-of-var %eax) # => eax + 8669 # result += eax + 8670 01/add-to %edi 0/r32/eax + 8671 # curr += row-size + 8672 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size + 8673 # + 8674 eb/jump loop/disp8 + 8675 } + 8676 # - save result + 8677 89/<- *(esi+0xc) 7/r32/edi # Typeinfo-total-size-in-bytes + 8678 $populate-mu-type-sizes-in-type:end: + 8679 # . restore registers + 8680 5f/pop-to-edi + 8681 5e/pop-to-esi + 8682 5a/pop-to-edx + 8683 59/pop-to-ecx + 8684 58/pop-to-eax + 8685 # . epilogue + 8686 89/<- %esp 5/r32/ebp + 8687 5d/pop-to-ebp + 8688 c3/return + 8689 + 8690 $populate-mu-type-sizes-in-type:abort: + 8691 (write-buffered *(ebp+0xc) "cycle in type definitions\n") + 8692 (flush *(ebp+0xc)) + 8693 (stop *(ebp+0x10) 1) + 8694 # never gets here + 8695 + 8696 # Analogous to size-of, except we need to compute what size-of can just read + 8697 # off the right data structures. + 8698 compute-size-of-var: # in: (addr var) -> result/eax: int + 8699 # . prologue + 8700 55/push-ebp + 8701 89/<- %ebp 4/r32/esp + 8702 # . push registers + 8703 51/push-ecx + 8704 # var t/ecx: (addr tree type-id) = lookup(v->type) + 8705 8b/-> *(ebp+8) 1/r32/ecx + 8706 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 8707 89/<- %ecx 0/r32/eax + 8708 # if (t->is-atom == false) t = lookup(t->left) + 8709 { + 8710 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom + 8711 75/jump-if-!= break/disp8 + 8712 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax + 8713 89/<- %ecx 0/r32/eax + 8714 } + 8715 # TODO: ensure t is an atom + 8716 (compute-size-of-type-id *(ecx+4)) # Tree-value => eax + 8717 $compute-size-of-var:end: + 8718 # . restore registers + 8719 59/pop-to-ecx + 8720 # . epilogue + 8721 89/<- %esp 5/r32/ebp + 8722 5d/pop-to-ebp + 8723 c3/return + 8724 + 8725 compute-size-of-type-id: # t: type-id -> result/eax: int + 8726 # . prologue + 8727 55/push-ebp + 8728 89/<- %ebp 4/r32/esp + 8729 # . save registers + 8730 51/push-ecx + 8731 # var out/ecx: (handle typeinfo) + 8732 68/push 0/imm32 + 8733 68/push 0/imm32 + 8734 89/<- %ecx 4/r32/esp + 8735 # eax = t + 8736 8b/-> *(ebp+8) 0/r32/eax + 8737 # if t is a literal, return 0 + 8738 3d/compare-eax-and 0/imm32/literal + 8739 0f 84/jump-if-= $compute-size-of-type-id:end/disp32 # eax changes type from type-id to int + 8740 # if t is a byte, return 4 (because we don't really support non-multiples of 4) + 8741 3d/compare-eax-and 8/imm32/byte + 8742 { + 8743 75/jump-if-!= break/disp8 + 8744 b8/copy-to-eax 4/imm32 + 8745 eb/jump $compute-size-of-type-id:end/disp8 + 8746 } + 8747 # if t is a handle, return 8 + 8748 3d/compare-eax-and 4/imm32/handle + 8749 { + 8750 75/jump-if-!= break/disp8 + 8751 b8/copy-to-eax 8/imm32 + 8752 eb/jump $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int + 8753 } + 8754 # if t is a user-defined type, compute its size + 8755 # TODO: support non-atom type + 8756 (find-typeinfo %eax %ecx) + 8757 { + 8758 81 7/subop/compare *ecx 0/imm32 + 8759 74/jump-if-= break/disp8 + 8760 $compute-size-of-type-id:user-defined: + 8761 (populate-mu-type-sizes %eax) + 8762 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes + 8763 eb/jump $compute-size-of-type-id:end/disp8 + 8764 } + 8765 # otherwise return the word size + 8766 b8/copy-to-eax 4/imm32 + 8767 $compute-size-of-type-id:end: + 8768 # . reclaim locals + 8769 81 0/subop/add %esp 8/imm32 + 8770 # . restore registers + 8771 59/pop-to-ecx + 8772 # . epilogue + 8773 89/<- %esp 5/r32/ebp + 8774 5d/pop-to-ebp + 8775 c3/return + 8776 + 8777 # at this point we have total sizes for all user-defined types + 8778 # compute offsets for each element + 8779 # complication: fields may be out of order + 8780 populate-mu-type-offsets: # in: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) + 8781 # . prologue + 8782 55/push-ebp + 8783 89/<- %ebp 4/r32/esp + 8784 # . save registers + 8785 50/push-eax + 8786 51/push-ecx + 8787 52/push-edx + 8788 53/push-ebx + 8789 56/push-esi + 8790 57/push-edi + 8791 #? (dump-typeinfos "aaa\n") + 8792 # var curr-offset/edi: int = 0 + 8793 bf/copy-to-edi 0/imm32 + 8794 # var table/ecx: (addr table string_key (handle typeinfo-entry)) = lookup(in->fields) + 8795 8b/-> *(ebp+8) 1/r32/ecx + 8796 (lookup *(ecx+4) *(ecx+8)) # Typeinfo-fields Typeinfo-fields => eax + 8797 89/<- %ecx 0/r32/eax + 8798 # var num-elems/edx: int = table->write / Typeinfo-fields-row-size + 8799 8b/-> *ecx 2/r32/edx # stream-write + 8800 c1 5/subop/shift-right-logical %edx 4/imm8 + 8801 # var i/ebx: int = 0 + 8802 bb/copy-to-ebx 0/imm32 + 8803 { + 8804 $populate-mu-type-offsets:loop: + 8805 39/compare %ebx 2/r32/edx + 8806 7d/jump-if->= break/disp8 + 8807 #? (write-buffered Stderr "looking up index ") + 8808 #? (print-int32-buffered Stderr %ebx) + 8809 #? (write-buffered Stderr " in ") + 8810 #? (print-int32-buffered Stderr *(ebp+8)) + 8811 #? (write-buffered Stderr Newline) + 8812 #? (flush Stderr) + 8813 # var v/esi: (addr typeinfo-entry) + 8814 (locate-typeinfo-entry-with-index %ecx %ebx *(ebp+0xc) *(ebp+0x10)) # => eax + 8815 89/<- %esi 0/r32/eax + 8816 # v->output-var->offset = curr-offset + 8817 # . eax: (addr var) + 8818 (lookup *(esi+0xc) *(esi+0x10)) # Typeinfo-entry-output-var Typeinfo-entry-output-var => eax + 8819 89/<- *(eax+0x14) 7/r32/edi # Var-offset + 8820 # curr-offset += size-of(v->input-var) + 8821 (lookup *esi *(esi+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax + 8822 (size-of %eax) # => eax + 8823 01/add-to %edi 0/r32/eax + 8824 # ++i + 8825 43/increment-ebx + 8826 eb/jump loop/disp8 + 8827 } + 8828 $populate-mu-type-offsets:end: + 8829 # . restore registers + 8830 5f/pop-to-edi + 8831 5e/pop-to-esi + 8832 5b/pop-to-ebx + 8833 5a/pop-to-edx + 8834 59/pop-to-ecx + 8835 58/pop-to-eax + 8836 # . epilogue + 8837 89/<- %esp 5/r32/ebp + 8838 5d/pop-to-ebp + 8839 c3/return + 8840 + 8841 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) + 8842 # . prologue + 8843 55/push-ebp + 8844 89/<- %ebp 4/r32/esp + 8845 # . save registers + 8846 51/push-ecx + 8847 52/push-edx + 8848 53/push-ebx + 8849 56/push-esi + 8850 57/push-edi + 8851 # esi = table + 8852 8b/-> *(ebp+8) 6/r32/esi + 8853 # var curr/ecx: (addr row (handle array byte) (handle typeinfo-entry)) = table->data + 8854 8d/copy-address *(esi+0xc) 1/r32/ecx + 8855 # var max/edx: (addr byte) = &table->data[table->write] + 8856 8b/-> *esi 2/r32/edx + 8857 8d/copy-address *(ecx+edx) 2/r32/edx + 8858 { + 8859 $locate-typeinfo-entry-with-index:loop: + 8860 39/compare %ecx 2/r32/edx + 8861 73/jump-if-addr>= $locate-typeinfo-entry-with-index:abort/disp8 + 8862 # var v/eax: (addr typeinfo-entry) + 8863 (lookup *(ecx+8) *(ecx+0xc)) # => eax + 8864 # if (v->index == idx) return v + 8865 8b/-> *(eax+8) 3/r32/ebx # Typeinfo-entry-index + 8866 #? (write-buffered Stderr "comparing ") + 8867 #? (print-int32-buffered Stderr %ebx) + 8868 #? (write-buffered Stderr " and ") + 8869 #? (print-int32-buffered Stderr *(ebp+0xc)) + 8870 #? (write-buffered Stderr Newline) + 8871 #? (flush Stderr) + 8872 39/compare *(ebp+0xc) 3/r32/ebx + 8873 74/jump-if-= $locate-typeinfo-entry-with-index:end/disp8 + 8874 # curr += Typeinfo-entry-size + 8875 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-entry-size + 8876 # + 8877 eb/jump loop/disp8 + 8878 } + 8879 # return 0 + 8880 b8/copy-to-eax 0/imm32 + 8881 $locate-typeinfo-entry-with-index:end: + 8882 #? (write-buffered Stderr "returning ") + 8883 #? (print-int32-buffered Stderr %eax) + 8884 #? (write-buffered Stderr Newline) + 8885 #? (flush Stderr) + 8886 # . restore registers + 8887 5f/pop-to-edi + 8888 5e/pop-to-esi + 8889 5b/pop-to-ebx + 8890 5a/pop-to-edx + 8891 59/pop-to-ecx + 8892 # . epilogue + 8893 89/<- %esp 5/r32/ebp + 8894 5d/pop-to-ebp + 8895 c3/return + 8896 + 8897 $locate-typeinfo-entry-with-index:abort: + 8898 (write-buffered *(ebp+0x10) "overflowing typeinfo-entry->index ") + 8899 (print-int32-buffered *(ebp+0x10) %ecx) + 8900 (write-buffered *(ebp+0x10) "\n") + 8901 (flush *(ebp+0x10)) + 8902 (stop *(ebp+0x14) 1) + 8903 # never gets here + 8904 + 8905 dump-typeinfos: # hdr: (addr array byte) + 8906 # . prologue + 8907 55/push-ebp + 8908 89/<- %ebp 4/r32/esp + 8909 # . save registers + 8910 50/push-eax + 8911 # + 8912 (write-buffered Stderr *(ebp+8)) + 8913 (flush Stderr) + 8914 # var curr/eax: (addr typeinfo) = lookup(Program->types) + 8915 (lookup *_Program-types *_Program-types->payload) # => eax + 8916 { + 8917 # if (curr == null) break + 8918 3d/compare-eax-and 0/imm32 + 8919 74/jump-if-= break/disp8 + 8920 (write-buffered Stderr "---\n") + 8921 (flush Stderr) + 8922 (dump-typeinfo %eax) + 8923 # curr = lookup(curr->next) + 8924 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax + 8925 eb/jump loop/disp8 + 8926 } + 8927 $dump-typeinfos:end: + 8928 # . restore registers + 8929 58/pop-to-eax + 8930 # . epilogue + 8931 89/<- %esp 5/r32/ebp + 8932 5d/pop-to-ebp + 8933 c3/return + 8934 + 8935 dump-typeinfo: # in: (addr typeinfo) + 8936 # . prologue + 8937 55/push-ebp + 8938 89/<- %ebp 4/r32/esp + 8939 # . save registers + 8940 50/push-eax + 8941 51/push-ecx + 8942 52/push-edx + 8943 53/push-ebx + 8944 56/push-esi + 8945 57/push-edi + 8946 # esi = in + 8947 8b/-> *(ebp+8) 6/r32/esi + 8948 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) + 8949 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax + 8950 89/<- %ecx 0/r32/eax + 8951 (write-buffered Stderr "id:") + 8952 (print-int32-buffered Stderr *esi) + 8953 (write-buffered Stderr "\n") + 8954 (write-buffered Stderr "fields @ ") + 8955 (print-int32-buffered Stderr %ecx) + 8956 (write-buffered Stderr Newline) + 8957 (flush Stderr) + 8958 (write-buffered Stderr " write: ") + 8959 (print-int32-buffered Stderr *ecx) + 8960 (write-buffered Stderr Newline) + 8961 (flush Stderr) + 8962 (write-buffered Stderr " read: ") + 8963 (print-int32-buffered Stderr *(ecx+4)) + 8964 (write-buffered Stderr Newline) + 8965 (flush Stderr) + 8966 (write-buffered Stderr " size: ") + 8967 (print-int32-buffered Stderr *(ecx+8)) + 8968 (write-buffered Stderr Newline) + 8969 (flush Stderr) + 8970 # var table-size/edx: int = table->write + 8971 8b/-> *ecx 2/r32/edx # stream-write + 8972 # var curr/ecx: (addr table_row) = table->data + 8973 8d/copy-address *(ecx+0xc) 1/r32/ecx + 8974 # var max/edx: (addr table_row) = table->data + table->write + 8975 8d/copy-address *(ecx+edx) 2/r32/edx + 8976 { + 8977 $dump-typeinfo:loop: + 8978 # if (curr >= max) break + 8979 39/compare %ecx 2/r32/edx + 8980 0f 83/jump-if-addr>= break/disp32 + 8981 (write-buffered Stderr " row:\n") + 8982 (write-buffered Stderr " key: ") + 8983 (print-int32-buffered Stderr *ecx) + 8984 (write-buffered Stderr ",") + 8985 (print-int32-buffered Stderr *(ecx+4)) + 8986 (write-buffered Stderr " = '") + 8987 (lookup *ecx *(ecx+4)) + 8988 (write-buffered Stderr %eax) + 8989 (write-buffered Stderr "' @ ") + 8990 (print-int32-buffered Stderr %eax) + 8991 (write-buffered Stderr Newline) + 8992 (flush Stderr) + 8993 (write-buffered Stderr " value: ") + 8994 (print-int32-buffered Stderr *(ecx+8)) + 8995 (write-buffered Stderr ",") + 8996 (print-int32-buffered Stderr *(ecx+0xc)) + 8997 (write-buffered Stderr " = typeinfo-entry@") + 8998 (lookup *(ecx+8) *(ecx+0xc)) + 8999 (print-int32-buffered Stderr %eax) + 9000 (write-buffered Stderr Newline) + 9001 (flush Stderr) + 9002 (write-buffered Stderr " input var@") + 9003 (print-int32-buffered Stderr *eax) + 9004 (write-buffered Stderr ",") + 9005 (print-int32-buffered Stderr *(eax+4)) + 9006 (write-buffered Stderr "->") + 9007 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var + 9008 (print-int32-buffered Stderr %eax) + 9009 { + 9010 3d/compare-eax-and 0/imm32 + 9011 74/jump-if-= break/disp8 + 9012 (write-buffered Stderr " ") + 9013 # TODO + 9014 } + 9015 (write-buffered Stderr Newline) + 9016 (flush Stderr) + 9017 (lookup *(ecx+8) *(ecx+0xc)) + 9018 (write-buffered Stderr " index: ") + 9019 (print-int32-buffered Stderr *(eax+8)) + 9020 (write-buffered Stderr Newline) + 9021 (flush Stderr) + 9022 (write-buffered Stderr " output var@") + 9023 (print-int32-buffered Stderr *(eax+0xc)) + 9024 (write-buffered Stderr ",") + 9025 (print-int32-buffered Stderr *(eax+0x10)) + 9026 (write-buffered Stderr "->") + 9027 (lookup *(eax+0xc) *(eax+0x10)) # Typeinfo-entry-output-var + 9028 (print-int32-buffered Stderr %eax) + 9029 (write-buffered Stderr Newline) + 9030 (flush Stderr) + 9031 { + 9032 3d/compare-eax-and 0/imm32 + 9033 0f 84/jump-if-= break/disp32 + 9034 (write-buffered Stderr " name: ") + 9035 89/<- %ebx 0/r32/eax + 9036 (print-int32-buffered Stderr *ebx) # Var-name + 9037 (write-buffered Stderr ",") + 9038 (print-int32-buffered Stderr *(ebx+4)) # Var-name + 9039 (write-buffered Stderr "->") + 9040 (lookup *ebx *(ebx+4)) # Var-name + 9041 (print-int32-buffered Stderr %eax) + 9042 { + 9043 3d/compare-eax-and 0/imm32 + 9044 74/jump-if-= break/disp8 + 9045 (write-buffered Stderr Space) + 9046 (write-buffered Stderr %eax) + 9047 } + 9048 (write-buffered Stderr Newline) + 9049 (flush Stderr) + 9050 (write-buffered Stderr " block depth: ") + 9051 (print-int32-buffered Stderr *(ebx+0x10)) # Var-block-depth + 9052 (write-buffered Stderr Newline) + 9053 (flush Stderr) + 9054 (write-buffered Stderr " stack offset: ") + 9055 (print-int32-buffered Stderr *(ebx+0x14)) # Var-offset + 9056 (write-buffered Stderr Newline) + 9057 (flush Stderr) + 9058 (write-buffered Stderr " reg: ") + 9059 (print-int32-buffered Stderr *(ebx+0x18)) # Var-register + 9060 (write-buffered Stderr ",") + 9061 (print-int32-buffered Stderr *(ebx+0x1c)) # Var-register + 9062 (write-buffered Stderr "->") + 9063 (flush Stderr) + 9064 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register + 9065 (print-int32-buffered Stderr %eax) + 9066 { + 9067 3d/compare-eax-and 0/imm32 + 9068 74/jump-if-= break/disp8 + 9069 (write-buffered Stderr Space) + 9070 (write-buffered Stderr %eax) + 9071 } + 9072 (write-buffered Stderr Newline) + 9073 (flush Stderr) + 9074 } + 9075 (flush Stderr) + 9076 # curr += row-size + 9077 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size + 9078 # + 9079 e9/jump loop/disp32 + 9080 } + 9081 $dump-typeinfo:end: + 9082 # . restore registers + 9083 5f/pop-to-edi + 9084 5e/pop-to-esi + 9085 5b/pop-to-ebx + 9086 5a/pop-to-edx + 9087 59/pop-to-ecx + 9088 58/pop-to-eax + 9089 # . epilogue + 9090 89/<- %esp 5/r32/ebp + 9091 5d/pop-to-ebp + 9092 c3/return + 9093 + 9094 ####################################################### + 9095 # Type-checking + 9096 ####################################################### + 9097 + 9098 check-mu-types: # err: (addr buffered-file), ed: (addr exit-descriptor) + 9099 # . prologue + 9100 55/push-ebp + 9101 89/<- %ebp 4/r32/esp + 9102 # . save registers + 9103 50/push-eax + 9104 # var curr/eax: (addr function) = *Program->functions + 9105 (lookup *_Program-functions *_Program-functions->payload) # => eax + 9106 { + 9107 $check-mu-types:loop: + 9108 # if (curr == null) break + 9109 3d/compare-eax-and 0/imm32 + 9110 0f 84/jump-if-= break/disp32 + 9111 (check-mu-function %eax *(ebp+8) *(ebp+0xc)) + 9112 # curr = lookup(curr->next) + 9113 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax + 9114 e9/jump loop/disp32 + 9115 } + 9116 $check-mu-types:end: + 9117 # . restore registers + 9118 58/pop-to-eax + 9119 # . epilogue + 9120 89/<- %esp 5/r32/ebp + 9121 5d/pop-to-ebp + 9122 c3/return + 9123 + 9124 check-mu-function: # fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) + 9125 # . prologue + 9126 55/push-ebp + 9127 89/<- %ebp 4/r32/esp + 9128 # . save registers + 9129 50/push-eax + 9130 # eax = f + 9131 8b/-> *(ebp+8) 0/r32/eax + 9132 # TODO: anything to check in header? + 9133 # var body/eax: (addr block) = lookup(f->body) + 9134 (lookup *(eax+0x18) *(eax+0x1c)) # Function-body Function-body => eax + 9135 (check-mu-block %eax *(ebp+0xc) *(ebp+0x10)) + 9136 $check-mu-function:end: + 9137 # . restore registers + 9138 58/pop-to-eax + 9139 # . epilogue + 9140 89/<- %esp 5/r32/ebp + 9141 5d/pop-to-ebp + 9142 c3/return + 9143 + 9144 check-mu-block: # block: (addr block), err: (addr buffered-file), ed: (addr exit-descriptor) + 9145 # . prologue + 9146 55/push-ebp + 9147 89/<- %ebp 4/r32/esp + 9148 # . save registers + 9149 50/push-eax + 9150 # eax = block + 9151 8b/-> *(ebp+8) 0/r32/eax + 9152 # var stmts/eax: (addr list stmt) = lookup(block->statements) + 9153 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax + 9154 # + 9155 { + 9156 $check-mu-block:check-empty: + 9157 3d/compare-eax-and 0/imm32 + 9158 0f 84/jump-if-= break/disp32 + 9159 # emit block->statements + 9160 (check-mu-stmt-list %eax *(ebp+0xc) *(ebp+0x10)) + 9161 } + 9162 $check-mu-block:end: + 9163 # . restore registers + 9164 58/pop-to-eax + 9165 # . epilogue + 9166 89/<- %esp 5/r32/ebp + 9167 5d/pop-to-ebp + 9168 c3/return + 9169 + 9170 check-mu-stmt-list: # stmts: (addr list stmt), err: (addr buffered-file), ed: (addr exit-descriptor) + 9171 # . prologue + 9172 55/push-ebp + 9173 89/<- %ebp 4/r32/esp + 9174 # . save registers + 9175 50/push-eax + 9176 56/push-esi + 9177 # esi = stmts + 9178 8b/-> *(ebp+8) 6/r32/esi + 9179 { + 9180 $check-mu-stmt-list:loop: + 9181 81 7/subop/compare %esi 0/imm32 + 9182 0f 84/jump-if-= break/disp32 + 9183 # var curr-stmt/eax: (addr stmt) = lookup(stmts->value) + 9184 (lookup *esi *(esi+4)) # List-value List-value => eax + 9185 { + 9186 $check-mu-stmt-list:check-for-block: + 9187 81 7/subop/compare *eax 0/imm32/block # Stmt-tag + 9188 75/jump-if-!= break/disp8 + 9189 $check-mu-stmt-list:block: + 9190 (check-mu-block %eax *(ebp+0xc) *(ebp+0x10)) + 9191 eb/jump $check-mu-stmt-list:continue/disp8 + 9192 } + 9193 { + 9194 $check-mu-stmt-list:check-for-stmt1: + 9195 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag + 9196 0f 85/jump-if-!= break/disp32 + 9197 $check-mu-stmt-list:stmt1: + 9198 (check-mu-stmt %eax *(ebp+0xc) *(ebp+0x10)) + 9199 eb/jump $check-mu-stmt-list:continue/disp8 + 9200 } + 9201 { + 9202 $check-mu-stmt-list:check-for-reg-var-def: + 9203 81 7/subop/compare *eax 3/imm32/reg-var-def # Stmt-tag + 9204 0f 85/jump-if-!= break/disp32 + 9205 $check-mu-stmt-list:reg-var-def: + 9206 (check-mu-stmt %eax *(ebp+0xc) *(ebp+0x10)) + 9207 eb/jump $check-mu-stmt-list:continue/disp8 + 9208 } + 9209 $check-mu-stmt-list:continue: + 9210 # TODO: raise an error on unrecognized Stmt-tag + 9211 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax + 9212 89/<- %esi 0/r32/eax + 9213 e9/jump loop/disp32 + 9214 } + 9215 $check-mu-stmt-list:end: + 9216 # . restore registers + 9217 5e/pop-to-esi + 9218 58/pop-to-eax + 9219 # . epilogue + 9220 89/<- %esp 5/r32/ebp + 9221 5d/pop-to-ebp + 9222 c3/return + 9223 + 9224 check-mu-stmt: # stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) + 9225 # . prologue + 9226 55/push-ebp + 9227 89/<- %ebp 4/r32/esp + 9228 # . save registers + 9229 50/push-eax + 9230 51/push-ecx + 9231 52/push-edx + 9232 53/push-ebx + 9233 56/push-esi + 9234 57/push-edi + 9235 # esi = stmt + 9236 8b/-> *(ebp+8) 6/r32/esi + 9237 # var f/edi: (addr function) = lookup(*Program->functions) + 9238 (lookup *_Program-functions *_Program-functions->payload) # => eax + 9239 (find-matching-function %eax *(ebp+8)) # => eax + 9240 89/<- %edi 0/r32/eax + 9241 { + 9242 $check-mu-stmt:check-for-call: + 9243 81 7/subop/compare %edi 0/imm32 + 9244 0f 84/jump-if-= break/disp32 + 9245 $check-mu-stmt:is-call: + 9246 # var inouts/ecx: (addr stmt-var) = lookup(stmt->inouts) + 9247 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax + 9248 89/<- %ecx 0/r32/eax + 9249 # var expected/edx: (addr list var) = lookup(f->inouts) + 9250 (lookup *(edi+8) *(edi+0xc)) # Function-inouts Function-inouts => eax + 9251 89/<- %edx 0/r32/eax + 9252 { + 9253 $check-mu-stmt:check-for-inouts: + 9254 # if (inouts == 0) break + 9255 81 7/subop/compare %ecx 0/imm32 + 9256 0f 84/jump-if-= break/disp32 + 9257 # if (expected == 0) error + 9258 81 7/subop/compare %edx 0/imm32 + 9259 0f 84/jump-if-= break/disp32 + 9260 $check-mu-stmt:check-inout-type: + 9261 # var v/eax: (addr v) = lookup(inouts->value) + 9262 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax + 9263 # var t/ebx: (addr tree type-id) = lookup(v->type) + 9264 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax + 9265 89/<- %ebx 0/r32/eax + 9266 # if (inouts->is-deref?) t = t->right # TODO: check that t->left is an addr + 9267 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref + 9268 { + 9269 74/jump-if-= break/disp8 + 9270 (lookup *(ebx+0xc) *(ebx+0x10)) # Tree-right Tree-right => eax + 9271 89/<- %ebx 0/r32/eax + 9272 # if t->right is null, t = t->left + 9273 81 7/subop/compare *(ebx+0xc) 0/imm32 # Tree-right + 9274 75/jump-if-!= break/disp8 + 9275 (lookup *(ebx+4) *(ebx+8)) # Tree-left Tree-left => eax + 9276 89/<- %ebx 0/r32/eax + 9277 } + 9278 # var v2/eax: (addr v) = lookup(expected->value) + 9279 (lookup *edx *(edx+4)) # List-value List-value => eax + 9280 # var t2/eax: (addr tree type-id) = lookup(v2->type) + 9281 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax + 9282 # if (t != t2) error + 9283 (type-match? %eax %ebx) # => eax + 9284 3d/compare-eax-and 0/imm32/false + 9285 { + 9286 0f 85/jump-if-!= break/disp32 + 9287 (write-buffered *(ebp+0xc) "call ") + 9288 (lookup *edi *(edi+4)) # Function-name Function-name => eax + 9289 (write-buffered *(ebp+0xc) %eax) + 9290 (write-buffered *(ebp+0xc) ": type for inout '") + 9291 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax + 9292 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 9293 (write-buffered *(ebp+0xc) %eax) + 9294 (write-buffered *(ebp+0xc) "' is not right\n") + 9295 (flush *(ebp+0xc)) + 9296 (stop *(ebp+0x10) 1) + 9297 } + 9298 $check-mu-stmt:continue-to-next-inout: + 9299 # inouts = lookup(inouts->next) + 9300 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax + 9301 89/<- %ecx 0/r32/eax + 9302 # expected = lookup(expected->next) + 9303 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 9304 89/<- %edx 0/r32/eax + 9305 # + 9306 e9/jump loop/disp32 + 9307 } + 9308 $check-mu-stmt:check-inout-count: + 9309 # if (inouts == expected) proceed + 9310 39/compare %ecx 2/r32/edx + 9311 { + 9312 0f 84/jump-if-= break/disp32 + 9313 # exactly one of the two is null + 9314 # if (inouts == 0) error("too many args") + 9315 { + 9316 81 7/subop/compare %ecx 0/imm32 + 9317 74/jump-if-= break/disp8 + 9318 (write-buffered *(ebp+0xc) "call ") + 9319 (lookup *edi *(edi+4)) # Function-name Function-name => eax + 9320 (write-buffered *(ebp+0xc) %eax) + 9321 (write-buffered *(ebp+0xc) ": too many inouts\n") + 9322 (flush *(ebp+0xc)) + 9323 (stop *(ebp+0x10) 1) + 9324 } + 9325 # if (expected == 0) error("too few args") + 9326 { + 9327 81 7/subop/compare %edx 0/imm32 + 9328 74/jump-if-= break/disp8 + 9329 (write-buffered *(ebp+0xc) "call ") + 9330 (lookup *edi *(edi+4)) # Function-name Function-name => eax + 9331 (write-buffered *(ebp+0xc) %eax) + 9332 (write-buffered *(ebp+0xc) ": too few inouts\n") + 9333 (flush *(ebp+0xc)) + 9334 (stop *(ebp+0x10) 1) + 9335 } + 9336 } + 9337 $check-mu-stmt:check-outputs: + 9338 # var outputs/ecx: (addr stmt-var) = lookup(stmt->outputs) + 9339 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax + 9340 89/<- %ecx 0/r32/eax + 9341 # var expected/edx: (addr list var) = lookup(f->outputs) + 9342 (lookup *(edi+0x10) *(edi+0x14)) # Function-outputs Function-outputs => eax + 9343 89/<- %edx 0/r32/eax + 9344 { + 9345 $check-mu-stmt:check-for-outputs: + 9346 # if (outputs == 0) break + 9347 81 7/subop/compare %ecx 0/imm32 + 9348 0f 84/jump-if-= break/disp32 + 9349 # if (expected == 0) error + 9350 81 7/subop/compare %edx 0/imm32 + 9351 0f 84/jump-if-= break/disp32 + 9352 $check-mu-stmt:check-output-type: + 9353 # var v/eax: (addr v) = lookup(outputs->value) + 9354 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax + 9355 # var t/ebx: (addr tree type-id) = lookup(v->type) + 9356 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax + 9357 89/<- %ebx 0/r32/eax + 9358 # if (outputs->is-deref?) t = t->right # TODO: check that t->left is an addr + 9359 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref + 9360 { + 9361 74/jump-if-= break/disp8 + 9362 (lookup *(ebx+0xc) *(ebx+0x10)) # Tree-right Tree-right => eax + 9363 89/<- %ebx 0/r32/eax + 9364 } + 9365 # var v2/eax: (addr v) = lookup(expected->value) + 9366 (lookup *edx *(edx+4)) # List-value List-value => eax + 9367 # var t2/eax: (addr tree type-id) = lookup(v2->type) + 9368 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax + 9369 # if (t != t2) error + 9370 (type-equal? %eax %ebx) # => eax + 9371 3d/compare-eax-and 0/imm32/false + 9372 { + 9373 0f 85/jump-if-!= break/disp32 + 9374 (write-buffered *(ebp+0xc) "call ") + 9375 (lookup *edi *(edi+4)) # Function-name Function-name => eax + 9376 (write-buffered *(ebp+0xc) %eax) + 9377 (write-buffered *(ebp+0xc) ": type for output '") + 9378 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax + 9379 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 9380 (write-buffered *(ebp+0xc) %eax) + 9381 (write-buffered *(ebp+0xc) "' is not right\n") + 9382 (flush *(ebp+0xc)) + 9383 (stop *(ebp+0x10) 1) + 9384 } + 9385 $check-mu-stmt:check-output-register: + 9386 # var v/eax: (addr v) = lookup(outputs->value) + 9387 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax + 9388 # var r/ebx: (addr array byte) = lookup(v->register) + 9389 (lookup *(eax+18) *(eax+0x1c)) # Var-register Var-register => eax + 9390 89/<- %ebx 0/r32/eax + 9391 # var v2/eax: (addr v) = lookup(expected->value) + 9392 (lookup *edx *(edx+4)) # Stmt-var-value Stmt-var-value => eax + 9393 # var r2/eax: (addr array byte) = lookup(v2->register) + 9394 (lookup *(eax+18) *(eax+0x1c)) # Var-register Var-register => eax + 9395 # if (r != r2) error + 9396 (string-equal? %eax %ebx) # => eax + 9397 3d/compare-eax-and 0/imm32/false + 9398 { + 9399 0f 85/jump-if-!= break/disp32 + 9400 (write-buffered *(ebp+0xc) "call ") + 9401 (lookup *edi *(edi+4)) # Function-name Function-name => eax + 9402 (write-buffered *(ebp+0xc) %eax) + 9403 (write-buffered *(ebp+0xc) ": register for output '") + 9404 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax + 9405 (lookup *eax *(eax+4)) # Var-name Var-name => eax + 9406 (write-buffered *(ebp+0xc) %eax) + 9407 (write-buffered *(ebp+0xc) "' is not right\n") + 9408 (flush *(ebp+0xc)) + 9409 (stop *(ebp+0x10) 1) + 9410 } + 9411 $check-mu-stmt:continue-to-next-output: + 9412 # outputs = lookup(outputs->next) + 9413 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax + 9414 89/<- %ecx 0/r32/eax + 9415 # expected = lookup(expected->next) + 9416 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax + 9417 89/<- %edx 0/r32/eax + 9418 # + 9419 e9/jump loop/disp32 + 9420 } + 9421 $check-mu-stmt:check-output-count: + 9422 # if (outputs == expected) proceed + 9423 39/compare %ecx 2/r32/edx + 9424 { + 9425 0f 84/jump-if-= break/disp32 + 9426 # exactly one of the two is null + 9427 # if (outputs == 0) error("too many outputs") + 9428 { + 9429 81 7/subop/compare %ecx 0/imm32 + 9430 74/jump-if-= break/disp8 + 9431 (write-buffered *(ebp+0xc) "call ") + 9432 (lookup *edi *(edi+4)) # Function-name Function-name => eax + 9433 (write-buffered *(ebp+0xc) %eax) + 9434 (write-buffered *(ebp+0xc) ": too many outputs\n") + 9435 (flush *(ebp+0xc)) + 9436 (stop *(ebp+0x10) 1) + 9437 } + 9438 # if (expected == 0) error("too few outputs") + 9439 { + 9440 81 7/subop/compare %edx 0/imm32 + 9441 74/jump-if-= break/disp8 + 9442 (write-buffered *(ebp+0xc) "call ") + 9443 (lookup *edi *(edi+4)) # Function-name Function-name => eax + 9444 (write-buffered *(ebp+0xc) %eax) + 9445 (write-buffered *(ebp+0xc) ": too few outputs\n") + 9446 (flush *(ebp+0xc)) + 9447 (stop *(ebp+0x10) 1) + 9448 } + 9449 } + 9450 } + 9451 $check-mu-stmt:end: + 9452 # . restore registers + 9453 5f/pop-to-edi + 9454 5e/pop-to-esi + 9455 5b/pop-to-ebx + 9456 5a/pop-to-edx + 9457 59/pop-to-ecx + 9458 58/pop-to-eax + 9459 # . epilogue + 9460 89/<- %esp 5/r32/ebp + 9461 5d/pop-to-ebp + 9462 c3/return 9463 - 9464 # Table from Mu branch instructions to the reverse SubX opcodes for them. - 9465 Reverse-branch: # (table (handle array byte) (handle array byte)) - 9466 # a table is a stream - 9467 0x140/imm32/write - 9468 0/imm32/read - 9469 0x140/imm32/size - 9470 # data - 9471 0x11/imm32/alloc-id _string-break-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 - 9472 0x11/imm32/alloc-id _string-loop-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 - 9473 0x11/imm32/alloc-id _string-break-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 - 9474 0x11/imm32/alloc-id _string-loop-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 - 9475 0x11/imm32/alloc-id _string-break-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 - 9476 0x11/imm32/alloc-id _string-loop-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 - 9477 0x11/imm32/alloc-id _string-break-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 - 9478 0x11/imm32/alloc-id _string-loop-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 - 9479 0x11/imm32/alloc-id _string-break-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 - 9480 0x11/imm32/alloc-id _string-loop-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 - 9481 0x11/imm32/alloc-id _string-break-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 - 9482 0x11/imm32/alloc-id _string-loop-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 - 9483 0x11/imm32/alloc-id _string-break-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 - 9484 0x11/imm32/alloc-id _string-loop-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 - 9485 0x11/imm32/alloc-id _string-break-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 - 9486 0x11/imm32/alloc-id _string-loop-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 - 9487 0x11/imm32/alloc-id _string-break-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 - 9488 0x11/imm32/alloc-id _string-loop-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 - 9489 0x11/imm32/alloc-id _string-break-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 - 9490 0x11/imm32/alloc-id _string-loop-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 - 9491 - 9492 == code - 9493 - 9494 emit-unconditional-jump-to-depth: # out: (addr buffered-file), vars: (addr stack live-var), depth: int, label-suffix: (addr array byte) - 9495 # . prologue - 9496 55/push-ebp - 9497 89/<- %ebp 4/r32/esp - 9498 # . save registers - 9499 50/push-eax - 9500 51/push-ecx - 9501 52/push-edx - 9502 53/push-ebx - 9503 56/push-esi - 9504 # ecx = vars - 9505 8b/-> *(ebp+0xc) 1/r32/ecx - 9506 # var eax: int = vars->top - 9507 8b/-> *ecx 0/r32/eax - 9508 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] - 9509 8d/copy-address *(ecx+eax-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size - 9510 # var min/ecx: (addr handle var) = vars->data - 9511 8d/copy-address *(ecx+8) 1/r32/ecx - 9512 # edx = depth - 9513 8b/-> *(ebp+0x10) 2/r32/edx - 9514 { - 9515 $emit-unconditional-jump-to-depth:loop: - 9516 # if (curr < min) break - 9517 39/compare %esi 1/r32/ecx - 9518 0f 82/jump-if-addr< break/disp32 - 9519 # var v/ebx: (addr var) = lookup(*curr) - 9520 (lookup *esi *(esi+4)) # => eax - 9521 89/<- %ebx 0/r32/eax - 9522 # if (v->block-depth < until-block-depth) break - 9523 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth - 9524 0f 8c/jump-if-< break/disp32 - 9525 { - 9526 $emit-unconditional-jump-to-depth:check: - 9527 # if v->block-depth != until-block-depth, continue - 9528 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth - 9529 0f 85/jump-if-!= break/disp32 - 9530 $emit-unconditional-jump-to-depth:depth-found: - 9531 # if v is not a literal, continue - 9532 (size-of %ebx) # => eax - 9533 3d/compare-eax-and 0/imm32 - 9534 0f 85/jump-if-!= break/disp32 - 9535 $emit-unconditional-jump-to-depth:label-found: - 9536 # emit unconditional jump, then return - 9537 (emit-indent *(ebp+8) *Curr-block-depth) - 9538 (write-buffered *(ebp+8) "e9/jump ") - 9539 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 9540 (write-buffered *(ebp+8) %eax) - 9541 (write-buffered *(ebp+8) ":") - 9542 (write-buffered *(ebp+8) *(ebp+0x14)) - 9543 (write-buffered *(ebp+8) "/disp32\n") - 9544 eb/jump $emit-unconditional-jump-to-depth:end/disp8 - 9545 } - 9546 # curr -= 12 - 9547 81 5/subop/subtract %esi 0xc/imm32 - 9548 e9/jump loop/disp32 - 9549 } - 9550 # TODO: error if no label at 'depth' was found - 9551 $emit-unconditional-jump-to-depth:end: - 9552 # . restore registers - 9553 5e/pop-to-esi - 9554 5b/pop-to-ebx - 9555 5a/pop-to-edx - 9556 59/pop-to-ecx - 9557 58/pop-to-eax - 9558 # . epilogue - 9559 89/<- %esp 5/r32/ebp - 9560 5d/pop-to-ebp - 9561 c3/return - 9562 - 9563 # emit clean-up code for 'vars' until some block depth - 9564 # doesn't actually modify 'vars' so we need traverse manually inside the stack - 9565 emit-cleanup-code-until-depth: # out: (addr buffered-file), vars: (addr stack live-var), until-block-depth: int - 9566 # . prologue - 9567 55/push-ebp - 9568 89/<- %ebp 4/r32/esp - 9569 # . save registers - 9570 50/push-eax - 9571 51/push-ecx - 9572 52/push-edx - 9573 53/push-ebx - 9574 56/push-esi - 9575 #? (write-buffered Stderr "--- cleanup\n") - 9576 #? (flush Stderr) - 9577 # ecx = vars - 9578 8b/-> *(ebp+0xc) 1/r32/ecx - 9579 # var esi: int = vars->top - 9580 8b/-> *ecx 6/r32/esi - 9581 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] - 9582 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size - 9583 # var min/ecx: (addr handle var) = vars->data - 9584 81 0/subop/add %ecx 8/imm32 - 9585 # edx = until-block-depth - 9586 8b/-> *(ebp+0x10) 2/r32/edx - 9587 { - 9588 $emit-cleanup-code-until-depth:loop: - 9589 # if (curr < min) break - 9590 39/compare %esi 1/r32/ecx - 9591 0f 82/jump-if-addr< break/disp32 - 9592 # var v/ebx: (addr var) = lookup(*curr) - 9593 (lookup *esi *(esi+4)) # => eax - 9594 89/<- %ebx 0/r32/eax - 9595 #? (lookup *ebx *(ebx+4)) # Var-name - 9596 #? (write-buffered Stderr "var ") - 9597 #? (write-buffered Stderr %eax) - 9598 #? (write-buffered Stderr Newline) - 9599 #? (flush Stderr) - 9600 # if (v->block-depth < until-block-depth) break - 9601 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth - 9602 0f 8c/jump-if-< break/disp32 - 9603 # if v is in a register - 9604 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register - 9605 { - 9606 0f 84/jump-if-= break/disp32 - 9607 { - 9608 $emit-cleanup-code-until-depth:check-for-previous-spill: - 9609 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled - 9610 3d/compare-eax-and 0/imm32/false - 9611 74/jump-if-= break/disp8 - 9612 $emit-cleanup-code-until-depth:reclaim-var-in-register: - 9613 (emit-indent *(ebp+8) *Curr-block-depth) - 9614 (write-buffered *(ebp+8) "8f 0/subop/pop %") - 9615 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax - 9616 (write-buffered *(ebp+8) %eax) - 9617 (write-buffered *(ebp+8) Newline) - 9618 } - 9619 eb/jump $emit-cleanup-code-until-depth:continue/disp8 - 9620 } - 9621 # otherwise v is on the stack - 9622 { - 9623 75/jump-if-!= break/disp8 - 9624 $emit-cleanup-code-until-depth:var-on-stack: - 9625 (size-of %ebx) # => eax - 9626 # don't emit code for labels - 9627 3d/compare-eax-and 0/imm32 - 9628 74/jump-if-= break/disp8 - 9629 $emit-cleanup-code-until-depth:reclaim-var-on-stack: - 9630 (emit-indent *(ebp+8) *Curr-block-depth) - 9631 (write-buffered *(ebp+8) "81 0/subop/add %esp ") - 9632 (print-int32-buffered *(ebp+8) %eax) - 9633 (write-buffered *(ebp+8) "/imm32\n") - 9634 } - 9635 $emit-cleanup-code-until-depth:continue: - 9636 # curr -= 12 - 9637 81 5/subop/subtract %esi 0xc/imm32 - 9638 e9/jump loop/disp32 - 9639 } - 9640 $emit-cleanup-code-until-depth:end: - 9641 # . restore registers - 9642 5e/pop-to-esi - 9643 5b/pop-to-ebx - 9644 5a/pop-to-edx - 9645 59/pop-to-ecx - 9646 58/pop-to-eax - 9647 # . epilogue - 9648 89/<- %esp 5/r32/ebp - 9649 5d/pop-to-ebp - 9650 c3/return - 9651 - 9652 # emit clean-up code for 'vars' until a given label is encountered - 9653 # doesn't actually modify 'vars' so we need traverse manually inside the stack - 9654 emit-cleanup-code-until-target: # out: (addr buffered-file), vars: (addr stack live-var), until-block-label: (addr array byte) - 9655 # . prologue - 9656 55/push-ebp - 9657 89/<- %ebp 4/r32/esp - 9658 # . save registers - 9659 50/push-eax - 9660 51/push-ecx - 9661 52/push-edx - 9662 53/push-ebx - 9663 # ecx = vars - 9664 8b/-> *(ebp+0xc) 1/r32/ecx - 9665 # var eax: int = vars->top - 9666 8b/-> *ecx 0/r32/eax - 9667 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] - 9668 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size - 9669 # var min/ecx: (addr handle var) = vars->data - 9670 81 0/subop/add %ecx 8/imm32 - 9671 { - 9672 $emit-cleanup-code-until-target:loop: - 9673 # if (curr < min) break - 9674 39/compare %edx 1/r32/ecx - 9675 0f 82/jump-if-addr< break/disp32 - 9676 # var v/ebx: (handle var) = lookup(*curr) - 9677 (lookup *edx *(edx+4)) # => eax - 9678 89/<- %ebx 0/r32/eax - 9679 # if (v->name == until-block-label) break - 9680 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax - 9681 (string-equal? %eax *(ebp+0x10)) # => eax - 9682 3d/compare-eax-and 0/imm32/false - 9683 0f 85/jump-if-!= break/disp32 - 9684 # if v is in a register - 9685 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register - 9686 { - 9687 0f 84/jump-if-= break/disp32 - 9688 { - 9689 $emit-cleanup-code-until-target:check-for-previous-spill: - 9690 8b/-> *(edx+8) 0/r32/eax # Live-var-register-spilled - 9691 3d/compare-eax-and 0/imm32/false - 9692 74/jump-if-= break/disp8 - 9693 $emit-cleanup-code-until-target:reclaim-var-in-register: - 9694 (emit-indent *(ebp+8) *Curr-block-depth) - 9695 (write-buffered *(ebp+8) "8f 0/subop/pop %") - 9696 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax - 9697 (write-buffered *(ebp+8) %eax) - 9698 (write-buffered *(ebp+8) Newline) - 9699 } - 9700 eb/jump $emit-cleanup-code-until-target:continue/disp8 - 9701 } - 9702 # otherwise v is on the stack - 9703 { - 9704 75/jump-if-!= break/disp8 - 9705 $emit-cleanup-code-until-target:reclaim-var-on-stack: - 9706 (size-of %ebx) # => eax - 9707 # don't emit code for labels - 9708 3d/compare-eax-and 0/imm32 - 9709 74/jump-if-= break/disp8 - 9710 # - 9711 (emit-indent *(ebp+8) *Curr-block-depth) - 9712 (write-buffered *(ebp+8) "81 0/subop/add %esp ") - 9713 (print-int32-buffered *(ebp+8) %eax) - 9714 (write-buffered *(ebp+8) "/imm32\n") - 9715 } - 9716 $emit-cleanup-code-until-target:continue: - 9717 # curr -= 12 - 9718 81 5/subop/subtract %edx 0xc/imm32 - 9719 e9/jump loop/disp32 - 9720 } - 9721 $emit-cleanup-code-until-target:end: - 9722 # . restore registers - 9723 5b/pop-to-ebx - 9724 5a/pop-to-edx - 9725 59/pop-to-ecx - 9726 58/pop-to-eax - 9727 # . epilogue - 9728 89/<- %esp 5/r32/ebp - 9729 5d/pop-to-ebp - 9730 c3/return - 9731 - 9732 # Return true if there isn't a variable in 'vars' with the same block-depth - 9733 # and register as 'v'. - 9734 # 'v' is guaranteed not to be within 'vars'. - 9735 not-yet-spilled-this-block?: # v: (addr var), vars: (addr stack live-var) -> result/eax: boolean - 9736 # . prologue - 9737 55/push-ebp - 9738 89/<- %ebp 4/r32/esp - 9739 # . save registers - 9740 51/push-ecx - 9741 52/push-edx - 9742 53/push-ebx - 9743 56/push-esi - 9744 57/push-edi - 9745 # ecx = vars - 9746 8b/-> *(ebp+0xc) 1/r32/ecx - 9747 # var eax: int = vars->top - 9748 8b/-> *ecx 0/r32/eax - 9749 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] - 9750 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size - 9751 # var min/ecx: (addr handle var) = vars->data - 9752 8d/copy-address *(ecx+8) 1/r32/ecx - 9753 # var depth/ebx: int = v->block-depth - 9754 8b/-> *(ebp+8) 3/r32/ebx - 9755 8b/-> *(ebx+0x10) 3/r32/ebx # Var-block-depth - 9756 # var needle/esi: (addr array byte) = v->register - 9757 8b/-> *(ebp+8) 6/r32/esi - 9758 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax - 9759 89/<- %esi 0/r32/eax - 9760 { - 9761 $not-yet-spilled-this-block?:loop: - 9762 # if (curr < min) break - 9763 39/compare %edx 1/r32/ecx - 9764 0f 82/jump-if-addr< break/disp32 - 9765 # var cand/edi: (addr var) = lookup(*curr) - 9766 (lookup *edx *(edx+4)) # => eax - 9767 89/<- %edi 0/r32/eax - 9768 # if (cand->block-depth < depth) break - 9769 39/compare *(edi+0x10) 3/r32/ebx # Var-block-depth - 9770 0f 8c/jump-if-< break/disp32 - 9771 # var cand-reg/edi: (array array byte) = cand->reg - 9772 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax - 9773 89/<- %edi 0/r32/eax - 9774 # if (cand-reg == null) continue - 9775 { - 9776 $not-yet-spilled-this-block?:check-reg: - 9777 81 7/subop/compare %edi 0/imm32 - 9778 0f 84/jump-if-= break/disp32 - 9779 # if (cand-reg == needle) return true - 9780 (string-equal? %esi %edi) # => eax - 9781 3d/compare-eax-and 0/imm32/false - 9782 74/jump-if-= break/disp8 - 9783 $not-yet-spilled-this-block?:return-false: - 9784 b8/copy-to-eax 0/imm32/false - 9785 eb/jump $not-yet-spilled-this-block?:end/disp8 - 9786 } - 9787 $not-yet-spilled-this-block?:continue: - 9788 # curr -= 12 - 9789 81 5/subop/subtract %edx 0xc/imm32 - 9790 e9/jump loop/disp32 - 9791 } - 9792 $not-yet-spilled-this-block?:return-true: - 9793 # return true - 9794 b8/copy-to-eax 1/imm32/true - 9795 $not-yet-spilled-this-block?:end: - 9796 # . restore registers - 9797 5f/pop-to-edi - 9798 5e/pop-to-esi - 9799 5b/pop-to-ebx - 9800 5a/pop-to-edx - 9801 59/pop-to-ecx - 9802 # . epilogue - 9803 89/<- %esp 5/r32/ebp - 9804 5d/pop-to-ebp - 9805 c3/return - 9806 - 9807 # could the register of 'v' ever be written to by one of the vars in fn-outputs? - 9808 will-not-write-some-register?: # v: (addr var), stmts: (addr list stmt), fn-outputs: (addr list var) -> result/eax: boolean - 9809 # . prologue - 9810 55/push-ebp - 9811 89/<- %ebp 4/r32/esp - 9812 # eax = v - 9813 8b/-> *(ebp+8) 0/r32/eax - 9814 # var reg/eax: (addr array byte) = lookup(v->register) - 9815 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax - 9816 # var target/eax: (addr var) = find-register(fn-outputs, reg) - 9817 (find-register *(ebp+0x10) %eax) # => eax - 9818 # if (target == 0) return true - 9819 { - 9820 3d/compare-eax-and 0/imm32 - 9821 75/jump-if-!= break/disp8 - 9822 b8/copy-to-eax 1/imm32/true - 9823 eb/jump $will-not-write-some-register?:end/disp8 - 9824 } - 9825 # return !assigns-in-stmts?(stmts, target) - 9826 (assigns-in-stmts? *(ebp+0xc) %eax) # => eax - 9827 3d/compare-eax-and 0/imm32/false - 9828 # assume: true = 1, so no need to mask with 0x000000ff - 9829 0f 94/set-if-= %al - 9830 $will-not-write-some-register?:end: - 9831 # . epilogue - 9832 89/<- %esp 5/r32/ebp - 9833 5d/pop-to-ebp - 9834 c3/return - 9835 - 9836 # return output var with matching register - 9837 # always returns false if 'reg' is null - 9838 find-register: # fn-outputs: (addr list var), reg: (addr array byte) -> result/eax: (addr var) - 9839 # . prologue - 9840 55/push-ebp - 9841 89/<- %ebp 4/r32/esp - 9842 # . save registers - 9843 51/push-ecx - 9844 # var curr/ecx: (addr list var) = fn-outputs - 9845 8b/-> *(ebp+8) 1/r32/ecx - 9846 { - 9847 $find-register:loop: - 9848 # if (curr == 0) break - 9849 81 7/subop/compare %ecx 0/imm32 - 9850 74/jump-if-= break/disp8 - 9851 # eax = curr->value->register - 9852 (lookup *ecx *(ecx+4)) # List-value List-value => eax - 9853 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax - 9854 # if (eax == reg) return curr->value - 9855 $find-register:compare: - 9856 (string-equal? *(ebp+0xc) %eax) # => eax - 9857 { - 9858 3d/compare-eax-and 0/imm32/false - 9859 74/jump-if-= break/disp8 - 9860 $find-register:found: - 9861 (lookup *ecx *(ecx+4)) # List-value List-value => eax - 9862 eb/jump $find-register:end/disp8 - 9863 } - 9864 # curr = lookup(curr->next) - 9865 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax - 9866 89/<- %ecx 0/r32/eax - 9867 # - 9868 eb/jump loop/disp8 - 9869 } - 9870 $find-register:end: - 9871 # . restore registers - 9872 59/pop-to-ecx - 9873 # . epilogue - 9874 89/<- %esp 5/r32/ebp - 9875 5d/pop-to-ebp - 9876 c3/return - 9877 - 9878 assigns-in-stmts?: # stmts: (addr list stmt), v: (addr var) -> result/eax: boolean - 9879 # . prologue - 9880 55/push-ebp - 9881 89/<- %ebp 4/r32/esp - 9882 # . save registers - 9883 51/push-ecx - 9884 # var curr/ecx: (addr list stmt) = stmts - 9885 8b/-> *(ebp+8) 1/r32/ecx - 9886 { - 9887 # if (curr == 0) break - 9888 81 7/subop/compare %ecx 0/imm32 - 9889 74/jump-if-= break/disp8 - 9890 # if assigns-in-stmt?(curr->value, v) return true - 9891 (lookup *ecx *(ecx+4)) # List-value List-value => eax - 9892 (assigns-in-stmt? %eax *(ebp+0xc)) # => eax - 9893 3d/compare-eax-and 0/imm32/false - 9894 75/jump-if-!= break/disp8 - 9895 # curr = lookup(curr->next) - 9896 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax - 9897 89/<- %ecx 0/r32/eax - 9898 # - 9899 eb/jump loop/disp8 - 9900 } - 9901 $assigns-in-stmts?:end: - 9902 # . restore registers - 9903 59/pop-to-ecx - 9904 # . epilogue - 9905 89/<- %esp 5/r32/ebp - 9906 5d/pop-to-ebp - 9907 c3/return - 9908 - 9909 assigns-in-stmt?: # stmt: (addr stmt), v: (addr var) -> result/eax: boolean - 9910 # . prologue - 9911 55/push-ebp - 9912 89/<- %ebp 4/r32/esp - 9913 # . save registers - 9914 51/push-ecx - 9915 # ecx = stmt - 9916 8b/-> *(ebp+8) 1/r32/ecx - 9917 # if stmt is a stmt1, return assigns-in-stmt-vars?(stmt->outputs, v) - 9918 { - 9919 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag - 9920 75/jump-if-!= break/disp8 - 9921 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax - 9922 (assigns-in-stmt-vars? %eax *(ebp+0xc)) # => eax - 9923 eb/jump $assigns-in-stmt?:end/disp8 - 9924 } - 9925 # if stmt is a block, return assigns-in-stmts?(stmt->stmts, v) - 9926 { - 9927 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag - 9928 75/jump-if-!= break/disp8 - 9929 (lookup *(ecx+4) *(ecx+8)) # Block-stmts Block-stmts => eax - 9930 (assigns-in-stmts? %eax *(ebp+0xc)) # => eax - 9931 eb/jump $assigns-in-stmt?:end/disp8 - 9932 } - 9933 # otherwise return false - 9934 b8/copy 0/imm32/false - 9935 $assigns-in-stmt?:end: - 9936 # . restore registers - 9937 59/pop-to-ecx - 9938 # . epilogue - 9939 89/<- %esp 5/r32/ebp - 9940 5d/pop-to-ebp - 9941 c3/return - 9942 - 9943 assigns-in-stmt-vars?: # stmt-var: (addr stmt-var), v: (addr var) -> result/eax: boolean - 9944 # . prologue - 9945 55/push-ebp - 9946 89/<- %ebp 4/r32/esp - 9947 # . save registers - 9948 51/push-ecx - 9949 # var curr/ecx: (addr stmt-var) = stmt-var - 9950 8b/-> *(ebp+8) 1/r32/ecx - 9951 { - 9952 # if (curr == 0) break - 9953 81 7/subop/compare %ecx 0/imm32 - 9954 74/jump-if-= break/disp8 - 9955 # eax = lookup(curr->value) - 9956 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax - 9957 # if (eax == v && curr->is-deref? == false) return true - 9958 { - 9959 39/compare *(ebp+0xc) 0/r32/eax - 9960 75/jump-if-!= break/disp8 - 9961 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref - 9962 75/jump-if-!= break/disp8 - 9963 b8/copy-to-eax 1/imm32/true - 9964 eb/jump $assigns-in-stmt-vars?:end/disp8 - 9965 } - 9966 # curr = lookup(curr->next) - 9967 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax - 9968 89/<- %ecx 0/r32/eax - 9969 # - 9970 eb/jump loop/disp8 - 9971 } - 9972 $assigns-in-stmt-vars?:end: - 9973 # . restore registers - 9974 59/pop-to-ecx - 9975 # . epilogue - 9976 89/<- %esp 5/r32/ebp - 9977 5d/pop-to-ebp - 9978 c3/return - 9979 - 9980 # is there a var before 'v' with the same block-depth and register on the 'vars' stack? - 9981 # v is guaranteed to be within vars - 9982 # 'start' is provided as an optimization, a pointer within vars - 9983 # *start == v - 9984 same-register-spilled-before?: # v: (addr var), vars: (addr stack (handle var)), start: (addr var) -> result/eax: boolean - 9985 # . prologue - 9986 55/push-ebp - 9987 89/<- %ebp 4/r32/esp - 9988 # . save registers - 9989 51/push-ecx - 9990 52/push-edx - 9991 53/push-ebx - 9992 56/push-esi - 9993 57/push-edi - 9994 # ecx = v - 9995 8b/-> *(ebp+8) 1/r32/ecx - 9996 # var reg/edx: (addr array byte) = lookup(v->register) - 9997 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax - 9998 89/<- %edx 0/r32/eax - 9999 # var depth/ebx: int = v->block-depth -10000 8b/-> *(ecx+0x10) 3/r32/ebx # Var-block-depth -10001 # var min/ecx: (addr handle var) = vars->data -10002 8b/-> *(ebp+0xc) 1/r32/ecx -10003 81 0/subop/add %ecx 8/imm32 -10004 # TODO: check that start >= min and start < &vars->data[top] -10005 # TODO: check that *start == v -10006 # var curr/esi: (addr handle var) = start -10007 8b/-> *(ebp+0x10) 6/r32/esi -10008 # curr -= 8 -10009 81 5/subop/subtract %esi 8/imm32 -10010 { -10011 $same-register-spilled-before?:loop: -10012 # if (curr < min) break -10013 39/compare %esi 1/r32/ecx -10014 0f 82/jump-if-addr< break/disp32 -10015 # var x/eax: (addr var) = lookup(*curr) -10016 (lookup *esi *(esi+4)) # => eax -10017 # if (x->block-depth < depth) break -10018 39/compare *(eax+0x10) 3/r32/ebx # Var-block-depth -10019 0f 8c/jump-if-< break/disp32 -10020 # if (x->register == 0) continue -10021 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -10022 74/jump-if-= $same-register-spilled-before?:continue/disp8 -10023 # if (x->register == reg) return true -10024 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -10025 (string-equal? %eax %edx) # => eax -10026 3d/compare-eax-and 0/imm32/false -10027 b8/copy-to-eax 1/imm32/true -10028 75/jump-if-!= $same-register-spilled-before?:end/disp8 -10029 $same-register-spilled-before?:continue: -10030 # curr -= 8 -10031 81 5/subop/subtract %esi 8/imm32 -10032 e9/jump loop/disp32 -10033 } -10034 $same-register-spilled-before?:false: -10035 b8/copy-to-eax 0/imm32/false -10036 $same-register-spilled-before?:end: -10037 # . restore registers -10038 5f/pop-to-edi -10039 5e/pop-to-esi -10040 5b/pop-to-ebx -10041 5a/pop-to-edx -10042 59/pop-to-ecx -10043 # . epilogue -10044 89/<- %esp 5/r32/ebp -10045 5d/pop-to-ebp -10046 c3/return -10047 -10048 # clean up global state for 'vars' until some block depth -10049 clean-up-blocks: # vars: (addr stack live-var), until-block-depth: int -10050 # . prologue -10051 55/push-ebp -10052 89/<- %ebp 4/r32/esp -10053 # . save registers -10054 50/push-eax -10055 51/push-ecx -10056 56/push-esi -10057 # esi = vars -10058 8b/-> *(ebp+8) 6/r32/esi -10059 # ecx = until-block-depth -10060 8b/-> *(ebp+0xc) 1/r32/ecx -10061 { -10062 $clean-up-blocks:reclaim-loop: -10063 # if (vars->top <= 0) break -10064 8b/-> *esi 0/r32/eax # Stack-top -10065 3d/compare-eax-and 0/imm32 -10066 0f 8e/jump-if-<= break/disp32 -10067 # var v/eax: (addr var) = lookup(vars[vars->top-12]) -10068 #? (print-int32-buffered Stderr %eax) -10069 #? (write-buffered Stderr ": ") -10070 #? (print-int32-buffered Stderr *(esi+eax-4)) -10071 #? (write-buffered Stderr " ") -10072 #? (print-int32-buffered Stderr *(esi+eax)) -10073 #? (write-buffered Stderr " ") -10074 #? (print-int32-buffered Stderr *(esi+eax+4)) -10075 #? (write-buffered Stderr Newline) -10076 #? (flush Stderr) -10077 (lookup *(esi+eax-4) *(esi+eax)) # vars + 8 + vars->top - 12 => eax -10078 # if (v->block-depth < until-block-depth) break -10079 39/compare *(eax+0x10) 1/r32/ecx # Var-block-depth -10080 7c/jump-if-< break/disp8 -10081 # if v is on the stack, update Curr-local-stack-offset -10082 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -10083 { -10084 75/jump-if-!= break/disp8 -10085 $clean-up-blocks:reclaim-var-on-stack: -10086 (size-of %eax) # => eax -10087 01/add-to *Curr-local-stack-offset 0/r32/eax -10088 } -10089 (pop %esi) # => eax -10090 (pop %esi) # => eax -10091 (pop %esi) # => eax -10092 e9/jump loop/disp32 -10093 } -10094 $clean-up-blocks:end: -10095 # . restore registers -10096 5e/pop-to-esi -10097 59/pop-to-ecx -10098 58/pop-to-eax -10099 # . epilogue -10100 89/<- %esp 5/r32/ebp -10101 5d/pop-to-ebp -10102 c3/return -10103 -10104 emit-subx-var-def: # out: (addr buffered-file), stmt: (addr stmt) -10105 # . prologue -10106 55/push-ebp -10107 89/<- %ebp 4/r32/esp -10108 # . save registers -10109 50/push-eax -10110 51/push-ecx -10111 52/push-edx -10112 # eax = stmt -10113 8b/-> *(ebp+0xc) 0/r32/eax -10114 # var v/ecx: (addr var) -10115 (lookup *(eax+4) *(eax+8)) # Vardef-var Vardef-var => eax -10116 89/<- %ecx 0/r32/eax -10117 # v->block-depth = *Curr-block-depth -10118 8b/-> *Curr-block-depth 0/r32/eax -10119 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth -10120 # var n/edx: int = size-of(stmt->var) -10121 (size-of %ecx) # => eax -10122 89/<- %edx 0/r32/eax -10123 # *Curr-local-stack-offset -= n -10124 29/subtract-from *Curr-local-stack-offset 2/r32/edx -10125 # v->offset = *Curr-local-stack-offset -10126 8b/-> *Curr-local-stack-offset 0/r32/eax -10127 89/<- *(ecx+0x14) 0/r32/eax # Var-offset -10128 # if v is an array, do something special -10129 { -10130 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -10131 (is-mu-array? %eax) # => eax -10132 3d/compare-eax-and 0/imm32/false -10133 0f 84/jump-if-= break/disp32 -10134 # var array-size-without-size/edx: int = n-4 -10135 81 5/subop/subtract %edx 4/imm32 -10136 (emit-indent *(ebp+8) *Curr-block-depth) -10137 (write-buffered *(ebp+8) "(push-n-zero-bytes ") -10138 (print-int32-buffered *(ebp+8) %edx) -10139 (write-buffered *(ebp+8) ")\n") -10140 (emit-indent *(ebp+8) *Curr-block-depth) -10141 (write-buffered *(ebp+8) "68/push ") -10142 (print-int32-buffered *(ebp+8) %edx) -10143 (write-buffered *(ebp+8) "/imm32\n") -10144 eb/jump $emit-subx-var-def:end/disp8 -10145 } -10146 # while n > 0 -10147 { -10148 81 7/subop/compare %edx 0/imm32 -10149 7e/jump-if-<= break/disp8 -10150 (emit-indent *(ebp+8) *Curr-block-depth) -10151 (write-buffered *(ebp+8) "68/push 0/imm32\n") -10152 # n -= 4 -10153 81 5/subop/subtract %edx 4/imm32 -10154 # -10155 eb/jump loop/disp8 -10156 } -10157 $emit-subx-var-def:end: -10158 # . restore registers -10159 5a/pop-to-edx -10160 59/pop-to-ecx -10161 58/pop-to-eax -10162 # . epilogue -10163 89/<- %esp 5/r32/ebp -10164 5d/pop-to-ebp -10165 c3/return -10166 -10167 emit-subx-stmt: # out: (addr buffered-file), stmt: (addr stmt), primitives: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) -10168 # . prologue -10169 55/push-ebp -10170 89/<- %ebp 4/r32/esp -10171 # . save registers -10172 50/push-eax -10173 51/push-ecx -10174 # - some special-case primitives that don't actually use the 'primitives' data structure -10175 # var op/ecx: (addr array byte) = lookup(stmt->operation) -10176 8b/-> *(ebp+0xc) 1/r32/ecx -10177 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -10178 89/<- %ecx 0/r32/eax -10179 # array size -10180 { -10181 # if (!string-equal?(stmt->operation, "length")) break -10182 (string-equal? %ecx "length") # => eax -10183 3d/compare-eax-and 0/imm32 -10184 0f 84/jump-if-= break/disp32 -10185 (translate-mu-length-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -10186 e9/jump $emit-subx-stmt:end/disp32 -10187 } -10188 # index into array -10189 { -10190 # if (!string-equal?(stmt->operation, "index")) break -10191 (string-equal? %ecx "index") # => eax -10192 3d/compare-eax-and 0/imm32 -10193 0f 84/jump-if-= break/disp32 -10194 (translate-mu-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -10195 e9/jump $emit-subx-stmt:end/disp32 -10196 } -10197 # compute-offset for index into array -10198 { -10199 # if (!string-equal?(stmt->operation, "compute-offset")) break -10200 (string-equal? %ecx "compute-offset") # => eax -10201 3d/compare-eax-and 0/imm32 -10202 0f 84/jump-if-= break/disp32 -10203 (translate-mu-compute-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -10204 e9/jump $emit-subx-stmt:end/disp32 -10205 } -10206 # get field from record -10207 { -10208 # if (!string-equal?(stmt->operation, "get")) break -10209 (string-equal? %ecx "get") # => eax -10210 3d/compare-eax-and 0/imm32 -10211 0f 84/jump-if-= break/disp32 -10212 (translate-mu-get-stmt *(ebp+8) *(ebp+0xc)) -10213 e9/jump $emit-subx-stmt:end/disp32 -10214 } -10215 # - if stmt matches a primitive, emit it -10216 { -10217 $emit-subx-stmt:check-for-primitive: -10218 # var curr/eax: (addr primitive) -10219 (find-matching-primitive *(ebp+0x10) *(ebp+0xc)) # primitives, stmt => eax -10220 3d/compare-eax-and 0/imm32 -10221 74/jump-if-= break/disp8 -10222 $emit-subx-stmt:primitive: -10223 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax) # out, stmt, curr -10224 e9/jump $emit-subx-stmt:end/disp32 -10225 } -10226 # - otherwise emit a call -10227 # TODO: type-checking -10228 $emit-subx-stmt:call: -10229 (emit-call *(ebp+8) *(ebp+0xc)) -10230 $emit-subx-stmt:end: -10231 # . restore registers -10232 59/pop-to-ecx -10233 58/pop-to-eax -10234 # . epilogue -10235 89/<- %esp 5/r32/ebp -10236 5d/pop-to-ebp -10237 c3/return -10238 -10239 translate-mu-length-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -10240 # . prologue -10241 55/push-ebp -10242 89/<- %ebp 4/r32/esp -10243 # . save registers -10244 50/push-eax -10245 51/push-ecx -10246 52/push-edx -10247 53/push-ebx -10248 56/push-esi -10249 # esi = stmt -10250 8b/-> *(ebp+0xc) 6/r32/esi -10251 # var base/ebx: (addr var) = stmt->inouts[0]->value -10252 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -10253 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10254 89/<- %ebx 0/r32/eax -10255 # var elemsize/ecx: int = array-element-size(base) -10256 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -10257 89/<- %ecx 0/r32/eax -10258 # var outreg/edx: (addr array byte) = stmt->outputs[0]->value->register -10259 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -10260 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10261 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -10262 89/<- %edx 0/r32/eax -10263 # if elemsize == 1 -10264 { -10265 81 7/subop/compare %ecx 1/imm32 -10266 75/jump-if-!= break/disp8 -10267 $translate-mu-length-stmt:size-1: -10268 (emit-save-size-to *(ebp+8) %ebx %edx) -10269 e9/jump $translate-mu-length-stmt:end/disp32 -10270 } -10271 # if elemsize is a power of 2 less than 256 -10272 { -10273 (power-of-2? %ecx *(ebp+0x10) *(ebp+0x14)) # => eax -10274 3d/compare-eax-and 0/imm32/false -10275 74/jump-if-= break/disp8 -10276 81 7/subop/compare %ecx 0xff/imm32 -10277 7f/jump-if-> break/disp8 -10278 $translate-mu-length-stmt:size-power-of-2: -10279 (emit-save-size-to *(ebp+8) %ebx %edx) -10280 (emit-divide-by-shift-right *(ebp+8) %edx %ecx) -10281 e9/jump $translate-mu-length-stmt:end/disp32 -10282 } -10283 # otherwise, the complex case -10284 # . emit register spills -10285 { -10286 $translate-mu-length-stmt:complex: -10287 (string-equal? %edx "eax") # => eax -10288 3d/compare-eax-and 0/imm32/false -10289 75/break-if-!= break/disp8 -10290 (emit-indent *(ebp+8) *Curr-block-depth) -10291 (write-buffered *(ebp+8) "50/push-eax\n") -10292 } -10293 { -10294 (string-equal? %edx "ecx") # => eax -10295 3d/compare-eax-and 0/imm32/false -10296 75/break-if-!= break/disp8 -10297 (emit-indent *(ebp+8) *Curr-block-depth) -10298 (write-buffered *(ebp+8) "51/push-ecx\n") -10299 } -10300 { -10301 (string-equal? %edx "edx") # => eax -10302 3d/compare-eax-and 0/imm32/false -10303 75/break-if-!= break/disp8 -10304 (emit-indent *(ebp+8) *Curr-block-depth) -10305 (write-buffered *(ebp+8) "52/push-edx\n") -10306 } -10307 # . -10308 (emit-save-size-to *(ebp+8) %ebx "eax") -10309 (emit-indent *(ebp+8) *Curr-block-depth) -10310 (write-buffered *(ebp+8) "31/xor %edx 2/r32/edx\n") -10311 (emit-indent *(ebp+8) *Curr-block-depth) -10312 (write-buffered *(ebp+8) "b9/copy-to-ecx ") -10313 (print-int32-buffered *(ebp+8) %ecx) -10314 (write-buffered *(ebp+8) "/imm32\n") -10315 (emit-indent *(ebp+8) *Curr-block-depth) -10316 (write-buffered *(ebp+8) "f7 7/subop/idiv-eax-edx-by %ecx\n") -10317 { -10318 (string-equal? %edx "eax") # => eax -10319 3d/compare-eax-and 0/imm32/false -10320 75/break-if-!= break/disp8 -10321 (emit-indent *(ebp+8) *Curr-block-depth) -10322 (write-buffered *(ebp+8) "89/<- %") -10323 (write-buffered *(ebp+8) %edx) -10324 (write-buffered *(ebp+8) " 0/r32/eax\n") -10325 } -10326 # . emit register restores -10327 { -10328 (string-equal? %edx "edx") # => eax -10329 3d/compare-eax-and 0/imm32/false -10330 75/break-if-!= break/disp8 -10331 (emit-indent *(ebp+8) *Curr-block-depth) -10332 (write-buffered *(ebp+8) "5a/pop-to-edx\n") -10333 } -10334 { -10335 (string-equal? %edx "ecx") # => eax -10336 3d/compare-eax-and 0/imm32/false -10337 75/break-if-!= break/disp8 -10338 (emit-indent *(ebp+8) *Curr-block-depth) -10339 (write-buffered *(ebp+8) "59/pop-to-ecx\n") -10340 } -10341 { -10342 (string-equal? %edx "eax") # => eax -10343 3d/compare-eax-and 0/imm32/false -10344 75/break-if-!= break/disp8 -10345 (emit-indent *(ebp+8) *Curr-block-depth) -10346 (write-buffered *(ebp+8) "58/pop-to-eax\n") -10347 } -10348 $translate-mu-length-stmt:end: -10349 # . restore registers -10350 5e/pop-to-esi -10351 5b/pop-to-ebx -10352 5a/pop-to-edx -10353 59/pop-to-ecx -10354 58/pop-to-eax -10355 # . epilogue -10356 89/<- %esp 5/r32/ebp -10357 5d/pop-to-ebp -10358 c3/return -10359 -10360 array-element-size: # arr: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -10361 # . prologue -10362 55/push-ebp -10363 89/<- %ebp 4/r32/esp -10364 # -10365 (array-element-type-id *(ebp+8) *(ebp+0xc) *(ebp+0x10)) # => eax -10366 (size-of-type-id-as-array-element %eax) # => eax -10367 $array-element-size:end: -10368 # . epilogue -10369 89/<- %esp 5/r32/ebp -10370 5d/pop-to-ebp -10371 c3/return -10372 -10373 size-of-type-id-as-array-element: # t: type-id -> result/eax: int -10374 # . prologue -10375 55/push-ebp -10376 89/<- %ebp 4/r32/esp -10377 # eax = t -10378 8b/-> *(ebp+8) 0/r32/eax -10379 # if t is 'byte', size is 1 -10380 3d/compare-eax-and 8/imm32/byte -10381 { -10382 75/jump-if-!= break/disp8 -10383 b8/copy-to-eax 1/imm32 -10384 eb/jump $array-element-size:end/disp8 -10385 } -10386 # otherwise proceed as usual -10387 (size-of-type-id %eax) # => eax -10388 $size-of-type-id-as-array-element:end: -10389 # . epilogue -10390 89/<- %esp 5/r32/ebp -10391 5d/pop-to-ebp -10392 c3/return -10393 -10394 emit-save-size-to: # out: (addr buffered-file), base: (addr var), outreg: (addr array byte) -10395 # . prologue -10396 55/push-ebp -10397 89/<- %ebp 4/r32/esp -10398 # . save registers -10399 50/push-eax -10400 53/push-ebx -10401 # ebx = base -10402 8b/-> *(ebp+0xc) 3/r32/ebx -10403 (emit-indent *(ebp+8) *Curr-block-depth) -10404 (write-buffered *(ebp+8) "8b/-> *") -10405 # if base is an (addr array ...) in a register -10406 { -10407 81 7/subop/compare *(ebx+0x18)) 0/imm32 # Var-register -10408 74/jump-if-= break/disp8 -10409 $emit-save-size-to:emit-base-from-register: -10410 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -10411 (write-buffered *(ebp+8) %eax) -10412 eb/jump $emit-save-size-to:emit-output/disp8 -10413 } -10414 # otherwise if base is an (array ...) on the stack -10415 { -10416 81 7/subop/compare *(ebx+0x14)) 0/imm32 # Var-offset -10417 74/jump-if-= break/disp8 -10418 $emit-save-size-to:emit-base-from-stack: -10419 (write-buffered *(ebp+8) "(ebp+") -10420 (print-int32-buffered *(ebp+8) *(ebx+0x14)) # Var-offset -10421 (write-buffered *(ebp+8) ")") -10422 } -10423 $emit-save-size-to:emit-output: -10424 (write-buffered *(ebp+8) " ") -10425 (get Registers *(ebp+0x10) 0xc "Registers") # => eax -10426 (print-int32-buffered *(ebp+8) *eax) -10427 (write-buffered *(ebp+8) "/r32\n") -10428 $emit-save-size-to:end: -10429 # . restore registers -10430 5b/pop-to-ebx -10431 58/pop-to-eax -10432 # . epilogue -10433 89/<- %esp 5/r32/ebp -10434 5d/pop-to-ebp -10435 c3/return -10436 -10437 emit-divide-by-shift-right: # out: (addr buffered-file), reg: (addr array byte), size: int -10438 # . prologue -10439 55/push-ebp -10440 89/<- %ebp 4/r32/esp -10441 # . save registers -10442 50/push-eax -10443 # -10444 (emit-indent *(ebp+8) *Curr-block-depth) -10445 (write-buffered *(ebp+8) "c1/shift 5/subop/>> %") -10446 (write-buffered *(ebp+8) *(ebp+0xc)) -10447 (write-buffered *(ebp+8) Space) -10448 (num-shift-rights *(ebp+0x10)) # => eax -10449 (print-int32-buffered *(ebp+8) %eax) -10450 (write-buffered *(ebp+8) "/imm8\n") -10451 $emit-divide-by-shift-right:end: -10452 # . restore registers -10453 58/pop-to-eax -10454 # . epilogue -10455 89/<- %esp 5/r32/ebp -10456 5d/pop-to-ebp -10457 c3/return -10458 -10459 translate-mu-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -10460 # . prologue -10461 55/push-ebp -10462 89/<- %ebp 4/r32/esp -10463 # . save registers -10464 51/push-ecx -10465 # ecx = stmt -10466 8b/-> *(ebp+0xc) 1/r32/ecx -10467 # var base/ecx: (addr var) = stmt->inouts[0] -10468 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -10469 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10470 89/<- %ecx 0/r32/eax -10471 # if (var->register) do one thing -10472 { -10473 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -10474 74/jump-if-= break/disp8 -10475 # TODO: ensure there's no dereference -10476 (translate-mu-index-stmt-with-array-in-register *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -10477 eb/jump $translate-mu-index-stmt:end/disp8 -10478 } -10479 # if (var->offset) do a different thing -10480 { -10481 81 7/subop/compare *(ecx+0x14) 0/imm32 # Var-offset -10482 74/jump-if-= break/disp8 -10483 # TODO: ensure there's no dereference -10484 (translate-mu-index-stmt-with-array-on-stack *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -10485 eb/jump $translate-mu-index-stmt:end/disp8 -10486 } -10487 $translate-mu-index-stmt:end: -10488 # . restore registers -10489 59/pop-to-ecx -10490 # . epilogue -10491 89/<- %esp 5/r32/ebp -10492 5d/pop-to-ebp -10493 c3/return -10494 -10495 $translate-mu-index-stmt-with-array:error1: -10496 (write-buffered *(ebp+0x10) "couldn't translate an index instruction. second (index) input must either lie in a register or be a literal\n") -10497 (flush *(ebp+0x10)) -10498 (stop *(ebp+0x14) 1) -10499 # never gets here -10500 -10501 $translate-mu-index-stmt-with-array:error2: -10502 (write-buffered *(ebp+0x10) "couldn't translate an index instruction. second (index) input when in a register must be an int or offset\n") -10503 (flush *(ebp+0x10)) -10504 (stop *(ebp+0x14) 1) -10505 # never gets here -10506 -10507 translate-mu-index-stmt-with-array-in-register: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -10508 # . prologue -10509 55/push-ebp -10510 89/<- %ebp 4/r32/esp -10511 # . save registers -10512 50/push-eax -10513 51/push-ecx -10514 52/push-edx -10515 53/push-ebx -10516 # -10517 (emit-indent *(ebp+8) *Curr-block-depth) -10518 (write-buffered *(ebp+8) "8d/copy-address *(") -10519 # TODO: ensure inouts[0] is in a register and not dereferenced -10520 $translate-mu-index-stmt-with-array-in-register:emit-base: -10521 # ecx = stmt -10522 8b/-> *(ebp+0xc) 1/r32/ecx -10523 # var base/ebx: (addr var) = inouts[0] -10524 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -10525 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10526 89/<- %ebx 0/r32/eax -10527 # print base->register " + " -10528 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -10529 (write-buffered *(ebp+8) %eax) -10530 (write-buffered *(ebp+8) " + ") -10531 # var index/edx: (addr var) = inouts[1] -10532 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -10533 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -10534 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10535 89/<- %edx 0/r32/eax -10536 # if index->register -10537 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register -10538 { -10539 0f 84/jump-if-= break/disp32 -10540 $translate-mu-index-stmt-with-array-in-register:emit-register-index: -10541 # if index is an int -10542 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -10543 (is-simple-mu-type? %eax 1) # int => eax -10544 3d/compare-eax-and 0/imm32/false -10545 { -10546 0f 84/jump-if-= break/disp32 -10547 $translate-mu-index-stmt-with-array-in-register:emit-int-register-index: -10548 # print index->register "<<" log2(array-element-size(base)) " + 4) " -10549 # . index->register "<<" -10550 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -10551 (write-buffered *(ebp+8) %eax) -10552 (write-buffered *(ebp+8) "<<") -10553 # . log2(array-element-size(base->type)) -10554 # TODO: ensure size is a power of 2 -10555 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -10556 (num-shift-rights %eax) # => eax -10557 (print-int32-buffered *(ebp+8) %eax) -10558 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-register-index-done/disp32 -10559 } -10560 # if index->type is any other atom, abort -10561 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -10562 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom -10563 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 -10564 # if index has type (offset ...) -10565 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax -10566 (is-simple-mu-type? %eax 7) # => eax -10567 3d/compare-eax-and 0/imm32/false -10568 { -10569 0f 84/jump-if-= break/disp32 -10570 # print index->register -10571 $translate-mu-index-stmt-with-array-in-register:emit-offset-register-index: -10572 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -10573 (write-buffered *(ebp+8) %eax) -10574 } -10575 $translate-mu-index-stmt-with-array-in-register:emit-register-index-done: -10576 (write-buffered *(ebp+8) " + 4) ") -10577 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 -10578 } -10579 # otherwise if index is a literal -10580 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -10581 (is-simple-mu-type? %eax 0) # => eax -10582 3d/compare-eax-and 0/imm32/false -10583 { -10584 0f 84/jump-if-= break/disp32 -10585 $translate-mu-index-stmt-with-array-in-register:emit-literal-index: -10586 # var index-value/edx: int = parse-hex-int(index->name) -10587 (lookup *edx *(edx+4)) # Var-name Var-name => eax -10588 (parse-hex-int %eax) # => eax -10589 89/<- %edx 0/r32/eax -10590 # offset = idx-value * array-element-size(base->type) -10591 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -10592 f7 4/subop/multiply-into-eax %edx # clobbers edx -10593 # offset += 4 for array size -10594 05/add-to-eax 4/imm32 -10595 # TODO: check edx for overflow -10596 # print offset -10597 (print-int32-buffered *(ebp+8) %eax) -10598 (write-buffered *(ebp+8) ") ") -10599 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 -10600 } -10601 # otherwise abort -10602 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 -10603 $translate-mu-index-stmt-with-array-in-register:emit-output: -10604 # outputs[0] "/r32" -10605 8b/-> *(ebp+0xc) 1/r32/ecx -10606 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -10607 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10608 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -10609 (get Registers %eax 0xc "Registers") # => eax: (addr int) -10610 (print-int32-buffered *(ebp+8) *eax) -10611 (write-buffered *(ebp+8) "/r32\n") -10612 $translate-mu-index-stmt-with-array-in-register:end: -10613 # . restore registers -10614 5b/pop-to-ebx -10615 5a/pop-to-edx -10616 59/pop-to-ecx -10617 58/pop-to-eax -10618 # . epilogue -10619 89/<- %esp 5/r32/ebp -10620 5d/pop-to-ebp -10621 c3/return -10622 -10623 translate-mu-index-stmt-with-array-on-stack: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -10624 # . prologue -10625 55/push-ebp -10626 89/<- %ebp 4/r32/esp -10627 # . save registers -10628 50/push-eax -10629 51/push-ecx -10630 52/push-edx -10631 53/push-ebx -10632 # -10633 (emit-indent *(ebp+8) *Curr-block-depth) -10634 (write-buffered *(ebp+8) "8d/copy-address *(ebp + ") -10635 # var curr/edx: (addr stmt-var) = lookup(stmt->inouts) -10636 8b/-> *(ebp+0xc) 0/r32/eax -10637 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -10638 89/<- %edx 0/r32/eax -10639 # var base/ecx: (addr var) = lookup(curr->value) -10640 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10641 89/<- %ecx 0/r32/eax -10642 # var curr2/eax: (addr stmt-var) = lookup(curr->next) -10643 (lookup *(edx+8) *(edx+0xc)) # Stmt-var-next Stmt-var-next => eax -10644 # var index/edx: (handle var) = curr2->value -10645 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10646 89/<- %edx 0/r32/eax -10647 # if index->register -10648 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register -10649 { -10650 0f 84/jump-if-= break/disp32 -10651 $translate-mu-index-stmt-with-array-on-stack:emit-register-index: -10652 # if index is an int -10653 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -10654 (is-simple-mu-type? %eax 1) # int => eax -10655 3d/compare-eax-and 0/imm32/false -10656 { -10657 0f 84/jump-if-= break/disp32 -10658 $translate-mu-index-stmt-with-array-on-stack:emit-int-register-index: -10659 # print index->register "<<" log2(array-element-size(base)) " + " base->offset+4 -10660 # . inouts[1]->register "<<" -10661 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -10662 (write-buffered *(ebp+8) %eax) -10663 (write-buffered *(ebp+8) "<<") -10664 # . log2(array-element-size(base)) -10665 # TODO: ensure size is a power of 2 -10666 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax -10667 (num-shift-rights %eax) # => eax -10668 (print-int32-buffered *(ebp+8) %eax) -10669 # -10670 (write-buffered *(ebp+8) " + ") -10671 # -10672 8b/-> *(ecx+0x14) 0/r32/eax # Var-offset -10673 05/add-to-eax 4/imm32 # for array length -10674 (print-int32-buffered *(ebp+8) %eax) -10675 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done/disp32 -10676 } -10677 # if index->type is any other atom, abort -10678 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -10679 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom -10680 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 -10681 # if index has type (offset ...) -10682 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax -10683 (is-simple-mu-type? %eax 7) # => eax -10684 3d/compare-eax-and 0/imm32/false -10685 { -10686 0f 84/jump-if-= break/disp32 -10687 # print index->register -10688 $translate-mu-index-stmt-with-array-on-stack:emit-offset-register-index: -10689 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -10690 (write-buffered *(ebp+8) %eax) -10691 } -10692 $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done: -10693 (write-buffered *(ebp+8) ") ") -10694 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 -10695 } -10696 # otherwise if index is a literal -10697 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -10698 (is-simple-mu-type? %eax 0) # => eax -10699 3d/compare-eax-and 0/imm32/false -10700 { -10701 0f 84/jump-if-= break/disp32 -10702 $translate-mu-index-stmt-with-array-on-stack:emit-literal-index: -10703 # var idx-value/edx: int = parse-hex-int(index->name) -10704 (lookup *edx *(edx+4)) # Var-name Var-name => eax -10705 (parse-hex-int %eax) # Var-name => eax -10706 89/<- %edx 0/r32/eax -10707 # offset = idx-value * array-element-size(base) -10708 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax -10709 f7 4/subop/multiply-into-eax %edx # clobbers edx -10710 # offset += base->offset -10711 03/add *(ecx+0x14) 0/r32/eax # Var-offset -10712 # offset += 4 for array size -10713 05/add-to-eax 4/imm32 -10714 # TODO: check edx for overflow -10715 # print offset -10716 (print-int32-buffered *(ebp+8) %eax) -10717 (write-buffered *(ebp+8) ") ") -10718 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 -10719 } -10720 # otherwise abort -10721 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 -10722 $translate-mu-index-stmt-with-array-on-stack:emit-output: -10723 # outputs[0] "/r32" -10724 8b/-> *(ebp+0xc) 0/r32/eax -10725 (lookup *(eax+0x14) *(eax+0x18)) # Stmt1-outputs Stmt1-outputs => eax -10726 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10727 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -10728 (get Registers %eax 0xc "Registers") # => eax: (addr int) -10729 (print-int32-buffered *(ebp+8) *eax) -10730 (write-buffered *(ebp+8) "/r32\n") -10731 $translate-mu-index-stmt-with-array-on-stack:end: -10732 # . restore registers -10733 5b/pop-to-ebx -10734 5a/pop-to-edx -10735 59/pop-to-ecx -10736 58/pop-to-eax -10737 # . epilogue -10738 89/<- %esp 5/r32/ebp -10739 5d/pop-to-ebp -10740 c3/return -10741 -10742 translate-mu-compute-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -10743 # . prologue -10744 55/push-ebp -10745 89/<- %ebp 4/r32/esp -10746 # . save registers -10747 50/push-eax -10748 51/push-ecx -10749 52/push-edx -10750 53/push-ebx -10751 # -10752 (emit-indent *(ebp+8) *Curr-block-depth) -10753 (write-buffered *(ebp+8) "69/multiply") -10754 # ecx = stmt -10755 8b/-> *(ebp+0xc) 1/r32/ecx -10756 # var first-inout/ebx: (addr stmt-var) = stmt->inouts[0] -10757 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -10758 89/<- %ebx 0/r32/eax -10759 $translate-mu-compute-index-stmt:emit-index: -10760 (lookup *(ebx+8) *(ebx+0xc)) # Stmt-var-next Stmt-var-next => eax -10761 (emit-subx-var-as-rm32 *(ebp+8) %eax) -10762 (write-buffered *(ebp+8) Space) -10763 $translate-mu-compute-index-stmt:emit-elem-size: -10764 # var base/ebx: (addr var) -10765 (lookup *ebx *(ebx+4)) # Stmt-var-value Stmt-var-value => eax -10766 89/<- %ebx 0/r32/eax -10767 # print array-element-size(base) -10768 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -10769 (print-int32-buffered *(ebp+8) %eax) -10770 (write-buffered *(ebp+8) "/imm32 ") -10771 $translate-mu-compute-index-stmt:emit-output: -10772 # outputs[0] "/r32" -10773 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -10774 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10775 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -10776 (get Registers %eax 0xc "Registers") # => eax: (addr int) -10777 (print-int32-buffered *(ebp+8) *eax) -10778 (write-buffered *(ebp+8) "/r32\n") -10779 $translate-mu-compute-index-stmt:end: -10780 # . restore registers -10781 5b/pop-to-ebx -10782 5a/pop-to-edx -10783 59/pop-to-ecx -10784 58/pop-to-eax -10785 # . epilogue -10786 89/<- %esp 5/r32/ebp -10787 5d/pop-to-ebp -10788 c3/return -10789 -10790 translate-mu-get-stmt: # out: (addr buffered-file), stmt: (addr stmt) -10791 # . prologue -10792 55/push-ebp -10793 89/<- %ebp 4/r32/esp -10794 # . save registers -10795 50/push-eax -10796 51/push-ecx -10797 52/push-edx -10798 # -10799 (emit-indent *(ebp+8) *Curr-block-depth) -10800 (write-buffered *(ebp+8) "8d/copy-address ") -10801 # ecx = stmt -10802 8b/-> *(ebp+0xc) 1/r32/ecx -10803 # var offset/edx: int = get offset of stmt -10804 (mu-get-offset %ecx) # => eax -10805 89/<- %edx 0/r32/eax -10806 # var base/eax: (addr var) = stmt->inouts->value -10807 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -10808 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10809 # if base is in a register -10810 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -10811 { -10812 0f 84/jump-if-= break/disp32 -10813 $translate-mu-get-stmt:emit-register-input: -10814 # emit "*(" base->register " + " offset ") " -10815 (write-buffered *(ebp+8) "*(") -10816 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -10817 (write-buffered *(ebp+8) %eax) -10818 (write-buffered *(ebp+8) " + ") -10819 (print-int32-buffered *(ebp+8) %edx) -10820 (write-buffered *(ebp+8) ") ") -10821 e9/jump $translate-mu-get-stmt:emit-output/disp32 -10822 } -10823 # otherwise base is on the stack -10824 { -10825 $translate-mu-get-stmt:emit-stack-input: -10826 # emit "*(ebp + " inouts[0]->stack-offset + offset ") " -10827 (write-buffered *(ebp+8) "*(ebp+") -10828 03/add *(eax+0x14) 2/r32/edx # Var-offset -10829 (print-int32-buffered *(ebp+8) %edx) -10830 (write-buffered *(ebp+8) ") ") -10831 eb/jump $translate-mu-get-stmt:emit-output/disp8 -10832 } -10833 $translate-mu-get-stmt:emit-output: -10834 # var output/eax: (addr var) = stmt->outputs->value -10835 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -10836 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -10837 # emit offset->register "/r32" -10838 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -10839 (get Registers %eax 0xc "Registers") # => eax: (addr int) -10840 (print-int32-buffered *(ebp+8) *eax) -10841 (write-buffered *(ebp+8) "/r32\n") -10842 $translate-mu-get-stmt:end: -10843 # . restore registers -10844 5a/pop-to-edx -10845 59/pop-to-ecx -10846 58/pop-to-eax -10847 # . epilogue -10848 89/<- %esp 5/r32/ebp -10849 5d/pop-to-ebp -10850 c3/return -10851 -10852 array-element-type-id: # v: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: type-id -10853 # precondition: n is positive -10854 # . prologue -10855 55/push-ebp -10856 89/<- %ebp 4/r32/esp -10857 # -10858 8b/-> *(ebp+8) 0/r32/eax -10859 # var t/eax: (addr tree type-id) -10860 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -10861 # if t == 0 abort -10862 3d/compare-eax-with 0/imm32 -10863 0f 84/jump-if-== $array-element-type-id:error0/disp32 -10864 # if t->is-atom? abort -10865 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom -10866 0f 85/jump-if-!= $array-element-type-id:error1/disp32 -10867 # if (t->left == addr) t = t->right -10868 { -10869 50/push-eax -10870 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax -10871 (is-simple-mu-type? %eax 2) # addr => eax -10872 3d/compare-eax-with 0/imm32/false -10873 58/pop-to-eax -10874 74/jump-if-= break/disp8 -10875 $array-element-type-id:skip-addr: -10876 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax -10877 } -10878 # if t == 0 abort -10879 3d/compare-eax-with 0/imm32 -10880 0f 84/jump-if-= $array-element-type-id:error2/disp32 -10881 # if t->is-atom? abort -10882 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom -10883 0f 85/jump-if-!= $array-element-type-id:error2/disp32 -10884 # if t->left != array abort -10885 { -10886 50/push-eax -10887 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax -10888 (is-simple-mu-type? %eax 3) # array => eax -10889 3d/compare-eax-with 0/imm32/false -10890 58/pop-to-eax -10891 $array-element-type-id:no-array: -10892 0f 84/jump-if-= $array-element-type-id:error2/disp32 -10893 } -10894 $array-element-type-id:skip-array: -10895 # t = t->right -10896 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax -10897 # if t == 0 abort -10898 3d/compare-eax-with 0/imm32 -10899 0f 84/jump-if-= $array-element-type-id:error2/disp32 -10900 # if t->is-atom? abort -10901 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom -10902 0f 85/jump-if-!= $array-element-type-id:error2/disp32 -10903 # return t->left->value -10904 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax -10905 8b/-> *(eax+4) 0/r32/eax # Tree-value -10906 $array-element-type-id:end: -10907 # . epilogue -10908 89/<- %esp 5/r32/ebp -10909 5d/pop-to-ebp -10910 c3/return -10911 -10912 $array-element-type-id:error0: -10913 (write-buffered *(ebp+0xc) "array-element-type-id: var '") -10914 50/push-eax -10915 8b/-> *(ebp+8) 0/r32/eax -10916 (lookup *eax *(eax+4)) # Var-name Var-name => eax -10917 (write-buffered *(ebp+0xc) %eax) -10918 58/pop-to-eax -10919 (write-buffered *(ebp+0xc) "' has no type\n") -10920 (flush *(ebp+0xc)) -10921 (stop *(ebp+0x10) 1) -10922 # never gets here -10923 -10924 $array-element-type-id:error1: -10925 (write-buffered *(ebp+0xc) "array-element-type-id: var '") -10926 50/push-eax -10927 8b/-> *(ebp+8) 0/r32/eax -10928 (lookup *eax *(eax+4)) # Var-name Var-name => eax -10929 (write-buffered *(ebp+0xc) %eax) -10930 58/pop-to-eax -10931 (write-buffered *(ebp+0xc) "' has atomic type ") -10932 (print-int32-buffered *(ebp+0xc) *(eax+4)) # Tree-value -10933 (write-buffered *(ebp+0xc) Newline) -10934 (flush *(ebp+0xc)) -10935 (stop *(ebp+0x10) 1) -10936 # never gets here -10937 -10938 $array-element-type-id:error2: -10939 (write-buffered *(ebp+0xc) "array-element-type-id: var '") -10940 50/push-eax -10941 8b/-> *(ebp+8) 0/r32/eax -10942 (lookup *eax *(eax+4)) # Var-name Var-name => eax -10943 (write-buffered *(ebp+0xc) %eax) -10944 58/pop-to-eax -10945 (write-buffered *(ebp+0xc) "' has non-array type\n") -10946 (flush *(ebp+0xc)) -10947 (stop *(ebp+0x10) 1) -10948 # never gets here -10949 -10950 power-of-2?: # n: int, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: boolean -10951 # precondition: n is positive -10952 # . prologue -10953 55/push-ebp -10954 89/<- %ebp 4/r32/esp -10955 # eax = n -10956 8b/-> *(ebp+8) 0/r32/eax -10957 # if (n < 0) abort -10958 3d/compare-eax-with 0/imm32 -10959 0f 8c/jump-if-< $power-of-2?:abort/disp32 -10960 # var tmp/eax: int = n-1 -10961 48/decrement-eax -10962 # var tmp2/eax: int = n & tmp -10963 23/and-> *(ebp+8) 0/r32/eax -10964 # return (tmp2 == 0) -10965 3d/compare-eax-and 0/imm32 -10966 0f 94/set-byte-if-= %al -10967 81 4/subop/and %eax 0xff/imm32 -10968 $power-of-2?:end: -10969 # . epilogue -10970 89/<- %esp 5/r32/ebp -10971 5d/pop-to-ebp -10972 c3/return -10973 -10974 $power-of-2?:abort: -10975 (write-buffered *(ebp+0xc) "power-of-2?: negative number\n") -10976 (flush *(ebp+0xc)) -10977 (stop *(ebp+0x10) 1) -10978 # never gets here -10979 -10980 num-shift-rights: # n: int -> result/eax: int -10981 # precondition: n is a positive power of 2 -10982 # . prologue -10983 55/push-ebp -10984 89/<- %ebp 4/r32/esp -10985 # . save registers -10986 51/push-ecx -10987 # var curr/ecx: int = n -10988 8b/-> *(ebp+8) 1/r32/ecx -10989 # result = 0 -10990 b8/copy-to-eax 0/imm32 -10991 { -10992 # if (curr <= 1) break -10993 81 7/subop/compare %ecx 1/imm32 -10994 7e/jump-if-<= break/disp8 -10995 40/increment-eax -10996 c1/shift 5/subop/arithmetic-right %ecx 1/imm8 -10997 eb/jump loop/disp8 -10998 } -10999 $num-shift-rights:end: -11000 # . restore registers -11001 59/pop-to-ecx -11002 # . epilogue -11003 89/<- %esp 5/r32/ebp -11004 5d/pop-to-ebp -11005 c3/return -11006 -11007 mu-get-offset: # stmt: (addr stmt) -> result/eax: int -11008 # . prologue -11009 55/push-ebp -11010 89/<- %ebp 4/r32/esp -11011 # var second-inout/eax: (addr stmt-var) = stmt->inouts->next -11012 8b/-> *(ebp+8) 0/r32/eax -11013 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -11014 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -11015 # var output-var/eax: (addr var) = second-inout->value -11016 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -11017 #? (write-buffered Stderr "mu-get-offset: ") -11018 #? (print-int32-buffered Stderr %eax) -11019 #? (write-buffered Stderr " name: ") -11020 #? 50/push-eax -11021 #? (lookup *eax *(eax+4)) # Var-name -11022 #? (write-buffered Stderr %eax) -11023 #? 58/pop-to-eax -11024 #? (write-buffered Stderr Newline) -11025 #? (flush Stderr) -11026 # return output-var->stack-offset -11027 8b/-> *(eax+0x14) 0/r32/eax # Var-offset -11028 #? (write-buffered Stderr "=> ") -11029 #? (print-int32-buffered Stderr %eax) -11030 #? (write-buffered Stderr Newline) -11031 #? (flush Stderr) -11032 $emit-get-offset:end: -11033 # . epilogue -11034 89/<- %esp 5/r32/ebp -11035 5d/pop-to-ebp -11036 c3/return -11037 -11038 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) -11039 # . prologue -11040 55/push-ebp -11041 89/<- %ebp 4/r32/esp -11042 # . save registers -11043 50/push-eax -11044 51/push-ecx -11045 56/push-esi -11046 # esi = block -11047 8b/-> *(ebp+0xc) 6/r32/esi -11048 # block->var->block-depth = *Curr-block-depth -11049 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax -11050 8b/-> *Curr-block-depth 1/r32/ecx -11051 89/<- *(eax+0x10) 1/r32/ecx # Var-block-depth -11052 # var stmts/eax: (addr list stmt) = lookup(block->statements) -11053 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax -11054 # -11055 { -11056 $emit-subx-block:check-empty: -11057 3d/compare-eax-and 0/imm32 -11058 0f 84/jump-if-= break/disp32 -11059 (emit-indent *(ebp+8) *Curr-block-depth) -11060 (write-buffered *(ebp+8) "{\n") -11061 # var v/ecx: (addr var) = lookup(block->var) -11062 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax -11063 89/<- %ecx 0/r32/eax -11064 # -11065 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -11066 (write-buffered *(ebp+8) %eax) -11067 (write-buffered *(ebp+8) ":loop:\n") -11068 ff 0/subop/increment *Curr-block-depth -11069 (push *(ebp+0x10) *(esi+0xc)) # Block-var -11070 (push *(ebp+0x10) *(esi+0x10)) # Block-var -11071 (push *(ebp+0x10) 0) # false -11072 # emit block->statements -11073 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax -11074 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -11075 (pop *(ebp+0x10)) # => eax -11076 (pop *(ebp+0x10)) # => eax -11077 (pop *(ebp+0x10)) # => eax -11078 ff 1/subop/decrement *Curr-block-depth -11079 (emit-indent *(ebp+8) *Curr-block-depth) -11080 (write-buffered *(ebp+8) "}\n") -11081 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -11082 (write-buffered *(ebp+8) %eax) -11083 (write-buffered *(ebp+8) ":break:\n") -11084 } -11085 $emit-subx-block:end: -11086 # . restore registers -11087 5e/pop-to-esi -11088 59/pop-to-ecx -11089 58/pop-to-eax -11090 # . epilogue -11091 89/<- %esp 5/r32/ebp -11092 5d/pop-to-ebp -11093 c3/return -11094 -11095 # Primitives supported -11096 # See mu_instructions for a summary of this linked-list data structure. -11097 # -11098 # For each operation, put variants with hard-coded registers before flexible ones. -11099 # -11100 # Unfortunately, our restrictions on addresses require that various fields in -11101 # primitives be handles, which complicates these definitions. -11102 # - we need to insert dummy fields all over the place for fake alloc-ids -11103 # - we can't use our syntax sugar of quoted literals for string fields -11104 # -11105 # Fake alloc-ids are needed because our type definitions up top require -11106 # handles but it's clearer to statically allocate these long-lived objects. -11107 # Fake alloc-ids are perfectly safe, but they can't be reclaimed. -11108 # -11109 # Every 'object' below starts with a fake alloc-id. It may also contain other -11110 # fake alloc-ids for various handle fields. -11111 # -11112 # I think of objects starting with a fake alloc-id as having type 'payload'. -11113 # It's not really intended to be created dynamically; for that use `allocate` -11114 # as usual. -11115 # -11116 # Idea for a notation to simplify such definitions: -11117 # _Primitive-increment-eax: # (payload primitive) -11118 # 0x11/alloc-id:fake:payload -11119 # 0x11 @(0x11 "increment") # name -11120 # 0 0 # inouts -11121 # 0x11 @(0x11/payload -11122 # 0x11 @(0x11/payload # List-value -11123 # 0 0 # Var-name -11124 # 0x11 @(0x11 # Var-type -11125 # 1/is-atom -11126 # 1/value 0/unused # Tree-left -11127 # 0 0 # Tree-right -11128 # ) -11129 # 1 # block-depth -11130 # 0 # stack-offset -11131 # 0x11 @(0x11 "eax") # Var-register -11132 # ) -11133 # 0 0) # List-next -11134 # ... -11135 # _Primitive-increment-ecx/imm32/next -11136 # ... -11137 # Awfully complex and non-obvious. But also clearly signals there's something -11138 # to learn here, so may be worth trying. -11139 # -11140 # '@' is just an initial thought. Punctuation used so far in Mu: () * % # / " -11141 # -11142 # For now we'll continue to just use comments and manually ensure they stay up -11143 # to date. -11144 == data -11145 Primitives: # (addr primitive) -11146 # - increment/decrement -11147 _Primitive-increment-eax: # (addr primitive) -11148 # var/eax <- increment => 40/increment-eax -11149 0x11/imm32/alloc-id:fake -11150 _string-increment/imm32/name -11151 0/imm32/no-inouts -11152 0/imm32/no-inouts -11153 0x11/imm32/alloc-id:fake -11154 Single-int-var-in-eax/imm32/outputs -11155 0x11/imm32/alloc-id:fake -11156 _string_40_increment_eax/imm32/subx-name -11157 0/imm32/no-rm32 -11158 0/imm32/no-r32 -11159 0/imm32/no-imm32 -11160 0/imm32/no-disp32 -11161 0/imm32/output-is-write-only -11162 0x11/imm32/alloc-id:fake -11163 _Primitive-increment-ecx/imm32/next -11164 _Primitive-increment-ecx: # (payload primitive) -11165 0x11/imm32/alloc-id:fake:payload -11166 # var/ecx <- increment => 41/increment-ecx -11167 0x11/imm32/alloc-id:fake -11168 _string-increment/imm32/name -11169 0/imm32/no-inouts -11170 0/imm32/no-inouts -11171 0x11/imm32/alloc-id:fake -11172 Single-int-var-in-ecx/imm32/outputs -11173 0x11/imm32/alloc-id:fake -11174 _string_41_increment_ecx/imm32/subx-name -11175 0/imm32/no-rm32 -11176 0/imm32/no-r32 -11177 0/imm32/no-imm32 -11178 0/imm32/no-disp32 -11179 0/imm32/output-is-write-only -11180 0x11/imm32/alloc-id:fake -11181 _Primitive-increment-edx/imm32/next -11182 _Primitive-increment-edx: # (payload primitive) -11183 0x11/imm32/alloc-id:fake:payload -11184 # var/edx <- increment => 42/increment-edx -11185 0x11/imm32/alloc-id:fake -11186 _string-increment/imm32/name -11187 0/imm32/no-inouts -11188 0/imm32/no-inouts -11189 0x11/imm32/alloc-id:fake -11190 Single-int-var-in-edx/imm32/outputs -11191 0x11/imm32/alloc-id:fake -11192 _string_42_increment_edx/imm32/subx-name -11193 0/imm32/no-rm32 -11194 0/imm32/no-r32 -11195 0/imm32/no-imm32 -11196 0/imm32/no-disp32 -11197 0/imm32/output-is-write-only -11198 0x11/imm32/alloc-id:fake -11199 _Primitive-increment-ebx/imm32/next -11200 _Primitive-increment-ebx: # (payload primitive) -11201 0x11/imm32/alloc-id:fake:payload -11202 # var/ebx <- increment => 43/increment-ebx -11203 0x11/imm32/alloc-id:fake -11204 _string-increment/imm32/name -11205 0/imm32/no-inouts -11206 0/imm32/no-inouts -11207 0x11/imm32/alloc-id:fake -11208 Single-int-var-in-ebx/imm32/outputs -11209 0x11/imm32/alloc-id:fake -11210 _string_43_increment_ebx/imm32/subx-name -11211 0/imm32/no-rm32 -11212 0/imm32/no-r32 -11213 0/imm32/no-imm32 -11214 0/imm32/no-disp32 -11215 0/imm32/output-is-write-only -11216 0x11/imm32/alloc-id:fake -11217 _Primitive-increment-esi/imm32/next -11218 _Primitive-increment-esi: # (payload primitive) -11219 0x11/imm32/alloc-id:fake:payload -11220 # var/esi <- increment => 46/increment-esi -11221 0x11/imm32/alloc-id:fake -11222 _string-increment/imm32/name -11223 0/imm32/no-inouts -11224 0/imm32/no-inouts -11225 0x11/imm32/alloc-id:fake -11226 Single-int-var-in-esi/imm32/outputs -11227 0x11/imm32/alloc-id:fake -11228 _string_46_increment_esi/imm32/subx-name -11229 0/imm32/no-rm32 -11230 0/imm32/no-r32 -11231 0/imm32/no-imm32 -11232 0/imm32/no-disp32 -11233 0/imm32/output-is-write-only -11234 0x11/imm32/alloc-id:fake -11235 _Primitive-increment-edi/imm32/next -11236 _Primitive-increment-edi: # (payload primitive) -11237 0x11/imm32/alloc-id:fake:payload -11238 # var/edi <- increment => 47/increment-edi -11239 0x11/imm32/alloc-id:fake -11240 _string-increment/imm32/name -11241 0/imm32/no-inouts -11242 0/imm32/no-inouts -11243 0x11/imm32/alloc-id:fake -11244 Single-int-var-in-edi/imm32/outputs -11245 0x11/imm32/alloc-id:fake -11246 _string_47_increment_edi/imm32/subx-name -11247 0/imm32/no-rm32 -11248 0/imm32/no-r32 -11249 0/imm32/no-imm32 -11250 0/imm32/no-disp32 -11251 0/imm32/output-is-write-only -11252 0x11/imm32/alloc-id:fake -11253 _Primitive-decrement-eax/imm32/next -11254 _Primitive-decrement-eax: # (payload primitive) -11255 0x11/imm32/alloc-id:fake:payload -11256 # var/eax <- decrement => 48/decrement-eax -11257 0x11/imm32/alloc-id:fake -11258 _string-decrement/imm32/name -11259 0/imm32/no-inouts -11260 0/imm32/no-inouts -11261 0x11/imm32/alloc-id:fake -11262 Single-int-var-in-eax/imm32/outputs -11263 0x11/imm32/alloc-id:fake -11264 _string_48_decrement_eax/imm32/subx-name -11265 0/imm32/no-rm32 -11266 0/imm32/no-r32 -11267 0/imm32/no-imm32 -11268 0/imm32/no-disp32 -11269 0/imm32/output-is-write-only -11270 0x11/imm32/alloc-id:fake -11271 _Primitive-decrement-ecx/imm32/next -11272 _Primitive-decrement-ecx: # (payload primitive) -11273 0x11/imm32/alloc-id:fake:payload -11274 # var/ecx <- decrement => 49/decrement-ecx -11275 0x11/imm32/alloc-id:fake -11276 _string-decrement/imm32/name -11277 0/imm32/no-inouts -11278 0/imm32/no-inouts -11279 0x11/imm32/alloc-id:fake -11280 Single-int-var-in-ecx/imm32/outputs -11281 0x11/imm32/alloc-id:fake -11282 _string_49_decrement_ecx/imm32/subx-name -11283 0/imm32/no-rm32 -11284 0/imm32/no-r32 -11285 0/imm32/no-imm32 -11286 0/imm32/no-disp32 -11287 0/imm32/output-is-write-only -11288 0x11/imm32/alloc-id:fake -11289 _Primitive-decrement-edx/imm32/next -11290 _Primitive-decrement-edx: # (payload primitive) -11291 0x11/imm32/alloc-id:fake:payload -11292 # var/edx <- decrement => 4a/decrement-edx -11293 0x11/imm32/alloc-id:fake -11294 _string-decrement/imm32/name -11295 0/imm32/no-inouts -11296 0/imm32/no-inouts -11297 0x11/imm32/alloc-id:fake -11298 Single-int-var-in-edx/imm32/outputs -11299 0x11/imm32/alloc-id:fake -11300 _string_4a_decrement_edx/imm32/subx-name -11301 0/imm32/no-rm32 -11302 0/imm32/no-r32 -11303 0/imm32/no-imm32 -11304 0/imm32/no-disp32 -11305 0/imm32/output-is-write-only -11306 0x11/imm32/alloc-id:fake -11307 _Primitive-decrement-ebx/imm32/next -11308 _Primitive-decrement-ebx: # (payload primitive) -11309 0x11/imm32/alloc-id:fake:payload -11310 # var/ebx <- decrement => 4b/decrement-ebx -11311 0x11/imm32/alloc-id:fake -11312 _string-decrement/imm32/name -11313 0/imm32/no-inouts -11314 0/imm32/no-inouts -11315 0x11/imm32/alloc-id:fake -11316 Single-int-var-in-ebx/imm32/outputs -11317 0x11/imm32/alloc-id:fake -11318 _string_4b_decrement_ebx/imm32/subx-name -11319 0/imm32/no-rm32 -11320 0/imm32/no-r32 -11321 0/imm32/no-imm32 -11322 0/imm32/no-disp32 -11323 0/imm32/output-is-write-only -11324 0x11/imm32/alloc-id:fake -11325 _Primitive-decrement-esi/imm32/next -11326 _Primitive-decrement-esi: # (payload primitive) -11327 0x11/imm32/alloc-id:fake:payload -11328 # var/esi <- decrement => 4e/decrement-esi -11329 0x11/imm32/alloc-id:fake -11330 _string-decrement/imm32/name -11331 0/imm32/no-inouts -11332 0/imm32/no-inouts -11333 0x11/imm32/alloc-id:fake -11334 Single-int-var-in-esi/imm32/outputs -11335 0x11/imm32/alloc-id:fake -11336 _string_4e_decrement_esi/imm32/subx-name -11337 0/imm32/no-rm32 -11338 0/imm32/no-r32 -11339 0/imm32/no-imm32 -11340 0/imm32/no-disp32 -11341 0/imm32/output-is-write-only -11342 0x11/imm32/alloc-id:fake -11343 _Primitive-decrement-edi/imm32/next -11344 _Primitive-decrement-edi: # (payload primitive) -11345 0x11/imm32/alloc-id:fake:payload -11346 # var/edi <- decrement => 4f/decrement-edi -11347 0x11/imm32/alloc-id:fake -11348 _string-decrement/imm32/name -11349 0/imm32/no-inouts -11350 0/imm32/no-inouts -11351 0x11/imm32/alloc-id:fake -11352 Single-int-var-in-edi/imm32/outputs -11353 0x11/imm32/alloc-id:fake -11354 _string_4f_decrement_edi/imm32/subx-name -11355 0/imm32/no-rm32 -11356 0/imm32/no-r32 -11357 0/imm32/no-imm32 -11358 0/imm32/no-disp32 -11359 0/imm32/output-is-write-only -11360 0x11/imm32/alloc-id:fake -11361 _Primitive-increment-mem/imm32/next -11362 _Primitive-increment-mem: # (payload primitive) -11363 0x11/imm32/alloc-id:fake:payload -11364 # increment var => ff 0/subop/increment *(ebp+__) -11365 0x11/imm32/alloc-id:fake -11366 _string-increment/imm32/name -11367 0x11/imm32/alloc-id:fake -11368 Single-int-var-in-mem/imm32/inouts -11369 0/imm32/no-outputs -11370 0/imm32/no-outputs -11371 0x11/imm32/alloc-id:fake -11372 _string_ff_subop_increment/imm32/subx-name -11373 1/imm32/rm32-is-first-inout -11374 0/imm32/no-r32 -11375 0/imm32/no-imm32 -11376 0/imm32/no-disp32 -11377 0/imm32/output-is-write-only -11378 0x11/imm32/alloc-id:fake -11379 _Primitive-increment-reg/imm32/next -11380 _Primitive-increment-reg: # (payload primitive) -11381 0x11/imm32/alloc-id:fake:payload -11382 # var/reg <- increment => ff 0/subop/increment %__ -11383 0x11/imm32/alloc-id:fake -11384 _string-increment/imm32/name -11385 0/imm32/no-inouts -11386 0/imm32/no-inouts -11387 0x11/imm32/alloc-id:fake -11388 Single-int-var-in-some-register/imm32/outputs -11389 0x11/imm32/alloc-id:fake -11390 _string_ff_subop_increment/imm32/subx-name -11391 3/imm32/rm32-is-first-output -11392 0/imm32/no-r32 -11393 0/imm32/no-imm32 -11394 0/imm32/no-disp32 -11395 0/imm32/output-is-write-only -11396 0x11/imm32/alloc-id:fake -11397 _Primitive-decrement-mem/imm32/next -11398 _Primitive-decrement-mem: # (payload primitive) -11399 0x11/imm32/alloc-id:fake:payload -11400 # decrement var => ff 1/subop/decrement *(ebp+__) -11401 0x11/imm32/alloc-id:fake -11402 _string-decrement/imm32/name -11403 0x11/imm32/alloc-id:fake -11404 Single-int-var-in-mem/imm32/inouts -11405 0/imm32/no-outputs -11406 0/imm32/no-outputs -11407 0x11/imm32/alloc-id:fake -11408 _string_ff_subop_decrement/imm32/subx-name -11409 1/imm32/rm32-is-first-inout -11410 0/imm32/no-r32 -11411 0/imm32/no-imm32 -11412 0/imm32/no-disp32 -11413 0/imm32/output-is-write-only -11414 0x11/imm32/alloc-id:fake -11415 _Primitive-decrement-reg/imm32/next -11416 _Primitive-decrement-reg: # (payload primitive) -11417 0x11/imm32/alloc-id:fake:payload -11418 # var/reg <- decrement => ff 1/subop/decrement %__ -11419 0x11/imm32/alloc-id:fake -11420 _string-decrement/imm32/name -11421 0/imm32/no-inouts -11422 0/imm32/no-inouts -11423 0x11/imm32/alloc-id:fake -11424 Single-int-var-in-some-register/imm32/outputs -11425 0x11/imm32/alloc-id:fake -11426 _string_ff_subop_decrement/imm32/subx-name -11427 3/imm32/rm32-is-first-output -11428 0/imm32/no-r32 -11429 0/imm32/no-imm32 -11430 0/imm32/no-disp32 -11431 0/imm32/output-is-write-only -11432 0x11/imm32/alloc-id:fake -11433 _Primitive-add-to-eax/imm32/next -11434 # - add -11435 _Primitive-add-to-eax: # (payload primitive) -11436 0x11/imm32/alloc-id:fake:payload -11437 # var/eax <- add lit => 05/add-to-eax lit/imm32 -11438 0x11/imm32/alloc-id:fake -11439 _string-add/imm32/name -11440 0x11/imm32/alloc-id:fake -11441 Single-lit-var/imm32/inouts -11442 0x11/imm32/alloc-id:fake -11443 Single-int-var-in-eax/imm32/outputs -11444 0x11/imm32/alloc-id:fake -11445 _string_05_add_to_eax/imm32/subx-name -11446 0/imm32/no-rm32 -11447 0/imm32/no-r32 -11448 1/imm32/imm32-is-first-inout -11449 0/imm32/no-disp32 -11450 0/imm32/output-is-write-only -11451 0x11/imm32/alloc-id:fake -11452 _Primitive-add-reg-to-reg/imm32/next -11453 _Primitive-add-reg-to-reg: # (payload primitive) -11454 0x11/imm32/alloc-id:fake:payload -11455 # var1/reg <- add var2/reg => 01/add-to var1/rm32 var2/r32 -11456 0x11/imm32/alloc-id:fake -11457 _string-add/imm32/name -11458 0x11/imm32/alloc-id:fake -11459 Single-int-var-in-some-register/imm32/inouts -11460 0x11/imm32/alloc-id:fake -11461 Single-int-var-in-some-register/imm32/outputs -11462 0x11/imm32/alloc-id:fake -11463 _string_01_add_to/imm32/subx-name -11464 3/imm32/rm32-is-first-output -11465 1/imm32/r32-is-first-inout -11466 0/imm32/no-imm32 -11467 0/imm32/no-disp32 -11468 0/imm32/output-is-write-only -11469 0x11/imm32/alloc-id:fake -11470 _Primitive-add-reg-to-mem/imm32/next -11471 _Primitive-add-reg-to-mem: # (payload primitive) -11472 0x11/imm32/alloc-id:fake:payload -11473 # add-to var1 var2/reg => 01/add-to var1 var2/r32 -11474 0x11/imm32/alloc-id:fake -11475 _string-add-to/imm32/name -11476 0x11/imm32/alloc-id:fake -11477 Two-args-int-stack-int-reg/imm32/inouts -11478 0/imm32/no-outputs -11479 0/imm32/no-outputs -11480 0x11/imm32/alloc-id:fake -11481 _string_01_add_to/imm32/subx-name -11482 1/imm32/rm32-is-first-inout -11483 2/imm32/r32-is-second-inout -11484 0/imm32/no-imm32 -11485 0/imm32/no-disp32 -11486 0/imm32/output-is-write-only -11487 0x11/imm32/alloc-id:fake -11488 _Primitive-add-mem-to-reg/imm32/next -11489 _Primitive-add-mem-to-reg: # (payload primitive) -11490 0x11/imm32/alloc-id:fake:payload -11491 # var1/reg <- add var2 => 03/add var2/rm32 var1/r32 -11492 0x11/imm32/alloc-id:fake -11493 _string-add/imm32/name -11494 0x11/imm32/alloc-id:fake -11495 Single-int-var-in-mem/imm32/inouts -11496 0x11/imm32/alloc-id:fake -11497 Single-int-var-in-some-register/imm32/outputs -11498 0x11/imm32/alloc-id:fake -11499 _string_03_add/imm32/subx-name -11500 1/imm32/rm32-is-first-inout -11501 3/imm32/r32-is-first-output -11502 0/imm32/no-imm32 -11503 0/imm32/no-disp32 -11504 0/imm32/output-is-write-only -11505 0x11/imm32/alloc-id:fake -11506 _Primitive-add-lit-to-reg/imm32/next -11507 _Primitive-add-lit-to-reg: # (payload primitive) -11508 0x11/imm32/alloc-id:fake:payload -11509 # var1/reg <- add lit => 81 0/subop/add var1/rm32 lit/imm32 -11510 0x11/imm32/alloc-id:fake -11511 _string-add/imm32/name -11512 0x11/imm32/alloc-id:fake -11513 Single-lit-var/imm32/inouts -11514 0x11/imm32/alloc-id:fake -11515 Single-int-var-in-some-register/imm32/outputs -11516 0x11/imm32/alloc-id:fake -11517 _string_81_subop_add/imm32/subx-name -11518 3/imm32/rm32-is-first-output -11519 0/imm32/no-r32 -11520 1/imm32/imm32-is-first-inout -11521 0/imm32/no-disp32 -11522 0/imm32/output-is-write-only -11523 0x11/imm32/alloc-id:fake -11524 _Primitive-add-lit-to-mem/imm32/next -11525 _Primitive-add-lit-to-mem: # (payload primitive) -11526 0x11/imm32/alloc-id:fake:payload -11527 # add-to var1, lit => 81 0/subop/add var1/rm32 lit/imm32 -11528 0x11/imm32/alloc-id:fake -11529 _string-add-to/imm32/name -11530 0x11/imm32/alloc-id:fake -11531 Int-var-and-literal/imm32/inouts -11532 0/imm32/no-outputs -11533 0/imm32/no-outputs -11534 0x11/imm32/alloc-id:fake -11535 _string_81_subop_add/imm32/subx-name -11536 1/imm32/rm32-is-first-inout -11537 0/imm32/no-r32 -11538 2/imm32/imm32-is-second-inout -11539 0/imm32/no-disp32 -11540 0/imm32/output-is-write-only -11541 0x11/imm32/alloc-id:fake -11542 _Primitive-subtract-from-eax/imm32/next -11543 # - subtract -11544 _Primitive-subtract-from-eax: # (payload primitive) -11545 0x11/imm32/alloc-id:fake:payload -11546 # var/eax <- subtract lit => 2d/subtract-from-eax lit/imm32 -11547 0x11/imm32/alloc-id:fake -11548 _string-subtract/imm32/name -11549 0x11/imm32/alloc-id:fake -11550 Single-lit-var/imm32/inouts -11551 0x11/imm32/alloc-id:fake -11552 Single-int-var-in-eax/imm32/outputs -11553 0x11/imm32/alloc-id:fake -11554 _string_2d_subtract_from_eax/imm32/subx-name -11555 0/imm32/no-rm32 -11556 0/imm32/no-r32 -11557 1/imm32/imm32-is-first-inout -11558 0/imm32/no-disp32 -11559 0/imm32/output-is-write-only -11560 0x11/imm32/alloc-id:fake -11561 _Primitive-subtract-reg-from-reg/imm32/next -11562 _Primitive-subtract-reg-from-reg: # (payload primitive) -11563 0x11/imm32/alloc-id:fake:payload -11564 # var1/reg <- subtract var2/reg => 29/subtract-from var1/rm32 var2/r32 -11565 0x11/imm32/alloc-id:fake -11566 _string-subtract/imm32/name -11567 0x11/imm32/alloc-id:fake -11568 Single-int-var-in-some-register/imm32/inouts -11569 0x11/imm32/alloc-id:fake -11570 Single-int-var-in-some-register/imm32/outputs -11571 0x11/imm32/alloc-id:fake -11572 _string_29_subtract_from/imm32/subx-name -11573 3/imm32/rm32-is-first-output -11574 1/imm32/r32-is-first-inout -11575 0/imm32/no-imm32 -11576 0/imm32/no-disp32 -11577 0/imm32/output-is-write-only -11578 0x11/imm32/alloc-id:fake -11579 _Primitive-subtract-reg-from-mem/imm32/next -11580 _Primitive-subtract-reg-from-mem: # (payload primitive) -11581 0x11/imm32/alloc-id:fake:payload -11582 # subtract-from var1 var2/reg => 29/subtract-from var1 var2/r32 -11583 0x11/imm32/alloc-id:fake -11584 _string-subtract-from/imm32/name -11585 0x11/imm32/alloc-id:fake -11586 Two-args-int-stack-int-reg/imm32/inouts -11587 0/imm32/no-outputs -11588 0/imm32/no-outputs -11589 0x11/imm32/alloc-id:fake -11590 _string_29_subtract_from/imm32/subx-name -11591 1/imm32/rm32-is-first-inout -11592 2/imm32/r32-is-second-inout -11593 0/imm32/no-imm32 -11594 0/imm32/no-disp32 -11595 0/imm32/output-is-write-only -11596 0x11/imm32/alloc-id:fake -11597 _Primitive-subtract-mem-from-reg/imm32/next -11598 _Primitive-subtract-mem-from-reg: # (payload primitive) -11599 0x11/imm32/alloc-id:fake:payload -11600 # var1/reg <- subtract var2 => 2b/subtract var2/rm32 var1/r32 -11601 0x11/imm32/alloc-id:fake -11602 _string-subtract/imm32/name -11603 0x11/imm32/alloc-id:fake -11604 Single-int-var-in-mem/imm32/inouts -11605 0x11/imm32/alloc-id:fake -11606 Single-int-var-in-some-register/imm32/outputs -11607 0x11/imm32/alloc-id:fake -11608 _string_2b_subtract/imm32/subx-name -11609 1/imm32/rm32-is-first-inout -11610 3/imm32/r32-is-first-output -11611 0/imm32/no-imm32 -11612 0/imm32/no-disp32 -11613 0/imm32/output-is-write-only -11614 0x11/imm32/alloc-id:fake -11615 _Primitive-subtract-lit-from-reg/imm32/next -11616 _Primitive-subtract-lit-from-reg: # (payload primitive) -11617 0x11/imm32/alloc-id:fake:payload -11618 # var1/reg <- subtract lit => 81 5/subop/subtract var1/rm32 lit/imm32 -11619 0x11/imm32/alloc-id:fake -11620 _string-subtract/imm32/name -11621 0x11/imm32/alloc-id:fake -11622 Single-lit-var/imm32/inouts -11623 0x11/imm32/alloc-id:fake -11624 Single-int-var-in-some-register/imm32/outputs -11625 0x11/imm32/alloc-id:fake -11626 _string_81_subop_subtract/imm32/subx-name -11627 3/imm32/rm32-is-first-output -11628 0/imm32/no-r32 -11629 1/imm32/imm32-is-first-inout -11630 0/imm32/no-disp32 -11631 0/imm32/output-is-write-only -11632 0x11/imm32/alloc-id:fake -11633 _Primitive-subtract-lit-from-mem/imm32/next -11634 _Primitive-subtract-lit-from-mem: # (payload primitive) -11635 0x11/imm32/alloc-id:fake:payload -11636 # subtract-from var1, lit => 81 5/subop/subtract var1/rm32 lit/imm32 -11637 0x11/imm32/alloc-id:fake -11638 _string-subtract-from/imm32/name -11639 0x11/imm32/alloc-id:fake -11640 Int-var-and-literal/imm32/inouts -11641 0/imm32/no-outputs -11642 0/imm32/no-outputs -11643 0x11/imm32/alloc-id:fake -11644 _string_81_subop_subtract/imm32/subx-name -11645 1/imm32/rm32-is-first-inout -11646 0/imm32/no-r32 -11647 2/imm32/imm32-is-first-inout -11648 0/imm32/no-disp32 -11649 0/imm32/output-is-write-only -11650 0x11/imm32/alloc-id:fake -11651 _Primitive-and-with-eax/imm32/next -11652 # - and -11653 _Primitive-and-with-eax: # (payload primitive) -11654 0x11/imm32/alloc-id:fake:payload -11655 # var/eax <- and lit => 25/and-with-eax lit/imm32 -11656 0x11/imm32/alloc-id:fake -11657 _string-and/imm32/name -11658 0x11/imm32/alloc-id:fake -11659 Single-lit-var/imm32/inouts -11660 0x11/imm32/alloc-id:fake -11661 Single-int-var-in-eax/imm32/outputs -11662 0x11/imm32/alloc-id:fake -11663 _string_25_and_with_eax/imm32/subx-name -11664 0/imm32/no-rm32 -11665 0/imm32/no-r32 -11666 1/imm32/imm32-is-first-inout -11667 0/imm32/no-disp32 -11668 0/imm32/output-is-write-only -11669 0x11/imm32/alloc-id:fake -11670 _Primitive-and-reg-with-reg/imm32/next -11671 _Primitive-and-reg-with-reg: # (payload primitive) -11672 0x11/imm32/alloc-id:fake:payload -11673 # var1/reg <- and var2/reg => 21/and-with var1/rm32 var2/r32 -11674 0x11/imm32/alloc-id:fake -11675 _string-and/imm32/name -11676 0x11/imm32/alloc-id:fake -11677 Single-int-var-in-some-register/imm32/inouts -11678 0x11/imm32/alloc-id:fake -11679 Single-int-var-in-some-register/imm32/outputs -11680 0x11/imm32/alloc-id:fake -11681 _string_21_and_with/imm32/subx-name -11682 3/imm32/rm32-is-first-output -11683 1/imm32/r32-is-first-inout -11684 0/imm32/no-imm32 -11685 0/imm32/no-disp32 -11686 0/imm32/output-is-write-only -11687 0x11/imm32/alloc-id:fake -11688 _Primitive-and-reg-with-mem/imm32/next -11689 _Primitive-and-reg-with-mem: # (payload primitive) -11690 0x11/imm32/alloc-id:fake:payload -11691 # and-with var1 var2/reg => 21/and-with var1 var2/r32 -11692 0x11/imm32/alloc-id:fake -11693 _string-and-with/imm32/name -11694 0x11/imm32/alloc-id:fake -11695 Two-args-int-stack-int-reg/imm32/inouts -11696 0/imm32/no-outputs -11697 0/imm32/no-outputs -11698 0x11/imm32/alloc-id:fake -11699 _string_21_and_with/imm32/subx-name -11700 1/imm32/rm32-is-first-inout -11701 2/imm32/r32-is-second-inout -11702 0/imm32/no-imm32 -11703 0/imm32/no-disp32 -11704 0/imm32/output-is-write-only -11705 0x11/imm32/alloc-id:fake -11706 _Primitive-and-mem-with-reg/imm32/next -11707 _Primitive-and-mem-with-reg: # (payload primitive) -11708 0x11/imm32/alloc-id:fake:payload -11709 # var1/reg <- and var2 => 23/and var2/rm32 var1/r32 -11710 0x11/imm32/alloc-id:fake -11711 _string-and/imm32/name -11712 0x11/imm32/alloc-id:fake -11713 Single-int-var-in-mem/imm32/inouts -11714 0x11/imm32/alloc-id:fake -11715 Single-int-var-in-some-register/imm32/outputs -11716 0x11/imm32/alloc-id:fake -11717 _string_23_and/imm32/subx-name -11718 1/imm32/rm32-is-first-inout -11719 3/imm32/r32-is-first-output -11720 0/imm32/no-imm32 -11721 0/imm32/no-disp32 -11722 0/imm32/output-is-write-only -11723 0x11/imm32/alloc-id:fake -11724 _Primitive-and-lit-with-reg/imm32/next -11725 _Primitive-and-lit-with-reg: # (payload primitive) -11726 0x11/imm32/alloc-id:fake:payload -11727 # var1/reg <- and lit => 81 4/subop/and var1/rm32 lit/imm32 -11728 0x11/imm32/alloc-id:fake -11729 _string-and/imm32/name -11730 0x11/imm32/alloc-id:fake -11731 Single-lit-var/imm32/inouts -11732 0x11/imm32/alloc-id:fake -11733 Single-int-var-in-some-register/imm32/outputs -11734 0x11/imm32/alloc-id:fake -11735 _string_81_subop_and/imm32/subx-name -11736 3/imm32/rm32-is-first-output -11737 0/imm32/no-r32 -11738 1/imm32/imm32-is-first-inout -11739 0/imm32/no-disp32 -11740 0/imm32/output-is-write-only -11741 0x11/imm32/alloc-id:fake -11742 _Primitive-and-lit-with-mem/imm32/next -11743 _Primitive-and-lit-with-mem: # (payload primitive) -11744 0x11/imm32/alloc-id:fake:payload -11745 # and-with var1, lit => 81 4/subop/and var1/rm32 lit/imm32 -11746 0x11/imm32/alloc-id:fake -11747 _string-and-with/imm32/name -11748 0x11/imm32/alloc-id:fake -11749 Int-var-and-literal/imm32/inouts -11750 0/imm32/no-outputs -11751 0/imm32/no-outputs -11752 0x11/imm32/alloc-id:fake -11753 _string_81_subop_and/imm32/subx-name -11754 1/imm32/rm32-is-first-inout -11755 0/imm32/no-r32 -11756 2/imm32/imm32-is-first-inout -11757 0/imm32/no-disp32 -11758 0/imm32/output-is-write-only -11759 0x11/imm32/alloc-id:fake -11760 _Primitive-or-with-eax/imm32/next -11761 # - or -11762 _Primitive-or-with-eax: # (payload primitive) -11763 0x11/imm32/alloc-id:fake:payload -11764 # var/eax <- or lit => 0d/or-with-eax lit/imm32 -11765 0x11/imm32/alloc-id:fake -11766 _string-or/imm32/name -11767 0x11/imm32/alloc-id:fake -11768 Single-lit-var/imm32/inouts -11769 0x11/imm32/alloc-id:fake -11770 Single-int-var-in-eax/imm32/outputs -11771 0x11/imm32/alloc-id:fake -11772 _string_0d_or_with_eax/imm32/subx-name -11773 0/imm32/no-rm32 -11774 0/imm32/no-r32 -11775 1/imm32/imm32-is-first-inout -11776 0/imm32/no-disp32 -11777 0/imm32/output-is-write-only -11778 0x11/imm32/alloc-id:fake -11779 _Primitive-or-reg-with-reg/imm32/next -11780 _Primitive-or-reg-with-reg: # (payload primitive) -11781 0x11/imm32/alloc-id:fake:payload -11782 # var1/reg <- or var2/reg => 09/or-with var1/rm32 var2/r32 -11783 0x11/imm32/alloc-id:fake -11784 _string-or/imm32/name -11785 0x11/imm32/alloc-id:fake -11786 Single-int-var-in-some-register/imm32/inouts -11787 0x11/imm32/alloc-id:fake -11788 Single-int-var-in-some-register/imm32/outputs -11789 0x11/imm32/alloc-id:fake -11790 _string_09_or_with/imm32/subx-name -11791 3/imm32/rm32-is-first-output -11792 1/imm32/r32-is-first-inout -11793 0/imm32/no-imm32 -11794 0/imm32/no-disp32 -11795 0/imm32/output-is-write-only -11796 0x11/imm32/alloc-id:fake -11797 _Primitive-or-reg-with-mem/imm32/next -11798 _Primitive-or-reg-with-mem: # (payload primitive) -11799 0x11/imm32/alloc-id:fake:payload -11800 # or-with var1 var2/reg => 09/or-with var1 var2/r32 -11801 0x11/imm32/alloc-id:fake -11802 _string-or-with/imm32/name -11803 0x11/imm32/alloc-id:fake -11804 Two-args-int-stack-int-reg/imm32/inouts -11805 0/imm32/no-outputs -11806 0/imm32/no-outputs -11807 0x11/imm32/alloc-id:fake -11808 _string_09_or_with/imm32/subx-name -11809 1/imm32/rm32-is-first-inout -11810 2/imm32/r32-is-second-inout -11811 0/imm32/no-imm32 -11812 0/imm32/no-disp32 -11813 0/imm32/output-is-write-only -11814 0x11/imm32/alloc-id:fake -11815 _Primitive-or-mem-with-reg/imm32/next -11816 _Primitive-or-mem-with-reg: # (payload primitive) -11817 0x11/imm32/alloc-id:fake:payload -11818 # var1/reg <- or var2 => 0b/or var2/rm32 var1/r32 -11819 0x11/imm32/alloc-id:fake -11820 _string-or/imm32/name -11821 0x11/imm32/alloc-id:fake -11822 Single-int-var-in-mem/imm32/inouts -11823 0x11/imm32/alloc-id:fake -11824 Single-int-var-in-some-register/imm32/outputs -11825 0x11/imm32/alloc-id:fake -11826 _string_0b_or/imm32/subx-name -11827 1/imm32/rm32-is-first-inout -11828 3/imm32/r32-is-first-output -11829 0/imm32/no-imm32 -11830 0/imm32/no-disp32 -11831 0/imm32/output-is-write-only -11832 0x11/imm32/alloc-id:fake -11833 _Primitive-or-lit-with-reg/imm32/next -11834 _Primitive-or-lit-with-reg: # (payload primitive) -11835 0x11/imm32/alloc-id:fake:payload -11836 # var1/reg <- or lit => 81 1/subop/or var1/rm32 lit/imm32 -11837 0x11/imm32/alloc-id:fake -11838 _string-or/imm32/name -11839 0x11/imm32/alloc-id:fake -11840 Single-lit-var/imm32/inouts -11841 0x11/imm32/alloc-id:fake -11842 Single-int-var-in-some-register/imm32/outputs -11843 0x11/imm32/alloc-id:fake -11844 _string_81_subop_or/imm32/subx-name -11845 3/imm32/rm32-is-first-output -11846 0/imm32/no-r32 -11847 1/imm32/imm32-is-first-inout -11848 0/imm32/no-disp32 -11849 0/imm32/output-is-write-only -11850 0x11/imm32/alloc-id:fake -11851 _Primitive-or-lit-with-mem/imm32/next -11852 _Primitive-or-lit-with-mem: # (payload primitive) -11853 0x11/imm32/alloc-id:fake:payload -11854 # or-with var1, lit => 81 1/subop/or var1/rm32 lit/imm32 -11855 0x11/imm32/alloc-id:fake -11856 _string-or-with/imm32/name -11857 0x11/imm32/alloc-id:fake -11858 Int-var-and-literal/imm32/inouts -11859 0/imm32/no-outputs -11860 0/imm32/no-outputs -11861 0x11/imm32/alloc-id:fake -11862 _string_81_subop_or/imm32/subx-name -11863 1/imm32/rm32-is-first-inout -11864 0/imm32/no-r32 -11865 2/imm32/imm32-is-second-inout -11866 0/imm32/no-disp32 -11867 0/imm32/output-is-write-only -11868 0x11/imm32/alloc-id:fake -11869 _Primitive-xor-with-eax/imm32/next -11870 # - xor -11871 _Primitive-xor-with-eax: # (payload primitive) -11872 0x11/imm32/alloc-id:fake:payload -11873 # var/eax <- xor lit => 35/xor-with-eax lit/imm32 -11874 0x11/imm32/alloc-id:fake -11875 _string-xor/imm32/name -11876 0x11/imm32/alloc-id:fake -11877 Single-lit-var/imm32/inouts -11878 0x11/imm32/alloc-id:fake -11879 Single-int-var-in-eax/imm32/outputs -11880 0x11/imm32/alloc-id:fake -11881 _string_35_xor_with_eax/imm32/subx-name -11882 0/imm32/no-rm32 -11883 0/imm32/no-r32 -11884 1/imm32/imm32-is-first-inout -11885 0/imm32/no-disp32 -11886 0/imm32/output-is-write-only -11887 0x11/imm32/alloc-id:fake -11888 _Primitive-xor-reg-with-reg/imm32/next -11889 _Primitive-xor-reg-with-reg: # (payload primitive) -11890 0x11/imm32/alloc-id:fake:payload -11891 # var1/reg <- xor var2/reg => 31/xor-with var1/rm32 var2/r32 -11892 0x11/imm32/alloc-id:fake -11893 _string-xor/imm32/name -11894 0x11/imm32/alloc-id:fake -11895 Single-int-var-in-some-register/imm32/inouts -11896 0x11/imm32/alloc-id:fake -11897 Single-int-var-in-some-register/imm32/outputs -11898 0x11/imm32/alloc-id:fake -11899 _string_31_xor_with/imm32/subx-name -11900 3/imm32/rm32-is-first-output -11901 1/imm32/r32-is-first-inout -11902 0/imm32/no-imm32 -11903 0/imm32/no-disp32 -11904 0/imm32/output-is-write-only -11905 0x11/imm32/alloc-id:fake -11906 _Primitive-xor-reg-with-mem/imm32/next -11907 _Primitive-xor-reg-with-mem: # (payload primitive) -11908 0x11/imm32/alloc-id:fake:payload -11909 # xor-with var1 var2/reg => 31/xor-with var1 var2/r32 -11910 0x11/imm32/alloc-id:fake -11911 _string-xor-with/imm32/name -11912 0x11/imm32/alloc-id:fake -11913 Two-args-int-stack-int-reg/imm32/inouts -11914 0/imm32/no-outputs -11915 0/imm32/no-outputs + 9464 # like type-equal? but takes literals into account + 9465 type-match?: # def: (addr tree type-id), call: (addr tree type-id) -> result/eax: boolean + 9466 # . prologue + 9467 55/push-ebp + 9468 89/<- %ebp 4/r32/esp + 9469 # if (call == literal) return true # TODO: more precise + 9470 (is-simple-mu-type? *(ebp+0xc) 0) # literal => eax + 9471 3d/compare-eax-and 0/imm32/false + 9472 b8/copy-to-eax 1/imm32/true + 9473 75/jump-if-!= $type-match?:end/disp8 + 9474 $type-match?:baseline: + 9475 # otherwise fall back + 9476 (type-equal? *(ebp+8) *(ebp+0xc)) # => eax + 9477 $type-match?:end: + 9478 # . epilogue + 9479 89/<- %esp 5/r32/ebp + 9480 5d/pop-to-ebp + 9481 c3/return + 9482 + 9483 size-of: # v: (addr var) -> result/eax: int + 9484 # . prologue + 9485 55/push-ebp + 9486 89/<- %ebp 4/r32/esp + 9487 # . save registers + 9488 51/push-ecx + 9489 # var t/ecx: (addr tree type-id) = lookup(v->type) + 9490 8b/-> *(ebp+8) 1/r32/ecx + 9491 #? (write-buffered Stderr "size-of ") + 9492 #? (print-int32-buffered Stderr %ecx) + 9493 #? (write-buffered Stderr Newline) + 9494 #? (write-buffered Stderr "type allocid: ") + 9495 #? (print-int32-buffered Stderr *(ecx+8)) + 9496 #? (write-buffered Stderr Newline) + 9497 #? (flush Stderr) + 9498 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 9499 89/<- %ecx 0/r32/eax + 9500 # if is-mu-array?(t) return size-of-array(t) + 9501 { + 9502 (is-mu-array? %ecx) # => eax + 9503 3d/compare-eax-and 0/imm32/false + 9504 74/jump-if-= break/disp8 + 9505 (size-of-array %ecx) # => eax + 9506 eb/jump $size-of:end/disp8 + 9507 } + 9508 # if (!t->is-atom?) t = lookup(t->left) + 9509 { + 9510 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom + 9511 75/jump-if-!= break/disp8 + 9512 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax + 9513 89/<- %ecx 0/r32/eax + 9514 } + 9515 # TODO: assert t->is-atom? + 9516 (size-of-type-id *(ecx+4)) # Tree-value => eax + 9517 $size-of:end: + 9518 # . restore registers + 9519 59/pop-to-ecx + 9520 # . epilogue + 9521 89/<- %esp 5/r32/ebp + 9522 5d/pop-to-ebp + 9523 c3/return + 9524 + 9525 size-of-deref: # v: (addr var) -> result/eax: int + 9526 # . prologue + 9527 55/push-ebp + 9528 89/<- %ebp 4/r32/esp + 9529 # . save registers + 9530 51/push-ecx + 9531 # var t/ecx: (addr tree type-id) = lookup(v->type) + 9532 8b/-> *(ebp+8) 1/r32/ecx + 9533 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax + 9534 89/<- %ecx 0/r32/eax + 9535 # TODO: assert(t is an addr) + 9536 # t = lookup(t->right) + 9537 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax + 9538 89/<- %ecx 0/r32/eax + 9539 # if is-mu-array?(t) return size-of-array(t) + 9540 { + 9541 (is-mu-array? %ecx) # => eax + 9542 3d/compare-eax-and 0/imm32/false + 9543 74/jump-if-= break/disp8 + 9544 (size-of-array %ecx) # => eax + 9545 eb/jump $size-of:end/disp8 + 9546 } + 9547 # if (!t->is-atom?) t = lookup(t->left) + 9548 { + 9549 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom + 9550 75/jump-if-!= break/disp8 + 9551 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax + 9552 89/<- %ecx 0/r32/eax + 9553 } + 9554 # TODO: assert t->is-atom? + 9555 (size-of-type-id *(ecx+4)) # Tree-value => eax + 9556 $size-of-deref:end: + 9557 # . restore registers + 9558 59/pop-to-ecx + 9559 # . epilogue + 9560 89/<- %esp 5/r32/ebp + 9561 5d/pop-to-ebp + 9562 c3/return + 9563 + 9564 is-mu-array?: # t: (addr tree type-id) -> result/eax: boolean + 9565 # . prologue + 9566 55/push-ebp + 9567 89/<- %ebp 4/r32/esp + 9568 # . save registers + 9569 51/push-ecx + 9570 # ecx = t + 9571 8b/-> *(ebp+8) 1/r32/ecx + 9572 # if t->is-atom?, return false + 9573 81 7/subop/compare *ecx 0/imm32/false # Tree-is-atom + 9574 75/jump-if-!= $is-mu-array?:return-false/disp8 + 9575 # if !t->left->is-atom?, return false + 9576 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax + 9577 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom + 9578 74/jump-if-= $is-mu-array?:return-false/disp8 + 9579 # return t->left->value == array + 9580 81 7/subop/compare *(eax+4) 3/imm32/array-type-id # Tree-value + 9581 0f 94/set-if-= %al + 9582 81 4/subop/and %eax 0xff/imm32 + 9583 eb/jump $is-mu-array?:end/disp8 + 9584 $is-mu-array?:return-false: + 9585 b8/copy-to-eax 0/imm32/false + 9586 $is-mu-array?:end: + 9587 # . restore registers + 9588 59/pop-to-ecx + 9589 # . epilogue + 9590 89/<- %esp 5/r32/ebp + 9591 5d/pop-to-ebp + 9592 c3/return + 9593 + 9594 size-of-array: # a: (addr tree type-id) -> result/eax: int + 9595 # . prologue + 9596 55/push-ebp + 9597 89/<- %ebp 4/r32/esp + 9598 # . save registers + 9599 51/push-ecx + 9600 52/push-edx + 9601 # + 9602 8b/-> *(ebp+8) 1/r32/ecx + 9603 # TODO: assert that a->left is 'array' + 9604 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax + 9605 89/<- %ecx 0/r32/eax + 9606 # var elem-type/edx: type-id = a->right->left->value + 9607 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax + 9608 8b/-> *(eax+4) 2/r32/edx # Tree-value + 9609 # var array-size/ecx: int = a->right->right->left->value + 9610 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax + 9611 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax + 9612 8b/-> *(eax+4) 1/r32/ecx # Tree-value + 9613 # return array-size * size-of(elem-type) + 9614 (size-of-type-id-as-array-element %edx) # => eax + 9615 f7 4/subop/multiply-into-eax %ecx + 9616 05/add-to-eax 4/imm32 # for array size + 9617 $size-of-array:end: + 9618 # . restore registers + 9619 5a/pop-to-edx + 9620 59/pop-to-ecx + 9621 # . epilogue + 9622 89/<- %esp 5/r32/ebp + 9623 5d/pop-to-ebp + 9624 c3/return + 9625 + 9626 size-of-type-id: # t: type-id -> result/eax: int + 9627 # . prologue + 9628 55/push-ebp + 9629 89/<- %ebp 4/r32/esp + 9630 # . save registers + 9631 51/push-ecx + 9632 # var out/ecx: (handle typeinfo) + 9633 68/push 0/imm32 + 9634 68/push 0/imm32 + 9635 89/<- %ecx 4/r32/esp + 9636 # eax = t + 9637 8b/-> *(ebp+8) 0/r32/eax + 9638 # if t is a literal, return 0 + 9639 3d/compare-eax-and 0/imm32 + 9640 0f 84/jump-if-= $size-of-type-id:end/disp32 # eax changes type from type-id to int + 9641 # if t is a byte, return 4 (because we don't really support non-multiples of 4) + 9642 3d/compare-eax-and 8/imm32/byte + 9643 { + 9644 75/jump-if-!= break/disp8 + 9645 b8/copy-to-eax 4/imm32 + 9646 eb/jump $size-of-type-id:end/disp8 + 9647 } + 9648 # if t is a handle, return 8 + 9649 3d/compare-eax-and 4/imm32/handle + 9650 { + 9651 75/jump-if-!= break/disp8 + 9652 b8/copy-to-eax 8/imm32 + 9653 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int + 9654 } + 9655 # if t is a user-defined type, return its size + 9656 # TODO: support non-atom type + 9657 (find-typeinfo %eax %ecx) + 9658 { + 9659 81 7/subop/compare *ecx 0/imm32 + 9660 74/jump-if-= break/disp8 + 9661 $size-of-type-id:user-defined: + 9662 (lookup *ecx *(ecx+4)) # => eax + 9663 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes + 9664 eb/jump $size-of-type-id:end/disp8 + 9665 } + 9666 # otherwise return the word size + 9667 b8/copy-to-eax 4/imm32 + 9668 $size-of-type-id:end: + 9669 # . reclaim locals + 9670 81 0/subop/add %esp 8/imm32 + 9671 # . restore registers + 9672 59/pop-to-ecx + 9673 # . epilogue + 9674 89/<- %esp 5/r32/ebp + 9675 5d/pop-to-ebp + 9676 c3/return + 9677 + 9678 type-equal?: # a: (addr tree type-id), b: (addr tree type-id) -> result/eax: boolean + 9679 # . prologue + 9680 55/push-ebp + 9681 89/<- %ebp 4/r32/esp + 9682 # . save registers + 9683 51/push-ecx + 9684 52/push-edx + 9685 53/push-ebx + 9686 # ecx = a + 9687 8b/-> *(ebp+8) 1/r32/ecx + 9688 # edx = b + 9689 8b/-> *(ebp+0xc) 2/r32/edx + 9690 $type-equal?:compare-addr: + 9691 # if (a == b) return true + 9692 8b/-> %ecx 0/r32/eax # Var-type + 9693 39/compare %edx 0/r32/eax # Var-type + 9694 b8/copy-to-eax 1/imm32/true + 9695 0f 84/jump-if-= $type-equal?:end/disp32 + 9696 $type-equal?:compare-atom-state: + 9697 # if (a->is-atom? != b->is-atom?) return false + 9698 8b/-> *ecx 3/r32/ebx # Tree-value + 9699 39/compare *edx 3/r32/ebx # Tree-value + 9700 b8/copy-to-eax 0/imm32/false + 9701 0f 85/jump-if-!= $type-equal?:end/disp32 + 9702 # if a->is-atom? return (a->value == b->value) + 9703 { + 9704 $type-equal?:check-atom: + 9705 81 7/subop/compare %ebx 0/imm32/false + 9706 74/jump-if-= break/disp8 + 9707 $type-equal?:is-atom: + 9708 8b/-> *(ecx+4) 0/r32/eax # Tree-value + 9709 39/compare *(edx+4) 0/r32/eax # Tree-value + 9710 0f 94/set-if-= %al + 9711 81 4/subop/and %eax 0xff/imm32 + 9712 e9/jump $type-equal?:end/disp32 + 9713 } + 9714 $type-equal?:check-left: + 9715 # if (!type-equal?(a->left, b->left)) return false + 9716 (lookup *(ecx+4) *(ecx+8)) # Tree-left Tree-left => eax + 9717 89/<- %ebx 0/r32/eax + 9718 (lookup *(edx+4) *(edx+8)) # Tree-left Tree-left => eax + 9719 (type-equal? %eax %ebx) # => eax + 9720 3d/compare-eax-and 0/imm32/false + 9721 74/jump-if-= $type-equal?:end/disp8 + 9722 $type-equal?:check-right: + 9723 # return type-equal?(a->right, b->right) + 9724 (lookup *(ecx+0xc) *(ecx+0x10)) # Tree-right Tree-right => eax + 9725 89/<- %ebx 0/r32/eax + 9726 (lookup *(edx+0xc) *(edx+0x10)) # Tree-right Tree-right => eax + 9727 (type-equal? %eax %ebx) # => eax + 9728 $type-equal?:end: + 9729 # . restore registers + 9730 5b/pop-to-ebx + 9731 5a/pop-to-edx + 9732 59/pop-to-ecx + 9733 # . epilogue + 9734 89/<- %esp 5/r32/ebp + 9735 5d/pop-to-ebp + 9736 c3/return + 9737 + 9738 ####################################################### + 9739 # Code-generation + 9740 ####################################################### + 9741 + 9742 == data + 9743 + 9744 Curr-block-depth: # (addr int) + 9745 0/imm32 + 9746 Curr-local-stack-offset: # (addr int) + 9747 0/imm32 + 9748 + 9749 == code + 9750 + 9751 emit-subx: # out: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) + 9752 # . prologue + 9753 55/push-ebp + 9754 89/<- %ebp 4/r32/esp + 9755 # . save registers + 9756 50/push-eax + 9757 # var curr/eax: (addr function) = *Program->functions + 9758 (lookup *_Program-functions *_Program-functions->payload) # => eax + 9759 { + 9760 # if (curr == null) break + 9761 3d/compare-eax-and 0/imm32 + 9762 0f 84/jump-if-= break/disp32 + 9763 (emit-subx-function *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) + 9764 # curr = lookup(curr->next) + 9765 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax + 9766 e9/jump loop/disp32 + 9767 } + 9768 $emit-subx:end: + 9769 # . restore registers + 9770 58/pop-to-eax + 9771 # . epilogue + 9772 89/<- %esp 5/r32/ebp + 9773 5d/pop-to-ebp + 9774 c3/return + 9775 + 9776 emit-subx-function: # out: (addr buffered-file), f: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) + 9777 # . prologue + 9778 55/push-ebp + 9779 89/<- %ebp 4/r32/esp + 9780 # some preprocessing + 9781 (populate-mu-type-offsets-in-inouts *(ebp+0xc)) + 9782 # . save registers + 9783 50/push-eax + 9784 51/push-ecx + 9785 52/push-edx + 9786 57/push-edi + 9787 # initialize some global state + 9788 c7 0/subop/copy *Curr-block-depth 1/imm32 + 9789 c7 0/subop/copy *Curr-local-stack-offset 0/imm32 + 9790 # ecx = f + 9791 8b/-> *(ebp+0xc) 1/r32/ecx + 9792 # var vars/edx: (stack (addr var) 256) + 9793 81 5/subop/subtract %esp 0xc00/imm32 + 9794 68/push 0xc00/imm32/size + 9795 68/push 0/imm32/top + 9796 89/<- %edx 4/r32/esp + 9797 # var name/eax: (addr array byte) = lookup(f->name) + 9798 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax + 9799 # + 9800 (write-buffered *(ebp+8) %eax) + 9801 (write-buffered *(ebp+8) ":\n") + 9802 (emit-subx-prologue *(ebp+8)) + 9803 # var outputs/edi: (addr list var) = lookup(f->outputs) + 9804 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax + 9805 89/<- %edi 0/r32/eax + 9806 # var body/eax: (addr block) = lookup(f->body) + 9807 (lookup *(ecx+0x18) *(ecx+0x1c)) # Function-body Function-body => eax + 9808 # + 9809 (emit-subx-block *(ebp+8) %eax %edx %edi *(ebp+0x10) *(ebp+0x14)) + 9810 (emit-subx-epilogue *(ebp+8)) + 9811 # TODO: validate that *Curr-block-depth and *Curr-local-stack-offset have + 9812 # been cleaned up + 9813 $emit-subx-function:end: + 9814 # . reclaim locals + 9815 81 0/subop/add %esp 0xc08/imm32 + 9816 # . restore registers + 9817 5f/pop-to-edi + 9818 5a/pop-to-edx + 9819 59/pop-to-ecx + 9820 58/pop-to-eax + 9821 # . epilogue + 9822 89/<- %esp 5/r32/ebp + 9823 5d/pop-to-ebp + 9824 c3/return + 9825 + 9826 populate-mu-type-offsets-in-inouts: # f: (addr function) + 9827 # . prologue + 9828 55/push-ebp + 9829 89/<- %ebp 4/r32/esp + 9830 # . save registers + 9831 50/push-eax + 9832 51/push-ecx + 9833 52/push-edx + 9834 53/push-ebx + 9835 57/push-edi + 9836 # var next-offset/edx: int = 8 + 9837 ba/copy-to-edx 8/imm32 + 9838 # var curr/ecx: (addr list var) = lookup(f->inouts) + 9839 8b/-> *(ebp+8) 1/r32/ecx + 9840 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax + 9841 89/<- %ecx 0/r32/eax + 9842 { + 9843 $populate-mu-type-offsets-in-inouts:loop: + 9844 81 7/subop/compare %ecx 0/imm32 + 9845 74/jump-if-= break/disp8 + 9846 # var v/ebx: (addr var) = lookup(curr->value) + 9847 (lookup *ecx *(ecx+4)) # List-value List-value => eax + 9848 89/<- %ebx 0/r32/eax + 9849 #? (lookup *ebx *(ebx+4)) + 9850 #? (write-buffered Stderr "setting offset of fn inout ") + 9851 #? (write-buffered Stderr %eax) + 9852 #? (write-buffered Stderr "@") + 9853 #? (print-int32-buffered Stderr %ebx) + 9854 #? (write-buffered Stderr " to ") + 9855 #? (print-int32-buffered Stderr %edx) + 9856 #? (write-buffered Stderr Newline) + 9857 #? (flush Stderr) + 9858 # v->offset = next-offset + 9859 89/<- *(ebx+0x14) 2/r32/edx # Var-offset + 9860 # next-offset += size-of(v) + 9861 (size-of %ebx) # => eax + 9862 01/add-to %edx 0/r32/eax + 9863 # curr = lookup(curr->next) + 9864 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax + 9865 89/<- %ecx 0/r32/eax + 9866 # + 9867 eb/jump loop/disp8 + 9868 } + 9869 $populate-mu-type-offsets-in-inouts:end: + 9870 # . restore registers + 9871 5f/pop-to-edi + 9872 5b/pop-to-ebx + 9873 5a/pop-to-edx + 9874 59/pop-to-ecx + 9875 58/pop-to-eax + 9876 # . epilogue + 9877 89/<- %esp 5/r32/ebp + 9878 5d/pop-to-ebp + 9879 c3/return + 9880 + 9881 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) + 9882 # . prologue + 9883 55/push-ebp + 9884 89/<- %ebp 4/r32/esp + 9885 # . save registers + 9886 50/push-eax + 9887 51/push-ecx + 9888 53/push-ebx + 9889 56/push-esi + 9890 # esi = stmts + 9891 8b/-> *(ebp+0xc) 6/r32/esi + 9892 # + 9893 { + 9894 $emit-subx-stmt-list:loop: + 9895 81 7/subop/compare %esi 0/imm32 + 9896 0f 84/jump-if-= break/disp32 + 9897 # var curr-stmt/ecx: (addr stmt) = lookup(stmts->value) + 9898 (lookup *esi *(esi+4)) # List-value List-value => eax + 9899 89/<- %ecx 0/r32/eax + 9900 { + 9901 $emit-subx-stmt-list:check-for-block: + 9902 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag + 9903 75/jump-if-!= break/disp8 + 9904 $emit-subx-stmt-list:block: + 9905 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) + 9906 } + 9907 { + 9908 $emit-subx-stmt-list:check-for-stmt: + 9909 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag + 9910 0f 85/jump-if-!= break/disp32 + 9911 $emit-subx-stmt-list:stmt1: + 9912 { + 9913 (is-mu-branch? %ecx) # => eax + 9914 3d/compare-eax-and 0/imm32/false + 9915 0f 84/jump-if-= break/disp32 + 9916 $emit-subx-stmt-list:branch-stmt: + 9917 +-- 27 lines: # unconditional loops ----------------------------------------------------------------------------------------------------------------------------------------------------- + 9944 +-- 16 lines: # unconditional breaks ---------------------------------------------------------------------------------------------------------------------------------------------------- + 9960 +-- 38 lines: # simple conditional branches without a target ---------------------------------------------------------------------------------------------------------------------------- + 9998 +-- 19 lines: # conditional branches with an explicit target ---------------------------------------------------------------------------------------------------------------------------- +10017 } +10018 $emit-subx-stmt-list:1-to-1: +10019 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x18) *(ebp+0x1c)) +10020 e9/jump $emit-subx-stmt-list:continue/disp32 +10021 } +10022 { +10023 $emit-subx-stmt-list:check-for-var-def: +10024 81 7/subop/compare *ecx 2/imm32/var-def # Stmt-tag +10025 75/jump-if-!= break/disp8 +10026 $emit-subx-stmt-list:var-def: +10027 (emit-subx-var-def *(ebp+8) %ecx) +10028 (push *(ebp+0x10) *(ecx+4)) # Vardef-var +10029 (push *(ebp+0x10) *(ecx+8)) # Vardef-var +10030 (push *(ebp+0x10) 0) # Live-var-register-spilled = 0 for vars on the stack +10031 # +10032 eb/jump $emit-subx-stmt-list:continue/disp8 +10033 } +10034 { +10035 $emit-subx-stmt-list:check-for-reg-var-def: +10036 81 7/subop/compare *ecx 3/imm32/reg-var-def # Stmt-tag +10037 0f 85/jump-if-!= break/disp32 +10038 $emit-subx-stmt-list:reg-var-def: +10039 # TODO: ensure that there's exactly one output +10040 (push-output-and-maybe-emit-spill *(ebp+8) %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +10041 # emit the instruction as usual +10042 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x18) *(ebp+0x1c)) +10043 # +10044 eb/jump $emit-subx-stmt-list:continue/disp8 +10045 } +10046 $emit-subx-stmt-list:continue: +10047 # TODO: raise an error on unrecognized Stmt-tag +10048 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax +10049 89/<- %esi 0/r32/eax +10050 e9/jump loop/disp32 +10051 } +10052 $emit-subx-stmt-list:emit-cleanup: +10053 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth) +10054 $emit-subx-stmt-list:clean-up: +10055 (clean-up-blocks *(ebp+0x10) *Curr-block-depth) +10056 $emit-subx-stmt-list:end: +10057 # . restore registers +10058 5e/pop-to-esi +10059 5b/pop-to-ebx +10060 59/pop-to-ecx +10061 58/pop-to-eax +10062 # . epilogue +10063 89/<- %esp 5/r32/ebp +10064 5d/pop-to-ebp +10065 c3/return +10066 +10067 # 'later-stmts' includes 'stmt', but will behave the same even without it; reg-var-def stmts are guaranteed not to write to function outputs. +10068 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) +10069 # . prologue +10070 55/push-ebp +10071 89/<- %ebp 4/r32/esp +10072 # . save registers +10073 50/push-eax +10074 51/push-ecx +10075 52/push-edx +10076 # ecx = stmt +10077 8b/-> *(ebp+0xc) 1/r32/ecx +10078 # var sv/eax: (addr stmt-var) = lookup(curr-stmt->outputs) +10079 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax +10080 # TODO: assert !sv->is-deref? +10081 # var v/ecx: (addr var) = lookup(sv->value) +10082 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +10083 89/<- %ecx 0/r32/eax +10084 # v->block-depth = *Curr-block-depth +10085 8b/-> *Curr-block-depth 0/r32/eax +10086 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +10087 #? (write-buffered Stderr "var ") +10088 #? (lookup *ecx *(ecx+4)) +10089 #? (write-buffered Stderr %eax) +10090 #? (write-buffered Stderr " at depth ") +10091 #? (print-int32-buffered Stderr *(ecx+0x10)) +10092 #? (write-buffered Stderr Newline) +10093 #? (flush Stderr) +10094 # ensure that v is in a register +10095 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +10096 0f 84/jump-if-= $push-output-and-maybe-emit-spill:abort/disp32 +10097 # var emit-spill?/edx: boolean = not-yet-spilled-this-block? && will-not-write-some-register?(fn-outputs) +10098 (not-yet-spilled-this-block? %ecx *(ebp+0x10)) # => eax +10099 89/<- %edx 0/r32/eax +10100 3d/compare-eax-and 0/imm32/false +10101 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 +10102 (will-not-write-some-register? %ecx *(ebp+0x14) *(ebp+0x18)) # => eax +10103 89/<- %edx 0/r32/eax +10104 # check emit-spill? +10105 3d/compare-eax-and 0/imm32/false +10106 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 +10107 # TODO: assert(size-of(output) == 4) +10108 # *Curr-local-stack-offset -= 4 +10109 81 5/subop/subtract *Curr-local-stack-offset 4/imm32 +10110 # emit spill +10111 (emit-indent *(ebp+8) *Curr-block-depth) +10112 (write-buffered *(ebp+8) "ff 6/subop/push %") +10113 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +10114 (write-buffered *(ebp+8) %eax) +10115 (write-buffered *(ebp+8) Newline) +10116 $push-output-and-maybe-emit-spill:push: +10117 8b/-> *(ebp+0xc) 1/r32/ecx +10118 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax +10119 # push(vars, {sv->value, emit-spill?}) +10120 (push *(ebp+0x10) *eax) # Stmt-var-value +10121 (push *(ebp+0x10) *(eax+4)) # Stmt-var-value +10122 (push *(ebp+0x10) %edx) +10123 $push-output-and-maybe-emit-spill:end: +10124 # . restore registers +10125 5a/pop-to-edx +10126 59/pop-to-ecx +10127 58/pop-to-eax +10128 # . epilogue +10129 89/<- %esp 5/r32/ebp +10130 5d/pop-to-ebp +10131 c3/return +10132 +10133 $push-output-and-maybe-emit-spill:abort: +10134 # error("var '" var->name "' initialized from an instruction must live in a register\n") +10135 (write-buffered *(ebp+0x1c) "var '") +10136 (write-buffered *(ebp+0x1c) *eax) # Var-name +10137 (write-buffered *(ebp+0x1c) "' initialized from an instruction must live in a register\n") +10138 (flush *(ebp+0x1c)) +10139 (stop *(ebp+0x20) 1) +10140 # never gets here +10141 +10142 emit-subx-cleanup-and-unconditional-nonlocal-branch: # out: (addr buffered-file), stmt: (addr stmt1), vars: (addr stack live-var) +10143 # . prologue +10144 55/push-ebp +10145 89/<- %ebp 4/r32/esp +10146 # . save registers +10147 50/push-eax +10148 51/push-ecx +10149 # ecx = stmt +10150 8b/-> *(ebp+0xc) 1/r32/ecx +10151 # var target/eax: (addr array byte) = curr-stmt->inouts->value->name +10152 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +10153 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +10154 (lookup *eax *(eax+4)) # Var-name Var-name => eax +10155 # clean up until target block +10156 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %eax) +10157 # emit jump to target block +10158 (emit-indent *(ebp+8) *Curr-block-depth) +10159 (write-buffered *(ebp+8) "e9/jump ") +10160 (write-buffered *(ebp+8) %eax) +10161 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +10162 (string-starts-with? %eax "break") +10163 3d/compare-eax-and 0/imm32/false +10164 { +10165 74/jump-if-= break/disp8 +10166 (write-buffered *(ebp+8) ":break/disp32\n") +10167 } +10168 3d/compare-eax-and 0/imm32/false # just in case the function call modified flags +10169 { +10170 75/jump-if-!= break/disp8 +10171 (write-buffered *(ebp+8) ":loop/disp32\n") +10172 } +10173 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end: +10174 # . restore registers +10175 59/pop-to-ecx +10176 58/pop-to-eax +10177 # . epilogue +10178 89/<- %esp 5/r32/ebp +10179 5d/pop-to-ebp +10180 c3/return +10181 +10182 is-mu-branch?: # stmt: (addr stmt1) -> result/eax: boolean +10183 # . prologue +10184 55/push-ebp +10185 89/<- %ebp 4/r32/esp +10186 # . save registers +10187 51/push-ecx +10188 # ecx = lookup(stmt->operation) +10189 8b/-> *(ebp+8) 1/r32/ecx +10190 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +10191 89/<- %ecx 0/r32/eax +10192 # if (stmt->operation starts with "loop") return true +10193 (string-starts-with? %ecx "loop") # => eax +10194 3d/compare-eax-and 0/imm32/false +10195 75/jump-if-not-equal $is-mu-branch?:end/disp8 +10196 # otherwise return (stmt->operation starts with "break") +10197 (string-starts-with? %ecx "break") # => eax +10198 $is-mu-branch?:end: +10199 # . restore registers +10200 59/pop-to-ecx +10201 # . epilogue +10202 89/<- %esp 5/r32/ebp +10203 5d/pop-to-ebp +10204 c3/return +10205 +10206 emit-reverse-break: # out: (addr buffered-file), stmt: (addr stmt1) +10207 # . prologue +10208 55/push-ebp +10209 89/<- %ebp 4/r32/esp +10210 # . save registers +10211 50/push-eax +10212 # eax = stmt +10213 8b/-> *(ebp+0xc) 0/r32/eax +10214 # +10215 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +10216 (get Reverse-branch %eax 0x10 "reverse-branch: ") # => eax: (addr handle array byte) +10217 (emit-indent *(ebp+8) *Curr-block-depth) +10218 (lookup *eax *(eax+4)) # => eax +10219 (write-buffered *(ebp+8) %eax) +10220 (write-buffered *(ebp+8) " break/disp32\n") +10221 $emit-reverse-break:end: +10222 # . restore registers +10223 58/pop-to-eax +10224 # . epilogue +10225 89/<- %esp 5/r32/ebp +10226 5d/pop-to-ebp +10227 c3/return +10228 +10229 == data +10230 +10231 # Table from Mu branch instructions to the reverse SubX opcodes for them. +10232 Reverse-branch: # (table (handle array byte) (handle array byte)) +10233 # a table is a stream +10234 0x140/imm32/write +10235 0/imm32/read +10236 0x140/imm32/size +10237 # data +10238 0x11/imm32/alloc-id _string-break-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 +10239 0x11/imm32/alloc-id _string-loop-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 +10240 0x11/imm32/alloc-id _string-break-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 +10241 0x11/imm32/alloc-id _string-loop-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 +10242 0x11/imm32/alloc-id _string-break-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 +10243 0x11/imm32/alloc-id _string-loop-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 +10244 0x11/imm32/alloc-id _string-break-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 +10245 0x11/imm32/alloc-id _string-loop-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 +10246 0x11/imm32/alloc-id _string-break-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +10247 0x11/imm32/alloc-id _string-loop-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +10248 0x11/imm32/alloc-id _string-break-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 +10249 0x11/imm32/alloc-id _string-loop-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 +10250 0x11/imm32/alloc-id _string-break-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 +10251 0x11/imm32/alloc-id _string-loop-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 +10252 0x11/imm32/alloc-id _string-break-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 +10253 0x11/imm32/alloc-id _string-loop-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 +10254 0x11/imm32/alloc-id _string-break-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +10255 0x11/imm32/alloc-id _string-loop-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +10256 0x11/imm32/alloc-id _string-break-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 +10257 0x11/imm32/alloc-id _string-loop-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 +10258 +10259 == code +10260 +10261 emit-unconditional-jump-to-depth: # out: (addr buffered-file), vars: (addr stack live-var), depth: int, label-suffix: (addr array byte) +10262 # . prologue +10263 55/push-ebp +10264 89/<- %ebp 4/r32/esp +10265 # . save registers +10266 50/push-eax +10267 51/push-ecx +10268 52/push-edx +10269 53/push-ebx +10270 56/push-esi +10271 # ecx = vars +10272 8b/-> *(ebp+0xc) 1/r32/ecx +10273 # var eax: int = vars->top +10274 8b/-> *ecx 0/r32/eax +10275 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +10276 8d/copy-address *(ecx+eax-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size +10277 # var min/ecx: (addr handle var) = vars->data +10278 8d/copy-address *(ecx+8) 1/r32/ecx +10279 # edx = depth +10280 8b/-> *(ebp+0x10) 2/r32/edx +10281 { +10282 $emit-unconditional-jump-to-depth:loop: +10283 # if (curr < min) break +10284 39/compare %esi 1/r32/ecx +10285 0f 82/jump-if-addr< break/disp32 +10286 # var v/ebx: (addr var) = lookup(*curr) +10287 (lookup *esi *(esi+4)) # => eax +10288 89/<- %ebx 0/r32/eax +10289 # if (v->block-depth < until-block-depth) break +10290 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth +10291 0f 8c/jump-if-< break/disp32 +10292 { +10293 $emit-unconditional-jump-to-depth:check: +10294 # if v->block-depth != until-block-depth, continue +10295 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth +10296 0f 85/jump-if-!= break/disp32 +10297 $emit-unconditional-jump-to-depth:depth-found: +10298 # if v is not a literal, continue +10299 (size-of %ebx) # => eax +10300 3d/compare-eax-and 0/imm32 +10301 0f 85/jump-if-!= break/disp32 +10302 $emit-unconditional-jump-to-depth:label-found: +10303 # emit unconditional jump, then return +10304 (emit-indent *(ebp+8) *Curr-block-depth) +10305 (write-buffered *(ebp+8) "e9/jump ") +10306 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +10307 (write-buffered *(ebp+8) %eax) +10308 (write-buffered *(ebp+8) ":") +10309 (write-buffered *(ebp+8) *(ebp+0x14)) +10310 (write-buffered *(ebp+8) "/disp32\n") +10311 eb/jump $emit-unconditional-jump-to-depth:end/disp8 +10312 } +10313 # curr -= 12 +10314 81 5/subop/subtract %esi 0xc/imm32 +10315 e9/jump loop/disp32 +10316 } +10317 # TODO: error if no label at 'depth' was found +10318 $emit-unconditional-jump-to-depth:end: +10319 # . restore registers +10320 5e/pop-to-esi +10321 5b/pop-to-ebx +10322 5a/pop-to-edx +10323 59/pop-to-ecx +10324 58/pop-to-eax +10325 # . epilogue +10326 89/<- %esp 5/r32/ebp +10327 5d/pop-to-ebp +10328 c3/return +10329 +10330 # emit clean-up code for 'vars' until some block depth +10331 # doesn't actually modify 'vars' so we need traverse manually inside the stack +10332 emit-cleanup-code-until-depth: # out: (addr buffered-file), vars: (addr stack live-var), until-block-depth: int +10333 # . prologue +10334 55/push-ebp +10335 89/<- %ebp 4/r32/esp +10336 # . save registers +10337 50/push-eax +10338 51/push-ecx +10339 52/push-edx +10340 53/push-ebx +10341 56/push-esi +10342 #? (write-buffered Stderr "--- cleanup\n") +10343 #? (flush Stderr) +10344 # ecx = vars +10345 8b/-> *(ebp+0xc) 1/r32/ecx +10346 # var esi: int = vars->top +10347 8b/-> *ecx 6/r32/esi +10348 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +10349 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size +10350 # var min/ecx: (addr handle var) = vars->data +10351 81 0/subop/add %ecx 8/imm32 +10352 # edx = until-block-depth +10353 8b/-> *(ebp+0x10) 2/r32/edx +10354 { +10355 $emit-cleanup-code-until-depth:loop: +10356 # if (curr < min) break +10357 39/compare %esi 1/r32/ecx +10358 0f 82/jump-if-addr< break/disp32 +10359 # var v/ebx: (addr var) = lookup(*curr) +10360 (lookup *esi *(esi+4)) # => eax +10361 89/<- %ebx 0/r32/eax +10362 #? (lookup *ebx *(ebx+4)) # Var-name +10363 #? (write-buffered Stderr "var ") +10364 #? (write-buffered Stderr %eax) +10365 #? (write-buffered Stderr Newline) +10366 #? (flush Stderr) +10367 # if (v->block-depth < until-block-depth) break +10368 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth +10369 0f 8c/jump-if-< break/disp32 +10370 # if v is in a register +10371 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +10372 { +10373 0f 84/jump-if-= break/disp32 +10374 { +10375 $emit-cleanup-code-until-depth:check-for-previous-spill: +10376 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled +10377 3d/compare-eax-and 0/imm32/false +10378 74/jump-if-= break/disp8 +10379 $emit-cleanup-code-until-depth:reclaim-var-in-register: +10380 (emit-indent *(ebp+8) *Curr-block-depth) +10381 (write-buffered *(ebp+8) "8f 0/subop/pop %") +10382 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +10383 (write-buffered *(ebp+8) %eax) +10384 (write-buffered *(ebp+8) Newline) +10385 } +10386 eb/jump $emit-cleanup-code-until-depth:continue/disp8 +10387 } +10388 # otherwise v is on the stack +10389 { +10390 75/jump-if-!= break/disp8 +10391 $emit-cleanup-code-until-depth:var-on-stack: +10392 (size-of %ebx) # => eax +10393 # don't emit code for labels +10394 3d/compare-eax-and 0/imm32 +10395 74/jump-if-= break/disp8 +10396 $emit-cleanup-code-until-depth:reclaim-var-on-stack: +10397 (emit-indent *(ebp+8) *Curr-block-depth) +10398 (write-buffered *(ebp+8) "81 0/subop/add %esp ") +10399 (print-int32-buffered *(ebp+8) %eax) +10400 (write-buffered *(ebp+8) "/imm32\n") +10401 } +10402 $emit-cleanup-code-until-depth:continue: +10403 # curr -= 12 +10404 81 5/subop/subtract %esi 0xc/imm32 +10405 e9/jump loop/disp32 +10406 } +10407 $emit-cleanup-code-until-depth:end: +10408 # . restore registers +10409 5e/pop-to-esi +10410 5b/pop-to-ebx +10411 5a/pop-to-edx +10412 59/pop-to-ecx +10413 58/pop-to-eax +10414 # . epilogue +10415 89/<- %esp 5/r32/ebp +10416 5d/pop-to-ebp +10417 c3/return +10418 +10419 # emit clean-up code for 'vars' until a given label is encountered +10420 # doesn't actually modify 'vars' so we need traverse manually inside the stack +10421 emit-cleanup-code-until-target: # out: (addr buffered-file), vars: (addr stack live-var), until-block-label: (addr array byte) +10422 # . prologue +10423 55/push-ebp +10424 89/<- %ebp 4/r32/esp +10425 # . save registers +10426 50/push-eax +10427 51/push-ecx +10428 52/push-edx +10429 53/push-ebx +10430 # ecx = vars +10431 8b/-> *(ebp+0xc) 1/r32/ecx +10432 # var eax: int = vars->top +10433 8b/-> *ecx 0/r32/eax +10434 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] +10435 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size +10436 # var min/ecx: (addr handle var) = vars->data +10437 81 0/subop/add %ecx 8/imm32 +10438 { +10439 $emit-cleanup-code-until-target:loop: +10440 # if (curr < min) break +10441 39/compare %edx 1/r32/ecx +10442 0f 82/jump-if-addr< break/disp32 +10443 # var v/ebx: (handle var) = lookup(*curr) +10444 (lookup *edx *(edx+4)) # => eax +10445 89/<- %ebx 0/r32/eax +10446 # if (v->name == until-block-label) break +10447 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +10448 (string-equal? %eax *(ebp+0x10)) # => eax +10449 3d/compare-eax-and 0/imm32/false +10450 0f 85/jump-if-!= break/disp32 +10451 # if v is in a register +10452 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +10453 { +10454 0f 84/jump-if-= break/disp32 +10455 { +10456 $emit-cleanup-code-until-target:check-for-previous-spill: +10457 8b/-> *(edx+8) 0/r32/eax # Live-var-register-spilled +10458 3d/compare-eax-and 0/imm32/false +10459 74/jump-if-= break/disp8 +10460 $emit-cleanup-code-until-target:reclaim-var-in-register: +10461 (emit-indent *(ebp+8) *Curr-block-depth) +10462 (write-buffered *(ebp+8) "8f 0/subop/pop %") +10463 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +10464 (write-buffered *(ebp+8) %eax) +10465 (write-buffered *(ebp+8) Newline) +10466 } +10467 eb/jump $emit-cleanup-code-until-target:continue/disp8 +10468 } +10469 # otherwise v is on the stack +10470 { +10471 75/jump-if-!= break/disp8 +10472 $emit-cleanup-code-until-target:reclaim-var-on-stack: +10473 (size-of %ebx) # => eax +10474 # don't emit code for labels +10475 3d/compare-eax-and 0/imm32 +10476 74/jump-if-= break/disp8 +10477 # +10478 (emit-indent *(ebp+8) *Curr-block-depth) +10479 (write-buffered *(ebp+8) "81 0/subop/add %esp ") +10480 (print-int32-buffered *(ebp+8) %eax) +10481 (write-buffered *(ebp+8) "/imm32\n") +10482 } +10483 $emit-cleanup-code-until-target:continue: +10484 # curr -= 12 +10485 81 5/subop/subtract %edx 0xc/imm32 +10486 e9/jump loop/disp32 +10487 } +10488 $emit-cleanup-code-until-target:end: +10489 # . restore registers +10490 5b/pop-to-ebx +10491 5a/pop-to-edx +10492 59/pop-to-ecx +10493 58/pop-to-eax +10494 # . epilogue +10495 89/<- %esp 5/r32/ebp +10496 5d/pop-to-ebp +10497 c3/return +10498 +10499 # Return true if there isn't a variable in 'vars' with the same block-depth +10500 # and register as 'v'. +10501 # 'v' is guaranteed not to be within 'vars'. +10502 not-yet-spilled-this-block?: # v: (addr var), vars: (addr stack live-var) -> result/eax: boolean +10503 # . prologue +10504 55/push-ebp +10505 89/<- %ebp 4/r32/esp +10506 # . save registers +10507 51/push-ecx +10508 52/push-edx +10509 53/push-ebx +10510 56/push-esi +10511 57/push-edi +10512 # ecx = vars +10513 8b/-> *(ebp+0xc) 1/r32/ecx +10514 # var eax: int = vars->top +10515 8b/-> *ecx 0/r32/eax +10516 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] +10517 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size +10518 # var min/ecx: (addr handle var) = vars->data +10519 8d/copy-address *(ecx+8) 1/r32/ecx +10520 # var depth/ebx: int = v->block-depth +10521 8b/-> *(ebp+8) 3/r32/ebx +10522 8b/-> *(ebx+0x10) 3/r32/ebx # Var-block-depth +10523 # var needle/esi: (addr array byte) = v->register +10524 8b/-> *(ebp+8) 6/r32/esi +10525 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +10526 89/<- %esi 0/r32/eax +10527 { +10528 $not-yet-spilled-this-block?:loop: +10529 # if (curr < min) break +10530 39/compare %edx 1/r32/ecx +10531 0f 82/jump-if-addr< break/disp32 +10532 # var cand/edi: (addr var) = lookup(*curr) +10533 (lookup *edx *(edx+4)) # => eax +10534 89/<- %edi 0/r32/eax +10535 # if (cand->block-depth < depth) break +10536 39/compare *(edi+0x10) 3/r32/ebx # Var-block-depth +10537 0f 8c/jump-if-< break/disp32 +10538 # var cand-reg/edi: (array array byte) = cand->reg +10539 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax +10540 89/<- %edi 0/r32/eax +10541 # if (cand-reg == null) continue +10542 { +10543 $not-yet-spilled-this-block?:check-reg: +10544 81 7/subop/compare %edi 0/imm32 +10545 0f 84/jump-if-= break/disp32 +10546 # if (cand-reg == needle) return true +10547 (string-equal? %esi %edi) # => eax +10548 3d/compare-eax-and 0/imm32/false +10549 74/jump-if-= break/disp8 +10550 $not-yet-spilled-this-block?:return-false: +10551 b8/copy-to-eax 0/imm32/false +10552 eb/jump $not-yet-spilled-this-block?:end/disp8 +10553 } +10554 $not-yet-spilled-this-block?:continue: +10555 # curr -= 12 +10556 81 5/subop/subtract %edx 0xc/imm32 +10557 e9/jump loop/disp32 +10558 } +10559 $not-yet-spilled-this-block?:return-true: +10560 # return true +10561 b8/copy-to-eax 1/imm32/true +10562 $not-yet-spilled-this-block?:end: +10563 # . restore registers +10564 5f/pop-to-edi +10565 5e/pop-to-esi +10566 5b/pop-to-ebx +10567 5a/pop-to-edx +10568 59/pop-to-ecx +10569 # . epilogue +10570 89/<- %esp 5/r32/ebp +10571 5d/pop-to-ebp +10572 c3/return +10573 +10574 # could the register of 'v' ever be written to by one of the vars in fn-outputs? +10575 will-not-write-some-register?: # v: (addr var), stmts: (addr list stmt), fn-outputs: (addr list var) -> result/eax: boolean +10576 # . prologue +10577 55/push-ebp +10578 89/<- %ebp 4/r32/esp +10579 # eax = v +10580 8b/-> *(ebp+8) 0/r32/eax +10581 # var reg/eax: (addr array byte) = lookup(v->register) +10582 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +10583 # var target/eax: (addr var) = find-register(fn-outputs, reg) +10584 (find-register *(ebp+0x10) %eax) # => eax +10585 # if (target == 0) return true +10586 { +10587 3d/compare-eax-and 0/imm32 +10588 75/jump-if-!= break/disp8 +10589 b8/copy-to-eax 1/imm32/true +10590 eb/jump $will-not-write-some-register?:end/disp8 +10591 } +10592 # return !assigns-in-stmts?(stmts, target) +10593 (assigns-in-stmts? *(ebp+0xc) %eax) # => eax +10594 3d/compare-eax-and 0/imm32/false +10595 # assume: true = 1, so no need to mask with 0x000000ff +10596 0f 94/set-if-= %al +10597 $will-not-write-some-register?:end: +10598 # . epilogue +10599 89/<- %esp 5/r32/ebp +10600 5d/pop-to-ebp +10601 c3/return +10602 +10603 # return output var with matching register +10604 # always returns false if 'reg' is null +10605 find-register: # fn-outputs: (addr list var), reg: (addr array byte) -> result/eax: (addr var) +10606 # . prologue +10607 55/push-ebp +10608 89/<- %ebp 4/r32/esp +10609 # . save registers +10610 51/push-ecx +10611 # var curr/ecx: (addr list var) = fn-outputs +10612 8b/-> *(ebp+8) 1/r32/ecx +10613 { +10614 $find-register:loop: +10615 # if (curr == 0) break +10616 81 7/subop/compare %ecx 0/imm32 +10617 74/jump-if-= break/disp8 +10618 # eax = curr->value->register +10619 (lookup *ecx *(ecx+4)) # List-value List-value => eax +10620 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +10621 # if (eax == reg) return curr->value +10622 $find-register:compare: +10623 (string-equal? *(ebp+0xc) %eax) # => eax +10624 { +10625 3d/compare-eax-and 0/imm32/false +10626 74/jump-if-= break/disp8 +10627 $find-register:found: +10628 (lookup *ecx *(ecx+4)) # List-value List-value => eax +10629 eb/jump $find-register:end/disp8 +10630 } +10631 # curr = lookup(curr->next) +10632 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +10633 89/<- %ecx 0/r32/eax +10634 # +10635 eb/jump loop/disp8 +10636 } +10637 $find-register:end: +10638 # . restore registers +10639 59/pop-to-ecx +10640 # . epilogue +10641 89/<- %esp 5/r32/ebp +10642 5d/pop-to-ebp +10643 c3/return +10644 +10645 assigns-in-stmts?: # stmts: (addr list stmt), v: (addr var) -> result/eax: boolean +10646 # . prologue +10647 55/push-ebp +10648 89/<- %ebp 4/r32/esp +10649 # . save registers +10650 51/push-ecx +10651 # var curr/ecx: (addr list stmt) = stmts +10652 8b/-> *(ebp+8) 1/r32/ecx +10653 { +10654 # if (curr == 0) break +10655 81 7/subop/compare %ecx 0/imm32 +10656 74/jump-if-= break/disp8 +10657 # if assigns-in-stmt?(curr->value, v) return true +10658 (lookup *ecx *(ecx+4)) # List-value List-value => eax +10659 (assigns-in-stmt? %eax *(ebp+0xc)) # => eax +10660 3d/compare-eax-and 0/imm32/false +10661 75/jump-if-!= break/disp8 +10662 # curr = lookup(curr->next) +10663 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +10664 89/<- %ecx 0/r32/eax +10665 # +10666 eb/jump loop/disp8 +10667 } +10668 $assigns-in-stmts?:end: +10669 # . restore registers +10670 59/pop-to-ecx +10671 # . epilogue +10672 89/<- %esp 5/r32/ebp +10673 5d/pop-to-ebp +10674 c3/return +10675 +10676 assigns-in-stmt?: # stmt: (addr stmt), v: (addr var) -> result/eax: boolean +10677 # . prologue +10678 55/push-ebp +10679 89/<- %ebp 4/r32/esp +10680 # . save registers +10681 51/push-ecx +10682 # ecx = stmt +10683 8b/-> *(ebp+8) 1/r32/ecx +10684 # if stmt is a stmt1, return assigns-in-stmt-vars?(stmt->outputs, v) +10685 { +10686 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag +10687 75/jump-if-!= break/disp8 +10688 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +10689 (assigns-in-stmt-vars? %eax *(ebp+0xc)) # => eax +10690 eb/jump $assigns-in-stmt?:end/disp8 +10691 } +10692 # if stmt is a block, return assigns-in-stmts?(stmt->stmts, v) +10693 { +10694 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag +10695 75/jump-if-!= break/disp8 +10696 (lookup *(ecx+4) *(ecx+8)) # Block-stmts Block-stmts => eax +10697 (assigns-in-stmts? %eax *(ebp+0xc)) # => eax +10698 eb/jump $assigns-in-stmt?:end/disp8 +10699 } +10700 # otherwise return false +10701 b8/copy 0/imm32/false +10702 $assigns-in-stmt?:end: +10703 # . restore registers +10704 59/pop-to-ecx +10705 # . epilogue +10706 89/<- %esp 5/r32/ebp +10707 5d/pop-to-ebp +10708 c3/return +10709 +10710 assigns-in-stmt-vars?: # stmt-var: (addr stmt-var), v: (addr var) -> result/eax: boolean +10711 # . prologue +10712 55/push-ebp +10713 89/<- %ebp 4/r32/esp +10714 # . save registers +10715 51/push-ecx +10716 # var curr/ecx: (addr stmt-var) = stmt-var +10717 8b/-> *(ebp+8) 1/r32/ecx +10718 { +10719 # if (curr == 0) break +10720 81 7/subop/compare %ecx 0/imm32 +10721 74/jump-if-= break/disp8 +10722 # eax = lookup(curr->value) +10723 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +10724 # if (eax == v && curr->is-deref? == false) return true +10725 { +10726 39/compare *(ebp+0xc) 0/r32/eax +10727 75/jump-if-!= break/disp8 +10728 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +10729 75/jump-if-!= break/disp8 +10730 b8/copy-to-eax 1/imm32/true +10731 eb/jump $assigns-in-stmt-vars?:end/disp8 +10732 } +10733 # curr = lookup(curr->next) +10734 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax +10735 89/<- %ecx 0/r32/eax +10736 # +10737 eb/jump loop/disp8 +10738 } +10739 $assigns-in-stmt-vars?:end: +10740 # . restore registers +10741 59/pop-to-ecx +10742 # . epilogue +10743 89/<- %esp 5/r32/ebp +10744 5d/pop-to-ebp +10745 c3/return +10746 +10747 # is there a var before 'v' with the same block-depth and register on the 'vars' stack? +10748 # v is guaranteed to be within vars +10749 # 'start' is provided as an optimization, a pointer within vars +10750 # *start == v +10751 same-register-spilled-before?: # v: (addr var), vars: (addr stack (handle var)), start: (addr var) -> result/eax: boolean +10752 # . prologue +10753 55/push-ebp +10754 89/<- %ebp 4/r32/esp +10755 # . save registers +10756 51/push-ecx +10757 52/push-edx +10758 53/push-ebx +10759 56/push-esi +10760 57/push-edi +10761 # ecx = v +10762 8b/-> *(ebp+8) 1/r32/ecx +10763 # var reg/edx: (addr array byte) = lookup(v->register) +10764 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +10765 89/<- %edx 0/r32/eax +10766 # var depth/ebx: int = v->block-depth +10767 8b/-> *(ecx+0x10) 3/r32/ebx # Var-block-depth +10768 # var min/ecx: (addr handle var) = vars->data +10769 8b/-> *(ebp+0xc) 1/r32/ecx +10770 81 0/subop/add %ecx 8/imm32 +10771 # TODO: check that start >= min and start < &vars->data[top] +10772 # TODO: check that *start == v +10773 # var curr/esi: (addr handle var) = start +10774 8b/-> *(ebp+0x10) 6/r32/esi +10775 # curr -= 8 +10776 81 5/subop/subtract %esi 8/imm32 +10777 { +10778 $same-register-spilled-before?:loop: +10779 # if (curr < min) break +10780 39/compare %esi 1/r32/ecx +10781 0f 82/jump-if-addr< break/disp32 +10782 # var x/eax: (addr var) = lookup(*curr) +10783 (lookup *esi *(esi+4)) # => eax +10784 # if (x->block-depth < depth) break +10785 39/compare *(eax+0x10) 3/r32/ebx # Var-block-depth +10786 0f 8c/jump-if-< break/disp32 +10787 # if (x->register == 0) continue +10788 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +10789 74/jump-if-= $same-register-spilled-before?:continue/disp8 +10790 # if (x->register == reg) return true +10791 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +10792 (string-equal? %eax %edx) # => eax +10793 3d/compare-eax-and 0/imm32/false +10794 b8/copy-to-eax 1/imm32/true +10795 75/jump-if-!= $same-register-spilled-before?:end/disp8 +10796 $same-register-spilled-before?:continue: +10797 # curr -= 8 +10798 81 5/subop/subtract %esi 8/imm32 +10799 e9/jump loop/disp32 +10800 } +10801 $same-register-spilled-before?:false: +10802 b8/copy-to-eax 0/imm32/false +10803 $same-register-spilled-before?:end: +10804 # . restore registers +10805 5f/pop-to-edi +10806 5e/pop-to-esi +10807 5b/pop-to-ebx +10808 5a/pop-to-edx +10809 59/pop-to-ecx +10810 # . epilogue +10811 89/<- %esp 5/r32/ebp +10812 5d/pop-to-ebp +10813 c3/return +10814 +10815 # clean up global state for 'vars' until some block depth +10816 clean-up-blocks: # vars: (addr stack live-var), until-block-depth: int +10817 # . prologue +10818 55/push-ebp +10819 89/<- %ebp 4/r32/esp +10820 # . save registers +10821 50/push-eax +10822 51/push-ecx +10823 56/push-esi +10824 # esi = vars +10825 8b/-> *(ebp+8) 6/r32/esi +10826 # ecx = until-block-depth +10827 8b/-> *(ebp+0xc) 1/r32/ecx +10828 { +10829 $clean-up-blocks:reclaim-loop: +10830 # if (vars->top <= 0) break +10831 8b/-> *esi 0/r32/eax # Stack-top +10832 3d/compare-eax-and 0/imm32 +10833 0f 8e/jump-if-<= break/disp32 +10834 # var v/eax: (addr var) = lookup(vars[vars->top-12]) +10835 #? (print-int32-buffered Stderr %eax) +10836 #? (write-buffered Stderr ": ") +10837 #? (print-int32-buffered Stderr *(esi+eax-4)) +10838 #? (write-buffered Stderr " ") +10839 #? (print-int32-buffered Stderr *(esi+eax)) +10840 #? (write-buffered Stderr " ") +10841 #? (print-int32-buffered Stderr *(esi+eax+4)) +10842 #? (write-buffered Stderr Newline) +10843 #? (flush Stderr) +10844 (lookup *(esi+eax-4) *(esi+eax)) # vars + 8 + vars->top - 12 => eax +10845 # if (v->block-depth < until-block-depth) break +10846 39/compare *(eax+0x10) 1/r32/ecx # Var-block-depth +10847 7c/jump-if-< break/disp8 +10848 # if v is on the stack, update Curr-local-stack-offset +10849 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +10850 { +10851 75/jump-if-!= break/disp8 +10852 $clean-up-blocks:reclaim-var-on-stack: +10853 (size-of %eax) # => eax +10854 01/add-to *Curr-local-stack-offset 0/r32/eax +10855 } +10856 (pop %esi) # => eax +10857 (pop %esi) # => eax +10858 (pop %esi) # => eax +10859 e9/jump loop/disp32 +10860 } +10861 $clean-up-blocks:end: +10862 # . restore registers +10863 5e/pop-to-esi +10864 59/pop-to-ecx +10865 58/pop-to-eax +10866 # . epilogue +10867 89/<- %esp 5/r32/ebp +10868 5d/pop-to-ebp +10869 c3/return +10870 +10871 emit-subx-var-def: # out: (addr buffered-file), stmt: (addr stmt) +10872 # . prologue +10873 55/push-ebp +10874 89/<- %ebp 4/r32/esp +10875 # . save registers +10876 50/push-eax +10877 51/push-ecx +10878 52/push-edx +10879 # eax = stmt +10880 8b/-> *(ebp+0xc) 0/r32/eax +10881 # var v/ecx: (addr var) +10882 (lookup *(eax+4) *(eax+8)) # Vardef-var Vardef-var => eax +10883 89/<- %ecx 0/r32/eax +10884 # v->block-depth = *Curr-block-depth +10885 8b/-> *Curr-block-depth 0/r32/eax +10886 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +10887 # var n/edx: int = size-of(stmt->var) +10888 (size-of %ecx) # => eax +10889 89/<- %edx 0/r32/eax +10890 # *Curr-local-stack-offset -= n +10891 29/subtract-from *Curr-local-stack-offset 2/r32/edx +10892 # v->offset = *Curr-local-stack-offset +10893 8b/-> *Curr-local-stack-offset 0/r32/eax +10894 89/<- *(ecx+0x14) 0/r32/eax # Var-offset +10895 # if v is an array, do something special +10896 { +10897 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +10898 (is-mu-array? %eax) # => eax +10899 3d/compare-eax-and 0/imm32/false +10900 0f 84/jump-if-= break/disp32 +10901 # var array-size-without-size/edx: int = n-4 +10902 81 5/subop/subtract %edx 4/imm32 +10903 (emit-indent *(ebp+8) *Curr-block-depth) +10904 (write-buffered *(ebp+8) "(push-n-zero-bytes ") +10905 (print-int32-buffered *(ebp+8) %edx) +10906 (write-buffered *(ebp+8) ")\n") +10907 (emit-indent *(ebp+8) *Curr-block-depth) +10908 (write-buffered *(ebp+8) "68/push ") +10909 (print-int32-buffered *(ebp+8) %edx) +10910 (write-buffered *(ebp+8) "/imm32\n") +10911 eb/jump $emit-subx-var-def:end/disp8 +10912 } +10913 # while n > 0 +10914 { +10915 81 7/subop/compare %edx 0/imm32 +10916 7e/jump-if-<= break/disp8 +10917 (emit-indent *(ebp+8) *Curr-block-depth) +10918 (write-buffered *(ebp+8) "68/push 0/imm32\n") +10919 # n -= 4 +10920 81 5/subop/subtract %edx 4/imm32 +10921 # +10922 eb/jump loop/disp8 +10923 } +10924 $emit-subx-var-def:end: +10925 # . restore registers +10926 5a/pop-to-edx +10927 59/pop-to-ecx +10928 58/pop-to-eax +10929 # . epilogue +10930 89/<- %esp 5/r32/ebp +10931 5d/pop-to-ebp +10932 c3/return +10933 +10934 emit-subx-stmt: # out: (addr buffered-file), stmt: (addr stmt), primitives: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) +10935 # . prologue +10936 55/push-ebp +10937 89/<- %ebp 4/r32/esp +10938 # . save registers +10939 50/push-eax +10940 51/push-ecx +10941 # - some special-case primitives that don't actually use the 'primitives' data structure +10942 # var op/ecx: (addr array byte) = lookup(stmt->operation) +10943 8b/-> *(ebp+0xc) 1/r32/ecx +10944 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +10945 89/<- %ecx 0/r32/eax +10946 # array size +10947 { +10948 # if (!string-equal?(stmt->operation, "length")) break +10949 (string-equal? %ecx "length") # => eax +10950 3d/compare-eax-and 0/imm32 +10951 0f 84/jump-if-= break/disp32 +10952 (translate-mu-length-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +10953 e9/jump $emit-subx-stmt:end/disp32 +10954 } +10955 # index into array +10956 { +10957 # if (!string-equal?(stmt->operation, "index")) break +10958 (string-equal? %ecx "index") # => eax +10959 3d/compare-eax-and 0/imm32 +10960 0f 84/jump-if-= break/disp32 +10961 (translate-mu-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +10962 e9/jump $emit-subx-stmt:end/disp32 +10963 } +10964 # compute-offset for index into array +10965 { +10966 # if (!string-equal?(stmt->operation, "compute-offset")) break +10967 (string-equal? %ecx "compute-offset") # => eax +10968 3d/compare-eax-and 0/imm32 +10969 0f 84/jump-if-= break/disp32 +10970 (translate-mu-compute-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +10971 e9/jump $emit-subx-stmt:end/disp32 +10972 } +10973 # get field from record +10974 { +10975 # if (!string-equal?(stmt->operation, "get")) break +10976 (string-equal? %ecx "get") # => eax +10977 3d/compare-eax-and 0/imm32 +10978 0f 84/jump-if-= break/disp32 +10979 (translate-mu-get-stmt *(ebp+8) *(ebp+0xc)) +10980 e9/jump $emit-subx-stmt:end/disp32 +10981 } +10982 # - if stmt matches a primitive, emit it +10983 { +10984 $emit-subx-stmt:check-for-primitive: +10985 # var curr/eax: (addr primitive) +10986 (find-matching-primitive *(ebp+0x10) *(ebp+0xc)) # primitives, stmt => eax +10987 3d/compare-eax-and 0/imm32 +10988 74/jump-if-= break/disp8 +10989 $emit-subx-stmt:primitive: +10990 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax) # out, stmt, curr +10991 e9/jump $emit-subx-stmt:end/disp32 +10992 } +10993 # - otherwise emit a call +10994 # TODO: type-checking +10995 $emit-subx-stmt:call: +10996 (emit-call *(ebp+8) *(ebp+0xc)) +10997 $emit-subx-stmt:end: +10998 # . restore registers +10999 59/pop-to-ecx +11000 58/pop-to-eax +11001 # . epilogue +11002 89/<- %esp 5/r32/ebp +11003 5d/pop-to-ebp +11004 c3/return +11005 +11006 translate-mu-length-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +11007 # . prologue +11008 55/push-ebp +11009 89/<- %ebp 4/r32/esp +11010 # . save registers +11011 50/push-eax +11012 51/push-ecx +11013 52/push-edx +11014 53/push-ebx +11015 56/push-esi +11016 # esi = stmt +11017 8b/-> *(ebp+0xc) 6/r32/esi +11018 # var base/ebx: (addr var) = stmt->inouts[0]->value +11019 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +11020 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11021 89/<- %ebx 0/r32/eax +11022 # var elemsize/ecx: int = array-element-size(base) +11023 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +11024 89/<- %ecx 0/r32/eax +11025 # var outreg/edx: (addr array byte) = stmt->outputs[0]->value->register +11026 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +11027 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11028 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +11029 89/<- %edx 0/r32/eax +11030 # if elemsize == 1 +11031 { +11032 81 7/subop/compare %ecx 1/imm32 +11033 75/jump-if-!= break/disp8 +11034 $translate-mu-length-stmt:size-1: +11035 (emit-save-size-to *(ebp+8) %ebx %edx) +11036 e9/jump $translate-mu-length-stmt:end/disp32 +11037 } +11038 # if elemsize is a power of 2 less than 256 +11039 { +11040 (power-of-2? %ecx *(ebp+0x10) *(ebp+0x14)) # => eax +11041 3d/compare-eax-and 0/imm32/false +11042 74/jump-if-= break/disp8 +11043 81 7/subop/compare %ecx 0xff/imm32 +11044 7f/jump-if-> break/disp8 +11045 $translate-mu-length-stmt:size-power-of-2: +11046 (emit-save-size-to *(ebp+8) %ebx %edx) +11047 (emit-divide-by-shift-right *(ebp+8) %edx %ecx) +11048 e9/jump $translate-mu-length-stmt:end/disp32 +11049 } +11050 # otherwise, the complex case +11051 # . emit register spills +11052 { +11053 $translate-mu-length-stmt:complex: +11054 (string-equal? %edx "eax") # => eax +11055 3d/compare-eax-and 0/imm32/false +11056 75/break-if-!= break/disp8 +11057 (emit-indent *(ebp+8) *Curr-block-depth) +11058 (write-buffered *(ebp+8) "50/push-eax\n") +11059 } +11060 { +11061 (string-equal? %edx "ecx") # => eax +11062 3d/compare-eax-and 0/imm32/false +11063 75/break-if-!= break/disp8 +11064 (emit-indent *(ebp+8) *Curr-block-depth) +11065 (write-buffered *(ebp+8) "51/push-ecx\n") +11066 } +11067 { +11068 (string-equal? %edx "edx") # => eax +11069 3d/compare-eax-and 0/imm32/false +11070 75/break-if-!= break/disp8 +11071 (emit-indent *(ebp+8) *Curr-block-depth) +11072 (write-buffered *(ebp+8) "52/push-edx\n") +11073 } +11074 # . +11075 (emit-save-size-to *(ebp+8) %ebx "eax") +11076 (emit-indent *(ebp+8) *Curr-block-depth) +11077 (write-buffered *(ebp+8) "31/xor %edx 2/r32/edx\n") +11078 (emit-indent *(ebp+8) *Curr-block-depth) +11079 (write-buffered *(ebp+8) "b9/copy-to-ecx ") +11080 (print-int32-buffered *(ebp+8) %ecx) +11081 (write-buffered *(ebp+8) "/imm32\n") +11082 (emit-indent *(ebp+8) *Curr-block-depth) +11083 (write-buffered *(ebp+8) "f7 7/subop/idiv-eax-edx-by %ecx\n") +11084 { +11085 (string-equal? %edx "eax") # => eax +11086 3d/compare-eax-and 0/imm32/false +11087 75/break-if-!= break/disp8 +11088 (emit-indent *(ebp+8) *Curr-block-depth) +11089 (write-buffered *(ebp+8) "89/<- %") +11090 (write-buffered *(ebp+8) %edx) +11091 (write-buffered *(ebp+8) " 0/r32/eax\n") +11092 } +11093 # . emit register restores +11094 { +11095 (string-equal? %edx "edx") # => eax +11096 3d/compare-eax-and 0/imm32/false +11097 75/break-if-!= break/disp8 +11098 (emit-indent *(ebp+8) *Curr-block-depth) +11099 (write-buffered *(ebp+8) "5a/pop-to-edx\n") +11100 } +11101 { +11102 (string-equal? %edx "ecx") # => eax +11103 3d/compare-eax-and 0/imm32/false +11104 75/break-if-!= break/disp8 +11105 (emit-indent *(ebp+8) *Curr-block-depth) +11106 (write-buffered *(ebp+8) "59/pop-to-ecx\n") +11107 } +11108 { +11109 (string-equal? %edx "eax") # => eax +11110 3d/compare-eax-and 0/imm32/false +11111 75/break-if-!= break/disp8 +11112 (emit-indent *(ebp+8) *Curr-block-depth) +11113 (write-buffered *(ebp+8) "58/pop-to-eax\n") +11114 } +11115 $translate-mu-length-stmt:end: +11116 # . restore registers +11117 5e/pop-to-esi +11118 5b/pop-to-ebx +11119 5a/pop-to-edx +11120 59/pop-to-ecx +11121 58/pop-to-eax +11122 # . epilogue +11123 89/<- %esp 5/r32/ebp +11124 5d/pop-to-ebp +11125 c3/return +11126 +11127 array-element-size: # arr: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +11128 # . prologue +11129 55/push-ebp +11130 89/<- %ebp 4/r32/esp +11131 # +11132 (array-element-type-id *(ebp+8) *(ebp+0xc) *(ebp+0x10)) # => eax +11133 (size-of-type-id-as-array-element %eax) # => eax +11134 $array-element-size:end: +11135 # . epilogue +11136 89/<- %esp 5/r32/ebp +11137 5d/pop-to-ebp +11138 c3/return +11139 +11140 size-of-type-id-as-array-element: # t: type-id -> result/eax: int +11141 # . prologue +11142 55/push-ebp +11143 89/<- %ebp 4/r32/esp +11144 # eax = t +11145 8b/-> *(ebp+8) 0/r32/eax +11146 # if t is 'byte', size is 1 +11147 3d/compare-eax-and 8/imm32/byte +11148 { +11149 75/jump-if-!= break/disp8 +11150 b8/copy-to-eax 1/imm32 +11151 eb/jump $array-element-size:end/disp8 +11152 } +11153 # otherwise proceed as usual +11154 (size-of-type-id %eax) # => eax +11155 $size-of-type-id-as-array-element:end: +11156 # . epilogue +11157 89/<- %esp 5/r32/ebp +11158 5d/pop-to-ebp +11159 c3/return +11160 +11161 emit-save-size-to: # out: (addr buffered-file), base: (addr var), outreg: (addr array byte) +11162 # . prologue +11163 55/push-ebp +11164 89/<- %ebp 4/r32/esp +11165 # . save registers +11166 50/push-eax +11167 53/push-ebx +11168 # ebx = base +11169 8b/-> *(ebp+0xc) 3/r32/ebx +11170 (emit-indent *(ebp+8) *Curr-block-depth) +11171 (write-buffered *(ebp+8) "8b/-> *") +11172 # if base is an (addr array ...) in a register +11173 { +11174 81 7/subop/compare *(ebx+0x18)) 0/imm32 # Var-register +11175 74/jump-if-= break/disp8 +11176 $emit-save-size-to:emit-base-from-register: +11177 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +11178 (write-buffered *(ebp+8) %eax) +11179 eb/jump $emit-save-size-to:emit-output/disp8 +11180 } +11181 # otherwise if base is an (array ...) on the stack +11182 { +11183 81 7/subop/compare *(ebx+0x14)) 0/imm32 # Var-offset +11184 74/jump-if-= break/disp8 +11185 $emit-save-size-to:emit-base-from-stack: +11186 (write-buffered *(ebp+8) "(ebp+") +11187 (print-int32-buffered *(ebp+8) *(ebx+0x14)) # Var-offset +11188 (write-buffered *(ebp+8) ")") +11189 } +11190 $emit-save-size-to:emit-output: +11191 (write-buffered *(ebp+8) " ") +11192 (get Registers *(ebp+0x10) 0xc "Registers") # => eax +11193 (print-int32-buffered *(ebp+8) *eax) +11194 (write-buffered *(ebp+8) "/r32\n") +11195 $emit-save-size-to:end: +11196 # . restore registers +11197 5b/pop-to-ebx +11198 58/pop-to-eax +11199 # . epilogue +11200 89/<- %esp 5/r32/ebp +11201 5d/pop-to-ebp +11202 c3/return +11203 +11204 emit-divide-by-shift-right: # out: (addr buffered-file), reg: (addr array byte), size: int +11205 # . prologue +11206 55/push-ebp +11207 89/<- %ebp 4/r32/esp +11208 # . save registers +11209 50/push-eax +11210 # +11211 (emit-indent *(ebp+8) *Curr-block-depth) +11212 (write-buffered *(ebp+8) "c1/shift 5/subop/>> %") +11213 (write-buffered *(ebp+8) *(ebp+0xc)) +11214 (write-buffered *(ebp+8) Space) +11215 (num-shift-rights *(ebp+0x10)) # => eax +11216 (print-int32-buffered *(ebp+8) %eax) +11217 (write-buffered *(ebp+8) "/imm8\n") +11218 $emit-divide-by-shift-right:end: +11219 # . restore registers +11220 58/pop-to-eax +11221 # . epilogue +11222 89/<- %esp 5/r32/ebp +11223 5d/pop-to-ebp +11224 c3/return +11225 +11226 translate-mu-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +11227 # . prologue +11228 55/push-ebp +11229 89/<- %ebp 4/r32/esp +11230 # . save registers +11231 51/push-ecx +11232 # ecx = stmt +11233 8b/-> *(ebp+0xc) 1/r32/ecx +11234 # var base/ecx: (addr var) = stmt->inouts[0] +11235 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +11236 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11237 89/<- %ecx 0/r32/eax +11238 # if (var->register) do one thing +11239 { +11240 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +11241 74/jump-if-= break/disp8 +11242 # TODO: ensure there's no dereference +11243 (translate-mu-index-stmt-with-array-in-register *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +11244 eb/jump $translate-mu-index-stmt:end/disp8 +11245 } +11246 # if (var->offset) do a different thing +11247 { +11248 81 7/subop/compare *(ecx+0x14) 0/imm32 # Var-offset +11249 74/jump-if-= break/disp8 +11250 # TODO: ensure there's no dereference +11251 (translate-mu-index-stmt-with-array-on-stack *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +11252 eb/jump $translate-mu-index-stmt:end/disp8 +11253 } +11254 $translate-mu-index-stmt:end: +11255 # . restore registers +11256 59/pop-to-ecx +11257 # . epilogue +11258 89/<- %esp 5/r32/ebp +11259 5d/pop-to-ebp +11260 c3/return +11261 +11262 $translate-mu-index-stmt-with-array:error1: +11263 (write-buffered *(ebp+0x10) "couldn't translate an index instruction. second (index) input must either lie in a register or be a literal\n") +11264 (flush *(ebp+0x10)) +11265 (stop *(ebp+0x14) 1) +11266 # never gets here +11267 +11268 $translate-mu-index-stmt-with-array:error2: +11269 (write-buffered *(ebp+0x10) "couldn't translate an index instruction. second (index) input when in a register must be an int or offset\n") +11270 (flush *(ebp+0x10)) +11271 (stop *(ebp+0x14) 1) +11272 # never gets here +11273 +11274 translate-mu-index-stmt-with-array-in-register: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +11275 # . prologue +11276 55/push-ebp +11277 89/<- %ebp 4/r32/esp +11278 # . save registers +11279 50/push-eax +11280 51/push-ecx +11281 52/push-edx +11282 53/push-ebx +11283 # +11284 (emit-indent *(ebp+8) *Curr-block-depth) +11285 (write-buffered *(ebp+8) "8d/copy-address *(") +11286 # TODO: ensure inouts[0] is in a register and not dereferenced +11287 $translate-mu-index-stmt-with-array-in-register:emit-base: +11288 # ecx = stmt +11289 8b/-> *(ebp+0xc) 1/r32/ecx +11290 # var base/ebx: (addr var) = inouts[0] +11291 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +11292 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11293 89/<- %ebx 0/r32/eax +11294 # print base->register " + " +11295 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +11296 (write-buffered *(ebp+8) %eax) +11297 (write-buffered *(ebp+8) " + ") +11298 # var index/edx: (addr var) = inouts[1] +11299 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +11300 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +11301 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11302 89/<- %edx 0/r32/eax +11303 # if index->register +11304 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register +11305 { +11306 0f 84/jump-if-= break/disp32 +11307 $translate-mu-index-stmt-with-array-in-register:emit-register-index: +11308 # if index is an int +11309 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +11310 (is-simple-mu-type? %eax 1) # int => eax +11311 3d/compare-eax-and 0/imm32/false +11312 { +11313 0f 84/jump-if-= break/disp32 +11314 $translate-mu-index-stmt-with-array-in-register:emit-int-register-index: +11315 # print index->register "<<" log2(array-element-size(base)) " + 4) " +11316 # . index->register "<<" +11317 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +11318 (write-buffered *(ebp+8) %eax) +11319 (write-buffered *(ebp+8) "<<") +11320 # . log2(array-element-size(base->type)) +11321 # TODO: ensure size is a power of 2 +11322 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +11323 (num-shift-rights %eax) # => eax +11324 (print-int32-buffered *(ebp+8) %eax) +11325 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-register-index-done/disp32 +11326 } +11327 # if index->type is any other atom, abort +11328 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +11329 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom +11330 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 +11331 # if index has type (offset ...) +11332 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax +11333 (is-simple-mu-type? %eax 7) # => eax +11334 3d/compare-eax-and 0/imm32/false +11335 { +11336 0f 84/jump-if-= break/disp32 +11337 # print index->register +11338 $translate-mu-index-stmt-with-array-in-register:emit-offset-register-index: +11339 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +11340 (write-buffered *(ebp+8) %eax) +11341 } +11342 $translate-mu-index-stmt-with-array-in-register:emit-register-index-done: +11343 (write-buffered *(ebp+8) " + 4) ") +11344 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 +11345 } +11346 # otherwise if index is a literal +11347 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +11348 (is-simple-mu-type? %eax 0) # => eax +11349 3d/compare-eax-and 0/imm32/false +11350 { +11351 0f 84/jump-if-= break/disp32 +11352 $translate-mu-index-stmt-with-array-in-register:emit-literal-index: +11353 # var index-value/edx: int = parse-hex-int(index->name) +11354 (lookup *edx *(edx+4)) # Var-name Var-name => eax +11355 (parse-hex-int %eax) # => eax +11356 89/<- %edx 0/r32/eax +11357 # offset = idx-value * array-element-size(base->type) +11358 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +11359 f7 4/subop/multiply-into-eax %edx # clobbers edx +11360 # offset += 4 for array size +11361 05/add-to-eax 4/imm32 +11362 # TODO: check edx for overflow +11363 # print offset +11364 (print-int32-buffered *(ebp+8) %eax) +11365 (write-buffered *(ebp+8) ") ") +11366 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 +11367 } +11368 # otherwise abort +11369 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 +11370 $translate-mu-index-stmt-with-array-in-register:emit-output: +11371 # outputs[0] "/r32" +11372 8b/-> *(ebp+0xc) 1/r32/ecx +11373 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +11374 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11375 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +11376 (get Registers %eax 0xc "Registers") # => eax: (addr int) +11377 (print-int32-buffered *(ebp+8) *eax) +11378 (write-buffered *(ebp+8) "/r32\n") +11379 $translate-mu-index-stmt-with-array-in-register:end: +11380 # . restore registers +11381 5b/pop-to-ebx +11382 5a/pop-to-edx +11383 59/pop-to-ecx +11384 58/pop-to-eax +11385 # . epilogue +11386 89/<- %esp 5/r32/ebp +11387 5d/pop-to-ebp +11388 c3/return +11389 +11390 translate-mu-index-stmt-with-array-on-stack: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +11391 # . prologue +11392 55/push-ebp +11393 89/<- %ebp 4/r32/esp +11394 # . save registers +11395 50/push-eax +11396 51/push-ecx +11397 52/push-edx +11398 53/push-ebx +11399 # +11400 (emit-indent *(ebp+8) *Curr-block-depth) +11401 (write-buffered *(ebp+8) "8d/copy-address *(ebp + ") +11402 # var curr/edx: (addr stmt-var) = lookup(stmt->inouts) +11403 8b/-> *(ebp+0xc) 0/r32/eax +11404 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +11405 89/<- %edx 0/r32/eax +11406 # var base/ecx: (addr var) = lookup(curr->value) +11407 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11408 89/<- %ecx 0/r32/eax +11409 # var curr2/eax: (addr stmt-var) = lookup(curr->next) +11410 (lookup *(edx+8) *(edx+0xc)) # Stmt-var-next Stmt-var-next => eax +11411 # var index/edx: (handle var) = curr2->value +11412 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11413 89/<- %edx 0/r32/eax +11414 # if index->register +11415 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register +11416 { +11417 0f 84/jump-if-= break/disp32 +11418 $translate-mu-index-stmt-with-array-on-stack:emit-register-index: +11419 # if index is an int +11420 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +11421 (is-simple-mu-type? %eax 1) # int => eax +11422 3d/compare-eax-and 0/imm32/false +11423 { +11424 0f 84/jump-if-= break/disp32 +11425 $translate-mu-index-stmt-with-array-on-stack:emit-int-register-index: +11426 # print index->register "<<" log2(array-element-size(base)) " + " base->offset+4 +11427 # . inouts[1]->register "<<" +11428 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +11429 (write-buffered *(ebp+8) %eax) +11430 (write-buffered *(ebp+8) "<<") +11431 # . log2(array-element-size(base)) +11432 # TODO: ensure size is a power of 2 +11433 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax +11434 (num-shift-rights %eax) # => eax +11435 (print-int32-buffered *(ebp+8) %eax) +11436 # +11437 (write-buffered *(ebp+8) " + ") +11438 # +11439 8b/-> *(ecx+0x14) 0/r32/eax # Var-offset +11440 05/add-to-eax 4/imm32 # for array length +11441 (print-int32-buffered *(ebp+8) %eax) +11442 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done/disp32 +11443 } +11444 # if index->type is any other atom, abort +11445 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +11446 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom +11447 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 +11448 # if index has type (offset ...) +11449 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax +11450 (is-simple-mu-type? %eax 7) # => eax +11451 3d/compare-eax-and 0/imm32/false +11452 { +11453 0f 84/jump-if-= break/disp32 +11454 # print index->register +11455 $translate-mu-index-stmt-with-array-on-stack:emit-offset-register-index: +11456 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +11457 (write-buffered *(ebp+8) %eax) +11458 } +11459 $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done: +11460 (write-buffered *(ebp+8) ") ") +11461 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 +11462 } +11463 # otherwise if index is a literal +11464 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +11465 (is-simple-mu-type? %eax 0) # => eax +11466 3d/compare-eax-and 0/imm32/false +11467 { +11468 0f 84/jump-if-= break/disp32 +11469 $translate-mu-index-stmt-with-array-on-stack:emit-literal-index: +11470 # var idx-value/edx: int = parse-hex-int(index->name) +11471 (lookup *edx *(edx+4)) # Var-name Var-name => eax +11472 (parse-hex-int %eax) # Var-name => eax +11473 89/<- %edx 0/r32/eax +11474 # offset = idx-value * array-element-size(base) +11475 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax +11476 f7 4/subop/multiply-into-eax %edx # clobbers edx +11477 # offset += base->offset +11478 03/add *(ecx+0x14) 0/r32/eax # Var-offset +11479 # offset += 4 for array size +11480 05/add-to-eax 4/imm32 +11481 # TODO: check edx for overflow +11482 # print offset +11483 (print-int32-buffered *(ebp+8) %eax) +11484 (write-buffered *(ebp+8) ") ") +11485 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 +11486 } +11487 # otherwise abort +11488 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 +11489 $translate-mu-index-stmt-with-array-on-stack:emit-output: +11490 # outputs[0] "/r32" +11491 8b/-> *(ebp+0xc) 0/r32/eax +11492 (lookup *(eax+0x14) *(eax+0x18)) # Stmt1-outputs Stmt1-outputs => eax +11493 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11494 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +11495 (get Registers %eax 0xc "Registers") # => eax: (addr int) +11496 (print-int32-buffered *(ebp+8) *eax) +11497 (write-buffered *(ebp+8) "/r32\n") +11498 $translate-mu-index-stmt-with-array-on-stack:end: +11499 # . restore registers +11500 5b/pop-to-ebx +11501 5a/pop-to-edx +11502 59/pop-to-ecx +11503 58/pop-to-eax +11504 # . epilogue +11505 89/<- %esp 5/r32/ebp +11506 5d/pop-to-ebp +11507 c3/return +11508 +11509 translate-mu-compute-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +11510 # . prologue +11511 55/push-ebp +11512 89/<- %ebp 4/r32/esp +11513 # . save registers +11514 50/push-eax +11515 51/push-ecx +11516 52/push-edx +11517 53/push-ebx +11518 # +11519 (emit-indent *(ebp+8) *Curr-block-depth) +11520 (write-buffered *(ebp+8) "69/multiply") +11521 # ecx = stmt +11522 8b/-> *(ebp+0xc) 1/r32/ecx +11523 # var first-inout/ebx: (addr stmt-var) = stmt->inouts[0] +11524 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +11525 89/<- %ebx 0/r32/eax +11526 $translate-mu-compute-index-stmt:emit-index: +11527 (lookup *(ebx+8) *(ebx+0xc)) # Stmt-var-next Stmt-var-next => eax +11528 (emit-subx-var-as-rm32 *(ebp+8) %eax) +11529 (write-buffered *(ebp+8) Space) +11530 $translate-mu-compute-index-stmt:emit-elem-size: +11531 # var base/ebx: (addr var) +11532 (lookup *ebx *(ebx+4)) # Stmt-var-value Stmt-var-value => eax +11533 89/<- %ebx 0/r32/eax +11534 # print array-element-size(base) +11535 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +11536 (print-int32-buffered *(ebp+8) %eax) +11537 (write-buffered *(ebp+8) "/imm32 ") +11538 $translate-mu-compute-index-stmt:emit-output: +11539 # outputs[0] "/r32" +11540 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +11541 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11542 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +11543 (get Registers %eax 0xc "Registers") # => eax: (addr int) +11544 (print-int32-buffered *(ebp+8) *eax) +11545 (write-buffered *(ebp+8) "/r32\n") +11546 $translate-mu-compute-index-stmt:end: +11547 # . restore registers +11548 5b/pop-to-ebx +11549 5a/pop-to-edx +11550 59/pop-to-ecx +11551 58/pop-to-eax +11552 # . epilogue +11553 89/<- %esp 5/r32/ebp +11554 5d/pop-to-ebp +11555 c3/return +11556 +11557 translate-mu-get-stmt: # out: (addr buffered-file), stmt: (addr stmt) +11558 # . prologue +11559 55/push-ebp +11560 89/<- %ebp 4/r32/esp +11561 # . save registers +11562 50/push-eax +11563 51/push-ecx +11564 52/push-edx +11565 # +11566 (emit-indent *(ebp+8) *Curr-block-depth) +11567 (write-buffered *(ebp+8) "8d/copy-address ") +11568 # ecx = stmt +11569 8b/-> *(ebp+0xc) 1/r32/ecx +11570 # var offset/edx: int = get offset of stmt +11571 (mu-get-offset %ecx) # => eax +11572 89/<- %edx 0/r32/eax +11573 # var base/eax: (addr var) = stmt->inouts->value +11574 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +11575 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11576 # if base is in a register +11577 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +11578 { +11579 0f 84/jump-if-= break/disp32 +11580 $translate-mu-get-stmt:emit-register-input: +11581 # emit "*(" base->register " + " offset ") " +11582 (write-buffered *(ebp+8) "*(") +11583 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +11584 (write-buffered *(ebp+8) %eax) +11585 (write-buffered *(ebp+8) " + ") +11586 (print-int32-buffered *(ebp+8) %edx) +11587 (write-buffered *(ebp+8) ") ") +11588 e9/jump $translate-mu-get-stmt:emit-output/disp32 +11589 } +11590 # otherwise base is on the stack +11591 { +11592 $translate-mu-get-stmt:emit-stack-input: +11593 # emit "*(ebp + " inouts[0]->stack-offset + offset ") " +11594 (write-buffered *(ebp+8) "*(ebp+") +11595 03/add *(eax+0x14) 2/r32/edx # Var-offset +11596 (print-int32-buffered *(ebp+8) %edx) +11597 (write-buffered *(ebp+8) ") ") +11598 eb/jump $translate-mu-get-stmt:emit-output/disp8 +11599 } +11600 $translate-mu-get-stmt:emit-output: +11601 # var output/eax: (addr var) = stmt->outputs->value +11602 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +11603 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11604 # emit offset->register "/r32" +11605 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +11606 (get Registers %eax 0xc "Registers") # => eax: (addr int) +11607 (print-int32-buffered *(ebp+8) *eax) +11608 (write-buffered *(ebp+8) "/r32\n") +11609 $translate-mu-get-stmt:end: +11610 # . restore registers +11611 5a/pop-to-edx +11612 59/pop-to-ecx +11613 58/pop-to-eax +11614 # . epilogue +11615 89/<- %esp 5/r32/ebp +11616 5d/pop-to-ebp +11617 c3/return +11618 +11619 array-element-type-id: # v: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: type-id +11620 # precondition: n is positive +11621 # . prologue +11622 55/push-ebp +11623 89/<- %ebp 4/r32/esp +11624 # +11625 8b/-> *(ebp+8) 0/r32/eax +11626 # var t/eax: (addr tree type-id) +11627 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +11628 # if t == 0 abort +11629 3d/compare-eax-with 0/imm32 +11630 0f 84/jump-if-== $array-element-type-id:error0/disp32 +11631 # if t->is-atom? abort +11632 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom +11633 0f 85/jump-if-!= $array-element-type-id:error1/disp32 +11634 # if (t->left == addr) t = t->right +11635 { +11636 50/push-eax +11637 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax +11638 (is-simple-mu-type? %eax 2) # addr => eax +11639 3d/compare-eax-with 0/imm32/false +11640 58/pop-to-eax +11641 74/jump-if-= break/disp8 +11642 $array-element-type-id:skip-addr: +11643 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax +11644 } +11645 # if t == 0 abort +11646 3d/compare-eax-with 0/imm32 +11647 0f 84/jump-if-= $array-element-type-id:error2/disp32 +11648 # if t->is-atom? abort +11649 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom +11650 0f 85/jump-if-!= $array-element-type-id:error2/disp32 +11651 # if t->left != array abort +11652 { +11653 50/push-eax +11654 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax +11655 (is-simple-mu-type? %eax 3) # array => eax +11656 3d/compare-eax-with 0/imm32/false +11657 58/pop-to-eax +11658 $array-element-type-id:no-array: +11659 0f 84/jump-if-= $array-element-type-id:error2/disp32 +11660 } +11661 $array-element-type-id:skip-array: +11662 # t = t->right +11663 (lookup *(eax+0xc) *(eax+0x10)) # Tree-right Tree-right => eax +11664 # if t == 0 abort +11665 3d/compare-eax-with 0/imm32 +11666 0f 84/jump-if-= $array-element-type-id:error2/disp32 +11667 # if t->is-atom? abort +11668 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom +11669 0f 85/jump-if-!= $array-element-type-id:error2/disp32 +11670 # return t->left->value +11671 (lookup *(eax+4) *(eax+8)) # Tree-left Tree-left => eax +11672 8b/-> *(eax+4) 0/r32/eax # Tree-value +11673 $array-element-type-id:end: +11674 # . epilogue +11675 89/<- %esp 5/r32/ebp +11676 5d/pop-to-ebp +11677 c3/return +11678 +11679 $array-element-type-id:error0: +11680 (write-buffered *(ebp+0xc) "array-element-type-id: var '") +11681 50/push-eax +11682 8b/-> *(ebp+8) 0/r32/eax +11683 (lookup *eax *(eax+4)) # Var-name Var-name => eax +11684 (write-buffered *(ebp+0xc) %eax) +11685 58/pop-to-eax +11686 (write-buffered *(ebp+0xc) "' has no type\n") +11687 (flush *(ebp+0xc)) +11688 (stop *(ebp+0x10) 1) +11689 # never gets here +11690 +11691 $array-element-type-id:error1: +11692 (write-buffered *(ebp+0xc) "array-element-type-id: var '") +11693 50/push-eax +11694 8b/-> *(ebp+8) 0/r32/eax +11695 (lookup *eax *(eax+4)) # Var-name Var-name => eax +11696 (write-buffered *(ebp+0xc) %eax) +11697 58/pop-to-eax +11698 (write-buffered *(ebp+0xc) "' has atomic type ") +11699 (print-int32-buffered *(ebp+0xc) *(eax+4)) # Tree-value +11700 (write-buffered *(ebp+0xc) Newline) +11701 (flush *(ebp+0xc)) +11702 (stop *(ebp+0x10) 1) +11703 # never gets here +11704 +11705 $array-element-type-id:error2: +11706 (write-buffered *(ebp+0xc) "array-element-type-id: var '") +11707 50/push-eax +11708 8b/-> *(ebp+8) 0/r32/eax +11709 (lookup *eax *(eax+4)) # Var-name Var-name => eax +11710 (write-buffered *(ebp+0xc) %eax) +11711 58/pop-to-eax +11712 (write-buffered *(ebp+0xc) "' has non-array type\n") +11713 (flush *(ebp+0xc)) +11714 (stop *(ebp+0x10) 1) +11715 # never gets here +11716 +11717 power-of-2?: # n: int, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: boolean +11718 # precondition: n is positive +11719 # . prologue +11720 55/push-ebp +11721 89/<- %ebp 4/r32/esp +11722 # eax = n +11723 8b/-> *(ebp+8) 0/r32/eax +11724 # if (n < 0) abort +11725 3d/compare-eax-with 0/imm32 +11726 0f 8c/jump-if-< $power-of-2?:abort/disp32 +11727 # var tmp/eax: int = n-1 +11728 48/decrement-eax +11729 # var tmp2/eax: int = n & tmp +11730 23/and-> *(ebp+8) 0/r32/eax +11731 # return (tmp2 == 0) +11732 3d/compare-eax-and 0/imm32 +11733 0f 94/set-byte-if-= %al +11734 81 4/subop/and %eax 0xff/imm32 +11735 $power-of-2?:end: +11736 # . epilogue +11737 89/<- %esp 5/r32/ebp +11738 5d/pop-to-ebp +11739 c3/return +11740 +11741 $power-of-2?:abort: +11742 (write-buffered *(ebp+0xc) "power-of-2?: negative number\n") +11743 (flush *(ebp+0xc)) +11744 (stop *(ebp+0x10) 1) +11745 # never gets here +11746 +11747 num-shift-rights: # n: int -> result/eax: int +11748 # precondition: n is a positive power of 2 +11749 # . prologue +11750 55/push-ebp +11751 89/<- %ebp 4/r32/esp +11752 # . save registers +11753 51/push-ecx +11754 # var curr/ecx: int = n +11755 8b/-> *(ebp+8) 1/r32/ecx +11756 # result = 0 +11757 b8/copy-to-eax 0/imm32 +11758 { +11759 # if (curr <= 1) break +11760 81 7/subop/compare %ecx 1/imm32 +11761 7e/jump-if-<= break/disp8 +11762 40/increment-eax +11763 c1/shift 5/subop/arithmetic-right %ecx 1/imm8 +11764 eb/jump loop/disp8 +11765 } +11766 $num-shift-rights:end: +11767 # . restore registers +11768 59/pop-to-ecx +11769 # . epilogue +11770 89/<- %esp 5/r32/ebp +11771 5d/pop-to-ebp +11772 c3/return +11773 +11774 mu-get-offset: # stmt: (addr stmt) -> result/eax: int +11775 # . prologue +11776 55/push-ebp +11777 89/<- %ebp 4/r32/esp +11778 # var second-inout/eax: (addr stmt-var) = stmt->inouts->next +11779 8b/-> *(ebp+8) 0/r32/eax +11780 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +11781 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +11782 # var output-var/eax: (addr var) = second-inout->value +11783 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +11784 #? (write-buffered Stderr "mu-get-offset: ") +11785 #? (print-int32-buffered Stderr %eax) +11786 #? (write-buffered Stderr " name: ") +11787 #? 50/push-eax +11788 #? (lookup *eax *(eax+4)) # Var-name +11789 #? (write-buffered Stderr %eax) +11790 #? 58/pop-to-eax +11791 #? (write-buffered Stderr Newline) +11792 #? (flush Stderr) +11793 # return output-var->stack-offset +11794 8b/-> *(eax+0x14) 0/r32/eax # Var-offset +11795 #? (write-buffered Stderr "=> ") +11796 #? (print-int32-buffered Stderr %eax) +11797 #? (write-buffered Stderr Newline) +11798 #? (flush Stderr) +11799 $emit-get-offset:end: +11800 # . epilogue +11801 89/<- %esp 5/r32/ebp +11802 5d/pop-to-ebp +11803 c3/return +11804 +11805 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) +11806 # . prologue +11807 55/push-ebp +11808 89/<- %ebp 4/r32/esp +11809 # . save registers +11810 50/push-eax +11811 51/push-ecx +11812 56/push-esi +11813 # esi = block +11814 8b/-> *(ebp+0xc) 6/r32/esi +11815 # block->var->block-depth = *Curr-block-depth +11816 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax +11817 8b/-> *Curr-block-depth 1/r32/ecx +11818 89/<- *(eax+0x10) 1/r32/ecx # Var-block-depth +11819 # var stmts/eax: (addr list stmt) = lookup(block->statements) +11820 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax +11821 # +11822 { +11823 $emit-subx-block:check-empty: +11824 3d/compare-eax-and 0/imm32 +11825 0f 84/jump-if-= break/disp32 +11826 (emit-indent *(ebp+8) *Curr-block-depth) +11827 (write-buffered *(ebp+8) "{\n") +11828 # var v/ecx: (addr var) = lookup(block->var) +11829 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax +11830 89/<- %ecx 0/r32/eax +11831 # +11832 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +11833 (write-buffered *(ebp+8) %eax) +11834 (write-buffered *(ebp+8) ":loop:\n") +11835 ff 0/subop/increment *Curr-block-depth +11836 (push *(ebp+0x10) *(esi+0xc)) # Block-var +11837 (push *(ebp+0x10) *(esi+0x10)) # Block-var +11838 (push *(ebp+0x10) 0) # false +11839 # emit block->statements +11840 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax +11841 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +11842 (pop *(ebp+0x10)) # => eax +11843 (pop *(ebp+0x10)) # => eax +11844 (pop *(ebp+0x10)) # => eax +11845 ff 1/subop/decrement *Curr-block-depth +11846 (emit-indent *(ebp+8) *Curr-block-depth) +11847 (write-buffered *(ebp+8) "}\n") +11848 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +11849 (write-buffered *(ebp+8) %eax) +11850 (write-buffered *(ebp+8) ":break:\n") +11851 } +11852 $emit-subx-block:end: +11853 # . restore registers +11854 5e/pop-to-esi +11855 59/pop-to-ecx +11856 58/pop-to-eax +11857 # . epilogue +11858 89/<- %esp 5/r32/ebp +11859 5d/pop-to-ebp +11860 c3/return +11861 +11862 # Primitives supported +11863 # See mu_instructions for a summary of this linked-list data structure. +11864 # +11865 # For each operation, put variants with hard-coded registers before flexible ones. +11866 # +11867 # Unfortunately, our restrictions on addresses require that various fields in +11868 # primitives be handles, which complicates these definitions. +11869 # - we need to insert dummy fields all over the place for fake alloc-ids +11870 # - we can't use our syntax sugar of quoted literals for string fields +11871 # +11872 # Fake alloc-ids are needed because our type definitions up top require +11873 # handles but it's clearer to statically allocate these long-lived objects. +11874 # Fake alloc-ids are perfectly safe, but they can't be reclaimed. +11875 # +11876 # Every 'object' below starts with a fake alloc-id. It may also contain other +11877 # fake alloc-ids for various handle fields. +11878 # +11879 # I think of objects starting with a fake alloc-id as having type 'payload'. +11880 # It's not really intended to be created dynamically; for that use `allocate` +11881 # as usual. +11882 # +11883 # Idea for a notation to simplify such definitions: +11884 # _Primitive-increment-eax: # (payload primitive) +11885 # 0x11/alloc-id:fake:payload +11886 # 0x11 @(0x11 "increment") # name +11887 # 0 0 # inouts +11888 # 0x11 @(0x11/payload +11889 # 0x11 @(0x11/payload # List-value +11890 # 0 0 # Var-name +11891 # 0x11 @(0x11 # Var-type +11892 # 1/is-atom +11893 # 1/value 0/unused # Tree-left +11894 # 0 0 # Tree-right +11895 # ) +11896 # 1 # block-depth +11897 # 0 # stack-offset +11898 # 0x11 @(0x11 "eax") # Var-register +11899 # ) +11900 # 0 0) # List-next +11901 # ... +11902 # _Primitive-increment-ecx/imm32/next +11903 # ... +11904 # Awfully complex and non-obvious. But also clearly signals there's something +11905 # to learn here, so may be worth trying. +11906 # +11907 # '@' is just an initial thought. Punctuation used so far in Mu: () * % # / " +11908 # +11909 # For now we'll continue to just use comments and manually ensure they stay up +11910 # to date. +11911 == data +11912 Primitives: # (addr primitive) +11913 # - increment/decrement +11914 _Primitive-increment-eax: # (addr primitive) +11915 # var/eax <- increment => 40/increment-eax 11916 0x11/imm32/alloc-id:fake -11917 _string_31_xor_with/imm32/subx-name -11918 1/imm32/rm32-is-first-inout -11919 2/imm32/r32-is-second-inout -11920 0/imm32/no-imm32 -11921 0/imm32/no-disp32 -11922 0/imm32/output-is-write-only -11923 0x11/imm32/alloc-id:fake -11924 _Primitive-xor-mem-with-reg/imm32/next -11925 _Primitive-xor-mem-with-reg: # (payload primitive) -11926 0x11/imm32/alloc-id:fake:payload -11927 # var1/reg <- xor var2 => 33/xor var2/rm32 var1/r32 -11928 0x11/imm32/alloc-id:fake -11929 _string-xor/imm32/name -11930 0x11/imm32/alloc-id:fake -11931 Single-int-var-in-mem/imm32/inouts -11932 0x11/imm32/alloc-id:fake -11933 Single-int-var-in-some-register/imm32/outputs +11917 _string-increment/imm32/name +11918 0/imm32/no-inouts +11919 0/imm32/no-inouts +11920 0x11/imm32/alloc-id:fake +11921 Single-int-var-in-eax/imm32/outputs +11922 0x11/imm32/alloc-id:fake +11923 _string_40_increment_eax/imm32/subx-name +11924 0/imm32/no-rm32 +11925 0/imm32/no-r32 +11926 0/imm32/no-imm32 +11927 0/imm32/no-disp32 +11928 0/imm32/output-is-write-only +11929 0x11/imm32/alloc-id:fake +11930 _Primitive-increment-ecx/imm32/next +11931 _Primitive-increment-ecx: # (payload primitive) +11932 0x11/imm32/alloc-id:fake:payload +11933 # var/ecx <- increment => 41/increment-ecx 11934 0x11/imm32/alloc-id:fake -11935 _string_33_xor/imm32/subx-name -11936 1/imm32/rm32-is-first-inout -11937 3/imm32/r32-is-first-output -11938 0/imm32/no-imm32 -11939 0/imm32/no-disp32 -11940 0/imm32/output-is-write-only -11941 0x11/imm32/alloc-id:fake -11942 _Primitive-xor-lit-with-reg/imm32/next -11943 _Primitive-xor-lit-with-reg: # (payload primitive) -11944 0x11/imm32/alloc-id:fake:payload -11945 # var1/reg <- xor lit => 81 6/subop/xor var1/rm32 lit/imm32 -11946 0x11/imm32/alloc-id:fake -11947 _string-xor/imm32/name -11948 0x11/imm32/alloc-id:fake -11949 Single-lit-var/imm32/inouts -11950 0x11/imm32/alloc-id:fake -11951 Single-int-var-in-some-register/imm32/outputs +11935 _string-increment/imm32/name +11936 0/imm32/no-inouts +11937 0/imm32/no-inouts +11938 0x11/imm32/alloc-id:fake +11939 Single-int-var-in-ecx/imm32/outputs +11940 0x11/imm32/alloc-id:fake +11941 _string_41_increment_ecx/imm32/subx-name +11942 0/imm32/no-rm32 +11943 0/imm32/no-r32 +11944 0/imm32/no-imm32 +11945 0/imm32/no-disp32 +11946 0/imm32/output-is-write-only +11947 0x11/imm32/alloc-id:fake +11948 _Primitive-increment-edx/imm32/next +11949 _Primitive-increment-edx: # (payload primitive) +11950 0x11/imm32/alloc-id:fake:payload +11951 # var/edx <- increment => 42/increment-edx 11952 0x11/imm32/alloc-id:fake -11953 _string_81_subop_xor/imm32/subx-name -11954 3/imm32/rm32-is-first-output -11955 0/imm32/no-r32 -11956 1/imm32/imm32-is-first-inout -11957 0/imm32/no-disp32 -11958 0/imm32/output-is-write-only -11959 0x11/imm32/alloc-id:fake -11960 _Primitive-xor-lit-with-mem/imm32/next -11961 _Primitive-xor-lit-with-mem: # (payload primitive) -11962 0x11/imm32/alloc-id:fake:payload -11963 # xor-with var1, lit => 81 6/subop/xor var1/rm32 lit/imm32 -11964 0x11/imm32/alloc-id:fake -11965 _string-xor-with/imm32/name -11966 0x11/imm32/alloc-id:fake -11967 Int-var-and-literal/imm32/inouts -11968 0/imm32/no-outputs -11969 0/imm32/no-outputs +11953 _string-increment/imm32/name +11954 0/imm32/no-inouts +11955 0/imm32/no-inouts +11956 0x11/imm32/alloc-id:fake +11957 Single-int-var-in-edx/imm32/outputs +11958 0x11/imm32/alloc-id:fake +11959 _string_42_increment_edx/imm32/subx-name +11960 0/imm32/no-rm32 +11961 0/imm32/no-r32 +11962 0/imm32/no-imm32 +11963 0/imm32/no-disp32 +11964 0/imm32/output-is-write-only +11965 0x11/imm32/alloc-id:fake +11966 _Primitive-increment-ebx/imm32/next +11967 _Primitive-increment-ebx: # (payload primitive) +11968 0x11/imm32/alloc-id:fake:payload +11969 # var/ebx <- increment => 43/increment-ebx 11970 0x11/imm32/alloc-id:fake -11971 _string_81_subop_xor/imm32/subx-name -11972 1/imm32/rm32-is-first-inout -11973 0/imm32/no-r32 -11974 2/imm32/imm32-is-first-inout -11975 0/imm32/no-disp32 -11976 0/imm32/output-is-write-only -11977 0x11/imm32/alloc-id:fake -11978 _Primitive-copy-to-eax/imm32/next -11979 # - copy -11980 _Primitive-copy-to-eax: # (payload primitive) -11981 0x11/imm32/alloc-id:fake:payload -11982 # var/eax <- copy lit => b8/copy-to-eax lit/imm32 +11971 _string-increment/imm32/name +11972 0/imm32/no-inouts +11973 0/imm32/no-inouts +11974 0x11/imm32/alloc-id:fake +11975 Single-int-var-in-ebx/imm32/outputs +11976 0x11/imm32/alloc-id:fake +11977 _string_43_increment_ebx/imm32/subx-name +11978 0/imm32/no-rm32 +11979 0/imm32/no-r32 +11980 0/imm32/no-imm32 +11981 0/imm32/no-disp32 +11982 0/imm32/output-is-write-only 11983 0x11/imm32/alloc-id:fake -11984 _string-copy/imm32/name -11985 0x11/imm32/alloc-id:fake -11986 Single-lit-var/imm32/inouts -11987 0x11/imm32/alloc-id:fake -11988 Single-int-var-in-eax/imm32/outputs -11989 0x11/imm32/alloc-id:fake -11990 _string_b8_copy_to_eax/imm32/subx-name -11991 0/imm32/no-rm32 -11992 0/imm32/no-r32 -11993 1/imm32/imm32-is-first-inout -11994 0/imm32/no-disp32 -11995 1/imm32/output-is-write-only -11996 0x11/imm32/alloc-id:fake -11997 _Primitive-copy-to-ecx/imm32/next -11998 _Primitive-copy-to-ecx: # (payload primitive) -11999 0x11/imm32/alloc-id:fake:payload -12000 # var/ecx <- copy lit => b9/copy-to-ecx lit/imm32 +11984 _Primitive-increment-esi/imm32/next +11985 _Primitive-increment-esi: # (payload primitive) +11986 0x11/imm32/alloc-id:fake:payload +11987 # var/esi <- increment => 46/increment-esi +11988 0x11/imm32/alloc-id:fake +11989 _string-increment/imm32/name +11990 0/imm32/no-inouts +11991 0/imm32/no-inouts +11992 0x11/imm32/alloc-id:fake +11993 Single-int-var-in-esi/imm32/outputs +11994 0x11/imm32/alloc-id:fake +11995 _string_46_increment_esi/imm32/subx-name +11996 0/imm32/no-rm32 +11997 0/imm32/no-r32 +11998 0/imm32/no-imm32 +11999 0/imm32/no-disp32 +12000 0/imm32/output-is-write-only 12001 0x11/imm32/alloc-id:fake -12002 _string-copy/imm32/name -12003 0x11/imm32/alloc-id:fake -12004 Single-lit-var/imm32/inouts -12005 0x11/imm32/alloc-id:fake -12006 Single-int-var-in-ecx/imm32/outputs -12007 0x11/imm32/alloc-id:fake -12008 _string_b9_copy_to_ecx/imm32/subx-name -12009 0/imm32/no-rm32 -12010 0/imm32/no-r32 -12011 1/imm32/imm32-is-first-inout -12012 0/imm32/no-disp32 -12013 1/imm32/output-is-write-only -12014 0x11/imm32/alloc-id:fake -12015 _Primitive-copy-to-edx/imm32/next -12016 _Primitive-copy-to-edx: # (payload primitive) -12017 0x11/imm32/alloc-id:fake:payload -12018 # var/edx <- copy lit => ba/copy-to-edx lit/imm32 +12002 _Primitive-increment-edi/imm32/next +12003 _Primitive-increment-edi: # (payload primitive) +12004 0x11/imm32/alloc-id:fake:payload +12005 # var/edi <- increment => 47/increment-edi +12006 0x11/imm32/alloc-id:fake +12007 _string-increment/imm32/name +12008 0/imm32/no-inouts +12009 0/imm32/no-inouts +12010 0x11/imm32/alloc-id:fake +12011 Single-int-var-in-edi/imm32/outputs +12012 0x11/imm32/alloc-id:fake +12013 _string_47_increment_edi/imm32/subx-name +12014 0/imm32/no-rm32 +12015 0/imm32/no-r32 +12016 0/imm32/no-imm32 +12017 0/imm32/no-disp32 +12018 0/imm32/output-is-write-only 12019 0x11/imm32/alloc-id:fake -12020 _string-copy/imm32/name -12021 0x11/imm32/alloc-id:fake -12022 Single-lit-var/imm32/inouts -12023 0x11/imm32/alloc-id:fake -12024 Single-int-var-in-edx/imm32/outputs -12025 0x11/imm32/alloc-id:fake -12026 _string_ba_copy_to_edx/imm32/subx-name -12027 0/imm32/no-rm32 -12028 0/imm32/no-r32 -12029 1/imm32/imm32-is-first-inout -12030 0/imm32/no-disp32 -12031 1/imm32/output-is-write-only -12032 0x11/imm32/alloc-id:fake -12033 _Primitive-copy-to-ebx/imm32/next -12034 _Primitive-copy-to-ebx: # (payload primitive) -12035 0x11/imm32/alloc-id:fake:payload -12036 # var/ebx <- copy lit => bb/copy-to-ebx lit/imm32 +12020 _Primitive-decrement-eax/imm32/next +12021 _Primitive-decrement-eax: # (payload primitive) +12022 0x11/imm32/alloc-id:fake:payload +12023 # var/eax <- decrement => 48/decrement-eax +12024 0x11/imm32/alloc-id:fake +12025 _string-decrement/imm32/name +12026 0/imm32/no-inouts +12027 0/imm32/no-inouts +12028 0x11/imm32/alloc-id:fake +12029 Single-int-var-in-eax/imm32/outputs +12030 0x11/imm32/alloc-id:fake +12031 _string_48_decrement_eax/imm32/subx-name +12032 0/imm32/no-rm32 +12033 0/imm32/no-r32 +12034 0/imm32/no-imm32 +12035 0/imm32/no-disp32 +12036 0/imm32/output-is-write-only 12037 0x11/imm32/alloc-id:fake -12038 _string-copy/imm32/name -12039 0x11/imm32/alloc-id:fake -12040 Single-lit-var/imm32/inouts -12041 0x11/imm32/alloc-id:fake -12042 Single-int-var-in-ebx/imm32/outputs -12043 0x11/imm32/alloc-id:fake -12044 _string_bb_copy_to_ebx/imm32/subx-name -12045 0/imm32/no-rm32 -12046 0/imm32/no-r32 -12047 1/imm32/imm32-is-first-inout -12048 0/imm32/no-disp32 -12049 1/imm32/output-is-write-only -12050 0x11/imm32/alloc-id:fake -12051 _Primitive-copy-to-esi/imm32/next -12052 _Primitive-copy-to-esi: # (payload primitive) -12053 0x11/imm32/alloc-id:fake:payload -12054 # var/esi <- copy lit => be/copy-to-esi lit/imm32 +12038 _Primitive-decrement-ecx/imm32/next +12039 _Primitive-decrement-ecx: # (payload primitive) +12040 0x11/imm32/alloc-id:fake:payload +12041 # var/ecx <- decrement => 49/decrement-ecx +12042 0x11/imm32/alloc-id:fake +12043 _string-decrement/imm32/name +12044 0/imm32/no-inouts +12045 0/imm32/no-inouts +12046 0x11/imm32/alloc-id:fake +12047 Single-int-var-in-ecx/imm32/outputs +12048 0x11/imm32/alloc-id:fake +12049 _string_49_decrement_ecx/imm32/subx-name +12050 0/imm32/no-rm32 +12051 0/imm32/no-r32 +12052 0/imm32/no-imm32 +12053 0/imm32/no-disp32 +12054 0/imm32/output-is-write-only 12055 0x11/imm32/alloc-id:fake -12056 _string-copy/imm32/name -12057 0x11/imm32/alloc-id:fake -12058 Single-lit-var/imm32/inouts -12059 0x11/imm32/alloc-id:fake -12060 Single-int-var-in-esi/imm32/outputs -12061 0x11/imm32/alloc-id:fake -12062 _string_be_copy_to_esi/imm32/subx-name -12063 0/imm32/no-rm32 -12064 0/imm32/no-r32 -12065 1/imm32/imm32-is-first-inout -12066 0/imm32/no-disp32 -12067 1/imm32/output-is-write-only -12068 0x11/imm32/alloc-id:fake -12069 _Primitive-copy-to-edi/imm32/next -12070 _Primitive-copy-to-edi: # (payload primitive) -12071 0x11/imm32/alloc-id:fake:payload -12072 # var/edi <- copy lit => bf/copy-to-edi lit/imm32 +12056 _Primitive-decrement-edx/imm32/next +12057 _Primitive-decrement-edx: # (payload primitive) +12058 0x11/imm32/alloc-id:fake:payload +12059 # var/edx <- decrement => 4a/decrement-edx +12060 0x11/imm32/alloc-id:fake +12061 _string-decrement/imm32/name +12062 0/imm32/no-inouts +12063 0/imm32/no-inouts +12064 0x11/imm32/alloc-id:fake +12065 Single-int-var-in-edx/imm32/outputs +12066 0x11/imm32/alloc-id:fake +12067 _string_4a_decrement_edx/imm32/subx-name +12068 0/imm32/no-rm32 +12069 0/imm32/no-r32 +12070 0/imm32/no-imm32 +12071 0/imm32/no-disp32 +12072 0/imm32/output-is-write-only 12073 0x11/imm32/alloc-id:fake -12074 _string-copy/imm32/name -12075 0x11/imm32/alloc-id:fake -12076 Single-lit-var/imm32/inouts -12077 0x11/imm32/alloc-id:fake -12078 Single-int-var-in-edi/imm32/outputs -12079 0x11/imm32/alloc-id:fake -12080 _string_bf_copy_to_edi/imm32/subx-name -12081 0/imm32/no-rm32 -12082 0/imm32/no-r32 -12083 1/imm32/imm32-is-first-inout -12084 0/imm32/no-disp32 -12085 1/imm32/output-is-write-only -12086 0x11/imm32/alloc-id:fake -12087 _Primitive-copy-reg-to-reg/imm32/next -12088 _Primitive-copy-reg-to-reg: # (payload primitive) -12089 0x11/imm32/alloc-id:fake:payload -12090 # var1/reg <- copy var2/reg => 89/<- var1/rm32 var2/r32 +12074 _Primitive-decrement-ebx/imm32/next +12075 _Primitive-decrement-ebx: # (payload primitive) +12076 0x11/imm32/alloc-id:fake:payload +12077 # var/ebx <- decrement => 4b/decrement-ebx +12078 0x11/imm32/alloc-id:fake +12079 _string-decrement/imm32/name +12080 0/imm32/no-inouts +12081 0/imm32/no-inouts +12082 0x11/imm32/alloc-id:fake +12083 Single-int-var-in-ebx/imm32/outputs +12084 0x11/imm32/alloc-id:fake +12085 _string_4b_decrement_ebx/imm32/subx-name +12086 0/imm32/no-rm32 +12087 0/imm32/no-r32 +12088 0/imm32/no-imm32 +12089 0/imm32/no-disp32 +12090 0/imm32/output-is-write-only 12091 0x11/imm32/alloc-id:fake -12092 _string-copy/imm32/name -12093 0x11/imm32/alloc-id:fake -12094 Single-int-var-in-some-register/imm32/inouts -12095 0x11/imm32/alloc-id:fake -12096 Single-int-var-in-some-register/imm32/outputs -12097 0x11/imm32/alloc-id:fake -12098 _string_89_<-/imm32/subx-name -12099 3/imm32/rm32-is-first-output -12100 1/imm32/r32-is-first-inout -12101 0/imm32/no-imm32 -12102 0/imm32/no-disp32 -12103 1/imm32/output-is-write-only -12104 0x11/imm32/alloc-id:fake -12105 _Primitive-copy-reg-to-mem/imm32/next -12106 _Primitive-copy-reg-to-mem: # (payload primitive) -12107 0x11/imm32/alloc-id:fake:payload -12108 # copy-to var1 var2/reg => 89/<- var1 var2/r32 +12092 _Primitive-decrement-esi/imm32/next +12093 _Primitive-decrement-esi: # (payload primitive) +12094 0x11/imm32/alloc-id:fake:payload +12095 # var/esi <- decrement => 4e/decrement-esi +12096 0x11/imm32/alloc-id:fake +12097 _string-decrement/imm32/name +12098 0/imm32/no-inouts +12099 0/imm32/no-inouts +12100 0x11/imm32/alloc-id:fake +12101 Single-int-var-in-esi/imm32/outputs +12102 0x11/imm32/alloc-id:fake +12103 _string_4e_decrement_esi/imm32/subx-name +12104 0/imm32/no-rm32 +12105 0/imm32/no-r32 +12106 0/imm32/no-imm32 +12107 0/imm32/no-disp32 +12108 0/imm32/output-is-write-only 12109 0x11/imm32/alloc-id:fake -12110 _string-copy-to/imm32/name -12111 0x11/imm32/alloc-id:fake -12112 Two-args-int-stack-int-reg/imm32/inouts -12113 0/imm32/no-outputs -12114 0/imm32/no-outputs -12115 0x11/imm32/alloc-id:fake -12116 _string_89_<-/imm32/subx-name -12117 1/imm32/rm32-is-first-inout -12118 2/imm32/r32-is-second-inout -12119 0/imm32/no-imm32 -12120 0/imm32/no-disp32 -12121 1/imm32/output-is-write-only -12122 0x11/imm32/alloc-id:fake -12123 _Primitive-copy-mem-to-reg/imm32/next -12124 _Primitive-copy-mem-to-reg: # (payload primitive) -12125 0x11/imm32/alloc-id:fake:payload -12126 # var1/reg <- copy var2 => 8b/-> var2/rm32 var1/r32 +12110 _Primitive-decrement-edi/imm32/next +12111 _Primitive-decrement-edi: # (payload primitive) +12112 0x11/imm32/alloc-id:fake:payload +12113 # var/edi <- decrement => 4f/decrement-edi +12114 0x11/imm32/alloc-id:fake +12115 _string-decrement/imm32/name +12116 0/imm32/no-inouts +12117 0/imm32/no-inouts +12118 0x11/imm32/alloc-id:fake +12119 Single-int-var-in-edi/imm32/outputs +12120 0x11/imm32/alloc-id:fake +12121 _string_4f_decrement_edi/imm32/subx-name +12122 0/imm32/no-rm32 +12123 0/imm32/no-r32 +12124 0/imm32/no-imm32 +12125 0/imm32/no-disp32 +12126 0/imm32/output-is-write-only 12127 0x11/imm32/alloc-id:fake -12128 _string-copy/imm32/name -12129 0x11/imm32/alloc-id:fake -12130 Single-int-var-in-mem/imm32/inouts -12131 0x11/imm32/alloc-id:fake -12132 Single-int-var-in-some-register/imm32/outputs -12133 0x11/imm32/alloc-id:fake -12134 _string_8b_->/imm32/subx-name -12135 1/imm32/rm32-is-first-inout -12136 3/imm32/r32-is-first-output -12137 0/imm32/no-imm32 -12138 0/imm32/no-disp32 -12139 1/imm32/output-is-write-only -12140 0x11/imm32/alloc-id:fake -12141 _Primitive-copy-lit-to-reg/imm32/next -12142 _Primitive-copy-lit-to-reg: # (payload primitive) -12143 0x11/imm32/alloc-id:fake:payload -12144 # var1/reg <- copy lit => c7 0/subop/copy var1/rm32 lit/imm32 +12128 _Primitive-increment-mem/imm32/next +12129 _Primitive-increment-mem: # (payload primitive) +12130 0x11/imm32/alloc-id:fake:payload +12131 # increment var => ff 0/subop/increment *(ebp+__) +12132 0x11/imm32/alloc-id:fake +12133 _string-increment/imm32/name +12134 0x11/imm32/alloc-id:fake +12135 Single-int-var-in-mem/imm32/inouts +12136 0/imm32/no-outputs +12137 0/imm32/no-outputs +12138 0x11/imm32/alloc-id:fake +12139 _string_ff_subop_increment/imm32/subx-name +12140 1/imm32/rm32-is-first-inout +12141 0/imm32/no-r32 +12142 0/imm32/no-imm32 +12143 0/imm32/no-disp32 +12144 0/imm32/output-is-write-only 12145 0x11/imm32/alloc-id:fake -12146 _string-copy/imm32/name -12147 0x11/imm32/alloc-id:fake -12148 Single-lit-var/imm32/inouts -12149 0x11/imm32/alloc-id:fake -12150 Single-int-var-in-some-register/imm32/outputs -12151 0x11/imm32/alloc-id:fake -12152 _string_c7_subop_copy/imm32/subx-name -12153 3/imm32/rm32-is-first-output -12154 0/imm32/no-r32 -12155 1/imm32/imm32-is-first-inout -12156 0/imm32/no-disp32 -12157 1/imm32/output-is-write-only -12158 0x11/imm32/alloc-id:fake -12159 _Primitive-copy-lit-to-mem/imm32/next -12160 _Primitive-copy-lit-to-mem: # (payload primitive) -12161 0x11/imm32/alloc-id:fake:payload -12162 # copy-to var1, lit => c7 0/subop/copy var1/rm32 lit/imm32 +12146 _Primitive-increment-reg/imm32/next +12147 _Primitive-increment-reg: # (payload primitive) +12148 0x11/imm32/alloc-id:fake:payload +12149 # var/reg <- increment => ff 0/subop/increment %__ +12150 0x11/imm32/alloc-id:fake +12151 _string-increment/imm32/name +12152 0/imm32/no-inouts +12153 0/imm32/no-inouts +12154 0x11/imm32/alloc-id:fake +12155 Single-int-var-in-some-register/imm32/outputs +12156 0x11/imm32/alloc-id:fake +12157 _string_ff_subop_increment/imm32/subx-name +12158 3/imm32/rm32-is-first-output +12159 0/imm32/no-r32 +12160 0/imm32/no-imm32 +12161 0/imm32/no-disp32 +12162 0/imm32/output-is-write-only 12163 0x11/imm32/alloc-id:fake -12164 _string-copy-to/imm32/name -12165 0x11/imm32/alloc-id:fake -12166 Int-var-and-literal/imm32/inouts -12167 0/imm32/no-outputs -12168 0/imm32/no-outputs -12169 0x11/imm32/alloc-id:fake -12170 _string_c7_subop_copy/imm32/subx-name -12171 1/imm32/rm32-is-first-inout -12172 0/imm32/no-r32 -12173 2/imm32/imm32-is-first-inout -12174 0/imm32/no-disp32 -12175 1/imm32/output-is-write-only -12176 0x11/imm32/alloc-id:fake -12177 _Primitive-copy-byte-from-reg/imm32/next -12178 # - copy byte -12179 _Primitive-copy-byte-from-reg: -12180 0x11/imm32/alloc-id:fake:payload -12181 # var/reg <- copy-byte var2/reg2 => 8a/byte-> %var2 var/r32 -12182 0x11/imm32/alloc-id:fake -12183 _string-copy-byte/imm32/name -12184 0x11/imm32/alloc-id:fake -12185 Single-byte-var-in-some-register/imm32/inouts +12164 _Primitive-decrement-mem/imm32/next +12165 _Primitive-decrement-mem: # (payload primitive) +12166 0x11/imm32/alloc-id:fake:payload +12167 # decrement var => ff 1/subop/decrement *(ebp+__) +12168 0x11/imm32/alloc-id:fake +12169 _string-decrement/imm32/name +12170 0x11/imm32/alloc-id:fake +12171 Single-int-var-in-mem/imm32/inouts +12172 0/imm32/no-outputs +12173 0/imm32/no-outputs +12174 0x11/imm32/alloc-id:fake +12175 _string_ff_subop_decrement/imm32/subx-name +12176 1/imm32/rm32-is-first-inout +12177 0/imm32/no-r32 +12178 0/imm32/no-imm32 +12179 0/imm32/no-disp32 +12180 0/imm32/output-is-write-only +12181 0x11/imm32/alloc-id:fake +12182 _Primitive-decrement-reg/imm32/next +12183 _Primitive-decrement-reg: # (payload primitive) +12184 0x11/imm32/alloc-id:fake:payload +12185 # var/reg <- decrement => ff 1/subop/decrement %__ 12186 0x11/imm32/alloc-id:fake -12187 Single-byte-var-in-some-register/imm32/outputs -12188 0x11/imm32/alloc-id:fake -12189 _string_8a_copy_byte/imm32/subx-name -12190 1/imm32/rm32-is-first-inout -12191 3/imm32/r32-is-first-output -12192 0/imm32/no-imm32 -12193 0/imm32/no-disp32 -12194 1/imm32/output-is-write-only -12195 0x11/imm32/alloc-id:fake -12196 _Primitive-copy-byte-from-mem/imm32/next -12197 _Primitive-copy-byte-from-mem: -12198 0x11/imm32/alloc-id:fake:payload -12199 # var/reg <- copy-byte *var2/reg2 => 8a/byte-> *var2 var/r32 -12200 0x11/imm32/alloc-id:fake -12201 _string-copy-byte/imm32/name -12202 0x11/imm32/alloc-id:fake -12203 Single-byte-var-in-mem/imm32/inouts -12204 0x11/imm32/alloc-id:fake -12205 Single-byte-var-in-some-register/imm32/outputs -12206 0x11/imm32/alloc-id:fake -12207 _string_8a_copy_byte/imm32/subx-name -12208 1/imm32/rm32-is-first-inout -12209 3/imm32/r32-is-first-output -12210 0/imm32/no-imm32 -12211 0/imm32/no-disp32 -12212 1/imm32/output-is-write-only -12213 0x11/imm32/alloc-id:fake -12214 _Primitive-copy-byte-to-mem/imm32/next -12215 _Primitive-copy-byte-to-mem: -12216 0x11/imm32/alloc-id:fake:payload -12217 # copy-byte-to *var1/reg1, var2/reg2 => 88/byte<- *reg1 reg2/r32 +12187 _string-decrement/imm32/name +12188 0/imm32/no-inouts +12189 0/imm32/no-inouts +12190 0x11/imm32/alloc-id:fake +12191 Single-int-var-in-some-register/imm32/outputs +12192 0x11/imm32/alloc-id:fake +12193 _string_ff_subop_decrement/imm32/subx-name +12194 3/imm32/rm32-is-first-output +12195 0/imm32/no-r32 +12196 0/imm32/no-imm32 +12197 0/imm32/no-disp32 +12198 0/imm32/output-is-write-only +12199 0x11/imm32/alloc-id:fake +12200 _Primitive-add-to-eax/imm32/next +12201 # - add +12202 _Primitive-add-to-eax: # (payload primitive) +12203 0x11/imm32/alloc-id:fake:payload +12204 # var/eax <- add lit => 05/add-to-eax lit/imm32 +12205 0x11/imm32/alloc-id:fake +12206 _string-add/imm32/name +12207 0x11/imm32/alloc-id:fake +12208 Single-lit-var/imm32/inouts +12209 0x11/imm32/alloc-id:fake +12210 Single-int-var-in-eax/imm32/outputs +12211 0x11/imm32/alloc-id:fake +12212 _string_05_add_to_eax/imm32/subx-name +12213 0/imm32/no-rm32 +12214 0/imm32/no-r32 +12215 1/imm32/imm32-is-first-inout +12216 0/imm32/no-disp32 +12217 0/imm32/output-is-write-only 12218 0x11/imm32/alloc-id:fake -12219 _string-copy-byte-to/imm32/name -12220 0x11/imm32/alloc-id:fake -12221 Two-args-byte-stack-byte-reg/imm32/inouts -12222 0/imm32/no-outputs -12223 0/imm32/no-outputs -12224 0x11/imm32/alloc-id:fake -12225 _string_88_copy_byte/imm32/subx-name -12226 1/imm32/rm32-is-first-inout -12227 2/imm32/r32-is-second-inout -12228 0/imm32/no-imm32 -12229 0/imm32/no-disp32 -12230 0/imm32/output-is-write-only -12231 0x11/imm32/alloc-id:fake -12232 _Primitive-address/imm32/next -12233 # - address -12234 _Primitive-address: # (payload primitive) -12235 0x11/imm32/alloc-id:fake:payload -12236 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 -12237 0x11/imm32/alloc-id:fake -12238 _string-address/imm32/name -12239 0x11/imm32/alloc-id:fake -12240 Single-int-var-in-mem/imm32/inouts +12219 _Primitive-add-reg-to-reg/imm32/next +12220 _Primitive-add-reg-to-reg: # (payload primitive) +12221 0x11/imm32/alloc-id:fake:payload +12222 # var1/reg <- add var2/reg => 01/add-to var1/rm32 var2/r32 +12223 0x11/imm32/alloc-id:fake +12224 _string-add/imm32/name +12225 0x11/imm32/alloc-id:fake +12226 Single-int-var-in-some-register/imm32/inouts +12227 0x11/imm32/alloc-id:fake +12228 Single-int-var-in-some-register/imm32/outputs +12229 0x11/imm32/alloc-id:fake +12230 _string_01_add_to/imm32/subx-name +12231 3/imm32/rm32-is-first-output +12232 1/imm32/r32-is-first-inout +12233 0/imm32/no-imm32 +12234 0/imm32/no-disp32 +12235 0/imm32/output-is-write-only +12236 0x11/imm32/alloc-id:fake +12237 _Primitive-add-reg-to-mem/imm32/next +12238 _Primitive-add-reg-to-mem: # (payload primitive) +12239 0x11/imm32/alloc-id:fake:payload +12240 # add-to var1 var2/reg => 01/add-to var1 var2/r32 12241 0x11/imm32/alloc-id:fake -12242 Single-addr-var-in-some-register/imm32/outputs +12242 _string-add-to/imm32/name 12243 0x11/imm32/alloc-id:fake -12244 _string_8d_copy_address/imm32/subx-name -12245 1/imm32/rm32-is-first-inout -12246 3/imm32/r32-is-first-output -12247 0/imm32/no-imm32 -12248 0/imm32/no-disp32 -12249 1/imm32/output-is-write-only -12250 0x11/imm32/alloc-id:fake -12251 _Primitive-compare-reg-with-reg/imm32/next -12252 # - compare -12253 _Primitive-compare-reg-with-reg: # (payload primitive) -12254 0x11/imm32/alloc-id:fake:payload -12255 # compare var1/reg1 var2/reg2 => 39/compare var1/rm32 var2/r32 -12256 0x11/imm32/alloc-id:fake -12257 _string-compare/imm32/name -12258 0x11/imm32/alloc-id:fake -12259 Two-int-args-in-regs/imm32/inouts -12260 0/imm32/no-outputs -12261 0/imm32/no-outputs -12262 0x11/imm32/alloc-id:fake -12263 _string_39_compare->/imm32/subx-name -12264 1/imm32/rm32-is-first-inout -12265 2/imm32/r32-is-second-inout -12266 0/imm32/no-imm32 -12267 0/imm32/no-disp32 -12268 0/imm32/output-is-write-only -12269 0x11/imm32/alloc-id:fake -12270 _Primitive-compare-mem-with-reg/imm32/next -12271 _Primitive-compare-mem-with-reg: # (payload primitive) -12272 0x11/imm32/alloc-id:fake:payload -12273 # compare var1 var2/reg => 39/compare var1/rm32 var2/r32 -12274 0x11/imm32/alloc-id:fake -12275 _string-compare/imm32/name -12276 0x11/imm32/alloc-id:fake -12277 Two-args-int-stack-int-reg/imm32/inouts -12278 0/imm32/no-outputs -12279 0/imm32/no-outputs -12280 0x11/imm32/alloc-id:fake -12281 _string_39_compare->/imm32/subx-name -12282 1/imm32/rm32-is-first-inout -12283 2/imm32/r32-is-second-inout -12284 0/imm32/no-imm32 -12285 0/imm32/no-disp32 -12286 0/imm32/output-is-write-only -12287 0x11/imm32/alloc-id:fake -12288 _Primitive-compare-reg-with-mem/imm32/next -12289 _Primitive-compare-reg-with-mem: # (payload primitive) -12290 0x11/imm32/alloc-id:fake:payload -12291 # compare var1/reg var2 => 3b/compare<- var2/rm32 var1/r32 -12292 0x11/imm32/alloc-id:fake -12293 _string-compare/imm32/name -12294 0x11/imm32/alloc-id:fake -12295 Two-args-int-reg-int-stack/imm32/inouts -12296 0/imm32/no-outputs -12297 0/imm32/no-outputs -12298 0x11/imm32/alloc-id:fake -12299 _string_3b_compare<-/imm32/subx-name -12300 2/imm32/rm32-is-second-inout -12301 1/imm32/r32-is-first-inout -12302 0/imm32/no-imm32 -12303 0/imm32/no-disp32 -12304 0/imm32/output-is-write-only -12305 0x11/imm32/alloc-id:fake -12306 _Primitive-compare-eax-with-literal/imm32/next -12307 _Primitive-compare-eax-with-literal: # (payload primitive) -12308 0x11/imm32/alloc-id:fake:payload -12309 # compare var1/eax n => 3d/compare-eax-with n/imm32 -12310 0x11/imm32/alloc-id:fake -12311 _string-compare/imm32/name -12312 0x11/imm32/alloc-id:fake -12313 Two-args-int-eax-int-literal/imm32/inouts -12314 0/imm32/no-outputs -12315 0/imm32/no-outputs +12244 Two-args-int-stack-int-reg/imm32/inouts +12245 0/imm32/no-outputs +12246 0/imm32/no-outputs +12247 0x11/imm32/alloc-id:fake +12248 _string_01_add_to/imm32/subx-name +12249 1/imm32/rm32-is-first-inout +12250 2/imm32/r32-is-second-inout +12251 0/imm32/no-imm32 +12252 0/imm32/no-disp32 +12253 0/imm32/output-is-write-only +12254 0x11/imm32/alloc-id:fake +12255 _Primitive-add-mem-to-reg/imm32/next +12256 _Primitive-add-mem-to-reg: # (payload primitive) +12257 0x11/imm32/alloc-id:fake:payload +12258 # var1/reg <- add var2 => 03/add var2/rm32 var1/r32 +12259 0x11/imm32/alloc-id:fake +12260 _string-add/imm32/name +12261 0x11/imm32/alloc-id:fake +12262 Single-int-var-in-mem/imm32/inouts +12263 0x11/imm32/alloc-id:fake +12264 Single-int-var-in-some-register/imm32/outputs +12265 0x11/imm32/alloc-id:fake +12266 _string_03_add/imm32/subx-name +12267 1/imm32/rm32-is-first-inout +12268 3/imm32/r32-is-first-output +12269 0/imm32/no-imm32 +12270 0/imm32/no-disp32 +12271 0/imm32/output-is-write-only +12272 0x11/imm32/alloc-id:fake +12273 _Primitive-add-lit-to-reg/imm32/next +12274 _Primitive-add-lit-to-reg: # (payload primitive) +12275 0x11/imm32/alloc-id:fake:payload +12276 # var1/reg <- add lit => 81 0/subop/add var1/rm32 lit/imm32 +12277 0x11/imm32/alloc-id:fake +12278 _string-add/imm32/name +12279 0x11/imm32/alloc-id:fake +12280 Single-lit-var/imm32/inouts +12281 0x11/imm32/alloc-id:fake +12282 Single-int-var-in-some-register/imm32/outputs +12283 0x11/imm32/alloc-id:fake +12284 _string_81_subop_add/imm32/subx-name +12285 3/imm32/rm32-is-first-output +12286 0/imm32/no-r32 +12287 1/imm32/imm32-is-first-inout +12288 0/imm32/no-disp32 +12289 0/imm32/output-is-write-only +12290 0x11/imm32/alloc-id:fake +12291 _Primitive-add-lit-to-mem/imm32/next +12292 _Primitive-add-lit-to-mem: # (payload primitive) +12293 0x11/imm32/alloc-id:fake:payload +12294 # add-to var1, lit => 81 0/subop/add var1/rm32 lit/imm32 +12295 0x11/imm32/alloc-id:fake +12296 _string-add-to/imm32/name +12297 0x11/imm32/alloc-id:fake +12298 Int-var-and-literal/imm32/inouts +12299 0/imm32/no-outputs +12300 0/imm32/no-outputs +12301 0x11/imm32/alloc-id:fake +12302 _string_81_subop_add/imm32/subx-name +12303 1/imm32/rm32-is-first-inout +12304 0/imm32/no-r32 +12305 2/imm32/imm32-is-second-inout +12306 0/imm32/no-disp32 +12307 0/imm32/output-is-write-only +12308 0x11/imm32/alloc-id:fake +12309 _Primitive-subtract-from-eax/imm32/next +12310 # - subtract +12311 _Primitive-subtract-from-eax: # (payload primitive) +12312 0x11/imm32/alloc-id:fake:payload +12313 # var/eax <- subtract lit => 2d/subtract-from-eax lit/imm32 +12314 0x11/imm32/alloc-id:fake +12315 _string-subtract/imm32/name 12316 0x11/imm32/alloc-id:fake -12317 _string_3d_compare_eax_with/imm32/subx-name -12318 0/imm32/no-rm32 -12319 0/imm32/no-r32 -12320 2/imm32/imm32-is-second-inout -12321 0/imm32/no-disp32 -12322 0/imm32/output-is-write-only -12323 0x11/imm32/alloc-id:fake -12324 _Primitive-compare-reg-with-literal/imm32/next -12325 _Primitive-compare-reg-with-literal: # (payload primitive) -12326 0x11/imm32/alloc-id:fake:payload -12327 # compare var1/reg n => 81 7/subop/compare %reg n/imm32 -12328 0x11/imm32/alloc-id:fake -12329 _string-compare/imm32/name -12330 0x11/imm32/alloc-id:fake -12331 Int-var-in-register-and-literal/imm32/inouts -12332 0/imm32/no-outputs -12333 0/imm32/no-outputs +12317 Single-lit-var/imm32/inouts +12318 0x11/imm32/alloc-id:fake +12319 Single-int-var-in-eax/imm32/outputs +12320 0x11/imm32/alloc-id:fake +12321 _string_2d_subtract_from_eax/imm32/subx-name +12322 0/imm32/no-rm32 +12323 0/imm32/no-r32 +12324 1/imm32/imm32-is-first-inout +12325 0/imm32/no-disp32 +12326 0/imm32/output-is-write-only +12327 0x11/imm32/alloc-id:fake +12328 _Primitive-subtract-reg-from-reg/imm32/next +12329 _Primitive-subtract-reg-from-reg: # (payload primitive) +12330 0x11/imm32/alloc-id:fake:payload +12331 # var1/reg <- subtract var2/reg => 29/subtract-from var1/rm32 var2/r32 +12332 0x11/imm32/alloc-id:fake +12333 _string-subtract/imm32/name 12334 0x11/imm32/alloc-id:fake -12335 _string_81_subop_compare/imm32/subx-name -12336 1/imm32/rm32-is-first-inout -12337 0/imm32/no-r32 -12338 2/imm32/imm32-is-second-inout -12339 0/imm32/no-disp32 -12340 0/imm32/output-is-write-only -12341 0x11/imm32/alloc-id:fake -12342 _Primitive-compare-mem-with-literal/imm32/next -12343 _Primitive-compare-mem-with-literal: # (payload primitive) -12344 0x11/imm32/alloc-id:fake:payload -12345 # compare var1 n => 81 7/subop/compare *(ebp+___) n/imm32 -12346 0x11/imm32/alloc-id:fake -12347 _string-compare/imm32/name -12348 0x11/imm32/alloc-id:fake -12349 Int-var-and-literal/imm32/inouts -12350 0/imm32/no-outputs -12351 0/imm32/no-outputs +12335 Single-int-var-in-some-register/imm32/inouts +12336 0x11/imm32/alloc-id:fake +12337 Single-int-var-in-some-register/imm32/outputs +12338 0x11/imm32/alloc-id:fake +12339 _string_29_subtract_from/imm32/subx-name +12340 3/imm32/rm32-is-first-output +12341 1/imm32/r32-is-first-inout +12342 0/imm32/no-imm32 +12343 0/imm32/no-disp32 +12344 0/imm32/output-is-write-only +12345 0x11/imm32/alloc-id:fake +12346 _Primitive-subtract-reg-from-mem/imm32/next +12347 _Primitive-subtract-reg-from-mem: # (payload primitive) +12348 0x11/imm32/alloc-id:fake:payload +12349 # subtract-from var1 var2/reg => 29/subtract-from var1 var2/r32 +12350 0x11/imm32/alloc-id:fake +12351 _string-subtract-from/imm32/name 12352 0x11/imm32/alloc-id:fake -12353 _string_81_subop_compare/imm32/subx-name -12354 1/imm32/rm32-is-first-inout -12355 0/imm32/no-r32 -12356 2/imm32/imm32-is-second-inout -12357 0/imm32/no-disp32 -12358 0/imm32/output-is-write-only -12359 0x11/imm32/alloc-id:fake -12360 _Primitive-multiply-reg-by-reg/imm32/next -12361 # - multiply -12362 _Primitive-multiply-reg-by-reg: # (payload primitive) -12363 0x11/imm32/alloc-id:fake:payload -12364 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 -12365 0x11/imm32/alloc-id:fake -12366 _string-multiply/imm32/name -12367 0x11/imm32/alloc-id:fake -12368 Single-int-var-in-some-register/imm32/inouts -12369 0x11/imm32/alloc-id:fake -12370 Single-int-var-in-some-register/imm32/outputs -12371 0x11/imm32/alloc-id:fake -12372 _string_0f_af_multiply/imm32/subx-name -12373 1/imm32/rm32-is-first-inout -12374 3/imm32/r32-is-first-output -12375 0/imm32/no-imm32 -12376 0/imm32/no-disp32 -12377 0/imm32/output-is-write-only -12378 0x11/imm32/alloc-id:fake -12379 _Primitive-multiply-reg-by-mem/imm32/next -12380 _Primitive-multiply-reg-by-mem: # (payload primitive) -12381 0x11/imm32/alloc-id:fake:payload -12382 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 -12383 0x11/imm32/alloc-id:fake -12384 _string-multiply/imm32/name -12385 0x11/imm32/alloc-id:fake -12386 Single-int-var-in-mem/imm32/inouts -12387 0x11/imm32/alloc-id:fake -12388 Single-int-var-in-some-register/imm32/outputs -12389 0x11/imm32/alloc-id:fake -12390 _string_0f_af_multiply/imm32/subx-name -12391 1/imm32/rm32-is-first-inout -12392 3/imm32/r32-is-first-output -12393 0/imm32/no-imm32 -12394 0/imm32/no-disp32 -12395 0/imm32/output-is-write-only -12396 0x11/imm32/alloc-id:fake -12397 _Primitive-break-if-addr</imm32/next -12398 # - branches -12399 _Primitive-break-if-addr<: # (payload primitive) -12400 0x11/imm32/alloc-id:fake:payload -12401 0x11/imm32/alloc-id:fake -12402 _string-break-if-addr</imm32/name -12403 0/imm32/no-inouts -12404 0/imm32/no-inouts -12405 0/imm32/no-outputs -12406 0/imm32/no-outputs -12407 0x11/imm32/alloc-id:fake -12408 _string_0f_82_jump_break/imm32/subx-name -12409 0/imm32/no-rm32 -12410 0/imm32/no-r32 -12411 0/imm32/no-imm32 -12412 0/imm32/no-disp32 -12413 0/imm32/no-output -12414 0x11/imm32/alloc-id:fake -12415 _Primitive-break-if-addr>=/imm32/next -12416 _Primitive-break-if-addr>=: # (payload primitive) -12417 0x11/imm32/alloc-id:fake:payload -12418 0x11/imm32/alloc-id:fake -12419 _string-break-if-addr>=/imm32/name -12420 0/imm32/no-inouts -12421 0/imm32/no-inouts -12422 0/imm32/no-outputs -12423 0/imm32/no-outputs -12424 0x11/imm32/alloc-id:fake -12425 _string_0f_83_jump_break/imm32/subx-name -12426 0/imm32/no-rm32 -12427 0/imm32/no-r32 -12428 0/imm32/no-imm32 -12429 0/imm32/no-disp32 -12430 0/imm32/no-output -12431 0x11/imm32/alloc-id:fake -12432 _Primitive-break-if-=/imm32/next -12433 _Primitive-break-if-=: # (payload primitive) -12434 0x11/imm32/alloc-id:fake:payload -12435 0x11/imm32/alloc-id:fake -12436 _string-break-if-=/imm32/name -12437 0/imm32/no-inouts -12438 0/imm32/no-inouts -12439 0/imm32/no-outputs -12440 0/imm32/no-outputs +12353 Two-args-int-stack-int-reg/imm32/inouts +12354 0/imm32/no-outputs +12355 0/imm32/no-outputs +12356 0x11/imm32/alloc-id:fake +12357 _string_29_subtract_from/imm32/subx-name +12358 1/imm32/rm32-is-first-inout +12359 2/imm32/r32-is-second-inout +12360 0/imm32/no-imm32 +12361 0/imm32/no-disp32 +12362 0/imm32/output-is-write-only +12363 0x11/imm32/alloc-id:fake +12364 _Primitive-subtract-mem-from-reg/imm32/next +12365 _Primitive-subtract-mem-from-reg: # (payload primitive) +12366 0x11/imm32/alloc-id:fake:payload +12367 # var1/reg <- subtract var2 => 2b/subtract var2/rm32 var1/r32 +12368 0x11/imm32/alloc-id:fake +12369 _string-subtract/imm32/name +12370 0x11/imm32/alloc-id:fake +12371 Single-int-var-in-mem/imm32/inouts +12372 0x11/imm32/alloc-id:fake +12373 Single-int-var-in-some-register/imm32/outputs +12374 0x11/imm32/alloc-id:fake +12375 _string_2b_subtract/imm32/subx-name +12376 1/imm32/rm32-is-first-inout +12377 3/imm32/r32-is-first-output +12378 0/imm32/no-imm32 +12379 0/imm32/no-disp32 +12380 0/imm32/output-is-write-only +12381 0x11/imm32/alloc-id:fake +12382 _Primitive-subtract-lit-from-reg/imm32/next +12383 _Primitive-subtract-lit-from-reg: # (payload primitive) +12384 0x11/imm32/alloc-id:fake:payload +12385 # var1/reg <- subtract lit => 81 5/subop/subtract var1/rm32 lit/imm32 +12386 0x11/imm32/alloc-id:fake +12387 _string-subtract/imm32/name +12388 0x11/imm32/alloc-id:fake +12389 Single-lit-var/imm32/inouts +12390 0x11/imm32/alloc-id:fake +12391 Single-int-var-in-some-register/imm32/outputs +12392 0x11/imm32/alloc-id:fake +12393 _string_81_subop_subtract/imm32/subx-name +12394 3/imm32/rm32-is-first-output +12395 0/imm32/no-r32 +12396 1/imm32/imm32-is-first-inout +12397 0/imm32/no-disp32 +12398 0/imm32/output-is-write-only +12399 0x11/imm32/alloc-id:fake +12400 _Primitive-subtract-lit-from-mem/imm32/next +12401 _Primitive-subtract-lit-from-mem: # (payload primitive) +12402 0x11/imm32/alloc-id:fake:payload +12403 # subtract-from var1, lit => 81 5/subop/subtract var1/rm32 lit/imm32 +12404 0x11/imm32/alloc-id:fake +12405 _string-subtract-from/imm32/name +12406 0x11/imm32/alloc-id:fake +12407 Int-var-and-literal/imm32/inouts +12408 0/imm32/no-outputs +12409 0/imm32/no-outputs +12410 0x11/imm32/alloc-id:fake +12411 _string_81_subop_subtract/imm32/subx-name +12412 1/imm32/rm32-is-first-inout +12413 0/imm32/no-r32 +12414 2/imm32/imm32-is-first-inout +12415 0/imm32/no-disp32 +12416 0/imm32/output-is-write-only +12417 0x11/imm32/alloc-id:fake +12418 _Primitive-and-with-eax/imm32/next +12419 # - and +12420 _Primitive-and-with-eax: # (payload primitive) +12421 0x11/imm32/alloc-id:fake:payload +12422 # var/eax <- and lit => 25/and-with-eax lit/imm32 +12423 0x11/imm32/alloc-id:fake +12424 _string-and/imm32/name +12425 0x11/imm32/alloc-id:fake +12426 Single-lit-var/imm32/inouts +12427 0x11/imm32/alloc-id:fake +12428 Single-int-var-in-eax/imm32/outputs +12429 0x11/imm32/alloc-id:fake +12430 _string_25_and_with_eax/imm32/subx-name +12431 0/imm32/no-rm32 +12432 0/imm32/no-r32 +12433 1/imm32/imm32-is-first-inout +12434 0/imm32/no-disp32 +12435 0/imm32/output-is-write-only +12436 0x11/imm32/alloc-id:fake +12437 _Primitive-and-reg-with-reg/imm32/next +12438 _Primitive-and-reg-with-reg: # (payload primitive) +12439 0x11/imm32/alloc-id:fake:payload +12440 # var1/reg <- and var2/reg => 21/and-with var1/rm32 var2/r32 12441 0x11/imm32/alloc-id:fake -12442 _string_0f_84_jump_break/imm32/subx-name -12443 0/imm32/no-rm32 -12444 0/imm32/no-r32 -12445 0/imm32/no-imm32 -12446 0/imm32/no-disp32 -12447 0/imm32/no-output -12448 0x11/imm32/alloc-id:fake -12449 _Primitive-break-if-!=/imm32/next -12450 _Primitive-break-if-!=: # (payload primitive) -12451 0x11/imm32/alloc-id:fake:payload -12452 0x11/imm32/alloc-id:fake -12453 _string-break-if-!=/imm32/name -12454 0/imm32/no-inouts -12455 0/imm32/no-inouts -12456 0/imm32/no-outputs -12457 0/imm32/no-outputs -12458 0x11/imm32/alloc-id:fake -12459 _string_0f_85_jump_break/imm32/subx-name -12460 0/imm32/no-rm32 -12461 0/imm32/no-r32 -12462 0/imm32/no-imm32 -12463 0/imm32/no-disp32 -12464 0/imm32/no-output +12442 _string-and/imm32/name +12443 0x11/imm32/alloc-id:fake +12444 Single-int-var-in-some-register/imm32/inouts +12445 0x11/imm32/alloc-id:fake +12446 Single-int-var-in-some-register/imm32/outputs +12447 0x11/imm32/alloc-id:fake +12448 _string_21_and_with/imm32/subx-name +12449 3/imm32/rm32-is-first-output +12450 1/imm32/r32-is-first-inout +12451 0/imm32/no-imm32 +12452 0/imm32/no-disp32 +12453 0/imm32/output-is-write-only +12454 0x11/imm32/alloc-id:fake +12455 _Primitive-and-reg-with-mem/imm32/next +12456 _Primitive-and-reg-with-mem: # (payload primitive) +12457 0x11/imm32/alloc-id:fake:payload +12458 # and-with var1 var2/reg => 21/and-with var1 var2/r32 +12459 0x11/imm32/alloc-id:fake +12460 _string-and-with/imm32/name +12461 0x11/imm32/alloc-id:fake +12462 Two-args-int-stack-int-reg/imm32/inouts +12463 0/imm32/no-outputs +12464 0/imm32/no-outputs 12465 0x11/imm32/alloc-id:fake -12466 _Primitive-break-if-addr<=/imm32/next -12467 _Primitive-break-if-addr<=: # (payload primitive) -12468 0x11/imm32/alloc-id:fake:payload -12469 0x11/imm32/alloc-id:fake -12470 _string-break-if-addr<=/imm32/name -12471 0/imm32/no-inouts -12472 0/imm32/no-inouts -12473 0/imm32/no-outputs -12474 0/imm32/no-outputs -12475 0x11/imm32/alloc-id:fake -12476 _string_0f_86_jump_break/imm32/subx-name -12477 0/imm32/no-rm32 -12478 0/imm32/no-r32 -12479 0/imm32/no-imm32 -12480 0/imm32/no-disp32 -12481 0/imm32/no-output -12482 0x11/imm32/alloc-id:fake -12483 _Primitive-break-if-addr>/imm32/next -12484 _Primitive-break-if-addr>: # (payload primitive) -12485 0x11/imm32/alloc-id:fake:payload -12486 0x11/imm32/alloc-id:fake -12487 _string-break-if-addr>/imm32/name -12488 0/imm32/no-inouts -12489 0/imm32/no-inouts -12490 0/imm32/no-outputs -12491 0/imm32/no-outputs -12492 0x11/imm32/alloc-id:fake -12493 _string_0f_87_jump_break/imm32/subx-name -12494 0/imm32/no-rm32 -12495 0/imm32/no-r32 -12496 0/imm32/no-imm32 -12497 0/imm32/no-disp32 -12498 0/imm32/no-output +12466 _string_21_and_with/imm32/subx-name +12467 1/imm32/rm32-is-first-inout +12468 2/imm32/r32-is-second-inout +12469 0/imm32/no-imm32 +12470 0/imm32/no-disp32 +12471 0/imm32/output-is-write-only +12472 0x11/imm32/alloc-id:fake +12473 _Primitive-and-mem-with-reg/imm32/next +12474 _Primitive-and-mem-with-reg: # (payload primitive) +12475 0x11/imm32/alloc-id:fake:payload +12476 # var1/reg <- and var2 => 23/and var2/rm32 var1/r32 +12477 0x11/imm32/alloc-id:fake +12478 _string-and/imm32/name +12479 0x11/imm32/alloc-id:fake +12480 Single-int-var-in-mem/imm32/inouts +12481 0x11/imm32/alloc-id:fake +12482 Single-int-var-in-some-register/imm32/outputs +12483 0x11/imm32/alloc-id:fake +12484 _string_23_and/imm32/subx-name +12485 1/imm32/rm32-is-first-inout +12486 3/imm32/r32-is-first-output +12487 0/imm32/no-imm32 +12488 0/imm32/no-disp32 +12489 0/imm32/output-is-write-only +12490 0x11/imm32/alloc-id:fake +12491 _Primitive-and-lit-with-reg/imm32/next +12492 _Primitive-and-lit-with-reg: # (payload primitive) +12493 0x11/imm32/alloc-id:fake:payload +12494 # var1/reg <- and lit => 81 4/subop/and var1/rm32 lit/imm32 +12495 0x11/imm32/alloc-id:fake +12496 _string-and/imm32/name +12497 0x11/imm32/alloc-id:fake +12498 Single-lit-var/imm32/inouts 12499 0x11/imm32/alloc-id:fake -12500 _Primitive-break-if-</imm32/next -12501 _Primitive-break-if-<: # (payload primitive) -12502 0x11/imm32/alloc-id:fake:payload -12503 0x11/imm32/alloc-id:fake -12504 _string-break-if-</imm32/name -12505 0/imm32/no-inouts -12506 0/imm32/no-inouts -12507 0/imm32/no-outputs -12508 0/imm32/no-outputs -12509 0x11/imm32/alloc-id:fake -12510 _string_0f_8c_jump_break/imm32/subx-name -12511 0/imm32/no-rm32 -12512 0/imm32/no-r32 -12513 0/imm32/no-imm32 -12514 0/imm32/no-disp32 -12515 0/imm32/no-output -12516 0x11/imm32/alloc-id:fake -12517 _Primitive-break-if->=/imm32/next -12518 _Primitive-break-if->=: # (payload primitive) -12519 0x11/imm32/alloc-id:fake:payload -12520 0x11/imm32/alloc-id:fake -12521 _string-break-if->=/imm32/name -12522 0/imm32/no-inouts -12523 0/imm32/no-inouts -12524 0/imm32/no-outputs -12525 0/imm32/no-outputs +12500 Single-int-var-in-some-register/imm32/outputs +12501 0x11/imm32/alloc-id:fake +12502 _string_81_subop_and/imm32/subx-name +12503 3/imm32/rm32-is-first-output +12504 0/imm32/no-r32 +12505 1/imm32/imm32-is-first-inout +12506 0/imm32/no-disp32 +12507 0/imm32/output-is-write-only +12508 0x11/imm32/alloc-id:fake +12509 _Primitive-and-lit-with-mem/imm32/next +12510 _Primitive-and-lit-with-mem: # (payload primitive) +12511 0x11/imm32/alloc-id:fake:payload +12512 # and-with var1, lit => 81 4/subop/and var1/rm32 lit/imm32 +12513 0x11/imm32/alloc-id:fake +12514 _string-and-with/imm32/name +12515 0x11/imm32/alloc-id:fake +12516 Int-var-and-literal/imm32/inouts +12517 0/imm32/no-outputs +12518 0/imm32/no-outputs +12519 0x11/imm32/alloc-id:fake +12520 _string_81_subop_and/imm32/subx-name +12521 1/imm32/rm32-is-first-inout +12522 0/imm32/no-r32 +12523 2/imm32/imm32-is-first-inout +12524 0/imm32/no-disp32 +12525 0/imm32/output-is-write-only 12526 0x11/imm32/alloc-id:fake -12527 _string_0f_8d_jump_break/imm32/subx-name -12528 0/imm32/no-rm32 -12529 0/imm32/no-r32 -12530 0/imm32/no-imm32 -12531 0/imm32/no-disp32 -12532 0/imm32/no-output -12533 0x11/imm32/alloc-id:fake -12534 _Primitive-break-if-<=/imm32/next -12535 _Primitive-break-if-<=: # (payload primitive) -12536 0x11/imm32/alloc-id:fake:payload -12537 0x11/imm32/alloc-id:fake -12538 _string-break-if-<=/imm32/name -12539 0/imm32/no-inouts -12540 0/imm32/no-inouts -12541 0/imm32/no-outputs -12542 0/imm32/no-outputs -12543 0x11/imm32/alloc-id:fake -12544 _string_0f_8e_jump_break/imm32/subx-name -12545 0/imm32/no-rm32 -12546 0/imm32/no-r32 -12547 0/imm32/no-imm32 -12548 0/imm32/no-disp32 -12549 0/imm32/no-output +12527 _Primitive-or-with-eax/imm32/next +12528 # - or +12529 _Primitive-or-with-eax: # (payload primitive) +12530 0x11/imm32/alloc-id:fake:payload +12531 # var/eax <- or lit => 0d/or-with-eax lit/imm32 +12532 0x11/imm32/alloc-id:fake +12533 _string-or/imm32/name +12534 0x11/imm32/alloc-id:fake +12535 Single-lit-var/imm32/inouts +12536 0x11/imm32/alloc-id:fake +12537 Single-int-var-in-eax/imm32/outputs +12538 0x11/imm32/alloc-id:fake +12539 _string_0d_or_with_eax/imm32/subx-name +12540 0/imm32/no-rm32 +12541 0/imm32/no-r32 +12542 1/imm32/imm32-is-first-inout +12543 0/imm32/no-disp32 +12544 0/imm32/output-is-write-only +12545 0x11/imm32/alloc-id:fake +12546 _Primitive-or-reg-with-reg/imm32/next +12547 _Primitive-or-reg-with-reg: # (payload primitive) +12548 0x11/imm32/alloc-id:fake:payload +12549 # var1/reg <- or var2/reg => 09/or-with var1/rm32 var2/r32 12550 0x11/imm32/alloc-id:fake -12551 _Primitive-break-if->/imm32/next -12552 _Primitive-break-if->: # (payload primitive) -12553 0x11/imm32/alloc-id:fake:payload +12551 _string-or/imm32/name +12552 0x11/imm32/alloc-id:fake +12553 Single-int-var-in-some-register/imm32/inouts 12554 0x11/imm32/alloc-id:fake -12555 _string-break-if->/imm32/name -12556 0/imm32/no-inouts -12557 0/imm32/no-inouts -12558 0/imm32/no-outputs -12559 0/imm32/no-outputs -12560 0x11/imm32/alloc-id:fake -12561 _string_0f_8f_jump_break/imm32/subx-name -12562 0/imm32/no-rm32 -12563 0/imm32/no-r32 -12564 0/imm32/no-imm32 -12565 0/imm32/no-disp32 -12566 0/imm32/no-output -12567 0x11/imm32/alloc-id:fake -12568 _Primitive-break/imm32/next -12569 _Primitive-break: # (payload primitive) -12570 0x11/imm32/alloc-id:fake:payload -12571 0x11/imm32/alloc-id:fake -12572 _string-break/imm32/name -12573 0/imm32/no-inouts -12574 0/imm32/no-inouts -12575 0/imm32/no-outputs -12576 0/imm32/no-outputs -12577 0x11/imm32/alloc-id:fake -12578 _string_e9_jump_break/imm32/subx-name -12579 0/imm32/no-rm32 -12580 0/imm32/no-r32 -12581 0/imm32/no-imm32 -12582 0/imm32/no-disp32 -12583 0/imm32/no-output -12584 0x11/imm32/alloc-id:fake -12585 _Primitive-loop-if-addr</imm32/next -12586 _Primitive-loop-if-addr<: # (payload primitive) -12587 0x11/imm32/alloc-id:fake:payload +12555 Single-int-var-in-some-register/imm32/outputs +12556 0x11/imm32/alloc-id:fake +12557 _string_09_or_with/imm32/subx-name +12558 3/imm32/rm32-is-first-output +12559 1/imm32/r32-is-first-inout +12560 0/imm32/no-imm32 +12561 0/imm32/no-disp32 +12562 0/imm32/output-is-write-only +12563 0x11/imm32/alloc-id:fake +12564 _Primitive-or-reg-with-mem/imm32/next +12565 _Primitive-or-reg-with-mem: # (payload primitive) +12566 0x11/imm32/alloc-id:fake:payload +12567 # or-with var1 var2/reg => 09/or-with var1 var2/r32 +12568 0x11/imm32/alloc-id:fake +12569 _string-or-with/imm32/name +12570 0x11/imm32/alloc-id:fake +12571 Two-args-int-stack-int-reg/imm32/inouts +12572 0/imm32/no-outputs +12573 0/imm32/no-outputs +12574 0x11/imm32/alloc-id:fake +12575 _string_09_or_with/imm32/subx-name +12576 1/imm32/rm32-is-first-inout +12577 2/imm32/r32-is-second-inout +12578 0/imm32/no-imm32 +12579 0/imm32/no-disp32 +12580 0/imm32/output-is-write-only +12581 0x11/imm32/alloc-id:fake +12582 _Primitive-or-mem-with-reg/imm32/next +12583 _Primitive-or-mem-with-reg: # (payload primitive) +12584 0x11/imm32/alloc-id:fake:payload +12585 # var1/reg <- or var2 => 0b/or var2/rm32 var1/r32 +12586 0x11/imm32/alloc-id:fake +12587 _string-or/imm32/name 12588 0x11/imm32/alloc-id:fake -12589 _string-loop-if-addr</imm32/name -12590 0/imm32/no-inouts -12591 0/imm32/no-inouts -12592 0/imm32/no-outputs -12593 0/imm32/no-outputs -12594 0x11/imm32/alloc-id:fake -12595 _string_0f_82_jump_loop/imm32/subx-name -12596 0/imm32/no-rm32 -12597 0/imm32/no-r32 -12598 0/imm32/no-imm32 -12599 0/imm32/no-disp32 -12600 0/imm32/no-output -12601 0x11/imm32/alloc-id:fake -12602 _Primitive-loop-if-addr>=/imm32/next -12603 _Primitive-loop-if-addr>=: # (payload primitive) -12604 0x11/imm32/alloc-id:fake:payload -12605 0x11/imm32/alloc-id:fake -12606 _string-loop-if-addr>=/imm32/name -12607 0/imm32/no-inouts -12608 0/imm32/no-inouts -12609 0/imm32/no-outputs -12610 0/imm32/no-outputs -12611 0x11/imm32/alloc-id:fake -12612 _string_0f_83_jump_loop/imm32/subx-name -12613 0/imm32/no-rm32 -12614 0/imm32/no-r32 -12615 0/imm32/no-imm32 -12616 0/imm32/no-disp32 -12617 0/imm32/no-output -12618 0x11/imm32/alloc-id:fake -12619 _Primitive-loop-if-=/imm32/next -12620 _Primitive-loop-if-=: # (payload primitive) -12621 0x11/imm32/alloc-id:fake:payload +12589 Single-int-var-in-mem/imm32/inouts +12590 0x11/imm32/alloc-id:fake +12591 Single-int-var-in-some-register/imm32/outputs +12592 0x11/imm32/alloc-id:fake +12593 _string_0b_or/imm32/subx-name +12594 1/imm32/rm32-is-first-inout +12595 3/imm32/r32-is-first-output +12596 0/imm32/no-imm32 +12597 0/imm32/no-disp32 +12598 0/imm32/output-is-write-only +12599 0x11/imm32/alloc-id:fake +12600 _Primitive-or-lit-with-reg/imm32/next +12601 _Primitive-or-lit-with-reg: # (payload primitive) +12602 0x11/imm32/alloc-id:fake:payload +12603 # var1/reg <- or lit => 81 1/subop/or var1/rm32 lit/imm32 +12604 0x11/imm32/alloc-id:fake +12605 _string-or/imm32/name +12606 0x11/imm32/alloc-id:fake +12607 Single-lit-var/imm32/inouts +12608 0x11/imm32/alloc-id:fake +12609 Single-int-var-in-some-register/imm32/outputs +12610 0x11/imm32/alloc-id:fake +12611 _string_81_subop_or/imm32/subx-name +12612 3/imm32/rm32-is-first-output +12613 0/imm32/no-r32 +12614 1/imm32/imm32-is-first-inout +12615 0/imm32/no-disp32 +12616 0/imm32/output-is-write-only +12617 0x11/imm32/alloc-id:fake +12618 _Primitive-or-lit-with-mem/imm32/next +12619 _Primitive-or-lit-with-mem: # (payload primitive) +12620 0x11/imm32/alloc-id:fake:payload +12621 # or-with var1, lit => 81 1/subop/or var1/rm32 lit/imm32 12622 0x11/imm32/alloc-id:fake -12623 _string-loop-if-=/imm32/name -12624 0/imm32/no-inouts -12625 0/imm32/no-inouts +12623 _string-or-with/imm32/name +12624 0x11/imm32/alloc-id:fake +12625 Int-var-and-literal/imm32/inouts 12626 0/imm32/no-outputs 12627 0/imm32/no-outputs 12628 0x11/imm32/alloc-id:fake -12629 _string_0f_84_jump_loop/imm32/subx-name -12630 0/imm32/no-rm32 +12629 _string_81_subop_or/imm32/subx-name +12630 1/imm32/rm32-is-first-inout 12631 0/imm32/no-r32 -12632 0/imm32/no-imm32 +12632 2/imm32/imm32-is-second-inout 12633 0/imm32/no-disp32 -12634 0/imm32/no-output +12634 0/imm32/output-is-write-only 12635 0x11/imm32/alloc-id:fake -12636 _Primitive-loop-if-!=/imm32/next -12637 _Primitive-loop-if-!=: # (payload primitive) -12638 0x11/imm32/alloc-id:fake:payload -12639 0x11/imm32/alloc-id:fake -12640 _string-loop-if-!=/imm32/name -12641 0/imm32/no-inouts -12642 0/imm32/no-inouts -12643 0/imm32/no-outputs -12644 0/imm32/no-outputs +12636 _Primitive-xor-with-eax/imm32/next +12637 # - xor +12638 _Primitive-xor-with-eax: # (payload primitive) +12639 0x11/imm32/alloc-id:fake:payload +12640 # var/eax <- xor lit => 35/xor-with-eax lit/imm32 +12641 0x11/imm32/alloc-id:fake +12642 _string-xor/imm32/name +12643 0x11/imm32/alloc-id:fake +12644 Single-lit-var/imm32/inouts 12645 0x11/imm32/alloc-id:fake -12646 _string_0f_85_jump_loop/imm32/subx-name -12647 0/imm32/no-rm32 -12648 0/imm32/no-r32 -12649 0/imm32/no-imm32 -12650 0/imm32/no-disp32 -12651 0/imm32/no-output -12652 0x11/imm32/alloc-id:fake -12653 _Primitive-loop-if-addr<=/imm32/next -12654 _Primitive-loop-if-addr<=: # (payload primitive) -12655 0x11/imm32/alloc-id:fake:payload -12656 0x11/imm32/alloc-id:fake -12657 _string-loop-if-addr<=/imm32/name -12658 0/imm32/no-inouts -12659 0/imm32/no-inouts -12660 0/imm32/no-outputs -12661 0/imm32/no-outputs -12662 0x11/imm32/alloc-id:fake -12663 _string_0f_86_jump_loop/imm32/subx-name -12664 0/imm32/no-rm32 -12665 0/imm32/no-r32 -12666 0/imm32/no-imm32 -12667 0/imm32/no-disp32 -12668 0/imm32/no-output -12669 0x11/imm32/alloc-id:fake -12670 _Primitive-loop-if-addr>/imm32/next -12671 _Primitive-loop-if-addr>: # (payload primitive) -12672 0x11/imm32/alloc-id:fake:payload -12673 0x11/imm32/alloc-id:fake -12674 _string-loop-if-addr>/imm32/name -12675 0/imm32/no-inouts -12676 0/imm32/no-inouts -12677 0/imm32/no-outputs -12678 0/imm32/no-outputs +12646 Single-int-var-in-eax/imm32/outputs +12647 0x11/imm32/alloc-id:fake +12648 _string_35_xor_with_eax/imm32/subx-name +12649 0/imm32/no-rm32 +12650 0/imm32/no-r32 +12651 1/imm32/imm32-is-first-inout +12652 0/imm32/no-disp32 +12653 0/imm32/output-is-write-only +12654 0x11/imm32/alloc-id:fake +12655 _Primitive-xor-reg-with-reg/imm32/next +12656 _Primitive-xor-reg-with-reg: # (payload primitive) +12657 0x11/imm32/alloc-id:fake:payload +12658 # var1/reg <- xor var2/reg => 31/xor-with var1/rm32 var2/r32 +12659 0x11/imm32/alloc-id:fake +12660 _string-xor/imm32/name +12661 0x11/imm32/alloc-id:fake +12662 Single-int-var-in-some-register/imm32/inouts +12663 0x11/imm32/alloc-id:fake +12664 Single-int-var-in-some-register/imm32/outputs +12665 0x11/imm32/alloc-id:fake +12666 _string_31_xor_with/imm32/subx-name +12667 3/imm32/rm32-is-first-output +12668 1/imm32/r32-is-first-inout +12669 0/imm32/no-imm32 +12670 0/imm32/no-disp32 +12671 0/imm32/output-is-write-only +12672 0x11/imm32/alloc-id:fake +12673 _Primitive-xor-reg-with-mem/imm32/next +12674 _Primitive-xor-reg-with-mem: # (payload primitive) +12675 0x11/imm32/alloc-id:fake:payload +12676 # xor-with var1 var2/reg => 31/xor-with var1 var2/r32 +12677 0x11/imm32/alloc-id:fake +12678 _string-xor-with/imm32/name 12679 0x11/imm32/alloc-id:fake -12680 _string_0f_87_jump_loop/imm32/subx-name -12681 0/imm32/no-rm32 -12682 0/imm32/no-r32 -12683 0/imm32/no-imm32 -12684 0/imm32/no-disp32 -12685 0/imm32/no-output -12686 0x11/imm32/alloc-id:fake -12687 _Primitive-loop-if-</imm32/next -12688 _Primitive-loop-if-<: # (payload primitive) -12689 0x11/imm32/alloc-id:fake:payload +12680 Two-args-int-stack-int-reg/imm32/inouts +12681 0/imm32/no-outputs +12682 0/imm32/no-outputs +12683 0x11/imm32/alloc-id:fake +12684 _string_31_xor_with/imm32/subx-name +12685 1/imm32/rm32-is-first-inout +12686 2/imm32/r32-is-second-inout +12687 0/imm32/no-imm32 +12688 0/imm32/no-disp32 +12689 0/imm32/output-is-write-only 12690 0x11/imm32/alloc-id:fake -12691 _string-loop-if-</imm32/name -12692 0/imm32/no-inouts -12693 0/imm32/no-inouts -12694 0/imm32/no-outputs -12695 0/imm32/no-outputs -12696 0x11/imm32/alloc-id:fake -12697 _string_0f_8c_jump_loop/imm32/subx-name -12698 0/imm32/no-rm32 -12699 0/imm32/no-r32 -12700 0/imm32/no-imm32 -12701 0/imm32/no-disp32 -12702 0/imm32/no-output -12703 0x11/imm32/alloc-id:fake -12704 _Primitive-loop-if->=/imm32/next -12705 _Primitive-loop-if->=: # (payload primitive) -12706 0x11/imm32/alloc-id:fake:payload -12707 0x11/imm32/alloc-id:fake -12708 _string-loop-if->=/imm32/name -12709 0/imm32/no-inouts -12710 0/imm32/no-inouts -12711 0/imm32/no-outputs -12712 0/imm32/no-outputs +12691 _Primitive-xor-mem-with-reg/imm32/next +12692 _Primitive-xor-mem-with-reg: # (payload primitive) +12693 0x11/imm32/alloc-id:fake:payload +12694 # var1/reg <- xor var2 => 33/xor var2/rm32 var1/r32 +12695 0x11/imm32/alloc-id:fake +12696 _string-xor/imm32/name +12697 0x11/imm32/alloc-id:fake +12698 Single-int-var-in-mem/imm32/inouts +12699 0x11/imm32/alloc-id:fake +12700 Single-int-var-in-some-register/imm32/outputs +12701 0x11/imm32/alloc-id:fake +12702 _string_33_xor/imm32/subx-name +12703 1/imm32/rm32-is-first-inout +12704 3/imm32/r32-is-first-output +12705 0/imm32/no-imm32 +12706 0/imm32/no-disp32 +12707 0/imm32/output-is-write-only +12708 0x11/imm32/alloc-id:fake +12709 _Primitive-xor-lit-with-reg/imm32/next +12710 _Primitive-xor-lit-with-reg: # (payload primitive) +12711 0x11/imm32/alloc-id:fake:payload +12712 # var1/reg <- xor lit => 81 6/subop/xor var1/rm32 lit/imm32 12713 0x11/imm32/alloc-id:fake -12714 _string_0f_8d_jump_loop/imm32/subx-name -12715 0/imm32/no-rm32 -12716 0/imm32/no-r32 -12717 0/imm32/no-imm32 -12718 0/imm32/no-disp32 -12719 0/imm32/no-output -12720 0x11/imm32/alloc-id:fake -12721 _Primitive-loop-if-<=/imm32/next -12722 _Primitive-loop-if-<=: # (payload primitive) -12723 0x11/imm32/alloc-id:fake:payload -12724 0x11/imm32/alloc-id:fake -12725 _string-loop-if-<=/imm32/name -12726 0/imm32/no-inouts -12727 0/imm32/no-inouts -12728 0/imm32/no-outputs -12729 0/imm32/no-outputs -12730 0x11/imm32/alloc-id:fake -12731 _string_0f_8e_jump_loop/imm32/subx-name -12732 0/imm32/no-rm32 -12733 0/imm32/no-r32 -12734 0/imm32/no-imm32 -12735 0/imm32/no-disp32 -12736 0/imm32/no-output +12714 _string-xor/imm32/name +12715 0x11/imm32/alloc-id:fake +12716 Single-lit-var/imm32/inouts +12717 0x11/imm32/alloc-id:fake +12718 Single-int-var-in-some-register/imm32/outputs +12719 0x11/imm32/alloc-id:fake +12720 _string_81_subop_xor/imm32/subx-name +12721 3/imm32/rm32-is-first-output +12722 0/imm32/no-r32 +12723 1/imm32/imm32-is-first-inout +12724 0/imm32/no-disp32 +12725 0/imm32/output-is-write-only +12726 0x11/imm32/alloc-id:fake +12727 _Primitive-xor-lit-with-mem/imm32/next +12728 _Primitive-xor-lit-with-mem: # (payload primitive) +12729 0x11/imm32/alloc-id:fake:payload +12730 # xor-with var1, lit => 81 6/subop/xor var1/rm32 lit/imm32 +12731 0x11/imm32/alloc-id:fake +12732 _string-xor-with/imm32/name +12733 0x11/imm32/alloc-id:fake +12734 Int-var-and-literal/imm32/inouts +12735 0/imm32/no-outputs +12736 0/imm32/no-outputs 12737 0x11/imm32/alloc-id:fake -12738 _Primitive-loop-if->/imm32/next -12739 _Primitive-loop-if->: # (payload primitive) -12740 0x11/imm32/alloc-id:fake:payload -12741 0x11/imm32/alloc-id:fake -12742 _string-loop-if->/imm32/name -12743 0/imm32/no-inouts -12744 0/imm32/no-inouts -12745 0/imm32/no-outputs -12746 0/imm32/no-outputs -12747 0x11/imm32/alloc-id:fake -12748 _string_0f_8f_jump_loop/imm32/subx-name -12749 0/imm32/no-rm32 -12750 0/imm32/no-r32 -12751 0/imm32/no-imm32 -12752 0/imm32/no-disp32 -12753 0/imm32/no-output +12738 _string_81_subop_xor/imm32/subx-name +12739 1/imm32/rm32-is-first-inout +12740 0/imm32/no-r32 +12741 2/imm32/imm32-is-first-inout +12742 0/imm32/no-disp32 +12743 0/imm32/output-is-write-only +12744 0x11/imm32/alloc-id:fake +12745 _Primitive-copy-to-eax/imm32/next +12746 # - copy +12747 _Primitive-copy-to-eax: # (payload primitive) +12748 0x11/imm32/alloc-id:fake:payload +12749 # var/eax <- copy lit => b8/copy-to-eax lit/imm32 +12750 0x11/imm32/alloc-id:fake +12751 _string-copy/imm32/name +12752 0x11/imm32/alloc-id:fake +12753 Single-lit-var/imm32/inouts 12754 0x11/imm32/alloc-id:fake -12755 _Primitive-loop/imm32/next # we probably don't need an unconditional break -12756 _Primitive-loop: # (payload primitive) -12757 0x11/imm32/alloc-id:fake:payload -12758 0x11/imm32/alloc-id:fake -12759 _string-loop/imm32/name -12760 0/imm32/no-inouts -12761 0/imm32/no-inouts -12762 0/imm32/no-outputs -12763 0/imm32/no-outputs -12764 0x11/imm32/alloc-id:fake -12765 _string_e9_jump_loop/imm32/subx-name -12766 0/imm32/no-rm32 -12767 0/imm32/no-r32 -12768 0/imm32/no-imm32 -12769 0/imm32/no-disp32 -12770 0/imm32/no-output -12771 0x11/imm32/alloc-id:fake -12772 _Primitive-break-if-addr<-named/imm32/next -12773 # - branches to named blocks -12774 _Primitive-break-if-addr<-named: # (payload primitive) -12775 0x11/imm32/alloc-id:fake:payload -12776 0x11/imm32/alloc-id:fake -12777 _string-break-if-addr</imm32/name -12778 0x11/imm32/alloc-id:fake -12779 Single-lit-var/imm32/inouts -12780 0/imm32/no-outputs -12781 0/imm32/no-outputs -12782 0x11/imm32/alloc-id:fake -12783 _string_0f_82_jump_label/imm32/subx-name -12784 0/imm32/no-rm32 -12785 0/imm32/no-r32 -12786 0/imm32/no-imm32 -12787 1/imm32/disp32-is-first-inout -12788 0/imm32/no-output -12789 0x11/imm32/alloc-id:fake -12790 _Primitive-break-if-addr>=-named/imm32/next -12791 _Primitive-break-if-addr>=-named: # (payload primitive) -12792 0x11/imm32/alloc-id:fake:payload -12793 0x11/imm32/alloc-id:fake -12794 _string-break-if-addr>=/imm32/name -12795 0x11/imm32/alloc-id:fake -12796 Single-lit-var/imm32/inouts -12797 0/imm32/no-outputs -12798 0/imm32/no-outputs +12755 Single-int-var-in-eax/imm32/outputs +12756 0x11/imm32/alloc-id:fake +12757 _string_b8_copy_to_eax/imm32/subx-name +12758 0/imm32/no-rm32 +12759 0/imm32/no-r32 +12760 1/imm32/imm32-is-first-inout +12761 0/imm32/no-disp32 +12762 1/imm32/output-is-write-only +12763 0x11/imm32/alloc-id:fake +12764 _Primitive-copy-to-ecx/imm32/next +12765 _Primitive-copy-to-ecx: # (payload primitive) +12766 0x11/imm32/alloc-id:fake:payload +12767 # var/ecx <- copy lit => b9/copy-to-ecx lit/imm32 +12768 0x11/imm32/alloc-id:fake +12769 _string-copy/imm32/name +12770 0x11/imm32/alloc-id:fake +12771 Single-lit-var/imm32/inouts +12772 0x11/imm32/alloc-id:fake +12773 Single-int-var-in-ecx/imm32/outputs +12774 0x11/imm32/alloc-id:fake +12775 _string_b9_copy_to_ecx/imm32/subx-name +12776 0/imm32/no-rm32 +12777 0/imm32/no-r32 +12778 1/imm32/imm32-is-first-inout +12779 0/imm32/no-disp32 +12780 1/imm32/output-is-write-only +12781 0x11/imm32/alloc-id:fake +12782 _Primitive-copy-to-edx/imm32/next +12783 _Primitive-copy-to-edx: # (payload primitive) +12784 0x11/imm32/alloc-id:fake:payload +12785 # var/edx <- copy lit => ba/copy-to-edx lit/imm32 +12786 0x11/imm32/alloc-id:fake +12787 _string-copy/imm32/name +12788 0x11/imm32/alloc-id:fake +12789 Single-lit-var/imm32/inouts +12790 0x11/imm32/alloc-id:fake +12791 Single-int-var-in-edx/imm32/outputs +12792 0x11/imm32/alloc-id:fake +12793 _string_ba_copy_to_edx/imm32/subx-name +12794 0/imm32/no-rm32 +12795 0/imm32/no-r32 +12796 1/imm32/imm32-is-first-inout +12797 0/imm32/no-disp32 +12798 1/imm32/output-is-write-only 12799 0x11/imm32/alloc-id:fake -12800 _string_0f_83_jump_label/imm32/subx-name -12801 0/imm32/no-rm32 -12802 0/imm32/no-r32 -12803 0/imm32/no-imm32 -12804 1/imm32/disp32-is-first-inout -12805 0/imm32/no-output +12800 _Primitive-copy-to-ebx/imm32/next +12801 _Primitive-copy-to-ebx: # (payload primitive) +12802 0x11/imm32/alloc-id:fake:payload +12803 # var/ebx <- copy lit => bb/copy-to-ebx lit/imm32 +12804 0x11/imm32/alloc-id:fake +12805 _string-copy/imm32/name 12806 0x11/imm32/alloc-id:fake -12807 _Primitive-break-if-=-named/imm32/next -12808 _Primitive-break-if-=-named: # (payload primitive) -12809 0x11/imm32/alloc-id:fake:payload +12807 Single-lit-var/imm32/inouts +12808 0x11/imm32/alloc-id:fake +12809 Single-int-var-in-ebx/imm32/outputs 12810 0x11/imm32/alloc-id:fake -12811 _string-break-if-=/imm32/name -12812 0x11/imm32/alloc-id:fake -12813 Single-lit-var/imm32/inouts -12814 0/imm32/no-outputs -12815 0/imm32/no-outputs -12816 0x11/imm32/alloc-id:fake -12817 _string_0f_84_jump_label/imm32/subx-name -12818 0/imm32/no-rm32 -12819 0/imm32/no-r32 -12820 0/imm32/no-imm32 -12821 1/imm32/disp32-is-first-inout -12822 0/imm32/no-output -12823 0x11/imm32/alloc-id:fake -12824 _Primitive-break-if-!=-named/imm32/next -12825 _Primitive-break-if-!=-named: # (payload primitive) -12826 0x11/imm32/alloc-id:fake:payload -12827 0x11/imm32/alloc-id:fake -12828 _string-break-if-!=/imm32/name -12829 0x11/imm32/alloc-id:fake -12830 Single-lit-var/imm32/inouts -12831 0/imm32/no-outputs -12832 0/imm32/no-outputs -12833 0x11/imm32/alloc-id:fake -12834 _string_0f_85_jump_label/imm32/subx-name -12835 0/imm32/no-rm32 -12836 0/imm32/no-r32 -12837 0/imm32/no-imm32 -12838 1/imm32/disp32-is-first-inout -12839 0/imm32/no-output +12811 _string_bb_copy_to_ebx/imm32/subx-name +12812 0/imm32/no-rm32 +12813 0/imm32/no-r32 +12814 1/imm32/imm32-is-first-inout +12815 0/imm32/no-disp32 +12816 1/imm32/output-is-write-only +12817 0x11/imm32/alloc-id:fake +12818 _Primitive-copy-to-esi/imm32/next +12819 _Primitive-copy-to-esi: # (payload primitive) +12820 0x11/imm32/alloc-id:fake:payload +12821 # var/esi <- copy lit => be/copy-to-esi lit/imm32 +12822 0x11/imm32/alloc-id:fake +12823 _string-copy/imm32/name +12824 0x11/imm32/alloc-id:fake +12825 Single-lit-var/imm32/inouts +12826 0x11/imm32/alloc-id:fake +12827 Single-int-var-in-esi/imm32/outputs +12828 0x11/imm32/alloc-id:fake +12829 _string_be_copy_to_esi/imm32/subx-name +12830 0/imm32/no-rm32 +12831 0/imm32/no-r32 +12832 1/imm32/imm32-is-first-inout +12833 0/imm32/no-disp32 +12834 1/imm32/output-is-write-only +12835 0x11/imm32/alloc-id:fake +12836 _Primitive-copy-to-edi/imm32/next +12837 _Primitive-copy-to-edi: # (payload primitive) +12838 0x11/imm32/alloc-id:fake:payload +12839 # var/edi <- copy lit => bf/copy-to-edi lit/imm32 12840 0x11/imm32/alloc-id:fake -12841 _Primitive-break-if-addr<=-named/imm32/next -12842 _Primitive-break-if-addr<=-named: # (payload primitive) -12843 0x11/imm32/alloc-id:fake:payload +12841 _string-copy/imm32/name +12842 0x11/imm32/alloc-id:fake +12843 Single-lit-var/imm32/inouts 12844 0x11/imm32/alloc-id:fake -12845 _string-break-if-addr<=/imm32/name +12845 Single-int-var-in-edi/imm32/outputs 12846 0x11/imm32/alloc-id:fake -12847 Single-lit-var/imm32/inouts -12848 0/imm32/no-outputs -12849 0/imm32/no-outputs -12850 0x11/imm32/alloc-id:fake -12851 _string_0f_86_jump_label/imm32/subx-name -12852 0/imm32/no-rm32 -12853 0/imm32/no-r32 -12854 0/imm32/no-imm32 -12855 1/imm32/disp32-is-first-inout -12856 0/imm32/no-output -12857 0x11/imm32/alloc-id:fake -12858 _Primitive-break-if-addr>-named/imm32/next -12859 _Primitive-break-if-addr>-named: # (payload primitive) -12860 0x11/imm32/alloc-id:fake:payload -12861 0x11/imm32/alloc-id:fake -12862 _string-break-if-addr>/imm32/name -12863 0x11/imm32/alloc-id:fake -12864 Single-lit-var/imm32/inouts -12865 0/imm32/no-outputs -12866 0/imm32/no-outputs -12867 0x11/imm32/alloc-id:fake -12868 _string_0f_87_jump_label/imm32/subx-name -12869 0/imm32/no-rm32 -12870 0/imm32/no-r32 -12871 0/imm32/no-imm32 -12872 1/imm32/disp32-is-first-inout -12873 0/imm32/no-output -12874 0x11/imm32/alloc-id:fake -12875 _Primitive-break-if-<-named/imm32/next -12876 _Primitive-break-if-<-named: # (payload primitive) -12877 0x11/imm32/alloc-id:fake:payload +12847 _string_bf_copy_to_edi/imm32/subx-name +12848 0/imm32/no-rm32 +12849 0/imm32/no-r32 +12850 1/imm32/imm32-is-first-inout +12851 0/imm32/no-disp32 +12852 1/imm32/output-is-write-only +12853 0x11/imm32/alloc-id:fake +12854 _Primitive-copy-reg-to-reg/imm32/next +12855 _Primitive-copy-reg-to-reg: # (payload primitive) +12856 0x11/imm32/alloc-id:fake:payload +12857 # var1/reg <- copy var2/reg => 89/<- var1/rm32 var2/r32 +12858 0x11/imm32/alloc-id:fake +12859 _string-copy/imm32/name +12860 0x11/imm32/alloc-id:fake +12861 Single-int-var-in-some-register/imm32/inouts +12862 0x11/imm32/alloc-id:fake +12863 Single-int-var-in-some-register/imm32/outputs +12864 0x11/imm32/alloc-id:fake +12865 _string_89_<-/imm32/subx-name +12866 3/imm32/rm32-is-first-output +12867 1/imm32/r32-is-first-inout +12868 0/imm32/no-imm32 +12869 0/imm32/no-disp32 +12870 1/imm32/output-is-write-only +12871 0x11/imm32/alloc-id:fake +12872 _Primitive-copy-reg-to-mem/imm32/next +12873 _Primitive-copy-reg-to-mem: # (payload primitive) +12874 0x11/imm32/alloc-id:fake:payload +12875 # copy-to var1 var2/reg => 89/<- var1 var2/r32 +12876 0x11/imm32/alloc-id:fake +12877 _string-copy-to/imm32/name 12878 0x11/imm32/alloc-id:fake -12879 _string-break-if-</imm32/name -12880 0x11/imm32/alloc-id:fake -12881 Single-lit-var/imm32/inouts -12882 0/imm32/no-outputs -12883 0/imm32/no-outputs -12884 0x11/imm32/alloc-id:fake -12885 _string_0f_8c_jump_label/imm32/subx-name -12886 0/imm32/no-rm32 -12887 0/imm32/no-r32 -12888 0/imm32/no-imm32 -12889 1/imm32/disp32-is-first-inout -12890 0/imm32/no-output -12891 0x11/imm32/alloc-id:fake -12892 _Primitive-break-if->=-named/imm32/next -12893 _Primitive-break-if->=-named: # (payload primitive) -12894 0x11/imm32/alloc-id:fake:payload -12895 0x11/imm32/alloc-id:fake -12896 _string-break-if->=/imm32/name -12897 0x11/imm32/alloc-id:fake -12898 Single-lit-var/imm32/inouts -12899 0/imm32/no-outputs -12900 0/imm32/no-outputs -12901 0x11/imm32/alloc-id:fake -12902 _string_0f_8d_jump_label/imm32/subx-name -12903 0/imm32/no-rm32 -12904 0/imm32/no-r32 -12905 0/imm32/no-imm32 -12906 1/imm32/disp32-is-first-inout -12907 0/imm32/no-output -12908 0x11/imm32/alloc-id:fake -12909 _Primitive-break-if-<=-named/imm32/next -12910 _Primitive-break-if-<=-named: # (payload primitive) -12911 0x11/imm32/alloc-id:fake:payload +12879 Two-args-int-stack-int-reg/imm32/inouts +12880 0/imm32/no-outputs +12881 0/imm32/no-outputs +12882 0x11/imm32/alloc-id:fake +12883 _string_89_<-/imm32/subx-name +12884 1/imm32/rm32-is-first-inout +12885 2/imm32/r32-is-second-inout +12886 0/imm32/no-imm32 +12887 0/imm32/no-disp32 +12888 1/imm32/output-is-write-only +12889 0x11/imm32/alloc-id:fake +12890 _Primitive-copy-mem-to-reg/imm32/next +12891 _Primitive-copy-mem-to-reg: # (payload primitive) +12892 0x11/imm32/alloc-id:fake:payload +12893 # var1/reg <- copy var2 => 8b/-> var2/rm32 var1/r32 +12894 0x11/imm32/alloc-id:fake +12895 _string-copy/imm32/name +12896 0x11/imm32/alloc-id:fake +12897 Single-int-var-in-mem/imm32/inouts +12898 0x11/imm32/alloc-id:fake +12899 Single-int-var-in-some-register/imm32/outputs +12900 0x11/imm32/alloc-id:fake +12901 _string_8b_->/imm32/subx-name +12902 1/imm32/rm32-is-first-inout +12903 3/imm32/r32-is-first-output +12904 0/imm32/no-imm32 +12905 0/imm32/no-disp32 +12906 1/imm32/output-is-write-only +12907 0x11/imm32/alloc-id:fake +12908 _Primitive-copy-lit-to-reg/imm32/next +12909 _Primitive-copy-lit-to-reg: # (payload primitive) +12910 0x11/imm32/alloc-id:fake:payload +12911 # var1/reg <- copy lit => c7 0/subop/copy var1/rm32 lit/imm32 12912 0x11/imm32/alloc-id:fake -12913 _string-break-if-<=/imm32/name +12913 _string-copy/imm32/name 12914 0x11/imm32/alloc-id:fake -12915 Single-lit-var/imm32/inouts -12916 0/imm32/no-outputs -12917 0/imm32/no-outputs +12915 Single-lit-var/imm32/inouts +12916 0x11/imm32/alloc-id:fake +12917 Single-int-var-in-some-register/imm32/outputs 12918 0x11/imm32/alloc-id:fake -12919 _string_0f_8e_jump_label/imm32/subx-name -12920 0/imm32/no-rm32 +12919 _string_c7_subop_copy/imm32/subx-name +12920 3/imm32/rm32-is-first-output 12921 0/imm32/no-r32 -12922 0/imm32/no-imm32 -12923 1/imm32/disp32-is-first-inout -12924 0/imm32/no-output +12922 1/imm32/imm32-is-first-inout +12923 0/imm32/no-disp32 +12924 1/imm32/output-is-write-only 12925 0x11/imm32/alloc-id:fake -12926 _Primitive-break-if->-named/imm32/next -12927 _Primitive-break-if->-named: # (payload primitive) +12926 _Primitive-copy-lit-to-mem/imm32/next +12927 _Primitive-copy-lit-to-mem: # (payload primitive) 12928 0x11/imm32/alloc-id:fake:payload -12929 0x11/imm32/alloc-id:fake -12930 _string-break-if->/imm32/name -12931 0x11/imm32/alloc-id:fake -12932 Single-lit-var/imm32/inouts -12933 0/imm32/no-outputs +12929 # copy-to var1, lit => c7 0/subop/copy var1/rm32 lit/imm32 +12930 0x11/imm32/alloc-id:fake +12931 _string-copy-to/imm32/name +12932 0x11/imm32/alloc-id:fake +12933 Int-var-and-literal/imm32/inouts 12934 0/imm32/no-outputs -12935 0x11/imm32/alloc-id:fake -12936 _string_0f_8f_jump_label/imm32/subx-name -12937 0/imm32/no-rm32 -12938 0/imm32/no-r32 -12939 0/imm32/no-imm32 -12940 1/imm32/disp32-is-first-inout -12941 0/imm32/no-output -12942 0x11/imm32/alloc-id:fake -12943 _Primitive-break-named/imm32/next -12944 _Primitive-break-named: # (payload primitive) -12945 0x11/imm32/alloc-id:fake:payload -12946 0x11/imm32/alloc-id:fake -12947 _string-break/imm32/name -12948 0x11/imm32/alloc-id:fake -12949 Single-lit-var/imm32/inouts -12950 0/imm32/no-outputs -12951 0/imm32/no-outputs -12952 0x11/imm32/alloc-id:fake -12953 _string_e9_jump_label/imm32/subx-name -12954 0/imm32/no-rm32 -12955 0/imm32/no-r32 -12956 0/imm32/no-imm32 -12957 1/imm32/disp32-is-first-inout -12958 0/imm32/no-output -12959 0x11/imm32/alloc-id:fake -12960 _Primitive-loop-if-addr<-named/imm32/next -12961 _Primitive-loop-if-addr<-named: # (payload primitive) -12962 0x11/imm32/alloc-id:fake:payload -12963 0x11/imm32/alloc-id:fake -12964 _string-loop-if-addr</imm32/name -12965 0x11/imm32/alloc-id:fake -12966 Single-lit-var/imm32/inouts -12967 0/imm32/no-outputs -12968 0/imm32/no-outputs +12935 0/imm32/no-outputs +12936 0x11/imm32/alloc-id:fake +12937 _string_c7_subop_copy/imm32/subx-name +12938 1/imm32/rm32-is-first-inout +12939 0/imm32/no-r32 +12940 2/imm32/imm32-is-first-inout +12941 0/imm32/no-disp32 +12942 1/imm32/output-is-write-only +12943 0x11/imm32/alloc-id:fake +12944 _Primitive-copy-byte-from-reg/imm32/next +12945 # - copy byte +12946 _Primitive-copy-byte-from-reg: +12947 0x11/imm32/alloc-id:fake:payload +12948 # var/reg <- copy-byte var2/reg2 => 8a/byte-> %var2 var/r32 +12949 0x11/imm32/alloc-id:fake +12950 _string-copy-byte/imm32/name +12951 0x11/imm32/alloc-id:fake +12952 Single-byte-var-in-some-register/imm32/inouts +12953 0x11/imm32/alloc-id:fake +12954 Single-byte-var-in-some-register/imm32/outputs +12955 0x11/imm32/alloc-id:fake +12956 _string_8a_copy_byte/imm32/subx-name +12957 1/imm32/rm32-is-first-inout +12958 3/imm32/r32-is-first-output +12959 0/imm32/no-imm32 +12960 0/imm32/no-disp32 +12961 1/imm32/output-is-write-only +12962 0x11/imm32/alloc-id:fake +12963 _Primitive-copy-byte-from-mem/imm32/next +12964 _Primitive-copy-byte-from-mem: +12965 0x11/imm32/alloc-id:fake:payload +12966 # var/reg <- copy-byte *var2/reg2 => 8a/byte-> *var2 var/r32 +12967 0x11/imm32/alloc-id:fake +12968 _string-copy-byte/imm32/name 12969 0x11/imm32/alloc-id:fake -12970 _string_0f_82_jump_label/imm32/subx-name -12971 0/imm32/no-rm32 -12972 0/imm32/no-r32 -12973 0/imm32/no-imm32 -12974 1/imm32/disp32-is-first-inout -12975 0/imm32/no-output -12976 0x11/imm32/alloc-id:fake -12977 _Primitive-loop-if-addr>=-named/imm32/next -12978 _Primitive-loop-if-addr>=-named: # (payload primitive) -12979 0x11/imm32/alloc-id:fake:payload +12970 Single-byte-var-in-mem/imm32/inouts +12971 0x11/imm32/alloc-id:fake +12972 Single-byte-var-in-some-register/imm32/outputs +12973 0x11/imm32/alloc-id:fake +12974 _string_8a_copy_byte/imm32/subx-name +12975 1/imm32/rm32-is-first-inout +12976 3/imm32/r32-is-first-output +12977 0/imm32/no-imm32 +12978 0/imm32/no-disp32 +12979 1/imm32/output-is-write-only 12980 0x11/imm32/alloc-id:fake -12981 _string-loop-if-addr>=/imm32/name -12982 0x11/imm32/alloc-id:fake -12983 Single-lit-var/imm32/inouts -12984 0/imm32/no-outputs -12985 0/imm32/no-outputs -12986 0x11/imm32/alloc-id:fake -12987 _string_0f_83_jump_label/imm32/subx-name -12988 0/imm32/no-rm32 -12989 0/imm32/no-r32 -12990 0/imm32/no-imm32 -12991 1/imm32/disp32-is-first-inout -12992 0/imm32/no-output -12993 0x11/imm32/alloc-id:fake -12994 _Primitive-loop-if-=-named/imm32/next -12995 _Primitive-loop-if-=-named: # (payload primitive) -12996 0x11/imm32/alloc-id:fake:payload -12997 0x11/imm32/alloc-id:fake -12998 _string-loop-if-=/imm32/name -12999 0x11/imm32/alloc-id:fake -13000 Single-lit-var/imm32/inouts -13001 0/imm32/no-outputs -13002 0/imm32/no-outputs -13003 0x11/imm32/alloc-id:fake -13004 _string_0f_84_jump_label/imm32/subx-name -13005 0/imm32/no-rm32 -13006 0/imm32/no-r32 -13007 0/imm32/no-imm32 -13008 1/imm32/disp32-is-first-inout -13009 0/imm32/no-output +12981 _Primitive-copy-byte-to-mem/imm32/next +12982 _Primitive-copy-byte-to-mem: +12983 0x11/imm32/alloc-id:fake:payload +12984 # copy-byte-to *var1/reg1, var2/reg2 => 88/byte<- *reg1 reg2/r32 +12985 0x11/imm32/alloc-id:fake +12986 _string-copy-byte-to/imm32/name +12987 0x11/imm32/alloc-id:fake +12988 Two-args-byte-stack-byte-reg/imm32/inouts +12989 0/imm32/no-outputs +12990 0/imm32/no-outputs +12991 0x11/imm32/alloc-id:fake +12992 _string_88_copy_byte/imm32/subx-name +12993 1/imm32/rm32-is-first-inout +12994 2/imm32/r32-is-second-inout +12995 0/imm32/no-imm32 +12996 0/imm32/no-disp32 +12997 0/imm32/output-is-write-only +12998 0x11/imm32/alloc-id:fake +12999 _Primitive-address/imm32/next +13000 # - address +13001 _Primitive-address: # (payload primitive) +13002 0x11/imm32/alloc-id:fake:payload +13003 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 +13004 0x11/imm32/alloc-id:fake +13005 _string-address/imm32/name +13006 0x11/imm32/alloc-id:fake +13007 Single-int-var-in-mem/imm32/inouts +13008 0x11/imm32/alloc-id:fake +13009 Single-addr-var-in-some-register/imm32/outputs 13010 0x11/imm32/alloc-id:fake -13011 _Primitive-loop-if-!=-named/imm32/next -13012 _Primitive-loop-if-!=-named: # (payload primitive) -13013 0x11/imm32/alloc-id:fake:payload -13014 0x11/imm32/alloc-id:fake -13015 _string-loop-if-!=/imm32/name -13016 0x11/imm32/alloc-id:fake -13017 Single-lit-var/imm32/inouts -13018 0/imm32/no-outputs -13019 0/imm32/no-outputs -13020 0x11/imm32/alloc-id:fake -13021 _string_0f_85_jump_label/imm32/subx-name -13022 0/imm32/no-rm32 -13023 0/imm32/no-r32 -13024 0/imm32/no-imm32 -13025 1/imm32/disp32-is-first-inout -13026 0/imm32/no-output -13027 0x11/imm32/alloc-id:fake -13028 _Primitive-loop-if-addr<=-named/imm32/next -13029 _Primitive-loop-if-addr<=-named: # (payload primitive) -13030 0x11/imm32/alloc-id:fake:payload -13031 0x11/imm32/alloc-id:fake -13032 _string-loop-if-addr<=/imm32/name -13033 0x11/imm32/alloc-id:fake -13034 Single-lit-var/imm32/inouts -13035 0/imm32/no-outputs -13036 0/imm32/no-outputs -13037 0x11/imm32/alloc-id:fake -13038 _string_0f_86_jump_label/imm32/subx-name -13039 0/imm32/no-rm32 -13040 0/imm32/no-r32 -13041 0/imm32/no-imm32 -13042 1/imm32/disp32-is-first-inout -13043 0/imm32/no-output -13044 0x11/imm32/alloc-id:fake -13045 _Primitive-loop-if-addr>-named/imm32/next -13046 _Primitive-loop-if-addr>-named: # (payload primitive) -13047 0x11/imm32/alloc-id:fake:payload -13048 0x11/imm32/alloc-id:fake -13049 _string-loop-if-addr>/imm32/name -13050 0x11/imm32/alloc-id:fake -13051 Single-lit-var/imm32/inouts -13052 0/imm32/no-outputs -13053 0/imm32/no-outputs +13011 _string_8d_copy_address/imm32/subx-name +13012 1/imm32/rm32-is-first-inout +13013 3/imm32/r32-is-first-output +13014 0/imm32/no-imm32 +13015 0/imm32/no-disp32 +13016 1/imm32/output-is-write-only +13017 0x11/imm32/alloc-id:fake +13018 _Primitive-compare-reg-with-reg/imm32/next +13019 # - compare +13020 _Primitive-compare-reg-with-reg: # (payload primitive) +13021 0x11/imm32/alloc-id:fake:payload +13022 # compare var1/reg1 var2/reg2 => 39/compare var1/rm32 var2/r32 +13023 0x11/imm32/alloc-id:fake +13024 _string-compare/imm32/name +13025 0x11/imm32/alloc-id:fake +13026 Two-int-args-in-regs/imm32/inouts +13027 0/imm32/no-outputs +13028 0/imm32/no-outputs +13029 0x11/imm32/alloc-id:fake +13030 _string_39_compare->/imm32/subx-name +13031 1/imm32/rm32-is-first-inout +13032 2/imm32/r32-is-second-inout +13033 0/imm32/no-imm32 +13034 0/imm32/no-disp32 +13035 0/imm32/output-is-write-only +13036 0x11/imm32/alloc-id:fake +13037 _Primitive-compare-mem-with-reg/imm32/next +13038 _Primitive-compare-mem-with-reg: # (payload primitive) +13039 0x11/imm32/alloc-id:fake:payload +13040 # compare var1 var2/reg => 39/compare var1/rm32 var2/r32 +13041 0x11/imm32/alloc-id:fake +13042 _string-compare/imm32/name +13043 0x11/imm32/alloc-id:fake +13044 Two-args-int-stack-int-reg/imm32/inouts +13045 0/imm32/no-outputs +13046 0/imm32/no-outputs +13047 0x11/imm32/alloc-id:fake +13048 _string_39_compare->/imm32/subx-name +13049 1/imm32/rm32-is-first-inout +13050 2/imm32/r32-is-second-inout +13051 0/imm32/no-imm32 +13052 0/imm32/no-disp32 +13053 0/imm32/output-is-write-only 13054 0x11/imm32/alloc-id:fake -13055 _string_0f_87_jump_label/imm32/subx-name -13056 0/imm32/no-rm32 -13057 0/imm32/no-r32 -13058 0/imm32/no-imm32 -13059 1/imm32/disp32-is-first-inout -13060 0/imm32/no-output +13055 _Primitive-compare-reg-with-mem/imm32/next +13056 _Primitive-compare-reg-with-mem: # (payload primitive) +13057 0x11/imm32/alloc-id:fake:payload +13058 # compare var1/reg var2 => 3b/compare<- var2/rm32 var1/r32 +13059 0x11/imm32/alloc-id:fake +13060 _string-compare/imm32/name 13061 0x11/imm32/alloc-id:fake -13062 _Primitive-loop-if-<-named/imm32/next -13063 _Primitive-loop-if-<-named: # (payload primitive) -13064 0x11/imm32/alloc-id:fake:payload +13062 Two-args-int-reg-int-stack/imm32/inouts +13063 0/imm32/no-outputs +13064 0/imm32/no-outputs 13065 0x11/imm32/alloc-id:fake -13066 _string-loop-if-</imm32/name -13067 0x11/imm32/alloc-id:fake -13068 Single-lit-var/imm32/inouts -13069 0/imm32/no-outputs -13070 0/imm32/no-outputs -13071 0x11/imm32/alloc-id:fake -13072 _string_0f_8c_jump_label/imm32/subx-name -13073 0/imm32/no-rm32 -13074 0/imm32/no-r32 -13075 0/imm32/no-imm32 -13076 1/imm32/disp32-is-first-inout -13077 0/imm32/no-output -13078 0x11/imm32/alloc-id:fake -13079 _Primitive-loop-if->=-named/imm32/next -13080 _Primitive-loop-if->=-named: # (payload primitive) -13081 0x11/imm32/alloc-id:fake:payload -13082 0x11/imm32/alloc-id:fake -13083 _string-loop-if->=/imm32/name -13084 0x11/imm32/alloc-id:fake -13085 Single-lit-var/imm32/inouts -13086 0/imm32/no-outputs -13087 0/imm32/no-outputs -13088 0x11/imm32/alloc-id:fake -13089 _string_0f_8d_jump_label/imm32/subx-name -13090 0/imm32/no-rm32 -13091 0/imm32/no-r32 -13092 0/imm32/no-imm32 -13093 1/imm32/disp32-is-first-inout -13094 0/imm32/no-output +13066 _string_3b_compare<-/imm32/subx-name +13067 2/imm32/rm32-is-second-inout +13068 1/imm32/r32-is-first-inout +13069 0/imm32/no-imm32 +13070 0/imm32/no-disp32 +13071 0/imm32/output-is-write-only +13072 0x11/imm32/alloc-id:fake +13073 _Primitive-compare-eax-with-literal/imm32/next +13074 _Primitive-compare-eax-with-literal: # (payload primitive) +13075 0x11/imm32/alloc-id:fake:payload +13076 # compare var1/eax n => 3d/compare-eax-with n/imm32 +13077 0x11/imm32/alloc-id:fake +13078 _string-compare/imm32/name +13079 0x11/imm32/alloc-id:fake +13080 Two-args-int-eax-int-literal/imm32/inouts +13081 0/imm32/no-outputs +13082 0/imm32/no-outputs +13083 0x11/imm32/alloc-id:fake +13084 _string_3d_compare_eax_with/imm32/subx-name +13085 0/imm32/no-rm32 +13086 0/imm32/no-r32 +13087 2/imm32/imm32-is-second-inout +13088 0/imm32/no-disp32 +13089 0/imm32/output-is-write-only +13090 0x11/imm32/alloc-id:fake +13091 _Primitive-compare-reg-with-literal/imm32/next +13092 _Primitive-compare-reg-with-literal: # (payload primitive) +13093 0x11/imm32/alloc-id:fake:payload +13094 # compare var1/reg n => 81 7/subop/compare %reg n/imm32 13095 0x11/imm32/alloc-id:fake -13096 _Primitive-loop-if-<=-named/imm32/next -13097 _Primitive-loop-if-<=-named: # (payload primitive) -13098 0x11/imm32/alloc-id:fake:payload -13099 0x11/imm32/alloc-id:fake -13100 _string-loop-if-<=/imm32/name +13096 _string-compare/imm32/name +13097 0x11/imm32/alloc-id:fake +13098 Int-var-in-register-and-literal/imm32/inouts +13099 0/imm32/no-outputs +13100 0/imm32/no-outputs 13101 0x11/imm32/alloc-id:fake -13102 Single-lit-var/imm32/inouts -13103 0/imm32/no-outputs -13104 0/imm32/no-outputs -13105 0x11/imm32/alloc-id:fake -13106 _string_0f_8e_jump_label/imm32/subx-name -13107 0/imm32/no-rm32 -13108 0/imm32/no-r32 -13109 0/imm32/no-imm32 -13110 1/imm32/disp32-is-first-inout -13111 0/imm32/no-output -13112 0x11/imm32/alloc-id:fake -13113 _Primitive-loop-if->-named/imm32/next -13114 _Primitive-loop-if->-named: # (payload primitive) -13115 0x11/imm32/alloc-id:fake:payload -13116 0x11/imm32/alloc-id:fake -13117 _string-loop-if->/imm32/name -13118 0x11/imm32/alloc-id:fake -13119 Single-lit-var/imm32/inouts -13120 0/imm32/no-outputs -13121 0/imm32/no-outputs -13122 0x11/imm32/alloc-id:fake -13123 _string_0f_8f_jump_label/imm32/subx-name -13124 0/imm32/no-rm32 -13125 0/imm32/no-r32 -13126 0/imm32/no-imm32 -13127 1/imm32/disp32-is-first-inout -13128 0/imm32/no-output -13129 0x11/imm32/alloc-id:fake -13130 _Primitive-loop-named/imm32/next # we probably don't need an unconditional break -13131 _Primitive-loop-named: # (payload primitive) -13132 0x11/imm32/alloc-id:fake:payload -13133 0x11/imm32/alloc-id:fake -13134 _string-loop/imm32/name -13135 0x11/imm32/alloc-id:fake -13136 Single-lit-var/imm32/inouts -13137 0/imm32/no-outputs -13138 0/imm32/no-outputs -13139 0x11/imm32/alloc-id:fake -13140 _string_e9_jump_label/imm32/subx-name -13141 0/imm32/no-rm32 -13142 0/imm32/no-r32 -13143 0/imm32/no-imm32 -13144 1/imm32/disp32-is-first-inout -13145 0/imm32/no-output -13146 0/imm32/next -13147 0/imm32/next -13148 -13149 # string literals for Mu instructions -13150 _string-add: # (payload array byte) -13151 0x11/imm32/alloc-id:fake:payload -13152 # "add" -13153 0x3/imm32/size -13154 0x61/a 0x64/d 0x64/d -13155 _string-address: # (payload array byte) -13156 0x11/imm32/alloc-id:fake:payload -13157 # "address" -13158 0x7/imm32/size -13159 0x61/a 0x64/d 0x64/d 0x72/r 0x65/e 0x73/s 0x73/s -13160 _string-add-to: # (payload array byte) -13161 0x11/imm32/alloc-id:fake:payload -13162 # "add-to" -13163 0x6/imm32/size -13164 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o -13165 _string-and: # (payload array byte) -13166 0x11/imm32/alloc-id:fake:payload -13167 # "and" -13168 0x3/imm32/size -13169 0x61/a 0x6e/n 0x64/d -13170 _string-and-with: # (payload array byte) -13171 0x11/imm32/alloc-id:fake:payload -13172 # "and-with" -13173 0x8/imm32/size -13174 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -13175 _string-break: # (payload array byte) -13176 0x11/imm32/alloc-id:fake:payload -13177 # "break" -13178 0x5/imm32/size -13179 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k -13180 _string-break-if-<: # (payload array byte) -13181 0x11/imm32/alloc-id:fake:payload -13182 # "break-if-<" -13183 0xa/imm32/size -13184 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< -13185 _string-break-if-<=: # (payload array byte) -13186 0x11/imm32/alloc-id:fake:payload -13187 # "break-if-<=" -13188 0xb/imm32/size -13189 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= -13190 _string-break-if-=: # (payload array byte) -13191 0x11/imm32/alloc-id:fake:payload -13192 # "break-if-=" -13193 0xa/imm32/size -13194 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= -13195 _string-break-if->: # (payload array byte) -13196 0x11/imm32/alloc-id:fake:payload -13197 # "break-if->" -13198 0xa/imm32/size -13199 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> -13200 _string-break-if->=: # (payload array byte) +13102 _string_81_subop_compare/imm32/subx-name +13103 1/imm32/rm32-is-first-inout +13104 0/imm32/no-r32 +13105 2/imm32/imm32-is-second-inout +13106 0/imm32/no-disp32 +13107 0/imm32/output-is-write-only +13108 0x11/imm32/alloc-id:fake +13109 _Primitive-compare-mem-with-literal/imm32/next +13110 _Primitive-compare-mem-with-literal: # (payload primitive) +13111 0x11/imm32/alloc-id:fake:payload +13112 # compare var1 n => 81 7/subop/compare *(ebp+___) n/imm32 +13113 0x11/imm32/alloc-id:fake +13114 _string-compare/imm32/name +13115 0x11/imm32/alloc-id:fake +13116 Int-var-and-literal/imm32/inouts +13117 0/imm32/no-outputs +13118 0/imm32/no-outputs +13119 0x11/imm32/alloc-id:fake +13120 _string_81_subop_compare/imm32/subx-name +13121 1/imm32/rm32-is-first-inout +13122 0/imm32/no-r32 +13123 2/imm32/imm32-is-second-inout +13124 0/imm32/no-disp32 +13125 0/imm32/output-is-write-only +13126 0x11/imm32/alloc-id:fake +13127 _Primitive-multiply-reg-by-reg/imm32/next +13128 # - multiply +13129 _Primitive-multiply-reg-by-reg: # (payload primitive) +13130 0x11/imm32/alloc-id:fake:payload +13131 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 +13132 0x11/imm32/alloc-id:fake +13133 _string-multiply/imm32/name +13134 0x11/imm32/alloc-id:fake +13135 Single-int-var-in-some-register/imm32/inouts +13136 0x11/imm32/alloc-id:fake +13137 Single-int-var-in-some-register/imm32/outputs +13138 0x11/imm32/alloc-id:fake +13139 _string_0f_af_multiply/imm32/subx-name +13140 1/imm32/rm32-is-first-inout +13141 3/imm32/r32-is-first-output +13142 0/imm32/no-imm32 +13143 0/imm32/no-disp32 +13144 0/imm32/output-is-write-only +13145 0x11/imm32/alloc-id:fake +13146 _Primitive-multiply-reg-by-mem/imm32/next +13147 _Primitive-multiply-reg-by-mem: # (payload primitive) +13148 0x11/imm32/alloc-id:fake:payload +13149 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 +13150 0x11/imm32/alloc-id:fake +13151 _string-multiply/imm32/name +13152 0x11/imm32/alloc-id:fake +13153 Single-int-var-in-mem/imm32/inouts +13154 0x11/imm32/alloc-id:fake +13155 Single-int-var-in-some-register/imm32/outputs +13156 0x11/imm32/alloc-id:fake +13157 _string_0f_af_multiply/imm32/subx-name +13158 1/imm32/rm32-is-first-inout +13159 3/imm32/r32-is-first-output +13160 0/imm32/no-imm32 +13161 0/imm32/no-disp32 +13162 0/imm32/output-is-write-only +13163 0x11/imm32/alloc-id:fake +13164 _Primitive-break-if-addr</imm32/next +13165 # - branches +13166 _Primitive-break-if-addr<: # (payload primitive) +13167 0x11/imm32/alloc-id:fake:payload +13168 0x11/imm32/alloc-id:fake +13169 _string-break-if-addr</imm32/name +13170 0/imm32/no-inouts +13171 0/imm32/no-inouts +13172 0/imm32/no-outputs +13173 0/imm32/no-outputs +13174 0x11/imm32/alloc-id:fake +13175 _string_0f_82_jump_break/imm32/subx-name +13176 0/imm32/no-rm32 +13177 0/imm32/no-r32 +13178 0/imm32/no-imm32 +13179 0/imm32/no-disp32 +13180 0/imm32/no-output +13181 0x11/imm32/alloc-id:fake +13182 _Primitive-break-if-addr>=/imm32/next +13183 _Primitive-break-if-addr>=: # (payload primitive) +13184 0x11/imm32/alloc-id:fake:payload +13185 0x11/imm32/alloc-id:fake +13186 _string-break-if-addr>=/imm32/name +13187 0/imm32/no-inouts +13188 0/imm32/no-inouts +13189 0/imm32/no-outputs +13190 0/imm32/no-outputs +13191 0x11/imm32/alloc-id:fake +13192 _string_0f_83_jump_break/imm32/subx-name +13193 0/imm32/no-rm32 +13194 0/imm32/no-r32 +13195 0/imm32/no-imm32 +13196 0/imm32/no-disp32 +13197 0/imm32/no-output +13198 0x11/imm32/alloc-id:fake +13199 _Primitive-break-if-=/imm32/next +13200 _Primitive-break-if-=: # (payload primitive) 13201 0x11/imm32/alloc-id:fake:payload -13202 # "break-if->=" -13203 0xb/imm32/size -13204 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= -13205 _string-break-if-!=: # (payload array byte) -13206 0x11/imm32/alloc-id:fake:payload -13207 # "break-if-!=" -13208 0xb/imm32/size -13209 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= -13210 _string-break-if-addr<: # (payload array byte) -13211 0x11/imm32/alloc-id:fake:payload -13212 # "break-if-addr<" -13213 0xe/imm32/size -13214 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/< -13215 _string-break-if-addr<=: # (payload array byte) -13216 0x11/imm32/alloc-id:fake:payload -13217 # "break-if-addr<=" -13218 0xf/imm32/size -13219 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/= -13220 _string-break-if-addr>: # (payload array byte) -13221 0x11/imm32/alloc-id:fake:payload -13222 # "break-if-addr>" -13223 0xe/imm32/size -13224 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/> -13225 _string-break-if-addr>=: # (payload array byte) -13226 0x11/imm32/alloc-id:fake:payload -13227 # "break-if-addr>=" -13228 0xf/imm32/size -13229 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/= -13230 _string-compare: # (payload array byte) -13231 0x11/imm32/alloc-id:fake:payload -13232 # "compare" -13233 0x7/imm32/size -13234 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e -13235 _string-copy: # (payload array byte) -13236 0x11/imm32/alloc-id:fake:payload -13237 # "copy" -13238 0x4/imm32/size -13239 0x63/c 0x6f/o 0x70/p 0x79/y -13240 _string-copy-to: # (payload array byte) -13241 0x11/imm32/alloc-id:fake:payload -13242 # "copy-to" -13243 0x7/imm32/size -13244 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o -13245 _string-copy-byte: -13246 0x11/imm32/alloc-id:fake:payload -13247 # "copy-byte" -13248 0x9/imm32/size -13249 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e -13250 _string-copy-byte-to: -13251 0x11/imm32/alloc-id:fake:payload -13252 # "copy-byte-to" -13253 0xc/imm32/size -13254 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x74/t 0x6f/o -13255 _string-decrement: # (payload array byte) -13256 0x11/imm32/alloc-id:fake:payload -13257 # "decrement" -13258 0x9/imm32/size -13259 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t -13260 _string-increment: # (payload array byte) -13261 0x11/imm32/alloc-id:fake:payload -13262 # "increment" -13263 0x9/imm32/size -13264 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t -13265 _string-loop: # (payload array byte) -13266 0x11/imm32/alloc-id:fake:payload -13267 # "loop" -13268 0x4/imm32/size -13269 0x6c/l 0x6f/o 0x6f/o 0x70/p -13270 _string-loop-if-<: # (payload array byte) -13271 0x11/imm32/alloc-id:fake:payload -13272 # "loop-if-<" -13273 0x9/imm32/size -13274 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< -13275 _string-loop-if-<=: # (payload array byte) -13276 0x11/imm32/alloc-id:fake:payload -13277 # "loop-if-<=" -13278 0xa/imm32/size -13279 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= -13280 _string-loop-if-=: # (payload array byte) -13281 0x11/imm32/alloc-id:fake:payload -13282 # "loop-if-=" -13283 0x9/imm32/size -13284 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= -13285 _string-loop-if->: # (payload array byte) +13202 0x11/imm32/alloc-id:fake +13203 _string-break-if-=/imm32/name +13204 0/imm32/no-inouts +13205 0/imm32/no-inouts +13206 0/imm32/no-outputs +13207 0/imm32/no-outputs +13208 0x11/imm32/alloc-id:fake +13209 _string_0f_84_jump_break/imm32/subx-name +13210 0/imm32/no-rm32 +13211 0/imm32/no-r32 +13212 0/imm32/no-imm32 +13213 0/imm32/no-disp32 +13214 0/imm32/no-output +13215 0x11/imm32/alloc-id:fake +13216 _Primitive-break-if-!=/imm32/next +13217 _Primitive-break-if-!=: # (payload primitive) +13218 0x11/imm32/alloc-id:fake:payload +13219 0x11/imm32/alloc-id:fake +13220 _string-break-if-!=/imm32/name +13221 0/imm32/no-inouts +13222 0/imm32/no-inouts +13223 0/imm32/no-outputs +13224 0/imm32/no-outputs +13225 0x11/imm32/alloc-id:fake +13226 _string_0f_85_jump_break/imm32/subx-name +13227 0/imm32/no-rm32 +13228 0/imm32/no-r32 +13229 0/imm32/no-imm32 +13230 0/imm32/no-disp32 +13231 0/imm32/no-output +13232 0x11/imm32/alloc-id:fake +13233 _Primitive-break-if-addr<=/imm32/next +13234 _Primitive-break-if-addr<=: # (payload primitive) +13235 0x11/imm32/alloc-id:fake:payload +13236 0x11/imm32/alloc-id:fake +13237 _string-break-if-addr<=/imm32/name +13238 0/imm32/no-inouts +13239 0/imm32/no-inouts +13240 0/imm32/no-outputs +13241 0/imm32/no-outputs +13242 0x11/imm32/alloc-id:fake +13243 _string_0f_86_jump_break/imm32/subx-name +13244 0/imm32/no-rm32 +13245 0/imm32/no-r32 +13246 0/imm32/no-imm32 +13247 0/imm32/no-disp32 +13248 0/imm32/no-output +13249 0x11/imm32/alloc-id:fake +13250 _Primitive-break-if-addr>/imm32/next +13251 _Primitive-break-if-addr>: # (payload primitive) +13252 0x11/imm32/alloc-id:fake:payload +13253 0x11/imm32/alloc-id:fake +13254 _string-break-if-addr>/imm32/name +13255 0/imm32/no-inouts +13256 0/imm32/no-inouts +13257 0/imm32/no-outputs +13258 0/imm32/no-outputs +13259 0x11/imm32/alloc-id:fake +13260 _string_0f_87_jump_break/imm32/subx-name +13261 0/imm32/no-rm32 +13262 0/imm32/no-r32 +13263 0/imm32/no-imm32 +13264 0/imm32/no-disp32 +13265 0/imm32/no-output +13266 0x11/imm32/alloc-id:fake +13267 _Primitive-break-if-</imm32/next +13268 _Primitive-break-if-<: # (payload primitive) +13269 0x11/imm32/alloc-id:fake:payload +13270 0x11/imm32/alloc-id:fake +13271 _string-break-if-</imm32/name +13272 0/imm32/no-inouts +13273 0/imm32/no-inouts +13274 0/imm32/no-outputs +13275 0/imm32/no-outputs +13276 0x11/imm32/alloc-id:fake +13277 _string_0f_8c_jump_break/imm32/subx-name +13278 0/imm32/no-rm32 +13279 0/imm32/no-r32 +13280 0/imm32/no-imm32 +13281 0/imm32/no-disp32 +13282 0/imm32/no-output +13283 0x11/imm32/alloc-id:fake +13284 _Primitive-break-if->=/imm32/next +13285 _Primitive-break-if->=: # (payload primitive) 13286 0x11/imm32/alloc-id:fake:payload -13287 # "loop-if->" -13288 0x9/imm32/size -13289 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> -13290 _string-loop-if->=: # (payload array byte) -13291 0x11/imm32/alloc-id:fake:payload -13292 # "loop-if->=" -13293 0xa/imm32/size -13294 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= -13295 _string-loop-if-!=: # (payload array byte) -13296 0x11/imm32/alloc-id:fake:payload -13297 # "loop-if-!=" -13298 0xa/imm32/size -13299 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= -13300 _string-loop-if-addr<: # (payload array byte) -13301 0x11/imm32/alloc-id:fake:payload -13302 # "loop-if-addr<" -13303 0xd/imm32/size -13304 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/< -13305 _string-loop-if-addr<=: # (payload array byte) -13306 0x11/imm32/alloc-id:fake:payload -13307 # "loop-if-addr<=" -13308 0xe/imm32/size -13309 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/= -13310 _string-loop-if-addr>: # (payload array byte) -13311 0x11/imm32/alloc-id:fake:payload -13312 # "loop-if-addr>" -13313 0xd/imm32/size -13314 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/> -13315 _string-loop-if-addr>=: # (payload array byte) -13316 0x11/imm32/alloc-id:fake:payload -13317 # "loop-if-addr>=" -13318 0xe/imm32/size -13319 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/= -13320 _string-multiply: # (payload array byte) -13321 0x11/imm32/alloc-id:fake:payload -13322 # "multiply" -13323 0x8/imm32/size -13324 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y -13325 _string-or: # (payload array byte) -13326 0x11/imm32/alloc-id:fake:payload -13327 # "or" -13328 0x2/imm32/size -13329 0x6f/o 0x72/r -13330 _string-or-with: # (payload array byte) -13331 0x11/imm32/alloc-id:fake:payload -13332 # "or-with" -13333 0x7/imm32/size -13334 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -13335 _string-subtract: # (payload array byte) -13336 0x11/imm32/alloc-id:fake:payload -13337 # "subtract" -13338 0x8/imm32/size -13339 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t -13340 _string-subtract-from: # (payload array byte) -13341 0x11/imm32/alloc-id:fake:payload -13342 # "subtract-from" -13343 0xd/imm32/size -13344 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 -13345 _string-xor: # (payload array byte) -13346 0x11/imm32/alloc-id:fake:payload -13347 # "xor" -13348 0x3/imm32/size -13349 0x78/x 0x6f/o 0x72/r -13350 _string-xor-with: # (payload array byte) -13351 0x11/imm32/alloc-id:fake:payload -13352 # "xor-with" -13353 0x8/imm32/size -13354 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -13355 -13356 # string literals for SubX instructions -13357 _string_01_add_to: # (payload array byte) -13358 0x11/imm32/alloc-id:fake:payload -13359 # "01/add-to" -13360 0x9/imm32/size -13361 0x30/0 0x31/1 0x2f/slash 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o -13362 _string_03_add: # (payload array byte) -13363 0x11/imm32/alloc-id:fake:payload -13364 # "03/add" -13365 0x6/imm32/size -13366 0x30/0 0x33/3 0x2f/slash 0x61/a 0x64/d 0x64/d -13367 _string_05_add_to_eax: # (payload array byte) -13368 0x11/imm32/alloc-id:fake:payload -13369 # "05/add-to-eax" -13370 0xd/imm32/size -13371 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 -13372 _string_09_or_with: # (payload array byte) -13373 0x11/imm32/alloc-id:fake:payload -13374 # "09/or-with" -13375 0xa/imm32/size -13376 0x30/0 0x39/9 0x2f/slash 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -13377 _string_0b_or: # (payload array byte) -13378 0x11/imm32/alloc-id:fake:payload -13379 # "0b/or" -13380 0x5/imm32/size -13381 0x30/0 0x62/b 0x2f/slash 0x6f/o 0x72/r -13382 _string_0d_or_with_eax: # (payload array byte) -13383 0x11/imm32/alloc-id:fake:payload -13384 # "0d/or-with-eax" -13385 0xe/imm32/size -13386 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 -13387 _string_0f_82_jump_label: # (payload array byte) +13287 0x11/imm32/alloc-id:fake +13288 _string-break-if->=/imm32/name +13289 0/imm32/no-inouts +13290 0/imm32/no-inouts +13291 0/imm32/no-outputs +13292 0/imm32/no-outputs +13293 0x11/imm32/alloc-id:fake +13294 _string_0f_8d_jump_break/imm32/subx-name +13295 0/imm32/no-rm32 +13296 0/imm32/no-r32 +13297 0/imm32/no-imm32 +13298 0/imm32/no-disp32 +13299 0/imm32/no-output +13300 0x11/imm32/alloc-id:fake +13301 _Primitive-break-if-<=/imm32/next +13302 _Primitive-break-if-<=: # (payload primitive) +13303 0x11/imm32/alloc-id:fake:payload +13304 0x11/imm32/alloc-id:fake +13305 _string-break-if-<=/imm32/name +13306 0/imm32/no-inouts +13307 0/imm32/no-inouts +13308 0/imm32/no-outputs +13309 0/imm32/no-outputs +13310 0x11/imm32/alloc-id:fake +13311 _string_0f_8e_jump_break/imm32/subx-name +13312 0/imm32/no-rm32 +13313 0/imm32/no-r32 +13314 0/imm32/no-imm32 +13315 0/imm32/no-disp32 +13316 0/imm32/no-output +13317 0x11/imm32/alloc-id:fake +13318 _Primitive-break-if->/imm32/next +13319 _Primitive-break-if->: # (payload primitive) +13320 0x11/imm32/alloc-id:fake:payload +13321 0x11/imm32/alloc-id:fake +13322 _string-break-if->/imm32/name +13323 0/imm32/no-inouts +13324 0/imm32/no-inouts +13325 0/imm32/no-outputs +13326 0/imm32/no-outputs +13327 0x11/imm32/alloc-id:fake +13328 _string_0f_8f_jump_break/imm32/subx-name +13329 0/imm32/no-rm32 +13330 0/imm32/no-r32 +13331 0/imm32/no-imm32 +13332 0/imm32/no-disp32 +13333 0/imm32/no-output +13334 0x11/imm32/alloc-id:fake +13335 _Primitive-break/imm32/next +13336 _Primitive-break: # (payload primitive) +13337 0x11/imm32/alloc-id:fake:payload +13338 0x11/imm32/alloc-id:fake +13339 _string-break/imm32/name +13340 0/imm32/no-inouts +13341 0/imm32/no-inouts +13342 0/imm32/no-outputs +13343 0/imm32/no-outputs +13344 0x11/imm32/alloc-id:fake +13345 _string_e9_jump_break/imm32/subx-name +13346 0/imm32/no-rm32 +13347 0/imm32/no-r32 +13348 0/imm32/no-imm32 +13349 0/imm32/no-disp32 +13350 0/imm32/no-output +13351 0x11/imm32/alloc-id:fake +13352 _Primitive-loop-if-addr</imm32/next +13353 _Primitive-loop-if-addr<: # (payload primitive) +13354 0x11/imm32/alloc-id:fake:payload +13355 0x11/imm32/alloc-id:fake +13356 _string-loop-if-addr</imm32/name +13357 0/imm32/no-inouts +13358 0/imm32/no-inouts +13359 0/imm32/no-outputs +13360 0/imm32/no-outputs +13361 0x11/imm32/alloc-id:fake +13362 _string_0f_82_jump_loop/imm32/subx-name +13363 0/imm32/no-rm32 +13364 0/imm32/no-r32 +13365 0/imm32/no-imm32 +13366 0/imm32/no-disp32 +13367 0/imm32/no-output +13368 0x11/imm32/alloc-id:fake +13369 _Primitive-loop-if-addr>=/imm32/next +13370 _Primitive-loop-if-addr>=: # (payload primitive) +13371 0x11/imm32/alloc-id:fake:payload +13372 0x11/imm32/alloc-id:fake +13373 _string-loop-if-addr>=/imm32/name +13374 0/imm32/no-inouts +13375 0/imm32/no-inouts +13376 0/imm32/no-outputs +13377 0/imm32/no-outputs +13378 0x11/imm32/alloc-id:fake +13379 _string_0f_83_jump_loop/imm32/subx-name +13380 0/imm32/no-rm32 +13381 0/imm32/no-r32 +13382 0/imm32/no-imm32 +13383 0/imm32/no-disp32 +13384 0/imm32/no-output +13385 0x11/imm32/alloc-id:fake +13386 _Primitive-loop-if-=/imm32/next +13387 _Primitive-loop-if-=: # (payload primitive) 13388 0x11/imm32/alloc-id:fake:payload -13389 # "0f 82/jump-if-addr<" -13390 0x13/imm32/size -13391 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/< -13392 _string_0f_82_jump_break: # (payload array byte) -13393 0x11/imm32/alloc-id:fake:payload -13394 # "0f 82/jump-if-addr< break/disp32" -13395 0x20/imm32/size -13396 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 -13397 _string_0f_82_jump_loop: # (payload array byte) -13398 0x11/imm32/alloc-id:fake:payload -13399 # "0f 82/jump-if-addr< loop/disp32" -13400 0x1f/imm32/size -13401 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 -13402 _string_0f_83_jump_label: # (payload array byte) -13403 0x11/imm32/alloc-id:fake:payload -13404 # "0f 83/jump-if-addr>=" -13405 0x14/imm32/size -13406 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/= -13407 _string_0f_83_jump_break: # (payload array byte) -13408 0x11/imm32/alloc-id:fake:payload -13409 # "0f 83/jump-if-addr>= break/disp32" -13410 0x21/imm32/size -13411 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 -13412 _string_0f_83_jump_loop: # (payload array byte) -13413 0x11/imm32/alloc-id:fake:payload -13414 # "0f 83/jump-if-addr>= loop/disp32" -13415 0x20/imm32/size -13416 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 -13417 _string_0f_84_jump_label: # (payload array byte) -13418 0x11/imm32/alloc-id:fake:payload -13419 # "0f 84/jump-if-=" -13420 0xf/imm32/size -13421 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/= -13422 _string_0f_84_jump_break: # (payload array byte) -13423 0x11/imm32/alloc-id:fake:payload -13424 # "0f 84/jump-if-= break/disp32" -13425 0x1c/imm32/size -13426 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 -13427 _string_0f_84_jump_loop: # (payload array byte) -13428 0x11/imm32/alloc-id:fake:payload -13429 # "0f 84/jump-if-= loop/disp32" -13430 0x1b/imm32/size -13431 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 -13432 _string_0f_85_jump_label: # (payload array byte) -13433 0x11/imm32/alloc-id:fake:payload -13434 # "0f 85/jump-if-!=" -13435 0x10/imm32/size -13436 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/= -13437 _string_0f_85_jump_break: # (payload array byte) -13438 0x11/imm32/alloc-id:fake:payload -13439 # "0f 85/jump-if-!= break/disp32" -13440 0x1d/imm32/size -13441 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 -13442 _string_0f_85_jump_loop: # (payload array byte) -13443 0x11/imm32/alloc-id:fake:payload -13444 # "0f 85/jump-if-!= loop/disp32" -13445 0x1c/imm32/size -13446 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 -13447 _string_0f_86_jump_label: # (payload array byte) -13448 0x11/imm32/alloc-id:fake:payload -13449 # "0f 86/jump-if-addr<=" -13450 0x14/imm32/size -13451 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/= -13452 _string_0f_86_jump_break: # (payload array byte) -13453 0x11/imm32/alloc-id:fake:payload -13454 # "0f 86/jump-if-addr<= break/disp32" -13455 0x21/imm32/size -13456 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 -13457 _string_0f_86_jump_loop: # (payload array byte) -13458 0x11/imm32/alloc-id:fake:payload -13459 # "0f 86/jump-if-addr<= loop/disp32" -13460 0x20/imm32/size -13461 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 -13462 _string_0f_87_jump_label: # (payload array byte) -13463 0x11/imm32/alloc-id:fake:payload -13464 # "0f 87/jump-if-addr>" -13465 0x13/imm32/size -13466 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/> -13467 _string_0f_87_jump_break: # (payload array byte) -13468 0x11/imm32/alloc-id:fake:payload -13469 # "0f 87/jump-if-addr> break/disp32" -13470 0x20/imm32/size -13471 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 -13472 _string_0f_87_jump_loop: # (payload array byte) +13389 0x11/imm32/alloc-id:fake +13390 _string-loop-if-=/imm32/name +13391 0/imm32/no-inouts +13392 0/imm32/no-inouts +13393 0/imm32/no-outputs +13394 0/imm32/no-outputs +13395 0x11/imm32/alloc-id:fake +13396 _string_0f_84_jump_loop/imm32/subx-name +13397 0/imm32/no-rm32 +13398 0/imm32/no-r32 +13399 0/imm32/no-imm32 +13400 0/imm32/no-disp32 +13401 0/imm32/no-output +13402 0x11/imm32/alloc-id:fake +13403 _Primitive-loop-if-!=/imm32/next +13404 _Primitive-loop-if-!=: # (payload primitive) +13405 0x11/imm32/alloc-id:fake:payload +13406 0x11/imm32/alloc-id:fake +13407 _string-loop-if-!=/imm32/name +13408 0/imm32/no-inouts +13409 0/imm32/no-inouts +13410 0/imm32/no-outputs +13411 0/imm32/no-outputs +13412 0x11/imm32/alloc-id:fake +13413 _string_0f_85_jump_loop/imm32/subx-name +13414 0/imm32/no-rm32 +13415 0/imm32/no-r32 +13416 0/imm32/no-imm32 +13417 0/imm32/no-disp32 +13418 0/imm32/no-output +13419 0x11/imm32/alloc-id:fake +13420 _Primitive-loop-if-addr<=/imm32/next +13421 _Primitive-loop-if-addr<=: # (payload primitive) +13422 0x11/imm32/alloc-id:fake:payload +13423 0x11/imm32/alloc-id:fake +13424 _string-loop-if-addr<=/imm32/name +13425 0/imm32/no-inouts +13426 0/imm32/no-inouts +13427 0/imm32/no-outputs +13428 0/imm32/no-outputs +13429 0x11/imm32/alloc-id:fake +13430 _string_0f_86_jump_loop/imm32/subx-name +13431 0/imm32/no-rm32 +13432 0/imm32/no-r32 +13433 0/imm32/no-imm32 +13434 0/imm32/no-disp32 +13435 0/imm32/no-output +13436 0x11/imm32/alloc-id:fake +13437 _Primitive-loop-if-addr>/imm32/next +13438 _Primitive-loop-if-addr>: # (payload primitive) +13439 0x11/imm32/alloc-id:fake:payload +13440 0x11/imm32/alloc-id:fake +13441 _string-loop-if-addr>/imm32/name +13442 0/imm32/no-inouts +13443 0/imm32/no-inouts +13444 0/imm32/no-outputs +13445 0/imm32/no-outputs +13446 0x11/imm32/alloc-id:fake +13447 _string_0f_87_jump_loop/imm32/subx-name +13448 0/imm32/no-rm32 +13449 0/imm32/no-r32 +13450 0/imm32/no-imm32 +13451 0/imm32/no-disp32 +13452 0/imm32/no-output +13453 0x11/imm32/alloc-id:fake +13454 _Primitive-loop-if-</imm32/next +13455 _Primitive-loop-if-<: # (payload primitive) +13456 0x11/imm32/alloc-id:fake:payload +13457 0x11/imm32/alloc-id:fake +13458 _string-loop-if-</imm32/name +13459 0/imm32/no-inouts +13460 0/imm32/no-inouts +13461 0/imm32/no-outputs +13462 0/imm32/no-outputs +13463 0x11/imm32/alloc-id:fake +13464 _string_0f_8c_jump_loop/imm32/subx-name +13465 0/imm32/no-rm32 +13466 0/imm32/no-r32 +13467 0/imm32/no-imm32 +13468 0/imm32/no-disp32 +13469 0/imm32/no-output +13470 0x11/imm32/alloc-id:fake +13471 _Primitive-loop-if->=/imm32/next +13472 _Primitive-loop-if->=: # (payload primitive) 13473 0x11/imm32/alloc-id:fake:payload -13474 # "0f 87/jump-if-addr> loop/disp32" -13475 0x1f/imm32/size -13476 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 -13477 _string_0f_8c_jump_label: # (payload array byte) -13478 0x11/imm32/alloc-id:fake:payload -13479 # "0f 8c/jump-if-<" -13480 0xf/imm32/size -13481 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/< -13482 _string_0f_8c_jump_break: # (payload array byte) -13483 0x11/imm32/alloc-id:fake:payload -13484 # "0f 8c/jump-if-< break/disp32" -13485 0x1c/imm32/size -13486 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 -13487 _string_0f_8c_jump_loop: # (payload array byte) -13488 0x11/imm32/alloc-id:fake:payload -13489 # "0f 8c/jump-if-< loop/disp32" -13490 0x1b/imm32/size -13491 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 -13492 _string_0f_8d_jump_label: # (payload array byte) -13493 0x11/imm32/alloc-id:fake:payload -13494 # "0f 8d/jump-if->=" -13495 0x10/imm32/size -13496 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/= -13497 _string_0f_8d_jump_break: # (payload array byte) -13498 0x11/imm32/alloc-id:fake:payload -13499 # "0f 8d/jump-if->= break/disp32" -13500 0x1d/imm32/size -13501 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 -13502 _string_0f_8d_jump_loop: # (payload array byte) -13503 0x11/imm32/alloc-id:fake:payload -13504 # "0f 8d/jump-if->= loop/disp32" -13505 0x1c/imm32/size -13506 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 -13507 _string_0f_8e_jump_label: # (payload array byte) -13508 0x11/imm32/alloc-id:fake:payload -13509 # "0f 8e/jump-if-<=" -13510 0x10/imm32/size -13511 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/= -13512 _string_0f_8e_jump_break: # (payload array byte) -13513 0x11/imm32/alloc-id:fake:payload -13514 # "0f 8e/jump-if-<= break/disp32" -13515 0x1d/imm32/size -13516 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 -13517 _string_0f_8e_jump_loop: # (payload array byte) -13518 0x11/imm32/alloc-id:fake:payload -13519 # "0f 8e/jump-if-<= loop/disp32" -13520 0x1c/imm32/size -13521 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 -13522 _string_0f_8f_jump_label: # (payload array byte) -13523 0x11/imm32/alloc-id:fake:payload -13524 # "0f 8f/jump-if->" -13525 0xf/imm32/size -13526 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/> -13527 _string_0f_8f_jump_break: # (payload array byte) -13528 0x11/imm32/alloc-id:fake:payload -13529 # "0f 8f/jump-if-> break/disp32" -13530 0x1c/imm32/size -13531 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 -13532 _string_0f_8f_jump_loop: # (payload array byte) -13533 0x11/imm32/alloc-id:fake:payload -13534 # "0f 8f/jump-if-> loop/disp32" -13535 0x1b/imm32/size -13536 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 -13537 _string_0f_af_multiply: # (payload array byte) -13538 0x11/imm32/alloc-id:fake:payload -13539 # "0f af/multiply" -13540 0xe/imm32/size -13541 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 -13542 _string_21_and_with: # (payload array byte) -13543 0x11/imm32/alloc-id:fake:payload -13544 # "21/and-with" -13545 0xb/imm32/size -13546 0x32/2 0x31/1 0x2f/slash 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -13547 _string_23_and: # (payload array byte) -13548 0x11/imm32/alloc-id:fake:payload -13549 # "23/and" -13550 0x6/imm32/size -13551 0x32/2 0x33/3 0x2f/slash 0x61/a 0x6e/n 0x64/d -13552 _string_25_and_with_eax: # (payload array byte) -13553 0x11/imm32/alloc-id:fake:payload -13554 # "25/and-with-eax" -13555 0xf/imm32/size -13556 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 -13557 _string_29_subtract_from: # (payload array byte) -13558 0x11/imm32/alloc-id:fake:payload -13559 # "29/subtract-from" -13560 0x10/imm32/size -13561 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 -13562 _string_2b_subtract: # (payload array byte) -13563 0x11/imm32/alloc-id:fake:payload -13564 # "2b/subtract" -13565 0xb/imm32/size -13566 0x32/2 0x62/b 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t -13567 _string_2d_subtract_from_eax: # (payload array byte) -13568 0x11/imm32/alloc-id:fake:payload -13569 # "2d/subtract-from-eax" -13570 0x14/imm32/size -13571 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 -13572 _string_31_xor_with: # (payload array byte) -13573 0x11/imm32/alloc-id:fake:payload -13574 # "31/xor-with" -13575 0xb/imm32/size -13576 0x33/3 0x31/1 0x2f/slash 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -13577 _string_33_xor: # (payload array byte) -13578 0x11/imm32/alloc-id:fake:payload -13579 # "33/xor" -13580 0x6/imm32/size -13581 0x33/3 0x33/3 0x2f/slash 0x78/x 0x6f/o 0x72/r -13582 _string_35_xor_with_eax: # (payload array byte) -13583 0x11/imm32/alloc-id:fake:payload -13584 # "35/xor-with-eax" -13585 0xf/imm32/size -13586 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 -13587 _string_39_compare->: # (payload array byte) -13588 0x11/imm32/alloc-id:fake:payload -13589 # "39/compare->" -13590 0xc/imm32/size -13591 0x33/3 0x39/9 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x2d/dash 0x3e/> -13592 _string_3b_compare<-: # (payload array byte) +13474 0x11/imm32/alloc-id:fake +13475 _string-loop-if->=/imm32/name +13476 0/imm32/no-inouts +13477 0/imm32/no-inouts +13478 0/imm32/no-outputs +13479 0/imm32/no-outputs +13480 0x11/imm32/alloc-id:fake +13481 _string_0f_8d_jump_loop/imm32/subx-name +13482 0/imm32/no-rm32 +13483 0/imm32/no-r32 +13484 0/imm32/no-imm32 +13485 0/imm32/no-disp32 +13486 0/imm32/no-output +13487 0x11/imm32/alloc-id:fake +13488 _Primitive-loop-if-<=/imm32/next +13489 _Primitive-loop-if-<=: # (payload primitive) +13490 0x11/imm32/alloc-id:fake:payload +13491 0x11/imm32/alloc-id:fake +13492 _string-loop-if-<=/imm32/name +13493 0/imm32/no-inouts +13494 0/imm32/no-inouts +13495 0/imm32/no-outputs +13496 0/imm32/no-outputs +13497 0x11/imm32/alloc-id:fake +13498 _string_0f_8e_jump_loop/imm32/subx-name +13499 0/imm32/no-rm32 +13500 0/imm32/no-r32 +13501 0/imm32/no-imm32 +13502 0/imm32/no-disp32 +13503 0/imm32/no-output +13504 0x11/imm32/alloc-id:fake +13505 _Primitive-loop-if->/imm32/next +13506 _Primitive-loop-if->: # (payload primitive) +13507 0x11/imm32/alloc-id:fake:payload +13508 0x11/imm32/alloc-id:fake +13509 _string-loop-if->/imm32/name +13510 0/imm32/no-inouts +13511 0/imm32/no-inouts +13512 0/imm32/no-outputs +13513 0/imm32/no-outputs +13514 0x11/imm32/alloc-id:fake +13515 _string_0f_8f_jump_loop/imm32/subx-name +13516 0/imm32/no-rm32 +13517 0/imm32/no-r32 +13518 0/imm32/no-imm32 +13519 0/imm32/no-disp32 +13520 0/imm32/no-output +13521 0x11/imm32/alloc-id:fake +13522 _Primitive-loop/imm32/next # we probably don't need an unconditional break +13523 _Primitive-loop: # (payload primitive) +13524 0x11/imm32/alloc-id:fake:payload +13525 0x11/imm32/alloc-id:fake +13526 _string-loop/imm32/name +13527 0/imm32/no-inouts +13528 0/imm32/no-inouts +13529 0/imm32/no-outputs +13530 0/imm32/no-outputs +13531 0x11/imm32/alloc-id:fake +13532 _string_e9_jump_loop/imm32/subx-name +13533 0/imm32/no-rm32 +13534 0/imm32/no-r32 +13535 0/imm32/no-imm32 +13536 0/imm32/no-disp32 +13537 0/imm32/no-output +13538 0x11/imm32/alloc-id:fake +13539 _Primitive-break-if-addr<-named/imm32/next +13540 # - branches to named blocks +13541 _Primitive-break-if-addr<-named: # (payload primitive) +13542 0x11/imm32/alloc-id:fake:payload +13543 0x11/imm32/alloc-id:fake +13544 _string-break-if-addr</imm32/name +13545 0x11/imm32/alloc-id:fake +13546 Single-lit-var/imm32/inouts +13547 0/imm32/no-outputs +13548 0/imm32/no-outputs +13549 0x11/imm32/alloc-id:fake +13550 _string_0f_82_jump_label/imm32/subx-name +13551 0/imm32/no-rm32 +13552 0/imm32/no-r32 +13553 0/imm32/no-imm32 +13554 1/imm32/disp32-is-first-inout +13555 0/imm32/no-output +13556 0x11/imm32/alloc-id:fake +13557 _Primitive-break-if-addr>=-named/imm32/next +13558 _Primitive-break-if-addr>=-named: # (payload primitive) +13559 0x11/imm32/alloc-id:fake:payload +13560 0x11/imm32/alloc-id:fake +13561 _string-break-if-addr>=/imm32/name +13562 0x11/imm32/alloc-id:fake +13563 Single-lit-var/imm32/inouts +13564 0/imm32/no-outputs +13565 0/imm32/no-outputs +13566 0x11/imm32/alloc-id:fake +13567 _string_0f_83_jump_label/imm32/subx-name +13568 0/imm32/no-rm32 +13569 0/imm32/no-r32 +13570 0/imm32/no-imm32 +13571 1/imm32/disp32-is-first-inout +13572 0/imm32/no-output +13573 0x11/imm32/alloc-id:fake +13574 _Primitive-break-if-=-named/imm32/next +13575 _Primitive-break-if-=-named: # (payload primitive) +13576 0x11/imm32/alloc-id:fake:payload +13577 0x11/imm32/alloc-id:fake +13578 _string-break-if-=/imm32/name +13579 0x11/imm32/alloc-id:fake +13580 Single-lit-var/imm32/inouts +13581 0/imm32/no-outputs +13582 0/imm32/no-outputs +13583 0x11/imm32/alloc-id:fake +13584 _string_0f_84_jump_label/imm32/subx-name +13585 0/imm32/no-rm32 +13586 0/imm32/no-r32 +13587 0/imm32/no-imm32 +13588 1/imm32/disp32-is-first-inout +13589 0/imm32/no-output +13590 0x11/imm32/alloc-id:fake +13591 _Primitive-break-if-!=-named/imm32/next +13592 _Primitive-break-if-!=-named: # (payload primitive) 13593 0x11/imm32/alloc-id:fake:payload -13594 # "3b/compare<-" -13595 0xc/imm32/size -13596 0x33/3 0x62/b 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x3c/< 0x2d/dash -13597 _string_3d_compare_eax_with: # (payload array byte) -13598 0x11/imm32/alloc-id:fake:payload -13599 # "3d/compare-eax-with" -13600 0x13/imm32/size -13601 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 -13602 _string_40_increment_eax: # (payload array byte) -13603 0x11/imm32/alloc-id:fake:payload -13604 # "40/increment-eax" -13605 0x10/imm32/size -13606 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 -13607 _string_41_increment_ecx: # (payload array byte) -13608 0x11/imm32/alloc-id:fake:payload -13609 # "41/increment-ecx" -13610 0x10/imm32/size -13611 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 -13612 _string_42_increment_edx: # (payload array byte) -13613 0x11/imm32/alloc-id:fake:payload -13614 # "42/increment-edx" -13615 0x10/imm32/size -13616 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 -13617 _string_43_increment_ebx: # (payload array byte) -13618 0x11/imm32/alloc-id:fake:payload -13619 # "43/increment-ebx" -13620 0x10/imm32/size -13621 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 -13622 _string_46_increment_esi: # (payload array byte) -13623 0x11/imm32/alloc-id:fake:payload -13624 # "46/increment-esi" -13625 0x10/imm32/size -13626 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 -13627 _string_47_increment_edi: # (payload array byte) -13628 0x11/imm32/alloc-id:fake:payload -13629 # "47/increment-edi" -13630 0x10/imm32/size -13631 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 -13632 _string_48_decrement_eax: # (payload array byte) -13633 0x11/imm32/alloc-id:fake:payload -13634 # "48/decrement-eax" -13635 0x10/imm32/size -13636 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 -13637 _string_49_decrement_ecx: # (payload array byte) -13638 0x11/imm32/alloc-id:fake:payload -13639 # "49/decrement-ecx" -13640 0x10/imm32/size -13641 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 -13642 _string_4a_decrement_edx: # (payload array byte) -13643 0x11/imm32/alloc-id:fake:payload -13644 # "4a/decrement-edx" -13645 0x10/imm32/size -13646 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 -13647 _string_4b_decrement_ebx: # (payload array byte) -13648 0x11/imm32/alloc-id:fake:payload -13649 # "4b/decrement-ebx" -13650 0x10/imm32/size -13651 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 -13652 _string_4e_decrement_esi: # (payload array byte) -13653 0x11/imm32/alloc-id:fake:payload -13654 # "4e/decrement-esi" -13655 0x10/imm32/size -13656 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 -13657 _string_4f_decrement_edi: # (payload array byte) -13658 0x11/imm32/alloc-id:fake:payload -13659 # "4f/decrement-edi" -13660 0x10/imm32/size -13661 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 -13662 _string_81_subop_add: # (payload array byte) -13663 0x11/imm32/alloc-id:fake:payload -13664 # "81 0/subop/add" -13665 0xe/imm32/size -13666 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 -13667 _string_81_subop_or: # (payload array byte) -13668 0x11/imm32/alloc-id:fake:payload -13669 # "81 1/subop/or" -13670 0xd/imm32/size -13671 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 -13672 _string_81_subop_and: # (payload array byte) -13673 0x11/imm32/alloc-id:fake:payload -13674 # "81 4/subop/and" -13675 0xe/imm32/size -13676 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 -13677 _string_81_subop_subtract: # (payload array byte) +13594 0x11/imm32/alloc-id:fake +13595 _string-break-if-!=/imm32/name +13596 0x11/imm32/alloc-id:fake +13597 Single-lit-var/imm32/inouts +13598 0/imm32/no-outputs +13599 0/imm32/no-outputs +13600 0x11/imm32/alloc-id:fake +13601 _string_0f_85_jump_label/imm32/subx-name +13602 0/imm32/no-rm32 +13603 0/imm32/no-r32 +13604 0/imm32/no-imm32 +13605 1/imm32/disp32-is-first-inout +13606 0/imm32/no-output +13607 0x11/imm32/alloc-id:fake +13608 _Primitive-break-if-addr<=-named/imm32/next +13609 _Primitive-break-if-addr<=-named: # (payload primitive) +13610 0x11/imm32/alloc-id:fake:payload +13611 0x11/imm32/alloc-id:fake +13612 _string-break-if-addr<=/imm32/name +13613 0x11/imm32/alloc-id:fake +13614 Single-lit-var/imm32/inouts +13615 0/imm32/no-outputs +13616 0/imm32/no-outputs +13617 0x11/imm32/alloc-id:fake +13618 _string_0f_86_jump_label/imm32/subx-name +13619 0/imm32/no-rm32 +13620 0/imm32/no-r32 +13621 0/imm32/no-imm32 +13622 1/imm32/disp32-is-first-inout +13623 0/imm32/no-output +13624 0x11/imm32/alloc-id:fake +13625 _Primitive-break-if-addr>-named/imm32/next +13626 _Primitive-break-if-addr>-named: # (payload primitive) +13627 0x11/imm32/alloc-id:fake:payload +13628 0x11/imm32/alloc-id:fake +13629 _string-break-if-addr>/imm32/name +13630 0x11/imm32/alloc-id:fake +13631 Single-lit-var/imm32/inouts +13632 0/imm32/no-outputs +13633 0/imm32/no-outputs +13634 0x11/imm32/alloc-id:fake +13635 _string_0f_87_jump_label/imm32/subx-name +13636 0/imm32/no-rm32 +13637 0/imm32/no-r32 +13638 0/imm32/no-imm32 +13639 1/imm32/disp32-is-first-inout +13640 0/imm32/no-output +13641 0x11/imm32/alloc-id:fake +13642 _Primitive-break-if-<-named/imm32/next +13643 _Primitive-break-if-<-named: # (payload primitive) +13644 0x11/imm32/alloc-id:fake:payload +13645 0x11/imm32/alloc-id:fake +13646 _string-break-if-</imm32/name +13647 0x11/imm32/alloc-id:fake +13648 Single-lit-var/imm32/inouts +13649 0/imm32/no-outputs +13650 0/imm32/no-outputs +13651 0x11/imm32/alloc-id:fake +13652 _string_0f_8c_jump_label/imm32/subx-name +13653 0/imm32/no-rm32 +13654 0/imm32/no-r32 +13655 0/imm32/no-imm32 +13656 1/imm32/disp32-is-first-inout +13657 0/imm32/no-output +13658 0x11/imm32/alloc-id:fake +13659 _Primitive-break-if->=-named/imm32/next +13660 _Primitive-break-if->=-named: # (payload primitive) +13661 0x11/imm32/alloc-id:fake:payload +13662 0x11/imm32/alloc-id:fake +13663 _string-break-if->=/imm32/name +13664 0x11/imm32/alloc-id:fake +13665 Single-lit-var/imm32/inouts +13666 0/imm32/no-outputs +13667 0/imm32/no-outputs +13668 0x11/imm32/alloc-id:fake +13669 _string_0f_8d_jump_label/imm32/subx-name +13670 0/imm32/no-rm32 +13671 0/imm32/no-r32 +13672 0/imm32/no-imm32 +13673 1/imm32/disp32-is-first-inout +13674 0/imm32/no-output +13675 0x11/imm32/alloc-id:fake +13676 _Primitive-break-if-<=-named/imm32/next +13677 _Primitive-break-if-<=-named: # (payload primitive) 13678 0x11/imm32/alloc-id:fake:payload -13679 # "81 5/subop/subtract" -13680 0x13/imm32/size -13681 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 -13682 _string_81_subop_xor: # (payload array byte) -13683 0x11/imm32/alloc-id:fake:payload -13684 # "81 6/subop/xor" -13685 0xe/imm32/size -13686 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 -13687 _string_81_subop_compare: # (payload array byte) -13688 0x11/imm32/alloc-id:fake:payload -13689 # "81 7/subop/compare" -13690 0x12/imm32/size -13691 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 -13692 _string_89_<-: # (payload array byte) -13693 0x11/imm32/alloc-id:fake:payload -13694 # "89/<-" -13695 0x5/imm32/size -13696 0x38/8 0x39/9 0x2f/slash 0x3c/< 0x2d/dash -13697 _string_8b_->: # (payload array byte) -13698 0x11/imm32/alloc-id:fake:payload -13699 # "8b/->" -13700 0x5/imm32/size -13701 0x38/8 0x62/b 0x2f/slash 0x2d/dash 0x3e/> -13702 _string_8a_copy_byte: -13703 0x11/imm32/alloc-id:fake:payload -13704 # "8a/byte->" -13705 0x9/imm32/size -13706 0x38/8 0x61/a 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x3e/> -13707 _string_88_copy_byte: -13708 0x11/imm32/alloc-id:fake:payload -13709 # "88/byte<-" -13710 0x9/imm32/size -13711 0x38/8 0x38/8 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x3c/< 0x2d/- -13712 _string_8d_copy_address: # (payload array byte) -13713 0x11/imm32/alloc-id:fake:payload -13714 # "8d/copy-address" -13715 0xf/imm32/size -13716 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 -13717 _string_b8_copy_to_eax: # (payload array byte) -13718 0x11/imm32/alloc-id:fake:payload -13719 # "b8/copy-to-eax" -13720 0xe/imm32/size -13721 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 -13722 _string_b9_copy_to_ecx: # (payload array byte) -13723 0x11/imm32/alloc-id:fake:payload -13724 # "b9/copy-to-ecx" -13725 0xe/imm32/size -13726 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 -13727 _string_ba_copy_to_edx: # (payload array byte) -13728 0x11/imm32/alloc-id:fake:payload -13729 # "ba/copy-to-edx" -13730 0xe/imm32/size -13731 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 -13732 _string_bb_copy_to_ebx: # (payload array byte) -13733 0x11/imm32/alloc-id:fake:payload -13734 # "bb/copy-to-ebx" -13735 0xe/imm32/size -13736 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 -13737 _string_be_copy_to_esi: # (payload array byte) -13738 0x11/imm32/alloc-id:fake:payload -13739 # "be/copy-to-esi" -13740 0xe/imm32/size -13741 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 -13742 _string_bf_copy_to_edi: # (payload array byte) -13743 0x11/imm32/alloc-id:fake:payload -13744 # "bf/copy-to-edi" -13745 0xe/imm32/size -13746 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 -13747 _string_c7_subop_copy: # (payload array byte) -13748 0x11/imm32/alloc-id:fake:payload -13749 # "c7 0/subop/copy" -13750 0xf/imm32/size -13751 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 -13752 _string_e9_jump_label: # (payload array byte) -13753 0x11/imm32/alloc-id:fake:payload -13754 # "e9/jump" -13755 0x7/imm32/size -13756 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p -13757 _string_e9_jump_break: # (payload array byte) -13758 0x11/imm32/alloc-id:fake:payload -13759 # "e9/jump break/disp32" -13760 0x14/imm32/size -13761 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 -13762 _string_e9_jump_loop: # (payload array byte) +13679 0x11/imm32/alloc-id:fake +13680 _string-break-if-<=/imm32/name +13681 0x11/imm32/alloc-id:fake +13682 Single-lit-var/imm32/inouts +13683 0/imm32/no-outputs +13684 0/imm32/no-outputs +13685 0x11/imm32/alloc-id:fake +13686 _string_0f_8e_jump_label/imm32/subx-name +13687 0/imm32/no-rm32 +13688 0/imm32/no-r32 +13689 0/imm32/no-imm32 +13690 1/imm32/disp32-is-first-inout +13691 0/imm32/no-output +13692 0x11/imm32/alloc-id:fake +13693 _Primitive-break-if->-named/imm32/next +13694 _Primitive-break-if->-named: # (payload primitive) +13695 0x11/imm32/alloc-id:fake:payload +13696 0x11/imm32/alloc-id:fake +13697 _string-break-if->/imm32/name +13698 0x11/imm32/alloc-id:fake +13699 Single-lit-var/imm32/inouts +13700 0/imm32/no-outputs +13701 0/imm32/no-outputs +13702 0x11/imm32/alloc-id:fake +13703 _string_0f_8f_jump_label/imm32/subx-name +13704 0/imm32/no-rm32 +13705 0/imm32/no-r32 +13706 0/imm32/no-imm32 +13707 1/imm32/disp32-is-first-inout +13708 0/imm32/no-output +13709 0x11/imm32/alloc-id:fake +13710 _Primitive-break-named/imm32/next +13711 _Primitive-break-named: # (payload primitive) +13712 0x11/imm32/alloc-id:fake:payload +13713 0x11/imm32/alloc-id:fake +13714 _string-break/imm32/name +13715 0x11/imm32/alloc-id:fake +13716 Single-lit-var/imm32/inouts +13717 0/imm32/no-outputs +13718 0/imm32/no-outputs +13719 0x11/imm32/alloc-id:fake +13720 _string_e9_jump_label/imm32/subx-name +13721 0/imm32/no-rm32 +13722 0/imm32/no-r32 +13723 0/imm32/no-imm32 +13724 1/imm32/disp32-is-first-inout +13725 0/imm32/no-output +13726 0x11/imm32/alloc-id:fake +13727 _Primitive-loop-if-addr<-named/imm32/next +13728 _Primitive-loop-if-addr<-named: # (payload primitive) +13729 0x11/imm32/alloc-id:fake:payload +13730 0x11/imm32/alloc-id:fake +13731 _string-loop-if-addr</imm32/name +13732 0x11/imm32/alloc-id:fake +13733 Single-lit-var/imm32/inouts +13734 0/imm32/no-outputs +13735 0/imm32/no-outputs +13736 0x11/imm32/alloc-id:fake +13737 _string_0f_82_jump_label/imm32/subx-name +13738 0/imm32/no-rm32 +13739 0/imm32/no-r32 +13740 0/imm32/no-imm32 +13741 1/imm32/disp32-is-first-inout +13742 0/imm32/no-output +13743 0x11/imm32/alloc-id:fake +13744 _Primitive-loop-if-addr>=-named/imm32/next +13745 _Primitive-loop-if-addr>=-named: # (payload primitive) +13746 0x11/imm32/alloc-id:fake:payload +13747 0x11/imm32/alloc-id:fake +13748 _string-loop-if-addr>=/imm32/name +13749 0x11/imm32/alloc-id:fake +13750 Single-lit-var/imm32/inouts +13751 0/imm32/no-outputs +13752 0/imm32/no-outputs +13753 0x11/imm32/alloc-id:fake +13754 _string_0f_83_jump_label/imm32/subx-name +13755 0/imm32/no-rm32 +13756 0/imm32/no-r32 +13757 0/imm32/no-imm32 +13758 1/imm32/disp32-is-first-inout +13759 0/imm32/no-output +13760 0x11/imm32/alloc-id:fake +13761 _Primitive-loop-if-=-named/imm32/next +13762 _Primitive-loop-if-=-named: # (payload primitive) 13763 0x11/imm32/alloc-id:fake:payload -13764 # "e9/jump loop/disp32" -13765 0x13/imm32/size -13766 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 -13767 _string_ff_subop_increment: # (payload array byte) -13768 0x11/imm32/alloc-id:fake:payload -13769 # "ff 0/subop/increment" -13770 0x14/imm32/size -13771 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 -13772 _string_ff_subop_decrement: # (payload array byte) -13773 0x11/imm32/alloc-id:fake:payload -13774 # "ff 1/subop/decrement" -13775 0x14/imm32/size -13776 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 -13777 -13778 Single-int-var-in-mem: # (payload list var) -13779 0x11/imm32/alloc-id:fake:payload -13780 0x11/imm32/alloc-id:fake -13781 Int-var-in-mem/imm32 -13782 0/imm32/next -13783 0/imm32/next -13784 -13785 Int-var-in-mem: # (payload var) -13786 0x11/imm32/alloc-id:fake:payload -13787 0/imm32/name -13788 0/imm32/name -13789 0x11/imm32/alloc-id:fake -13790 Type-int/imm32 -13791 1/imm32/some-block-depth -13792 1/imm32/some-stack-offset -13793 0/imm32/no-register -13794 0/imm32/no-register -13795 -13796 # Not really legal, but closest we can currently represent a dereference of an (addr byte) -13797 Single-byte-var-in-mem: # (payload list var) -13798 0x11/imm32/alloc-id:fake:payload -13799 0x11/imm32/alloc-id:fake -13800 Byte-var-in-mem/imm32 -13801 0/imm32/next -13802 0/imm32/next -13803 -13804 # Not really legal, but closest we can currently represent a dereference of an (addr byte) -13805 Byte-var-in-mem: # (payload var) -13806 0x11/imm32/alloc-id:fake:payload -13807 0/imm32/name -13808 0/imm32/name -13809 0x11/imm32/alloc-id:fake -13810 Type-byte/imm32 -13811 1/imm32/some-block-depth -13812 1/imm32/some-stack-offset -13813 0/imm32/no-register -13814 0/imm32/no-register -13815 -13816 Two-args-int-stack-int-reg: # (payload list var) -13817 0x11/imm32/alloc-id:fake:payload -13818 0x11/imm32/alloc-id:fake -13819 Int-var-in-mem/imm32 -13820 0x11/imm32/alloc-id:fake -13821 Single-int-var-in-some-register/imm32/next -13822 -13823 Two-int-args-in-regs: # (payload list var) -13824 0x11/imm32/alloc-id:fake:payload -13825 0x11/imm32/alloc-id:fake -13826 Int-var-in-some-register/imm32 -13827 0x11/imm32/alloc-id:fake -13828 Single-int-var-in-some-register/imm32/next -13829 -13830 # Not really legal, but closest we can currently represent a dereference of an (addr byte) -13831 Two-args-byte-stack-byte-reg: # (payload list var) -13832 0x11/imm32/alloc-id:fake:payload -13833 0x11/imm32/alloc-id:fake -13834 Byte-var-in-mem/imm32 -13835 0x11/imm32/alloc-id:fake -13836 Single-byte-var-in-some-register/imm32/next -13837 -13838 Two-args-int-reg-int-stack: # (payload list var) -13839 0x11/imm32/alloc-id:fake:payload -13840 0x11/imm32/alloc-id:fake -13841 Int-var-in-some-register/imm32 -13842 0x11/imm32/alloc-id:fake -13843 Single-int-var-in-mem/imm32/next -13844 -13845 Two-args-int-eax-int-literal: # (payload list var) -13846 0x11/imm32/alloc-id:fake:payload -13847 0x11/imm32/alloc-id:fake -13848 Int-var-in-eax/imm32 +13764 0x11/imm32/alloc-id:fake +13765 _string-loop-if-=/imm32/name +13766 0x11/imm32/alloc-id:fake +13767 Single-lit-var/imm32/inouts +13768 0/imm32/no-outputs +13769 0/imm32/no-outputs +13770 0x11/imm32/alloc-id:fake +13771 _string_0f_84_jump_label/imm32/subx-name +13772 0/imm32/no-rm32 +13773 0/imm32/no-r32 +13774 0/imm32/no-imm32 +13775 1/imm32/disp32-is-first-inout +13776 0/imm32/no-output +13777 0x11/imm32/alloc-id:fake +13778 _Primitive-loop-if-!=-named/imm32/next +13779 _Primitive-loop-if-!=-named: # (payload primitive) +13780 0x11/imm32/alloc-id:fake:payload +13781 0x11/imm32/alloc-id:fake +13782 _string-loop-if-!=/imm32/name +13783 0x11/imm32/alloc-id:fake +13784 Single-lit-var/imm32/inouts +13785 0/imm32/no-outputs +13786 0/imm32/no-outputs +13787 0x11/imm32/alloc-id:fake +13788 _string_0f_85_jump_label/imm32/subx-name +13789 0/imm32/no-rm32 +13790 0/imm32/no-r32 +13791 0/imm32/no-imm32 +13792 1/imm32/disp32-is-first-inout +13793 0/imm32/no-output +13794 0x11/imm32/alloc-id:fake +13795 _Primitive-loop-if-addr<=-named/imm32/next +13796 _Primitive-loop-if-addr<=-named: # (payload primitive) +13797 0x11/imm32/alloc-id:fake:payload +13798 0x11/imm32/alloc-id:fake +13799 _string-loop-if-addr<=/imm32/name +13800 0x11/imm32/alloc-id:fake +13801 Single-lit-var/imm32/inouts +13802 0/imm32/no-outputs +13803 0/imm32/no-outputs +13804 0x11/imm32/alloc-id:fake +13805 _string_0f_86_jump_label/imm32/subx-name +13806 0/imm32/no-rm32 +13807 0/imm32/no-r32 +13808 0/imm32/no-imm32 +13809 1/imm32/disp32-is-first-inout +13810 0/imm32/no-output +13811 0x11/imm32/alloc-id:fake +13812 _Primitive-loop-if-addr>-named/imm32/next +13813 _Primitive-loop-if-addr>-named: # (payload primitive) +13814 0x11/imm32/alloc-id:fake:payload +13815 0x11/imm32/alloc-id:fake +13816 _string-loop-if-addr>/imm32/name +13817 0x11/imm32/alloc-id:fake +13818 Single-lit-var/imm32/inouts +13819 0/imm32/no-outputs +13820 0/imm32/no-outputs +13821 0x11/imm32/alloc-id:fake +13822 _string_0f_87_jump_label/imm32/subx-name +13823 0/imm32/no-rm32 +13824 0/imm32/no-r32 +13825 0/imm32/no-imm32 +13826 1/imm32/disp32-is-first-inout +13827 0/imm32/no-output +13828 0x11/imm32/alloc-id:fake +13829 _Primitive-loop-if-<-named/imm32/next +13830 _Primitive-loop-if-<-named: # (payload primitive) +13831 0x11/imm32/alloc-id:fake:payload +13832 0x11/imm32/alloc-id:fake +13833 _string-loop-if-</imm32/name +13834 0x11/imm32/alloc-id:fake +13835 Single-lit-var/imm32/inouts +13836 0/imm32/no-outputs +13837 0/imm32/no-outputs +13838 0x11/imm32/alloc-id:fake +13839 _string_0f_8c_jump_label/imm32/subx-name +13840 0/imm32/no-rm32 +13841 0/imm32/no-r32 +13842 0/imm32/no-imm32 +13843 1/imm32/disp32-is-first-inout +13844 0/imm32/no-output +13845 0x11/imm32/alloc-id:fake +13846 _Primitive-loop-if->=-named/imm32/next +13847 _Primitive-loop-if->=-named: # (payload primitive) +13848 0x11/imm32/alloc-id:fake:payload 13849 0x11/imm32/alloc-id:fake -13850 Single-lit-var/imm32/next -13851 -13852 Int-var-and-literal: # (payload list var) -13853 0x11/imm32/alloc-id:fake:payload -13854 0x11/imm32/alloc-id:fake -13855 Int-var-in-mem/imm32 -13856 0x11/imm32/alloc-id:fake -13857 Single-lit-var/imm32/next -13858 -13859 Int-var-in-register-and-literal: # (payload list var) -13860 0x11/imm32/alloc-id:fake:payload -13861 0x11/imm32/alloc-id:fake -13862 Int-var-in-some-register/imm32 -13863 0x11/imm32/alloc-id:fake -13864 Single-lit-var/imm32/next -13865 -13866 Single-int-var-in-some-register: # (payload list var) -13867 0x11/imm32/alloc-id:fake:payload +13850 _string-loop-if->=/imm32/name +13851 0x11/imm32/alloc-id:fake +13852 Single-lit-var/imm32/inouts +13853 0/imm32/no-outputs +13854 0/imm32/no-outputs +13855 0x11/imm32/alloc-id:fake +13856 _string_0f_8d_jump_label/imm32/subx-name +13857 0/imm32/no-rm32 +13858 0/imm32/no-r32 +13859 0/imm32/no-imm32 +13860 1/imm32/disp32-is-first-inout +13861 0/imm32/no-output +13862 0x11/imm32/alloc-id:fake +13863 _Primitive-loop-if-<=-named/imm32/next +13864 _Primitive-loop-if-<=-named: # (payload primitive) +13865 0x11/imm32/alloc-id:fake:payload +13866 0x11/imm32/alloc-id:fake +13867 _string-loop-if-<=/imm32/name 13868 0x11/imm32/alloc-id:fake -13869 Int-var-in-some-register/imm32 -13870 0/imm32/next -13871 0/imm32/next -13872 -13873 Single-addr-var-in-some-register: # (payload list var) -13874 0x11/imm32/alloc-id:fake:payload -13875 0x11/imm32/alloc-id:fake -13876 Addr-var-in-some-register/imm32 -13877 0/imm32/next -13878 0/imm32/next -13879 -13880 Single-byte-var-in-some-register: # (payload list var) -13881 0x11/imm32/alloc-id:fake:payload -13882 0x11/imm32/alloc-id:fake -13883 Byte-var-in-some-register/imm32 -13884 0/imm32/next -13885 0/imm32/next -13886 -13887 Int-var-in-some-register: # (payload var) -13888 0x11/imm32/alloc-id:fake:payload -13889 0/imm32/name -13890 0/imm32/name -13891 0x11/imm32/alloc-id:fake -13892 Type-int/imm32 -13893 1/imm32/some-block-depth -13894 0/imm32/no-stack-offset -13895 0x11/imm32/alloc-id:fake -13896 Any-register/imm32 -13897 -13898 Any-register: # (payload array byte) +13869 Single-lit-var/imm32/inouts +13870 0/imm32/no-outputs +13871 0/imm32/no-outputs +13872 0x11/imm32/alloc-id:fake +13873 _string_0f_8e_jump_label/imm32/subx-name +13874 0/imm32/no-rm32 +13875 0/imm32/no-r32 +13876 0/imm32/no-imm32 +13877 1/imm32/disp32-is-first-inout +13878 0/imm32/no-output +13879 0x11/imm32/alloc-id:fake +13880 _Primitive-loop-if->-named/imm32/next +13881 _Primitive-loop-if->-named: # (payload primitive) +13882 0x11/imm32/alloc-id:fake:payload +13883 0x11/imm32/alloc-id:fake +13884 _string-loop-if->/imm32/name +13885 0x11/imm32/alloc-id:fake +13886 Single-lit-var/imm32/inouts +13887 0/imm32/no-outputs +13888 0/imm32/no-outputs +13889 0x11/imm32/alloc-id:fake +13890 _string_0f_8f_jump_label/imm32/subx-name +13891 0/imm32/no-rm32 +13892 0/imm32/no-r32 +13893 0/imm32/no-imm32 +13894 1/imm32/disp32-is-first-inout +13895 0/imm32/no-output +13896 0x11/imm32/alloc-id:fake +13897 _Primitive-loop-named/imm32/next # we probably don't need an unconditional break +13898 _Primitive-loop-named: # (payload primitive) 13899 0x11/imm32/alloc-id:fake:payload -13900 1/imm32/size -13901 # data -13902 2a/asterisk -13903 -13904 Addr-var-in-some-register: # (payload var) -13905 0x11/imm32/alloc-id:fake:payload -13906 0/imm32/name -13907 0/imm32/name -13908 0x11/imm32/alloc-id:fake -13909 Type-addr/imm32 -13910 1/imm32/some-block-depth -13911 0/imm32/no-stack-offset -13912 0x11/imm32/alloc-id:fake -13913 Any-register/imm32 -13914 -13915 Byte-var-in-some-register: # (payload var) -13916 0x11/imm32/alloc-id:fake:payload -13917 0/imm32/name -13918 0/imm32/name -13919 0x11/imm32/alloc-id:fake -13920 Type-byte/imm32 -13921 1/imm32/some-block-depth -13922 0/imm32/no-stack-offset -13923 0x11/imm32/alloc-id:fake -13924 Any-register/imm32 -13925 -13926 Single-int-var-in-eax: # (payload list var) -13927 0x11/imm32/alloc-id:fake:payload -13928 0x11/imm32/alloc-id:fake -13929 Int-var-in-eax/imm32 -13930 0/imm32/next -13931 0/imm32/next -13932 -13933 Int-var-in-eax: -13934 0x11/imm32/alloc-id:fake:payload -13935 0/imm32/name -13936 0/imm32/name -13937 0x11/imm32/alloc-id:fake -13938 Type-int/imm32 -13939 1/imm32/some-block-depth -13940 0/imm32/no-stack-offset -13941 0x11/imm32/alloc-id:fake -13942 $Register-eax/imm32 -13943 -13944 Single-int-var-in-ecx: # (payload list var) -13945 0x11/imm32/alloc-id:fake:payload -13946 0x11/imm32/alloc-id:fake -13947 Int-var-in-ecx/imm32 -13948 0/imm32/next -13949 0/imm32/next -13950 -13951 Int-var-in-ecx: -13952 0x11/imm32/alloc-id:fake:payload -13953 0/imm32/name -13954 0/imm32/name -13955 0x11/imm32/alloc-id:fake -13956 Type-int/imm32 -13957 1/imm32/some-block-depth -13958 0/imm32/no-stack-offset -13959 0x11/imm32/alloc-id:fake -13960 $Register-ecx/imm32/register -13961 -13962 Single-int-var-in-edx: # (payload list var) +13900 0x11/imm32/alloc-id:fake +13901 _string-loop/imm32/name +13902 0x11/imm32/alloc-id:fake +13903 Single-lit-var/imm32/inouts +13904 0/imm32/no-outputs +13905 0/imm32/no-outputs +13906 0x11/imm32/alloc-id:fake +13907 _string_e9_jump_label/imm32/subx-name +13908 0/imm32/no-rm32 +13909 0/imm32/no-r32 +13910 0/imm32/no-imm32 +13911 1/imm32/disp32-is-first-inout +13912 0/imm32/no-output +13913 0/imm32/next +13914 0/imm32/next +13915 +13916 # string literals for Mu instructions +13917 _string-add: # (payload array byte) +13918 0x11/imm32/alloc-id:fake:payload +13919 # "add" +13920 0x3/imm32/size +13921 0x61/a 0x64/d 0x64/d +13922 _string-address: # (payload array byte) +13923 0x11/imm32/alloc-id:fake:payload +13924 # "address" +13925 0x7/imm32/size +13926 0x61/a 0x64/d 0x64/d 0x72/r 0x65/e 0x73/s 0x73/s +13927 _string-add-to: # (payload array byte) +13928 0x11/imm32/alloc-id:fake:payload +13929 # "add-to" +13930 0x6/imm32/size +13931 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o +13932 _string-and: # (payload array byte) +13933 0x11/imm32/alloc-id:fake:payload +13934 # "and" +13935 0x3/imm32/size +13936 0x61/a 0x6e/n 0x64/d +13937 _string-and-with: # (payload array byte) +13938 0x11/imm32/alloc-id:fake:payload +13939 # "and-with" +13940 0x8/imm32/size +13941 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +13942 _string-break: # (payload array byte) +13943 0x11/imm32/alloc-id:fake:payload +13944 # "break" +13945 0x5/imm32/size +13946 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k +13947 _string-break-if-<: # (payload array byte) +13948 0x11/imm32/alloc-id:fake:payload +13949 # "break-if-<" +13950 0xa/imm32/size +13951 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< +13952 _string-break-if-<=: # (payload array byte) +13953 0x11/imm32/alloc-id:fake:payload +13954 # "break-if-<=" +13955 0xb/imm32/size +13956 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= +13957 _string-break-if-=: # (payload array byte) +13958 0x11/imm32/alloc-id:fake:payload +13959 # "break-if-=" +13960 0xa/imm32/size +13961 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= +13962 _string-break-if->: # (payload array byte) 13963 0x11/imm32/alloc-id:fake:payload -13964 0x11/imm32/alloc-id:fake -13965 Int-var-in-edx/imm32 -13966 0/imm32/next -13967 0/imm32/next -13968 -13969 Int-var-in-edx: # (payload list var) -13970 0x11/imm32/alloc-id:fake:payload -13971 0/imm32/name -13972 0/imm32/name -13973 0x11/imm32/alloc-id:fake -13974 Type-int/imm32 -13975 1/imm32/some-block-depth -13976 0/imm32/no-stack-offset -13977 0x11/imm32/alloc-id:fake -13978 $Register-edx/imm32/register -13979 -13980 Single-int-var-in-ebx: # (payload list var) -13981 0x11/imm32/alloc-id:fake:payload -13982 0x11/imm32/alloc-id:fake -13983 Int-var-in-ebx/imm32 -13984 0/imm32/next -13985 0/imm32/next -13986 -13987 Int-var-in-ebx: # (payload list var) +13964 # "break-if->" +13965 0xa/imm32/size +13966 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> +13967 _string-break-if->=: # (payload array byte) +13968 0x11/imm32/alloc-id:fake:payload +13969 # "break-if->=" +13970 0xb/imm32/size +13971 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= +13972 _string-break-if-!=: # (payload array byte) +13973 0x11/imm32/alloc-id:fake:payload +13974 # "break-if-!=" +13975 0xb/imm32/size +13976 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= +13977 _string-break-if-addr<: # (payload array byte) +13978 0x11/imm32/alloc-id:fake:payload +13979 # "break-if-addr<" +13980 0xe/imm32/size +13981 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/< +13982 _string-break-if-addr<=: # (payload array byte) +13983 0x11/imm32/alloc-id:fake:payload +13984 # "break-if-addr<=" +13985 0xf/imm32/size +13986 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/= +13987 _string-break-if-addr>: # (payload array byte) 13988 0x11/imm32/alloc-id:fake:payload -13989 0/imm32/name -13990 0/imm32/name -13991 0x11/imm32/alloc-id:fake -13992 Type-int/imm32 -13993 1/imm32/some-block-depth -13994 0/imm32/no-stack-offset -13995 0x11/imm32/alloc-id:fake -13996 $Register-ebx/imm32/register -13997 -13998 Single-int-var-in-esi: # (payload list var) -13999 0x11/imm32/alloc-id:fake:payload -14000 0x11/imm32/alloc-id:fake -14001 Int-var-in-esi/imm32 -14002 0/imm32/next -14003 0/imm32/next -14004 -14005 Int-var-in-esi: # (payload list var) -14006 0x11/imm32/alloc-id:fake:payload -14007 0/imm32/name -14008 0/imm32/name -14009 0x11/imm32/alloc-id:fake -14010 Type-int/imm32 -14011 1/imm32/some-block-depth -14012 0/imm32/no-stack-offset -14013 0x11/imm32/alloc-id:fake -14014 $Register-esi/imm32/register -14015 -14016 Single-int-var-in-edi: # (payload list var) -14017 0x11/imm32/alloc-id:fake:payload -14018 0x11/imm32/alloc-id:fake -14019 Int-var-in-edi/imm32 -14020 0/imm32/next -14021 0/imm32/next -14022 -14023 Int-var-in-edi: # (payload list var) -14024 0x11/imm32/alloc-id:fake:payload -14025 0/imm32/name -14026 0/imm32/name -14027 0x11/imm32/alloc-id:fake -14028 Type-int/imm32 -14029 1/imm32/some-block-depth -14030 0/imm32/no-stack-offset -14031 0x11/imm32/alloc-id:fake -14032 $Register-edi/imm32/register -14033 -14034 Single-lit-var: # (payload list var) -14035 0x11/imm32/alloc-id:fake:payload -14036 0x11/imm32/alloc-id:fake -14037 Lit-var/imm32 -14038 0/imm32/next -14039 0/imm32/next -14040 -14041 Lit-var: # (payload var) -14042 0x11/imm32/alloc-id:fake:payload -14043 0/imm32/name -14044 0/imm32/name -14045 0x11/imm32/alloc-id:fake -14046 Type-literal/imm32 -14047 1/imm32/some-block-depth -14048 0/imm32/no-stack-offset -14049 0/imm32/no-register -14050 0/imm32/no-register -14051 -14052 Type-int: # (payload tree type-id) +13989 # "break-if-addr>" +13990 0xe/imm32/size +13991 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/> +13992 _string-break-if-addr>=: # (payload array byte) +13993 0x11/imm32/alloc-id:fake:payload +13994 # "break-if-addr>=" +13995 0xf/imm32/size +13996 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/= +13997 _string-compare: # (payload array byte) +13998 0x11/imm32/alloc-id:fake:payload +13999 # "compare" +14000 0x7/imm32/size +14001 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e +14002 _string-copy: # (payload array byte) +14003 0x11/imm32/alloc-id:fake:payload +14004 # "copy" +14005 0x4/imm32/size +14006 0x63/c 0x6f/o 0x70/p 0x79/y +14007 _string-copy-to: # (payload array byte) +14008 0x11/imm32/alloc-id:fake:payload +14009 # "copy-to" +14010 0x7/imm32/size +14011 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o +14012 _string-copy-byte: +14013 0x11/imm32/alloc-id:fake:payload +14014 # "copy-byte" +14015 0x9/imm32/size +14016 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e +14017 _string-copy-byte-to: +14018 0x11/imm32/alloc-id:fake:payload +14019 # "copy-byte-to" +14020 0xc/imm32/size +14021 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x74/t 0x6f/o +14022 _string-decrement: # (payload array byte) +14023 0x11/imm32/alloc-id:fake:payload +14024 # "decrement" +14025 0x9/imm32/size +14026 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t +14027 _string-increment: # (payload array byte) +14028 0x11/imm32/alloc-id:fake:payload +14029 # "increment" +14030 0x9/imm32/size +14031 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t +14032 _string-loop: # (payload array byte) +14033 0x11/imm32/alloc-id:fake:payload +14034 # "loop" +14035 0x4/imm32/size +14036 0x6c/l 0x6f/o 0x6f/o 0x70/p +14037 _string-loop-if-<: # (payload array byte) +14038 0x11/imm32/alloc-id:fake:payload +14039 # "loop-if-<" +14040 0x9/imm32/size +14041 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< +14042 _string-loop-if-<=: # (payload array byte) +14043 0x11/imm32/alloc-id:fake:payload +14044 # "loop-if-<=" +14045 0xa/imm32/size +14046 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= +14047 _string-loop-if-=: # (payload array byte) +14048 0x11/imm32/alloc-id:fake:payload +14049 # "loop-if-=" +14050 0x9/imm32/size +14051 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= +14052 _string-loop-if->: # (payload array byte) 14053 0x11/imm32/alloc-id:fake:payload -14054 1/imm32/left-is-atom -14055 1/imm32/value:int -14056 0/imm32/left:unused -14057 0/imm32/right:null -14058 0/imm32/right:null -14059 -14060 Type-literal: # (payload tree type-id) -14061 0x11/imm32/alloc-id:fake:payload -14062 1/imm32/is-atom -14063 0/imm32/value:literal -14064 0/imm32/left:unused -14065 0/imm32/right:null -14066 0/imm32/right:null -14067 -14068 Type-addr: # (payload tree type-id) -14069 0x11/imm32/alloc-id:fake:payload -14070 1/imm32/is-atom -14071 2/imm32/value:addr -14072 0/imm32/left:unused -14073 0/imm32/right:null -14074 0/imm32/right:null -14075 -14076 Type-byte: # (payload tree type-id) -14077 0x11/imm32/alloc-id:fake:payload -14078 1/imm32/is-atom -14079 8/imm32/value:byte -14080 0/imm32/left:unused -14081 0/imm32/right:null -14082 0/imm32/right:null -14083 -14084 == code -14085 emit-subx-primitive: # out: (addr buffered-file), stmt: (addr stmt), primitive: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) -14086 # . prologue -14087 55/push-ebp -14088 89/<- %ebp 4/r32/esp -14089 # . save registers -14090 50/push-eax -14091 51/push-ecx -14092 # ecx = primitive -14093 8b/-> *(ebp+0x10) 1/r32/ecx -14094 # emit primitive name -14095 (emit-indent *(ebp+8) *Curr-block-depth) -14096 (lookup *(ecx+0x18) *(ecx+0x1c)) # Primitive-subx-name Primitive-subx-name => eax -14097 (write-buffered *(ebp+8) %eax) -14098 # emit rm32 if necessary -14099 (emit-subx-rm32 *(ebp+8) *(ecx+0x20) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-rm32 -14100 # emit r32 if necessary -14101 (emit-subx-r32 *(ebp+8) *(ecx+0x24) *(ebp+0xc)) # Primitive-subx-r32 -14102 # emit imm32 if necessary -14103 (emit-subx-imm32 *(ebp+8) *(ecx+0x28) *(ebp+0xc)) # Primitive-subx-imm32 -14104 # emit disp32 if necessary -14105 (emit-subx-disp32 *(ebp+8) *(ecx+0x2c) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-disp32 -14106 (write-buffered *(ebp+8) Newline) -14107 $emit-subx-primitive:end: -14108 # . restore registers -14109 59/pop-to-ecx -14110 58/pop-to-eax -14111 # . epilogue -14112 89/<- %esp 5/r32/ebp -14113 5d/pop-to-ebp -14114 c3/return -14115 -14116 emit-subx-rm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -14117 # . prologue -14118 55/push-ebp -14119 89/<- %ebp 4/r32/esp -14120 # . save registers -14121 50/push-eax -14122 # if (l == 0) return -14123 81 7/subop/compare *(ebp+0xc) 0/imm32 -14124 74/jump-if-= $emit-subx-rm32:end/disp8 -14125 # var v/eax: (addr stmt-var) -14126 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax -14127 (emit-subx-var-as-rm32 *(ebp+8) %eax) -14128 $emit-subx-rm32:end: -14129 # . restore registers -14130 58/pop-to-eax -14131 # . epilogue -14132 89/<- %esp 5/r32/ebp -14133 5d/pop-to-ebp -14134 c3/return -14135 -14136 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) -14137 # . prologue -14138 55/push-ebp -14139 89/<- %ebp 4/r32/esp -14140 # . save registers -14141 51/push-ecx -14142 # eax = l -14143 8b/-> *(ebp+0xc) 0/r32/eax -14144 # ecx = stmt -14145 8b/-> *(ebp+8) 1/r32/ecx -14146 # if (l == 1) return stmt->inouts -14147 { -14148 3d/compare-eax-and 1/imm32 -14149 75/jump-if-!= break/disp8 -14150 $get-stmt-operand-from-arg-location:1: -14151 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -14152 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -14153 } -14154 # if (l == 2) return stmt->inouts->next -14155 { -14156 3d/compare-eax-and 2/imm32 -14157 75/jump-if-!= break/disp8 -14158 $get-stmt-operand-from-arg-location:2: -14159 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -14160 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -14161 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -14162 } -14163 # if (l == 3) return stmt->outputs -14164 { -14165 3d/compare-eax-and 3/imm32 -14166 75/jump-if-!= break/disp8 -14167 $get-stmt-operand-from-arg-location:3: -14168 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -14169 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -14170 } -14171 # abort -14172 e9/jump $get-stmt-operand-from-arg-location:abort/disp32 -14173 $get-stmt-operand-from-arg-location:end: -14174 # . restore registers -14175 59/pop-to-ecx -14176 # . epilogue -14177 89/<- %esp 5/r32/ebp -14178 5d/pop-to-ebp -14179 c3/return -14180 -14181 $get-stmt-operand-from-arg-location:abort: -14182 # error("invalid arg-location " eax) -14183 (write-buffered *(ebp+0x10) "invalid arg-location ") -14184 (print-int32-buffered *(ebp+0x10) %eax) -14185 (write-buffered *(ebp+0x10) Newline) -14186 (flush *(ebp+0x10)) -14187 (stop *(ebp+0x14) 1) -14188 # never gets here -14189 -14190 emit-subx-r32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -14191 # . prologue -14192 55/push-ebp -14193 89/<- %ebp 4/r32/esp -14194 # . save registers -14195 50/push-eax -14196 51/push-ecx -14197 # if (l == 0) return -14198 81 7/subop/compare *(ebp+0xc) 0/imm32 -14199 0f 84/jump-if-= $emit-subx-r32:end/disp32 -14200 # var v/eax: (addr stmt-var) -14201 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -14202 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -14203 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -14204 (maybe-get Registers %eax 0xc) # => eax: (addr register-index) -14205 (write-buffered *(ebp+8) Space) -14206 (print-int32-buffered *(ebp+8) *eax) -14207 (write-buffered *(ebp+8) "/r32") -14208 $emit-subx-r32:end: -14209 # . restore registers -14210 59/pop-to-ecx -14211 58/pop-to-eax -14212 # . epilogue -14213 89/<- %esp 5/r32/ebp -14214 5d/pop-to-ebp -14215 c3/return -14216 -14217 emit-subx-imm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -14218 # . prologue -14219 55/push-ebp -14220 89/<- %ebp 4/r32/esp -14221 # . save registers -14222 50/push-eax -14223 51/push-ecx -14224 # if (l == 0) return -14225 81 7/subop/compare *(ebp+0xc) 0/imm32 -14226 0f 84/jump-if-= $emit-subx-imm32:end/disp32 -14227 # var v/eax: (handle var) -14228 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -14229 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -14230 (lookup *eax *(eax+4)) # Var-name Var-name => eax -14231 (write-buffered *(ebp+8) Space) -14232 (write-buffered *(ebp+8) %eax) -14233 (write-buffered *(ebp+8) "/imm32") -14234 $emit-subx-imm32:end: -14235 # . restore registers -14236 59/pop-to-ecx -14237 58/pop-to-eax -14238 # . epilogue -14239 89/<- %esp 5/r32/ebp -14240 5d/pop-to-ebp -14241 c3/return -14242 -14243 emit-subx-disp32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -14244 # . prologue -14245 55/push-ebp -14246 89/<- %ebp 4/r32/esp -14247 # . save registers -14248 50/push-eax -14249 51/push-ecx -14250 # if (location == 0) return -14251 81 7/subop/compare *(ebp+0xc) 0/imm32 -14252 0f 84/jump-if-= $emit-subx-disp32:end/disp32 -14253 # var v/eax: (addr stmt-var) -14254 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax -14255 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -14256 (lookup *eax *(eax+4)) # Var-name Var-name => eax -14257 (write-buffered *(ebp+8) Space) -14258 (write-buffered *(ebp+8) %eax) -14259 # hack: if instruction operation starts with "break", emit ":break" -14260 # var name/ecx: (addr array byte) = lookup(stmt->operation) -14261 8b/-> *(ebp+0x10) 0/r32/eax -14262 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -14263 89/<- %ecx 0/r32/eax -14264 { -14265 (string-starts-with? %ecx "break") # => eax -14266 3d/compare-eax-and 0/imm32/false -14267 74/jump-if-= break/disp8 -14268 (write-buffered *(ebp+8) ":break") -14269 } -14270 # hack: if instruction operation starts with "loop", emit ":loop" -14271 { -14272 (string-starts-with? %ecx "loop") # => eax -14273 3d/compare-eax-and 0/imm32/false -14274 74/jump-if-= break/disp8 -14275 (write-buffered *(ebp+8) ":loop") -14276 } -14277 (write-buffered *(ebp+8) "/disp32") -14278 $emit-subx-disp32:end: -14279 # . restore registers -14280 59/pop-to-ecx -14281 58/pop-to-eax -14282 # . epilogue -14283 89/<- %esp 5/r32/ebp -14284 5d/pop-to-ebp -14285 c3/return -14286 -14287 emit-call: # out: (addr buffered-file), stmt: (addr stmt) -14288 # . prologue -14289 55/push-ebp -14290 89/<- %ebp 4/r32/esp -14291 # . save registers -14292 50/push-eax -14293 51/push-ecx -14294 # -14295 (emit-indent *(ebp+8) *Curr-block-depth) -14296 (write-buffered *(ebp+8) "(") -14297 # ecx = stmt -14298 8b/-> *(ebp+0xc) 1/r32/ecx -14299 # - emit function name -14300 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -14301 (write-buffered *(ebp+8) %eax) -14302 # - emit arguments -14303 # var curr/eax: (addr stmt-var) = lookup(stmt->inouts) -14304 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -14305 { -14306 # if (curr == null) break -14307 3d/compare-eax-and 0/imm32 -14308 74/jump-if-= break/disp8 -14309 # -14310 (emit-subx-call-operand *(ebp+8) %eax) -14311 # curr = lookup(curr->next) -14312 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -14313 eb/jump loop/disp8 -14314 } -14315 # -14316 (write-buffered *(ebp+8) ")\n") -14317 $emit-call:end: -14318 # . restore registers -14319 59/pop-to-ecx -14320 58/pop-to-eax -14321 # . epilogue -14322 89/<- %esp 5/r32/ebp -14323 5d/pop-to-ebp -14324 c3/return -14325 -14326 emit-subx-call-operand: # out: (addr buffered-file), s: (addr stmt-var) -14327 # shares code with emit-subx-var-as-rm32 -14328 # . prologue -14329 55/push-ebp -14330 89/<- %ebp 4/r32/esp -14331 # . save registers -14332 50/push-eax -14333 51/push-ecx -14334 56/push-esi -14335 # ecx = s -14336 8b/-> *(ebp+0xc) 1/r32/ecx -14337 # var operand/esi: (addr var) = lookup(s->value) -14338 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -14339 89/<- %esi 0/r32/eax -14340 # if (operand->register && !s->is-deref?) emit "%__" -14341 { -14342 $emit-subx-call-operand:check-for-register-direct: -14343 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -14344 74/jump-if-= break/disp8 -14345 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -14346 75/jump-if-!= break/disp8 -14347 $emit-subx-call-operand:register-direct: -14348 (write-buffered *(ebp+8) " %") -14349 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -14350 (write-buffered *(ebp+8) %eax) -14351 e9/jump $emit-subx-call-operand:end/disp32 -14352 } -14353 # else if (operand->register && s->is-deref?) emit "*__" -14354 { -14355 $emit-subx-call-operand:check-for-register-indirect: -14356 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -14357 74/jump-if-= break/disp8 -14358 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -14359 74/jump-if-= break/disp8 -14360 $emit-subx-call-operand:register-indirect: -14361 (emit-subx-call-operand-register-indirect *(ebp+8) %esi) -14362 e9/jump $emit-subx-call-operand:end/disp32 -14363 } -14364 # else if (operand->stack-offset) emit "*(ebp+__)" -14365 { -14366 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset -14367 74/jump-if-= break/disp8 -14368 $emit-subx-call-operand:stack: -14369 (emit-subx-call-operand-stack *(ebp+8) %esi) -14370 e9/jump $emit-subx-call-operand:end/disp32 -14371 } -14372 # else if (operand->type == literal) emit "__" -14373 { -14374 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax -14375 81 7/subop/compare *(eax+4) 0/imm32 # Tree-left -14376 75/jump-if-!= break/disp8 -14377 $emit-subx-call-operand:literal: -14378 (write-buffered *(ebp+8) Space) -14379 (lookup *esi *(esi+4)) # Var-name Var-name => eax -14380 (write-buffered *(ebp+8) %eax) -14381 } -14382 $emit-subx-call-operand:end: -14383 # . restore registers -14384 5e/pop-to-esi -14385 59/pop-to-ecx -14386 58/pop-to-eax -14387 # . epilogue -14388 89/<- %esp 5/r32/ebp -14389 5d/pop-to-ebp -14390 c3/return -14391 -14392 emit-subx-call-operand-register-indirect: # out: (addr buffered-file), v: (addr var) -14393 # . prologue -14394 55/push-ebp -14395 89/<- %ebp 4/r32/esp -14396 # . save registers -14397 50/push-eax -14398 51/push-ecx -14399 56/push-esi -14400 # esi = v -14401 8b/-> *(ebp+0xc) 6/r32/esi -14402 # var size/ecx: int = size-of-deref(v) -14403 (size-of-deref %esi) # => eax -14404 89/<- %ecx 0/r32/eax -14405 # var reg-name/esi: (addr array byte) = lookup(v->register) -14406 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -14407 89/<- %esi 0/r32/eax -14408 # TODO: assert size is a multiple of 4 -14409 # var i/eax: int = 0 -14410 b8/copy-to-eax 0/imm32 -14411 { -14412 $emit-subx-call-operand-register-indirect:loop: -14413 # if (i >= size) break -14414 39/compare %eax 1/r32/ecx -14415 7d/jump-if->= break/disp8 -14416 # emit " *(" v->register "+" i ")" -14417 (write-buffered *(ebp+8) " *(") -14418 (write-buffered *(ebp+8) %esi) -14419 (write-buffered *(ebp+8) "+") -14420 (print-int32-buffered *(ebp+8) %eax) -14421 (write-buffered *(ebp+8) ")") -14422 # i += 4 -14423 05/add-to-eax 4/imm32 -14424 # -14425 eb/jump loop/disp8 -14426 } -14427 $emit-subx-call-operand-register-indirect:end: -14428 # . restore registers -14429 5e/pop-to-esi -14430 59/pop-to-ecx -14431 58/pop-to-eax -14432 # . epilogue -14433 89/<- %esp 5/r32/ebp -14434 5d/pop-to-ebp -14435 c3/return -14436 -14437 emit-subx-call-operand-stack: # out: (addr buffered-file), v: (addr var) -14438 # . prologue -14439 55/push-ebp -14440 89/<- %ebp 4/r32/esp -14441 # . save registers -14442 50/push-eax -14443 51/push-ecx -14444 56/push-esi -14445 # esi = v -14446 8b/-> *(ebp+0xc) 6/r32/esi -14447 # var curr/ecx: int = v->offset -14448 8b/-> *(esi+0x14) 1/r32/ecx # Var-offset -14449 # var max/eax: int = v->offset + size-of(v) -14450 (size-of %esi) # => eax -14451 # TODO: assert size is a multiple of 4 -14452 01/add-to %eax 1/r32/ecx -14453 { -14454 $emit-subx-call-operand-stack:loop: -14455 # if (curr >= max) break -14456 39/compare %ecx 0/r32/eax -14457 7d/jump-if->= break/disp8 -14458 # emit " *(ebp+" curr ")" -14459 (write-buffered *(ebp+8) " *(ebp+") -14460 (print-int32-buffered *(ebp+8) %ecx) -14461 (write-buffered *(ebp+8) ")") -14462 # i += 4 -14463 81 0/subop/add %ecx 4/imm32 -14464 # -14465 eb/jump loop/disp8 -14466 } -14467 $emit-subx-call-operand-stack:end: -14468 # . restore registers -14469 5e/pop-to-esi -14470 59/pop-to-ecx -14471 58/pop-to-eax -14472 # . epilogue -14473 89/<- %esp 5/r32/ebp -14474 5d/pop-to-ebp -14475 c3/return -14476 -14477 emit-subx-var-as-rm32: # out: (addr buffered-file), s: (addr stmt-var) -14478 # . prologue -14479 55/push-ebp -14480 89/<- %ebp 4/r32/esp -14481 # . save registers -14482 50/push-eax -14483 51/push-ecx -14484 56/push-esi -14485 # ecx = s -14486 8b/-> *(ebp+0xc) 1/r32/ecx -14487 # var operand/esi: (addr var) = lookup(s->value) -14488 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -14489 89/<- %esi 0/r32/eax -14490 # if (operand->register && s->is-deref?) emit "*__" -14491 { -14492 $emit-subx-var-as-rm32:check-for-register-indirect: -14493 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -14494 74/jump-if-= break/disp8 -14495 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -14496 74/jump-if-= break/disp8 -14497 $emit-subx-var-as-rm32:register-indirect: -14498 (write-buffered *(ebp+8) " *") -14499 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -14500 (write-buffered *(ebp+8) %eax) -14501 e9/jump $emit-subx-var-as-rm32:end/disp32 -14502 } -14503 # if (operand->register && !s->is-deref?) emit "%__" -14504 { -14505 $emit-subx-var-as-rm32:check-for-register-direct: -14506 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -14507 74/jump-if-= break/disp8 -14508 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -14509 75/jump-if-!= break/disp8 -14510 $emit-subx-var-as-rm32:register-direct: -14511 (write-buffered *(ebp+8) " %") -14512 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -14513 (write-buffered *(ebp+8) %eax) -14514 e9/jump $emit-subx-var-as-rm32:end/disp32 -14515 } -14516 # else if (operand->stack-offset) emit "*(ebp+__)" -14517 { -14518 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset -14519 74/jump-if-= break/disp8 -14520 $emit-subx-var-as-rm32:stack: -14521 (write-buffered *(ebp+8) Space) -14522 (write-buffered *(ebp+8) "*(ebp+") -14523 (print-int32-buffered *(ebp+8) *(esi+0x14)) # Var-offset -14524 (write-buffered *(ebp+8) ")") -14525 } -14526 $emit-subx-var-as-rm32:end: -14527 # . restore registers -14528 5e/pop-to-esi -14529 59/pop-to-ecx -14530 58/pop-to-eax -14531 # . epilogue -14532 89/<- %esp 5/r32/ebp -14533 5d/pop-to-ebp -14534 c3/return -14535 -14536 find-matching-primitive: # primitives: (addr primitive), stmt: (addr stmt) -> result/eax: (addr primitive) -14537 # . prologue -14538 55/push-ebp -14539 89/<- %ebp 4/r32/esp -14540 # . save registers -14541 51/push-ecx -14542 # var curr/ecx: (addr primitive) = primitives -14543 8b/-> *(ebp+8) 1/r32/ecx -14544 { -14545 $find-matching-primitive:loop: -14546 # if (curr == null) break -14547 81 7/subop/compare %ecx 0/imm32 -14548 0f 84/jump-if-= break/disp32 -14549 # if match(curr, stmt) return curr -14550 { -14551 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx) # => eax -14552 3d/compare-eax-and 0/imm32/false -14553 74/jump-if-= break/disp8 -14554 89/<- %eax 1/r32/ecx -14555 eb/jump $find-matching-primitive:end/disp8 -14556 } -14557 $find-matching-primitive:next-primitive: -14558 # curr = curr->next -14559 (lookup *(ecx+0x34) *(ecx+0x38)) # Primitive-next Primitive-next => eax -14560 89/<- %ecx 0/r32/eax -14561 # -14562 e9/jump loop/disp32 -14563 } -14564 # return null -14565 b8/copy-to-eax 0/imm32 -14566 $find-matching-primitive:end: -14567 # . restore registers -14568 59/pop-to-ecx -14569 # . epilogue -14570 89/<- %esp 5/r32/ebp -14571 5d/pop-to-ebp -14572 c3/return -14573 -14574 mu-stmt-matches-primitive?: # stmt: (addr stmt), primitive: (addr primitive) -> result/eax: boolean -14575 # A mu stmt matches a primitive if the name matches, all the inout vars -14576 # match, and all the output vars match. -14577 # Vars match if types match and registers match. -14578 # In addition, a stmt output matches a primitive's output if types match -14579 # and the primitive has a wildcard register. -14580 # . prologue -14581 55/push-ebp -14582 89/<- %ebp 4/r32/esp -14583 # . save registers -14584 51/push-ecx -14585 52/push-edx -14586 53/push-ebx -14587 56/push-esi -14588 57/push-edi -14589 # ecx = stmt -14590 8b/-> *(ebp+8) 1/r32/ecx -14591 # edx = primitive -14592 8b/-> *(ebp+0xc) 2/r32/edx -14593 { -14594 $mu-stmt-matches-primitive?:check-name: -14595 # if (primitive->name != stmt->operation) return false -14596 # . var esi: (addr array byte) = lookup(stmt->operation) -14597 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -14598 89/<- %esi 0/r32/eax -14599 # . var edi: (addr array byte) = lookup(primitive->name) -14600 (lookup *edx *(edx+4)) # Primitive-name Primitive-name => eax -14601 89/<- %edi 0/r32/eax -14602 (string-equal? %esi %edi) # => eax -14603 3d/compare-eax-and 0/imm32/false -14604 75/jump-if-!= break/disp8 -14605 b8/copy-to-eax 0/imm32 -14606 e9/jump $mu-stmt-matches-primitive?:end/disp32 -14607 } -14608 # var curr/esi: (addr stmt-var) = lookup(stmt->inouts) -14609 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -14610 89/<- %esi 0/r32/eax -14611 # var curr2/edi: (addr list var) = lookup(primitive->inouts) -14612 (lookup *(edx+8) *(edx+0xc)) # Primitive-inouts Primitive-inouts => eax -14613 89/<- %edi 0/r32/eax -14614 { -14615 $mu-stmt-matches-primitive?:inouts-loop: -14616 # if (curr == 0 && curr2 == 0) move on to check outputs -14617 { -14618 $mu-stmt-matches-primitive?:check-both-inouts-null: -14619 81 7/subop/compare %esi 0/imm32 -14620 75/jump-if-!= break/disp8 -14621 $mu-stmt-matches-primitive?:stmt-inout-null: -14622 81 7/subop/compare %edi 0/imm32 -14623 0f 84/jump-if-= $mu-stmt-matches-primitive?:check-outputs/disp32 -14624 $mu-stmt-matches-primitive?:stmt-inout-null-and-prim-inout-not-null: -14625 # return false -14626 b8/copy-to-eax 0/imm32/false -14627 e9/jump $mu-stmt-matches-primitive?:end/disp32 -14628 } -14629 # if (curr2 == 0) return false -14630 { -14631 $mu-stmt-matches-primitive?:check-prim-inout-null: -14632 81 7/subop/compare %edi 0/imm32 -14633 75/jump-if-!= break/disp8 -14634 $mu-stmt-matches-primitive?:prim-inout-null: -14635 b8/copy-to-eax 0/imm32/false -14636 e9/jump $mu-stmt-matches-primitive?:end/disp32 -14637 } -14638 # if (curr != curr2) return false -14639 { -14640 $mu-stmt-matches-primitive?:check-inouts-match: -14641 (lookup *edi *(edi+4)) # List-value List-value => eax -14642 (operand-matches-primitive? %esi %eax) # => eax -14643 3d/compare-eax-and 0/imm32/false -14644 75/jump-if-!= break/disp8 -14645 $mu-stmt-matches-primitive?:inouts-match: -14646 b8/copy-to-eax 0/imm32/false -14647 e9/jump $mu-stmt-matches-primitive?:end/disp32 -14648 } -14649 $mu-stmt-matches-primitive?:next-inout: -14650 # curr = lookup(curr->next) -14651 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -14652 89/<- %esi 0/r32/eax -14653 # curr2 = lookup(curr2->next) -14654 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -14655 89/<- %edi 0/r32/eax -14656 # -14657 e9/jump loop/disp32 -14658 } -14659 $mu-stmt-matches-primitive?:check-outputs: -14660 # var curr/esi: (addr stmt-var) = lookup(stmt->outputs) -14661 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -14662 89/<- %esi 0/r32/eax -14663 # var curr2/edi: (addr list var) = lookup(primitive->outputs) -14664 (lookup *(edx+0x10) *(edx+0x14)) # Primitive-outputs Primitive-outputs => eax -14665 89/<- %edi 0/r32/eax -14666 { -14667 $mu-stmt-matches-primitive?:outputs-loop: -14668 # if (curr == 0) return (curr2 == 0) -14669 { -14670 $mu-stmt-matches-primitive?:check-both-outputs-null: -14671 81 7/subop/compare %esi 0/imm32 -14672 75/jump-if-!= break/disp8 -14673 { -14674 $mu-stmt-matches-primitive?:stmt-output-null: -14675 81 7/subop/compare %edi 0/imm32 -14676 75/jump-if-!= break/disp8 -14677 $mu-stmt-matches-primitive?:both-outputs-null: -14678 # return true -14679 b8/copy-to-eax 1/imm32 -14680 e9/jump $mu-stmt-matches-primitive?:end/disp32 -14681 } -14682 $mu-stmt-matches-primitive?:stmt-output-null-and-prim-output-not-null: -14683 # return false -14684 b8/copy-to-eax 0/imm32 -14685 e9/jump $mu-stmt-matches-primitive?:end/disp32 -14686 } -14687 # if (curr2 == 0) return false -14688 { -14689 $mu-stmt-matches-primitive?:check-prim-output-null: -14690 81 7/subop/compare %edi 0/imm32 -14691 75/jump-if-!= break/disp8 -14692 $mu-stmt-matches-primitive?:prim-output-is-null: -14693 b8/copy-to-eax 0/imm32 -14694 e9/jump $mu-stmt-matches-primitive?:end/disp32 -14695 } -14696 # if (curr != curr2) return false -14697 { -14698 $mu-stmt-matches-primitive?:check-outputs-match: -14699 (lookup *edi *(edi+4)) # List-value List-value => eax -14700 (operand-matches-primitive? %esi %eax) # => eax -14701 3d/compare-eax-and 0/imm32/false -14702 75/jump-if-!= break/disp8 -14703 $mu-stmt-matches-primitive?:outputs-match: -14704 b8/copy-to-eax 0/imm32 -14705 e9/jump $mu-stmt-matches-primitive?:end/disp32 -14706 } -14707 $mu-stmt-matches-primitive?:next-output: -14708 # curr = lookup(curr->next) -14709 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -14710 89/<- %esi 0/r32/eax -14711 # curr2 = lookup(curr2->next) -14712 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -14713 89/<- %edi 0/r32/eax -14714 # -14715 e9/jump loop/disp32 -14716 } -14717 $mu-stmt-matches-primitive?:return-true: -14718 b8/copy-to-eax 1/imm32 -14719 $mu-stmt-matches-primitive?:end: -14720 # . restore registers -14721 5f/pop-to-edi -14722 5e/pop-to-esi -14723 5b/pop-to-ebx -14724 5a/pop-to-edx -14725 59/pop-to-ecx -14726 # . epilogue -14727 89/<- %esp 5/r32/ebp -14728 5d/pop-to-ebp -14729 c3/return -14730 -14731 operand-matches-primitive?: # s: (addr stmt-var), prim-var: (addr var) -> result/eax: boolean -14732 # . prologue -14733 55/push-ebp -14734 89/<- %ebp 4/r32/esp -14735 # . save registers -14736 51/push-ecx -14737 52/push-edx -14738 53/push-ebx -14739 56/push-esi -14740 57/push-edi -14741 # ecx = s -14742 8b/-> *(ebp+8) 1/r32/ecx -14743 # var var/esi: (addr var) = lookup(s->value) -14744 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -14745 89/<- %esi 0/r32/eax -14746 # edi = prim-var -14747 8b/-> *(ebp+0xc) 7/r32/edi -14748 $operand-matches-primitive?:check-type: -14749 # if (var->type != prim-var->type) return false -14750 # . var vtype/ebx: (addr tree type-id) = lookup(var->type) -14751 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax -14752 89/<- %ebx 0/r32/eax -14753 # . var ptype/eax: (addr tree type-id) = lookup(prim-var->type) -14754 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -14755 (subx-type-equal? %ebx %eax) # => eax -14756 3d/compare-eax-and 0/imm32/false -14757 0f 84/jump-if-= $operand-matches-primitive?:return-false/disp32 -14758 { -14759 $operand-matches-primitive?:check-register: -14760 # if prim-var is in memory and var is in register but dereference, match -14761 { -14762 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register -14763 0f 85/jump-if-!= break/disp32 -14764 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -14765 74/jump-if-= break/disp8 -14766 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -14767 74/jump-if-= break/disp8 -14768 $operand-matches-primitive?:var-deref-match: -14769 e9/jump $operand-matches-primitive?:return-true/disp32 -14770 } -14771 # if prim-var is in register and var is in register but dereference, no match -14772 { -14773 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register -14774 0f 84/jump-if-= break/disp32 -14775 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -14776 0f 84/jump-if-= break/disp32 -14777 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -14778 74/jump-if-= break/disp8 -14779 $operand-matches-primitive?:var-deref-no-match: -14780 e9/jump $operand-matches-primitive?:return-false/disp32 -14781 } -14782 # return false if var->register doesn't match prim-var->register -14783 { -14784 # if register addresses are equal, it's a match -14785 # var vreg/ebx: (addr array byte) = lookup(var->register) -14786 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -14787 89/<- %ebx 0/r32/eax -14788 # var preg/ecx: (addr array byte) = lookup(prim-var->register) -14789 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax -14790 89/<- %ecx 0/r32/eax -14791 # if (vreg == preg) break -14792 39/compare %ecx 3/r32/ebx -14793 74/jump-if-= break/disp8 -14794 $operand-matches-primitive?:var-register-no-match: -14795 # if either address is 0, return false -14796 81 7/subop/compare %ebx 0/imm32 -14797 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -14798 81 7/subop/compare %ecx 0/imm32 -14799 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -14800 # if prim-var->register is wildcard, it's a match -14801 (string-equal? %ecx "*") # Any-register => eax -14802 3d/compare-eax-and 0/imm32/false -14803 75/jump-if-!= break/disp8 -14804 $operand-matches-primitive?:wildcard-no-match: -14805 # if string contents aren't equal, return false -14806 (string-equal? %ecx %ebx) # => eax -14807 3d/compare-eax-and 0/imm32/false -14808 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -14809 } -14810 } -14811 $operand-matches-primitive?:return-true: -14812 b8/copy-to-eax 1/imm32/true -14813 eb/jump $operand-matches-primitive?:end/disp8 -14814 $operand-matches-primitive?:return-false: -14815 b8/copy-to-eax 0/imm32/false -14816 $operand-matches-primitive?:end: -14817 # . restore registers -14818 5f/pop-to-edi -14819 5e/pop-to-esi -14820 5b/pop-to-ebx -14821 5a/pop-to-edx -14822 59/pop-to-ecx -14823 # . epilogue -14824 89/<- %esp 5/r32/ebp -14825 5d/pop-to-ebp -14826 c3/return -14827 -14828 subx-type-equal?: # a: (addr tree type-id), b: (addr tree type-id) -> result/eax: boolean -14829 # . prologue -14830 55/push-ebp -14831 89/<- %ebp 4/r32/esp -14832 # . save registers -14833 51/push-ecx -14834 # var alit/ecx: boolean = is-literal-type?(a) -14835 (is-simple-mu-type? *(ebp+8) 0) # => eax -14836 89/<- %ecx 0/r32/eax -14837 # var blit/eax: boolean = is-literal-type?(b) -14838 (is-simple-mu-type? *(ebp+0xc) 0) # => eax -14839 # return alit == blit -14840 39/compare %eax 1/r32/ecx -14841 0f 94/set-byte-if-= %al -14842 81 4/subop/and %eax 0xff/imm32 -14843 $subx-type-equal?:end: -14844 # . restore registers -14845 59/pop-to-ecx -14846 # . epilogue -14847 89/<- %esp 5/r32/ebp -14848 5d/pop-to-ebp -14849 c3/return +14054 # "loop-if->" +14055 0x9/imm32/size +14056 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> +14057 _string-loop-if->=: # (payload array byte) +14058 0x11/imm32/alloc-id:fake:payload +14059 # "loop-if->=" +14060 0xa/imm32/size +14061 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= +14062 _string-loop-if-!=: # (payload array byte) +14063 0x11/imm32/alloc-id:fake:payload +14064 # "loop-if-!=" +14065 0xa/imm32/size +14066 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= +14067 _string-loop-if-addr<: # (payload array byte) +14068 0x11/imm32/alloc-id:fake:payload +14069 # "loop-if-addr<" +14070 0xd/imm32/size +14071 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/< +14072 _string-loop-if-addr<=: # (payload array byte) +14073 0x11/imm32/alloc-id:fake:payload +14074 # "loop-if-addr<=" +14075 0xe/imm32/size +14076 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/= +14077 _string-loop-if-addr>: # (payload array byte) +14078 0x11/imm32/alloc-id:fake:payload +14079 # "loop-if-addr>" +14080 0xd/imm32/size +14081 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/> +14082 _string-loop-if-addr>=: # (payload array byte) +14083 0x11/imm32/alloc-id:fake:payload +14084 # "loop-if-addr>=" +14085 0xe/imm32/size +14086 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/= +14087 _string-multiply: # (payload array byte) +14088 0x11/imm32/alloc-id:fake:payload +14089 # "multiply" +14090 0x8/imm32/size +14091 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y +14092 _string-or: # (payload array byte) +14093 0x11/imm32/alloc-id:fake:payload +14094 # "or" +14095 0x2/imm32/size +14096 0x6f/o 0x72/r +14097 _string-or-with: # (payload array byte) +14098 0x11/imm32/alloc-id:fake:payload +14099 # "or-with" +14100 0x7/imm32/size +14101 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +14102 _string-subtract: # (payload array byte) +14103 0x11/imm32/alloc-id:fake:payload +14104 # "subtract" +14105 0x8/imm32/size +14106 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t +14107 _string-subtract-from: # (payload array byte) +14108 0x11/imm32/alloc-id:fake:payload +14109 # "subtract-from" +14110 0xd/imm32/size +14111 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 +14112 _string-xor: # (payload array byte) +14113 0x11/imm32/alloc-id:fake:payload +14114 # "xor" +14115 0x3/imm32/size +14116 0x78/x 0x6f/o 0x72/r +14117 _string-xor-with: # (payload array byte) +14118 0x11/imm32/alloc-id:fake:payload +14119 # "xor-with" +14120 0x8/imm32/size +14121 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +14122 +14123 # string literals for SubX instructions +14124 _string_01_add_to: # (payload array byte) +14125 0x11/imm32/alloc-id:fake:payload +14126 # "01/add-to" +14127 0x9/imm32/size +14128 0x30/0 0x31/1 0x2f/slash 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o +14129 _string_03_add: # (payload array byte) +14130 0x11/imm32/alloc-id:fake:payload +14131 # "03/add" +14132 0x6/imm32/size +14133 0x30/0 0x33/3 0x2f/slash 0x61/a 0x64/d 0x64/d +14134 _string_05_add_to_eax: # (payload array byte) +14135 0x11/imm32/alloc-id:fake:payload +14136 # "05/add-to-eax" +14137 0xd/imm32/size +14138 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 +14139 _string_09_or_with: # (payload array byte) +14140 0x11/imm32/alloc-id:fake:payload +14141 # "09/or-with" +14142 0xa/imm32/size +14143 0x30/0 0x39/9 0x2f/slash 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +14144 _string_0b_or: # (payload array byte) +14145 0x11/imm32/alloc-id:fake:payload +14146 # "0b/or" +14147 0x5/imm32/size +14148 0x30/0 0x62/b 0x2f/slash 0x6f/o 0x72/r +14149 _string_0d_or_with_eax: # (payload array byte) +14150 0x11/imm32/alloc-id:fake:payload +14151 # "0d/or-with-eax" +14152 0xe/imm32/size +14153 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 +14154 _string_0f_82_jump_label: # (payload array byte) +14155 0x11/imm32/alloc-id:fake:payload +14156 # "0f 82/jump-if-addr<" +14157 0x13/imm32/size +14158 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/< +14159 _string_0f_82_jump_break: # (payload array byte) +14160 0x11/imm32/alloc-id:fake:payload +14161 # "0f 82/jump-if-addr< break/disp32" +14162 0x20/imm32/size +14163 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 +14164 _string_0f_82_jump_loop: # (payload array byte) +14165 0x11/imm32/alloc-id:fake:payload +14166 # "0f 82/jump-if-addr< loop/disp32" +14167 0x1f/imm32/size +14168 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 +14169 _string_0f_83_jump_label: # (payload array byte) +14170 0x11/imm32/alloc-id:fake:payload +14171 # "0f 83/jump-if-addr>=" +14172 0x14/imm32/size +14173 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/= +14174 _string_0f_83_jump_break: # (payload array byte) +14175 0x11/imm32/alloc-id:fake:payload +14176 # "0f 83/jump-if-addr>= break/disp32" +14177 0x21/imm32/size +14178 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 +14179 _string_0f_83_jump_loop: # (payload array byte) +14180 0x11/imm32/alloc-id:fake:payload +14181 # "0f 83/jump-if-addr>= loop/disp32" +14182 0x20/imm32/size +14183 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 +14184 _string_0f_84_jump_label: # (payload array byte) +14185 0x11/imm32/alloc-id:fake:payload +14186 # "0f 84/jump-if-=" +14187 0xf/imm32/size +14188 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/= +14189 _string_0f_84_jump_break: # (payload array byte) +14190 0x11/imm32/alloc-id:fake:payload +14191 # "0f 84/jump-if-= break/disp32" +14192 0x1c/imm32/size +14193 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 +14194 _string_0f_84_jump_loop: # (payload array byte) +14195 0x11/imm32/alloc-id:fake:payload +14196 # "0f 84/jump-if-= loop/disp32" +14197 0x1b/imm32/size +14198 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 +14199 _string_0f_85_jump_label: # (payload array byte) +14200 0x11/imm32/alloc-id:fake:payload +14201 # "0f 85/jump-if-!=" +14202 0x10/imm32/size +14203 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/= +14204 _string_0f_85_jump_break: # (payload array byte) +14205 0x11/imm32/alloc-id:fake:payload +14206 # "0f 85/jump-if-!= break/disp32" +14207 0x1d/imm32/size +14208 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 +14209 _string_0f_85_jump_loop: # (payload array byte) +14210 0x11/imm32/alloc-id:fake:payload +14211 # "0f 85/jump-if-!= loop/disp32" +14212 0x1c/imm32/size +14213 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 +14214 _string_0f_86_jump_label: # (payload array byte) +14215 0x11/imm32/alloc-id:fake:payload +14216 # "0f 86/jump-if-addr<=" +14217 0x14/imm32/size +14218 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/= +14219 _string_0f_86_jump_break: # (payload array byte) +14220 0x11/imm32/alloc-id:fake:payload +14221 # "0f 86/jump-if-addr<= break/disp32" +14222 0x21/imm32/size +14223 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 +14224 _string_0f_86_jump_loop: # (payload array byte) +14225 0x11/imm32/alloc-id:fake:payload +14226 # "0f 86/jump-if-addr<= loop/disp32" +14227 0x20/imm32/size +14228 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 +14229 _string_0f_87_jump_label: # (payload array byte) +14230 0x11/imm32/alloc-id:fake:payload +14231 # "0f 87/jump-if-addr>" +14232 0x13/imm32/size +14233 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/> +14234 _string_0f_87_jump_break: # (payload array byte) +14235 0x11/imm32/alloc-id:fake:payload +14236 # "0f 87/jump-if-addr> break/disp32" +14237 0x20/imm32/size +14238 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 +14239 _string_0f_87_jump_loop: # (payload array byte) +14240 0x11/imm32/alloc-id:fake:payload +14241 # "0f 87/jump-if-addr> loop/disp32" +14242 0x1f/imm32/size +14243 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 +14244 _string_0f_8c_jump_label: # (payload array byte) +14245 0x11/imm32/alloc-id:fake:payload +14246 # "0f 8c/jump-if-<" +14247 0xf/imm32/size +14248 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/< +14249 _string_0f_8c_jump_break: # (payload array byte) +14250 0x11/imm32/alloc-id:fake:payload +14251 # "0f 8c/jump-if-< break/disp32" +14252 0x1c/imm32/size +14253 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 +14254 _string_0f_8c_jump_loop: # (payload array byte) +14255 0x11/imm32/alloc-id:fake:payload +14256 # "0f 8c/jump-if-< loop/disp32" +14257 0x1b/imm32/size +14258 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 +14259 _string_0f_8d_jump_label: # (payload array byte) +14260 0x11/imm32/alloc-id:fake:payload +14261 # "0f 8d/jump-if->=" +14262 0x10/imm32/size +14263 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/= +14264 _string_0f_8d_jump_break: # (payload array byte) +14265 0x11/imm32/alloc-id:fake:payload +14266 # "0f 8d/jump-if->= break/disp32" +14267 0x1d/imm32/size +14268 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 +14269 _string_0f_8d_jump_loop: # (payload array byte) +14270 0x11/imm32/alloc-id:fake:payload +14271 # "0f 8d/jump-if->= loop/disp32" +14272 0x1c/imm32/size +14273 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 +14274 _string_0f_8e_jump_label: # (payload array byte) +14275 0x11/imm32/alloc-id:fake:payload +14276 # "0f 8e/jump-if-<=" +14277 0x10/imm32/size +14278 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/= +14279 _string_0f_8e_jump_break: # (payload array byte) +14280 0x11/imm32/alloc-id:fake:payload +14281 # "0f 8e/jump-if-<= break/disp32" +14282 0x1d/imm32/size +14283 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 +14284 _string_0f_8e_jump_loop: # (payload array byte) +14285 0x11/imm32/alloc-id:fake:payload +14286 # "0f 8e/jump-if-<= loop/disp32" +14287 0x1c/imm32/size +14288 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 +14289 _string_0f_8f_jump_label: # (payload array byte) +14290 0x11/imm32/alloc-id:fake:payload +14291 # "0f 8f/jump-if->" +14292 0xf/imm32/size +14293 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/> +14294 _string_0f_8f_jump_break: # (payload array byte) +14295 0x11/imm32/alloc-id:fake:payload +14296 # "0f 8f/jump-if-> break/disp32" +14297 0x1c/imm32/size +14298 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 +14299 _string_0f_8f_jump_loop: # (payload array byte) +14300 0x11/imm32/alloc-id:fake:payload +14301 # "0f 8f/jump-if-> loop/disp32" +14302 0x1b/imm32/size +14303 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 +14304 _string_0f_af_multiply: # (payload array byte) +14305 0x11/imm32/alloc-id:fake:payload +14306 # "0f af/multiply" +14307 0xe/imm32/size +14308 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 +14309 _string_21_and_with: # (payload array byte) +14310 0x11/imm32/alloc-id:fake:payload +14311 # "21/and-with" +14312 0xb/imm32/size +14313 0x32/2 0x31/1 0x2f/slash 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +14314 _string_23_and: # (payload array byte) +14315 0x11/imm32/alloc-id:fake:payload +14316 # "23/and" +14317 0x6/imm32/size +14318 0x32/2 0x33/3 0x2f/slash 0x61/a 0x6e/n 0x64/d +14319 _string_25_and_with_eax: # (payload array byte) +14320 0x11/imm32/alloc-id:fake:payload +14321 # "25/and-with-eax" +14322 0xf/imm32/size +14323 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 +14324 _string_29_subtract_from: # (payload array byte) +14325 0x11/imm32/alloc-id:fake:payload +14326 # "29/subtract-from" +14327 0x10/imm32/size +14328 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 +14329 _string_2b_subtract: # (payload array byte) +14330 0x11/imm32/alloc-id:fake:payload +14331 # "2b/subtract" +14332 0xb/imm32/size +14333 0x32/2 0x62/b 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t +14334 _string_2d_subtract_from_eax: # (payload array byte) +14335 0x11/imm32/alloc-id:fake:payload +14336 # "2d/subtract-from-eax" +14337 0x14/imm32/size +14338 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 +14339 _string_31_xor_with: # (payload array byte) +14340 0x11/imm32/alloc-id:fake:payload +14341 # "31/xor-with" +14342 0xb/imm32/size +14343 0x33/3 0x31/1 0x2f/slash 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +14344 _string_33_xor: # (payload array byte) +14345 0x11/imm32/alloc-id:fake:payload +14346 # "33/xor" +14347 0x6/imm32/size +14348 0x33/3 0x33/3 0x2f/slash 0x78/x 0x6f/o 0x72/r +14349 _string_35_xor_with_eax: # (payload array byte) +14350 0x11/imm32/alloc-id:fake:payload +14351 # "35/xor-with-eax" +14352 0xf/imm32/size +14353 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 +14354 _string_39_compare->: # (payload array byte) +14355 0x11/imm32/alloc-id:fake:payload +14356 # "39/compare->" +14357 0xc/imm32/size +14358 0x33/3 0x39/9 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x2d/dash 0x3e/> +14359 _string_3b_compare<-: # (payload array byte) +14360 0x11/imm32/alloc-id:fake:payload +14361 # "3b/compare<-" +14362 0xc/imm32/size +14363 0x33/3 0x62/b 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x3c/< 0x2d/dash +14364 _string_3d_compare_eax_with: # (payload array byte) +14365 0x11/imm32/alloc-id:fake:payload +14366 # "3d/compare-eax-with" +14367 0x13/imm32/size +14368 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 +14369 _string_40_increment_eax: # (payload array byte) +14370 0x11/imm32/alloc-id:fake:payload +14371 # "40/increment-eax" +14372 0x10/imm32/size +14373 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 +14374 _string_41_increment_ecx: # (payload array byte) +14375 0x11/imm32/alloc-id:fake:payload +14376 # "41/increment-ecx" +14377 0x10/imm32/size +14378 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 +14379 _string_42_increment_edx: # (payload array byte) +14380 0x11/imm32/alloc-id:fake:payload +14381 # "42/increment-edx" +14382 0x10/imm32/size +14383 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 +14384 _string_43_increment_ebx: # (payload array byte) +14385 0x11/imm32/alloc-id:fake:payload +14386 # "43/increment-ebx" +14387 0x10/imm32/size +14388 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 +14389 _string_46_increment_esi: # (payload array byte) +14390 0x11/imm32/alloc-id:fake:payload +14391 # "46/increment-esi" +14392 0x10/imm32/size +14393 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 +14394 _string_47_increment_edi: # (payload array byte) +14395 0x11/imm32/alloc-id:fake:payload +14396 # "47/increment-edi" +14397 0x10/imm32/size +14398 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 +14399 _string_48_decrement_eax: # (payload array byte) +14400 0x11/imm32/alloc-id:fake:payload +14401 # "48/decrement-eax" +14402 0x10/imm32/size +14403 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 +14404 _string_49_decrement_ecx: # (payload array byte) +14405 0x11/imm32/alloc-id:fake:payload +14406 # "49/decrement-ecx" +14407 0x10/imm32/size +14408 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 +14409 _string_4a_decrement_edx: # (payload array byte) +14410 0x11/imm32/alloc-id:fake:payload +14411 # "4a/decrement-edx" +14412 0x10/imm32/size +14413 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 +14414 _string_4b_decrement_ebx: # (payload array byte) +14415 0x11/imm32/alloc-id:fake:payload +14416 # "4b/decrement-ebx" +14417 0x10/imm32/size +14418 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 +14419 _string_4e_decrement_esi: # (payload array byte) +14420 0x11/imm32/alloc-id:fake:payload +14421 # "4e/decrement-esi" +14422 0x10/imm32/size +14423 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 +14424 _string_4f_decrement_edi: # (payload array byte) +14425 0x11/imm32/alloc-id:fake:payload +14426 # "4f/decrement-edi" +14427 0x10/imm32/size +14428 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 +14429 _string_81_subop_add: # (payload array byte) +14430 0x11/imm32/alloc-id:fake:payload +14431 # "81 0/subop/add" +14432 0xe/imm32/size +14433 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 +14434 _string_81_subop_or: # (payload array byte) +14435 0x11/imm32/alloc-id:fake:payload +14436 # "81 1/subop/or" +14437 0xd/imm32/size +14438 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 +14439 _string_81_subop_and: # (payload array byte) +14440 0x11/imm32/alloc-id:fake:payload +14441 # "81 4/subop/and" +14442 0xe/imm32/size +14443 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 +14444 _string_81_subop_subtract: # (payload array byte) +14445 0x11/imm32/alloc-id:fake:payload +14446 # "81 5/subop/subtract" +14447 0x13/imm32/size +14448 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 +14449 _string_81_subop_xor: # (payload array byte) +14450 0x11/imm32/alloc-id:fake:payload +14451 # "81 6/subop/xor" +14452 0xe/imm32/size +14453 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 +14454 _string_81_subop_compare: # (payload array byte) +14455 0x11/imm32/alloc-id:fake:payload +14456 # "81 7/subop/compare" +14457 0x12/imm32/size +14458 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 +14459 _string_89_<-: # (payload array byte) +14460 0x11/imm32/alloc-id:fake:payload +14461 # "89/<-" +14462 0x5/imm32/size +14463 0x38/8 0x39/9 0x2f/slash 0x3c/< 0x2d/dash +14464 _string_8b_->: # (payload array byte) +14465 0x11/imm32/alloc-id:fake:payload +14466 # "8b/->" +14467 0x5/imm32/size +14468 0x38/8 0x62/b 0x2f/slash 0x2d/dash 0x3e/> +14469 _string_8a_copy_byte: +14470 0x11/imm32/alloc-id:fake:payload +14471 # "8a/byte->" +14472 0x9/imm32/size +14473 0x38/8 0x61/a 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x3e/> +14474 _string_88_copy_byte: +14475 0x11/imm32/alloc-id:fake:payload +14476 # "88/byte<-" +14477 0x9/imm32/size +14478 0x38/8 0x38/8 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x3c/< 0x2d/- +14479 _string_8d_copy_address: # (payload array byte) +14480 0x11/imm32/alloc-id:fake:payload +14481 # "8d/copy-address" +14482 0xf/imm32/size +14483 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 +14484 _string_b8_copy_to_eax: # (payload array byte) +14485 0x11/imm32/alloc-id:fake:payload +14486 # "b8/copy-to-eax" +14487 0xe/imm32/size +14488 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 +14489 _string_b9_copy_to_ecx: # (payload array byte) +14490 0x11/imm32/alloc-id:fake:payload +14491 # "b9/copy-to-ecx" +14492 0xe/imm32/size +14493 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 +14494 _string_ba_copy_to_edx: # (payload array byte) +14495 0x11/imm32/alloc-id:fake:payload +14496 # "ba/copy-to-edx" +14497 0xe/imm32/size +14498 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 +14499 _string_bb_copy_to_ebx: # (payload array byte) +14500 0x11/imm32/alloc-id:fake:payload +14501 # "bb/copy-to-ebx" +14502 0xe/imm32/size +14503 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 +14504 _string_be_copy_to_esi: # (payload array byte) +14505 0x11/imm32/alloc-id:fake:payload +14506 # "be/copy-to-esi" +14507 0xe/imm32/size +14508 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 +14509 _string_bf_copy_to_edi: # (payload array byte) +14510 0x11/imm32/alloc-id:fake:payload +14511 # "bf/copy-to-edi" +14512 0xe/imm32/size +14513 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 +14514 _string_c7_subop_copy: # (payload array byte) +14515 0x11/imm32/alloc-id:fake:payload +14516 # "c7 0/subop/copy" +14517 0xf/imm32/size +14518 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 +14519 _string_e9_jump_label: # (payload array byte) +14520 0x11/imm32/alloc-id:fake:payload +14521 # "e9/jump" +14522 0x7/imm32/size +14523 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p +14524 _string_e9_jump_break: # (payload array byte) +14525 0x11/imm32/alloc-id:fake:payload +14526 # "e9/jump break/disp32" +14527 0x14/imm32/size +14528 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 +14529 _string_e9_jump_loop: # (payload array byte) +14530 0x11/imm32/alloc-id:fake:payload +14531 # "e9/jump loop/disp32" +14532 0x13/imm32/size +14533 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 +14534 _string_ff_subop_increment: # (payload array byte) +14535 0x11/imm32/alloc-id:fake:payload +14536 # "ff 0/subop/increment" +14537 0x14/imm32/size +14538 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 +14539 _string_ff_subop_decrement: # (payload array byte) +14540 0x11/imm32/alloc-id:fake:payload +14541 # "ff 1/subop/decrement" +14542 0x14/imm32/size +14543 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 +14544 +14545 Single-int-var-in-mem: # (payload list var) +14546 0x11/imm32/alloc-id:fake:payload +14547 0x11/imm32/alloc-id:fake +14548 Int-var-in-mem/imm32 +14549 0/imm32/next +14550 0/imm32/next +14551 +14552 Int-var-in-mem: # (payload var) +14553 0x11/imm32/alloc-id:fake:payload +14554 0/imm32/name +14555 0/imm32/name +14556 0x11/imm32/alloc-id:fake +14557 Type-int/imm32 +14558 1/imm32/some-block-depth +14559 1/imm32/some-stack-offset +14560 0/imm32/no-register +14561 0/imm32/no-register +14562 +14563 # Not really legal, but closest we can currently represent a dereference of an (addr byte) +14564 Single-byte-var-in-mem: # (payload list var) +14565 0x11/imm32/alloc-id:fake:payload +14566 0x11/imm32/alloc-id:fake +14567 Byte-var-in-mem/imm32 +14568 0/imm32/next +14569 0/imm32/next +14570 +14571 # Not really legal, but closest we can currently represent a dereference of an (addr byte) +14572 Byte-var-in-mem: # (payload var) +14573 0x11/imm32/alloc-id:fake:payload +14574 0/imm32/name +14575 0/imm32/name +14576 0x11/imm32/alloc-id:fake +14577 Type-byte/imm32 +14578 1/imm32/some-block-depth +14579 1/imm32/some-stack-offset +14580 0/imm32/no-register +14581 0/imm32/no-register +14582 +14583 Two-args-int-stack-int-reg: # (payload list var) +14584 0x11/imm32/alloc-id:fake:payload +14585 0x11/imm32/alloc-id:fake +14586 Int-var-in-mem/imm32 +14587 0x11/imm32/alloc-id:fake +14588 Single-int-var-in-some-register/imm32/next +14589 +14590 Two-int-args-in-regs: # (payload list var) +14591 0x11/imm32/alloc-id:fake:payload +14592 0x11/imm32/alloc-id:fake +14593 Int-var-in-some-register/imm32 +14594 0x11/imm32/alloc-id:fake +14595 Single-int-var-in-some-register/imm32/next +14596 +14597 # Not really legal, but closest we can currently represent a dereference of an (addr byte) +14598 Two-args-byte-stack-byte-reg: # (payload list var) +14599 0x11/imm32/alloc-id:fake:payload +14600 0x11/imm32/alloc-id:fake +14601 Byte-var-in-mem/imm32 +14602 0x11/imm32/alloc-id:fake +14603 Single-byte-var-in-some-register/imm32/next +14604 +14605 Two-args-int-reg-int-stack: # (payload list var) +14606 0x11/imm32/alloc-id:fake:payload +14607 0x11/imm32/alloc-id:fake +14608 Int-var-in-some-register/imm32 +14609 0x11/imm32/alloc-id:fake +14610 Single-int-var-in-mem/imm32/next +14611 +14612 Two-args-int-eax-int-literal: # (payload list var) +14613 0x11/imm32/alloc-id:fake:payload +14614 0x11/imm32/alloc-id:fake +14615 Int-var-in-eax/imm32 +14616 0x11/imm32/alloc-id:fake +14617 Single-lit-var/imm32/next +14618 +14619 Int-var-and-literal: # (payload list var) +14620 0x11/imm32/alloc-id:fake:payload +14621 0x11/imm32/alloc-id:fake +14622 Int-var-in-mem/imm32 +14623 0x11/imm32/alloc-id:fake +14624 Single-lit-var/imm32/next +14625 +14626 Int-var-in-register-and-literal: # (payload list var) +14627 0x11/imm32/alloc-id:fake:payload +14628 0x11/imm32/alloc-id:fake +14629 Int-var-in-some-register/imm32 +14630 0x11/imm32/alloc-id:fake +14631 Single-lit-var/imm32/next +14632 +14633 Single-int-var-in-some-register: # (payload list var) +14634 0x11/imm32/alloc-id:fake:payload +14635 0x11/imm32/alloc-id:fake +14636 Int-var-in-some-register/imm32 +14637 0/imm32/next +14638 0/imm32/next +14639 +14640 Single-addr-var-in-some-register: # (payload list var) +14641 0x11/imm32/alloc-id:fake:payload +14642 0x11/imm32/alloc-id:fake +14643 Addr-var-in-some-register/imm32 +14644 0/imm32/next +14645 0/imm32/next +14646 +14647 Single-byte-var-in-some-register: # (payload list var) +14648 0x11/imm32/alloc-id:fake:payload +14649 0x11/imm32/alloc-id:fake +14650 Byte-var-in-some-register/imm32 +14651 0/imm32/next +14652 0/imm32/next +14653 +14654 Int-var-in-some-register: # (payload var) +14655 0x11/imm32/alloc-id:fake:payload +14656 0/imm32/name +14657 0/imm32/name +14658 0x11/imm32/alloc-id:fake +14659 Type-int/imm32 +14660 1/imm32/some-block-depth +14661 0/imm32/no-stack-offset +14662 0x11/imm32/alloc-id:fake +14663 Any-register/imm32 +14664 +14665 Any-register: # (payload array byte) +14666 0x11/imm32/alloc-id:fake:payload +14667 1/imm32/size +14668 # data +14669 2a/asterisk +14670 +14671 Addr-var-in-some-register: # (payload var) +14672 0x11/imm32/alloc-id:fake:payload +14673 0/imm32/name +14674 0/imm32/name +14675 0x11/imm32/alloc-id:fake +14676 Type-addr/imm32 +14677 1/imm32/some-block-depth +14678 0/imm32/no-stack-offset +14679 0x11/imm32/alloc-id:fake +14680 Any-register/imm32 +14681 +14682 Byte-var-in-some-register: # (payload var) +14683 0x11/imm32/alloc-id:fake:payload +14684 0/imm32/name +14685 0/imm32/name +14686 0x11/imm32/alloc-id:fake +14687 Type-byte/imm32 +14688 1/imm32/some-block-depth +14689 0/imm32/no-stack-offset +14690 0x11/imm32/alloc-id:fake +14691 Any-register/imm32 +14692 +14693 Single-int-var-in-eax: # (payload list var) +14694 0x11/imm32/alloc-id:fake:payload +14695 0x11/imm32/alloc-id:fake +14696 Int-var-in-eax/imm32 +14697 0/imm32/next +14698 0/imm32/next +14699 +14700 Int-var-in-eax: +14701 0x11/imm32/alloc-id:fake:payload +14702 0/imm32/name +14703 0/imm32/name +14704 0x11/imm32/alloc-id:fake +14705 Type-int/imm32 +14706 1/imm32/some-block-depth +14707 0/imm32/no-stack-offset +14708 0x11/imm32/alloc-id:fake +14709 $Register-eax/imm32 +14710 +14711 Single-int-var-in-ecx: # (payload list var) +14712 0x11/imm32/alloc-id:fake:payload +14713 0x11/imm32/alloc-id:fake +14714 Int-var-in-ecx/imm32 +14715 0/imm32/next +14716 0/imm32/next +14717 +14718 Int-var-in-ecx: +14719 0x11/imm32/alloc-id:fake:payload +14720 0/imm32/name +14721 0/imm32/name +14722 0x11/imm32/alloc-id:fake +14723 Type-int/imm32 +14724 1/imm32/some-block-depth +14725 0/imm32/no-stack-offset +14726 0x11/imm32/alloc-id:fake +14727 $Register-ecx/imm32/register +14728 +14729 Single-int-var-in-edx: # (payload list var) +14730 0x11/imm32/alloc-id:fake:payload +14731 0x11/imm32/alloc-id:fake +14732 Int-var-in-edx/imm32 +14733 0/imm32/next +14734 0/imm32/next +14735 +14736 Int-var-in-edx: # (payload list var) +14737 0x11/imm32/alloc-id:fake:payload +14738 0/imm32/name +14739 0/imm32/name +14740 0x11/imm32/alloc-id:fake +14741 Type-int/imm32 +14742 1/imm32/some-block-depth +14743 0/imm32/no-stack-offset +14744 0x11/imm32/alloc-id:fake +14745 $Register-edx/imm32/register +14746 +14747 Single-int-var-in-ebx: # (payload list var) +14748 0x11/imm32/alloc-id:fake:payload +14749 0x11/imm32/alloc-id:fake +14750 Int-var-in-ebx/imm32 +14751 0/imm32/next +14752 0/imm32/next +14753 +14754 Int-var-in-ebx: # (payload list var) +14755 0x11/imm32/alloc-id:fake:payload +14756 0/imm32/name +14757 0/imm32/name +14758 0x11/imm32/alloc-id:fake +14759 Type-int/imm32 +14760 1/imm32/some-block-depth +14761 0/imm32/no-stack-offset +14762 0x11/imm32/alloc-id:fake +14763 $Register-ebx/imm32/register +14764 +14765 Single-int-var-in-esi: # (payload list var) +14766 0x11/imm32/alloc-id:fake:payload +14767 0x11/imm32/alloc-id:fake +14768 Int-var-in-esi/imm32 +14769 0/imm32/next +14770 0/imm32/next +14771 +14772 Int-var-in-esi: # (payload list var) +14773 0x11/imm32/alloc-id:fake:payload +14774 0/imm32/name +14775 0/imm32/name +14776 0x11/imm32/alloc-id:fake +14777 Type-int/imm32 +14778 1/imm32/some-block-depth +14779 0/imm32/no-stack-offset +14780 0x11/imm32/alloc-id:fake +14781 $Register-esi/imm32/register +14782 +14783 Single-int-var-in-edi: # (payload list var) +14784 0x11/imm32/alloc-id:fake:payload +14785 0x11/imm32/alloc-id:fake +14786 Int-var-in-edi/imm32 +14787 0/imm32/next +14788 0/imm32/next +14789 +14790 Int-var-in-edi: # (payload list var) +14791 0x11/imm32/alloc-id:fake:payload +14792 0/imm32/name +14793 0/imm32/name +14794 0x11/imm32/alloc-id:fake +14795 Type-int/imm32 +14796 1/imm32/some-block-depth +14797 0/imm32/no-stack-offset +14798 0x11/imm32/alloc-id:fake +14799 $Register-edi/imm32/register +14800 +14801 Single-lit-var: # (payload list var) +14802 0x11/imm32/alloc-id:fake:payload +14803 0x11/imm32/alloc-id:fake +14804 Lit-var/imm32 +14805 0/imm32/next +14806 0/imm32/next +14807 +14808 Lit-var: # (payload var) +14809 0x11/imm32/alloc-id:fake:payload +14810 0/imm32/name +14811 0/imm32/name +14812 0x11/imm32/alloc-id:fake +14813 Type-literal/imm32 +14814 1/imm32/some-block-depth +14815 0/imm32/no-stack-offset +14816 0/imm32/no-register +14817 0/imm32/no-register +14818 +14819 Type-int: # (payload tree type-id) +14820 0x11/imm32/alloc-id:fake:payload +14821 1/imm32/left-is-atom +14822 1/imm32/value:int +14823 0/imm32/left:unused +14824 0/imm32/right:null +14825 0/imm32/right:null +14826 +14827 Type-literal: # (payload tree type-id) +14828 0x11/imm32/alloc-id:fake:payload +14829 1/imm32/is-atom +14830 0/imm32/value:literal +14831 0/imm32/left:unused +14832 0/imm32/right:null +14833 0/imm32/right:null +14834 +14835 Type-addr: # (payload tree type-id) +14836 0x11/imm32/alloc-id:fake:payload +14837 1/imm32/is-atom +14838 2/imm32/value:addr +14839 0/imm32/left:unused +14840 0/imm32/right:null +14841 0/imm32/right:null +14842 +14843 Type-byte: # (payload tree type-id) +14844 0x11/imm32/alloc-id:fake:payload +14845 1/imm32/is-atom +14846 8/imm32/value:byte +14847 0/imm32/left:unused +14848 0/imm32/right:null +14849 0/imm32/right:null 14850 -14851 is-simple-mu-type?: # a: (addr tree type-id), n: type-id -> result/eax: boolean -14852 # . prologue -14853 55/push-ebp -14854 89/<- %ebp 4/r32/esp -14855 # . save registers -14856 51/push-ecx -14857 # ecx = n -14858 8b/-> *(ebp+0xc) 1/r32/ecx -14859 # return (a->value == n) -14860 8b/-> *(ebp+8) 0/r32/eax -14861 39/compare *(eax+4) 1/r32/ecx # Tree-value -14862 0f 94/set-byte-if-= %al -14863 81 4/subop/and %eax 0xff/imm32 -14864 $is-simple-mu-type?:end: -14865 # . restore registers -14866 59/pop-to-ecx -14867 # . epilogue -14868 89/<- %esp 5/r32/ebp -14869 5d/pop-to-ebp -14870 c3/return -14871 -14872 test-emit-subx-stmt-primitive: -14873 # Primitive operation on a variable on the stack. -14874 # increment foo -14875 # => -14876 # ff 0/subop/increment *(ebp-8) -14877 # -14878 # There's a variable on the var stack as follows: -14879 # name: 'foo' -14880 # type: int -14881 # stack-offset: -8 -14882 # -14883 # There's a primitive with this info: -14884 # name: 'increment' -14885 # inouts: int/mem -14886 # value: 'ff 0/subop/increment' -14887 # -14888 # . prologue -14889 55/push-ebp -14890 89/<- %ebp 4/r32/esp -14891 # setup -14892 (clear-stream _test-output-stream) -14893 (clear-stream $_test-output-buffered-file->buffer) -14894 # simulate allocated payloads starting with an initial fake alloc-id (0x11) -14895 $test-emit-subx-stmt-primitive:initialize-type: -14896 # var type/ecx: (payload tree type-id) = int -14897 68/push 0/imm32/right:null -14898 68/push 0/imm32/right:null -14899 68/push 0/imm32/left:unused -14900 68/push 1/imm32/value:int -14901 68/push 1/imm32/is-atom?:true -14902 68/push 0x11/imm32/alloc-id:fake:payload -14903 89/<- %ecx 4/r32/esp -14904 $test-emit-subx-stmt-primitive:initialize-var: -14905 # var var-foo/ecx: (payload var) = var(type) -14906 68/push 0/imm32/no-register -14907 68/push 0/imm32/no-register -14908 68/push -8/imm32/stack-offset -14909 68/push 1/imm32/block-depth -14910 51/push-ecx/type -14911 68/push 0x11/imm32/alloc-id:fake -14912 68/push 0/imm32/name -14913 68/push 0/imm32/name -14914 68/push 0x11/imm32/alloc-id:fake:payload -14915 89/<- %ecx 4/r32/esp -14916 $test-emit-subx-stmt-primitive:initialize-var-name: -14917 # var-foo->name = "foo" -14918 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -14919 (copy-array Heap "foo" %eax) -14920 $test-emit-subx-stmt-primitive:initialize-stmt-var: -14921 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -14922 68/push 0/imm32/is-deref:false -14923 68/push 0/imm32/next -14924 68/push 0/imm32/next -14925 51/push-ecx/var-foo -14926 68/push 0x11/imm32/alloc-id:fake -14927 68/push 0x11/imm32/alloc-id:fake:payload -14928 89/<- %ebx 4/r32/esp -14929 $test-emit-subx-stmt-primitive:initialize-stmt: -14930 # var stmt/esi: (addr statement) -14931 68/push 0/imm32/no-outputs -14932 68/push 0/imm32/no-outputs -14933 53/push-ebx/inouts -14934 68/push 0x11/imm32/alloc-id:fake -14935 68/push 0/imm32/operation -14936 68/push 0/imm32/operation -14937 68/push 1/imm32/tag -14938 89/<- %esi 4/r32/esp -14939 $test-emit-subx-stmt-primitive:initialize-stmt-operation: -14940 # stmt->operation = "increment" -14941 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -14942 (copy-array Heap "increment" %eax) -14943 $test-emit-subx-stmt-primitive:initialize-primitive: -14944 # var primitives/ebx: (addr primitive) -14945 68/push 0/imm32/next -14946 68/push 0/imm32/next -14947 68/push 0/imm32/output-is-write-only -14948 68/push 0/imm32/no-disp32 -14949 68/push 0/imm32/no-imm32 -14950 68/push 0/imm32/no-r32 -14951 68/push 1/imm32/rm32-is-first-inout -14952 68/push 0/imm32/subx-name -14953 68/push 0/imm32/subx-name -14954 68/push 0/imm32/no-outputs -14955 68/push 0/imm32/no-outputs -14956 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -14957 68/push 0x11/imm32/alloc-id:fake -14958 68/push 0/imm32/name -14959 68/push 0/imm32/name -14960 89/<- %ebx 4/r32/esp -14961 $test-emit-subx-stmt-primitive:initialize-primitive-name: -14962 # primitives->name = "increment" -14963 (copy-array Heap "increment" %ebx) # Primitive-name -14964 $test-emit-subx-stmt-primitive:initialize-primitive-subx-name: -14965 # primitives->subx-name = "ff 0/subop/increment" -14966 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -14967 (copy-array Heap "ff 0/subop/increment" %eax) -14968 # convert -14969 c7 0/subop/copy *Curr-block-depth 0/imm32 -14970 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) -14971 (flush _test-output-buffered-file) -14972 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -14978 # check output -14979 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive") -14980 # . epilogue -14981 89/<- %esp 5/r32/ebp -14982 5d/pop-to-ebp -14983 c3/return -14984 -14985 test-emit-subx-stmt-primitive-register: -14986 # Primitive operation on a variable in a register. -14987 # foo <- increment -14988 # => -14989 # ff 0/subop/increment %eax # sub-optimal, but should suffice -14990 # -14991 # There's a variable on the var stack as follows: -14992 # name: 'foo' -14993 # type: int -14994 # register: 'eax' -14995 # -14996 # There's a primitive with this info: -14997 # name: 'increment' -14998 # out: int/reg -14999 # value: 'ff 0/subop/increment' -15000 # -15001 # . prologue -15002 55/push-ebp -15003 89/<- %ebp 4/r32/esp -15004 # setup -15005 (clear-stream _test-output-stream) -15006 (clear-stream $_test-output-buffered-file->buffer) -15007 $test-emit-subx-stmt-primitive-register:initialize-type: -15008 # var type/ecx: (payload tree type-id) = int -15009 68/push 0/imm32/right:null -15010 68/push 0/imm32/right:null -15011 68/push 0/imm32/left:unused -15012 68/push 1/imm32/value:int -15013 68/push 1/imm32/is-atom?:true -15014 68/push 0x11/imm32/alloc-id:fake:payload -15015 89/<- %ecx 4/r32/esp -15016 $test-emit-subx-stmt-primitive-register:initialize-var: -15017 # var var-foo/ecx: (payload var) -15018 68/push 0/imm32/register -15019 68/push 0/imm32/register -15020 68/push 0/imm32/no-stack-offset -15021 68/push 1/imm32/block-depth -15022 51/push-ecx -15023 68/push 0x11/imm32/alloc-id:fake -15024 68/push 0/imm32/name -15025 68/push 0/imm32/name -15026 68/push 0x11/imm32/alloc-id:fake:payload -15027 89/<- %ecx 4/r32/esp -15028 $test-emit-subx-stmt-primitive-register:initialize-var-name: -15029 # var-foo->name = "foo" -15030 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15031 (copy-array Heap "foo" %eax) -15032 $test-emit-subx-stmt-primitive-register:initialize-var-register: -15033 # var-foo->register = "eax" -15034 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -15035 (copy-array Heap "eax" %eax) -15036 $test-emit-subx-stmt-primitive-register:initialize-stmt-var: -15037 # var operand/ebx: (payload stmt-var) -15038 68/push 0/imm32/is-deref:false -15039 68/push 0/imm32/next -15040 68/push 0/imm32/next -15041 51/push-ecx/var-foo -15042 68/push 0x11/imm32/alloc-id:fake -15043 68/push 0x11/imm32/alloc-id:fake:payload -15044 89/<- %ebx 4/r32/esp -15045 $test-emit-subx-stmt-primitive-register:initialize-stmt: -15046 # var stmt/esi: (addr statement) -15047 53/push-ebx/outputs -15048 68/push 0x11/imm32/alloc-id:fake -15049 68/push 0/imm32/no-inouts -15050 68/push 0/imm32/no-inouts -15051 68/push 0/imm32/operation -15052 68/push 0/imm32/operation -15053 68/push 1/imm32 -15054 89/<- %esi 4/r32/esp -15055 $test-emit-subx-stmt-primitive-register:initialize-stmt-operation: -15056 # stmt->operation = "increment" -15057 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15058 (copy-array Heap "increment" %eax) -15059 $test-emit-subx-stmt-primitive-register:initialize-formal-var: -15060 # var formal-var/ebx: (payload var) -15061 68/push 0/imm32/register -15062 68/push 0/imm32/register -15063 68/push 0/imm32/no-stack-offset -15064 68/push 1/imm32/block-depth -15065 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -15066 68/push 0x11/imm32/alloc-id:fake -15067 68/push 0/imm32/name -15068 68/push 0/imm32/name -15069 68/push 0x11/imm32/alloc-id:fake:payload -15070 89/<- %ebx 4/r32/esp -15071 $test-emit-subx-stmt-primitive-register:initialize-formal-var-name: -15072 # formal-var->name = "dummy" -15073 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -15074 (copy-array Heap "dummy" %eax) -15075 $test-emit-subx-stmt-primitive-register:initialize-formal-register: -15076 # formal-var->register = "*" -15077 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -15078 (copy-array Heap "*" %eax) # Any-register -15079 $test-emit-subx-stmt-primitive-register:initialize-var-list: -15080 # var formal-outputs/ebx: (payload list var) -15081 68/push 0/imm32/next -15082 68/push 0/imm32/next -15083 53/push-ebx/formal-var -15084 68/push 0x11/imm32/alloc-id:fake -15085 68/push 0x11/imm32/alloc-id:fake:payload -15086 89/<- %ebx 4/r32/esp -15087 $test-emit-subx-stmt-primitive-register:initialize-primitive: -15088 # var primitives/ebx: (addr primitive) -15089 68/push 0/imm32/next -15090 68/push 0/imm32/next -15091 68/push 0/imm32/output-is-write-only -15092 68/push 0/imm32/no-disp32 -15093 68/push 0/imm32/no-imm32 -15094 68/push 0/imm32/no-r32 -15095 68/push 3/imm32/rm32-is-first-output -15096 68/push 0/imm32/subx-name -15097 68/push 0/imm32/subx-name -15098 53/push-ebx/outputs -15099 68/push 0x11/imm32/alloc-id:fake -15100 68/push 0/imm32/no-inouts -15101 68/push 0/imm32/no-inouts -15102 68/push 0/imm32/name -15103 68/push 0/imm32/name -15104 89/<- %ebx 4/r32/esp -15105 $test-emit-subx-stmt-primitive-register:initialize-primitive-name: -15106 # primitives->name = "increment" -15107 (copy-array Heap "increment" %ebx) # Primitive-name -15108 $test-emit-subx-stmt-primitive-register:initialize-primitive-subx-name: -15109 # primitives->subx-name = "ff 0/subop/increment" -15110 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -15111 (copy-array Heap "ff 0/subop/increment" %eax) -15112 # convert -15113 c7 0/subop/copy *Curr-block-depth 0/imm32 -15114 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) -15115 (flush _test-output-buffered-file) -15116 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -15122 # check output -15123 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register") -15124 # . epilogue -15125 89/<- %esp 5/r32/ebp -15126 5d/pop-to-ebp -15127 c3/return -15128 -15129 test-emit-subx-stmt-select-primitive: -15130 # Select the right primitive between overloads. -15131 # foo <- increment -15132 # => -15133 # ff 0/subop/increment %eax # sub-optimal, but should suffice -15134 # -15135 # There's a variable on the var stack as follows: -15136 # name: 'foo' -15137 # type: int -15138 # register: 'eax' -15139 # -15140 # There's two primitives, as follows: -15141 # - name: 'increment' -15142 # out: int/reg -15143 # value: 'ff 0/subop/increment' -15144 # - name: 'increment' -15145 # inout: int/mem -15146 # value: 'ff 0/subop/increment' -15147 # -15148 # . prologue -15149 55/push-ebp -15150 89/<- %ebp 4/r32/esp -15151 # setup -15152 (clear-stream _test-output-stream) -15153 (clear-stream $_test-output-buffered-file->buffer) -15154 $test-emit-subx-stmt-select-primitive:initialize-type: -15155 # var type/ecx: (payload tree type-id) = int -15156 68/push 0/imm32/right:null -15157 68/push 0/imm32/right:null -15158 68/push 0/imm32/left:unused -15159 68/push 1/imm32/value:int -15160 68/push 1/imm32/is-atom?:true -15161 68/push 0x11/imm32/alloc-id:fake:payload -15162 89/<- %ecx 4/r32/esp -15163 $test-emit-subx-stmt-select-primitive:initialize-var: -15164 # var var-foo/ecx: (payload var) -15165 68/push 0/imm32/register -15166 68/push 0/imm32/register -15167 68/push 0/imm32/no-stack-offset -15168 68/push 1/imm32/block-depth -15169 51/push-ecx -15170 68/push 0x11/imm32/alloc-id:fake -15171 68/push 0/imm32/name -15172 68/push 0/imm32/name -15173 68/push 0x11/imm32/alloc-id:fake:payload -15174 89/<- %ecx 4/r32/esp -15175 $test-emit-subx-stmt-select-primitive:initialize-var-name: -15176 # var-foo->name = "foo" -15177 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15178 (copy-array Heap "foo" %eax) -15179 $test-emit-subx-stmt-select-primitive:initialize-var-register: -15180 # var-foo->register = "eax" -15181 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -15182 (copy-array Heap "eax" %eax) -15183 $test-emit-subx-stmt-select-primitive:initialize-stmt-var: -15184 # var operand/ebx: (payload stmt-var) -15185 68/push 0/imm32/is-deref:false -15186 68/push 0/imm32/next -15187 68/push 0/imm32/next -15188 51/push-ecx/var-foo -15189 68/push 0x11/imm32/alloc-id:fake -15190 68/push 0x11/imm32/alloc-id:fake:payload -15191 89/<- %ebx 4/r32/esp -15192 $test-emit-subx-stmt-select-primitive:initialize-stmt: -15193 # var stmt/esi: (addr statement) -15194 53/push-ebx/outputs -15195 68/push 0x11/imm32/alloc-id:fake -15196 68/push 0/imm32/no-inouts -15197 68/push 0/imm32/no-inouts -15198 68/push 0/imm32/operation -15199 68/push 0/imm32/operation -15200 68/push 1/imm32 -15201 89/<- %esi 4/r32/esp -15202 $test-emit-subx-stmt-select-primitive:initialize-stmt-operation: -15203 # stmt->operation = "increment" -15204 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15205 (copy-array Heap "increment" %eax) -15206 $test-emit-subx-stmt-select-primitive:initialize-formal-var: -15207 # var formal-var/ebx: (payload var) -15208 68/push 0/imm32/register -15209 68/push 0/imm32/register -15210 68/push 0/imm32/no-stack-offset -15211 68/push 1/imm32/block-depth -15212 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -15213 68/push 0x11/imm32/alloc-id:fake -15214 68/push 0/imm32/name -15215 68/push 0/imm32/name -15216 68/push 0x11/imm32/alloc-id:fake:payload -15217 89/<- %ebx 4/r32/esp -15218 $test-emit-subx-stmt-select-primitive:initialize-formal-var-name: -15219 # formal-var->name = "dummy" -15220 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -15221 (copy-array Heap "dummy" %eax) -15222 $test-emit-subx-stmt-select-primitive:initialize-formal-register: -15223 # formal-var->register = "*" -15224 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -15225 (copy-array Heap "*" %eax) # Any-register -15226 $test-emit-subx-stmt-select-primitive:initialize-var-list: -15227 # var formal-outputs/ebx: (payload list var) -15228 68/push 0/imm32/next -15229 68/push 0/imm32/next -15230 53/push-ebx/formal-var -15231 68/push 0x11/imm32/alloc-id:fake -15232 68/push 0x11/imm32/alloc-id:fake:payload -15233 89/<- %ebx 4/r32/esp -15234 $test-emit-subx-stmt-select-primitive:initialize-primitive2: -15235 # var primitive2/edi: (payload primitive) -15236 68/push 0/imm32/next -15237 68/push 0/imm32/next -15238 68/push 0/imm32/output-is-write-only -15239 68/push 0/imm32/no-disp32 -15240 68/push 0/imm32/no-imm32 -15241 68/push 0/imm32/no-r32 -15242 68/push 3/imm32/rm32-is-first-output -15243 68/push 0/imm32/subx-name -15244 68/push 0/imm32/subx-name -15245 53/push-ebx/outputs -15246 68/push 0x11/imm32/alloc-id:fake -15247 68/push 0/imm32/no-inouts -15248 68/push 0/imm32/no-inouts -15249 68/push 0/imm32/name -15250 68/push 0/imm32/name -15251 68/push 0x11/imm32/alloc-id:fake:payload -15252 89/<- %edi 4/r32/esp -15253 $test-emit-subx-stmt-select-primitive:initialize-primitive2-name: -15254 # primitives->name = "increment" -15255 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 -15256 (copy-array Heap "increment" %eax) -15257 $test-emit-subx-stmt-select-primitive:initialize-primitive2-subx-name: -15258 # primitives->subx-name = "ff 0/subop/increment" -15259 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 -15260 (copy-array Heap "ff 0/subop/increment" %eax) -15261 $test-emit-subx-stmt-select-primitive:initialize-primitive: -15262 # var primitives/ebx: (addr primitive) -15263 57/push-edi -15264 68/push 0x11/imm32/alloc-id:fake -15265 68/push 0/imm32/output-is-write-only -15266 68/push 0/imm32/no-disp32 -15267 68/push 0/imm32/no-imm32 -15268 68/push 0/imm32/no-r32 -15269 68/push 1/imm32/rm32-is-first-inout -15270 68/push 0/imm32/subx-name -15271 68/push 0/imm32/subx-name -15272 68/push 0/imm32/no-outputs -15273 68/push 0/imm32/no-outputs -15274 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -15275 68/push 0x11/imm32/alloc-id:fake -15276 68/push 0/imm32/name -15277 68/push 0/imm32/name -15278 89/<- %ebx 4/r32/esp -15279 $test-emit-subx-stmt-select-primitive:initialize-primitive-name: -15280 # primitives->name = "increment" -15281 (copy-array Heap "increment" %ebx) # Primitive-name -15282 $test-emit-subx-stmt-select-primitive:initialize-primitive-subx-name: -15283 # primitives->subx-name = "ff 0/subop/increment" -15284 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -15285 (copy-array Heap "ff 0/subop/increment" %eax) -15286 # convert -15287 c7 0/subop/copy *Curr-block-depth 0/imm32 -15288 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) -15289 (flush _test-output-buffered-file) -15290 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -15296 # check output -15297 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive") +14851 == code +14852 emit-subx-primitive: # out: (addr buffered-file), stmt: (addr stmt), primitive: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) +14853 # . prologue +14854 55/push-ebp +14855 89/<- %ebp 4/r32/esp +14856 # . save registers +14857 50/push-eax +14858 51/push-ecx +14859 # ecx = primitive +14860 8b/-> *(ebp+0x10) 1/r32/ecx +14861 # emit primitive name +14862 (emit-indent *(ebp+8) *Curr-block-depth) +14863 (lookup *(ecx+0x18) *(ecx+0x1c)) # Primitive-subx-name Primitive-subx-name => eax +14864 (write-buffered *(ebp+8) %eax) +14865 # emit rm32 if necessary +14866 (emit-subx-rm32 *(ebp+8) *(ecx+0x20) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-rm32 +14867 # emit r32 if necessary +14868 (emit-subx-r32 *(ebp+8) *(ecx+0x24) *(ebp+0xc)) # Primitive-subx-r32 +14869 # emit imm32 if necessary +14870 (emit-subx-imm32 *(ebp+8) *(ecx+0x28) *(ebp+0xc)) # Primitive-subx-imm32 +14871 # emit disp32 if necessary +14872 (emit-subx-disp32 *(ebp+8) *(ecx+0x2c) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-disp32 +14873 (write-buffered *(ebp+8) Newline) +14874 $emit-subx-primitive:end: +14875 # . restore registers +14876 59/pop-to-ecx +14877 58/pop-to-eax +14878 # . epilogue +14879 89/<- %esp 5/r32/ebp +14880 5d/pop-to-ebp +14881 c3/return +14882 +14883 emit-subx-rm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +14884 # . prologue +14885 55/push-ebp +14886 89/<- %ebp 4/r32/esp +14887 # . save registers +14888 50/push-eax +14889 # if (l == 0) return +14890 81 7/subop/compare *(ebp+0xc) 0/imm32 +14891 74/jump-if-= $emit-subx-rm32:end/disp8 +14892 # var v/eax: (addr stmt-var) +14893 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax +14894 (emit-subx-var-as-rm32 *(ebp+8) %eax) +14895 $emit-subx-rm32:end: +14896 # . restore registers +14897 58/pop-to-eax +14898 # . epilogue +14899 89/<- %esp 5/r32/ebp +14900 5d/pop-to-ebp +14901 c3/return +14902 +14903 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) +14904 # . prologue +14905 55/push-ebp +14906 89/<- %ebp 4/r32/esp +14907 # . save registers +14908 51/push-ecx +14909 # eax = l +14910 8b/-> *(ebp+0xc) 0/r32/eax +14911 # ecx = stmt +14912 8b/-> *(ebp+8) 1/r32/ecx +14913 # if (l == 1) return stmt->inouts +14914 { +14915 3d/compare-eax-and 1/imm32 +14916 75/jump-if-!= break/disp8 +14917 $get-stmt-operand-from-arg-location:1: +14918 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +14919 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +14920 } +14921 # if (l == 2) return stmt->inouts->next +14922 { +14923 3d/compare-eax-and 2/imm32 +14924 75/jump-if-!= break/disp8 +14925 $get-stmt-operand-from-arg-location:2: +14926 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +14927 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +14928 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +14929 } +14930 # if (l == 3) return stmt->outputs +14931 { +14932 3d/compare-eax-and 3/imm32 +14933 75/jump-if-!= break/disp8 +14934 $get-stmt-operand-from-arg-location:3: +14935 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +14936 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +14937 } +14938 # abort +14939 e9/jump $get-stmt-operand-from-arg-location:abort/disp32 +14940 $get-stmt-operand-from-arg-location:end: +14941 # . restore registers +14942 59/pop-to-ecx +14943 # . epilogue +14944 89/<- %esp 5/r32/ebp +14945 5d/pop-to-ebp +14946 c3/return +14947 +14948 $get-stmt-operand-from-arg-location:abort: +14949 # error("invalid arg-location " eax) +14950 (write-buffered *(ebp+0x10) "invalid arg-location ") +14951 (print-int32-buffered *(ebp+0x10) %eax) +14952 (write-buffered *(ebp+0x10) Newline) +14953 (flush *(ebp+0x10)) +14954 (stop *(ebp+0x14) 1) +14955 # never gets here +14956 +14957 emit-subx-r32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +14958 # . prologue +14959 55/push-ebp +14960 89/<- %ebp 4/r32/esp +14961 # . save registers +14962 50/push-eax +14963 51/push-ecx +14964 # if (l == 0) return +14965 81 7/subop/compare *(ebp+0xc) 0/imm32 +14966 0f 84/jump-if-= $emit-subx-r32:end/disp32 +14967 # var v/eax: (addr stmt-var) +14968 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +14969 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +14970 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +14971 (maybe-get Registers %eax 0xc) # => eax: (addr register-index) +14972 (write-buffered *(ebp+8) Space) +14973 (print-int32-buffered *(ebp+8) *eax) +14974 (write-buffered *(ebp+8) "/r32") +14975 $emit-subx-r32:end: +14976 # . restore registers +14977 59/pop-to-ecx +14978 58/pop-to-eax +14979 # . epilogue +14980 89/<- %esp 5/r32/ebp +14981 5d/pop-to-ebp +14982 c3/return +14983 +14984 emit-subx-imm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +14985 # . prologue +14986 55/push-ebp +14987 89/<- %ebp 4/r32/esp +14988 # . save registers +14989 50/push-eax +14990 51/push-ecx +14991 # if (l == 0) return +14992 81 7/subop/compare *(ebp+0xc) 0/imm32 +14993 0f 84/jump-if-= $emit-subx-imm32:end/disp32 +14994 # var v/eax: (handle var) +14995 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +14996 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +14997 (lookup *eax *(eax+4)) # Var-name Var-name => eax +14998 (write-buffered *(ebp+8) Space) +14999 (write-buffered *(ebp+8) %eax) +15000 (write-buffered *(ebp+8) "/imm32") +15001 $emit-subx-imm32:end: +15002 # . restore registers +15003 59/pop-to-ecx +15004 58/pop-to-eax +15005 # . epilogue +15006 89/<- %esp 5/r32/ebp +15007 5d/pop-to-ebp +15008 c3/return +15009 +15010 emit-subx-disp32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +15011 # . prologue +15012 55/push-ebp +15013 89/<- %ebp 4/r32/esp +15014 # . save registers +15015 50/push-eax +15016 51/push-ecx +15017 # if (location == 0) return +15018 81 7/subop/compare *(ebp+0xc) 0/imm32 +15019 0f 84/jump-if-= $emit-subx-disp32:end/disp32 +15020 # var v/eax: (addr stmt-var) +15021 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax +15022 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +15023 (lookup *eax *(eax+4)) # Var-name Var-name => eax +15024 (write-buffered *(ebp+8) Space) +15025 (write-buffered *(ebp+8) %eax) +15026 # hack: if instruction operation starts with "break", emit ":break" +15027 # var name/ecx: (addr array byte) = lookup(stmt->operation) +15028 8b/-> *(ebp+0x10) 0/r32/eax +15029 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +15030 89/<- %ecx 0/r32/eax +15031 { +15032 (string-starts-with? %ecx "break") # => eax +15033 3d/compare-eax-and 0/imm32/false +15034 74/jump-if-= break/disp8 +15035 (write-buffered *(ebp+8) ":break") +15036 } +15037 # hack: if instruction operation starts with "loop", emit ":loop" +15038 { +15039 (string-starts-with? %ecx "loop") # => eax +15040 3d/compare-eax-and 0/imm32/false +15041 74/jump-if-= break/disp8 +15042 (write-buffered *(ebp+8) ":loop") +15043 } +15044 (write-buffered *(ebp+8) "/disp32") +15045 $emit-subx-disp32:end: +15046 # . restore registers +15047 59/pop-to-ecx +15048 58/pop-to-eax +15049 # . epilogue +15050 89/<- %esp 5/r32/ebp +15051 5d/pop-to-ebp +15052 c3/return +15053 +15054 emit-call: # out: (addr buffered-file), stmt: (addr stmt) +15055 # . prologue +15056 55/push-ebp +15057 89/<- %ebp 4/r32/esp +15058 # . save registers +15059 50/push-eax +15060 51/push-ecx +15061 # +15062 (emit-indent *(ebp+8) *Curr-block-depth) +15063 (write-buffered *(ebp+8) "(") +15064 # ecx = stmt +15065 8b/-> *(ebp+0xc) 1/r32/ecx +15066 # - emit function name +15067 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +15068 (write-buffered *(ebp+8) %eax) +15069 # - emit arguments +15070 # var curr/eax: (addr stmt-var) = lookup(stmt->inouts) +15071 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +15072 { +15073 # if (curr == null) break +15074 3d/compare-eax-and 0/imm32 +15075 74/jump-if-= break/disp8 +15076 # +15077 (emit-subx-call-operand *(ebp+8) %eax) +15078 # curr = lookup(curr->next) +15079 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +15080 eb/jump loop/disp8 +15081 } +15082 # +15083 (write-buffered *(ebp+8) ")\n") +15084 $emit-call:end: +15085 # . restore registers +15086 59/pop-to-ecx +15087 58/pop-to-eax +15088 # . epilogue +15089 89/<- %esp 5/r32/ebp +15090 5d/pop-to-ebp +15091 c3/return +15092 +15093 emit-subx-call-operand: # out: (addr buffered-file), s: (addr stmt-var) +15094 # shares code with emit-subx-var-as-rm32 +15095 # . prologue +15096 55/push-ebp +15097 89/<- %ebp 4/r32/esp +15098 # . save registers +15099 50/push-eax +15100 51/push-ecx +15101 56/push-esi +15102 # ecx = s +15103 8b/-> *(ebp+0xc) 1/r32/ecx +15104 # var operand/esi: (addr var) = lookup(s->value) +15105 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +15106 89/<- %esi 0/r32/eax +15107 # if (operand->register && !s->is-deref?) emit "%__" +15108 { +15109 $emit-subx-call-operand:check-for-register-direct: +15110 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +15111 74/jump-if-= break/disp8 +15112 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +15113 75/jump-if-!= break/disp8 +15114 $emit-subx-call-operand:register-direct: +15115 (write-buffered *(ebp+8) " %") +15116 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +15117 (write-buffered *(ebp+8) %eax) +15118 e9/jump $emit-subx-call-operand:end/disp32 +15119 } +15120 # else if (operand->register && s->is-deref?) emit "*__" +15121 { +15122 $emit-subx-call-operand:check-for-register-indirect: +15123 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +15124 74/jump-if-= break/disp8 +15125 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +15126 74/jump-if-= break/disp8 +15127 $emit-subx-call-operand:register-indirect: +15128 (emit-subx-call-operand-register-indirect *(ebp+8) %esi) +15129 e9/jump $emit-subx-call-operand:end/disp32 +15130 } +15131 # else if (operand->stack-offset) emit "*(ebp+__)" +15132 { +15133 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset +15134 74/jump-if-= break/disp8 +15135 $emit-subx-call-operand:stack: +15136 (emit-subx-call-operand-stack *(ebp+8) %esi) +15137 e9/jump $emit-subx-call-operand:end/disp32 +15138 } +15139 # else if (operand->type == literal) emit "__" +15140 { +15141 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +15142 81 7/subop/compare *(eax+4) 0/imm32 # Tree-left +15143 75/jump-if-!= break/disp8 +15144 $emit-subx-call-operand:literal: +15145 (write-buffered *(ebp+8) Space) +15146 (lookup *esi *(esi+4)) # Var-name Var-name => eax +15147 (write-buffered *(ebp+8) %eax) +15148 } +15149 $emit-subx-call-operand:end: +15150 # . restore registers +15151 5e/pop-to-esi +15152 59/pop-to-ecx +15153 58/pop-to-eax +15154 # . epilogue +15155 89/<- %esp 5/r32/ebp +15156 5d/pop-to-ebp +15157 c3/return +15158 +15159 emit-subx-call-operand-register-indirect: # out: (addr buffered-file), v: (addr var) +15160 # . prologue +15161 55/push-ebp +15162 89/<- %ebp 4/r32/esp +15163 # . save registers +15164 50/push-eax +15165 51/push-ecx +15166 56/push-esi +15167 # esi = v +15168 8b/-> *(ebp+0xc) 6/r32/esi +15169 # var size/ecx: int = size-of-deref(v) +15170 (size-of-deref %esi) # => eax +15171 89/<- %ecx 0/r32/eax +15172 # var reg-name/esi: (addr array byte) = lookup(v->register) +15173 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +15174 89/<- %esi 0/r32/eax +15175 # TODO: assert size is a multiple of 4 +15176 # var i/eax: int = 0 +15177 b8/copy-to-eax 0/imm32 +15178 { +15179 $emit-subx-call-operand-register-indirect:loop: +15180 # if (i >= size) break +15181 39/compare %eax 1/r32/ecx +15182 7d/jump-if->= break/disp8 +15183 # emit " *(" v->register "+" i ")" +15184 (write-buffered *(ebp+8) " *(") +15185 (write-buffered *(ebp+8) %esi) +15186 (write-buffered *(ebp+8) "+") +15187 (print-int32-buffered *(ebp+8) %eax) +15188 (write-buffered *(ebp+8) ")") +15189 # i += 4 +15190 05/add-to-eax 4/imm32 +15191 # +15192 eb/jump loop/disp8 +15193 } +15194 $emit-subx-call-operand-register-indirect:end: +15195 # . restore registers +15196 5e/pop-to-esi +15197 59/pop-to-ecx +15198 58/pop-to-eax +15199 # . epilogue +15200 89/<- %esp 5/r32/ebp +15201 5d/pop-to-ebp +15202 c3/return +15203 +15204 emit-subx-call-operand-stack: # out: (addr buffered-file), v: (addr var) +15205 # . prologue +15206 55/push-ebp +15207 89/<- %ebp 4/r32/esp +15208 # . save registers +15209 50/push-eax +15210 51/push-ecx +15211 56/push-esi +15212 # esi = v +15213 8b/-> *(ebp+0xc) 6/r32/esi +15214 # var curr/ecx: int = v->offset +15215 8b/-> *(esi+0x14) 1/r32/ecx # Var-offset +15216 # var max/eax: int = v->offset + size-of(v) +15217 (size-of %esi) # => eax +15218 # TODO: assert size is a multiple of 4 +15219 01/add-to %eax 1/r32/ecx +15220 { +15221 $emit-subx-call-operand-stack:loop: +15222 # if (curr >= max) break +15223 39/compare %ecx 0/r32/eax +15224 7d/jump-if->= break/disp8 +15225 # emit " *(ebp+" curr ")" +15226 (write-buffered *(ebp+8) " *(ebp+") +15227 (print-int32-buffered *(ebp+8) %ecx) +15228 (write-buffered *(ebp+8) ")") +15229 # i += 4 +15230 81 0/subop/add %ecx 4/imm32 +15231 # +15232 eb/jump loop/disp8 +15233 } +15234 $emit-subx-call-operand-stack:end: +15235 # . restore registers +15236 5e/pop-to-esi +15237 59/pop-to-ecx +15238 58/pop-to-eax +15239 # . epilogue +15240 89/<- %esp 5/r32/ebp +15241 5d/pop-to-ebp +15242 c3/return +15243 +15244 emit-subx-var-as-rm32: # out: (addr buffered-file), s: (addr stmt-var) +15245 # . prologue +15246 55/push-ebp +15247 89/<- %ebp 4/r32/esp +15248 # . save registers +15249 50/push-eax +15250 51/push-ecx +15251 56/push-esi +15252 # ecx = s +15253 8b/-> *(ebp+0xc) 1/r32/ecx +15254 # var operand/esi: (addr var) = lookup(s->value) +15255 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +15256 89/<- %esi 0/r32/eax +15257 # if (operand->register && s->is-deref?) emit "*__" +15258 { +15259 $emit-subx-var-as-rm32:check-for-register-indirect: +15260 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +15261 74/jump-if-= break/disp8 +15262 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +15263 74/jump-if-= break/disp8 +15264 $emit-subx-var-as-rm32:register-indirect: +15265 (write-buffered *(ebp+8) " *") +15266 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +15267 (write-buffered *(ebp+8) %eax) +15268 e9/jump $emit-subx-var-as-rm32:end/disp32 +15269 } +15270 # if (operand->register && !s->is-deref?) emit "%__" +15271 { +15272 $emit-subx-var-as-rm32:check-for-register-direct: +15273 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +15274 74/jump-if-= break/disp8 +15275 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +15276 75/jump-if-!= break/disp8 +15277 $emit-subx-var-as-rm32:register-direct: +15278 (write-buffered *(ebp+8) " %") +15279 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +15280 (write-buffered *(ebp+8) %eax) +15281 e9/jump $emit-subx-var-as-rm32:end/disp32 +15282 } +15283 # else if (operand->stack-offset) emit "*(ebp+__)" +15284 { +15285 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset +15286 74/jump-if-= break/disp8 +15287 $emit-subx-var-as-rm32:stack: +15288 (write-buffered *(ebp+8) Space) +15289 (write-buffered *(ebp+8) "*(ebp+") +15290 (print-int32-buffered *(ebp+8) *(esi+0x14)) # Var-offset +15291 (write-buffered *(ebp+8) ")") +15292 } +15293 $emit-subx-var-as-rm32:end: +15294 # . restore registers +15295 5e/pop-to-esi +15296 59/pop-to-ecx +15297 58/pop-to-eax 15298 # . epilogue 15299 89/<- %esp 5/r32/ebp 15300 5d/pop-to-ebp 15301 c3/return 15302 -15303 test-emit-subx-stmt-select-primitive-2: -15304 # Select the right primitive between overloads. -15305 # increment foo -15306 # => -15307 # ff 0/subop/increment %eax # sub-optimal, but should suffice -15308 # -15309 # There's a variable on the var stack as follows: -15310 # name: 'foo' -15311 # type: int -15312 # register: 'eax' -15313 # -15314 # There's two primitives, as follows: -15315 # - name: 'increment' -15316 # out: int/reg -15317 # value: 'ff 0/subop/increment' -15318 # - name: 'increment' -15319 # inout: int/mem -15320 # value: 'ff 0/subop/increment' -15321 # -15322 # . prologue -15323 55/push-ebp -15324 89/<- %ebp 4/r32/esp -15325 # setup -15326 (clear-stream _test-output-stream) -15327 (clear-stream $_test-output-buffered-file->buffer) -15328 $test-emit-subx-stmt-select-primitive-2:initialize-type: -15329 # var type/ecx: (payload tree type-id) = int -15330 68/push 0/imm32/right:null -15331 68/push 0/imm32/right:null -15332 68/push 0/imm32/left:unused -15333 68/push 1/imm32/value:int -15334 68/push 1/imm32/is-atom?:true -15335 68/push 0x11/imm32/alloc-id:fake:payload -15336 89/<- %ecx 4/r32/esp -15337 $test-emit-subx-stmt-select-primitive-2:initialize-var: -15338 # var var-foo/ecx: (payload var) -15339 68/push 0/imm32/register -15340 68/push 0/imm32/register -15341 68/push 0/imm32/no-stack-offset -15342 68/push 1/imm32/block-depth -15343 51/push-ecx -15344 68/push 0x11/imm32/alloc-id:fake -15345 68/push 0/imm32/name -15346 68/push 0/imm32/name -15347 68/push 0x11/imm32/alloc-id:fake:payload -15348 89/<- %ecx 4/r32/esp -15349 $test-emit-subx-stmt-select-primitive-2:initialize-var-name: -15350 # var-foo->name = "foo" -15351 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15352 (copy-array Heap "foo" %eax) -15353 $test-emit-subx-stmt-select-primitive-2:initialize-var-register: -15354 # var-foo->register = "eax" -15355 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -15356 (copy-array Heap "eax" %eax) -15357 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-var: -15358 # var operand/ebx: (payload stmt-var) -15359 68/push 0/imm32/is-deref:false -15360 68/push 0/imm32/next -15361 68/push 0/imm32/next -15362 51/push-ecx/var-foo -15363 68/push 0x11/imm32/alloc-id:fake -15364 68/push 0x11/imm32/alloc-id:fake:payload -15365 89/<- %ebx 4/r32/esp -15366 $test-emit-subx-stmt-select-primitive-2:initialize-stmt: -15367 # var stmt/esi: (addr statement) -15368 68/push 0/imm32/no-outputs -15369 68/push 0/imm32/no-outputs -15370 53/push-ebx/inouts -15371 68/push 0x11/imm32/alloc-id:fake -15372 68/push 0/imm32/operation -15373 68/push 0/imm32/operation -15374 68/push 1/imm32 -15375 89/<- %esi 4/r32/esp -15376 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-operation: -15377 # stmt->operation = "increment" -15378 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15379 (copy-array Heap "increment" %eax) -15380 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var: -15381 # var formal-var/ebx: (payload var) -15382 68/push 0/imm32/register -15383 68/push 0/imm32/register -15384 68/push 0/imm32/no-stack-offset -15385 68/push 1/imm32/block-depth -15386 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -15387 68/push 0x11/imm32/alloc-id:fake -15388 68/push 0/imm32/name -15389 68/push 0/imm32/name -15390 68/push 0x11/imm32/alloc-id:fake:payload -15391 89/<- %ebx 4/r32/esp -15392 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var-name: -15393 # formal-var->name = "dummy" -15394 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -15395 (copy-array Heap "dummy" %eax) -15396 $test-emit-subx-stmt-select-primitive-2:initialize-formal-register: -15397 # formal-var->register = "*" -15398 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -15399 (copy-array Heap "*" %eax) # Any-register -15400 $test-emit-subx-stmt-select-primitive-2:initialize-var-list: -15401 # var formal-outputs/ebx: (payload list stmt-var) -15402 68/push 0/imm32/next -15403 68/push 0/imm32/next -15404 53/push-ebx/formal-var -15405 68/push 0x11/imm32/alloc-id:fake -15406 68/push 0x11/imm32/alloc-id:fake:payload -15407 89/<- %ebx 4/r32/esp -15408 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2: -15409 # var primitive2/edi: (payload primitive) -15410 68/push 0/imm32/next -15411 68/push 0/imm32/next -15412 68/push 0/imm32/output-is-write-only -15413 68/push 0/imm32/no-disp32 -15414 68/push 0/imm32/no-imm32 -15415 68/push 0/imm32/no-r32 -15416 68/push 3/imm32/rm32-is-first-output -15417 68/push 0/imm32/subx-name -15418 68/push 0/imm32/subx-name -15419 53/push-ebx/outputs -15420 68/push 0x11/imm32/alloc-id:fake -15421 68/push 0/imm32/no-inouts -15422 68/push 0/imm32/no-inouts -15423 68/push 0/imm32/name -15424 68/push 0/imm32/name -15425 68/push 0x11/imm32/alloc-id:fake:payload -15426 89/<- %edi 4/r32/esp -15427 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-name: -15428 # primitives->name = "increment" -15429 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 -15430 (copy-array Heap "increment" %eax) -15431 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-subx-name: -15432 # primitives->subx-name = "ff 0/subop/increment" -15433 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 -15434 (copy-array Heap "ff 0/subop/increment" %eax) -15435 $test-emit-subx-stmt-select-primitive-2:initialize-primitive: -15436 # var primitives/ebx: (addr primitive) -15437 57/push-edi -15438 68/push 0x11/imm32/alloc-id:fake -15439 68/push 0/imm32/output-is-write-only -15440 68/push 0/imm32/no-disp32 -15441 68/push 0/imm32/no-imm32 -15442 68/push 0/imm32/no-r32 -15443 68/push 1/imm32/rm32-is-first-inout -15444 68/push 0/imm32/subx-name -15445 68/push 0/imm32/subx-name -15446 68/push 0/imm32/no-outputs -15447 68/push 0/imm32/no-outputs -15448 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -15449 68/push 0x11/imm32/alloc-id:fake -15450 68/push 0/imm32/name -15451 68/push 0/imm32/name -15452 89/<- %ebx 4/r32/esp -15453 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-name: -15454 # primitives->name = "increment" -15455 (copy-array Heap "increment" %ebx) # Primitive-name -15456 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-subx-name: -15457 # primitives->subx-name = "ff 0/subop/increment" -15458 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -15459 (copy-array Heap "ff 0/subop/increment" %eax) -15460 # convert -15461 c7 0/subop/copy *Curr-block-depth 0/imm32 -15462 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) -15463 (flush _test-output-buffered-file) -15464 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -15470 # check output -15471 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2") -15472 # . epilogue -15473 89/<- %esp 5/r32/ebp -15474 5d/pop-to-ebp -15475 c3/return -15476 -15477 test-increment-register: -15478 # Select the right register between overloads. -15479 # foo <- increment -15480 # => -15481 # 50/increment-eax -15482 # -15483 # There's a variable on the var stack as follows: -15484 # name: 'foo' -15485 # type: int -15486 # register: 'eax' -15487 # -15488 # Primitives are the global definitions. -15489 # -15490 # . prologue -15491 55/push-ebp -15492 89/<- %ebp 4/r32/esp -15493 # setup -15494 (clear-stream _test-output-stream) -15495 (clear-stream $_test-output-buffered-file->buffer) -15496 $test-increment-register:initialize-type: -15497 # var type/ecx: (payload tree type-id) = int -15498 68/push 0/imm32/right:null -15499 68/push 0/imm32/right:null -15500 68/push 0/imm32/left:unused -15501 68/push 1/imm32/value:int -15502 68/push 1/imm32/is-atom?:true -15503 68/push 0x11/imm32/alloc-id:fake:payload -15504 89/<- %ecx 4/r32/esp -15505 $test-increment-register:initialize-var: -15506 # var var-foo/ecx: (payload var) -15507 68/push 0/imm32/register -15508 68/push 0/imm32/register -15509 68/push 0/imm32/no-stack-offset -15510 68/push 1/imm32/block-depth -15511 51/push-ecx -15512 68/push 0x11/imm32/alloc-id:fake -15513 68/push 0/imm32/name -15514 68/push 0/imm32/name -15515 68/push 0x11/imm32/alloc-id:fake:payload -15516 89/<- %ecx 4/r32/esp -15517 $test-increment-register:initialize-var-name: -15518 # var-foo->name = "foo" -15519 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15520 (copy-array Heap "foo" %eax) -15521 $test-increment-register:initialize-var-register: -15522 # var-foo->register = "eax" -15523 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -15524 (copy-array Heap "eax" %eax) -15525 $test-increment-register:initialize-stmt-var: -15526 # var operand/ebx: (payload stmt-var) -15527 68/push 0/imm32/is-deref:false -15528 68/push 0/imm32/next -15529 68/push 0/imm32/next -15530 51/push-ecx/var-foo -15531 68/push 0x11/imm32/alloc-id:fake -15532 68/push 0x11/imm32/alloc-id:fake:payload -15533 89/<- %ebx 4/r32/esp -15534 $test-increment-register:initialize-stmt: -15535 # var stmt/esi: (addr statement) -15536 53/push-ebx/outputs -15537 68/push 0x11/imm32/alloc-id:fake -15538 68/push 0/imm32/no-inouts -15539 68/push 0/imm32/no-inouts -15540 68/push 0/imm32/operation -15541 68/push 0/imm32/operation -15542 68/push 1/imm32 -15543 89/<- %esi 4/r32/esp -15544 $test-increment-register:initialize-stmt-operation: -15545 # stmt->operation = "increment" -15546 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15547 (copy-array Heap "increment" %eax) -15548 # convert -15549 c7 0/subop/copy *Curr-block-depth 0/imm32 -15550 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -15551 (flush _test-output-buffered-file) -15552 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -15558 # check output -15559 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register") -15560 # . epilogue -15561 89/<- %esp 5/r32/ebp -15562 5d/pop-to-ebp -15563 c3/return -15564 -15565 test-add-reg-to-reg: -15566 # var1/reg <- add var2/reg -15567 # => -15568 # 01/add-to %var1 var2 -15569 # -15570 # . prologue -15571 55/push-ebp -15572 89/<- %ebp 4/r32/esp -15573 # setup -15574 (clear-stream _test-output-stream) -15575 (clear-stream $_test-output-buffered-file->buffer) -15576 $test-add-reg-to-reg:initialize-type: -15577 # var type/ecx: (payload tree type-id) = int -15578 68/push 0/imm32/right:null -15579 68/push 0/imm32/right:null -15580 68/push 0/imm32/left:unused -15581 68/push 1/imm32/value:int -15582 68/push 1/imm32/is-atom?:true -15583 68/push 0x11/imm32/alloc-id:fake:payload -15584 89/<- %ecx 4/r32/esp -15585 $test-add-reg-to-reg:initialize-var1: -15586 # var var1/ecx: (payload var) -15587 68/push 0/imm32/register -15588 68/push 0/imm32/register -15589 68/push 0/imm32/no-stack-offset -15590 68/push 1/imm32/block-depth -15591 51/push-ecx -15592 68/push 0x11/imm32/alloc-id:fake -15593 68/push 0/imm32/name -15594 68/push 0/imm32/name -15595 68/push 0x11/imm32/alloc-id:fake:payload -15596 89/<- %ecx 4/r32/esp -15597 $test-add-reg-to-reg:initialize-var1-name: -15598 # var1->name = "var1" -15599 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15600 (copy-array Heap "var1" %eax) -15601 $test-add-reg-to-reg:initialize-var1-register: -15602 # var1->register = "eax" -15603 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -15604 (copy-array Heap "eax" %eax) -15605 $test-add-reg-to-reg:initialize-var2: -15606 # var var2/edx: (payload var) -15607 68/push 0/imm32/register -15608 68/push 0/imm32/register -15609 68/push 0/imm32/no-stack-offset -15610 68/push 1/imm32/block-depth -15611 ff 6/subop/push *(ecx+0x10) -15612 68/push 0x11/imm32/alloc-id:fake -15613 68/push 0/imm32/name -15614 68/push 0/imm32/name -15615 68/push 0x11/imm32/alloc-id:fake:payload -15616 89/<- %edx 4/r32/esp -15617 $test-add-reg-to-reg:initialize-var2-name: -15618 # var2->name = "var2" -15619 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -15620 (copy-array Heap "var2" %eax) -15621 $test-add-reg-to-reg:initialize-var2-register: -15622 # var2->register = "ecx" -15623 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -15624 (copy-array Heap "ecx" %eax) -15625 $test-add-reg-to-reg:initialize-inouts: -15626 # var inouts/esi: (payload stmt-var) = [var2] -15627 68/push 0/imm32/is-deref:false -15628 68/push 0/imm32/next -15629 68/push 0/imm32/next -15630 52/push-edx/var2 -15631 68/push 0x11/imm32/alloc-id:fake -15632 68/push 0x11/imm32/alloc-id:fake:payload -15633 89/<- %esi 4/r32/esp -15634 $test-add-reg-to-reg:initialize-outputs: -15635 # var outputs/edi: (payload stmt-var) = [var1] -15636 68/push 0/imm32/is-deref:false -15637 68/push 0/imm32/next -15638 68/push 0/imm32/next -15639 51/push-ecx/var1 -15640 68/push 0x11/imm32/alloc-id:fake -15641 68/push 0x11/imm32/alloc-id:fake:payload -15642 89/<- %edi 4/r32/esp -15643 $test-add-reg-to-reg:initialize-stmt: -15644 # var stmt/esi: (addr statement) -15645 68/push 0/imm32/next -15646 68/push 0/imm32/next -15647 57/push-edi/outputs -15648 68/push 0x11/imm32/alloc-id:fake -15649 56/push-esi/inouts -15650 68/push 0x11/imm32/alloc-id:fake -15651 68/push 0/imm32/operation -15652 68/push 0/imm32/operation -15653 68/push 1/imm32/tag:stmt1 -15654 89/<- %esi 4/r32/esp -15655 $test-add-reg-to-reg:initialize-stmt-operation: -15656 # stmt->operation = "add" -15657 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15658 (copy-array Heap "add" %eax) -15659 # convert -15660 c7 0/subop/copy *Curr-block-depth 0/imm32 -15661 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -15662 (flush _test-output-buffered-file) -15663 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -15669 # check output -15670 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg") -15671 # . epilogue -15672 89/<- %esp 5/r32/ebp -15673 5d/pop-to-ebp -15674 c3/return -15675 -15676 test-add-reg-to-mem: -15677 # add-to var1 var2/reg -15678 # => -15679 # 01/add-to *(ebp+__) var2 -15680 # +15303 find-matching-primitive: # primitives: (addr primitive), stmt: (addr stmt) -> result/eax: (addr primitive) +15304 # . prologue +15305 55/push-ebp +15306 89/<- %ebp 4/r32/esp +15307 # . save registers +15308 51/push-ecx +15309 # var curr/ecx: (addr primitive) = primitives +15310 8b/-> *(ebp+8) 1/r32/ecx +15311 { +15312 $find-matching-primitive:loop: +15313 # if (curr == null) break +15314 81 7/subop/compare %ecx 0/imm32 +15315 74/jump-if-= break/disp8 +15316 # if match(curr, stmt) return curr +15317 { +15318 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx) # => eax +15319 3d/compare-eax-and 0/imm32/false +15320 74/jump-if-= break/disp8 +15321 89/<- %eax 1/r32/ecx +15322 eb/jump $find-matching-primitive:end/disp8 +15323 } +15324 $find-matching-primitive:next-primitive: +15325 # curr = curr->next +15326 (lookup *(ecx+0x34) *(ecx+0x38)) # Primitive-next Primitive-next => eax +15327 89/<- %ecx 0/r32/eax +15328 # +15329 e9/jump loop/disp32 +15330 } +15331 # return null +15332 b8/copy-to-eax 0/imm32 +15333 $find-matching-primitive:end: +15334 # . restore registers +15335 59/pop-to-ecx +15336 # . epilogue +15337 89/<- %esp 5/r32/ebp +15338 5d/pop-to-ebp +15339 c3/return +15340 +15341 mu-stmt-matches-primitive?: # stmt: (addr stmt), primitive: (addr primitive) -> result/eax: boolean +15342 # A mu stmt matches a primitive if the name matches, all the inout vars +15343 # match, and all the output vars match. +15344 # Vars match if types match and registers match. +15345 # In addition, a stmt output matches a primitive's output if types match +15346 # and the primitive has a wildcard register. +15347 # . prologue +15348 55/push-ebp +15349 89/<- %ebp 4/r32/esp +15350 # . save registers +15351 51/push-ecx +15352 52/push-edx +15353 53/push-ebx +15354 56/push-esi +15355 57/push-edi +15356 # ecx = stmt +15357 8b/-> *(ebp+8) 1/r32/ecx +15358 # edx = primitive +15359 8b/-> *(ebp+0xc) 2/r32/edx +15360 { +15361 $mu-stmt-matches-primitive?:check-name: +15362 # if (primitive->name != stmt->operation) return false +15363 # . var esi: (addr array byte) = lookup(stmt->operation) +15364 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +15365 89/<- %esi 0/r32/eax +15366 # . var edi: (addr array byte) = lookup(primitive->name) +15367 (lookup *edx *(edx+4)) # Primitive-name Primitive-name => eax +15368 89/<- %edi 0/r32/eax +15369 (string-equal? %esi %edi) # => eax +15370 3d/compare-eax-and 0/imm32/false +15371 75/jump-if-!= break/disp8 +15372 b8/copy-to-eax 0/imm32 +15373 e9/jump $mu-stmt-matches-primitive?:end/disp32 +15374 } +15375 # var curr/esi: (addr stmt-var) = lookup(stmt->inouts) +15376 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +15377 89/<- %esi 0/r32/eax +15378 # var curr2/edi: (addr list var) = lookup(primitive->inouts) +15379 (lookup *(edx+8) *(edx+0xc)) # Primitive-inouts Primitive-inouts => eax +15380 89/<- %edi 0/r32/eax +15381 { +15382 $mu-stmt-matches-primitive?:inouts-loop: +15383 # if (curr == 0 && curr2 == 0) move on to check outputs +15384 { +15385 $mu-stmt-matches-primitive?:check-both-inouts-null: +15386 81 7/subop/compare %esi 0/imm32 +15387 75/jump-if-!= break/disp8 +15388 $mu-stmt-matches-primitive?:stmt-inout-null: +15389 81 7/subop/compare %edi 0/imm32 +15390 0f 84/jump-if-= $mu-stmt-matches-primitive?:check-outputs/disp32 +15391 $mu-stmt-matches-primitive?:stmt-inout-null-and-prim-inout-not-null: +15392 # return false +15393 b8/copy-to-eax 0/imm32/false +15394 e9/jump $mu-stmt-matches-primitive?:end/disp32 +15395 } +15396 # if (curr2 == 0) return false +15397 { +15398 $mu-stmt-matches-primitive?:check-prim-inout-null: +15399 81 7/subop/compare %edi 0/imm32 +15400 75/jump-if-!= break/disp8 +15401 $mu-stmt-matches-primitive?:prim-inout-null: +15402 b8/copy-to-eax 0/imm32/false +15403 e9/jump $mu-stmt-matches-primitive?:end/disp32 +15404 } +15405 # if (curr != curr2) return false +15406 { +15407 $mu-stmt-matches-primitive?:check-inouts-match: +15408 (lookup *edi *(edi+4)) # List-value List-value => eax +15409 (operand-matches-primitive? %esi %eax) # => eax +15410 3d/compare-eax-and 0/imm32/false +15411 75/jump-if-!= break/disp8 +15412 $mu-stmt-matches-primitive?:inouts-match: +15413 b8/copy-to-eax 0/imm32/false +15414 e9/jump $mu-stmt-matches-primitive?:end/disp32 +15415 } +15416 $mu-stmt-matches-primitive?:next-inout: +15417 # curr = lookup(curr->next) +15418 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +15419 89/<- %esi 0/r32/eax +15420 # curr2 = lookup(curr2->next) +15421 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +15422 89/<- %edi 0/r32/eax +15423 # +15424 e9/jump loop/disp32 +15425 } +15426 $mu-stmt-matches-primitive?:check-outputs: +15427 # var curr/esi: (addr stmt-var) = lookup(stmt->outputs) +15428 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +15429 89/<- %esi 0/r32/eax +15430 # var curr2/edi: (addr list var) = lookup(primitive->outputs) +15431 (lookup *(edx+0x10) *(edx+0x14)) # Primitive-outputs Primitive-outputs => eax +15432 89/<- %edi 0/r32/eax +15433 { +15434 $mu-stmt-matches-primitive?:outputs-loop: +15435 # if (curr == 0) return (curr2 == 0) +15436 { +15437 $mu-stmt-matches-primitive?:check-both-outputs-null: +15438 81 7/subop/compare %esi 0/imm32 +15439 75/jump-if-!= break/disp8 +15440 { +15441 $mu-stmt-matches-primitive?:stmt-output-null: +15442 81 7/subop/compare %edi 0/imm32 +15443 75/jump-if-!= break/disp8 +15444 $mu-stmt-matches-primitive?:both-outputs-null: +15445 # return true +15446 b8/copy-to-eax 1/imm32 +15447 e9/jump $mu-stmt-matches-primitive?:end/disp32 +15448 } +15449 $mu-stmt-matches-primitive?:stmt-output-null-and-prim-output-not-null: +15450 # return false +15451 b8/copy-to-eax 0/imm32 +15452 e9/jump $mu-stmt-matches-primitive?:end/disp32 +15453 } +15454 # if (curr2 == 0) return false +15455 { +15456 $mu-stmt-matches-primitive?:check-prim-output-null: +15457 81 7/subop/compare %edi 0/imm32 +15458 75/jump-if-!= break/disp8 +15459 $mu-stmt-matches-primitive?:prim-output-is-null: +15460 b8/copy-to-eax 0/imm32 +15461 e9/jump $mu-stmt-matches-primitive?:end/disp32 +15462 } +15463 # if (curr != curr2) return false +15464 { +15465 $mu-stmt-matches-primitive?:check-outputs-match: +15466 (lookup *edi *(edi+4)) # List-value List-value => eax +15467 (operand-matches-primitive? %esi %eax) # => eax +15468 3d/compare-eax-and 0/imm32/false +15469 75/jump-if-!= break/disp8 +15470 $mu-stmt-matches-primitive?:outputs-match: +15471 b8/copy-to-eax 0/imm32 +15472 e9/jump $mu-stmt-matches-primitive?:end/disp32 +15473 } +15474 $mu-stmt-matches-primitive?:next-output: +15475 # curr = lookup(curr->next) +15476 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +15477 89/<- %esi 0/r32/eax +15478 # curr2 = lookup(curr2->next) +15479 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +15480 89/<- %edi 0/r32/eax +15481 # +15482 e9/jump loop/disp32 +15483 } +15484 $mu-stmt-matches-primitive?:return-true: +15485 b8/copy-to-eax 1/imm32 +15486 $mu-stmt-matches-primitive?:end: +15487 # . restore registers +15488 5f/pop-to-edi +15489 5e/pop-to-esi +15490 5b/pop-to-ebx +15491 5a/pop-to-edx +15492 59/pop-to-ecx +15493 # . epilogue +15494 89/<- %esp 5/r32/ebp +15495 5d/pop-to-ebp +15496 c3/return +15497 +15498 operand-matches-primitive?: # s: (addr stmt-var), prim-var: (addr var) -> result/eax: boolean +15499 # . prologue +15500 55/push-ebp +15501 89/<- %ebp 4/r32/esp +15502 # . save registers +15503 51/push-ecx +15504 52/push-edx +15505 53/push-ebx +15506 56/push-esi +15507 57/push-edi +15508 # ecx = s +15509 8b/-> *(ebp+8) 1/r32/ecx +15510 # var var/esi: (addr var) = lookup(s->value) +15511 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +15512 89/<- %esi 0/r32/eax +15513 # edi = prim-var +15514 8b/-> *(ebp+0xc) 7/r32/edi +15515 $operand-matches-primitive?:check-type: +15516 # if (var->type != prim-var->type) return false +15517 # . var vtype/ebx: (addr tree type-id) = lookup(var->type) +15518 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +15519 89/<- %ebx 0/r32/eax +15520 # . var ptype/eax: (addr tree type-id) = lookup(prim-var->type) +15521 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +15522 (subx-type-equal? %ebx %eax) # => eax +15523 3d/compare-eax-and 0/imm32/false +15524 0f 84/jump-if-= $operand-matches-primitive?:return-false/disp32 +15525 { +15526 $operand-matches-primitive?:check-register: +15527 # if prim-var is in memory and var is in register but dereference, match +15528 { +15529 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register +15530 0f 85/jump-if-!= break/disp32 +15531 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +15532 74/jump-if-= break/disp8 +15533 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +15534 74/jump-if-= break/disp8 +15535 $operand-matches-primitive?:var-deref-match: +15536 e9/jump $operand-matches-primitive?:return-true/disp32 +15537 } +15538 # if prim-var is in register and var is in register but dereference, no match +15539 { +15540 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register +15541 0f 84/jump-if-= break/disp32 +15542 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +15543 0f 84/jump-if-= break/disp32 +15544 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +15545 74/jump-if-= break/disp8 +15546 $operand-matches-primitive?:var-deref-no-match: +15547 e9/jump $operand-matches-primitive?:return-false/disp32 +15548 } +15549 # return false if var->register doesn't match prim-var->register +15550 { +15551 # if register addresses are equal, it's a match +15552 # var vreg/ebx: (addr array byte) = lookup(var->register) +15553 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +15554 89/<- %ebx 0/r32/eax +15555 # var preg/ecx: (addr array byte) = lookup(prim-var->register) +15556 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax +15557 89/<- %ecx 0/r32/eax +15558 # if (vreg == preg) break +15559 39/compare %ecx 3/r32/ebx +15560 74/jump-if-= break/disp8 +15561 $operand-matches-primitive?:var-register-no-match: +15562 # if either address is 0, return false +15563 81 7/subop/compare %ebx 0/imm32 +15564 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +15565 81 7/subop/compare %ecx 0/imm32 +15566 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +15567 # if prim-var->register is wildcard, it's a match +15568 (string-equal? %ecx "*") # Any-register => eax +15569 3d/compare-eax-and 0/imm32/false +15570 75/jump-if-!= break/disp8 +15571 $operand-matches-primitive?:wildcard-no-match: +15572 # if string contents aren't equal, return false +15573 (string-equal? %ecx %ebx) # => eax +15574 3d/compare-eax-and 0/imm32/false +15575 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +15576 } +15577 } +15578 $operand-matches-primitive?:return-true: +15579 b8/copy-to-eax 1/imm32/true +15580 eb/jump $operand-matches-primitive?:end/disp8 +15581 $operand-matches-primitive?:return-false: +15582 b8/copy-to-eax 0/imm32/false +15583 $operand-matches-primitive?:end: +15584 # . restore registers +15585 5f/pop-to-edi +15586 5e/pop-to-esi +15587 5b/pop-to-ebx +15588 5a/pop-to-edx +15589 59/pop-to-ecx +15590 # . epilogue +15591 89/<- %esp 5/r32/ebp +15592 5d/pop-to-ebp +15593 c3/return +15594 +15595 find-matching-function: # functions: (addr function), stmt: (addr stmt) -> result/eax: (addr function) +15596 # . prologue +15597 55/push-ebp +15598 89/<- %ebp 4/r32/esp +15599 # . save registers +15600 51/push-ecx +15601 # var curr/ecx: (handle function) = functions +15602 8b/-> *(ebp+8) 1/r32/ecx +15603 { +15604 # if (curr == null) break +15605 81 7/subop/compare %ecx 0/imm32 +15606 74/jump-if-= break/disp8 +15607 #? (write-buffered Stderr "iter\n") +15608 #? (flush Stderr) +15609 # if match(stmt, curr) return curr +15610 { +15611 (mu-stmt-matches-function? *(ebp+0xc) %ecx) # => eax +15612 3d/compare-eax-and 0/imm32/false +15613 74/jump-if-= break/disp8 +15614 89/<- %eax 1/r32/ecx +15615 eb/jump $find-matching-function:end/disp8 +15616 } +15617 # curr = curr->next +15618 (lookup *(ecx+0x20) *(ecx+0x24)) # Function-next Function-next => eax +15619 89/<- %ecx 0/r32/eax +15620 # +15621 eb/jump loop/disp8 +15622 } +15623 # return null +15624 b8/copy-to-eax 0/imm32 +15625 $find-matching-function:end: +15626 # . restore registers +15627 59/pop-to-ecx +15628 # . epilogue +15629 89/<- %esp 5/r32/ebp +15630 5d/pop-to-ebp +15631 c3/return +15632 +15633 # Just compare names; user-defined functions don't support overloading yet. +15634 mu-stmt-matches-function?: # stmt: (addr stmt1), function: (addr function) -> result/eax: boolean +15635 # . prologue +15636 55/push-ebp +15637 89/<- %ebp 4/r32/esp +15638 # . save registers +15639 51/push-ecx +15640 # return function->name == stmt->operation +15641 # ecx = lookup(stmt->operation) +15642 8b/-> *(ebp+8) 0/r32/eax +15643 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +15644 89/<- %ecx 0/r32/eax +15645 # eax = lookup(function->name) +15646 8b/-> *(ebp+0xc) 0/r32/eax +15647 (lookup *eax *(eax+4)) # Function-name Function-name => eax +15648 (string-equal? %eax %ecx) # => eax +15649 $mu-stmt-matches-function?:end: +15650 # . restore registers +15651 59/pop-to-ecx +15652 # . epilogue +15653 89/<- %esp 5/r32/ebp +15654 5d/pop-to-ebp +15655 c3/return +15656 +15657 subx-type-equal?: # a: (addr tree type-id), b: (addr tree type-id) -> result/eax: boolean +15658 # . prologue +15659 55/push-ebp +15660 89/<- %ebp 4/r32/esp +15661 # . save registers +15662 51/push-ecx +15663 # var alit/ecx: boolean = is-literal-type?(a) +15664 (is-simple-mu-type? *(ebp+8) 0) # => eax +15665 89/<- %ecx 0/r32/eax +15666 # var blit/eax: boolean = is-literal-type?(b) +15667 (is-simple-mu-type? *(ebp+0xc) 0) # => eax +15668 # return alit == blit +15669 39/compare %eax 1/r32/ecx +15670 0f 94/set-byte-if-= %al +15671 81 4/subop/and %eax 0xff/imm32 +15672 $subx-type-equal?:end: +15673 # . restore registers +15674 59/pop-to-ecx +15675 # . epilogue +15676 89/<- %esp 5/r32/ebp +15677 5d/pop-to-ebp +15678 c3/return +15679 +15680 is-simple-mu-type?: # a: (addr tree type-id), n: type-id -> result/eax: boolean 15681 # . prologue 15682 55/push-ebp 15683 89/<- %ebp 4/r32/esp -15684 # setup -15685 (clear-stream _test-output-stream) -15686 (clear-stream $_test-output-buffered-file->buffer) -15687 $test-add-reg-to-mem:initialize-type: -15688 # var type/ecx: (payload tree type-id) = int -15689 68/push 0/imm32/right:null -15690 68/push 0/imm32/right:null -15691 68/push 0/imm32/left:unused -15692 68/push 1/imm32/value:int -15693 68/push 1/imm32/is-atom?:true -15694 68/push 0x11/imm32/alloc-id:fake:payload -15695 89/<- %ecx 4/r32/esp -15696 $test-add-reg-to-mem:initialize-var1: -15697 # var var1/ecx: (payload var) -15698 68/push 0/imm32/register -15699 68/push 0/imm32/register -15700 68/push 8/imm32/stack-offset -15701 68/push 1/imm32/block-depth -15702 51/push-ecx -15703 68/push 0x11/imm32/alloc-id:fake -15704 68/push 0/imm32/name -15705 68/push 0/imm32/name -15706 68/push 0x11/imm32/alloc-id:fake:payload -15707 89/<- %ecx 4/r32/esp -15708 $test-add-reg-to-mem:initialize-var1-name: -15709 # var1->name = "var1" -15710 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15711 (copy-array Heap "var1" %eax) -15712 $test-add-reg-to-mem:initialize-var2: -15713 # var var2/edx: (payload var) -15714 68/push 0/imm32/register -15715 68/push 0/imm32/register -15716 68/push 0/imm32/no-stack-offset -15717 68/push 1/imm32/block-depth -15718 ff 6/subop/push *(ecx+0x10) -15719 68/push 0x11/imm32/alloc-id:fake -15720 68/push 0/imm32/name -15721 68/push 0/imm32/name -15722 68/push 0x11/imm32/alloc-id:fake:payload -15723 89/<- %edx 4/r32/esp -15724 $test-add-reg-to-mem:initialize-var2-name: -15725 # var2->name = "var2" -15726 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -15727 (copy-array Heap "var2" %eax) -15728 $test-add-reg-to-mem:initialize-var2-register: -15729 # var2->register = "ecx" -15730 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -15731 (copy-array Heap "ecx" %eax) -15732 $test-add-reg-to-mem:initialize-inouts: -15733 # var inouts/esi: (payload stmt-var) = [var2] -15734 68/push 0/imm32/is-deref:false -15735 68/push 0/imm32/next -15736 68/push 0/imm32/next -15737 52/push-edx/var2 -15738 68/push 0x11/imm32/alloc-id:fake -15739 68/push 0x11/imm32/alloc-id:fake:payload -15740 89/<- %esi 4/r32/esp -15741 # inouts = [var1, var2] -15742 68/push 0/imm32/is-deref:false -15743 56/push-esi/next -15744 68/push 0x11/imm32/alloc-id:fake -15745 51/push-ecx/var1 -15746 68/push 0x11/imm32/alloc-id:fake -15747 68/push 0x11/imm32/alloc-id:fake:payload -15748 89/<- %esi 4/r32/esp -15749 $test-add-reg-to-mem:initialize-stmt: -15750 # var stmt/esi: (addr statement) -15751 68/push 0/imm32/next +15684 # . save registers +15685 51/push-ecx +15686 # ecx = n +15687 8b/-> *(ebp+0xc) 1/r32/ecx +15688 # return (a->value == n) +15689 8b/-> *(ebp+8) 0/r32/eax +15690 39/compare *(eax+4) 1/r32/ecx # Tree-value +15691 0f 94/set-byte-if-= %al +15692 81 4/subop/and %eax 0xff/imm32 +15693 $is-simple-mu-type?:end: +15694 # . restore registers +15695 59/pop-to-ecx +15696 # . epilogue +15697 89/<- %esp 5/r32/ebp +15698 5d/pop-to-ebp +15699 c3/return +15700 +15701 test-emit-subx-stmt-primitive: +15702 # Primitive operation on a variable on the stack. +15703 # increment foo +15704 # => +15705 # ff 0/subop/increment *(ebp-8) +15706 # +15707 # There's a variable on the var stack as follows: +15708 # name: 'foo' +15709 # type: int +15710 # stack-offset: -8 +15711 # +15712 # There's a primitive with this info: +15713 # name: 'increment' +15714 # inouts: int/mem +15715 # value: 'ff 0/subop/increment' +15716 # +15717 # . prologue +15718 55/push-ebp +15719 89/<- %ebp 4/r32/esp +15720 # setup +15721 (clear-stream _test-output-stream) +15722 (clear-stream $_test-output-buffered-file->buffer) +15723 # simulate allocated payloads starting with an initial fake alloc-id (0x11) +15724 $test-emit-subx-stmt-primitive:initialize-type: +15725 # var type/ecx: (payload tree type-id) = int +15726 68/push 0/imm32/right:null +15727 68/push 0/imm32/right:null +15728 68/push 0/imm32/left:unused +15729 68/push 1/imm32/value:int +15730 68/push 1/imm32/is-atom?:true +15731 68/push 0x11/imm32/alloc-id:fake:payload +15732 89/<- %ecx 4/r32/esp +15733 $test-emit-subx-stmt-primitive:initialize-var: +15734 # var var-foo/ecx: (payload var) = var(type) +15735 68/push 0/imm32/no-register +15736 68/push 0/imm32/no-register +15737 68/push -8/imm32/stack-offset +15738 68/push 1/imm32/block-depth +15739 51/push-ecx/type +15740 68/push 0x11/imm32/alloc-id:fake +15741 68/push 0/imm32/name +15742 68/push 0/imm32/name +15743 68/push 0x11/imm32/alloc-id:fake:payload +15744 89/<- %ecx 4/r32/esp +15745 $test-emit-subx-stmt-primitive:initialize-var-name: +15746 # var-foo->name = "foo" +15747 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +15748 (copy-array Heap "foo" %eax) +15749 $test-emit-subx-stmt-primitive:initialize-stmt-var: +15750 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +15751 68/push 0/imm32/is-deref:false 15752 68/push 0/imm32/next -15753 68/push 0/imm32/outputs -15754 68/push 0/imm32/outputs -15755 56/push-esi/inouts -15756 68/push 0x11/imm32/alloc-id:fake -15757 68/push 0/imm32/operation -15758 68/push 0/imm32/operation -15759 68/push 1/imm32/tag:stmt1 -15760 89/<- %esi 4/r32/esp -15761 $test-add-reg-to-mem:initialize-stmt-operation: -15762 # stmt->operation = "add-to" -15763 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15764 (copy-array Heap "add-to" %eax) -15765 # convert -15766 c7 0/subop/copy *Curr-block-depth 0/imm32 -15767 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -15768 (flush _test-output-buffered-file) -15769 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -15775 # check output -15776 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem") -15777 # . epilogue -15778 89/<- %esp 5/r32/ebp -15779 5d/pop-to-ebp -15780 c3/return -15781 -15782 test-add-mem-to-reg: -15783 # var1/reg <- add var2 -15784 # => -15785 # 03/add *(ebp+__) var1 -15786 # -15787 # . prologue -15788 55/push-ebp -15789 89/<- %ebp 4/r32/esp -15790 # setup -15791 (clear-stream _test-output-stream) -15792 (clear-stream $_test-output-buffered-file->buffer) -15793 $test-add-mem-to-reg:initialize-type: -15794 # var type/ecx: (payload tree type-id) = int -15795 68/push 0/imm32/right:null -15796 68/push 0/imm32/right:null -15797 68/push 0/imm32/left:unused -15798 68/push 1/imm32/value:int -15799 68/push 1/imm32/is-atom?:true -15800 68/push 0x11/imm32/alloc-id:fake:payload -15801 89/<- %ecx 4/r32/esp -15802 $test-add-mem-to-reg:initialize-var: -15803 # var var1/ecx: (payload var) -15804 68/push 0/imm32/register -15805 68/push 0/imm32/register -15806 68/push 0/imm32/no-stack-offset -15807 68/push 1/imm32/block-depth -15808 51/push-ecx -15809 68/push 0x11/imm32/alloc-id:fake -15810 68/push 0/imm32/name -15811 68/push 0/imm32/name -15812 68/push 0x11/imm32/alloc-id:fake:payload -15813 89/<- %ecx 4/r32/esp -15814 $test-add-mem-to-reg:initialize-var-name: -15815 # var1->name = "foo" -15816 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15817 (copy-array Heap "var1" %eax) -15818 $test-add-mem-to-reg:initialize-var-register: -15819 # var1->register = "eax" -15820 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -15821 (copy-array Heap "eax" %eax) -15822 $test-add-mem-to-reg:initialize-var2: -15823 # var var2/edx: (payload var) -15824 68/push 0/imm32/register -15825 68/push 0/imm32/register -15826 68/push 8/imm32/stack-offset -15827 68/push 1/imm32/block-depth -15828 ff 6/subop/push *(ecx+0x10) -15829 68/push 0x11/imm32/alloc-id:fake -15830 68/push 0/imm32/name -15831 68/push 0/imm32/name -15832 68/push 0x11/imm32/alloc-id:fake:payload -15833 89/<- %edx 4/r32/esp -15834 $test-add-mem-to-reg:initialize-var2-name: -15835 # var2->name = "var2" -15836 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -15837 (copy-array Heap "var2" %eax) -15838 $test-add-mem-to-reg:initialize-inouts: -15839 # var inouts/esi: (payload stmt-var) = [var2] -15840 68/push 0/imm32/is-deref:false -15841 68/push 0/imm32/next -15842 68/push 0/imm32/next -15843 52/push-edx/var2 -15844 68/push 0x11/imm32/alloc-id:fake -15845 68/push 0x11/imm32/alloc-id:fake:payload -15846 89/<- %esi 4/r32/esp -15847 $test-add-mem-to-reg:initialize-outputs: -15848 # var outputs/edi: (payload stmt-var) = [var1] -15849 68/push 0/imm32/is-deref:false -15850 68/push 0/imm32/next -15851 68/push 0/imm32/next -15852 51/push-ecx/var1 -15853 68/push 0x11/imm32/alloc-id:fake -15854 68/push 0x11/imm32/alloc-id:fake:payload -15855 89/<- %edi 4/r32/esp -15856 $test-add-mem-to-reg:initialize-stmt: -15857 # var stmt/esi: (addr statement) -15858 68/push 0/imm32/next -15859 68/push 0/imm32/next -15860 57/push-edi/outputs -15861 68/push 0x11/imm32/alloc-id:fake -15862 56/push-esi/inouts -15863 68/push 0x11/imm32/alloc-id:fake -15864 68/push 0/imm32/operation -15865 68/push 0/imm32/operation -15866 68/push 1/imm32/tag:stmt1 -15867 89/<- %esi 4/r32/esp -15868 $test-add-mem-to-reg:initialize-stmt-operation: -15869 # stmt->operation = "add" -15870 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15871 (copy-array Heap "add" %eax) -15872 # convert -15873 c7 0/subop/copy *Curr-block-depth 0/imm32 -15874 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -15875 (flush _test-output-buffered-file) -15876 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -15882 # check output -15883 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg") -15884 # . epilogue -15885 89/<- %esp 5/r32/ebp -15886 5d/pop-to-ebp -15887 c3/return -15888 -15889 test-add-literal-to-eax: -15890 # var1/eax <- add 0x34 -15891 # => -15892 # 05/add-to-eax 0x34/imm32 -15893 # -15894 # . prologue -15895 55/push-ebp -15896 89/<- %ebp 4/r32/esp -15897 # setup -15898 (clear-stream _test-output-stream) -15899 (clear-stream $_test-output-buffered-file->buffer) -15900 $test-add-literal-to-eax:initialize-var-type: -15901 # var type/ecx: (payload tree type-id) = int -15902 68/push 0/imm32/right:null -15903 68/push 0/imm32/right:null -15904 68/push 0/imm32/left:unused -15905 68/push 1/imm32/value:int -15906 68/push 1/imm32/is-atom?:true -15907 68/push 0x11/imm32/alloc-id:fake:payload -15908 89/<- %ecx 4/r32/esp -15909 $test-add-literal-to-eax:initialize-var: -15910 # var v/ecx: (payload var) -15911 68/push 0/imm32/register -15912 68/push 0/imm32/register -15913 68/push 0/imm32/no-stack-offset -15914 68/push 1/imm32/block-depth -15915 51/push-ecx -15916 68/push 0x11/imm32/alloc-id:fake -15917 68/push 0/imm32/name -15918 68/push 0/imm32/name -15919 68/push 0x11/imm32/alloc-id:fake:payload -15920 89/<- %ecx 4/r32/esp -15921 $test-add-literal-to-eax:initialize-var-name: -15922 # v->name = "v" -15923 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -15924 (copy-array Heap "v" %eax) -15925 $test-add-literal-to-eax:initialize-var-register: -15926 # v->register = "eax" -15927 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -15928 (copy-array Heap "eax" %eax) -15929 $test-add-literal-to-eax:initialize-literal-type: -15930 # var type/edx: (payload tree type-id) = literal -15931 68/push 0/imm32/right:null -15932 68/push 0/imm32/right:null -15933 68/push 0/imm32/left:unused -15934 68/push 0/imm32/value:literal -15935 68/push 1/imm32/is-atom?:true -15936 68/push 0x11/imm32/alloc-id:fake:payload -15937 89/<- %edx 4/r32/esp -15938 $test-add-literal-to-eax:initialize-literal: -15939 # var l/edx: (payload var) -15940 68/push 0/imm32/register -15941 68/push 0/imm32/register -15942 68/push 0/imm32/no-stack-offset -15943 68/push 1/imm32/block-depth -15944 52/push-edx -15945 68/push 0x11/imm32/alloc-id:fake -15946 68/push 0/imm32/name -15947 68/push 0/imm32/name -15948 68/push 0x11/imm32/alloc-id:fake:payload -15949 89/<- %edx 4/r32/esp -15950 $test-add-literal-to-eax:initialize-literal-value: -15951 # l->name = "0x34" -15952 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -15953 (copy-array Heap "0x34" %eax) -15954 $test-add-literal-to-eax:initialize-inouts: -15955 # var inouts/esi: (payload stmt-var) = [l] -15956 68/push 0/imm32/is-deref:false -15957 68/push 0/imm32/next -15958 68/push 0/imm32/next -15959 52/push-edx/l -15960 68/push 0x11/imm32/alloc-id:fake -15961 68/push 0x11/imm32/alloc-id:fake:payload -15962 89/<- %esi 4/r32/esp -15963 $test-add-literal-to-eax:initialize-outputs: -15964 # var outputs/edi: (payload stmt-var) = [v] -15965 68/push 0/imm32/is-deref:false -15966 68/push 0/imm32/next -15967 68/push 0/imm32/next -15968 51/push-ecx/v -15969 68/push 0x11/imm32/alloc-id:fake -15970 68/push 0x11/imm32/alloc-id:fake:payload -15971 89/<- %edi 4/r32/esp -15972 $test-add-literal-to-eax:initialize-stmt: -15973 # var stmt/esi: (addr statement) -15974 68/push 0/imm32/next -15975 68/push 0/imm32/next -15976 57/push-edi/outputs -15977 68/push 0x11/imm32/alloc-id:fake -15978 56/push-esi/inouts -15979 68/push 0x11/imm32/alloc-id:fake -15980 68/push 0/imm32/operation -15981 68/push 0/imm32/operation -15982 68/push 1/imm32/tag:stmt1 -15983 89/<- %esi 4/r32/esp -15984 $test-add-literal-to-eax:initialize-stmt-operation: -15985 # stmt->operation = "add" -15986 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -15987 (copy-array Heap "add" %eax) -15988 # convert -15989 c7 0/subop/copy *Curr-block-depth 0/imm32 -15990 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -15991 (flush _test-output-buffered-file) -15992 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -15998 # check output -15999 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax") -16000 # . epilogue -16001 89/<- %esp 5/r32/ebp -16002 5d/pop-to-ebp -16003 c3/return -16004 -16005 test-add-literal-to-reg: -16006 # var1/ecx <- add 0x34 -16007 # => -16008 # 81 0/subop/add %ecx 0x34/imm32 -16009 # -16010 # . prologue -16011 55/push-ebp -16012 89/<- %ebp 4/r32/esp -16013 # setup -16014 (clear-stream _test-output-stream) -16015 (clear-stream $_test-output-buffered-file->buffer) -16016 $test-add-literal-to-reg:initialize-var-type: -16017 # var type/ecx: (payload tree type-id) = int -16018 68/push 0/imm32/right:null -16019 68/push 0/imm32/right:null -16020 68/push 0/imm32/left:unused -16021 68/push 1/imm32/value:int -16022 68/push 1/imm32/is-atom?:true -16023 68/push 0x11/imm32/alloc-id:fake:payload -16024 89/<- %ecx 4/r32/esp -16025 $test-add-literal-to-reg:initialize-var: -16026 # var v/ecx: (payload var) -16027 68/push 0/imm32/register -16028 68/push 0/imm32/register -16029 68/push 0/imm32/no-stack-offset -16030 68/push 1/imm32/block-depth -16031 51/push-ecx -16032 68/push 0x11/imm32/alloc-id:fake -16033 68/push 0/imm32/name -16034 68/push 0/imm32/name -16035 68/push 0x11/imm32/alloc-id:fake:payload -16036 89/<- %ecx 4/r32/esp -16037 $test-add-literal-to-reg:initialize-var-name: -16038 # v->name = "v" -16039 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -16040 (copy-array Heap "v" %eax) -16041 $test-add-literal-to-reg:initialize-var-register: -16042 # v->register = "ecx" -16043 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -16044 (copy-array Heap "ecx" %eax) -16045 $test-add-literal-to-reg:initialize-literal-type: -16046 # var type/edx: (payload tree type-id) = literal -16047 68/push 0/imm32/right:null -16048 68/push 0/imm32/right:null -16049 68/push 0/imm32/left:unused -16050 68/push 0/imm32/value:literal -16051 68/push 1/imm32/is-atom?:true -16052 68/push 0x11/imm32/alloc-id:fake:payload -16053 89/<- %edx 4/r32/esp -16054 $test-add-literal-to-reg:initialize-literal: -16055 # var l/edx: (payload var) -16056 68/push 0/imm32/register -16057 68/push 0/imm32/register -16058 68/push 0/imm32/no-stack-offset -16059 68/push 1/imm32/block-depth -16060 52/push-edx -16061 68/push 0x11/imm32/alloc-id:fake -16062 68/push 0/imm32/name -16063 68/push 0/imm32/name -16064 68/push 0x11/imm32/alloc-id:fake:payload -16065 89/<- %edx 4/r32/esp -16066 $test-add-literal-to-reg:initialize-literal-value: -16067 # l->name = "0x34" -16068 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -16069 (copy-array Heap "0x34" %eax) -16070 $test-add-literal-to-reg:initialize-inouts: -16071 # var inouts/esi: (payload stmt-var) = [l] -16072 68/push 0/imm32/is-deref:false -16073 68/push 0/imm32/next -16074 68/push 0/imm32/next -16075 52/push-edx/l -16076 68/push 0x11/imm32/alloc-id:fake -16077 68/push 0x11/imm32/alloc-id:fake:payload -16078 89/<- %esi 4/r32/esp -16079 $test-add-literal-to-reg:initialize-outputs: -16080 # var outputs/edi: (payload stmt-var) = [v] -16081 68/push 0/imm32/is-deref:false -16082 68/push 0/imm32/next -16083 68/push 0/imm32/next -16084 51/push-ecx/v -16085 68/push 0x11/imm32/alloc-id:fake -16086 68/push 0x11/imm32/alloc-id:fake:payload -16087 89/<- %edi 4/r32/esp -16088 $test-add-literal-to-reg:initialize-stmt: -16089 # var stmt/esi: (addr statement) -16090 68/push 0/imm32/next -16091 68/push 0/imm32/next -16092 57/push-edi/outputs +15753 68/push 0/imm32/next +15754 51/push-ecx/var-foo +15755 68/push 0x11/imm32/alloc-id:fake +15756 68/push 0x11/imm32/alloc-id:fake:payload +15757 89/<- %ebx 4/r32/esp +15758 $test-emit-subx-stmt-primitive:initialize-stmt: +15759 # var stmt/esi: (addr statement) +15760 68/push 0/imm32/no-outputs +15761 68/push 0/imm32/no-outputs +15762 53/push-ebx/inouts +15763 68/push 0x11/imm32/alloc-id:fake +15764 68/push 0/imm32/operation +15765 68/push 0/imm32/operation +15766 68/push 1/imm32/tag +15767 89/<- %esi 4/r32/esp +15768 $test-emit-subx-stmt-primitive:initialize-stmt-operation: +15769 # stmt->operation = "increment" +15770 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15771 (copy-array Heap "increment" %eax) +15772 $test-emit-subx-stmt-primitive:initialize-primitive: +15773 # var primitives/ebx: (addr primitive) +15774 68/push 0/imm32/next +15775 68/push 0/imm32/next +15776 68/push 0/imm32/output-is-write-only +15777 68/push 0/imm32/no-disp32 +15778 68/push 0/imm32/no-imm32 +15779 68/push 0/imm32/no-r32 +15780 68/push 1/imm32/rm32-is-first-inout +15781 68/push 0/imm32/subx-name +15782 68/push 0/imm32/subx-name +15783 68/push 0/imm32/no-outputs +15784 68/push 0/imm32/no-outputs +15785 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +15786 68/push 0x11/imm32/alloc-id:fake +15787 68/push 0/imm32/name +15788 68/push 0/imm32/name +15789 89/<- %ebx 4/r32/esp +15790 $test-emit-subx-stmt-primitive:initialize-primitive-name: +15791 # primitives->name = "increment" +15792 (copy-array Heap "increment" %ebx) # Primitive-name +15793 $test-emit-subx-stmt-primitive:initialize-primitive-subx-name: +15794 # primitives->subx-name = "ff 0/subop/increment" +15795 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +15796 (copy-array Heap "ff 0/subop/increment" %eax) +15797 # convert +15798 c7 0/subop/copy *Curr-block-depth 0/imm32 +15799 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +15800 (flush _test-output-buffered-file) +15801 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15807 # check output +15808 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive") +15809 # . epilogue +15810 89/<- %esp 5/r32/ebp +15811 5d/pop-to-ebp +15812 c3/return +15813 +15814 test-emit-subx-stmt-primitive-register: +15815 # Primitive operation on a variable in a register. +15816 # foo <- increment +15817 # => +15818 # ff 0/subop/increment %eax # sub-optimal, but should suffice +15819 # +15820 # There's a variable on the var stack as follows: +15821 # name: 'foo' +15822 # type: int +15823 # register: 'eax' +15824 # +15825 # There's a primitive with this info: +15826 # name: 'increment' +15827 # out: int/reg +15828 # value: 'ff 0/subop/increment' +15829 # +15830 # . prologue +15831 55/push-ebp +15832 89/<- %ebp 4/r32/esp +15833 # setup +15834 (clear-stream _test-output-stream) +15835 (clear-stream $_test-output-buffered-file->buffer) +15836 $test-emit-subx-stmt-primitive-register:initialize-type: +15837 # var type/ecx: (payload tree type-id) = int +15838 68/push 0/imm32/right:null +15839 68/push 0/imm32/right:null +15840 68/push 0/imm32/left:unused +15841 68/push 1/imm32/value:int +15842 68/push 1/imm32/is-atom?:true +15843 68/push 0x11/imm32/alloc-id:fake:payload +15844 89/<- %ecx 4/r32/esp +15845 $test-emit-subx-stmt-primitive-register:initialize-var: +15846 # var var-foo/ecx: (payload var) +15847 68/push 0/imm32/register +15848 68/push 0/imm32/register +15849 68/push 0/imm32/no-stack-offset +15850 68/push 1/imm32/block-depth +15851 51/push-ecx +15852 68/push 0x11/imm32/alloc-id:fake +15853 68/push 0/imm32/name +15854 68/push 0/imm32/name +15855 68/push 0x11/imm32/alloc-id:fake:payload +15856 89/<- %ecx 4/r32/esp +15857 $test-emit-subx-stmt-primitive-register:initialize-var-name: +15858 # var-foo->name = "foo" +15859 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +15860 (copy-array Heap "foo" %eax) +15861 $test-emit-subx-stmt-primitive-register:initialize-var-register: +15862 # var-foo->register = "eax" +15863 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +15864 (copy-array Heap "eax" %eax) +15865 $test-emit-subx-stmt-primitive-register:initialize-stmt-var: +15866 # var operand/ebx: (payload stmt-var) +15867 68/push 0/imm32/is-deref:false +15868 68/push 0/imm32/next +15869 68/push 0/imm32/next +15870 51/push-ecx/var-foo +15871 68/push 0x11/imm32/alloc-id:fake +15872 68/push 0x11/imm32/alloc-id:fake:payload +15873 89/<- %ebx 4/r32/esp +15874 $test-emit-subx-stmt-primitive-register:initialize-stmt: +15875 # var stmt/esi: (addr statement) +15876 53/push-ebx/outputs +15877 68/push 0x11/imm32/alloc-id:fake +15878 68/push 0/imm32/no-inouts +15879 68/push 0/imm32/no-inouts +15880 68/push 0/imm32/operation +15881 68/push 0/imm32/operation +15882 68/push 1/imm32 +15883 89/<- %esi 4/r32/esp +15884 $test-emit-subx-stmt-primitive-register:initialize-stmt-operation: +15885 # stmt->operation = "increment" +15886 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +15887 (copy-array Heap "increment" %eax) +15888 $test-emit-subx-stmt-primitive-register:initialize-formal-var: +15889 # var formal-var/ebx: (payload var) +15890 68/push 0/imm32/register +15891 68/push 0/imm32/register +15892 68/push 0/imm32/no-stack-offset +15893 68/push 1/imm32/block-depth +15894 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +15895 68/push 0x11/imm32/alloc-id:fake +15896 68/push 0/imm32/name +15897 68/push 0/imm32/name +15898 68/push 0x11/imm32/alloc-id:fake:payload +15899 89/<- %ebx 4/r32/esp +15900 $test-emit-subx-stmt-primitive-register:initialize-formal-var-name: +15901 # formal-var->name = "dummy" +15902 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +15903 (copy-array Heap "dummy" %eax) +15904 $test-emit-subx-stmt-primitive-register:initialize-formal-register: +15905 # formal-var->register = "*" +15906 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +15907 (copy-array Heap "*" %eax) # Any-register +15908 $test-emit-subx-stmt-primitive-register:initialize-var-list: +15909 # var formal-outputs/ebx: (payload list var) +15910 68/push 0/imm32/next +15911 68/push 0/imm32/next +15912 53/push-ebx/formal-var +15913 68/push 0x11/imm32/alloc-id:fake +15914 68/push 0x11/imm32/alloc-id:fake:payload +15915 89/<- %ebx 4/r32/esp +15916 $test-emit-subx-stmt-primitive-register:initialize-primitive: +15917 # var primitives/ebx: (addr primitive) +15918 68/push 0/imm32/next +15919 68/push 0/imm32/next +15920 68/push 0/imm32/output-is-write-only +15921 68/push 0/imm32/no-disp32 +15922 68/push 0/imm32/no-imm32 +15923 68/push 0/imm32/no-r32 +15924 68/push 3/imm32/rm32-is-first-output +15925 68/push 0/imm32/subx-name +15926 68/push 0/imm32/subx-name +15927 53/push-ebx/outputs +15928 68/push 0x11/imm32/alloc-id:fake +15929 68/push 0/imm32/no-inouts +15930 68/push 0/imm32/no-inouts +15931 68/push 0/imm32/name +15932 68/push 0/imm32/name +15933 89/<- %ebx 4/r32/esp +15934 $test-emit-subx-stmt-primitive-register:initialize-primitive-name: +15935 # primitives->name = "increment" +15936 (copy-array Heap "increment" %ebx) # Primitive-name +15937 $test-emit-subx-stmt-primitive-register:initialize-primitive-subx-name: +15938 # primitives->subx-name = "ff 0/subop/increment" +15939 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +15940 (copy-array Heap "ff 0/subop/increment" %eax) +15941 # convert +15942 c7 0/subop/copy *Curr-block-depth 0/imm32 +15943 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +15944 (flush _test-output-buffered-file) +15945 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +15951 # check output +15952 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register") +15953 # . epilogue +15954 89/<- %esp 5/r32/ebp +15955 5d/pop-to-ebp +15956 c3/return +15957 +15958 test-emit-subx-stmt-select-primitive: +15959 # Select the right primitive between overloads. +15960 # foo <- increment +15961 # => +15962 # ff 0/subop/increment %eax # sub-optimal, but should suffice +15963 # +15964 # There's a variable on the var stack as follows: +15965 # name: 'foo' +15966 # type: int +15967 # register: 'eax' +15968 # +15969 # There's two primitives, as follows: +15970 # - name: 'increment' +15971 # out: int/reg +15972 # value: 'ff 0/subop/increment' +15973 # - name: 'increment' +15974 # inout: int/mem +15975 # value: 'ff 0/subop/increment' +15976 # +15977 # . prologue +15978 55/push-ebp +15979 89/<- %ebp 4/r32/esp +15980 # setup +15981 (clear-stream _test-output-stream) +15982 (clear-stream $_test-output-buffered-file->buffer) +15983 $test-emit-subx-stmt-select-primitive:initialize-type: +15984 # var type/ecx: (payload tree type-id) = int +15985 68/push 0/imm32/right:null +15986 68/push 0/imm32/right:null +15987 68/push 0/imm32/left:unused +15988 68/push 1/imm32/value:int +15989 68/push 1/imm32/is-atom?:true +15990 68/push 0x11/imm32/alloc-id:fake:payload +15991 89/<- %ecx 4/r32/esp +15992 $test-emit-subx-stmt-select-primitive:initialize-var: +15993 # var var-foo/ecx: (payload var) +15994 68/push 0/imm32/register +15995 68/push 0/imm32/register +15996 68/push 0/imm32/no-stack-offset +15997 68/push 1/imm32/block-depth +15998 51/push-ecx +15999 68/push 0x11/imm32/alloc-id:fake +16000 68/push 0/imm32/name +16001 68/push 0/imm32/name +16002 68/push 0x11/imm32/alloc-id:fake:payload +16003 89/<- %ecx 4/r32/esp +16004 $test-emit-subx-stmt-select-primitive:initialize-var-name: +16005 # var-foo->name = "foo" +16006 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +16007 (copy-array Heap "foo" %eax) +16008 $test-emit-subx-stmt-select-primitive:initialize-var-register: +16009 # var-foo->register = "eax" +16010 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +16011 (copy-array Heap "eax" %eax) +16012 $test-emit-subx-stmt-select-primitive:initialize-stmt-var: +16013 # var operand/ebx: (payload stmt-var) +16014 68/push 0/imm32/is-deref:false +16015 68/push 0/imm32/next +16016 68/push 0/imm32/next +16017 51/push-ecx/var-foo +16018 68/push 0x11/imm32/alloc-id:fake +16019 68/push 0x11/imm32/alloc-id:fake:payload +16020 89/<- %ebx 4/r32/esp +16021 $test-emit-subx-stmt-select-primitive:initialize-stmt: +16022 # var stmt/esi: (addr statement) +16023 53/push-ebx/outputs +16024 68/push 0x11/imm32/alloc-id:fake +16025 68/push 0/imm32/no-inouts +16026 68/push 0/imm32/no-inouts +16027 68/push 0/imm32/operation +16028 68/push 0/imm32/operation +16029 68/push 1/imm32 +16030 89/<- %esi 4/r32/esp +16031 $test-emit-subx-stmt-select-primitive:initialize-stmt-operation: +16032 # stmt->operation = "increment" +16033 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +16034 (copy-array Heap "increment" %eax) +16035 $test-emit-subx-stmt-select-primitive:initialize-formal-var: +16036 # var formal-var/ebx: (payload var) +16037 68/push 0/imm32/register +16038 68/push 0/imm32/register +16039 68/push 0/imm32/no-stack-offset +16040 68/push 1/imm32/block-depth +16041 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +16042 68/push 0x11/imm32/alloc-id:fake +16043 68/push 0/imm32/name +16044 68/push 0/imm32/name +16045 68/push 0x11/imm32/alloc-id:fake:payload +16046 89/<- %ebx 4/r32/esp +16047 $test-emit-subx-stmt-select-primitive:initialize-formal-var-name: +16048 # formal-var->name = "dummy" +16049 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +16050 (copy-array Heap "dummy" %eax) +16051 $test-emit-subx-stmt-select-primitive:initialize-formal-register: +16052 # formal-var->register = "*" +16053 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +16054 (copy-array Heap "*" %eax) # Any-register +16055 $test-emit-subx-stmt-select-primitive:initialize-var-list: +16056 # var formal-outputs/ebx: (payload list var) +16057 68/push 0/imm32/next +16058 68/push 0/imm32/next +16059 53/push-ebx/formal-var +16060 68/push 0x11/imm32/alloc-id:fake +16061 68/push 0x11/imm32/alloc-id:fake:payload +16062 89/<- %ebx 4/r32/esp +16063 $test-emit-subx-stmt-select-primitive:initialize-primitive2: +16064 # var primitive2/edi: (payload primitive) +16065 68/push 0/imm32/next +16066 68/push 0/imm32/next +16067 68/push 0/imm32/output-is-write-only +16068 68/push 0/imm32/no-disp32 +16069 68/push 0/imm32/no-imm32 +16070 68/push 0/imm32/no-r32 +16071 68/push 3/imm32/rm32-is-first-output +16072 68/push 0/imm32/subx-name +16073 68/push 0/imm32/subx-name +16074 53/push-ebx/outputs +16075 68/push 0x11/imm32/alloc-id:fake +16076 68/push 0/imm32/no-inouts +16077 68/push 0/imm32/no-inouts +16078 68/push 0/imm32/name +16079 68/push 0/imm32/name +16080 68/push 0x11/imm32/alloc-id:fake:payload +16081 89/<- %edi 4/r32/esp +16082 $test-emit-subx-stmt-select-primitive:initialize-primitive2-name: +16083 # primitives->name = "increment" +16084 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 +16085 (copy-array Heap "increment" %eax) +16086 $test-emit-subx-stmt-select-primitive:initialize-primitive2-subx-name: +16087 # primitives->subx-name = "ff 0/subop/increment" +16088 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 +16089 (copy-array Heap "ff 0/subop/increment" %eax) +16090 $test-emit-subx-stmt-select-primitive:initialize-primitive: +16091 # var primitives/ebx: (addr primitive) +16092 57/push-edi 16093 68/push 0x11/imm32/alloc-id:fake -16094 56/push-esi/inouts -16095 68/push 0x11/imm32/alloc-id:fake -16096 68/push 0/imm32/operation -16097 68/push 0/imm32/operation -16098 68/push 1/imm32/tag:stmt1 -16099 89/<- %esi 4/r32/esp -16100 $test-add-literal-to-reg:initialize-stmt-operation: -16101 # stmt->operation = "add" -16102 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -16103 (copy-array Heap "add" %eax) -16104 # convert -16105 c7 0/subop/copy *Curr-block-depth 0/imm32 -16106 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -16107 (flush _test-output-buffered-file) -16108 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -16114 # check output -16115 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg") -16116 # . epilogue -16117 89/<- %esp 5/r32/ebp -16118 5d/pop-to-ebp -16119 c3/return -16120 -16121 test-add-literal-to-mem: -16122 # add-to var1, 0x34 -16123 # => -16124 # 81 0/subop/add %eax 0x34/imm32 -16125 # -16126 # . prologue -16127 55/push-ebp -16128 89/<- %ebp 4/r32/esp -16129 # setup -16130 (clear-stream _test-output-stream) -16131 (clear-stream $_test-output-buffered-file->buffer) -16132 $test-add-literal-to-mem:initialize-type: -16133 # var type/ecx: (payload tree type-id) = int -16134 68/push 0/imm32/right:null -16135 68/push 0/imm32/right:null -16136 68/push 0/imm32/left:unused -16137 68/push 1/imm32/value:int -16138 68/push 1/imm32/is-atom?:true -16139 68/push 0x11/imm32/alloc-id:fake:payload -16140 89/<- %ecx 4/r32/esp -16141 $test-add-literal-to-mem:initialize-var1: -16142 # var var1/ecx: (payload var) -16143 68/push 0/imm32/register -16144 68/push 0/imm32/register -16145 68/push 8/imm32/stack-offset -16146 68/push 1/imm32/block-depth -16147 51/push-ecx -16148 68/push 0x11/imm32/alloc-id:fake -16149 68/push 0/imm32/name -16150 68/push 0/imm32/name -16151 68/push 0x11/imm32/alloc-id:fake:payload -16152 89/<- %ecx 4/r32/esp -16153 $test-add-literal-to-mem:initialize-var1-name: -16154 # var1->name = "var1" -16155 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -16156 (copy-array Heap "var1" %eax) -16157 $test-add-literal-to-mem:initialize-literal-type: -16158 # var type/edx: (payload tree type-id) = literal +16094 68/push 0/imm32/output-is-write-only +16095 68/push 0/imm32/no-disp32 +16096 68/push 0/imm32/no-imm32 +16097 68/push 0/imm32/no-r32 +16098 68/push 1/imm32/rm32-is-first-inout +16099 68/push 0/imm32/subx-name +16100 68/push 0/imm32/subx-name +16101 68/push 0/imm32/no-outputs +16102 68/push 0/imm32/no-outputs +16103 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +16104 68/push 0x11/imm32/alloc-id:fake +16105 68/push 0/imm32/name +16106 68/push 0/imm32/name +16107 89/<- %ebx 4/r32/esp +16108 $test-emit-subx-stmt-select-primitive:initialize-primitive-name: +16109 # primitives->name = "increment" +16110 (copy-array Heap "increment" %ebx) # Primitive-name +16111 $test-emit-subx-stmt-select-primitive:initialize-primitive-subx-name: +16112 # primitives->subx-name = "ff 0/subop/increment" +16113 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +16114 (copy-array Heap "ff 0/subop/increment" %eax) +16115 # convert +16116 c7 0/subop/copy *Curr-block-depth 0/imm32 +16117 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +16118 (flush _test-output-buffered-file) +16119 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +16125 # check output +16126 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive") +16127 # . epilogue +16128 89/<- %esp 5/r32/ebp +16129 5d/pop-to-ebp +16130 c3/return +16131 +16132 test-emit-subx-stmt-select-primitive-2: +16133 # Select the right primitive between overloads. +16134 # increment foo +16135 # => +16136 # ff 0/subop/increment %eax # sub-optimal, but should suffice +16137 # +16138 # There's a variable on the var stack as follows: +16139 # name: 'foo' +16140 # type: int +16141 # register: 'eax' +16142 # +16143 # There's two primitives, as follows: +16144 # - name: 'increment' +16145 # out: int/reg +16146 # value: 'ff 0/subop/increment' +16147 # - name: 'increment' +16148 # inout: int/mem +16149 # value: 'ff 0/subop/increment' +16150 # +16151 # . prologue +16152 55/push-ebp +16153 89/<- %ebp 4/r32/esp +16154 # setup +16155 (clear-stream _test-output-stream) +16156 (clear-stream $_test-output-buffered-file->buffer) +16157 $test-emit-subx-stmt-select-primitive-2:initialize-type: +16158 # var type/ecx: (payload tree type-id) = int 16159 68/push 0/imm32/right:null 16160 68/push 0/imm32/right:null 16161 68/push 0/imm32/left:unused -16162 68/push 0/imm32/value:literal +16162 68/push 1/imm32/value:int 16163 68/push 1/imm32/is-atom?:true 16164 68/push 0x11/imm32/alloc-id:fake:payload -16165 89/<- %edx 4/r32/esp -16166 $test-add-literal-to-mem:initialize-literal: -16167 # var l/edx: (payload var) +16165 89/<- %ecx 4/r32/esp +16166 $test-emit-subx-stmt-select-primitive-2:initialize-var: +16167 # var var-foo/ecx: (payload var) 16168 68/push 0/imm32/register 16169 68/push 0/imm32/register 16170 68/push 0/imm32/no-stack-offset 16171 68/push 1/imm32/block-depth -16172 52/push-edx +16172 51/push-ecx 16173 68/push 0x11/imm32/alloc-id:fake 16174 68/push 0/imm32/name 16175 68/push 0/imm32/name 16176 68/push 0x11/imm32/alloc-id:fake:payload -16177 89/<- %edx 4/r32/esp -16178 $test-add-literal-to-mem:initialize-literal-value: -16179 # l->name = "0x34" -16180 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -16181 (copy-array Heap "0x34" %eax) -16182 $test-add-literal-to-mem:initialize-inouts: -16183 # var inouts/esi: (payload stmt-var) = [l] -16184 68/push 0/imm32/is-deref:false -16185 68/push 0/imm32/next -16186 68/push 0/imm32/next -16187 52/push-edx/l -16188 68/push 0x11/imm32/alloc-id:fake -16189 68/push 0x11/imm32/alloc-id:fake:payload -16190 89/<- %esi 4/r32/esp -16191 # var inouts = (handle stmt-var) = [var1, var2] -16192 68/push 0/imm32/is-deref:false -16193 56/push-esi/next -16194 68/push 0x11/imm32/alloc-id:fake -16195 51/push-ecx/var1 -16196 68/push 0x11/imm32/alloc-id:fake -16197 68/push 0x11/imm32/alloc-id:fake:payload -16198 89/<- %esi 4/r32/esp -16199 $test-add-literal-to-mem:initialize-stmt: -16200 # var stmt/esi: (addr statement) -16201 68/push 0/imm32/next -16202 68/push 0/imm32/next -16203 68/push 0/imm32/outputs -16204 68/push 0/imm32/outputs -16205 56/push-esi/inouts -16206 68/push 0x11/imm32/alloc-id:fake -16207 68/push 0/imm32/operation -16208 68/push 0/imm32/operation -16209 68/push 1/imm32/tag:stmt1 -16210 89/<- %esi 4/r32/esp -16211 $test-add-literal-to-mem:initialize-stmt-operation: -16212 # stmt->operation = "add-to" -16213 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -16214 (copy-array Heap "add-to" %eax) -16215 # convert -16216 c7 0/subop/copy *Curr-block-depth 0/imm32 -16217 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -16218 (flush _test-output-buffered-file) -16219 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -16225 # check output -16226 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem") -16227 # . epilogue -16228 89/<- %esp 5/r32/ebp -16229 5d/pop-to-ebp -16230 c3/return -16231 -16232 test-compare-reg-with-reg: -16233 # compare var1/ecx, var2/eax -16234 # => -16235 # 39/compare %ecx 0/r32/eax -16236 # -16237 # . prologue -16238 55/push-ebp -16239 89/<- %ebp 4/r32/esp -16240 # setup -16241 (clear-stream _test-output-stream) -16242 (clear-stream $_test-output-buffered-file->buffer) -16243 $test-compare-reg-with-reg:initialize-type: -16244 # var type/ecx: (payload tree type-id) = int -16245 68/push 0/imm32/right:null -16246 68/push 0/imm32/right:null -16247 68/push 0/imm32/left:unused -16248 68/push 1/imm32/value:int -16249 68/push 1/imm32/is-atom?:true -16250 68/push 0x11/imm32/alloc-id:fake:payload -16251 89/<- %ecx 4/r32/esp -16252 $test-compare-reg-with-reg:initialize-var1: -16253 # var var1/ecx: (payload var) -16254 68/push 0/imm32/register -16255 68/push 0/imm32/register -16256 68/push 0/imm32/no-stack-offset -16257 68/push 1/imm32/block-depth -16258 51/push-ecx -16259 68/push 0x11/imm32/alloc-id:fake -16260 68/push 0/imm32/name -16261 68/push 0/imm32/name -16262 68/push 0x11/imm32/alloc-id:fake:payload -16263 89/<- %ecx 4/r32/esp -16264 $test-compare-reg-with-reg:initialize-var1-name: -16265 # var1->name = "var1" -16266 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -16267 (copy-array Heap "var1" %eax) -16268 $test-compare-reg-with-reg:initialize-var1-register: -16269 # var1->register = "ecx" -16270 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -16271 (copy-array Heap "ecx" %eax) -16272 $test-compare-reg-with-reg:initialize-var2: -16273 # var var2/edx: (payload var) -16274 68/push 0/imm32/register -16275 68/push 0/imm32/register -16276 68/push 0/imm32/no-stack-offset -16277 68/push 1/imm32/block-depth -16278 ff 6/subop/push *(ecx+0x10) -16279 68/push 0x11/imm32/alloc-id:fake +16177 89/<- %ecx 4/r32/esp +16178 $test-emit-subx-stmt-select-primitive-2:initialize-var-name: +16179 # var-foo->name = "foo" +16180 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +16181 (copy-array Heap "foo" %eax) +16182 $test-emit-subx-stmt-select-primitive-2:initialize-var-register: +16183 # var-foo->register = "eax" +16184 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +16185 (copy-array Heap "eax" %eax) +16186 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-var: +16187 # var operand/ebx: (payload stmt-var) +16188 68/push 0/imm32/is-deref:false +16189 68/push 0/imm32/next +16190 68/push 0/imm32/next +16191 51/push-ecx/var-foo +16192 68/push 0x11/imm32/alloc-id:fake +16193 68/push 0x11/imm32/alloc-id:fake:payload +16194 89/<- %ebx 4/r32/esp +16195 $test-emit-subx-stmt-select-primitive-2:initialize-stmt: +16196 # var stmt/esi: (addr statement) +16197 68/push 0/imm32/no-outputs +16198 68/push 0/imm32/no-outputs +16199 53/push-ebx/inouts +16200 68/push 0x11/imm32/alloc-id:fake +16201 68/push 0/imm32/operation +16202 68/push 0/imm32/operation +16203 68/push 1/imm32 +16204 89/<- %esi 4/r32/esp +16205 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-operation: +16206 # stmt->operation = "increment" +16207 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +16208 (copy-array Heap "increment" %eax) +16209 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var: +16210 # var formal-var/ebx: (payload var) +16211 68/push 0/imm32/register +16212 68/push 0/imm32/register +16213 68/push 0/imm32/no-stack-offset +16214 68/push 1/imm32/block-depth +16215 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +16216 68/push 0x11/imm32/alloc-id:fake +16217 68/push 0/imm32/name +16218 68/push 0/imm32/name +16219 68/push 0x11/imm32/alloc-id:fake:payload +16220 89/<- %ebx 4/r32/esp +16221 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var-name: +16222 # formal-var->name = "dummy" +16223 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +16224 (copy-array Heap "dummy" %eax) +16225 $test-emit-subx-stmt-select-primitive-2:initialize-formal-register: +16226 # formal-var->register = "*" +16227 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +16228 (copy-array Heap "*" %eax) # Any-register +16229 $test-emit-subx-stmt-select-primitive-2:initialize-var-list: +16230 # var formal-outputs/ebx: (payload list stmt-var) +16231 68/push 0/imm32/next +16232 68/push 0/imm32/next +16233 53/push-ebx/formal-var +16234 68/push 0x11/imm32/alloc-id:fake +16235 68/push 0x11/imm32/alloc-id:fake:payload +16236 89/<- %ebx 4/r32/esp +16237 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2: +16238 # var primitive2/edi: (payload primitive) +16239 68/push 0/imm32/next +16240 68/push 0/imm32/next +16241 68/push 0/imm32/output-is-write-only +16242 68/push 0/imm32/no-disp32 +16243 68/push 0/imm32/no-imm32 +16244 68/push 0/imm32/no-r32 +16245 68/push 3/imm32/rm32-is-first-output +16246 68/push 0/imm32/subx-name +16247 68/push 0/imm32/subx-name +16248 53/push-ebx/outputs +16249 68/push 0x11/imm32/alloc-id:fake +16250 68/push 0/imm32/no-inouts +16251 68/push 0/imm32/no-inouts +16252 68/push 0/imm32/name +16253 68/push 0/imm32/name +16254 68/push 0x11/imm32/alloc-id:fake:payload +16255 89/<- %edi 4/r32/esp +16256 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-name: +16257 # primitives->name = "increment" +16258 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 +16259 (copy-array Heap "increment" %eax) +16260 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-subx-name: +16261 # primitives->subx-name = "ff 0/subop/increment" +16262 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 +16263 (copy-array Heap "ff 0/subop/increment" %eax) +16264 $test-emit-subx-stmt-select-primitive-2:initialize-primitive: +16265 # var primitives/ebx: (addr primitive) +16266 57/push-edi +16267 68/push 0x11/imm32/alloc-id:fake +16268 68/push 0/imm32/output-is-write-only +16269 68/push 0/imm32/no-disp32 +16270 68/push 0/imm32/no-imm32 +16271 68/push 0/imm32/no-r32 +16272 68/push 1/imm32/rm32-is-first-inout +16273 68/push 0/imm32/subx-name +16274 68/push 0/imm32/subx-name +16275 68/push 0/imm32/no-outputs +16276 68/push 0/imm32/no-outputs +16277 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +16278 68/push 0x11/imm32/alloc-id:fake +16279 68/push 0/imm32/name 16280 68/push 0/imm32/name -16281 68/push 0/imm32/name -16282 68/push 0x11/imm32/alloc-id:fake:payload -16283 89/<- %edx 4/r32/esp -16284 $test-compare-reg-with-reg:initialize-var2-name: -16285 # var2->name = "var2" -16286 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -16287 (copy-array Heap "var2" %eax) -16288 $test-compare-reg-with-reg:initialize-var2-register: -16289 # var2->register = "eax" -16290 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -16291 (copy-array Heap "eax" %eax) -16292 $test-compare-reg-with-reg:initialize-inouts: -16293 # var inouts/esi: (payload stmt-var) = [var2] -16294 68/push 0/imm32/is-deref:false -16295 68/push 0/imm32/next -16296 68/push 0/imm32/next -16297 52/push-edx/var2 -16298 68/push 0x11/imm32/alloc-id:fake -16299 68/push 0x11/imm32/alloc-id:fake:payload -16300 89/<- %esi 4/r32/esp -16301 # inouts = [var1, var2] -16302 68/push 0/imm32/is-deref:false -16303 56/push-esi/next -16304 68/push 0x11/imm32/alloc-id:fake -16305 51/push-ecx/var1 -16306 68/push 0x11/imm32/alloc-id:fake -16307 68/push 0x11/imm32/alloc-id:fake:payload -16308 89/<- %esi 4/r32/esp -16309 $test-compare-reg-with-reg:initialize-stmt: -16310 # var stmt/esi: (addr statement) -16311 68/push 0/imm32/next -16312 68/push 0/imm32/next -16313 68/push 0/imm32/outputs -16314 68/push 0/imm32/outputs -16315 56/push-esi/inouts -16316 68/push 0x11/imm32/alloc-id:fake -16317 68/push 0/imm32/operation -16318 68/push 0/imm32/operation -16319 68/push 1/imm32/tag:stmt1 -16320 89/<- %esi 4/r32/esp -16321 $test-compare-reg-with-reg:initialize-stmt-operation: -16322 # stmt->operation = "compare" -16323 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -16324 (copy-array Heap "compare" %eax) -16325 # convert -16326 c7 0/subop/copy *Curr-block-depth 0/imm32 -16327 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -16328 (flush _test-output-buffered-file) -16329 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -16335 # check output -16336 (check-next-stream-line-equal _test-output-stream "39/compare-> %ecx 0x00000000/r32" "F - test-compare-reg-with-reg") -16337 # . epilogue -16338 89/<- %esp 5/r32/ebp -16339 5d/pop-to-ebp -16340 c3/return -16341 -16342 test-compare-mem-with-reg: -16343 # compare var1, var2/eax -16344 # => -16345 # 39/compare *(ebp+___) 0/r32/eax -16346 # -16347 # . prologue -16348 55/push-ebp -16349 89/<- %ebp 4/r32/esp -16350 # setup -16351 (clear-stream _test-output-stream) -16352 (clear-stream $_test-output-buffered-file->buffer) -16353 $test-compare-mem-with-reg:initialize-type: -16354 # var type/ecx: (payload tree type-id) = int -16355 68/push 0/imm32/right:null -16356 68/push 0/imm32/right:null -16357 68/push 0/imm32/left:unused -16358 68/push 1/imm32/value:int -16359 68/push 1/imm32/is-atom?:true -16360 68/push 0x11/imm32/alloc-id:fake:payload -16361 89/<- %ecx 4/r32/esp -16362 $test-compare-mem-with-reg:initialize-var1: -16363 # var var1/ecx: (payload var) -16364 68/push 0/imm32/register -16365 68/push 0/imm32/register -16366 68/push 8/imm32/stack-offset -16367 68/push 1/imm32/block-depth -16368 51/push-ecx -16369 68/push 0x11/imm32/alloc-id:fake -16370 68/push 0/imm32/name -16371 68/push 0/imm32/name -16372 68/push 0x11/imm32/alloc-id:fake:payload -16373 89/<- %ecx 4/r32/esp -16374 $test-compare-mem-with-reg:initialize-var1-name: -16375 # var1->name = "var1" -16376 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -16377 (copy-array Heap "var1" %eax) -16378 $test-compare-mem-with-reg:initialize-var2: -16379 # var var2/edx: (payload var) -16380 68/push 0/imm32/register -16381 68/push 0/imm32/register -16382 68/push 0/imm32/no-stack-offset -16383 68/push 1/imm32/block-depth -16384 ff 6/subop/push *(ecx+0x10) -16385 68/push 0x11/imm32/alloc-id:fake -16386 68/push 0/imm32/name -16387 68/push 0/imm32/name -16388 68/push 0x11/imm32/alloc-id:fake:payload -16389 89/<- %edx 4/r32/esp -16390 $test-compare-mem-with-reg:initialize-var2-name: -16391 # var2->name = "var2" -16392 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -16393 (copy-array Heap "var2" %eax) -16394 $test-compare-mem-with-reg:initialize-var2-register: -16395 # var2->register = "eax" -16396 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -16397 (copy-array Heap "eax" %eax) -16398 $test-compare-mem-with-reg:initialize-inouts: -16399 # var inouts/esi: (payload stmt-var) = [var2] -16400 68/push 0/imm32/is-deref:false -16401 68/push 0/imm32/next -16402 68/push 0/imm32/next -16403 52/push-edx/var2 -16404 68/push 0x11/imm32/alloc-id:fake -16405 68/push 0x11/imm32/alloc-id:fake:payload -16406 89/<- %esi 4/r32/esp -16407 # inouts = [var1, var2] -16408 68/push 0/imm32/is-deref:false -16409 56/push-esi/next -16410 68/push 0x11/imm32/alloc-id:fake -16411 51/push-ecx/var1 -16412 68/push 0x11/imm32/alloc-id:fake -16413 68/push 0x11/imm32/alloc-id:fake:payload -16414 89/<- %esi 4/r32/esp -16415 $test-compare-mem-with-reg:initialize-stmt: -16416 # var stmt/esi: (addr statement) -16417 68/push 0/imm32/next -16418 68/push 0/imm32/next -16419 68/push 0/imm32/outputs -16420 68/push 0/imm32/outputs -16421 56/push-esi/inouts -16422 68/push 0x11/imm32/alloc-id:fake -16423 68/push 0/imm32/operation -16424 68/push 0/imm32/operation -16425 68/push 1/imm32/tag:stmt1 -16426 89/<- %esi 4/r32/esp -16427 $test-compare-mem-with-reg:initialize-stmt-operation: -16428 # stmt->operation = "compare" -16429 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -16430 (copy-array Heap "compare" %eax) -16431 # convert -16432 c7 0/subop/copy *Curr-block-depth 0/imm32 -16433 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -16434 (flush _test-output-buffered-file) -16435 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -16441 # check output -16442 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg") -16443 # . epilogue -16444 89/<- %esp 5/r32/ebp -16445 5d/pop-to-ebp -16446 c3/return -16447 -16448 test-compare-reg-with-mem: -16449 # compare var1/eax, var2 -16450 # => -16451 # 3b/compare<- *(ebp+___) 0/r32/eax -16452 # -16453 # . prologue -16454 55/push-ebp -16455 89/<- %ebp 4/r32/esp -16456 # setup -16457 (clear-stream _test-output-stream) -16458 (clear-stream $_test-output-buffered-file->buffer) -16459 $test-compare-reg-with-mem:initialize-type: -16460 # var type/ecx: (payload tree type-id) = int -16461 68/push 0/imm32/right:null -16462 68/push 0/imm32/right:null -16463 68/push 0/imm32/left:unused -16464 68/push 1/imm32/value:int -16465 68/push 1/imm32/is-atom?:true -16466 68/push 0x11/imm32/alloc-id:fake:payload -16467 89/<- %ecx 4/r32/esp -16468 $test-compare-reg-with-mem:initialize-var1: -16469 # var var1/ecx: (payload var) -16470 68/push 0/imm32/register -16471 68/push 0/imm32/register -16472 68/push 0/imm32/no-stack-offset -16473 68/push 1/imm32/block-depth -16474 51/push-ecx -16475 68/push 0x11/imm32/alloc-id:fake -16476 68/push 0/imm32/name -16477 68/push 0/imm32/name -16478 68/push 0x11/imm32/alloc-id:fake:payload -16479 89/<- %ecx 4/r32/esp -16480 $test-compare-reg-with-mem:initialize-var1-name: -16481 # var1->name = "var1" -16482 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -16483 (copy-array Heap "var1" %eax) -16484 $test-compare-reg-with-mem:initialize-var1-register: -16485 # var1->register = "eax" -16486 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -16487 (copy-array Heap "eax" %eax) -16488 $test-compare-reg-with-mem:initialize-var2: -16489 # var var2/edx: (payload var) -16490 68/push 0/imm32/register -16491 68/push 0/imm32/register -16492 68/push 8/imm32/stack-offset -16493 68/push 1/imm32/block-depth -16494 ff 6/subop/push *(ecx+0x10) -16495 68/push 0x11/imm32/alloc-id:fake -16496 68/push 0/imm32/name -16497 68/push 0/imm32/name -16498 68/push 0x11/imm32/alloc-id:fake:payload -16499 89/<- %edx 4/r32/esp -16500 $test-compare-reg-with-mem:initialize-var2-name: -16501 # var2->name = "var2" -16502 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -16503 (copy-array Heap "var2" %eax) -16504 $test-compare-reg-with-mem:initialize-inouts: -16505 # var inouts/esi: (payload stmt-var) = [var2] -16506 68/push 0/imm32/is-deref:false -16507 68/push 0/imm32/next -16508 68/push 0/imm32/next -16509 52/push-edx/var2 -16510 68/push 0x11/imm32/alloc-id:fake -16511 68/push 0x11/imm32/alloc-id:fake:payload -16512 89/<- %esi 4/r32/esp -16513 # inouts = [var1, var2] -16514 68/push 0/imm32/is-deref:false -16515 56/push-esi/next -16516 68/push 0x11/imm32/alloc-id:fake -16517 51/push-ecx/var1 -16518 68/push 0x11/imm32/alloc-id:fake -16519 68/push 0x11/imm32/alloc-id:fake:payload -16520 89/<- %esi 4/r32/esp -16521 $test-compare-reg-with-mem:initialize-stmt: -16522 # var stmt/esi: (addr statement) -16523 68/push 0/imm32/next -16524 68/push 0/imm32/next -16525 68/push 0/imm32/outputs -16526 68/push 0/imm32/outputs -16527 56/push-esi/inouts -16528 68/push 0x11/imm32/alloc-id:fake -16529 68/push 0/imm32/operation -16530 68/push 0/imm32/operation -16531 68/push 1/imm32/tag:stmt1 -16532 89/<- %esi 4/r32/esp -16533 $test-compare-reg-with-mem:initialize-stmt-operation: -16534 # stmt->operation = "compare" -16535 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -16536 (copy-array Heap "compare" %eax) -16537 # convert -16538 c7 0/subop/copy *Curr-block-depth 0/imm32 -16539 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -16540 (flush _test-output-buffered-file) -16541 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -16547 # check output -16548 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem") -16549 # . epilogue -16550 89/<- %esp 5/r32/ebp -16551 5d/pop-to-ebp -16552 c3/return -16553 -16554 test-compare-mem-with-literal: -16555 # compare var1, 0x34 -16556 # => -16557 # 81 7/subop/compare *(ebp+___) 0x34/imm32 -16558 # -16559 # . prologue -16560 55/push-ebp -16561 89/<- %ebp 4/r32/esp -16562 # setup -16563 (clear-stream _test-output-stream) -16564 (clear-stream $_test-output-buffered-file->buffer) -16565 $test-compare-mem-with-literal:initialize-type: -16566 # var type/ecx: (payload tree type-id) = int -16567 68/push 0/imm32/right:null -16568 68/push 0/imm32/right:null -16569 68/push 0/imm32/left:unused -16570 68/push 1/imm32/value:int -16571 68/push 1/imm32/is-atom?:true -16572 68/push 0x11/imm32/alloc-id:fake:payload -16573 89/<- %ecx 4/r32/esp -16574 $test-compare-mem-with-literal:initialize-var1: -16575 # var var1/ecx: (payload var) -16576 68/push 0/imm32/register -16577 68/push 0/imm32/register -16578 68/push 8/imm32/stack-offset -16579 68/push 1/imm32/block-depth -16580 51/push-ecx -16581 68/push 0x11/imm32/alloc-id:fake -16582 68/push 0/imm32/name -16583 68/push 0/imm32/name -16584 68/push 0x11/imm32/alloc-id:fake:payload -16585 89/<- %ecx 4/r32/esp -16586 $test-compare-mem-with-literal:initialize-var1-name: -16587 # var1->name = "var1" -16588 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -16589 (copy-array Heap "var1" %eax) -16590 $test-compare-mem-with-literal:initialize-literal-type: -16591 # var type/edx: (payload tree type-id) = literal -16592 68/push 0/imm32/right:null -16593 68/push 0/imm32/right:null -16594 68/push 0/imm32/left:unused -16595 68/push 0/imm32/value:literal -16596 68/push 1/imm32/is-atom?:true -16597 68/push 0x11/imm32/alloc-id:fake:payload -16598 89/<- %edx 4/r32/esp -16599 $test-compare-mem-with-literal:initialize-literal: -16600 # var l/edx: (payload var) -16601 68/push 0/imm32/register -16602 68/push 0/imm32/register -16603 68/push 0/imm32/no-stack-offset -16604 68/push 1/imm32/block-depth -16605 52/push-edx -16606 68/push 0x11/imm32/alloc-id:fake -16607 68/push 0/imm32/name -16608 68/push 0/imm32/name -16609 68/push 0x11/imm32/alloc-id:fake:payload -16610 89/<- %edx 4/r32/esp -16611 $test-compare-mem-with-literal:initialize-literal-value: -16612 # l->name = "0x34" -16613 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -16614 (copy-array Heap "0x34" %eax) -16615 $test-compare-mem-with-literal:initialize-inouts: -16616 # var inouts/esi: (payload stmt-var) = [l] -16617 68/push 0/imm32/is-deref:false -16618 68/push 0/imm32/next -16619 68/push 0/imm32/next -16620 52/push-edx/l -16621 68/push 0x11/imm32/alloc-id:fake -16622 68/push 0x11/imm32/alloc-id:fake:payload -16623 89/<- %esi 4/r32/esp -16624 # var inouts = (handle stmt-var) = [var1, var2] -16625 68/push 0/imm32/is-deref:false -16626 56/push-esi/next -16627 68/push 0x11/imm32/alloc-id:fake -16628 51/push-ecx/var1 -16629 68/push 0x11/imm32/alloc-id:fake -16630 68/push 0x11/imm32/alloc-id:fake:payload -16631 89/<- %esi 4/r32/esp -16632 $test-compare-mem-with-literal:initialize-stmt: -16633 # var stmt/esi: (addr statement) -16634 68/push 0/imm32/next -16635 68/push 0/imm32/next -16636 68/push 0/imm32/outputs -16637 68/push 0/imm32/outputs -16638 56/push-esi/inouts -16639 68/push 0x11/imm32/alloc-id:fake -16640 68/push 0/imm32/operation -16641 68/push 0/imm32/operation -16642 68/push 1/imm32/tag:stmt1 -16643 89/<- %esi 4/r32/esp -16644 $test-compare-mem-with-literal:initialize-stmt-operation: -16645 # stmt->operation = "compare" -16646 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -16647 (copy-array Heap "compare" %eax) -16648 # convert -16649 c7 0/subop/copy *Curr-block-depth 0/imm32 -16650 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -16651 (flush _test-output-buffered-file) -16652 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -16658 # check output -16659 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal") -16660 # . epilogue -16661 89/<- %esp 5/r32/ebp -16662 5d/pop-to-ebp -16663 c3/return -16664 -16665 test-compare-eax-with-literal: -16666 # compare var1/eax 0x34 -16667 # => -16668 # 3d/compare-eax-with 0x34/imm32 -16669 # -16670 # . prologue -16671 55/push-ebp -16672 89/<- %ebp 4/r32/esp -16673 # setup -16674 (clear-stream _test-output-stream) -16675 (clear-stream $_test-output-buffered-file->buffer) -16676 $test-compare-eax-with-literal:initialize-type: -16677 # var type/ecx: (payload tree type-id) = int -16678 68/push 0/imm32/right:null -16679 68/push 0/imm32/right:null -16680 68/push 0/imm32/left:unused -16681 68/push 1/imm32/value:int -16682 68/push 1/imm32/is-atom?:true +16281 89/<- %ebx 4/r32/esp +16282 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-name: +16283 # primitives->name = "increment" +16284 (copy-array Heap "increment" %ebx) # Primitive-name +16285 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-subx-name: +16286 # primitives->subx-name = "ff 0/subop/increment" +16287 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +16288 (copy-array Heap "ff 0/subop/increment" %eax) +16289 # convert +16290 c7 0/subop/copy *Curr-block-depth 0/imm32 +16291 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +16292 (flush _test-output-buffered-file) +16293 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +16299 # check output +16300 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2") +16301 # . epilogue +16302 89/<- %esp 5/r32/ebp +16303 5d/pop-to-ebp +16304 c3/return +16305 +16306 test-increment-register: +16307 # Select the right register between overloads. +16308 # foo <- increment +16309 # => +16310 # 50/increment-eax +16311 # +16312 # There's a variable on the var stack as follows: +16313 # name: 'foo' +16314 # type: int +16315 # register: 'eax' +16316 # +16317 # Primitives are the global definitions. +16318 # +16319 # . prologue +16320 55/push-ebp +16321 89/<- %ebp 4/r32/esp +16322 # setup +16323 (clear-stream _test-output-stream) +16324 (clear-stream $_test-output-buffered-file->buffer) +16325 $test-increment-register:initialize-type: +16326 # var type/ecx: (payload tree type-id) = int +16327 68/push 0/imm32/right:null +16328 68/push 0/imm32/right:null +16329 68/push 0/imm32/left:unused +16330 68/push 1/imm32/value:int +16331 68/push 1/imm32/is-atom?:true +16332 68/push 0x11/imm32/alloc-id:fake:payload +16333 89/<- %ecx 4/r32/esp +16334 $test-increment-register:initialize-var: +16335 # var var-foo/ecx: (payload var) +16336 68/push 0/imm32/register +16337 68/push 0/imm32/register +16338 68/push 0/imm32/no-stack-offset +16339 68/push 1/imm32/block-depth +16340 51/push-ecx +16341 68/push 0x11/imm32/alloc-id:fake +16342 68/push 0/imm32/name +16343 68/push 0/imm32/name +16344 68/push 0x11/imm32/alloc-id:fake:payload +16345 89/<- %ecx 4/r32/esp +16346 $test-increment-register:initialize-var-name: +16347 # var-foo->name = "foo" +16348 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +16349 (copy-array Heap "foo" %eax) +16350 $test-increment-register:initialize-var-register: +16351 # var-foo->register = "eax" +16352 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +16353 (copy-array Heap "eax" %eax) +16354 $test-increment-register:initialize-stmt-var: +16355 # var operand/ebx: (payload stmt-var) +16356 68/push 0/imm32/is-deref:false +16357 68/push 0/imm32/next +16358 68/push 0/imm32/next +16359 51/push-ecx/var-foo +16360 68/push 0x11/imm32/alloc-id:fake +16361 68/push 0x11/imm32/alloc-id:fake:payload +16362 89/<- %ebx 4/r32/esp +16363 $test-increment-register:initialize-stmt: +16364 # var stmt/esi: (addr statement) +16365 53/push-ebx/outputs +16366 68/push 0x11/imm32/alloc-id:fake +16367 68/push 0/imm32/no-inouts +16368 68/push 0/imm32/no-inouts +16369 68/push 0/imm32/operation +16370 68/push 0/imm32/operation +16371 68/push 1/imm32 +16372 89/<- %esi 4/r32/esp +16373 $test-increment-register:initialize-stmt-operation: +16374 # stmt->operation = "increment" +16375 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +16376 (copy-array Heap "increment" %eax) +16377 # convert +16378 c7 0/subop/copy *Curr-block-depth 0/imm32 +16379 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +16380 (flush _test-output-buffered-file) +16381 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +16387 # check output +16388 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register") +16389 # . epilogue +16390 89/<- %esp 5/r32/ebp +16391 5d/pop-to-ebp +16392 c3/return +16393 +16394 test-add-reg-to-reg: +16395 # var1/reg <- add var2/reg +16396 # => +16397 # 01/add-to %var1 var2 +16398 # +16399 # . prologue +16400 55/push-ebp +16401 89/<- %ebp 4/r32/esp +16402 # setup +16403 (clear-stream _test-output-stream) +16404 (clear-stream $_test-output-buffered-file->buffer) +16405 $test-add-reg-to-reg:initialize-type: +16406 # var type/ecx: (payload tree type-id) = int +16407 68/push 0/imm32/right:null +16408 68/push 0/imm32/right:null +16409 68/push 0/imm32/left:unused +16410 68/push 1/imm32/value:int +16411 68/push 1/imm32/is-atom?:true +16412 68/push 0x11/imm32/alloc-id:fake:payload +16413 89/<- %ecx 4/r32/esp +16414 $test-add-reg-to-reg:initialize-var1: +16415 # var var1/ecx: (payload var) +16416 68/push 0/imm32/register +16417 68/push 0/imm32/register +16418 68/push 0/imm32/no-stack-offset +16419 68/push 1/imm32/block-depth +16420 51/push-ecx +16421 68/push 0x11/imm32/alloc-id:fake +16422 68/push 0/imm32/name +16423 68/push 0/imm32/name +16424 68/push 0x11/imm32/alloc-id:fake:payload +16425 89/<- %ecx 4/r32/esp +16426 $test-add-reg-to-reg:initialize-var1-name: +16427 # var1->name = "var1" +16428 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +16429 (copy-array Heap "var1" %eax) +16430 $test-add-reg-to-reg:initialize-var1-register: +16431 # var1->register = "eax" +16432 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +16433 (copy-array Heap "eax" %eax) +16434 $test-add-reg-to-reg:initialize-var2: +16435 # var var2/edx: (payload var) +16436 68/push 0/imm32/register +16437 68/push 0/imm32/register +16438 68/push 0/imm32/no-stack-offset +16439 68/push 1/imm32/block-depth +16440 ff 6/subop/push *(ecx+0x10) +16441 68/push 0x11/imm32/alloc-id:fake +16442 68/push 0/imm32/name +16443 68/push 0/imm32/name +16444 68/push 0x11/imm32/alloc-id:fake:payload +16445 89/<- %edx 4/r32/esp +16446 $test-add-reg-to-reg:initialize-var2-name: +16447 # var2->name = "var2" +16448 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +16449 (copy-array Heap "var2" %eax) +16450 $test-add-reg-to-reg:initialize-var2-register: +16451 # var2->register = "ecx" +16452 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +16453 (copy-array Heap "ecx" %eax) +16454 $test-add-reg-to-reg:initialize-inouts: +16455 # var inouts/esi: (payload stmt-var) = [var2] +16456 68/push 0/imm32/is-deref:false +16457 68/push 0/imm32/next +16458 68/push 0/imm32/next +16459 52/push-edx/var2 +16460 68/push 0x11/imm32/alloc-id:fake +16461 68/push 0x11/imm32/alloc-id:fake:payload +16462 89/<- %esi 4/r32/esp +16463 $test-add-reg-to-reg:initialize-outputs: +16464 # var outputs/edi: (payload stmt-var) = [var1] +16465 68/push 0/imm32/is-deref:false +16466 68/push 0/imm32/next +16467 68/push 0/imm32/next +16468 51/push-ecx/var1 +16469 68/push 0x11/imm32/alloc-id:fake +16470 68/push 0x11/imm32/alloc-id:fake:payload +16471 89/<- %edi 4/r32/esp +16472 $test-add-reg-to-reg:initialize-stmt: +16473 # var stmt/esi: (addr statement) +16474 68/push 0/imm32/next +16475 68/push 0/imm32/next +16476 57/push-edi/outputs +16477 68/push 0x11/imm32/alloc-id:fake +16478 56/push-esi/inouts +16479 68/push 0x11/imm32/alloc-id:fake +16480 68/push 0/imm32/operation +16481 68/push 0/imm32/operation +16482 68/push 1/imm32/tag:stmt1 +16483 89/<- %esi 4/r32/esp +16484 $test-add-reg-to-reg:initialize-stmt-operation: +16485 # stmt->operation = "add" +16486 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +16487 (copy-array Heap "add" %eax) +16488 # convert +16489 c7 0/subop/copy *Curr-block-depth 0/imm32 +16490 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +16491 (flush _test-output-buffered-file) +16492 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +16498 # check output +16499 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg") +16500 # . epilogue +16501 89/<- %esp 5/r32/ebp +16502 5d/pop-to-ebp +16503 c3/return +16504 +16505 test-add-reg-to-mem: +16506 # add-to var1 var2/reg +16507 # => +16508 # 01/add-to *(ebp+__) var2 +16509 # +16510 # . prologue +16511 55/push-ebp +16512 89/<- %ebp 4/r32/esp +16513 # setup +16514 (clear-stream _test-output-stream) +16515 (clear-stream $_test-output-buffered-file->buffer) +16516 $test-add-reg-to-mem:initialize-type: +16517 # var type/ecx: (payload tree type-id) = int +16518 68/push 0/imm32/right:null +16519 68/push 0/imm32/right:null +16520 68/push 0/imm32/left:unused +16521 68/push 1/imm32/value:int +16522 68/push 1/imm32/is-atom?:true +16523 68/push 0x11/imm32/alloc-id:fake:payload +16524 89/<- %ecx 4/r32/esp +16525 $test-add-reg-to-mem:initialize-var1: +16526 # var var1/ecx: (payload var) +16527 68/push 0/imm32/register +16528 68/push 0/imm32/register +16529 68/push 8/imm32/stack-offset +16530 68/push 1/imm32/block-depth +16531 51/push-ecx +16532 68/push 0x11/imm32/alloc-id:fake +16533 68/push 0/imm32/name +16534 68/push 0/imm32/name +16535 68/push 0x11/imm32/alloc-id:fake:payload +16536 89/<- %ecx 4/r32/esp +16537 $test-add-reg-to-mem:initialize-var1-name: +16538 # var1->name = "var1" +16539 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +16540 (copy-array Heap "var1" %eax) +16541 $test-add-reg-to-mem:initialize-var2: +16542 # var var2/edx: (payload var) +16543 68/push 0/imm32/register +16544 68/push 0/imm32/register +16545 68/push 0/imm32/no-stack-offset +16546 68/push 1/imm32/block-depth +16547 ff 6/subop/push *(ecx+0x10) +16548 68/push 0x11/imm32/alloc-id:fake +16549 68/push 0/imm32/name +16550 68/push 0/imm32/name +16551 68/push 0x11/imm32/alloc-id:fake:payload +16552 89/<- %edx 4/r32/esp +16553 $test-add-reg-to-mem:initialize-var2-name: +16554 # var2->name = "var2" +16555 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +16556 (copy-array Heap "var2" %eax) +16557 $test-add-reg-to-mem:initialize-var2-register: +16558 # var2->register = "ecx" +16559 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +16560 (copy-array Heap "ecx" %eax) +16561 $test-add-reg-to-mem:initialize-inouts: +16562 # var inouts/esi: (payload stmt-var) = [var2] +16563 68/push 0/imm32/is-deref:false +16564 68/push 0/imm32/next +16565 68/push 0/imm32/next +16566 52/push-edx/var2 +16567 68/push 0x11/imm32/alloc-id:fake +16568 68/push 0x11/imm32/alloc-id:fake:payload +16569 89/<- %esi 4/r32/esp +16570 # inouts = [var1, var2] +16571 68/push 0/imm32/is-deref:false +16572 56/push-esi/next +16573 68/push 0x11/imm32/alloc-id:fake +16574 51/push-ecx/var1 +16575 68/push 0x11/imm32/alloc-id:fake +16576 68/push 0x11/imm32/alloc-id:fake:payload +16577 89/<- %esi 4/r32/esp +16578 $test-add-reg-to-mem:initialize-stmt: +16579 # var stmt/esi: (addr statement) +16580 68/push 0/imm32/next +16581 68/push 0/imm32/next +16582 68/push 0/imm32/outputs +16583 68/push 0/imm32/outputs +16584 56/push-esi/inouts +16585 68/push 0x11/imm32/alloc-id:fake +16586 68/push 0/imm32/operation +16587 68/push 0/imm32/operation +16588 68/push 1/imm32/tag:stmt1 +16589 89/<- %esi 4/r32/esp +16590 $test-add-reg-to-mem:initialize-stmt-operation: +16591 # stmt->operation = "add-to" +16592 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +16593 (copy-array Heap "add-to" %eax) +16594 # convert +16595 c7 0/subop/copy *Curr-block-depth 0/imm32 +16596 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +16597 (flush _test-output-buffered-file) +16598 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +16604 # check output +16605 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem") +16606 # . epilogue +16607 89/<- %esp 5/r32/ebp +16608 5d/pop-to-ebp +16609 c3/return +16610 +16611 test-add-mem-to-reg: +16612 # var1/reg <- add var2 +16613 # => +16614 # 03/add *(ebp+__) var1 +16615 # +16616 # . prologue +16617 55/push-ebp +16618 89/<- %ebp 4/r32/esp +16619 # setup +16620 (clear-stream _test-output-stream) +16621 (clear-stream $_test-output-buffered-file->buffer) +16622 $test-add-mem-to-reg:initialize-type: +16623 # var type/ecx: (payload tree type-id) = int +16624 68/push 0/imm32/right:null +16625 68/push 0/imm32/right:null +16626 68/push 0/imm32/left:unused +16627 68/push 1/imm32/value:int +16628 68/push 1/imm32/is-atom?:true +16629 68/push 0x11/imm32/alloc-id:fake:payload +16630 89/<- %ecx 4/r32/esp +16631 $test-add-mem-to-reg:initialize-var: +16632 # var var1/ecx: (payload var) +16633 68/push 0/imm32/register +16634 68/push 0/imm32/register +16635 68/push 0/imm32/no-stack-offset +16636 68/push 1/imm32/block-depth +16637 51/push-ecx +16638 68/push 0x11/imm32/alloc-id:fake +16639 68/push 0/imm32/name +16640 68/push 0/imm32/name +16641 68/push 0x11/imm32/alloc-id:fake:payload +16642 89/<- %ecx 4/r32/esp +16643 $test-add-mem-to-reg:initialize-var-name: +16644 # var1->name = "foo" +16645 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +16646 (copy-array Heap "var1" %eax) +16647 $test-add-mem-to-reg:initialize-var-register: +16648 # var1->register = "eax" +16649 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +16650 (copy-array Heap "eax" %eax) +16651 $test-add-mem-to-reg:initialize-var2: +16652 # var var2/edx: (payload var) +16653 68/push 0/imm32/register +16654 68/push 0/imm32/register +16655 68/push 8/imm32/stack-offset +16656 68/push 1/imm32/block-depth +16657 ff 6/subop/push *(ecx+0x10) +16658 68/push 0x11/imm32/alloc-id:fake +16659 68/push 0/imm32/name +16660 68/push 0/imm32/name +16661 68/push 0x11/imm32/alloc-id:fake:payload +16662 89/<- %edx 4/r32/esp +16663 $test-add-mem-to-reg:initialize-var2-name: +16664 # var2->name = "var2" +16665 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +16666 (copy-array Heap "var2" %eax) +16667 $test-add-mem-to-reg:initialize-inouts: +16668 # var inouts/esi: (payload stmt-var) = [var2] +16669 68/push 0/imm32/is-deref:false +16670 68/push 0/imm32/next +16671 68/push 0/imm32/next +16672 52/push-edx/var2 +16673 68/push 0x11/imm32/alloc-id:fake +16674 68/push 0x11/imm32/alloc-id:fake:payload +16675 89/<- %esi 4/r32/esp +16676 $test-add-mem-to-reg:initialize-outputs: +16677 # var outputs/edi: (payload stmt-var) = [var1] +16678 68/push 0/imm32/is-deref:false +16679 68/push 0/imm32/next +16680 68/push 0/imm32/next +16681 51/push-ecx/var1 +16682 68/push 0x11/imm32/alloc-id:fake 16683 68/push 0x11/imm32/alloc-id:fake:payload -16684 89/<- %ecx 4/r32/esp -16685 $test-compare-eax-with-literal:initialize-var1: -16686 # var var1/ecx: (payload var) -16687 68/push 0/imm32/register -16688 68/push 0/imm32/register -16689 68/push 0/imm32/no-stack-offset -16690 68/push 1/imm32/block-depth -16691 51/push-ecx +16684 89/<- %edi 4/r32/esp +16685 $test-add-mem-to-reg:initialize-stmt: +16686 # var stmt/esi: (addr statement) +16687 68/push 0/imm32/next +16688 68/push 0/imm32/next +16689 57/push-edi/outputs +16690 68/push 0x11/imm32/alloc-id:fake +16691 56/push-esi/inouts 16692 68/push 0x11/imm32/alloc-id:fake -16693 68/push 0/imm32/name -16694 68/push 0/imm32/name -16695 68/push 0x11/imm32/alloc-id:fake:payload -16696 89/<- %ecx 4/r32/esp -16697 $test-compare-eax-with-literal:initialize-var1-name: -16698 # var1->name = "var1" -16699 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -16700 (copy-array Heap "var1" %eax) -16701 $test-compare-eax-with-literal:initialize-var1-register: -16702 # v->register = "eax" -16703 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -16704 (copy-array Heap "eax" %eax) -16705 $test-compare-eax-with-literal:initialize-literal-type: -16706 # var type/edx: (payload tree type-id) = literal -16707 68/push 0/imm32/right:null -16708 68/push 0/imm32/right:null -16709 68/push 0/imm32/left:unused -16710 68/push 0/imm32/value:literal -16711 68/push 1/imm32/is-atom?:true -16712 68/push 0x11/imm32/alloc-id:fake:payload -16713 89/<- %edx 4/r32/esp -16714 $test-compare-eax-with-literal:initialize-literal: -16715 # var l/edx: (payload var) -16716 68/push 0/imm32/register -16717 68/push 0/imm32/register -16718 68/push 0/imm32/no-stack-offset -16719 68/push 1/imm32/block-depth -16720 52/push-edx -16721 68/push 0x11/imm32/alloc-id:fake -16722 68/push 0/imm32/name -16723 68/push 0/imm32/name -16724 68/push 0x11/imm32/alloc-id:fake:payload -16725 89/<- %edx 4/r32/esp -16726 $test-compare-eax-with-literal:initialize-literal-value: -16727 # l->name = "0x34" -16728 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -16729 (copy-array Heap "0x34" %eax) -16730 $test-compare-eax-with-literal:initialize-inouts: -16731 # var inouts/esi: (payload stmt-var) = [l] -16732 68/push 0/imm32/is-deref:false -16733 68/push 0/imm32/next -16734 68/push 0/imm32/next -16735 52/push-edx/l -16736 68/push 0x11/imm32/alloc-id:fake -16737 68/push 0x11/imm32/alloc-id:fake:payload -16738 89/<- %esi 4/r32/esp -16739 # var inouts = (handle stmt-var) = [var1, var2] -16740 68/push 0/imm32/is-deref:false -16741 56/push-esi/next -16742 68/push 0x11/imm32/alloc-id:fake -16743 51/push-ecx/var1 -16744 68/push 0x11/imm32/alloc-id:fake -16745 68/push 0x11/imm32/alloc-id:fake:payload -16746 89/<- %esi 4/r32/esp -16747 $test-compare-eax-with-literal:initialize-stmt: -16748 # var stmt/esi: (addr statement) -16749 68/push 0/imm32/next -16750 68/push 0/imm32/next -16751 68/push 0/imm32/outputs -16752 68/push 0/imm32/outputs -16753 56/push-esi/inouts -16754 68/push 0x11/imm32/alloc-id:fake -16755 68/push 0/imm32/operation -16756 68/push 0/imm32/operation -16757 68/push 1/imm32/tag:stmt1 -16758 89/<- %esi 4/r32/esp -16759 $test-compare-eax-with-literal:initialize-stmt-operation: -16760 # stmt->operation = "compare" -16761 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -16762 (copy-array Heap "compare" %eax) -16763 # convert -16764 c7 0/subop/copy *Curr-block-depth 0/imm32 -16765 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -16766 (flush _test-output-buffered-file) -16767 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -16773 # check output -16774 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal") -16775 # . epilogue -16776 89/<- %esp 5/r32/ebp -16777 5d/pop-to-ebp -16778 c3/return -16779 -16780 test-compare-reg-with-literal: -16781 # compare var1/ecx 0x34 -16782 # => -16783 # 81 7/subop/compare %ecx 0x34/imm32 -16784 # -16785 # . prologue -16786 55/push-ebp -16787 89/<- %ebp 4/r32/esp -16788 # setup -16789 (clear-stream _test-output-stream) -16790 (clear-stream $_test-output-buffered-file->buffer) -16791 $test-compare-reg-with-literal:initialize-type: -16792 # var type/ecx: (payload tree type-id) = int -16793 68/push 0/imm32/right:null -16794 68/push 0/imm32/right:null -16795 68/push 0/imm32/left:unused -16796 68/push 1/imm32/value:int -16797 68/push 1/imm32/is-atom?:true -16798 68/push 0x11/imm32/alloc-id:fake:payload -16799 89/<- %ecx 4/r32/esp -16800 $test-compare-reg-with-literal:initialize-var1: -16801 # var var1/ecx: (payload var) -16802 68/push 0/imm32/register -16803 68/push 0/imm32/register -16804 68/push 0/imm32/no-stack-offset -16805 68/push 1/imm32/block-depth -16806 51/push-ecx -16807 68/push 0x11/imm32/alloc-id:fake -16808 68/push 0/imm32/name -16809 68/push 0/imm32/name -16810 68/push 0x11/imm32/alloc-id:fake:payload -16811 89/<- %ecx 4/r32/esp -16812 $test-compare-reg-with-literal:initialize-var1-name: -16813 # var1->name = "var1" -16814 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -16815 (copy-array Heap "var1" %eax) -16816 $test-compare-reg-with-literal:initialize-var1-register: -16817 # v->register = "ecx" -16818 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -16819 (copy-array Heap "ecx" %eax) -16820 $test-compare-reg-with-literal:initialize-literal-type: -16821 # var type/edx: (payload tree type-id) = literal -16822 68/push 0/imm32/right:null -16823 68/push 0/imm32/right:null -16824 68/push 0/imm32/left:unused -16825 68/push 0/imm32/value:literal -16826 68/push 1/imm32/is-atom?:true -16827 68/push 0x11/imm32/alloc-id:fake:payload -16828 89/<- %edx 4/r32/esp -16829 $test-compare-reg-with-literal:initialize-literal: -16830 # var l/edx: (payload var) -16831 68/push 0/imm32/register -16832 68/push 0/imm32/register -16833 68/push 0/imm32/no-stack-offset -16834 68/push 1/imm32/block-depth -16835 52/push-edx -16836 68/push 0x11/imm32/alloc-id:fake -16837 68/push 0/imm32/name -16838 68/push 0/imm32/name -16839 68/push 0x11/imm32/alloc-id:fake:payload -16840 89/<- %edx 4/r32/esp -16841 $test-compare-reg-with-literal:initialize-literal-value: -16842 # l->name = "0x34" -16843 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -16844 (copy-array Heap "0x34" %eax) -16845 $test-compare-reg-with-literal:initialize-inouts: -16846 # var inouts/esi: (payload stmt-var) = [l] -16847 68/push 0/imm32/is-deref:false -16848 68/push 0/imm32/next -16849 68/push 0/imm32/next -16850 52/push-edx/l -16851 68/push 0x11/imm32/alloc-id:fake +16693 68/push 0/imm32/operation +16694 68/push 0/imm32/operation +16695 68/push 1/imm32/tag:stmt1 +16696 89/<- %esi 4/r32/esp +16697 $test-add-mem-to-reg:initialize-stmt-operation: +16698 # stmt->operation = "add" +16699 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +16700 (copy-array Heap "add" %eax) +16701 # convert +16702 c7 0/subop/copy *Curr-block-depth 0/imm32 +16703 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +16704 (flush _test-output-buffered-file) +16705 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +16711 # check output +16712 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg") +16713 # . epilogue +16714 89/<- %esp 5/r32/ebp +16715 5d/pop-to-ebp +16716 c3/return +16717 +16718 test-add-literal-to-eax: +16719 # var1/eax <- add 0x34 +16720 # => +16721 # 05/add-to-eax 0x34/imm32 +16722 # +16723 # . prologue +16724 55/push-ebp +16725 89/<- %ebp 4/r32/esp +16726 # setup +16727 (clear-stream _test-output-stream) +16728 (clear-stream $_test-output-buffered-file->buffer) +16729 $test-add-literal-to-eax:initialize-var-type: +16730 # var type/ecx: (payload tree type-id) = int +16731 68/push 0/imm32/right:null +16732 68/push 0/imm32/right:null +16733 68/push 0/imm32/left:unused +16734 68/push 1/imm32/value:int +16735 68/push 1/imm32/is-atom?:true +16736 68/push 0x11/imm32/alloc-id:fake:payload +16737 89/<- %ecx 4/r32/esp +16738 $test-add-literal-to-eax:initialize-var: +16739 # var v/ecx: (payload var) +16740 68/push 0/imm32/register +16741 68/push 0/imm32/register +16742 68/push 0/imm32/no-stack-offset +16743 68/push 1/imm32/block-depth +16744 51/push-ecx +16745 68/push 0x11/imm32/alloc-id:fake +16746 68/push 0/imm32/name +16747 68/push 0/imm32/name +16748 68/push 0x11/imm32/alloc-id:fake:payload +16749 89/<- %ecx 4/r32/esp +16750 $test-add-literal-to-eax:initialize-var-name: +16751 # v->name = "v" +16752 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +16753 (copy-array Heap "v" %eax) +16754 $test-add-literal-to-eax:initialize-var-register: +16755 # v->register = "eax" +16756 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +16757 (copy-array Heap "eax" %eax) +16758 $test-add-literal-to-eax:initialize-literal-type: +16759 # var type/edx: (payload tree type-id) = literal +16760 68/push 0/imm32/right:null +16761 68/push 0/imm32/right:null +16762 68/push 0/imm32/left:unused +16763 68/push 0/imm32/value:literal +16764 68/push 1/imm32/is-atom?:true +16765 68/push 0x11/imm32/alloc-id:fake:payload +16766 89/<- %edx 4/r32/esp +16767 $test-add-literal-to-eax:initialize-literal: +16768 # var l/edx: (payload var) +16769 68/push 0/imm32/register +16770 68/push 0/imm32/register +16771 68/push 0/imm32/no-stack-offset +16772 68/push 1/imm32/block-depth +16773 52/push-edx +16774 68/push 0x11/imm32/alloc-id:fake +16775 68/push 0/imm32/name +16776 68/push 0/imm32/name +16777 68/push 0x11/imm32/alloc-id:fake:payload +16778 89/<- %edx 4/r32/esp +16779 $test-add-literal-to-eax:initialize-literal-value: +16780 # l->name = "0x34" +16781 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +16782 (copy-array Heap "0x34" %eax) +16783 $test-add-literal-to-eax:initialize-inouts: +16784 # var inouts/esi: (payload stmt-var) = [l] +16785 68/push 0/imm32/is-deref:false +16786 68/push 0/imm32/next +16787 68/push 0/imm32/next +16788 52/push-edx/l +16789 68/push 0x11/imm32/alloc-id:fake +16790 68/push 0x11/imm32/alloc-id:fake:payload +16791 89/<- %esi 4/r32/esp +16792 $test-add-literal-to-eax:initialize-outputs: +16793 # var outputs/edi: (payload stmt-var) = [v] +16794 68/push 0/imm32/is-deref:false +16795 68/push 0/imm32/next +16796 68/push 0/imm32/next +16797 51/push-ecx/v +16798 68/push 0x11/imm32/alloc-id:fake +16799 68/push 0x11/imm32/alloc-id:fake:payload +16800 89/<- %edi 4/r32/esp +16801 $test-add-literal-to-eax:initialize-stmt: +16802 # var stmt/esi: (addr statement) +16803 68/push 0/imm32/next +16804 68/push 0/imm32/next +16805 57/push-edi/outputs +16806 68/push 0x11/imm32/alloc-id:fake +16807 56/push-esi/inouts +16808 68/push 0x11/imm32/alloc-id:fake +16809 68/push 0/imm32/operation +16810 68/push 0/imm32/operation +16811 68/push 1/imm32/tag:stmt1 +16812 89/<- %esi 4/r32/esp +16813 $test-add-literal-to-eax:initialize-stmt-operation: +16814 # stmt->operation = "add" +16815 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +16816 (copy-array Heap "add" %eax) +16817 # convert +16818 c7 0/subop/copy *Curr-block-depth 0/imm32 +16819 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +16820 (flush _test-output-buffered-file) +16821 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +16827 # check output +16828 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax") +16829 # . epilogue +16830 89/<- %esp 5/r32/ebp +16831 5d/pop-to-ebp +16832 c3/return +16833 +16834 test-add-literal-to-reg: +16835 # var1/ecx <- add 0x34 +16836 # => +16837 # 81 0/subop/add %ecx 0x34/imm32 +16838 # +16839 # . prologue +16840 55/push-ebp +16841 89/<- %ebp 4/r32/esp +16842 # setup +16843 (clear-stream _test-output-stream) +16844 (clear-stream $_test-output-buffered-file->buffer) +16845 $test-add-literal-to-reg:initialize-var-type: +16846 # var type/ecx: (payload tree type-id) = int +16847 68/push 0/imm32/right:null +16848 68/push 0/imm32/right:null +16849 68/push 0/imm32/left:unused +16850 68/push 1/imm32/value:int +16851 68/push 1/imm32/is-atom?:true 16852 68/push 0x11/imm32/alloc-id:fake:payload -16853 89/<- %esi 4/r32/esp -16854 # var inouts = (handle stmt-var) = [var1, var2] -16855 68/push 0/imm32/is-deref:false -16856 56/push-esi/next -16857 68/push 0x11/imm32/alloc-id:fake -16858 51/push-ecx/var1 -16859 68/push 0x11/imm32/alloc-id:fake -16860 68/push 0x11/imm32/alloc-id:fake:payload -16861 89/<- %esi 4/r32/esp -16862 $test-compare-reg-with-literal:initialize-stmt: -16863 # var stmt/esi: (addr statement) -16864 68/push 0/imm32/next -16865 68/push 0/imm32/next -16866 68/push 0/imm32/outputs -16867 68/push 0/imm32/outputs -16868 56/push-esi/inouts -16869 68/push 0x11/imm32/alloc-id:fake -16870 68/push 0/imm32/operation -16871 68/push 0/imm32/operation -16872 68/push 1/imm32/tag:stmt1 -16873 89/<- %esi 4/r32/esp -16874 $test-compare-reg-with-literal:initialize-stmt-operation: -16875 # stmt->operation = "compare" -16876 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -16877 (copy-array Heap "compare" %eax) -16878 # convert -16879 c7 0/subop/copy *Curr-block-depth 0/imm32 -16880 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -16881 (flush _test-output-buffered-file) -16882 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -16888 # check output -16889 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal") -16890 # . epilogue -16891 89/<- %esp 5/r32/ebp -16892 5d/pop-to-ebp -16893 c3/return -16894 -16895 test-emit-subx-stmt-function-call: -16896 # Call a function on a variable on the stack. -16897 # f foo -16898 # => -16899 # (f *(ebp-8)) -16900 # (Changing the function name supports overloading in general, but here it -16901 # just serves to help disambiguate things.) -16902 # -16903 # There's a variable on the var stack as follows: -16904 # name: 'foo' -16905 # type: int -16906 # stack-offset: -8 -16907 # -16908 # There's nothing in primitives. -16909 # -16910 # We don't perform any checking here on the type of 'f'. -16911 # -16912 # . prologue -16913 55/push-ebp -16914 89/<- %ebp 4/r32/esp -16915 # setup -16916 (clear-stream _test-output-stream) -16917 (clear-stream $_test-output-buffered-file->buffer) -16918 $test-emit-subx-function-call:initialize-type: -16919 # var type/ecx: (payload tree type-id) = int -16920 68/push 0/imm32/right:null -16921 68/push 0/imm32/right:null -16922 68/push 0/imm32/left:unused -16923 68/push 1/imm32/value:int -16924 68/push 1/imm32/is-atom?:true -16925 68/push 0x11/imm32/alloc-id:fake:payload -16926 89/<- %ecx 4/r32/esp -16927 $test-emit-subx-function-call:initialize-var: -16928 # var var-foo/ecx: (payload var) = var(type) -16929 68/push 0/imm32/no-register -16930 68/push 0/imm32/no-register -16931 68/push -8/imm32/stack-offset -16932 68/push 1/imm32/block-depth -16933 51/push-ecx/type -16934 68/push 0x11/imm32/alloc-id:fake -16935 68/push 0/imm32/name -16936 68/push 0/imm32/name -16937 68/push 0x11/imm32/alloc-id:fake:payload -16938 89/<- %ecx 4/r32/esp -16939 $test-emit-subx-function-call:initialize-var-name: -16940 # var-foo->name = "foo" -16941 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -16942 (copy-array Heap "foo" %eax) -16943 $test-emit-subx-function-call:initialize-stmt-var: -16944 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -16945 68/push 0/imm32/is-deref:false -16946 68/push 0/imm32/next -16947 68/push 0/imm32/next -16948 51/push-ecx/var-foo -16949 68/push 0x11/imm32/alloc-id:fake -16950 68/push 0x11/imm32/alloc-id:fake:payload -16951 89/<- %ebx 4/r32/esp -16952 $test-emit-subx-function-call:initialize-stmt: -16953 # var stmt/esi: (addr statement) -16954 68/push 0/imm32/no-outputs -16955 68/push 0/imm32/no-outputs -16956 53/push-ebx/inouts -16957 68/push 0x11/imm32/alloc-id:fake -16958 68/push 0/imm32/operation -16959 68/push 0/imm32/operation -16960 68/push 1/imm32/tag -16961 89/<- %esi 4/r32/esp -16962 $test-emit-subx-function-call:initialize-stmt-operation: -16963 # stmt->operation = "f" -16964 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -16965 (copy-array Heap "f" %eax) -16966 # convert -16967 c7 0/subop/copy *Curr-block-depth 0/imm32 -16968 (emit-subx-stmt _test-output-buffered-file %esi 0 Stderr 0) -16969 (flush _test-output-buffered-file) -16970 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -16976 # check output -16977 (check-next-stream-line-equal _test-output-stream "(f *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call") -16978 # . epilogue -16979 89/<- %esp 5/r32/ebp -16980 5d/pop-to-ebp -16981 c3/return -16982 -16983 test-emit-subx-stmt-function-call-with-literal-arg: -16984 # Call a function on a literal. -16985 # f 0x34 -16986 # => -16987 # (f2 0x34) -16988 # -16989 # . prologue -16990 55/push-ebp -16991 89/<- %ebp 4/r32/esp -16992 # setup -16993 (clear-stream _test-output-stream) -16994 (clear-stream $_test-output-buffered-file->buffer) -16995 $test-emit-subx-function-call-with-literal-arg:initialize-type: -16996 # var type/ecx: (payload tree type-id) = int -16997 68/push 0/imm32/right:null -16998 68/push 0/imm32/right:null -16999 68/push 0/imm32/left:unused -17000 68/push 0/imm32/value:literal -17001 68/push 1/imm32/is-atom?:true -17002 68/push 0x11/imm32/alloc-id:fake:payload -17003 89/<- %ecx 4/r32/esp -17004 $test-emit-subx-function-call-with-literal-arg:initialize-var: -17005 # var var-foo/ecx: (payload var) = var(lit) -17006 68/push 0/imm32/no-register -17007 68/push 0/imm32/no-register -17008 68/push 0/imm32/no-stack-offset -17009 68/push 1/imm32/block-depth -17010 51/push-ecx/type -17011 68/push 0x11/imm32/alloc-id:fake -17012 68/push 0/imm32/name -17013 68/push 0/imm32/name -17014 68/push 0x11/imm32/alloc-id:fake:payload -17015 89/<- %ecx 4/r32/esp -17016 $test-emit-subx-function-call-with-literal-arg:initialize-var-name: -17017 # var-foo->name = "0x34" -17018 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -17019 (copy-array Heap "0x34" %eax) -17020 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-var: -17021 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -17022 68/push 0/imm32/is-deref:false -17023 68/push 0/imm32/next -17024 68/push 0/imm32/next -17025 51/push-ecx/var-foo -17026 68/push 0x11/imm32/alloc-id:fake -17027 68/push 0x11/imm32/alloc-id:fake:payload -17028 89/<- %ebx 4/r32/esp -17029 $test-emit-subx-function-call-with-literal-arg:initialize-stmt: -17030 # var stmt/esi: (addr statement) -17031 68/push 0/imm32/no-outputs -17032 68/push 0/imm32/no-outputs -17033 53/push-ebx/inouts -17034 68/push 0x11/imm32/alloc-id:fake -17035 68/push 0/imm32/operation +16853 89/<- %ecx 4/r32/esp +16854 $test-add-literal-to-reg:initialize-var: +16855 # var v/ecx: (payload var) +16856 68/push 0/imm32/register +16857 68/push 0/imm32/register +16858 68/push 0/imm32/no-stack-offset +16859 68/push 1/imm32/block-depth +16860 51/push-ecx +16861 68/push 0x11/imm32/alloc-id:fake +16862 68/push 0/imm32/name +16863 68/push 0/imm32/name +16864 68/push 0x11/imm32/alloc-id:fake:payload +16865 89/<- %ecx 4/r32/esp +16866 $test-add-literal-to-reg:initialize-var-name: +16867 # v->name = "v" +16868 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +16869 (copy-array Heap "v" %eax) +16870 $test-add-literal-to-reg:initialize-var-register: +16871 # v->register = "ecx" +16872 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +16873 (copy-array Heap "ecx" %eax) +16874 $test-add-literal-to-reg:initialize-literal-type: +16875 # var type/edx: (payload tree type-id) = literal +16876 68/push 0/imm32/right:null +16877 68/push 0/imm32/right:null +16878 68/push 0/imm32/left:unused +16879 68/push 0/imm32/value:literal +16880 68/push 1/imm32/is-atom?:true +16881 68/push 0x11/imm32/alloc-id:fake:payload +16882 89/<- %edx 4/r32/esp +16883 $test-add-literal-to-reg:initialize-literal: +16884 # var l/edx: (payload var) +16885 68/push 0/imm32/register +16886 68/push 0/imm32/register +16887 68/push 0/imm32/no-stack-offset +16888 68/push 1/imm32/block-depth +16889 52/push-edx +16890 68/push 0x11/imm32/alloc-id:fake +16891 68/push 0/imm32/name +16892 68/push 0/imm32/name +16893 68/push 0x11/imm32/alloc-id:fake:payload +16894 89/<- %edx 4/r32/esp +16895 $test-add-literal-to-reg:initialize-literal-value: +16896 # l->name = "0x34" +16897 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +16898 (copy-array Heap "0x34" %eax) +16899 $test-add-literal-to-reg:initialize-inouts: +16900 # var inouts/esi: (payload stmt-var) = [l] +16901 68/push 0/imm32/is-deref:false +16902 68/push 0/imm32/next +16903 68/push 0/imm32/next +16904 52/push-edx/l +16905 68/push 0x11/imm32/alloc-id:fake +16906 68/push 0x11/imm32/alloc-id:fake:payload +16907 89/<- %esi 4/r32/esp +16908 $test-add-literal-to-reg:initialize-outputs: +16909 # var outputs/edi: (payload stmt-var) = [v] +16910 68/push 0/imm32/is-deref:false +16911 68/push 0/imm32/next +16912 68/push 0/imm32/next +16913 51/push-ecx/v +16914 68/push 0x11/imm32/alloc-id:fake +16915 68/push 0x11/imm32/alloc-id:fake:payload +16916 89/<- %edi 4/r32/esp +16917 $test-add-literal-to-reg:initialize-stmt: +16918 # var stmt/esi: (addr statement) +16919 68/push 0/imm32/next +16920 68/push 0/imm32/next +16921 57/push-edi/outputs +16922 68/push 0x11/imm32/alloc-id:fake +16923 56/push-esi/inouts +16924 68/push 0x11/imm32/alloc-id:fake +16925 68/push 0/imm32/operation +16926 68/push 0/imm32/operation +16927 68/push 1/imm32/tag:stmt1 +16928 89/<- %esi 4/r32/esp +16929 $test-add-literal-to-reg:initialize-stmt-operation: +16930 # stmt->operation = "add" +16931 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +16932 (copy-array Heap "add" %eax) +16933 # convert +16934 c7 0/subop/copy *Curr-block-depth 0/imm32 +16935 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +16936 (flush _test-output-buffered-file) +16937 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +16943 # check output +16944 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg") +16945 # . epilogue +16946 89/<- %esp 5/r32/ebp +16947 5d/pop-to-ebp +16948 c3/return +16949 +16950 test-add-literal-to-mem: +16951 # add-to var1, 0x34 +16952 # => +16953 # 81 0/subop/add %eax 0x34/imm32 +16954 # +16955 # . prologue +16956 55/push-ebp +16957 89/<- %ebp 4/r32/esp +16958 # setup +16959 (clear-stream _test-output-stream) +16960 (clear-stream $_test-output-buffered-file->buffer) +16961 $test-add-literal-to-mem:initialize-type: +16962 # var type/ecx: (payload tree type-id) = int +16963 68/push 0/imm32/right:null +16964 68/push 0/imm32/right:null +16965 68/push 0/imm32/left:unused +16966 68/push 1/imm32/value:int +16967 68/push 1/imm32/is-atom?:true +16968 68/push 0x11/imm32/alloc-id:fake:payload +16969 89/<- %ecx 4/r32/esp +16970 $test-add-literal-to-mem:initialize-var1: +16971 # var var1/ecx: (payload var) +16972 68/push 0/imm32/register +16973 68/push 0/imm32/register +16974 68/push 8/imm32/stack-offset +16975 68/push 1/imm32/block-depth +16976 51/push-ecx +16977 68/push 0x11/imm32/alloc-id:fake +16978 68/push 0/imm32/name +16979 68/push 0/imm32/name +16980 68/push 0x11/imm32/alloc-id:fake:payload +16981 89/<- %ecx 4/r32/esp +16982 $test-add-literal-to-mem:initialize-var1-name: +16983 # var1->name = "var1" +16984 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +16985 (copy-array Heap "var1" %eax) +16986 $test-add-literal-to-mem:initialize-literal-type: +16987 # var type/edx: (payload tree type-id) = literal +16988 68/push 0/imm32/right:null +16989 68/push 0/imm32/right:null +16990 68/push 0/imm32/left:unused +16991 68/push 0/imm32/value:literal +16992 68/push 1/imm32/is-atom?:true +16993 68/push 0x11/imm32/alloc-id:fake:payload +16994 89/<- %edx 4/r32/esp +16995 $test-add-literal-to-mem:initialize-literal: +16996 # var l/edx: (payload var) +16997 68/push 0/imm32/register +16998 68/push 0/imm32/register +16999 68/push 0/imm32/no-stack-offset +17000 68/push 1/imm32/block-depth +17001 52/push-edx +17002 68/push 0x11/imm32/alloc-id:fake +17003 68/push 0/imm32/name +17004 68/push 0/imm32/name +17005 68/push 0x11/imm32/alloc-id:fake:payload +17006 89/<- %edx 4/r32/esp +17007 $test-add-literal-to-mem:initialize-literal-value: +17008 # l->name = "0x34" +17009 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +17010 (copy-array Heap "0x34" %eax) +17011 $test-add-literal-to-mem:initialize-inouts: +17012 # var inouts/esi: (payload stmt-var) = [l] +17013 68/push 0/imm32/is-deref:false +17014 68/push 0/imm32/next +17015 68/push 0/imm32/next +17016 52/push-edx/l +17017 68/push 0x11/imm32/alloc-id:fake +17018 68/push 0x11/imm32/alloc-id:fake:payload +17019 89/<- %esi 4/r32/esp +17020 # var inouts = (handle stmt-var) = [var1, var2] +17021 68/push 0/imm32/is-deref:false +17022 56/push-esi/next +17023 68/push 0x11/imm32/alloc-id:fake +17024 51/push-ecx/var1 +17025 68/push 0x11/imm32/alloc-id:fake +17026 68/push 0x11/imm32/alloc-id:fake:payload +17027 89/<- %esi 4/r32/esp +17028 $test-add-literal-to-mem:initialize-stmt: +17029 # var stmt/esi: (addr statement) +17030 68/push 0/imm32/next +17031 68/push 0/imm32/next +17032 68/push 0/imm32/outputs +17033 68/push 0/imm32/outputs +17034 56/push-esi/inouts +17035 68/push 0x11/imm32/alloc-id:fake 17036 68/push 0/imm32/operation -17037 68/push 1/imm32/tag -17038 89/<- %esi 4/r32/esp -17039 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-operation: -17040 # stmt->operation = "f" -17041 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -17042 (copy-array Heap "f" %eax) -17043 # convert -17044 c7 0/subop/copy *Curr-block-depth 0/imm32 -17045 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx Stderr 0) -17046 (flush _test-output-buffered-file) -17047 +-- 6 lines: #? # dump _test-output-stream ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -17053 # check output -17054 (check-next-stream-line-equal _test-output-stream "(f 0x34)" "F - test-emit-subx-stmt-function-call-with-literal-arg") -17055 # . epilogue -17056 89/<- %esp 5/r32/ebp -17057 5d/pop-to-ebp -17058 c3/return -17059 -17060 emit-indent: # out: (addr buffered-file), n: int -17061 # . prologue -17062 55/push-ebp -17063 89/<- %ebp 4/r32/esp -17064 # . save registers -17065 50/push-eax -17066 # var i/eax: int = n -17067 8b/-> *(ebp+0xc) 0/r32/eax -17068 { -17069 # if (i <= 0) break -17070 3d/compare-eax-with 0/imm32 -17071 7e/jump-if-<= break/disp8 -17072 (write-buffered *(ebp+8) " ") -17073 48/decrement-eax -17074 eb/jump loop/disp8 -17075 } -17076 $emit-indent:end: -17077 # . restore registers -17078 58/pop-to-eax -17079 # . epilogue -17080 89/<- %esp 5/r32/ebp -17081 5d/pop-to-ebp -17082 c3/return -17083 -17084 emit-subx-prologue: # out: (addr buffered-file) -17085 # . prologue -17086 55/push-ebp -17087 89/<- %ebp 4/r32/esp -17088 # -17089 (write-buffered *(ebp+8) " # . prologue\n") -17090 (write-buffered *(ebp+8) " 55/push-ebp\n") -17091 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n") -17092 $emit-subx-prologue:end: -17093 # . epilogue -17094 89/<- %esp 5/r32/ebp -17095 5d/pop-to-ebp -17096 c3/return -17097 -17098 emit-subx-epilogue: # out: (addr buffered-file) -17099 # . prologue -17100 55/push-ebp -17101 89/<- %ebp 4/r32/esp -17102 # -17103 (write-buffered *(ebp+8) " # . epilogue\n") -17104 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n") -17105 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n") -17106 (write-buffered *(ebp+8) " c3/return\n") -17107 $emit-subx-epilogue:end: -17108 # . epilogue -17109 89/<- %esp 5/r32/ebp -17110 5d/pop-to-ebp -17111 c3/return +17037 68/push 0/imm32/operation +17038 68/push 1/imm32/tag:stmt1 +17039 89/<- %esi 4/r32/esp +17040 $test-add-literal-to-mem:initialize-stmt-operation: +17041 # stmt->operation = "add-to" +17042 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +17043 (copy-array Heap "add-to" %eax) +17044 # convert +17045 c7 0/subop/copy *Curr-block-depth 0/imm32 +17046 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +17047 (flush _test-output-buffered-file) +17048 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +17054 # check output +17055 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem") +17056 # . epilogue +17057 89/<- %esp 5/r32/ebp +17058 5d/pop-to-ebp +17059 c3/return +17060 +17061 test-compare-reg-with-reg: +17062 # compare var1/ecx, var2/eax +17063 # => +17064 # 39/compare %ecx 0/r32/eax +17065 # +17066 # . prologue +17067 55/push-ebp +17068 89/<- %ebp 4/r32/esp +17069 # setup +17070 (clear-stream _test-output-stream) +17071 (clear-stream $_test-output-buffered-file->buffer) +17072 $test-compare-reg-with-reg:initialize-type: +17073 # var type/ecx: (payload tree type-id) = int +17074 68/push 0/imm32/right:null +17075 68/push 0/imm32/right:null +17076 68/push 0/imm32/left:unused +17077 68/push 1/imm32/value:int +17078 68/push 1/imm32/is-atom?:true +17079 68/push 0x11/imm32/alloc-id:fake:payload +17080 89/<- %ecx 4/r32/esp +17081 $test-compare-reg-with-reg:initialize-var1: +17082 # var var1/ecx: (payload var) +17083 68/push 0/imm32/register +17084 68/push 0/imm32/register +17085 68/push 0/imm32/no-stack-offset +17086 68/push 1/imm32/block-depth +17087 51/push-ecx +17088 68/push 0x11/imm32/alloc-id:fake +17089 68/push 0/imm32/name +17090 68/push 0/imm32/name +17091 68/push 0x11/imm32/alloc-id:fake:payload +17092 89/<- %ecx 4/r32/esp +17093 $test-compare-reg-with-reg:initialize-var1-name: +17094 # var1->name = "var1" +17095 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +17096 (copy-array Heap "var1" %eax) +17097 $test-compare-reg-with-reg:initialize-var1-register: +17098 # var1->register = "ecx" +17099 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +17100 (copy-array Heap "ecx" %eax) +17101 $test-compare-reg-with-reg:initialize-var2: +17102 # var var2/edx: (payload var) +17103 68/push 0/imm32/register +17104 68/push 0/imm32/register +17105 68/push 0/imm32/no-stack-offset +17106 68/push 1/imm32/block-depth +17107 ff 6/subop/push *(ecx+0x10) +17108 68/push 0x11/imm32/alloc-id:fake +17109 68/push 0/imm32/name +17110 68/push 0/imm32/name +17111 68/push 0x11/imm32/alloc-id:fake:payload +17112 89/<- %edx 4/r32/esp +17113 $test-compare-reg-with-reg:initialize-var2-name: +17114 # var2->name = "var2" +17115 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +17116 (copy-array Heap "var2" %eax) +17117 $test-compare-reg-with-reg:initialize-var2-register: +17118 # var2->register = "eax" +17119 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +17120 (copy-array Heap "eax" %eax) +17121 $test-compare-reg-with-reg:initialize-inouts: +17122 # var inouts/esi: (payload stmt-var) = [var2] +17123 68/push 0/imm32/is-deref:false +17124 68/push 0/imm32/next +17125 68/push 0/imm32/next +17126 52/push-edx/var2 +17127 68/push 0x11/imm32/alloc-id:fake +17128 68/push 0x11/imm32/alloc-id:fake:payload +17129 89/<- %esi 4/r32/esp +17130 # inouts = [var1, var2] +17131 68/push 0/imm32/is-deref:false +17132 56/push-esi/next +17133 68/push 0x11/imm32/alloc-id:fake +17134 51/push-ecx/var1 +17135 68/push 0x11/imm32/alloc-id:fake +17136 68/push 0x11/imm32/alloc-id:fake:payload +17137 89/<- %esi 4/r32/esp +17138 $test-compare-reg-with-reg:initialize-stmt: +17139 # var stmt/esi: (addr statement) +17140 68/push 0/imm32/next +17141 68/push 0/imm32/next +17142 68/push 0/imm32/outputs +17143 68/push 0/imm32/outputs +17144 56/push-esi/inouts +17145 68/push 0x11/imm32/alloc-id:fake +17146 68/push 0/imm32/operation +17147 68/push 0/imm32/operation +17148 68/push 1/imm32/tag:stmt1 +17149 89/<- %esi 4/r32/esp +17150 $test-compare-reg-with-reg:initialize-stmt-operation: +17151 # stmt->operation = "compare" +17152 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +17153 (copy-array Heap "compare" %eax) +17154 # convert +17155 c7 0/subop/copy *Curr-block-depth 0/imm32 +17156 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +17157 (flush _test-output-buffered-file) +17158 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +17164 # check output +17165 (check-next-stream-line-equal _test-output-stream "39/compare-> %ecx 0x00000000/r32" "F - test-compare-reg-with-reg") +17166 # . epilogue +17167 89/<- %esp 5/r32/ebp +17168 5d/pop-to-ebp +17169 c3/return +17170 +17171 test-compare-mem-with-reg: +17172 # compare var1, var2/eax +17173 # => +17174 # 39/compare *(ebp+___) 0/r32/eax +17175 # +17176 # . prologue +17177 55/push-ebp +17178 89/<- %ebp 4/r32/esp +17179 # setup +17180 (clear-stream _test-output-stream) +17181 (clear-stream $_test-output-buffered-file->buffer) +17182 $test-compare-mem-with-reg:initialize-type: +17183 # var type/ecx: (payload tree type-id) = int +17184 68/push 0/imm32/right:null +17185 68/push 0/imm32/right:null +17186 68/push 0/imm32/left:unused +17187 68/push 1/imm32/value:int +17188 68/push 1/imm32/is-atom?:true +17189 68/push 0x11/imm32/alloc-id:fake:payload +17190 89/<- %ecx 4/r32/esp +17191 $test-compare-mem-with-reg:initialize-var1: +17192 # var var1/ecx: (payload var) +17193 68/push 0/imm32/register +17194 68/push 0/imm32/register +17195 68/push 8/imm32/stack-offset +17196 68/push 1/imm32/block-depth +17197 51/push-ecx +17198 68/push 0x11/imm32/alloc-id:fake +17199 68/push 0/imm32/name +17200 68/push 0/imm32/name +17201 68/push 0x11/imm32/alloc-id:fake:payload +17202 89/<- %ecx 4/r32/esp +17203 $test-compare-mem-with-reg:initialize-var1-name: +17204 # var1->name = "var1" +17205 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +17206 (copy-array Heap "var1" %eax) +17207 $test-compare-mem-with-reg:initialize-var2: +17208 # var var2/edx: (payload var) +17209 68/push 0/imm32/register +17210 68/push 0/imm32/register +17211 68/push 0/imm32/no-stack-offset +17212 68/push 1/imm32/block-depth +17213 ff 6/subop/push *(ecx+0x10) +17214 68/push 0x11/imm32/alloc-id:fake +17215 68/push 0/imm32/name +17216 68/push 0/imm32/name +17217 68/push 0x11/imm32/alloc-id:fake:payload +17218 89/<- %edx 4/r32/esp +17219 $test-compare-mem-with-reg:initialize-var2-name: +17220 # var2->name = "var2" +17221 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +17222 (copy-array Heap "var2" %eax) +17223 $test-compare-mem-with-reg:initialize-var2-register: +17224 # var2->register = "eax" +17225 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +17226 (copy-array Heap "eax" %eax) +17227 $test-compare-mem-with-reg:initialize-inouts: +17228 # var inouts/esi: (payload stmt-var) = [var2] +17229 68/push 0/imm32/is-deref:false +17230 68/push 0/imm32/next +17231 68/push 0/imm32/next +17232 52/push-edx/var2 +17233 68/push 0x11/imm32/alloc-id:fake +17234 68/push 0x11/imm32/alloc-id:fake:payload +17235 89/<- %esi 4/r32/esp +17236 # inouts = [var1, var2] +17237 68/push 0/imm32/is-deref:false +17238 56/push-esi/next +17239 68/push 0x11/imm32/alloc-id:fake +17240 51/push-ecx/var1 +17241 68/push 0x11/imm32/alloc-id:fake +17242 68/push 0x11/imm32/alloc-id:fake:payload +17243 89/<- %esi 4/r32/esp +17244 $test-compare-mem-with-reg:initialize-stmt: +17245 # var stmt/esi: (addr statement) +17246 68/push 0/imm32/next +17247 68/push 0/imm32/next +17248 68/push 0/imm32/outputs +17249 68/push 0/imm32/outputs +17250 56/push-esi/inouts +17251 68/push 0x11/imm32/alloc-id:fake +17252 68/push 0/imm32/operation +17253 68/push 0/imm32/operation +17254 68/push 1/imm32/tag:stmt1 +17255 89/<- %esi 4/r32/esp +17256 $test-compare-mem-with-reg:initialize-stmt-operation: +17257 # stmt->operation = "compare" +17258 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +17259 (copy-array Heap "compare" %eax) +17260 # convert +17261 c7 0/subop/copy *Curr-block-depth 0/imm32 +17262 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +17263 (flush _test-output-buffered-file) +17264 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +17270 # check output +17271 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg") +17272 # . epilogue +17273 89/<- %esp 5/r32/ebp +17274 5d/pop-to-ebp +17275 c3/return +17276 +17277 test-compare-reg-with-mem: +17278 # compare var1/eax, var2 +17279 # => +17280 # 3b/compare<- *(ebp+___) 0/r32/eax +17281 # +17282 # . prologue +17283 55/push-ebp +17284 89/<- %ebp 4/r32/esp +17285 # setup +17286 (clear-stream _test-output-stream) +17287 (clear-stream $_test-output-buffered-file->buffer) +17288 $test-compare-reg-with-mem:initialize-type: +17289 # var type/ecx: (payload tree type-id) = int +17290 68/push 0/imm32/right:null +17291 68/push 0/imm32/right:null +17292 68/push 0/imm32/left:unused +17293 68/push 1/imm32/value:int +17294 68/push 1/imm32/is-atom?:true +17295 68/push 0x11/imm32/alloc-id:fake:payload +17296 89/<- %ecx 4/r32/esp +17297 $test-compare-reg-with-mem:initialize-var1: +17298 # var var1/ecx: (payload var) +17299 68/push 0/imm32/register +17300 68/push 0/imm32/register +17301 68/push 0/imm32/no-stack-offset +17302 68/push 1/imm32/block-depth +17303 51/push-ecx +17304 68/push 0x11/imm32/alloc-id:fake +17305 68/push 0/imm32/name +17306 68/push 0/imm32/name +17307 68/push 0x11/imm32/alloc-id:fake:payload +17308 89/<- %ecx 4/r32/esp +17309 $test-compare-reg-with-mem:initialize-var1-name: +17310 # var1->name = "var1" +17311 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +17312 (copy-array Heap "var1" %eax) +17313 $test-compare-reg-with-mem:initialize-var1-register: +17314 # var1->register = "eax" +17315 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +17316 (copy-array Heap "eax" %eax) +17317 $test-compare-reg-with-mem:initialize-var2: +17318 # var var2/edx: (payload var) +17319 68/push 0/imm32/register +17320 68/push 0/imm32/register +17321 68/push 8/imm32/stack-offset +17322 68/push 1/imm32/block-depth +17323 ff 6/subop/push *(ecx+0x10) +17324 68/push 0x11/imm32/alloc-id:fake +17325 68/push 0/imm32/name +17326 68/push 0/imm32/name +17327 68/push 0x11/imm32/alloc-id:fake:payload +17328 89/<- %edx 4/r32/esp +17329 $test-compare-reg-with-mem:initialize-var2-name: +17330 # var2->name = "var2" +17331 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +17332 (copy-array Heap "var2" %eax) +17333 $test-compare-reg-with-mem:initialize-inouts: +17334 # var inouts/esi: (payload stmt-var) = [var2] +17335 68/push 0/imm32/is-deref:false +17336 68/push 0/imm32/next +17337 68/push 0/imm32/next +17338 52/push-edx/var2 +17339 68/push 0x11/imm32/alloc-id:fake +17340 68/push 0x11/imm32/alloc-id:fake:payload +17341 89/<- %esi 4/r32/esp +17342 # inouts = [var1, var2] +17343 68/push 0/imm32/is-deref:false +17344 56/push-esi/next +17345 68/push 0x11/imm32/alloc-id:fake +17346 51/push-ecx/var1 +17347 68/push 0x11/imm32/alloc-id:fake +17348 68/push 0x11/imm32/alloc-id:fake:payload +17349 89/<- %esi 4/r32/esp +17350 $test-compare-reg-with-mem:initialize-stmt: +17351 # var stmt/esi: (addr statement) +17352 68/push 0/imm32/next +17353 68/push 0/imm32/next +17354 68/push 0/imm32/outputs +17355 68/push 0/imm32/outputs +17356 56/push-esi/inouts +17357 68/push 0x11/imm32/alloc-id:fake +17358 68/push 0/imm32/operation +17359 68/push 0/imm32/operation +17360 68/push 1/imm32/tag:stmt1 +17361 89/<- %esi 4/r32/esp +17362 $test-compare-reg-with-mem:initialize-stmt-operation: +17363 # stmt->operation = "compare" +17364 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +17365 (copy-array Heap "compare" %eax) +17366 # convert +17367 c7 0/subop/copy *Curr-block-depth 0/imm32 +17368 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +17369 (flush _test-output-buffered-file) +17370 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +17376 # check output +17377 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem") +17378 # . epilogue +17379 89/<- %esp 5/r32/ebp +17380 5d/pop-to-ebp +17381 c3/return +17382 +17383 test-compare-mem-with-literal: +17384 # compare var1, 0x34 +17385 # => +17386 # 81 7/subop/compare *(ebp+___) 0x34/imm32 +17387 # +17388 # . prologue +17389 55/push-ebp +17390 89/<- %ebp 4/r32/esp +17391 # setup +17392 (clear-stream _test-output-stream) +17393 (clear-stream $_test-output-buffered-file->buffer) +17394 $test-compare-mem-with-literal:initialize-type: +17395 # var type/ecx: (payload tree type-id) = int +17396 68/push 0/imm32/right:null +17397 68/push 0/imm32/right:null +17398 68/push 0/imm32/left:unused +17399 68/push 1/imm32/value:int +17400 68/push 1/imm32/is-atom?:true +17401 68/push 0x11/imm32/alloc-id:fake:payload +17402 89/<- %ecx 4/r32/esp +17403 $test-compare-mem-with-literal:initialize-var1: +17404 # var var1/ecx: (payload var) +17405 68/push 0/imm32/register +17406 68/push 0/imm32/register +17407 68/push 8/imm32/stack-offset +17408 68/push 1/imm32/block-depth +17409 51/push-ecx +17410 68/push 0x11/imm32/alloc-id:fake +17411 68/push 0/imm32/name +17412 68/push 0/imm32/name +17413 68/push 0x11/imm32/alloc-id:fake:payload +17414 89/<- %ecx 4/r32/esp +17415 $test-compare-mem-with-literal:initialize-var1-name: +17416 # var1->name = "var1" +17417 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +17418 (copy-array Heap "var1" %eax) +17419 $test-compare-mem-with-literal:initialize-literal-type: +17420 # var type/edx: (payload tree type-id) = literal +17421 68/push 0/imm32/right:null +17422 68/push 0/imm32/right:null +17423 68/push 0/imm32/left:unused +17424 68/push 0/imm32/value:literal +17425 68/push 1/imm32/is-atom?:true +17426 68/push 0x11/imm32/alloc-id:fake:payload +17427 89/<- %edx 4/r32/esp +17428 $test-compare-mem-with-literal:initialize-literal: +17429 # var l/edx: (payload var) +17430 68/push 0/imm32/register +17431 68/push 0/imm32/register +17432 68/push 0/imm32/no-stack-offset +17433 68/push 1/imm32/block-depth +17434 52/push-edx +17435 68/push 0x11/imm32/alloc-id:fake +17436 68/push 0/imm32/name +17437 68/push 0/imm32/name +17438 68/push 0x11/imm32/alloc-id:fake:payload +17439 89/<- %edx 4/r32/esp +17440 $test-compare-mem-with-literal:initialize-literal-value: +17441 # l->name = "0x34" +17442 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +17443 (copy-array Heap "0x34" %eax) +17444 $test-compare-mem-with-literal:initialize-inouts: +17445 # var inouts/esi: (payload stmt-var) = [l] +17446 68/push 0/imm32/is-deref:false +17447 68/push 0/imm32/next +17448 68/push 0/imm32/next +17449 52/push-edx/l +17450 68/push 0x11/imm32/alloc-id:fake +17451 68/push 0x11/imm32/alloc-id:fake:payload +17452 89/<- %esi 4/r32/esp +17453 # var inouts = (handle stmt-var) = [var1, var2] +17454 68/push 0/imm32/is-deref:false +17455 56/push-esi/next +17456 68/push 0x11/imm32/alloc-id:fake +17457 51/push-ecx/var1 +17458 68/push 0x11/imm32/alloc-id:fake +17459 68/push 0x11/imm32/alloc-id:fake:payload +17460 89/<- %esi 4/r32/esp +17461 $test-compare-mem-with-literal:initialize-stmt: +17462 # var stmt/esi: (addr statement) +17463 68/push 0/imm32/next +17464 68/push 0/imm32/next +17465 68/push 0/imm32/outputs +17466 68/push 0/imm32/outputs +17467 56/push-esi/inouts +17468 68/push 0x11/imm32/alloc-id:fake +17469 68/push 0/imm32/operation +17470 68/push 0/imm32/operation +17471 68/push 1/imm32/tag:stmt1 +17472 89/<- %esi 4/r32/esp +17473 $test-compare-mem-with-literal:initialize-stmt-operation: +17474 # stmt->operation = "compare" +17475 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +17476 (copy-array Heap "compare" %eax) +17477 # convert +17478 c7 0/subop/copy *Curr-block-depth 0/imm32 +17479 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +17480 (flush _test-output-buffered-file) +17481 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +17487 # check output +17488 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal") +17489 # . epilogue +17490 89/<- %esp 5/r32/ebp +17491 5d/pop-to-ebp +17492 c3/return +17493 +17494 test-compare-eax-with-literal: +17495 # compare var1/eax 0x34 +17496 # => +17497 # 3d/compare-eax-with 0x34/imm32 +17498 # +17499 # . prologue +17500 55/push-ebp +17501 89/<- %ebp 4/r32/esp +17502 # setup +17503 (clear-stream _test-output-stream) +17504 (clear-stream $_test-output-buffered-file->buffer) +17505 $test-compare-eax-with-literal:initialize-type: +17506 # var type/ecx: (payload tree type-id) = int +17507 68/push 0/imm32/right:null +17508 68/push 0/imm32/right:null +17509 68/push 0/imm32/left:unused +17510 68/push 1/imm32/value:int +17511 68/push 1/imm32/is-atom?:true +17512 68/push 0x11/imm32/alloc-id:fake:payload +17513 89/<- %ecx 4/r32/esp +17514 $test-compare-eax-with-literal:initialize-var1: +17515 # var var1/ecx: (payload var) +17516 68/push 0/imm32/register +17517 68/push 0/imm32/register +17518 68/push 0/imm32/no-stack-offset +17519 68/push 1/imm32/block-depth +17520 51/push-ecx +17521 68/push 0x11/imm32/alloc-id:fake +17522 68/push 0/imm32/name +17523 68/push 0/imm32/name +17524 68/push 0x11/imm32/alloc-id:fake:payload +17525 89/<- %ecx 4/r32/esp +17526 $test-compare-eax-with-literal:initialize-var1-name: +17527 # var1->name = "var1" +17528 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +17529 (copy-array Heap "var1" %eax) +17530 $test-compare-eax-with-literal:initialize-var1-register: +17531 # v->register = "eax" +17532 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +17533 (copy-array Heap "eax" %eax) +17534 $test-compare-eax-with-literal:initialize-literal-type: +17535 # var type/edx: (payload tree type-id) = literal +17536 68/push 0/imm32/right:null +17537 68/push 0/imm32/right:null +17538 68/push 0/imm32/left:unused +17539 68/push 0/imm32/value:literal +17540 68/push 1/imm32/is-atom?:true +17541 68/push 0x11/imm32/alloc-id:fake:payload +17542 89/<- %edx 4/r32/esp +17543 $test-compare-eax-with-literal:initialize-literal: +17544 # var l/edx: (payload var) +17545 68/push 0/imm32/register +17546 68/push 0/imm32/register +17547 68/push 0/imm32/no-stack-offset +17548 68/push 1/imm32/block-depth +17549 52/push-edx +17550 68/push 0x11/imm32/alloc-id:fake +17551 68/push 0/imm32/name +17552 68/push 0/imm32/name +17553 68/push 0x11/imm32/alloc-id:fake:payload +17554 89/<- %edx 4/r32/esp +17555 $test-compare-eax-with-literal:initialize-literal-value: +17556 # l->name = "0x34" +17557 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +17558 (copy-array Heap "0x34" %eax) +17559 $test-compare-eax-with-literal:initialize-inouts: +17560 # var inouts/esi: (payload stmt-var) = [l] +17561 68/push 0/imm32/is-deref:false +17562 68/push 0/imm32/next +17563 68/push 0/imm32/next +17564 52/push-edx/l +17565 68/push 0x11/imm32/alloc-id:fake +17566 68/push 0x11/imm32/alloc-id:fake:payload +17567 89/<- %esi 4/r32/esp +17568 # var inouts = (handle stmt-var) = [var1, var2] +17569 68/push 0/imm32/is-deref:false +17570 56/push-esi/next +17571 68/push 0x11/imm32/alloc-id:fake +17572 51/push-ecx/var1 +17573 68/push 0x11/imm32/alloc-id:fake +17574 68/push 0x11/imm32/alloc-id:fake:payload +17575 89/<- %esi 4/r32/esp +17576 $test-compare-eax-with-literal:initialize-stmt: +17577 # var stmt/esi: (addr statement) +17578 68/push 0/imm32/next +17579 68/push 0/imm32/next +17580 68/push 0/imm32/outputs +17581 68/push 0/imm32/outputs +17582 56/push-esi/inouts +17583 68/push 0x11/imm32/alloc-id:fake +17584 68/push 0/imm32/operation +17585 68/push 0/imm32/operation +17586 68/push 1/imm32/tag:stmt1 +17587 89/<- %esi 4/r32/esp +17588 $test-compare-eax-with-literal:initialize-stmt-operation: +17589 # stmt->operation = "compare" +17590 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +17591 (copy-array Heap "compare" %eax) +17592 # convert +17593 c7 0/subop/copy *Curr-block-depth 0/imm32 +17594 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +17595 (flush _test-output-buffered-file) +17596 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +17602 # check output +17603 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal") +17604 # . epilogue +17605 89/<- %esp 5/r32/ebp +17606 5d/pop-to-ebp +17607 c3/return +17608 +17609 test-compare-reg-with-literal: +17610 # compare var1/ecx 0x34 +17611 # => +17612 # 81 7/subop/compare %ecx 0x34/imm32 +17613 # +17614 # . prologue +17615 55/push-ebp +17616 89/<- %ebp 4/r32/esp +17617 # setup +17618 (clear-stream _test-output-stream) +17619 (clear-stream $_test-output-buffered-file->buffer) +17620 $test-compare-reg-with-literal:initialize-type: +17621 # var type/ecx: (payload tree type-id) = int +17622 68/push 0/imm32/right:null +17623 68/push 0/imm32/right:null +17624 68/push 0/imm32/left:unused +17625 68/push 1/imm32/value:int +17626 68/push 1/imm32/is-atom?:true +17627 68/push 0x11/imm32/alloc-id:fake:payload +17628 89/<- %ecx 4/r32/esp +17629 $test-compare-reg-with-literal:initialize-var1: +17630 # var var1/ecx: (payload var) +17631 68/push 0/imm32/register +17632 68/push 0/imm32/register +17633 68/push 0/imm32/no-stack-offset +17634 68/push 1/imm32/block-depth +17635 51/push-ecx +17636 68/push 0x11/imm32/alloc-id:fake +17637 68/push 0/imm32/name +17638 68/push 0/imm32/name +17639 68/push 0x11/imm32/alloc-id:fake:payload +17640 89/<- %ecx 4/r32/esp +17641 $test-compare-reg-with-literal:initialize-var1-name: +17642 # var1->name = "var1" +17643 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +17644 (copy-array Heap "var1" %eax) +17645 $test-compare-reg-with-literal:initialize-var1-register: +17646 # v->register = "ecx" +17647 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +17648 (copy-array Heap "ecx" %eax) +17649 $test-compare-reg-with-literal:initialize-literal-type: +17650 # var type/edx: (payload tree type-id) = literal +17651 68/push 0/imm32/right:null +17652 68/push 0/imm32/right:null +17653 68/push 0/imm32/left:unused +17654 68/push 0/imm32/value:literal +17655 68/push 1/imm32/is-atom?:true +17656 68/push 0x11/imm32/alloc-id:fake:payload +17657 89/<- %edx 4/r32/esp +17658 $test-compare-reg-with-literal:initialize-literal: +17659 # var l/edx: (payload var) +17660 68/push 0/imm32/register +17661 68/push 0/imm32/register +17662 68/push 0/imm32/no-stack-offset +17663 68/push 1/imm32/block-depth +17664 52/push-edx +17665 68/push 0x11/imm32/alloc-id:fake +17666 68/push 0/imm32/name +17667 68/push 0/imm32/name +17668 68/push 0x11/imm32/alloc-id:fake:payload +17669 89/<- %edx 4/r32/esp +17670 $test-compare-reg-with-literal:initialize-literal-value: +17671 # l->name = "0x34" +17672 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +17673 (copy-array Heap "0x34" %eax) +17674 $test-compare-reg-with-literal:initialize-inouts: +17675 # var inouts/esi: (payload stmt-var) = [l] +17676 68/push 0/imm32/is-deref:false +17677 68/push 0/imm32/next +17678 68/push 0/imm32/next +17679 52/push-edx/l +17680 68/push 0x11/imm32/alloc-id:fake +17681 68/push 0x11/imm32/alloc-id:fake:payload +17682 89/<- %esi 4/r32/esp +17683 # var inouts = (handle stmt-var) = [var1, var2] +17684 68/push 0/imm32/is-deref:false +17685 56/push-esi/next +17686 68/push 0x11/imm32/alloc-id:fake +17687 51/push-ecx/var1 +17688 68/push 0x11/imm32/alloc-id:fake +17689 68/push 0x11/imm32/alloc-id:fake:payload +17690 89/<- %esi 4/r32/esp +17691 $test-compare-reg-with-literal:initialize-stmt: +17692 # var stmt/esi: (addr statement) +17693 68/push 0/imm32/next +17694 68/push 0/imm32/next +17695 68/push 0/imm32/outputs +17696 68/push 0/imm32/outputs +17697 56/push-esi/inouts +17698 68/push 0x11/imm32/alloc-id:fake +17699 68/push 0/imm32/operation +17700 68/push 0/imm32/operation +17701 68/push 1/imm32/tag:stmt1 +17702 89/<- %esi 4/r32/esp +17703 $test-compare-reg-with-literal:initialize-stmt-operation: +17704 # stmt->operation = "compare" +17705 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +17706 (copy-array Heap "compare" %eax) +17707 # convert +17708 c7 0/subop/copy *Curr-block-depth 0/imm32 +17709 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +17710 (flush _test-output-buffered-file) +17711 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +17717 # check output +17718 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal") +17719 # . epilogue +17720 89/<- %esp 5/r32/ebp +17721 5d/pop-to-ebp +17722 c3/return +17723 +17724 test-emit-subx-stmt-function-call: +17725 # Call a function on a variable on the stack. +17726 # f foo +17727 # => +17728 # (f *(ebp-8)) +17729 # (Changing the function name supports overloading in general, but here it +17730 # just serves to help disambiguate things.) +17731 # +17732 # There's a variable on the var stack as follows: +17733 # name: 'foo' +17734 # type: int +17735 # stack-offset: -8 +17736 # +17737 # There's nothing in primitives. +17738 # +17739 # We don't perform any checking here on the type of 'f'. +17740 # +17741 # . prologue +17742 55/push-ebp +17743 89/<- %ebp 4/r32/esp +17744 # setup +17745 (clear-stream _test-output-stream) +17746 (clear-stream $_test-output-buffered-file->buffer) +17747 $test-emit-subx-function-call:initialize-type: +17748 # var type/ecx: (payload tree type-id) = int +17749 68/push 0/imm32/right:null +17750 68/push 0/imm32/right:null +17751 68/push 0/imm32/left:unused +17752 68/push 1/imm32/value:int +17753 68/push 1/imm32/is-atom?:true +17754 68/push 0x11/imm32/alloc-id:fake:payload +17755 89/<- %ecx 4/r32/esp +17756 $test-emit-subx-function-call:initialize-var: +17757 # var var-foo/ecx: (payload var) = var(type) +17758 68/push 0/imm32/no-register +17759 68/push 0/imm32/no-register +17760 68/push -8/imm32/stack-offset +17761 68/push 1/imm32/block-depth +17762 51/push-ecx/type +17763 68/push 0x11/imm32/alloc-id:fake +17764 68/push 0/imm32/name +17765 68/push 0/imm32/name +17766 68/push 0x11/imm32/alloc-id:fake:payload +17767 89/<- %ecx 4/r32/esp +17768 $test-emit-subx-function-call:initialize-var-name: +17769 # var-foo->name = "foo" +17770 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +17771 (copy-array Heap "foo" %eax) +17772 $test-emit-subx-function-call:initialize-stmt-var: +17773 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +17774 68/push 0/imm32/is-deref:false +17775 68/push 0/imm32/next +17776 68/push 0/imm32/next +17777 51/push-ecx/var-foo +17778 68/push 0x11/imm32/alloc-id:fake +17779 68/push 0x11/imm32/alloc-id:fake:payload +17780 89/<- %ebx 4/r32/esp +17781 $test-emit-subx-function-call:initialize-stmt: +17782 # var stmt/esi: (addr statement) +17783 68/push 0/imm32/no-outputs +17784 68/push 0/imm32/no-outputs +17785 53/push-ebx/inouts +17786 68/push 0x11/imm32/alloc-id:fake +17787 68/push 0/imm32/operation +17788 68/push 0/imm32/operation +17789 68/push 1/imm32/tag +17790 89/<- %esi 4/r32/esp +17791 $test-emit-subx-function-call:initialize-stmt-operation: +17792 # stmt->operation = "f" +17793 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +17794 (copy-array Heap "f" %eax) +17795 # convert +17796 c7 0/subop/copy *Curr-block-depth 0/imm32 +17797 (emit-subx-stmt _test-output-buffered-file %esi 0 Stderr 0) +17798 (flush _test-output-buffered-file) +17799 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +17805 # check output +17806 (check-next-stream-line-equal _test-output-stream "(f *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call") +17807 # . epilogue +17808 89/<- %esp 5/r32/ebp +17809 5d/pop-to-ebp +17810 c3/return +17811 +17812 test-emit-subx-stmt-function-call-with-literal-arg: +17813 # Call a function on a literal. +17814 # f 0x34 +17815 # => +17816 # (f2 0x34) +17817 # +17818 # . prologue +17819 55/push-ebp +17820 89/<- %ebp 4/r32/esp +17821 # setup +17822 (clear-stream _test-output-stream) +17823 (clear-stream $_test-output-buffered-file->buffer) +17824 $test-emit-subx-function-call-with-literal-arg:initialize-type: +17825 # var type/ecx: (payload tree type-id) = int +17826 68/push 0/imm32/right:null +17827 68/push 0/imm32/right:null +17828 68/push 0/imm32/left:unused +17829 68/push 0/imm32/value:literal +17830 68/push 1/imm32/is-atom?:true +17831 68/push 0x11/imm32/alloc-id:fake:payload +17832 89/<- %ecx 4/r32/esp +17833 $test-emit-subx-function-call-with-literal-arg:initialize-var: +17834 # var var-foo/ecx: (payload var) = var(lit) +17835 68/push 0/imm32/no-register +17836 68/push 0/imm32/no-register +17837 68/push 0/imm32/no-stack-offset +17838 68/push 1/imm32/block-depth +17839 51/push-ecx/type +17840 68/push 0x11/imm32/alloc-id:fake +17841 68/push 0/imm32/name +17842 68/push 0/imm32/name +17843 68/push 0x11/imm32/alloc-id:fake:payload +17844 89/<- %ecx 4/r32/esp +17845 $test-emit-subx-function-call-with-literal-arg:initialize-var-name: +17846 # var-foo->name = "0x34" +17847 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +17848 (copy-array Heap "0x34" %eax) +17849 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-var: +17850 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +17851 68/push 0/imm32/is-deref:false +17852 68/push 0/imm32/next +17853 68/push 0/imm32/next +17854 51/push-ecx/var-foo +17855 68/push 0x11/imm32/alloc-id:fake +17856 68/push 0x11/imm32/alloc-id:fake:payload +17857 89/<- %ebx 4/r32/esp +17858 $test-emit-subx-function-call-with-literal-arg:initialize-stmt: +17859 # var stmt/esi: (addr statement) +17860 68/push 0/imm32/no-outputs +17861 68/push 0/imm32/no-outputs +17862 53/push-ebx/inouts +17863 68/push 0x11/imm32/alloc-id:fake +17864 68/push 0/imm32/operation +17865 68/push 0/imm32/operation +17866 68/push 1/imm32/tag +17867 89/<- %esi 4/r32/esp +17868 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-operation: +17869 # stmt->operation = "f" +17870 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +17871 (copy-array Heap "f" %eax) +17872 # convert +17873 c7 0/subop/copy *Curr-block-depth 0/imm32 +17874 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx Stderr 0) +17875 (flush _test-output-buffered-file) +17876 +-- 6 lines: #? # dump _test-output-stream ----------------------------------------------------------------------------------------------------------------------------------------- +17882 # check output +17883 (check-next-stream-line-equal _test-output-stream "(f 0x34)" "F - test-emit-subx-stmt-function-call-with-literal-arg") +17884 # . epilogue +17885 89/<- %esp 5/r32/ebp +17886 5d/pop-to-ebp +17887 c3/return +17888 +17889 emit-indent: # out: (addr buffered-file), n: int +17890 # . prologue +17891 55/push-ebp +17892 89/<- %ebp 4/r32/esp +17893 # . save registers +17894 50/push-eax +17895 # var i/eax: int = n +17896 8b/-> *(ebp+0xc) 0/r32/eax +17897 { +17898 # if (i <= 0) break +17899 3d/compare-eax-with 0/imm32 +17900 7e/jump-if-<= break/disp8 +17901 (write-buffered *(ebp+8) " ") +17902 48/decrement-eax +17903 eb/jump loop/disp8 +17904 } +17905 $emit-indent:end: +17906 # . restore registers +17907 58/pop-to-eax +17908 # . epilogue +17909 89/<- %esp 5/r32/ebp +17910 5d/pop-to-ebp +17911 c3/return +17912 +17913 emit-subx-prologue: # out: (addr buffered-file) +17914 # . prologue +17915 55/push-ebp +17916 89/<- %ebp 4/r32/esp +17917 # +17918 (write-buffered *(ebp+8) " # . prologue\n") +17919 (write-buffered *(ebp+8) " 55/push-ebp\n") +17920 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n") +17921 $emit-subx-prologue:end: +17922 # . epilogue +17923 89/<- %esp 5/r32/ebp +17924 5d/pop-to-ebp +17925 c3/return +17926 +17927 emit-subx-epilogue: # out: (addr buffered-file) +17928 # . prologue +17929 55/push-ebp +17930 89/<- %ebp 4/r32/esp +17931 # +17932 (write-buffered *(ebp+8) " # . epilogue\n") +17933 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n") +17934 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n") +17935 (write-buffered *(ebp+8) " c3/return\n") +17936 $emit-subx-epilogue:end: +17937 # . epilogue +17938 89/<- %esp 5/r32/ebp +17939 5d/pop-to-ebp +17940 c3/return -- cgit 1.4.1-2-gfad0