https://github.com/akkartik/mu/blob/master/apps/mu.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241 == data
242
243 Program:
244 _Program-functions:
245 0/imm32
246 _Program-types:
247 0/imm32
248
249
250
251
252
253
254
255
256
257
258
259
260 Function-name:
261 0/imm32
262 Function-subx-name:
263 4/imm32
264 Function-inouts:
265 8/imm32
266 Function-outputs:
267 0xc/imm32
268 Function-body:
269 0x10/imm32
270 Function-next:
271 0x14/imm32
272 Function-size:
273 0x18/imm32/24
274
275 Primitive-name:
276 0/imm32
277 Primitive-inouts:
278 4/imm32
279 Primitive-outputs:
280 8/imm32
281 Primitive-subx-name:
282 0xc/imm32
283 Primitive-subx-rm32:
284 0x10/imm32
285 Primitive-subx-r32:
286 0x14/imm32
287 Primitive-subx-imm32:
288 0x18/imm32
289 Primitive-subx-disp32:
290 0x1c/imm32
291 Primitive-output-is-write-only:
292 0x20/imm32
293 Primitive-next:
294 0x24/imm32
295 Primitive-size:
296 0x28/imm32/36
297
298 Stmt-tag:
299 0/imm32
300
301 Block-stmts:
302 4/imm32
303 Block-var:
304 8/imm32
305
306 Stmt1-operation:
307 4/imm32
308 Stmt1-inouts:
309 8/imm32
310 Stmt1-outputs:
311 0xc/imm32
312
313 Vardef-var:
314 4/imm32
315
316 Regvardef-operation:
317 4/imm32
318 Regvardef-inouts:
319 8/imm32
320 Regvardef-outputs:
321 0xc/imm32
322
323 Stmt-size:
324 0x10/imm32
325
326 Var-name:
327 0/imm32
328 Var-type:
329 4/imm32
330 Var-block-depth:
331 8/imm32
332 Var-offset:
333 0xc/imm32
334 Var-register:
335 0x10/imm32
336 Var-size:
337 0x14/imm32
338
339 Any-register:
340
341 1/imm32
342
343 2a/asterisk
344
345 List-value:
346 0/imm32
347 List-next:
348 4/imm32
349 List-size:
350 8/imm32
351
352
353 Stmt-var-value:
354 0/imm32
355 Stmt-var-next:
356 4/imm32
357 Stmt-var-is-deref:
358 8/imm32
359 Stmt-var-size:
360 0xc/imm32
361
362
363
364
365
366
367
368 Tree-left:
369 0/imm32
370 Tree-right:
371 4/imm32
372 Tree-size:
373 8/imm32
374
375
376
377 Max-type-id:
378 0x10000/imm32
379
380 Type-id:
381 0x1c/imm32/write
382 0/imm32/read
383 0x100/imm32/length
384
385 "literal"/imm32
386 "int"/imm32
387 "addr"/imm32
388 "array"/imm32
389 "handle"/imm32
390 "boolean"/imm32
391 "constant"/imm32
392 "offset"/imm32
393 0/imm32
394
395 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
396 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
397 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
398 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
399 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
400 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
401 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
402
403
404
405 Typeinfo-id:
406 0/imm32
407 Typeinfo-fields:
408 4/imm32
409
410
411
412
413
414 Typeinfo-total-size-in-bytes:
415 8/imm32
416 Typeinfo-next:
417 0xc/imm32
418 Typeinfo-size:
419 0x10/imm32
420
421
422
423 Typeinfo-fields-row-size:
424 8/imm32
425
426
427
428
429
430
431
432
433 Typeinfo-entry-input-var:
434 0/imm32
435 Typeinfo-entry-index:
436 4/imm32
437 Typeinfo-entry-output-var:
438 8/imm32
439 Typeinfo-entry-size:
440 0xc/imm32
441
442 == code
443
444 Entry:
445
446 89/<- %ebp 4/r32/esp
447 (new-segment *Heap-size Heap)
448
449 {
450
451 81 7/subop/compare *ebp 1/imm32
452 7e/jump-if-<= break/disp8
453
454 (kernel-string-equal? *(ebp+8) "test")
455 3d/compare-eax-and 0/imm32/false
456 74/jump-if-= break/disp8
457
458 (run-tests)
459
460 8b/-> *Num-test-failures 3/r32/ebx
461 eb/jump $mu-main:end/disp8
462 }
463
464 (convert-mu Stdin Stdout)
465 (flush Stdout)
466
467 bb/copy-to-ebx 0/imm32
468 $mu-main:end:
469 b8/copy-to-eax 1/imm32/exit
470 cd/syscall 0x80/imm8
471
472 convert-mu:
473
474 55/push-ebp
475 89/<- %ebp 4/r32/esp
476
477 c7 0/subop/copy *Next-block-index 1/imm32
478 c7 0/subop/copy *Type-id 0x1c/imm32
479 c7 0/subop/copy *_Program-functions 0/imm32
480 c7 0/subop/copy *_Program-types 0/imm32
481
482 (parse-mu *(ebp+8))
483 (populate-mu-type-sizes)
484 (check-mu-types)
485 (emit-subx *(ebp+0xc))
486 $convert-mu:end:
487
488 89/<- %esp 5/r32/ebp
489 5d/pop-to-ebp
490 c3/return
491
492 test-convert-empty-input:
493
494
495 55/push-ebp
496 89/<- %ebp 4/r32/esp
497
498 (clear-stream _test-input-stream)
499 (clear-stream $_test-input-buffered-file->buffer)
500 (clear-stream _test-output-stream)
501 (clear-stream $_test-output-buffered-file->buffer)
502
503 (convert-mu _test-input-buffered-file _test-output-buffered-file)
504 (flush _test-output-buffered-file)
505 (check-stream-equal _test-output-stream "" "F - test-convert-empty-input")
506
507 89/<- %esp 5/r32/ebp
508 5d/pop-to-ebp
509 c3/return
510
511 test-convert-function-skeleton:
512
513 55/push-ebp
514 89/<- %ebp 4/r32/esp
515
516 (clear-stream _test-input-stream)
517 (clear-stream $_test-input-buffered-file->buffer)
518 (clear-stream _test-output-stream)
519 (clear-stream $_test-output-buffered-file->buffer)
520
521 (write _test-input-stream "fn foo {\n")
522 (write _test-input-stream "}\n")
523
524 (convert-mu _test-input-buffered-file _test-output-buffered-file)
525 (flush _test-output-buffered-file)
526 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
532
533 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0")
534 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-skeleton/1")
535 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-skeleton/2")
536 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3")
537 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-skeleton/4")
538 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5")
539 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-skeleton/6")
540 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-skeleton/7")
541
542 89/<- %esp 5/r32/ebp
543 5d/pop-to-ebp
544 c3/return
545
546 test-convert-multiple-function-skeletons:
547
548 55/push-ebp
549 89/<- %ebp 4/r32/esp
550
551 (clear-stream _test-input-stream)
552 (clear-stream $_test-input-buffered-file->buffer)
553 (clear-stream _test-output-stream)
554 (clear-stream $_test-output-buffered-file->buffer)
555
556 (write _test-input-stream "fn foo {\n")
557 (write _test-input-stream "}\n")
558 (write _test-input-stream "fn bar {\n")
559 (write _test-input-stream "}\n")
560
561 (convert-mu _test-input-buffered-file _test-output-buffered-file)
562 (flush _test-output-buffered-file)
563 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
569
570 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0")
571 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/1")
572 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/2")
573 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3")
574 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/4")
575 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5")
576 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6")
577 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/7")
578
579 (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10")
580 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/11")
581 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/12")
582 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13")
583 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/14")
584 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15")
585 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16")
586 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/17")
587
588 89/<- %esp 5/r32/ebp
589 5d/pop-to-ebp
590 c3/return
591
592 test-convert-function-with-arg:
593
594 55/push-ebp
595 89/<- %ebp 4/r32/esp
596
597 (clear-stream _test-input-stream)
598 (clear-stream $_test-input-buffered-file->buffer)
599 (clear-stream _test-output-stream)
600 (clear-stream $_test-output-buffered-file->buffer)
601
602 (write _test-input-stream "fn foo n: int {\n")
603 (write _test-input-stream "}\n")
604
605 (convert-mu _test-input-buffered-file _test-output-buffered-file)
606 (flush _test-output-buffered-file)
607 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
613
614 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0")
615 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg/1")
616 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg/2")
617 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3")
618 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg/4")
619 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5")
620 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg/6")
621 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg/7")
622
623 89/<- %esp 5/r32/ebp
624 5d/pop-to-ebp
625 c3/return
626
627 test-convert-function-with-arg-and-body:
628
629 55/push-ebp
630 89/<- %ebp 4/r32/esp
631
632 (clear-stream _test-input-stream)
633 (clear-stream $_test-input-buffered-file->buffer)
634 (clear-stream _test-output-stream)
635 (clear-stream $_test-output-buffered-file->buffer)
636
637 (write _test-input-stream "fn foo n: int {\n")
638 (write _test-input-stream " increment n\n")
639 (write _test-input-stream "}\n")
640
641 (convert-mu _test-input-buffered-file _test-output-buffered-file)
642 (flush _test-output-buffered-file)
643 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
649
650 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0")
651 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1")
652 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg-and-body/2")
653 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3")
654 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-arg-and-body/4")
655 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-arg-and-body/5")
656 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/6")
657 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-arg-and-body/7")
658 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-arg-and-body/8")
659 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg-and-body/9")
660 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/10")
661 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/11")
662 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg-and-body/12")
663
664 89/<- %esp 5/r32/ebp
665 5d/pop-to-ebp
666 c3/return
667
668 test-convert-function-distinguishes-args:
669
670 55/push-ebp
671 89/<- %ebp 4/r32/esp
672
673 (clear-stream _test-input-stream)
674 (clear-stream $_test-input-buffered-file->buffer)
675 (clear-stream _test-output-stream)
676 (clear-stream $_test-output-buffered-file->buffer)
677
678 (write _test-input-stream "fn foo a: int, b: int {\n")
679 (write _test-input-stream " increment b\n")
680 (write _test-input-stream "}\n")
681
682 (convert-mu _test-input-buffered-file _test-output-buffered-file)
683 (flush _test-output-buffered-file)
684 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
690
691 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0")
692 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-distinguishes-args/1")
693 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-distinguishes-args/2")
694 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3")
695 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-distinguishes-args/4")
696 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-distinguishes-args/5")
697 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/6")
698 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-distinguishes-args/7")
699 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-distinguishes-args/8")
700 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-distinguishes-args/9")
701 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/10")
702 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/11")
703 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-distinguishes-args/12")
704
705 89/<- %esp 5/r32/ebp
706 5d/pop-to-ebp
707 c3/return
708
709 test-convert-function-returns-result:
710
711 55/push-ebp
712 89/<- %ebp 4/r32/esp
713
714 (clear-stream _test-input-stream)
715 (clear-stream $_test-input-buffered-file->buffer)
716 (clear-stream _test-output-stream)
717 (clear-stream $_test-output-buffered-file->buffer)
718
719 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
720 (write _test-input-stream " result <- copy a\n")
721 (write _test-input-stream " result <- increment\n")
722 (write _test-input-stream "}\n")
723
724 (convert-mu _test-input-buffered-file _test-output-buffered-file)
725 (flush _test-output-buffered-file)
726 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
732
733 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-returns-result/0")
734 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-returns-result/1")
735 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-returns-result/2")
736 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-returns-result/3")
737 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-returns-result/4")
738 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-returns-result/5")
739 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-returns-result/6")
740 (check-next-stream-line-equal _test-output-stream " 40/increment-eax" "F - test-convert-function-returns-result/7")
741 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-returns-result/8")
742 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-returns-result/9")
743 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-returns-result/10")
744 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-returns-result/11")
745 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-returns-result/12")
746 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-returns-result/13")
747
748 89/<- %esp 5/r32/ebp
749 5d/pop-to-ebp
750 c3/return
751
752 test-convert-function-with-literal-arg:
753
754 55/push-ebp
755 89/<- %ebp 4/r32/esp
756
757 (clear-stream _test-input-stream)
758 (clear-stream $_test-input-buffered-file->buffer)
759 (clear-stream _test-output-stream)
760 (clear-stream $_test-output-buffered-file->buffer)
761
762 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
763 (write _test-input-stream " result <- copy a\n")
764 (write _test-input-stream " result <- add 1\n")
765 (write _test-input-stream "}\n")
766
767 (convert-mu _test-input-buffered-file _test-output-buffered-file)
768 (flush _test-output-buffered-file)
769 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
775
776 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg/0")
777 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg/1")
778 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg/2")
779 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg/3")
780 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg/4")
781 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg/5")
782 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-with-literal-arg/6")
783 (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-with-literal-arg/7")
784 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg/8")
785 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg/9")
786 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg/10")
787 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg/11")
788 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg/12")
789 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg/13")
790
791 89/<- %esp 5/r32/ebp
792 5d/pop-to-ebp
793 c3/return
794
795 test-convert-function-with-literal-arg-2:
796
797 55/push-ebp
798 89/<- %ebp 4/r32/esp
799
800 (clear-stream _test-input-stream)
801 (clear-stream $_test-input-buffered-file->buffer)
802 (clear-stream _test-output-stream)
803 (clear-stream $_test-output-buffered-file->buffer)
804
805 (write _test-input-stream "fn foo a: int, b: int -> result/ebx: int {\n")
806 (write _test-input-stream " result <- copy a\n")
807 (write _test-input-stream " result <- add 1\n")
808 (write _test-input-stream "}\n")
809
810 (convert-mu _test-input-buffered-file _test-output-buffered-file)
811 (flush _test-output-buffered-file)
812 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
818
819 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg-2/0")
820 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg-2/1")
821 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg-2/2")
822 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg-2/3")
823 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg-2/4")
824 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg-2/5")
825 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/6")
826 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-with-literal-arg-2/7")
827 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg-2/8")
828 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg-2/9")
829 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg-2/10")
830 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg-2/11")
831 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg-2/12")
832 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg-2/13")
833
834 89/<- %esp 5/r32/ebp
835 5d/pop-to-ebp
836 c3/return
837
838 test-convert-function-call-with-literal-arg:
839
840 55/push-ebp
841 89/<- %ebp 4/r32/esp
842
843 (clear-stream _test-input-stream)
844 (clear-stream $_test-input-buffered-file->buffer)
845 (clear-stream _test-output-stream)
846 (clear-stream $_test-output-buffered-file->buffer)
847
848 (write _test-input-stream "fn main -> result/ebx: int {\n")
849 (write _test-input-stream " result <- do-add 3 4\n")
850 (write _test-input-stream "}\n")
851 (write _test-input-stream "fn do-add a: int, b: int -> result/ebx: int {\n")
852 (write _test-input-stream " result <- copy a\n")
853 (write _test-input-stream " result <- add b\n")
854 (write _test-input-stream "}\n")
855
856 (convert-mu _test-input-buffered-file _test-output-buffered-file)
857 (flush _test-output-buffered-file)
858 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
864
865 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0")
866 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1")
867 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2")
868 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3")
869 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4")
870 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-literal-arg/5")
871 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/6")
872 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/7")
873 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-literal-arg/8")
874 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/9")
875 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/10")
876 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/11")
877 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/12")
878 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/13")
879 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/14")
880 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/15")
881 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/16")
882 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/17")
883 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:loop:" "F - test-convert-function-call-with-literal-arg/18")
884 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/19")
885 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/20")
886 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/21")
887 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:break:" "F - test-convert-function-call-with-literal-arg/22")
888 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/23")
889 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/24")
890 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/25")
891 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/26")
892
893 89/<- %esp 5/r32/ebp
894 5d/pop-to-ebp
895 c3/return
896
897 test-convert-function-with-local-var-in-mem:
898
899 55/push-ebp
900 89/<- %ebp 4/r32/esp
901
902 (clear-stream _test-input-stream)
903 (clear-stream $_test-input-buffered-file->buffer)
904 (clear-stream _test-output-stream)
905 (clear-stream $_test-output-buffered-file->buffer)
906
907 (write _test-input-stream "fn foo {\n")
908 (write _test-input-stream " var x: int\n")
909 (write _test-input-stream " increment x\n")
910 (write _test-input-stream "}\n")
911
912 (convert-mu _test-input-buffered-file _test-output-buffered-file)
913 (flush _test-output-buffered-file)
914 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
920
921 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0")
922 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1")
923 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2")
924 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3")
925 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4")
926 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem/5")
927 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/6")
928 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/7")
929 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-mem/8")
930 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/9")
931 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem/10")
932 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/11")
933 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/12")
934 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/13")
935 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/14")
936
937 89/<- %esp 5/r32/ebp
938 5d/pop-to-ebp
939 c3/return
940
941 test-convert-function-with-local-var-with-compound-type-in-mem:
942
943 55/push-ebp
944 89/<- %ebp 4/r32/esp
945
946 (clear-stream _test-input-stream)
947 (clear-stream $_test-input-buffered-file->buffer)
948 (clear-stream _test-output-stream)
949 (clear-stream $_test-output-buffered-file->buffer)
950
951 (write _test-input-stream "fn foo {\n")
952 (write _test-input-stream " var x: (addr int)\n")
953 (write _test-input-stream " copy-to x, 0\n")
954 (write _test-input-stream "}\n")
955
956 (convert-mu _test-input-buffered-file _test-output-buffered-file)
957 (flush _test-output-buffered-file)
958 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
964
965 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/0")
966 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/1")
967 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/2")
968 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/3")
969 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-compound-type-in-mem/4")
970 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/5")
971 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/6")
972 (check-next-stream-line-equal _test-output-stream " c7 0/subop/copy *(ebp+0xfffffffc) 0/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/7")
973 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/8")
974 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-compound-type-in-mem/9")
975 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/10")
976 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/11")
977 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/12")
978 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/13")
979 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-compound-type-in-mem/14")
980
981 89/<- %esp 5/r32/ebp
982 5d/pop-to-ebp
983 c3/return
984
985 test-convert-function-with-local-var-in-reg:
986
987 55/push-ebp
988 89/<- %ebp 4/r32/esp
989
990 (clear-stream _test-input-stream)
991 (clear-stream $_test-input-buffered-file->buffer)
992 (clear-stream _test-output-stream)
993 (clear-stream $_test-output-buffered-file->buffer)
994
995 (write _test-input-stream "fn foo {\n")
996 (write _test-input-stream " var x/ecx: int <- copy 3\n")
997 (write _test-input-stream " x <- increment\n")
998 (write _test-input-stream "}\n")
999
1000 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1001 (flush _test-output-buffered-file)
1002 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1008
1009 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0")
1010 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1")
1011 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2")
1012 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3")
1013 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4")
1014 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-reg/5")
1015 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/6")
1016 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/7")
1017 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/8")
1018 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/9")
1019 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/10")
1020 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-reg/11")
1021 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/12")
1022 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/13")
1023 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/14")
1024 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/15")
1025
1026 89/<- %esp 5/r32/ebp
1027 5d/pop-to-ebp
1028 c3/return
1029
1030 test-convert-function-with-second-local-var-in-same-reg:
1031
1032 55/push-ebp
1033 89/<- %ebp 4/r32/esp
1034
1035 (clear-stream _test-input-stream)
1036 (clear-stream $_test-input-buffered-file->buffer)
1037 (clear-stream _test-output-stream)
1038 (clear-stream $_test-output-buffered-file->buffer)
1039
1040 (write _test-input-stream "fn foo {\n")
1041 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1042 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1043 (write _test-input-stream " y <- increment\n")
1044 (write _test-input-stream "}\n")
1045
1046 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1047 (flush _test-output-buffered-file)
1048 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1054
1055 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-second-local-var-in-same-reg/0")
1056 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-second-local-var-in-same-reg/1")
1057 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/2")
1058 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-second-local-var-in-same-reg/3")
1059 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-second-local-var-in-same-reg/4")
1060 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-second-local-var-in-same-reg/5")
1061 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-second-local-var-in-same-reg/6")
1062 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-second-local-var-in-same-reg/7")
1063 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-convert-function-with-second-local-var-in-same-reg/8")
1064 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-second-local-var-in-same-reg/9")
1065 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-second-local-var-in-same-reg/10")
1066 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-second-local-var-in-same-reg/11")
1067 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-second-local-var-in-same-reg/12")
1068 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-second-local-var-in-same-reg/13")
1069 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-second-local-var-in-same-reg/14")
1070 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/15")
1071 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-second-local-var-in-same-reg/16")
1072
1073 89/<- %esp 5/r32/ebp
1074 5d/pop-to-ebp
1075 c3/return
1076
1077 test-convert-function-with-local-var-dereferenced:
1078
1079 55/push-ebp
1080 89/<- %ebp 4/r32/esp
1081
1082 (clear-stream _test-input-stream)
1083 (clear-stream $_test-input-buffered-file->buffer)
1084 (clear-stream _test-output-stream)
1085 (clear-stream $_test-output-buffered-file->buffer)
1086
1087 (write _test-input-stream "fn foo {\n")
1088 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n")
1089 (write _test-input-stream " increment *x\n")
1090 (write _test-input-stream "}\n")
1091
1092 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1093 (flush _test-output-buffered-file)
1094 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1100
1101 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0")
1102 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1")
1103 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2")
1104 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3")
1105 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4")
1106 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5")
1107 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6")
1108 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7")
1109 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8")
1110 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9")
1111 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10")
1112 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11")
1113 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12")
1114 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13")
1115 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14")
1116 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15")
1117
1118 89/<- %esp 5/r32/ebp
1119 5d/pop-to-ebp
1120 c3/return
1121
1122 test-convert-compare-register-with-literal:
1123
1124 55/push-ebp
1125 89/<- %ebp 4/r32/esp
1126
1127 (clear-stream _test-input-stream)
1128 (clear-stream $_test-input-buffered-file->buffer)
1129 (clear-stream _test-output-stream)
1130 (clear-stream $_test-output-buffered-file->buffer)
1131
1132 (write _test-input-stream "fn foo {\n")
1133 (write _test-input-stream " var x/ecx: int <- copy 0\n")
1134 (write _test-input-stream " compare x, 0\n")
1135 (write _test-input-stream "}\n")
1136
1137 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1138 (flush _test-output-buffered-file)
1139 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1145
1146 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0")
1147 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1")
1148 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2")
1149 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3")
1150 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4")
1151 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5")
1152 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6")
1153 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7")
1154 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8")
1155 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9")
1156 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10")
1157 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11")
1158 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12")
1159 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13")
1160 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14")
1161 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15")
1162
1163 89/<- %esp 5/r32/ebp
1164 5d/pop-to-ebp
1165 c3/return
1166
1167 test-convert-function-with-local-var-in-block:
1168
1169 55/push-ebp
1170 89/<- %ebp 4/r32/esp
1171
1172 (clear-stream _test-input-stream)
1173 (clear-stream $_test-input-buffered-file->buffer)
1174 (clear-stream _test-output-stream)
1175 (clear-stream $_test-output-buffered-file->buffer)
1176
1177 (write _test-input-stream "fn foo {\n")
1178 (write _test-input-stream " {\n")
1179 (write _test-input-stream " var x: int\n")
1180 (write _test-input-stream " increment x\n")
1181 (write _test-input-stream " }\n")
1182 (write _test-input-stream "}\n")
1183
1184 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1185 (flush _test-output-buffered-file)
1186 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1192
1193 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0")
1194 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1")
1195 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2")
1196 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3")
1197 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4")
1198 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5")
1199 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6")
1200 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7")
1201 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8")
1202 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9")
1203 (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")
1204 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11")
1205 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12")
1206 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13")
1207 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14")
1208 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15")
1209 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16")
1210 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17")
1211 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18")
1212
1213 89/<- %esp 5/r32/ebp
1214 5d/pop-to-ebp
1215 c3/return
1216
1217 test-convert-function-with-local-var-in-named-block:
1218
1219 55/push-ebp
1220 89/<- %ebp 4/r32/esp
1221
1222 (clear-stream _test-input-stream)
1223 (clear-stream $_test-input-buffered-file->buffer)
1224 (clear-stream _test-output-stream)
1225 (clear-stream $_test-output-buffered-file->buffer)
1226
1227 (write _test-input-stream "fn foo {\n")
1228 (write _test-input-stream " $bar: {\n")
1229 (write _test-input-stream " var x: int\n")
1230 (write _test-input-stream " increment x\n")
1231 (write _test-input-stream " }\n")
1232 (write _test-input-stream "}\n")
1233
1234 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1235 (flush _test-output-buffered-file)
1236 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1242
1243 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0")
1244 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1")
1245 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2")
1246 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3")
1247 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4")
1248 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5")
1249 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6")
1250 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7")
1251 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8")
1252 (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")
1253 (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")
1254 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11")
1255 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12")
1256 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13")
1257 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14")
1258 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15")
1259 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16")
1260 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17")
1261 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18")
1262
1263 89/<- %esp 5/r32/ebp
1264 5d/pop-to-ebp
1265 c3/return
1266
1267 test-always-shadow-outermost-reg-vars-in-function:
1268
1269 55/push-ebp
1270 89/<- %ebp 4/r32/esp
1271
1272 (clear-stream _test-input-stream)
1273 (clear-stream $_test-input-buffered-file->buffer)
1274 (clear-stream _test-output-stream)
1275 (clear-stream $_test-output-buffered-file->buffer)
1276
1277 (write _test-input-stream "fn foo {\n")
1278 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1279 (write _test-input-stream "}\n")
1280
1281 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1282 (flush _test-output-buffered-file)
1283 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1289
1290 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-always-shadow-outermost-reg-vars-in-function/0")
1291 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-always-shadow-outermost-reg-vars-in-function/1")
1292 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/2")
1293 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-always-shadow-outermost-reg-vars-in-function/3")
1294 (check-next-stream-line-equal _test-output-stream " {" "F - test-always-shadow-outermost-reg-vars-in-function/4")
1295 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-always-shadow-outermost-reg-vars-in-function/5")
1296 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6")
1297 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-always-shadow-outermost-reg-vars-in-function/8")
1298 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9")
1299 (check-next-stream-line-equal _test-output-stream " }" "F - test-always-shadow-outermost-reg-vars-in-function/12")
1300 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-always-shadow-outermost-reg-vars-in-function/13")
1301 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-always-shadow-outermost-reg-vars-in-function/14")
1302 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-always-shadow-outermost-reg-vars-in-function/15")
1303 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/16")
1304 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-always-shadow-outermost-reg-vars-in-function/17")
1305
1306 89/<- %esp 5/r32/ebp
1307 5d/pop-to-ebp
1308 c3/return
1309
1310 _pending-test-clobber-dead-local:
1311
1312 55/push-ebp
1313 89/<- %ebp 4/r32/esp
1314
1315 (clear-stream _test-input-stream)
1316 (clear-stream $_test-input-buffered-file->buffer)
1317 (clear-stream _test-output-stream)
1318 (clear-stream $_test-output-buffered-file->buffer)
1319
1320 (write _test-input-stream "fn foo {\n")
1321 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1322 (write _test-input-stream " {\n")
1323 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1324 (write _test-input-stream " }\n")
1325 (write _test-input-stream "}\n")
1326
1327 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1328 (flush _test-output-buffered-file)
1329 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1335
1336 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-clobber-dead-local/0")
1337 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-clobber-dead-local/1")
1338 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-clobber-dead-local/2")
1339 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-clobber-dead-local/3")
1340 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/4")
1341 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-clobber-dead-local/5")
1342 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-clobber-dead-local/6")
1343 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-clobber-dead-local/7")
1344 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/8")
1345 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-clobber-dead-local/9")
1346 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-clobber-dead-local/10")
1347 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/11")
1348 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-clobber-dead-local/12")
1349 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-clobber-dead-local/13")
1350 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/14")
1351 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-clobber-dead-local/15")
1352 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-clobber-dead-local/16")
1353 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-clobber-dead-local/17")
1354 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-clobber-dead-local/18")
1355 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-clobber-dead-local/19")
1356
1357 89/<- %esp 5/r32/ebp
1358 5d/pop-to-ebp
1359 c3/return
1360
1361 test-shadow-live-local:
1362
1363 55/push-ebp
1364 89/<- %ebp 4/r32/esp
1365
1366 (clear-stream _test-input-stream)
1367 (clear-stream $_test-input-buffered-file->buffer)
1368 (clear-stream _test-output-stream)
1369 (clear-stream $_test-output-buffered-file->buffer)
1370
1371 (write _test-input-stream "fn foo {\n")
1372 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1373 (write _test-input-stream " {\n")
1374 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1375 (write _test-input-stream " }\n")
1376 (write _test-input-stream " x <- increment\n")
1377 (write _test-input-stream "}\n")
1378
1379 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1380 (flush _test-output-buffered-file)
1381 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1387
1388 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-local/0")
1389 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-local/1")
1390 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-local/2")
1391 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-local/3")
1392 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/4")
1393 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-local/5")
1394 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/6")
1395 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-local/7")
1396 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/8")
1397 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-local/9")
1398 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/10")
1399 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-local/11")
1400 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/12")
1401 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/13")
1402 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-local/14")
1403 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-local/15")
1404 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/16")
1405 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/17")
1406 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-local/18")
1407 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-local/19")
1408 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-local/20")
1409 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-local/21")
1410 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-local/21")
1411
1412 89/<- %esp 5/r32/ebp
1413 5d/pop-to-ebp
1414 c3/return
1415
1416 test-shadow-live-output:
1417
1418 55/push-ebp
1419 89/<- %ebp 4/r32/esp
1420
1421 (clear-stream _test-input-stream)
1422 (clear-stream $_test-input-buffered-file->buffer)
1423 (clear-stream _test-output-stream)
1424 (clear-stream $_test-output-buffered-file->buffer)
1425
1426 (write _test-input-stream "fn foo -> x/ecx: int {\n")
1427 (write _test-input-stream " x <- copy 3\n")
1428 (write _test-input-stream " {\n")
1429 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1430 (write _test-input-stream " }\n")
1431 (write _test-input-stream " x <- increment\n")
1432 (write _test-input-stream "}\n")
1433
1434 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1435 (flush _test-output-buffered-file)
1436 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1442
1443 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-output/0")
1444 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-output/1")
1445 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-output/2")
1446 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-output/3")
1447 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/4")
1448 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-output/5")
1449 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-output/7")
1450 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/8")
1451 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-output/9")
1452 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-output/10")
1453 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-output/11")
1454 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-output/12")
1455 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/13")
1456 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-output/14")
1457 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-output/15")
1458 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/17")
1459 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-output/18")
1460 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-output/19")
1461 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-output/20")
1462 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-output/21")
1463 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-output/21")
1464
1465 89/<- %esp 5/r32/ebp
1466 5d/pop-to-ebp
1467 c3/return
1468
1469 _pending-test-local-clobbered-by-output:
1470
1471
1472 55/push-ebp
1473 89/<- %ebp 4/r32/esp
1474
1475 (clear-stream _test-input-stream)
1476 (clear-stream $_test-input-buffered-file->buffer)
1477 (clear-stream _test-output-stream)
1478 (clear-stream $_test-output-buffered-file->buffer)
1479
1480 (write _test-input-stream "fn foo -> x/ecx: int {\n")
1481 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1482 (write _test-input-stream " x <- copy y\n")
1483 (write _test-input-stream "}\n")
1484
1485 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1486 (flush _test-output-buffered-file)
1487 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1493
1494 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-local-clobbered-by-output/0")
1495 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-local-clobbered-by-output/1")
1496 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-local-clobbered-by-output/2")
1497 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-local-clobbered-by-output/3")
1498 (check-next-stream-line-equal _test-output-stream " {" "F - test-local-clobbered-by-output/4")
1499 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-local-clobbered-by-output/5")
1500 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-local-clobbered-by-output/6")
1501 (check-next-stream-line-equal _test-output-stream " 89/copy-to %ecx 0x00000001/r32" "F - test-local-clobbered-by-output/7")
1502 (check-next-stream-line-equal _test-output-stream " }" "F - test-local-clobbered-by-output/8")
1503 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-local-clobbered-by-output/9")
1504 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-local-clobbered-by-output/10")
1505 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-local-clobbered-by-output/11")
1506 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-local-clobbered-by-output/12")
1507 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-local-clobbered-by-output/13")
1508
1509 89/<- %esp 5/r32/ebp
1510 5d/pop-to-ebp
1511 c3/return
1512
1513 test-convert-function-with-branches-in-block:
1514
1515 55/push-ebp
1516 89/<- %ebp 4/r32/esp
1517
1518 (clear-stream _test-input-stream)
1519 (clear-stream $_test-input-buffered-file->buffer)
1520 (clear-stream _test-output-stream)
1521 (clear-stream $_test-output-buffered-file->buffer)
1522
1523 (write _test-input-stream "fn foo x: int {\n")
1524 (write _test-input-stream " {\n")
1525 (write _test-input-stream " break-if->=\n")
1526 (write _test-input-stream " loop-if-addr<\n")
1527 (write _test-input-stream " increment x\n")
1528 (write _test-input-stream " loop\n")
1529 (write _test-input-stream " }\n")
1530 (write _test-input-stream "}\n")
1531
1532 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1533 (flush _test-output-buffered-file)
1534 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1540
1541 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0")
1542 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1")
1543 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2")
1544 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3")
1545 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4")
1546 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5")
1547 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6")
1548 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7")
1549 (check-next-stream-line-equal _test-output-stream " 0f 8d/jump-if->= break/disp32" "F - test-convert-function-with-branches-in-block/8")
1550 (check-next-stream-line-equal _test-output-stream " 0f 82/jump-if-addr< loop/disp32" "F - test-convert-function-with-branches-in-block/9")
1551 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/10")
1552 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/11")
1553 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/12")
1554 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/13")
1555 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/14")
1556 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/15")
1557 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/16")
1558 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/17")
1559 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/18")
1560 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/19")
1561
1562 89/<- %esp 5/r32/ebp
1563 5d/pop-to-ebp
1564 c3/return
1565
1566 test-convert-function-with-branches-in-named-block:
1567
1568 55/push-ebp
1569 89/<- %ebp 4/r32/esp
1570
1571 (clear-stream _test-input-stream)
1572 (clear-stream $_test-input-buffered-file->buffer)
1573 (clear-stream _test-output-stream)
1574 (clear-stream $_test-output-buffered-file->buffer)
1575
1576 (write _test-input-stream "fn foo x: int {\n")
1577 (write _test-input-stream " $bar: {\n")
1578 (write _test-input-stream " break-if->= $bar\n")
1579 (write _test-input-stream " loop-if-addr< $bar\n")
1580 (write _test-input-stream " increment x\n")
1581 (write _test-input-stream " loop\n")
1582 (write _test-input-stream " }\n")
1583 (write _test-input-stream "}\n")
1584
1585 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1586 (flush _test-output-buffered-file)
1587 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1593
1594 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0")
1595 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1")
1596 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2")
1597 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3")
1598 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4")
1599 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5")
1600 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6")
1601 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7")
1602 (check-next-stream-line-equal _test-output-stream " 0f 8d/jump-if->= $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/8")
1603 (check-next-stream-line-equal _test-output-stream " 0f 82/jump-if-addr< $bar:loop/disp32" "F - test-convert-function-with-branches-in-named-block/9")
1604 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/10")
1605 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/11")
1606 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/12")
1607 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/13")
1608 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/14")
1609 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/15")
1610 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/16")
1611 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/17")
1612 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/18")
1613 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/19")
1614
1615 89/<- %esp 5/r32/ebp
1616 5d/pop-to-ebp
1617 c3/return
1618
1619 test-convert-function-with-var-in-nested-block:
1620
1621 55/push-ebp
1622 89/<- %ebp 4/r32/esp
1623
1624 (clear-stream _test-input-stream)
1625 (clear-stream $_test-input-buffered-file->buffer)
1626 (clear-stream _test-output-stream)
1627 (clear-stream $_test-output-buffered-file->buffer)
1628
1629 (write _test-input-stream "fn foo x: int {\n")
1630 (write _test-input-stream " {\n")
1631 (write _test-input-stream " {\n")
1632 (write _test-input-stream " var x: int\n")
1633 (write _test-input-stream " increment x\n")
1634 (write _test-input-stream " }\n")
1635 (write _test-input-stream " }\n")
1636 (write _test-input-stream "}\n")
1637
1638 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1639 (flush _test-output-buffered-file)
1640 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1646
1647 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0")
1648 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1")
1649 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2")
1650 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3")
1651 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4")
1652 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5")
1653 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6")
1654 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7")
1655 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8")
1656 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9")
1657 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10")
1658 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11")
1659 (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")
1660 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13")
1661 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14")
1662 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15")
1663 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16")
1664 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17")
1665 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18")
1666 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19")
1667 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20")
1668 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21")
1669 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22")
1670
1671 89/<- %esp 5/r32/ebp
1672 5d/pop-to-ebp
1673 c3/return
1674
1675 test-convert-function-with-multiple-vars-in-nested-blocks:
1676
1677 55/push-ebp
1678 89/<- %ebp 4/r32/esp
1679
1680 (clear-stream _test-input-stream)
1681 (clear-stream $_test-input-buffered-file->buffer)
1682 (clear-stream _test-output-stream)
1683 (clear-stream $_test-output-buffered-file->buffer)
1684
1685 (write _test-input-stream "fn foo x: int {\n")
1686 (write _test-input-stream " {\n")
1687 (write _test-input-stream " var x/eax: int <- copy 0\n")
1688 (write _test-input-stream " {\n")
1689 (write _test-input-stream " var y: int\n")
1690 (write _test-input-stream " x <- add y\n")
1691 (write _test-input-stream " }\n")
1692 (write _test-input-stream " }\n")
1693 (write _test-input-stream "}\n")
1694
1695 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1696 (flush _test-output-buffered-file)
1697 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1703
1704 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0")
1705 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1")
1706 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2")
1707 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3")
1708 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4")
1709 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5")
1710 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6")
1711 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7")
1712 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8")
1713 (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")
1714 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10")
1715 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11")
1716 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12")
1717 (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")
1718 (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")
1719 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15")
1720 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16")
1721 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17")
1722 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18")
1723 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19")
1724 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20")
1725 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21")
1726 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22")
1727 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23")
1728 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24")
1729 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25")
1730
1731 89/<- %esp 5/r32/ebp
1732 5d/pop-to-ebp
1733 c3/return
1734
1735 test-convert-function-with-branches-and-local-vars:
1736
1737
1738
1739
1740 55/push-ebp
1741 89/<- %ebp 4/r32/esp
1742
1743 (clear-stream _test-input-stream)
1744 (clear-stream $_test-input-buffered-file->buffer)
1745 (clear-stream _test-output-stream)
1746 (clear-stream $_test-output-buffered-file->buffer)
1747
1748 (write _test-input-stream "fn foo {\n")
1749 (write _test-input-stream " {\n")
1750 (write _test-input-stream " var x: int\n")
1751 (write _test-input-stream " break-if->=\n")
1752 (write _test-input-stream " increment x\n")
1753 (write _test-input-stream " }\n")
1754 (write _test-input-stream "}\n")
1755
1756 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1757 (flush _test-output-buffered-file)
1758 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1764
1765 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0")
1766 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1")
1767 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2")
1768 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3")
1769 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4")
1770 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5")
1771 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6")
1772 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7")
1773 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8")
1774 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9")
1775 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10")
1776 (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")
1777 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12")
1778 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13")
1779 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14")
1780 (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")
1781 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16")
1782 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17")
1783 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18")
1784 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19")
1785 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20")
1786 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21")
1787 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22")
1788 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23")
1789
1790 89/<- %esp 5/r32/ebp
1791 5d/pop-to-ebp
1792 c3/return
1793
1794 test-convert-function-with-conditional-loops-and-local-vars:
1795
1796
1797
1798
1799 55/push-ebp
1800 89/<- %ebp 4/r32/esp
1801
1802 (clear-stream _test-input-stream)
1803 (clear-stream $_test-input-buffered-file->buffer)
1804 (clear-stream _test-output-stream)
1805 (clear-stream $_test-output-buffered-file->buffer)
1806
1807 (write _test-input-stream "fn foo {\n")
1808 (write _test-input-stream " {\n")
1809 (write _test-input-stream " var x: int\n")
1810 (write _test-input-stream " loop-if->=\n")
1811 (write _test-input-stream " increment x\n")
1812 (write _test-input-stream " }\n")
1813 (write _test-input-stream "}\n")
1814
1815 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1816 (flush _test-output-buffered-file)
1817 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1823
1824 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0")
1825 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1")
1826 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2")
1827 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3")
1828 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4")
1829 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5")
1830 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6")
1831 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7")
1832 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8")
1833 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9")
1834 (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")
1835 (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")
1836 (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")
1837 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13")
1838 (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")
1839 (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")
1840 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16")
1841 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17")
1842 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18")
1843 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19")
1844 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20")
1845 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21")
1846 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22")
1847 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23")
1848
1849 89/<- %esp 5/r32/ebp
1850 5d/pop-to-ebp
1851 c3/return
1852
1853 test-convert-function-with-unconditional-loops-and-local-vars:
1854
1855
1856
1857
1858 55/push-ebp
1859 89/<- %ebp 4/r32/esp
1860
1861 (clear-stream _test-input-stream)
1862 (clear-stream $_test-input-buffered-file->buffer)
1863 (clear-stream _test-output-stream)
1864 (clear-stream $_test-output-buffered-file->buffer)
1865
1866 (write _test-input-stream "fn foo {\n")
1867 (write _test-input-stream " {\n")
1868 (write _test-input-stream " var x: int\n")
1869 (write _test-input-stream " loop\n")
1870 (write _test-input-stream " increment x\n")
1871 (write _test-input-stream " }\n")
1872 (write _test-input-stream "}\n")
1873
1874 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1875 (flush _test-output-buffered-file)
1876 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1882
1883 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0")
1884 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1")
1885 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2")
1886 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3")
1887 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4")
1888 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5")
1889 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6")
1890 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7")
1891 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8")
1892 (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")
1893 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10")
1894
1895 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11")
1896 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12")
1897 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13")
1898 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14")
1899 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15")
1900 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16")
1901 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17")
1902 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18")
1903
1904 89/<- %esp 5/r32/ebp
1905 5d/pop-to-ebp
1906 c3/return
1907
1908 test-convert-function-with-branches-and-loops-and-local-vars:
1909
1910 55/push-ebp
1911 89/<- %ebp 4/r32/esp
1912
1913 (clear-stream _test-input-stream)
1914 (clear-stream $_test-input-buffered-file->buffer)
1915 (clear-stream _test-output-stream)
1916 (clear-stream $_test-output-buffered-file->buffer)
1917
1918 (write _test-input-stream "fn foo {\n")
1919 (write _test-input-stream " {\n")
1920 (write _test-input-stream " var x: int\n")
1921 (write _test-input-stream " break-if->=\n")
1922 (write _test-input-stream " increment x\n")
1923 (write _test-input-stream " loop\n")
1924 (write _test-input-stream " }\n")
1925 (write _test-input-stream "}\n")
1926
1927 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1928 (flush _test-output-buffered-file)
1929 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1935
1936 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0")
1937 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1")
1938 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2")
1939 (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")
1940 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4")
1941 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5")
1942 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6")
1943 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7")
1944 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8")
1945 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9")
1946 (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")
1947 (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")
1948 (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")
1949 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13")
1950 (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")
1951 (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")
1952 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16")
1953 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17")
1954 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18")
1955 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19")
1956 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20")
1957 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21")
1958 (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")
1959 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23")
1960 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24")
1961
1962 89/<- %esp 5/r32/ebp
1963 5d/pop-to-ebp
1964 c3/return
1965
1966 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars:
1967
1968 55/push-ebp
1969 89/<- %ebp 4/r32/esp
1970
1971 (clear-stream _test-input-stream)
1972 (clear-stream $_test-input-buffered-file->buffer)
1973 (clear-stream _test-output-stream)
1974 (clear-stream $_test-output-buffered-file->buffer)
1975
1976 (write _test-input-stream "fn foo {\n")
1977 (write _test-input-stream " a: {\n")
1978 (write _test-input-stream " var x: int\n")
1979 (write _test-input-stream " {\n")
1980 (write _test-input-stream " var y: int\n")
1981 (write _test-input-stream " break-if->= a\n")
1982 (write _test-input-stream " increment x\n")
1983 (write _test-input-stream " loop\n")
1984 (write _test-input-stream " }\n")
1985 (write _test-input-stream " }\n")
1986 (write _test-input-stream "}\n")
1987
1988 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1989 (flush _test-output-buffered-file)
1990 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1996
1997 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0")
1998 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1")
1999 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2")
2000 (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")
2001 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4")
2002 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5")
2003 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6")
2004 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7")
2005 (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")
2006 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9")
2007 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10")
2008 (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")
2009 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12")
2010 (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")
2011 (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")
2012 (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")
2013 (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")
2014 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17")
2015 (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")
2016 (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")
2017 (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")
2018 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21")
2019 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22")
2020 (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")
2021 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24")
2022 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25")
2023 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26")
2024 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27")
2025 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28")
2026 (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")
2027 (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")
2028 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31")
2029
2030 89/<- %esp 5/r32/ebp
2031 5d/pop-to-ebp
2032 c3/return
2033
2034 test-convert-function-with-nonlocal-unconditional-break-and-local-vars:
2035
2036 55/push-ebp
2037 89/<- %ebp 4/r32/esp
2038
2039 (clear-stream _test-input-stream)
2040 (clear-stream $_test-input-buffered-file->buffer)
2041 (clear-stream _test-output-stream)
2042 (clear-stream $_test-output-buffered-file->buffer)
2043
2044 (write _test-input-stream "fn foo {\n")
2045 (write _test-input-stream " a: {\n")
2046 (write _test-input-stream " var x: int\n")
2047 (write _test-input-stream " {\n")
2048 (write _test-input-stream " var y: int\n")
2049 (write _test-input-stream " break a\n")
2050 (write _test-input-stream " increment x\n")
2051 (write _test-input-stream " }\n")
2052 (write _test-input-stream " }\n")
2053 (write _test-input-stream "}\n")
2054
2055 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2056 (flush _test-output-buffered-file)
2057 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2063
2064 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0")
2065 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1")
2066 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2")
2067 (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")
2068 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4")
2069 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5")
2070 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6")
2071 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7")
2072 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8")
2073 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9")
2074 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10")
2075 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11")
2076 (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")
2077 (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")
2078 (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")
2079 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15")
2080 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16")
2081 (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")
2082 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18")
2083 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19")
2084 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20")
2085 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21")
2086 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22")
2087 (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")
2088 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24")
2089 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25")
2090
2091 89/<- %esp 5/r32/ebp
2092 5d/pop-to-ebp
2093 c3/return
2094
2095 test-convert-function-with-unconditional-break-and-local-vars:
2096
2097 55/push-ebp
2098 89/<- %ebp 4/r32/esp
2099
2100 (clear-stream _test-input-stream)
2101 (clear-stream $_test-input-buffered-file->buffer)
2102 (clear-stream _test-output-stream)
2103 (clear-stream $_test-output-buffered-file->buffer)
2104
2105 (write _test-input-stream "fn foo {\n")
2106 (write _test-input-stream " {\n")
2107 (write _test-input-stream " var x: int\n")
2108 (write _test-input-stream " {\n")
2109 (write _test-input-stream " var y: int\n")
2110 (write _test-input-stream " break\n")
2111 (write _test-input-stream " increment x\n")
2112 (write _test-input-stream " }\n")
2113 (write _test-input-stream " }\n")
2114 (write _test-input-stream "}\n")
2115
2116 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2117 (flush _test-output-buffered-file)
2118 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2124
2125 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0")
2126 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1")
2127 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2")
2128 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3")
2129 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4")
2130 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5")
2131 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6")
2132 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7")
2133 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8")
2134 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9")
2135 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10")
2136 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11")
2137 (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")
2138 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13")
2139 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14")
2140 (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")
2141 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16")
2142 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17")
2143 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18")
2144 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19")
2145 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20")
2146 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21")
2147 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22")
2148 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23")
2149
2150 89/<- %esp 5/r32/ebp
2151 5d/pop-to-ebp
2152 c3/return
2153
2154 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars:
2155
2156 55/push-ebp
2157 89/<- %ebp 4/r32/esp
2158
2159 (clear-stream _test-input-stream)
2160 (clear-stream $_test-input-buffered-file->buffer)
2161 (clear-stream _test-output-stream)
2162 (clear-stream $_test-output-buffered-file->buffer)
2163
2164 (write _test-input-stream "fn foo {\n")
2165 (write _test-input-stream " a: {\n")
2166 (write _test-input-stream " var x: int\n")
2167 (write _test-input-stream " {\n")
2168 (write _test-input-stream " var y: int\n")
2169 (write _test-input-stream " loop a\n")
2170 (write _test-input-stream " increment x\n")
2171 (write _test-input-stream " }\n")
2172 (write _test-input-stream " }\n")
2173 (write _test-input-stream "}\n")
2174
2175 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2176 (flush _test-output-buffered-file)
2177 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2183
2184 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0")
2185 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1")
2186 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2")
2187 (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")
2188 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4")
2189 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5")
2190 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6")
2191 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7")
2192 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8")
2193 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9")
2194 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10")
2195 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11")
2196 (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")
2197 (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")
2198 (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")
2199 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15")
2200 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16")
2201 (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")
2202 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18")
2203 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19")
2204 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20")
2205 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21")
2206 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22")
2207 (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")
2208 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24")
2209 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25")
2210
2211 89/<- %esp 5/r32/ebp
2212 5d/pop-to-ebp
2213 c3/return
2214
2215 test-convert-function-with-local-array-var-in-mem:
2216
2217 55/push-ebp
2218 89/<- %ebp 4/r32/esp
2219
2220 (clear-stream _test-input-stream)
2221 (clear-stream $_test-input-buffered-file->buffer)
2222 (clear-stream _test-output-stream)
2223 (clear-stream $_test-output-buffered-file->buffer)
2224
2225 (write _test-input-stream "fn foo {\n")
2226 (write _test-input-stream " var x: (array int 3)\n")
2227 (write _test-input-stream "}\n")
2228
2229 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2230 (flush _test-output-buffered-file)
2231 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2237
2238 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-var-in-mem/0")
2239 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-var-in-mem/1")
2240 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-var-in-mem/2")
2241 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-var-in-mem/3")
2242 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-var-in-mem/4")
2243 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-var-in-mem/5")
2244
2245 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-function-with-local-array-var-in-mem/7")
2246 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-function-with-local-array-var-in-mem/8")
2247
2248 (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")
2249
2250 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-var-in-mem/10")
2251 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-var-in-mem/11")
2252 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-var-in-mem/12")
2253 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-var-in-mem/13")
2254 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-var-in-mem/14")
2255 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-var-in-mem/15")
2256
2257 89/<- %esp 5/r32/ebp
2258 5d/pop-to-ebp
2259 c3/return
2260
2261 test-convert-length-of-array:
2262
2263 55/push-ebp
2264 89/<- %ebp 4/r32/esp
2265
2266 (clear-stream _test-input-stream)
2267 (clear-stream $_test-input-buffered-file->buffer)
2268 (clear-stream _test-output-stream)
2269 (clear-stream $_test-output-buffered-file->buffer)
2270
2271 (write _test-input-stream "fn foo a: (addr array int) {\n")
2272 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n")
2273 (write _test-input-stream " var c/eax: int <- length b\n")
2274 (write _test-input-stream "}\n")
2275
2276 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2277 (flush _test-output-buffered-file)
2278 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2284
2285 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0")
2286 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1")
2287 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2")
2288 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3")
2289 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4")
2290 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5")
2291 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6")
2292 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7")
2293 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *eax 0x00000000/r32" "F - test-convert-length-of-array/9")
2294 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/11")
2295 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/12")
2296 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/13")
2297 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/14")
2298 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/15")
2299 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/16")
2300 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/17")
2301
2302 89/<- %esp 5/r32/ebp
2303 5d/pop-to-ebp
2304 c3/return
2305
2306 test-convert-length-of-array-on-stack:
2307
2308 55/push-ebp
2309 89/<- %ebp 4/r32/esp
2310
2311 (clear-stream _test-input-stream)
2312 (clear-stream $_test-input-buffered-file->buffer)
2313 (clear-stream _test-output-stream)
2314 (clear-stream $_test-output-buffered-file->buffer)
2315
2316 (write _test-input-stream "fn foo {\n")
2317 (write _test-input-stream " var a: (array int 3)\n")
2318 (write _test-input-stream " var b/eax: int <- length a\n")
2319 (write _test-input-stream "}\n")
2320
2321 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2322 (flush _test-output-buffered-file)
2323 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2329
2330 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-on-stack/0")
2331 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-on-stack/1")
2332 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-on-stack/2")
2333 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-on-stack/3")
2334 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-on-stack/4")
2335 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-on-stack/5")
2336
2337 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-length-of-array-on-stack/6")
2338 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-length-of-array-on-stack/7")
2339 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-on-stack/8")
2340 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0xfffffff0) 0x00000000/r32" "F - test-convert-length-of-array-on-stack/9")
2341 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-on-stack/10")
2342 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-length-of-array-on-stack/11")
2343 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-on-stack/12")
2344 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-on-stack/13")
2345 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-on-stack/14")
2346 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-on-stack/15")
2347 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-on-stack/16")
2348 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-on-stack/17")
2349
2350 89/<- %esp 5/r32/ebp
2351 5d/pop-to-ebp
2352 c3/return
2353
2354 test-convert-index-into-array:
2355
2356 55/push-ebp
2357 89/<- %ebp 4/r32/esp
2358
2359 (clear-stream _test-input-stream)
2360 (clear-stream $_test-input-buffered-file->buffer)
2361 (clear-stream _test-output-stream)
2362 (clear-stream $_test-output-buffered-file->buffer)
2363
2364 (write _test-input-stream "fn foo {\n")
2365 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2366 (write _test-input-stream " var idx/ecx: int <- copy 3\n")
2367 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n")
2368 (write _test-input-stream "}\n")
2369
2370 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2371 (flush _test-output-buffered-file)
2372 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2378
2379 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0")
2380 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1")
2381 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2")
2382 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3")
2383 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4")
2384 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5")
2385 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6")
2386 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7")
2387 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8")
2388 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9")
2389 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-convert-index-into-array/11")
2390 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/13")
2391 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/14")
2392 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/15")
2393 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/16")
2394 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/17")
2395 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/18")
2396 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/19")
2397 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/20")
2398
2399 89/<- %esp 5/r32/ebp
2400 5d/pop-to-ebp
2401 c3/return
2402
2403 test-convert-index-into-array-with-literal:
2404
2405 55/push-ebp
2406 89/<- %ebp 4/r32/esp
2407
2408 (clear-stream _test-input-stream)
2409 (clear-stream $_test-input-buffered-file->buffer)
2410 (clear-stream _test-output-stream)
2411 (clear-stream $_test-output-buffered-file->buffer)
2412
2413 (write _test-input-stream "fn foo {\n")
2414 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2415 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n")
2416 (write _test-input-stream "}\n")
2417
2418 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2419 (flush _test-output-buffered-file)
2420 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2426
2427 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-with-literal/0")
2428 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-with-literal/1")
2429 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-with-literal/2")
2430 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-with-literal/3")
2431 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-with-literal/4")
2432 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5")
2433 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6")
2434 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7")
2435
2436 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/8")
2437 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/9")
2438 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/10")
2439 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-with-literal/11")
2440 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-with-literal/12")
2441 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-with-literal/13")
2442 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-with-literal/14")
2443 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-with-literal/15")
2444
2445 89/<- %esp 5/r32/ebp
2446 5d/pop-to-ebp
2447 c3/return
2448
2449 test-convert-index-into-array-on-stack:
2450
2451 55/push-ebp
2452 89/<- %ebp 4/r32/esp
2453
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 {\n")
2460 (write _test-input-stream " var arr: (array int 3)\n")
2461 (write _test-input-stream " var idx/eax: int <- copy 2\n")
2462 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n")
2463 (write _test-input-stream "}\n")
2464
2465 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2466 (flush _test-output-buffered-file)
2467 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2473
2474 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack/0")
2475 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack/1")
2476 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack/2")
2477 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack/3")
2478 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack/4")
2479 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack/5")
2480
2481 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack/6")
2482 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack/7")
2483
2484 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack/8")
2485 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 2/imm32" "F - test-convert-index-into-array-on-stack/9")
2486
2487 (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")
2488
2489 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack/11")
2490
2491 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack/12")
2492
2493 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack/13")
2494 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack/14")
2495 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack/15")
2496 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack/16")
2497 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack/17")
2498 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack/18")
2499
2500 89/<- %esp 5/r32/ebp
2501 5d/pop-to-ebp
2502 c3/return
2503
2504 test-convert-index-into-array-on-stack-with-literal:
2505
2506 55/push-ebp
2507 89/<- %ebp 4/r32/esp
2508
2509 (clear-stream _test-input-stream)
2510 (clear-stream $_test-input-buffered-file->buffer)
2511 (clear-stream _test-output-stream)
2512 (clear-stream $_test-output-buffered-file->buffer)
2513
2514 (write _test-input-stream "fn foo {\n")
2515 (write _test-input-stream " var arr: (array int 3)\n")
2516 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n")
2517 (write _test-input-stream "}\n")
2518
2519 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2520 (flush _test-output-buffered-file)
2521 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2527
2528 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack-with-literal/0")
2529 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack-with-literal/1")
2530 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack-with-literal/2")
2531 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack-with-literal/3")
2532 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack-with-literal/4")
2533 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack-with-literal/5")
2534
2535 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack-with-literal/6")
2536 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack-with-literal/7")
2537
2538 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack-with-literal/8")
2539
2540 (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")
2541
2542 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack-with-literal/10")
2543
2544 (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")
2545
2546 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack-with-literal/12")
2547 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack-with-literal/13")
2548 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack-with-literal/14")
2549 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack-with-literal/15")
2550 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack-with-literal/16")
2551 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack-with-literal/17")
2552
2553 89/<- %esp 5/r32/ebp
2554 5d/pop-to-ebp
2555 c3/return
2556
2557 test-convert-index-into-array-using-offset:
2558
2559 55/push-ebp
2560 89/<- %ebp 4/r32/esp
2561
2562 (clear-stream _test-input-stream)
2563 (clear-stream $_test-input-buffered-file->buffer)
2564 (clear-stream _test-output-stream)
2565 (clear-stream $_test-output-buffered-file->buffer)
2566
2567 (write _test-input-stream "fn foo {\n")
2568 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2569 (write _test-input-stream " var idx/ecx: int <- copy 3\n")
2570 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n")
2571 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n")
2572 (write _test-input-stream "}\n")
2573
2574 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2575 (flush _test-output-buffered-file)
2576 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2582
2583 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset/0")
2584 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset/1")
2585 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset/2")
2586 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset/3")
2587 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset/4")
2588 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset/5")
2589 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset/6")
2590 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset/7")
2591 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset/8")
2592 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-using-offset/9")
2593 (check-next-stream-line-equal _test-output-stream " 69/multiply 0x00000004/imm32 %ecx 0x00000001/r32" "F - test-convert-index-into-array-using-offset/10")
2594 (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")
2595 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset/12")
2596 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset/13")
2597 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset/14")
2598 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset/15")
2599 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset/16")
2600 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset/17")
2601 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset/18")
2602 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset/19")
2603
2604 89/<- %esp 5/r32/ebp
2605 5d/pop-to-ebp
2606 c3/return
2607
2608 test-convert-index-into-array-using-offset-on-stack:
2609
2610 55/push-ebp
2611 89/<- %ebp 4/r32/esp
2612
2613 (clear-stream _test-input-stream)
2614 (clear-stream $_test-input-buffered-file->buffer)
2615 (clear-stream _test-output-stream)
2616 (clear-stream $_test-output-buffered-file->buffer)
2617
2618 (write _test-input-stream "fn foo {\n")
2619 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2620 (write _test-input-stream " var idx: int\n")
2621 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n")
2622 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n")
2623 (write _test-input-stream "}\n")
2624
2625 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2626 (flush _test-output-buffered-file)
2627 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2633
2634 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset-on-stack/0")
2635 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset-on-stack/1")
2636 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset-on-stack/2")
2637 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset-on-stack/3")
2638 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset-on-stack/4")
2639 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset-on-stack/5")
2640 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset-on-stack/6")
2641 (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")
2642 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/8")
2643 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset-on-stack/9")
2644 (check-next-stream-line-equal _test-output-stream " 69/multiply 0x00000004/imm32 *(ebp+0xfffffff8) 0x00000001/r32" "F - test-convert-index-into-array-using-offset-on-stack/10")
2645 (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")
2646 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset-on-stack/12")
2647 (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")
2648 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset-on-stack/14")
2649 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset-on-stack/15")
2650 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset-on-stack/16")
2651 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset-on-stack/17")
2652 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset-on-stack/18")
2653 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset-on-stack/19")
2654 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset-on-stack/20")
2655
2656 89/<- %esp 5/r32/ebp
2657 5d/pop-to-ebp
2658 c3/return
2659
2660 test-convert-function-and-type-definition:
2661
2662 55/push-ebp
2663 89/<- %ebp 4/r32/esp
2664
2665 (clear-stream _test-input-stream)
2666 (clear-stream $_test-input-buffered-file->buffer)
2667 (clear-stream _test-output-stream)
2668 (clear-stream $_test-output-buffered-file->buffer)
2669
2670 (write _test-input-stream "fn foo a: (addr t) {\n")
2671 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n")
2672 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n")
2673 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n")
2674 (write _test-input-stream "}\n")
2675 (write _test-input-stream "type t {\n")
2676 (write _test-input-stream " x: int\n")
2677 (write _test-input-stream " y: int\n")
2678 (write _test-input-stream "}\n")
2679
2680 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2681 (flush _test-output-buffered-file)
2682 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2688
2689 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0")
2690 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1")
2691 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2")
2692 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3")
2693 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4")
2694 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5")
2695 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6")
2696 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7")
2697 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8")
2698 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9")
2699 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11")
2700 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13")
2701 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14")
2702 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15")
2703 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16")
2704 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17")
2705 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18")
2706 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19")
2707 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20")
2708
2709 89/<- %esp 5/r32/ebp
2710 5d/pop-to-ebp
2711 c3/return
2712
2713 test-convert-function-with-local-var-with-user-defined-type:
2714
2715 55/push-ebp
2716 89/<- %ebp 4/r32/esp
2717
2718 (clear-stream _test-input-stream)
2719 (clear-stream $_test-input-buffered-file->buffer)
2720 (clear-stream _test-output-stream)
2721 (clear-stream $_test-output-buffered-file->buffer)
2722
2723 (write _test-input-stream "fn foo {\n")
2724 (write _test-input-stream " var a: t\n")
2725 (write _test-input-stream "}\n")
2726 (write _test-input-stream "type t {\n")
2727 (write _test-input-stream " x: int\n")
2728 (write _test-input-stream " y: int\n")
2729 (write _test-input-stream "}\n")
2730
2731 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2732 (flush _test-output-buffered-file)
2733 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2739
2740 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0")
2741 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1")
2742 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2")
2743 (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")
2744 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4")
2745 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5")
2746 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6")
2747 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7")
2748 (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")
2749 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9")
2750 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10")
2751 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11")
2752 (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")
2753 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13")
2754 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14")
2755
2756 89/<- %esp 5/r32/ebp
2757 5d/pop-to-ebp
2758 c3/return
2759
2760 test-convert-get-of-type-on-stack:
2761
2762 55/push-ebp
2763 89/<- %ebp 4/r32/esp
2764
2765 (clear-stream _test-input-stream)
2766 (clear-stream $_test-input-buffered-file->buffer)
2767 (clear-stream _test-output-stream)
2768 (clear-stream $_test-output-buffered-file->buffer)
2769
2770 (write _test-input-stream "fn foo {\n")
2771 (write _test-input-stream " var a: t\n")
2772 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n")
2773 (write _test-input-stream "}\n")
2774 (write _test-input-stream "type t {\n")
2775 (write _test-input-stream " x: int\n")
2776 (write _test-input-stream " y: int\n")
2777 (write _test-input-stream "}\n")
2778
2779 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2780 (flush _test-output-buffered-file)
2781 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2787
2788 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-of-type-on-stack/0")
2789 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-of-type-on-stack/1")
2790 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-of-type-on-stack/2")
2791 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-of-type-on-stack/3")
2792 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-of-type-on-stack/4")
2793 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-of-type-on-stack/5")
2794
2795 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-of-type-on-stack/6")
2796 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-of-type-on-stack/7")
2797
2798 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-of-type-on-stack/8")
2799
2800 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000001/r32" "F - test-convert-get-of-type-on-stack/9")
2801
2802 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-of-type-on-stack/10")
2803
2804 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-get-of-type-on-stack/11")
2805 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-of-type-on-stack/12")
2806 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-of-type-on-stack/13")
2807 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-of-type-on-stack/14")
2808 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-of-type-on-stack/15")
2809 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-of-type-on-stack/16")
2810 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-of-type-on-stack/17")
2811
2812 89/<- %esp 5/r32/ebp
2813 5d/pop-to-ebp
2814 c3/return
2815
2816 test-convert-array-of-user-defined-types:
2817
2818 55/push-ebp
2819 89/<- %ebp 4/r32/esp
2820
2821 (clear-stream _test-input-stream)
2822 (clear-stream $_test-input-buffered-file->buffer)
2823 (clear-stream _test-output-stream)
2824 (clear-stream $_test-output-buffered-file->buffer)
2825
2826 (write _test-input-stream "type t {\n")
2827 (write _test-input-stream " x: int\n")
2828 (write _test-input-stream " y: int\n")
2829 (write _test-input-stream "}\n")
2830 (write _test-input-stream "fn foo {\n")
2831 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n")
2832 (write _test-input-stream " var idx/ecx: int <- copy 3\n")
2833 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n")
2834 (write _test-input-stream "}\n")
2835
2836 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2837 (flush _test-output-buffered-file)
2838 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2844
2845 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-array-of-user-defined-types/0")
2846 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-array-of-user-defined-types/1")
2847 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-array-of-user-defined-types/2")
2848 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-array-of-user-defined-types/3")
2849 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-array-of-user-defined-types/4")
2850 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-array-of-user-defined-types/5")
2851 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-array-of-user-defined-types/6")
2852 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-array-of-user-defined-types/7")
2853 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-array-of-user-defined-types/8")
2854 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-array-of-user-defined-types/9")
2855 (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")
2856 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-array-of-user-defined-types/13")
2857 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-array-of-user-defined-types/14")
2858 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-array-of-user-defined-types/15")
2859 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-array-of-user-defined-types/16")
2860 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-array-of-user-defined-types/17")
2861 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-array-of-user-defined-types/18")
2862 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-array-of-user-defined-types/19")
2863 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-array-of-user-defined-types/20")
2864
2865 89/<- %esp 5/r32/ebp
2866 5d/pop-to-ebp
2867 c3/return
2868
2869
2870
2871
2872
2873 parse-mu:
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906 55/push-ebp
2907 89/<- %ebp 4/r32/esp
2908
2909 50/push-eax
2910 51/push-ecx
2911 52/push-edx
2912 53/push-ebx
2913 56/push-esi
2914 57/push-edi
2915
2916 81 5/subop/subtract %esp 0x200/imm32
2917 68/push 0x200/imm32/length
2918 68/push 0/imm32/read
2919 68/push 0/imm32/write
2920 89/<- %ecx 4/r32/esp
2921
2922 68/push 0/imm32/end
2923 68/push 0/imm32/start
2924 89/<- %edx 4/r32/esp
2925
2926 bf/copy-to-edi _Program-functions/imm32
2927
2928 be/copy-to-esi _Program-types/imm32
2929
2930 81 5/subop/subtract %esp 0x400/imm32
2931 68/push 0x400/imm32/length
2932 68/push 0/imm32/top
2933 89/<- %ebx 4/r32/esp
2934 {
2935 $parse-mu:line-loop:
2936 (clear-stream %ecx)
2937 (read-line-buffered *(ebp+8) %ecx)
2938
2939 81 7/subop/compare *ecx 0/imm32
2940 0f 84/jump-if-= break/disp32
2941 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------
2947 (next-mu-token %ecx %edx)
2948
2949 (slice-empty? %edx)
2950 3d/compare-eax-and 0/imm32/false
2951 0f 85/jump-if-!= loop/disp32
2952
2953
2954 8b/-> *edx 0/r32/eax
2955 8a/copy-byte *eax 0/r32/AL
2956 81 4/subop/and %eax 0xff/imm32
2957
2958 3d/compare-eax-and 0x23/imm32/hash
2959 0f 84/jump-if-= loop/disp32
2960
2961 {
2962 $parse-mu:fn:
2963 (slice-equal? %edx "fn")
2964 3d/compare-eax-and 0/imm32/false
2965 0f 84/jump-if-= break/disp32
2966
2967 (allocate Heap *Function-size)
2968 (zero-out %eax *Function-size)
2969 (clear-stack %ebx)
2970 (populate-mu-function-header %ecx %eax %ebx)
2971 (populate-mu-function-body *(ebp+8) %eax %ebx)
2972
2973 89/<- *edi 0/r32/eax
2974
2975 8d/address-> *(eax+0x14) 7/r32/edi
2976 e9/jump $parse-mu:line-loop/disp32
2977 }
2978
2979 {
2980 $parse-mu:type:
2981 (slice-equal? %edx "type")
2982 3d/compare-eax-and 0/imm32
2983 0f 84/jump-if-= break/disp32
2984 (next-mu-token %ecx %edx)
2985
2986 (pos-or-insert-slice Type-id %edx)
2987
2988 (find-or-create-typeinfo %eax)
2989
2990 (populate-mu-type *(ebp+8) %eax)
2991 e9/jump $parse-mu:line-loop/disp32
2992 }
2993
2994 e9/jump $parse-mu:error1/disp32
2995 }
2996 $parse-mu:end:
2997
2998 81 0/subop/add %esp 0x630/imm32
2999
3000 5f/pop-to-edi
3001 5e/pop-to-esi
3002 5b/pop-to-ebx
3003 5a/pop-to-edx
3004 59/pop-to-ecx
3005 58/pop-to-eax
3006
3007 89/<- %esp 5/r32/ebp
3008 5d/pop-to-ebp
3009 c3/return
3010
3011 $parse-mu:error1:
3012
3013 (write-buffered Stderr "unexpected top-level command: ")
3014 (write-slice-buffered Stderr %edx)
3015 (write-buffered Stderr "\n")
3016 (flush Stderr)
3017
3018 bb/copy-to-ebx 1/imm32
3019 b8/copy-to-eax 1/imm32/exit
3020 cd/syscall 0x80/imm8
3021
3022
3023 $parse-mu:error2:
3024
3025 (print-int32-buffered Stderr *ebx)
3026 (write-buffered Stderr " vars not reclaimed after fn '")
3027 (write-slice-buffered Stderr *eax)
3028 (write-buffered Stderr "'\n")
3029 (flush Stderr)
3030
3031 bb/copy-to-ebx 1/imm32
3032 b8/copy-to-eax 1/imm32/exit
3033 cd/syscall 0x80/imm8
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047 populate-mu-function-header:
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076 55/push-ebp
3077 89/<- %ebp 4/r32/esp
3078
3079 50/push-eax
3080 51/push-ecx
3081 52/push-edx
3082 53/push-ebx
3083 57/push-edi
3084
3085 8b/-> *(ebp+0xc) 7/r32/edi
3086
3087 68/push 0/imm32/end
3088 68/push 0/imm32/start
3089 89/<- %ecx 4/r32/esp
3090
3091 (next-mu-token *(ebp+8) %ecx)
3092
3093
3094
3095 (slice-equal? %ecx "{")
3096 3d/compare-eax-and 0/imm32/false
3097 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3098
3099 (slice-equal? %ecx "->")
3100 3d/compare-eax-and 0/imm32/false
3101 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3102
3103 (slice-equal? %ecx "}")
3104 3d/compare-eax-and 0/imm32/false
3105 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3106
3107 (slice-to-string Heap %ecx)
3108 89/<- *edi 0/r32/eax
3109
3110 89/<- *(edi+4) 0/r32/eax
3111
3112 {
3113 $populate-mu-function-header:check-for-inout:
3114 (next-mu-token *(ebp+8) %ecx)
3115
3116 (slice-equal? %ecx "{")
3117 3d/compare-eax-and 0/imm32/false
3118 0f 85/jump-if-!= $populate-mu-function-header:done/disp32
3119
3120 (slice-equal? %ecx "->")
3121 3d/compare-eax-and 0/imm32/false
3122 0f 85/jump-if-!= break/disp32
3123
3124 (slice-equal? %ecx "}")
3125 3d/compare-eax-and 0/imm32/false
3126 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3127
3128 (parse-var-with-type %ecx *(ebp+8))
3129 89/<- %ebx 0/r32/eax
3130
3131 81 7/subop/compare *(ebx+0x10) 0/imm32
3132 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32
3133
3134
3135
3136 (append-list Heap %ebx *(edi+8))
3137 89/<- *(edi+8) 0/r32/eax
3138
3139 (push *(ebp+0x10) %ebx)
3140
3141 e9/jump loop/disp32
3142 }
3143
3144 {
3145 $populate-mu-function-header:check-for-out:
3146 (next-mu-token *(ebp+8) %ecx)
3147
3148 (slice-equal? %ecx "{")
3149 3d/compare-eax-and 0/imm32/false
3150 0f 85/jump-if-!= break/disp32
3151
3152 (slice-equal? %ecx "->")
3153 3d/compare-eax-and 0/imm32/false
3154 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3155
3156 (slice-equal? %ecx "}")
3157 3d/compare-eax-and 0/imm32/false
3158 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3159
3160 (parse-var-with-type %ecx *(ebp+8))
3161 89/<- %ebx 0/r32/eax
3162
3163 81 7/subop/compare *(ebx+0x10) 0/imm32
3164 0f 84/jump-if-= $populate-mu-function-header:error3/disp32
3165 (append-list Heap %ebx *(edi+0xc))
3166 89/<- *(edi+0xc) 0/r32/eax
3167 e9/jump loop/disp32
3168 }
3169 $populate-mu-function-header:done:
3170 (check-no-tokens-left *(ebp+8))
3171 $populate-mu-function-header:end:
3172
3173 81 0/subop/add %esp 8/imm32
3174
3175 5f/pop-to-edi
3176 5b/pop-to-ebx
3177 5a/pop-to-edx
3178 59/pop-to-ecx
3179 58/pop-to-eax
3180
3181 89/<- %esp 5/r32/ebp
3182 5d/pop-to-ebp
3183 c3/return
3184
3185 $populate-mu-function-header:error1:
3186
3187 (write-buffered Stderr "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '")
3188 (flush Stderr)
3189 (rewind-stream *(ebp+8))
3190 (write-stream 2 *(ebp+8))
3191 (write-buffered Stderr "'\n")
3192 (flush Stderr)
3193
3194 bb/copy-to-ebx 1/imm32
3195 b8/copy-to-eax 1/imm32/exit
3196 cd/syscall 0x80/imm8
3197
3198
3199 $populate-mu-function-header:error2:
3200
3201 (write-buffered Stderr "function input '")
3202 (write-buffered Stderr *ebx)
3203 (write-buffered Stderr "' cannot be in a register")
3204 (flush Stderr)
3205
3206 bb/copy-to-ebx 1/imm32
3207 b8/copy-to-eax 1/imm32/exit
3208 cd/syscall 0x80/imm8
3209
3210
3211 $populate-mu-function-header:error3:
3212
3213 (write-buffered Stderr "function input '")
3214 (write-buffered Stderr *eax)
3215 (write-buffered Stderr " must be in a register'")
3216 (flush Stderr)
3217 (rewind-stream *(ebp+8))
3218 (write-stream 2 *(ebp+8))
3219 (write-buffered Stderr "'\n")
3220 (flush Stderr)
3221
3222 bb/copy-to-ebx 1/imm32
3223 b8/copy-to-eax 1/imm32/exit
3224 cd/syscall 0x80/imm8
3225
3226
3227 test-function-header-with-arg:
3228
3229 55/push-ebp
3230 89/<- %ebp 4/r32/esp
3231
3232 (clear-stream _test-input-stream)
3233 (write _test-input-stream "foo n: int {\n")
3234
3235 2b/subtract-> *Function-size 4/r32/esp
3236 89/<- %ecx 4/r32/esp
3237 (zero-out %ecx *Function-size)
3238
3239 81 5/subop/subtract %esp 0x10/imm32
3240 68/push 0x10/imm32/length
3241 68/push 0/imm32/top
3242 89/<- %ebx 4/r32/esp
3243
3244 (populate-mu-function-header _test-input-stream %ecx %ebx)
3245
3246 (check-strings-equal *ecx "foo" "F - test-function-header-with-arg/name")
3247
3248 8b/-> *(ecx+8) 2/r32/edx
3249
3250 8b/-> *edx 3/r32/ebx
3251 (check-strings-equal *ebx "n" "F - test-function-header-with-arg/inout:0")
3252 8b/-> *(ebx+4) 3/r32/ebx
3253 (check-ints-equal *ebx 1 "F - test-function-header-with-arg/inout:0/type:0")
3254 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-arg/inout:0/type:1")
3255
3256 89/<- %esp 5/r32/ebp
3257 5d/pop-to-ebp
3258 c3/return
3259
3260 test-function-header-with-multiple-args:
3261
3262 55/push-ebp
3263 89/<- %ebp 4/r32/esp
3264
3265 (clear-stream _test-input-stream)
3266 (write _test-input-stream "foo a: int, b: int c: int {\n")
3267
3268 2b/subtract-> *Function-size 4/r32/esp
3269 89/<- %ecx 4/r32/esp
3270 (zero-out %ecx *Function-size)
3271
3272 81 5/subop/subtract %esp 0x10/imm32
3273 68/push 0x10/imm32/length
3274 68/push 0/imm32/top
3275 89/<- %ebx 4/r32/esp
3276
3277 (populate-mu-function-header _test-input-stream %ecx %ebx)
3278
3279 (check-strings-equal *ecx "foo")
3280
3281 8b/-> *(ecx+8) 2/r32/edx
3282 $test-function-header-with-multiple-args:inout0:
3283
3284 8b/-> *edx 3/r32/ebx
3285 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args/inout:0")
3286 8b/-> *(ebx+4) 3/r32/ebx
3287 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:0/type:0")
3288 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:0/type:1")
3289
3290 8b/-> *(edx+4) 2/r32/edx
3291 $test-function-header-with-multiple-args:inout1:
3292
3293 8b/-> *edx 3/r32/ebx
3294 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args/inout:1")
3295 8b/-> *(ebx+4) 3/r32/ebx
3296 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:1/type:0")
3297 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:1/type:1")
3298
3299 8b/-> *(edx+4) 2/r32/edx
3300 $test-function-header-with-multiple-args:inout2:
3301
3302 8b/-> *edx 3/r32/ebx
3303 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args/inout:2")
3304 8b/-> *(ebx+4) 3/r32/ebx
3305 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:2/type:0")
3306 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:2/type:1")
3307
3308 89/<- %esp 5/r32/ebp
3309 5d/pop-to-ebp
3310 c3/return
3311
3312 test-function-with-multiple-args-and-outputs:
3313
3314 55/push-ebp
3315 89/<- %ebp 4/r32/esp
3316
3317 (clear-stream _test-input-stream)
3318 (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx: int {\n")
3319
3320 2b/subtract-> *Function-size 4/r32/esp
3321 89/<- %ecx 4/r32/esp
3322 (zero-out %ecx *Function-size)
3323
3324 81 5/subop/subtract %esp 0x10/imm32
3325 68/push 0x10/imm32/length
3326 68/push 0/imm32/top
3327 89/<- %ebx 4/r32/esp
3328
3329 (populate-mu-function-header _test-input-stream %ecx %ebx)
3330
3331 (check-strings-equal *ecx "foo")
3332
3333 8b/-> *(ecx+8) 2/r32/edx
3334
3335 8b/-> *edx 3/r32/ebx
3336 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0")
3337 8b/-> *(ebx+4) 3/r32/ebx
3338 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0")
3339 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1")
3340
3341 8b/-> *(edx+4) 2/r32/edx
3342
3343 8b/-> *edx 3/r32/ebx
3344 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1")
3345 8b/-> *(ebx+4) 3/r32/ebx
3346 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0")
3347 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1")
3348
3349 8b/-> *(edx+4) 2/r32/edx
3350
3351 8b/-> *edx 3/r32/ebx
3352 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2")
3353 8b/-> *(ebx+4) 3/r32/ebx
3354 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0")
3355 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1")
3356
3357 8b/-> *(ecx+0xc) 2/r32/edx
3358
3359 8b/-> *edx 3/r32/ebx
3360 (check-strings-equal *ebx "x" "F - test-function-header-with-multiple-args-and-outputs/output:0")
3361 (check-strings-equal *(ebx+0x10) "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register")
3362 8b/-> *(ebx+4) 3/r32/ebx
3363 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1")
3364 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1")
3365
3366 8b/-> *(edx+4) 2/r32/edx
3367
3368 8b/-> *edx 3/r32/ebx
3369 (check-strings-equal *ebx "y" "F - test-function-header-with-multiple-args-and-outputs/output:1")
3370 (check-strings-equal *(ebx+0x10) "edx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register")
3371 8b/-> *(ebx+4) 3/r32/ebx
3372 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1")
3373 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1")
3374
3375 89/<- %esp 5/r32/ebp
3376 5d/pop-to-ebp
3377 c3/return
3378
3379
3380
3381
3382
3383
3384
3385
3386 parse-var-with-type:
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404 55/push-ebp
3405 89/<- %ebp 4/r32/esp
3406
3407 51/push-ecx
3408 52/push-edx
3409 53/push-ebx
3410 56/push-esi
3411 57/push-edi
3412
3413 8b/-> *(ebp+8) 6/r32/esi
3414
3415 8b/-> *(esi+4) 1/r32/ecx
3416 49/decrement-ecx
3417 8a/copy-byte *ecx 1/r32/CL
3418 81 4/subop/and %ecx 0xff/imm32
3419 81 7/subop/compare %ecx 0x3a/imm32/colon
3420 0f 85/jump-if-!= $parse-var-with-type:abort/disp32
3421
3422 ff 1/subop/decrement *(esi+4)
3423
3424 68/push 0/imm32/end
3425 68/push 0/imm32/start
3426 89/<- %ecx 4/r32/esp
3427 $parse-var-with-type:parse-name:
3428 (next-token-from-slice *esi *(esi+4) 0x2f %ecx)
3429 $parse-var-with-type:create-var:
3430
3431 (new-var-from-slice Heap %ecx)
3432 89/<- %edi 0/r32/eax
3433
3434 $parse-var-with-type:save-register:
3435
3436 (next-token-from-slice *(ecx+4) *(esi+4) 0x2f %ecx)
3437
3438 {
3439 $parse-var-with-type:write-register:
3440 (slice-empty? %ecx)
3441 3d/compare-eax-and 0/imm32/false
3442 75/jump-if-!= break/disp8
3443 (slice-to-string Heap %ecx)
3444 89/<- *(edi+0x10) 0/r32/eax
3445 }
3446 $parse-var-with-type:save-type:
3447 (parse-type Heap *(ebp+0xc))
3448
3449
3450
3451
3452 89/<- *(edi+4) 0/r32/eax
3453 $parse-var-with-type:end:
3454
3455 89/<- %eax 7/r32/edi
3456
3457 81 0/subop/add %esp 8/imm32
3458
3459 5f/pop-to-edi
3460 5e/pop-to-esi
3461 5b/pop-to-ebx
3462 5a/pop-to-edx
3463 59/pop-to-ecx
3464
3465 89/<- %esp 5/r32/ebp
3466 5d/pop-to-ebp
3467 c3/return
3468
3469 $parse-var-with-type:abort:
3470
3471 (write-buffered Stderr "var should have form 'name: type' in '")
3472 (flush Stderr)
3473 (rewind-stream *(ebp+0xc))
3474 (write-stream 2 *(ebp+0xc))
3475 (write-buffered Stderr "'\n")
3476 (flush Stderr)
3477
3478 bb/copy-to-ebx 1/imm32
3479 b8/copy-to-eax 1/imm32/exit
3480 cd/syscall 0x80/imm8
3481
3482
3483 parse-type:
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501 55/push-ebp
3502 89/<- %ebp 4/r32/esp
3503
3504 51/push-ecx
3505 52/push-edx
3506
3507 68/push 0/imm32
3508 68/push 0/imm32
3509 89/<- %ecx 4/r32/esp
3510
3511 (next-mu-token *(ebp+0xc) %ecx)
3512
3513
3514
3515
3516
3517 (slice-equal? %ecx "")
3518 3d/compare-eax-and 0/imm32/false
3519 0f 85/jump-if-!= $parse-type:abort/disp32
3520
3521 (slice-equal? %ecx "{")
3522 3d/compare-eax-and 0/imm32/false
3523 0f 85/jump-if-!= $parse-type:abort/disp32
3524
3525 (slice-equal? %ecx "}")
3526 3d/compare-eax-and 0/imm32/false
3527 0f 85/jump-if-!= $parse-type:abort/disp32
3528
3529 (slice-equal? %ecx "->")
3530 3d/compare-eax-and 0/imm32/false
3531 0f 85/jump-if-!= $parse-type:abort/disp32
3532
3533 (slice-equal? %ecx ")")
3534 3d/compare-eax-and 0/imm32/false
3535 b8/copy-to-eax 0/imm32
3536 0f 85/jump-if-!= $parse-type:end/disp32
3537
3538 (allocate *(ebp+8) *Tree-size)
3539 (zero-out %eax *Tree-size)
3540 89/<- %edx 0/r32/eax
3541 {
3542
3543 (slice-equal? %ecx "(")
3544 3d/compare-eax-and 0/imm32/false
3545 75/jump-if-!= break/disp8
3546
3547 {
3548 (is-hex-int? %ecx)
3549 3d/compare-eax-and 0/imm32/false
3550 74/jump-if-= break/disp8
3551 (parse-hex-int-from-slice %ecx)
3552 89/<- *edx 0/r32/eax
3553 e9/jump $parse-type:return-edx/disp32
3554 }
3555
3556 (pos-or-insert-slice Type-id %ecx)
3557
3558
3559
3560
3561 89/<- *edx 0/r32/eax
3562 e9/jump $parse-type:return-edx/disp32
3563 }
3564
3565
3566 (parse-type *(ebp+8) *(ebp+0xc))
3567
3568
3569 89/<- *edx 0/r32/eax
3570
3571 (parse-type-tree *(ebp+8) *(ebp+0xc))
3572
3573
3574
3575
3576 89/<- *(edx+4) 0/r32/eax
3577 $parse-type:return-edx:
3578 89/<- %eax 2/r32/edx
3579 $parse-type:end:
3580
3581 81 0/subop/add %esp 8/imm32
3582
3583 5a/pop-to-edx
3584 59/pop-to-ecx
3585
3586 89/<- %esp 5/r32/ebp
3587 5d/pop-to-ebp
3588 c3/return
3589
3590 $parse-type:abort:
3591
3592 (write-buffered Stderr "unexpected token when parsing type: '")
3593 (write-slice-buffered Stderr %ecx)
3594 (write-buffered Stderr "'\n")
3595 (flush Stderr)
3596
3597 bb/copy-to-ebx 1/imm32
3598 b8/copy-to-eax 1/imm32/exit
3599 cd/syscall 0x80/imm8
3600
3601
3602 parse-type-tree:
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613 55/push-ebp
3614 89/<- %ebp 4/r32/esp
3615
3616 51/push-ecx
3617 52/push-edx
3618
3619 (parse-type *(ebp+8) *(ebp+0xc))
3620
3621 3d/compare-eax-and 0/imm32
3622 74/jump-if-= $parse-type-tree:end/disp8
3623
3624 89/<- %ecx 0/r32/eax
3625
3626 (allocate *(ebp+8) *Tree-size)
3627 (zero-out %eax *Tree-size)
3628 89/<- %edx 0/r32/eax
3629
3630 89/<- *edx 1/r32/ecx
3631
3632 (parse-type-tree *(ebp+8) *(ebp+0xc))
3633 89/<- *(edx+4) 0/r32/eax
3634 $parse-type-tree:return-edx:
3635 89/<- %eax 2/r32/edx
3636 $parse-type-tree:end:
3637
3638 5a/pop-to-edx
3639 59/pop-to-ecx
3640
3641 89/<- %esp 5/r32/ebp
3642 5d/pop-to-ebp
3643 c3/return
3644
3645 next-mu-token:
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690 55/push-ebp
3691 89/<- %ebp 4/r32/esp
3692
3693 50/push-eax
3694 51/push-ecx
3695 56/push-esi
3696 57/push-edi
3697
3698 8b/-> *(ebp+8) 6/r32/esi
3699
3700 8b/-> *(ebp+0xc) 7/r32/edi
3701 $next-mu-token:start:
3702 (skip-chars-matching-whitespace %esi)
3703 $next-mu-token:check0:
3704
3705
3706 8b/-> *(esi+4) 1/r32/ecx
3707
3708 3b/compare 1/r32/ecx *esi
3709 c7 0/subop/copy *edi 0/imm32
3710 c7 0/subop/copy *(edi+4) 0/imm32
3711 0f 8d/jump-if->= $next-mu-token:end/disp32
3712
3713 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
3714 89/<- *edi 0/r32/eax
3715
3716 31/xor %eax 0/r32/eax
3717 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
3718 {
3719 $next-mu-token:check-for-comma:
3720
3721 3d/compare-eax-and 0x2c/imm32/comma
3722 75/jump-if-!= break/disp8
3723
3724 ff 0/subop/increment *(esi+4)
3725
3726 e9/jump $next-mu-token:start/disp32
3727 }
3728 {
3729 $next-mu-token:check-for-comment:
3730
3731 3d/compare-eax-and 0x23/imm32/pound
3732 75/jump-if-!= break/disp8
3733
3734 e9/jump $next-mu-token:done/disp32
3735 }
3736 {
3737 $next-mu-token:check-for-string-literal:
3738
3739 3d/compare-eax-and 0x22/imm32/dquote
3740 75/jump-if-!= break/disp8
3741 (skip-string %esi)
3742
3743 e9/jump $next-mu-token:done/disp32
3744 }
3745 {
3746 $next-mu-token:check-for-open-paren:
3747
3748 3d/compare-eax-and 0x28/imm32/open-paren
3749 75/jump-if-!= break/disp8
3750
3751 ff 0/subop/increment *(esi+4)
3752
3753 e9/jump $next-mu-token:done/disp32
3754 }
3755 {
3756 $next-mu-token:check-for-close-paren:
3757
3758 3d/compare-eax-and 0x29/imm32/close-paren
3759 75/jump-if-!= break/disp8
3760
3761 ff 0/subop/increment *(esi+4)
3762
3763 e9/jump $next-mu-token:done/disp32
3764 }
3765 {
3766 $next-mu-token:regular-word-without-metadata:
3767
3768
3769 8b/-> *(esi+4) 1/r32/ecx
3770
3771 3b/compare *esi 1/r32/ecx
3772 7d/jump-if->= break/disp8
3773
3774 31/xor %eax 0/r32/eax
3775 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
3776
3777 3d/compare-eax-and 0x20/imm32/space
3778 74/jump-if-= break/disp8
3779
3780 3d/compare-eax-and 0xd/imm32/carriage-return
3781 74/jump-if-= break/disp8
3782
3783 3d/compare-eax-and 0xa/imm32/newline
3784 74/jump-if-= break/disp8
3785
3786 3d/compare-eax-and 0x28/imm32/open-paren
3787 0f 84/jump-if-= break/disp32
3788
3789 3d/compare-eax-and 0x29/imm32/close-paren
3790 0f 84/jump-if-= break/disp32
3791
3792 3d/compare-eax-and 0x2c/imm32/comma
3793 0f 84/jump-if-= break/disp32
3794
3795 ff 0/subop/increment *(esi+4)
3796
3797 e9/jump loop/disp32
3798 }
3799 $next-mu-token:done:
3800
3801 8b/-> *(esi+4) 1/r32/ecx
3802 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
3803 89/<- *(edi+4) 0/r32/eax
3804 $next-mu-token:end:
3805
3806 5f/pop-to-edi
3807 5e/pop-to-esi
3808 59/pop-to-ecx
3809 58/pop-to-eax
3810
3811 89/<- %esp 5/r32/ebp
3812 5d/pop-to-ebp
3813 c3/return
3814
3815 pos-or-insert-slice:
3816
3817 55/push-ebp
3818 89/<- %ebp 4/r32/esp
3819
3820 (pos-slice *(ebp+8) *(ebp+0xc))
3821 3d/compare-eax-and -1/imm32
3822 75/jump-if-!= $pos-or-insert-slice:end/disp8
3823 $pos-or-insert-slice:insert:
3824 (slice-to-string Heap *(ebp+0xc))
3825 (write-int *(ebp+8) %eax)
3826 (pos-slice *(ebp+8) *(ebp+0xc))
3827 $pos-or-insert-slice:end:
3828
3829 89/<- %esp 5/r32/ebp
3830 5d/pop-to-ebp
3831 c3/return
3832
3833
3834
3835 pos-slice:
3836
3837 55/push-ebp
3838 89/<- %ebp 4/r32/esp
3839
3840 51/push-ecx
3841 52/push-edx
3842 53/push-ebx
3843 56/push-esi
3844
3845
3846
3847
3848
3849 8b/-> *(ebp+8) 6/r32/esi
3850
3851 b9/copy-to-ecx 0/imm32
3852
3853 8d/copy-address *(esi+0xc) 2/r32/edx
3854
3855 8b/-> *esi 3/r32/ebx
3856 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx
3857 {
3858
3859
3860
3861
3862
3863 39/compare %edx 3/r32/ebx
3864 b8/copy-to-eax -1/imm32
3865 73/jump-if-addr>= $pos-slice:end/disp8
3866
3867 (slice-equal? *(ebp+0xc) *edx)
3868 3d/compare-eax-and 0/imm32/false
3869 75/jump-if-!= break/disp8
3870
3871 41/increment-ecx
3872
3873 81 0/subop/add %edx 4/imm32
3874
3875 eb/jump loop/disp8
3876 }
3877
3878 89/<- %eax 1/r32/ecx
3879 $pos-slice:end:
3880
3881
3882
3883
3884 5e/pop-to-esi
3885 5b/pop-to-ebx
3886 5a/pop-to-edx
3887 59/pop-to-ecx
3888
3889 89/<- %esp 5/r32/ebp
3890 5d/pop-to-ebp
3891 c3/return
3892
3893 test-parse-var-with-type:
3894
3895 55/push-ebp
3896 89/<- %ebp 4/r32/esp
3897
3898 b8/copy-to-eax "x:"/imm32
3899 8b/-> *eax 1/r32/ecx
3900 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3901 05/add-to-eax 4/imm32
3902
3903 51/push-ecx
3904 50/push-eax
3905 89/<- %ecx 4/r32/esp
3906
3907 (clear-stream _test-input-stream)
3908 (write _test-input-stream "int")
3909
3910 (parse-var-with-type %ecx _test-input-stream)
3911 8b/-> *eax 2/r32/edx
3912 (check-strings-equal %edx "x" "F - test-var-with-type/name")
3913 8b/-> *(eax+4) 2/r32/edx
3914 (check-ints-equal *edx 1 "F - test-var-with-type/type")
3915 (check-ints-equal *(edx+4) 0 "F - test-var-with-type/type")
3916
3917 89/<- %esp 5/r32/ebp
3918 5d/pop-to-ebp
3919 c3/return
3920
3921 test-parse-var-with-type-and-register:
3922
3923 55/push-ebp
3924 89/<- %ebp 4/r32/esp
3925
3926 b8/copy-to-eax "x/eax:"/imm32
3927 8b/-> *eax 1/r32/ecx
3928 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3929 05/add-to-eax 4/imm32
3930
3931 51/push-ecx
3932 50/push-eax
3933 89/<- %ecx 4/r32/esp
3934
3935 (clear-stream _test-input-stream)
3936 (write _test-input-stream "int")
3937
3938 (parse-var-with-type %ecx _test-input-stream)
3939 8b/-> *eax 2/r32/edx
3940 (check-strings-equal %edx "x" "F - test-var-with-type-and-register/name")
3941 8b/-> *(eax+0x10) 2/r32/edx
3942 (check-strings-equal %edx "eax" "F - test-var-with-type-and-register/register")
3943 8b/-> *(eax+4) 2/r32/edx
3944 (check-ints-equal *edx 1 "F - test-var-with-type-and-register/type")
3945 (check-ints-equal *(edx+4) 0 "F - test-var-with-type-and-register/type")
3946
3947 89/<- %esp 5/r32/ebp
3948 5d/pop-to-ebp
3949 c3/return
3950
3951 test-parse-var-with-trailing-characters:
3952
3953 55/push-ebp
3954 89/<- %ebp 4/r32/esp
3955
3956 b8/copy-to-eax "x:"/imm32
3957 8b/-> *eax 1/r32/ecx
3958 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3959 05/add-to-eax 4/imm32
3960
3961 51/push-ecx
3962 50/push-eax
3963 89/<- %ecx 4/r32/esp
3964
3965 (clear-stream _test-input-stream)
3966 (write _test-input-stream "int,")
3967
3968 (parse-var-with-type %ecx _test-input-stream)
3969 8b/-> *eax 2/r32/edx
3970 (check-strings-equal %edx "x" "F - test-var-with-trailing-characters/name")
3971 8b/-> *(eax+0x10) 2/r32/edx
3972 (check-ints-equal %edx 0 "F - test-var-with-trailing-characters/register")
3973 8b/-> *(eax+4) 2/r32/edx
3974 (check-ints-equal *edx 1 "F - test-var-with-trailing-characters/type")
3975 (check-ints-equal *(edx+4) 0 "F - test-var-with-trailing-characters/type")
3976
3977 89/<- %esp 5/r32/ebp
3978 5d/pop-to-ebp
3979 c3/return
3980
3981 test-parse-var-with-register-and-trailing-characters:
3982
3983 55/push-ebp
3984 89/<- %ebp 4/r32/esp
3985
3986 b8/copy-to-eax "x/eax:"/imm32
3987 8b/-> *eax 1/r32/ecx
3988 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3989 05/add-to-eax 4/imm32
3990
3991 51/push-ecx
3992 50/push-eax
3993 89/<- %ecx 4/r32/esp
3994
3995 (clear-stream _test-input-stream)
3996 (write _test-input-stream "int,")
3997
3998 (parse-var-with-type %ecx _test-input-stream)
3999 8b/-> *eax 2/r32/edx
4000 (check-strings-equal %edx "x" "F - test-var-with-register-and-trailing-characters/name")
4001 8b/-> *(eax+0x10) 2/r32/edx
4002 (check-strings-equal %edx "eax" "F - test-var-with-register-and-trailing-characters/register")
4003 8b/-> *(eax+4) 2/r32/edx
4004 (check-ints-equal *edx 1 "F - test-var-with-register-and-trailing-characters/type")
4005 (check-ints-equal *(edx+4) 0 "F - test-var-with-register-and-trailing-characters/type")
4006
4007 89/<- %esp 5/r32/ebp
4008 5d/pop-to-ebp
4009 c3/return
4010
4011 test-parse-var-with-compound-type:
4012
4013 55/push-ebp
4014 89/<- %ebp 4/r32/esp
4015
4016 b8/copy-to-eax "x:"/imm32
4017 8b/-> *eax 1/r32/ecx
4018 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4019 05/add-to-eax 4/imm32
4020
4021 51/push-ecx
4022 50/push-eax
4023 89/<- %ecx 4/r32/esp
4024
4025 (clear-stream _test-input-stream)
4026 (write _test-input-stream "(addr int)")
4027
4028 (parse-var-with-type %ecx _test-input-stream)
4029 8b/-> *eax 2/r32/edx
4030 (check-strings-equal %edx "x" "F - test-var-with-compound-type/name")
4031 8b/-> *(eax+0x10) 2/r32/edx
4032 (check-ints-equal %edx 0 "F - test-var-with-compound-type/register")
4033
4034 8b/-> *(eax+4) 2/r32/edx
4035
4036 8b/-> *edx 0/r32/eax
4037 (check-ints-equal *eax 2 "F - test-var-with-compound-type/type:0")
4038
4039 8b/-> *(edx+4) 2/r32/edx
4040 8b/-> *edx 0/r32/eax
4041 (check-ints-equal *eax 1 "F - test-var-with-compound-type/type:1")
4042
4043 (check-ints-equal *(edx+4) 0 "F - test-var-with-compound-type/type:2")
4044
4045 89/<- %esp 5/r32/ebp
4046 5d/pop-to-ebp
4047 c3/return
4048
4049
4050
4051
4052 is-identifier?:
4053
4054 55/push-ebp
4055 89/<- %ebp 4/r32/esp
4056
4057 (slice-empty? *(ebp+8))
4058 3d/compare-eax-and 0/imm32/false
4059 75/jump-if-!= $is-identifier?:false/disp8
4060
4061 8b/-> *(ebp+8) 0/r32/eax
4062 8b/-> *eax 0/r32/eax
4063 8a/copy-byte *eax 0/r32/AL
4064 81 4/subop/and %eax 0xff/imm32
4065
4066 3d/compare-eax-and 0x24/imm32/$
4067 74/jump-if-= $is-identifier?:true/disp8
4068
4069 3d/compare-eax-and 0x5f/imm32/_
4070 74/jump-if-= $is-identifier?:true/disp8
4071
4072 25/and-eax-with 0x5f/imm32
4073
4074 3d/compare-eax-and 0x41/imm32/A
4075 7c/jump-if-< $is-identifier?:false/disp8
4076
4077 3d/compare-eax-and 0x5a/imm32/Z
4078 7f/jump-if-> $is-identifier?:false/disp8
4079
4080 $is-identifier?:true:
4081 b8/copy-to-eax 1/imm32/true
4082 eb/jump $is-identifier?:end/disp8
4083 $is-identifier?:false:
4084 b8/copy-to-eax 0/imm32/false
4085 $is-identifier?:end:
4086
4087 89/<- %esp 5/r32/ebp
4088 5d/pop-to-ebp
4089 c3/return
4090
4091 test-is-identifier-dollar:
4092
4093 55/push-ebp
4094 89/<- %ebp 4/r32/esp
4095
4096 b8/copy-to-eax "$a"/imm32
4097 8b/-> *eax 1/r32/ecx
4098 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4099 05/add-to-eax 4/imm32
4100
4101 51/push-ecx
4102 50/push-eax
4103 89/<- %ecx 4/r32/esp
4104
4105 (is-identifier? %ecx)
4106 (check-ints-equal %eax 1 "F - test-is-identifier-dollar")
4107
4108 89/<- %esp 5/r32/ebp
4109 5d/pop-to-ebp
4110 c3/return
4111
4112 test-is-identifier-underscore:
4113
4114 55/push-ebp
4115 89/<- %ebp 4/r32/esp
4116
4117 b8/copy-to-eax "_a"/imm32
4118 8b/-> *eax 1/r32/ecx
4119 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4120 05/add-to-eax 4/imm32
4121
4122 51/push-ecx
4123 50/push-eax
4124 89/<- %ecx 4/r32/esp
4125
4126 (is-identifier? %ecx)
4127 (check-ints-equal %eax 1 "F - test-is-identifier-underscore")
4128
4129 89/<- %esp 5/r32/ebp
4130 5d/pop-to-ebp
4131 c3/return
4132
4133 test-is-identifier-a:
4134
4135 55/push-ebp
4136 89/<- %ebp 4/r32/esp
4137
4138 b8/copy-to-eax "a$"/imm32
4139 8b/-> *eax 1/r32/ecx
4140 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4141 05/add-to-eax 4/imm32
4142
4143 51/push-ecx
4144 50/push-eax
4145 89/<- %ecx 4/r32/esp
4146
4147 (is-identifier? %ecx)
4148 (check-ints-equal %eax 1 "F - test-is-identifier-a")
4149
4150 89/<- %esp 5/r32/ebp
4151 5d/pop-to-ebp
4152 c3/return
4153
4154 test-is-identifier-z:
4155
4156 55/push-ebp
4157 89/<- %ebp 4/r32/esp
4158
4159 b8/copy-to-eax "z$"/imm32
4160 8b/-> *eax 1/r32/ecx
4161 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4162 05/add-to-eax 4/imm32
4163
4164 51/push-ecx
4165 50/push-eax
4166 89/<- %ecx 4/r32/esp
4167
4168 (is-identifier? %ecx)
4169 (check-ints-equal %eax 1 "F - test-is-identifier-z")
4170
4171 89/<- %esp 5/r32/ebp
4172 5d/pop-to-ebp
4173 c3/return
4174
4175 test-is-identifier-A:
4176
4177 55/push-ebp
4178 89/<- %ebp 4/r32/esp
4179
4180 b8/copy-to-eax "A$"/imm32
4181 8b/-> *eax 1/r32/ecx
4182 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4183 05/add-to-eax 4/imm32
4184
4185 51/push-ecx
4186 50/push-eax
4187 89/<- %ecx 4/r32/esp
4188
4189 (is-identifier? %ecx)
4190 (check-ints-equal %eax 1 "F - test-is-identifier-A")
4191
4192 89/<- %esp 5/r32/ebp
4193 5d/pop-to-ebp
4194 c3/return
4195
4196 test-is-identifier-Z:
4197
4198 55/push-ebp
4199 89/<- %ebp 4/r32/esp
4200
4201 b8/copy-to-eax "Z$"/imm32
4202 8b/-> *eax 1/r32/ecx
4203 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4204 05/add-to-eax 4/imm32
4205
4206 51/push-ecx
4207 50/push-eax
4208 89/<- %ecx 4/r32/esp
4209
4210 (is-identifier? %ecx)
4211 (check-ints-equal %eax 1 "F - test-is-identifier-Z")
4212
4213 89/<- %esp 5/r32/ebp
4214 5d/pop-to-ebp
4215 c3/return
4216
4217 test-is-identifier-@:
4218
4219
4220 55/push-ebp
4221 89/<- %ebp 4/r32/esp
4222
4223 b8/copy-to-eax "@a"/imm32
4224 8b/-> *eax 1/r32/ecx
4225 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4226 05/add-to-eax 4/imm32
4227
4228 51/push-ecx
4229 50/push-eax
4230 89/<- %ecx 4/r32/esp
4231
4232 (is-identifier? %ecx)
4233 (check-ints-equal %eax 0 "F - test-is-identifier-@")
4234
4235 89/<- %esp 5/r32/ebp
4236 5d/pop-to-ebp
4237 c3/return
4238
4239 test-is-identifier-square-bracket:
4240
4241
4242 55/push-ebp
4243 89/<- %ebp 4/r32/esp
4244
4245 b8/copy-to-eax "[a"/imm32
4246 8b/-> *eax 1/r32/ecx
4247 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4248 05/add-to-eax 4/imm32
4249
4250 51/push-ecx
4251 50/push-eax
4252 89/<- %ecx 4/r32/esp
4253
4254 (is-identifier? %ecx)
4255 (check-ints-equal %eax 0 "F - test-is-identifier-@")
4256
4257 89/<- %esp 5/r32/ebp
4258 5d/pop-to-ebp
4259 c3/return
4260
4261 test-is-identifier-backtick:
4262
4263
4264 55/push-ebp
4265 89/<- %ebp 4/r32/esp
4266
4267 b8/copy-to-eax "`a"/imm32
4268 8b/-> *eax 1/r32/ecx
4269 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4270 05/add-to-eax 4/imm32
4271
4272 51/push-ecx
4273 50/push-eax
4274 89/<- %ecx 4/r32/esp
4275
4276 (is-identifier? %ecx)
4277 (check-ints-equal %eax 0 "F - test-is-identifier-backtick")
4278
4279 89/<- %esp 5/r32/ebp
4280 5d/pop-to-ebp
4281 c3/return
4282
4283 test-is-identifier-curly-brace-open:
4284
4285
4286 55/push-ebp
4287 89/<- %ebp 4/r32/esp
4288
4289 b8/copy-to-eax "{a"/imm32
4290 8b/-> *eax 1/r32/ecx
4291 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4292 05/add-to-eax 4/imm32
4293
4294 51/push-ecx
4295 50/push-eax
4296 89/<- %ecx 4/r32/esp
4297
4298 (is-identifier? %ecx)
4299 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open")
4300
4301 89/<- %esp 5/r32/ebp
4302 5d/pop-to-ebp
4303 c3/return
4304
4305 test-is-identifier-curly-brace-close:
4306
4307 55/push-ebp
4308 89/<- %ebp 4/r32/esp
4309
4310 b8/copy-to-eax "}a"/imm32
4311 8b/-> *eax 1/r32/ecx
4312 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4313 05/add-to-eax 4/imm32
4314
4315 51/push-ecx
4316 50/push-eax
4317 89/<- %ecx 4/r32/esp
4318
4319 (is-identifier? %ecx)
4320 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close")
4321
4322 89/<- %esp 5/r32/ebp
4323 5d/pop-to-ebp
4324 c3/return
4325
4326 test-is-identifier-hyphen:
4327
4328
4329 55/push-ebp
4330 89/<- %ebp 4/r32/esp
4331
4332 b8/copy-to-eax "-a"/imm32
4333 8b/-> *eax 1/r32/ecx
4334 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4335 05/add-to-eax 4/imm32
4336
4337 51/push-ecx
4338 50/push-eax
4339 89/<- %ecx 4/r32/esp
4340
4341 (is-identifier? %ecx)
4342 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen")
4343
4344 89/<- %esp 5/r32/ebp
4345 5d/pop-to-ebp
4346 c3/return
4347
4348 populate-mu-function-body:
4349
4350 55/push-ebp
4351 89/<- %ebp 4/r32/esp
4352
4353 50/push-eax
4354 56/push-esi
4355 57/push-edi
4356
4357 8b/-> *(ebp+8) 6/r32/esi
4358
4359 8b/-> *(ebp+0xc) 7/r32/edi
4360
4361 (parse-mu-block %esi *(ebp+0x10) %edi)
4362
4363 89/<- *(edi+0x10) 0/r32/eax
4364 $populate-mu-function-body:end:
4365
4366 5f/pop-to-edi
4367 5e/pop-to-esi
4368 58/pop-to-eax
4369
4370 89/<- %esp 5/r32/ebp
4371 5d/pop-to-ebp
4372 c3/return
4373
4374
4375 parse-mu-block:
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411 55/push-ebp
4412 89/<- %ebp 4/r32/esp
4413
4414 51/push-ecx
4415 52/push-edx
4416 53/push-ebx
4417 57/push-edi
4418
4419 81 5/subop/subtract %esp 0x200/imm32
4420 68/push 0x200/imm32/length
4421 68/push 0/imm32/read
4422 68/push 0/imm32/write
4423 89/<- %ecx 4/r32/esp
4424
4425 68/push 0/imm32/end
4426 68/push 0/imm32/start
4427 89/<- %edx 4/r32/esp
4428
4429 (allocate Heap *Stmt-size)
4430 (zero-out %eax *Stmt-size)
4431 89/<- %edi 0/r32/eax
4432
4433 c7 0/subop/copy *edi 0/imm32/block
4434
4435 (new-block-name *(ebp+0x10))
4436 89/<- *(edi+8) 0/r32/eax
4437
4438 (push *(ebp+0xc) %eax)
4439 {
4440 $parse-mu-block:line-loop:
4441
4442 (clear-stream %ecx)
4443 (read-line-buffered *(ebp+8) %ecx)
4444
4445
4446
4447
4448
4449 81 7/subop/compare *ecx 0/imm32
4450 0f 84/jump-if-= break/disp32
4451
4452 (next-mu-token %ecx %edx)
4453
4454
4455
4456
4457
4458 (slice-empty? %edx)
4459 3d/compare-eax-and 0/imm32/false
4460 0f 85/jump-if-!= loop/disp32
4461
4462
4463 8b/-> *edx 0/r32/eax
4464 8a/copy-byte *eax 0/r32/AL
4465 81 4/subop/and %eax 0xff/imm32
4466
4467 3d/compare-eax-and 0x23/imm32/hash
4468 0f 84/jump-if-= loop/disp32
4469
4470 {
4471 $parse-mu-block:check-for-block:
4472 (slice-equal? %edx "{")
4473 3d/compare-eax-and 0/imm32/false
4474 74/jump-if-= break/disp8
4475 (check-no-tokens-left %ecx)
4476
4477 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10))
4478 (append-to-block Heap %edi %eax)
4479 e9/jump $parse-mu-block:line-loop/disp32
4480 }
4481
4482 $parse-mu-block:check-for-end:
4483 (slice-equal? %edx "}")
4484 3d/compare-eax-and 0/imm32/false
4485 0f 85/jump-if-!= break/disp32
4486
4487 {
4488 $parse-mu-block:check-for-named-block:
4489
4490 8b/-> *(edx+4) 0/r32/eax
4491 48/decrement-eax
4492 8a/copy-byte *eax 0/r32/AL
4493 81 4/subop/and %eax 0xff/imm32
4494
4495 3d/compare-eax-and 0x3a/imm32/colon
4496 0f 85/jump-if-!= break/disp32
4497
4498
4499
4500 ff 1/subop/decrement *(edx+4)
4501
4502 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10))
4503 (append-to-block Heap %edi %eax)
4504 e9/jump $parse-mu-block:line-loop/disp32
4505 }
4506
4507 {
4508 $parse-mu-block:check-for-var:
4509 (slice-equal? %edx "var")
4510 3d/compare-eax-and 0/imm32/false
4511 74/jump-if-= break/disp8
4512
4513 (parse-mu-var-def %ecx *(ebp+0xc))
4514 (append-to-block Heap %edi %eax)
4515 e9/jump $parse-mu-block:line-loop/disp32
4516 }
4517 $parse-mu-block:regular-stmt:
4518
4519 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10))
4520 (append-to-block Heap %edi %eax)
4521 e9/jump loop/disp32
4522 }
4523
4524 (pop *(ebp+0xc))
4525
4526 89/<- %eax 7/r32/edi
4527 $parse-mu-block:end:
4528
4529 81 0/subop/add %esp 0x214/imm32
4530
4531 5f/pop-to-edi
4532 5b/pop-to-ebx
4533 5a/pop-to-edx
4534 59/pop-to-ecx
4535
4536 89/<- %esp 5/r32/ebp
4537 5d/pop-to-ebp
4538 c3/return
4539
4540 $parse-mu-block:abort:
4541
4542 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
4543 (rewind-stream %ecx)
4544 (write-stream 2 %ecx)
4545 (write-buffered Stderr "'\n")
4546 (flush Stderr)
4547
4548 bb/copy-to-ebx 1/imm32
4549 b8/copy-to-eax 1/imm32/exit
4550 cd/syscall 0x80/imm8
4551
4552
4553 new-block-name:
4554
4555 55/push-ebp
4556 89/<- %ebp 4/r32/esp
4557
4558 51/push-ecx
4559 52/push-edx
4560
4561 8b/-> *(ebp+8) 0/r32/eax
4562 8b/-> *eax 0/r32/eax
4563 8b/-> *eax 0/r32/eax
4564 05/add-to-eax 0xd/imm32
4565 89/<- %ecx 0/r32/eax
4566
4567 29/subtract %esp 1/r32/ecx
4568 ff 6/subop/push %ecx
4569 68/push 0/imm32/read
4570 68/push 0/imm32/write
4571 89/<- %edx 4/r32/esp
4572 (clear-stream %edx)
4573
4574 8b/-> *(ebp+8) 0/r32/eax
4575 8b/-> *eax 0/r32/eax
4576
4577 (write %edx "$")
4578 (write %edx %eax)
4579 (write %edx ":")
4580 (print-int32 %edx *Next-block-index)
4581 ff 0/subop/increment *Next-block-index
4582
4583
4584 8b/-> *edx 0/r32/eax
4585
4586 8d/copy-address *(edx+0xc) 2/r32/edx
4587
4588 01/add %eax 2/r32/edx
4589
4590 ff 6/subop/push %eax
4591 ff 6/subop/push %edx
4592 89/<- %eax 4/r32/esp
4593
4594 (new-literal Heap %eax)
4595 $new-block-name:end:
4596
4597 81 0/subop/add %ecx 0xc/imm32
4598 81 0/subop/add %ecx 8/imm32
4599 01/add %esp 1/r32/ecx
4600
4601 5a/pop-to-edx
4602 59/pop-to-ecx
4603
4604 89/<- %esp 5/r32/ebp
4605 5d/pop-to-ebp
4606 c3/return
4607
4608 == data
4609
4610
4611 Next-block-index:
4612 1/imm32
4613
4614 == code
4615
4616 check-no-tokens-left:
4617
4618 55/push-ebp
4619 89/<- %ebp 4/r32/esp
4620
4621 50/push-eax
4622 51/push-ecx
4623
4624 68/push 0/imm32/end
4625 68/push 0/imm32/start
4626 89/<- %ecx 4/r32/esp
4627
4628 (next-mu-token *(ebp+8) %ecx)
4629
4630 (slice-empty? %ecx)
4631 3d/compare-eax-and 0/imm32/false
4632 75/jump-if-!= $check-no-tokens-left:end/disp8
4633
4634
4635 8b/-> *edx 0/r32/eax
4636 8a/copy-byte *eax 0/r32/AL
4637 81 4/subop/and %eax 0xff/imm32
4638
4639 3d/compare-eax-and 0x23/imm32/hash
4640 74/jump-if-= $check-no-tokens-left:end/disp8
4641
4642 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
4643 (rewind-stream %ecx)
4644 (write-stream 2 %ecx)
4645 (write-buffered Stderr "'\n")
4646 (flush Stderr)
4647
4648 bb/copy-to-ebx 1/imm32
4649 b8/copy-to-eax 1/imm32/exit
4650 cd/syscall 0x80/imm8
4651
4652 $check-no-tokens-left:end:
4653
4654 81 0/subop/add %esp 8/imm32
4655
4656 59/pop-to-ecx
4657 58/pop-to-eax
4658
4659 89/<- %esp 5/r32/ebp
4660 5d/pop-to-ebp
4661 c3/return
4662
4663 parse-mu-named-block:
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673 55/push-ebp
4674 89/<- %ebp 4/r32/esp
4675
4676 51/push-ecx
4677
4678 (new-literal Heap *(ebp+8))
4679 89/<- %ecx 0/r32/eax
4680
4681 (push *(ebp+0x10) %ecx)
4682
4683 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14))
4684
4685 50/push-eax
4686 (pop *(ebp+0x10))
4687 58/pop-to-eax
4688
4689 c7 0/subop/copy *eax 0/imm32/block
4690
4691 89/<- *(eax+8) 1/r32/ecx
4692 $parse-mu-named-block:end:
4693
4694 59/pop-to-ecx
4695
4696 89/<- %esp 5/r32/ebp
4697 5d/pop-to-ebp
4698 c3/return
4699
4700 parse-mu-var-def:
4701
4702 55/push-ebp
4703 89/<- %ebp 4/r32/esp
4704
4705 51/push-ecx
4706 52/push-edx
4707
4708 68/push 0/imm32/end
4709 68/push 0/imm32/start
4710 89/<- %ecx 4/r32/esp
4711
4712 (next-mu-token *(ebp+8) %ecx)
4713 (parse-var-with-type %ecx *(ebp+8))
4714 89/<- %edx 0/r32/eax
4715
4716 (push *(ebp+0xc) %edx)
4717
4718 8b/-> *(edx+0x10) 0/r32/eax
4719 3d/compare-eax-and 0/imm32
4720 {
4721 75/jump-if-!= break/disp8
4722
4723 (new-var-def Heap %edx)
4724 eb/jump $parse-mu-var-def:end/disp8
4725 }
4726
4727 {
4728 74/jump-if-= break/disp8
4729
4730 (next-mu-token *(ebp+8) %ecx)
4731 (slice-equal? %ecx "<-")
4732 3d/compare-eax-and 0/imm32/false
4733 74/jump-if-= $parse-mu-var-def:abort/disp8
4734
4735 (new-reg-var-def Heap %edx)
4736 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc))
4737 }
4738 $parse-mu-var-def:end:
4739
4740 81 0/subop/add %esp 8/imm32
4741
4742 5a/pop-to-edx
4743 59/pop-to-ecx
4744
4745 89/<- %esp 5/r32/ebp
4746 5d/pop-to-ebp
4747 c3/return
4748
4749 $parse-mu-var-def:abort:
4750 (rewind-stream *(ebp+8))
4751
4752 (write-buffered Stderr "register variable requires a valid instruction to initialize but got '")
4753 (flush Stderr)
4754 (write-stream 2 *(ebp+8))
4755 (write-buffered Stderr "'\n")
4756 (flush Stderr)
4757
4758 bb/copy-to-ebx 1/imm32
4759 b8/copy-to-eax 1/imm32/exit
4760 cd/syscall 0x80/imm8
4761
4762
4763 test-parse-mu-var-def:
4764
4765
4766 55/push-ebp
4767 89/<- %ebp 4/r32/esp
4768
4769 (clear-stream _test-input-stream)
4770 (write _test-input-stream "n: int\n")
4771
4772 81 5/subop/subtract %esp 0x10/imm32
4773 68/push 0x10/imm32/length
4774 68/push 0/imm32/top
4775 89/<- %ecx 4/r32/esp
4776 (clear-stack %ecx)
4777
4778 (parse-mu-var-def _test-input-stream %ecx)
4779
4780 (check-ints-equal *eax 2 "F - test-parse-mu-var-def/tag")
4781 8b/-> *(eax+4) 0/r32/eax
4782 (check-strings-equal *eax "n" "F - test-parse-mu-var-def/var-name")
4783 (check-ints-equal *(eax+0x10) 0 "F - test-parse-mu-var-def/var-register")
4784
4785 8b/-> *(eax+4) 0/r32/eax
4786 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0")
4787 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-var-def/var-type:0")
4788
4789 89/<- %esp 5/r32/ebp
4790 5d/pop-to-ebp
4791 c3/return
4792
4793 test-parse-mu-reg-var-def:
4794
4795
4796 55/push-ebp
4797 89/<- %ebp 4/r32/esp
4798
4799 (clear-stream _test-input-stream)
4800 (write _test-input-stream "n/eax: int <- copy 0\n")
4801
4802 81 5/subop/subtract %esp 0x10/imm32
4803 68/push 0x10/imm32/length
4804 68/push 0/imm32/top
4805 89/<- %ecx 4/r32/esp
4806 (clear-stack %ecx)
4807
4808 (parse-mu-var-def _test-input-stream %ecx)
4809
4810 (check-ints-equal *eax 3 "F - test-parse-mu-reg-var-def/tag")
4811 8b/-> *(eax+0xc) 0/r32/eax
4812 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-reg-var-def/single-output")
4813 8b/-> *eax 0/r32/eax
4814 (check-strings-equal *eax "n" "F - test-parse-mu-reg-var-def/output-name")
4815 (check-strings-equal *(eax+0x10) "eax" "F - test-parse-mu-reg-var-def/output-register")
4816
4817 8b/-> *(eax+4) 0/r32/eax
4818 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0")
4819 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-reg-var-def/output-type:0")
4820
4821 89/<- %esp 5/r32/ebp
4822 5d/pop-to-ebp
4823 c3/return
4824
4825 parse-mu-stmt:
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839 55/push-ebp
4840 89/<- %ebp 4/r32/esp
4841
4842 51/push-ecx
4843 52/push-edx
4844 57/push-edi
4845
4846 68/push 0/imm32/end
4847 68/push 0/imm32/start
4848 89/<- %ecx 4/r32/esp
4849
4850 ba/copy-to-edx 0/imm32/false
4851
4852 (allocate Heap *Stmt-size)
4853 (zero-out %eax *Stmt-size)
4854 89/<- %edi 0/r32/eax
4855
4856 c7 0/subop/copy *edi 1/imm32/stmt1
4857 {
4858 (stmt-has-outputs? *(ebp+8))
4859 3d/compare-eax-and 0/imm32/false
4860 0f 84/jump-if-= break/disp32
4861 {
4862 $parse-mu-stmt:read-outputs:
4863
4864 (next-mu-token *(ebp+8) %ecx)
4865
4866 (slice-empty? %ecx)
4867 3d/compare-eax-and 0/imm32/false
4868 0f 85/jump-if-!= break/disp32
4869
4870 (slice-equal? %ecx "<-")
4871 3d/compare-eax-and 0/imm32/false
4872 0f 85/jump-if-!= break/disp32
4873
4874 ba/copy-to-edx 0/imm32/false
4875
4876 8b/-> *ecx 0/r32/eax
4877 8a/copy-byte *eax 0/r32/AL
4878 81 4/subop/and %eax 0xff/imm32
4879 3d/compare-eax-and 0x2a/imm32/asterisk
4880 {
4881 75/jump-if-!= break/disp8
4882 ff 0/subop/increment *ecx
4883 ba/copy-to-edx 1/imm32/true
4884 }
4885
4886 (is-identifier? %ecx)
4887 3d/compare-eax-and 0/imm32/false
4888 0f 84/jump-if-= $parse-mu-stmt:abort/disp32
4889
4890 (lookup-or-define-var %ecx *(ebp+0xc) *(ebp+0x10))
4891 (append-stmt-var Heap %eax *(edi+0xc) %edx)
4892 89/<- *(edi+0xc) 0/r32/eax
4893 e9/jump loop/disp32
4894 }
4895 }
4896 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc))
4897 $parse-mu-stmt:end:
4898
4899 89/<- %eax 7/r32/edi
4900
4901 81 0/subop/add %esp 8/imm32
4902
4903 5f/pop-to-edi
4904 5a/pop-to-edx
4905 59/pop-to-ecx
4906
4907 89/<- %esp 5/r32/ebp
4908 5d/pop-to-ebp
4909 c3/return
4910
4911 $parse-mu-stmt:abort:
4912
4913 (write-buffered Stderr "invalid identifier '")
4914 (write-slice-buffered Stderr %ecx)
4915 (write-buffered Stderr "'\n")
4916 (flush Stderr)
4917
4918 bb/copy-to-ebx 1/imm32
4919 b8/copy-to-eax 1/imm32/exit
4920 cd/syscall 0x80/imm8
4921
4922
4923 add-operation-and-inputs-to-stmt:
4924
4925
4926
4927
4928
4929
4930
4931
4932 55/push-ebp
4933 89/<- %ebp 4/r32/esp
4934
4935 50/push-eax
4936 51/push-ecx
4937 52/push-edx
4938 53/push-ebx
4939 57/push-edi
4940
4941 8b/-> *(ebp+8) 7/r32/edi
4942
4943 68/push 0/imm32/end
4944 68/push 0/imm32/start
4945 89/<- %ecx 4/r32/esp
4946
4947 ba/copy-to-edx 0/imm32/false
4948 $add-operation-and-inputs-to-stmt:read-operation:
4949 (next-mu-token *(ebp+0xc) %ecx)
4950 (slice-to-string Heap %ecx)
4951 89/<- *(edi+4) 0/r32/eax
4952
4953 (slice-equal? %ecx "get")
4954 89/<- %ebx 0/r32/eax
4955 {
4956 $add-operation-and-inputs-to-stmt:read-inouts:
4957
4958 (next-mu-token *(ebp+0xc) %ecx)
4959
4960 (slice-empty? %ecx)
4961 3d/compare-eax-and 0/imm32/false
4962 0f 85/jump-if-!= break/disp32
4963
4964 (slice-equal? %ecx "<-")
4965 3d/compare-eax-and 0/imm32/false
4966 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32
4967
4968 {
4969 81 7/subop/compare %ebx 0/imm32/false
4970 74/jump-if-= break/disp8
4971 81 7/subop/compare *(edi+8) 0/imm32
4972 74/jump-if-= break/disp8
4973 (lookup-or-create-constant *(edi+8) %ecx)
4974
4975
4976
4977
4978
4979
4980 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32
4981 }
4982
4983 ba/copy-to-edx 0/imm32/false
4984
4985 8b/-> *ecx 0/r32/eax
4986 8a/copy-byte *eax 0/r32/AL
4987 81 4/subop/and %eax 0xff/imm32
4988 3d/compare-eax-and 0x2a/imm32/asterisk
4989 {
4990 75/jump-if-!= break/disp8
4991 $add-operation-and-inputs-to-stmt:inout-is-deref:
4992 ff 0/subop/increment *ecx
4993 ba/copy-to-edx 1/imm32/true
4994 }
4995 (lookup-var-or-literal %ecx *(ebp+0x10))
4996 $add-operation-and-inputs-to-stmt:save-var:
4997 (append-stmt-var Heap %eax *(edi+8) %edx)
4998 89/<- *(edi+8) 0/r32/eax
4999 e9/jump loop/disp32
5000 }
5001 $add-operation-and-inputs-to-stmt:end:
5002
5003 81 0/subop/add %esp 8/imm32
5004
5005 5f/pop-to-edi
5006 5b/pop-to-ebx
5007 5a/pop-to-edx
5008 59/pop-to-ecx
5009 58/pop-to-eax
5010
5011 89/<- %esp 5/r32/ebp
5012 5d/pop-to-ebp
5013 c3/return
5014
5015 $add-operation-and-inputs-to-stmt:abort:
5016
5017 (rewind-stream *(ebp+8))
5018 (write-buffered Stderr "invalid identifier '")
5019 (flush Stderr)
5020 (write-stream 2 *(ebp+8))
5021 (write-buffered Stderr "'\n")
5022 (flush Stderr)
5023
5024 bb/copy-to-ebx 1/imm32
5025 b8/copy-to-eax 1/imm32/exit
5026 cd/syscall 0x80/imm8
5027
5028
5029 stmt-has-outputs?:
5030
5031 55/push-ebp
5032 89/<- %ebp 4/r32/esp
5033
5034 51/push-ecx
5035
5036 68/push 0/imm32/end
5037 68/push 0/imm32/start
5038 89/<- %ecx 4/r32/esp
5039
5040 b8/copy-to-eax 0/imm32/false
5041 (rewind-stream *(ebp+8))
5042 {
5043 (next-mu-token *(ebp+8) %ecx)
5044
5045 (slice-empty? %ecx)
5046 3d/compare-eax-and 0/imm32/false
5047 b8/copy-to-eax 0/imm32/false/result
5048 0f 85/jump-if-!= break/disp32
5049
5050
5051 8b/-> *ecx 0/r32/eax
5052 8a/copy-byte *eax 0/r32/AL
5053 81 4/subop/and %eax 0xff/imm32
5054
5055 3d/compare-eax-and 0x23/imm32/hash
5056 b8/copy-to-eax 0/imm32/false/result
5057 0f 84/jump-if-= break/disp32
5058
5059 (slice-equal? %ecx "<-")
5060 3d/compare-eax-and 0/imm32/false
5061 74/jump-if-= loop/disp8
5062 b8/copy-to-eax 1/imm32/true
5063 }
5064 $stmt-has-outputs:end:
5065 (rewind-stream *(ebp+8))
5066
5067 81 0/subop/add %esp 8/imm32
5068
5069 59/pop-to-ecx
5070
5071 89/<- %esp 5/r32/ebp
5072 5d/pop-to-ebp
5073 c3/return
5074
5075
5076
5077 lookup-var-or-literal:
5078
5079 55/push-ebp
5080 89/<- %ebp 4/r32/esp
5081
5082 51/push-ecx
5083 56/push-esi
5084
5085 8b/-> *(ebp+8) 6/r32/esi
5086
5087 (slice-empty? %esi)
5088 3d/compare-eax-and 0/imm32/false
5089 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32
5090
5091 8b/-> *esi 1/r32/ecx
5092 8a/copy-byte *ecx 1/r32/CL
5093 81 4/subop/and %ecx 0xff/imm32
5094
5095 {
5096 (is-decimal-digit? %ecx)
5097 3d/compare-eax-and 0/imm32/false
5098 74/jump-if-= break/disp8
5099 (new-literal-integer Heap %esi)
5100 eb/jump $lookup-var-or-literal:end/disp8
5101 }
5102
5103 {
5104 81 7/subop/compare %ecx 0x22/imm32/dquote
5105 75/jump-if-!= break/disp8
5106 (new-literal Heap %esi)
5107 eb/jump $lookup-var-or-literal:end/disp8
5108 }
5109
5110 {
5111 (lookup-var %esi *(ebp+0xc))
5112 }
5113 $lookup-var-or-literal:end:
5114
5115 5e/pop-to-esi
5116 59/pop-to-ecx
5117
5118 89/<- %esp 5/r32/ebp
5119 5d/pop-to-ebp
5120 c3/return
5121
5122 $lookup-var-or-literal:abort:
5123 (write-buffered Stderr "empty variable!")
5124 (flush Stderr)
5125
5126 bb/copy-to-ebx 1/imm32
5127 b8/copy-to-eax 1/imm32/exit
5128 cd/syscall 0x80/imm8
5129
5130
5131
5132 lookup-var:
5133
5134 55/push-ebp
5135 89/<- %ebp 4/r32/esp
5136
5137 (slice-to-string Heap *(ebp+8))
5138
5139 (lookup-var-helper %eax *(ebp+0xc))
5140
5141 3d/compare-eax-and 0/imm32
5142 74/jump-if-= $lookup-var:abort/disp8
5143 $lookup-var:end:
5144
5145 89/<- %esp 5/r32/ebp
5146 5d/pop-to-ebp
5147 c3/return
5148
5149 $lookup-var:abort:
5150 (write-buffered Stderr "unknown variable '")
5151 (write-slice-buffered Stderr *(ebp+8))
5152 (write-buffered Stderr "'\n")
5153 (flush Stderr)
5154
5155 bb/copy-to-ebx 1/imm32
5156 b8/copy-to-eax 1/imm32/exit
5157 cd/syscall 0x80/imm8
5158
5159
5160
5161 lookup-var-helper:
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172 55/push-ebp
5173 89/<- %ebp 4/r32/esp
5174
5175 52/push-edx
5176 53/push-ebx
5177 56/push-esi
5178
5179 8b/-> *(ebp+0xc) 6/r32/esi
5180
5181 8b/-> *esi 3/r32/ebx
5182
5183 3b/compare 0/r32/eax *(esi+4)
5184 0f 8f/jump-if-> $lookup-var-helper:error1/disp32
5185
5186 8d/copy-address *(esi+8) 2/r32/edx
5187
5188 81 5/subop/subtract %ebx 4/imm32
5189 8d/copy-address *(esi+ebx+8) 3/r32/ebx
5190 {
5191
5192 39/compare %ebx 2/r32/edx
5193 b8/copy-to-eax 0/imm32
5194 0f 82/jump-if-addr< break/disp32
5195
5196 8b/-> *ebx 0/r32/eax
5197
5198 (string-equal? *eax *(ebp+8))
5199 3d/compare-eax-and 0/imm32/false
5200 8b/-> *ebx 0/r32/eax
5201 75/jump-if-!= break/disp8
5202
5203 81 5/subop/subtract %ebx 4/imm32
5204 e9/jump loop/disp32
5205 }
5206 $lookup-var-helper:end:
5207
5208 5e/pop-to-esi
5209 5b/pop-to-ebx
5210 5a/pop-to-edx
5211
5212 89/<- %esp 5/r32/ebp
5213 5d/pop-to-ebp
5214 c3/return
5215
5216 $lookup-var-helper:error1:
5217 (write-buffered Stderr "malformed stack when looking up '")
5218 (write-slice-buffered Stderr *(ebp+8))
5219 (write-buffered Stderr "'\n")
5220 (flush Stderr)
5221
5222 bb/copy-to-ebx 1/imm32
5223 b8/copy-to-eax 1/imm32/exit
5224 cd/syscall 0x80/imm8
5225
5226
5227
5228 lookup-or-define-var:
5229
5230 55/push-ebp
5231 89/<- %ebp 4/r32/esp
5232
5233 51/push-ecx
5234
5235 (slice-to-string Heap *(ebp+8))
5236 89/<- %ecx 0/r32/eax
5237
5238 (lookup-var-helper %ecx *(ebp+0xc))
5239 {
5240
5241 3d/compare-eax-and 0/imm32
5242 75/jump-if-!= break/disp8
5243
5244 {
5245 (find-in-function-outputs *(ebp+0x10) %ecx)
5246 3d/compare-eax-and 0/imm32
5247
5248 0f 84/jump-if-!= $lookup-var:abort/disp32
5249 }
5250 }
5251 $lookup-or-define-var:end:
5252
5253 59/pop-to-ecx
5254
5255 89/<- %esp 5/r32/ebp
5256 5d/pop-to-ebp
5257 c3/return
5258
5259 find-in-function-outputs:
5260
5261 55/push-ebp
5262 89/<- %ebp 4/r32/esp
5263
5264 51/push-ecx
5265
5266 8b/-> *(ebp+8) 1/r32/ecx
5267 8b/-> *(ecx+0xc) 1/r32/ecx
5268
5269 {
5270 81 7/subop/compare %ecx 0/imm32
5271 74/jump-if-= break/disp8
5272
5273 8b/-> *ecx 0/r32/eax
5274
5275 50/push-eax
5276 (string-equal? *eax *(ebp+0xc))
5277 3d/compare-eax-and 0/imm32/false
5278 58/pop-to-eax
5279 75/jump-if-!= $find-in-function-outputs:end/disp8
5280
5281 8b/-> *(ecx+4) 1/r32/ecx
5282 eb/jump loop/disp8
5283 }
5284 b8/copy-to-eax 0/imm32
5285 $find-in-function-outputs:end:
5286
5287 59/pop-to-ecx
5288
5289 89/<- %esp 5/r32/ebp
5290 5d/pop-to-ebp
5291 c3/return
5292
5293 test-parse-mu-stmt:
5294
5295 55/push-ebp
5296 89/<- %ebp 4/r32/esp
5297
5298 (clear-stream _test-input-stream)
5299 (write _test-input-stream "increment n\n")
5300
5301 81 5/subop/subtract %esp 0x10/imm32
5302 68/push 0x10/imm32/length
5303 68/push 0/imm32/top
5304 89/<- %ecx 4/r32/esp
5305 (clear-stack %ecx)
5306
5307 81 5/subop/subtract %esp 0x14/imm32
5308 89/<- %edx 4/r32/esp
5309 (zero-out %edx 0x14)
5310
5311 c7 0/subop/copy *edx "n"/imm32
5312
5313 (push %ecx %edx)
5314
5315 (parse-mu-stmt _test-input-stream %ecx)
5316
5317 (check-ints-equal *eax 1 "F - test-parse-mu-stmt/tag")
5318 (check-strings-equal *(eax+4) "increment" "F - test-parse-mu-stmt/name")
5319
5320 8b/-> *(eax+8) 2/r32/edx
5321
5322 8b/-> *edx 3/r32/ebx
5323 (check-strings-equal *ebx "n" "F - test-parse-mu-stmt/inout:0")
5324
5325 89/<- %esp 5/r32/ebp
5326 5d/pop-to-ebp
5327 c3/return
5328
5329 test-parse-mu-stmt-with-comma:
5330
5331 55/push-ebp
5332 89/<- %ebp 4/r32/esp
5333
5334 (clear-stream _test-input-stream)
5335 (write _test-input-stream "copy-to n, 3\n")
5336
5337 81 5/subop/subtract %esp 0x10/imm32
5338 68/push 0x10/imm32/length
5339 68/push 0/imm32/top
5340 89/<- %ecx 4/r32/esp
5341 (clear-stack %ecx)
5342
5343 81 5/subop/subtract %esp 0x14/imm32
5344 89/<- %edx 4/r32/esp
5345 (zero-out %edx 0x14)
5346
5347 c7 0/subop/copy *edx "n"/imm32
5348
5349 (push %ecx %edx)
5350
5351 (parse-mu-stmt _test-input-stream %ecx)
5352
5353 (check-ints-equal *eax 1 "F - test-parse-mu-stmt-with-comma/tag")
5354 (check-strings-equal *(eax+4) "copy-to" "F - test-parse-mu-stmt-with-comma/name")
5355
5356 8b/-> *(eax+8) 2/r32/edx
5357
5358 8b/-> *edx 3/r32/ebx
5359 (check-strings-equal *ebx "n" "F - test-parse-mu-stmt-with-comma/inout:0")
5360
5361 89/<- %esp 5/r32/ebp
5362 5d/pop-to-ebp
5363 c3/return
5364
5365 new-function:
5366
5367 55/push-ebp
5368 89/<- %ebp 4/r32/esp
5369
5370 51/push-ecx
5371
5372 (allocate *(ebp+8) *Function-size)
5373 8b/-> *(ebp+0xc) 1/r32/ecx
5374 89/<- *eax 1/r32/ecx
5375 8b/-> *(ebp+0x10) 1/r32/ecx
5376 89/<- *(eax+4) 1/r32/ecx
5377 8b/-> *(ebp+0x14) 1/r32/ecx
5378 89/<- *(eax+8) 1/r32/ecx
5379 8b/-> *(ebp+0x18) 1/r32/ecx
5380 89/<- *(eax+0xc) 1/r32/ecx
5381 8b/-> *(ebp+0x1c) 1/r32/ecx
5382 89/<- *(eax+0x10) 1/r32/ecx
5383 8b/-> *(ebp+0x20) 1/r32/ecx
5384 89/<- *(eax+0x14) 1/r32/ecx
5385 $new-function:end:
5386
5387 59/pop-to-ecx
5388
5389 89/<- %esp 5/r32/ebp
5390 5d/pop-to-ebp
5391 c3/return
5392
5393 new-var:
5394
5395 55/push-ebp
5396 89/<- %ebp 4/r32/esp
5397
5398 51/push-ecx
5399
5400 (allocate *(ebp+8) *Var-size)
5401 (zero-out %eax *Var-size)
5402 8b/-> *(ebp+0xc) 1/r32/ecx
5403 89/<- *eax 1/r32/ecx
5404 $new-var:end:
5405
5406 59/pop-to-ecx
5407
5408 89/<- %esp 5/r32/ebp
5409 5d/pop-to-ebp
5410 c3/return
5411
5412 new-literal-integer:
5413
5414 55/push-ebp
5415 89/<- %ebp 4/r32/esp
5416
5417 51/push-ecx
5418
5419 (is-hex-int? *(ebp+0xc))
5420 3d/compare-eax-and 0/imm32/false
5421 0f 84/jump-if-= $new-literal-integer:abort/disp32
5422
5423 (allocate *(ebp+8) *Tree-size)
5424 (zero-out %eax *Tree-size)
5425 89/<- %ecx 0/r32/eax
5426
5427 (new-var-from-slice *(ebp+8) *(ebp+0xc))
5428 89/<- *(eax+4) 1/r32/ecx
5429 $new-literal-integer:end:
5430
5431 59/pop-to-ecx
5432
5433 89/<- %esp 5/r32/ebp
5434 5d/pop-to-ebp
5435 c3/return
5436
5437 $new-literal-integer:abort:
5438 (write-buffered Stderr "variable cannot begin with a digit '")
5439 (write-slice-buffered Stderr *(ebp+0xc))
5440 (write-buffered Stderr "'\n")
5441 (flush Stderr)
5442
5443 bb/copy-to-ebx 1/imm32
5444 b8/copy-to-eax 1/imm32/exit
5445 cd/syscall 0x80/imm8
5446
5447
5448 new-literal:
5449
5450 55/push-ebp
5451 89/<- %ebp 4/r32/esp
5452
5453 51/push-ecx
5454 52/push-edx
5455
5456 (slice-to-string Heap *(ebp+0xc))
5457 89/<- %ecx 0/r32/eax
5458
5459 (allocate *(ebp+8) *Tree-size)
5460 (zero-out %eax *Tree-size)
5461 89/<- %edx 0/r32/eax
5462
5463 (new-var *(ebp+8) %ecx)
5464
5465 89/<- *(eax+4) 2/r32/edx
5466 $new-literal:end:
5467
5468 5a/pop-to-edx
5469 59/pop-to-ecx
5470
5471 89/<- %esp 5/r32/ebp
5472 5d/pop-to-ebp
5473 c3/return
5474
5475 new-var-from-slice:
5476
5477 55/push-ebp
5478 89/<- %ebp 4/r32/esp
5479
5480 51/push-ecx
5481
5482 (slice-to-string Heap *(ebp+0xc))
5483 (new-var *(ebp+8) %eax)
5484 $new-var-from-slice:end:
5485
5486 59/pop-to-ecx
5487
5488 89/<- %esp 5/r32/ebp
5489 5d/pop-to-ebp
5490 c3/return
5491
5492 new-block:
5493
5494 55/push-ebp
5495 89/<- %ebp 4/r32/esp
5496
5497 51/push-ecx
5498
5499 (allocate *(ebp+8) *Stmt-size)
5500 (zero-out %eax *Stmt-size)
5501 c7 0/subop/copy *eax 0/imm32/tag/block
5502 8b/-> *(ebp+0xc) 1/r32/ecx
5503 89/<- *(eax+4) 1/r32/ecx
5504 $new-block:end:
5505
5506 59/pop-to-ecx
5507
5508 89/<- %esp 5/r32/ebp
5509 5d/pop-to-ebp
5510 c3/return
5511
5512 new-var-def:
5513
5514 55/push-ebp
5515 89/<- %ebp 4/r32/esp
5516
5517 51/push-ecx
5518
5519 (allocate *(ebp+8) *Stmt-size)
5520 (zero-out %eax *Stmt-size)
5521 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack
5522
5523 8b/-> *(ebp+0xc) 1/r32/ecx
5524 89/<- *(eax+4) 1/r32/ecx
5525 $new-var-def:end:
5526
5527 59/pop-to-ecx
5528
5529 89/<- %esp 5/r32/ebp
5530 5d/pop-to-ebp
5531 c3/return
5532
5533 new-reg-var-def:
5534
5535 55/push-ebp
5536 89/<- %ebp 4/r32/esp
5537
5538 51/push-ecx
5539 57/push-edi
5540
5541 8b/-> *(ebp+0xc) 1/r32/ecx
5542
5543 (allocate *(ebp+8) *Stmt-size)
5544 89/<- %edi 0/r32/eax
5545 (zero-out %edi *Stmt-size)
5546
5547 c7 0/subop/copy *edi 3/imm32/tag/var-in-register
5548
5549 (append-stmt-var Heap %ecx *(edi+0xc) 0)
5550 89/<- *(edi+0xc) 0/r32/eax
5551 $new-reg-var-def:end:
5552 89/<- %eax 7/r32/edi
5553
5554 5f/pop-to-edi
5555 59/pop-to-ecx
5556
5557 89/<- %esp 5/r32/ebp
5558 5d/pop-to-ebp
5559 c3/return
5560
5561 append-list:
5562
5563 55/push-ebp
5564 89/<- %ebp 4/r32/esp
5565
5566 51/push-ecx
5567
5568 (allocate *(ebp+8) *List-size)
5569 (zero-out %eax *List-size)
5570 8b/-> *(ebp+0xc) 1/r32/ecx
5571 89/<- *eax 1/r32/ecx
5572
5573 81 7/subop/compare *(ebp+0x10) 0/imm32
5574 74/jump-if-= $append-list:end/disp8
5575
5576
5577 8b/-> *(ebp+0x10) 1/r32/ecx
5578
5579 {
5580 81 7/subop/compare *(ecx+4) 0/imm32
5581 74/jump-if-= break/disp8
5582
5583 8b/-> *(ecx+4) 1/r32/ecx
5584 eb/jump loop/disp8
5585 }
5586
5587 89/<- *(ecx+4) 0/r32/eax
5588
5589 8b/-> *(ebp+0x10) 0/r32/eax
5590 $append-list:end:
5591
5592 59/pop-to-ecx
5593
5594 89/<- %esp 5/r32/ebp
5595 5d/pop-to-ebp
5596 c3/return
5597
5598 append-stmt-var:
5599
5600 55/push-ebp
5601 89/<- %ebp 4/r32/esp
5602
5603 51/push-ecx
5604
5605 (allocate *(ebp+8) *Stmt-var-size)
5606 (zero-out %eax *Stmt-var-size)
5607 8b/-> *(ebp+0xc) 1/r32/ecx
5608 89/<- *eax 1/r32/ecx
5609 8b/-> *(ebp+0x14) 1/r32/ecx
5610 89/<- *(eax+8) 1/r32/ecx
5611
5612 81 7/subop/compare *(ebp+0x10) 0/imm32
5613 74/jump-if-= $append-stmt-var:end/disp8
5614
5615
5616 8b/-> *(ebp+0x10) 1/r32/ecx
5617
5618 {
5619 81 7/subop/compare *(ecx+4) 0/imm32
5620 74/jump-if-= break/disp8
5621
5622 8b/-> *(ecx+4) 1/r32/ecx
5623 eb/jump loop/disp8
5624 }
5625
5626 89/<- *(ecx+4) 0/r32/eax
5627
5628 8b/-> *(ebp+0x10) 0/r32/eax
5629 $append-stmt-var:end:
5630
5631 59/pop-to-ecx
5632
5633 89/<- %esp 5/r32/ebp
5634 5d/pop-to-ebp
5635 c3/return
5636
5637 append-to-block:
5638
5639 55/push-ebp
5640 89/<- %ebp 4/r32/esp
5641
5642 56/push-esi
5643
5644 8b/-> *(ebp+0xc) 6/r32/esi
5645 (append-list *(ebp+8) *(ebp+0x10) *(esi+4))
5646 89/<- *(esi+4) 0/r32/eax
5647 $append-to-block:end:
5648
5649 5e/pop-to-esi
5650
5651 89/<- %esp 5/r32/ebp
5652 5d/pop-to-ebp
5653 c3/return
5654
5655
5656
5657
5658
5659
5660
5661 lookup-or-create-constant:
5662
5663 55/push-ebp
5664 89/<- %ebp 4/r32/esp
5665
5666 56/push-esi
5667
5668 (container-type *(ebp+8))
5669
5670
5671
5672
5673 89/<- %esi 0/r32/eax
5674
5675 (find-or-create-typeinfo %esi)
5676
5677
5678
5679
5680
5681 (find-or-create-typeinfo-output-var %eax *(ebp+0xc))
5682 $lookup-or-create-constant:end:
5683
5684 5e/pop-to-esi
5685
5686 89/<- %esp 5/r32/ebp
5687 5d/pop-to-ebp
5688 c3/return
5689
5690
5691
5692
5693
5694 container-type:
5695
5696 55/push-ebp
5697 89/<- %ebp 4/r32/esp
5698
5699 8b/-> *(ebp+8) 0/r32/eax
5700 8b/-> *eax 0/r32/eax
5701 8b/-> *(eax+4) 0/r32/eax
5702 {
5703 81 7/subop/compare *(eax+4) 0/imm32
5704 74/jump-if-= break/disp8
5705 8b/-> *(eax+4) 0/r32/eax
5706 8b/-> *eax 0/r32/eax
5707 }
5708 8b/-> *eax 0/r32/eax
5709 $container-type:end:
5710
5711 89/<- %esp 5/r32/ebp
5712 5d/pop-to-ebp
5713 c3/return
5714
5715 find-or-create-typeinfo:
5716
5717 55/push-ebp
5718 89/<- %ebp 4/r32/esp
5719
5720 51/push-ecx
5721
5722 (find-typeinfo *(ebp+8))
5723 {
5724
5725 3d/compare-eax-and 0/imm32
5726 75/jump-if-!= break/disp8
5727 $find-or-create-typeinfo:create:
5728 (allocate Heap *Typeinfo-size)
5729 (zero-out %eax *Typeinfo-size)
5730
5731 8b/-> *(ebp+8) 1/r32/ecx
5732 89/<- *eax 1/r32/ecx
5733
5734
5735 50/push-eax
5736 (new-stream Heap 0x40 *Typeinfo-fields-row-size)
5737 89/<- %ecx 0/r32/eax
5738 58/pop-to-eax
5739
5740 89/<- *(eax+4) 1/r32/ecx
5741
5742 8b/-> *_Program-types 1/r32/ecx
5743 89/<- *(eax+0xc) 1/r32/ecx
5744
5745 89/<- *_Program-types 0/r32/eax
5746 }
5747 $find-or-create-typeinfo:end:
5748
5749 59/pop-to-ecx
5750
5751 89/<- %esp 5/r32/ebp
5752 5d/pop-to-ebp
5753 c3/return
5754
5755 find-typeinfo:
5756
5757 55/push-ebp
5758 89/<- %ebp 4/r32/esp
5759
5760 51/push-ecx
5761
5762 8b/-> *(ebp+8) 1/r32/ecx
5763
5764 8b/-> *_Program-types 0/r32/eax
5765 {
5766
5767 3d/compare-eax-and 0/imm32
5768 74/jump-if-= break/disp8
5769
5770 39/compare *eax 1/r32/ecx
5771 0f 84/jump-if-= $find-or-create-typeinfo:end/disp32
5772
5773 8b/-> *(eax+0xc) 0/r32/eax
5774
5775 eb/jump loop/disp8
5776 }
5777 $find-typeinfo:end:
5778
5779 59/pop-to-ecx
5780
5781 89/<- %esp 5/r32/ebp
5782 5d/pop-to-ebp
5783 c3/return
5784
5785 find-or-create-typeinfo-output-var:
5786
5787 55/push-ebp
5788 89/<- %ebp 4/r32/esp
5789
5790 51/push-ecx
5791 56/push-esi
5792
5793 (find-or-create-typeinfo-fields *(ebp+8) *(ebp+0xc))
5794 89/<- %esi 0/r32/eax
5795
5796 {
5797 81 7/subop/compare *(esi+8) 0/imm32
5798 75/jump-if-!= break/disp8
5799
5800 (allocate Heap *Tree-size)
5801 c7 0/subop/copy *eax 6/imm32/constant
5802 c7 0/subop/copy *(eax+4) 0/imm32
5803 89/<- %ecx 0/r32/eax
5804
5805 (new-var Heap "field")
5806
5807 89/<- *(eax+4) 1/r32/ecx
5808
5809 c7 0/subop/copy *(eax+0xc) -1/imm32/uninitialized
5810
5811 89/<- *(esi+8) 0/r32/eax
5812 }
5813
5814 8b/-> *(esi+8) 0/r32/eax
5815 $find-or-create-typeinfo-output-var:end:
5816
5817 5e/pop-to-esi
5818 59/pop-to-ecx
5819
5820 89/<- %esp 5/r32/ebp
5821 5d/pop-to-ebp
5822 c3/return
5823
5824 find-or-create-typeinfo-fields:
5825
5826 55/push-ebp
5827 89/<- %ebp 4/r32/esp
5828
5829 56/push-esi
5830
5831 8b/-> *(ebp+8) 6/r32/esi
5832 8b/-> *(esi+4) 6/r32/esi
5833
5834 (leaky-get-or-insert-slice %esi *(ebp+0xc) *Typeinfo-fields-row-size)
5835 89/<- %esi 0/r32/eax
5836
5837 {
5838 81 7/subop/compare *esi 0/imm32
5839 75/jump-if-!= break/disp8
5840 (allocate Heap *Typeinfo-entry-size)
5841 (zero-out %eax *Typeinfo-entry-size)
5842 89/<- *esi 0/r32/eax
5843 }
5844
5845 8b/-> *esi 0/r32/eax
5846 $find-or-create-typeinfo-fields:end:
5847
5848 5e/pop-to-esi
5849
5850 89/<- %esp 5/r32/ebp
5851 5d/pop-to-ebp
5852 c3/return
5853
5854 populate-mu-type:
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880 55/push-ebp
5881 89/<- %ebp 4/r32/esp
5882
5883 68/push 0/imm32
5884
5885 50/push-eax
5886 51/push-ecx
5887 52/push-edx
5888 53/push-ebx
5889 56/push-esi
5890 57/push-edi
5891
5892 8b/-> *(ebp+0xc) 7/r32/edi
5893
5894 81 5/subop/subtract %esp 0x200/imm32
5895 68/push 0x200/imm32/length
5896 68/push 0/imm32/read
5897 68/push 0/imm32/write
5898 89/<- %ecx 4/r32/esp
5899
5900 68/push 0/imm32/end
5901 68/push 0/imm32/start
5902 89/<- %edx 4/r32/esp
5903 {
5904 $populate-mu-type:line-loop:
5905 (clear-stream %ecx)
5906 (read-line-buffered *(ebp+8) %ecx)
5907
5908 81 7/subop/compare *ecx 0/imm32
5909 0f 84/jump-if-= $populate-mu-type:abort/disp32
5910 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------
5916 (next-mu-token %ecx %edx)
5917
5918 (slice-empty? %edx)
5919 3d/compare-eax-and 0/imm32
5920 0f 85/jump-if-!= loop/disp32
5921
5922 (slice-equal? %edx "}")
5923 3d/compare-eax-and 0/imm32
5924 0f 85/jump-if-!= break/disp32
5925 $populate-mu-type:parse-element:
5926
5927 (parse-var-with-type %edx %ecx)
5928 89/<- %esi 0/r32/eax
5929 $populate-mu-type:create-typeinfo-fields:
5930
5931 (find-or-create-typeinfo-fields %edi %edx)
5932 89/<- %ebx 0/r32/eax
5933
5934
5935
5936
5937
5938
5939
5940 8b/-> *(ebp-4) 0/r32/eax
5941 89/<- *(ebx+4) 0/r32/eax
5942
5943 ff 0/subop/increment *(ebp-4)
5944 $populate-mu-type:set-input-type:
5945
5946 89/<- *ebx 6/r32/esi
5947 {
5948 $populate-mu-type:create-output-type:
5949
5950 81 7/subop/compare *(ebx+8) 0/imm32
5951 75/jump-if-!= break/disp8
5952 (new-literal Heap %edx)
5953 89/<- *(ebx+8) 0/r32/eax
5954 }
5955 e9/jump loop/disp32
5956 }
5957 $populate-mu-type:invalidate-total-size-in-bytes:
5958
5959
5960
5961 c7 0/subop/copy *(edi+8) -2/imm32/uninitialized
5962 $populate-mu-type:end:
5963
5964 81 0/subop/add %esp 0x214/imm32
5965
5966 5f/pop-to-edi
5967 5e/pop-to-esi
5968 5b/pop-to-ebx
5969 5a/pop-to-edx
5970 59/pop-to-ecx
5971 58/pop-to-eax
5972
5973 81 0/subop/add %esp 4/imm32
5974
5975 89/<- %esp 5/r32/ebp
5976 5d/pop-to-ebp
5977 c3/return
5978
5979 $populate-mu-type:abort:
5980
5981 (write-buffered Stderr "incomplete type definition '")
5982 (type-name *edi)
5983 (write-buffered Stderr %eax)
5984 (write-buffered Stderr "\n")
5985 (flush Stderr)
5986
5987 bb/copy-to-ebx 1/imm32
5988 b8/copy-to-eax 1/imm32/exit
5989 cd/syscall 0x80/imm8
5990
5991
5992 type-name:
5993
5994 55/push-ebp
5995 89/<- %ebp 4/r32/esp
5996
5997 (index Type-id *(ebp+8))
5998 $type-name:end:
5999
6000 89/<- %esp 5/r32/ebp
6001 5d/pop-to-ebp
6002 c3/return
6003
6004 index:
6005
6006 55/push-ebp
6007 89/<- %ebp 4/r32/esp
6008
6009 56/push-esi
6010
6011
6012 8b/-> *(ebp+8) 6/r32/esi
6013
6014 8b/-> *(ebp+0xc) 0/r32/eax
6015
6016 8b/-> *(esi+eax+0xc) 0/r32/eax
6017 $index:end:
6018
6019 5e/pop-to-esi
6020
6021 89/<- %esp 5/r32/ebp
6022 5d/pop-to-ebp
6023 c3/return
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034 populate-mu-type-sizes:
6035
6036 55/push-ebp
6037 89/<- %ebp 4/r32/esp
6038
6039 51/push-ecx
6040 $populate-mu-type-sizes:total-sizes:
6041
6042 8b/-> *_Program-types 1/r32/ecx
6043 {
6044
6045 81 7/subop/compare %ecx 0/imm32
6046 74/jump-if-= break/disp8
6047 (populate-mu-type-sizes-in-type %ecx)
6048
6049 8b/-> *(ecx+0xc) 1/r32/ecx
6050 eb/jump loop/disp8
6051 }
6052 $populate-mu-type-sizes:offsets:
6053
6054 8b/-> *_Program-types 1/r32/ecx
6055 {
6056
6057 81 7/subop/compare %ecx 0/imm32
6058 74/jump-if-= break/disp8
6059 (populate-mu-type-offsets %ecx)
6060
6061 8b/-> *(ecx+0xc) 1/r32/ecx
6062 eb/jump loop/disp8
6063 }
6064 $populate-mu-type-sizes:end:
6065
6066 59/pop-to-ecx
6067
6068 89/<- %esp 5/r32/ebp
6069 5d/pop-to-ebp
6070 c3/return
6071
6072
6073
6074
6075 populate-mu-type-sizes-in-type:
6076
6077 55/push-ebp
6078 89/<- %ebp 4/r32/esp
6079
6080 50/push-eax
6081 51/push-ecx
6082 52/push-edx
6083 56/push-esi
6084 57/push-edi
6085
6086 8b/-> *(ebp+8) 6/r32/esi
6087
6088 81 7/subop/compare *(esi+8) 0/imm32
6089 7d/jump-if->= $populate-mu-type-sizes-in-type:end/disp8
6090
6091 81 7/subop/compare *(esi+8) -1/imm32/being-computed
6092 74/jump-if-= $populate-mu-type-sizes-in-type:abort/disp8
6093
6094 c7 0/subop/copy *(esi+8) -1/imm32/being-computed
6095
6096 bf/copy-to-edi 0/imm32
6097
6098
6099 8b/-> *(esi+4) 1/r32/ecx
6100
6101 8b/-> *ecx 2/r32/edx
6102
6103 8d/copy-address *(ecx+0xc) 1/r32/ecx
6104
6105 8d/copy-address *(ecx+edx) 2/r32/edx
6106 {
6107 $populate-mu-type-sizes-in-type:loop:
6108
6109 39/compare %ecx 2/r32/edx
6110 73/jump-if-addr>= break/disp8
6111
6112 8b/-> *(ecx+4) 0/r32/eax
6113
6114 (compute-size-of-var *eax)
6115
6116 01/add-to %edi 0/r32/eax
6117
6118 81 0/subop/add %ecx 8/imm32
6119
6120 eb/jump loop/disp8
6121 }
6122
6123 89/<- *(esi+8) 7/r32/edi
6124 $populate-mu-type-sizes-in-type:end:
6125
6126 5f/pop-to-edi
6127 5e/pop-to-esi
6128 5a/pop-to-edx
6129 59/pop-to-ecx
6130 58/pop-to-eax
6131
6132 89/<- %esp 5/r32/ebp
6133 5d/pop-to-ebp
6134 c3/return
6135
6136 $populate-mu-type-sizes-in-type:abort:
6137 (write-buffered Stderr "cycle in type definitions\n")
6138 (flush Stderr)
6139
6140 bb/copy-to-ebx 1/imm32
6141 b8/copy-to-eax 1/imm32/exit
6142 cd/syscall 0x80/imm8
6143
6144
6145
6146
6147 compute-size-of-var:
6148
6149 55/push-ebp
6150 89/<- %ebp 4/r32/esp
6151
6152 51/push-ecx
6153
6154 8b/-> *(ebp+8) 1/r32/ecx
6155 8b/-> *(ecx+4) 1/r32/ecx
6156
6157 {
6158 8b/-> *Max-type-id 0/r32/eax
6159 39/compare *ecx 0/r32/eax
6160 72/jump-if-addr< break/disp8
6161 8b/-> *ecx 1/r32/ecx
6162 }
6163 (compute-size-of-type-id *ecx)
6164 $compute-size-of-var:end:
6165
6166 59/pop-to-ecx
6167
6168 89/<- %esp 5/r32/ebp
6169 5d/pop-to-ebp
6170 c3/return
6171
6172 compute-size-of-type-id:
6173
6174 55/push-ebp
6175 89/<- %ebp 4/r32/esp
6176
6177 8b/-> *(ebp+8) 0/r32/eax
6178
6179 3d/compare-eax-and 0/imm32
6180 74/jump-if-= $compute-size-of-type-id:end/disp8
6181
6182
6183 (find-typeinfo %eax)
6184 {
6185 3d/compare-eax-and 0/imm32
6186 74/jump-if-= break/disp8
6187 $compute-size-of-type-id:user-defined:
6188 (populate-mu-type-sizes %eax)
6189 8b/-> *(eax+8) 0/r32/eax
6190 eb/jump $compute-size-of-type-id:end/disp8
6191 }
6192
6193 b8/copy-to-eax 4/imm32
6194 $compute-size-of-type-id:end:
6195
6196 89/<- %esp 5/r32/ebp
6197 5d/pop-to-ebp
6198 c3/return
6199
6200
6201
6202
6203 populate-mu-type-offsets:
6204
6205 55/push-ebp
6206 89/<- %ebp 4/r32/esp
6207
6208 50/push-eax
6209 51/push-ecx
6210 52/push-edx
6211 53/push-ebx
6212 56/push-esi
6213 57/push-edi
6214
6215 bf/copy-to-edi 0/imm32
6216
6217 8b/-> *(ebp+8) 1/r32/ecx
6218 8b/-> *(ecx+4) 1/r32/ecx
6219
6220 8b/-> *ecx 2/r32/edx
6221 c1 5/subop/shift-right-logical %edx 3/imm8
6222
6223 bb/copy-to-ebx 0/imm32
6224 {
6225 $populate-mu-type-offsets:loop:
6226 39/compare %ebx 2/r32/edx
6227 7d/jump-if->= break/disp8
6228
6229 (locate-typeinfo-entry-with-index %ecx %ebx)
6230 89/<- %esi 0/r32/eax
6231
6232 8b/-> *(esi+8) 0/r32/eax
6233 89/<- *(eax+0xc) 7/r32/edi
6234
6235 8b/-> *esi 0/r32/eax
6236 (size-of %eax)
6237 01/add-to %edi 0/r32/eax
6238
6239 43/increment-ebx
6240 eb/jump loop/disp8
6241 }
6242 $populate-mu-type-offsets:end:
6243
6244 5f/pop-to-edi
6245 5e/pop-to-esi
6246 5b/pop-to-ebx
6247 5a/pop-to-edx
6248 59/pop-to-ecx
6249 58/pop-to-eax
6250
6251 89/<- %esp 5/r32/ebp
6252 5d/pop-to-ebp
6253 c3/return
6254
6255 locate-typeinfo-entry-with-index:
6256
6257 55/push-ebp
6258 89/<- %ebp 4/r32/esp
6259
6260 51/push-ecx
6261 52/push-edx
6262 53/push-ebx
6263 56/push-esi
6264 57/push-edi
6265
6266 8b/-> *(ebp+8) 6/r32/esi
6267
6268 8d/copy-address *(esi+0xc) 1/r32/ecx
6269
6270 8b/-> *esi 2/r32/edx
6271 8d/copy-address *(ecx+edx) 2/r32/edx
6272 {
6273 $locate-typeinfo-entry-with-index:loop:
6274 39/compare %ecx 2/r32/edx
6275 73/jump-if-addr>= $locate-typeinfo-entry-with-index:abort/disp8
6276
6277 8b/-> *(ecx+4) 3/r32/ebx
6278
6279 8b/-> *(ebx+4) 0/r32/eax
6280 39/compare *(ebp+0xc) 0/r32/eax
6281 89/<- %eax 3/r32/ebx
6282 74/jump-if-= break/disp8
6283
6284 81 0/subop/add %ecx 8/imm32
6285 eb/jump loop/disp8
6286 }
6287 $locate-typeinfo-entry-with-index:end:
6288
6289 5f/pop-to-edi
6290 5e/pop-to-esi
6291 5b/pop-to-ebx
6292 5a/pop-to-edx
6293 59/pop-to-ecx
6294
6295 89/<- %esp 5/r32/ebp
6296 5d/pop-to-ebp
6297 c3/return
6298
6299 $locate-typeinfo-entry-with-index:abort:
6300 (write-buffered Stderr "overflowing typeinfo-entry->index ")
6301 (print-int32-buffered Stderr %ecx)
6302 (write-buffered Stderr "\n")
6303 (flush Stderr)
6304
6305 bb/copy-to-ebx 1/imm32
6306 b8/copy-to-eax 1/imm32/exit
6307 cd/syscall 0x80/imm8
6308
6309
6310
6311
6312
6313
6314 check-mu-types:
6315
6316 55/push-ebp
6317 89/<- %ebp 4/r32/esp
6318
6319 $check-mu-types:end:
6320
6321 89/<- %esp 5/r32/ebp
6322 5d/pop-to-ebp
6323 c3/return
6324
6325 size-of:
6326
6327 55/push-ebp
6328 89/<- %ebp 4/r32/esp
6329
6330 51/push-ecx
6331
6332 8b/-> *(ebp+8) 1/r32/ecx
6333 8b/-> *(ecx+4) 1/r32/ecx
6334
6335 {
6336 (is-mu-array? %ecx)
6337 3d/compare-eax-and 0/imm32/false
6338 74/jump-if-= break/disp8
6339 (size-of-array %ecx)
6340 eb/jump $size-of:end/disp8
6341 }
6342
6343 {
6344 8b/-> *Max-type-id 0/r32/eax
6345 39/compare *ecx 0/r32/eax
6346 72/jump-if-addr< break/disp8
6347 8b/-> *ecx 1/r32/ecx
6348 }
6349 (size-of-type-id *ecx)
6350 $size-of:end:
6351
6352 59/pop-to-ecx
6353
6354 89/<- %esp 5/r32/ebp
6355 5d/pop-to-ebp
6356 c3/return
6357
6358 is-mu-array?:
6359
6360 55/push-ebp
6361 89/<- %ebp 4/r32/esp
6362
6363 51/push-ecx
6364
6365 8b/-> *(ebp+8) 1/r32/ecx
6366 8b/-> *ecx 1/r32/ecx
6367
6368 3b/compare 1/r32/ecx *Max-type-id
6369 b8/copy-to-eax 0/imm32/false
6370 72/jump-if-addr< $is-mu-array?:end/disp8
6371
6372 81 7/subop/compare *ecx 3/imm32/array-type-id
6373 0f 94/set-if-= %al
6374 81 4/subop/and %eax 0xff/imm32
6375 $is-mu-array?:end:
6376
6377 59/pop-to-ecx
6378
6379 89/<- %esp 5/r32/ebp
6380 5d/pop-to-ebp
6381 c3/return
6382
6383 size-of-array:
6384
6385 55/push-ebp
6386 89/<- %ebp 4/r32/esp
6387
6388 51/push-ecx
6389 52/push-edx
6390
6391 8b/-> *(ebp+8) 1/r32/ecx
6392
6393 8b/-> *(ecx+4) 1/r32/ecx
6394
6395 8b/-> *ecx 2/r32/edx
6396 8b/-> *edx 2/r32/edx
6397
6398 8b/-> *(ecx+4) 1/r32/ecx
6399 8b/-> *ecx 1/r32/ecx
6400 8b/-> *ecx 1/r32/ecx
6401
6402 (size-of-type-id %edx)
6403 f7 4/subop/multiply-into-eax %ecx
6404 05/add-to-eax 4/imm32
6405 $size-of-array:end:
6406
6407 5a/pop-to-edx
6408 59/pop-to-ecx
6409
6410 89/<- %esp 5/r32/ebp
6411 5d/pop-to-ebp
6412 c3/return
6413
6414 size-of-type-id:
6415
6416 55/push-ebp
6417 89/<- %ebp 4/r32/esp
6418
6419 8b/-> *(ebp+8) 0/r32/eax
6420
6421 3d/compare-eax-and 0/imm32
6422 74/jump-if-= $size-of-type-id:end/disp8
6423
6424
6425 (find-typeinfo %eax)
6426 {
6427 3d/compare-eax-and 0/imm32
6428 74/jump-if-= break/disp8
6429 $size-of-type-id:user-defined:
6430 8b/-> *(eax+8) 0/r32/eax
6431 eb/jump $size-of-type-id:end/disp8
6432 }
6433
6434 b8/copy-to-eax 4/imm32
6435 $size-of-type-id:end:
6436
6437 89/<- %esp 5/r32/ebp
6438 5d/pop-to-ebp
6439 c3/return
6440
6441 type-equal?:
6442
6443 55/push-ebp
6444 89/<- %ebp 4/r32/esp
6445
6446 51/push-ecx
6447 52/push-edx
6448
6449 8b/-> *(ebp+8) 1/r32/ecx
6450
6451 8b/-> *(ebp+0xc) 2/r32/edx
6452
6453 8b/-> %ecx 0/r32/eax
6454 39/compare %edx 0/r32/eax
6455 b8/copy-to-eax 1/imm32/true
6456 74/jump-if-= $type-equal?:end/disp8
6457
6458 81 7/subop/compare %ecx 0x10000/imm32
6459 b8/copy-to-eax 0/imm32/false
6460 72/jump-if-addr< $type-equal?:end/disp8
6461
6462 81 7/subop/compare %edx 0x10000/imm32
6463 b8/copy-to-eax 0/imm32/false
6464 72/jump-if-addr< $type-equal?:end/disp8
6465
6466 (type-equal? *ecx *edx)
6467 3d/compare-eax-and 0/imm32/false
6468 74/jump-if-= $type-equal?:end/disp8
6469
6470 (type-equal? *(ecx+4) *(edx+4))
6471 $type-equal?:end:
6472
6473 5a/pop-to-edx
6474 59/pop-to-ecx
6475
6476 89/<- %esp 5/r32/ebp
6477 5d/pop-to-ebp
6478 c3/return
6479
6480
6481
6482
6483
6484 == data
6485
6486 Curr-block-depth:
6487 0/imm32
6488 Curr-local-stack-offset:
6489 0/imm32
6490
6491 == code
6492
6493 emit-subx:
6494
6495 55/push-ebp
6496 89/<- %ebp 4/r32/esp
6497
6498 50/push-eax
6499 51/push-ecx
6500 57/push-edi
6501
6502 8b/-> *(ebp+8) 7/r32/edi
6503
6504 8b/-> *_Program-functions 1/r32/ecx
6505 {
6506
6507 81 7/subop/compare %ecx 0/imm32
6508 0f 84/jump-if-= break/disp32
6509 (emit-subx-function %edi %ecx)
6510
6511 8b/-> *(ecx+0x14) 1/r32/ecx
6512 e9/jump loop/disp32
6513 }
6514 $emit-subx:end:
6515
6516 5f/pop-to-edi
6517 59/pop-to-ecx
6518 58/pop-to-eax
6519
6520 89/<- %esp 5/r32/ebp
6521 5d/pop-to-ebp
6522 c3/return
6523
6524 emit-subx-function:
6525
6526 55/push-ebp
6527 89/<- %ebp 4/r32/esp
6528
6529 (populate-mu-type-offsets-in-inouts *(ebp+0xc))
6530
6531 50/push-eax
6532 51/push-ecx
6533 52/push-edx
6534 57/push-edi
6535
6536 8b/-> *(ebp+8) 7/r32/edi
6537
6538 8b/-> *(ebp+0xc) 1/r32/ecx
6539
6540 81 5/subop/subtract %esp 0x400/imm32
6541 68/push 0x400/imm32/length
6542 68/push 0/imm32/top
6543 89/<- %edx 4/r32/esp
6544
6545 (write-buffered %edi *ecx)
6546 (write-buffered %edi ":\n")
6547
6548 c7 0/subop/copy *Curr-block-depth 1/imm32
6549 c7 0/subop/copy *Curr-local-stack-offset 0/imm32
6550
6551 (emit-subx-prologue %edi)
6552 (emit-subx-block %edi *(ecx+0x10) %edx)
6553 (emit-subx-epilogue %edi)
6554
6555
6556 $emit-subx-function:end:
6557
6558 81 0/subop/add %esp 408/imm32
6559
6560 5f/pop-to-edi
6561 5a/pop-to-edx
6562 59/pop-to-ecx
6563 58/pop-to-eax
6564
6565 89/<- %esp 5/r32/ebp
6566 5d/pop-to-ebp
6567 c3/return
6568
6569 populate-mu-type-offsets-in-inouts:
6570
6571 55/push-ebp
6572 89/<- %ebp 4/r32/esp
6573
6574 50/push-eax
6575 51/push-ecx
6576 52/push-edx
6577 53/push-ebx
6578 57/push-edi
6579
6580 ba/copy-to-edx 8/imm32
6581
6582 8b/-> *(ebp+8) 1/r32/ecx
6583 8b/-> *(ecx+8) 1/r32/ecx
6584 {
6585 $populate-mu-type-offsets-in-inouts:loop:
6586 81 7/subop/compare %ecx 0/imm32
6587 74/jump-if-= break/disp8
6588
6589 8b/-> *ecx 3/r32/ebx
6590
6591 89/<- *(ebx+0xc) 2/r32/edx
6592
6593 (size-of %ebx)
6594 01/add %edx 0/r32/eax
6595
6596 8b/-> *(ecx+4) 1/r32/ecx
6597 eb/jump loop/disp8
6598 }
6599 $populate-mu-type-offsets-in-inouts:end:
6600
6601 5f/pop-to-edi
6602 5b/pop-to-ebx
6603 5a/pop-to-edx
6604 59/pop-to-ecx
6605 58/pop-to-eax
6606
6607 89/<- %esp 5/r32/ebp
6608 5d/pop-to-ebp
6609 c3/return
6610
6611 emit-subx-stmt-list:
6612
6613 55/push-ebp
6614 89/<- %ebp 4/r32/esp
6615
6616 50/push-eax
6617 51/push-ecx
6618 52/push-edx
6619 53/push-ebx
6620 56/push-esi
6621
6622 8b/-> *(ebp+0xc) 6/r32/esi
6623
6624 ba/copy-to-edx 0/imm32/false
6625
6626 {
6627 $emit-subx-stmt-list:loop:
6628 81 7/subop/compare %esi 0/imm32
6629 0f 84/jump-if-= break/disp32
6630
6631 8b/-> *esi 1/r32/ecx
6632 {
6633 $emit-subx-stmt-list:check-for-block:
6634 81 7/subop/compare *ecx 0/imm32/block
6635 75/jump-if-!= break/disp8
6636 $emit-subx-stmt-list:block:
6637 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10))
6638 }
6639 {
6640 $emit-subx-stmt-list:check-for-stmt:
6641 81 7/subop/compare *ecx 1/imm32/stmt1
6642 0f 85/jump-if-!= break/disp32
6643 $emit-subx-stmt-list:stmt1:
6644 {
6645 (is-mu-branch? %ecx)
6646 3d/compare-eax-and 0/imm32/false
6647 0f 84/jump-if-= break/disp32
6648 $emit-subx-stmt-list:branch-stmt:
6649
6650 81 7/subop/compare %edx 0/imm32/false
6651 0f 84/jump-if-= break/disp32
6652 $emit-subx-stmt-list:branch-stmt-and-var-seen:
6653 +-- 26 lines: # unconditional loops -----------------------------------------------------------------------------------------------------------------------------------------------------
6679 +-- 15 lines: # unconditional breaks ----------------------------------------------------------------------------------------------------------------------------------------------------
6694 +-- 37 lines: # simple conditional branches without a target ----------------------------------------------------------------------------------------------------------------------------
6731 +-- 19 lines: # conditional branches with an explicit target ----------------------------------------------------------------------------------------------------------------------------
6750 }
6751 $emit-subx-stmt-list:1-to-1:
6752 (emit-subx-stmt *(ebp+8) %ecx Primitives *_Program-functions)
6753 }
6754 {
6755 $emit-subx-stmt-list:check-for-var-def:
6756 81 7/subop/compare *ecx 2/imm32/var-def
6757 75/jump-if-!= break/disp8
6758 $emit-subx-stmt-list:var-def:
6759 (emit-subx-var-def *(ebp+8) %ecx)
6760 (push *(ebp+0x10) *(ecx+4))
6761
6762 ba/copy-to-edx 1/imm32/true
6763 }
6764 {
6765 $emit-subx-stmt-list:check-for-reg-var-def:
6766 81 7/subop/compare *ecx 3/imm32/reg-var-def
6767 0f 85/jump-if-!= break/disp32
6768 $emit-subx-stmt-list:reg-var-def:
6769
6770 (compute-reg-and-maybe-emit-spill *(ebp+8) %ecx *(ebp+0x10))
6771
6772 (push *(ebp+0x10) %eax)
6773
6774 (emit-subx-stmt *(ebp+8) %ecx Primitives *_Program-functions)
6775
6776 ba/copy-to-edx 1/imm32/true
6777 }
6778 $emit-subx-stmt-list:continue:
6779
6780 8b/-> *(esi+4) 6/r32/esi
6781 e9/jump loop/disp32
6782 }
6783 $emit-subx-stmt-list:emit-cleanup:
6784 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth)
6785 $emit-subx-stmt-list:cleanup:
6786 (clean-up-blocks *(ebp+0x10) *Curr-block-depth)
6787 $emit-subx-stmt-list:end:
6788
6789 5e/pop-to-esi
6790 5b/pop-to-ebx
6791 5a/pop-to-edx
6792 59/pop-to-ecx
6793 58/pop-to-eax
6794
6795 89/<- %esp 5/r32/ebp
6796 5d/pop-to-ebp
6797 c3/return
6798
6799 compute-reg-and-maybe-emit-spill:
6800
6801 55/push-ebp
6802 89/<- %ebp 4/r32/esp
6803
6804 51/push-ecx
6805
6806 8b/-> *(ebp+0xc) 1/r32/ecx
6807
6808 8b/-> *(ecx+0xc) 1/r32/ecx
6809 8b/-> *ecx 1/r32/ecx
6810
6811 8b/-> *Curr-block-depth 0/r32/eax
6812 89/<- *(ecx+8) 0/r32/eax
6813
6814 8b/-> *(ecx+0x10) 0/r32/eax
6815
6816 3d/compare-eax-and 0/imm32
6817 0f 84/jump-if-= $compute-reg-and-maybe-emit-spill:abort/disp32
6818
6819 (already-spilled-this-block? %ecx *(ebp+0x10))
6820 3d/compare-eax-and 0/imm32/false
6821 75/jump-if-!= $compute-reg-and-maybe-emit-spill:end/disp8
6822
6823
6824 81 5/subop/subtract *Curr-local-stack-offset 4/imm32
6825
6826 (emit-indent *(ebp+8) *Curr-block-depth)
6827 (write-buffered *(ebp+8) "ff 6/subop/push %")
6828 (write-buffered *(ebp+8) *(ecx+0x10))
6829 (write-buffered *(ebp+8) Newline)
6830 $compute-reg-and-maybe-emit-spill:end:
6831
6832 89/<- %eax 1/r32/ecx
6833
6834 59/pop-to-ecx
6835
6836 89/<- %esp 5/r32/ebp
6837 5d/pop-to-ebp
6838 c3/return
6839
6840 $compute-reg-and-maybe-emit-spill:abort:
6841
6842 (write-buffered Stderr "var '")
6843 (write-buffered Stderr *eax)
6844 (write-buffered Stderr "' initialized from an instruction must live in a register\n")
6845 (flush Stderr)
6846
6847 bb/copy-to-ebx 1/imm32
6848 b8/copy-to-eax 1/imm32/exit
6849 cd/syscall 0x80/imm8
6850
6851
6852 emit-subx-cleanup-and-unconditional-nonlocal-branch:
6853
6854 55/push-ebp
6855 89/<- %ebp 4/r32/esp
6856
6857 50/push-eax
6858 51/push-ecx
6859 52/push-edx
6860
6861 8b/-> *(ebp+0xc) 1/r32/ecx
6862
6863 8b/-> *(ecx+8) 2/r32/edx
6864 8b/-> *edx 2/r32/edx
6865 8b/-> *edx 2/r32/edx
6866
6867 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %edx)
6868
6869 (emit-indent *(ebp+8) *Curr-block-depth)
6870 (write-buffered *(ebp+8) "e9/jump ")
6871 (write-buffered *(ebp+8) %edx)
6872 (string-starts-with? *(ecx+4) "break")
6873 3d/compare-eax-and 0/imm32/false
6874 {
6875 74/jump-if-= break/disp8
6876 (write-buffered *(ebp+8) ":break/disp32\n")
6877 }
6878 3d/compare-eax-and 0/imm32/false
6879 {
6880 75/jump-if-!= break/disp8
6881 (write-buffered *(ebp+8) ":loop/disp32\n")
6882 }
6883 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end:
6884
6885 5a/pop-to-edx
6886 59/pop-to-ecx
6887 58/pop-to-eax
6888
6889 89/<- %esp 5/r32/ebp
6890 5d/pop-to-ebp
6891 c3/return
6892
6893 is-mu-branch?:
6894
6895 55/push-ebp
6896 89/<- %ebp 4/r32/esp
6897
6898 51/push-ecx
6899
6900 8b/-> *(ebp+8) 1/r32/ecx
6901
6902 (string-starts-with? *(ecx+4) "loop")
6903 3d/compare-eax-and 0/imm32/false
6904 75/jump-if-not-equal $is-mu-branch?:end/disp8
6905
6906 (string-starts-with? *(ecx+4) "break")
6907 $is-mu-branch?:end:
6908
6909 59/pop-to-ecx
6910
6911 89/<- %esp 5/r32/ebp
6912 5d/pop-to-ebp
6913 c3/return
6914
6915 emit-reverse-break:
6916
6917 55/push-ebp
6918 89/<- %ebp 4/r32/esp
6919
6920 50/push-eax
6921
6922 8b/-> *(ebp+0xc) 0/r32/eax
6923
6924 (get Reverse-branch *(eax+4) 8 "reverse-branch: ")
6925 (emit-indent *(ebp+8) *Curr-block-depth)
6926 (write-buffered *(ebp+8) *eax)
6927 (write-buffered *(ebp+8) " break/disp32\n")
6928 $emit-reverse-break:end:
6929
6930 58/pop-to-eax
6931
6932 89/<- %esp 5/r32/ebp
6933 5d/pop-to-ebp
6934 c3/return
6935
6936 == data
6937
6938 Reverse-branch:
6939
6940 0xa0/imm32/write
6941 0/imm32/read
6942 0xa0/imm32/length
6943
6944 "break-if-="/imm32 "0f 85/jump-if-!="/imm32
6945 "loop-if-="/imm32 "0f 85/jump-if-!="/imm32
6946 "break-if-!="/imm32 "0f 84/jump-if-="/imm32
6947 "loop-if-!="/imm32 "0f 84/jump-if-="/imm32
6948 "break-if-<"/imm32 "0f 8d/jump-if->="/imm32
6949 "loop-if-<"/imm32 "0f 8d/jump-if->="/imm32
6950 "break-if->"/imm32 "0f 8e/jump-if-<="/imm32
6951 "loop-if->"/imm32 "0f 8e/jump-if-<="/imm32
6952 "break-if-<="/imm32 "0f 87/jump-if->"/imm32
6953 "loop-if-<="/imm32 "0f 87/jump-if->"/imm32
6954 "break-if->="/imm32 "0f 8c/jump-if-<"/imm32
6955 "loop-if->="/imm32 "0f 8c/jump-if-<"/imm32
6956 "break-if-addr<"/imm32 "0f 83/jump-if-addr>="/imm32
6957 "loop-if-addr<"/imm32 "0f 83/jump-if-addr>="/imm32
6958 "break-if-addr>"/imm32 "0f 86/jump-if-addr<="/imm32
6959 "loop-if-addr>"/imm32 "0f 86/jump-if-addr<="/imm32
6960 "break-if-addr<="/imm32 "0f 87/jump-if-addr>"/imm32
6961 "loop-if-addr<="/imm32 "0f 87/jump-if-addr>"/imm32
6962 "break-if-addr>="/imm32 "0f 82/jump-if-addr<"/imm32
6963 "loop-if-addr>="/imm32 "0f 82/jump-if-addr<"/imm32
6964
6965 == code
6966
6967 emit-unconditional-jump-to-depth:
6968
6969 55/push-ebp
6970 89/<- %ebp 4/r32/esp
6971
6972 50/push-eax
6973 51/push-ecx
6974 52/push-edx
6975 53/push-ebx
6976
6977 8b/-> *(ebp+0xc) 1/r32/ecx
6978
6979 8b/-> *ecx 0/r32/eax
6980
6981 81 0/subop/add %ecx 8/imm32
6982
6983 81 5/subop/subtract %eax 4/imm32
6984 8d/copy-address *(ecx+eax) 0/r32/eax
6985
6986 8b/-> *(ebp+0x10) 2/r32/edx
6987 {
6988 $emit-unconditional-jump-to-depth:loop:
6989
6990 39/compare %eax 1/r32/ecx
6991 0f 82/jump-if-addr< break/disp32
6992
6993 8b/-> *eax 3/r32/ebx
6994
6995 39/compare *(ebx+8) 2/r32/edx
6996 0f 8c/jump-if-< break/disp32
6997 {
6998 $emit-unconditional-jump-to-depth:check:
6999
7000 39/compare *(ebx+8) 2/r32/edx
7001 0f 85/jump-if-!= break/disp32
7002 $emit-unconditional-jump-to-depth:depth-found:
7003
7004
7005 50/push-eax
7006 (size-of %ebx)
7007
7008 3d/compare-eax-and 0/imm32
7009 58/pop-to-eax
7010
7011 0f 85/jump-if-!= break/disp32
7012 $emit-unconditional-jump-to-depth:label-found:
7013
7014 (emit-indent *(ebp+8) *Curr-block-depth)
7015 (write-buffered *(ebp+8) "e9/jump ")
7016 (write-buffered *(ebp+8) *ebx)
7017 (write-buffered *(ebp+8) ":")
7018 (write-buffered *(ebp+8) *(ebp+0x14))
7019 (write-buffered *(ebp+8) "/disp32\n")
7020 eb/jump $emit-unconditional-jump-to-depth:end/disp8
7021 }
7022
7023 2d/subtract-from-eax 4/imm32
7024 e9/jump loop/disp32
7025 }
7026
7027 $emit-unconditional-jump-to-depth:end:
7028
7029 5b/pop-to-ebx
7030 5a/pop-to-edx
7031 59/pop-to-ecx
7032 58/pop-to-eax
7033
7034 89/<- %esp 5/r32/ebp
7035 5d/pop-to-ebp
7036 c3/return
7037
7038
7039
7040 emit-cleanup-code-until-depth:
7041
7042 55/push-ebp
7043 89/<- %ebp 4/r32/esp
7044
7045 50/push-eax
7046 51/push-ecx
7047 52/push-edx
7048 53/push-ebx
7049
7050 8b/-> *(ebp+0xc) 1/r32/ecx
7051
7052 8b/-> *ecx 0/r32/eax
7053
7054 81 0/subop/add %ecx 8/imm32
7055
7056 81 5/subop/subtract %eax 4/imm32
7057 8d/copy-address *(ecx+eax) 0/r32/eax
7058
7059 8b/-> *(ebp+0x10) 2/r32/edx
7060 {
7061 $emit-cleanup-code-until-depth:loop:
7062
7063 39/compare %eax 1/r32/ecx
7064 0f 82/jump-if-addr< break/disp32
7065
7066 8b/-> *eax 3/r32/ebx
7067
7068 39/compare *(ebx+8) 2/r32/edx
7069 0f 8c/jump-if-< break/disp32
7070
7071 81 7/subop/compare *(ebx+0x10) 0/imm32
7072 {
7073 0f 84/jump-if-= break/disp32
7074 50/push-eax
7075 {
7076 $emit-cleanup-code-until-depth:check-for-previous-spill:
7077 (same-register-spilled-before? %ebx *(ebp+0xc) %eax)
7078 3d/compare-eax-and 0/imm32/false
7079 0f 85/jump-if-!= break/disp32
7080 $emit-cleanup-code-until-depth:reclaim-var-in-register:
7081 (emit-indent *(ebp+8) *Curr-block-depth)
7082 (write-buffered *(ebp+8) "8f 0/subop/pop %")
7083 (write-buffered *(ebp+8) *(ebx+0x10))
7084 (write-buffered *(ebp+8) Newline)
7085 }
7086 58/pop-to-eax
7087 eb/jump $emit-cleanup-code-until-depth:continue/disp8
7088 }
7089
7090 {
7091 75/jump-if-!= break/disp8
7092 $emit-cleanup-code-until-depth:reclaim-var-on-stack:
7093 50/push-eax
7094 (size-of %ebx)
7095
7096 3d/compare-eax-and 0/imm32
7097 74/jump-if-= break/disp8
7098
7099 (emit-indent *(ebp+8) *Curr-block-depth)
7100 (write-buffered *(ebp+8) "81 0/subop/add %esp ")
7101 (print-int32-buffered *(ebp+8) %eax)
7102 (write-buffered *(ebp+8) "/imm32\n")
7103 58/pop-to-eax
7104 }
7105 $emit-cleanup-code-until-depth:continue:
7106
7107 2d/subtract-from-eax 4/imm32
7108 e9/jump loop/disp32
7109 }
7110 $emit-cleanup-code-until-depth:end:
7111
7112 5b/pop-to-ebx
7113 5a/pop-to-edx
7114 59/pop-to-ecx
7115 58/pop-to-eax
7116
7117 89/<- %esp 5/r32/ebp
7118 5d/pop-to-ebp
7119 c3/return
7120
7121
7122
7123 emit-cleanup-code-until-target:
7124
7125 55/push-ebp
7126 89/<- %ebp 4/r32/esp
7127
7128 50/push-eax
7129 51/push-ecx
7130 52/push-edx
7131 53/push-ebx
7132
7133 8b/-> *(ebp+0xc) 1/r32/ecx
7134
7135 8b/-> *ecx 0/r32/eax
7136
7137 81 0/subop/add %ecx 8/imm32
7138
7139 81 5/subop/subtract %eax 4/imm32
7140 8d/copy-address *(ecx+eax) 2/r32/edx
7141 {
7142 $emit-cleanup-code-until-target:loop:
7143
7144 39/compare %edx 1/r32/ecx
7145 0f 82/jump-if-addr< break/disp32
7146
7147 8b/-> *edx 3/r32/ebx
7148
7149 (string-equal? *ebx *(ebp+0x10))
7150 3d/compare-eax-and 0/imm32/false
7151 0f 85/jump-if-!= break/disp32
7152
7153 81 7/subop/compare *(ebx+0x10) 0/imm32
7154 {
7155 74/jump-if-= break/disp8
7156 50/push-eax
7157 {
7158 $emit-cleanup-code-until-target:check-for-previous-spill:
7159 (same-register-spilled-before? %ebx *(ebp+0xc) %edx)
7160 3d/compare-eax-and 0/imm32/false
7161 75/jump-if-!= break/disp8
7162 $emit-cleanup-code-until-target:reclaim-var-in-register:
7163 (emit-indent *(ebp+8) *Curr-block-depth)
7164 (write-buffered *(ebp+8) "8f 0/subop/pop %")
7165 (write-buffered *(ebp+8) *(ebx+0x10))
7166 (write-buffered *(ebp+8) Newline)
7167 }
7168 58/pop-to-eax
7169 eb/jump $emit-cleanup-code-until-target:continue/disp8
7170 }
7171
7172 {
7173 75/jump-if-!= break/disp8
7174 $emit-cleanup-code-until-target:reclaim-var-on-stack:
7175 (size-of %ebx)
7176
7177 3d/compare-eax-and 0/imm32
7178 74/jump-if-= break/disp8
7179
7180 (emit-indent *(ebp+8) *Curr-block-depth)
7181 (write-buffered *(ebp+8) "81 0/subop/add %esp ")
7182 (print-int32-buffered *(ebp+8) %eax)
7183 (write-buffered *(ebp+8) "/imm32\n")
7184 }
7185 $emit-cleanup-code-until-target:continue:
7186
7187 81 5/subop/subtract %edx 4/imm32
7188 e9/jump loop/disp32
7189 }
7190 $emit-cleanup-code-until-target:end:
7191
7192 5b/pop-to-ebx
7193 5a/pop-to-edx
7194 59/pop-to-ecx
7195 58/pop-to-eax
7196
7197 89/<- %esp 5/r32/ebp
7198 5d/pop-to-ebp
7199 c3/return
7200
7201
7202
7203 already-spilled-this-block?:
7204
7205 55/push-ebp
7206 89/<- %ebp 4/r32/esp
7207
7208 51/push-ecx
7209 52/push-edx
7210 53/push-ebx
7211 56/push-esi
7212 57/push-edi
7213
7214 8b/-> *(ebp+0xc) 1/r32/ecx
7215
7216 8b/-> *ecx 0/r32/eax
7217
7218 81 0/subop/add %ecx 8/imm32
7219
7220 81 5/subop/subtract %eax 4/imm32
7221 8d/copy-address *(ecx+eax) 2/r32/edx
7222
7223 8b/-> *(ebp+8) 3/r32/ebx
7224 8b/-> *(ebx+8) 3/r32/ebx
7225
7226 8b/-> *(ebp+8) 6/r32/esi
7227 8b/-> *(esi+0x10) 6/r32/esi
7228 {
7229 $already-spilled-this-block?:loop:
7230
7231 39/compare %edx 1/r32/ecx
7232 0f 82/jump-if-addr< break/disp32
7233
7234 8b/-> *edx 7/r32/edi
7235
7236 39/compare *(edi+8) 3/r32/ebx
7237 0f 8c/jump-if-< break/disp32
7238
7239 8b/-> *(edi+0x10) 7/r32/edi
7240
7241 {
7242 $already-spilled-this-block?:check-reg:
7243 81 7/subop/compare %edi 0/imm32
7244 74/jump-if-= break/disp8
7245
7246 (string-equal? %esi %edi)
7247 3d/compare-eax-and 0/imm32/false
7248 74/jump-if-= break/disp8
7249 b8/copy-to-eax 1/imm32/true
7250 eb/jump $already-spilled-this-block?:end/disp8
7251 }
7252 $already-spilled-this-block?:continue:
7253
7254 81 5/subop/subtract %edx 4/imm32
7255 e9/jump loop/disp32
7256 }
7257
7258 b8/copy-to-eax 0/imm32/false
7259 $already-spilled-this-block?:end:
7260
7261 5f/pop-to-edi
7262 5e/pop-to-esi
7263 5b/pop-to-ebx
7264 5a/pop-to-edx
7265 59/pop-to-ecx
7266
7267 89/<- %esp 5/r32/ebp
7268 5d/pop-to-ebp
7269 c3/return
7270
7271
7272
7273
7274
7275 same-register-spilled-before?:
7276
7277 55/push-ebp
7278 89/<- %ebp 4/r32/esp
7279
7280 51/push-ecx
7281 52/push-edx
7282 53/push-ebx
7283 56/push-esi
7284 57/push-edi
7285
7286 8b/-> *(ebp+8) 1/r32/ecx
7287
7288 8b/-> *(ecx+0x10) 2/r32/edx
7289
7290 8b/-> *(ecx+8) 3/r32/ebx
7291
7292 8b/-> *(ebp+0xc) 1/r32/ecx
7293 81 0/subop/add %ecx 8/imm32
7294
7295
7296
7297 8b/-> *(ebp+0x10) 6/r32/esi
7298
7299 81 5/subop/subtract %esi 4/imm32
7300 {
7301 $same-register-spilled-before?:loop:
7302
7303 39/compare %esi 1/r32/ecx
7304 0f 82/jump-if-addr< break/disp32
7305
7306 8b/-> *esi 0/r32/eax
7307
7308 39/compare *(eax+8) 3/r32/ebx
7309 0f 8c/jump-if-< break/disp32
7310
7311 81 7/subop/compare *(eax+0x10) 0/imm32
7312 74/jump-if-= $same-register-spilled-before?:continue/disp8
7313
7314 (string-equal? *(eax+0x10) %edx)
7315 3d/compare-eax-and 0/imm32/false
7316 75/jump-if-!= $same-register-spilled-before?:end/disp8
7317 $same-register-spilled-before?:continue:
7318
7319 81 5/subop/subtract %esi 4/imm32
7320 e9/jump loop/disp32
7321 }
7322 $same-register-spilled-before?:false:
7323 b8/copy-to-eax 0/imm32/false
7324 $same-register-spilled-before?:end:
7325
7326 5f/pop-to-edi
7327 5e/pop-to-esi
7328 5b/pop-to-ebx
7329 5a/pop-to-edx
7330 59/pop-to-ecx
7331
7332 89/<- %esp 5/r32/ebp
7333 5d/pop-to-ebp
7334 c3/return
7335
7336
7337 clean-up-blocks:
7338
7339 55/push-ebp
7340 89/<- %ebp 4/r32/esp
7341
7342 50/push-eax
7343 51/push-ecx
7344 56/push-esi
7345
7346 8b/-> *(ebp+8) 6/r32/esi
7347
7348 8b/-> *(ebp+0xc) 1/r32/ecx
7349 {
7350 $clean-up-blocks:reclaim-loop:
7351
7352 81 7/subop/compare *esi 0/imm32
7353 7e/jump-if-<= break/disp8
7354
7355 (top %esi)
7356
7357 39/compare *(eax+8) 1/r32/ecx
7358 7c/jump-if-< break/disp8
7359
7360 81 7/subop/compare *(eax+0x10) 0/imm32
7361 {
7362 75/jump-if-!= break/disp8
7363 $clean-up-blocks:reclaim-var-on-stack:
7364 (size-of %eax)
7365 01/add *Curr-local-stack-offset 0/r32/eax
7366 }
7367 (pop %esi)
7368 e9/jump loop/disp32
7369 }
7370 $clean-up-blocks:end:
7371
7372 5e/pop-to-esi
7373 59/pop-to-ecx
7374 58/pop-to-eax
7375
7376 89/<- %esp 5/r32/ebp
7377 5d/pop-to-ebp
7378 c3/return
7379
7380 emit-subx-var-def:
7381
7382 55/push-ebp
7383 89/<- %ebp 4/r32/esp
7384
7385 50/push-eax
7386 51/push-ecx
7387 52/push-edx
7388
7389 8b/-> *(ebp+0xc) 0/r32/eax
7390
7391 8b/-> *(eax+4) 1/r32/ecx
7392
7393 8b/-> *Curr-block-depth 0/r32/eax
7394 89/<- *(ecx+8) 0/r32/eax
7395
7396 (size-of %ecx)
7397 89/<- %edx 0/r32/eax
7398
7399 29/subtract-from *Curr-local-stack-offset 2/r32/edx
7400
7401 8b/-> *Curr-local-stack-offset 0/r32/eax
7402 89/<- *(ecx+0xc) 0/r32/eax
7403
7404 {
7405 (is-mu-array? *(ecx+4))
7406 3d/compare-eax-and 0/imm32/false
7407 0f 84/jump-if-= break/disp32
7408
7409 81 5/subop/subtract %edx 4/imm32
7410 (emit-indent *(ebp+8) *Curr-block-depth)
7411 (write-buffered *(ebp+8) "(push-n-zero-bytes ")
7412 (print-int32-buffered *(ebp+8) %edx)
7413 (write-buffered *(ebp+8) ")\n")
7414 (emit-indent *(ebp+8) *Curr-block-depth)
7415 (write-buffered *(ebp+8) "68/push ")
7416 (print-int32-buffered *(ebp+8) %edx)
7417 (write-buffered *(ebp+8) "/imm32\n")
7418 eb/jump $emit-subx-var-def:end/disp8
7419 }
7420
7421 {
7422 81 7/subop/compare %edx 0/imm32
7423 7e/jump-if-<= break/disp8
7424 (emit-indent *(ebp+8) *Curr-block-depth)
7425 (write-buffered *(ebp+8) "68/push 0/imm32\n")
7426
7427 81 5/subop/subtract %edx 4/imm32
7428
7429 eb/jump loop/disp8
7430 }
7431 $emit-subx-var-def:end:
7432
7433 5a/pop-to-edx
7434 59/pop-to-ecx
7435 58/pop-to-eax
7436
7437 89/<- %esp 5/r32/ebp
7438 5d/pop-to-ebp
7439 c3/return
7440
7441 emit-subx-stmt:
7442
7443 55/push-ebp
7444 89/<- %ebp 4/r32/esp
7445
7446 50/push-eax
7447 51/push-ecx
7448
7449
7450 8b/-> *(ebp+0xc) 1/r32/ecx
7451
7452 {
7453
7454 (string-equal? *(ecx+4) "length")
7455 3d/compare-eax-and 0/imm32
7456 0f 84/jump-if-= break/disp32
7457 (translate-mu-length-stmt *(ebp+8) *(ebp+0xc))
7458 e9/jump $emit-subx-stmt:end/disp32
7459 }
7460
7461 {
7462
7463 (string-equal? *(ecx+4) "index")
7464 3d/compare-eax-and 0/imm32
7465 0f 84/jump-if-= break/disp32
7466 (translate-mu-index-stmt *(ebp+8) *(ebp+0xc))
7467 e9/jump $emit-subx-stmt:end/disp32
7468 }
7469
7470 {
7471
7472 (string-equal? *(ecx+4) "compute-offset")
7473 3d/compare-eax-and 0/imm32
7474 0f 84/jump-if-= break/disp32
7475 (translate-mu-compute-index-stmt *(ebp+8) *(ebp+0xc))
7476 e9/jump $emit-subx-stmt:end/disp32
7477 }
7478
7479 {
7480
7481 (string-equal? *(ecx+4) "get")
7482 3d/compare-eax-and 0/imm32
7483 0f 84/jump-if-= break/disp32
7484 (translate-mu-get-stmt *(ebp+8) *(ebp+0xc))
7485 e9/jump $emit-subx-stmt:end/disp32
7486 }
7487
7488 {
7489 $emit-subx-stmt:check-for-primitive:
7490 (find-matching-primitive *(ebp+0x10) *(ebp+0xc))
7491 3d/compare-eax-and 0/imm32
7492 74/jump-if-= break/disp8
7493 $emit-subx-stmt:primitive:
7494 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax)
7495 e9/jump $emit-subx-stmt:end/disp32
7496 }
7497
7498 {
7499 $emit-subx-stmt:check-for-call:
7500 (find-matching-function *(ebp+0x14) *(ebp+0xc))
7501 3d/compare-eax-and 0/imm32
7502 74/jump-if-= break/disp8
7503 $emit-subx-stmt:call:
7504 (emit-subx-call *(ebp+8) *(ebp+0xc) %eax)
7505 e9/jump $emit-subx-stmt:end/disp32
7506 }
7507
7508 (emit-hailmary-call *(ebp+8) *(ebp+0xc))
7509 $emit-subx-stmt:end:
7510
7511 59/pop-to-ecx
7512 58/pop-to-eax
7513
7514 89/<- %esp 5/r32/ebp
7515 5d/pop-to-ebp
7516 c3/return
7517
7518 translate-mu-length-stmt:
7519
7520 55/push-ebp
7521 89/<- %ebp 4/r32/esp
7522
7523 50/push-eax
7524 51/push-ecx
7525
7526 8b/-> *(ebp+0xc) 1/r32/ecx
7527
7528 (emit-indent *(ebp+8) *Curr-block-depth)
7529 (write-buffered *(ebp+8) "8b/copy-from *")
7530
7531 8b/-> *(ecx+8) 0/r32/eax
7532 8b/-> *eax 0/r32/eax
7533
7534 {
7535 81 7/subop/compare *(eax+0x10)) 0/imm32
7536 74/jump-if-= break/disp8
7537 (write-buffered *(ebp+8) *(eax+0x10))
7538 eb/jump $translate-mu-length-stmt:emit-output/disp8
7539 }
7540
7541 {
7542 81 7/subop/compare *(eax+0xc)) 0/imm32
7543 74/jump-if-= break/disp8
7544 (write-buffered *(ebp+8) "(ebp+")
7545 (print-int32-buffered *(ebp+8) *(eax+0xc))
7546 (write-buffered *(ebp+8) ")")
7547 }
7548 $translate-mu-length-stmt:emit-output:
7549 (write-buffered *(ebp+8) " ")
7550
7551 8b/-> *(ecx+0xc) 0/r32/eax
7552 8b/-> *eax 0/r32/eax
7553 (get Registers *(eax+0x10) 8 "Registers")
7554 (print-int32-buffered *(ebp+8) *eax)
7555 (write-buffered *(ebp+8) "/r32\n")
7556 $translate-mu-length-stmt:end:
7557
7558 59/pop-to-ecx
7559 58/pop-to-eax
7560
7561 89/<- %esp 5/r32/ebp
7562 5d/pop-to-ebp
7563 c3/return
7564
7565 translate-mu-index-stmt:
7566
7567 55/push-ebp
7568 89/<- %ebp 4/r32/esp
7569
7570 51/push-ecx
7571
7572 8b/-> *(ebp+0xc) 1/r32/ecx
7573 8b/-> *(ecx+8) 1/r32/ecx
7574 8b/-> *ecx 1/r32/ecx
7575
7576 {
7577 81 7/subop/compare *(ecx+0x10) 0/imm32
7578 74/jump-if-= break/disp8
7579
7580 (translate-mu-index-stmt-with-array-in-register *(ebp+8) *(ebp+0xc))
7581 eb/jump $translate-mu-index-stmt:end/disp8
7582 }
7583
7584 {
7585 81 7/subop/compare *(ecx+0xc) 0/imm32
7586 74/jump-if-= break/disp8
7587
7588 (translate-mu-index-stmt-with-array-on-stack *(ebp+8) *(ebp+0xc))
7589 eb/jump $translate-mu-index-stmt:end/disp8
7590 }
7591 $translate-mu-index-stmt:end:
7592
7593 59/pop-to-ecx
7594
7595 89/<- %esp 5/r32/ebp
7596 5d/pop-to-ebp
7597 c3/return
7598
7599 $translate-mu-index-stmt-with-array:error1:
7600 (write-buffered Stderr "couldn't translate an index instruction. second (index) input must either lie in a register or be a literal\n")
7601 (flush Stderr)
7602
7603 bb/copy-to-ebx 1/imm32
7604 b8/copy-to-eax 1/imm32/exit
7605 cd/syscall 0x80/imm8
7606
7607
7608 $translate-mu-index-stmt-with-array:error2:
7609 (write-buffered Stderr "couldn't translate an index instruction. second (index) input when in a register must be an int or offset\n")
7610 (flush Stderr)
7611
7612 bb/copy-to-ebx 1/imm32
7613 b8/copy-to-eax 1/imm32/exit
7614 cd/syscall 0x80/imm8
7615
7616
7617 translate-mu-index-stmt-with-array-in-register:
7618
7619 55/push-ebp
7620 89/<- %ebp 4/r32/esp
7621
7622 50/push-eax
7623 51/push-ecx
7624 52/push-edx
7625 53/push-ebx
7626
7627 (emit-indent *(ebp+8) *Curr-block-depth)
7628 (write-buffered *(ebp+8) "8d/copy-address *(")
7629
7630 $translate-mu-index-stmt-with-array-in-register:emit-base:
7631
7632 8b/-> *(ebp+0xc) 1/r32/ecx
7633
7634 8b/-> *(ecx+8) 3/r32/ebx
7635 8b/-> *ebx 3/r32/ebx
7636
7637 (write-buffered *(ebp+8) *(ebx+0x10))
7638
7639 (write-buffered *(ebp+8) " + ")
7640
7641 8b/-> *(ecx+8) 2/r32/edx
7642 8b/-> *(edx+4) 2/r32/edx
7643 8b/-> *edx 2/r32/edx
7644
7645 81 7/subop/compare *(edx+0x10) 0/imm32
7646 {
7647 0f 84/jump-if-= break/disp32
7648 $translate-mu-index-stmt-with-array-in-register:emit-register-index:
7649
7650 (is-simple-mu-type? *(edx+4) 1)
7651 3d/compare-eax-and 0/imm32/false
7652 {
7653 0f 84/jump-if-= break/disp32
7654 $translate-mu-index-stmt-with-array-in-register:emit-int-register-index:
7655
7656
7657 (write-buffered *(ebp+8) *(edx+0x10))
7658 (write-buffered *(ebp+8) "<<")
7659
7660
7661 (array-element-type-id %ebx)
7662 (size-of-type-id %eax)
7663 (num-shift-rights %eax)
7664 (print-int32-buffered *(ebp+8) %eax)
7665 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-register-index-done/disp32
7666 }
7667
7668 8b/-> *(edx+4) 0/r32/eax
7669 8b/-> *eax 0/r32/eax
7670 3b/compare 0/r32/eax *Max-type-id
7671 0f 82/jump-if-addr< $translate-mu-index-stmt-with-array:error2/disp32
7672
7673 (is-simple-mu-type? %eax 7)
7674 3d/compare-eax-and 0/imm32/false
7675 {
7676 0f 84/jump-if-= break/disp32
7677
7678 $translate-mu-index-stmt-with-array-in-register:emit-offset-register-index:
7679 (write-buffered *(ebp+8) *(edx+0x10))
7680 }
7681 $translate-mu-index-stmt-with-array-in-register:emit-register-index-done:
7682 (write-buffered *(ebp+8) " + 4) ")
7683 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32
7684 }
7685
7686 (is-simple-mu-type? *(edx+4) 0)
7687 3d/compare-eax-and 0/imm32/false
7688 {
7689 0f 84/jump-if-= break/disp32
7690 $translate-mu-index-stmt-with-array-in-register:emit-literal-index:
7691
7692 (parse-hex-int *edx)
7693 89/<- %edx 0/r32/eax
7694
7695 (array-element-type-id %ebx)
7696 (size-of-type-id %eax)
7697 f7 4/subop/multiply-into-eax %edx
7698
7699 05/add-to-eax 4/imm32
7700
7701
7702 (print-int32-buffered *(ebp+8) %eax)
7703 (write-buffered *(ebp+8) ") ")
7704 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32
7705 }
7706
7707 e9/jump $translate-mu-index-stmt-with-array:error1/disp32
7708 $translate-mu-index-stmt-with-array-in-register:emit-output:
7709
7710 8b/-> *(ebp+0xc) 1/r32/ecx
7711 8b/-> *(ecx+0xc) 0/r32/eax
7712 8b/-> *eax 0/r32/eax
7713 (get Registers *(eax+0x10) 8 "Registers")
7714 (print-int32-buffered *(ebp+8) *eax)
7715 (write-buffered *(ebp+8) "/r32\n")
7716 $translate-mu-index-stmt-with-array-in-register:end:
7717
7718 5b/pop-to-ebx
7719 5a/pop-to-edx
7720 59/pop-to-ecx
7721 58/pop-to-eax
7722
7723 89/<- %esp 5/r32/ebp
7724 5d/pop-to-ebp
7725 c3/return
7726
7727 translate-mu-index-stmt-with-array-on-stack:
7728
7729 55/push-ebp
7730 89/<- %ebp 4/r32/esp
7731
7732 50/push-eax
7733 51/push-ecx
7734 52/push-edx
7735 53/push-ebx
7736
7737 (emit-indent *(ebp+8) *Curr-block-depth)
7738 (write-buffered *(ebp+8) "8d/copy-address *(ebp + ")
7739
7740 8b/-> *(ebp+0xc) 0/r32/eax
7741
7742 8b/-> *(eax+8) 0/r32/eax
7743 8b/-> *eax 1/r32/ecx
7744
7745 8b/-> *(eax+4) 0/r32/eax
7746
7747 8b/-> *eax 2/r32/edx
7748
7749 81 7/subop/compare *(edx+0x10) 0/imm32
7750 {
7751 0f 84/jump-if-= break/disp32
7752 $translate-mu-index-stmt-with-array-on-stack:emit-register-index:
7753
7754 (is-simple-mu-type? *(edx+4) 1)
7755 3d/compare-eax-and 0/imm32/false
7756 {
7757 0f 84/jump-if-= break/disp32
7758 $translate-mu-index-stmt-with-array-on-stack:emit-int-register-index:
7759
7760
7761 (write-buffered *(ebp+8) *(edx+0x10))
7762 (write-buffered *(ebp+8) "<<")
7763
7764
7765 (array-element-type-id %ecx)
7766 (size-of-type-id %eax)
7767 (num-shift-rights %eax)
7768 (print-int32-buffered *(ebp+8) %eax)
7769
7770 (write-buffered *(ebp+8) " + ")
7771
7772 8b/-> *(ecx+0xc) 0/r32/eax
7773 05/add-to-eax 4/imm32
7774 (print-int32-buffered *(ebp+8) %eax)
7775 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done/disp32
7776 }
7777
7778 8b/-> *(edx+4) 0/r32/eax
7779 8b/-> *eax 0/r32/eax
7780 3b/compare 0/r32/eax *Max-type-id
7781 0f 82/jump-if-addr< $translate-mu-index-stmt-with-array:error2/disp32
7782
7783 (is-simple-mu-type? %eax 7)
7784 3d/compare-eax-and 0/imm32/false
7785 {
7786 0f 84/jump-if-= break/disp32
7787
7788 $translate-mu-index-stmt-with-array-on-stack:emit-offset-register-index:
7789 (write-buffered *(ebp+8) *(edx+0x10))
7790 }
7791 $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done:
7792 (write-buffered *(ebp+8) ") ")
7793 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32
7794 }
7795
7796 (is-simple-mu-type? *(edx+4) 0)
7797 3d/compare-eax-and 0/imm32/false
7798 {
7799 0f 84/jump-if-= break/disp32
7800 $translate-mu-index-stmt-with-array-on-stack:emit-literal-index:
7801
7802 (parse-hex-int *edx)
7803 89/<- %ebx 0/r32/eax
7804
7805 (array-element-type-id %ecx)
7806 (size-of-type-id %eax)
7807 f7 4/subop/multiply-into-eax %ebx
7808
7809 03/add-to 0/r32/eax *(ecx+0xc)
7810
7811 05/add-to-eax 4/imm32
7812
7813
7814 (print-int32-buffered *(ebp+8) %eax)
7815 (write-buffered *(ebp+8) ") ")
7816 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32
7817 }
7818
7819 e9/jump $translate-mu-index-stmt-with-array:error1/disp32
7820 $translate-mu-index-stmt-with-array-on-stack:emit-output:
7821
7822 8b/-> *(ebp+0xc) 0/r32/eax
7823 8b/-> *(eax+0xc) 0/r32/eax
7824 8b/-> *eax 0/r32/eax
7825 (get Registers *(eax+0x10) 8 "Registers")
7826 (print-int32-buffered *(ebp+8) *eax)
7827 (write-buffered *(ebp+8) "/r32\n")
7828 $translate-mu-index-stmt-with-array-on-stack:end:
7829
7830 5b/pop-to-ebx
7831 5a/pop-to-edx
7832 59/pop-to-ecx
7833 58/pop-to-eax
7834
7835 89/<- %esp 5/r32/ebp
7836 5d/pop-to-ebp
7837 c3/return
7838
7839 translate-mu-compute-index-stmt:
7840
7841 55/push-ebp
7842 89/<- %ebp 4/r32/esp
7843
7844 50/push-eax
7845 51/push-ecx
7846 52/push-edx
7847 53/push-ebx
7848
7849 (emit-indent *(ebp+8) *Curr-block-depth)
7850 (write-buffered *(ebp+8) "69/multiply ")
7851 $translate-mu-compute-index-stmt:emit-elem-size:
7852
7853 8b/-> *(ebp+0xc) 1/r32/ecx
7854
7855 8b/-> *(ecx+8) 2/r32/edx
7856
7857 8b/-> *edx 3/r32/ebx
7858
7859 (array-element-type-id %ebx)
7860 (size-of-type-id %eax)
7861 (print-int32-buffered *(ebp+8) %eax)
7862 (write-buffered *(ebp+8) "/imm32")
7863 $translate-mu-compute-index-stmt:emit-index:
7864 (emit-subx-var-as-rm32 *(ebp+8) *(edx+4))
7865 (write-buffered *(ebp+8) Space)
7866 $translate-mu-compute-index-stmt:emit-output:
7867
7868 8b/-> *(ecx+0xc) 0/r32/eax
7869 8b/-> *eax 0/r32/eax
7870 (get Registers *(eax+0x10) 8 "Registers")
7871 (print-int32-buffered *(ebp+8) *eax)
7872 (write-buffered *(ebp+8) "/r32\n")
7873 $translate-mu-compute-index-stmt:end:
7874
7875 5b/pop-to-ebx
7876 5a/pop-to-edx
7877 59/pop-to-ecx
7878 58/pop-to-eax
7879
7880 89/<- %esp 5/r32/ebp
7881 5d/pop-to-ebp
7882 c3/return
7883
7884 translate-mu-get-stmt:
7885
7886 55/push-ebp
7887 89/<- %ebp 4/r32/esp
7888
7889 50/push-eax
7890 51/push-ecx
7891 52/push-edx
7892
7893 (emit-indent *(ebp+8) *Curr-block-depth)
7894 (write-buffered *(ebp+8) "8d/copy-address ")
7895
7896 8b/-> *(ebp+0xc) 1/r32/ecx
7897
7898 (mu-get-offset %ecx)
7899 89/<- %edx 0/r32/eax
7900
7901 8b/-> *(ecx+8) 0/r32/eax
7902 8b/-> *eax 0/r32/eax
7903
7904 81 7/subop/compare *(eax+0x10) 0/imm32
7905 {
7906 0f 84/jump-if-= break/disp32
7907 $translate-mu-get-stmt:emit-register-input:
7908
7909 (write-buffered *(ebp+8) "*(")
7910 (write-buffered *(ebp+8) *(eax+0x10))
7911 (write-buffered *(ebp+8) " + ")
7912 (print-int32-buffered *(ebp+8) %edx)
7913 (write-buffered *(ebp+8) ") ")
7914 e9/jump $translate-mu-get-stmt:emit-output/disp32
7915 }
7916
7917 {
7918 $translate-mu-get-stmt:emit-stack-input:
7919
7920 (write-buffered *(ebp+8) "*(ebp+")
7921 03/add-from *(eax+0xc) 2/r32/edx
7922 (print-int32-buffered *(ebp+8) %edx)
7923 (write-buffered *(ebp+8) ") ")
7924 eb/jump $translate-mu-get-stmt:emit-output/disp8
7925 }
7926 $translate-mu-get-stmt:emit-output:
7927
7928 8b/-> *(ecx+0xc) 0/r32/eax
7929 8b/-> *eax 0/r32/eax
7930 (get Registers *(eax+0x10) 8 "Registers")
7931 (print-int32-buffered *(ebp+8) *eax)
7932 (write-buffered *(ebp+8) "/r32\n")
7933 $translate-mu-get-stmt:end:
7934
7935 5a/pop-to-edx
7936 59/pop-to-ecx
7937 58/pop-to-eax
7938
7939 89/<- %esp 5/r32/ebp
7940 5d/pop-to-ebp
7941 c3/return
7942
7943 array-element-type-id:
7944
7945
7946 55/push-ebp
7947 89/<- %ebp 4/r32/esp
7948
7949 8b/-> *(ebp+8) 0/r32/eax
7950 8b/-> *(eax+4) 0/r32/eax
7951
7952 8b/-> *(eax+4) 0/r32/eax
7953
7954
7955 8b/-> *(eax+4) 0/r32/eax
7956
7957 8b/-> *eax 0/r32/eax
7958 8b/-> *eax 0/r32/eax
7959 $array-element-type-id:end:
7960
7961 89/<- %esp 5/r32/ebp
7962 5d/pop-to-ebp
7963 c3/return
7964
7965 power-of-2?:
7966
7967
7968 55/push-ebp
7969 89/<- %ebp 4/r32/esp
7970
7971 8b/-> *(ebp+8) 0/r32/eax
7972 48/decrement-eax
7973
7974 0b/and-> *(ebp+8) 0/r32/eax
7975
7976 3d/compare-eax-and 0/imm32
7977 0f 94/set-byte-if-= %al
7978 81 4/subop/and %eax 0xff/imm32
7979 $power-of-2?:end:
7980
7981 89/<- %esp 5/r32/ebp
7982 5d/pop-to-ebp
7983 c3/return
7984
7985 num-shift-rights:
7986
7987
7988 55/push-ebp
7989 89/<- %ebp 4/r32/esp
7990
7991 51/push-ecx
7992
7993 8b/-> *(ebp+8) 1/r32/ecx
7994
7995 b8/copy-to-eax 0/imm32
7996 {
7997
7998 81 7/subop/compare %ecx 1/imm32
7999 7e/jump-if-<= break/disp8
8000 40/increment-eax
8001 c1/shift 5/subop/arithmetic-right %ecx 1/imm8
8002 eb/jump loop/disp8
8003 }
8004 $num-shift-rights:end:
8005
8006 59/pop-to-ecx
8007
8008 89/<- %esp 5/r32/ebp
8009 5d/pop-to-ebp
8010 c3/return
8011
8012 mu-get-offset:
8013
8014 55/push-ebp
8015 89/<- %ebp 4/r32/esp
8016
8017 8b/-> *(ebp+8) 0/r32/eax
8018 8b/-> *(eax+8) 0/r32/eax
8019 8b/-> *(eax+4) 0/r32/eax
8020
8021 8b/-> *eax 0/r32/eax
8022
8023 8b/-> *(eax+0xc) 0/r32/eax
8024 $emit-get-offset:end:
8025
8026 89/<- %esp 5/r32/ebp
8027 5d/pop-to-ebp
8028 c3/return
8029
8030 emit-subx-block:
8031
8032 55/push-ebp
8033 89/<- %ebp 4/r32/esp
8034
8035 50/push-eax
8036 51/push-ecx
8037 56/push-esi
8038
8039 8b/-> *(ebp+0xc) 6/r32/esi
8040
8041 8b/-> *(esi+8) 0/r32/eax
8042 8b/-> *Curr-block-depth 1/r32/ecx
8043 89/<- *(eax+8) 1/r32/ecx
8044
8045 8b/-> *(esi+4) 0/r32/eax
8046
8047 {
8048 $emit-subx-block:check-empty:
8049 3d/compare-eax-and 0/imm32
8050 0f 84/jump-if-= break/disp32
8051 (emit-indent *(ebp+8) *Curr-block-depth)
8052 (write-buffered *(ebp+8) "{\n")
8053
8054 8b/-> *(esi+8) 1/r32/ecx
8055
8056 (write-buffered *(ebp+8) *ecx)
8057 (write-buffered *(ebp+8) ":loop:\n")
8058 ff 0/subop/increment *Curr-block-depth
8059 (push *(ebp+0x10) %ecx)
8060 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10))
8061 (pop *(ebp+0x10))
8062 ff 1/subop/decrement *Curr-block-depth
8063 (emit-indent *(ebp+8) *Curr-block-depth)
8064 (write-buffered *(ebp+8) "}\n")
8065 (write-buffered *(ebp+8) *ecx)
8066 (write-buffered *(ebp+8) ":break:\n")
8067 }
8068 $emit-subx-block:end:
8069
8070 5e/pop-to-esi
8071 59/pop-to-ecx
8072 58/pop-to-eax
8073
8074 89/<- %esp 5/r32/ebp
8075 5d/pop-to-ebp
8076 c3/return
8077
8078
8079
8080 == data
8081 Primitives:
8082
8083 _Primitive-inc-eax:
8084
8085 "increment"/imm32/name
8086 0/imm32/no-inouts
8087 Single-int-var-in-eax/imm32/outputs
8088 "40/increment-eax"/imm32/subx-name
8089 0/imm32/no-rm32
8090 0/imm32/no-r32
8091 0/imm32/no-imm32
8092 0/imm32/no-disp32
8093 0/imm32/output-is-write-only
8094 _Primitive-inc-ecx/imm32/next
8095 _Primitive-inc-ecx:
8096
8097 "increment"/imm32/name
8098 0/imm32/no-inouts
8099 Single-int-var-in-ecx/imm32/outputs
8100 "41/increment-ecx"/imm32/subx-name
8101 0/imm32/no-rm32
8102 0/imm32/no-r32
8103 0/imm32/no-imm32
8104 0/imm32/no-disp32
8105 0/imm32/output-is-write-only
8106 _Primitive-inc-edx/imm32/next
8107 _Primitive-inc-edx:
8108
8109 "increment"/imm32/name
8110 0/imm32/no-inouts
8111 Single-int-var-in-edx/imm32/outputs
8112 "42/increment-edx"/imm32/subx-name
8113 0/imm32/no-rm32
8114 0/imm32/no-r32
8115 0/imm32/no-imm32
8116 0/imm32/no-disp32
8117 0/imm32/output-is-write-only
8118 _Primitive-inc-ebx/imm32/next
8119 _Primitive-inc-ebx:
8120
8121 "increment"/imm32/name
8122 0/imm32/no-inouts
8123 Single-int-var-in-ebx/imm32/outputs
8124 "43/increment-ebx"/imm32/subx-name
8125 0/imm32/no-rm32
8126 0/imm32/no-r32
8127 0/imm32/no-imm32
8128 0/imm32/no-disp32
8129 0/imm32/output-is-write-only
8130 _Primitive-inc-esi/imm32/next
8131 _Primitive-inc-esi:
8132
8133 "increment"/imm32/name
8134 0/imm32/no-inouts
8135 Single-int-var-in-esi/imm32/outputs
8136 "46/increment-esi"/imm32/subx-name
8137 0/imm32/no-rm32
8138 0/imm32/no-r32
8139 0/imm32/no-imm32
8140 0/imm32/no-disp32
8141 0/imm32/output-is-write-only
8142 _Primitive-inc-edi/imm32/next
8143 _Primitive-inc-edi:
8144
8145 "increment"/imm32/name
8146 0/imm32/no-inouts
8147 Single-int-var-in-edi/imm32/outputs
8148 "47/increment-edi"/imm32/subx-name
8149 0/imm32/no-rm32
8150 0/imm32/no-r32
8151 0/imm32/no-imm32
8152 0/imm32/no-disp32
8153 0/imm32/output-is-write-only
8154 _Primitive-dec-eax/imm32/next
8155 _Primitive-dec-eax:
8156
8157 "decrement"/imm32/name
8158 0/imm32/no-inouts
8159 Single-int-var-in-eax/imm32/outputs
8160 "48/decrement-eax"/imm32/subx-name
8161 0/imm32/no-rm32
8162 0/imm32/no-r32
8163 0/imm32/no-imm32
8164 0/imm32/no-disp32
8165 0/imm32/output-is-write-only
8166 _Primitive-dec-ecx/imm32/next
8167 _Primitive-dec-ecx:
8168
8169 "decrement"/imm32/name
8170 0/imm32/no-inouts
8171 Single-int-var-in-ecx/imm32/outputs
8172 "49/decrement-ecx"/imm32/subx-name
8173 0/imm32/no-rm32
8174 0/imm32/no-r32
8175 0/imm32/no-imm32
8176 0/imm32/no-disp32
8177 0/imm32/output-is-write-only
8178 _Primitive-dec-edx/imm32/next
8179 _Primitive-dec-edx:
8180
8181 "decrement"/imm32/name
8182 0/imm32/no-inouts
8183 Single-int-var-in-edx/imm32/outputs
8184 "4a/decrement-edx"/imm32/subx-name
8185 0/imm32/no-rm32
8186 0/imm32/no-r32
8187 0/imm32/no-imm32
8188 0/imm32/no-disp32
8189 0/imm32/output-is-write-only
8190 _Primitive-dec-ebx/imm32/next
8191 _Primitive-dec-ebx:
8192
8193 "decrement"/imm32/name
8194 0/imm32/no-inouts
8195 Single-int-var-in-ebx/imm32/outputs
8196 "4b/decrement-ebx"/imm32/subx-name
8197 0/imm32/no-rm32
8198 0/imm32/no-r32
8199 0/imm32/no-imm32
8200 0/imm32/no-disp32
8201 0/imm32/output-is-write-only
8202 _Primitive-dec-esi/imm32/next
8203 _Primitive-dec-esi:
8204
8205 "decrement"/imm32/name
8206 0/imm32/no-inouts
8207 Single-int-var-in-esi/imm32/outputs
8208 "4e/decrement-esi"/imm32/subx-name
8209 0/imm32/no-rm32
8210 0/imm32/no-r32
8211 0/imm32/no-imm32
8212 0/imm32/no-disp32
8213 0/imm32/output-is-write-only
8214 _Primitive-dec-edi/imm32/next
8215 _Primitive-dec-edi:
8216
8217 "decrement"/imm32/name
8218 0/imm32/no-inouts
8219 Single-int-var-in-edi/imm32/outputs
8220 "4f/decrement-edi"/imm32/subx-name
8221 0/imm32/no-rm32
8222 0/imm32/no-r32
8223 0/imm32/no-imm32
8224 0/imm32/no-disp32
8225 0/imm32/output-is-write-only
8226 _Primitive-inc-mem/imm32/next
8227 _Primitive-inc-mem:
8228
8229 "increment"/imm32/name
8230 Single-int-var-in-mem/imm32/inouts
8231 0/imm32/no-outputs
8232 "ff 0/subop/increment"/imm32/subx-name
8233 1/imm32/rm32-is-first-inout
8234 0/imm32/no-r32
8235 0/imm32/no-imm32
8236 0/imm32/no-disp32
8237 0/imm32/output-is-write-only
8238 _Primitive-inc-reg/imm32/next
8239 _Primitive-inc-reg:
8240
8241 "increment"/imm32/name
8242 0/imm32/no-inouts
8243 Single-int-var-in-some-register/imm32/outputs
8244 "ff 0/subop/increment"/imm32/subx-name
8245 3/imm32/rm32-is-first-output
8246 0/imm32/no-r32
8247 0/imm32/no-imm32
8248 0/imm32/no-disp32
8249 0/imm32/output-is-write-only
8250 _Primitive-dec-mem/imm32/next
8251 _Primitive-dec-mem:
8252
8253 "decrement"/imm32/name
8254 Single-int-var-in-mem/imm32/inouts
8255 0/imm32/no-outputs
8256 "ff 1/subop/decrement"/imm32/subx-name
8257 1/imm32/rm32-is-first-inout
8258 0/imm32/no-r32
8259 0/imm32/no-imm32
8260 0/imm32/no-disp32
8261 0/imm32/output-is-write-only
8262 _Primitive-dec-reg/imm32/next
8263 _Primitive-dec-reg:
8264
8265 "decrement"/imm32/name
8266 0/imm32/no-inouts
8267 Single-int-var-in-some-register/imm32/outputs
8268 "ff 1/subop/decrement"/imm32/subx-name
8269 3/imm32/rm32-is-first-output
8270 0/imm32/no-r32
8271 0/imm32/no-imm32
8272 0/imm32/no-disp32
8273 0/imm32/output-is-write-only
8274 _Primitive-add-to-eax/imm32/next
8275
8276 _Primitive-add-to-eax:
8277
8278 "add"/imm32/name
8279 Single-lit-var/imm32/inouts
8280 Single-int-var-in-eax/imm32/outputs
8281 "05/add-to-eax"/imm32/subx-name
8282 0/imm32/no-rm32
8283 0/imm32/no-r32
8284 1/imm32/imm32-is-first-inout
8285 0/imm32/no-disp32
8286 0/imm32/output-is-write-only
8287 _Primitive-add-reg-to-reg/imm32/next
8288 _Primitive-add-reg-to-reg:
8289
8290 "add"/imm32/name
8291 Single-int-var-in-some-register/imm32/inouts
8292 Single-int-var-in-some-register/imm32/outputs
8293 "01/add-to"/imm32/subx-name
8294 3/imm32/rm32-is-first-output
8295 1/imm32/r32-is-first-inout
8296 0/imm32/no-imm32
8297 0/imm32/no-disp32
8298 0/imm32/output-is-write-only
8299 _Primitive-add-reg-to-mem/imm32/next
8300 _Primitive-add-reg-to-mem:
8301
8302 "add-to"/imm32/name
8303 Two-args-int-stack-int-reg/imm32/inouts
8304 0/imm32/outputs
8305 "01/add-to"/imm32/subx-name
8306 1/imm32/rm32-is-first-inout
8307 2/imm32/r32-is-second-inout
8308 0/imm32/no-imm32
8309 0/imm32/no-disp32
8310 0/imm32/output-is-write-only
8311 _Primitive-add-mem-to-reg/imm32/next
8312 _Primitive-add-mem-to-reg:
8313
8314 "add"/imm32/name
8315 Single-int-var-in-mem/imm32/inouts
8316 Single-int-var-in-some-register/imm32/outputs
8317 "03/add"/imm32/subx-name
8318 1/imm32/rm32-is-first-inout
8319 3/imm32/r32-is-first-output
8320 0/imm32/no-imm32
8321 0/imm32/no-disp32
8322 0/imm32/output-is-write-only
8323 _Primitive-add-lit-to-reg/imm32/next
8324 _Primitive-add-lit-to-reg:
8325
8326 "add"/imm32/name
8327 Single-lit-var/imm32/inouts
8328 Single-int-var-in-some-register/imm32/outputs
8329 "81 0/subop/add"/imm32/subx-name
8330 3/imm32/rm32-is-first-output
8331 0/imm32/no-r32
8332 1/imm32/imm32-is-first-inout
8333 0/imm32/no-disp32
8334 0/imm32/output-is-write-only
8335 _Primitive-add-lit-to-mem/imm32/next
8336 _Primitive-add-lit-to-mem:
8337
8338 "add-to"/imm32/name
8339 Int-var-and-literal/imm32/inouts
8340 0/imm32/outputs
8341 "81 0/subop/add"/imm32/subx-name
8342 1/imm32/rm32-is-first-inout
8343 0/imm32/no-r32
8344 2/imm32/imm32-is-second-inout
8345 0/imm32/no-disp32
8346 0/imm32/output-is-write-only
8347 _Primitive-subtract-from-eax/imm32/next
8348
8349 _Primitive-subtract-from-eax:
8350
8351 "subtract"/imm32/name
8352 Single-lit-var/imm32/inouts
8353 Single-int-var-in-eax/imm32/outputs
8354 "2d/subtract-from-eax"/imm32/subx-name
8355 0/imm32/no-rm32
8356 0/imm32/no-r32
8357 1/imm32/imm32-is-first-inout
8358 0/imm32/no-disp32
8359 0/imm32/output-is-write-only
8360 _Primitive-subtract-reg-from-reg/imm32/next
8361 _Primitive-subtract-reg-from-reg:
8362
8363 "subtract"/imm32/name
8364 Single-int-var-in-some-register/imm32/inouts
8365 Single-int-var-in-some-register/imm32/outputs
8366 "29/subtract-from"/imm32/subx-name
8367 3/imm32/rm32-is-first-output
8368 1/imm32/r32-is-first-inout
8369 0/imm32/no-imm32
8370 0/imm32/no-disp32
8371 0/imm32/output-is-write-only
8372 _Primitive-subtract-reg-from-mem/imm32/next
8373 _Primitive-subtract-reg-from-mem:
8374
8375 "subtract-from"/imm32/name
8376 Two-args-int-stack-int-reg/imm32/inouts
8377 0/imm32/outputs
8378 "29/subtract-from"/imm32/subx-name
8379 1/imm32/rm32-is-first-inout
8380 2/imm32/r32-is-second-inout
8381 0/imm32/no-imm32
8382 0/imm32/no-disp32
8383 0/imm32/output-is-write-only
8384 _Primitive-subtract-mem-from-reg/imm32/next
8385 _Primitive-subtract-mem-from-reg:
8386
8387 "subtract"/imm32/name
8388 Single-int-var-in-mem/imm32/inouts
8389 Single-int-var-in-some-register/imm32/outputs
8390 "2b/subtract"/imm32/subx-name
8391 1/imm32/rm32-is-first-inout
8392 3/imm32/r32-is-first-output
8393 0/imm32/no-imm32
8394 0/imm32/no-disp32
8395 0/imm32/output-is-write-only
8396 _Primitive-subtract-lit-from-reg/imm32/next
8397 _Primitive-subtract-lit-from-reg:
8398
8399 "subtract"/imm32/name
8400 Single-lit-var/imm32/inouts
8401 Single-int-var-in-some-register/imm32/outputs
8402 "81 5/subop/subtract"/imm32/subx-name
8403 3/imm32/rm32-is-first-output
8404 0/imm32/no-r32
8405 1/imm32/imm32-is-first-inout
8406 0/imm32/no-disp32
8407 0/imm32/output-is-write-only
8408 _Primitive-subtract-lit-from-mem/imm32/next
8409 _Primitive-subtract-lit-from-mem:
8410
8411 "subtract-from"/imm32/name
8412 Int-var-and-literal/imm32/inouts
8413 0/imm32/outputs
8414 "81 5/subop/subtract"/imm32/subx-name
8415 1/imm32/rm32-is-first-inout
8416 0/imm32/no-r32
8417 2/imm32/imm32-is-first-inout
8418 0/imm32/no-disp32
8419 0/imm32/output-is-write-only
8420 _Primitive-and-with-eax/imm32/next
8421
8422 _Primitive-and-with-eax:
8423
8424 "and"/imm32/name
8425 Single-lit-var/imm32/inouts
8426 Single-int-var-in-eax/imm32/outputs
8427 "25/and-with-eax"/imm32/subx-name
8428 0/imm32/no-rm32
8429 0/imm32/no-r32
8430 1/imm32/imm32-is-first-inout
8431 0/imm32/no-disp32
8432 0/imm32/output-is-write-only
8433 _Primitive-and-reg-with-reg/imm32/next
8434 _Primitive-and-reg-with-reg:
8435
8436 "and"/imm32/name
8437 Single-int-var-in-some-register/imm32/inouts
8438 Single-int-var-in-some-register/imm32/outputs
8439 "21/and-with"/imm32/subx-name
8440 3/imm32/rm32-is-first-output
8441 1/imm32/r32-is-first-inout
8442 0/imm32/no-imm32
8443 0/imm32/no-disp32
8444 0/imm32/output-is-write-only
8445 _Primitive-and-reg-with-mem/imm32/next
8446 _Primitive-and-reg-with-mem:
8447
8448 "and-with"/imm32/name
8449 Two-args-int-stack-int-reg/imm32/inouts
8450 0/imm32/outputs
8451 "21/and-with"/imm32/subx-name
8452 1/imm32/rm32-is-first-inout
8453 2/imm32/r32-is-second-inout
8454 0/imm32/no-imm32
8455 0/imm32/no-disp32
8456 0/imm32/output-is-write-only
8457 _Primitive-and-mem-with-reg/imm32/next
8458 _Primitive-and-mem-with-reg:
8459
8460 "and"/imm32/name
8461 Single-int-var-in-mem/imm32/inouts
8462 Single-int-var-in-some-register/imm32/outputs
8463 "23/and"/imm32/subx-name
8464 1/imm32/rm32-is-first-inout
8465 3/imm32/r32-is-first-output
8466 0/imm32/no-imm32
8467 0/imm32/no-disp32
8468 0/imm32/output-is-write-only
8469 _Primitive-and-lit-with-reg/imm32/next
8470 _Primitive-and-lit-with-reg:
8471
8472 "and"/imm32/name
8473 Single-lit-var/imm32/inouts
8474 Single-int-var-in-some-register/imm32/outputs
8475 "81 4/subop/and"/imm32/subx-name
8476 3/imm32/rm32-is-first-output
8477 0/imm32/no-r32
8478 1/imm32/imm32-is-first-inout
8479 0/imm32/no-disp32
8480 0/imm32/output-is-write-only
8481 _Primitive-and-lit-with-mem/imm32/next
8482 _Primitive-and-lit-with-mem:
8483
8484 "and-with"/imm32/name
8485 Int-var-and-literal/imm32/inouts
8486 0/imm32/outputs
8487 "81 4/subop/and"/imm32/subx-name
8488 1/imm32/rm32-is-first-inout
8489 0/imm32/no-r32
8490 2/imm32/imm32-is-first-inout
8491 0/imm32/no-disp32
8492 0/imm32/output-is-write-only
8493 _Primitive-or-with-eax/imm32/next
8494
8495 _Primitive-or-with-eax:
8496
8497 "or"/imm32/name
8498 Single-lit-var/imm32/inouts
8499 Single-int-var-in-eax/imm32/outputs
8500 "0d/or-with-eax"/imm32/subx-name
8501 0/imm32/no-rm32
8502 0/imm32/no-r32
8503 1/imm32/imm32-is-first-inout
8504 0/imm32/no-disp32
8505 0/imm32/output-is-write-only
8506 _Primitive-or-reg-with-reg/imm32/next
8507 _Primitive-or-reg-with-reg:
8508
8509 "or"/imm32/name
8510 Single-int-var-in-some-register/imm32/inouts
8511 Single-int-var-in-some-register/imm32/outputs
8512 "09/or-with"/imm32/subx-name
8513 3/imm32/rm32-is-first-output
8514 1/imm32/r32-is-first-inout
8515 0/imm32/no-imm32
8516 0/imm32/no-disp32
8517 0/imm32/output-is-write-only
8518 _Primitive-or-reg-with-mem/imm32/next
8519 _Primitive-or-reg-with-mem:
8520
8521 "or-with"/imm32/name
8522 Two-args-int-stack-int-reg/imm32/inouts
8523 0/imm32/outputs
8524 "09/or-with"/imm32/subx-name
8525 1/imm32/rm32-is-first-inout
8526 2/imm32/r32-is-second-inout
8527 0/imm32/no-imm32
8528 0/imm32/no-disp32
8529 0/imm32/output-is-write-only
8530 _Primitive-or-mem-with-reg/imm32/next
8531 _Primitive-or-mem-with-reg:
8532
8533 "or"/imm32/name
8534 Single-int-var-in-mem/imm32/inouts
8535 Single-int-var-in-some-register/imm32/outputs
8536 "0b/or"/imm32/subx-name
8537 1/imm32/rm32-is-first-inout
8538 3/imm32/r32-is-first-output
8539 0/imm32/no-imm32
8540 0/imm32/no-disp32
8541 0/imm32/output-is-write-only
8542 _Primitive-or-lit-with-reg/imm32/next
8543 _Primitive-or-lit-with-reg:
8544
8545 "or"/imm32/name
8546 Single-lit-var/imm32/inouts
8547 Single-int-var-in-some-register/imm32/outputs
8548 "81 1/subop/or"/imm32/subx-name
8549 3/imm32/rm32-is-first-output
8550 0/imm32/no-r32
8551 1/imm32/imm32-is-first-inout
8552 0/imm32/no-disp32
8553 0/imm32/output-is-write-only
8554 _Primitive-or-lit-with-mem/imm32/next
8555 _Primitive-or-lit-with-mem:
8556
8557 "or-with"/imm32/name
8558 Int-var-and-literal/imm32/inouts
8559 0/imm32/outputs
8560 "81 1/subop/or"/imm32/subx-name
8561 1/imm32/rm32-is-first-inout
8562 0/imm32/no-r32
8563 2/imm32/imm32-is-second-inout
8564 0/imm32/no-disp32
8565 0/imm32/output-is-write-only
8566 _Primitive-xor-with-eax/imm32/next
8567
8568 _Primitive-xor-with-eax:
8569
8570 "xor"/imm32/name
8571 Single-lit-var/imm32/inouts
8572 Single-int-var-in-eax/imm32/outputs
8573 "35/xor-with-eax"/imm32/subx-name
8574 0/imm32/no-rm32
8575 0/imm32/no-r32
8576 1/imm32/imm32-is-first-inout
8577 0/imm32/no-disp32
8578 0/imm32/output-is-write-only
8579 _Primitive-xor-reg-with-reg/imm32/next
8580 _Primitive-xor-reg-with-reg:
8581
8582 "xor"/imm32/name
8583 Single-int-var-in-some-register/imm32/inouts
8584 Single-int-var-in-some-register/imm32/outputs
8585 "31/xor-with"/imm32/subx-name
8586 3/imm32/rm32-is-first-output
8587 1/imm32/r32-is-first-inout
8588 0/imm32/no-imm32
8589 0/imm32/no-disp32
8590 0/imm32/output-is-write-only
8591 _Primitive-xor-reg-with-mem/imm32/next
8592 _Primitive-xor-reg-with-mem:
8593
8594 "xor-with"/imm32/name
8595 Two-args-int-stack-int-reg/imm32/inouts
8596 0/imm32/outputs
8597 "31/xor-with"/imm32/subx-name
8598 1/imm32/rm32-is-first-inout
8599 2/imm32/r32-is-second-inout
8600 0/imm32/no-imm32
8601 0/imm32/no-disp32
8602 0/imm32/output-is-write-only
8603 _Primitive-xor-mem-with-reg/imm32/next
8604 _Primitive-xor-mem-with-reg:
8605
8606 "xor"/imm32/name
8607 Single-int-var-in-mem/imm32/inouts
8608 Single-int-var-in-some-register/imm32/outputs
8609 "33/xor"/imm32/subx-name
8610 1/imm32/rm32-is-first-inout
8611 3/imm32/r32-is-first-output
8612 0/imm32/no-imm32
8613 0/imm32/no-disp32
8614 0/imm32/output-is-write-only
8615 _Primitive-xor-lit-with-reg/imm32/next
8616 _Primitive-xor-lit-with-reg:
8617
8618 "xor"/imm32/name
8619 Single-lit-var/imm32/inouts
8620 Single-int-var-in-some-register/imm32/outputs
8621 "81 6/subop/xor"/imm32/subx-name
8622 3/imm32/rm32-is-first-output
8623 0/imm32/no-r32
8624 1/imm32/imm32-is-first-inout
8625 0/imm32/no-disp32
8626 0/imm32/output-is-write-only
8627 _Primitive-xor-lit-with-mem/imm32/next
8628 _Primitive-xor-lit-with-mem:
8629
8630 "xor-with"/imm32/name
8631 Int-var-and-literal/imm32/inouts
8632 0/imm32/outputs
8633 "81 6/subop/xor"/imm32/subx-name
8634 1/imm32/rm32-is-first-inout
8635 0/imm32/no-r32
8636 2/imm32/imm32-is-first-inout
8637 0/imm32/no-disp32
8638 0/imm32/output-is-write-only
8639 _Primitive-copy-to-eax/imm32/next
8640
8641 _Primitive-copy-to-eax:
8642
8643 "copy"/imm32/name
8644 Single-lit-var/imm32/inouts
8645 Single-int-var-in-eax/imm32/outputs
8646 "b8/copy-to-eax"/imm32/subx-name
8647 0/imm32/no-rm32
8648 0/imm32/no-r32
8649 1/imm32/imm32-is-first-inout
8650 0/imm32/no-disp32
8651 1/imm32/output-is-write-only
8652 _Primitive-copy-to-ecx/imm32/next
8653 _Primitive-copy-to-ecx:
8654
8655 "copy"/imm32/name
8656 Single-lit-var/imm32/inouts
8657 Single-int-var-in-ecx/imm32/outputs
8658 "b9/copy-to-ecx"/imm32/subx-name
8659 0/imm32/no-rm32
8660 0/imm32/no-r32
8661 1/imm32/imm32-is-first-inout
8662 0/imm32/no-disp32
8663 1/imm32/output-is-write-only
8664 _Primitive-copy-to-edx/imm32/next
8665 _Primitive-copy-to-edx:
8666
8667 "copy"/imm32/name
8668 Single-lit-var/imm32/inouts
8669 Single-int-var-in-edx/imm32/outputs
8670 "ba/copy-to-edx"/imm32/subx-name
8671 0/imm32/no-rm32
8672 0/imm32/no-r32
8673 1/imm32/imm32-is-first-inout
8674 0/imm32/no-disp32
8675 1/imm32/output-is-write-only
8676 _Primitive-copy-to-ebx/imm32/next
8677 _Primitive-copy-to-ebx:
8678
8679 "copy"/imm32/name
8680 Single-lit-var/imm32/inouts
8681 Single-int-var-in-ebx/imm32/outputs
8682 "bb/copy-to-ebx"/imm32/subx-name
8683 0/imm32/no-rm32
8684 0/imm32/no-r32
8685 1/imm32/imm32-is-first-inout
8686 0/imm32/no-disp32
8687 1/imm32/output-is-write-only
8688 _Primitive-copy-to-esi/imm32/next
8689 _Primitive-copy-to-esi:
8690
8691 "copy"/imm32/name
8692 Single-lit-var/imm32/inouts
8693 Single-int-var-in-esi/imm32/outputs
8694 "be/copy-to-esi"/imm32/subx-name
8695 0/imm32/no-rm32
8696 0/imm32/no-r32
8697 1/imm32/imm32-is-first-inout
8698 0/imm32/no-disp32
8699 1/imm32/output-is-write-only
8700 _Primitive-copy-to-edi/imm32/next
8701 _Primitive-copy-to-edi:
8702
8703 "copy"/imm32/name
8704 Single-lit-var/imm32/inouts
8705 Single-int-var-in-edi/imm32/outputs
8706 "bf/copy-to-edi"/imm32/subx-name
8707 0/imm32/no-rm32
8708 0/imm32/no-r32
8709 1/imm32/imm32-is-first-inout
8710 0/imm32/no-disp32
8711 1/imm32/output-is-write-only
8712 _Primitive-copy-reg-to-reg/imm32/next
8713 _Primitive-copy-reg-to-reg:
8714
8715 "copy"/imm32/name
8716 Single-int-var-in-some-register/imm32/inouts
8717 Single-int-var-in-some-register/imm32/outputs
8718 "89/copy-to"/imm32/subx-name
8719 3/imm32/rm32-is-first-output
8720 1/imm32/r32-is-first-inout
8721 0/imm32/no-imm32
8722 0/imm32/no-disp32
8723 1/imm32/output-is-write-only
8724 _Primitive-copy-reg-to-mem/imm32/next
8725 _Primitive-copy-reg-to-mem:
8726
8727 "copy-to"/imm32/name
8728 Two-args-int-stack-int-reg/imm32/inouts
8729 0/imm32/outputs
8730 "89/copy-to"/imm32/subx-name
8731 1/imm32/rm32-is-first-inout
8732 2/imm32/r32-is-second-inout
8733 0/imm32/no-imm32
8734 0/imm32/no-disp32
8735 1/imm32/output-is-write-only
8736 _Primitive-copy-mem-to-reg/imm32/next
8737 _Primitive-copy-mem-to-reg:
8738
8739 "copy"/imm32/name
8740 Single-int-var-in-mem/imm32/inouts
8741 Single-int-var-in-some-register/imm32/outputs
8742 "8b/copy-from"/imm32/subx-name
8743 1/imm32/rm32-is-first-inout
8744 3/imm32/r32-is-first-output
8745 0/imm32/no-imm32
8746 0/imm32/no-disp32
8747 1/imm32/output-is-write-only
8748 _Primitive-copy-lit-to-reg/imm32/next
8749 _Primitive-copy-lit-to-reg:
8750
8751 "copy"/imm32/name
8752 Single-lit-var/imm32/inouts
8753 Single-int-var-in-some-register/imm32/outputs
8754 "c7 0/subop/copy"/imm32/subx-name
8755 3/imm32/rm32-is-first-output
8756 0/imm32/no-r32
8757 1/imm32/imm32-is-first-inout
8758 0/imm32/no-disp32
8759 1/imm32/output-is-write-only
8760 _Primitive-copy-lit-to-mem/imm32/next
8761 _Primitive-copy-lit-to-mem:
8762
8763 "copy-to"/imm32/name
8764 Int-var-and-literal/imm32/inouts
8765 0/imm32/outputs
8766 "c7 0/subop/copy"/imm32/subx-name
8767 1/imm32/rm32-is-first-inout
8768 0/imm32/no-r32
8769 2/imm32/imm32-is-first-inout
8770 0/imm32/no-disp32
8771 1/imm32/output-is-write-only
8772 _Primitive-compare-mem-with-reg/imm32/next
8773
8774 _Primitive-compare-mem-with-reg:
8775
8776 "compare"/imm32/name
8777 Two-args-int-stack-int-reg/imm32/inouts
8778 0/imm32/outputs
8779 "39/compare->"/imm32/subx-name
8780 1/imm32/rm32-is-first-inout
8781 2/imm32/r32-is-second-inout
8782 0/imm32/no-imm32
8783 0/imm32/no-disp32
8784 0/imm32/output-is-write-only
8785 _Primitive-compare-reg-with-mem/imm32/next
8786 _Primitive-compare-reg-with-mem:
8787
8788 "compare"/imm32/name
8789 Two-args-int-reg-int-stack/imm32/inouts
8790 0/imm32/outputs
8791 "3b/compare<-"/imm32/subx-name
8792 2/imm32/rm32-is-second-inout
8793 1/imm32/r32-is-first-inout
8794 0/imm32/no-imm32
8795 0/imm32/no-disp32
8796 0/imm32/output-is-write-only
8797 _Primitive-compare-eax-with-literal/imm32/next
8798 _Primitive-compare-eax-with-literal:
8799
8800 "compare"/imm32/name
8801 Two-args-int-eax-int-literal/imm32/inouts
8802 0/imm32/outputs
8803 "3d/compare-eax-with"/imm32/subx-name
8804 0/imm32/no-rm32
8805 0/imm32/no-r32
8806 2/imm32/imm32-is-second-inout
8807 0/imm32/no-disp32
8808 0/imm32/output-is-write-only
8809 _Primitive-compare-reg-with-literal/imm32/next
8810 _Primitive-compare-reg-with-literal:
8811
8812 "compare"/imm32/name
8813 Int-var-in-register-and-literal/imm32/inouts
8814 0/imm32/outputs
8815 "81 7/subop/compare"/imm32/subx-name
8816 1/imm32/rm32-is-first-inout
8817 0/imm32/no-r32
8818 2/imm32/imm32-is-second-inout
8819 0/imm32/no-disp32
8820 0/imm32/output-is-write-only
8821 _Primitive-compare-mem-with-literal/imm32/next
8822 _Primitive-compare-mem-with-literal:
8823
8824 "compare"/imm32/name
8825 Int-var-and-literal/imm32/inouts
8826 0/imm32/outputs
8827 "81 7/subop/compare"/imm32/subx-name
8828 1/imm32/rm32-is-first-inout
8829 0/imm32/no-r32
8830 2/imm32/imm32-is-second-inout
8831 0/imm32/no-disp32
8832 0/imm32/output-is-write-only
8833 _Primitive-multiply-reg-by-mem/imm32/next
8834
8835 _Primitive-multiply-reg-by-mem:
8836
8837 "multiply"/imm32/name
8838 Single-int-var-in-mem/imm32/inouts
8839 Single-int-var-in-some-register/imm32/outputs
8840 "0f af/multiply"/imm32/subx-name
8841 1/imm32/rm32-is-first-inout
8842 3/imm32/r32-is-first-output
8843 0/imm32/no-imm32
8844 0/imm32/no-disp32
8845 0/imm32/output-is-write-only
8846 _Primitive-break-if-addr</imm32/next
8847
8848 _Primitive-break-if-addr<:
8849 "break-if-addr<"/imm32/name
8850 0/imm32/inouts
8851 0/imm32/outputs
8852 "0f 82/jump-if-addr< break/disp32"/imm32/subx-name
8853 0/imm32/no-rm32
8854 0/imm32/no-r32
8855 0/imm32/no-imm32
8856 0/imm32/no-disp32
8857 0/imm32/no-output
8858 _Primitive-break-if-addr>=/imm32/next
8859 _Primitive-break-if-addr>=:
8860 "break-if-addr>="/imm32/name
8861 0/imm32/inouts
8862 0/imm32/outputs
8863 "0f 83/jump-if-addr>= break/disp32"/imm32/subx-name
8864 0/imm32/no-rm32
8865 0/imm32/no-r32
8866 0/imm32/no-imm32
8867 0/imm32/no-disp32
8868 0/imm32/no-output
8869 _Primitive-break-if-=/imm32/next
8870 _Primitive-break-if-=:
8871 "break-if-="/imm32/name
8872 0/imm32/inouts
8873 0/imm32/outputs
8874 "0f 84/jump-if-= break/disp32"/imm32/subx-name
8875 0/imm32/no-rm32
8876 0/imm32/no-r32
8877 0/imm32/no-imm32
8878 0/imm32/no-disp32
8879 0/imm32/no-output
8880 _Primitive-break-if-!=/imm32/next
8881 _Primitive-break-if-!=:
8882 "break-if-!="/imm32/name
8883 0/imm32/inouts
8884 0/imm32/outputs
8885 "0f 85/jump-if-!= break/disp32"/imm32/subx-name
8886 0/imm32/no-rm32
8887 0/imm32/no-r32
8888 0/imm32/no-imm32
8889 0/imm32/no-disp32
8890 0/imm32/no-output
8891 _Primitive-break-if-addr<=/imm32/next
8892 _Primitive-break-if-addr<=:
8893 "break-if-addr<="/imm32/name
8894 0/imm32/inouts
8895 0/imm32/outputs
8896 "0f 86/jump-if-addr<= break/disp32"/imm32/subx-name
8897 0/imm32/no-rm32
8898 0/imm32/no-r32
8899 0/imm32/no-imm32
8900 0/imm32/no-disp32
8901 0/imm32/no-output
8902 _Primitive-break-if-addr>/imm32/next
8903 _Primitive-break-if-addr>:
8904 "break-if-addr>"/imm32/name
8905 0/imm32/inouts
8906 0/imm32/outputs
8907 "0f 87/jump-if-addr> break/disp32"/imm32/subx-name
8908 0/imm32/no-rm32
8909 0/imm32/no-r32
8910 0/imm32/no-imm32
8911 0/imm32/no-disp32
8912 0/imm32/no-output
8913 _Primitive-break-if-</imm32/next
8914 _Primitive-break-if-<:
8915 "break-if-<"/imm32/name
8916 0/imm32/inouts
8917 0/imm32/outputs
8918 "0f 8c/jump-if-< break/disp32"/imm32/subx-name
8919 0/imm32/no-rm32
8920 0/imm32/no-r32
8921 0/imm32/no-imm32
8922 0/imm32/no-disp32
8923 0/imm32/no-output
8924 _Primitive-break-if->=/imm32/next
8925 _Primitive-break-if->=:
8926 "break-if->="/imm32/name
8927 0/imm32/inouts
8928 0/imm32/outputs
8929 "0f 8d/jump-if->= break/disp32"/imm32/subx-name
8930 0/imm32/no-rm32
8931 0/imm32/no-r32
8932 0/imm32/no-imm32
8933 0/imm32/no-disp32
8934 0/imm32/no-output
8935 _Primitive-break-if-<=/imm32/next
8936 _Primitive-break-if-<=:
8937 "break-if-<="/imm32/name
8938 0/imm32/inouts
8939 0/imm32/outputs
8940 "0f 8e/jump-if-<= break/disp32"/imm32/subx-name
8941 0/imm32/no-rm32
8942 0/imm32/no-r32
8943 0/imm32/no-imm32
8944 0/imm32/no-disp32
8945 0/imm32/no-output
8946 _Primitive-break-if->/imm32/next
8947 _Primitive-break-if->:
8948 "break-if->"/imm32/name
8949 0/imm32/inouts
8950 0/imm32/outputs
8951 "0f 8f/jump-if-> break/disp32"/imm32/subx-name
8952 0/imm32/no-rm32
8953 0/imm32/no-r32
8954 0/imm32/no-imm32
8955 0/imm32/no-disp32
8956 0/imm32/no-output
8957 _Primitive-break/imm32/next
8958 _Primitive-break:
8959 "break"/imm32/name
8960 0/imm32/inouts
8961 0/imm32/outputs
8962 "e9/jump break/disp32"/imm32/subx-name
8963 0/imm32/no-rm32
8964 0/imm32/no-r32
8965 0/imm32/no-imm32
8966 0/imm32/no-disp32
8967 0/imm32/no-output
8968 _Primitive-loop-if-addr</imm32/next
8969 _Primitive-loop-if-addr<:
8970 "loop-if-addr<"/imm32/name
8971 0/imm32/inouts
8972 0/imm32/outputs
8973 "0f 82/jump-if-addr< loop/disp32"/imm32/subx-name
8974 0/imm32/no-rm32
8975 0/imm32/no-r32
8976 0/imm32/no-imm32
8977 0/imm32/no-disp32
8978 0/imm32/no-output
8979 _Primitive-loop-if-addr>=/imm32/next
8980 _Primitive-loop-if-addr>=:
8981 "loop-if-addr>="/imm32/name
8982 0/imm32/inouts
8983 0/imm32/outputs
8984 "0f 83/jump-if-addr>= loop/disp32"/imm32/subx-name
8985 0/imm32/no-rm32
8986 0/imm32/no-r32
8987 0/imm32/no-imm32
8988 0/imm32/no-disp32
8989 0/imm32/no-output
8990 _Primitive-loop-if-=/imm32/next
8991 _Primitive-loop-if-=:
8992 "loop-if-="/imm32/name
8993 0/imm32/inouts
8994 0/imm32/outputs
8995 "0f 84/jump-if-= loop/disp32"/imm32/subx-name
8996 0/imm32/no-rm32
8997 0/imm32/no-r32
8998 0/imm32/no-imm32
8999 0/imm32/no-disp32
9000 0/imm32/no-output
9001 _Primitive-loop-if-!=/imm32/next
9002 _Primitive-loop-if-!=:
9003 "loop-if-!="/imm32/name
9004 0/imm32/inouts
9005 0/imm32/outputs
9006 "0f 85/jump-if-!= loop/disp32"/imm32/subx-name
9007 0/imm32/no-rm32
9008 0/imm32/no-r32
9009 0/imm32/no-imm32
9010 0/imm32/no-disp32
9011 0/imm32/no-output
9012 _Primitive-loop-if-addr<=/imm32/next
9013 _Primitive-loop-if-addr<=:
9014 "loop-if-addr<="/imm32/name
9015 0/imm32/inouts
9016 0/imm32/outputs
9017 "0f 86/jump-if-addr<= loop/disp32"/imm32/subx-name
9018 0/imm32/no-rm32
9019 0/imm32/no-r32
9020 0/imm32/no-imm32
9021 0/imm32/no-disp32
9022 0/imm32/no-output
9023 _Primitive-loop-if-addr>/imm32/next
9024 _Primitive-loop-if-addr>:
9025 "loop-if-addr>"/imm32/name
9026 0/imm32/inouts
9027 0/imm32/outputs
9028 "0f 87/jump-if-addr> loop/disp32"/imm32/subx-name
9029 0/imm32/no-rm32
9030 0/imm32/no-r32
9031 0/imm32/no-imm32
9032 0/imm32/no-disp32
9033 0/imm32/no-output
9034 _Primitive-loop-if-</imm32/next
9035 _Primitive-loop-if-<:
9036 "loop-if-<"/imm32/name
9037 0/imm32/inouts
9038 0/imm32/outputs
9039 "0f 8c/jump-if-< loop/disp32"/imm32/subx-name
9040 0/imm32/no-rm32
9041 0/imm32/no-r32
9042 0/imm32/no-imm32
9043 0/imm32/no-disp32
9044 0/imm32/no-output
9045 _Primitive-loop-if->=/imm32/next
9046 _Primitive-loop-if->=:
9047 "loop-if->="/imm32/name
9048 0/imm32/inouts
9049 0/imm32/outputs
9050 "0f 8d/jump-if->= loop/disp32"/imm32/subx-name
9051 0/imm32/no-rm32
9052 0/imm32/no-r32
9053 0/imm32/no-imm32
9054 0/imm32/no-disp32
9055 0/imm32/no-output
9056 _Primitive-loop-if-<=/imm32/next
9057 _Primitive-loop-if-<=:
9058 "loop-if-<="/imm32/name
9059 0/imm32/inouts
9060 0/imm32/outputs
9061 "0f 8e/jump-if-<= loop/disp32"/imm32/subx-name
9062 0/imm32/no-rm32
9063 0/imm32/no-r32
9064 0/imm32/no-imm32
9065 0/imm32/no-disp32
9066 0/imm32/no-output
9067 _Primitive-loop-if->/imm32/next
9068 _Primitive-loop-if->:
9069 "loop-if->"/imm32/name
9070 0/imm32/inouts
9071 0/imm32/outputs
9072 "0f 8f/jump-if-> loop/disp32"/imm32/subx-name
9073 0/imm32/no-rm32
9074 0/imm32/no-r32
9075 0/imm32/no-imm32
9076 0/imm32/no-disp32
9077 0/imm32/no-output
9078 _Primitive-loop/imm32/next
9079 _Primitive-loop:
9080 "loop"/imm32/name
9081 0/imm32/inouts
9082 0/imm32/outputs
9083 "e9/jump loop/disp32"/imm32/subx-name
9084 0/imm32/no-rm32
9085 0/imm32/no-r32
9086 0/imm32/no-imm32
9087 0/imm32/no-disp32
9088 0/imm32/no-output
9089 _Primitive-break-if-addr<-named/imm32/next
9090
9091 _Primitive-break-if-addr<-named:
9092 "break-if-addr<"/imm32/name
9093 Single-lit-var/imm32/inouts
9094 0/imm32/outputs
9095 "0f 82/jump-if-addr<"/imm32/subx-name
9096 0/imm32/no-rm32
9097 0/imm32/no-r32
9098 0/imm32/no-imm32
9099 1/imm32/disp32-is-first-inout
9100 0/imm32/no-output
9101 _Primitive-break-if-addr>=-named/imm32/next
9102 _Primitive-break-if-addr>=-named:
9103 "break-if-addr>="/imm32/name
9104 Single-lit-var/imm32/inouts
9105 0/imm32/outputs
9106 "0f 83/jump-if-addr>="/imm32/subx-name
9107 0/imm32/no-rm32
9108 0/imm32/no-r32
9109 0/imm32/no-imm32
9110 1/imm32/disp32-is-first-inout
9111 0/imm32/no-output
9112 _Primitive-break-if-=-named/imm32/next
9113 _Primitive-break-if-=-named:
9114 "break-if-="/imm32/name
9115 Single-lit-var/imm32/inouts
9116 0/imm32/outputs
9117 "0f 84/jump-if-="/imm32/subx-name
9118 0/imm32/no-rm32
9119 0/imm32/no-r32
9120 0/imm32/no-imm32
9121 1/imm32/disp32-is-first-inout
9122 0/imm32/no-output
9123 _Primitive-break-if-!=-named/imm32/next
9124 _Primitive-break-if-!=-named:
9125 "break-if-!="/imm32/name
9126 Single-lit-var/imm32/inouts
9127 0/imm32/outputs
9128 "0f 85/jump-if-!="/imm32/subx-name
9129 0/imm32/no-rm32
9130 0/imm32/no-r32
9131 0/imm32/no-imm32
9132 1/imm32/disp32-is-first-inout
9133 0/imm32/no-output
9134 _Primitive-break-if-addr<=-named/imm32/next
9135 _Primitive-break-if-addr<=-named:
9136 "break-if-addr<="/imm32/name
9137 Single-lit-var/imm32/inouts
9138 0/imm32/outputs
9139 "0f 86/jump-if-addr<="/imm32/subx-name
9140 0/imm32/no-rm32
9141 0/imm32/no-r32
9142 0/imm32/no-imm32
9143 1/imm32/disp32-is-first-inout
9144 0/imm32/no-output
9145 _Primitive-break-if-addr>-named/imm32/next
9146 _Primitive-break-if-addr>-named:
9147 "break-if-addr>"/imm32/name
9148 Single-lit-var/imm32/inouts
9149 0/imm32/outputs
9150 "0f 87/jump-if-addr>"/imm32/subx-name
9151 0/imm32/no-rm32
9152 0/imm32/no-r32
9153 0/imm32/no-imm32
9154 1/imm32/disp32-is-first-inout
9155 0/imm32/no-output
9156 _Primitive-break-if-<-named/imm32/next
9157 _Primitive-break-if-<-named:
9158 "break-if-<"/imm32/name
9159 Single-lit-var/imm32/inouts
9160 0/imm32/outputs
9161 "0f 8c/jump-if-<"/imm32/subx-name
9162 0/imm32/no-rm32
9163 0/imm32/no-r32
9164 0/imm32/no-imm32
9165 1/imm32/disp32-is-first-inout
9166 0/imm32/no-output
9167 _Primitive-break-if->=-named/imm32/next
9168 _Primitive-break-if->=-named:
9169 "break-if->="/imm32/name
9170 Single-lit-var/imm32/inouts
9171 0/imm32/outputs
9172 "0f 8d/jump-if->="/imm32/subx-name
9173 0/imm32/no-rm32
9174 0/imm32/no-r32
9175 0/imm32/no-imm32
9176 1/imm32/disp32-is-first-inout
9177 0/imm32/no-output
9178 _Primitive-break-if-<=-named/imm32/next
9179 _Primitive-break-if-<=-named:
9180 "break-if-<="/imm32/name
9181 Single-lit-var/imm32/inouts
9182 0/imm32/outputs
9183 "0f 8e/jump-if-<="/imm32/subx-name
9184 0/imm32/no-rm32
9185 0/imm32/no-r32
9186 0/imm32/no-imm32
9187 1/imm32/disp32-is-first-inout
9188 0/imm32/no-output
9189 _Primitive-break-if->-named/imm32/next
9190 _Primitive-break-if->-named:
9191 "break-if->"/imm32/name
9192 Single-lit-var/imm32/inouts
9193 0/imm32/outputs
9194 "0f 8f/jump-if->"/imm32/subx-name
9195 0/imm32/no-rm32
9196 0/imm32/no-r32
9197 0/imm32/no-imm32
9198 1/imm32/disp32-is-first-inout
9199 0/imm32/no-output
9200 _Primitive-break-named/imm32/next
9201 _Primitive-break-named:
9202 "break"/imm32/name
9203 Single-lit-var/imm32/inouts
9204 0/imm32/outputs
9205 "e9/jump"/imm32/subx-name
9206 0/imm32/no-rm32
9207 0/imm32/no-r32
9208 0/imm32/no-imm32
9209 1/imm32/disp32-is-first-inout
9210 0/imm32/no-output
9211 _Primitive-loop-if-addr<-named/imm32/next
9212 _Primitive-loop-if-addr<-named:
9213 "loop-if-addr<"/imm32/name
9214 Single-lit-var/imm32/inouts
9215 0/imm32/outputs
9216 "0f 82/jump-if-addr<"/imm32/subx-name
9217 0/imm32/no-rm32
9218 0/imm32/no-r32
9219 0/imm32/no-imm32
9220 1/imm32/disp32-is-first-inout
9221 0/imm32/no-output
9222 _Primitive-loop-if-addr>=-named/imm32/next
9223 _Primitive-loop-if-addr>=-named:
9224 "loop-if-addr>="/imm32/name
9225 Single-lit-var/imm32/inouts
9226 0/imm32/outputs
9227 "0f 83/jump-if-addr>="/imm32/subx-name
9228 0/imm32/no-rm32
9229 0/imm32/no-r32
9230 0/imm32/no-imm32
9231 1/imm32/disp32-is-first-inout
9232 0/imm32/no-output
9233 _Primitive-loop-if-=-named/imm32/next
9234 _Primitive-loop-if-=-named:
9235 "loop-if-="/imm32/name
9236 Single-lit-var/imm32/inouts
9237 0/imm32/outputs
9238 "0f 84/jump-if-="/imm32/subx-name
9239 0/imm32/no-rm32
9240 0/imm32/no-r32
9241 0/imm32/no-imm32
9242 1/imm32/disp32-is-first-inout
9243 0/imm32/no-output
9244 _Primitive-loop-if-!=-named/imm32/next
9245 _Primitive-loop-if-!=-named:
9246 "loop-if-!="/imm32/name
9247 Single-lit-var/imm32/inouts
9248 0/imm32/outputs
9249 "0f 85/jump-if-!="/imm32/subx-name
9250 0/imm32/no-rm32
9251 0/imm32/no-r32
9252 0/imm32/no-imm32
9253 1/imm32/disp32-is-first-inout
9254 0/imm32/no-output
9255 _Primitive-loop-if-addr<=-named/imm32/next
9256 _Primitive-loop-if-addr<=-named:
9257 "loop-if-addr<="/imm32/name
9258 Single-lit-var/imm32/inouts
9259 0/imm32/outputs
9260 "0f 86/jump-if-addr<="/imm32/subx-name
9261 0/imm32/no-rm32
9262 0/imm32/no-r32
9263 0/imm32/no-imm32
9264 1/imm32/disp32-is-first-inout
9265 0/imm32/no-output
9266 _Primitive-loop-if-addr>-named/imm32/next
9267 _Primitive-loop-if-addr>-named:
9268 "loop-if-addr>"/imm32/name
9269 Single-lit-var/imm32/inouts
9270 0/imm32/outputs
9271 "0f 87/jump-if-addr>"/imm32/subx-name
9272 0/imm32/no-rm32
9273 0/imm32/no-r32
9274 0/imm32/no-imm32
9275 1/imm32/disp32-is-first-inout
9276 0/imm32/no-output
9277 _Primitive-loop-if-<-named/imm32/next
9278 _Primitive-loop-if-<-named:
9279 "loop-if-<"/imm32/name
9280 Single-lit-var/imm32/inouts
9281 0/imm32/outputs
9282 "0f 8c/jump-if-<"/imm32/subx-name
9283 0/imm32/no-rm32
9284 0/imm32/no-r32
9285 0/imm32/no-imm32
9286 1/imm32/disp32-is-first-inout
9287 0/imm32/no-output
9288 _Primitive-loop-if->=-named/imm32/next
9289 _Primitive-loop-if->=-named:
9290 "loop-if->="/imm32/name
9291 Single-lit-var/imm32/inouts
9292 0/imm32/outputs
9293 "0f 8d/jump-if->="/imm32/subx-name
9294 0/imm32/no-rm32
9295 0/imm32/no-r32
9296 0/imm32/no-imm32
9297 1/imm32/disp32-is-first-inout
9298 0/imm32/no-output
9299 _Primitive-loop-if-<=-named/imm32/next
9300 _Primitive-loop-if-<=-named:
9301 "loop-if-<="/imm32/name
9302 Single-lit-var/imm32/inouts
9303 0/imm32/outputs
9304 "0f 8e/jump-if-<="/imm32/subx-name
9305 0/imm32/no-rm32
9306 0/imm32/no-r32
9307 0/imm32/no-imm32
9308 1/imm32/disp32-is-first-inout
9309 0/imm32/no-output
9310 _Primitive-loop-if->-named/imm32/next
9311 _Primitive-loop-if->-named:
9312 "loop-if->"/imm32/name
9313 Single-lit-var/imm32/inouts
9314 0/imm32/outputs
9315 "0f 8f/jump-if->"/imm32/subx-name
9316 0/imm32/no-rm32
9317 0/imm32/no-r32
9318 0/imm32/no-imm32
9319 1/imm32/disp32-is-first-inout
9320 0/imm32/no-output
9321 _Primitive-loop-named/imm32/next
9322 _Primitive-loop-named:
9323 "loop"/imm32/name
9324 Single-lit-var/imm32/inouts
9325 0/imm32/outputs
9326 "e9/jump"/imm32/subx-name
9327 0/imm32/no-rm32
9328 0/imm32/no-r32
9329 0/imm32/no-imm32
9330 1/imm32/disp32-is-first-inout
9331 0/imm32/no-output
9332 0/imm32/next
9333
9334 Single-int-var-in-mem:
9335 Int-var-in-mem/imm32
9336 0/imm32/next
9337
9338 Int-var-in-mem:
9339 "arg1"/imm32/name
9340 Type-int/imm32
9341 1/imm32/some-block-depth
9342 1/imm32/some-stack-offset
9343 0/imm32/no-register
9344
9345 Two-args-int-stack-int-reg:
9346 Int-var-in-mem/imm32
9347 Single-int-var-in-some-register/imm32/next
9348
9349 Two-args-int-reg-int-stack:
9350 Int-var-in-some-register/imm32
9351 Single-int-var-in-mem/imm32/next
9352
9353 Two-args-int-eax-int-literal:
9354 Int-var-in-eax/imm32
9355 Single-lit-var/imm32/next
9356
9357 Int-var-and-literal:
9358 Int-var-in-mem/imm32
9359 Single-lit-var/imm32/next
9360
9361 Int-var-in-register-and-literal:
9362 Int-var-in-some-register/imm32
9363 Single-lit-var/imm32/next
9364
9365 Single-int-var-in-some-register:
9366 Int-var-in-some-register/imm32
9367 0/imm32/next
9368
9369 Int-var-in-some-register:
9370 "arg1"/imm32/name
9371 Type-int/imm32
9372 1/imm32/some-block-depth
9373 0/imm32/no-stack-offset
9374 Any-register/imm32
9375
9376 Single-int-var-in-eax:
9377 Int-var-in-eax/imm32
9378 0/imm32/next
9379
9380 Int-var-in-eax:
9381 "arg1"/imm32/name
9382 Type-int/imm32
9383 1/imm32/some-block-depth
9384 0/imm32/no-stack-offset
9385 "eax"/imm32/register
9386
9387 Single-int-var-in-ecx:
9388 Int-var-in-ecx/imm32
9389 0/imm32/next
9390
9391 Int-var-in-ecx:
9392 "arg1"/imm32/name
9393 Type-int/imm32
9394 1/imm32/some-block-depth
9395 0/imm32/no-stack-offset
9396 "ecx"/imm32/register
9397
9398 Single-int-var-in-edx:
9399 Int-var-in-edx/imm32
9400 0/imm32/next
9401
9402 Int-var-in-edx:
9403 "arg1"/imm32/name
9404 Type-int/imm32
9405 1/imm32/some-block-depth
9406 0/imm32/no-stack-offset
9407 "edx"/imm32/register
9408
9409 Single-int-var-in-ebx:
9410 Int-var-in-ebx/imm32
9411 0/imm32/next
9412
9413 Int-var-in-ebx:
9414 "arg1"/imm32/name
9415 Type-int/imm32
9416 1/imm32/some-block-depth
9417 0/imm32/no-stack-offset
9418 "ebx"/imm32/register
9419
9420 Single-int-var-in-esi:
9421 Int-var-in-esi/imm32
9422 0/imm32/next
9423
9424 Int-var-in-esi:
9425 "arg1"/imm32/name
9426 Type-int/imm32
9427 1/imm32/some-block-depth
9428 0/imm32/no-stack-offset
9429 "esi"/imm32/register
9430
9431 Single-int-var-in-edi:
9432 Int-var-in-edi/imm32
9433 0/imm32/next
9434
9435 Int-var-in-edi:
9436 "arg1"/imm32/name
9437 Type-int/imm32
9438 1/imm32/some-block-depth
9439 0/imm32/no-stack-offset
9440 "edi"/imm32/register
9441
9442 Single-lit-var:
9443 Lit-var/imm32
9444 0/imm32/next
9445
9446 Lit-var:
9447 "literal"/imm32/name
9448 Type-literal/imm32
9449 1/imm32/some-block-depth
9450 0/imm32/no-stack-offset
9451 0/imm32/no-register
9452
9453 Type-int:
9454 1/imm32/left/int
9455 0/imm32/right/null
9456
9457 Type-literal:
9458 0/imm32/left/literal
9459 0/imm32/right/null
9460
9461 == code
9462 emit-subx-primitive:
9463
9464 55/push-ebp
9465 89/<- %ebp 4/r32/esp
9466
9467 50/push-eax
9468 51/push-ecx
9469
9470 8b/-> *(ebp+0x10) 1/r32/ecx
9471
9472 (emit-indent *(ebp+8) *Curr-block-depth)
9473 (write-buffered *(ebp+8) *(ecx+0xc))
9474
9475 (emit-subx-rm32 *(ebp+8) *(ecx+0x10) *(ebp+0xc))
9476
9477 (emit-subx-r32 *(ebp+8) *(ecx+0x14) *(ebp+0xc))
9478
9479 (emit-subx-imm32 *(ebp+8) *(ecx+0x18) *(ebp+0xc))
9480
9481 (emit-subx-disp32 *(ebp+8) *(ecx+0x1c) *(ebp+0xc))
9482 (write-buffered *(ebp+8) Newline)
9483 $emit-subx-primitive:end:
9484
9485 59/pop-to-ecx
9486 58/pop-to-eax
9487
9488 89/<- %esp 5/r32/ebp
9489 5d/pop-to-ebp
9490 c3/return
9491
9492 emit-subx-rm32:
9493
9494 55/push-ebp
9495 89/<- %ebp 4/r32/esp
9496
9497 50/push-eax
9498
9499 81 7/subop/compare *(ebp+0xc) 0/imm32
9500 74/jump-if-= $emit-subx-rm32:end/disp8
9501
9502 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9503 (emit-subx-var-as-rm32 *(ebp+8) %eax)
9504 $emit-subx-rm32:end:
9505
9506 58/pop-to-eax
9507
9508 89/<- %esp 5/r32/ebp
9509 5d/pop-to-ebp
9510 c3/return
9511
9512 get-stmt-operand-from-arg-location:
9513
9514 55/push-ebp
9515 89/<- %ebp 4/r32/esp
9516
9517 51/push-ecx
9518
9519 8b/-> *(ebp+0xc) 0/r32/eax
9520
9521 8b/-> *(ebp+8) 1/r32/ecx
9522
9523 {
9524 3d/compare-eax-and 1/imm32
9525 75/jump-if-!= break/disp8
9526 $get-stmt-operand-from-arg-location:1:
9527 8b/-> *(ecx+8) 0/r32/eax
9528 eb/jump $get-stmt-operand-from-arg-location:end/disp8
9529 }
9530
9531 {
9532 3d/compare-eax-and 2/imm32
9533 75/jump-if-!= break/disp8
9534 $get-stmt-operand-from-arg-location:2:
9535 8b/-> *(ecx+8) 0/r32/eax
9536 8b/-> *(eax+4) 0/r32/eax
9537 eb/jump $get-stmt-operand-from-arg-location:end/disp8
9538 }
9539
9540 {
9541 3d/compare-eax-and 3/imm32
9542 75/jump-if-!= break/disp8
9543 $get-stmt-operand-from-arg-location:3:
9544 8b/-> *(ecx+0xc) 0/r32/eax
9545 eb/jump $get-stmt-operand-from-arg-location:end/disp8
9546 }
9547
9548 e9/jump $get-stmt-operand-from-arg-location:abort/disp32
9549 $get-stmt-operand-from-arg-location:end:
9550
9551 59/pop-to-ecx
9552
9553 89/<- %esp 5/r32/ebp
9554 5d/pop-to-ebp
9555 c3/return
9556
9557 $get-stmt-operand-from-arg-location:abort:
9558
9559 (write-buffered Stderr "invalid arg-location ")
9560 (print-int32-buffered Stderr %eax)
9561 (write-buffered Stderr Newline)
9562 (flush Stderr)
9563
9564 bb/copy-to-ebx 1/imm32
9565 b8/copy-to-eax 1/imm32/exit
9566 cd/syscall 0x80/imm8
9567
9568
9569 emit-subx-r32:
9570
9571 55/push-ebp
9572 89/<- %ebp 4/r32/esp
9573
9574 50/push-eax
9575 51/push-ecx
9576
9577 81 7/subop/compare *(ebp+0xc) 0/imm32
9578 0f 84/jump-if-= $emit-subx-r32:end/disp32
9579
9580 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9581 8b/-> *eax 0/r32/eax
9582 (maybe-get Registers *(eax+0x10) 8)
9583 (write-buffered *(ebp+8) Space)
9584 (print-int32-buffered *(ebp+8) *eax)
9585 (write-buffered *(ebp+8) "/r32")
9586 $emit-subx-r32:end:
9587
9588 59/pop-to-ecx
9589 58/pop-to-eax
9590
9591 89/<- %esp 5/r32/ebp
9592 5d/pop-to-ebp
9593 c3/return
9594
9595 emit-subx-imm32:
9596
9597 55/push-ebp
9598 89/<- %ebp 4/r32/esp
9599
9600 50/push-eax
9601 51/push-ecx
9602
9603 81 7/subop/compare *(ebp+0xc) 0/imm32
9604 74/jump-if-= $emit-subx-imm32:end/disp8
9605
9606 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9607 8b/-> *eax 0/r32/eax
9608 (write-buffered *(ebp+8) Space)
9609 (write-buffered *(ebp+8) *eax)
9610 (write-buffered *(ebp+8) "/imm32")
9611 $emit-subx-imm32:end:
9612
9613 59/pop-to-ecx
9614 58/pop-to-eax
9615
9616 89/<- %esp 5/r32/ebp
9617 5d/pop-to-ebp
9618 c3/return
9619
9620 emit-subx-disp32:
9621
9622 55/push-ebp
9623 89/<- %ebp 4/r32/esp
9624
9625 50/push-eax
9626 51/push-ecx
9627
9628 81 7/subop/compare *(ebp+0xc) 0/imm32
9629 0f 84/jump-if-= $emit-subx-disp32:end/disp32
9630
9631 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9632 8b/-> *eax 0/r32/eax
9633 (write-buffered *(ebp+8) Space)
9634 (write-buffered *(ebp+8) *eax)
9635
9636
9637 8b/-> *(ebp+0x10) 0/r32/eax
9638 8b/-> *(eax+4) 1/r32/ecx
9639 {
9640 (string-starts-with? %ecx "break")
9641 3d/compare-eax-and 0/imm32/false
9642 74/jump-if-= break/disp8
9643 (write-buffered *(ebp+8) ":break")
9644 }
9645
9646 {
9647 (string-starts-with? %ecx "loop")
9648 3d/compare-eax-and 0/imm32/false
9649 74/jump-if-= break/disp8
9650 (write-buffered *(ebp+8) ":loop")
9651 }
9652 (write-buffered *(ebp+8) "/disp32")
9653 $emit-subx-disp32:end:
9654
9655 59/pop-to-ecx
9656 58/pop-to-eax
9657
9658 89/<- %esp 5/r32/ebp
9659 5d/pop-to-ebp
9660 c3/return
9661
9662 emit-subx-call:
9663
9664 55/push-ebp
9665 89/<- %ebp 4/r32/esp
9666
9667 51/push-ecx
9668
9669 (emit-indent *(ebp+8) *Curr-block-depth)
9670 (write-buffered *(ebp+8) "(")
9671
9672 8b/-> *(ebp+0x10) 1/r32/ecx
9673 (write-buffered *(ebp+8) *(ecx+4))
9674
9675
9676 8b/-> *(ebp+0xc) 1/r32/ecx
9677 8b/-> *(ecx+8) 1/r32/ecx
9678 {
9679
9680 81 7/subop/compare %ecx 0/imm32
9681 74/jump-if-= break/disp8
9682
9683 (emit-subx-call-operand *(ebp+8) %ecx)
9684
9685 8b/-> *(ecx+4) 1/r32/ecx
9686 eb/jump loop/disp8
9687 }
9688
9689 (write-buffered *(ebp+8) ")\n")
9690 $emit-subx-call:end:
9691
9692 59/pop-to-ecx
9693
9694 89/<- %esp 5/r32/ebp
9695 5d/pop-to-ebp
9696 c3/return
9697
9698
9699
9700 emit-hailmary-call:
9701
9702 55/push-ebp
9703 89/<- %ebp 4/r32/esp
9704
9705 51/push-ecx
9706
9707 (emit-indent *(ebp+8) *Curr-block-depth)
9708 (write-buffered *(ebp+8) "(")
9709
9710 8b/-> *(ebp+0xc) 1/r32/ecx
9711
9712 (write-buffered *(ebp+8) *(ecx+4))
9713
9714
9715 8b/-> *(ecx+8) 1/r32/ecx
9716 {
9717
9718 81 7/subop/compare %ecx 0/imm32
9719 74/jump-if-= break/disp8
9720
9721 (emit-subx-call-operand *(ebp+8) %ecx)
9722
9723 8b/-> *(ecx+4) 1/r32/ecx
9724 eb/jump loop/disp8
9725 }
9726
9727 (write-buffered *(ebp+8) ")\n")
9728 $emit-hailmary-call:end:
9729
9730 59/pop-to-ecx
9731
9732 89/<- %esp 5/r32/ebp
9733 5d/pop-to-ebp
9734 c3/return
9735
9736 emit-subx-call-operand:
9737
9738
9739 55/push-ebp
9740 89/<- %ebp 4/r32/esp
9741
9742 50/push-eax
9743 51/push-ecx
9744 56/push-esi
9745
9746 8b/-> *(ebp+0xc) 1/r32/ecx
9747
9748 8b/-> *ecx 6/r32/esi
9749
9750 {
9751 $emit-subx-call-operand:check-for-register-indirect:
9752 81 7/subop/compare *(esi+0x10) 0/imm32
9753 74/jump-if-= break/disp8
9754 81 7/subop/compare *(ecx+8) 0/imm32/false
9755 74/jump-if-= break/disp8
9756 $emit-subx-call-operand:register-indirect:
9757 (write-buffered *(ebp+8) " *")
9758 (write-buffered *(ebp+8) *(esi+0x10))
9759 e9/jump $emit-subx-call-operand:end/disp32
9760 }
9761
9762 {
9763 $emit-subx-call-operand:check-for-register-direct:
9764 81 7/subop/compare *(esi+0x10) 0/imm32
9765 74/jump-if-= break/disp8
9766 81 7/subop/compare *(ecx+8) 0/imm32/false
9767 75/jump-if-!= break/disp8
9768 $emit-subx-call-operand:register-direct:
9769 (write-buffered *(ebp+8) " %")
9770 (write-buffered *(ebp+8) *(esi+0x10))
9771 e9/jump $emit-subx-call-operand:end/disp32
9772 }
9773
9774 {
9775 81 7/subop/compare *(esi+0xc) 0/imm32
9776 74/jump-if-= break/disp8
9777 $emit-subx-call-operand:stack:
9778 (write-buffered *(ebp+8) Space)
9779 (write-buffered *(ebp+8) "*(ebp+")
9780 (print-int32-buffered *(ebp+8) *(esi+0xc))
9781 (write-buffered *(ebp+8) ")")
9782 e9/jump $emit-subx-call-operand:end/disp32
9783 }
9784
9785 {
9786 8b/-> *(esi+4) 0/r32/eax
9787 81 7/subop/compare *eax 0/imm32
9788 75/jump-if-!= break/disp8
9789 $emit-subx-call-operand:literal:
9790 (write-buffered *(ebp+8) Space)
9791 (write-buffered *(ebp+8) *esi)
9792 }
9793 $emit-subx-call-operand:end:
9794
9795 5e/pop-to-esi
9796 59/pop-to-ecx
9797 58/pop-to-eax
9798
9799 89/<- %esp 5/r32/ebp
9800 5d/pop-to-ebp
9801 c3/return
9802
9803 emit-subx-var-as-rm32:
9804
9805 55/push-ebp
9806 89/<- %ebp 4/r32/esp
9807
9808 50/push-eax
9809 51/push-ecx
9810 56/push-esi
9811
9812 8b/-> *(ebp+0xc) 1/r32/ecx
9813
9814 8b/-> *ecx 6/r32/esi
9815
9816 {
9817 $emit-subx-var-as-rm32:check-for-register-indirect:
9818 81 7/subop/compare *(esi+0x10) 0/imm32
9819 74/jump-if-= break/disp8
9820 81 7/subop/compare *(ecx+8) 0/imm32/false
9821 74/jump-if-= break/disp8
9822 $emit-subx-var-as-rm32:register-indirect:
9823 (write-buffered *(ebp+8) " *")
9824 (write-buffered *(ebp+8) *(esi+0x10))
9825 }
9826
9827 {
9828 $emit-subx-var-as-rm32:check-for-register-direct:
9829 81 7/subop/compare *(esi+0x10) 0/imm32
9830 74/jump-if-= break/disp8
9831 81 7/subop/compare *(ecx+8) 0/imm32/false
9832 75/jump-if-!= break/disp8
9833 $emit-subx-var-as-rm32:register-direct:
9834 (write-buffered *(ebp+8) " %")
9835 (write-buffered *(ebp+8) *(esi+0x10))
9836 }
9837
9838 {
9839 81 7/subop/compare *(esi+0xc) 0/imm32
9840 74/jump-if-= break/disp8
9841 $emit-subx-var-as-rm32:stack:
9842 (write-buffered *(ebp+8) Space)
9843 (write-buffered *(ebp+8) "*(ebp+")
9844 (print-int32-buffered *(ebp+8) *(esi+0xc))
9845 (write-buffered *(ebp+8) ")")
9846 }
9847 $emit-subx-var-as-rm32:end:
9848
9849 5e/pop-to-esi
9850 59/pop-to-ecx
9851 58/pop-to-eax
9852
9853 89/<- %esp 5/r32/ebp
9854 5d/pop-to-ebp
9855 c3/return
9856
9857 find-matching-function:
9858
9859 55/push-ebp
9860 89/<- %ebp 4/r32/esp
9861
9862 51/push-ecx
9863
9864 8b/-> *(ebp+8) 1/r32/ecx
9865 {
9866
9867 81 7/subop/compare %ecx 0/imm32
9868 74/jump-if-= break/disp8
9869
9870 {
9871 (mu-stmt-matches-function? *(ebp+0xc) %ecx)
9872 3d/compare-eax-and 0/imm32/false
9873 74/jump-if-= break/disp8
9874 89/<- %eax 1/r32/ecx
9875 eb/jump $find-matching-function:end/disp8
9876 }
9877
9878 8b/-> *(ecx+0x14) 1/r32/ecx
9879 eb/jump loop/disp8
9880 }
9881
9882 b8/copy-to-eax 0/imm32
9883 $find-matching-function:end:
9884
9885 59/pop-to-ecx
9886
9887 89/<- %esp 5/r32/ebp
9888 5d/pop-to-ebp
9889 c3/return
9890
9891 find-matching-primitive:
9892
9893 55/push-ebp
9894 89/<- %ebp 4/r32/esp
9895
9896 51/push-ecx
9897
9898 8b/-> *(ebp+8) 1/r32/ecx
9899 {
9900 $find-matching-primitive:loop:
9901
9902 81 7/subop/compare %ecx 0/imm32
9903 0f 84/jump-if-= break/disp32
9904
9905
9906
9907
9908
9909
9910
9911 {
9912 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx)
9913 3d/compare-eax-and 0/imm32/false
9914 74/jump-if-= break/disp8
9915 89/<- %eax 1/r32/ecx
9916 eb/jump $find-matching-primitive:end/disp8
9917 }
9918 $find-matching-primitive:next-primitive:
9919
9920 8b/-> *(ecx+0x24) 1/r32/ecx
9921 e9/jump loop/disp32
9922 }
9923
9924 b8/copy-to-eax 0/imm32
9925 $find-matching-primitive:end:
9926
9927 59/pop-to-ecx
9928
9929 89/<- %esp 5/r32/ebp
9930 5d/pop-to-ebp
9931 c3/return
9932
9933 mu-stmt-matches-function?:
9934
9935 55/push-ebp
9936 89/<- %ebp 4/r32/esp
9937
9938 51/push-ecx
9939
9940 8b/-> *(ebp+8) 1/r32/ecx
9941 8b/-> *(ebp+0xc) 0/r32/eax
9942 (string-equal? *(ecx+4) *eax)
9943 $mu-stmt-matches-function?:end:
9944
9945 59/pop-to-ecx
9946
9947 89/<- %esp 5/r32/ebp
9948 5d/pop-to-ebp
9949 c3/return
9950
9951 mu-stmt-matches-primitive?:
9952
9953
9954
9955
9956
9957
9958 55/push-ebp
9959 89/<- %ebp 4/r32/esp
9960
9961 51/push-ecx
9962 52/push-edx
9963 53/push-ebx
9964 56/push-esi
9965 57/push-edi
9966
9967 8b/-> *(ebp+8) 1/r32/ecx
9968
9969 8b/-> *(ebp+0xc) 2/r32/edx
9970 {
9971 $mu-stmt-matches-primitive?:check-name:
9972
9973 (string-equal? *(ecx+4) *edx)
9974 3d/compare-eax-and 0/imm32/false
9975 75/jump-if-!= break/disp8
9976 b8/copy-to-eax 0/imm32
9977 e9/jump $mu-stmt-matches-primitive?:end/disp32
9978 }
9979 $mu-stmt-matches-primitive?:check-inouts:
9980
9981 8b/-> *(ecx+8) 6/r32/esi
9982 8b/-> *(edx+4) 7/r32/edi
9983 {
9984
9985 {
9986 81 7/subop/compare %esi 0/imm32
9987 75/jump-if-!= break/disp8
9988 $mu-stmt-matches-primitive?:stmt-inout-is-null:
9989 {
9990 81 7/subop/compare %edi 0/imm32
9991 75/jump-if-!= break/disp8
9992
9993 e9/jump $mu-stmt-matches-primitive?:check-outputs/disp32
9994 }
9995
9996 b8/copy-to-eax 0/imm32/false
9997 e9/jump $mu-stmt-matches-primitive?:end/disp32
9998 }
9999
10000 {
10001 81 7/subop/compare %edi 0/imm32
10002 75/jump-if-!= break/disp8
10003 $mu-stmt-matches-primitive?:prim-inout-is-null:
10004 b8/copy-to-eax 0/imm32/false
10005 e9/jump $mu-stmt-matches-primitive?:end/disp32
10006 }
10007
10008 {
10009 (operand-matches-primitive? %esi *edi)
10010 3d/compare-eax-and 0/imm32/false
10011 75/jump-if-!= break/disp8
10012 b8/copy-to-eax 0/imm32/false
10013 e9/jump $mu-stmt-matches-primitive?:end/disp32
10014 }
10015
10016 8b/-> *(esi+4) 6/r32/esi
10017
10018 8b/-> *(edi+4) 7/r32/edi
10019 eb/jump loop/disp8
10020 }
10021 $mu-stmt-matches-primitive?:check-outputs:
10022
10023 8b/-> *(ecx+0xc) 6/r32/esi
10024 8b/-> *(edx+8) 7/r32/edi
10025 {
10026
10027 {
10028 $mu-stmt-matches-primitive?:check-output:
10029 81 7/subop/compare %esi 0/imm32
10030 75/jump-if-!= break/disp8
10031 {
10032 81 7/subop/compare %edi 0/imm32
10033 75/jump-if-!= break/disp8
10034
10035 b8/copy-to-eax 1/imm32
10036 e9/jump $mu-stmt-matches-primitive?:end/disp32
10037 }
10038
10039 b8/copy-to-eax 0/imm32
10040 e9/jump $mu-stmt-matches-primitive?:end/disp32
10041 }
10042
10043 {
10044 81 7/subop/compare %edi 0/imm32
10045 75/jump-if-!= break/disp8
10046 b8/copy-to-eax 0/imm32
10047 e9/jump $mu-stmt-matches-primitive?:end/disp32
10048 }
10049
10050 {
10051 (operand-matches-primitive? %esi *edi)
10052 3d/compare-eax-and 0/imm32/false
10053 75/jump-if-!= break/disp8
10054 b8/copy-to-eax 0/imm32
10055 e9/jump $mu-stmt-matches-primitive?:end/disp32
10056 }
10057
10058 8b/-> *(esi+4) 6/r32/esi
10059
10060 8b/-> *(edi+4) 7/r32/edi
10061 eb/jump loop/disp8
10062 }
10063 $mu-stmt-matches-primitive?:return-true:
10064 b8/copy-to-eax 1/imm32
10065 $mu-stmt-matches-primitive?:end:
10066
10067 5f/pop-to-edi
10068 5e/pop-to-esi
10069 5b/pop-to-ebx
10070 5a/pop-to-edx
10071 59/pop-to-ecx
10072
10073 89/<- %esp 5/r32/ebp
10074 5d/pop-to-ebp
10075 c3/return
10076
10077 operand-matches-primitive?:
10078
10079 55/push-ebp
10080 89/<- %ebp 4/r32/esp
10081
10082 51/push-ecx
10083 56/push-esi
10084 57/push-edi
10085
10086 8b/-> *(ebp+8) 1/r32/ecx
10087
10088 8b/-> *ecx 6/r32/esi
10089
10090 8b/-> *(ebp+0xc) 7/r32/edi
10091 $operand-matches-primitive?:check-type:
10092
10093 (subx-type-equal? *(esi+4) *(edi+4))
10094 3d/compare-eax-and 0/imm32/false
10095 b8/copy-to-eax 0/imm32/false
10096 0f 84/jump-if-= $operand-matches-primitive?:end/disp32
10097 {
10098 $operand-matches-primitive?:check-register:
10099
10100 {
10101 81 7/subop/compare *(edi+0x10) 0/imm32
10102 0f 85/jump-if-!= break/disp32
10103 81 7/subop/compare *(esi+0x10) 0/imm32
10104 74/jump-if-= break/disp8
10105 81 7/subop/compare *(ecx+8) 0/imm32/false
10106 74/jump-if-= break/disp8
10107 e9/jump $operand-matches-primitive?:return-true/disp32
10108 }
10109
10110 {
10111 81 7/subop/compare *(edi+0x10) 0/imm32
10112 0f 84/jump-if-= break/disp32
10113 81 7/subop/compare *(esi+0x10) 0/imm32
10114 0f 84/jump-if-= break/disp32
10115 81 7/subop/compare *(ecx+8) 0/imm32/false
10116 74/jump-if-= break/disp8
10117 e9/jump $operand-matches-primitive?:return-false/disp32
10118 }
10119
10120 {
10121
10122 8b/-> *(esi+0x10) 0/r32/eax
10123 39/compare *(edi+0x10) 0/r32/eax
10124 74/jump-if-= break/disp8
10125
10126 3d/compare-eax-and 0/imm32
10127 74/jump-if-= $operand-matches-primitive?:end/disp8
10128 81 7/subop/compare *(edi+0x10) 0/imm32
10129 74/jump-if-= $operand-matches-primitive?:return-false/disp8
10130
10131 (string-equal? *(edi+0x10) Any-register)
10132 3d/compare-eax-and 0/imm32/false
10133 75/jump-if-!= break/disp8
10134
10135 (string-equal? *(esi+0x10) *(edi+0x10))
10136 3d/compare-eax-and 0/imm32/false
10137 74/jump-if-= $operand-matches-primitive?:return-false/disp8
10138 }
10139 }
10140 $operand-matches-primitive?:return-true:
10141 b8/copy-to-eax 1/imm32/true
10142 eb/jump $operand-matches-primitive?:end/disp8
10143 $operand-matches-primitive?:return-false:
10144 b8/copy-to-eax 0/imm32/false
10145 $operand-matches-primitive?:end:
10146
10147 5f/pop-to-edi
10148 5e/pop-to-esi
10149 59/pop-to-ecx
10150
10151 89/<- %esp 5/r32/ebp
10152 5d/pop-to-ebp
10153 c3/return
10154
10155 subx-type-equal?:
10156
10157 55/push-ebp
10158 89/<- %ebp 4/r32/esp
10159
10160 51/push-ecx
10161
10162 (is-simple-mu-type? *(ebp+8) 0)
10163 89/<- %ecx 0/r32/eax
10164
10165 (is-simple-mu-type? *(ebp+0xc) 0)
10166
10167 39/compare %eax 1/r32/ecx
10168 0f 94/set-byte-if-= %al
10169 81 4/subop/and %eax 0xff/imm32
10170 $subx-type-equal?:end:
10171
10172 59/pop-to-ecx
10173
10174 89/<- %esp 5/r32/ebp
10175 5d/pop-to-ebp
10176 c3/return
10177
10178 is-simple-mu-type?:
10179
10180 55/push-ebp
10181 89/<- %ebp 4/r32/esp
10182
10183 51/push-ecx
10184
10185 8b/-> *(ebp+0xc) 1/r32/ecx
10186
10187 8b/-> *(ebp+8) 0/r32/eax
10188 39/compare *eax 1/r32/ecx
10189 0f 94/set-byte-if-= %al
10190 81 4/subop/and %eax 0xff/imm32
10191 $is-simple-mu-type?:end:
10192
10193 59/pop-to-ecx
10194
10195 89/<- %esp 5/r32/ebp
10196 5d/pop-to-ebp
10197 c3/return
10198
10199 test-emit-subx-stmt-primitive:
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218 55/push-ebp
10219 89/<- %ebp 4/r32/esp
10220
10221 (clear-stream _test-output-stream)
10222 (clear-stream $_test-output-buffered-file->buffer)
10223
10224 68/push 0/imm32/right/null
10225 68/push 1/imm32/left/int
10226 89/<- %ecx 4/r32/esp
10227
10228 68/push 0/imm32/no-register
10229 68/push -8/imm32/stack-offset
10230 68/push 1/imm32/block-depth
10231 51/push-ecx
10232 68/push "foo"/imm32
10233 89/<- %ecx 4/r32/esp
10234
10235 68/push 0/imm32/is-deref:false
10236 68/push 0/imm32/next
10237 51/push-ecx/var-foo
10238 89/<- %ebx 4/r32/esp
10239
10240 68/push 0/imm32/next
10241 68/push 0/imm32/outputs
10242 53/push-ebx/operands
10243 68/push "increment"/imm32/operation
10244 68/push 1/imm32
10245 89/<- %esi 4/r32/esp
10246
10247 68/push 0/imm32/next
10248 68/push 0/imm32/output-is-write-only
10249 68/push 0/imm32/no-disp32
10250 68/push 0/imm32/no-imm32
10251 68/push 0/imm32/no-r32
10252 68/push 1/imm32/rm32-is-first-inout
10253 68/push "ff 0/subop/increment"/imm32/subx-name
10254 68/push 0/imm32/outputs
10255 53/push-ebx/inouts
10256 68/push "increment"/imm32/name
10257 89/<- %ebx 4/r32/esp
10258
10259 c7 0/subop/copy *Curr-block-depth 0/imm32
10260 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
10261 (flush _test-output-buffered-file)
10262 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10268
10269 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive")
10270
10271 89/<- %esp 5/r32/ebp
10272 5d/pop-to-ebp
10273 c3/return
10274
10275 test-emit-subx-stmt-primitive-register:
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294 55/push-ebp
10295 89/<- %ebp 4/r32/esp
10296
10297 (clear-stream _test-output-stream)
10298 (clear-stream $_test-output-buffered-file->buffer)
10299
10300 68/push 0/imm32/right/null
10301 68/push 1/imm32/left/int
10302 89/<- %ecx 4/r32/esp
10303
10304 68/push "eax"/imm32/register
10305 68/push 0/imm32/no-stack-offset
10306 68/push 1/imm32/block-depth
10307 51/push-ecx
10308 68/push "foo"/imm32
10309 89/<- %ecx 4/r32/esp
10310
10311 68/push 0/imm32/is-deref:false
10312 68/push 0/imm32/next
10313 51/push-ecx/var-foo
10314 89/<- %ebx 4/r32/esp
10315
10316 68/push 0/imm32/next
10317 53/push-ebx/outputs
10318 68/push 0/imm32/inouts
10319 68/push "increment"/imm32/operation
10320 68/push 1/imm32
10321 89/<- %esi 4/r32/esp
10322
10323 68/push Any-register/imm32
10324 68/push 0/imm32/no-stack-offset
10325 68/push 1/imm32/block-depth
10326 ff 6/subop/push *(ecx+4)
10327 68/push "dummy"/imm32
10328 89/<- %ebx 4/r32/esp
10329
10330 68/push 0/imm32/is-deref:false
10331 68/push 0/imm32/next
10332 53/push-ebx/formal-var
10333 89/<- %ebx 4/r32/esp
10334
10335 68/push 0/imm32/next
10336 68/push 0/imm32/output-is-write-only
10337 68/push 0/imm32/no-disp32
10338 68/push 0/imm32/no-imm32
10339 68/push 0/imm32/no-r32
10340 68/push 3/imm32/rm32-in-first-output
10341 68/push "ff 0/subop/increment"/imm32/subx-name
10342 53/push-ebx/outputs
10343 68/push 0/imm32/inouts
10344 68/push "increment"/imm32/name
10345 89/<- %ebx 4/r32/esp
10346
10347 c7 0/subop/copy *Curr-block-depth 0/imm32
10348 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
10349 (flush _test-output-buffered-file)
10350 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10356
10357 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register")
10358
10359 89/<- %esp 5/r32/ebp
10360 5d/pop-to-ebp
10361 c3/return
10362
10363 test-emit-subx-stmt-select-primitive:
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385 55/push-ebp
10386 89/<- %ebp 4/r32/esp
10387
10388 (clear-stream _test-output-stream)
10389 (clear-stream $_test-output-buffered-file->buffer)
10390
10391 68/push 0/imm32/right/null
10392 68/push 1/imm32/left/int
10393 89/<- %ecx 4/r32/esp
10394
10395 68/push "eax"/imm32/register
10396 68/push 0/imm32/no-stack-offset
10397 68/push 1/imm32/block-depth
10398 51/push-ecx
10399 68/push "foo"/imm32
10400 89/<- %ecx 4/r32/esp
10401
10402 68/push 0/imm32/is-deref:false
10403 68/push 0/imm32/next
10404 51/push-ecx/var-foo
10405 89/<- %edi 4/r32/esp
10406
10407 68/push 0/imm32/next
10408 57/push-edi/outputs
10409 68/push 0/imm32/inouts
10410 68/push "increment"/imm32/operation
10411 68/push 1/imm32
10412 89/<- %esi 4/r32/esp
10413
10414 68/push Any-register/imm32
10415 68/push 0/imm32/no-stack-offset
10416 68/push 1/imm32/block-depth
10417 ff 6/subop/push *(ecx+4)
10418 68/push "dummy"/imm32
10419 89/<- %ebx 4/r32/esp
10420
10421 68/push 0/imm32/is-deref:false
10422 68/push 0/imm32/next
10423 53/push-ebx/formal-var
10424 89/<- %ebx 4/r32/esp
10425
10426 68/push 0/imm32/next
10427 68/push 0/imm32/output-is-write-only
10428 68/push 0/imm32/no-disp32
10429 68/push 0/imm32/no-imm32
10430 68/push 0/imm32/no-r32
10431 68/push 3/imm32/rm32-in-first-output
10432 68/push "ff 0/subop/increment"/imm32/subx-name
10433 53/push-ebx/outputs/formal-outputs
10434 68/push 0/imm32/inouts
10435 68/push "increment"/imm32/name
10436 89/<- %ebx 4/r32/esp
10437
10438 53/push-ebx/next
10439 68/push 0/imm32/output-is-write-only
10440 68/push 0/imm32/no-disp32
10441 68/push 0/imm32/no-imm32
10442 68/push 0/imm32/no-r32
10443 68/push 1/imm32/rm32-is-first-inout
10444 68/push "ff 0/subop/increment"/imm32/subx-name
10445 68/push 0/imm32/outputs
10446 57/push-edi/inouts/real-outputs
10447 68/push "increment"/imm32/name
10448 89/<- %ebx 4/r32/esp
10449
10450 c7 0/subop/copy *Curr-block-depth 0/imm32
10451 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
10452 (flush _test-output-buffered-file)
10453 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10459
10460 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive")
10461
10462 89/<- %esp 5/r32/ebp
10463 5d/pop-to-ebp
10464 c3/return
10465
10466 test-emit-subx-stmt-select-primitive-2:
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488 55/push-ebp
10489 89/<- %ebp 4/r32/esp
10490
10491 (clear-stream _test-output-stream)
10492 (clear-stream $_test-output-buffered-file->buffer)
10493
10494 68/push 0/imm32/right/null
10495 68/push 1/imm32/left/int
10496 89/<- %ecx 4/r32/esp
10497
10498 68/push "eax"/imm32/register
10499 68/push 0/imm32/no-stack-offset
10500 68/push 1/imm32/block-depth
10501 51/push-ecx
10502 68/push "foo"/imm32
10503 89/<- %ecx 4/r32/esp
10504
10505 68/push 0/imm32/is-deref:false
10506 68/push 0/imm32/next
10507 51/push-ecx/var-foo
10508 89/<- %edi 4/r32/esp
10509
10510 68/push 0/imm32/next
10511 68/push 0/imm32/outputs
10512 57/push-edi/inouts
10513 68/push "increment"/imm32/operation
10514 68/push 1/imm32
10515 89/<- %esi 4/r32/esp
10516
10517 68/push Any-register/imm32
10518 68/push 0/imm32/no-stack-offset
10519 68/push 1/imm32/block-depth
10520 ff 6/subop/push *(ecx+4)
10521 68/push "dummy"/imm32
10522 89/<- %ebx 4/r32/esp
10523
10524 68/push 0/imm32/is-deref:false
10525 68/push 0/imm32/next
10526 53/push-ebx/formal-var
10527 89/<- %ebx 4/r32/esp
10528
10529 68/push 0/imm32/next
10530 68/push 0/imm32/output-is-write-only
10531 68/push 0/imm32/no-disp32
10532 68/push 0/imm32/no-imm32
10533 68/push 0/imm32/no-r32
10534 68/push 3/imm32/rm32-in-first-output
10535 68/push "ff 0/subop/increment"/imm32/subx-name
10536 53/push-ebx/outputs/formal-outputs
10537 68/push 0/imm32/inouts
10538 68/push "increment"/imm32/name
10539 89/<- %ebx 4/r32/esp
10540
10541 53/push-ebx/next
10542 68/push 0/imm32/output-is-write-only
10543 68/push 0/imm32/no-disp32
10544 68/push 0/imm32/no-imm32
10545 68/push 0/imm32/no-r32
10546 68/push 1/imm32/rm32-is-first-inout
10547 68/push "ff 0/subop/increment"/imm32/subx-name
10548 68/push 0/imm32/outputs
10549 57/push-edi/inouts/real-outputs
10550 68/push "increment"/imm32/name
10551 89/<- %ebx 4/r32/esp
10552
10553 c7 0/subop/copy *Curr-block-depth 0/imm32
10554 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
10555 (flush _test-output-buffered-file)
10556 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10562
10563 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2")
10564
10565 89/<- %esp 5/r32/ebp
10566 5d/pop-to-ebp
10567 c3/return
10568
10569 test-increment-register:
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585 55/push-ebp
10586 89/<- %ebp 4/r32/esp
10587
10588 (clear-stream _test-output-stream)
10589 (clear-stream $_test-output-buffered-file->buffer)
10590
10591 68/push 0/imm32/right/null
10592 68/push 1/imm32/left/int
10593 89/<- %ecx 4/r32/esp
10594
10595 68/push "eax"/imm32/register
10596 68/push 0/imm32/no-stack-offset
10597 68/push 1/imm32/block-depth
10598 51/push-ecx
10599 68/push "foo"/imm32
10600 89/<- %ecx 4/r32/esp
10601
10602 68/push 0/imm32/is-deref:false
10603 68/push 0/imm32/next
10604 51/push-ecx/var-foo
10605 89/<- %edi 4/r32/esp
10606
10607 68/push 0/imm32/next
10608 57/push-edi/outputs
10609 68/push 0/imm32/inouts
10610 68/push "increment"/imm32/operation
10611 68/push 1/imm32/regular-stmt
10612 89/<- %esi 4/r32/esp
10613
10614 c7 0/subop/copy *Curr-block-depth 0/imm32
10615 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10616 (flush _test-output-buffered-file)
10617 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10623
10624 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register")
10625
10626 89/<- %esp 5/r32/ebp
10627 5d/pop-to-ebp
10628 c3/return
10629
10630 test-increment-var:
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646 55/push-ebp
10647 89/<- %ebp 4/r32/esp
10648
10649 (clear-stream _test-output-stream)
10650 (clear-stream $_test-output-buffered-file->buffer)
10651
10652 68/push 0/imm32/right/null
10653 68/push 1/imm32/left/int
10654 89/<- %ecx 4/r32/esp
10655
10656 68/push "eax"/imm32/register
10657 68/push 0/imm32/no-stack-offset
10658 68/push 1/imm32/block-depth
10659 51/push-ecx
10660 68/push "foo"/imm32
10661 89/<- %ecx 4/r32/esp
10662
10663 68/push 0/imm32/is-deref:false
10664 68/push 0/imm32/next
10665 51/push-ecx/var-foo
10666 89/<- %edi 4/r32/esp
10667
10668 68/push 0/imm32/next
10669 57/push-edi/outputs
10670 68/push 0/imm32/inouts
10671 68/push "increment"/imm32/operation
10672 68/push 1/imm32
10673 89/<- %esi 4/r32/esp
10674
10675 c7 0/subop/copy *Curr-block-depth 0/imm32
10676 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10677 (flush _test-output-buffered-file)
10678 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10684
10685 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-var")
10686
10687 89/<- %esp 5/r32/ebp
10688 5d/pop-to-ebp
10689 c3/return
10690
10691 test-add-reg-to-reg:
10692
10693
10694
10695
10696
10697 55/push-ebp
10698 89/<- %ebp 4/r32/esp
10699
10700 (clear-stream _test-output-stream)
10701 (clear-stream $_test-output-buffered-file->buffer)
10702
10703 68/push 0/imm32/right/null
10704 68/push 1/imm32/left/int
10705 89/<- %ecx 4/r32/esp
10706
10707 68/push "eax"/imm32/register
10708 68/push 0/imm32/no-stack-offset
10709 68/push 1/imm32/block-depth
10710 51/push-ecx
10711 68/push "var1"/imm32
10712 89/<- %ecx 4/r32/esp
10713
10714 68/push "ecx"/imm32/register
10715 68/push 0/imm32/no-stack-offset
10716 68/push 1/imm32/block-depth
10717 ff 6/subop/push *(ecx+4)
10718 68/push "var2"/imm32
10719 89/<- %edx 4/r32/esp
10720
10721 68/push 0/imm32/is-deref:false
10722 68/push 0/imm32/next
10723 52/push-edx/var-var2
10724 89/<- %esi 4/r32/esp
10725
10726 68/push 0/imm32/is-deref:false
10727 68/push 0/imm32/next
10728 51/push-ecx/var-var1
10729 89/<- %edi 4/r32/esp
10730
10731 68/push 0/imm32/next
10732 57/push-edi/outputs
10733 56/push-esi/inouts
10734 68/push "add"/imm32/operation
10735 68/push 1/imm32
10736 89/<- %esi 4/r32/esp
10737
10738 c7 0/subop/copy *Curr-block-depth 0/imm32
10739 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10740 (flush _test-output-buffered-file)
10741 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10747
10748 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg")
10749
10750 89/<- %esp 5/r32/ebp
10751 5d/pop-to-ebp
10752 c3/return
10753
10754 test-add-reg-to-mem:
10755
10756
10757
10758
10759
10760 55/push-ebp
10761 89/<- %ebp 4/r32/esp
10762
10763 (clear-stream _test-output-stream)
10764 (clear-stream $_test-output-buffered-file->buffer)
10765
10766 68/push 0/imm32/right/null
10767 68/push 1/imm32/left/int
10768 89/<- %ecx 4/r32/esp
10769
10770 68/push 0/imm32/no-register
10771 68/push 8/imm32/stack-offset
10772 68/push 1/imm32/block-depth
10773 51/push-ecx
10774 68/push "var1"/imm32
10775 89/<- %ecx 4/r32/esp
10776
10777 68/push "ecx"/imm32/register
10778 68/push 0/imm32/no-stack-offset
10779 68/push 1/imm32/block-depth
10780 ff 6/subop/push *(ecx+4)
10781 68/push "var2"/imm32
10782 89/<- %edx 4/r32/esp
10783
10784 68/push 0/imm32/is-deref:false
10785 68/push 0/imm32/next
10786 52/push-edx/var-var2
10787 89/<- %esi 4/r32/esp
10788
10789 56/push-esi/next
10790 51/push-ecx/var-var1
10791 89/<- %esi 4/r32/esp
10792
10793 68/push 0/imm32/next
10794 68/push 0/imm32/outputs
10795 56/push-esi/inouts
10796 68/push "add-to"/imm32/operation
10797 68/push 1/imm32
10798 89/<- %esi 4/r32/esp
10799
10800 c7 0/subop/copy *Curr-block-depth 0/imm32
10801 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10802 (flush _test-output-buffered-file)
10803 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10809
10810 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem")
10811
10812 89/<- %esp 5/r32/ebp
10813 5d/pop-to-ebp
10814 c3/return
10815
10816 test-add-mem-to-reg:
10817
10818
10819
10820
10821
10822 55/push-ebp
10823 89/<- %ebp 4/r32/esp
10824
10825 (clear-stream _test-output-stream)
10826 (clear-stream $_test-output-buffered-file->buffer)
10827
10828 68/push 0/imm32/right/null
10829 68/push 1/imm32/left/int
10830 89/<- %ecx 4/r32/esp
10831
10832 68/push "eax"/imm32/register
10833 68/push 0/imm32/no-stack-offset
10834 68/push 1/imm32/block-depth
10835 51/push-ecx
10836 68/push "var1"/imm32
10837 89/<- %ecx 4/r32/esp
10838
10839 68/push 0/imm32/no-register
10840 68/push 8/imm32/stack-offset
10841 68/push 1/imm32/block-depth
10842 ff 6/subop/push *(ecx+4)
10843 68/push "var2"/imm32
10844 89/<- %edx 4/r32/esp
10845
10846 68/push 0/imm32/is-deref:false
10847 68/push 0/imm32/next
10848 52/push-edx/var-var2
10849 89/<- %esi 4/r32/esp
10850
10851 68/push 0/imm32/is-deref:false
10852 68/push 0/imm32/next
10853 51/push-ecx/var-var1
10854 89/<- %edi 4/r32/esp
10855
10856 68/push 0/imm32/next
10857 57/push-edi/outputs
10858 56/push-esi/inouts
10859 68/push "add"/imm32/operation
10860 68/push 1/imm32
10861 89/<- %esi 4/r32/esp
10862
10863 c7 0/subop/copy *Curr-block-depth 0/imm32
10864 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10865 (flush _test-output-buffered-file)
10866 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10872
10873 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg")
10874
10875 89/<- %esp 5/r32/ebp
10876 5d/pop-to-ebp
10877 c3/return
10878
10879 test-add-literal-to-eax:
10880
10881
10882
10883
10884
10885 55/push-ebp
10886 89/<- %ebp 4/r32/esp
10887
10888 (clear-stream _test-output-stream)
10889 (clear-stream $_test-output-buffered-file->buffer)
10890
10891 68/push 0/imm32/right/null
10892 68/push 1/imm32/left/int
10893 89/<- %ecx 4/r32/esp
10894
10895 68/push "eax"/imm32/register
10896 68/push 0/imm32/no-stack-offset
10897 68/push 1/imm32/block-depth
10898 51/push-ecx
10899 68/push "var1"/imm32
10900 89/<- %ecx 4/r32/esp
10901
10902 68/push 0/imm32/right/null
10903 68/push 0/imm32/left/literal
10904 89/<- %edx 4/r32/esp
10905
10906 68/push 0/imm32/no-register
10907 68/push 0/imm32/no-stack-offset
10908 68/push 1/imm32/block-depth
10909 52/push-edx
10910 68/push "0x34"/imm32
10911 89/<- %edx 4/r32/esp
10912
10913 68/push 0/imm32/is-deref:false
10914 68/push 0/imm32/next
10915 52/push-edx/var-var2
10916 89/<- %esi 4/r32/esp
10917
10918 68/push 0/imm32/is-deref:false
10919 68/push 0/imm32/next
10920 51/push-ecx/var-var1
10921 89/<- %edi 4/r32/esp
10922
10923 68/push 0/imm32/next
10924 57/push-edi/outputs
10925 56/push-esi/inouts
10926 68/push "add"/imm32/operation
10927 68/push 1/imm32
10928 89/<- %esi 4/r32/esp
10929
10930 c7 0/subop/copy *Curr-block-depth 0/imm32
10931 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10932 (flush _test-output-buffered-file)
10933 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10939
10940 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax")
10941
10942 89/<- %esp 5/r32/ebp
10943 5d/pop-to-ebp
10944 c3/return
10945
10946 test-add-literal-to-reg:
10947
10948
10949
10950
10951
10952 55/push-ebp
10953 89/<- %ebp 4/r32/esp
10954
10955 (clear-stream _test-output-stream)
10956 (clear-stream $_test-output-buffered-file->buffer)
10957
10958 68/push 0/imm32/right/null
10959 68/push 1/imm32/left/int
10960 89/<- %ecx 4/r32/esp
10961
10962 68/push "ecx"/imm32/register
10963 68/push 0/imm32/no-stack-offset
10964 68/push 1/imm32/block-depth
10965 51/push-ecx
10966 68/push "var1"/imm32
10967 89/<- %ecx 4/r32/esp
10968
10969 68/push 0/imm32/right/null
10970 68/push 0/imm32/left/literal
10971 89/<- %edx 4/r32/esp
10972
10973 68/push 0/imm32/no-register
10974 68/push 0/imm32/no-stack-offset
10975 68/push 1/imm32/block-depth
10976 52/push-edx
10977 68/push "0x34"/imm32
10978 89/<- %edx 4/r32/esp
10979
10980 68/push 0/imm32/is-deref:false
10981 68/push 0/imm32/next
10982 52/push-edx/var-var2
10983 89/<- %esi 4/r32/esp
10984
10985 68/push 0/imm32/is-deref:false
10986 68/push 0/imm32/next
10987 51/push-ecx/var-var1
10988 89/<- %edi 4/r32/esp
10989
10990 68/push 0/imm32/next
10991 57/push-edi/outputs
10992 56/push-esi/inouts
10993 68/push "add"/imm32/operation
10994 68/push 1/imm32
10995 89/<- %esi 4/r32/esp
10996
10997 c7 0/subop/copy *Curr-block-depth 0/imm32
10998 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10999 (flush _test-output-buffered-file)
11000 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11006
11007 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg")
11008
11009 89/<- %esp 5/r32/ebp
11010 5d/pop-to-ebp
11011 c3/return
11012
11013 test-add-literal-to-mem:
11014
11015
11016
11017
11018
11019 55/push-ebp
11020 89/<- %ebp 4/r32/esp
11021
11022 (clear-stream _test-output-stream)
11023 (clear-stream $_test-output-buffered-file->buffer)
11024
11025 68/push 0/imm32/right/null
11026 68/push 1/imm32/left/int
11027 89/<- %ecx 4/r32/esp
11028
11029 68/push 0/imm32/no-register
11030 68/push 8/imm32/stack-offset
11031 68/push 1/imm32/block-depth
11032 51/push-ecx
11033 68/push "var1"/imm32
11034 89/<- %ecx 4/r32/esp
11035
11036 68/push 0/imm32/right/null
11037 68/push 0/imm32/left/literal
11038 89/<- %edx 4/r32/esp
11039
11040 68/push 0/imm32/no-register
11041 68/push 0/imm32/no-stack-offset
11042 68/push 1/imm32/block-depth
11043 52/push-edx
11044 68/push "0x34"/imm32
11045 89/<- %edx 4/r32/esp
11046
11047 68/push 0/imm32/is-deref:false
11048 68/push 0/imm32/next
11049 52/push-edx/var-var2
11050 89/<- %esi 4/r32/esp
11051
11052 68/push 0/imm32/is-deref:false
11053 56/push-esi/next
11054 51/push-ecx/var-var1
11055 89/<- %esi 4/r32/esp
11056
11057 68/push 0/imm32/next
11058 68/push 0/imm32/outputs
11059 56/push-esi/inouts
11060 68/push "add-to"/imm32/operation
11061 68/push 1/imm32
11062 89/<- %esi 4/r32/esp
11063
11064 c7 0/subop/copy *Curr-block-depth 0/imm32
11065 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11066 (flush _test-output-buffered-file)
11067 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11073
11074 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem")
11075
11076 89/<- %esp 5/r32/ebp
11077 5d/pop-to-ebp
11078 c3/return
11079
11080 test-compare-mem-with-reg:
11081
11082
11083
11084
11085
11086 55/push-ebp
11087 89/<- %ebp 4/r32/esp
11088
11089 (clear-stream _test-output-stream)
11090 (clear-stream $_test-output-buffered-file->buffer)
11091
11092 68/push 0/imm32/right/null
11093 68/push 1/imm32/left/int
11094 89/<- %ecx 4/r32/esp
11095
11096 68/push "eax"/imm32/register
11097 68/push 0/imm32/no-stack-offset
11098 68/push 1/imm32/block-depth
11099 51/push-ecx
11100 68/push "var2"/imm32
11101 89/<- %ecx 4/r32/esp
11102
11103 68/push 0/imm32/no-register
11104 68/push 8/imm32/stack-offset
11105 68/push 1/imm32/block-depth
11106 ff 6/subop/push *(ecx+4)
11107 68/push "var1"/imm32
11108 89/<- %edx 4/r32/esp
11109
11110 68/push 0/imm32/is-deref:false
11111 68/push 0/imm32/next
11112 51/push-ecx/var-var2
11113 89/<- %esi 4/r32/esp
11114
11115 68/push 0/imm32/is-deref:false
11116 56/push-esi
11117 52/push-edx/var-var1
11118 89/<- %esi 4/r32/esp
11119
11120 68/push 0/imm32/next
11121 68/push 0/imm32/outputs
11122 56/push-esi/inouts
11123 68/push "compare"/imm32/operation
11124 68/push 1/imm32
11125 89/<- %esi 4/r32/esp
11126
11127 c7 0/subop/copy *Curr-block-depth 0/imm32
11128 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11129 (flush _test-output-buffered-file)
11130 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11136
11137 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg")
11138
11139 89/<- %esp 5/r32/ebp
11140 5d/pop-to-ebp
11141 c3/return
11142
11143 test-compare-reg-with-mem:
11144
11145
11146
11147
11148
11149 55/push-ebp
11150 89/<- %ebp 4/r32/esp
11151
11152 (clear-stream _test-output-stream)
11153 (clear-stream $_test-output-buffered-file->buffer)
11154
11155 68/push 0/imm32/right/null
11156 68/push 1/imm32/left/int
11157 89/<- %ecx 4/r32/esp
11158
11159 68/push "eax"/imm32/register
11160 68/push 0/imm32/no-stack-offset
11161 68/push 1/imm32/block-depth
11162 51/push-ecx
11163 68/push "var1"/imm32
11164 89/<- %ecx 4/r32/esp
11165
11166 68/push 0/imm32/no-register
11167 68/push 8/imm32/stack-offset
11168 68/push 1/imm32/block-depth
11169 ff 6/subop/push *(ecx+4)
11170 68/push "var2"/imm32
11171 89/<- %edx 4/r32/esp
11172
11173 68/push 0/imm32/is-deref:false
11174 68/push 0/imm32/next
11175 52/push-edx/var-var2
11176 89/<- %esi 4/r32/esp
11177
11178 68/push 0/imm32/is-deref:false
11179 56/push-esi
11180 51/push-ecx/var-var1
11181 89/<- %esi 4/r32/esp
11182
11183 68/push 0/imm32/next
11184 68/push 0/imm32/outputs
11185 56/push-esi/inouts
11186 68/push "compare"/imm32/operation
11187 68/push 1/imm32
11188 89/<- %esi 4/r32/esp
11189
11190 c7 0/subop/copy *Curr-block-depth 0/imm32
11191 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11192 (flush _test-output-buffered-file)
11193 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11199
11200 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem")
11201
11202 89/<- %esp 5/r32/ebp
11203 5d/pop-to-ebp
11204 c3/return
11205
11206 test-compare-mem-with-literal:
11207
11208
11209
11210
11211
11212 55/push-ebp
11213 89/<- %ebp 4/r32/esp
11214
11215 (clear-stream _test-output-stream)
11216 (clear-stream $_test-output-buffered-file->buffer)
11217
11218 68/push 0/imm32/right/null
11219 68/push 1/imm32/left/int
11220 89/<- %ecx 4/r32/esp
11221
11222 68/push 0/imm32/no-register
11223 68/push 8/imm32/stack-offset
11224 68/push 1/imm32/block-depth
11225 51/push-ecx
11226 68/push "var1"/imm32
11227 89/<- %ecx 4/r32/esp
11228
11229 68/push 0/imm32/right/null
11230 68/push 0/imm32/left/literal
11231 89/<- %edx 4/r32/esp
11232
11233 68/push 0/imm32/no-register
11234 68/push 0/imm32/no-stack-offset
11235 68/push 1/imm32/block-depth
11236 52/push-edx
11237 68/push "0x34"/imm32
11238 89/<- %edx 4/r32/esp
11239
11240 68/push 0/imm32/is-deref:false
11241 68/push 0/imm32/next
11242 52/push-edx/var-var2
11243 89/<- %esi 4/r32/esp
11244
11245 68/push 0/imm32/is-deref:false
11246 56/push-esi/next
11247 51/push-ecx/var-var1
11248 89/<- %esi 4/r32/esp
11249
11250 68/push 0/imm32/next
11251 68/push 0/imm32/outputs
11252 56/push-esi/inouts
11253 68/push "compare"/imm32/operation
11254 68/push 1/imm32
11255 89/<- %esi 4/r32/esp
11256
11257 c7 0/subop/copy *Curr-block-depth 0/imm32
11258 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11259 (flush _test-output-buffered-file)
11260 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11266
11267 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal")
11268
11269 89/<- %esp 5/r32/ebp
11270 5d/pop-to-ebp
11271 c3/return
11272
11273 test-compare-eax-with-literal:
11274
11275
11276
11277
11278
11279 55/push-ebp
11280 89/<- %ebp 4/r32/esp
11281
11282 (clear-stream _test-output-stream)
11283 (clear-stream $_test-output-buffered-file->buffer)
11284
11285 68/push 0/imm32/right/null
11286 68/push 1/imm32/left/int
11287 89/<- %ecx 4/r32/esp
11288
11289 68/push "eax"/imm32/register
11290 68/push 0/imm32/no-stack-offset
11291 68/push 1/imm32/block-depth
11292 51/push-ecx
11293 68/push "var1"/imm32
11294 89/<- %ecx 4/r32/esp
11295
11296 68/push 0/imm32/right/null
11297 68/push 0/imm32/left/literal
11298 89/<- %edx 4/r32/esp
11299
11300 68/push 0/imm32/no-register
11301 68/push 0/imm32/no-stack-offset
11302 68/push 1/imm32/block-depth
11303 52/push-edx
11304 68/push "0x34"/imm32
11305 89/<- %edx 4/r32/esp
11306
11307 68/push 0/imm32/is-deref:false
11308 68/push 0/imm32/next
11309 52/push-edx/var-var2
11310 89/<- %esi 4/r32/esp
11311
11312 68/push 0/imm32/is-deref:false
11313 56/push-esi/next
11314 51/push-ecx/var-var1
11315 89/<- %esi 4/r32/esp
11316
11317 68/push 0/imm32/next
11318 68/push 0/imm32/outputs
11319 56/push-esi/inouts
11320 68/push "compare"/imm32/operation
11321 68/push 1/imm32/regular-stmt
11322 89/<- %esi 4/r32/esp
11323
11324 c7 0/subop/copy *Curr-block-depth 0/imm32
11325 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11326 (flush _test-output-buffered-file)
11327 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11333
11334 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal")
11335
11336 89/<- %esp 5/r32/ebp
11337 5d/pop-to-ebp
11338 c3/return
11339
11340 test-compare-reg-with-literal:
11341
11342
11343
11344
11345
11346 55/push-ebp
11347 89/<- %ebp 4/r32/esp
11348
11349 (clear-stream _test-output-stream)
11350 (clear-stream $_test-output-buffered-file->buffer)
11351
11352 68/push 0/imm32/right/null
11353 68/push 1/imm32/left/int
11354 89/<- %ecx 4/r32/esp
11355
11356 68/push "ecx"/imm32/register
11357 68/push 0/imm32/no-stack-offset
11358 68/push 1/imm32/block-depth
11359 51/push-ecx
11360 68/push "var1"/imm32
11361 89/<- %ecx 4/r32/esp
11362
11363 68/push 0/imm32/right/null
11364 68/push 0/imm32/left/literal
11365 89/<- %edx 4/r32/esp
11366
11367 68/push 0/imm32/no-register
11368 68/push 0/imm32/no-stack-offset
11369 68/push 1/imm32/block-depth
11370 52/push-edx
11371 68/push "0x34"/imm32
11372 89/<- %edx 4/r32/esp
11373
11374 68/push 0/imm32/is-deref:false
11375 68/push 0/imm32/next
11376 52/push-edx/var-var2
11377 89/<- %esi 4/r32/esp
11378
11379 68/push 0/imm32/is-deref:false
11380 56/push-esi/next
11381 51/push-ecx/var-var1
11382 89/<- %esi 4/r32/esp
11383
11384 68/push 0/imm32/next
11385 68/push 0/imm32/outputs
11386 56/push-esi/inouts
11387 68/push "compare"/imm32/operation
11388 68/push 1/imm32/regular-stmt
11389 89/<- %esi 4/r32/esp
11390
11391 c7 0/subop/copy *Curr-block-depth 0/imm32
11392 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11393 (flush _test-output-buffered-file)
11394 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11400
11401 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal")
11402
11403 89/<- %esp 5/r32/ebp
11404 5d/pop-to-ebp
11405 c3/return
11406
11407 test-emit-subx-stmt-function-call:
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428 55/push-ebp
11429 89/<- %ebp 4/r32/esp
11430
11431 (clear-stream _test-output-stream)
11432 (clear-stream $_test-output-buffered-file->buffer)
11433
11434 68/push 0/imm32/right/null
11435 68/push 1/imm32/left/int
11436 89/<- %ecx 4/r32/esp
11437
11438 68/push 0/imm32/no-register
11439 68/push -8/imm32/stack-offset
11440 68/push 0/imm32/block-depth
11441 51/push-ecx
11442 68/push "foo"/imm32
11443 89/<- %ecx 4/r32/esp
11444
11445 68/push 0/imm32/is-deref:false
11446 68/push 0/imm32/next
11447 51/push-ecx/var-foo
11448 89/<- %esi 4/r32/esp
11449
11450 68/push 0/imm32/next
11451 68/push 0/imm32/outputs
11452 56/push-esi/inouts
11453 68/push "f"/imm32/operation
11454 68/push 1/imm32
11455 89/<- %esi 4/r32/esp
11456
11457 68/push 0/imm32/next
11458 68/push 0/imm32/body
11459 68/push 0/imm32/outputs
11460 51/push-ecx/inouts
11461 68/push "f2"/imm32/subx-name
11462 68/push "f"/imm32/name
11463 89/<- %ebx 4/r32/esp
11464
11465 c7 0/subop/copy *Curr-block-depth 0/imm32
11466 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx)
11467 (flush _test-output-buffered-file)
11468 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11474
11475 (check-next-stream-line-equal _test-output-stream "(f2 *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call")
11476
11477 89/<- %esp 5/r32/ebp
11478 5d/pop-to-ebp
11479 c3/return
11480
11481 test-emit-subx-stmt-function-call-with-literal-arg:
11482
11483
11484
11485
11486
11487
11488 55/push-ebp
11489 89/<- %ebp 4/r32/esp
11490
11491 (clear-stream _test-output-stream)
11492 (clear-stream $_test-output-buffered-file->buffer)
11493
11494 68/push 0/imm32/right/null
11495 68/push 0/imm32/left/literal
11496 89/<- %ecx 4/r32/esp
11497
11498 68/push 0/imm32/no-register
11499 68/push 0/imm32/no-stack-offset
11500 68/push 0/imm32/block-depth
11501 51/push-ecx
11502 68/push "34"/imm32
11503 89/<- %ecx 4/r32/esp
11504
11505 68/push 0/imm32/is-deref:false
11506 68/push 0/imm32/next
11507 51/push-ecx/var-foo
11508 89/<- %esi 4/r32/esp
11509
11510 68/push 0/imm32/next
11511 68/push 0/imm32/outputs
11512 56/push-esi/inouts
11513 68/push "f"/imm32/operation
11514 68/push 1/imm32
11515 89/<- %esi 4/r32/esp
11516
11517 68/push 0/imm32/next
11518 68/push 0/imm32/body
11519 68/push 0/imm32/outputs
11520 51/push-ecx/inouts
11521 68/push "f2"/imm32/subx-name
11522 68/push "f"/imm32/name
11523 89/<- %ebx 4/r32/esp
11524
11525 c7 0/subop/copy *Curr-block-depth 0/imm32
11526 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx)
11527 (flush _test-output-buffered-file)
11528 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11534
11535 (check-next-stream-line-equal _test-output-stream "(f2 34)" "F - test-emit-subx-stmt-function-call-with-literal-arg")
11536
11537 89/<- %esp 5/r32/ebp
11538 5d/pop-to-ebp
11539 c3/return
11540
11541 emit-indent:
11542
11543 55/push-ebp
11544 89/<- %ebp 4/r32/esp
11545
11546 50/push-eax
11547
11548 8b/-> *(ebp+0xc) 0/r32/eax
11549 {
11550
11551 3d/compare-eax-with 0/imm32
11552 7e/jump-if-<= break/disp8
11553 (write-buffered *(ebp+8) " ")
11554 48/decrement-eax
11555 eb/jump loop/disp8
11556 }
11557 $emit-indent:end:
11558
11559 58/pop-to-eax
11560
11561 89/<- %esp 5/r32/ebp
11562 5d/pop-to-ebp
11563 c3/return
11564
11565 emit-subx-prologue:
11566
11567 55/push-ebp
11568 89/<- %ebp 4/r32/esp
11569
11570 (write-buffered *(ebp+8) " # . prologue\n")
11571 (write-buffered *(ebp+8) " 55/push-ebp\n")
11572 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n")
11573 $emit-subx-prologue:end:
11574
11575 89/<- %esp 5/r32/ebp
11576 5d/pop-to-ebp
11577 c3/return
11578
11579 emit-subx-epilogue:
11580
11581 55/push-ebp
11582 89/<- %ebp 4/r32/esp
11583
11584 (write-buffered *(ebp+8) " # . epilogue\n")
11585 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n")
11586 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n")
11587 (write-buffered *(ebp+8) " c3/return\n")
11588 $emit-subx-epilogue:end:
11589
11590 89/<- %esp 5/r32/ebp
11591 5d/pop-to-ebp
11592 c3/return