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
242
243
244
245
246
247 == data
248
249 Program:
250 0/imm32
251
252 Function-name:
253 0/imm32
254 Function-subx-name:
255 4/imm32
256 Function-inouts:
257 8/imm32
258 Function-outputs:
259 0xc/imm32
260 Function-body:
261 0x10/imm32
262 Function-next:
263 0x14/imm32
264 Function-size:
265 0x18/imm32/24
266
267 Primitive-name:
268 0/imm32
269 Primitive-inouts:
270 4/imm32
271 Primitive-outputs:
272 8/imm32
273 Primitive-subx-name:
274 0xc/imm32
275 Primitive-subx-rm32:
276 0x10/imm32
277 Primitive-subx-r32:
278 0x14/imm32
279 Primitive-subx-imm32:
280 0x18/imm32
281 Primitive-write-only-output:
282 0x1c/imm32
283 Primitive-next:
284 0x20/imm32
285 Primitive-size:
286 0x24/imm32/36
287
288 Stmt-tag:
289 0/imm32
290
291 Block-statements:
292 4/imm32
293
294 Stmt1-operation:
295 4/imm32
296 Stmt1-inouts:
297 8/imm32
298 Stmt1-outputs:
299 0xc/imm32
300
301 Vardef-name:
302 4/imm32
303 Vardef-type:
304 8/imm32
305
306 Regvardef-name:
307 4/imm32
308 Regvardef-type:
309 8/imm32
310 Regvardef-register:
311 0xc/imm32
312 Regvardef-operation:
313 0x10/imm32
314 Regvardef-inputs:
315 0x14/imm32
316
317 Named-block-name:
318 4/imm32
319 Named-block-statements:
320 8/imm32
321
322 Stmt-size:
323 0x18/imm32
324
325 Var-name:
326 0/imm32
327 Var-type:
328 4/imm32
329 Var-block:
330 8/imm32
331 Var-stack-offset:
332 0xc/imm32
333 Var-register:
334 0x10/imm32
335 Var-size:
336 0x14/imm32
337
338 Any-register:
339
340 1/imm32
341
342 2a/asterisk
343
344 List-value:
345 0/imm32
346 List-next:
347 4/imm32
348 List-size:
349 8/imm32
350
351 == code
352
353 Entry:
354
355 89/<- %ebp 4/r32/esp
356 (new-segment *Heap-size Heap)
357
358 {
359
360 81 7/subop/compare *ebp 1/imm32
361 7e/jump-if-lesser-or-equal break/disp8
362
363 (kernel-string-equal? *(ebp+8) "test")
364 3d/compare-eax-and 0/imm32
365 74/jump-if-equal break/disp8
366
367 (run-tests)
368
369 8b/-> *Num-test-failures 3/r32/ebx
370 eb/jump $mu-main:end/disp8
371 }
372
373 (convert-mu Stdin Stdout)
374 (flush Stdout)
375
376 bb/copy-to-ebx 0/imm32
377 $mu-main:end:
378 b8/copy-to-eax 1/imm32/exit
379 cd/syscall 0x80/imm8
380
381 convert-mu:
382
383 55/push-ebp
384 89/<- %ebp 4/r32/esp
385
386 (parse-mu *(ebp+8))
387 (check-mu-types)
388 (emit-subx *(ebp+0xc))
389 $convert-mu:end:
390
391 89/<- %esp 5/r32/ebp
392 5d/pop-to-ebp
393 c3/return
394
395 test-convert-empty-input:
396
397
398 55/push-ebp
399 89/<- %ebp 4/r32/esp
400
401 (clear-stream _test-input-stream)
402 (clear-stream $_test-input-buffered-file->buffer)
403 (clear-stream _test-output-stream)
404 (clear-stream $_test-output-buffered-file->buffer)
405
406 (convert-mu _test-input-buffered-file _test-output-buffered-file)
407 (flush _test-output-buffered-file)
408 (check-stream-equal _test-output-stream "" "F - test-convert-empty-input")
409
410 89/<- %esp 5/r32/ebp
411 5d/pop-to-ebp
412 c3/return
413
414 test-convert-function-skeleton:
415
416
417
418
419
420
421
422
423
424
425
426
427
428 55/push-ebp
429 89/<- %ebp 4/r32/esp
430
431 (clear-stream _test-input-stream)
432 (clear-stream $_test-input-buffered-file->buffer)
433 (clear-stream _test-output-stream)
434 (clear-stream $_test-output-buffered-file->buffer)
435
436 (write _test-input-stream "fn foo {\n")
437 (write _test-input-stream "}\n")
438
439 (convert-mu _test-input-buffered-file _test-output-buffered-file)
440 (flush _test-output-buffered-file)
441 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
447
448 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0")
449 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-skeleton/1")
450 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-skeleton/2")
451 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3")
452 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-skeleton/4")
453 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5")
454 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-skeleton/6")
455 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-skeleton/7")
456
457 89/<- %esp 5/r32/ebp
458 5d/pop-to-ebp
459 c3/return
460
461 test-convert-multiple-function-skeletons:
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485 55/push-ebp
486 89/<- %ebp 4/r32/esp
487
488 (clear-stream _test-input-stream)
489 (clear-stream $_test-input-buffered-file->buffer)
490 (clear-stream _test-output-stream)
491 (clear-stream $_test-output-buffered-file->buffer)
492
493 (write _test-input-stream "fn foo {\n")
494 (write _test-input-stream "}\n")
495 (write _test-input-stream "fn bar {\n")
496 (write _test-input-stream "}\n")
497
498 (convert-mu _test-input-buffered-file _test-output-buffered-file)
499 (flush _test-output-buffered-file)
500 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
506
507 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0")
508 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-multiple-function-skeletons/1")
509 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-multiple-function-skeletons/2")
510 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3")
511 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-multiple-function-skeletons/4")
512 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5")
513 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6")
514 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-multiple-function-skeletons/7")
515
516 (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10")
517 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-multiple-function-skeletons/11")
518 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-multiple-function-skeletons/12")
519 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13")
520 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-multiple-function-skeletons/14")
521 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15")
522 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16")
523 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-multiple-function-skeletons/17")
524
525 89/<- %esp 5/r32/ebp
526 5d/pop-to-ebp
527 c3/return
528
529 test-convert-function-with-arg:
530
531
532
533
534
535
536
537
538
539
540
541
542
543 55/push-ebp
544 89/<- %ebp 4/r32/esp
545
546 (clear-stream _test-input-stream)
547 (clear-stream $_test-input-buffered-file->buffer)
548 (clear-stream _test-output-stream)
549 (clear-stream $_test-output-buffered-file->buffer)
550
551 (write _test-input-stream "fn foo n : int {\n")
552 (write _test-input-stream "}\n")
553
554 (convert-mu _test-input-buffered-file _test-output-buffered-file)
555 (flush _test-output-buffered-file)
556 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
562
563 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0")
564 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-arg/1")
565 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-arg/2")
566 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3")
567 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-arg/4")
568 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5")
569 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-arg/6")
570 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-arg/7")
571
572 89/<- %esp 5/r32/ebp
573 5d/pop-to-ebp
574 c3/return
575
576 test-convert-function-with-arg-and-body:
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
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 " increment n\n")
604 (write _test-input-stream "}\n")
605
606 (convert-mu _test-input-buffered-file _test-output-buffered-file)
607 (flush _test-output-buffered-file)
608 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
614
615 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0")
616 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-arg-and-body/1")
617 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-arg-and-body/2")
618 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3")
619 (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-arg-and-body/4")
620 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/5")
621 (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-arg-and-body/6")
622 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-arg-and-body/7")
623 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/8")
624 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/9")
625 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-arg-and-body/10")
626
627 89/<- %esp 5/r32/ebp
628 5d/pop-to-ebp
629 c3/return
630
631 test-convert-function-distinguishes-args:
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649 55/push-ebp
650 89/<- %ebp 4/r32/esp
651
652 (clear-stream _test-input-stream)
653 (clear-stream $_test-input-buffered-file->buffer)
654 (clear-stream _test-output-stream)
655 (clear-stream $_test-output-buffered-file->buffer)
656
657 (write _test-input-stream "fn foo a: int, b: int {\n")
658 (write _test-input-stream " increment b\n")
659 (write _test-input-stream "}\n")
660
661 (convert-mu _test-input-buffered-file _test-output-buffered-file)
662 (flush _test-output-buffered-file)
663 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
669
670 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0")
671 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-distinguishes-args/1")
672 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-distinguishes-args/2")
673 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3")
674 (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-distinguishes-args/4")
675 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/5")
676 (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-distinguishes-args/6")
677 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-distinguishes-args/7")
678 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/8")
679 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/9")
680 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-distinguishes-args/10")
681
682 89/<- %esp 5/r32/ebp
683 5d/pop-to-ebp
684 c3/return
685
686 test-convert-function-returns-result:
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706 55/push-ebp
707 89/<- %ebp 4/r32/esp
708
709 (clear-stream _test-input-stream)
710 (clear-stream $_test-input-buffered-file->buffer)
711 (clear-stream _test-output-stream)
712 (clear-stream $_test-output-buffered-file->buffer)
713
714 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
715 (write _test-input-stream " result <- copy a\n")
716 (write _test-input-stream " result <- increment\n")
717 (write _test-input-stream "}\n")
718
719 (convert-mu _test-input-buffered-file _test-output-buffered-file)
720 (flush _test-output-buffered-file)
721 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
727
728 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-returns-result/0")
729 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-returns-result/1")
730 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-returns-result/2")
731 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-returns-result/3")
732 (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-returns-result/4")
733 (check-next-stream-line-equal _test-output-stream "8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-returns-result/5")
734 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-convert-function-returns-result/6")
735 (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-returns-result/7")
736 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-returns-result/8")
737 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-returns-result/9")
738 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-returns-result/10")
739 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-returns-result/11")
740
741 89/<- %esp 5/r32/ebp
742 5d/pop-to-ebp
743 c3/return
744
745 test-convert-function-literal-arg:
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765 55/push-ebp
766 89/<- %ebp 4/r32/esp
767
768 (clear-stream _test-input-stream)
769 (clear-stream $_test-input-buffered-file->buffer)
770 (clear-stream _test-output-stream)
771 (clear-stream $_test-output-buffered-file->buffer)
772
773 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
774 (write _test-input-stream " result <- copy a\n")
775 (write _test-input-stream " result <- add 1\n")
776 (write _test-input-stream "}\n")
777
778 (convert-mu _test-input-buffered-file _test-output-buffered-file)
779 (flush _test-output-buffered-file)
780 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
786
787 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-literal-arg/0")
788 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-literal-arg/1")
789 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-literal-arg/2")
790 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-literal-arg/3")
791 (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-literal-arg/4")
792 (check-next-stream-line-equal _test-output-stream "8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-literal-arg/5")
793 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 1/imm32" "F - test-convert-function-literal-arg/6")
794 (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-literal-arg/7")
795 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-literal-arg/8")
796 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-literal-arg/9")
797 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-literal-arg/10")
798 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-literal-arg/11")
799
800 89/<- %esp 5/r32/ebp
801 5d/pop-to-ebp
802 c3/return
803
804 test-convert-function-literal-arg-2:
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824 55/push-ebp
825 89/<- %ebp 4/r32/esp
826
827 (clear-stream _test-input-stream)
828 (clear-stream $_test-input-buffered-file->buffer)
829 (clear-stream _test-output-stream)
830 (clear-stream $_test-output-buffered-file->buffer)
831
832 (write _test-input-stream "fn foo a: int, b: int -> result/ebx: int {\n")
833 (write _test-input-stream " result <- copy a\n")
834 (write _test-input-stream " result <- add 1\n")
835 (write _test-input-stream "}\n")
836
837 (convert-mu _test-input-buffered-file _test-output-buffered-file)
838 (flush _test-output-buffered-file)
839 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
845
846 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-literal-arg-2/0")
847 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-literal-arg-2/1")
848 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-literal-arg-2/2")
849 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-literal-arg-2/3")
850 (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-literal-arg-2/4")
851 (check-next-stream-line-equal _test-output-stream "8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-literal-arg-2/5")
852 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ebx 1/imm32" "F - test-convert-function-literal-arg-2/6")
853 (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-literal-arg-2/7")
854 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-literal-arg-2/8")
855 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-literal-arg-2/9")
856 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-literal-arg-2/10")
857 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-literal-arg-2/11")
858
859 89/<- %esp 5/r32/ebp
860 5d/pop-to-ebp
861 c3/return
862
863 test-convert-function-call-with-literal-arg:
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898 55/push-ebp
899 89/<- %ebp 4/r32/esp
900
901 (clear-stream _test-input-stream)
902 (clear-stream $_test-input-buffered-file->buffer)
903 (clear-stream _test-output-stream)
904 (clear-stream $_test-output-buffered-file->buffer)
905
906 (write _test-input-stream "fn main -> result/ebx: int {\n")
907 (write _test-input-stream " result <- do-add 3 4\n")
908 (write _test-input-stream "}\n")
909 (write _test-input-stream "fn do-add a: int, b: int -> result/ebx: int {\n")
910 (write _test-input-stream " result <- copy a\n")
911 (write _test-input-stream " result <- add b\n")
912 (write _test-input-stream "}\n")
913
914 (convert-mu _test-input-buffered-file _test-output-buffered-file)
915 (flush _test-output-buffered-file)
916 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
922
923 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0")
924 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-call-with-literal-arg/1")
925 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-call-with-literal-arg/2")
926 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3")
927 (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-call-with-literal-arg/4")
928 (check-next-stream-line-equal _test-output-stream "(do-add 3 4)" "F - test-convert-function-call-with-literal-arg/5")
929 (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-call-with-literal-arg/6")
930 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-call-with-literal-arg/7")
931 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/8")
932 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/9")
933 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-call-with-literal-arg/10")
934 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/11")
935 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-call-with-literal-arg/12")
936 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-call-with-literal-arg/13")
937 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/14")
938 (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-call-with-literal-arg/15")
939 (check-next-stream-line-equal _test-output-stream "8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/16")
940 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x0000000c) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/17")
941 (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-call-with-literal-arg/18")
942 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-call-with-literal-arg/19")
943 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/20")
944 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/21")
945 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-call-with-literal-arg/22")
946
947 89/<- %esp 5/r32/ebp
948 5d/pop-to-ebp
949 c3/return
950
951
952
953
954
955 parse-mu:
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981 55/push-ebp
982 89/<- %ebp 4/r32/esp
983
984 50/push-eax
985 51/push-ecx
986 52/push-edx
987 53/push-ebx
988 57/push-edi
989
990 81 5/subop/subtract %esp 0x200/imm32
991 68/push 0x200/imm32/length
992 68/push 0/imm32/read
993 68/push 0/imm32/write
994 89/<- %ecx 4/r32/esp
995
996 68/push 0/imm32/end
997 68/push 0/imm32/start
998 89/<- %edx 4/r32/esp
999
1000 bf/copy-to-edi Program/imm32
1001
1002 81 5/subop/subtract %esp 0x400/imm32
1003 68/push 0x400/imm32/length
1004 68/push 0/imm32/top
1005 89/<- %ebx 4/r32/esp
1006 {
1007 $parse-mu:line-loop:
1008 (clear-stream %ecx)
1009 (read-line-buffered *(ebp+8) %ecx)
1010
1011 81 7/subop/compare *ecx 0/imm32
1012 0f 84/jump-if-equal break/disp32
1013 +-- 6 lines: #? # dump line ---------------------------------------------------------------------------------------------------------------------------
1019 (next-word-or-string %ecx %edx)
1020
1021 (slice-empty? %edx)
1022 3d/compare-eax-and 0/imm32
1023 0f 85/jump-if-not-equal loop/disp32
1024
1025
1026 8b/-> *edx 0/r32/eax
1027 8a/copy-byte *eax 0/r32/AL
1028 81 4/subop/and %eax 0xff/imm32
1029
1030 3d/compare-eax-and 0x23/imm32/hash
1031 0f 84/jump-if-equal loop/disp32
1032
1033 {
1034 $parse-mu:fn:
1035 (slice-equal? %edx "fn")
1036 3d/compare-eax-and 0/imm32
1037 0f 84/jump-if-equal break/disp32
1038
1039 (allocate Heap *Function-size)
1040 (zero-out %eax *Function-size)
1041 (clear-stack %ebx)
1042 (populate-mu-function-header %ecx %eax %ebx)
1043 (populate-mu-function-body *(ebp+8) %eax %ebx)
1044
1045 89/<- *edi 0/r32/eax
1046
1047 8d/address-> *(eax+0x14) 7/r32/edi
1048 e9/jump $parse-mu:line-loop/disp32
1049 }
1050
1051 e9/jump $parse-mu:error1/disp32
1052 }
1053 $parse-mu:end:
1054
1055 81 0/subop/add %esp 0x630/imm32
1056
1057 5f/pop-to-edi
1058 5b/pop-to-ebx
1059 5a/pop-to-edx
1060 59/pop-to-ecx
1061 58/pop-to-eax
1062
1063 89/<- %esp 5/r32/ebp
1064 5d/pop-to-ebp
1065 c3/return
1066
1067 $parse-mu:error1:
1068
1069 (write-buffered Stderr "unexpected top-level command: ")
1070 (write-slice-buffered Stderr %edx)
1071 (write-buffered Stderr "\n")
1072 (flush Stderr)
1073
1074 bb/copy-to-ebx 1/imm32
1075 b8/copy-to-eax 1/imm32/exit
1076 cd/syscall 0x80/imm8
1077
1078
1079 $parse-mu:error2:
1080
1081 (print-int32-buffered Stderr *ebx)
1082 (write-buffered Stderr " vars not reclaimed after fn '")
1083 (write-slice-buffered Stderr *eax)
1084 (write-buffered Stderr "'\n")
1085 (flush Stderr)
1086
1087 bb/copy-to-ebx 1/imm32
1088 b8/copy-to-eax 1/imm32/exit
1089 cd/syscall 0x80/imm8
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103 populate-mu-function-header:
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134 55/push-ebp
1135 89/<- %ebp 4/r32/esp
1136
1137 50/push-eax
1138 51/push-ecx
1139 52/push-edx
1140 53/push-ebx
1141 57/push-edi
1142
1143 8b/-> *(ebp+0xc) 7/r32/edi
1144
1145 68/push 0/imm32/end
1146 68/push 0/imm32/start
1147 89/<- %ecx 4/r32/esp
1148
1149 ba/copy-to-edx 8/imm32
1150
1151 (next-word *(ebp+8) %ecx)
1152
1153
1154 (slice-equal? %ecx "{")
1155 3d/compare-eax-and 0/imm32
1156 0f 85/jump-if-not-equal $populate-mu-function-header:error1/disp32
1157
1158 (slice-equal? %ecx "->")
1159 3d/compare-eax-and 0/imm32
1160 0f 85/jump-if-not-equal $populate-mu-function-header:error1/disp32
1161
1162 (slice-equal? %ecx "}")
1163 3d/compare-eax-and 0/imm32
1164 0f 85/jump-if-not-equal $populate-mu-function-header:error1/disp32
1165
1166 (slice-to-string Heap %ecx)
1167 89/<- *edi 0/r32/eax
1168
1169 89/<- *(edi+4) 0/r32/eax
1170
1171 {
1172 $populate-mu-function-header:check-for-inout:
1173 (next-word *(ebp+8) %ecx)
1174
1175 (slice-equal? %ecx "{")
1176 3d/compare-eax-and 0/imm32
1177 0f 85/jump-if-not-equal $populate-mu-function-header:done/disp32
1178
1179 (slice-equal? %ecx "->")
1180 3d/compare-eax-and 0/imm32
1181 0f 85/jump-if-not-equal break/disp32
1182
1183 (slice-equal? %ecx "}")
1184 3d/compare-eax-and 0/imm32
1185 0f 85/jump-if-not-equal $populate-mu-function-header:error1/disp32
1186
1187 (parse-var-with-type %ecx *(ebp+8))
1188 89/<- %ebx 0/r32/eax
1189
1190 81 7/subop/compare *(ebx+0x10) 0/imm32
1191 0f 85/jump-if-not-equal $populate-mu-function-header:error2/disp32
1192
1193 89/<- *(ebx+0xc) 2/r32/edx
1194
1195 (size-of %ebx)
1196 01/add %edx 0/r32/eax
1197
1198 (append-list Heap %ebx *(edi+8))
1199 89/<- *(edi+8) 0/r32/eax
1200 (push *(ebp+0x10) %ebx)
1201
1202 e9/jump loop/disp32
1203 }
1204
1205 {
1206 $parse-var-with-type:check-for-out:
1207 (next-word *(ebp+8) %ecx)
1208
1209 (slice-equal? %ecx "{")
1210 3d/compare-eax-and 0/imm32
1211 0f 85/jump-if-not-equal break/disp32
1212
1213 (slice-equal? %ecx "->")
1214 3d/compare-eax-and 0/imm32
1215 0f 85/jump-if-not-equal $populate-mu-function-header:error1/disp32
1216
1217 (slice-equal? %ecx "}")
1218 3d/compare-eax-and 0/imm32
1219 0f 85/jump-if-not-equal $populate-mu-function-header:error1/disp32
1220
1221 (parse-var-with-type %ecx *(ebp+8))
1222 89/<- %ebx 0/r32/eax
1223
1224 81 7/subop/compare *(ebx+0x10) 0/imm32
1225 0f 84/jump-if-equal $populate-mu-function-header:error3/disp32
1226 (append-list Heap %ebx *(edi+0xc))
1227 89/<- *(edi+0xc) 0/r32/eax
1228 e9/jump loop/disp32
1229 }
1230 $populate-mu-function-header:done:
1231 (check-no-tokens-left *(ebp+8))
1232 $populate-mu-function-header:end:
1233
1234 81 0/subop/add %esp 8/imm32
1235
1236 5f/pop-to-edi
1237 5b/pop-to-ebx
1238 5a/pop-to-edx
1239 59/pop-to-ecx
1240 58/pop-to-eax
1241
1242 89/<- %esp 5/r32/ebp
1243 5d/pop-to-ebp
1244 c3/return
1245
1246 $populate-mu-function-header:error1:
1247
1248 (write-buffered Stderr "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '")
1249 (flush Stderr)
1250 (rewind-stream *(ebp+8))
1251 (write-stream 2 *(ebp+8))
1252 (write-buffered Stderr "'\n")
1253 (flush Stderr)
1254
1255 bb/copy-to-ebx 1/imm32
1256 b8/copy-to-eax 1/imm32/exit
1257 cd/syscall 0x80/imm8
1258
1259
1260 $populate-mu-function-header:error2:
1261
1262 (write-buffered Stderr "function input '")
1263 (write-buffered Stderr *ebx)
1264 (write-buffered Stderr "' cannot be in a register")
1265 (flush Stderr)
1266
1267 bb/copy-to-ebx 1/imm32
1268 b8/copy-to-eax 1/imm32/exit
1269 cd/syscall 0x80/imm8
1270
1271
1272 $populate-mu-function-header:error3:
1273
1274 (write-buffered Stderr "function input '")
1275 (write-buffered Stderr *eax)
1276 (write-buffered Stderr " must be in a register'")
1277 (flush Stderr)
1278 (rewind-stream *(ebp+8))
1279 (write-stream 2 *(ebp+8))
1280 (write-buffered Stderr "'\n")
1281 (flush Stderr)
1282
1283 bb/copy-to-ebx 1/imm32
1284 b8/copy-to-eax 1/imm32/exit
1285 cd/syscall 0x80/imm8
1286
1287
1288 test-function-header-with-arg:
1289
1290
1291 55/push-ebp
1292 89/<- %ebp 4/r32/esp
1293
1294 (clear-stream _test-input-stream)
1295 (write _test-input-stream "foo n : int {\n")
1296
1297 2b/subtract-> *Function-size 4/r32/esp
1298 89/<- %ecx 4/r32/esp
1299 (zero-out %ecx *Function-size)
1300
1301 81 5/subop/subtract %esp 0x10/imm32
1302 68/push 0x10/imm32/length
1303 68/push 0/imm32/top
1304 89/<- %ebx 4/r32/esp
1305
1306 (populate-mu-function-header _test-input-stream %ecx %ebx)
1307
1308 (check-strings-equal *ecx "foo" "F - test-function-header-with-arg/name")
1309
1310 8b/-> *(ecx+8) 2/r32/edx
1311
1312 8b/-> *edx 3/r32/ebx
1313 (check-strings-equal *ebx "n" "F - test-function-header-with-arg/inout:0")
1314 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-arg/inout:0/type")
1315
1316 89/<- %esp 5/r32/ebp
1317 5d/pop-to-ebp
1318 c3/return
1319
1320 test-function-header-with-multiple-args:
1321
1322
1323 55/push-ebp
1324 89/<- %ebp 4/r32/esp
1325
1326 (clear-stream _test-input-stream)
1327 (write _test-input-stream "foo a: int, b: int c: int {\n")
1328
1329 2b/subtract-> *Function-size 4/r32/esp
1330 89/<- %ecx 4/r32/esp
1331 (zero-out %ecx *Function-size)
1332
1333 81 5/subop/subtract %esp 0x10/imm32
1334 68/push 0x10/imm32/length
1335 68/push 0/imm32/top
1336 89/<- %ebx 4/r32/esp
1337
1338 (populate-mu-function-header _test-input-stream %ecx %ebx)
1339
1340 (check-strings-equal *ecx "foo")
1341
1342 8b/-> *(ecx+8) 2/r32/edx
1343 $test-function-header-with-multiple-args:inout0:
1344
1345 8b/-> *edx 3/r32/ebx
1346 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args/inout:0")
1347 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-multiple-args/inout:0/type")
1348
1349 8b/-> *(edx+4) 2/r32/edx
1350 $test-function-header-with-multiple-args:inout1:
1351
1352 8b/-> *edx 3/r32/ebx
1353 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args/inout:1")
1354 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-multiple-args/inout:1/type")
1355
1356 8b/-> *(edx+4) 2/r32/edx
1357 $test-function-header-with-multiple-args:inout2:
1358
1359 8b/-> *edx 3/r32/ebx
1360 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args/inout:2")
1361 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-multiple-args/inout:2/type")
1362
1363 89/<- %esp 5/r32/ebp
1364 5d/pop-to-ebp
1365 c3/return
1366
1367 test-function-with-multiple-args-and-outputs:
1368
1369
1370 55/push-ebp
1371 89/<- %ebp 4/r32/esp
1372
1373 (clear-stream _test-input-stream)
1374 (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx : int {\n")
1375
1376 2b/subtract-> *Function-size 4/r32/esp
1377 89/<- %ecx 4/r32/esp
1378 (zero-out %ecx *Function-size)
1379
1380 81 5/subop/subtract %esp 0x10/imm32
1381 68/push 0x10/imm32/length
1382 68/push 0/imm32/top
1383 89/<- %ebx 4/r32/esp
1384
1385 (populate-mu-function-header _test-input-stream %ecx %ebx)
1386
1387 (check-strings-equal *ecx "foo")
1388
1389 8b/-> *(ecx+8) 2/r32/edx
1390
1391 8b/-> *edx 3/r32/ebx
1392 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args/inout:0")
1393 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-arg/inout:0/type")
1394
1395 8b/-> *(edx+4) 2/r32/edx
1396
1397 8b/-> *edx 3/r32/ebx
1398 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args/inout:1")
1399 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-arg/inout:1/type")
1400
1401 8b/-> *(edx+4) 2/r32/edx
1402
1403 8b/-> *edx 3/r32/ebx
1404 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args/inout:2")
1405 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-arg/inout:2/type")
1406
1407 8b/-> *(ecx+0xc) 2/r32/edx
1408
1409 8b/-> *edx 3/r32/ebx
1410 (check-strings-equal *ebx "x" "F - test-function-header-with-multiple-args/output:0")
1411 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-arg/output:0/type")
1412 (check-strings-equal *(ebx+0x10) "ecx" "F - test-function-header-with-arg/output:0/register")
1413
1414 8b/-> *(edx+4) 2/r32/edx
1415
1416 8b/-> *edx 3/r32/ebx
1417 (check-strings-equal *ebx "y" "F - test-function-header-with-multiple-args/output:1")
1418 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-arg/output:1/type")
1419 (check-strings-equal *(ebx+0x10) "edx" "F - test-function-header-with-arg/output:0/register")
1420
1421 89/<- %esp 5/r32/ebp
1422 5d/pop-to-ebp
1423 c3/return
1424
1425
1426
1427
1428
1429
1430 parse-var-with-type:
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461 55/push-ebp
1462 89/<- %ebp 4/r32/esp
1463
1464 51/push-ecx
1465 52/push-edx
1466 53/push-ebx
1467 56/push-esi
1468 57/push-edi
1469
1470 (allocate Heap *Var-size)
1471 (zero-out %eax *Var-size)
1472 89/<- %edi 0/r32/eax
1473
1474 8b/-> *(ebp+8) 6/r32/esi
1475
1476 68/push 0/imm32/end
1477 68/push 0/imm32/start
1478 89/<- %ecx 4/r32/esp
1479 $parse-var-with-type:save-name:
1480
1481 (next-token-from-slice *esi *(esi+4) 0x2f %ecx)
1482
1483 8b/-> *(ecx+4) 2/r32/edx
1484
1485 {
1486 8b/-> *(ecx+4) 0/r32/eax
1487 48/decrement-eax
1488 8a/copy-byte *eax 3/r32/BL
1489 81 4/subop/and %ebx 0xff/imm32
1490 81 7/subop/compare %ebx 0x3a/imm32/colon
1491 75/jump-if-not-equal break/disp8
1492 89/<- *(ecx+4) 0/r32/eax
1493 }
1494
1495 {
1496 8b/-> *(ecx+4) 0/r32/eax
1497 48/decrement-eax
1498 8a/copy-byte *eax 3/r32/BL
1499 81 4/subop/and %ebx 0xff/imm32
1500 81 7/subop/compare %ebx 0x2c/imm32/comma
1501 75/jump-if-not-equal break/disp8
1502 89/<- *(ecx+4) 0/r32/eax
1503 }
1504 $parse-var-with-type:write-name:
1505 (slice-to-string Heap %ecx)
1506 89/<- *edi 0/r32/eax
1507
1508 $parse-var-with-type:save-register:
1509 (next-token-from-slice %edx *(esi+4) 0x2f %ecx)
1510
1511 {
1512 8b/-> *(ecx+4) 0/r32/eax
1513 48/decrement-eax
1514 8a/copy-byte *eax 3/r32/BL
1515 81 4/subop/and %ebx 0xff/imm32
1516 81 7/subop/compare %ebx 0x3a/imm32/colon
1517 75/jump-if-not-equal break/disp8
1518 89/<- *(ecx+4) 0/r32/eax
1519 }
1520
1521 {
1522 8b/-> *(ecx+4) 0/r32/eax
1523 48/decrement-eax
1524 8a/copy-byte *eax 3/r32/BL
1525 81 4/subop/and %ebx 0xff/imm32
1526 81 7/subop/compare %ebx 0x2c/imm32/comma
1527 75/jump-if-not-equal break/disp8
1528 89/<- *(ecx+4) 0/r32/eax
1529 }
1530
1531 {
1532 $parse-var-with-type:write-register:
1533
1534
1535 8b/-> *ecx 0/r32/eax
1536 39/compare 0/r32/eax *(ecx+4)
1537 76/jump-if-lesser-or-equal break/disp8
1538 (slice-to-string Heap %ecx)
1539 89/<- *(edi+0x10) 0/r32/eax
1540 }
1541
1542 (next-mu-token *(ebp+0xc) %ecx)
1543
1544 (slice-equal? %ecx "{")
1545 3d/compare-eax-and 0/imm32
1546 0f 85/jump-if-not-equal $parse-var-with-type:abort/disp32
1547
1548 (slice-equal? %ecx "->")
1549 3d/compare-eax-and 0/imm32
1550 0f 85/jump-if-not-equal $parse-var-with-type:abort/disp32
1551
1552 (slice-equal? %ecx "}")
1553 3d/compare-eax-and 0/imm32
1554 0f 85/jump-if-not-equal $parse-var-with-type:abort/disp32
1555
1556 (slice-empty? %ecx)
1557 {
1558 3d/compare-eax-and 0/imm32
1559 0f 84/jump-if-equal break/disp32
1560 (next-mu-token *(ebp+0xc) %ecx)
1561
1562 (slice-equal? %ecx "{")
1563 3d/compare-eax-and 0/imm32
1564 0f 85/jump-if-not-equal $parse-var-with-type:abort/disp32
1565
1566 (slice-equal? %ecx "->")
1567 3d/compare-eax-and 0/imm32
1568 0f 85/jump-if-not-equal $parse-var-with-type:abort/disp32
1569
1570 (slice-equal? %ecx "}")
1571 3d/compare-eax-and 0/imm32
1572 0f 85/jump-if-not-equal $parse-var-with-type:abort/disp32
1573 }
1574 (type-for %ecx)
1575 89/<- *(edi+4) 0/r32/eax
1576 $parse-var-with-type:end:
1577
1578 89/<- %eax 7/r32/edi
1579
1580 81 0/subop/add %esp 8/imm32
1581
1582 5f/pop-to-edi
1583 5e/pop-to-esi
1584 5b/pop-to-ebx
1585 5a/pop-to-edx
1586 59/pop-to-ecx
1587
1588 89/<- %esp 5/r32/ebp
1589 5d/pop-to-ebp
1590 c3/return
1591
1592 $parse-var-with-type:abort:
1593
1594 (write-buffered Stderr "var should have form 'name: type' in '")
1595 (flush Stderr)
1596 (rewind-stream *(ebp+0xc))
1597 (write-stream 2 *(ebp+0xc))
1598 (write-buffered Stderr "'\n")
1599 (flush Stderr)
1600
1601 bb/copy-to-ebx 1/imm32
1602 b8/copy-to-eax 1/imm32/exit
1603 cd/syscall 0x80/imm8
1604
1605
1606 next-mu-token:
1607
1608 55/push-ebp
1609 89/<- %ebp 4/r32/esp
1610
1611 50/push-eax
1612 57/push-edi
1613
1614 8b/-> *(ebp+0xc) 7/r32/edi
1615
1616 (next-word *(ebp+8) %edi)
1617
1618 {
1619 8b/-> *(edi+4) 0/r32/eax
1620 48/decrement-eax
1621 8a/copy-byte *eax 3/r32/BL
1622 81 4/subop/and %ebx 0xff/imm32
1623 81 7/subop/compare %ebx 0x3a/imm32/colon
1624 75/jump-if-not-equal break/disp8
1625 89/<- *(edi+4) 0/r32/eax
1626 }
1627
1628 {
1629 8b/-> *(edi+4) 0/r32/eax
1630 48/decrement-eax
1631 8a/copy-byte *eax 3/r32/BL
1632 81 4/subop/and %ebx 0xff/imm32
1633 81 7/subop/compare %ebx 0x2c/imm32/comma
1634 75/jump-if-not-equal break/disp8
1635 89/<- *(edi+4) 0/r32/eax
1636 }
1637 $next-mu-token:end:
1638 b8/copy-to-eax 1/imm32/int
1639
1640 5f/pop-to-edi
1641 58/pop-to-eax
1642
1643 89/<- %esp 5/r32/ebp
1644 5d/pop-to-ebp
1645 c3/return
1646
1647 type-for:
1648
1649 55/push-ebp
1650 89/<- %ebp 4/r32/esp
1651
1652
1653
1654
1655
1656 $type-for:end:
1657 b8/copy-to-eax 1/imm32/int
1658
1659
1660 89/<- %esp 5/r32/ebp
1661 5d/pop-to-ebp
1662 c3/return
1663
1664 test-parse-var-with-type:
1665
1666 55/push-ebp
1667 89/<- %ebp 4/r32/esp
1668
1669 b8/copy-to-eax "x:"/imm32
1670 8b/-> *eax 1/r32/ecx
1671 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1672 05/add-to-eax 4/imm32
1673
1674 51/push-ecx
1675 50/push-eax
1676 89/<- %ecx 4/r32/esp
1677
1678 (clear-stream _test-input-stream)
1679 (write _test-input-stream "int")
1680
1681 (parse-var-with-type %ecx _test-input-stream)
1682 8b/-> *eax 2/r32/edx
1683 (check-strings-equal %edx "x" "F - test-var-with-type/name")
1684 8b/-> *(eax+4) 2/r32/edx
1685 (check-ints-equal %edx 1 "F - test-var-with-type/type")
1686
1687 89/<- %esp 5/r32/ebp
1688 5d/pop-to-ebp
1689 c3/return
1690
1691 test-parse-var-with-type-and-register:
1692
1693 55/push-ebp
1694 89/<- %ebp 4/r32/esp
1695
1696 b8/copy-to-eax "x/eax"/imm32
1697 8b/-> *eax 1/r32/ecx
1698 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1699 05/add-to-eax 4/imm32
1700
1701 51/push-ecx
1702 50/push-eax
1703 89/<- %ecx 4/r32/esp
1704
1705 (clear-stream _test-input-stream)
1706 (write _test-input-stream ": int")
1707
1708 (parse-var-with-type %ecx _test-input-stream)
1709 8b/-> *eax 2/r32/edx
1710 (check-strings-equal %edx "x" "F - test-var-with-type-and-register/name")
1711 8b/-> *(eax+0x10) 2/r32/edx
1712 (check-strings-equal %edx "eax" "F - test-var-with-type-and-register/register")
1713 8b/-> *(eax+4) 2/r32/edx
1714 (check-ints-equal %edx 1 "F - test-var-with-type-and-register/type")
1715
1716 89/<- %esp 5/r32/ebp
1717 5d/pop-to-ebp
1718 c3/return
1719
1720 test-parse-var-with-trailing-characters:
1721
1722 55/push-ebp
1723 89/<- %ebp 4/r32/esp
1724
1725 b8/copy-to-eax "x:"/imm32
1726 8b/-> *eax 1/r32/ecx
1727 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1728 05/add-to-eax 4/imm32
1729
1730 51/push-ecx
1731 50/push-eax
1732 89/<- %ecx 4/r32/esp
1733
1734 (clear-stream _test-input-stream)
1735 (write _test-input-stream "int,")
1736
1737 (parse-var-with-type %ecx _test-input-stream)
1738 8b/-> *eax 2/r32/edx
1739 (check-strings-equal %edx "x" "F - test-var-with-trailing-characters/name")
1740 8b/-> *(eax+0x10) 2/r32/edx
1741 (check-ints-equal %edx 0 "F - test-var-with-trailing-characters/register")
1742 8b/-> *(eax+4) 2/r32/edx
1743 (check-ints-equal %edx 1 "F - test-var-with-trailing-characters/type")
1744
1745 89/<- %esp 5/r32/ebp
1746 5d/pop-to-ebp
1747 c3/return
1748
1749 test-parse-var-with-register-and-trailing-characters:
1750
1751 55/push-ebp
1752 89/<- %ebp 4/r32/esp
1753
1754 b8/copy-to-eax "x/eax:"/imm32
1755 8b/-> *eax 1/r32/ecx
1756 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1757 05/add-to-eax 4/imm32
1758
1759 51/push-ecx
1760 50/push-eax
1761 89/<- %ecx 4/r32/esp
1762
1763 (clear-stream _test-input-stream)
1764 (write _test-input-stream "int,")
1765
1766 (parse-var-with-type %ecx _test-input-stream)
1767 8b/-> *eax 2/r32/edx
1768 (check-strings-equal %edx "x" "F - test-var-with-register-and-trailing-characters/name")
1769 8b/-> *(eax+0x10) 2/r32/edx
1770 (check-strings-equal %edx "eax" "F - test-var-with-register-and-trailing-characters/register")
1771 8b/-> *(eax+4) 2/r32/edx
1772 (check-ints-equal %edx 1 "F - test-var-with-register-and-trailing-characters/type")
1773
1774 89/<- %esp 5/r32/ebp
1775 5d/pop-to-ebp
1776 c3/return
1777
1778
1779
1780
1781 is-identifier?:
1782
1783 55/push-ebp
1784 89/<- %ebp 4/r32/esp
1785
1786 (slice-empty? *(ebp+8))
1787 3d/compare-eax-and 0/imm32
1788 75/jump-if-not-equal $is-identifier?:false/disp8
1789
1790 8b/-> *(ebp+8) 0/r32/eax
1791 8b/-> *eax 0/r32/eax
1792 8a/copy-byte *eax 0/r32/AL
1793 81 4/subop/and %eax 0xff/imm32
1794
1795 3d/compare-eax-and 0x24/imm32/$
1796 74/jump-if-equal $is-identifier?:true/disp8
1797
1798 3d/compare-eax-and 0x5f/imm32/_
1799 74/jump-if-equal $is-identifier?:true/disp8
1800
1801 25/and-eax-with 0x5f/imm32
1802
1803 3d/compare-eax-and 0x41/imm32/A
1804 7c/jump-if-lesser $is-identifier?:false/disp8
1805
1806 3d/compare-eax-and 0x5a/imm32/Z
1807 7f/jump-if-greater $is-identifier?:false/disp8
1808
1809 $is-identifier?:true:
1810 b8/copy-to-eax 1/imm32/true
1811 eb/jump $is-identifier?:end/disp8
1812 $is-identifier?:false:
1813 b8/copy-to-eax 0/imm32/false
1814 $is-identifier?:end:
1815
1816 89/<- %esp 5/r32/ebp
1817 5d/pop-to-ebp
1818 c3/return
1819
1820 test-is-identifier-dollar:
1821
1822 55/push-ebp
1823 89/<- %ebp 4/r32/esp
1824
1825 b8/copy-to-eax "$a"/imm32
1826 8b/-> *eax 1/r32/ecx
1827 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1828 05/add-to-eax 4/imm32
1829
1830 51/push-ecx
1831 50/push-eax
1832 89/<- %ecx 4/r32/esp
1833
1834 (is-identifier? %ecx)
1835 (check-ints-equal %eax 1 "F - test-is-identifier-dollar")
1836
1837 89/<- %esp 5/r32/ebp
1838 5d/pop-to-ebp
1839 c3/return
1840
1841 test-is-identifier-underscore:
1842
1843 55/push-ebp
1844 89/<- %ebp 4/r32/esp
1845
1846 b8/copy-to-eax "_a"/imm32
1847 8b/-> *eax 1/r32/ecx
1848 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1849 05/add-to-eax 4/imm32
1850
1851 51/push-ecx
1852 50/push-eax
1853 89/<- %ecx 4/r32/esp
1854
1855 (is-identifier? %ecx)
1856 (check-ints-equal %eax 1 "F - test-is-identifier-underscore")
1857
1858 89/<- %esp 5/r32/ebp
1859 5d/pop-to-ebp
1860 c3/return
1861
1862 test-is-identifier-a:
1863
1864 55/push-ebp
1865 89/<- %ebp 4/r32/esp
1866
1867 b8/copy-to-eax "a$"/imm32
1868 8b/-> *eax 1/r32/ecx
1869 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1870 05/add-to-eax 4/imm32
1871
1872 51/push-ecx
1873 50/push-eax
1874 89/<- %ecx 4/r32/esp
1875
1876 (is-identifier? %ecx)
1877 (check-ints-equal %eax 1 "F - test-is-identifier-a")
1878
1879 89/<- %esp 5/r32/ebp
1880 5d/pop-to-ebp
1881 c3/return
1882
1883 test-is-identifier-z:
1884
1885 55/push-ebp
1886 89/<- %ebp 4/r32/esp
1887
1888 b8/copy-to-eax "z$"/imm32
1889 8b/-> *eax 1/r32/ecx
1890 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1891 05/add-to-eax 4/imm32
1892
1893 51/push-ecx
1894 50/push-eax
1895 89/<- %ecx 4/r32/esp
1896
1897 (is-identifier? %ecx)
1898 (check-ints-equal %eax 1 "F - test-is-identifier-z")
1899
1900 89/<- %esp 5/r32/ebp
1901 5d/pop-to-ebp
1902 c3/return
1903
1904 test-is-identifier-A:
1905
1906 55/push-ebp
1907 89/<- %ebp 4/r32/esp
1908
1909 b8/copy-to-eax "A$"/imm32
1910 8b/-> *eax 1/r32/ecx
1911 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1912 05/add-to-eax 4/imm32
1913
1914 51/push-ecx
1915 50/push-eax
1916 89/<- %ecx 4/r32/esp
1917
1918 (is-identifier? %ecx)
1919 (check-ints-equal %eax 1 "F - test-is-identifier-A")
1920
1921 89/<- %esp 5/r32/ebp
1922 5d/pop-to-ebp
1923 c3/return
1924
1925 test-is-identifier-Z:
1926
1927 55/push-ebp
1928 89/<- %ebp 4/r32/esp
1929
1930 b8/copy-to-eax "Z$"/imm32
1931 8b/-> *eax 1/r32/ecx
1932 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1933 05/add-to-eax 4/imm32
1934
1935 51/push-ecx
1936 50/push-eax
1937 89/<- %ecx 4/r32/esp
1938
1939 (is-identifier? %ecx)
1940 (check-ints-equal %eax 1 "F - test-is-identifier-Z")
1941
1942 89/<- %esp 5/r32/ebp
1943 5d/pop-to-ebp
1944 c3/return
1945
1946 test-is-identifier-@:
1947
1948
1949 55/push-ebp
1950 89/<- %ebp 4/r32/esp
1951
1952 b8/copy-to-eax "@a"/imm32
1953 8b/-> *eax 1/r32/ecx
1954 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1955 05/add-to-eax 4/imm32
1956
1957 51/push-ecx
1958 50/push-eax
1959 89/<- %ecx 4/r32/esp
1960
1961 (is-identifier? %ecx)
1962 (check-ints-equal %eax 0 "F - test-is-identifier-@")
1963
1964 89/<- %esp 5/r32/ebp
1965 5d/pop-to-ebp
1966 c3/return
1967
1968 test-is-identifier-square-bracket:
1969
1970
1971 55/push-ebp
1972 89/<- %ebp 4/r32/esp
1973
1974 b8/copy-to-eax "[a"/imm32
1975 8b/-> *eax 1/r32/ecx
1976 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1977 05/add-to-eax 4/imm32
1978
1979 51/push-ecx
1980 50/push-eax
1981 89/<- %ecx 4/r32/esp
1982
1983 (is-identifier? %ecx)
1984 (check-ints-equal %eax 0 "F - test-is-identifier-@")
1985
1986 89/<- %esp 5/r32/ebp
1987 5d/pop-to-ebp
1988 c3/return
1989
1990 test-is-identifier-backtick:
1991
1992
1993 55/push-ebp
1994 89/<- %ebp 4/r32/esp
1995
1996 b8/copy-to-eax "`a"/imm32
1997 8b/-> *eax 1/r32/ecx
1998 8d/copy-address *(eax+ecx+4) 1/r32/ecx
1999 05/add-to-eax 4/imm32
2000
2001 51/push-ecx
2002 50/push-eax
2003 89/<- %ecx 4/r32/esp
2004
2005 (is-identifier? %ecx)
2006 (check-ints-equal %eax 0 "F - test-is-identifier-backtick")
2007
2008 89/<- %esp 5/r32/ebp
2009 5d/pop-to-ebp
2010 c3/return
2011
2012 test-is-identifier-curly-brace-open:
2013
2014
2015 55/push-ebp
2016 89/<- %ebp 4/r32/esp
2017
2018 b8/copy-to-eax "{a"/imm32
2019 8b/-> *eax 1/r32/ecx
2020 8d/copy-address *(eax+ecx+4) 1/r32/ecx
2021 05/add-to-eax 4/imm32
2022
2023 51/push-ecx
2024 50/push-eax
2025 89/<- %ecx 4/r32/esp
2026
2027 (is-identifier? %ecx)
2028 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open")
2029
2030 89/<- %esp 5/r32/ebp
2031 5d/pop-to-ebp
2032 c3/return
2033
2034 test-is-identifier-curly-brace-close:
2035
2036 55/push-ebp
2037 89/<- %ebp 4/r32/esp
2038
2039 b8/copy-to-eax "}a"/imm32
2040 8b/-> *eax 1/r32/ecx
2041 8d/copy-address *(eax+ecx+4) 1/r32/ecx
2042 05/add-to-eax 4/imm32
2043
2044 51/push-ecx
2045 50/push-eax
2046 89/<- %ecx 4/r32/esp
2047
2048 (is-identifier? %ecx)
2049 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close")
2050
2051 89/<- %esp 5/r32/ebp
2052 5d/pop-to-ebp
2053 c3/return
2054
2055 test-is-identifier-hyphen:
2056
2057
2058 55/push-ebp
2059 89/<- %ebp 4/r32/esp
2060
2061 b8/copy-to-eax "-a"/imm32
2062 8b/-> *eax 1/r32/ecx
2063 8d/copy-address *(eax+ecx+4) 1/r32/ecx
2064 05/add-to-eax 4/imm32
2065
2066 51/push-ecx
2067 50/push-eax
2068 89/<- %ecx 4/r32/esp
2069
2070 (is-identifier? %ecx)
2071 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen")
2072
2073 89/<- %esp 5/r32/ebp
2074 5d/pop-to-ebp
2075 c3/return
2076
2077 populate-mu-function-body:
2078
2079 55/push-ebp
2080 89/<- %ebp 4/r32/esp
2081
2082 50/push-eax
2083 56/push-esi
2084 57/push-edi
2085
2086 8b/-> *(ebp+8) 6/r32/esi
2087
2088 8b/-> *(ebp+0xc) 7/r32/edi
2089
2090 (parse-mu-block %esi *(ebp+0x10) %edi)
2091
2092 89/<- *(edi+0x10) 0/r32/eax
2093 $populate-mu-function-body:end:
2094
2095 5f/pop-to-edi
2096 5e/pop-to-esi
2097 58/pop-to-eax
2098
2099 89/<- %esp 5/r32/ebp
2100 5d/pop-to-ebp
2101 c3/return
2102
2103
2104 parse-mu-block:
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137 55/push-ebp
2138 89/<- %ebp 4/r32/esp
2139
2140 51/push-ecx
2141 52/push-edx
2142 53/push-ebx
2143 57/push-edi
2144
2145 81 5/subop/subtract %esp 0x200/imm32
2146 68/push 0x200/imm32/length
2147 68/push 0/imm32/read
2148 68/push 0/imm32/write
2149 89/<- %ecx 4/r32/esp
2150
2151 68/push 0/imm32/end
2152 68/push 0/imm32/start
2153 89/<- %edx 4/r32/esp
2154
2155 (allocate Heap *Stmt-size)
2156 (zero-out %eax *Stmt-size)
2157 89/<- %edi 0/r32/eax
2158 {
2159 $parse-mu-block:line-loop:
2160
2161 (clear-stream %ecx)
2162 (read-line-buffered *(ebp+8) %ecx)
2163
2164
2165
2166
2167
2168 81 7/subop/compare *ecx 0/imm32
2169 0f 84/jump-if-equal break/disp32
2170
2171 (next-word %ecx %edx)
2172
2173
2174
2175
2176
2177 (slice-empty? %edx)
2178 3d/compare-eax-and 0/imm32
2179 0f 85/jump-if-not-equal loop/disp32
2180
2181
2182 8b/-> *edx 0/r32/eax
2183 8a/copy-byte *eax 0/r32/AL
2184 81 4/subop/and %eax 0xff/imm32
2185
2186 3d/compare-eax-and 0x23/imm32/hash
2187 0f 84/jump-if-equal loop/disp32
2188
2189 {
2190 $parse-mu-block:check-for-block:
2191 (slice-equal? %edx "{")
2192 3d/compare-eax-and 0/imm32
2193 74/jump-if-equal break/disp8
2194 (check-no-tokens-left %ecx)
2195
2196 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10))
2197 (append-to-block %edi %eax)
2198 e9/jump $parse-mu-block:line-loop/disp32
2199 }
2200
2201 $parse-mu-block:check-for-end:
2202 (slice-equal? %edx "}")
2203 3d/compare-eax-and 0/imm32
2204 0f 85/jump-if-not-equal break/disp32
2205
2206 {
2207 $parse-mu-block:check-for-named-block:
2208
2209 8b/-> *(edx+4) 0/r32/eax
2210 8a/copy-byte *eax 0/r32/AL
2211 81 4/subop/and %eax 0xff/imm32
2212
2213 3d/compare-eax-and 0x23/imm32/hash
2214 0f 85/jump-if-not-equal break/disp32
2215
2216 (parse-mu-named-block %edx %ecx *(ebp+8) *(ebp+0xc) *(ebp+0x10))
2217 (append-to-block %edi %eax)
2218 e9/jump $parse-mu-block:line-loop/disp32
2219 }
2220
2221 {
2222 $parse-mu-block:check-for-var:
2223 (slice-equal? %edx "var")
2224 3d/compare-eax-and 0/imm32
2225 74/jump-if-equal break/disp8
2226
2227 (parse-mu-var-def %ecx *(ebp+0xc))
2228 (append-to-block %edi %eax)
2229 e9/jump $parse-mu-block:line-loop/disp32
2230 }
2231 $parse-mu-block:regular-stmt:
2232
2233 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10))
2234 (append-to-block Heap %edi %eax)
2235 e9/jump loop/disp32
2236 }
2237
2238 89/<- %eax 7/r32/edi
2239 $parse-mu-block:end:
2240
2241 81 0/subop/add %esp 0x214/imm32
2242
2243 5f/pop-to-edi
2244 5b/pop-to-ebx
2245 5a/pop-to-edx
2246 59/pop-to-ecx
2247
2248 89/<- %esp 5/r32/ebp
2249 5d/pop-to-ebp
2250 c3/return
2251
2252 $parse-mu-block:abort:
2253
2254 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
2255 (rewind-stream %ecx)
2256 (write-stream 2 %ecx)
2257 (write-buffered Stderr "'\n")
2258 (flush Stderr)
2259
2260 bb/copy-to-ebx 1/imm32
2261 b8/copy-to-eax 1/imm32/exit
2262 cd/syscall 0x80/imm8
2263
2264
2265 check-no-tokens-left:
2266
2267 55/push-ebp
2268 89/<- %ebp 4/r32/esp
2269
2270 50/push-eax
2271 51/push-ecx
2272
2273 68/push 0/imm32/end
2274 68/push 0/imm32/start
2275 89/<- %ecx 4/r32/esp
2276
2277 (next-word *(ebp+8) %ecx)
2278
2279 (slice-empty? %ecx)
2280 3d/compare-eax-and 0/imm32
2281 75/jump-if-not-equal $check-no-tokens-left:end/disp8
2282
2283
2284 8b/-> *edx 0/r32/eax
2285 8a/copy-byte *eax 0/r32/AL
2286 81 4/subop/and %eax 0xff/imm32
2287
2288 3d/compare-eax-and 0x23/imm32/hash
2289 74/jump-if-equal $check-no-tokens-left:end/disp8
2290
2291 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
2292 (rewind-stream %ecx)
2293 (write-stream 2 %ecx)
2294 (write-buffered Stderr "'\n")
2295 (flush Stderr)
2296
2297 bb/copy-to-ebx 1/imm32
2298 b8/copy-to-eax 1/imm32/exit
2299 cd/syscall 0x80/imm8
2300
2301 $check-no-tokens-left:end:
2302
2303 81 0/subop/add %esp 8/imm32
2304
2305 59/pop-to-ecx
2306 58/pop-to-eax
2307
2308 89/<- %esp 5/r32/ebp
2309 5d/pop-to-ebp
2310 c3/return
2311
2312 parse-mu-named-block:
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345 55/push-ebp
2346 89/<- %ebp 4/r32/esp
2347
2348 $parse-mu-named-block:end:
2349
2350
2351
2352 89/<- %esp 5/r32/ebp
2353 5d/pop-to-ebp
2354 c3/return
2355
2356 parse-mu-var-def:
2357
2358
2359
2360 55/push-ebp
2361 89/<- %ebp 4/r32/esp
2362
2363 $parse-mu-var-def:end:
2364
2365
2366
2367 89/<- %esp 5/r32/ebp
2368 5d/pop-to-ebp
2369 c3/return
2370
2371 parse-mu-stmt:
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389 55/push-ebp
2390 89/<- %ebp 4/r32/esp
2391
2392 51/push-ecx
2393 57/push-edi
2394
2395 68/push 0/imm32/end
2396 68/push 0/imm32/start
2397 89/<- %ecx 4/r32/esp
2398
2399 (allocate Heap *Stmt-size)
2400 (zero-out %eax *Stmt-size)
2401 89/<- %edi 0/r32/eax
2402
2403 c7 0/subop/copy *edi 1/imm32/stmt1
2404 {
2405 (stmt-has-outputs? *(ebp+8))
2406 3d/compare-eax-and 0/imm32
2407 0f 84/jump-if-equal break/disp32
2408 {
2409 $parse-mu-stmt:read-outputs:
2410
2411 (next-word *(ebp+8) %ecx)
2412
2413 (slice-empty? %ecx)
2414 3d/compare-eax-and 0/imm32
2415 0f 85/jump-if-not-equal break/disp32
2416
2417 (slice-equal? %ecx "<-")
2418 3d/compare-eax-and 0/imm32
2419 75/jump-if-not-equal break/disp8
2420
2421 (is-identifier? %ecx)
2422 3d/compare-eax-and 0/imm32
2423 0f 84/jump-if-equal $parse-mu-stmt:abort/disp32
2424
2425 (lookup-or-define-var %ecx *(ebp+0xc) *(ebp+0x10))
2426 (append-list Heap %eax *(edi+0xc))
2427 89/<- *(edi+0xc) 0/r32/eax
2428 e9/jump loop/disp32
2429 }
2430 }
2431 $parse-mu-stmt:read-operation:
2432 (next-word *(ebp+8) %ecx)
2433 (slice-to-string Heap %ecx)
2434 89/<- *(edi+4) 0/r32/eax
2435 {
2436 $parse-mu-stmt:read-inouts:
2437
2438 (next-word-or-string *(ebp+8) %ecx)
2439
2440 (slice-empty? %ecx)
2441 3d/compare-eax-and 0/imm32
2442 0f 85/jump-if-not-equal break/disp32
2443
2444 (slice-equal? %ecx "<-")
2445 3d/compare-eax-and 0/imm32
2446 0f 85/jump-if-not-equal $parse-mu-stmt:abort2/disp32
2447
2448 (lookup-var-or-literal %ecx *(ebp+0xc))
2449 (append-list Heap %eax *(edi+8))
2450 89/<- *(edi+8) 0/r32/eax
2451 e9/jump loop/disp32
2452 }
2453 $parse-mu-stmt:end:
2454
2455 89/<- %eax 7/r32/edi
2456
2457 81 0/subop/add %esp 8/imm32
2458
2459 5f/pop-to-edi
2460 59/pop-to-ecx
2461
2462 89/<- %esp 5/r32/ebp
2463 5d/pop-to-ebp
2464 c3/return
2465
2466 $parse-mu-stmt:abort:
2467
2468 (write-buffered Stderr "invalid identifier '")
2469 (write-slice-buffered Stderr %ecx)
2470 (write-buffered Stderr "'\n")
2471 (flush Stderr)
2472
2473 bb/copy-to-ebx 1/imm32
2474 b8/copy-to-eax 1/imm32/exit
2475 cd/syscall 0x80/imm8
2476
2477
2478 $parse-mu-stmt:abort2:
2479
2480 (rewind-stream *(ebp+8))
2481 (write-buffered Stderr "invalid identifier '")
2482 (write-stream Stderr *(ebp+8))
2483 (write-buffered Stderr "'\n")
2484 (flush Stderr)
2485
2486 bb/copy-to-ebx 1/imm32
2487 b8/copy-to-eax 1/imm32/exit
2488 cd/syscall 0x80/imm8
2489
2490
2491 stmt-has-outputs?:
2492
2493 55/push-ebp
2494 89/<- %ebp 4/r32/esp
2495
2496 51/push-ecx
2497
2498 68/push 0/imm32/end
2499 68/push 0/imm32/start
2500 89/<- %ecx 4/r32/esp
2501
2502 b8/copy-to-eax 0/imm32/false
2503 (rewind-stream *(ebp+8))
2504 {
2505 (next-word-or-string *(ebp+8) %ecx)
2506
2507 (slice-empty? %ecx)
2508 3d/compare-eax-and 0/imm32
2509 b8/copy-to-eax 0/imm32/false/result
2510 0f 85/jump-if-not-equal break/disp32
2511
2512
2513 8b/-> *ecx 0/r32/eax
2514 8a/copy-byte *eax 0/r32/AL
2515 81 4/subop/and %eax 0xff/imm32
2516
2517 3d/compare-eax-and 0x23/imm32/hash
2518 b8/copy-to-eax 0/imm32/false/result
2519 0f 84/jump-if-equal break/disp32
2520
2521 (slice-equal? %ecx "<-")
2522 3d/compare-eax-and 0/imm32
2523 74/jump-if-equal loop/disp8
2524 b8/copy-to-eax 1/imm32/true
2525 }
2526 $stmt-has-outputs:end:
2527 (rewind-stream *(ebp+8))
2528
2529 81 0/subop/add %esp 8/imm32
2530
2531 59/pop-to-ecx
2532
2533 89/<- %esp 5/r32/ebp
2534 5d/pop-to-ebp
2535 c3/return
2536
2537
2538
2539 lookup-var-or-literal:
2540
2541 55/push-ebp
2542 89/<- %ebp 4/r32/esp
2543
2544 51/push-ecx
2545 56/push-esi
2546
2547 8b/-> *(ebp+8) 6/r32/esi
2548
2549 (slice-empty? %esi)
2550 3d/compare-eax-and 0/imm32
2551 0f 85/jump-if-not-equal $lookup-var-or-literal:abort/disp32
2552
2553 8b/-> *esi 1/r32/ecx
2554 8a/copy-byte *ecx 1/r32/CL
2555 81 4/subop/and %ecx 0xff/imm32
2556
2557 (is-decimal-digit? %ecx)
2558 81 7/subop/compare %eax 0/imm32
2559 {
2560 74/jump-if-equal break/disp8
2561 (new-literal-integer Heap %esi)
2562 }
2563
2564 {
2565 75/jump-if-not-equal break/disp8
2566 (lookup-var %esi *(ebp+0xc))
2567 }
2568 $lookup-var-or-literal:end:
2569
2570 5e/pop-to-esi
2571 59/pop-to-ecx
2572
2573 89/<- %esp 5/r32/ebp
2574 5d/pop-to-ebp
2575 c3/return
2576
2577 $lookup-var-or-literal:abort:
2578 (write-buffered Stderr "empty variable!")
2579 (flush Stderr)
2580
2581 bb/copy-to-ebx 1/imm32
2582 b8/copy-to-eax 1/imm32/exit
2583 cd/syscall 0x80/imm8
2584
2585
2586
2587 lookup-var:
2588
2589 55/push-ebp
2590 89/<- %ebp 4/r32/esp
2591
2592 (slice-to-string Heap *(ebp+8))
2593
2594 (lookup-var-helper %eax *(ebp+0xc))
2595
2596 3d/compare-eax-and 0/imm32
2597 74/jump-if-equal $lookup-var:abort/disp8
2598 $lookup-var:end:
2599
2600 89/<- %esp 5/r32/ebp
2601 5d/pop-to-ebp
2602 c3/return
2603
2604 $lookup-var:abort:
2605 (write-buffered Stderr "unknown variable '")
2606 (write-slice-buffered Stderr *(ebp+8))
2607 (write-buffered Stderr "'\n")
2608 (flush Stderr)
2609
2610 bb/copy-to-ebx 1/imm32
2611 b8/copy-to-eax 1/imm32/exit
2612 cd/syscall 0x80/imm8
2613
2614
2615
2616 lookup-var-helper:
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627 55/push-ebp
2628 89/<- %ebp 4/r32/esp
2629
2630 52/push-edx
2631 53/push-ebx
2632 56/push-esi
2633
2634 8b/-> *(ebp+0xc) 6/r32/esi
2635
2636 8b/-> *esi 3/r32/ebx
2637
2638 3b/compare 0/r32/eax *(esi+4)
2639 0f 8f/jump-if-greater $lookup-var-helper:error1/disp32
2640
2641 8d/copy-address *(esi+8) 2/r32/edx
2642
2643 81 5/subop/subtract %ebx 4/imm32
2644 8d/copy-address *(esi+ebx+8) 3/r32/ebx
2645 {
2646
2647 39/compare %ebx 2/r32/edx
2648 b8/copy-to-eax 0/imm32
2649 0f 82/jump-if-lesser-unsigned break/disp32
2650
2651 8b/-> *ebx 0/r32/eax
2652
2653 (string-equal? *eax *(ebp+8))
2654 3d/compare-eax-and 0/imm32
2655 8b/-> *ebx 0/r32/eax
2656 75/jump-if-not-equal break/disp8
2657
2658 81 5/subop/subtract %ebx 4/imm32
2659 e9/jump loop/disp32
2660 }
2661 $lookup-var-helper:end:
2662
2663 5e/pop-to-esi
2664 5b/pop-to-ebx
2665 5a/pop-to-edx
2666
2667 89/<- %esp 5/r32/ebp
2668 5d/pop-to-ebp
2669 c3/return
2670
2671 $lookup-var-helper:error1:
2672 (write-buffered Stderr "malformed stack when looking up '")
2673 (write-slice-buffered Stderr *(ebp+8))
2674 (write-buffered Stderr "'\n")
2675 (flush Stderr)
2676
2677 bb/copy-to-ebx 1/imm32
2678 b8/copy-to-eax 1/imm32/exit
2679 cd/syscall 0x80/imm8
2680
2681
2682
2683 lookup-or-define-var:
2684
2685 55/push-ebp
2686 89/<- %ebp 4/r32/esp
2687
2688 51/push-ecx
2689
2690 (slice-to-string Heap *(ebp+8))
2691 89/<- %ecx 0/r32/eax
2692
2693 (lookup-var-helper *(ebp+8) *(ebp+0xc))
2694 {
2695
2696 3d/compare-eax-and 0/imm32
2697 75/jump-if-not-equal break/disp8
2698
2699 {
2700 (find-in-function-outputs *(ebp+0x10) %ecx)
2701 3d/compare-eax-and 0/imm32
2702
2703 0f 84/jump-if-not-equal $lookup-var:abort/disp32
2704 }
2705 }
2706 $lookup-or-define-var:end:
2707
2708 59/pop-to-ecx
2709
2710 89/<- %esp 5/r32/ebp
2711 5d/pop-to-ebp
2712 c3/return
2713
2714 find-in-function-outputs:
2715
2716 55/push-ebp
2717 89/<- %ebp 4/r32/esp
2718
2719 51/push-ecx
2720
2721 8b/-> *(ebp+8) 1/r32/ecx
2722 8b/-> *(ecx+0xc) 1/r32/ecx
2723
2724 {
2725 81 7/subop/compare %ecx 0/imm32
2726 74/jump-if-equal break/disp8
2727
2728 8b/-> *ecx 0/r32/eax
2729
2730 50/push-eax
2731 (string-equal? *eax *(ebp+0xc))
2732 3d/compare-eax-and 0/imm32
2733 58/pop-to-eax
2734 75/jump-if-not-equal $find-in-function-outputs:end/disp8
2735
2736 8b/-> *(ecx+4) 1/r32/ecx
2737 eb/jump loop/disp8
2738 }
2739 b8/copy-to-eax 0/imm32
2740 $find-in-function-outputs:end:
2741
2742 59/pop-to-ecx
2743
2744 89/<- %esp 5/r32/ebp
2745 5d/pop-to-ebp
2746 c3/return
2747
2748 test-parse-mu-stmt:
2749
2750
2751 55/push-ebp
2752 89/<- %ebp 4/r32/esp
2753
2754 (clear-stream _test-input-stream)
2755 (write _test-input-stream "increment n\n")
2756
2757 81 5/subop/subtract %esp 0x10/imm32
2758 68/push 0x10/imm32/length
2759 68/push 0/imm32/top
2760 89/<- %ecx 4/r32/esp
2761 (clear-stack %ecx)
2762
2763 81 5/subop/subtract %esp 0x14/imm32
2764 89/<- %edx 4/r32/esp
2765 (zero-out %edx 0x14)
2766
2767 c7 0/subop/copy *edx "n"/imm32
2768
2769 (push %ecx %edx)
2770
2771 (parse-mu-stmt _test-input-stream %ecx)
2772
2773 (check-strings-equal *(eax+4) "increment" "F - test-parse-mu-stmt/name")
2774
2775 8b/-> *(eax+8) 2/r32/edx
2776
2777 8b/-> *edx 3/r32/ebx
2778 (check-strings-equal *ebx "n" "F - test-parse-mu-stmt/inout:0")
2779
2780 89/<- %esp 5/r32/ebp
2781 5d/pop-to-ebp
2782 c3/return
2783
2784 new-function:
2785
2786 55/push-ebp
2787 89/<- %ebp 4/r32/esp
2788
2789 51/push-ecx
2790
2791 (allocate *(ebp+8) *Function-size)
2792 8b/-> *(ebp+0xc) 1/r32/ecx
2793 89/<- *eax 1/r32/ecx
2794 8b/-> *(ebp+0x10) 1/r32/ecx
2795 89/<- *(eax+4) 1/r32/ecx
2796 8b/-> *(ebp+0x14) 1/r32/ecx
2797 89/<- *(eax+8) 1/r32/ecx
2798 8b/-> *(ebp+0x18) 1/r32/ecx
2799 89/<- *(eax+0xc) 1/r32/ecx
2800 8b/-> *(ebp+0x1c) 1/r32/ecx
2801 89/<- *(eax+0x10) 1/r32/ecx
2802 8b/-> *(ebp+0x20) 1/r32/ecx
2803 89/<- *(eax+0x14) 1/r32/ecx
2804 $new-function:end:
2805
2806 59/pop-to-ecx
2807
2808 89/<- %esp 5/r32/ebp
2809 5d/pop-to-ebp
2810 c3/return
2811
2812 new-var:
2813
2814 55/push-ebp
2815 89/<- %ebp 4/r32/esp
2816
2817 51/push-ecx
2818
2819 (allocate *(ebp+8) *Var-size)
2820 8b/-> *(ebp+0xc) 1/r32/ecx
2821 89/<- *eax 1/r32/ecx
2822 8b/-> *(ebp+0x10) 1/r32/ecx
2823 89/<- *(eax+4) 1/r32/ecx
2824 8b/-> *(ebp+0x14) 1/r32/ecx
2825 89/<- *(eax+8) 1/r32/ecx
2826 8b/-> *(ebp+0x18) 1/r32/ecx
2827 89/<- *(eax+0xc) 1/r32/ecx
2828 8b/-> *(ebp+0x1c) 1/r32/ecx
2829 89/<- *(eax+0x10) 1/r32/ecx
2830 $new-var:end:
2831
2832 59/pop-to-ecx
2833
2834 89/<- %esp 5/r32/ebp
2835 5d/pop-to-ebp
2836 c3/return
2837
2838 new-literal-integer:
2839
2840 55/push-ebp
2841 89/<- %ebp 4/r32/esp
2842
2843 51/push-ecx
2844
2845 (is-hex-int? *(ebp+0xc))
2846 3d/compare-eax-and 0/imm32
2847 0f 84/jump-if-equal $new-literal-integer:abort/disp32
2848
2849 (slice-to-string Heap *(ebp+0xc))
2850 89/<- %ecx 0/r32/eax
2851
2852 (allocate *(ebp+8) *Var-size)
2853 89/<- *eax 1/r32/ecx
2854 c7 0/subop/copy *(eax+4) 0/imm32/tag/literal
2855 c7 0/subop/copy *(eax+8) 0/imm32
2856 c7 0/subop/copy *(eax+0xc) 0/imm32
2857 c7 0/subop/copy *(eax+0x10) 0/imm32
2858 $new-literal-integer:end:
2859
2860 59/pop-to-ecx
2861
2862 89/<- %esp 5/r32/ebp
2863 5d/pop-to-ebp
2864 c3/return
2865
2866 $new-literal-integer:abort:
2867 (write-buffered Stderr "variable cannot begin with a digit '")
2868 (write-slice-buffered Stderr *(ebp+0xc))
2869 (write-buffered Stderr "'\n")
2870 (flush Stderr)
2871
2872 bb/copy-to-ebx 1/imm32
2873 b8/copy-to-eax 1/imm32/exit
2874 cd/syscall 0x80/imm8
2875
2876
2877 new-block:
2878
2879 55/push-ebp
2880 89/<- %ebp 4/r32/esp
2881
2882 51/push-ecx
2883
2884 (allocate *(ebp+8) *Stmt-size)
2885 (zero-out %eax *Stmt-size)
2886 c7 0/subop/copy *eax 0/imm32/tag/block
2887 8b/-> *(ebp+0xc) 1/r32/ecx
2888 89/<- *(eax+4) 1/r32/ecx
2889 $new-block:end:
2890
2891 59/pop-to-ecx
2892
2893 89/<- %esp 5/r32/ebp
2894 5d/pop-to-ebp
2895 c3/return
2896
2897 new-stmt:
2898
2899 55/push-ebp
2900 89/<- %ebp 4/r32/esp
2901
2902 51/push-ecx
2903
2904 (allocate *(ebp+8) *Stmt-size)
2905 (zero-out %eax *Stmt-size)
2906 c7 0/subop/copy *eax 1/imm32/tag/regular-stmt
2907 8b/-> *(ebp+0xc) 1/r32/ecx
2908 89/<- *(eax+4) 1/r32/ecx
2909 8b/-> *(ebp+0x10) 1/r32/ecx
2910 89/<- *(eax+8) 1/r32/ecx
2911 8b/-> *(ebp+0x14) 1/r32/ecx
2912 89/<- *(eax+0xc) 1/r32/ecx
2913 $new-stmt:end:
2914
2915 59/pop-to-ecx
2916
2917 89/<- %esp 5/r32/ebp
2918 5d/pop-to-ebp
2919 c3/return
2920
2921 new-vardef:
2922
2923 55/push-ebp
2924 89/<- %ebp 4/r32/esp
2925
2926 51/push-ecx
2927
2928 (allocate *(ebp+8) *Stmt-size)
2929 (zero-out %eax *Stmt-size)
2930 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack
2931 8b/-> *(ebp+0xc) 1/r32/ecx
2932 89/<- *(eax+4) 1/r32/ecx
2933 8b/-> *(ebp+0x10) 1/r32/ecx
2934 89/<- *(eax+8) 1/r32/ecx
2935 $new-vardef:end:
2936
2937 59/pop-to-ecx
2938
2939 89/<- %esp 5/r32/ebp
2940 5d/pop-to-ebp
2941 c3/return
2942
2943 new-regvardef:
2944
2945 55/push-ebp
2946 89/<- %ebp 4/r32/esp
2947
2948 51/push-ecx
2949
2950 (allocate *(ebp+8) *Stmt-size)
2951 (zero-out %eax *Stmt-size)
2952 c7 0/subop/copy *eax 3/imm32/tag/var-in-register
2953 8b/-> *(ebp+0xc) 1/r32/ecx
2954 89/<- *(eax+4) 1/r32/ecx
2955 8b/-> *(ebp+0x10) 1/r32/ecx
2956 89/<- *(eax+8) 1/r32/ecx
2957 8b/-> *(ebp+0x14) 1/r32/ecx
2958 89/<- *(eax+0xc) 1/r32/ecx
2959 $new-regvardef:end:
2960
2961 59/pop-to-ecx
2962
2963 89/<- %esp 5/r32/ebp
2964 5d/pop-to-ebp
2965 c3/return
2966
2967 new-named-block:
2968
2969 55/push-ebp
2970 89/<- %ebp 4/r32/esp
2971
2972 51/push-ecx
2973
2974 (allocate *(ebp+8) *Stmt-size)
2975 (zero-out %eax *Stmt-size)
2976 c7 0/subop/copy *eax 4/imm32/tag/named-block
2977 8b/-> *(ebp+0xc) 1/r32/ecx
2978 89/<- *(eax+4) 1/r32/ecx
2979 8b/-> *(ebp+0x10) 1/r32/ecx
2980 89/<- *(eax+8) 1/r32/ecx
2981 $new-named-block:end:
2982
2983 59/pop-to-ecx
2984
2985 89/<- %esp 5/r32/ebp
2986 5d/pop-to-ebp
2987 c3/return
2988
2989 new-list:
2990
2991 55/push-ebp
2992 89/<- %ebp 4/r32/esp
2993
2994 51/push-ecx
2995
2996 (allocate *(ebp+8) *List-size)
2997 8b/-> *(ebp+0xc) 1/r32/ecx
2998 89/<- *eax 1/r32/ecx
2999 8b/-> *(ebp+0x10) 1/r32/ecx
3000 89/<- *(eax+4) 1/r32/ecx
3001 $new-list:end:
3002
3003 59/pop-to-ecx
3004
3005 89/<- %esp 5/r32/ebp
3006 5d/pop-to-ebp
3007 c3/return
3008
3009 append-list:
3010
3011 55/push-ebp
3012 89/<- %ebp 4/r32/esp
3013
3014 51/push-ecx
3015
3016 (allocate *(ebp+8) *List-size)
3017 8b/-> *(ebp+0xc) 1/r32/ecx
3018 89/<- *eax 1/r32/ecx
3019
3020 81 7/subop/compare *(ebp+0x10) 0/imm32
3021 74/jump-if-equal $new-list:end/disp8
3022
3023
3024 8b/-> *(ebp+0x10) 1/r32/ecx
3025
3026 {
3027 81 7/subop/compare *(ecx+4) 0/imm32
3028 74/jump-if-equal break/disp8
3029
3030 8b/-> *(ecx+4) 1/r32/ecx
3031 eb/jump loop/disp8
3032 }
3033
3034 89/<- *(ecx+4) 0/r32/eax
3035
3036 8b/-> *(ebp+0x10) 0/r32/eax
3037 $append-list:end:
3038
3039 59/pop-to-ecx
3040
3041 89/<- %esp 5/r32/ebp
3042 5d/pop-to-ebp
3043 c3/return
3044
3045 append-to-block:
3046
3047 55/push-ebp
3048 89/<- %ebp 4/r32/esp
3049
3050 56/push-esi
3051
3052 8b/-> *(ebp+0xc) 6/r32/esi
3053 (append-list *(ebp+8) *(ebp+0x10) *(esi+4))
3054 89/<- *(esi+4) 0/r32/eax
3055 $append-to-block:end:
3056
3057 5e/pop-to-esi
3058
3059 89/<- %esp 5/r32/ebp
3060 5d/pop-to-ebp
3061 c3/return
3062
3063
3064
3065
3066
3067 check-mu-types:
3068
3069 55/push-ebp
3070 89/<- %ebp 4/r32/esp
3071
3072 $check-mu-types:end:
3073
3074 89/<- %esp 5/r32/ebp
3075 5d/pop-to-ebp
3076 c3/return
3077
3078 size-of:
3079
3080 55/push-ebp
3081 89/<- %ebp 4/r32/esp
3082
3083 b8/copy-to-eax 4/imm32
3084 $size-of:end:
3085
3086 89/<- %esp 5/r32/ebp
3087 5d/pop-to-ebp
3088 c3/return
3089
3090
3091
3092
3093
3094 emit-subx:
3095
3096 55/push-ebp
3097 89/<- %ebp 4/r32/esp
3098
3099 50/push-eax
3100 51/push-ecx
3101 57/push-edi
3102
3103 8b/-> *(ebp+8) 7/r32/edi
3104
3105 8b/-> *Program 1/r32/ecx
3106 {
3107
3108 81 7/subop/compare %ecx 0/imm32
3109 0f 84/jump-if-equal break/disp32
3110 (emit-subx-function %edi %ecx)
3111
3112 8b/-> *(ecx+0x14) 1/r32/ecx
3113 e9/jump loop/disp32
3114 }
3115 $emit-subx:end:
3116
3117 5f/pop-to-edi
3118 59/pop-to-ecx
3119 58/pop-to-eax
3120
3121 89/<- %esp 5/r32/ebp
3122 5d/pop-to-ebp
3123 c3/return
3124
3125 emit-subx-function:
3126
3127 55/push-ebp
3128 89/<- %ebp 4/r32/esp
3129
3130 50/push-eax
3131 51/push-ecx
3132 57/push-edi
3133
3134 8b/-> *(ebp+8) 7/r32/edi
3135
3136 8b/-> *(ebp+0xc) 1/r32/ecx
3137
3138 (write-buffered %edi *ecx)
3139 (write-buffered %edi ":\n")
3140 (emit-subx-prologue %edi)
3141 (emit-subx-block %edi *(ecx+0x10))
3142 (emit-subx-epilogue %edi)
3143 $emit-subx-function:end:
3144
3145 5f/pop-to-edi
3146 59/pop-to-ecx
3147 58/pop-to-eax
3148
3149 89/<- %esp 5/r32/ebp
3150 5d/pop-to-ebp
3151 c3/return
3152
3153 emit-subx-block:
3154
3155 55/push-ebp
3156 89/<- %ebp 4/r32/esp
3157
3158 8b/-> *(ebp+0xc) 6/r32/esi
3159 8b/-> *(esi+4) 6/r32/esi
3160
3161 {
3162 $emit-subx-block:check-empty:
3163 81 7/subop/compare %esi 0/imm32
3164 0f 84/jump-if-equal break/disp32
3165 (write-buffered *(ebp+8) "{\n")
3166 {
3167 $emit-subx-block:stmt:
3168 81 7/subop/compare %esi 0/imm32
3169 74/jump-if-equal break/disp8
3170 (emit-subx-statement *(ebp+8) *esi Primitives *Program)
3171 (write-buffered *(ebp+8) Newline)
3172 8b/-> *(esi+4) 6/r32/esi
3173 eb/jump loop/disp8
3174 }
3175 (write-buffered *(ebp+8) "}\n")
3176 }
3177 $emit-subx-block:end:
3178
3179 89/<- %esp 5/r32/ebp
3180 5d/pop-to-ebp
3181 c3/return
3182
3183 emit-subx-statement:
3184
3185 55/push-ebp
3186 89/<- %ebp 4/r32/esp
3187
3188 50/push-eax
3189 51/push-ecx
3190
3191 {
3192 $emit-subx-statement:primitive:
3193 (find-matching-primitive *(ebp+0x10) *(ebp+0xc))
3194 3d/compare-eax-and 0/imm32
3195 74/jump-if-equal break/disp8
3196 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax)
3197 e9/jump $emit-subx-statement:end/disp32
3198 }
3199
3200 {
3201 $emit-subx-statement:call:
3202 (find-matching-function *(ebp+0x14) *(ebp+0xc))
3203 3d/compare-eax-and 0/imm32
3204 74/jump-if-equal break/disp8
3205 (emit-subx-call *(ebp+8) *(ebp+0xc) %eax)
3206 e9/jump $emit-subx-statement:end/disp32
3207 }
3208
3209 e9/jump $emit-subx-statement:abort/disp32
3210 $emit-subx-statement:end:
3211
3212 59/pop-to-ecx
3213 58/pop-to-eax
3214
3215 89/<- %esp 5/r32/ebp
3216 5d/pop-to-ebp
3217 c3/return
3218
3219 $emit-subx-statement:abort:
3220
3221 (write-buffered Stderr "couldn't translate '")
3222
3223 (write-buffered Stderr "'\n")
3224 (flush Stderr)
3225
3226 bb/copy-to-ebx 1/imm32
3227 b8/copy-to-eax 1/imm32/exit
3228 cd/syscall 0x80/imm8
3229
3230
3231
3232
3233 == data
3234 Primitives:
3235
3236 _Primitive-inc-eax:
3237
3238 "increment"/imm32/name
3239 0/imm32/no-inouts
3240 Single-int-var-in-eax/imm32/outputs
3241 "40/increment-eax"/imm32/subx-name
3242 0/imm32/no-rm32
3243 0/imm32/no-r32
3244 0/imm32/no-imm32
3245 0/imm32/output-is-write-only
3246 _Primitive-inc-ecx/imm32/next
3247 _Primitive-inc-ecx:
3248
3249 "increment"/imm32/name
3250 0/imm32/no-inouts
3251 Single-int-var-in-ecx/imm32/outputs
3252 "41/increment-ecx"/imm32/subx-name
3253 0/imm32/no-rm32
3254 0/imm32/no-r32
3255 0/imm32/no-imm32
3256 0/imm32/output-is-write-only
3257 _Primitive-inc-edx/imm32/next
3258 _Primitive-inc-edx:
3259
3260 "increment"/imm32/name
3261 0/imm32/no-inouts
3262 Single-int-var-in-edx/imm32/outputs
3263 "42/increment-edx"/imm32/subx-name
3264 0/imm32/no-rm32
3265 0/imm32/no-r32
3266 0/imm32/no-imm32
3267 0/imm32/output-is-write-only
3268 _Primitive-inc-ebx/imm32/next
3269 _Primitive-inc-ebx:
3270
3271 "increment"/imm32/name
3272 0/imm32/no-inouts
3273 Single-int-var-in-ebx/imm32/outputs
3274 "43/increment-ebx"/imm32/subx-name
3275 0/imm32/no-rm32
3276 0/imm32/no-r32
3277 0/imm32/no-imm32
3278 0/imm32/output-is-write-only
3279 _Primitive-inc-esi/imm32/next
3280 _Primitive-inc-esi:
3281
3282 "increment"/imm32/name
3283 0/imm32/no-inouts
3284 Single-int-var-in-esi/imm32/outputs
3285 "46/increment-esi"/imm32/subx-name
3286 0/imm32/no-rm32
3287 0/imm32/no-r32
3288 0/imm32/no-imm32
3289 0/imm32/output-is-write-only
3290 _Primitive-inc-edi/imm32/next
3291 _Primitive-inc-edi:
3292
3293 "increment"/imm32/name
3294 0/imm32/no-inouts
3295 Single-int-var-in-edi/imm32/outputs
3296 "47/increment-edi"/imm32/subx-name
3297 0/imm32/no-rm32
3298 0/imm32/no-r32
3299 0/imm32/no-imm32
3300 0/imm32/output-is-write-only
3301 _Primitive-dec-eax/imm32/next
3302 _Primitive-dec-eax:
3303
3304 "decrement"/imm32/name
3305 0/imm32/no-inouts
3306 Single-int-var-in-eax/imm32/outputs
3307 "48/decrement-eax"/imm32/subx-name
3308 0/imm32/no-rm32
3309 0/imm32/no-r32
3310 0/imm32/no-imm32
3311 0/imm32/output-is-write-only
3312 _Primitive-dec-ecx/imm32/next
3313 _Primitive-dec-ecx:
3314
3315 "decrement"/imm32/name
3316 0/imm32/no-inouts
3317 Single-int-var-in-ecx/imm32/outputs
3318 "49/decrement-ecx"/imm32/subx-name
3319 0/imm32/no-rm32
3320 0/imm32/no-r32
3321 0/imm32/no-imm32
3322 0/imm32/output-is-write-only
3323 _Primitive-dec-edx/imm32/next
3324 _Primitive-dec-edx:
3325
3326 "decrement"/imm32/name
3327 0/imm32/no-inouts
3328 Single-int-var-in-edx/imm32/outputs
3329 "4a/decrement-edx"/imm32/subx-name
3330 0/imm32/no-rm32
3331 0/imm32/no-r32
3332 0/imm32/no-imm32
3333 0/imm32/output-is-write-only
3334 _Primitive-dec-ebx/imm32/next
3335 _Primitive-dec-ebx:
3336
3337 "decrement"/imm32/name
3338 0/imm32/no-inouts
3339 Single-int-var-in-ebx/imm32/outputs
3340 "4b/decrement-ebx"/imm32/subx-name
3341 0/imm32/no-rm32
3342 0/imm32/no-r32
3343 0/imm32/no-imm32
3344 0/imm32/output-is-write-only
3345 _Primitive-dec-esi/imm32/next
3346 _Primitive-dec-esi:
3347
3348 "decrement"/imm32/name
3349 0/imm32/no-inouts
3350 Single-int-var-in-esi/imm32/outputs
3351 "4e/decrement-esi"/imm32/subx-name
3352 0/imm32/no-rm32
3353 0/imm32/no-r32
3354 0/imm32/no-imm32
3355 0/imm32/output-is-write-only
3356 _Primitive-dec-edi/imm32/next
3357 _Primitive-dec-edi:
3358
3359 "decrement"/imm32/name
3360 0/imm32/no-inouts
3361 Single-int-var-in-edi/imm32/outputs
3362 "4f/decrement-edi"/imm32/subx-name
3363 0/imm32/no-rm32
3364 0/imm32/no-r32
3365 0/imm32/no-imm32
3366 0/imm32/output-is-write-only
3367 _Primitive-inc-mem/imm32/next
3368 _Primitive-inc-mem:
3369
3370 "increment"/imm32/name
3371 Single-int-var-on-stack/imm32/inouts
3372 0/imm32/no-outputs
3373 "ff 0/subop/increment"/imm32/subx-name
3374 1/imm32/rm32-is-first-inout
3375 0/imm32/no-r32
3376 0/imm32/no-imm32
3377 0/imm32/output-is-write-only
3378 _Primitive-inc-reg/imm32/next
3379 _Primitive-inc-reg:
3380
3381 "increment"/imm32/name
3382 0/imm32/no-inouts
3383 Single-int-var-in-some-register/imm32/outputs
3384 "ff 0/subop/increment"/imm32/subx-name
3385 3/imm32/rm32-is-first-output
3386 0/imm32/no-r32
3387 0/imm32/no-imm32
3388 0/imm32/output-is-write-only
3389 _Primitive-dec-mem/imm32/next
3390 _Primitive-dec-mem:
3391
3392 "decrement"/imm32/name
3393 Single-int-var-on-stack/imm32/inouts
3394 0/imm32/no-outputs
3395 "ff 1/subop/decrement"/imm32/subx-name
3396 1/imm32/rm32-is-first-inout
3397 0/imm32/no-r32
3398 0/imm32/no-imm32
3399 0/imm32/output-is-write-only
3400 _Primitive-dec-reg/imm32/next
3401 _Primitive-dec-reg:
3402
3403 "decrement"/imm32/name
3404 0/imm32/no-inouts
3405 Single-int-var-in-some-register/imm32/outputs
3406 "ff 1/subop/decrement"/imm32/subx-name
3407 3/imm32/rm32-is-first-output
3408 0/imm32/no-r32
3409 0/imm32/no-imm32
3410 0/imm32/output-is-write-only
3411 _Primitive-add-to-eax/imm32/next
3412
3413 _Primitive-add-to-eax:
3414
3415 "add"/imm32/name
3416 Single-lit-var/imm32/inouts
3417 Single-int-var-in-eax/imm32/outputs
3418 "05/add-to-eax"/imm32/subx-name
3419 0/imm32/no-rm32
3420 0/imm32/no-r32
3421 1/imm32/imm32-is-first-inout
3422 0/imm32/output-is-write-only
3423 _Primitive-add-reg-to-reg/imm32/next
3424 _Primitive-add-reg-to-reg:
3425
3426 "add"/imm32/name
3427 Single-int-var-in-some-register/imm32/inouts
3428 Single-int-var-in-some-register/imm32/outputs
3429 "01/add-to"/imm32/subx-name
3430 3/imm32/rm32-is-first-output
3431 1/imm32/r32-is-first-inout
3432 0/imm32/no-imm32
3433 0/imm32/output-is-write-only
3434 _Primitive-add-reg-to-mem/imm32/next
3435 _Primitive-add-reg-to-mem:
3436
3437 "add-to"/imm32/name
3438 Int-var-and-second-int-var-in-some-register/imm32/inouts
3439 0/imm32/outputs
3440 "01/add-to"/imm32/subx-name
3441 1/imm32/rm32-is-first-inout
3442 2/imm32/r32-is-second-inout
3443 0/imm32/no-imm32
3444 0/imm32/output-is-write-only
3445 _Primitive-add-mem-to-reg/imm32/next
3446 _Primitive-add-mem-to-reg:
3447
3448 "add"/imm32/name
3449 Single-int-var-on-stack/imm32/inouts
3450 Single-int-var-in-some-register/imm32/outputs
3451 "03/add"/imm32/subx-name
3452 1/imm32/rm32-is-first-inout
3453 3/imm32/r32-is-first-output
3454 0/imm32/no-imm32
3455 0/imm32/output-is-write-only
3456 _Primitive-add-lit-to-reg/imm32/next
3457 _Primitive-add-lit-to-reg:
3458
3459 "add"/imm32/name
3460 Single-lit-var/imm32/inouts
3461 Single-int-var-in-some-register/imm32/outputs
3462 "81 0/subop/add"/imm32/subx-name
3463 3/imm32/rm32-is-first-output
3464 0/imm32/no-r32
3465 1/imm32/imm32-is-first-inout
3466 0/imm32/output-is-write-only
3467 _Primitive-add-lit-to-mem/imm32/next
3468 _Primitive-add-lit-to-mem:
3469
3470 "add-to"/imm32/name
3471 Int-var-and-literal/imm32/inouts
3472 0/imm32/outputs
3473 "81 0/subop/add"/imm32/subx-name
3474 1/imm32/rm32-is-first-inout
3475 0/imm32/no-r32
3476 2/imm32/imm32-is-first-inout
3477 0/imm32/output-is-write-only
3478 _Primitive-subtract-from-eax/imm32/next
3479
3480 _Primitive-subtract-from-eax:
3481
3482 "subtract"/imm32/name
3483 Single-lit-var/imm32/inouts
3484 Single-int-var-in-eax/imm32/outputs
3485 "2d/subtract-from-eax"/imm32/subx-name
3486 0/imm32/no-rm32
3487 0/imm32/no-r32
3488 1/imm32/imm32-is-first-inout
3489 0/imm32/output-is-write-only
3490 _Primitive-subtract-reg-from-reg/imm32/next
3491 _Primitive-subtract-reg-from-reg:
3492
3493 "subtract"/imm32/name
3494 Single-int-var-in-some-register/imm32/inouts
3495 Single-int-var-in-some-register/imm32/outputs
3496 "29/subtract-from"/imm32/subx-name
3497 3/imm32/rm32-is-first-output
3498 1/imm32/r32-is-first-inout
3499 0/imm32/no-imm32
3500 0/imm32/output-is-write-only
3501 _Primitive-subtract-reg-from-mem/imm32/next
3502 _Primitive-subtract-reg-from-mem:
3503
3504 "subtract-from"/imm32/name
3505 Int-var-and-second-int-var-in-some-register/imm32/inouts
3506 0/imm32/outputs
3507 "29/subtract-from"/imm32/subx-name
3508 1/imm32/rm32-is-first-inout
3509 2/imm32/r32-is-second-inout
3510 0/imm32/no-imm32
3511 0/imm32/output-is-write-only
3512 _Primitive-subtract-mem-from-reg/imm32/next
3513 _Primitive-subtract-mem-from-reg:
3514
3515 "subtract"/imm32/name
3516 Single-int-var-on-stack/imm32/inouts
3517 Single-int-var-in-some-register/imm32/outputs
3518 "2b/subtract"/imm32/subx-name
3519 1/imm32/rm32-is-first-inout
3520 3/imm32/r32-is-first-output
3521 0/imm32/no-imm32
3522 0/imm32/output-is-write-only
3523 _Primitive-subtract-lit-from-reg/imm32/next
3524 _Primitive-subtract-lit-from-reg:
3525
3526 "subtract"/imm32/name
3527 Single-lit-var/imm32/inouts
3528 Single-int-var-in-some-register/imm32/outputs
3529 "81 5/subop/subtract"/imm32/subx-name
3530 3/imm32/rm32-is-first-output
3531 0/imm32/no-r32
3532 1/imm32/imm32-is-first-inout
3533 0/imm32/output-is-write-only
3534 _Primitive-subtract-lit-from-mem/imm32/next
3535 _Primitive-subtract-lit-from-mem:
3536
3537 "subtract-from"/imm32/name
3538 Int-var-and-literal/imm32/inouts
3539 0/imm32/outputs
3540 "81 5/subop/subtract"/imm32/subx-name
3541 1/imm32/rm32-is-first-inout
3542 0/imm32/no-r32
3543 2/imm32/imm32-is-first-inout
3544 0/imm32/output-is-write-only
3545 _Primitive-and-with-eax/imm32/next
3546
3547 _Primitive-and-with-eax:
3548
3549 "and"/imm32/name
3550 Single-lit-var/imm32/inouts
3551 Single-int-var-in-eax/imm32/outputs
3552 "25/and-with-eax"/imm32/subx-name
3553 0/imm32/no-rm32
3554 0/imm32/no-r32
3555 1/imm32/imm32-is-first-inout
3556 0/imm32/output-is-write-only
3557 _Primitive-and-reg-with-reg/imm32/next
3558 _Primitive-and-reg-with-reg:
3559
3560 "and"/imm32/name
3561 Single-int-var-in-some-register/imm32/inouts
3562 Single-int-var-in-some-register/imm32/outputs
3563 "21/and-with"/imm32/subx-name
3564 3/imm32/rm32-is-first-output
3565 1/imm32/r32-is-first-inout
3566 0/imm32/no-imm32
3567 0/imm32/output-is-write-only
3568 _Primitive-and-reg-with-mem/imm32/next
3569 _Primitive-and-reg-with-mem:
3570
3571 "and-with"/imm32/name
3572 Int-var-and-second-int-var-in-some-register/imm32/inouts
3573 0/imm32/outputs
3574 "21/and-with"/imm32/subx-name
3575 1/imm32/rm32-is-first-inout
3576 2/imm32/r32-is-second-inout
3577 0/imm32/no-imm32
3578 0/imm32/output-is-write-only
3579 _Primitive-and-mem-with-reg/imm32/next
3580 _Primitive-and-mem-with-reg:
3581
3582 "and"/imm32/name
3583 Single-int-var-on-stack/imm32/inouts
3584 Single-int-var-in-some-register/imm32/outputs
3585 "23/and"/imm32/subx-name
3586 1/imm32/rm32-is-first-inout
3587 3/imm32/r32-is-first-output
3588 0/imm32/no-imm32
3589 0/imm32/output-is-write-only
3590 _Primitive-and-lit-with-reg/imm32/next
3591 _Primitive-and-lit-with-reg:
3592
3593 "and"/imm32/name
3594 Single-lit-var/imm32/inouts
3595 Single-int-var-in-some-register/imm32/outputs
3596 "81 4/subop/and"/imm32/subx-name
3597 3/imm32/rm32-is-first-output
3598 0/imm32/no-r32
3599 1/imm32/imm32-is-first-inout
3600 0/imm32/output-is-write-only
3601 _Primitive-and-lit-with-mem/imm32/next
3602 _Primitive-and-lit-with-mem:
3603
3604 "and-with"/imm32/name
3605 Int-var-and-literal/imm32/inouts
3606 0/imm32/outputs
3607 "81 4/subop/and"/imm32/subx-name
3608 1/imm32/rm32-is-first-inout
3609 0/imm32/no-r32
3610 2/imm32/imm32-is-first-inout
3611 0/imm32/output-is-write-only
3612 _Primitive-or-with-eax/imm32/next
3613
3614 _Primitive-or-with-eax:
3615
3616 "or"/imm32/name
3617 Single-lit-var/imm32/inouts
3618 Single-int-var-in-eax/imm32/outputs
3619 "0d/or-with-eax"/imm32/subx-name
3620 0/imm32/no-rm32
3621 0/imm32/no-r32
3622 1/imm32/imm32-is-first-inout
3623 0/imm32/output-is-write-only
3624 _Primitive-or-reg-with-reg/imm32/next
3625 _Primitive-or-reg-with-reg:
3626
3627 "or"/imm32/name
3628 Single-int-var-in-some-register/imm32/inouts
3629 Single-int-var-in-some-register/imm32/outputs
3630 "09/or-with"/imm32/subx-name
3631 3/imm32/rm32-is-first-output
3632 1/imm32/r32-is-first-inout
3633 0/imm32/no-imm32
3634 0/imm32/output-is-write-only
3635 _Primitive-or-reg-with-mem/imm32/next
3636 _Primitive-or-reg-with-mem:
3637
3638 "or-with"/imm32/name
3639 Int-var-and-second-int-var-in-some-register/imm32/inouts
3640 0/imm32/outputs
3641 "09/or-with"/imm32/subx-name
3642 1/imm32/rm32-is-first-inout
3643 2/imm32/r32-is-second-inout
3644 0/imm32/no-imm32
3645 0/imm32/output-is-write-only
3646 _Primitive-or-mem-with-reg/imm32/next
3647 _Primitive-or-mem-with-reg:
3648
3649 "or"/imm32/name
3650 Single-int-var-on-stack/imm32/inouts
3651 Single-int-var-in-some-register/imm32/outputs
3652 "0b/or"/imm32/subx-name
3653 1/imm32/rm32-is-first-inout
3654 3/imm32/r32-is-first-output
3655 0/imm32/no-imm32
3656 0/imm32/output-is-write-only
3657 _Primitive-or-lit-with-reg/imm32/next
3658 _Primitive-or-lit-with-reg:
3659
3660 "or"/imm32/name
3661 Single-lit-var/imm32/inouts
3662 Single-int-var-in-some-register/imm32/outputs
3663 "81 4/subop/or"/imm32/subx-name
3664 3/imm32/rm32-is-first-output
3665 0/imm32/no-r32
3666 1/imm32/imm32-is-first-inout
3667 0/imm32/output-is-write-only
3668 _Primitive-or-lit-with-mem/imm32/next
3669 _Primitive-or-lit-with-mem:
3670
3671 "or-with"/imm32/name
3672 Int-var-and-literal/imm32/inouts
3673 0/imm32/outputs
3674 "81 4/subop/or"/imm32/subx-name
3675 1/imm32/rm32-is-first-inout
3676 0/imm32/no-r32
3677 2/imm32/imm32-is-first-inout
3678 0/imm32/output-is-write-only
3679 _Primitive-xor-with-eax/imm32/next
3680
3681 _Primitive-xor-with-eax:
3682
3683 "xor"/imm32/name
3684 Single-lit-var/imm32/inouts
3685 Single-int-var-in-eax/imm32/outputs
3686 "35/xor-with-eax"/imm32/subx-name
3687 0/imm32/no-rm32
3688 0/imm32/no-r32
3689 1/imm32/imm32-is-first-inout
3690 0/imm32/output-is-write-only
3691 _Primitive-xor-reg-with-reg/imm32/next
3692 _Primitive-xor-reg-with-reg:
3693
3694 "xor"/imm32/name
3695 Single-int-var-in-some-register/imm32/inouts
3696 Single-int-var-in-some-register/imm32/outputs
3697 "31/xor-with"/imm32/subx-name
3698 3/imm32/rm32-is-first-output
3699 1/imm32/r32-is-first-inout
3700 0/imm32/no-imm32
3701 0/imm32/output-is-write-only
3702 _Primitive-xor-reg-with-mem/imm32/next
3703 _Primitive-xor-reg-with-mem:
3704
3705 "xor-with"/imm32/name
3706 Int-var-and-second-int-var-in-some-register/imm32/inouts
3707 0/imm32/outputs
3708 "31/xor-with"/imm32/subx-name
3709 1/imm32/rm32-is-first-inout
3710 2/imm32/r32-is-second-inout
3711 0/imm32/no-imm32
3712 0/imm32/output-is-write-only
3713 _Primitive-xor-mem-with-reg/imm32/next
3714 _Primitive-xor-mem-with-reg:
3715
3716 "xor"/imm32/name
3717 Single-int-var-on-stack/imm32/inouts
3718 Single-int-var-in-some-register/imm32/outputs
3719 "33/xor"/imm32/subx-name
3720 1/imm32/rm32-is-first-inout
3721 3/imm32/r32-is-first-output
3722 0/imm32/no-imm32
3723 0/imm32/output-is-write-only
3724 _Primitive-xor-lit-with-reg/imm32/next
3725 _Primitive-xor-lit-with-reg:
3726
3727 "xor"/imm32/name
3728 Single-lit-var/imm32/inouts
3729 Single-int-var-in-some-register/imm32/outputs
3730 "81 4/subop/xor"/imm32/subx-name
3731 3/imm32/rm32-is-first-output
3732 0/imm32/no-r32
3733 1/imm32/imm32-is-first-inout
3734 0/imm32/output-is-write-only
3735 _Primitive-xor-lit-with-mem/imm32/next
3736 _Primitive-xor-lit-with-mem:
3737
3738 "xor-with"/imm32/name
3739 Int-var-and-literal/imm32/inouts
3740 0/imm32/outputs
3741 "81 4/subop/xor"/imm32/subx-name
3742 1/imm32/rm32-is-first-inout
3743 0/imm32/no-r32
3744 2/imm32/imm32-is-first-inout
3745 0/imm32/output-is-write-only
3746 _Primitive-copy-to-eax/imm32/next
3747
3748 _Primitive-copy-to-eax:
3749
3750 "copy"/imm32/name
3751 Single-lit-var/imm32/inouts
3752 Single-int-var-in-eax/imm32/outputs
3753 "b8/copy-to-eax"/imm32/subx-name
3754 0/imm32/no-rm32
3755 0/imm32/no-r32
3756 1/imm32/imm32-is-first-inout
3757 1/imm32/output-is-write-only
3758 _Primitive-copy-to-ecx/imm32/next
3759 _Primitive-copy-to-ecx:
3760
3761 "copy"/imm32/name
3762 Single-lit-var/imm32/inouts
3763 Single-int-var-in-ecx/imm32/outputs
3764 "b9/copy-to-ecx"/imm32/subx-name
3765 0/imm32/no-rm32
3766 0/imm32/no-r32
3767 1/imm32/imm32-is-first-inout
3768 1/imm32/output-is-write-only
3769 _Primitive-copy-to-edx/imm32/next
3770 _Primitive-copy-to-edx:
3771
3772 "copy"/imm32/name
3773 Single-lit-var/imm32/inouts
3774 Single-int-var-in-edx/imm32/outputs
3775 "ba/copy-to-edx"/imm32/subx-name
3776 0/imm32/no-rm32
3777 0/imm32/no-r32
3778 1/imm32/imm32-is-first-inout
3779 1/imm32/output-is-write-only
3780 _Primitive-copy-to-ebx/imm32/next
3781 _Primitive-copy-to-ebx:
3782
3783 "copy"/imm32/name
3784 Single-lit-var/imm32/inouts
3785 Single-int-var-in-ebx/imm32/outputs
3786 "bb/copy-to-ebx"/imm32/subx-name
3787 0/imm32/no-rm32
3788 0/imm32/no-r32
3789 1/imm32/imm32-is-first-inout
3790 1/imm32/output-is-write-only
3791 _Primitive-copy-to-esi/imm32/next
3792 _Primitive-copy-to-esi:
3793
3794 "copy"/imm32/name
3795 Single-lit-var/imm32/inouts
3796 Single-int-var-in-esi/imm32/outputs
3797 "be/copy-to-esi"/imm32/subx-name
3798 0/imm32/no-rm32
3799 0/imm32/no-r32
3800 1/imm32/imm32-is-first-inout
3801 1/imm32/output-is-write-only
3802 _Primitive-copy-to-edi/imm32/next
3803 _Primitive-copy-to-edi:
3804
3805 "copy"/imm32/name
3806 Single-lit-var/imm32/inouts
3807 Single-int-var-in-edi/imm32/outputs
3808 "bf/copy-to-edi"/imm32/subx-name
3809 0/imm32/no-rm32
3810 0/imm32/no-r32
3811 1/imm32/imm32-is-first-inout
3812 1/imm32/output-is-write-only
3813 _Primitive-copy-reg-to-reg/imm32/next
3814 _Primitive-copy-reg-to-reg:
3815
3816 "copy"/imm32/name
3817 Single-int-var-in-some-register/imm32/inouts
3818 Single-int-var-in-some-register/imm32/outputs
3819 "89/copy-to"/imm32/subx-name
3820 3/imm32/rm32-is-first-output
3821 1/imm32/r32-is-first-inout
3822 0/imm32/no-imm32
3823 1/imm32/output-is-write-only
3824 _Primitive-copy-reg-to-mem/imm32/next
3825 _Primitive-copy-reg-to-mem:
3826
3827 "copy-to"/imm32/name
3828 Int-var-and-second-int-var-in-some-register/imm32/inouts
3829 0/imm32/outputs
3830 "89/copy-to"/imm32/subx-name
3831 1/imm32/rm32-is-first-inout
3832 2/imm32/r32-is-second-inout
3833 0/imm32/no-imm32
3834 1/imm32/output-is-write-only
3835 _Primitive-copy-mem-to-reg/imm32/next
3836 _Primitive-copy-mem-to-reg:
3837
3838 "copy"/imm32/name
3839 Single-int-var-on-stack/imm32/inouts
3840 Single-int-var-in-some-register/imm32/outputs
3841 "8b/copy-from"/imm32/subx-name
3842 1/imm32/rm32-is-first-inout
3843 3/imm32/r32-is-first-output
3844 0/imm32/no-imm32
3845 1/imm32/output-is-write-only
3846 _Primitive-copy-lit-to-reg/imm32/next
3847 _Primitive-copy-lit-to-reg:
3848
3849 "copy"/imm32/name
3850 Single-lit-var/imm32/inouts
3851 Single-int-var-in-some-register/imm32/outputs
3852 "c7 0/subop/copy"/imm32/subx-name
3853 3/imm32/rm32-is-first-output
3854 0/imm32/no-r32
3855 1/imm32/imm32-is-first-inout
3856 1/imm32/output-is-write-only
3857 _Primitive-copy-lit-to-mem/imm32/next
3858 _Primitive-copy-lit-to-mem:
3859
3860 "copy-to"/imm32/name
3861 Int-var-and-literal/imm32/inouts
3862 0/imm32/outputs
3863 "c7 0/subop/copy"/imm32/subx-name
3864 1/imm32/rm32-is-first-inout
3865 0/imm32/no-r32
3866 2/imm32/imm32-is-first-inout
3867 1/imm32/output-is-write-only
3868 0/imm32/next
3869
3870 Single-int-var-on-stack:
3871 Int-var-on-stack/imm32
3872 0/imm32/next
3873
3874 Int-var-on-stack:
3875 "arg1"/imm32/name
3876 1/imm32/type-int
3877 1/imm32/some-block-depth
3878 1/imm32/some-stack-offset
3879 0/imm32/no-register
3880
3881 Int-var-and-second-int-var-in-some-register:
3882 Int-var-on-stack/imm32
3883 Single-int-var-in-some-register/imm32/next
3884
3885 Int-var-and-literal:
3886 Int-var-on-stack/imm32
3887 Single-lit-var/imm32/next
3888
3889 Single-int-var-in-some-register:
3890 Int-var-in-some-register/imm32
3891 0/imm32/next
3892
3893 Int-var-in-some-register:
3894 "arg1"/imm32/name
3895 1/imm32/type-int
3896 1/imm32/some-block-depth
3897 0/imm32/no-stack-offset
3898 "*"/imm32/register
3899
3900 Single-int-var-in-eax:
3901 Int-var-in-eax/imm32
3902 0/imm32/next
3903
3904 Int-var-in-eax:
3905 "arg1"/imm32/name
3906 1/imm32/type-int
3907 1/imm32/some-block-depth
3908 0/imm32/no-stack-offset
3909 "eax"/imm32/register
3910
3911 Single-int-var-in-ecx:
3912 Int-var-in-ecx/imm32
3913 0/imm32/next
3914
3915 Int-var-in-ecx:
3916 "arg1"/imm32/name
3917 1/imm32/type-int
3918 1/imm32/some-block-depth
3919 0/imm32/no-stack-offset
3920 "ecx"/imm32/register
3921
3922 Single-int-var-in-edx:
3923 Int-var-in-edx/imm32
3924 0/imm32/next
3925
3926 Int-var-in-edx:
3927 "arg1"/imm32/name
3928 1/imm32/type-int
3929 1/imm32/some-block-depth
3930 0/imm32/no-stack-offset
3931 "edx"/imm32/register
3932
3933 Single-int-var-in-ebx:
3934 Int-var-in-ebx/imm32
3935 0/imm32/next
3936
3937 Int-var-in-ebx:
3938 "arg1"/imm32/name
3939 1/imm32/type-int
3940 1/imm32/some-block-depth
3941 0/imm32/no-stack-offset
3942 "ebx"/imm32/register
3943
3944 Single-int-var-in-esi:
3945 Int-var-in-esi/imm32
3946 0/imm32/next
3947
3948 Int-var-in-esi:
3949 "arg1"/imm32/name
3950 1/imm32/type-int
3951 1/imm32/some-block-depth
3952 0/imm32/no-stack-offset
3953 "esi"/imm32/register
3954
3955 Single-int-var-in-edi:
3956 Int-var-in-edi/imm32
3957 0/imm32/next
3958
3959 Int-var-in-edi:
3960 "arg1"/imm32/name
3961 1/imm32/type-int
3962 1/imm32/some-block-depth
3963 0/imm32/no-stack-offset
3964 "edi"/imm32/register
3965
3966 Single-lit-var:
3967 Lit-var/imm32
3968 0/imm32/next
3969
3970 Lit-var:
3971 "literal"/imm32/name
3972 0/imm32/type-literal
3973 1/imm32/some-block-depth
3974 0/imm32/no-stack-offset
3975 0/imm32/no-register
3976
3977 == code
3978 emit-subx-primitive:
3979
3980 55/push-ebp
3981 89/<- %ebp 4/r32/esp
3982
3983 50/push-eax
3984 51/push-ecx
3985
3986 8b/-> *(ebp+0x10) 1/r32/ecx
3987
3988 (write-buffered *(ebp+8) *(ecx+0xc))
3989
3990 (emit-subx-rm32 *(ebp+8) *(ecx+0x10) *(ebp+0xc))
3991
3992 (emit-subx-r32 *(ebp+8) *(ecx+0x14) *(ebp+0xc))
3993
3994 (emit-subx-imm32 *(ebp+8) *(ecx+0x18) *(ebp+0xc))
3995 $emit-subx-primitive:end:
3996
3997 59/pop-to-ecx
3998 58/pop-to-eax
3999
4000 89/<- %esp 5/r32/ebp
4001 5d/pop-to-ebp
4002 c3/return
4003
4004 emit-subx-rm32:
4005
4006 55/push-ebp
4007 89/<- %ebp 4/r32/esp
4008
4009 50/push-eax
4010
4011 81 7/subop/compare *(ebp+0xc) 0/imm32
4012 74/jump-if-equal $emit-subx-rm32:end/disp8
4013
4014 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
4015 (emit-subx-var-as-rm32 *(ebp+8) %eax)
4016 $emit-subx-rm32:end:
4017
4018 58/pop-to-eax
4019
4020 89/<- %esp 5/r32/ebp
4021 5d/pop-to-ebp
4022 c3/return
4023
4024 get-stmt-operand-from-arg-location:
4025
4026 55/push-ebp
4027 89/<- %ebp 4/r32/esp
4028
4029 51/push-ecx
4030
4031 8b/-> *(ebp+0xc) 0/r32/eax
4032
4033 8b/-> *(ebp+8) 1/r32/ecx
4034
4035 {
4036 3d/compare-eax-and 1/imm32
4037 75/jump-if-not-equal break/disp8
4038 $get-stmt-operand-from-arg-location:1:
4039 8b/-> *(ecx+8) 0/r32/eax
4040 8b/-> *eax 0/r32/eax
4041 eb/jump $get-stmt-operand-from-arg-location:end/disp8
4042 }
4043
4044 {
4045 3d/compare-eax-and 2/imm32
4046 75/jump-if-not-equal break/disp8
4047 $get-stmt-operand-from-arg-location:2:
4048 8b/-> *(ecx+8) 0/r32/eax
4049 8b/-> *(eax+4) 0/r32/eax
4050 8b/-> *eax 0/r32/eax
4051 eb/jump $get-stmt-operand-from-arg-location:end/disp8
4052 }
4053
4054 {
4055 3d/compare-eax-and 3/imm32
4056 75/jump-if-not-equal break/disp8
4057 $get-stmt-operand-from-arg-location:3:
4058 8b/-> *(ecx+0xc) 0/r32/eax
4059 8b/-> *eax 0/r32/eax
4060 eb/jump $get-stmt-operand-from-arg-location:end/disp8
4061 }
4062
4063 e9/jump $get-stmt-operand-from-arg-location:abort/disp32
4064 $get-stmt-operand-from-arg-location:end:
4065
4066 59/pop-to-ecx
4067
4068 89/<- %esp 5/r32/ebp
4069 5d/pop-to-ebp
4070 c3/return
4071
4072 $get-stmt-operand-from-arg-location:abort:
4073
4074 (write-buffered Stderr "invalid arg-location ")
4075 (print-int32-buffered Stderr %eax)
4076 (write-buffered Stderr "\n")
4077 (flush Stderr)
4078
4079 bb/copy-to-ebx 1/imm32
4080 b8/copy-to-eax 1/imm32/exit
4081 cd/syscall 0x80/imm8
4082
4083
4084 emit-subx-r32:
4085
4086 55/push-ebp
4087 89/<- %ebp 4/r32/esp
4088
4089 50/push-eax
4090 51/push-ecx
4091
4092 81 7/subop/compare *(ebp+0xc) 0/imm32
4093 0f 84/jump-if-equal $emit-subx-r32:end/disp32
4094
4095 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
4096 (maybe-get Registers *(eax+0x10) 8)
4097 (write-buffered *(ebp+8) Space)
4098 (print-int32-buffered *(ebp+8) *eax)
4099 (write-buffered *(ebp+8) "/r32")
4100 $emit-subx-r32:end:
4101
4102 59/pop-to-ecx
4103 58/pop-to-eax
4104
4105 89/<- %esp 5/r32/ebp
4106 5d/pop-to-ebp
4107 c3/return
4108
4109 emit-subx-imm32:
4110
4111 55/push-ebp
4112 89/<- %ebp 4/r32/esp
4113
4114 50/push-eax
4115 51/push-ecx
4116
4117 81 7/subop/compare *(ebp+0xc) 0/imm32
4118 74/jump-if-equal $emit-subx-imm32:end/disp8
4119
4120 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
4121 (write-buffered *(ebp+8) Space)
4122 (write-buffered *(ebp+8) *eax)
4123 (write-buffered *(ebp+8) "/imm32")
4124 $emit-subx-imm32:end:
4125
4126 59/pop-to-ecx
4127 58/pop-to-eax
4128
4129 89/<- %esp 5/r32/ebp
4130 5d/pop-to-ebp
4131 c3/return
4132
4133 emit-subx-call:
4134
4135 55/push-ebp
4136 89/<- %ebp 4/r32/esp
4137
4138 50/push-eax
4139 51/push-ecx
4140
4141 (write-buffered *(ebp+8) "(")
4142
4143 8b/-> *(ebp+0x10) 1/r32/ecx
4144 (write-buffered *(ebp+8) *(ecx+4))
4145
4146
4147 8b/-> *(ebp+0xc) 1/r32/ecx
4148 8b/-> *(ecx+8) 1/r32/ecx
4149 {
4150
4151 81 7/subop/compare %ecx 0/imm32
4152 74/jump-if-equal break/disp8
4153
4154 (emit-subx-call-operand *(ebp+8) *ecx)
4155
4156 8b/-> *(ecx+4) 1/r32/ecx
4157 eb/jump loop/disp8
4158 }
4159
4160 (write-buffered *(ebp+8) ")")
4161 $emit-subx-call:end:
4162
4163 59/pop-to-ecx
4164 58/pop-to-eax
4165
4166 89/<- %esp 5/r32/ebp
4167 5d/pop-to-ebp
4168 c3/return
4169
4170 emit-subx-call-operand:
4171
4172 55/push-ebp
4173 89/<- %ebp 4/r32/esp
4174
4175 50/push-eax
4176
4177 8b/-> *(ebp+0xc) 0/r32/eax
4178
4179 (emit-subx-var-as-rm32 *(ebp+8) %eax)
4180
4181 {
4182 81 7/subop/compare *(eax+4) 0/imm32
4183 75/jump-if-not-equal break/disp8
4184 $emit-subx-call-operand:literal:
4185 (write-buffered *(ebp+8) Space)
4186 (write-buffered *(ebp+8) *eax)
4187 }
4188 $emit-subx-call-operand:end:
4189
4190 58/pop-to-eax
4191
4192 89/<- %esp 5/r32/ebp
4193 5d/pop-to-ebp
4194 c3/return
4195
4196 emit-subx-var-as-rm32:
4197
4198 55/push-ebp
4199 89/<- %ebp 4/r32/esp
4200
4201 50/push-eax
4202
4203 8b/-> *(ebp+0xc) 0/r32/eax
4204
4205 {
4206 81 7/subop/compare *(eax+0x10) 0/imm32
4207 74/jump-if-equal break/disp8
4208 $emit-subx-var-as-rm32:register:
4209 (write-buffered *(ebp+8) " %")
4210 (write-buffered *(ebp+8) *(eax+0x10))
4211 }
4212
4213 {
4214 81 7/subop/compare *(eax+0xc) 0/imm32
4215 74/jump-if-equal break/disp8
4216 $emit-subx-var-as-rm32:stack:
4217 (write-buffered *(ebp+8) Space)
4218 (write-buffered *(ebp+8) "*(ebp+")
4219 8b/-> *(ebp+0xc) 0/r32/eax
4220 (print-int32-buffered *(ebp+8) *(eax+0xc))
4221 (write-buffered *(ebp+8) ")")
4222 }
4223 $emit-subx-var-as-rm32:end:
4224
4225 58/pop-to-eax
4226
4227 89/<- %esp 5/r32/ebp
4228 5d/pop-to-ebp
4229 c3/return
4230
4231 find-matching-function:
4232
4233 55/push-ebp
4234 89/<- %ebp 4/r32/esp
4235
4236 51/push-ecx
4237
4238 8b/-> *(ebp+8) 1/r32/ecx
4239 {
4240
4241 81 7/subop/compare %ecx 0/imm32
4242 74/jump-if-equal break/disp8
4243
4244 {
4245 (mu-stmt-matches-function? *(ebp+0xc) %ecx)
4246 3d/compare-eax-and 0/imm32
4247 74/jump-if-equal break/disp8
4248 89/<- %eax 1/r32/ecx
4249 eb/jump $find-matching-function:end/disp8
4250 }
4251
4252 8b/-> *(ecx+0x14) 1/r32/ecx
4253 eb/jump loop/disp8
4254 }
4255
4256 b8/copy-to-eax 0/imm32
4257 $find-matching-function:end:
4258
4259 59/pop-to-ecx
4260
4261 89/<- %esp 5/r32/ebp
4262 5d/pop-to-ebp
4263 c3/return
4264
4265 find-matching-primitive:
4266
4267 55/push-ebp
4268 89/<- %ebp 4/r32/esp
4269
4270 51/push-ecx
4271
4272 8b/-> *(ebp+8) 1/r32/ecx
4273 {
4274 $find-matching-primitive:loop:
4275
4276 81 7/subop/compare %ecx 0/imm32
4277 0f 84/jump-if-equal break/disp32
4278
4279
4280
4281
4282
4283
4284
4285 {
4286 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx)
4287 3d/compare-eax-and 0/imm32
4288 74/jump-if-equal break/disp8
4289 89/<- %eax 1/r32/ecx
4290 eb/jump $find-matching-primitive:end/disp8
4291 }
4292 $find-matching-primitive:next-primitive:
4293
4294 8b/-> *(ecx+0x20) 1/r32/ecx
4295 e9/jump loop/disp32
4296 }
4297
4298 b8/copy-to-eax 0/imm32
4299 $find-matching-primitive:end:
4300
4301 59/pop-to-ecx
4302
4303 89/<- %esp 5/r32/ebp
4304 5d/pop-to-ebp
4305 c3/return
4306
4307 mu-stmt-matches-function?:
4308
4309 55/push-ebp
4310 89/<- %ebp 4/r32/esp
4311
4312 51/push-ecx
4313
4314 8b/-> *(ebp+8) 1/r32/ecx
4315 8b/-> *(ebp+0xc) 0/r32/eax
4316 (string-equal? *(ecx+4) *eax)
4317 $mu-stmt-matches-function?:end:
4318
4319 59/pop-to-ecx
4320
4321 89/<- %esp 5/r32/ebp
4322 5d/pop-to-ebp
4323 c3/return
4324
4325 mu-stmt-matches-primitive?:
4326
4327
4328
4329
4330
4331
4332 55/push-ebp
4333 89/<- %ebp 4/r32/esp
4334
4335 51/push-ecx
4336 52/push-edx
4337 53/push-ebx
4338 56/push-esi
4339 57/push-edi
4340
4341 8b/-> *(ebp+8) 1/r32/ecx
4342
4343 8b/-> *(ebp+0xc) 2/r32/edx
4344 {
4345 $mu-stmt-matches-primitive?:check-name:
4346
4347 (string-equal? *(ecx+4) *edx)
4348 3d/compare-eax-and 0/imm32
4349 75/jump-if-not-equal break/disp8
4350 b8/copy-to-eax 0/imm32
4351 e9/jump $mu-stmt-matches-primitive?:end/disp32
4352 }
4353 $mu-stmt-matches-primitive?:check-inouts:
4354
4355 8b/-> *(ecx+8) 6/r32/esi
4356 8b/-> *(edx+4) 7/r32/edi
4357 {
4358
4359 {
4360 81 7/subop/compare %esi 0/imm32
4361 75/jump-if-not-equal break/disp8
4362 $mu-stmt-matches-primitive?:stmt-inout-is-null:
4363 {
4364 81 7/subop/compare %edi 0/imm32
4365 75/jump-if-not-equal break/disp8
4366
4367 e9/jump $mu-stmt-matches-primitive?:check-outputs/disp32
4368 }
4369
4370 b8/copy-to-eax 0/imm32/false
4371 e9/jump $mu-stmt-matches-primitive?:end/disp32
4372 }
4373
4374 {
4375 81 7/subop/compare %edi 0/imm32
4376 75/jump-if-not-equal break/disp8
4377 $mu-stmt-matches-primitive?:prim-inout-is-null:
4378 b8/copy-to-eax 0/imm32/false
4379 e9/jump $mu-stmt-matches-primitive?:end/disp32
4380 }
4381
4382 {
4383 (operand-matches-primitive? *esi *edi)
4384 3d/compare-eax-and 0/imm32
4385 75/jump-if-not-equal break/disp8
4386 b8/copy-to-eax 0/imm32/false
4387 e9/jump $mu-stmt-matches-primitive?:end/disp32
4388 }
4389
4390 8b/-> *(esi+4) 6/r32/esi
4391
4392 8b/-> *(edi+4) 7/r32/edi
4393 eb/jump loop/disp8
4394 }
4395 $mu-stmt-matches-primitive?:check-outputs:
4396
4397 8b/-> *(ecx+0xc) 6/r32/esi
4398 8b/-> *(edx+8) 7/r32/edi
4399 {
4400
4401 {
4402 $mu-stmt-matches-primitive?:check-output:
4403 81 7/subop/compare %esi 0/imm32
4404 75/jump-if-not-equal break/disp8
4405 {
4406 81 7/subop/compare %edi 0/imm32
4407 75/jump-if-not-equal break/disp8
4408
4409 b8/copy-to-eax 1/imm32
4410 e9/jump $mu-stmt-matches-primitive?:end/disp32
4411 }
4412
4413 b8/copy-to-eax 0/imm32
4414 e9/jump $mu-stmt-matches-primitive?:end/disp32
4415 }
4416
4417 {
4418 81 7/subop/compare %edi 0/imm32
4419 75/jump-if-not-equal break/disp8
4420 b8/copy-to-eax 0/imm32
4421 e9/jump $mu-stmt-matches-primitive?:end/disp32
4422 }
4423
4424 {
4425 (operand-matches-primitive? *esi *edi)
4426 3d/compare-eax-and 0/imm32
4427 75/jump-if-not-equal break/disp8
4428 b8/copy-to-eax 0/imm32
4429 e9/jump $mu-stmt-matches-primitive?:end/disp32
4430 }
4431
4432 8b/-> *(esi+4) 6/r32/esi
4433
4434 8b/-> *(edi+4) 7/r32/edi
4435 eb/jump loop/disp8
4436 }
4437 $mu-stmt-matches-primitive?:return-true:
4438 b8/copy-to-eax 1/imm32
4439 $mu-stmt-matches-primitive?:end:
4440
4441 5f/pop-to-edi
4442 5e/pop-to-esi
4443 5b/pop-to-ebx
4444 5a/pop-to-edx
4445 59/pop-to-ecx
4446
4447 89/<- %esp 5/r32/ebp
4448 5d/pop-to-ebp
4449 c3/return
4450
4451 operand-matches-primitive?:
4452
4453 55/push-ebp
4454 89/<- %ebp 4/r32/esp
4455
4456 56/push-esi
4457 57/push-edi
4458
4459 8b/-> *(ebp+8) 6/r32/esi
4460
4461 8b/-> *(ebp+0xc) 7/r32/edi
4462
4463 8b/-> *(esi+4) 0/r32/eax
4464 39/compare *(edi+4) 0/r32/eax
4465 b8/copy-to-eax 0/imm32/false
4466 75/jump-if-not-equal $operand-matches-primitive?:end/disp8
4467
4468 {
4469
4470 8b/-> *(esi+0x10) 0/r32/eax
4471 39/compare *(edi+0x10) 0/r32/eax
4472 74/jump-if-equal break/disp8
4473
4474 3d/compare-eax-and 0/imm32
4475 74/jump-if-equal $operand-matches-primitive?:end/disp8
4476 81 7/subop/compare *(edi+0x10) 0/imm32
4477 74/jump-if-equal $operand-matches-primitive?:end/disp8
4478
4479 (string-equal? *(edi+0x10) "*")
4480 3d/compare-eax-and 0/imm32
4481 b8/copy-to-eax 1/imm32/true
4482 75/jump-if-not-equal $operand-matches-primitive?:end/disp8
4483
4484 (string-equal? *(esi+0x10) *(edi+0x10))
4485 3d/compare-eax-and 0/imm32
4486 b8/copy-to-eax 0/imm32/false
4487 74/jump-if-equal $operand-matches-primitive?:end/disp8
4488 }
4489
4490 b8/copy-to-eax 1/imm32/true
4491 $operand-matches-primitive?:end:
4492
4493 5f/pop-to-edi
4494 5e/pop-to-esi
4495
4496 89/<- %esp 5/r32/ebp
4497 5d/pop-to-ebp
4498 c3/return
4499
4500 test-emit-subx-statement-primitive:
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519 55/push-ebp
4520 89/<- %ebp 4/r32/esp
4521
4522 (clear-stream _test-output-stream)
4523 (clear-stream $_test-output-buffered-file->buffer)
4524
4525 68/push 0/imm32/no-register
4526 68/push -8/imm32/stack-offset
4527 68/push 1/imm32/block-depth
4528 68/push 1/imm32/type-int
4529 68/push "foo"/imm32
4530 89/<- %ecx 4/r32/esp
4531
4532 68/push 0/imm32/next
4533 51/push-ecx/var-foo
4534 89/<- %ebx 4/r32/esp
4535
4536 68/push 0/imm32/next
4537 68/push 0/imm32/outputs
4538 53/push-ebx/operands
4539 68/push "increment"/imm32/operation
4540 68/push 1/imm32
4541 89/<- %esi 4/r32/esp
4542
4543 68/push 0/imm32/next
4544 68/push 0/imm32/output-is-write-only
4545 68/push 0/imm32/no-imm32
4546 68/push 0/imm32/no-r32
4547 68/push 1/imm32/rm32-is-first-inout
4548 68/push "ff 0/subop/increment"/imm32/subx-name
4549 68/push 0/imm32/outputs
4550 53/push-ebx/inouts
4551 68/push "increment"/imm32/name
4552 89/<- %ebx 4/r32/esp
4553
4554 (emit-subx-statement _test-output-buffered-file %esi %ebx 0)
4555 (flush _test-output-buffered-file)
4556 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
4562
4563 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-statement-primitive")
4564
4565 89/<- %esp 5/r32/ebp
4566 5d/pop-to-ebp
4567 c3/return
4568
4569 test-emit-subx-statement-primitive-register:
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588 55/push-ebp
4589 89/<- %ebp 4/r32/esp
4590
4591 (clear-stream _test-output-stream)
4592 (clear-stream $_test-output-buffered-file->buffer)
4593
4594 68/push "eax"/imm32/register
4595 68/push 0/imm32/no-stack-offset
4596 68/push 1/imm32/block-depth
4597 68/push 1/imm32/type-int
4598 68/push "foo"/imm32
4599 89/<- %ecx 4/r32/esp
4600
4601 68/push 0/imm32/next
4602 51/push-ecx/var-foo
4603 89/<- %ebx 4/r32/esp
4604
4605 68/push 0/imm32/next
4606 53/push-ebx/outputs
4607 68/push 0/imm32/inouts
4608 68/push "increment"/imm32/operation
4609 68/push 1/imm32
4610 89/<- %esi 4/r32/esp
4611
4612 68/push Any-register/imm32
4613 68/push 0/imm32/no-stack-offset
4614 68/push 1/imm32/block-depth
4615 68/push 1/imm32/type-int
4616 68/push "dummy"/imm32
4617 89/<- %ebx 4/r32/esp
4618
4619 68/push 0/imm32/next
4620 53/push-ebx/formal-var
4621 89/<- %ebx 4/r32/esp
4622
4623 68/push 0/imm32/next
4624 68/push 0/imm32/output-is-write-only
4625 68/push 0/imm32/no-imm32
4626 68/push 0/imm32/no-r32
4627 68/push 3/imm32/rm32-in-first-output
4628 68/push "ff 0/subop/increment"/imm32/subx-name
4629 53/push-ebx/outputs
4630 68/push 0/imm32/inouts
4631 68/push "increment"/imm32/name
4632 89/<- %ebx 4/r32/esp
4633
4634 (emit-subx-statement _test-output-buffered-file %esi %ebx 0)
4635 (flush _test-output-buffered-file)
4636 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
4642
4643 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-statement-primitive-register")
4644
4645 89/<- %esp 5/r32/ebp
4646 5d/pop-to-ebp
4647 c3/return
4648
4649 test-emit-subx-statement-select-primitive:
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671 55/push-ebp
4672 89/<- %ebp 4/r32/esp
4673
4674 (clear-stream _test-output-stream)
4675 (clear-stream $_test-output-buffered-file->buffer)
4676
4677 68/push "eax"/imm32/register
4678 68/push 0/imm32/no-stack-offset
4679 68/push 1/imm32/block-depth
4680 68/push 1/imm32/type-int
4681 68/push "foo"/imm32
4682 89/<- %ecx 4/r32/esp
4683
4684 68/push 0/imm32/next
4685 51/push-ecx/var-foo
4686 89/<- %edi 4/r32/esp
4687
4688 68/push 0/imm32/next
4689 57/push-edi/outputs
4690 68/push 0/imm32/inouts
4691 68/push "increment"/imm32/operation
4692 68/push 1/imm32
4693 89/<- %esi 4/r32/esp
4694
4695 68/push Any-register/imm32
4696 68/push 0/imm32/no-stack-offset
4697 68/push 1/imm32/block-depth
4698 68/push 1/imm32/type-int
4699 68/push "dummy"/imm32
4700 89/<- %ebx 4/r32/esp
4701
4702 68/push 0/imm32/next
4703 53/push-ebx/formal-var
4704 89/<- %ebx 4/r32/esp
4705
4706 68/push 0/imm32/next
4707 68/push 0/imm32/output-is-write-only
4708 68/push 0/imm32/no-imm32
4709 68/push 0/imm32/no-r32
4710 68/push 3/imm32/rm32-in-first-output
4711 68/push "ff 0/subop/increment"/imm32/subx-name
4712 53/push-ebx/outputs/formal-outputs
4713 68/push 0/imm32/inouts
4714 68/push "increment"/imm32/name
4715 89/<- %ebx 4/r32/esp
4716
4717 53/push-ebx/next
4718 68/push 0/imm32/output-is-write-only
4719 68/push 0/imm32/no-imm32
4720 68/push 0/imm32/no-r32
4721 68/push 1/imm32/rm32-is-first-inout
4722 68/push "ff 0/subop/increment"/imm32/subx-name
4723 68/push 0/imm32/outputs
4724 57/push-edi/inouts/real-outputs
4725 68/push "increment"/imm32/name
4726 89/<- %ebx 4/r32/esp
4727
4728 (emit-subx-statement _test-output-buffered-file %esi %ebx 0)
4729 (flush _test-output-buffered-file)
4730 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
4736
4737 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-statement-select-primitive")
4738
4739 89/<- %esp 5/r32/ebp
4740 5d/pop-to-ebp
4741 c3/return
4742
4743 test-emit-subx-statement-select-primitive-2:
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765 55/push-ebp
4766 89/<- %ebp 4/r32/esp
4767
4768 (clear-stream _test-output-stream)
4769 (clear-stream $_test-output-buffered-file->buffer)
4770
4771 68/push "eax"/imm32/register
4772 68/push 0/imm32/no-stack-offset
4773 68/push 1/imm32/block-depth
4774 68/push 1/imm32/type-int
4775 68/push "foo"/imm32
4776 89/<- %ecx 4/r32/esp
4777
4778 68/push 0/imm32/next
4779 51/push-ecx/var-foo
4780 89/<- %edi 4/r32/esp
4781
4782 68/push 0/imm32/next
4783 68/push 0/imm32/outputs
4784 57/push-edi/inouts
4785 68/push "increment"/imm32/operation
4786 68/push 1/imm32
4787 89/<- %esi 4/r32/esp
4788
4789 68/push Any-register/imm32
4790 68/push 0/imm32/no-stack-offset
4791 68/push 1/imm32/block-depth
4792 68/push 1/imm32/type-int
4793 68/push "dummy"/imm32
4794 89/<- %ebx 4/r32/esp
4795
4796 68/push 0/imm32/next
4797 53/push-ebx/formal-var
4798 89/<- %ebx 4/r32/esp
4799
4800 68/push 0/imm32/next
4801 68/push 0/imm32/output-is-write-only
4802 68/push 0/imm32/no-imm32
4803 68/push 0/imm32/no-r32
4804 68/push 3/imm32/rm32-in-first-output
4805 68/push "ff 0/subop/increment"/imm32/subx-name
4806 53/push-ebx/outputs/formal-outputs
4807 68/push 0/imm32/inouts
4808 68/push "increment"/imm32/name
4809 89/<- %ebx 4/r32/esp
4810
4811 53/push-ebx/next
4812 68/push 0/imm32/output-is-write-only
4813 68/push 0/imm32/no-imm32
4814 68/push 0/imm32/no-r32
4815 68/push 1/imm32/rm32-is-first-inout
4816 68/push "ff 0/subop/increment"/imm32/subx-name
4817 68/push 0/imm32/outputs
4818 57/push-edi/inouts/real-outputs
4819 68/push "increment"/imm32/name
4820 89/<- %ebx 4/r32/esp
4821
4822 (emit-subx-statement _test-output-buffered-file %esi %ebx 0)
4823 (flush _test-output-buffered-file)
4824 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
4830
4831 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-statement-select-primitive-2")
4832
4833 89/<- %esp 5/r32/ebp
4834 5d/pop-to-ebp
4835 c3/return
4836
4837 test-increment-register:
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853 55/push-ebp
4854 89/<- %ebp 4/r32/esp
4855
4856 (clear-stream _test-output-stream)
4857 (clear-stream $_test-output-buffered-file->buffer)
4858
4859 68/push "eax"/imm32/register
4860 68/push 0/imm32/no-stack-offset
4861 68/push 1/imm32/block-depth
4862 68/push 1/imm32/type-int
4863 68/push "foo"/imm32
4864 89/<- %ecx 4/r32/esp
4865
4866 68/push 0/imm32/next
4867 51/push-ecx/var-foo
4868 89/<- %edi 4/r32/esp
4869
4870 68/push 0/imm32/next
4871 57/push-edi/outputs
4872 68/push 0/imm32/inouts
4873 68/push "increment"/imm32/operation
4874 68/push 1/imm32
4875 89/<- %esi 4/r32/esp
4876
4877 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
4878 (flush _test-output-buffered-file)
4879 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
4885
4886 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register")
4887
4888 89/<- %esp 5/r32/ebp
4889 5d/pop-to-ebp
4890 c3/return
4891
4892 test-increment-var:
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908 55/push-ebp
4909 89/<- %ebp 4/r32/esp
4910
4911 (clear-stream _test-output-stream)
4912 (clear-stream $_test-output-buffered-file->buffer)
4913
4914 68/push "eax"/imm32/register
4915 68/push 0/imm32/no-stack-offset
4916 68/push 1/imm32/block-depth
4917 68/push 1/imm32/type-int
4918 68/push "foo"/imm32
4919 89/<- %ecx 4/r32/esp
4920
4921 68/push 0/imm32/next
4922 51/push-ecx/var-foo
4923 89/<- %edi 4/r32/esp
4924
4925 68/push 0/imm32/next
4926 68/push 0/imm32/outputs
4927 57/push-edi/inouts
4928 68/push "increment"/imm32/operation
4929 68/push 1/imm32
4930 89/<- %esi 4/r32/esp
4931
4932 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
4933 (flush _test-output-buffered-file)
4934 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
4940
4941 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-increment-var")
4942
4943 89/<- %esp 5/r32/ebp
4944 5d/pop-to-ebp
4945 c3/return
4946
4947 test-add-reg-to-reg:
4948
4949
4950
4951
4952
4953 55/push-ebp
4954 89/<- %ebp 4/r32/esp
4955
4956 (clear-stream _test-output-stream)
4957 (clear-stream $_test-output-buffered-file->buffer)
4958
4959 68/push "eax"/imm32/register
4960 68/push 0/imm32/no-stack-offset
4961 68/push 1/imm32/block-depth
4962 68/push 1/imm32/type-int
4963 68/push "var1"/imm32
4964 89/<- %ecx 4/r32/esp
4965
4966 68/push "ecx"/imm32/register
4967 68/push 0/imm32/no-stack-offset
4968 68/push 1/imm32/block-depth
4969 68/push 1/imm32/type-int
4970 68/push "var2"/imm32
4971 89/<- %edx 4/r32/esp
4972
4973 68/push 0/imm32/next
4974 52/push-edx/var-var2
4975 89/<- %esi 4/r32/esp
4976
4977 68/push 0/imm32/next
4978 51/push-ecx/var-var1
4979 89/<- %edi 4/r32/esp
4980
4981 68/push 0/imm32/next
4982 57/push-edi/outputs
4983 56/push-esi/inouts
4984 68/push "add"/imm32/operation
4985 68/push 1/imm32
4986 89/<- %esi 4/r32/esp
4987
4988 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
4989 (flush _test-output-buffered-file)
4990 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
4996
4997 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg")
4998
4999 89/<- %esp 5/r32/ebp
5000 5d/pop-to-ebp
5001 c3/return
5002
5003 test-add-reg-to-mem:
5004
5005
5006
5007
5008
5009 55/push-ebp
5010 89/<- %ebp 4/r32/esp
5011
5012 (clear-stream _test-output-stream)
5013 (clear-stream $_test-output-buffered-file->buffer)
5014
5015 68/push 0/imm32/no-register
5016 68/push 8/imm32/stack-offset
5017 68/push 1/imm32/block-depth
5018 68/push 1/imm32/type-int
5019 68/push "var1"/imm32
5020 89/<- %ecx 4/r32/esp
5021
5022 68/push "ecx"/imm32/register
5023 68/push 0/imm32/no-stack-offset
5024 68/push 1/imm32/block-depth
5025 68/push 1/imm32/type-int
5026 68/push "var2"/imm32
5027 89/<- %edx 4/r32/esp
5028
5029 68/push 0/imm32/next
5030 52/push-edx/var-var2
5031 89/<- %esi 4/r32/esp
5032
5033 56/push-esi/next
5034 51/push-ecx/var-var1
5035 89/<- %esi 4/r32/esp
5036
5037 68/push 0/imm32/next
5038 68/push 0/imm32/outputs
5039 56/push-esi/inouts
5040 68/push "add-to"/imm32/operation
5041 68/push 1/imm32
5042 89/<- %esi 4/r32/esp
5043
5044 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
5045 (flush _test-output-buffered-file)
5046 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
5052
5053 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem")
5054
5055 89/<- %esp 5/r32/ebp
5056 5d/pop-to-ebp
5057 c3/return
5058
5059 test-add-mem-to-reg:
5060
5061
5062
5063
5064
5065 55/push-ebp
5066 89/<- %ebp 4/r32/esp
5067
5068 (clear-stream _test-output-stream)
5069 (clear-stream $_test-output-buffered-file->buffer)
5070
5071 68/push "eax"/imm32/register
5072 68/push 0/imm32/no-stack-offset
5073 68/push 1/imm32/block-depth
5074 68/push 1/imm32/type-int
5075 68/push "var1"/imm32
5076 89/<- %ecx 4/r32/esp
5077
5078 68/push 0/imm32/no-register
5079 68/push 8/imm32/stack-offset
5080 68/push 1/imm32/block-depth
5081 68/push 1/imm32/type-int
5082 68/push "var2"/imm32
5083 89/<- %edx 4/r32/esp
5084
5085 68/push 0/imm32/next
5086 52/push-edx/var-var2
5087 89/<- %esi 4/r32/esp
5088
5089 68/push 0/imm32/next
5090 51/push-ecx/var-var1
5091 89/<- %edi 4/r32/esp
5092
5093 68/push 0/imm32/next
5094 57/push-edi/outputs
5095 56/push-esi/inouts
5096 68/push "add"/imm32/operation
5097 68/push 1/imm32
5098 89/<- %esi 4/r32/esp
5099
5100 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
5101 (flush _test-output-buffered-file)
5102 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
5108
5109 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg")
5110
5111 89/<- %esp 5/r32/ebp
5112 5d/pop-to-ebp
5113 c3/return
5114
5115 test-add-literal-to-eax:
5116
5117
5118
5119
5120
5121 55/push-ebp
5122 89/<- %ebp 4/r32/esp
5123
5124 (clear-stream _test-output-stream)
5125 (clear-stream $_test-output-buffered-file->buffer)
5126
5127 68/push "eax"/imm32/register
5128 68/push 0/imm32/no-stack-offset
5129 68/push 1/imm32/block-depth
5130 68/push 1/imm32/type-int
5131 68/push "var1"/imm32
5132 89/<- %ecx 4/r32/esp
5133
5134 68/push 0/imm32/no-register
5135 68/push 0/imm32/no-stack-offset
5136 68/push 1/imm32/block-depth
5137 68/push 0/imm32/type-literal
5138 68/push "0x34"/imm32
5139 89/<- %edx 4/r32/esp
5140
5141 68/push 0/imm32/next
5142 52/push-edx/var-var2
5143 89/<- %esi 4/r32/esp
5144
5145 68/push 0/imm32/next
5146 51/push-ecx/var-var1
5147 89/<- %edi 4/r32/esp
5148
5149 68/push 0/imm32/next
5150 57/push-edi/outputs
5151 56/push-esi/inouts
5152 68/push "add"/imm32/operation
5153 68/push 1/imm32
5154 89/<- %esi 4/r32/esp
5155
5156 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
5157 (flush _test-output-buffered-file)
5158 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
5164
5165 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax")
5166
5167 89/<- %esp 5/r32/ebp
5168 5d/pop-to-ebp
5169 c3/return
5170
5171 test-add-literal-to-reg:
5172
5173
5174
5175
5176
5177 55/push-ebp
5178 89/<- %ebp 4/r32/esp
5179
5180 (clear-stream _test-output-stream)
5181 (clear-stream $_test-output-buffered-file->buffer)
5182
5183 68/push "ecx"/imm32/register
5184 68/push 0/imm32/no-stack-offset
5185 68/push 1/imm32/block-depth
5186 68/push 1/imm32/type-int
5187 68/push "var1"/imm32
5188 89/<- %ecx 4/r32/esp
5189
5190 68/push 0/imm32/no-register
5191 68/push 0/imm32/no-stack-offset
5192 68/push 1/imm32/block-depth
5193 68/push 0/imm32/type-literal
5194 68/push "0x34"/imm32
5195 89/<- %edx 4/r32/esp
5196
5197 68/push 0/imm32/next
5198 52/push-edx/var-var2
5199 89/<- %esi 4/r32/esp
5200
5201 68/push 0/imm32/next
5202 51/push-ecx/var-var1
5203 89/<- %edi 4/r32/esp
5204
5205 68/push 0/imm32/next
5206 57/push-edi/outputs
5207 56/push-esi/inouts
5208 68/push "add"/imm32/operation
5209 68/push 1/imm32
5210 89/<- %esi 4/r32/esp
5211
5212 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
5213 (flush _test-output-buffered-file)
5214 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
5220
5221 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg")
5222
5223 89/<- %esp 5/r32/ebp
5224 5d/pop-to-ebp
5225 c3/return
5226
5227 test-add-literal-to-mem:
5228
5229
5230
5231
5232
5233 55/push-ebp
5234 89/<- %ebp 4/r32/esp
5235
5236 (clear-stream _test-output-stream)
5237 (clear-stream $_test-output-buffered-file->buffer)
5238
5239 68/push 0/imm32/no-register
5240 68/push 8/imm32/stack-offset
5241 68/push 1/imm32/block-depth
5242 68/push 1/imm32/type-int
5243 68/push "var1"/imm32
5244 89/<- %ecx 4/r32/esp
5245
5246 68/push 0/imm32/no-register
5247 68/push 0/imm32/no-stack-offset
5248 68/push 1/imm32/block-depth
5249 68/push 0/imm32/type-literal
5250 68/push "0x34"/imm32
5251 89/<- %edx 4/r32/esp
5252
5253 68/push 0/imm32/next
5254 52/push-edx/var-var2
5255 89/<- %esi 4/r32/esp
5256
5257 56/push-esi/next
5258 51/push-ecx/var-var1
5259 89/<- %esi 4/r32/esp
5260
5261 68/push 0/imm32/next
5262 68/push 0/imm32/outputs
5263 56/push-esi/inouts
5264 68/push "add-to"/imm32/operation
5265 68/push 1/imm32
5266 89/<- %esi 4/r32/esp
5267
5268 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
5269 (flush _test-output-buffered-file)
5270 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
5276
5277 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem")
5278
5279 89/<- %esp 5/r32/ebp
5280 5d/pop-to-ebp
5281 c3/return
5282
5283 test-emit-subx-statement-function-call:
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304 55/push-ebp
5305 89/<- %ebp 4/r32/esp
5306
5307 (clear-stream _test-output-stream)
5308 (clear-stream $_test-output-buffered-file->buffer)
5309
5310 68/push 0/imm32/no-register
5311 68/push -8/imm32/stack-offset
5312 68/push 0/imm32/block-depth
5313 68/push 1/imm32/type-int
5314 68/push "foo"/imm32
5315 89/<- %ecx 4/r32/esp
5316
5317 68/push 0/imm32/next
5318 51/push-ecx/var-foo
5319 89/<- %esi 4/r32/esp
5320
5321 68/push 0/imm32/next
5322 68/push 0/imm32/outputs
5323 56/push-esi/inouts
5324 68/push "f"/imm32/operation
5325 68/push 1/imm32
5326 89/<- %esi 4/r32/esp
5327
5328 68/push 0/imm32/next
5329 68/push 0/imm32/body
5330 68/push 0/imm32/outputs
5331 51/push-ecx/inouts
5332 68/push "f2"/imm32/subx-name
5333 68/push "f"/imm32/name
5334 89/<- %ebx 4/r32/esp
5335
5336 (emit-subx-statement _test-output-buffered-file %esi 0 %ebx)
5337 (flush _test-output-buffered-file)
5338 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
5344
5345 (check-next-stream-line-equal _test-output-stream "(f2 *(ebp+0xfffffff8))" "F - test-emit-subx-statement-function-call")
5346
5347 89/<- %esp 5/r32/ebp
5348 5d/pop-to-ebp
5349 c3/return
5350
5351 test-emit-subx-statement-function-call-with-literal-arg:
5352
5353
5354
5355
5356
5357
5358 55/push-ebp
5359 89/<- %ebp 4/r32/esp
5360
5361 (clear-stream _test-output-stream)
5362 (clear-stream $_test-output-buffered-file->buffer)
5363
5364 68/push 0/imm32/no-register
5365 68/push 0/imm32/no-stack-offset
5366 68/push 0/imm32/block-depth
5367 68/push 0/imm32/type-literal
5368 68/push "34"/imm32
5369 89/<- %ecx 4/r32/esp
5370
5371 68/push 0/imm32/next
5372 51/push-ecx/var-foo
5373 89/<- %esi 4/r32/esp
5374
5375 68/push 0/imm32/next
5376 68/push 0/imm32/outputs
5377 56/push-esi/inouts
5378 68/push "f"/imm32/operation
5379 68/push 1/imm32
5380 89/<- %esi 4/r32/esp
5381
5382 68/push 0/imm32/next
5383 68/push 0/imm32/body
5384 68/push 0/imm32/outputs
5385 51/push-ecx/inouts
5386 68/push "f2"/imm32/subx-name
5387 68/push "f"/imm32/name
5388 89/<- %ebx 4/r32/esp
5389
5390 (emit-subx-statement _test-output-buffered-file %esi 0 %ebx)
5391 (flush _test-output-buffered-file)
5392 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
5398
5399 (check-next-stream-line-equal _test-output-stream "(f2 34)" "F - test-emit-subx-statement-function-call-with-literal-arg")
5400
5401 89/<- %esp 5/r32/ebp
5402 5d/pop-to-ebp
5403 c3/return
5404
5405 emit-subx-prologue:
5406
5407 55/push-ebp
5408 89/<- %ebp 4/r32/esp
5409
5410 (write-buffered *(ebp+8) "# . prologue\n")
5411 (write-buffered *(ebp+8) "55/push-ebp\n")
5412 (write-buffered *(ebp+8) "89/<- %ebp 4/r32/esp\n")
5413 $emit-subx-prologue:end:
5414
5415 89/<- %esp 5/r32/ebp
5416 5d/pop-to-ebp
5417 c3/return
5418
5419 emit-subx-epilogue:
5420
5421 55/push-ebp
5422 89/<- %ebp 4/r32/esp
5423
5424 (write-buffered *(ebp+8) "# . epilogue\n")
5425 (write-buffered *(ebp+8) "89/<- %esp 5/r32/ebp\n")
5426 (write-buffered *(ebp+8) "5d/pop-to-ebp\n")
5427 (write-buffered *(ebp+8) "c3/return\n")
5428 $emit-subx-epilogue:end:
5429
5430 89/<- %esp 5/r32/ebp
5431 5d/pop-to-ebp
5432 c3/return