https://github.com/akkartik/mu/blob/master/apps/mu.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241 == data
242
243 Program:
244 _Program-functions:
245 0/imm32
246 _Program-types:
247 0/imm32
248
249
250
251
252
253
254
255
256
257
258
259
260 Function-name:
261 0/imm32
262 Function-subx-name:
263 4/imm32
264 Function-inouts:
265 8/imm32
266 Function-outputs:
267 0xc/imm32
268 Function-body:
269 0x10/imm32
270 Function-next:
271 0x14/imm32
272 Function-size:
273 0x18/imm32/24
274
275 Primitive-name:
276 0/imm32
277 Primitive-inouts:
278 4/imm32
279 Primitive-outputs:
280 8/imm32
281 Primitive-subx-name:
282 0xc/imm32
283 Primitive-subx-rm32:
284 0x10/imm32
285 Primitive-subx-r32:
286 0x14/imm32
287 Primitive-subx-imm32:
288 0x18/imm32
289 Primitive-subx-disp32:
290 0x1c/imm32
291 Primitive-output-is-write-only:
292 0x20/imm32
293 Primitive-next:
294 0x24/imm32
295 Primitive-size:
296 0x28/imm32/36
297
298 Stmt-tag:
299 0/imm32
300
301 Block-stmts:
302 4/imm32
303 Block-var:
304 8/imm32
305
306 Stmt1-operation:
307 4/imm32
308 Stmt1-inouts:
309 8/imm32
310 Stmt1-outputs:
311 0xc/imm32
312
313 Vardef-var:
314 4/imm32
315
316 Regvardef-operation:
317 4/imm32
318 Regvardef-inouts:
319 8/imm32
320 Regvardef-outputs:
321 0xc/imm32
322
323 Stmt-size:
324 0x10/imm32
325
326 Var-name:
327 0/imm32
328 Var-type:
329 4/imm32
330 Var-block-depth:
331 8/imm32
332 Var-offset:
333 0xc/imm32
334 Var-register:
335 0x10/imm32
336 Var-size:
337 0x14/imm32
338
339 Any-register:
340
341 1/imm32
342
343 2a/asterisk
344
345 List-value:
346 0/imm32
347 List-next:
348 4/imm32
349 List-size:
350 8/imm32
351
352
353 Stmt-var-value:
354 0/imm32
355 Stmt-var-next:
356 4/imm32
357 Stmt-var-is-deref:
358 8/imm32
359 Stmt-var-size:
360 0xc/imm32
361
362
363
364
365
366
367
368 Tree-left:
369 0/imm32
370 Tree-right:
371 4/imm32
372 Tree-size:
373 8/imm32
374
375
376
377 Max-type-id:
378 0x10000/imm32
379
380 Type-id:
381 0x1c/imm32/write
382 0/imm32/read
383 0x100/imm32/length
384
385 "literal"/imm32
386 "int"/imm32
387 "addr"/imm32
388 "array"/imm32
389 "handle"/imm32
390 "boolean"/imm32
391 "constant"/imm32
392 0/imm32
393
394 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
395 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
396 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
397 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
398 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
399 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
400 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
401
402
403
404 Typeinfo-id:
405 0/imm32
406
407
408
409 Typeinfo-fields:
410 4/imm32
411 Typeinfo-total-size-in-bytes:
412 8/imm32
413 Typeinfo-next:
414 0xc/imm32
415 Typeinfo-size:
416 0x10/imm32
417
418 == code
419
420 Entry:
421
422 89/<- %ebp 4/r32/esp
423 (new-segment *Heap-size Heap)
424
425 {
426
427 81 7/subop/compare *ebp 1/imm32
428 7e/jump-if-<= break/disp8
429
430 (kernel-string-equal? *(ebp+8) "test")
431 3d/compare-eax-and 0/imm32/false
432 74/jump-if-= break/disp8
433
434 (run-tests)
435
436 8b/-> *Num-test-failures 3/r32/ebx
437 eb/jump $mu-main:end/disp8
438 }
439
440 (convert-mu Stdin Stdout)
441 (flush Stdout)
442
443 bb/copy-to-ebx 0/imm32
444 $mu-main:end:
445 b8/copy-to-eax 1/imm32/exit
446 cd/syscall 0x80/imm8
447
448 convert-mu:
449
450 55/push-ebp
451 89/<- %ebp 4/r32/esp
452
453 (parse-mu *(ebp+8))
454 (check-mu-types)
455 (emit-subx *(ebp+0xc))
456 $convert-mu:end:
457
458 89/<- %esp 5/r32/ebp
459 5d/pop-to-ebp
460 c3/return
461
462 test-convert-empty-input:
463
464
465 55/push-ebp
466 89/<- %ebp 4/r32/esp
467
468 (clear-stream _test-input-stream)
469 (clear-stream $_test-input-buffered-file->buffer)
470 (clear-stream _test-output-stream)
471 (clear-stream $_test-output-buffered-file->buffer)
472
473 (convert-mu _test-input-buffered-file _test-output-buffered-file)
474 (flush _test-output-buffered-file)
475 (check-stream-equal _test-output-stream "" "F - test-convert-empty-input")
476
477 89/<- %esp 5/r32/ebp
478 5d/pop-to-ebp
479 c3/return
480
481 test-convert-function-skeleton:
482
483 55/push-ebp
484 89/<- %ebp 4/r32/esp
485
486 (clear-stream _test-input-stream)
487 (clear-stream $_test-input-buffered-file->buffer)
488 (clear-stream _test-output-stream)
489 (clear-stream $_test-output-buffered-file->buffer)
490
491 (write _test-input-stream "fn foo {\n")
492 (write _test-input-stream "}\n")
493
494 (convert-mu _test-input-buffered-file _test-output-buffered-file)
495 (flush _test-output-buffered-file)
496 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
502
503 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0")
504 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-skeleton/1")
505 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-skeleton/2")
506 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3")
507 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-skeleton/4")
508 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5")
509 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-skeleton/6")
510 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-skeleton/7")
511
512 89/<- %esp 5/r32/ebp
513 5d/pop-to-ebp
514 c3/return
515
516 test-convert-multiple-function-skeletons:
517
518 55/push-ebp
519 89/<- %ebp 4/r32/esp
520
521 (clear-stream _test-input-stream)
522 (clear-stream $_test-input-buffered-file->buffer)
523 (clear-stream _test-output-stream)
524 (clear-stream $_test-output-buffered-file->buffer)
525
526 (write _test-input-stream "fn foo {\n")
527 (write _test-input-stream "}\n")
528 (write _test-input-stream "fn bar {\n")
529 (write _test-input-stream "}\n")
530
531 (convert-mu _test-input-buffered-file _test-output-buffered-file)
532 (flush _test-output-buffered-file)
533 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
539
540 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0")
541 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/1")
542 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/2")
543 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3")
544 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/4")
545 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5")
546 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6")
547 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/7")
548
549 (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10")
550 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/11")
551 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/12")
552 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13")
553 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/14")
554 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15")
555 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16")
556 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/17")
557
558 89/<- %esp 5/r32/ebp
559 5d/pop-to-ebp
560 c3/return
561
562 test-convert-function-with-arg:
563
564 55/push-ebp
565 89/<- %ebp 4/r32/esp
566
567 (clear-stream _test-input-stream)
568 (clear-stream $_test-input-buffered-file->buffer)
569 (clear-stream _test-output-stream)
570 (clear-stream $_test-output-buffered-file->buffer)
571
572 (write _test-input-stream "fn foo n: int {\n")
573 (write _test-input-stream "}\n")
574
575 (convert-mu _test-input-buffered-file _test-output-buffered-file)
576 (flush _test-output-buffered-file)
577 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
583
584 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0")
585 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg/1")
586 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg/2")
587 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3")
588 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg/4")
589 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5")
590 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg/6")
591 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg/7")
592
593 89/<- %esp 5/r32/ebp
594 5d/pop-to-ebp
595 c3/return
596
597 test-convert-function-with-arg-and-body:
598
599 55/push-ebp
600 89/<- %ebp 4/r32/esp
601
602 (clear-stream _test-input-stream)
603 (clear-stream $_test-input-buffered-file->buffer)
604 (clear-stream _test-output-stream)
605 (clear-stream $_test-output-buffered-file->buffer)
606 c7 0/subop/copy *Next-block-index 1/imm32
607
608 (write _test-input-stream "fn foo n: int {\n")
609 (write _test-input-stream " increment n\n")
610 (write _test-input-stream "}\n")
611
612 (convert-mu _test-input-buffered-file _test-output-buffered-file)
613 (flush _test-output-buffered-file)
614 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
620
621 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0")
622 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1")
623 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg-and-body/2")
624 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3")
625 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-arg-and-body/4")
626 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-arg-and-body/5")
627 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/6")
628 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-arg-and-body/7")
629 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-arg-and-body/8")
630 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg-and-body/9")
631 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/10")
632 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/11")
633 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg-and-body/12")
634
635 89/<- %esp 5/r32/ebp
636 5d/pop-to-ebp
637 c3/return
638
639 test-convert-function-distinguishes-args:
640
641 55/push-ebp
642 89/<- %ebp 4/r32/esp
643
644 (clear-stream _test-input-stream)
645 (clear-stream $_test-input-buffered-file->buffer)
646 (clear-stream _test-output-stream)
647 (clear-stream $_test-output-buffered-file->buffer)
648 c7 0/subop/copy *Next-block-index 1/imm32
649
650 (write _test-input-stream "fn foo a: int, b: int {\n")
651 (write _test-input-stream " increment b\n")
652 (write _test-input-stream "}\n")
653
654 (convert-mu _test-input-buffered-file _test-output-buffered-file)
655 (flush _test-output-buffered-file)
656 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
662
663 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0")
664 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-distinguishes-args/1")
665 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-distinguishes-args/2")
666 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3")
667 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-distinguishes-args/4")
668 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-distinguishes-args/5")
669 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/6")
670 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-distinguishes-args/7")
671 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-distinguishes-args/8")
672 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-distinguishes-args/9")
673 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/10")
674 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/11")
675 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-distinguishes-args/12")
676
677 89/<- %esp 5/r32/ebp
678 5d/pop-to-ebp
679 c3/return
680
681 test-convert-function-returns-result:
682
683 55/push-ebp
684 89/<- %ebp 4/r32/esp
685
686 (clear-stream _test-input-stream)
687 (clear-stream $_test-input-buffered-file->buffer)
688 (clear-stream _test-output-stream)
689 (clear-stream $_test-output-buffered-file->buffer)
690 c7 0/subop/copy *Next-block-index 1/imm32
691
692 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
693 (write _test-input-stream " result <- copy a\n")
694 (write _test-input-stream " result <- increment\n")
695 (write _test-input-stream "}\n")
696
697 (convert-mu _test-input-buffered-file _test-output-buffered-file)
698 (flush _test-output-buffered-file)
699 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
705
706 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-returns-result/0")
707 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-returns-result/1")
708 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-returns-result/2")
709 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-returns-result/3")
710 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-returns-result/4")
711 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-returns-result/5")
712 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-returns-result/6")
713 (check-next-stream-line-equal _test-output-stream " 40/increment-eax" "F - test-convert-function-returns-result/7")
714 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-returns-result/8")
715 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-returns-result/9")
716 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-returns-result/10")
717 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-returns-result/11")
718 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-returns-result/12")
719 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-returns-result/13")
720
721 89/<- %esp 5/r32/ebp
722 5d/pop-to-ebp
723 c3/return
724
725 test-convert-function-literal-arg:
726
727 55/push-ebp
728 89/<- %ebp 4/r32/esp
729
730 (clear-stream _test-input-stream)
731 (clear-stream $_test-input-buffered-file->buffer)
732 (clear-stream _test-output-stream)
733 (clear-stream $_test-output-buffered-file->buffer)
734 c7 0/subop/copy *Next-block-index 1/imm32
735
736 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
737 (write _test-input-stream " result <- copy a\n")
738 (write _test-input-stream " result <- add 1\n")
739 (write _test-input-stream "}\n")
740
741 (convert-mu _test-input-buffered-file _test-output-buffered-file)
742 (flush _test-output-buffered-file)
743 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
749
750 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-literal-arg/0")
751 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-literal-arg/1")
752 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-literal-arg/2")
753 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-literal-arg/3")
754 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-literal-arg/4")
755 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-literal-arg/5")
756 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-literal-arg/6")
757 (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-literal-arg/7")
758 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-literal-arg/8")
759 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-literal-arg/9")
760 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-literal-arg/10")
761 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-literal-arg/11")
762 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-literal-arg/12")
763 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-literal-arg/13")
764
765 89/<- %esp 5/r32/ebp
766 5d/pop-to-ebp
767 c3/return
768
769 test-convert-function-literal-arg-2:
770
771 55/push-ebp
772 89/<- %ebp 4/r32/esp
773
774 (clear-stream _test-input-stream)
775 (clear-stream $_test-input-buffered-file->buffer)
776 (clear-stream _test-output-stream)
777 (clear-stream $_test-output-buffered-file->buffer)
778 c7 0/subop/copy *Next-block-index 1/imm32
779
780 (write _test-input-stream "fn foo a: int, b: int -> result/ebx: int {\n")
781 (write _test-input-stream " result <- copy a\n")
782 (write _test-input-stream " result <- add 1\n")
783 (write _test-input-stream "}\n")
784
785 (convert-mu _test-input-buffered-file _test-output-buffered-file)
786 (flush _test-output-buffered-file)
787 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
793
794 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-literal-arg-2/0")
795 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-literal-arg-2/1")
796 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-literal-arg-2/2")
797 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-literal-arg-2/3")
798 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-literal-arg-2/4")
799 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-literal-arg-2/5")
800 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-literal-arg-2/6")
801 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-literal-arg-2/7")
802 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-literal-arg-2/8")
803 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-literal-arg-2/9")
804 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-literal-arg-2/10")
805 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-literal-arg-2/11")
806 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-literal-arg-2/12")
807 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-literal-arg-2/13")
808
809 89/<- %esp 5/r32/ebp
810 5d/pop-to-ebp
811 c3/return
812
813 test-convert-function-call-with-literal-arg:
814
815 55/push-ebp
816 89/<- %ebp 4/r32/esp
817
818 (clear-stream _test-input-stream)
819 (clear-stream $_test-input-buffered-file->buffer)
820 (clear-stream _test-output-stream)
821 (clear-stream $_test-output-buffered-file->buffer)
822 c7 0/subop/copy *Next-block-index 1/imm32
823
824 (write _test-input-stream "fn main -> result/ebx: int {\n")
825 (write _test-input-stream " result <- do-add 3 4\n")
826 (write _test-input-stream "}\n")
827 (write _test-input-stream "fn do-add a: int, b: int -> result/ebx: int {\n")
828 (write _test-input-stream " result <- copy a\n")
829 (write _test-input-stream " result <- add b\n")
830 (write _test-input-stream "}\n")
831
832 (convert-mu _test-input-buffered-file _test-output-buffered-file)
833 (flush _test-output-buffered-file)
834 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
840
841 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0")
842 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1")
843 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2")
844 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3")
845 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4")
846 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-literal-arg/5")
847 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/6")
848 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/7")
849 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-literal-arg/8")
850 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/9")
851 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/10")
852 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/11")
853 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/12")
854 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/13")
855 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/14")
856 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/15")
857 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/16")
858 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/17")
859 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:loop:" "F - test-convert-function-call-with-literal-arg/18")
860 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/19")
861 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/20")
862 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/21")
863 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:break:" "F - test-convert-function-call-with-literal-arg/22")
864 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/23")
865 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/24")
866 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/25")
867 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/26")
868
869 89/<- %esp 5/r32/ebp
870 5d/pop-to-ebp
871 c3/return
872
873 test-convert-function-with-local-var-in-mem:
874
875 55/push-ebp
876 89/<- %ebp 4/r32/esp
877
878 (clear-stream _test-input-stream)
879 (clear-stream $_test-input-buffered-file->buffer)
880 (clear-stream _test-output-stream)
881 (clear-stream $_test-output-buffered-file->buffer)
882 c7 0/subop/copy *Next-block-index 1/imm32
883
884 (write _test-input-stream "fn foo {\n")
885 (write _test-input-stream " var x: int\n")
886 (write _test-input-stream " increment x\n")
887 (write _test-input-stream "}\n")
888
889 (convert-mu _test-input-buffered-file _test-output-buffered-file)
890 (flush _test-output-buffered-file)
891 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
897
898 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0")
899 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1")
900 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2")
901 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3")
902 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4")
903 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem/5")
904 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/6")
905 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/7")
906 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-mem/8")
907 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/9")
908 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem/10")
909 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/11")
910 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/12")
911 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/13")
912 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/14")
913
914 89/<- %esp 5/r32/ebp
915 5d/pop-to-ebp
916 c3/return
917
918 test-convert-function-with-local-var-in-reg:
919
920 55/push-ebp
921 89/<- %ebp 4/r32/esp
922
923 (clear-stream _test-input-stream)
924 (clear-stream $_test-input-buffered-file->buffer)
925 (clear-stream _test-output-stream)
926 (clear-stream $_test-output-buffered-file->buffer)
927 c7 0/subop/copy *Next-block-index 1/imm32
928
929 (write _test-input-stream "fn foo {\n")
930 (write _test-input-stream " var x/ecx: int <- copy 3\n")
931 (write _test-input-stream " x <- increment\n")
932 (write _test-input-stream "}\n")
933
934 (convert-mu _test-input-buffered-file _test-output-buffered-file)
935 (flush _test-output-buffered-file)
936 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
942
943 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0")
944 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1")
945 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2")
946 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3")
947 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4")
948 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-reg/5")
949 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/6")
950 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/7")
951 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/8")
952 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/9")
953 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/10")
954 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-reg/11")
955 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/12")
956 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/13")
957 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/14")
958 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/15")
959
960 89/<- %esp 5/r32/ebp
961 5d/pop-to-ebp
962 c3/return
963
964 test-convert-function-with-local-var-dereferenced:
965
966 55/push-ebp
967 89/<- %ebp 4/r32/esp
968
969 (clear-stream _test-input-stream)
970 (clear-stream $_test-input-buffered-file->buffer)
971 (clear-stream _test-output-stream)
972 (clear-stream $_test-output-buffered-file->buffer)
973 c7 0/subop/copy *Next-block-index 1/imm32
974
975 (write _test-input-stream "fn foo {\n")
976 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n")
977 (write _test-input-stream " increment *x\n")
978 (write _test-input-stream "}\n")
979
980 (convert-mu _test-input-buffered-file _test-output-buffered-file)
981 (flush _test-output-buffered-file)
982 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
988
989 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0")
990 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1")
991 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2")
992 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3")
993 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4")
994 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5")
995 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6")
996 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7")
997 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8")
998 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9")
999 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10")
1000 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11")
1001 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12")
1002 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13")
1003 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14")
1004 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15")
1005
1006 89/<- %esp 5/r32/ebp
1007 5d/pop-to-ebp
1008 c3/return
1009
1010 test-convert-compare-register-with-literal:
1011
1012 55/push-ebp
1013 89/<- %ebp 4/r32/esp
1014
1015 (clear-stream _test-input-stream)
1016 (clear-stream $_test-input-buffered-file->buffer)
1017 (clear-stream _test-output-stream)
1018 (clear-stream $_test-output-buffered-file->buffer)
1019 c7 0/subop/copy *Next-block-index 1/imm32
1020
1021 (write _test-input-stream "fn foo {\n")
1022 (write _test-input-stream " var x/ecx: int <- copy 0\n")
1023 (write _test-input-stream " compare x, 0\n")
1024 (write _test-input-stream "}\n")
1025
1026 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1027 (flush _test-output-buffered-file)
1028 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1034
1035 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0")
1036 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1")
1037 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2")
1038 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3")
1039 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4")
1040 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5")
1041 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6")
1042 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7")
1043 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8")
1044 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9")
1045 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10")
1046 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11")
1047 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12")
1048 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13")
1049 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14")
1050 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15")
1051
1052 89/<- %esp 5/r32/ebp
1053 5d/pop-to-ebp
1054 c3/return
1055
1056 test-convert-function-with-local-var-in-block:
1057
1058 55/push-ebp
1059 89/<- %ebp 4/r32/esp
1060
1061 (clear-stream _test-input-stream)
1062 (clear-stream $_test-input-buffered-file->buffer)
1063 (clear-stream _test-output-stream)
1064 (clear-stream $_test-output-buffered-file->buffer)
1065 c7 0/subop/copy *Next-block-index 1/imm32
1066
1067 (write _test-input-stream "fn foo {\n")
1068 (write _test-input-stream " {\n")
1069 (write _test-input-stream " var x: int\n")
1070 (write _test-input-stream " increment x\n")
1071 (write _test-input-stream " }\n")
1072 (write _test-input-stream "}\n")
1073
1074 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1075 (flush _test-output-buffered-file)
1076 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1082
1083 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0")
1084 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1")
1085 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2")
1086 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3")
1087 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4")
1088 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5")
1089 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6")
1090 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7")
1091 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8")
1092 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9")
1093 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-block/10")
1094 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11")
1095 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12")
1096 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13")
1097 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14")
1098 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15")
1099 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16")
1100 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17")
1101 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18")
1102
1103 89/<- %esp 5/r32/ebp
1104 5d/pop-to-ebp
1105 c3/return
1106
1107 test-convert-function-with-local-var-in-named-block:
1108
1109 55/push-ebp
1110 89/<- %ebp 4/r32/esp
1111
1112 (clear-stream _test-input-stream)
1113 (clear-stream $_test-input-buffered-file->buffer)
1114 (clear-stream _test-output-stream)
1115 (clear-stream $_test-output-buffered-file->buffer)
1116 c7 0/subop/copy *Next-block-index 1/imm32
1117
1118 (write _test-input-stream "fn foo {\n")
1119 (write _test-input-stream " $bar: {\n")
1120 (write _test-input-stream " var x: int\n")
1121 (write _test-input-stream " increment x\n")
1122 (write _test-input-stream " }\n")
1123 (write _test-input-stream "}\n")
1124
1125 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1126 (flush _test-output-buffered-file)
1127 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1133
1134 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0")
1135 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1")
1136 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2")
1137 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3")
1138 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4")
1139 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5")
1140 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6")
1141 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7")
1142 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8")
1143 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-named-block/9")
1144 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-named-block/10")
1145 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11")
1146 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12")
1147 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13")
1148 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14")
1149 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15")
1150 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16")
1151 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17")
1152 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18")
1153
1154 89/<- %esp 5/r32/ebp
1155 5d/pop-to-ebp
1156 c3/return
1157
1158 test-convert-function-with-branches-in-block:
1159
1160 55/push-ebp
1161 89/<- %ebp 4/r32/esp
1162
1163 (clear-stream _test-input-stream)
1164 (clear-stream $_test-input-buffered-file->buffer)
1165 (clear-stream _test-output-stream)
1166 (clear-stream $_test-output-buffered-file->buffer)
1167 c7 0/subop/copy *Next-block-index 1/imm32
1168
1169 (write _test-input-stream "fn foo x: int {\n")
1170 (write _test-input-stream " {\n")
1171 (write _test-input-stream " break-if->=\n")
1172 (write _test-input-stream " loop-if-addr<\n")
1173 (write _test-input-stream " increment x\n")
1174 (write _test-input-stream " loop\n")
1175 (write _test-input-stream " }\n")
1176 (write _test-input-stream "}\n")
1177
1178 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1179 (flush _test-output-buffered-file)
1180 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1186
1187 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0")
1188 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1")
1189 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2")
1190 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3")
1191 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4")
1192 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5")
1193 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6")
1194 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7")
1195 (check-next-stream-line-equal _test-output-stream " 0f 8d/jump-if->= break/disp32" "F - test-convert-function-with-branches-in-block/8")
1196 (check-next-stream-line-equal _test-output-stream " 0f 82/jump-if-addr< loop/disp32" "F - test-convert-function-with-branches-in-block/9")
1197 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/10")
1198 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/11")
1199 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/12")
1200 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/13")
1201 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/14")
1202 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/15")
1203 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/16")
1204 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/17")
1205 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/18")
1206 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/19")
1207
1208 89/<- %esp 5/r32/ebp
1209 5d/pop-to-ebp
1210 c3/return
1211
1212 test-convert-function-with-branches-in-named-block:
1213
1214 55/push-ebp
1215 89/<- %ebp 4/r32/esp
1216
1217 (clear-stream _test-input-stream)
1218 (clear-stream $_test-input-buffered-file->buffer)
1219 (clear-stream _test-output-stream)
1220 (clear-stream $_test-output-buffered-file->buffer)
1221 c7 0/subop/copy *Next-block-index 1/imm32
1222
1223 (write _test-input-stream "fn foo x: int {\n")
1224 (write _test-input-stream " $bar: {\n")
1225 (write _test-input-stream " break-if->= $bar\n")
1226 (write _test-input-stream " loop-if-addr< $bar\n")
1227 (write _test-input-stream " increment x\n")
1228 (write _test-input-stream " loop\n")
1229 (write _test-input-stream " }\n")
1230 (write _test-input-stream "}\n")
1231
1232 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1233 (flush _test-output-buffered-file)
1234 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1240
1241 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0")
1242 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1")
1243 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2")
1244 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3")
1245 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4")
1246 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5")
1247 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6")
1248 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7")
1249 (check-next-stream-line-equal _test-output-stream " 0f 8d/jump-if->= $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/8")
1250 (check-next-stream-line-equal _test-output-stream " 0f 82/jump-if-addr< $bar:loop/disp32" "F - test-convert-function-with-branches-in-named-block/9")
1251 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/10")
1252 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/11")
1253 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/12")
1254 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/13")
1255 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/14")
1256 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/15")
1257 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/16")
1258 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/17")
1259 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/18")
1260 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/19")
1261
1262 89/<- %esp 5/r32/ebp
1263 5d/pop-to-ebp
1264 c3/return
1265
1266 test-convert-function-with-var-in-nested-block:
1267
1268 55/push-ebp
1269 89/<- %ebp 4/r32/esp
1270
1271 (clear-stream _test-input-stream)
1272 (clear-stream $_test-input-buffered-file->buffer)
1273 (clear-stream _test-output-stream)
1274 (clear-stream $_test-output-buffered-file->buffer)
1275 c7 0/subop/copy *Next-block-index 1/imm32
1276
1277 (write _test-input-stream "fn foo x: int {\n")
1278 (write _test-input-stream " {\n")
1279 (write _test-input-stream " {\n")
1280 (write _test-input-stream " var x: int\n")
1281 (write _test-input-stream " increment x\n")
1282 (write _test-input-stream " }\n")
1283 (write _test-input-stream " }\n")
1284 (write _test-input-stream "}\n")
1285
1286 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1287 (flush _test-output-buffered-file)
1288 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1294
1295 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0")
1296 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1")
1297 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2")
1298 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3")
1299 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4")
1300 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5")
1301 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6")
1302 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7")
1303 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8")
1304 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9")
1305 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10")
1306 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11")
1307 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-var-in-nested-block/12")
1308 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13")
1309 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14")
1310 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15")
1311 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16")
1312 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17")
1313 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18")
1314 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19")
1315 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20")
1316 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21")
1317 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22")
1318
1319 89/<- %esp 5/r32/ebp
1320 5d/pop-to-ebp
1321 c3/return
1322
1323 test-convert-function-with-multiple-vars-in-nested-blocks:
1324
1325 55/push-ebp
1326 89/<- %ebp 4/r32/esp
1327
1328 (clear-stream _test-input-stream)
1329 (clear-stream $_test-input-buffered-file->buffer)
1330 (clear-stream _test-output-stream)
1331 (clear-stream $_test-output-buffered-file->buffer)
1332 c7 0/subop/copy *Next-block-index 1/imm32
1333
1334 (write _test-input-stream "fn foo x: int {\n")
1335 (write _test-input-stream " {\n")
1336 (write _test-input-stream " var x/eax: int <- copy 0\n")
1337 (write _test-input-stream " {\n")
1338 (write _test-input-stream " var y: int\n")
1339 (write _test-input-stream " x <- add y\n")
1340 (write _test-input-stream " }\n")
1341 (write _test-input-stream " }\n")
1342 (write _test-input-stream "}\n")
1343
1344 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1345 (flush _test-output-buffered-file)
1346 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1352
1353 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0")
1354 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1")
1355 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2")
1356 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3")
1357 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4")
1358 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5")
1359 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6")
1360 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7")
1361 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8")
1362 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/9")
1363 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10")
1364 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11")
1365 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12")
1366 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/13")
1367 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/14")
1368 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15")
1369 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16")
1370 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17")
1371 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18")
1372 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19")
1373 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20")
1374 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21")
1375 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22")
1376 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23")
1377 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24")
1378 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25")
1379
1380 89/<- %esp 5/r32/ebp
1381 5d/pop-to-ebp
1382 c3/return
1383
1384 test-convert-function-with-branches-and-local-vars:
1385
1386
1387
1388
1389 55/push-ebp
1390 89/<- %ebp 4/r32/esp
1391
1392 (clear-stream _test-input-stream)
1393 (clear-stream $_test-input-buffered-file->buffer)
1394 (clear-stream _test-output-stream)
1395 (clear-stream $_test-output-buffered-file->buffer)
1396 c7 0/subop/copy *Next-block-index 1/imm32
1397
1398 (write _test-input-stream "fn foo {\n")
1399 (write _test-input-stream " {\n")
1400 (write _test-input-stream " var x: int\n")
1401 (write _test-input-stream " break-if->=\n")
1402 (write _test-input-stream " increment x\n")
1403 (write _test-input-stream " }\n")
1404 (write _test-input-stream "}\n")
1405
1406 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1407 (flush _test-output-buffered-file)
1408 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1414
1415 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0")
1416 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1")
1417 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2")
1418 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3")
1419 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4")
1420 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5")
1421 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6")
1422 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7")
1423 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8")
1424 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9")
1425 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10")
1426 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-local-vars/11")
1427 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12")
1428 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13")
1429 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14")
1430 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-local-vars/15")
1431 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16")
1432 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17")
1433 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18")
1434 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19")
1435 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20")
1436 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21")
1437 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22")
1438 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23")
1439
1440 89/<- %esp 5/r32/ebp
1441 5d/pop-to-ebp
1442 c3/return
1443
1444 test-convert-function-with-conditional-loops-and-local-vars:
1445
1446
1447
1448
1449 55/push-ebp
1450 89/<- %ebp 4/r32/esp
1451
1452 (clear-stream _test-input-stream)
1453 (clear-stream $_test-input-buffered-file->buffer)
1454 (clear-stream _test-output-stream)
1455 (clear-stream $_test-output-buffered-file->buffer)
1456 c7 0/subop/copy *Next-block-index 1/imm32
1457
1458 (write _test-input-stream "fn foo {\n")
1459 (write _test-input-stream " {\n")
1460 (write _test-input-stream " var x: int\n")
1461 (write _test-input-stream " loop-if->=\n")
1462 (write _test-input-stream " increment x\n")
1463 (write _test-input-stream " }\n")
1464 (write _test-input-stream "}\n")
1465
1466 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1467 (flush _test-output-buffered-file)
1468 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1474
1475 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0")
1476 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1")
1477 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2")
1478 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3")
1479 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4")
1480 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5")
1481 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6")
1482 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7")
1483 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8")
1484 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9")
1485 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-conditional-loops-and-local-vars/10")
1486 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/11")
1487 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-conditional-loops-and-local-vars/12")
1488 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13")
1489 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-conditional-loops-and-local-vars/14")
1490 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/15")
1491 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16")
1492 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17")
1493 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18")
1494 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19")
1495 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20")
1496 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21")
1497 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22")
1498 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23")
1499
1500 89/<- %esp 5/r32/ebp
1501 5d/pop-to-ebp
1502 c3/return
1503
1504 test-convert-function-with-unconditional-loops-and-local-vars:
1505
1506
1507
1508
1509 55/push-ebp
1510 89/<- %ebp 4/r32/esp
1511
1512 (clear-stream _test-input-stream)
1513 (clear-stream $_test-input-buffered-file->buffer)
1514 (clear-stream _test-output-stream)
1515 (clear-stream $_test-output-buffered-file->buffer)
1516 c7 0/subop/copy *Next-block-index 1/imm32
1517
1518 (write _test-input-stream "fn foo {\n")
1519 (write _test-input-stream " {\n")
1520 (write _test-input-stream " var x: int\n")
1521 (write _test-input-stream " loop\n")
1522 (write _test-input-stream " increment x\n")
1523 (write _test-input-stream " }\n")
1524 (write _test-input-stream "}\n")
1525
1526 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1527 (flush _test-output-buffered-file)
1528 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1534
1535 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0")
1536 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1")
1537 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2")
1538 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3")
1539 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4")
1540 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5")
1541 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6")
1542 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7")
1543 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8")
1544 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/9")
1545 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10")
1546
1547 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11")
1548 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12")
1549 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13")
1550 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14")
1551 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15")
1552 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16")
1553 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17")
1554 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18")
1555
1556 89/<- %esp 5/r32/ebp
1557 5d/pop-to-ebp
1558 c3/return
1559
1560 test-convert-function-with-branches-and-loops-and-local-vars:
1561
1562 55/push-ebp
1563 89/<- %ebp 4/r32/esp
1564
1565 (clear-stream _test-input-stream)
1566 (clear-stream $_test-input-buffered-file->buffer)
1567 (clear-stream _test-output-stream)
1568 (clear-stream $_test-output-buffered-file->buffer)
1569 c7 0/subop/copy *Next-block-index 1/imm32
1570
1571 (write _test-input-stream "fn foo {\n")
1572 (write _test-input-stream " {\n")
1573 (write _test-input-stream " var x: int\n")
1574 (write _test-input-stream " break-if->=\n")
1575 (write _test-input-stream " increment x\n")
1576 (write _test-input-stream " loop\n")
1577 (write _test-input-stream " }\n")
1578 (write _test-input-stream "}\n")
1579
1580 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1581 (flush _test-output-buffered-file)
1582 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1588
1589 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0")
1590 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1")
1591 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2")
1592 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-loops-and-local-vars/3")
1593 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4")
1594 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5")
1595 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6")
1596 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7")
1597 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8")
1598 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9")
1599 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/10")
1600 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/11")
1601 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/12")
1602 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13")
1603 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-loops-and-local-vars/14")
1604 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/15")
1605 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16")
1606 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17")
1607 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18")
1608 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19")
1609 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20")
1610 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21")
1611 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/22")
1612 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23")
1613 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24")
1614
1615 89/<- %esp 5/r32/ebp
1616 5d/pop-to-ebp
1617 c3/return
1618
1619 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars:
1620
1621 55/push-ebp
1622 89/<- %ebp 4/r32/esp
1623
1624 (clear-stream _test-input-stream)
1625 (clear-stream $_test-input-buffered-file->buffer)
1626 (clear-stream _test-output-stream)
1627 (clear-stream $_test-output-buffered-file->buffer)
1628 c7 0/subop/copy *Next-block-index 1/imm32
1629
1630 (write _test-input-stream "fn foo {\n")
1631 (write _test-input-stream " a: {\n")
1632 (write _test-input-stream " var x: int\n")
1633 (write _test-input-stream " {\n")
1634 (write _test-input-stream " var y: int\n")
1635 (write _test-input-stream " break-if->= a\n")
1636 (write _test-input-stream " increment x\n")
1637 (write _test-input-stream " loop\n")
1638 (write _test-input-stream " }\n")
1639 (write _test-input-stream " }\n")
1640 (write _test-input-stream "}\n")
1641
1642 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1643 (flush _test-output-buffered-file)
1644 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1650
1651 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0")
1652 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1")
1653 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2")
1654 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/3")
1655 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4")
1656 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5")
1657 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6")
1658 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7")
1659 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/8")
1660 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9")
1661 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10")
1662 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/11")
1663 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12")
1664 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/13")
1665 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/14")
1666 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/15")
1667 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/16")
1668 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17")
1669 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/18")
1670 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/19")
1671 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/20")
1672 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21")
1673 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22")
1674 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/23")
1675 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24")
1676 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25")
1677 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26")
1678 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27")
1679 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28")
1680 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/29")
1681 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/30")
1682 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31")
1683
1684 89/<- %esp 5/r32/ebp
1685 5d/pop-to-ebp
1686 c3/return
1687
1688 test-convert-function-with-nonlocal-unconditional-break-and-local-vars:
1689
1690 55/push-ebp
1691 89/<- %ebp 4/r32/esp
1692
1693 (clear-stream _test-input-stream)
1694 (clear-stream $_test-input-buffered-file->buffer)
1695 (clear-stream _test-output-stream)
1696 (clear-stream $_test-output-buffered-file->buffer)
1697 c7 0/subop/copy *Next-block-index 1/imm32
1698
1699 (write _test-input-stream "fn foo {\n")
1700 (write _test-input-stream " a: {\n")
1701 (write _test-input-stream " var x: int\n")
1702 (write _test-input-stream " {\n")
1703 (write _test-input-stream " var y: int\n")
1704 (write _test-input-stream " break a\n")
1705 (write _test-input-stream " increment x\n")
1706 (write _test-input-stream " }\n")
1707 (write _test-input-stream " }\n")
1708 (write _test-input-stream "}\n")
1709
1710 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1711 (flush _test-output-buffered-file)
1712 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1718
1719 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0")
1720 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1")
1721 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2")
1722 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/3")
1723 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4")
1724 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5")
1725 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6")
1726 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7")
1727 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8")
1728 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9")
1729 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10")
1730 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11")
1731 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/12")
1732 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/13")
1733 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/14")
1734 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15")
1735 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16")
1736 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/17")
1737 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18")
1738 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19")
1739 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20")
1740 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21")
1741 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22")
1742 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/23")
1743 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24")
1744 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25")
1745
1746 89/<- %esp 5/r32/ebp
1747 5d/pop-to-ebp
1748 c3/return
1749
1750 test-convert-function-with-unconditional-break-and-local-vars:
1751
1752 55/push-ebp
1753 89/<- %ebp 4/r32/esp
1754
1755 (clear-stream _test-input-stream)
1756 (clear-stream $_test-input-buffered-file->buffer)
1757 (clear-stream _test-output-stream)
1758 (clear-stream $_test-output-buffered-file->buffer)
1759 c7 0/subop/copy *Next-block-index 1/imm32
1760
1761 (write _test-input-stream "fn foo {\n")
1762 (write _test-input-stream " {\n")
1763 (write _test-input-stream " var x: int\n")
1764 (write _test-input-stream " {\n")
1765 (write _test-input-stream " var y: int\n")
1766 (write _test-input-stream " break\n")
1767 (write _test-input-stream " increment x\n")
1768 (write _test-input-stream " }\n")
1769 (write _test-input-stream " }\n")
1770 (write _test-input-stream "}\n")
1771
1772 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1773 (flush _test-output-buffered-file)
1774 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1780
1781 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0")
1782 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1")
1783 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2")
1784 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3")
1785 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4")
1786 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5")
1787 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6")
1788 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7")
1789 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8")
1790 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9")
1791 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10")
1792 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11")
1793 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/12")
1794 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13")
1795 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14")
1796 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/15")
1797 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16")
1798 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17")
1799 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18")
1800 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19")
1801 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20")
1802 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21")
1803 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22")
1804 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23")
1805
1806 89/<- %esp 5/r32/ebp
1807 5d/pop-to-ebp
1808 c3/return
1809
1810 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars:
1811
1812 55/push-ebp
1813 89/<- %ebp 4/r32/esp
1814
1815 (clear-stream _test-input-stream)
1816 (clear-stream $_test-input-buffered-file->buffer)
1817 (clear-stream _test-output-stream)
1818 (clear-stream $_test-output-buffered-file->buffer)
1819 c7 0/subop/copy *Next-block-index 1/imm32
1820
1821 (write _test-input-stream "fn foo {\n")
1822 (write _test-input-stream " a: {\n")
1823 (write _test-input-stream " var x: int\n")
1824 (write _test-input-stream " {\n")
1825 (write _test-input-stream " var y: int\n")
1826 (write _test-input-stream " loop a\n")
1827 (write _test-input-stream " increment x\n")
1828 (write _test-input-stream " }\n")
1829 (write _test-input-stream " }\n")
1830 (write _test-input-stream "}\n")
1831
1832 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1833 (flush _test-output-buffered-file)
1834 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1840
1841 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0")
1842 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1")
1843 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2")
1844 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/3")
1845 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4")
1846 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5")
1847 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6")
1848 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7")
1849 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8")
1850 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9")
1851 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10")
1852 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11")
1853 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/12")
1854 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/13")
1855 (check-next-stream-line-equal _test-output-stream " e9/jump a:loop/disp32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/14")
1856 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15")
1857 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16")
1858 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/17")
1859 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18")
1860 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19")
1861 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20")
1862 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21")
1863 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22")
1864 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/23")
1865 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24")
1866 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25")
1867
1868 89/<- %esp 5/r32/ebp
1869 5d/pop-to-ebp
1870 c3/return
1871
1872 test-convert-length-of-array:
1873
1874 55/push-ebp
1875 89/<- %ebp 4/r32/esp
1876
1877 (clear-stream _test-input-stream)
1878 (clear-stream $_test-input-buffered-file->buffer)
1879 (clear-stream _test-output-stream)
1880 (clear-stream $_test-output-buffered-file->buffer)
1881 c7 0/subop/copy *Next-block-index 1/imm32
1882
1883 (write _test-input-stream "fn foo a: (addr array int) {\n")
1884 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n")
1885 (write _test-input-stream " var c/eax: int <- length b\n")
1886 (write _test-input-stream "}\n")
1887
1888 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1889 (flush _test-output-buffered-file)
1890 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1896
1897 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0")
1898 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1")
1899 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2")
1900 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3")
1901 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4")
1902 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5")
1903 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6")
1904 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7")
1905 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/8")
1906 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *eax 0x00000000/r32" "F - test-convert-length-of-array/9")
1907 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/10")
1908 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/11")
1909 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/12")
1910 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/13")
1911 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/14")
1912 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/15")
1913 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/16")
1914 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/17")
1915
1916 89/<- %esp 5/r32/ebp
1917 5d/pop-to-ebp
1918 c3/return
1919
1920 test-convert-index-into-array:
1921
1922 55/push-ebp
1923 89/<- %ebp 4/r32/esp
1924
1925 (clear-stream _test-input-stream)
1926 (clear-stream $_test-input-buffered-file->buffer)
1927 (clear-stream _test-output-stream)
1928 (clear-stream $_test-output-buffered-file->buffer)
1929 c7 0/subop/copy *Next-block-index 1/imm32
1930
1931 (write _test-input-stream "fn foo {\n")
1932 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
1933 (write _test-input-stream " var idx/ecx: int <- copy 3\n")
1934 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n")
1935 (write _test-input-stream "}\n")
1936
1937 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1938 (flush _test-output-buffered-file)
1939 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1945
1946 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0")
1947 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1")
1948 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2")
1949 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3")
1950 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4")
1951 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5")
1952 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6")
1953 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7")
1954 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8")
1955 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9")
1956 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/10")
1957 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<2 + 4) 0x00000000/r32" "F - test-convert-index-into-array/11")
1958 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/12")
1959 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/13")
1960 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/14")
1961 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/15")
1962 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/16")
1963 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/17")
1964 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/18")
1965 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/19")
1966 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/20")
1967
1968 89/<- %esp 5/r32/ebp
1969 5d/pop-to-ebp
1970 c3/return
1971
1972 test-convert-function-and-type-definition:
1973
1974 55/push-ebp
1975 89/<- %ebp 4/r32/esp
1976
1977 (clear-stream _test-input-stream)
1978 (clear-stream $_test-input-buffered-file->buffer)
1979 (clear-stream _test-output-stream)
1980 (clear-stream $_test-output-buffered-file->buffer)
1981 c7 0/subop/copy *Next-block-index 1/imm32
1982
1983 (write _test-input-stream "fn foo a: (addr t) {\n")
1984 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n")
1985 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n")
1986 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n")
1987 (write _test-input-stream "}\n")
1988 (write _test-input-stream "type t {\n")
1989 (write _test-input-stream " x: int\n")
1990 (write _test-input-stream " y: int\n")
1991 (write _test-input-stream "}\n")
1992
1993 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1994 (flush _test-output-buffered-file)
1995 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2001
2002 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0")
2003 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1")
2004 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2")
2005 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3")
2006 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4")
2007 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5")
2008 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6")
2009 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7")
2010 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8")
2011 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9")
2012 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/10")
2013 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11")
2014 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/12")
2015 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13")
2016 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14")
2017 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15")
2018 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16")
2019 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17")
2020 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18")
2021 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19")
2022 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20")
2023
2024 89/<- %esp 5/r32/ebp
2025 5d/pop-to-ebp
2026 c3/return
2027
2028 test-convert-function-with-local-var-with-user-defined-type:
2029
2030 55/push-ebp
2031 89/<- %ebp 4/r32/esp
2032
2033 (clear-stream _test-input-stream)
2034 (clear-stream $_test-input-buffered-file->buffer)
2035 (clear-stream _test-output-stream)
2036 (clear-stream $_test-output-buffered-file->buffer)
2037 c7 0/subop/copy *Next-block-index 1/imm32
2038
2039 (write _test-input-stream "fn foo {\n")
2040 (write _test-input-stream " var a: t\n")
2041 (write _test-input-stream "}\n")
2042 (write _test-input-stream "type t {\n")
2043 (write _test-input-stream " x: int\n")
2044 (write _test-input-stream " y: int\n")
2045 (write _test-input-stream "}\n")
2046
2047 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2048 (flush _test-output-buffered-file)
2049 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2055
2056 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0")
2057 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1")
2058 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2")
2059 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-with-user-defined-type/3")
2060 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4")
2061 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5")
2062 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6")
2063 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7")
2064 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/8")
2065 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9")
2066 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10")
2067 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11")
2068 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-with-user-defined-type/12")
2069 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13")
2070 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14")
2071
2072 89/<- %esp 5/r32/ebp
2073 5d/pop-to-ebp
2074 c3/return
2075
2076
2077
2078
2079
2080 parse-mu:
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113 55/push-ebp
2114 89/<- %ebp 4/r32/esp
2115
2116 50/push-eax
2117 51/push-ecx
2118 52/push-edx
2119 53/push-ebx
2120 56/push-esi
2121 57/push-edi
2122
2123 81 5/subop/subtract %esp 0x200/imm32
2124 68/push 0x200/imm32/length
2125 68/push 0/imm32/read
2126 68/push 0/imm32/write
2127 89/<- %ecx 4/r32/esp
2128
2129 68/push 0/imm32/end
2130 68/push 0/imm32/start
2131 89/<- %edx 4/r32/esp
2132
2133 bf/copy-to-edi _Program-functions/imm32
2134
2135 be/copy-to-esi _Program-types/imm32
2136
2137 81 5/subop/subtract %esp 0x400/imm32
2138 68/push 0x400/imm32/length
2139 68/push 0/imm32/top
2140 89/<- %ebx 4/r32/esp
2141 {
2142 $parse-mu:line-loop:
2143 (clear-stream %ecx)
2144 (read-line-buffered *(ebp+8) %ecx)
2145
2146 81 7/subop/compare *ecx 0/imm32
2147 0f 84/jump-if-= break/disp32
2148 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------
2154 (next-mu-token %ecx %edx)
2155
2156 (slice-empty? %edx)
2157 3d/compare-eax-and 0/imm32/false
2158 0f 85/jump-if-!= loop/disp32
2159
2160
2161 8b/-> *edx 0/r32/eax
2162 8a/copy-byte *eax 0/r32/AL
2163 81 4/subop/and %eax 0xff/imm32
2164
2165 3d/compare-eax-and 0x23/imm32/hash
2166 0f 84/jump-if-= loop/disp32
2167
2168 {
2169 $parse-mu:fn:
2170 (slice-equal? %edx "fn")
2171 3d/compare-eax-and 0/imm32/false
2172 0f 84/jump-if-= break/disp32
2173
2174 (allocate Heap *Function-size)
2175 (zero-out %eax *Function-size)
2176 (clear-stack %ebx)
2177 (populate-mu-function-header %ecx %eax %ebx)
2178 (populate-mu-function-body *(ebp+8) %eax %ebx)
2179
2180 89/<- *edi 0/r32/eax
2181
2182 8d/address-> *(eax+0x14) 7/r32/edi
2183 e9/jump $parse-mu:line-loop/disp32
2184 }
2185
2186 {
2187 $parse-mu:type:
2188 (slice-equal? %edx "type")
2189 3d/compare-eax-and 0/imm32
2190 0f 84/jump-if-= break/disp32
2191 (next-mu-token %ecx %edx)
2192
2193 (pos-or-insert-slice Type-id %edx)
2194
2195 (find-or-create-typeinfo %eax)
2196
2197 (populate-mu-type *(ebp+8) %eax)
2198 e9/jump $parse-mu:line-loop/disp32
2199 }
2200
2201 e9/jump $parse-mu:error1/disp32
2202 }
2203 $parse-mu:end:
2204
2205 81 0/subop/add %esp 0x630/imm32
2206
2207 5f/pop-to-edi
2208 5e/pop-to-esi
2209 5b/pop-to-ebx
2210 5a/pop-to-edx
2211 59/pop-to-ecx
2212 58/pop-to-eax
2213
2214 89/<- %esp 5/r32/ebp
2215 5d/pop-to-ebp
2216 c3/return
2217
2218 $parse-mu:error1:
2219
2220 (write-buffered Stderr "unexpected top-level command: ")
2221 (write-slice-buffered Stderr %edx)
2222 (write-buffered Stderr "\n")
2223 (flush Stderr)
2224
2225 bb/copy-to-ebx 1/imm32
2226 b8/copy-to-eax 1/imm32/exit
2227 cd/syscall 0x80/imm8
2228
2229
2230 $parse-mu:error2:
2231
2232 (print-int32-buffered Stderr *ebx)
2233 (write-buffered Stderr " vars not reclaimed after fn '")
2234 (write-slice-buffered Stderr *eax)
2235 (write-buffered Stderr "'\n")
2236 (flush Stderr)
2237
2238 bb/copy-to-ebx 1/imm32
2239 b8/copy-to-eax 1/imm32/exit
2240 cd/syscall 0x80/imm8
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254 populate-mu-function-header:
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286 55/push-ebp
2287 89/<- %ebp 4/r32/esp
2288
2289 50/push-eax
2290 51/push-ecx
2291 52/push-edx
2292 53/push-ebx
2293 57/push-edi
2294
2295 8b/-> *(ebp+0xc) 7/r32/edi
2296
2297 68/push 0/imm32/end
2298 68/push 0/imm32/start
2299 89/<- %ecx 4/r32/esp
2300
2301 ba/copy-to-edx 8/imm32
2302
2303 (next-mu-token *(ebp+8) %ecx)
2304
2305
2306
2307 (slice-equal? %ecx "{")
2308 3d/compare-eax-and 0/imm32/false
2309 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2310
2311 (slice-equal? %ecx "->")
2312 3d/compare-eax-and 0/imm32/false
2313 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2314
2315 (slice-equal? %ecx "}")
2316 3d/compare-eax-and 0/imm32/false
2317 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2318
2319 (slice-to-string Heap %ecx)
2320 89/<- *edi 0/r32/eax
2321
2322 89/<- *(edi+4) 0/r32/eax
2323
2324 {
2325 $populate-mu-function-header:check-for-inout:
2326 (next-mu-token *(ebp+8) %ecx)
2327
2328 (slice-equal? %ecx "{")
2329 3d/compare-eax-and 0/imm32/false
2330 0f 85/jump-if-!= $populate-mu-function-header:done/disp32
2331
2332 (slice-equal? %ecx "->")
2333 3d/compare-eax-and 0/imm32/false
2334 0f 85/jump-if-!= break/disp32
2335
2336 (slice-equal? %ecx "}")
2337 3d/compare-eax-and 0/imm32/false
2338 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2339
2340 (parse-var-with-type %ecx *(ebp+8))
2341 89/<- %ebx 0/r32/eax
2342
2343 81 7/subop/compare *(ebx+0x10) 0/imm32
2344 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32
2345
2346 89/<- *(ebx+0xc) 2/r32/edx
2347
2348 (size-of %ebx)
2349 01/add %edx 0/r32/eax
2350
2351
2352
2353 (append-list Heap %ebx *(edi+8))
2354 89/<- *(edi+8) 0/r32/eax
2355
2356 (push *(ebp+0x10) %ebx)
2357
2358 e9/jump loop/disp32
2359 }
2360
2361 {
2362 $populate-mu-function-header:check-for-out:
2363 (next-mu-token *(ebp+8) %ecx)
2364
2365 (slice-equal? %ecx "{")
2366 3d/compare-eax-and 0/imm32/false
2367 0f 85/jump-if-!= break/disp32
2368
2369 (slice-equal? %ecx "->")
2370 3d/compare-eax-and 0/imm32/false
2371 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2372
2373 (slice-equal? %ecx "}")
2374 3d/compare-eax-and 0/imm32/false
2375 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2376
2377 (parse-var-with-type %ecx *(ebp+8))
2378 89/<- %ebx 0/r32/eax
2379
2380 81 7/subop/compare *(ebx+0x10) 0/imm32
2381 0f 84/jump-if-= $populate-mu-function-header:error3/disp32
2382 (append-list Heap %ebx *(edi+0xc))
2383 89/<- *(edi+0xc) 0/r32/eax
2384 e9/jump loop/disp32
2385 }
2386 $populate-mu-function-header:done:
2387 (check-no-tokens-left *(ebp+8))
2388 $populate-mu-function-header:end:
2389
2390 81 0/subop/add %esp 8/imm32
2391
2392 5f/pop-to-edi
2393 5b/pop-to-ebx
2394 5a/pop-to-edx
2395 59/pop-to-ecx
2396 58/pop-to-eax
2397
2398 89/<- %esp 5/r32/ebp
2399 5d/pop-to-ebp
2400 c3/return
2401
2402 $populate-mu-function-header:error1:
2403
2404 (write-buffered Stderr "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '")
2405 (flush Stderr)
2406 (rewind-stream *(ebp+8))
2407 (write-stream 2 *(ebp+8))
2408 (write-buffered Stderr "'\n")
2409 (flush Stderr)
2410
2411 bb/copy-to-ebx 1/imm32
2412 b8/copy-to-eax 1/imm32/exit
2413 cd/syscall 0x80/imm8
2414
2415
2416 $populate-mu-function-header:error2:
2417
2418 (write-buffered Stderr "function input '")
2419 (write-buffered Stderr *ebx)
2420 (write-buffered Stderr "' cannot be in a register")
2421 (flush Stderr)
2422
2423 bb/copy-to-ebx 1/imm32
2424 b8/copy-to-eax 1/imm32/exit
2425 cd/syscall 0x80/imm8
2426
2427
2428 $populate-mu-function-header:error3:
2429
2430 (write-buffered Stderr "function input '")
2431 (write-buffered Stderr *eax)
2432 (write-buffered Stderr " must be in a register'")
2433 (flush Stderr)
2434 (rewind-stream *(ebp+8))
2435 (write-stream 2 *(ebp+8))
2436 (write-buffered Stderr "'\n")
2437 (flush Stderr)
2438
2439 bb/copy-to-ebx 1/imm32
2440 b8/copy-to-eax 1/imm32/exit
2441 cd/syscall 0x80/imm8
2442
2443
2444 test-function-header-with-arg:
2445
2446 55/push-ebp
2447 89/<- %ebp 4/r32/esp
2448
2449 (clear-stream _test-input-stream)
2450 (write _test-input-stream "foo n: int {\n")
2451
2452 2b/subtract-> *Function-size 4/r32/esp
2453 89/<- %ecx 4/r32/esp
2454 (zero-out %ecx *Function-size)
2455
2456 81 5/subop/subtract %esp 0x10/imm32
2457 68/push 0x10/imm32/length
2458 68/push 0/imm32/top
2459 89/<- %ebx 4/r32/esp
2460
2461 (populate-mu-function-header _test-input-stream %ecx %ebx)
2462
2463 (check-strings-equal *ecx "foo" "F - test-function-header-with-arg/name")
2464
2465 8b/-> *(ecx+8) 2/r32/edx
2466
2467 8b/-> *edx 3/r32/ebx
2468 (check-strings-equal *ebx "n" "F - test-function-header-with-arg/inout:0")
2469 8b/-> *(ebx+4) 3/r32/ebx
2470 (check-ints-equal *ebx 1 "F - test-function-header-with-arg/inout:0/type:0")
2471 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-arg/inout:0/type:1")
2472
2473 89/<- %esp 5/r32/ebp
2474 5d/pop-to-ebp
2475 c3/return
2476
2477 test-function-header-with-multiple-args:
2478
2479 55/push-ebp
2480 89/<- %ebp 4/r32/esp
2481
2482 (clear-stream _test-input-stream)
2483 (write _test-input-stream "foo a: int, b: int c: int {\n")
2484
2485 2b/subtract-> *Function-size 4/r32/esp
2486 89/<- %ecx 4/r32/esp
2487 (zero-out %ecx *Function-size)
2488
2489 81 5/subop/subtract %esp 0x10/imm32
2490 68/push 0x10/imm32/length
2491 68/push 0/imm32/top
2492 89/<- %ebx 4/r32/esp
2493
2494 (populate-mu-function-header _test-input-stream %ecx %ebx)
2495
2496 (check-strings-equal *ecx "foo")
2497
2498 8b/-> *(ecx+8) 2/r32/edx
2499 $test-function-header-with-multiple-args:inout0:
2500
2501 8b/-> *edx 3/r32/ebx
2502 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args/inout:0")
2503 8b/-> *(ebx+4) 3/r32/ebx
2504 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:0/type:0")
2505 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:0/type:1")
2506
2507 8b/-> *(edx+4) 2/r32/edx
2508 $test-function-header-with-multiple-args:inout1:
2509
2510 8b/-> *edx 3/r32/ebx
2511 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args/inout:1")
2512 8b/-> *(ebx+4) 3/r32/ebx
2513 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:1/type:0")
2514 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:1/type:1")
2515
2516 8b/-> *(edx+4) 2/r32/edx
2517 $test-function-header-with-multiple-args:inout2:
2518
2519 8b/-> *edx 3/r32/ebx
2520 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args/inout:2")
2521 8b/-> *(ebx+4) 3/r32/ebx
2522 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:2/type:0")
2523 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:2/type:1")
2524
2525 89/<- %esp 5/r32/ebp
2526 5d/pop-to-ebp
2527 c3/return
2528
2529 test-function-with-multiple-args-and-outputs:
2530
2531 55/push-ebp
2532 89/<- %ebp 4/r32/esp
2533
2534 (clear-stream _test-input-stream)
2535 (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx: int {\n")
2536
2537 2b/subtract-> *Function-size 4/r32/esp
2538 89/<- %ecx 4/r32/esp
2539 (zero-out %ecx *Function-size)
2540
2541 81 5/subop/subtract %esp 0x10/imm32
2542 68/push 0x10/imm32/length
2543 68/push 0/imm32/top
2544 89/<- %ebx 4/r32/esp
2545
2546 (populate-mu-function-header _test-input-stream %ecx %ebx)
2547
2548 (check-strings-equal *ecx "foo")
2549
2550 8b/-> *(ecx+8) 2/r32/edx
2551
2552 8b/-> *edx 3/r32/ebx
2553 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0")
2554 8b/-> *(ebx+4) 3/r32/ebx
2555 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0")
2556 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1")
2557
2558 8b/-> *(edx+4) 2/r32/edx
2559
2560 8b/-> *edx 3/r32/ebx
2561 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1")
2562 8b/-> *(ebx+4) 3/r32/ebx
2563 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0")
2564 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1")
2565
2566 8b/-> *(edx+4) 2/r32/edx
2567
2568 8b/-> *edx 3/r32/ebx
2569 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2")
2570 8b/-> *(ebx+4) 3/r32/ebx
2571 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0")
2572 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1")
2573
2574 8b/-> *(ecx+0xc) 2/r32/edx
2575
2576 8b/-> *edx 3/r32/ebx
2577 (check-strings-equal *ebx "x" "F - test-function-header-with-multiple-args-and-outputs/output:0")
2578 (check-strings-equal *(ebx+0x10) "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register")
2579 8b/-> *(ebx+4) 3/r32/ebx
2580 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1")
2581 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1")
2582
2583 8b/-> *(edx+4) 2/r32/edx
2584
2585 8b/-> *edx 3/r32/ebx
2586 (check-strings-equal *ebx "y" "F - test-function-header-with-multiple-args-and-outputs/output:1")
2587 (check-strings-equal *(ebx+0x10) "edx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register")
2588 8b/-> *(ebx+4) 3/r32/ebx
2589 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1")
2590 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1")
2591
2592 89/<- %esp 5/r32/ebp
2593 5d/pop-to-ebp
2594 c3/return
2595
2596
2597
2598
2599
2600
2601
2602
2603 parse-var-with-type:
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622 55/push-ebp
2623 89/<- %ebp 4/r32/esp
2624
2625 51/push-ecx
2626 52/push-edx
2627 53/push-ebx
2628 56/push-esi
2629 57/push-edi
2630
2631 8b/-> *(ebp+8) 6/r32/esi
2632
2633 8b/-> *(esi+4) 1/r32/ecx
2634 49/decrement-ecx
2635 8a/copy-byte *ecx 1/r32/CL
2636 81 4/subop/and %ecx 0xff/imm32
2637 81 7/subop/compare %ecx 0x3a/imm32/colon
2638 0f 85/jump-if-!= $parse-var-with-type:abort/disp32
2639
2640 ff 1/subop/decrement *(esi+4)
2641
2642 (allocate Heap *Var-size)
2643 (zero-out %eax *Var-size)
2644 89/<- %edi 0/r32/eax
2645
2646 68/push 0/imm32/end
2647 68/push 0/imm32/start
2648 89/<- %ecx 4/r32/esp
2649 $parse-var-with-type:save-name:
2650
2651 (next-token-from-slice *esi *(esi+4) 0x2f %ecx)
2652
2653 8b/-> *(ecx+4) 2/r32/edx
2654 $parse-var-with-type:write-name:
2655 (slice-to-string Heap %ecx)
2656 89/<- *edi 0/r32/eax
2657
2658 $parse-var-with-type:save-register:
2659 (next-token-from-slice %edx *(esi+4) 0x2f %ecx)
2660
2661 {
2662 $parse-var-with-type:write-register:
2663 (slice-empty? %ecx)
2664 3d/compare-eax-and 0/imm32/false
2665 75/jump-if-!= break/disp8
2666 (slice-to-string Heap %ecx)
2667 89/<- *(edi+0x10) 0/r32/eax
2668 }
2669 $parse-var-with-type:save-type:
2670 (parse-type Heap *(ebp+0xc))
2671
2672
2673
2674
2675 89/<- *(edi+4) 0/r32/eax
2676 $parse-var-with-type:end:
2677
2678 89/<- %eax 7/r32/edi
2679
2680 81 0/subop/add %esp 8/imm32
2681
2682 5f/pop-to-edi
2683 5e/pop-to-esi
2684 5b/pop-to-ebx
2685 5a/pop-to-edx
2686 59/pop-to-ecx
2687
2688 89/<- %esp 5/r32/ebp
2689 5d/pop-to-ebp
2690 c3/return
2691
2692 $parse-var-with-type:abort:
2693
2694 (write-buffered Stderr "var should have form 'name: type' in '")
2695 (flush Stderr)
2696 (rewind-stream *(ebp+0xc))
2697 (write-stream 2 *(ebp+0xc))
2698 (write-buffered Stderr "'\n")
2699 (flush Stderr)
2700
2701 bb/copy-to-ebx 1/imm32
2702 b8/copy-to-eax 1/imm32/exit
2703 cd/syscall 0x80/imm8
2704
2705
2706 parse-type:
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724 55/push-ebp
2725 89/<- %ebp 4/r32/esp
2726
2727 51/push-ecx
2728 52/push-edx
2729
2730 68/push 0/imm32
2731 68/push 0/imm32
2732 89/<- %ecx 4/r32/esp
2733
2734 (next-mu-token *(ebp+0xc) %ecx)
2735
2736
2737
2738
2739
2740 (slice-equal? %ecx "")
2741 3d/compare-eax-and 0/imm32/false
2742 0f 85/jump-if-!= $parse-type:abort/disp32
2743
2744 (slice-equal? %ecx "{")
2745 3d/compare-eax-and 0/imm32/false
2746 0f 85/jump-if-!= $parse-type:abort/disp32
2747
2748 (slice-equal? %ecx "}")
2749 3d/compare-eax-and 0/imm32/false
2750 0f 85/jump-if-!= $parse-type:abort/disp32
2751
2752 (slice-equal? %ecx "->")
2753 3d/compare-eax-and 0/imm32/false
2754 0f 85/jump-if-!= $parse-type:abort/disp32
2755
2756 (slice-equal? %ecx ")")
2757 3d/compare-eax-and 0/imm32/false
2758 b8/copy-to-eax 0/imm32
2759 0f 85/jump-if-!= $parse-type:end/disp32
2760
2761 (allocate *(ebp+8) *Tree-size)
2762 (zero-out %eax *Tree-size)
2763 89/<- %edx 0/r32/eax
2764 {
2765
2766 (slice-equal? %ecx "(")
2767 3d/compare-eax-and 0/imm32/false
2768 75/jump-if-!= break/disp8
2769
2770 (pos-or-insert-slice Type-id %ecx)
2771
2772
2773
2774
2775 89/<- *edx 0/r32/eax
2776 e9/jump $parse-type:return-edx/disp32
2777 }
2778
2779
2780 (parse-type *(ebp+8) *(ebp+0xc))
2781
2782
2783 89/<- *edx 0/r32/eax
2784
2785 (parse-type-tree *(ebp+8) *(ebp+0xc))
2786
2787
2788
2789
2790 89/<- *(edx+4) 0/r32/eax
2791 $parse-type:return-edx:
2792 89/<- %eax 2/r32/edx
2793 $parse-type:end:
2794
2795 81 0/subop/add %esp 8/imm32
2796
2797 5a/pop-to-edx
2798 59/pop-to-ecx
2799
2800 89/<- %esp 5/r32/ebp
2801 5d/pop-to-ebp
2802 c3/return
2803
2804 $parse-type:abort:
2805
2806 (write-buffered Stderr "unexpected token when parsing type: '")
2807 (write-slice-buffered Stderr %ecx)
2808 (write-buffered Stderr "'\n")
2809 (flush Stderr)
2810
2811 bb/copy-to-ebx 1/imm32
2812 b8/copy-to-eax 1/imm32/exit
2813 cd/syscall 0x80/imm8
2814
2815
2816 parse-type-tree:
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827 55/push-ebp
2828 89/<- %ebp 4/r32/esp
2829
2830 51/push-ecx
2831 52/push-edx
2832
2833 (parse-type *(ebp+8) *(ebp+0xc))
2834
2835 3d/compare-eax-and 0/imm32
2836 74/jump-if-= $parse-type-tree:end/disp8
2837
2838 89/<- %ecx 0/r32/eax
2839
2840 (allocate *(ebp+8) *Tree-size)
2841 (zero-out %eax *Tree-size)
2842 89/<- %edx 0/r32/eax
2843
2844 89/<- *edx 1/r32/ecx
2845
2846 (parse-type-tree *(ebp+8) *(ebp+0xc))
2847 89/<- *(edx+4) 0/r32/eax
2848 $parse-type-tree:return-edx:
2849 89/<- %eax 2/r32/edx
2850 $parse-type-tree:end:
2851
2852 5a/pop-to-edx
2853 59/pop-to-ecx
2854
2855 89/<- %esp 5/r32/ebp
2856 5d/pop-to-ebp
2857 c3/return
2858
2859 next-mu-token:
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904 55/push-ebp
2905 89/<- %ebp 4/r32/esp
2906
2907 50/push-eax
2908 51/push-ecx
2909 56/push-esi
2910 57/push-edi
2911
2912 8b/-> *(ebp+8) 6/r32/esi
2913
2914 8b/-> *(ebp+0xc) 7/r32/edi
2915 $next-mu-token:start:
2916 (skip-chars-matching-whitespace %esi)
2917 $next-mu-token:check0:
2918
2919
2920 8b/-> *(esi+4) 1/r32/ecx
2921
2922 3b/compare 1/r32/ecx *esi
2923 c7 0/subop/copy *edi 0/imm32
2924 c7 0/subop/copy *(edi+4) 0/imm32
2925 0f 8d/jump-if->= $next-mu-token:end/disp32
2926
2927 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
2928 89/<- *edi 0/r32/eax
2929
2930 31/xor %eax 0/r32/eax
2931 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
2932 {
2933 $next-mu-token:check-for-comma:
2934
2935 3d/compare-eax-and 0x2c/imm32/comma
2936 75/jump-if-!= break/disp8
2937
2938 ff 0/subop/increment *(esi+4)
2939
2940 e9/jump $next-mu-token:start/disp32
2941 }
2942 {
2943 $next-mu-token:check-for-comment:
2944
2945 3d/compare-eax-and 0x23/imm32/pound
2946 75/jump-if-!= break/disp8
2947
2948 e9/jump $next-mu-token:done/disp32
2949 }
2950 {
2951 $next-mu-token:check-for-string-literal:
2952
2953 3d/compare-eax-and 0x22/imm32/dquote
2954 75/jump-if-!= break/disp8
2955 (skip-string %esi)
2956
2957 e9/jump $next-mu-token:done/disp32
2958 }
2959 {
2960 $next-mu-token:check-for-open-paren:
2961
2962 3d/compare-eax-and 0x28/imm32/open-paren
2963 75/jump-if-!= break/disp8
2964
2965 ff 0/subop/increment *(esi+4)
2966
2967 e9/jump $next-mu-token:done/disp32
2968 }
2969 {
2970 $next-mu-token:check-for-close-paren:
2971
2972 3d/compare-eax-and 0x29/imm32/close-paren
2973 75/jump-if-!= break/disp8
2974
2975 ff 0/subop/increment *(esi+4)
2976
2977 e9/jump $next-mu-token:done/disp32
2978 }
2979 {
2980 $next-mu-token:regular-word-without-metadata:
2981
2982
2983 8b/-> *(esi+4) 1/r32/ecx
2984
2985 3b/compare *esi 1/r32/ecx
2986 7d/jump-if->= break/disp8
2987
2988 31/xor %eax 0/r32/eax
2989 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
2990
2991 3d/compare-eax-and 0x20/imm32/space
2992 74/jump-if-= break/disp8
2993
2994 3d/compare-eax-and 0xd/imm32/carriage-return
2995 74/jump-if-= break/disp8
2996
2997 3d/compare-eax-and 0xa/imm32/newline
2998 74/jump-if-= break/disp8
2999
3000 3d/compare-eax-and 0x28/imm32/open-paren
3001 0f 84/jump-if-= break/disp32
3002
3003 3d/compare-eax-and 0x29/imm32/close-paren
3004 0f 84/jump-if-= break/disp32
3005
3006 3d/compare-eax-and 0x2c/imm32/comma
3007 0f 84/jump-if-= break/disp32
3008
3009 ff 0/subop/increment *(esi+4)
3010
3011 e9/jump loop/disp32
3012 }
3013 $next-mu-token:done:
3014
3015 8b/-> *(esi+4) 1/r32/ecx
3016 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
3017 89/<- *(edi+4) 0/r32/eax
3018 $next-mu-token:end:
3019
3020 5f/pop-to-edi
3021 5e/pop-to-esi
3022 59/pop-to-ecx
3023 58/pop-to-eax
3024
3025 89/<- %esp 5/r32/ebp
3026 5d/pop-to-ebp
3027 c3/return
3028
3029 pos-or-insert-slice:
3030
3031 55/push-ebp
3032 89/<- %ebp 4/r32/esp
3033
3034 (pos-slice *(ebp+8) *(ebp+0xc))
3035 3d/compare-eax-and -1/imm32
3036 75/jump-if-not-equal $pos-or-insert-slice:end/disp8
3037
3038 (slice-to-string Heap *(ebp+0xc))
3039 (write-int *(ebp+8) %eax)
3040 (pos-slice *(ebp+8) *(ebp+0xc))
3041 $pos-or-insert-slice:end:
3042
3043 89/<- %esp 5/r32/ebp
3044 5d/pop-to-ebp
3045 c3/return
3046
3047
3048
3049 pos-slice:
3050
3051 55/push-ebp
3052 89/<- %ebp 4/r32/esp
3053
3054 51/push-ecx
3055 52/push-edx
3056 53/push-ebx
3057 56/push-esi
3058
3059
3060
3061
3062
3063 8b/-> *(ebp+8) 6/r32/esi
3064
3065 b9/copy-to-ecx 0/imm32
3066
3067 8d/copy-address *(esi+0xc) 2/r32/edx
3068
3069 8b/-> *esi 3/r32/ebx
3070 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx
3071 {
3072
3073
3074
3075
3076
3077 39/compare %edx 3/r32/ebx
3078 b8/copy-to-eax -1/imm32
3079 73/jump-if-addr>= $pos-slice:end/disp8
3080
3081 (slice-equal? *(ebp+0xc) *edx)
3082 3d/compare-eax-and 0/imm32/false
3083 75/jump-if-!= break/disp8
3084
3085 41/increment-ecx
3086
3087 81 0/subop/add %edx 4/imm32
3088
3089 eb/jump loop/disp8
3090 }
3091
3092 89/<- %eax 1/r32/ecx
3093 $pos-slice:end:
3094
3095
3096
3097
3098 5e/pop-to-esi
3099 5b/pop-to-ebx
3100 5a/pop-to-edx
3101 59/pop-to-ecx
3102
3103 89/<- %esp 5/r32/ebp
3104 5d/pop-to-ebp
3105 c3/return
3106
3107 test-parse-var-with-type:
3108
3109 55/push-ebp
3110 89/<- %ebp 4/r32/esp
3111
3112 b8/copy-to-eax "x:"/imm32
3113 8b/-> *eax 1/r32/ecx
3114 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3115 05/add-to-eax 4/imm32
3116
3117 51/push-ecx
3118 50/push-eax
3119 89/<- %ecx 4/r32/esp
3120
3121 (clear-stream _test-input-stream)
3122 (write _test-input-stream "int")
3123
3124 (parse-var-with-type %ecx _test-input-stream)
3125 8b/-> *eax 2/r32/edx
3126 (check-strings-equal %edx "x" "F - test-var-with-type/name")
3127 8b/-> *(eax+4) 2/r32/edx
3128 (check-ints-equal *edx 1 "F - test-var-with-type/type")
3129 (check-ints-equal *(edx+4) 0 "F - test-var-with-type/type")
3130
3131 89/<- %esp 5/r32/ebp
3132 5d/pop-to-ebp
3133 c3/return
3134
3135 test-parse-var-with-type-and-register:
3136
3137 55/push-ebp
3138 89/<- %ebp 4/r32/esp
3139
3140 b8/copy-to-eax "x/eax:"/imm32
3141 8b/-> *eax 1/r32/ecx
3142 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3143 05/add-to-eax 4/imm32
3144
3145 51/push-ecx
3146 50/push-eax
3147 89/<- %ecx 4/r32/esp
3148
3149 (clear-stream _test-input-stream)
3150 (write _test-input-stream "int")
3151
3152 (parse-var-with-type %ecx _test-input-stream)
3153 8b/-> *eax 2/r32/edx
3154 (check-strings-equal %edx "x" "F - test-var-with-type-and-register/name")
3155 8b/-> *(eax+0x10) 2/r32/edx
3156 (check-strings-equal %edx "eax" "F - test-var-with-type-and-register/register")
3157 8b/-> *(eax+4) 2/r32/edx
3158 (check-ints-equal *edx 1 "F - test-var-with-type-and-register/type")
3159 (check-ints-equal *(edx+4) 0 "F - test-var-with-type-and-register/type")
3160
3161 89/<- %esp 5/r32/ebp
3162 5d/pop-to-ebp
3163 c3/return
3164
3165 test-parse-var-with-trailing-characters:
3166
3167 55/push-ebp
3168 89/<- %ebp 4/r32/esp
3169
3170 b8/copy-to-eax "x:"/imm32
3171 8b/-> *eax 1/r32/ecx
3172 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3173 05/add-to-eax 4/imm32
3174
3175 51/push-ecx
3176 50/push-eax
3177 89/<- %ecx 4/r32/esp
3178
3179 (clear-stream _test-input-stream)
3180 (write _test-input-stream "int,")
3181
3182 (parse-var-with-type %ecx _test-input-stream)
3183 8b/-> *eax 2/r32/edx
3184 (check-strings-equal %edx "x" "F - test-var-with-trailing-characters/name")
3185 8b/-> *(eax+0x10) 2/r32/edx
3186 (check-ints-equal %edx 0 "F - test-var-with-trailing-characters/register")
3187 8b/-> *(eax+4) 2/r32/edx
3188 (check-ints-equal *edx 1 "F - test-var-with-trailing-characters/type")
3189 (check-ints-equal *(edx+4) 0 "F - test-var-with-trailing-characters/type")
3190
3191 89/<- %esp 5/r32/ebp
3192 5d/pop-to-ebp
3193 c3/return
3194
3195 test-parse-var-with-register-and-trailing-characters:
3196
3197 55/push-ebp
3198 89/<- %ebp 4/r32/esp
3199
3200 b8/copy-to-eax "x/eax:"/imm32
3201 8b/-> *eax 1/r32/ecx
3202 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3203 05/add-to-eax 4/imm32
3204
3205 51/push-ecx
3206 50/push-eax
3207 89/<- %ecx 4/r32/esp
3208
3209 (clear-stream _test-input-stream)
3210 (write _test-input-stream "int,")
3211
3212 (parse-var-with-type %ecx _test-input-stream)
3213 8b/-> *eax 2/r32/edx
3214 (check-strings-equal %edx "x" "F - test-var-with-register-and-trailing-characters/name")
3215 8b/-> *(eax+0x10) 2/r32/edx
3216 (check-strings-equal %edx "eax" "F - test-var-with-register-and-trailing-characters/register")
3217 8b/-> *(eax+4) 2/r32/edx
3218 (check-ints-equal *edx 1 "F - test-var-with-register-and-trailing-characters/type")
3219 (check-ints-equal *(edx+4) 0 "F - test-var-with-register-and-trailing-characters/type")
3220
3221 89/<- %esp 5/r32/ebp
3222 5d/pop-to-ebp
3223 c3/return
3224
3225 test-parse-var-with-compound-type:
3226
3227 55/push-ebp
3228 89/<- %ebp 4/r32/esp
3229
3230 b8/copy-to-eax "x:"/imm32
3231 8b/-> *eax 1/r32/ecx
3232 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3233 05/add-to-eax 4/imm32
3234
3235 51/push-ecx
3236 50/push-eax
3237 89/<- %ecx 4/r32/esp
3238
3239 (clear-stream _test-input-stream)
3240 (write _test-input-stream "(addr int)")
3241
3242 (parse-var-with-type %ecx _test-input-stream)
3243 8b/-> *eax 2/r32/edx
3244 (check-strings-equal %edx "x" "F - test-var-with-compound-type/name")
3245 8b/-> *(eax+0x10) 2/r32/edx
3246 (check-ints-equal %edx 0 "F - test-var-with-compound-type/register")
3247
3248 8b/-> *(eax+4) 2/r32/edx
3249
3250 8b/-> *edx 0/r32/eax
3251 (check-ints-equal *eax 2 "F - test-var-with-compound-type/type:0")
3252
3253 8b/-> *(edx+4) 2/r32/edx
3254 8b/-> *edx 0/r32/eax
3255 (check-ints-equal *eax 1 "F - test-var-with-compound-type/type:1")
3256
3257 (check-ints-equal *(edx+4) 0 "F - test-var-with-compound-type/type:2")
3258
3259 89/<- %esp 5/r32/ebp
3260 5d/pop-to-ebp
3261 c3/return
3262
3263
3264
3265
3266 is-identifier?:
3267
3268 55/push-ebp
3269 89/<- %ebp 4/r32/esp
3270
3271 (slice-empty? *(ebp+8))
3272 3d/compare-eax-and 0/imm32/false
3273 75/jump-if-!= $is-identifier?:false/disp8
3274
3275 8b/-> *(ebp+8) 0/r32/eax
3276 8b/-> *eax 0/r32/eax
3277 8a/copy-byte *eax 0/r32/AL
3278 81 4/subop/and %eax 0xff/imm32
3279
3280 3d/compare-eax-and 0x24/imm32/$
3281 74/jump-if-= $is-identifier?:true/disp8
3282
3283 3d/compare-eax-and 0x5f/imm32/_
3284 74/jump-if-= $is-identifier?:true/disp8
3285
3286 25/and-eax-with 0x5f/imm32
3287
3288 3d/compare-eax-and 0x41/imm32/A
3289 7c/jump-if-< $is-identifier?:false/disp8
3290
3291 3d/compare-eax-and 0x5a/imm32/Z
3292 7f/jump-if-> $is-identifier?:false/disp8
3293
3294 $is-identifier?:true:
3295 b8/copy-to-eax 1/imm32/true
3296 eb/jump $is-identifier?:end/disp8
3297 $is-identifier?:false:
3298 b8/copy-to-eax 0/imm32/false
3299 $is-identifier?:end:
3300
3301 89/<- %esp 5/r32/ebp
3302 5d/pop-to-ebp
3303 c3/return
3304
3305 test-is-identifier-dollar:
3306
3307 55/push-ebp
3308 89/<- %ebp 4/r32/esp
3309
3310 b8/copy-to-eax "$a"/imm32
3311 8b/-> *eax 1/r32/ecx
3312 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3313 05/add-to-eax 4/imm32
3314
3315 51/push-ecx
3316 50/push-eax
3317 89/<- %ecx 4/r32/esp
3318
3319 (is-identifier? %ecx)
3320 (check-ints-equal %eax 1 "F - test-is-identifier-dollar")
3321
3322 89/<- %esp 5/r32/ebp
3323 5d/pop-to-ebp
3324 c3/return
3325
3326 test-is-identifier-underscore:
3327
3328 55/push-ebp
3329 89/<- %ebp 4/r32/esp
3330
3331 b8/copy-to-eax "_a"/imm32
3332 8b/-> *eax 1/r32/ecx
3333 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3334 05/add-to-eax 4/imm32
3335
3336 51/push-ecx
3337 50/push-eax
3338 89/<- %ecx 4/r32/esp
3339
3340 (is-identifier? %ecx)
3341 (check-ints-equal %eax 1 "F - test-is-identifier-underscore")
3342
3343 89/<- %esp 5/r32/ebp
3344 5d/pop-to-ebp
3345 c3/return
3346
3347 test-is-identifier-a:
3348
3349 55/push-ebp
3350 89/<- %ebp 4/r32/esp
3351
3352 b8/copy-to-eax "a$"/imm32
3353 8b/-> *eax 1/r32/ecx
3354 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3355 05/add-to-eax 4/imm32
3356
3357 51/push-ecx
3358 50/push-eax
3359 89/<- %ecx 4/r32/esp
3360
3361 (is-identifier? %ecx)
3362 (check-ints-equal %eax 1 "F - test-is-identifier-a")
3363
3364 89/<- %esp 5/r32/ebp
3365 5d/pop-to-ebp
3366 c3/return
3367
3368 test-is-identifier-z:
3369
3370 55/push-ebp
3371 89/<- %ebp 4/r32/esp
3372
3373 b8/copy-to-eax "z$"/imm32
3374 8b/-> *eax 1/r32/ecx
3375 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3376 05/add-to-eax 4/imm32
3377
3378 51/push-ecx
3379 50/push-eax
3380 89/<- %ecx 4/r32/esp
3381
3382 (is-identifier? %ecx)
3383 (check-ints-equal %eax 1 "F - test-is-identifier-z")
3384
3385 89/<- %esp 5/r32/ebp
3386 5d/pop-to-ebp
3387 c3/return
3388
3389 test-is-identifier-A:
3390
3391 55/push-ebp
3392 89/<- %ebp 4/r32/esp
3393
3394 b8/copy-to-eax "A$"/imm32
3395 8b/-> *eax 1/r32/ecx
3396 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3397 05/add-to-eax 4/imm32
3398
3399 51/push-ecx
3400 50/push-eax
3401 89/<- %ecx 4/r32/esp
3402
3403 (is-identifier? %ecx)
3404 (check-ints-equal %eax 1 "F - test-is-identifier-A")
3405
3406 89/<- %esp 5/r32/ebp
3407 5d/pop-to-ebp
3408 c3/return
3409
3410 test-is-identifier-Z:
3411
3412 55/push-ebp
3413 89/<- %ebp 4/r32/esp
3414
3415 b8/copy-to-eax "Z$"/imm32
3416 8b/-> *eax 1/r32/ecx
3417 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3418 05/add-to-eax 4/imm32
3419
3420 51/push-ecx
3421 50/push-eax
3422 89/<- %ecx 4/r32/esp
3423
3424 (is-identifier? %ecx)
3425 (check-ints-equal %eax 1 "F - test-is-identifier-Z")
3426
3427 89/<- %esp 5/r32/ebp
3428 5d/pop-to-ebp
3429 c3/return
3430
3431 test-is-identifier-@:
3432
3433
3434 55/push-ebp
3435 89/<- %ebp 4/r32/esp
3436
3437 b8/copy-to-eax "@a"/imm32
3438 8b/-> *eax 1/r32/ecx
3439 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3440 05/add-to-eax 4/imm32
3441
3442 51/push-ecx
3443 50/push-eax
3444 89/<- %ecx 4/r32/esp
3445
3446 (is-identifier? %ecx)
3447 (check-ints-equal %eax 0 "F - test-is-identifier-@")
3448
3449 89/<- %esp 5/r32/ebp
3450 5d/pop-to-ebp
3451 c3/return
3452
3453 test-is-identifier-square-bracket:
3454
3455
3456 55/push-ebp
3457 89/<- %ebp 4/r32/esp
3458
3459 b8/copy-to-eax "[a"/imm32
3460 8b/-> *eax 1/r32/ecx
3461 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3462 05/add-to-eax 4/imm32
3463
3464 51/push-ecx
3465 50/push-eax
3466 89/<- %ecx 4/r32/esp
3467
3468 (is-identifier? %ecx)
3469 (check-ints-equal %eax 0 "F - test-is-identifier-@")
3470
3471 89/<- %esp 5/r32/ebp
3472 5d/pop-to-ebp
3473 c3/return
3474
3475 test-is-identifier-backtick:
3476
3477
3478 55/push-ebp
3479 89/<- %ebp 4/r32/esp
3480
3481 b8/copy-to-eax "`a"/imm32
3482 8b/-> *eax 1/r32/ecx
3483 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3484 05/add-to-eax 4/imm32
3485
3486 51/push-ecx
3487 50/push-eax
3488 89/<- %ecx 4/r32/esp
3489
3490 (is-identifier? %ecx)
3491 (check-ints-equal %eax 0 "F - test-is-identifier-backtick")
3492
3493 89/<- %esp 5/r32/ebp
3494 5d/pop-to-ebp
3495 c3/return
3496
3497 test-is-identifier-curly-brace-open:
3498
3499
3500 55/push-ebp
3501 89/<- %ebp 4/r32/esp
3502
3503 b8/copy-to-eax "{a"/imm32
3504 8b/-> *eax 1/r32/ecx
3505 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3506 05/add-to-eax 4/imm32
3507
3508 51/push-ecx
3509 50/push-eax
3510 89/<- %ecx 4/r32/esp
3511
3512 (is-identifier? %ecx)
3513 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open")
3514
3515 89/<- %esp 5/r32/ebp
3516 5d/pop-to-ebp
3517 c3/return
3518
3519 test-is-identifier-curly-brace-close:
3520
3521 55/push-ebp
3522 89/<- %ebp 4/r32/esp
3523
3524 b8/copy-to-eax "}a"/imm32
3525 8b/-> *eax 1/r32/ecx
3526 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3527 05/add-to-eax 4/imm32
3528
3529 51/push-ecx
3530 50/push-eax
3531 89/<- %ecx 4/r32/esp
3532
3533 (is-identifier? %ecx)
3534 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close")
3535
3536 89/<- %esp 5/r32/ebp
3537 5d/pop-to-ebp
3538 c3/return
3539
3540 test-is-identifier-hyphen:
3541
3542
3543 55/push-ebp
3544 89/<- %ebp 4/r32/esp
3545
3546 b8/copy-to-eax "-a"/imm32
3547 8b/-> *eax 1/r32/ecx
3548 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3549 05/add-to-eax 4/imm32
3550
3551 51/push-ecx
3552 50/push-eax
3553 89/<- %ecx 4/r32/esp
3554
3555 (is-identifier? %ecx)
3556 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen")
3557
3558 89/<- %esp 5/r32/ebp
3559 5d/pop-to-ebp
3560 c3/return
3561
3562 populate-mu-function-body:
3563
3564 55/push-ebp
3565 89/<- %ebp 4/r32/esp
3566
3567 50/push-eax
3568 56/push-esi
3569 57/push-edi
3570
3571 8b/-> *(ebp+8) 6/r32/esi
3572
3573 8b/-> *(ebp+0xc) 7/r32/edi
3574
3575 c7 0/subop/copy *Curr-block-depth 1/imm32
3576 c7 0/subop/copy *Next-local-stack-offset -4/imm32
3577
3578 (parse-mu-block %esi *(ebp+0x10) %edi)
3579
3580 89/<- *(edi+0x10) 0/r32/eax
3581 $populate-mu-function-body:end:
3582
3583 5f/pop-to-edi
3584 5e/pop-to-esi
3585 58/pop-to-eax
3586
3587 89/<- %esp 5/r32/ebp
3588 5d/pop-to-ebp
3589 c3/return
3590
3591 == data
3592
3593
3594
3595 Curr-block-depth:
3596 0/imm32
3597 Next-local-stack-offset:
3598 -4/imm32
3599
3600 Next-block-index:
3601 1/imm32
3602
3603 == code
3604
3605
3606 parse-mu-block:
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644 55/push-ebp
3645 89/<- %ebp 4/r32/esp
3646
3647 51/push-ecx
3648 52/push-edx
3649 53/push-ebx
3650 57/push-edi
3651
3652 81 5/subop/subtract %esp 0x200/imm32
3653 68/push 0x200/imm32/length
3654 68/push 0/imm32/read
3655 68/push 0/imm32/write
3656 89/<- %ecx 4/r32/esp
3657
3658 68/push 0/imm32/end
3659 68/push 0/imm32/start
3660 89/<- %edx 4/r32/esp
3661
3662 (allocate Heap *Stmt-size)
3663 (zero-out %eax *Stmt-size)
3664 89/<- %edi 0/r32/eax
3665
3666 c7 0/subop/copy *edi 0/imm32/block
3667
3668 (new-block-name *(ebp+0x10))
3669 89/<- *(edi+8) 0/r32/eax
3670
3671 (push *(ebp+0xc) %eax)
3672
3673 ff 0/subop/increment *Curr-block-depth
3674 {
3675 $parse-mu-block:line-loop:
3676
3677 (clear-stream %ecx)
3678 (read-line-buffered *(ebp+8) %ecx)
3679
3680
3681
3682
3683
3684 81 7/subop/compare *ecx 0/imm32
3685 0f 84/jump-if-= break/disp32
3686
3687 (next-mu-token %ecx %edx)
3688
3689
3690
3691
3692
3693 (slice-empty? %edx)
3694 3d/compare-eax-and 0/imm32/false
3695 0f 85/jump-if-!= loop/disp32
3696
3697
3698 8b/-> *edx 0/r32/eax
3699 8a/copy-byte *eax 0/r32/AL
3700 81 4/subop/and %eax 0xff/imm32
3701
3702 3d/compare-eax-and 0x23/imm32/hash
3703 0f 84/jump-if-= loop/disp32
3704
3705 {
3706 $parse-mu-block:check-for-block:
3707 (slice-equal? %edx "{")
3708 3d/compare-eax-and 0/imm32/false
3709 74/jump-if-= break/disp8
3710 (check-no-tokens-left %ecx)
3711
3712 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10))
3713 (append-to-block Heap %edi %eax)
3714 e9/jump $parse-mu-block:line-loop/disp32
3715 }
3716
3717 $parse-mu-block:check-for-end:
3718 (slice-equal? %edx "}")
3719 3d/compare-eax-and 0/imm32/false
3720 0f 85/jump-if-!= break/disp32
3721
3722 {
3723 $parse-mu-block:check-for-named-block:
3724
3725 8b/-> *(edx+4) 0/r32/eax
3726 48/decrement-eax
3727 8a/copy-byte *eax 0/r32/AL
3728 81 4/subop/and %eax 0xff/imm32
3729
3730 3d/compare-eax-and 0x3a/imm32/colon
3731 0f 85/jump-if-!= break/disp32
3732
3733
3734
3735 ff 1/subop/decrement *(edx+4)
3736
3737 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10))
3738 (append-to-block Heap %edi %eax)
3739 e9/jump $parse-mu-block:line-loop/disp32
3740 }
3741
3742 {
3743 $parse-mu-block:check-for-var:
3744 (slice-equal? %edx "var")
3745 3d/compare-eax-and 0/imm32/false
3746 74/jump-if-= break/disp8
3747
3748 (parse-mu-var-def %ecx *(ebp+0xc))
3749 (append-to-block Heap %edi %eax)
3750 e9/jump $parse-mu-block:line-loop/disp32
3751 }
3752 $parse-mu-block:regular-stmt:
3753
3754 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10))
3755 (append-to-block Heap %edi %eax)
3756 e9/jump loop/disp32
3757 }
3758
3759 ff 1/subop/decrement *Curr-block-depth
3760
3761 (pop *(ebp+0xc))
3762
3763 89/<- %eax 7/r32/edi
3764 $parse-mu-block:end:
3765
3766 81 0/subop/add %esp 0x214/imm32
3767
3768 5f/pop-to-edi
3769 5b/pop-to-ebx
3770 5a/pop-to-edx
3771 59/pop-to-ecx
3772
3773 89/<- %esp 5/r32/ebp
3774 5d/pop-to-ebp
3775 c3/return
3776
3777 $parse-mu-block:abort:
3778
3779 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
3780 (rewind-stream %ecx)
3781 (write-stream 2 %ecx)
3782 (write-buffered Stderr "'\n")
3783 (flush Stderr)
3784
3785 bb/copy-to-ebx 1/imm32
3786 b8/copy-to-eax 1/imm32/exit
3787 cd/syscall 0x80/imm8
3788
3789
3790 new-block-name:
3791
3792 55/push-ebp
3793 89/<- %ebp 4/r32/esp
3794
3795 51/push-ecx
3796 52/push-edx
3797
3798 8b/-> *(ebp+8) 0/r32/eax
3799 8b/-> *eax 0/r32/eax
3800 8b/-> *eax 0/r32/eax
3801 05/add-to-eax 0xd/imm32
3802 89/<- %ecx 0/r32/eax
3803
3804 29/subtract %esp 1/r32/ecx
3805 ff 6/subop/push %ecx
3806 68/push 0/imm32/read
3807 68/push 0/imm32/write
3808 89/<- %edx 4/r32/esp
3809 (clear-stream %edx)
3810
3811 8b/-> *(ebp+8) 0/r32/eax
3812 8b/-> *eax 0/r32/eax
3813
3814 (write %edx "$")
3815 (write %edx %eax)
3816 (write %edx ":")
3817 (print-int32 %edx *Next-block-index)
3818 ff 0/subop/increment *Next-block-index
3819
3820
3821 8b/-> *edx 0/r32/eax
3822
3823 8d/copy-address *(edx+0xc) 2/r32/edx
3824
3825 01/add %eax 2/r32/edx
3826
3827 ff 6/subop/push %eax
3828 ff 6/subop/push %edx
3829 89/<- %eax 4/r32/esp
3830
3831 (new-literal Heap %eax)
3832 $new-block-name:end:
3833
3834 81 0/subop/add %ecx 0xc/imm32
3835 81 0/subop/add %ecx 8/imm32
3836 01/add %esp 1/r32/ecx
3837
3838 5a/pop-to-edx
3839 59/pop-to-ecx
3840
3841 89/<- %esp 5/r32/ebp
3842 5d/pop-to-ebp
3843 c3/return
3844
3845 check-no-tokens-left:
3846
3847 55/push-ebp
3848 89/<- %ebp 4/r32/esp
3849
3850 50/push-eax
3851 51/push-ecx
3852
3853 68/push 0/imm32/end
3854 68/push 0/imm32/start
3855 89/<- %ecx 4/r32/esp
3856
3857 (next-mu-token *(ebp+8) %ecx)
3858
3859 (slice-empty? %ecx)
3860 3d/compare-eax-and 0/imm32/false
3861 75/jump-if-!= $check-no-tokens-left:end/disp8
3862
3863
3864 8b/-> *edx 0/r32/eax
3865 8a/copy-byte *eax 0/r32/AL
3866 81 4/subop/and %eax 0xff/imm32
3867
3868 3d/compare-eax-and 0x23/imm32/hash
3869 74/jump-if-= $check-no-tokens-left:end/disp8
3870
3871 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
3872 (rewind-stream %ecx)
3873 (write-stream 2 %ecx)
3874 (write-buffered Stderr "'\n")
3875 (flush Stderr)
3876
3877 bb/copy-to-ebx 1/imm32
3878 b8/copy-to-eax 1/imm32/exit
3879 cd/syscall 0x80/imm8
3880
3881 $check-no-tokens-left:end:
3882
3883 81 0/subop/add %esp 8/imm32
3884
3885 59/pop-to-ecx
3886 58/pop-to-eax
3887
3888 89/<- %esp 5/r32/ebp
3889 5d/pop-to-ebp
3890 c3/return
3891
3892 parse-mu-named-block:
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904 55/push-ebp
3905 89/<- %ebp 4/r32/esp
3906
3907 51/push-ecx
3908
3909 (new-literal Heap *(ebp+8))
3910 89/<- %ecx 0/r32/eax
3911
3912 (push *(ebp+0x10) %ecx)
3913
3914 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14))
3915
3916 50/push-eax
3917 (pop *(ebp+0x10))
3918 58/pop-to-eax
3919
3920 c7 0/subop/copy *eax 0/imm32/block
3921
3922 89/<- *(eax+8) 1/r32/ecx
3923 $parse-mu-named-block:end:
3924
3925 59/pop-to-ecx
3926
3927 89/<- %esp 5/r32/ebp
3928 5d/pop-to-ebp
3929 c3/return
3930
3931 parse-mu-var-def:
3932
3933 55/push-ebp
3934 89/<- %ebp 4/r32/esp
3935
3936 51/push-ecx
3937 52/push-edx
3938
3939 68/push 0/imm32/end
3940 68/push 0/imm32/start
3941 89/<- %ecx 4/r32/esp
3942
3943 (next-mu-token *(ebp+8) %ecx)
3944 (parse-var-with-type %ecx *(ebp+8))
3945 89/<- %edx 0/r32/eax
3946
3947 8b/-> *Curr-block-depth 0/r32/eax
3948 89/<- *(edx+8) 0/r32/eax
3949
3950 (push *(ebp+0xc) %edx)
3951
3952 8b/-> *(edx+0x10) 0/r32/eax
3953 3d/compare-eax-and 0/imm32
3954 {
3955 75/jump-if-!= break/disp8
3956
3957 8b/-> *Next-local-stack-offset 0/r32/eax
3958 89/<- *(edx+0xc) 0/r32/eax
3959
3960 (new-var-def Heap %edx)
3961 eb/jump $parse-mu-var-def:end/disp8
3962 }
3963
3964 {
3965 74/jump-if-= break/disp8
3966
3967 (next-mu-token *(ebp+8) %ecx)
3968 (slice-equal? %ecx "<-")
3969 3d/compare-eax-and 0/imm32/false
3970 74/jump-if-= $parse-mu-var-def:abort/disp8
3971
3972 (new-reg-var-def Heap %edx)
3973 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc))
3974 }
3975 $parse-mu-var-def:end:
3976
3977 50/push-eax
3978 (size-of %edx)
3979 29/subtract-from *Next-local-stack-offset 0/r32/eax
3980 58/pop-to-eax
3981
3982 81 0/subop/add %esp 8/imm32
3983
3984 5a/pop-to-edx
3985 59/pop-to-ecx
3986
3987 89/<- %esp 5/r32/ebp
3988 5d/pop-to-ebp
3989 c3/return
3990
3991 $parse-mu-var-def:abort:
3992 (rewind-stream *(ebp+8))
3993
3994 (write-buffered Stderr "register variable requires a valid instruction to initialize but got '")
3995 (flush Stderr)
3996 (write-stream 2 *(ebp+8))
3997 (write-buffered Stderr "'\n")
3998 (flush Stderr)
3999
4000 bb/copy-to-ebx 1/imm32
4001 b8/copy-to-eax 1/imm32/exit
4002 cd/syscall 0x80/imm8
4003
4004
4005 test-parse-mu-var-def:
4006
4007
4008 55/push-ebp
4009 89/<- %ebp 4/r32/esp
4010
4011 (clear-stream _test-input-stream)
4012 (write _test-input-stream "n: int\n")
4013 c7 0/subop/copy *Curr-block-depth 1/imm32
4014 c7 0/subop/copy *Next-local-stack-offset -4/imm32
4015
4016 81 5/subop/subtract %esp 0x10/imm32
4017 68/push 0x10/imm32/length
4018 68/push 0/imm32/top
4019 89/<- %ecx 4/r32/esp
4020 (clear-stack %ecx)
4021
4022 (parse-mu-var-def _test-input-stream %ecx)
4023
4024 (check-ints-equal *eax 2 "F - test-parse-mu-var-def/tag")
4025 8b/-> *(eax+4) 0/r32/eax
4026 (check-strings-equal *eax "n" "F - test-parse-mu-var-def/var-name")
4027 (check-ints-equal *(eax+0x10) 0 "F - test-parse-mu-var-def/var-register")
4028 (check-ints-equal *(eax+8) 1 "F - test-parse-mu-reg-var-def/output-block-depth")
4029 (check-ints-equal *(eax+0xc) -4 "F - test-parse-mu-reg-var-def/output-stack-offset")
4030
4031 8b/-> *(eax+4) 0/r32/eax
4032 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0")
4033 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-var-def/var-type:0")
4034
4035 (check-ints-equal *Next-local-stack-offset -8 "F - test-parse-mu-reg-var-def/Next-local-stack-offset")
4036
4037 89/<- %esp 5/r32/ebp
4038 5d/pop-to-ebp
4039 c3/return
4040
4041 test-parse-mu-reg-var-def:
4042
4043
4044 55/push-ebp
4045 89/<- %ebp 4/r32/esp
4046
4047 (clear-stream _test-input-stream)
4048 (write _test-input-stream "n/eax: int <- copy 0\n")
4049 c7 0/subop/copy *Curr-block-depth 1/imm32
4050 c7 0/subop/copy *Next-local-stack-offset -4/imm32
4051
4052 81 5/subop/subtract %esp 0x10/imm32
4053 68/push 0x10/imm32/length
4054 68/push 0/imm32/top
4055 89/<- %ecx 4/r32/esp
4056 (clear-stack %ecx)
4057
4058 (parse-mu-var-def _test-input-stream %ecx)
4059
4060 (check-ints-equal *eax 3 "F - test-parse-mu-reg-var-def/tag")
4061 8b/-> *(eax+0xc) 0/r32/eax
4062 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-reg-var-def/single-output")
4063 8b/-> *eax 0/r32/eax
4064 (check-strings-equal *eax "n" "F - test-parse-mu-reg-var-def/output-name")
4065 (check-strings-equal *(eax+0x10) "eax" "F - test-parse-mu-reg-var-def/output-register")
4066 (check-ints-equal *(eax+8) 1 "F - test-parse-mu-reg-var-def/output-block-depth")
4067 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-reg-var-def/output-stack-offset")
4068
4069 8b/-> *(eax+4) 0/r32/eax
4070 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0")
4071 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-reg-var-def/output-type:0")
4072
4073 (check-ints-equal *Next-local-stack-offset -8 "F - test-parse-mu-reg-var-def/Next-local-stack-offset")
4074
4075 89/<- %esp 5/r32/ebp
4076 5d/pop-to-ebp
4077 c3/return
4078
4079 parse-mu-stmt:
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093 55/push-ebp
4094 89/<- %ebp 4/r32/esp
4095
4096 51/push-ecx
4097 52/push-edx
4098 57/push-edi
4099
4100 68/push 0/imm32/end
4101 68/push 0/imm32/start
4102 89/<- %ecx 4/r32/esp
4103
4104 ba/copy-to-edx 0/imm32/false
4105
4106 (allocate Heap *Stmt-size)
4107 (zero-out %eax *Stmt-size)
4108 89/<- %edi 0/r32/eax
4109
4110 c7 0/subop/copy *edi 1/imm32/stmt1
4111 {
4112 (stmt-has-outputs? *(ebp+8))
4113 3d/compare-eax-and 0/imm32/false
4114 0f 84/jump-if-= break/disp32
4115 {
4116 $parse-mu-stmt:read-outputs:
4117
4118 (next-mu-token *(ebp+8) %ecx)
4119
4120 (slice-empty? %ecx)
4121 3d/compare-eax-and 0/imm32/false
4122 0f 85/jump-if-!= break/disp32
4123
4124 (slice-equal? %ecx "<-")
4125 3d/compare-eax-and 0/imm32/false
4126 0f 85/jump-if-!= break/disp32
4127
4128 ba/copy-to-edx 0/imm32/false
4129
4130 8b/-> *ecx 0/r32/eax
4131 8a/copy-byte *eax 0/r32/AL
4132 81 4/subop/and %eax 0xff/imm32
4133 3d/compare-eax-and 0x2a/imm32/asterisk
4134 {
4135 75/jump-if-!= break/disp8
4136 ff 0/subop/increment *ecx
4137 ba/copy-to-edx 1/imm32/true
4138 }
4139
4140 (is-identifier? %ecx)
4141 3d/compare-eax-and 0/imm32/false
4142 0f 84/jump-if-= $parse-mu-stmt:abort/disp32
4143
4144 (lookup-or-define-var %ecx *(ebp+0xc) *(ebp+0x10))
4145 (append-stmt-var Heap %eax *(edi+0xc) %edx)
4146 89/<- *(edi+0xc) 0/r32/eax
4147 e9/jump loop/disp32
4148 }
4149 }
4150 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc))
4151 $parse-mu-stmt:end:
4152
4153 89/<- %eax 7/r32/edi
4154
4155 81 0/subop/add %esp 8/imm32
4156
4157 5f/pop-to-edi
4158 5a/pop-to-edx
4159 59/pop-to-ecx
4160
4161 89/<- %esp 5/r32/ebp
4162 5d/pop-to-ebp
4163 c3/return
4164
4165 $parse-mu-stmt:abort:
4166
4167 (write-buffered Stderr "invalid identifier '")
4168 (write-slice-buffered Stderr %ecx)
4169 (write-buffered Stderr "'\n")
4170 (flush Stderr)
4171
4172 bb/copy-to-ebx 1/imm32
4173 b8/copy-to-eax 1/imm32/exit
4174 cd/syscall 0x80/imm8
4175
4176
4177 add-operation-and-inputs-to-stmt:
4178
4179
4180
4181
4182
4183
4184
4185
4186 55/push-ebp
4187 89/<- %ebp 4/r32/esp
4188
4189 50/push-eax
4190 51/push-ecx
4191 52/push-edx
4192 53/push-ebx
4193 57/push-edi
4194
4195 8b/-> *(ebp+8) 7/r32/edi
4196
4197 68/push 0/imm32/end
4198 68/push 0/imm32/start
4199 89/<- %ecx 4/r32/esp
4200
4201 ba/copy-to-edx 0/imm32/false
4202 $add-operation-and-inputs-to-stmt:read-operation:
4203 (next-mu-token *(ebp+0xc) %ecx)
4204 (slice-to-string Heap %ecx)
4205 89/<- *(edi+4) 0/r32/eax
4206
4207 (slice-equal? %ecx "get")
4208 89/<- %ebx 0/r32/eax
4209 {
4210 $add-operation-and-inputs-to-stmt:read-inouts:
4211
4212 (next-mu-token *(ebp+0xc) %ecx)
4213
4214 (slice-empty? %ecx)
4215 3d/compare-eax-and 0/imm32/false
4216 0f 85/jump-if-!= break/disp32
4217
4218 (slice-equal? %ecx "<-")
4219 3d/compare-eax-and 0/imm32/false
4220 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32
4221
4222 {
4223 81 7/subop/compare %ebx 0/imm32/false
4224 74/jump-if-= break/disp8
4225 81 7/subop/compare *(edi+8) 0/imm32
4226 74/jump-if-= break/disp8
4227 (lookup-or-create-constant *(edi+8) %ecx)
4228
4229
4230
4231
4232
4233
4234 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32
4235 }
4236
4237 ba/copy-to-edx 0/imm32/false
4238
4239 8b/-> *ecx 0/r32/eax
4240 8a/copy-byte *eax 0/r32/AL
4241 81 4/subop/and %eax 0xff/imm32
4242 3d/compare-eax-and 0x2a/imm32/asterisk
4243 {
4244 75/jump-if-!= break/disp8
4245 $add-operation-and-inputs-to-stmt:inout-is-deref:
4246 ff 0/subop/increment *ecx
4247 ba/copy-to-edx 1/imm32/true
4248 }
4249 (lookup-var-or-literal %ecx *(ebp+0x10))
4250 $add-operation-and-inputs-to-stmt:save-var:
4251 (append-stmt-var Heap %eax *(edi+8) %edx)
4252 89/<- *(edi+8) 0/r32/eax
4253 e9/jump loop/disp32
4254 }
4255 $add-operation-and-inputs-to-stmt:end:
4256
4257 81 0/subop/add %esp 8/imm32
4258
4259 5f/pop-to-edi
4260 5b/pop-to-ebx
4261 5a/pop-to-edx
4262 59/pop-to-ecx
4263 58/pop-to-eax
4264
4265 89/<- %esp 5/r32/ebp
4266 5d/pop-to-ebp
4267 c3/return
4268
4269 $add-operation-and-inputs-to-stmt:abort:
4270
4271 (rewind-stream *(ebp+8))
4272 (write-buffered Stderr "invalid identifier '")
4273 (flush Stderr)
4274 (write-stream 2 *(ebp+8))
4275 (write-buffered Stderr "'\n")
4276 (flush Stderr)
4277
4278 bb/copy-to-ebx 1/imm32
4279 b8/copy-to-eax 1/imm32/exit
4280 cd/syscall 0x80/imm8
4281
4282
4283 stmt-has-outputs?:
4284
4285 55/push-ebp
4286 89/<- %ebp 4/r32/esp
4287
4288 51/push-ecx
4289
4290 68/push 0/imm32/end
4291 68/push 0/imm32/start
4292 89/<- %ecx 4/r32/esp
4293
4294 b8/copy-to-eax 0/imm32/false
4295 (rewind-stream *(ebp+8))
4296 {
4297 (next-mu-token *(ebp+8) %ecx)
4298
4299 (slice-empty? %ecx)
4300 3d/compare-eax-and 0/imm32/false
4301 b8/copy-to-eax 0/imm32/false/result
4302 0f 85/jump-if-!= break/disp32
4303
4304
4305 8b/-> *ecx 0/r32/eax
4306 8a/copy-byte *eax 0/r32/AL
4307 81 4/subop/and %eax 0xff/imm32
4308
4309 3d/compare-eax-and 0x23/imm32/hash
4310 b8/copy-to-eax 0/imm32/false/result
4311 0f 84/jump-if-= break/disp32
4312
4313 (slice-equal? %ecx "<-")
4314 3d/compare-eax-and 0/imm32/false
4315 74/jump-if-= loop/disp8
4316 b8/copy-to-eax 1/imm32/true
4317 }
4318 $stmt-has-outputs:end:
4319 (rewind-stream *(ebp+8))
4320
4321 81 0/subop/add %esp 8/imm32
4322
4323 59/pop-to-ecx
4324
4325 89/<- %esp 5/r32/ebp
4326 5d/pop-to-ebp
4327 c3/return
4328
4329
4330
4331 lookup-var-or-literal:
4332
4333 55/push-ebp
4334 89/<- %ebp 4/r32/esp
4335
4336 51/push-ecx
4337 56/push-esi
4338
4339 8b/-> *(ebp+8) 6/r32/esi
4340
4341 (slice-empty? %esi)
4342 3d/compare-eax-and 0/imm32/false
4343 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32
4344
4345 8b/-> *esi 1/r32/ecx
4346 8a/copy-byte *ecx 1/r32/CL
4347 81 4/subop/and %ecx 0xff/imm32
4348
4349 {
4350 (is-decimal-digit? %ecx)
4351 3d/compare-eax-and 0/imm32/false
4352 74/jump-if-= break/disp8
4353 (new-literal-integer Heap %esi)
4354 eb/jump $lookup-var-or-literal:end/disp8
4355 }
4356
4357 {
4358 81 7/subop/compare %ecx 0x22/imm32/dquote
4359 75/jump-if-!= break/disp8
4360 (new-literal Heap %esi)
4361 eb/jump $lookup-var-or-literal:end/disp8
4362 }
4363
4364 {
4365 (lookup-var %esi *(ebp+0xc))
4366 }
4367 $lookup-var-or-literal:end:
4368
4369 5e/pop-to-esi
4370 59/pop-to-ecx
4371
4372 89/<- %esp 5/r32/ebp
4373 5d/pop-to-ebp
4374 c3/return
4375
4376 $lookup-var-or-literal:abort:
4377 (write-buffered Stderr "empty variable!")
4378 (flush Stderr)
4379
4380 bb/copy-to-ebx 1/imm32
4381 b8/copy-to-eax 1/imm32/exit
4382 cd/syscall 0x80/imm8
4383
4384
4385
4386 lookup-var:
4387
4388 55/push-ebp
4389 89/<- %ebp 4/r32/esp
4390
4391 (slice-to-string Heap *(ebp+8))
4392
4393 (lookup-var-helper %eax *(ebp+0xc))
4394
4395 3d/compare-eax-and 0/imm32
4396 74/jump-if-= $lookup-var:abort/disp8
4397 $lookup-var:end:
4398
4399 89/<- %esp 5/r32/ebp
4400 5d/pop-to-ebp
4401 c3/return
4402
4403 $lookup-var:abort:
4404 (write-buffered Stderr "unknown variable '")
4405 (write-slice-buffered Stderr *(ebp+8))
4406 (write-buffered Stderr "'\n")
4407 (flush Stderr)
4408
4409 bb/copy-to-ebx 1/imm32
4410 b8/copy-to-eax 1/imm32/exit
4411 cd/syscall 0x80/imm8
4412
4413
4414
4415 lookup-var-helper:
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426 55/push-ebp
4427 89/<- %ebp 4/r32/esp
4428
4429 52/push-edx
4430 53/push-ebx
4431 56/push-esi
4432
4433 8b/-> *(ebp+0xc) 6/r32/esi
4434
4435 8b/-> *esi 3/r32/ebx
4436
4437 3b/compare 0/r32/eax *(esi+4)
4438 0f 8f/jump-if-> $lookup-var-helper:error1/disp32
4439
4440 8d/copy-address *(esi+8) 2/r32/edx
4441
4442 81 5/subop/subtract %ebx 4/imm32
4443 8d/copy-address *(esi+ebx+8) 3/r32/ebx
4444 {
4445
4446 39/compare %ebx 2/r32/edx
4447 b8/copy-to-eax 0/imm32
4448 0f 82/jump-if-addr< break/disp32
4449
4450 8b/-> *ebx 0/r32/eax
4451
4452 (string-equal? *eax *(ebp+8))
4453 3d/compare-eax-and 0/imm32/false
4454 8b/-> *ebx 0/r32/eax
4455 75/jump-if-!= break/disp8
4456
4457 81 5/subop/subtract %ebx 4/imm32
4458 e9/jump loop/disp32
4459 }
4460 $lookup-var-helper:end:
4461
4462 5e/pop-to-esi
4463 5b/pop-to-ebx
4464 5a/pop-to-edx
4465
4466 89/<- %esp 5/r32/ebp
4467 5d/pop-to-ebp
4468 c3/return
4469
4470 $lookup-var-helper:error1:
4471 (write-buffered Stderr "malformed stack when looking up '")
4472 (write-slice-buffered Stderr *(ebp+8))
4473 (write-buffered Stderr "'\n")
4474 (flush Stderr)
4475
4476 bb/copy-to-ebx 1/imm32
4477 b8/copy-to-eax 1/imm32/exit
4478 cd/syscall 0x80/imm8
4479
4480
4481
4482 lookup-or-define-var:
4483
4484 55/push-ebp
4485 89/<- %ebp 4/r32/esp
4486
4487 51/push-ecx
4488
4489 (slice-to-string Heap *(ebp+8))
4490 89/<- %ecx 0/r32/eax
4491
4492 (lookup-var-helper %ecx *(ebp+0xc))
4493 {
4494
4495 3d/compare-eax-and 0/imm32
4496 75/jump-if-!= break/disp8
4497
4498 {
4499 (find-in-function-outputs *(ebp+0x10) %ecx)
4500 3d/compare-eax-and 0/imm32
4501
4502 0f 84/jump-if-!= $lookup-var:abort/disp32
4503 }
4504 }
4505 $lookup-or-define-var:end:
4506
4507 59/pop-to-ecx
4508
4509 89/<- %esp 5/r32/ebp
4510 5d/pop-to-ebp
4511 c3/return
4512
4513 find-in-function-outputs:
4514
4515 55/push-ebp
4516 89/<- %ebp 4/r32/esp
4517
4518 51/push-ecx
4519
4520 8b/-> *(ebp+8) 1/r32/ecx
4521 8b/-> *(ecx+0xc) 1/r32/ecx
4522
4523 {
4524 81 7/subop/compare %ecx 0/imm32
4525 74/jump-if-= break/disp8
4526
4527 8b/-> *ecx 0/r32/eax
4528
4529 50/push-eax
4530 (string-equal? *eax *(ebp+0xc))
4531 3d/compare-eax-and 0/imm32/false
4532 58/pop-to-eax
4533 75/jump-if-!= $find-in-function-outputs:end/disp8
4534
4535 8b/-> *(ecx+4) 1/r32/ecx
4536 eb/jump loop/disp8
4537 }
4538 b8/copy-to-eax 0/imm32
4539 $find-in-function-outputs:end:
4540
4541 59/pop-to-ecx
4542
4543 89/<- %esp 5/r32/ebp
4544 5d/pop-to-ebp
4545 c3/return
4546
4547 test-parse-mu-stmt:
4548
4549 55/push-ebp
4550 89/<- %ebp 4/r32/esp
4551
4552 (clear-stream _test-input-stream)
4553 (write _test-input-stream "increment n\n")
4554
4555 81 5/subop/subtract %esp 0x10/imm32
4556 68/push 0x10/imm32/length
4557 68/push 0/imm32/top
4558 89/<- %ecx 4/r32/esp
4559 (clear-stack %ecx)
4560
4561 81 5/subop/subtract %esp 0x14/imm32
4562 89/<- %edx 4/r32/esp
4563 (zero-out %edx 0x14)
4564
4565 c7 0/subop/copy *edx "n"/imm32
4566
4567 (push %ecx %edx)
4568
4569 (parse-mu-stmt _test-input-stream %ecx)
4570
4571 (check-ints-equal *eax 1 "F - test-parse-mu-stmt/tag")
4572 (check-strings-equal *(eax+4) "increment" "F - test-parse-mu-stmt/name")
4573
4574 8b/-> *(eax+8) 2/r32/edx
4575
4576 8b/-> *edx 3/r32/ebx
4577 (check-strings-equal *ebx "n" "F - test-parse-mu-stmt/inout:0")
4578
4579 89/<- %esp 5/r32/ebp
4580 5d/pop-to-ebp
4581 c3/return
4582
4583 test-parse-mu-stmt-with-comma:
4584
4585 55/push-ebp
4586 89/<- %ebp 4/r32/esp
4587
4588 (clear-stream _test-input-stream)
4589 (write _test-input-stream "copy-to n, 3\n")
4590
4591 81 5/subop/subtract %esp 0x10/imm32
4592 68/push 0x10/imm32/length
4593 68/push 0/imm32/top
4594 89/<- %ecx 4/r32/esp
4595 (clear-stack %ecx)
4596
4597 81 5/subop/subtract %esp 0x14/imm32
4598 89/<- %edx 4/r32/esp
4599 (zero-out %edx 0x14)
4600
4601 c7 0/subop/copy *edx "n"/imm32
4602
4603 (push %ecx %edx)
4604
4605 (parse-mu-stmt _test-input-stream %ecx)
4606
4607 (check-ints-equal *eax 1 "F - test-parse-mu-stmt-with-comma/tag")
4608 (check-strings-equal *(eax+4) "copy-to" "F - test-parse-mu-stmt-with-comma/name")
4609
4610 8b/-> *(eax+8) 2/r32/edx
4611
4612 8b/-> *edx 3/r32/ebx
4613 (check-strings-equal *ebx "n" "F - test-parse-mu-stmt-with-comma/inout:0")
4614
4615 89/<- %esp 5/r32/ebp
4616 5d/pop-to-ebp
4617 c3/return
4618
4619 new-function:
4620
4621 55/push-ebp
4622 89/<- %ebp 4/r32/esp
4623
4624 51/push-ecx
4625
4626 (allocate *(ebp+8) *Function-size)
4627 8b/-> *(ebp+0xc) 1/r32/ecx
4628 89/<- *eax 1/r32/ecx
4629 8b/-> *(ebp+0x10) 1/r32/ecx
4630 89/<- *(eax+4) 1/r32/ecx
4631 8b/-> *(ebp+0x14) 1/r32/ecx
4632 89/<- *(eax+8) 1/r32/ecx
4633 8b/-> *(ebp+0x18) 1/r32/ecx
4634 89/<- *(eax+0xc) 1/r32/ecx
4635 8b/-> *(ebp+0x1c) 1/r32/ecx
4636 89/<- *(eax+0x10) 1/r32/ecx
4637 8b/-> *(ebp+0x20) 1/r32/ecx
4638 89/<- *(eax+0x14) 1/r32/ecx
4639 $new-function:end:
4640
4641 59/pop-to-ecx
4642
4643 89/<- %esp 5/r32/ebp
4644 5d/pop-to-ebp
4645 c3/return
4646
4647 new-var:
4648
4649 55/push-ebp
4650 89/<- %ebp 4/r32/esp
4651
4652 51/push-ecx
4653
4654 (allocate *(ebp+8) *Var-size)
4655 8b/-> *(ebp+0xc) 1/r32/ecx
4656 89/<- *eax 1/r32/ecx
4657 8b/-> *(ebp+0x10) 1/r32/ecx
4658 89/<- *(eax+4) 1/r32/ecx
4659 8b/-> *(ebp+0x14) 1/r32/ecx
4660 89/<- *(eax+8) 1/r32/ecx
4661 8b/-> *(ebp+0x18) 1/r32/ecx
4662 89/<- *(eax+0xc) 1/r32/ecx
4663 8b/-> *(ebp+0x1c) 1/r32/ecx
4664 89/<- *(eax+0x10) 1/r32/ecx
4665 $new-var:end:
4666
4667 59/pop-to-ecx
4668
4669 89/<- %esp 5/r32/ebp
4670 5d/pop-to-ebp
4671 c3/return
4672
4673 new-literal-integer:
4674
4675 55/push-ebp
4676 89/<- %ebp 4/r32/esp
4677
4678 51/push-ecx
4679
4680 (is-hex-int? *(ebp+0xc))
4681 3d/compare-eax-and 0/imm32/false
4682 0f 84/jump-if-= $new-literal-integer:abort/disp32
4683
4684 (slice-to-string Heap *(ebp+0xc))
4685 89/<- %ecx 0/r32/eax
4686
4687 (allocate *(ebp+8) *Var-size)
4688 (zero-out %eax *Var-size)
4689 89/<- *eax 1/r32/ecx
4690 89/<- %ecx 0/r32/eax
4691
4692 (allocate *(ebp+8) *Tree-size)
4693 (zero-out %eax *Tree-size)
4694 89/<- *(ecx+4) 0/r32/eax
4695
4696 89/<- %eax 1/r32/ecx
4697 $new-literal-integer:end:
4698
4699 59/pop-to-ecx
4700
4701 89/<- %esp 5/r32/ebp
4702 5d/pop-to-ebp
4703 c3/return
4704
4705 $new-literal-integer:abort:
4706 (write-buffered Stderr "variable cannot begin with a digit '")
4707 (write-slice-buffered Stderr *(ebp+0xc))
4708 (write-buffered Stderr "'\n")
4709 (flush Stderr)
4710
4711 bb/copy-to-ebx 1/imm32
4712 b8/copy-to-eax 1/imm32/exit
4713 cd/syscall 0x80/imm8
4714
4715
4716 new-literal:
4717
4718 55/push-ebp
4719 89/<- %ebp 4/r32/esp
4720
4721 51/push-ecx
4722
4723 (slice-to-string Heap *(ebp+0xc))
4724 89/<- %ecx 0/r32/eax
4725
4726 (allocate *(ebp+8) *Tree-size)
4727 (zero-out %eax *Tree-size)
4728
4729 (new-var *(ebp+8) %ecx %eax *Curr-block-depth 0 0)
4730 $new-literal:end:
4731
4732 59/pop-to-ecx
4733
4734 89/<- %esp 5/r32/ebp
4735 5d/pop-to-ebp
4736 c3/return
4737
4738 new-label:
4739
4740 55/push-ebp
4741 89/<- %ebp 4/r32/esp
4742
4743 51/push-ecx
4744
4745 (slice-to-string Heap *(ebp+0xc))
4746 89/<- %ecx 0/r32/eax
4747
4748 (allocate *(ebp+8) *Var-size)
4749 89/<- *eax 1/r32/ecx
4750 89/<- %ecx 0/r32/eax
4751 (allocate *(ebp+8) *Tree-size)
4752 (zero-out %eax *Tree-size)
4753 89/<- *(ecx+4) 0/r32/eax
4754 89/<- %eax 1/r32/ecx
4755 c7 0/subop/copy *(eax+8) 0/imm32
4756 c7 0/subop/copy *(eax+0xc) 0/imm32
4757 c7 0/subop/copy *(eax+0x10) 0/imm32
4758 $new-label:end:
4759
4760 59/pop-to-ecx
4761
4762 89/<- %esp 5/r32/ebp
4763 5d/pop-to-ebp
4764 c3/return
4765
4766 new-block:
4767
4768 55/push-ebp
4769 89/<- %ebp 4/r32/esp
4770
4771 51/push-ecx
4772
4773 (allocate *(ebp+8) *Stmt-size)
4774 (zero-out %eax *Stmt-size)
4775 c7 0/subop/copy *eax 0/imm32/tag/block
4776 8b/-> *(ebp+0xc) 1/r32/ecx
4777 89/<- *(eax+4) 1/r32/ecx
4778 $new-block:end:
4779
4780 59/pop-to-ecx
4781
4782 89/<- %esp 5/r32/ebp
4783 5d/pop-to-ebp
4784 c3/return
4785
4786 new-var-def:
4787
4788 55/push-ebp
4789 89/<- %ebp 4/r32/esp
4790
4791 51/push-ecx
4792
4793 (allocate *(ebp+8) *Stmt-size)
4794 (zero-out %eax *Stmt-size)
4795 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack
4796
4797 8b/-> *(ebp+0xc) 1/r32/ecx
4798 89/<- *(eax+4) 1/r32/ecx
4799 $new-var-def:end:
4800
4801 59/pop-to-ecx
4802
4803 89/<- %esp 5/r32/ebp
4804 5d/pop-to-ebp
4805 c3/return
4806
4807 new-reg-var-def:
4808
4809 55/push-ebp
4810 89/<- %ebp 4/r32/esp
4811
4812 51/push-ecx
4813 57/push-edi
4814
4815 8b/-> *(ebp+0xc) 1/r32/ecx
4816
4817 (allocate *(ebp+8) *Stmt-size)
4818 89/<- %edi 0/r32/eax
4819 (zero-out %edi *Stmt-size)
4820
4821 c7 0/subop/copy *edi 3/imm32/tag/var-in-register
4822
4823 (append-stmt-var Heap %ecx *(edi+0xc) 0)
4824 89/<- *(edi+0xc) 0/r32/eax
4825 $new-reg-var-def:end:
4826 89/<- %eax 7/r32/edi
4827
4828 5f/pop-to-edi
4829 59/pop-to-ecx
4830
4831 89/<- %esp 5/r32/ebp
4832 5d/pop-to-ebp
4833 c3/return
4834
4835 append-list:
4836
4837 55/push-ebp
4838 89/<- %ebp 4/r32/esp
4839
4840 51/push-ecx
4841
4842 (allocate *(ebp+8) *List-size)
4843 (zero-out %eax *List-size)
4844 8b/-> *(ebp+0xc) 1/r32/ecx
4845 89/<- *eax 1/r32/ecx
4846
4847 81 7/subop/compare *(ebp+0x10) 0/imm32
4848 74/jump-if-= $append-list:end/disp8
4849
4850
4851 8b/-> *(ebp+0x10) 1/r32/ecx
4852
4853 {
4854 81 7/subop/compare *(ecx+4) 0/imm32
4855 74/jump-if-= break/disp8
4856
4857 8b/-> *(ecx+4) 1/r32/ecx
4858 eb/jump loop/disp8
4859 }
4860
4861 89/<- *(ecx+4) 0/r32/eax
4862
4863 8b/-> *(ebp+0x10) 0/r32/eax
4864 $append-list:end:
4865
4866 59/pop-to-ecx
4867
4868 89/<- %esp 5/r32/ebp
4869 5d/pop-to-ebp
4870 c3/return
4871
4872 append-stmt-var:
4873
4874 55/push-ebp
4875 89/<- %ebp 4/r32/esp
4876
4877 51/push-ecx
4878
4879 (allocate *(ebp+8) *Stmt-var-size)
4880 (zero-out %eax *Stmt-var-size)
4881 8b/-> *(ebp+0xc) 1/r32/ecx
4882 89/<- *eax 1/r32/ecx
4883 8b/-> *(ebp+0x14) 1/r32/ecx
4884 89/<- *(eax+8) 1/r32/ecx
4885
4886 81 7/subop/compare *(ebp+0x10) 0/imm32
4887 74/jump-if-= $append-stmt-var:end/disp8
4888
4889
4890 8b/-> *(ebp+0x10) 1/r32/ecx
4891
4892 {
4893 81 7/subop/compare *(ecx+4) 0/imm32
4894 74/jump-if-= break/disp8
4895
4896 8b/-> *(ecx+4) 1/r32/ecx
4897 eb/jump loop/disp8
4898 }
4899
4900 89/<- *(ecx+4) 0/r32/eax
4901
4902 8b/-> *(ebp+0x10) 0/r32/eax
4903 $append-stmt-var:end:
4904
4905 59/pop-to-ecx
4906
4907 89/<- %esp 5/r32/ebp
4908 5d/pop-to-ebp
4909 c3/return
4910
4911 append-to-block:
4912
4913 55/push-ebp
4914 89/<- %ebp 4/r32/esp
4915
4916 56/push-esi
4917
4918 8b/-> *(ebp+0xc) 6/r32/esi
4919 (append-list *(ebp+8) *(ebp+0x10) *(esi+4))
4920 89/<- *(esi+4) 0/r32/eax
4921 $append-to-block:end:
4922
4923 5e/pop-to-esi
4924
4925 89/<- %esp 5/r32/ebp
4926 5d/pop-to-ebp
4927 c3/return
4928
4929
4930
4931
4932
4933
4934
4935 lookup-or-create-constant:
4936
4937 55/push-ebp
4938 89/<- %ebp 4/r32/esp
4939
4940 56/push-esi
4941
4942 (container-type *(ebp+8))
4943
4944
4945
4946
4947 89/<- %esi 0/r32/eax
4948
4949 (find-or-create-typeinfo %esi)
4950
4951
4952
4953
4954
4955 (find-or-create-typeinfo-constant %eax *(ebp+0xc))
4956 $lookup-or-create-constant:end:
4957
4958 5e/pop-to-esi
4959
4960 89/<- %esp 5/r32/ebp
4961 5d/pop-to-ebp
4962 c3/return
4963
4964
4965 container-type:
4966
4967 55/push-ebp
4968 89/<- %ebp 4/r32/esp
4969
4970 8b/-> *(ebp+8) 0/r32/eax
4971 8b/-> *eax 0/r32/eax
4972 8b/-> *(eax+4) 0/r32/eax
4973 8b/-> *(eax+4) 0/r32/eax
4974 8b/-> *eax 0/r32/eax
4975 8b/-> *eax 0/r32/eax
4976 $container-type:end:
4977
4978 89/<- %esp 5/r32/ebp
4979 5d/pop-to-ebp
4980 c3/return
4981
4982 find-or-create-typeinfo:
4983
4984 55/push-ebp
4985 89/<- %ebp 4/r32/esp
4986
4987 51/push-ecx
4988
4989 (find-typeinfo *(ebp+8))
4990 {
4991
4992 3d/compare-eax-and 0/imm32
4993 75/jump-if-!= break/disp8
4994 $find-or-create-typeinfo:create:
4995 (allocate Heap *Typeinfo-size)
4996 (zero-out %eax *Typeinfo-size)
4997
4998 8b/-> *(ebp+8) 1/r32/ecx
4999 89/<- *eax 1/r32/ecx
5000
5001 50/push-eax
5002 (new-stream Heap 0x40 0xc)
5003 89/<- %ecx 0/r32/eax
5004 58/pop-to-eax
5005 89/<- *(eax+4) 1/r32/ecx
5006
5007 8b/-> *_Program-types 1/r32/ecx
5008 89/<- *(eax+0xc) 1/r32/ecx
5009
5010 89/<- *_Program-types 0/r32/eax
5011 }
5012 $find-or-create-typeinfo:end:
5013
5014 59/pop-to-ecx
5015
5016 89/<- %esp 5/r32/ebp
5017 5d/pop-to-ebp
5018 c3/return
5019
5020 find-typeinfo:
5021
5022 55/push-ebp
5023 89/<- %ebp 4/r32/esp
5024
5025 51/push-ecx
5026
5027 8b/-> *(ebp+8) 1/r32/ecx
5028
5029 8b/-> *_Program-types 0/r32/eax
5030 {
5031
5032 3d/compare-eax-and 0/imm32
5033 74/jump-if-= break/disp8
5034
5035 39/compare *eax 1/r32/ecx
5036 0f 84/jump-if-= $find-or-create-typeinfo:end/disp32
5037
5038 8b/-> *(eax+0xc) 0/r32/eax
5039
5040 eb/jump loop/disp8
5041 }
5042 $find-typeinfo:end:
5043
5044 59/pop-to-ecx
5045
5046 89/<- %esp 5/r32/ebp
5047 5d/pop-to-ebp
5048 c3/return
5049
5050 find-or-create-typeinfo-constant:
5051
5052 55/push-ebp
5053 89/<- %ebp 4/r32/esp
5054
5055 51/push-ecx
5056 56/push-esi
5057
5058 8b/-> *(ebp+8) 6/r32/esi
5059 8b/-> *(esi+4) 6/r32/esi
5060
5061 (leaky-get-or-insert-slice %esi *(ebp+0xc) 0xc)
5062 89/<- %esi 0/r32/eax
5063
5064 81 7/subop/compare *(esi+4) 0/imm32
5065 8b/-> *(esi+4) 0/r32/eax
5066 75/jump-if-!= $find-or-create-typeinfo-constant:end/disp8
5067
5068 (allocate Heap *Tree-size)
5069 c7 0/subop/copy *eax 6/imm32/constant
5070 c7 0/subop/copy *(eax+4) 0/imm32
5071 (new-var Heap "field" %eax 0 -1 0)
5072
5073
5074 89/<- *(esi+4) 0/r32/eax
5075 $find-or-create-typeinfo-constant:end:
5076
5077 5e/pop-to-esi
5078 59/pop-to-ecx
5079
5080 89/<- %esp 5/r32/ebp
5081 5d/pop-to-ebp
5082 c3/return
5083
5084 populate-mu-type:
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109 55/push-ebp
5110 89/<- %ebp 4/r32/esp
5111
5112 50/push-eax
5113 51/push-ecx
5114 52/push-edx
5115 53/push-ebx
5116 56/push-esi
5117 57/push-edi
5118
5119 8b/-> *(ebp+0xc) 7/r32/edi
5120
5121 81 5/subop/subtract %esp 0x200/imm32
5122 68/push 0x200/imm32/length
5123 68/push 0/imm32/read
5124 68/push 0/imm32/write
5125 89/<- %ecx 4/r32/esp
5126
5127 68/push 0/imm32/end
5128 68/push 0/imm32/start
5129 89/<- %edx 4/r32/esp
5130
5131 bb/copy-to-ebx 0/imm32
5132 {
5133 $populate-mu-type:line-loop:
5134 (clear-stream %ecx)
5135 (read-line-buffered *(ebp+8) %ecx)
5136
5137 81 7/subop/compare *ecx 0/imm32
5138 0f 84/jump-if-= $populate-mu-type:abort/disp32
5139 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------
5145 (next-mu-token %ecx %edx)
5146
5147 (slice-empty? %edx)
5148 3d/compare-eax-and 0/imm32
5149 0f 85/jump-if-!= loop/disp32
5150
5151 (slice-equal? %edx "}")
5152 3d/compare-eax-and 0/imm32
5153 0f 85/jump-if-!= break/disp32
5154
5155 (parse-var-with-type %edx %ecx)
5156
5157
5158
5159
5160
5161
5162 89/<- %esi 0/r32/eax
5163
5164
5165
5166
5167
5168 (get-or-insert *(edi+4) *esi 0xc)
5169
5170 89/<- *eax 6/r32/esi
5171
5172 {
5173 81 7/subop/compare *(eax+4) 0/imm32
5174 75/jump-if-!= break/disp8
5175
5176 89/<- %esi 0/r32/eax
5177 (new-literal Heap %edx)
5178 89/<- *(esi+4) 0/r32/eax
5179 89/<- %eax 6/r32/esi
5180
5181
5182
5183
5184 }
5185
5186 8b/-> *(eax+4) 0/r32/eax
5187
5188
5189
5190
5191
5192
5193 89/<- *(eax+0xc) 3/r32/ebx
5194
5195
5196
5197 50/push-eax
5198 (size-of %esi)
5199
5200
5201
5202
5203 01/add-to %ebx 0/r32/eax
5204 58/pop-to-eax
5205
5206 e9/jump loop/disp32
5207 }
5208
5209 89/<- *(edi+8) 3/r32/ebx
5210 $populate-mu-type:end:
5211
5212 81 0/subop/add %esp 0x214/imm32
5213
5214 5f/pop-to-edi
5215 5e/pop-to-esi
5216 5b/pop-to-ebx
5217 5a/pop-to-edx
5218 59/pop-to-ecx
5219 58/pop-to-eax
5220
5221 89/<- %esp 5/r32/ebp
5222 5d/pop-to-ebp
5223 c3/return
5224
5225 $populate-mu-type:abort:
5226
5227 (write-buffered Stderr "incomplete type definition '")
5228 (type-name *edi)
5229 (write-buffered Stderr %eax)
5230 (write-buffered Stderr "\n")
5231 (flush Stderr)
5232
5233 bb/copy-to-ebx 1/imm32
5234 b8/copy-to-eax 1/imm32/exit
5235 cd/syscall 0x80/imm8
5236
5237
5238 type-name:
5239
5240 55/push-ebp
5241 89/<- %ebp 4/r32/esp
5242
5243 (index Type-id *(ebp+8))
5244 $type-name:end:
5245
5246 89/<- %esp 5/r32/ebp
5247 5d/pop-to-ebp
5248 c3/return
5249
5250 index:
5251
5252 55/push-ebp
5253 89/<- %ebp 4/r32/esp
5254
5255 56/push-esi
5256
5257
5258 8b/-> *(ebp+8) 6/r32/esi
5259
5260 8b/-> *(ebp+0xc) 0/r32/eax
5261
5262 8b/-> *(esi+eax+0xc) 0/r32/eax
5263 $index:end:
5264
5265 5e/pop-to-esi
5266
5267 89/<- %esp 5/r32/ebp
5268 5d/pop-to-ebp
5269 c3/return
5270
5271
5272
5273
5274
5275 check-mu-types:
5276
5277 55/push-ebp
5278 89/<- %ebp 4/r32/esp
5279
5280 $check-mu-types:end:
5281
5282 89/<- %esp 5/r32/ebp
5283 5d/pop-to-ebp
5284 c3/return
5285
5286 size-of:
5287
5288 55/push-ebp
5289 89/<- %ebp 4/r32/esp
5290
5291 51/push-ecx
5292
5293 8b/-> *(ebp+8) 1/r32/ecx
5294 8b/-> *(ecx+4) 1/r32/ecx
5295
5296 81 7/subop/compare *ecx 0/imm32
5297 b8/copy-to-eax 0/imm32
5298 74/jump-if-= $size-of:end/disp8
5299
5300
5301 (find-typeinfo *ecx)
5302 {
5303 3d/compare-eax-and 0/imm32
5304 74/jump-if-= break/disp8
5305 8b/-> *(eax+8) 0/r32/eax
5306 eb/jump $size-of:end/disp8
5307 }
5308
5309 b8/copy-to-eax 4/imm32
5310 $size-of:end:
5311
5312 59/pop-to-ecx
5313
5314 89/<- %esp 5/r32/ebp
5315 5d/pop-to-ebp
5316 c3/return
5317
5318 type-equal?:
5319
5320 55/push-ebp
5321 89/<- %ebp 4/r32/esp
5322
5323 51/push-ecx
5324 52/push-edx
5325
5326 8b/-> *(ebp+8) 1/r32/ecx
5327
5328 8b/-> *(ebp+0xc) 2/r32/edx
5329
5330 8b/-> %ecx 0/r32/eax
5331 39/compare %edx 0/r32/eax
5332 b8/copy-to-eax 1/imm32/true
5333 74/jump-if-= $type-equal?:end/disp8
5334
5335 81 7/subop/compare %ecx 0x10000/imm32
5336 b8/copy-to-eax 0/imm32/false
5337 72/jump-if-addr< $type-equal?:end/disp8
5338
5339 81 7/subop/compare %edx 0x10000/imm32
5340 b8/copy-to-eax 0/imm32/false
5341 72/jump-if-addr< $type-equal?:end/disp8
5342
5343 (type-equal? *ecx *edx)
5344 3d/compare-eax-and 0/imm32/false
5345 74/jump-if-= $type-equal?:end/disp8
5346
5347 (type-equal? *(ecx+4) *(edx+4))
5348 $type-equal?:end:
5349
5350 5a/pop-to-edx
5351 59/pop-to-ecx
5352
5353 89/<- %esp 5/r32/ebp
5354 5d/pop-to-ebp
5355 c3/return
5356
5357 == data
5358
5359
5360 Type-size:
5361 0x18/imm32/write
5362 0/imm32/read
5363 0x100/imm32/length
5364
5365 4/imm32
5366 4/imm32
5367 4/imm32
5368 0/imm32
5369 8/imm32
5370 4/imm32
5371 0/imm32
5372 0/imm32
5373
5374 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
5375 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
5376 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
5377 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
5378 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
5379 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
5380 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
5381
5382 == code
5383
5384
5385
5386
5387
5388 emit-subx:
5389
5390 55/push-ebp
5391 89/<- %ebp 4/r32/esp
5392
5393 50/push-eax
5394 51/push-ecx
5395 57/push-edi
5396
5397 8b/-> *(ebp+8) 7/r32/edi
5398
5399 8b/-> *_Program-functions 1/r32/ecx
5400 {
5401
5402 81 7/subop/compare %ecx 0/imm32
5403 0f 84/jump-if-= break/disp32
5404 (emit-subx-function %edi %ecx)
5405
5406 8b/-> *(ecx+0x14) 1/r32/ecx
5407 e9/jump loop/disp32
5408 }
5409 $emit-subx:end:
5410
5411 5f/pop-to-edi
5412 59/pop-to-ecx
5413 58/pop-to-eax
5414
5415 89/<- %esp 5/r32/ebp
5416 5d/pop-to-ebp
5417 c3/return
5418
5419 emit-subx-function:
5420
5421 55/push-ebp
5422 89/<- %ebp 4/r32/esp
5423
5424 50/push-eax
5425 51/push-ecx
5426 52/push-edx
5427 57/push-edi
5428
5429 8b/-> *(ebp+8) 7/r32/edi
5430
5431 8b/-> *(ebp+0xc) 1/r32/ecx
5432
5433 81 5/subop/subtract %esp 0x400/imm32
5434 68/push 0x400/imm32/length
5435 68/push 0/imm32/top
5436 89/<- %edx 4/r32/esp
5437
5438 (write-buffered %edi *ecx)
5439 (write-buffered %edi ":\n")
5440
5441
5442 c7 0/subop/copy *Curr-block-depth 1/imm32
5443 (emit-subx-prologue %edi)
5444 (emit-subx-block %edi *(ecx+0x10) %edx)
5445 (emit-subx-epilogue %edi)
5446 $emit-subx-function:end:
5447
5448 81 0/subop/add %esp 408/imm32
5449
5450 5f/pop-to-edi
5451 5a/pop-to-edx
5452 59/pop-to-ecx
5453 58/pop-to-eax
5454
5455 89/<- %esp 5/r32/ebp
5456 5d/pop-to-ebp
5457 c3/return
5458
5459 emit-subx-stmt-list:
5460
5461 55/push-ebp
5462 89/<- %ebp 4/r32/esp
5463
5464 50/push-eax
5465 51/push-ecx
5466 52/push-edx
5467 53/push-ebx
5468 56/push-esi
5469
5470 8b/-> *(ebp+0xc) 6/r32/esi
5471
5472 ba/copy-to-edx 0/imm32/false
5473
5474 {
5475 $emit-subx-stmt-list:loop:
5476 81 7/subop/compare %esi 0/imm32
5477 0f 84/jump-if-= break/disp32
5478
5479 8b/-> *esi 1/r32/ecx
5480 {
5481 $emit-subx-stmt-list:check-for-block:
5482 81 7/subop/compare *ecx 0/imm32/block
5483 75/jump-if-!= break/disp8
5484 $emit-subx-stmt-list:block:
5485 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10))
5486 }
5487 {
5488 $emit-subx-stmt-list:check-for-stmt:
5489 81 7/subop/compare *ecx 1/imm32/stmt1
5490 0f 85/jump-if-!= break/disp32
5491 $emit-subx-stmt-list:stmt1:
5492 {
5493 (is-mu-branch? %ecx)
5494 3d/compare-eax-and 0/imm32/false
5495 0f 84/jump-if-= break/disp32
5496 $emit-subx-stmt-list:branch-stmt:
5497
5498 81 7/subop/compare %edx 0/imm32/false
5499 0f 84/jump-if-= break/disp32
5500 $emit-subx-stmt-list:branch-stmt-and-var-seen:
5501 +-- 26 lines: # unconditional loops -----------------------------------------------------------------------------------------------------------------------------------------------------
5527 +-- 15 lines: # unconditional breaks ----------------------------------------------------------------------------------------------------------------------------------------------------
5542 +-- 37 lines: # simple conditional branches without a target ----------------------------------------------------------------------------------------------------------------------------
5579 +-- 19 lines: # conditional branches with an explicit target ----------------------------------------------------------------------------------------------------------------------------
5598 }
5599 $emit-subx-stmt-list:1-to-1:
5600 (emit-subx-stmt *(ebp+8) %ecx Primitives *_Program-functions)
5601 }
5602 {
5603 $emit-subx-stmt-list:check-for-var-def:
5604 81 7/subop/compare *ecx 2/imm32/var-def
5605 75/jump-if-!= break/disp8
5606 $emit-subx-stmt-list:var-def:
5607 (emit-subx-var-def *(ebp+8) %ecx)
5608 (push *(ebp+0x10) *(ecx+4))
5609
5610 ba/copy-to-edx 1/imm32/true
5611 }
5612 {
5613 $emit-subx-stmt-list:check-for-reg-var-def:
5614 81 7/subop/compare *ecx 3/imm32/reg-var-def
5615 0f 85/jump-if-!= break/disp32
5616 $emit-subx-stmt-list:reg-var-def:
5617
5618
5619 8b/-> *(ecx+0xc) 0/r32/eax
5620 8b/-> *eax 0/r32/eax
5621
5622 81 7/subop/compare *(eax+0x10) 0/imm32
5623 0f 84/jump-if-= $emit-subx-stmt-list:abort-reg-var-def-without-register/disp32
5624
5625 (emit-indent *(ebp+8) *Curr-block-depth)
5626 (write-buffered *(ebp+8) "ff 6/subop/push %")
5627 (write-buffered *(ebp+8) *(eax+0x10))
5628 (write-buffered *(ebp+8) Newline)
5629
5630 (push *(ebp+0x10) %eax)
5631
5632 (emit-subx-stmt *(ebp+8) %ecx Primitives *_Program-functions)
5633
5634 ba/copy-to-edx 1/imm32/true
5635 }
5636 $emit-subx-stmt-list:continue:
5637
5638 8b/-> *(esi+4) 6/r32/esi
5639 e9/jump loop/disp32
5640 }
5641 $emit-subx-stmt-list:emit-cleanup:
5642 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth)
5643 $emit-subx-stmt-list:cleanup:
5644 (clean-up-blocks *(ebp+0x10) *Curr-block-depth)
5645 $emit-subx-stmt-list:end:
5646
5647 5e/pop-to-esi
5648 5b/pop-to-ebx
5649 5a/pop-to-edx
5650 59/pop-to-ecx
5651 58/pop-to-eax
5652
5653 89/<- %esp 5/r32/ebp
5654 5d/pop-to-ebp
5655 c3/return
5656
5657 $emit-subx-stmt-list:abort-reg-var-def-without-register:
5658
5659 (write-buffered Stderr "var '")
5660 (write-buffered Stderr *eax)
5661 (write-buffered Stderr "' initialized from an instruction must live in a register\n")
5662 (flush Stderr)
5663
5664 bb/copy-to-ebx 1/imm32
5665 b8/copy-to-eax 1/imm32/exit
5666 cd/syscall 0x80/imm8
5667
5668
5669 emit-subx-cleanup-and-unconditional-nonlocal-branch:
5670
5671 55/push-ebp
5672 89/<- %ebp 4/r32/esp
5673
5674 50/push-eax
5675 51/push-ecx
5676 52/push-edx
5677
5678 8b/-> *(ebp+0xc) 1/r32/ecx
5679
5680 8b/-> *(ecx+8) 2/r32/edx
5681 8b/-> *edx 2/r32/edx
5682 8b/-> *edx 2/r32/edx
5683
5684 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %edx)
5685
5686 (emit-indent *(ebp+8) *Curr-block-depth)
5687 (write-buffered *(ebp+8) "e9/jump ")
5688 (write-buffered *(ebp+8) %edx)
5689 (string-starts-with? *(ecx+4) "break")
5690 3d/compare-eax-and 0/imm32/false
5691 {
5692 74/jump-if-= break/disp8
5693 (write-buffered *(ebp+8) ":break/disp32\n")
5694 }
5695 3d/compare-eax-and 0/imm32/false
5696 {
5697 75/jump-if-!= break/disp8
5698 (write-buffered *(ebp+8) ":loop/disp32\n")
5699 }
5700 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end:
5701
5702 5a/pop-to-edx
5703 59/pop-to-ecx
5704 58/pop-to-eax
5705
5706 89/<- %esp 5/r32/ebp
5707 5d/pop-to-ebp
5708 c3/return
5709
5710 is-mu-branch?:
5711
5712 55/push-ebp
5713 89/<- %ebp 4/r32/esp
5714
5715 51/push-ecx
5716
5717 8b/-> *(ebp+8) 1/r32/ecx
5718
5719 (string-starts-with? *(ecx+4) "loop")
5720 3d/compare-eax-and 0/imm32/false
5721 75/jump-if-not-equal $is-mu-branch?:end/disp8
5722
5723 (string-starts-with? *(ecx+4) "break")
5724 $is-mu-branch?:end:
5725
5726 59/pop-to-ecx
5727
5728 89/<- %esp 5/r32/ebp
5729 5d/pop-to-ebp
5730 c3/return
5731
5732 emit-reverse-break:
5733
5734 55/push-ebp
5735 89/<- %ebp 4/r32/esp
5736
5737 50/push-eax
5738
5739 8b/-> *(ebp+0xc) 0/r32/eax
5740
5741 (get Reverse-branch *(eax+4) 8 "reverse-branch: ")
5742 (emit-indent *(ebp+8) *Curr-block-depth)
5743 (write-buffered *(ebp+8) *eax)
5744 (write-buffered *(ebp+8) " break/disp32\n")
5745 $emit-reverse-break:end:
5746
5747 58/pop-to-eax
5748
5749 89/<- %esp 5/r32/ebp
5750 5d/pop-to-ebp
5751 c3/return
5752
5753 == data
5754
5755 Reverse-branch:
5756
5757 0xa0/imm32/write
5758 0/imm32/read
5759 0xa0/imm32/length
5760
5761 "break-if-="/imm32 "0f 85/jump-if-!="/imm32
5762 "loop-if-="/imm32 "0f 85/jump-if-!="/imm32
5763 "break-if-!="/imm32 "0f 84/jump-if-="/imm32
5764 "loop-if-!="/imm32 "0f 84/jump-if-="/imm32
5765 "break-if-<"/imm32 "0f 8d/jump-if->="/imm32
5766 "loop-if-<"/imm32 "0f 8d/jump-if->="/imm32
5767 "break-if->"/imm32 "0f 8e/jump-if-<="/imm32
5768 "loop-if->"/imm32 "0f 8e/jump-if-<="/imm32
5769 "break-if-<="/imm32 "0f 87/jump-if->"/imm32
5770 "loop-if-<="/imm32 "0f 87/jump-if->"/imm32
5771 "break-if->="/imm32 "0f 8c/jump-if-<"/imm32
5772 "loop-if->="/imm32 "0f 8c/jump-if-<"/imm32
5773 "break-if-addr<"/imm32 "0f 83/jump-if-addr>="/imm32
5774 "loop-if-addr<"/imm32 "0f 83/jump-if-addr>="/imm32
5775 "break-if-addr>"/imm32 "0f 86/jump-if-addr<="/imm32
5776 "loop-if-addr>"/imm32 "0f 86/jump-if-addr<="/imm32
5777 "break-if-addr<="/imm32 "0f 87/jump-if-addr>"/imm32
5778 "loop-if-addr<="/imm32 "0f 87/jump-if-addr>"/imm32
5779 "break-if-addr>="/imm32 "0f 82/jump-if-addr<"/imm32
5780 "loop-if-addr>="/imm32 "0f 82/jump-if-addr<"/imm32
5781
5782 == code
5783
5784 emit-unconditional-jump-to-depth:
5785
5786 55/push-ebp
5787 89/<- %ebp 4/r32/esp
5788
5789 50/push-eax
5790 51/push-ecx
5791 52/push-edx
5792 53/push-ebx
5793
5794 8b/-> *(ebp+0xc) 1/r32/ecx
5795
5796 8b/-> *ecx 0/r32/eax
5797
5798 81 0/subop/add %ecx 8/imm32
5799
5800 81 5/subop/subtract %eax 4/imm32
5801 8d/copy-address *(ecx+eax) 0/r32/eax
5802
5803 8b/-> *(ebp+0x10) 2/r32/edx
5804 {
5805 $emit-unconditional-jump-to-depth:loop:
5806
5807 39/compare %eax 1/r32/ecx
5808 0f 82/jump-if-addr< break/disp32
5809
5810 8b/-> *eax 3/r32/ebx
5811
5812 39/compare *(ebx+8) 2/r32/edx
5813 0f 8c/jump-if-< break/disp32
5814 {
5815 $emit-unconditional-jump-to-depth:check:
5816
5817 39/compare *(ebx+8) 2/r32/edx
5818 0f 85/jump-if-!= break/disp32
5819 $emit-unconditional-jump-to-depth:depth-found:
5820
5821
5822 50/push-eax
5823 (size-of %ebx)
5824
5825 3d/compare-eax-and 0/imm32
5826 58/pop-to-eax
5827
5828 0f 85/jump-if-!= break/disp32
5829 $emit-unconditional-jump-to-depth:label-found:
5830
5831 (emit-indent *(ebp+8) *Curr-block-depth)
5832 (write-buffered *(ebp+8) "e9/jump ")
5833 (write-buffered *(ebp+8) *ebx)
5834 (write-buffered *(ebp+8) ":")
5835 (write-buffered *(ebp+8) *(ebp+0x14))
5836 (write-buffered *(ebp+8) "/disp32\n")
5837 eb/jump $emit-unconditional-jump-to-depth:end/disp8
5838 }
5839
5840 2d/subtract-from-eax 4/imm32
5841 e9/jump loop/disp32
5842 }
5843
5844 $emit-unconditional-jump-to-depth:end:
5845
5846 5b/pop-to-ebx
5847 5a/pop-to-edx
5848 59/pop-to-ecx
5849 58/pop-to-eax
5850
5851 89/<- %esp 5/r32/ebp
5852 5d/pop-to-ebp
5853 c3/return
5854
5855
5856
5857 emit-cleanup-code-until-depth:
5858
5859 55/push-ebp
5860 89/<- %ebp 4/r32/esp
5861
5862 50/push-eax
5863 51/push-ecx
5864 52/push-edx
5865 53/push-ebx
5866
5867 8b/-> *(ebp+0xc) 1/r32/ecx
5868
5869 8b/-> *ecx 0/r32/eax
5870
5871 81 0/subop/add %ecx 8/imm32
5872
5873 81 5/subop/subtract %eax 4/imm32
5874 8d/copy-address *(ecx+eax) 0/r32/eax
5875
5876 8b/-> *(ebp+0x10) 2/r32/edx
5877 {
5878 $emit-cleanup-code-until-depth:loop:
5879
5880 39/compare %eax 1/r32/ecx
5881 0f 82/jump-if-addr< break/disp32
5882
5883 8b/-> *eax 3/r32/ebx
5884
5885 39/compare *(ebx+8) 2/r32/edx
5886 0f 8c/jump-if-< break/disp32
5887
5888 81 7/subop/compare *(ebx+0x10) 0/imm32
5889 {
5890 74/jump-if-= break/disp8
5891 $emit-cleanup-code-until-depth:reclaim-var-in-register:
5892 (emit-indent *(ebp+8) *Curr-block-depth)
5893 (write-buffered *(ebp+8) "8f 0/subop/pop %")
5894 (write-buffered *(ebp+8) *(ebx+0x10))
5895 (write-buffered *(ebp+8) Newline)
5896 }
5897
5898 {
5899 75/jump-if-!= break/disp8
5900 $emit-cleanup-code-until-depth:reclaim-var-on-stack:
5901 50/push-eax
5902 (size-of %ebx)
5903
5904 3d/compare-eax-and 0/imm32
5905 74/jump-if-= break/disp8
5906
5907 (emit-indent *(ebp+8) *Curr-block-depth)
5908 (write-buffered *(ebp+8) "81 0/subop/add %esp ")
5909 (print-int32-buffered *(ebp+8) %eax)
5910 (write-buffered *(ebp+8) "/imm32\n")
5911 58/pop-to-eax
5912 }
5913
5914 2d/subtract-from-eax 4/imm32
5915 e9/jump loop/disp32
5916 }
5917 $emit-cleanup-code-until-depth:end:
5918
5919 5b/pop-to-ebx
5920 5a/pop-to-edx
5921 59/pop-to-ecx
5922 58/pop-to-eax
5923
5924 89/<- %esp 5/r32/ebp
5925 5d/pop-to-ebp
5926 c3/return
5927
5928
5929
5930 emit-cleanup-code-until-target:
5931
5932 55/push-ebp
5933 89/<- %ebp 4/r32/esp
5934
5935 50/push-eax
5936 51/push-ecx
5937 52/push-edx
5938 53/push-ebx
5939
5940 8b/-> *(ebp+0xc) 1/r32/ecx
5941
5942 8b/-> *ecx 0/r32/eax
5943
5944 81 0/subop/add %ecx 8/imm32
5945
5946 81 5/subop/subtract %eax 4/imm32
5947 8d/copy-address *(ecx+eax) 2/r32/edx
5948 {
5949 $emit-cleanup-code-until-target:loop:
5950
5951 39/compare %edx 1/r32/ecx
5952 0f 82/jump-if-addr< break/disp32
5953
5954 8b/-> *edx 3/r32/ebx
5955
5956 (string-equal? *ebx *(ebp+0x10))
5957 3d/compare-eax-and 0/imm32/false
5958 0f 85/jump-if-!= break/disp32
5959
5960 81 7/subop/compare *(ebx+0x10) 0/imm32
5961 {
5962 74/jump-if-= break/disp8
5963 $emit-cleanup-code-until-target:reclaim-var-in-register:
5964 (emit-indent *(ebp+8) *Curr-block-depth)
5965 (write-buffered *(ebp+8) "8f 0/subop/pop %")
5966 (write-buffered *(ebp+8) *(ebx+0x10))
5967 (write-buffered *(ebp+8) Newline)
5968 }
5969
5970 {
5971 75/jump-if-!= break/disp8
5972 $emit-cleanup-code-until-target:reclaim-var-on-stack:
5973 (size-of %ebx)
5974
5975 3d/compare-eax-and 0/imm32
5976 74/jump-if-= break/disp8
5977
5978 (emit-indent *(ebp+8) *Curr-block-depth)
5979 (write-buffered *(ebp+8) "81 0/subop/add %esp ")
5980 (print-int32-buffered *(ebp+8) %eax)
5981 (write-buffered *(ebp+8) "/imm32\n")
5982 }
5983
5984 81 5/subop/subtract %edx 4/imm32
5985 e9/jump loop/disp32
5986 }
5987 $emit-cleanup-code-until-target:end:
5988
5989 5b/pop-to-ebx
5990 5a/pop-to-edx
5991 59/pop-to-ecx
5992 58/pop-to-eax
5993
5994 89/<- %esp 5/r32/ebp
5995 5d/pop-to-ebp
5996 c3/return
5997
5998
5999 clean-up-blocks:
6000
6001 55/push-ebp
6002 89/<- %ebp 4/r32/esp
6003
6004 50/push-eax
6005 51/push-ecx
6006 56/push-esi
6007
6008 8b/-> *(ebp+8) 6/r32/esi
6009
6010 8b/-> *(ebp+0xc) 1/r32/ecx
6011 {
6012 $clean-up-blocks:reclaim-loop:
6013
6014 81 7/subop/compare *esi 0/imm32
6015 7e/jump-if-<= break/disp8
6016
6017 (top %esi)
6018
6019 39/compare *(eax+8) 1/r32/ecx
6020 7c/jump-if-< break/disp8
6021
6022 81 7/subop/compare *(eax+0x10) 0/imm32
6023 {
6024 75/jump-if-!= break/disp8
6025 $clean-up-blocks:reclaim-var-on-stack:
6026 (size-of %eax)
6027 01/add *Next-local-stack-offset 0/r32/eax
6028 }
6029 (pop %esi)
6030 e9/jump loop/disp32
6031 }
6032 $clean-up-blocks:end:
6033
6034 5e/pop-to-esi
6035 59/pop-to-ecx
6036 58/pop-to-eax
6037
6038 89/<- %esp 5/r32/ebp
6039 5d/pop-to-ebp
6040 c3/return
6041
6042 emit-subx-var-def:
6043
6044 55/push-ebp
6045 89/<- %ebp 4/r32/esp
6046
6047 50/push-eax
6048 51/push-ecx
6049
6050 8b/-> *(ebp+0xc) 0/r32/eax
6051
6052 (size-of *(eax+4))
6053
6054 {
6055 3d/compare-eax-with 0/imm32
6056 7e/jump-if-<= break/disp8
6057 (emit-indent *(ebp+8) *Curr-block-depth)
6058 (write-buffered *(ebp+8) "68/push 0/imm32\n")
6059
6060 2d/subtract-from-eax 4/imm32
6061
6062 eb/jump loop/disp8
6063 }
6064 $emit-subx-var-def:end:
6065
6066 59/pop-to-ecx
6067 58/pop-to-eax
6068
6069 89/<- %esp 5/r32/ebp
6070 5d/pop-to-ebp
6071 c3/return
6072
6073 emit-subx-stmt:
6074
6075 55/push-ebp
6076 89/<- %ebp 4/r32/esp
6077
6078 50/push-eax
6079 51/push-ecx
6080
6081
6082 8b/-> *(ebp+0xc) 1/r32/ecx
6083 +-- 24 lines: # array length ------------------------------------------------------------------------------------------------------------------------------------------------------------
6107 +-- 33 lines: # index into array --------------------------------------------------------------------------------------------------------------------------------------------------------
6140 +-- 26 lines: # get field from record ---------------------------------------------------------------------------------------------------------------------------------------------------
6166
6167 {
6168 $emit-subx-stmt:check-for-primitive:
6169 (find-matching-primitive *(ebp+0x10) *(ebp+0xc))
6170 3d/compare-eax-and 0/imm32
6171 74/jump-if-= break/disp8
6172 $emit-subx-stmt:primitive:
6173 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax)
6174 e9/jump $emit-subx-stmt:end/disp32
6175 }
6176
6177 {
6178 $emit-subx-stmt:check-for-call:
6179 (find-matching-function *(ebp+0x14) *(ebp+0xc))
6180 3d/compare-eax-and 0/imm32
6181 74/jump-if-= break/disp8
6182 $emit-subx-stmt:call:
6183 (emit-subx-call *(ebp+8) *(ebp+0xc) %eax)
6184 e9/jump $emit-subx-stmt:end/disp32
6185 }
6186
6187 (emit-hailmary-call *(ebp+8) *(ebp+0xc))
6188 $emit-subx-stmt:end:
6189
6190 59/pop-to-ecx
6191 58/pop-to-eax
6192
6193 89/<- %esp 5/r32/ebp
6194 5d/pop-to-ebp
6195 c3/return
6196
6197 $emit-subx-stmt:abort:
6198
6199 (write-buffered Stderr "couldn't translate an instruction with operation '")
6200 8b/-> *(ebp+0xc) 0/r32/eax
6201 (write-buffered Stderr *(eax+4))
6202 (write-buffered Stderr "'\n")
6203 (flush Stderr)
6204
6205 bb/copy-to-ebx 1/imm32
6206 b8/copy-to-eax 1/imm32/exit
6207 cd/syscall 0x80/imm8
6208
6209
6210 print-mu-get-offset:
6211
6212 55/push-ebp
6213 89/<- %ebp 4/r32/esp
6214
6215 50/push-eax
6216
6217 8b/-> *(ebp+0xc) 0/r32/eax
6218 8b/-> *(eax+8) 0/r32/eax
6219 8b/-> *(eax+4) 0/r32/eax
6220
6221 8b/-> *eax 0/r32/eax
6222
6223
6224
6225
6226
6227 (print-int32-buffered *(ebp+8) *(eax+0xc))
6228 $emit-get-offset:end:
6229
6230 58/pop-to-eax
6231
6232 89/<- %esp 5/r32/ebp
6233 5d/pop-to-ebp
6234 c3/return
6235
6236 emit-subx-block:
6237
6238 55/push-ebp
6239 89/<- %ebp 4/r32/esp
6240
6241 50/push-eax
6242 51/push-ecx
6243 56/push-esi
6244
6245 8b/-> *(ebp+0xc) 6/r32/esi
6246
6247 8b/-> *(esi+4) 0/r32/eax
6248
6249 {
6250 $emit-subx-block:check-empty:
6251 3d/compare-eax-and 0/imm32
6252 0f 84/jump-if-= break/disp32
6253 (emit-indent *(ebp+8) *Curr-block-depth)
6254 (write-buffered *(ebp+8) "{\n")
6255
6256 8b/-> *(esi+8) 1/r32/ecx
6257 (write-buffered *(ebp+8) *ecx)
6258 (write-buffered *(ebp+8) ":loop:\n")
6259 ff 0/subop/increment *Curr-block-depth
6260 (push *(ebp+0x10) %ecx)
6261 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10))
6262 (pop *(ebp+0x10))
6263 ff 1/subop/decrement *Curr-block-depth
6264 (emit-indent *(ebp+8) *Curr-block-depth)
6265 (write-buffered *(ebp+8) "}\n")
6266 (write-buffered *(ebp+8) *ecx)
6267 (write-buffered *(ebp+8) ":break:\n")
6268 }
6269 $emit-subx-block:end:
6270
6271 5e/pop-to-esi
6272 59/pop-to-ecx
6273 58/pop-to-eax
6274
6275 89/<- %esp 5/r32/ebp
6276 5d/pop-to-ebp
6277 c3/return
6278
6279
6280
6281 == data
6282 Primitives:
6283
6284 _Primitive-inc-eax:
6285
6286 "increment"/imm32/name
6287 0/imm32/no-inouts
6288 Single-int-var-in-eax/imm32/outputs
6289 "40/increment-eax"/imm32/subx-name
6290 0/imm32/no-rm32
6291 0/imm32/no-r32
6292 0/imm32/no-imm32
6293 0/imm32/no-disp32
6294 0/imm32/output-is-write-only
6295 _Primitive-inc-ecx/imm32/next
6296 _Primitive-inc-ecx:
6297
6298 "increment"/imm32/name
6299 0/imm32/no-inouts
6300 Single-int-var-in-ecx/imm32/outputs
6301 "41/increment-ecx"/imm32/subx-name
6302 0/imm32/no-rm32
6303 0/imm32/no-r32
6304 0/imm32/no-imm32
6305 0/imm32/no-disp32
6306 0/imm32/output-is-write-only
6307 _Primitive-inc-edx/imm32/next
6308 _Primitive-inc-edx:
6309
6310 "increment"/imm32/name
6311 0/imm32/no-inouts
6312 Single-int-var-in-edx/imm32/outputs
6313 "42/increment-edx"/imm32/subx-name
6314 0/imm32/no-rm32
6315 0/imm32/no-r32
6316 0/imm32/no-imm32
6317 0/imm32/no-disp32
6318 0/imm32/output-is-write-only
6319 _Primitive-inc-ebx/imm32/next
6320 _Primitive-inc-ebx:
6321
6322 "increment"/imm32/name
6323 0/imm32/no-inouts
6324 Single-int-var-in-ebx/imm32/outputs
6325 "43/increment-ebx"/imm32/subx-name
6326 0/imm32/no-rm32
6327 0/imm32/no-r32
6328 0/imm32/no-imm32
6329 0/imm32/no-disp32
6330 0/imm32/output-is-write-only
6331 _Primitive-inc-esi/imm32/next
6332 _Primitive-inc-esi:
6333
6334 "increment"/imm32/name
6335 0/imm32/no-inouts
6336 Single-int-var-in-esi/imm32/outputs
6337 "46/increment-esi"/imm32/subx-name
6338 0/imm32/no-rm32
6339 0/imm32/no-r32
6340 0/imm32/no-imm32
6341 0/imm32/no-disp32
6342 0/imm32/output-is-write-only
6343 _Primitive-inc-edi/imm32/next
6344 _Primitive-inc-edi:
6345
6346 "increment"/imm32/name
6347 0/imm32/no-inouts
6348 Single-int-var-in-edi/imm32/outputs
6349 "47/increment-edi"/imm32/subx-name
6350 0/imm32/no-rm32
6351 0/imm32/no-r32
6352 0/imm32/no-imm32
6353 0/imm32/no-disp32
6354 0/imm32/output-is-write-only
6355 _Primitive-dec-eax/imm32/next
6356 _Primitive-dec-eax:
6357
6358 "decrement"/imm32/name
6359 0/imm32/no-inouts
6360 Single-int-var-in-eax/imm32/outputs
6361 "48/decrement-eax"/imm32/subx-name
6362 0/imm32/no-rm32
6363 0/imm32/no-r32
6364 0/imm32/no-imm32
6365 0/imm32/no-disp32
6366 0/imm32/output-is-write-only
6367 _Primitive-dec-ecx/imm32/next
6368 _Primitive-dec-ecx:
6369
6370 "decrement"/imm32/name
6371 0/imm32/no-inouts
6372 Single-int-var-in-ecx/imm32/outputs
6373 "49/decrement-ecx"/imm32/subx-name
6374 0/imm32/no-rm32
6375 0/imm32/no-r32
6376 0/imm32/no-imm32
6377 0/imm32/no-disp32
6378 0/imm32/output-is-write-only
6379 _Primitive-dec-edx/imm32/next
6380 _Primitive-dec-edx:
6381
6382 "decrement"/imm32/name
6383 0/imm32/no-inouts
6384 Single-int-var-in-edx/imm32/outputs
6385 "4a/decrement-edx"/imm32/subx-name
6386 0/imm32/no-rm32
6387 0/imm32/no-r32
6388 0/imm32/no-imm32
6389 0/imm32/no-disp32
6390 0/imm32/output-is-write-only
6391 _Primitive-dec-ebx/imm32/next
6392 _Primitive-dec-ebx:
6393
6394 "decrement"/imm32/name
6395 0/imm32/no-inouts
6396 Single-int-var-in-ebx/imm32/outputs
6397 "4b/decrement-ebx"/imm32/subx-name
6398 0/imm32/no-rm32
6399 0/imm32/no-r32
6400 0/imm32/no-imm32
6401 0/imm32/no-disp32
6402 0/imm32/output-is-write-only
6403 _Primitive-dec-esi/imm32/next
6404 _Primitive-dec-esi:
6405
6406 "decrement"/imm32/name
6407 0/imm32/no-inouts
6408 Single-int-var-in-esi/imm32/outputs
6409 "4e/decrement-esi"/imm32/subx-name
6410 0/imm32/no-rm32
6411 0/imm32/no-r32
6412 0/imm32/no-imm32
6413 0/imm32/no-disp32
6414 0/imm32/output-is-write-only
6415 _Primitive-dec-edi/imm32/next
6416 _Primitive-dec-edi:
6417
6418 "decrement"/imm32/name
6419 0/imm32/no-inouts
6420 Single-int-var-in-edi/imm32/outputs
6421 "4f/decrement-edi"/imm32/subx-name
6422 0/imm32/no-rm32
6423 0/imm32/no-r32
6424 0/imm32/no-imm32
6425 0/imm32/no-disp32
6426 0/imm32/output-is-write-only
6427 _Primitive-inc-mem/imm32/next
6428 _Primitive-inc-mem:
6429
6430 "increment"/imm32/name
6431 Single-int-var-in-mem/imm32/inouts
6432 0/imm32/no-outputs
6433 "ff 0/subop/increment"/imm32/subx-name
6434 1/imm32/rm32-is-first-inout
6435 0/imm32/no-r32
6436 0/imm32/no-imm32
6437 0/imm32/no-disp32
6438 0/imm32/output-is-write-only
6439 _Primitive-inc-reg/imm32/next
6440 _Primitive-inc-reg:
6441
6442 "increment"/imm32/name
6443 0/imm32/no-inouts
6444 Single-int-var-in-some-register/imm32/outputs
6445 "ff 0/subop/increment"/imm32/subx-name
6446 3/imm32/rm32-is-first-output
6447 0/imm32/no-r32
6448 0/imm32/no-imm32
6449 0/imm32/no-disp32
6450 0/imm32/output-is-write-only
6451 _Primitive-dec-mem/imm32/next
6452 _Primitive-dec-mem:
6453
6454 "decrement"/imm32/name
6455 Single-int-var-in-mem/imm32/inouts
6456 0/imm32/no-outputs
6457 "ff 1/subop/decrement"/imm32/subx-name
6458 1/imm32/rm32-is-first-inout
6459 0/imm32/no-r32
6460 0/imm32/no-imm32
6461 0/imm32/no-disp32
6462 0/imm32/output-is-write-only
6463 _Primitive-dec-reg/imm32/next
6464 _Primitive-dec-reg:
6465
6466 "decrement"/imm32/name
6467 0/imm32/no-inouts
6468 Single-int-var-in-some-register/imm32/outputs
6469 "ff 1/subop/decrement"/imm32/subx-name
6470 3/imm32/rm32-is-first-output
6471 0/imm32/no-r32
6472 0/imm32/no-imm32
6473 0/imm32/no-disp32
6474 0/imm32/output-is-write-only
6475 _Primitive-add-to-eax/imm32/next
6476
6477 _Primitive-add-to-eax:
6478
6479 "add"/imm32/name
6480 Single-lit-var/imm32/inouts
6481 Single-int-var-in-eax/imm32/outputs
6482 "05/add-to-eax"/imm32/subx-name
6483 0/imm32/no-rm32
6484 0/imm32/no-r32
6485 1/imm32/imm32-is-first-inout
6486 0/imm32/no-disp32
6487 0/imm32/output-is-write-only
6488 _Primitive-add-reg-to-reg/imm32/next
6489 _Primitive-add-reg-to-reg:
6490
6491 "add"/imm32/name
6492 Single-int-var-in-some-register/imm32/inouts
6493 Single-int-var-in-some-register/imm32/outputs
6494 "01/add-to"/imm32/subx-name
6495 3/imm32/rm32-is-first-output
6496 1/imm32/r32-is-first-inout
6497 0/imm32/no-imm32
6498 0/imm32/no-disp32
6499 0/imm32/output-is-write-only
6500 _Primitive-add-reg-to-mem/imm32/next
6501 _Primitive-add-reg-to-mem:
6502
6503 "add-to"/imm32/name
6504 Two-args-int-stack-int-reg/imm32/inouts
6505 0/imm32/outputs
6506 "01/add-to"/imm32/subx-name
6507 1/imm32/rm32-is-first-inout
6508 2/imm32/r32-is-second-inout
6509 0/imm32/no-imm32
6510 0/imm32/no-disp32
6511 0/imm32/output-is-write-only
6512 _Primitive-add-mem-to-reg/imm32/next
6513 _Primitive-add-mem-to-reg:
6514
6515 "add"/imm32/name
6516 Single-int-var-in-mem/imm32/inouts
6517 Single-int-var-in-some-register/imm32/outputs
6518 "03/add"/imm32/subx-name
6519 1/imm32/rm32-is-first-inout
6520 3/imm32/r32-is-first-output
6521 0/imm32/no-imm32
6522 0/imm32/no-disp32
6523 0/imm32/output-is-write-only
6524 _Primitive-add-lit-to-reg/imm32/next
6525 _Primitive-add-lit-to-reg:
6526
6527 "add"/imm32/name
6528 Single-lit-var/imm32/inouts
6529 Single-int-var-in-some-register/imm32/outputs
6530 "81 0/subop/add"/imm32/subx-name
6531 3/imm32/rm32-is-first-output
6532 0/imm32/no-r32
6533 1/imm32/imm32-is-first-inout
6534 0/imm32/no-disp32
6535 0/imm32/output-is-write-only
6536 _Primitive-add-lit-to-mem/imm32/next
6537 _Primitive-add-lit-to-mem:
6538
6539 "add-to"/imm32/name
6540 Int-var-and-literal/imm32/inouts
6541 0/imm32/outputs
6542 "81 0/subop/add"/imm32/subx-name
6543 1/imm32/rm32-is-first-inout
6544 0/imm32/no-r32
6545 2/imm32/imm32-is-second-inout
6546 0/imm32/no-disp32
6547 0/imm32/output-is-write-only
6548 _Primitive-subtract-from-eax/imm32/next
6549
6550 _Primitive-subtract-from-eax:
6551
6552 "subtract"/imm32/name
6553 Single-lit-var/imm32/inouts
6554 Single-int-var-in-eax/imm32/outputs
6555 "2d/subtract-from-eax"/imm32/subx-name
6556 0/imm32/no-rm32
6557 0/imm32/no-r32
6558 1/imm32/imm32-is-first-inout
6559 0/imm32/no-disp32
6560 0/imm32/output-is-write-only
6561 _Primitive-subtract-reg-from-reg/imm32/next
6562 _Primitive-subtract-reg-from-reg:
6563
6564 "subtract"/imm32/name
6565 Single-int-var-in-some-register/imm32/inouts
6566 Single-int-var-in-some-register/imm32/outputs
6567 "29/subtract-from"/imm32/subx-name
6568 3/imm32/rm32-is-first-output
6569 1/imm32/r32-is-first-inout
6570 0/imm32/no-imm32
6571 0/imm32/no-disp32
6572 0/imm32/output-is-write-only
6573 _Primitive-subtract-reg-from-mem/imm32/next
6574 _Primitive-subtract-reg-from-mem:
6575
6576 "subtract-from"/imm32/name
6577 Two-args-int-stack-int-reg/imm32/inouts
6578 0/imm32/outputs
6579 "29/subtract-from"/imm32/subx-name
6580 1/imm32/rm32-is-first-inout
6581 2/imm32/r32-is-second-inout
6582 0/imm32/no-imm32
6583 0/imm32/no-disp32
6584 0/imm32/output-is-write-only
6585 _Primitive-subtract-mem-from-reg/imm32/next
6586 _Primitive-subtract-mem-from-reg:
6587
6588 "subtract"/imm32/name
6589 Single-int-var-in-mem/imm32/inouts
6590 Single-int-var-in-some-register/imm32/outputs
6591 "2b/subtract"/imm32/subx-name
6592 1/imm32/rm32-is-first-inout
6593 3/imm32/r32-is-first-output
6594 0/imm32/no-imm32
6595 0/imm32/no-disp32
6596 0/imm32/output-is-write-only
6597 _Primitive-subtract-lit-from-reg/imm32/next
6598 _Primitive-subtract-lit-from-reg:
6599
6600 "subtract"/imm32/name
6601 Single-lit-var/imm32/inouts
6602 Single-int-var-in-some-register/imm32/outputs
6603 "81 5/subop/subtract"/imm32/subx-name
6604 3/imm32/rm32-is-first-output
6605 0/imm32/no-r32
6606 1/imm32/imm32-is-first-inout
6607 0/imm32/no-disp32
6608 0/imm32/output-is-write-only
6609 _Primitive-subtract-lit-from-mem/imm32/next
6610 _Primitive-subtract-lit-from-mem:
6611
6612 "subtract-from"/imm32/name
6613 Int-var-and-literal/imm32/inouts
6614 0/imm32/outputs
6615 "81 5/subop/subtract"/imm32/subx-name
6616 1/imm32/rm32-is-first-inout
6617 0/imm32/no-r32
6618 2/imm32/imm32-is-first-inout
6619 0/imm32/no-disp32
6620 0/imm32/output-is-write-only
6621 _Primitive-and-with-eax/imm32/next
6622
6623 _Primitive-and-with-eax:
6624
6625 "and"/imm32/name
6626 Single-lit-var/imm32/inouts
6627 Single-int-var-in-eax/imm32/outputs
6628 "25/and-with-eax"/imm32/subx-name
6629 0/imm32/no-rm32
6630 0/imm32/no-r32
6631 1/imm32/imm32-is-first-inout
6632 0/imm32/no-disp32
6633 0/imm32/output-is-write-only
6634 _Primitive-and-reg-with-reg/imm32/next
6635 _Primitive-and-reg-with-reg:
6636
6637 "and"/imm32/name
6638 Single-int-var-in-some-register/imm32/inouts
6639 Single-int-var-in-some-register/imm32/outputs
6640 "21/and-with"/imm32/subx-name
6641 3/imm32/rm32-is-first-output
6642 1/imm32/r32-is-first-inout
6643 0/imm32/no-imm32
6644 0/imm32/no-disp32
6645 0/imm32/output-is-write-only
6646 _Primitive-and-reg-with-mem/imm32/next
6647 _Primitive-and-reg-with-mem:
6648
6649 "and-with"/imm32/name
6650 Two-args-int-stack-int-reg/imm32/inouts
6651 0/imm32/outputs
6652 "21/and-with"/imm32/subx-name
6653 1/imm32/rm32-is-first-inout
6654 2/imm32/r32-is-second-inout
6655 0/imm32/no-imm32
6656 0/imm32/no-disp32
6657 0/imm32/output-is-write-only
6658 _Primitive-and-mem-with-reg/imm32/next
6659 _Primitive-and-mem-with-reg:
6660
6661 "and"/imm32/name
6662 Single-int-var-in-mem/imm32/inouts
6663 Single-int-var-in-some-register/imm32/outputs
6664 "23/and"/imm32/subx-name
6665 1/imm32/rm32-is-first-inout
6666 3/imm32/r32-is-first-output
6667 0/imm32/no-imm32
6668 0/imm32/no-disp32
6669 0/imm32/output-is-write-only
6670 _Primitive-and-lit-with-reg/imm32/next
6671 _Primitive-and-lit-with-reg:
6672
6673 "and"/imm32/name
6674 Single-lit-var/imm32/inouts
6675 Single-int-var-in-some-register/imm32/outputs
6676 "81 4/subop/and"/imm32/subx-name
6677 3/imm32/rm32-is-first-output
6678 0/imm32/no-r32
6679 1/imm32/imm32-is-first-inout
6680 0/imm32/no-disp32
6681 0/imm32/output-is-write-only
6682 _Primitive-and-lit-with-mem/imm32/next
6683 _Primitive-and-lit-with-mem:
6684
6685 "and-with"/imm32/name
6686 Int-var-and-literal/imm32/inouts
6687 0/imm32/outputs
6688 "81 4/subop/and"/imm32/subx-name
6689 1/imm32/rm32-is-first-inout
6690 0/imm32/no-r32
6691 2/imm32/imm32-is-first-inout
6692 0/imm32/no-disp32
6693 0/imm32/output-is-write-only
6694 _Primitive-or-with-eax/imm32/next
6695
6696 _Primitive-or-with-eax:
6697
6698 "or"/imm32/name
6699 Single-lit-var/imm32/inouts
6700 Single-int-var-in-eax/imm32/outputs
6701 "0d/or-with-eax"/imm32/subx-name
6702 0/imm32/no-rm32
6703 0/imm32/no-r32
6704 1/imm32/imm32-is-first-inout
6705 0/imm32/no-disp32
6706 0/imm32/output-is-write-only
6707 _Primitive-or-reg-with-reg/imm32/next
6708 _Primitive-or-reg-with-reg:
6709
6710 "or"/imm32/name
6711 Single-int-var-in-some-register/imm32/inouts
6712 Single-int-var-in-some-register/imm32/outputs
6713 "09/or-with"/imm32/subx-name
6714 3/imm32/rm32-is-first-output
6715 1/imm32/r32-is-first-inout
6716 0/imm32/no-imm32
6717 0/imm32/no-disp32
6718 0/imm32/output-is-write-only
6719 _Primitive-or-reg-with-mem/imm32/next
6720 _Primitive-or-reg-with-mem:
6721
6722 "or-with"/imm32/name
6723 Two-args-int-stack-int-reg/imm32/inouts
6724 0/imm32/outputs
6725 "09/or-with"/imm32/subx-name
6726 1/imm32/rm32-is-first-inout
6727 2/imm32/r32-is-second-inout
6728 0/imm32/no-imm32
6729 0/imm32/no-disp32
6730 0/imm32/output-is-write-only
6731 _Primitive-or-mem-with-reg/imm32/next
6732 _Primitive-or-mem-with-reg:
6733
6734 "or"/imm32/name
6735 Single-int-var-in-mem/imm32/inouts
6736 Single-int-var-in-some-register/imm32/outputs
6737 "0b/or"/imm32/subx-name
6738 1/imm32/rm32-is-first-inout
6739 3/imm32/r32-is-first-output
6740 0/imm32/no-imm32
6741 0/imm32/no-disp32
6742 0/imm32/output-is-write-only
6743 _Primitive-or-lit-with-reg/imm32/next
6744 _Primitive-or-lit-with-reg:
6745
6746 "or"/imm32/name
6747 Single-lit-var/imm32/inouts
6748 Single-int-var-in-some-register/imm32/outputs
6749 "81 1/subop/or"/imm32/subx-name
6750 3/imm32/rm32-is-first-output
6751 0/imm32/no-r32
6752 1/imm32/imm32-is-first-inout
6753 0/imm32/no-disp32
6754 0/imm32/output-is-write-only
6755 _Primitive-or-lit-with-mem/imm32/next
6756 _Primitive-or-lit-with-mem:
6757
6758 "or-with"/imm32/name
6759 Int-var-and-literal/imm32/inouts
6760 0/imm32/outputs
6761 "81 1/subop/or"/imm32/subx-name
6762 1/imm32/rm32-is-first-inout
6763 0/imm32/no-r32
6764 2/imm32/imm32-is-second-inout
6765 0/imm32/no-disp32
6766 0/imm32/output-is-write-only
6767 _Primitive-xor-with-eax/imm32/next
6768
6769 _Primitive-xor-with-eax:
6770
6771 "xor"/imm32/name
6772 Single-lit-var/imm32/inouts
6773 Single-int-var-in-eax/imm32/outputs
6774 "35/xor-with-eax"/imm32/subx-name
6775 0/imm32/no-rm32
6776 0/imm32/no-r32
6777 1/imm32/imm32-is-first-inout
6778 0/imm32/no-disp32
6779 0/imm32/output-is-write-only
6780 _Primitive-xor-reg-with-reg/imm32/next
6781 _Primitive-xor-reg-with-reg:
6782
6783 "xor"/imm32/name
6784 Single-int-var-in-some-register/imm32/inouts
6785 Single-int-var-in-some-register/imm32/outputs
6786 "31/xor-with"/imm32/subx-name
6787 3/imm32/rm32-is-first-output
6788 1/imm32/r32-is-first-inout
6789 0/imm32/no-imm32
6790 0/imm32/no-disp32
6791 0/imm32/output-is-write-only
6792 _Primitive-xor-reg-with-mem/imm32/next
6793 _Primitive-xor-reg-with-mem:
6794
6795 "xor-with"/imm32/name
6796 Two-args-int-stack-int-reg/imm32/inouts
6797 0/imm32/outputs
6798 "31/xor-with"/imm32/subx-name
6799 1/imm32/rm32-is-first-inout
6800 2/imm32/r32-is-second-inout
6801 0/imm32/no-imm32
6802 0/imm32/no-disp32
6803 0/imm32/output-is-write-only
6804 _Primitive-xor-mem-with-reg/imm32/next
6805 _Primitive-xor-mem-with-reg:
6806
6807 "xor"/imm32/name
6808 Single-int-var-in-mem/imm32/inouts
6809 Single-int-var-in-some-register/imm32/outputs
6810 "33/xor"/imm32/subx-name
6811 1/imm32/rm32-is-first-inout
6812 3/imm32/r32-is-first-output
6813 0/imm32/no-imm32
6814 0/imm32/no-disp32
6815 0/imm32/output-is-write-only
6816 _Primitive-xor-lit-with-reg/imm32/next
6817 _Primitive-xor-lit-with-reg:
6818
6819 "xor"/imm32/name
6820 Single-lit-var/imm32/inouts
6821 Single-int-var-in-some-register/imm32/outputs
6822 "81 6/subop/xor"/imm32/subx-name
6823 3/imm32/rm32-is-first-output
6824 0/imm32/no-r32
6825 1/imm32/imm32-is-first-inout
6826 0/imm32/no-disp32
6827 0/imm32/output-is-write-only
6828 _Primitive-xor-lit-with-mem/imm32/next
6829 _Primitive-xor-lit-with-mem:
6830
6831 "xor-with"/imm32/name
6832 Int-var-and-literal/imm32/inouts
6833 0/imm32/outputs
6834 "81 6/subop/xor"/imm32/subx-name
6835 1/imm32/rm32-is-first-inout
6836 0/imm32/no-r32
6837 2/imm32/imm32-is-first-inout
6838 0/imm32/no-disp32
6839 0/imm32/output-is-write-only
6840 _Primitive-copy-to-eax/imm32/next
6841
6842 _Primitive-copy-to-eax:
6843
6844 "copy"/imm32/name
6845 Single-lit-var/imm32/inouts
6846 Single-int-var-in-eax/imm32/outputs
6847 "b8/copy-to-eax"/imm32/subx-name
6848 0/imm32/no-rm32
6849 0/imm32/no-r32
6850 1/imm32/imm32-is-first-inout
6851 0/imm32/no-disp32
6852 1/imm32/output-is-write-only
6853 _Primitive-copy-to-ecx/imm32/next
6854 _Primitive-copy-to-ecx:
6855
6856 "copy"/imm32/name
6857 Single-lit-var/imm32/inouts
6858 Single-int-var-in-ecx/imm32/outputs
6859 "b9/copy-to-ecx"/imm32/subx-name
6860 0/imm32/no-rm32
6861 0/imm32/no-r32
6862 1/imm32/imm32-is-first-inout
6863 0/imm32/no-disp32
6864 1/imm32/output-is-write-only
6865 _Primitive-copy-to-edx/imm32/next
6866 _Primitive-copy-to-edx:
6867
6868 "copy"/imm32/name
6869 Single-lit-var/imm32/inouts
6870 Single-int-var-in-edx/imm32/outputs
6871 "ba/copy-to-edx"/imm32/subx-name
6872 0/imm32/no-rm32
6873 0/imm32/no-r32
6874 1/imm32/imm32-is-first-inout
6875 0/imm32/no-disp32
6876 1/imm32/output-is-write-only
6877 _Primitive-copy-to-ebx/imm32/next
6878 _Primitive-copy-to-ebx:
6879
6880 "copy"/imm32/name
6881 Single-lit-var/imm32/inouts
6882 Single-int-var-in-ebx/imm32/outputs
6883 "bb/copy-to-ebx"/imm32/subx-name
6884 0/imm32/no-rm32
6885 0/imm32/no-r32
6886 1/imm32/imm32-is-first-inout
6887 0/imm32/no-disp32
6888 1/imm32/output-is-write-only
6889 _Primitive-copy-to-esi/imm32/next
6890 _Primitive-copy-to-esi:
6891
6892 "copy"/imm32/name
6893 Single-lit-var/imm32/inouts
6894 Single-int-var-in-esi/imm32/outputs
6895 "be/copy-to-esi"/imm32/subx-name
6896 0/imm32/no-rm32
6897 0/imm32/no-r32
6898 1/imm32/imm32-is-first-inout
6899 0/imm32/no-disp32
6900 1/imm32/output-is-write-only
6901 _Primitive-copy-to-edi/imm32/next
6902 _Primitive-copy-to-edi:
6903
6904 "copy"/imm32/name
6905 Single-lit-var/imm32/inouts
6906 Single-int-var-in-edi/imm32/outputs
6907 "bf/copy-to-edi"/imm32/subx-name
6908 0/imm32/no-rm32
6909 0/imm32/no-r32
6910 1/imm32/imm32-is-first-inout
6911 0/imm32/no-disp32
6912 1/imm32/output-is-write-only
6913 _Primitive-copy-reg-to-reg/imm32/next
6914 _Primitive-copy-reg-to-reg:
6915
6916 "copy"/imm32/name
6917 Single-int-var-in-some-register/imm32/inouts
6918 Single-int-var-in-some-register/imm32/outputs
6919 "89/copy-to"/imm32/subx-name
6920 3/imm32/rm32-is-first-output
6921 1/imm32/r32-is-first-inout
6922 0/imm32/no-imm32
6923 0/imm32/no-disp32
6924 1/imm32/output-is-write-only
6925 _Primitive-copy-reg-to-mem/imm32/next
6926 _Primitive-copy-reg-to-mem:
6927
6928 "copy-to"/imm32/name
6929 Two-args-int-stack-int-reg/imm32/inouts
6930 0/imm32/outputs
6931 "89/copy-to"/imm32/subx-name
6932 1/imm32/rm32-is-first-inout
6933 2/imm32/r32-is-second-inout
6934 0/imm32/no-imm32
6935 0/imm32/no-disp32
6936 1/imm32/output-is-write-only
6937 _Primitive-copy-mem-to-reg/imm32/next
6938 _Primitive-copy-mem-to-reg:
6939
6940 "copy"/imm32/name
6941 Single-int-var-in-mem/imm32/inouts
6942 Single-int-var-in-some-register/imm32/outputs
6943 "8b/copy-from"/imm32/subx-name
6944 1/imm32/rm32-is-first-inout
6945 3/imm32/r32-is-first-output
6946 0/imm32/no-imm32
6947 0/imm32/no-disp32
6948 1/imm32/output-is-write-only
6949 _Primitive-copy-lit-to-reg/imm32/next
6950 _Primitive-copy-lit-to-reg:
6951
6952 "copy"/imm32/name
6953 Single-lit-var/imm32/inouts
6954 Single-int-var-in-some-register/imm32/outputs
6955 "c7 0/subop/copy"/imm32/subx-name
6956 3/imm32/rm32-is-first-output
6957 0/imm32/no-r32
6958 1/imm32/imm32-is-first-inout
6959 0/imm32/no-disp32
6960 1/imm32/output-is-write-only
6961 _Primitive-copy-lit-to-mem/imm32/next
6962 _Primitive-copy-lit-to-mem:
6963
6964 "copy-to"/imm32/name
6965 Int-var-and-literal/imm32/inouts
6966 0/imm32/outputs
6967 "c7 0/subop/copy"/imm32/subx-name
6968 1/imm32/rm32-is-first-inout
6969 0/imm32/no-r32
6970 2/imm32/imm32-is-first-inout
6971 0/imm32/no-disp32
6972 1/imm32/output-is-write-only
6973 _Primitive-compare-mem-with-reg/imm32/next
6974
6975 _Primitive-compare-mem-with-reg:
6976
6977 "compare"/imm32/name
6978 Two-args-int-stack-int-reg/imm32/inouts
6979 0/imm32/outputs
6980 "39/compare->"/imm32/subx-name
6981 1/imm32/rm32-is-first-inout
6982 2/imm32/r32-is-second-inout
6983 0/imm32/no-imm32
6984 0/imm32/no-disp32
6985 0/imm32/output-is-write-only
6986 _Primitive-compare-reg-with-mem/imm32/next
6987 _Primitive-compare-reg-with-mem:
6988
6989 "compare"/imm32/name
6990 Two-args-int-reg-int-stack/imm32/inouts
6991 0/imm32/outputs
6992 "3b/compare<-"/imm32/subx-name
6993 2/imm32/rm32-is-second-inout
6994 1/imm32/r32-is-first-inout
6995 0/imm32/no-imm32
6996 0/imm32/no-disp32
6997 0/imm32/output-is-write-only
6998 _Primitive-compare-eax-with-literal/imm32/next
6999 _Primitive-compare-eax-with-literal:
7000
7001 "compare"/imm32/name
7002 Two-args-int-eax-int-literal/imm32/inouts
7003 0/imm32/outputs
7004 "3d/compare-eax-with"/imm32/subx-name
7005 0/imm32/no-rm32
7006 0/imm32/no-r32
7007 2/imm32/imm32-is-second-inout
7008 0/imm32/no-disp32
7009 0/imm32/output-is-write-only
7010 _Primitive-compare-reg-with-literal/imm32/next
7011 _Primitive-compare-reg-with-literal:
7012
7013 "compare"/imm32/name
7014 Int-var-in-register-and-literal/imm32/inouts
7015 0/imm32/outputs
7016 "81 7/subop/compare"/imm32/subx-name
7017 1/imm32/rm32-is-first-inout
7018 0/imm32/no-r32
7019 2/imm32/imm32-is-second-inout
7020 0/imm32/no-disp32
7021 0/imm32/output-is-write-only
7022 _Primitive-compare-mem-with-literal/imm32/next
7023 _Primitive-compare-mem-with-literal:
7024
7025 "compare"/imm32/name
7026 Int-var-and-literal/imm32/inouts
7027 0/imm32/outputs
7028 "81 7/subop/compare"/imm32/subx-name
7029 1/imm32/rm32-is-first-inout
7030 0/imm32/no-r32
7031 2/imm32/imm32-is-second-inout
7032 0/imm32/no-disp32
7033 0/imm32/output-is-write-only
7034 _Primitive-multiply-reg-by-mem/imm32/next
7035
7036 _Primitive-multiply-reg-by-mem:
7037
7038 "multiply"/imm32/name
7039 Single-int-var-in-mem/imm32/inouts
7040 Single-int-var-in-some-register/imm32/outputs
7041 "0f af/multiply"/imm32/subx-name
7042 1/imm32/rm32-is-first-inout
7043 3/imm32/r32-is-first-output
7044 0/imm32/no-imm32
7045 0/imm32/no-disp32
7046 0/imm32/output-is-write-only
7047 _Primitive-break-if-addr</imm32/next
7048
7049 _Primitive-break-if-addr<:
7050 "break-if-addr<"/imm32/name
7051 0/imm32/inouts
7052 0/imm32/outputs
7053 "0f 82/jump-if-addr< break/disp32"/imm32/subx-name
7054 0/imm32/no-rm32
7055 0/imm32/no-r32
7056 0/imm32/no-imm32
7057 0/imm32/no-disp32
7058 0/imm32/no-output
7059 _Primitive-break-if-addr>=/imm32/next
7060 _Primitive-break-if-addr>=:
7061 "break-if-addr>="/imm32/name
7062 0/imm32/inouts
7063 0/imm32/outputs
7064 "0f 83/jump-if-addr>= break/disp32"/imm32/subx-name
7065 0/imm32/no-rm32
7066 0/imm32/no-r32
7067 0/imm32/no-imm32
7068 0/imm32/no-disp32
7069 0/imm32/no-output
7070 _Primitive-break-if-=/imm32/next
7071 _Primitive-break-if-=:
7072 "break-if-="/imm32/name
7073 0/imm32/inouts
7074 0/imm32/outputs
7075 "0f 84/jump-if-= break/disp32"/imm32/subx-name
7076 0/imm32/no-rm32
7077 0/imm32/no-r32
7078 0/imm32/no-imm32
7079 0/imm32/no-disp32
7080 0/imm32/no-output
7081 _Primitive-break-if-!=/imm32/next
7082 _Primitive-break-if-!=:
7083 "break-if-!="/imm32/name
7084 0/imm32/inouts
7085 0/imm32/outputs
7086 "0f 85/jump-if-!= break/disp32"/imm32/subx-name
7087 0/imm32/no-rm32
7088 0/imm32/no-r32
7089 0/imm32/no-imm32
7090 0/imm32/no-disp32
7091 0/imm32/no-output
7092 _Primitive-break-if-addr<=/imm32/next
7093 _Primitive-break-if-addr<=:
7094 "break-if-addr<="/imm32/name
7095 0/imm32/inouts
7096 0/imm32/outputs
7097 "0f 86/jump-if-addr<= break/disp32"/imm32/subx-name
7098 0/imm32/no-rm32
7099 0/imm32/no-r32
7100 0/imm32/no-imm32
7101 0/imm32/no-disp32
7102 0/imm32/no-output
7103 _Primitive-break-if-addr>/imm32/next
7104 _Primitive-break-if-addr>:
7105 "break-if-addr>"/imm32/name
7106 0/imm32/inouts
7107 0/imm32/outputs
7108 "0f 87/jump-if-addr> break/disp32"/imm32/subx-name
7109 0/imm32/no-rm32
7110 0/imm32/no-r32
7111 0/imm32/no-imm32
7112 0/imm32/no-disp32
7113 0/imm32/no-output
7114 _Primitive-break-if-</imm32/next
7115 _Primitive-break-if-<:
7116 "break-if-<"/imm32/name
7117 0/imm32/inouts
7118 0/imm32/outputs
7119 "0f 8c/jump-if-< break/disp32"/imm32/subx-name
7120 0/imm32/no-rm32
7121 0/imm32/no-r32
7122 0/imm32/no-imm32
7123 0/imm32/no-disp32
7124 0/imm32/no-output
7125 _Primitive-break-if->=/imm32/next
7126 _Primitive-break-if->=:
7127 "break-if->="/imm32/name
7128 0/imm32/inouts
7129 0/imm32/outputs
7130 "0f 8d/jump-if->= break/disp32"/imm32/subx-name
7131 0/imm32/no-rm32
7132 0/imm32/no-r32
7133 0/imm32/no-imm32
7134 0/imm32/no-disp32
7135 0/imm32/no-output
7136 _Primitive-break-if-<=/imm32/next
7137 _Primitive-break-if-<=:
7138 "break-if-<="/imm32/name
7139 0/imm32/inouts
7140 0/imm32/outputs
7141 "0f 8e/jump-if-<= break/disp32"/imm32/subx-name
7142 0/imm32/no-rm32
7143 0/imm32/no-r32
7144 0/imm32/no-imm32
7145 0/imm32/no-disp32
7146 0/imm32/no-output
7147 _Primitive-break-if->/imm32/next
7148 _Primitive-break-if->:
7149 "break-if->"/imm32/name
7150 0/imm32/inouts
7151 0/imm32/outputs
7152 "0f 8f/jump-if-> break/disp32"/imm32/subx-name
7153 0/imm32/no-rm32
7154 0/imm32/no-r32
7155 0/imm32/no-imm32
7156 0/imm32/no-disp32
7157 0/imm32/no-output
7158 _Primitive-break/imm32/next
7159 _Primitive-break:
7160 "break"/imm32/name
7161 0/imm32/inouts
7162 0/imm32/outputs
7163 "e9/jump break/disp32"/imm32/subx-name
7164 0/imm32/no-rm32
7165 0/imm32/no-r32
7166 0/imm32/no-imm32
7167 0/imm32/no-disp32
7168 0/imm32/no-output
7169 _Primitive-loop-if-addr</imm32/next
7170 _Primitive-loop-if-addr<:
7171 "loop-if-addr<"/imm32/name
7172 0/imm32/inouts
7173 0/imm32/outputs
7174 "0f 82/jump-if-addr< loop/disp32"/imm32/subx-name
7175 0/imm32/no-rm32
7176 0/imm32/no-r32
7177 0/imm32/no-imm32
7178 0/imm32/no-disp32
7179 0/imm32/no-output
7180 _Primitive-loop-if-addr>=/imm32/next
7181 _Primitive-loop-if-addr>=:
7182 "loop-if-addr>="/imm32/name
7183 0/imm32/inouts
7184 0/imm32/outputs
7185 "0f 83/jump-if-addr>= loop/disp32"/imm32/subx-name
7186 0/imm32/no-rm32
7187 0/imm32/no-r32
7188 0/imm32/no-imm32
7189 0/imm32/no-disp32
7190 0/imm32/no-output
7191 _Primitive-loop-if-=/imm32/next
7192 _Primitive-loop-if-=:
7193 "loop-if-="/imm32/name
7194 0/imm32/inouts
7195 0/imm32/outputs
7196 "0f 84/jump-if-= loop/disp32"/imm32/subx-name
7197 0/imm32/no-rm32
7198 0/imm32/no-r32
7199 0/imm32/no-imm32
7200 0/imm32/no-disp32
7201 0/imm32/no-output
7202 _Primitive-loop-if-!=/imm32/next
7203 _Primitive-loop-if-!=:
7204 "loop-if-!="/imm32/name
7205 0/imm32/inouts
7206 0/imm32/outputs
7207 "0f 85/jump-if-!= loop/disp32"/imm32/subx-name
7208 0/imm32/no-rm32
7209 0/imm32/no-r32
7210 0/imm32/no-imm32
7211 0/imm32/no-disp32
7212 0/imm32/no-output
7213 _Primitive-loop-if-addr<=/imm32/next
7214 _Primitive-loop-if-addr<=:
7215 "loop-if-addr<="/imm32/name
7216 0/imm32/inouts
7217 0/imm32/outputs
7218 "0f 86/jump-if-addr<= loop/disp32"/imm32/subx-name
7219 0/imm32/no-rm32
7220 0/imm32/no-r32
7221 0/imm32/no-imm32
7222 0/imm32/no-disp32
7223 0/imm32/no-output
7224 _Primitive-loop-if-addr>/imm32/next
7225 _Primitive-loop-if-addr>:
7226 "loop-if-addr>"/imm32/name
7227 0/imm32/inouts
7228 0/imm32/outputs
7229 "0f 87/jump-if-addr> loop/disp32"/imm32/subx-name
7230 0/imm32/no-rm32
7231 0/imm32/no-r32
7232 0/imm32/no-imm32
7233 0/imm32/no-disp32
7234 0/imm32/no-output
7235 _Primitive-loop-if-</imm32/next
7236 _Primitive-loop-if-<:
7237 "loop-if-<"/imm32/name
7238 0/imm32/inouts
7239 0/imm32/outputs
7240 "0f 8c/jump-if-< loop/disp32"/imm32/subx-name
7241 0/imm32/no-rm32
7242 0/imm32/no-r32
7243 0/imm32/no-imm32
7244 0/imm32/no-disp32
7245 0/imm32/no-output
7246 _Primitive-loop-if->=/imm32/next
7247 _Primitive-loop-if->=:
7248 "loop-if->="/imm32/name
7249 0/imm32/inouts
7250 0/imm32/outputs
7251 "0f 8d/jump-if->= loop/disp32"/imm32/subx-name
7252 0/imm32/no-rm32
7253 0/imm32/no-r32
7254 0/imm32/no-imm32
7255 0/imm32/no-disp32
7256 0/imm32/no-output
7257 _Primitive-loop-if-<=/imm32/next
7258 _Primitive-loop-if-<=:
7259 "loop-if-<="/imm32/name
7260 0/imm32/inouts
7261 0/imm32/outputs
7262 "0f 8e/jump-if-<= loop/disp32"/imm32/subx-name
7263 0/imm32/no-rm32
7264 0/imm32/no-r32
7265 0/imm32/no-imm32
7266 0/imm32/no-disp32
7267 0/imm32/no-output
7268 _Primitive-loop-if->/imm32/next
7269 _Primitive-loop-if->:
7270 "loop-if->"/imm32/name
7271 0/imm32/inouts
7272 0/imm32/outputs
7273 "0f 8f/jump-if-> loop/disp32"/imm32/subx-name
7274 0/imm32/no-rm32
7275 0/imm32/no-r32
7276 0/imm32/no-imm32
7277 0/imm32/no-disp32
7278 0/imm32/no-output
7279 _Primitive-loop/imm32/next
7280 _Primitive-loop:
7281 "loop"/imm32/name
7282 0/imm32/inouts
7283 0/imm32/outputs
7284 "e9/jump loop/disp32"/imm32/subx-name
7285 0/imm32/no-rm32
7286 0/imm32/no-r32
7287 0/imm32/no-imm32
7288 0/imm32/no-disp32
7289 0/imm32/no-output
7290 _Primitive-break-if-addr<-named/imm32/next
7291
7292 _Primitive-break-if-addr<-named:
7293 "break-if-addr<"/imm32/name
7294 Single-lit-var/imm32/inouts
7295 0/imm32/outputs
7296 "0f 82/jump-if-addr<"/imm32/subx-name
7297 0/imm32/no-rm32
7298 0/imm32/no-r32
7299 0/imm32/no-imm32
7300 1/imm32/disp32-is-first-inout
7301 0/imm32/no-output
7302 _Primitive-break-if-addr>=-named/imm32/next
7303 _Primitive-break-if-addr>=-named:
7304 "break-if-addr>="/imm32/name
7305 Single-lit-var/imm32/inouts
7306 0/imm32/outputs
7307 "0f 83/jump-if-addr>="/imm32/subx-name
7308 0/imm32/no-rm32
7309 0/imm32/no-r32
7310 0/imm32/no-imm32
7311 1/imm32/disp32-is-first-inout
7312 0/imm32/no-output
7313 _Primitive-break-if-=-named/imm32/next
7314 _Primitive-break-if-=-named:
7315 "break-if-="/imm32/name
7316 Single-lit-var/imm32/inouts
7317 0/imm32/outputs
7318 "0f 84/jump-if-="/imm32/subx-name
7319 0/imm32/no-rm32
7320 0/imm32/no-r32
7321 0/imm32/no-imm32
7322 1/imm32/disp32-is-first-inout
7323 0/imm32/no-output
7324 _Primitive-break-if-!=-named/imm32/next
7325 _Primitive-break-if-!=-named:
7326 "break-if-!="/imm32/name
7327 Single-lit-var/imm32/inouts
7328 0/imm32/outputs
7329 "0f 85/jump-if-!="/imm32/subx-name
7330 0/imm32/no-rm32
7331 0/imm32/no-r32
7332 0/imm32/no-imm32
7333 1/imm32/disp32-is-first-inout
7334 0/imm32/no-output
7335 _Primitive-break-if-addr<=-named/imm32/next
7336 _Primitive-break-if-addr<=-named:
7337 "break-if-addr<="/imm32/name
7338 Single-lit-var/imm32/inouts
7339 0/imm32/outputs
7340 "0f 86/jump-if-addr<="/imm32/subx-name
7341 0/imm32/no-rm32
7342 0/imm32/no-r32
7343 0/imm32/no-imm32
7344 1/imm32/disp32-is-first-inout
7345 0/imm32/no-output
7346 _Primitive-break-if-addr>-named/imm32/next
7347 _Primitive-break-if-addr>-named:
7348 "break-if-addr>"/imm32/name
7349 Single-lit-var/imm32/inouts
7350 0/imm32/outputs
7351 "0f 87/jump-if-addr>"/imm32/subx-name
7352 0/imm32/no-rm32
7353 0/imm32/no-r32
7354 0/imm32/no-imm32
7355 1/imm32/disp32-is-first-inout
7356 0/imm32/no-output
7357 _Primitive-break-if-<-named/imm32/next
7358 _Primitive-break-if-<-named:
7359 "break-if-<"/imm32/name
7360 Single-lit-var/imm32/inouts
7361 0/imm32/outputs
7362 "0f 8c/jump-if-<"/imm32/subx-name
7363 0/imm32/no-rm32
7364 0/imm32/no-r32
7365 0/imm32/no-imm32
7366 1/imm32/disp32-is-first-inout
7367 0/imm32/no-output
7368 _Primitive-break-if->=-named/imm32/next
7369 _Primitive-break-if->=-named:
7370 "break-if->="/imm32/name
7371 Single-lit-var/imm32/inouts
7372 0/imm32/outputs
7373 "0f 8d/jump-if->="/imm32/subx-name
7374 0/imm32/no-rm32
7375 0/imm32/no-r32
7376 0/imm32/no-imm32
7377 1/imm32/disp32-is-first-inout
7378 0/imm32/no-output
7379 _Primitive-break-if-<=-named/imm32/next
7380 _Primitive-break-if-<=-named:
7381 "break-if-<="/imm32/name
7382 Single-lit-var/imm32/inouts
7383 0/imm32/outputs
7384 "0f 8e/jump-if-<="/imm32/subx-name
7385 0/imm32/no-rm32
7386 0/imm32/no-r32
7387 0/imm32/no-imm32
7388 1/imm32/disp32-is-first-inout
7389 0/imm32/no-output
7390 _Primitive-break-if->-named/imm32/next
7391 _Primitive-break-if->-named:
7392 "break-if->"/imm32/name
7393 Single-lit-var/imm32/inouts
7394 0/imm32/outputs
7395 "0f 8f/jump-if->"/imm32/subx-name
7396 0/imm32/no-rm32
7397 0/imm32/no-r32
7398 0/imm32/no-imm32
7399 1/imm32/disp32-is-first-inout
7400 0/imm32/no-output
7401 _Primitive-break-named/imm32/next
7402 _Primitive-break-named:
7403 "break"/imm32/name
7404 Single-lit-var/imm32/inouts
7405 0/imm32/outputs
7406 "e9/jump"/imm32/subx-name
7407 0/imm32/no-rm32
7408 0/imm32/no-r32
7409 0/imm32/no-imm32
7410 1/imm32/disp32-is-first-inout
7411 0/imm32/no-output
7412 _Primitive-loop-if-addr<-named/imm32/next
7413 _Primitive-loop-if-addr<-named:
7414 "loop-if-addr<"/imm32/name
7415 Single-lit-var/imm32/inouts
7416 0/imm32/outputs
7417 "0f 82/jump-if-addr<"/imm32/subx-name
7418 0/imm32/no-rm32
7419 0/imm32/no-r32
7420 0/imm32/no-imm32
7421 1/imm32/disp32-is-first-inout
7422 0/imm32/no-output
7423 _Primitive-loop-if-addr>=-named/imm32/next
7424 _Primitive-loop-if-addr>=-named:
7425 "loop-if-addr>="/imm32/name
7426 Single-lit-var/imm32/inouts
7427 0/imm32/outputs
7428 "0f 83/jump-if-addr>="/imm32/subx-name
7429 0/imm32/no-rm32
7430 0/imm32/no-r32
7431 0/imm32/no-imm32
7432 1/imm32/disp32-is-first-inout
7433 0/imm32/no-output
7434 _Primitive-loop-if-=-named/imm32/next
7435 _Primitive-loop-if-=-named:
7436 "loop-if-="/imm32/name
7437 Single-lit-var/imm32/inouts
7438 0/imm32/outputs
7439 "0f 84/jump-if-="/imm32/subx-name
7440 0/imm32/no-rm32
7441 0/imm32/no-r32
7442 0/imm32/no-imm32
7443 1/imm32/disp32-is-first-inout
7444 0/imm32/no-output
7445 _Primitive-loop-if-!=-named/imm32/next
7446 _Primitive-loop-if-!=-named:
7447 "loop-if-!="/imm32/name
7448 Single-lit-var/imm32/inouts
7449 0/imm32/outputs
7450 "0f 85/jump-if-!="/imm32/subx-name
7451 0/imm32/no-rm32
7452 0/imm32/no-r32
7453 0/imm32/no-imm32
7454 1/imm32/disp32-is-first-inout
7455 0/imm32/no-output
7456 _Primitive-loop-if-addr<=-named/imm32/next
7457 _Primitive-loop-if-addr<=-named:
7458 "loop-if-addr<="/imm32/name
7459 Single-lit-var/imm32/inouts
7460 0/imm32/outputs
7461 "0f 86/jump-if-addr<="/imm32/subx-name
7462 0/imm32/no-rm32
7463 0/imm32/no-r32
7464 0/imm32/no-imm32
7465 1/imm32/disp32-is-first-inout
7466 0/imm32/no-output
7467 _Primitive-loop-if-addr>-named/imm32/next
7468 _Primitive-loop-if-addr>-named:
7469 "loop-if-addr>"/imm32/name
7470 Single-lit-var/imm32/inouts
7471 0/imm32/outputs
7472 "0f 87/jump-if-addr>"/imm32/subx-name
7473 0/imm32/no-rm32
7474 0/imm32/no-r32
7475 0/imm32/no-imm32
7476 1/imm32/disp32-is-first-inout
7477 0/imm32/no-output
7478 _Primitive-loop-if-<-named/imm32/next
7479 _Primitive-loop-if-<-named:
7480 "loop-if-<"/imm32/name
7481 Single-lit-var/imm32/inouts
7482 0/imm32/outputs
7483 "0f 8c/jump-if-<"/imm32/subx-name
7484 0/imm32/no-rm32
7485 0/imm32/no-r32
7486 0/imm32/no-imm32
7487 1/imm32/disp32-is-first-inout
7488 0/imm32/no-output
7489 _Primitive-loop-if->=-named/imm32/next
7490 _Primitive-loop-if->=-named:
7491 "loop-if->="/imm32/name
7492 Single-lit-var/imm32/inouts
7493 0/imm32/outputs
7494 "0f 8d/jump-if->="/imm32/subx-name
7495 0/imm32/no-rm32
7496 0/imm32/no-r32
7497 0/imm32/no-imm32
7498 1/imm32/disp32-is-first-inout
7499 0/imm32/no-output
7500 _Primitive-loop-if-<=-named/imm32/next
7501 _Primitive-loop-if-<=-named:
7502 "loop-if-<="/imm32/name
7503 Single-lit-var/imm32/inouts
7504 0/imm32/outputs
7505 "0f 8e/jump-if-<="/imm32/subx-name
7506 0/imm32/no-rm32
7507 0/imm32/no-r32
7508 0/imm32/no-imm32
7509 1/imm32/disp32-is-first-inout
7510 0/imm32/no-output
7511 _Primitive-loop-if->-named/imm32/next
7512 _Primitive-loop-if->-named:
7513 "loop-if->"/imm32/name
7514 Single-lit-var/imm32/inouts
7515 0/imm32/outputs
7516 "0f 8f/jump-if->"/imm32/subx-name
7517 0/imm32/no-rm32
7518 0/imm32/no-r32
7519 0/imm32/no-imm32
7520 1/imm32/disp32-is-first-inout
7521 0/imm32/no-output
7522 _Primitive-loop-named/imm32/next
7523 _Primitive-loop-named:
7524 "loop"/imm32/name
7525 Single-lit-var/imm32/inouts
7526 0/imm32/outputs
7527 "e9/jump"/imm32/subx-name
7528 0/imm32/no-rm32
7529 0/imm32/no-r32
7530 0/imm32/no-imm32
7531 1/imm32/disp32-is-first-inout
7532 0/imm32/no-output
7533 0/imm32/next
7534
7535 Single-int-var-in-mem:
7536 Int-var-in-mem/imm32
7537 0/imm32/next
7538
7539 Int-var-in-mem:
7540 "arg1"/imm32/name
7541 Type-int/imm32
7542 1/imm32/some-block-depth
7543 1/imm32/some-stack-offset
7544 0/imm32/no-register
7545
7546 Two-args-int-stack-int-reg:
7547 Int-var-in-mem/imm32
7548 Single-int-var-in-some-register/imm32/next
7549
7550 Two-args-int-reg-int-stack:
7551 Int-var-in-some-register/imm32
7552 Single-int-var-in-mem/imm32/next
7553
7554 Two-args-int-eax-int-literal:
7555 Int-var-in-eax/imm32
7556 Single-lit-var/imm32/next
7557
7558 Int-var-and-literal:
7559 Int-var-in-mem/imm32
7560 Single-lit-var/imm32/next
7561
7562 Int-var-in-register-and-literal:
7563 Int-var-in-some-register/imm32
7564 Single-lit-var/imm32/next
7565
7566 Single-int-var-in-some-register:
7567 Int-var-in-some-register/imm32
7568 0/imm32/next
7569
7570 Int-var-in-some-register:
7571 "arg1"/imm32/name
7572 Type-int/imm32
7573 1/imm32/some-block-depth
7574 0/imm32/no-stack-offset
7575 Any-register/imm32
7576
7577 Single-int-var-in-eax:
7578 Int-var-in-eax/imm32
7579 0/imm32/next
7580
7581 Int-var-in-eax:
7582 "arg1"/imm32/name
7583 Type-int/imm32
7584 1/imm32/some-block-depth
7585 0/imm32/no-stack-offset
7586 "eax"/imm32/register
7587
7588 Single-int-var-in-ecx:
7589 Int-var-in-ecx/imm32
7590 0/imm32/next
7591
7592 Int-var-in-ecx:
7593 "arg1"/imm32/name
7594 Type-int/imm32
7595 1/imm32/some-block-depth
7596 0/imm32/no-stack-offset
7597 "ecx"/imm32/register
7598
7599 Single-int-var-in-edx:
7600 Int-var-in-edx/imm32
7601 0/imm32/next
7602
7603 Int-var-in-edx:
7604 "arg1"/imm32/name
7605 Type-int/imm32
7606 1/imm32/some-block-depth
7607 0/imm32/no-stack-offset
7608 "edx"/imm32/register
7609
7610 Single-int-var-in-ebx:
7611 Int-var-in-ebx/imm32
7612 0/imm32/next
7613
7614 Int-var-in-ebx:
7615 "arg1"/imm32/name
7616 Type-int/imm32
7617 1/imm32/some-block-depth
7618 0/imm32/no-stack-offset
7619 "ebx"/imm32/register
7620
7621 Single-int-var-in-esi:
7622 Int-var-in-esi/imm32
7623 0/imm32/next
7624
7625 Int-var-in-esi:
7626 "arg1"/imm32/name
7627 Type-int/imm32
7628 1/imm32/some-block-depth
7629 0/imm32/no-stack-offset
7630 "esi"/imm32/register
7631
7632 Single-int-var-in-edi:
7633 Int-var-in-edi/imm32
7634 0/imm32/next
7635
7636 Int-var-in-edi:
7637 "arg1"/imm32/name
7638 Type-int/imm32
7639 1/imm32/some-block-depth
7640 0/imm32/no-stack-offset
7641 "edi"/imm32/register
7642
7643 Single-lit-var:
7644 Lit-var/imm32
7645 0/imm32/next
7646
7647 Lit-var:
7648 "literal"/imm32/name
7649 Type-literal/imm32
7650 1/imm32/some-block-depth
7651 0/imm32/no-stack-offset
7652 0/imm32/no-register
7653
7654 Type-int:
7655 1/imm32/left/int
7656 0/imm32/right/null
7657
7658 Type-literal:
7659 0/imm32/left/literal
7660 0/imm32/right/null
7661
7662 == code
7663 emit-subx-primitive:
7664
7665 55/push-ebp
7666 89/<- %ebp 4/r32/esp
7667
7668 50/push-eax
7669 51/push-ecx
7670
7671 8b/-> *(ebp+0x10) 1/r32/ecx
7672
7673 (emit-indent *(ebp+8) *Curr-block-depth)
7674 (write-buffered *(ebp+8) *(ecx+0xc))
7675
7676 (emit-subx-rm32 *(ebp+8) *(ecx+0x10) *(ebp+0xc))
7677
7678 (emit-subx-r32 *(ebp+8) *(ecx+0x14) *(ebp+0xc))
7679
7680 (emit-subx-imm32 *(ebp+8) *(ecx+0x18) *(ebp+0xc))
7681
7682 (emit-subx-disp32 *(ebp+8) *(ecx+0x1c) *(ebp+0xc))
7683 (write-buffered *(ebp+8) Newline)
7684 $emit-subx-primitive:end:
7685
7686 59/pop-to-ecx
7687 58/pop-to-eax
7688
7689 89/<- %esp 5/r32/ebp
7690 5d/pop-to-ebp
7691 c3/return
7692
7693 emit-subx-rm32:
7694
7695 55/push-ebp
7696 89/<- %ebp 4/r32/esp
7697
7698 50/push-eax
7699
7700 81 7/subop/compare *(ebp+0xc) 0/imm32
7701 74/jump-if-= $emit-subx-rm32:end/disp8
7702
7703 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
7704 (emit-subx-var-as-rm32 *(ebp+8) %eax)
7705 $emit-subx-rm32:end:
7706
7707 58/pop-to-eax
7708
7709 89/<- %esp 5/r32/ebp
7710 5d/pop-to-ebp
7711 c3/return
7712
7713 get-stmt-operand-from-arg-location:
7714
7715 55/push-ebp
7716 89/<- %ebp 4/r32/esp
7717
7718 51/push-ecx
7719
7720 8b/-> *(ebp+0xc) 0/r32/eax
7721
7722 8b/-> *(ebp+8) 1/r32/ecx
7723
7724 {
7725 3d/compare-eax-and 1/imm32
7726 75/jump-if-!= break/disp8
7727 $get-stmt-operand-from-arg-location:1:
7728 8b/-> *(ecx+8) 0/r32/eax
7729 eb/jump $get-stmt-operand-from-arg-location:end/disp8
7730 }
7731
7732 {
7733 3d/compare-eax-and 2/imm32
7734 75/jump-if-!= break/disp8
7735 $get-stmt-operand-from-arg-location:2:
7736 8b/-> *(ecx+8) 0/r32/eax
7737 8b/-> *(eax+4) 0/r32/eax
7738 eb/jump $get-stmt-operand-from-arg-location:end/disp8
7739 }
7740
7741 {
7742 3d/compare-eax-and 3/imm32
7743 75/jump-if-!= break/disp8
7744 $get-stmt-operand-from-arg-location:3:
7745 8b/-> *(ecx+0xc) 0/r32/eax
7746 eb/jump $get-stmt-operand-from-arg-location:end/disp8
7747 }
7748
7749 e9/jump $get-stmt-operand-from-arg-location:abort/disp32
7750 $get-stmt-operand-from-arg-location:end:
7751
7752 59/pop-to-ecx
7753
7754 89/<- %esp 5/r32/ebp
7755 5d/pop-to-ebp
7756 c3/return
7757
7758 $get-stmt-operand-from-arg-location:abort:
7759
7760 (write-buffered Stderr "invalid arg-location ")
7761 (print-int32-buffered Stderr %eax)
7762 (write-buffered Stderr Newline)
7763 (flush Stderr)
7764
7765 bb/copy-to-ebx 1/imm32
7766 b8/copy-to-eax 1/imm32/exit
7767 cd/syscall 0x80/imm8
7768
7769
7770 emit-subx-r32:
7771
7772 55/push-ebp
7773 89/<- %ebp 4/r32/esp
7774
7775 50/push-eax
7776 51/push-ecx
7777
7778 81 7/subop/compare *(ebp+0xc) 0/imm32
7779 0f 84/jump-if-= $emit-subx-r32:end/disp32
7780
7781 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
7782 8b/-> *eax 0/r32/eax
7783 (maybe-get Registers *(eax+0x10) 8)
7784 (write-buffered *(ebp+8) Space)
7785 (print-int32-buffered *(ebp+8) *eax)
7786 (write-buffered *(ebp+8) "/r32")
7787 $emit-subx-r32:end:
7788
7789 59/pop-to-ecx
7790 58/pop-to-eax
7791
7792 89/<- %esp 5/r32/ebp
7793 5d/pop-to-ebp
7794 c3/return
7795
7796 emit-subx-imm32:
7797
7798 55/push-ebp
7799 89/<- %ebp 4/r32/esp
7800
7801 50/push-eax
7802 51/push-ecx
7803
7804 81 7/subop/compare *(ebp+0xc) 0/imm32
7805 74/jump-if-= $emit-subx-imm32:end/disp8
7806
7807 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
7808 8b/-> *eax 0/r32/eax
7809 (write-buffered *(ebp+8) Space)
7810 (write-buffered *(ebp+8) *eax)
7811 (write-buffered *(ebp+8) "/imm32")
7812 $emit-subx-imm32:end:
7813
7814 59/pop-to-ecx
7815 58/pop-to-eax
7816
7817 89/<- %esp 5/r32/ebp
7818 5d/pop-to-ebp
7819 c3/return
7820
7821 emit-subx-disp32:
7822
7823 55/push-ebp
7824 89/<- %ebp 4/r32/esp
7825
7826 50/push-eax
7827 51/push-ecx
7828
7829 81 7/subop/compare *(ebp+0xc) 0/imm32
7830 0f 84/jump-if-= $emit-subx-disp32:end/disp32
7831
7832 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
7833 8b/-> *eax 0/r32/eax
7834 (write-buffered *(ebp+8) Space)
7835 (write-buffered *(ebp+8) *eax)
7836
7837
7838 8b/-> *(ebp+0x10) 0/r32/eax
7839 8b/-> *(eax+4) 1/r32/ecx
7840 {
7841 (string-starts-with? %ecx "break")
7842 3d/compare-eax-and 0/imm32/false
7843 74/jump-if-= break/disp8
7844 (write-buffered *(ebp+8) ":break")
7845 }
7846
7847 {
7848 (string-starts-with? %ecx "loop")
7849 3d/compare-eax-and 0/imm32/false
7850 74/jump-if-= break/disp8
7851 (write-buffered *(ebp+8) ":loop")
7852 }
7853 (write-buffered *(ebp+8) "/disp32")
7854 $emit-subx-disp32:end:
7855
7856 59/pop-to-ecx
7857 58/pop-to-eax
7858
7859 89/<- %esp 5/r32/ebp
7860 5d/pop-to-ebp
7861 c3/return
7862
7863 emit-subx-call:
7864
7865 55/push-ebp
7866 89/<- %ebp 4/r32/esp
7867
7868 51/push-ecx
7869
7870 (emit-indent *(ebp+8) *Curr-block-depth)
7871 (write-buffered *(ebp+8) "(")
7872
7873 8b/-> *(ebp+0x10) 1/r32/ecx
7874 (write-buffered *(ebp+8) *(ecx+4))
7875
7876
7877 8b/-> *(ebp+0xc) 1/r32/ecx
7878 8b/-> *(ecx+8) 1/r32/ecx
7879 {
7880
7881 81 7/subop/compare %ecx 0/imm32
7882 74/jump-if-= break/disp8
7883
7884 (emit-subx-call-operand *(ebp+8) %ecx)
7885
7886 8b/-> *(ecx+4) 1/r32/ecx
7887 eb/jump loop/disp8
7888 }
7889
7890 (write-buffered *(ebp+8) ")\n")
7891 $emit-subx-call:end:
7892
7893 59/pop-to-ecx
7894
7895 89/<- %esp 5/r32/ebp
7896 5d/pop-to-ebp
7897 c3/return
7898
7899
7900
7901 emit-hailmary-call:
7902
7903 55/push-ebp
7904 89/<- %ebp 4/r32/esp
7905
7906 51/push-ecx
7907
7908 (emit-indent *(ebp+8) *Curr-block-depth)
7909 (write-buffered *(ebp+8) "(")
7910
7911 8b/-> *(ebp+0xc) 1/r32/ecx
7912
7913 (write-buffered *(ebp+8) *(ecx+4))
7914
7915
7916 8b/-> *(ecx+8) 1/r32/ecx
7917 {
7918
7919 81 7/subop/compare %ecx 0/imm32
7920 74/jump-if-= break/disp8
7921
7922 (emit-subx-call-operand *(ebp+8) %ecx)
7923
7924 8b/-> *(ecx+4) 1/r32/ecx
7925 eb/jump loop/disp8
7926 }
7927
7928 (write-buffered *(ebp+8) ")\n")
7929 $emit-hailmary-call:end:
7930
7931 59/pop-to-ecx
7932
7933 89/<- %esp 5/r32/ebp
7934 5d/pop-to-ebp
7935 c3/return
7936
7937 emit-subx-call-operand:
7938
7939
7940 55/push-ebp
7941 89/<- %ebp 4/r32/esp
7942
7943 50/push-eax
7944 51/push-ecx
7945 56/push-esi
7946
7947 8b/-> *(ebp+0xc) 1/r32/ecx
7948
7949 8b/-> *ecx 6/r32/esi
7950
7951 {
7952 $emit-subx-call-operand:check-for-register-indirect:
7953 81 7/subop/compare *(esi+0x10) 0/imm32
7954 74/jump-if-= break/disp8
7955 81 7/subop/compare *(ecx+8) 0/imm32/false
7956 74/jump-if-= break/disp8
7957 $emit-subx-call-operand:register-indirect:
7958 (write-buffered *(ebp+8) " *")
7959 (write-buffered *(ebp+8) *(esi+0x10))
7960 e9/jump $emit-subx-call-operand:end/disp32
7961 }
7962
7963 {
7964 $emit-subx-call-operand:check-for-register-direct:
7965 81 7/subop/compare *(esi+0x10) 0/imm32
7966 74/jump-if-= break/disp8
7967 81 7/subop/compare *(ecx+8) 0/imm32/false
7968 75/jump-if-!= break/disp8
7969 $emit-subx-call-operand:register-direct:
7970 (write-buffered *(ebp+8) " %")
7971 (write-buffered *(ebp+8) *(esi+0x10))
7972 e9/jump $emit-subx-call-operand:end/disp32
7973 }
7974
7975 {
7976 81 7/subop/compare *(esi+0xc) 0/imm32
7977 74/jump-if-= break/disp8
7978 $emit-subx-call-operand:stack:
7979 (write-buffered *(ebp+8) Space)
7980 (write-buffered *(ebp+8) "*(ebp+")
7981 (print-int32-buffered *(ebp+8) *(esi+0xc))
7982 (write-buffered *(ebp+8) ")")
7983 e9/jump $emit-subx-call-operand:end/disp32
7984 }
7985
7986 {
7987 8b/-> *(esi+4) 0/r32/eax
7988 81 7/subop/compare *eax 0/imm32
7989 75/jump-if-!= break/disp8
7990 $emit-subx-call-operand:literal:
7991 (write-buffered *(ebp+8) Space)
7992 (write-buffered *(ebp+8) *esi)
7993 }
7994 $emit-subx-call-operand:end:
7995
7996 5e/pop-to-esi
7997 59/pop-to-ecx
7998 58/pop-to-eax
7999
8000 89/<- %esp 5/r32/ebp
8001 5d/pop-to-ebp
8002 c3/return
8003
8004 emit-subx-var-as-rm32:
8005
8006 55/push-ebp
8007 89/<- %ebp 4/r32/esp
8008
8009 50/push-eax
8010 51/push-ecx
8011 56/push-esi
8012
8013 8b/-> *(ebp+0xc) 1/r32/ecx
8014
8015 8b/-> *ecx 6/r32/esi
8016
8017 {
8018 $emit-subx-var-as-rm32:check-for-register-indirect:
8019 81 7/subop/compare *(esi+0x10) 0/imm32
8020 74/jump-if-= break/disp8
8021 81 7/subop/compare *(ecx+8) 0/imm32/false
8022 74/jump-if-= break/disp8
8023 $emit-subx-var-as-rm32:register-indirect:
8024 (write-buffered *(ebp+8) " *")
8025 (write-buffered *(ebp+8) *(esi+0x10))
8026 }
8027
8028 {
8029 $emit-subx-var-as-rm32:check-for-register-direct:
8030 81 7/subop/compare *(esi+0x10) 0/imm32
8031 74/jump-if-= break/disp8
8032 81 7/subop/compare *(ecx+8) 0/imm32/false
8033 75/jump-if-!= break/disp8
8034 $emit-subx-var-as-rm32:register-direct:
8035 (write-buffered *(ebp+8) " %")
8036 (write-buffered *(ebp+8) *(esi+0x10))
8037 }
8038
8039 {
8040 81 7/subop/compare *(esi+0xc) 0/imm32
8041 74/jump-if-= break/disp8
8042 $emit-subx-var-as-rm32:stack:
8043 (write-buffered *(ebp+8) Space)
8044 (write-buffered *(ebp+8) "*(ebp+")
8045 (print-int32-buffered *(ebp+8) *(esi+0xc))
8046 (write-buffered *(ebp+8) ")")
8047 }
8048 $emit-subx-var-as-rm32:end:
8049
8050 5e/pop-to-esi
8051 59/pop-to-ecx
8052 58/pop-to-eax
8053
8054 89/<- %esp 5/r32/ebp
8055 5d/pop-to-ebp
8056 c3/return
8057
8058 find-matching-function:
8059
8060 55/push-ebp
8061 89/<- %ebp 4/r32/esp
8062
8063 51/push-ecx
8064
8065 8b/-> *(ebp+8) 1/r32/ecx
8066 {
8067
8068 81 7/subop/compare %ecx 0/imm32
8069 74/jump-if-= break/disp8
8070
8071 {
8072 (mu-stmt-matches-function? *(ebp+0xc) %ecx)
8073 3d/compare-eax-and 0/imm32/false
8074 74/jump-if-= break/disp8
8075 89/<- %eax 1/r32/ecx
8076 eb/jump $find-matching-function:end/disp8
8077 }
8078
8079 8b/-> *(ecx+0x14) 1/r32/ecx
8080 eb/jump loop/disp8
8081 }
8082
8083 b8/copy-to-eax 0/imm32
8084 $find-matching-function:end:
8085
8086 59/pop-to-ecx
8087
8088 89/<- %esp 5/r32/ebp
8089 5d/pop-to-ebp
8090 c3/return
8091
8092 find-matching-primitive:
8093
8094 55/push-ebp
8095 89/<- %ebp 4/r32/esp
8096
8097 51/push-ecx
8098
8099 8b/-> *(ebp+8) 1/r32/ecx
8100 {
8101 $find-matching-primitive:loop:
8102
8103 81 7/subop/compare %ecx 0/imm32
8104 0f 84/jump-if-= break/disp32
8105
8106
8107
8108
8109
8110
8111
8112 {
8113 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx)
8114 3d/compare-eax-and 0/imm32/false
8115 74/jump-if-= break/disp8
8116 89/<- %eax 1/r32/ecx
8117 eb/jump $find-matching-primitive:end/disp8
8118 }
8119 $find-matching-primitive:next-primitive:
8120
8121 8b/-> *(ecx+0x24) 1/r32/ecx
8122 e9/jump loop/disp32
8123 }
8124
8125 b8/copy-to-eax 0/imm32
8126 $find-matching-primitive:end:
8127
8128 59/pop-to-ecx
8129
8130 89/<- %esp 5/r32/ebp
8131 5d/pop-to-ebp
8132 c3/return
8133
8134 mu-stmt-matches-function?:
8135
8136 55/push-ebp
8137 89/<- %ebp 4/r32/esp
8138
8139 51/push-ecx
8140
8141 8b/-> *(ebp+8) 1/r32/ecx
8142 8b/-> *(ebp+0xc) 0/r32/eax
8143 (string-equal? *(ecx+4) *eax)
8144 $mu-stmt-matches-function?:end:
8145
8146 59/pop-to-ecx
8147
8148 89/<- %esp 5/r32/ebp
8149 5d/pop-to-ebp
8150 c3/return
8151
8152 mu-stmt-matches-primitive?:
8153
8154
8155
8156
8157
8158
8159 55/push-ebp
8160 89/<- %ebp 4/r32/esp
8161
8162 51/push-ecx
8163 52/push-edx
8164 53/push-ebx
8165 56/push-esi
8166 57/push-edi
8167
8168 8b/-> *(ebp+8) 1/r32/ecx
8169
8170 8b/-> *(ebp+0xc) 2/r32/edx
8171 {
8172 $mu-stmt-matches-primitive?:check-name:
8173
8174 (string-equal? *(ecx+4) *edx)
8175 3d/compare-eax-and 0/imm32/false
8176 75/jump-if-!= break/disp8
8177 b8/copy-to-eax 0/imm32
8178 e9/jump $mu-stmt-matches-primitive?:end/disp32
8179 }
8180 $mu-stmt-matches-primitive?:check-inouts:
8181
8182 8b/-> *(ecx+8) 6/r32/esi
8183 8b/-> *(edx+4) 7/r32/edi
8184 {
8185
8186 {
8187 81 7/subop/compare %esi 0/imm32
8188 75/jump-if-!= break/disp8
8189 $mu-stmt-matches-primitive?:stmt-inout-is-null:
8190 {
8191 81 7/subop/compare %edi 0/imm32
8192 75/jump-if-!= break/disp8
8193
8194 e9/jump $mu-stmt-matches-primitive?:check-outputs/disp32
8195 }
8196
8197 b8/copy-to-eax 0/imm32/false
8198 e9/jump $mu-stmt-matches-primitive?:end/disp32
8199 }
8200
8201 {
8202 81 7/subop/compare %edi 0/imm32
8203 75/jump-if-!= break/disp8
8204 $mu-stmt-matches-primitive?:prim-inout-is-null:
8205 b8/copy-to-eax 0/imm32/false
8206 e9/jump $mu-stmt-matches-primitive?:end/disp32
8207 }
8208
8209 {
8210 (operand-matches-primitive? %esi *edi)
8211 3d/compare-eax-and 0/imm32/false
8212 75/jump-if-!= break/disp8
8213 b8/copy-to-eax 0/imm32/false
8214 e9/jump $mu-stmt-matches-primitive?:end/disp32
8215 }
8216
8217 8b/-> *(esi+4) 6/r32/esi
8218
8219 8b/-> *(edi+4) 7/r32/edi
8220 eb/jump loop/disp8
8221 }
8222 $mu-stmt-matches-primitive?:check-outputs:
8223
8224 8b/-> *(ecx+0xc) 6/r32/esi
8225 8b/-> *(edx+8) 7/r32/edi
8226 {
8227
8228 {
8229 $mu-stmt-matches-primitive?:check-output:
8230 81 7/subop/compare %esi 0/imm32
8231 75/jump-if-!= break/disp8
8232 {
8233 81 7/subop/compare %edi 0/imm32
8234 75/jump-if-!= break/disp8
8235
8236 b8/copy-to-eax 1/imm32
8237 e9/jump $mu-stmt-matches-primitive?:end/disp32
8238 }
8239
8240 b8/copy-to-eax 0/imm32
8241 e9/jump $mu-stmt-matches-primitive?:end/disp32
8242 }
8243
8244 {
8245 81 7/subop/compare %edi 0/imm32
8246 75/jump-if-!= break/disp8
8247 b8/copy-to-eax 0/imm32
8248 e9/jump $mu-stmt-matches-primitive?:end/disp32
8249 }
8250
8251 {
8252 (operand-matches-primitive? %esi *edi)
8253 3d/compare-eax-and 0/imm32/false
8254 75/jump-if-!= break/disp8
8255 b8/copy-to-eax 0/imm32
8256 e9/jump $mu-stmt-matches-primitive?:end/disp32
8257 }
8258
8259 8b/-> *(esi+4) 6/r32/esi
8260
8261 8b/-> *(edi+4) 7/r32/edi
8262 eb/jump loop/disp8
8263 }
8264 $mu-stmt-matches-primitive?:return-true:
8265 b8/copy-to-eax 1/imm32
8266 $mu-stmt-matches-primitive?:end:
8267
8268 5f/pop-to-edi
8269 5e/pop-to-esi
8270 5b/pop-to-ebx
8271 5a/pop-to-edx
8272 59/pop-to-ecx
8273
8274 89/<- %esp 5/r32/ebp
8275 5d/pop-to-ebp
8276 c3/return
8277
8278 operand-matches-primitive?:
8279
8280 55/push-ebp
8281 89/<- %ebp 4/r32/esp
8282
8283 51/push-ecx
8284 56/push-esi
8285 57/push-edi
8286
8287 8b/-> *(ebp+8) 1/r32/ecx
8288
8289 8b/-> *ecx 6/r32/esi
8290
8291 8b/-> *(ebp+0xc) 7/r32/edi
8292 $operand-matches-primitive?:check-type:
8293
8294 (subx-type-equal? *(esi+4) *(edi+4))
8295 3d/compare-eax-and 0/imm32/false
8296 b8/copy-to-eax 0/imm32/false
8297 0f 84/jump-if-= $operand-matches-primitive?:end/disp32
8298 {
8299 $operand-matches-primitive?:check-register:
8300
8301 {
8302 81 7/subop/compare *(edi+0x10) 0/imm32
8303 0f 85/jump-if-!= break/disp32
8304 81 7/subop/compare *(esi+0x10) 0/imm32
8305 74/jump-if-= break/disp8
8306 81 7/subop/compare *(ecx+8) 0/imm32/false
8307 74/jump-if-= break/disp8
8308 e9/jump $operand-matches-primitive?:return-true/disp32
8309 }
8310
8311 {
8312 81 7/subop/compare *(edi+0x10) 0/imm32
8313 0f 84/jump-if-= break/disp32
8314 81 7/subop/compare *(esi+0x10) 0/imm32
8315 0f 84/jump-if-= break/disp32
8316 81 7/subop/compare *(ecx+8) 0/imm32/false
8317 74/jump-if-= break/disp8
8318 e9/jump $operand-matches-primitive?:return-false/disp32
8319 }
8320
8321 {
8322
8323 8b/-> *(esi+0x10) 0/r32/eax
8324 39/compare *(edi+0x10) 0/r32/eax
8325 74/jump-if-= break/disp8
8326
8327 3d/compare-eax-and 0/imm32
8328 74/jump-if-= $operand-matches-primitive?:end/disp8
8329 81 7/subop/compare *(edi+0x10) 0/imm32
8330 74/jump-if-= $operand-matches-primitive?:return-false/disp8
8331
8332 (string-equal? *(edi+0x10) Any-register)
8333 3d/compare-eax-and 0/imm32/false
8334 75/jump-if-!= break/disp8
8335
8336 (string-equal? *(esi+0x10) *(edi+0x10))
8337 3d/compare-eax-and 0/imm32/false
8338 74/jump-if-= $operand-matches-primitive?:return-false/disp8
8339 }
8340 }
8341 $operand-matches-primitive?:return-true:
8342 b8/copy-to-eax 1/imm32/true
8343 eb/jump $operand-matches-primitive?:end/disp8
8344 $operand-matches-primitive?:return-false:
8345 b8/copy-to-eax 0/imm32/false
8346 $operand-matches-primitive?:end:
8347
8348 5f/pop-to-edi
8349 5e/pop-to-esi
8350 59/pop-to-ecx
8351
8352 89/<- %esp 5/r32/ebp
8353 5d/pop-to-ebp
8354 c3/return
8355
8356 subx-type-equal?:
8357
8358 55/push-ebp
8359 89/<- %ebp 4/r32/esp
8360
8361 51/push-ecx
8362
8363 (is-literal-type? *(ebp+8))
8364 89/<- %ecx 0/r32/eax
8365
8366 (is-literal-type? *(ebp+0xc))
8367
8368 39/compare %eax 1/r32/ecx
8369 74/jump-if-= $subx-type-equal?:true/disp8
8370 $subx-type-equal?:false:
8371 b8/copy-to-eax 0/imm32/false
8372 eb/jump $subx-type-equal?:end/disp8
8373 $subx-type-equal?:true:
8374 b8/copy-to-eax 1/imm32/true
8375 $subx-type-equal?:end:
8376
8377 59/pop-to-ecx
8378
8379 89/<- %esp 5/r32/ebp
8380 5d/pop-to-ebp
8381 c3/return
8382
8383 is-literal-type?:
8384
8385 55/push-ebp
8386 89/<- %ebp 4/r32/esp
8387
8388 8b/-> *(ebp+8) 0/r32/eax
8389 8b/-> *eax 0/r32/eax
8390 3d/compare-eax-and 0/imm32/false
8391 74/jump-if-equal $is-literal-type?:end/disp8
8392 b8/copy-to-eax 1/imm32/true
8393 $is-literal-type?:end:
8394
8395 89/<- %esp 5/r32/ebp
8396 5d/pop-to-ebp
8397 c3/return
8398
8399 test-emit-subx-stmt-primitive:
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418 55/push-ebp
8419 89/<- %ebp 4/r32/esp
8420
8421 (clear-stream _test-output-stream)
8422 (clear-stream $_test-output-buffered-file->buffer)
8423
8424 68/push 0/imm32/right/null
8425 68/push 1/imm32/left/int
8426 89/<- %ecx 4/r32/esp
8427
8428 68/push 0/imm32/no-register
8429 68/push -8/imm32/stack-offset
8430 68/push 1/imm32/block-depth
8431 51/push-ecx
8432 68/push "foo"/imm32
8433 89/<- %ecx 4/r32/esp
8434
8435 68/push 0/imm32/is-deref:false
8436 68/push 0/imm32/next
8437 51/push-ecx/var-foo
8438 89/<- %ebx 4/r32/esp
8439
8440 68/push 0/imm32/next
8441 68/push 0/imm32/outputs
8442 53/push-ebx/operands
8443 68/push "increment"/imm32/operation
8444 68/push 1/imm32
8445 89/<- %esi 4/r32/esp
8446
8447 68/push 0/imm32/next
8448 68/push 0/imm32/output-is-write-only
8449 68/push 0/imm32/no-disp32
8450 68/push 0/imm32/no-imm32
8451 68/push 0/imm32/no-r32
8452 68/push 1/imm32/rm32-is-first-inout
8453 68/push "ff 0/subop/increment"/imm32/subx-name
8454 68/push 0/imm32/outputs
8455 53/push-ebx/inouts
8456 68/push "increment"/imm32/name
8457 89/<- %ebx 4/r32/esp
8458
8459 c7 0/subop/copy *Curr-block-depth 0/imm32
8460 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
8461 (flush _test-output-buffered-file)
8462 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8468
8469 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive")
8470
8471 89/<- %esp 5/r32/ebp
8472 5d/pop-to-ebp
8473 c3/return
8474
8475 test-emit-subx-stmt-primitive-register:
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494 55/push-ebp
8495 89/<- %ebp 4/r32/esp
8496
8497 (clear-stream _test-output-stream)
8498 (clear-stream $_test-output-buffered-file->buffer)
8499
8500 68/push 0/imm32/right/null
8501 68/push 1/imm32/left/int
8502 89/<- %ecx 4/r32/esp
8503
8504 68/push "eax"/imm32/register
8505 68/push 0/imm32/no-stack-offset
8506 68/push 1/imm32/block-depth
8507 51/push-ecx
8508 68/push "foo"/imm32
8509 89/<- %ecx 4/r32/esp
8510
8511 68/push 0/imm32/is-deref:false
8512 68/push 0/imm32/next
8513 51/push-ecx/var-foo
8514 89/<- %ebx 4/r32/esp
8515
8516 68/push 0/imm32/next
8517 53/push-ebx/outputs
8518 68/push 0/imm32/inouts
8519 68/push "increment"/imm32/operation
8520 68/push 1/imm32
8521 89/<- %esi 4/r32/esp
8522
8523 68/push Any-register/imm32
8524 68/push 0/imm32/no-stack-offset
8525 68/push 1/imm32/block-depth
8526 ff 6/subop/push *(ecx+4)
8527 68/push "dummy"/imm32
8528 89/<- %ebx 4/r32/esp
8529
8530 68/push 0/imm32/is-deref:false
8531 68/push 0/imm32/next
8532 53/push-ebx/formal-var
8533 89/<- %ebx 4/r32/esp
8534
8535 68/push 0/imm32/next
8536 68/push 0/imm32/output-is-write-only
8537 68/push 0/imm32/no-disp32
8538 68/push 0/imm32/no-imm32
8539 68/push 0/imm32/no-r32
8540 68/push 3/imm32/rm32-in-first-output
8541 68/push "ff 0/subop/increment"/imm32/subx-name
8542 53/push-ebx/outputs
8543 68/push 0/imm32/inouts
8544 68/push "increment"/imm32/name
8545 89/<- %ebx 4/r32/esp
8546
8547 c7 0/subop/copy *Curr-block-depth 0/imm32
8548 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
8549 (flush _test-output-buffered-file)
8550 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8556
8557 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register")
8558
8559 89/<- %esp 5/r32/ebp
8560 5d/pop-to-ebp
8561 c3/return
8562
8563 test-emit-subx-stmt-select-primitive:
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585 55/push-ebp
8586 89/<- %ebp 4/r32/esp
8587
8588 (clear-stream _test-output-stream)
8589 (clear-stream $_test-output-buffered-file->buffer)
8590
8591 68/push 0/imm32/right/null
8592 68/push 1/imm32/left/int
8593 89/<- %ecx 4/r32/esp
8594
8595 68/push "eax"/imm32/register
8596 68/push 0/imm32/no-stack-offset
8597 68/push 1/imm32/block-depth
8598 51/push-ecx
8599 68/push "foo"/imm32
8600 89/<- %ecx 4/r32/esp
8601
8602 68/push 0/imm32/is-deref:false
8603 68/push 0/imm32/next
8604 51/push-ecx/var-foo
8605 89/<- %edi 4/r32/esp
8606
8607 68/push 0/imm32/next
8608 57/push-edi/outputs
8609 68/push 0/imm32/inouts
8610 68/push "increment"/imm32/operation
8611 68/push 1/imm32
8612 89/<- %esi 4/r32/esp
8613
8614 68/push Any-register/imm32
8615 68/push 0/imm32/no-stack-offset
8616 68/push 1/imm32/block-depth
8617 ff 6/subop/push *(ecx+4)
8618 68/push "dummy"/imm32
8619 89/<- %ebx 4/r32/esp
8620
8621 68/push 0/imm32/is-deref:false
8622 68/push 0/imm32/next
8623 53/push-ebx/formal-var
8624 89/<- %ebx 4/r32/esp
8625
8626 68/push 0/imm32/next
8627 68/push 0/imm32/output-is-write-only
8628 68/push 0/imm32/no-disp32
8629 68/push 0/imm32/no-imm32
8630 68/push 0/imm32/no-r32
8631 68/push 3/imm32/rm32-in-first-output
8632 68/push "ff 0/subop/increment"/imm32/subx-name
8633 53/push-ebx/outputs/formal-outputs
8634 68/push 0/imm32/inouts
8635 68/push "increment"/imm32/name
8636 89/<- %ebx 4/r32/esp
8637
8638 53/push-ebx/next
8639 68/push 0/imm32/output-is-write-only
8640 68/push 0/imm32/no-disp32
8641 68/push 0/imm32/no-imm32
8642 68/push 0/imm32/no-r32
8643 68/push 1/imm32/rm32-is-first-inout
8644 68/push "ff 0/subop/increment"/imm32/subx-name
8645 68/push 0/imm32/outputs
8646 57/push-edi/inouts/real-outputs
8647 68/push "increment"/imm32/name
8648 89/<- %ebx 4/r32/esp
8649
8650 c7 0/subop/copy *Curr-block-depth 0/imm32
8651 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
8652 (flush _test-output-buffered-file)
8653 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8659
8660 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive")
8661
8662 89/<- %esp 5/r32/ebp
8663 5d/pop-to-ebp
8664 c3/return
8665
8666 test-emit-subx-stmt-select-primitive-2:
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688 55/push-ebp
8689 89/<- %ebp 4/r32/esp
8690
8691 (clear-stream _test-output-stream)
8692 (clear-stream $_test-output-buffered-file->buffer)
8693
8694 68/push 0/imm32/right/null
8695 68/push 1/imm32/left/int
8696 89/<- %ecx 4/r32/esp
8697
8698 68/push "eax"/imm32/register
8699 68/push 0/imm32/no-stack-offset
8700 68/push 1/imm32/block-depth
8701 51/push-ecx
8702 68/push "foo"/imm32
8703 89/<- %ecx 4/r32/esp
8704
8705 68/push 0/imm32/is-deref:false
8706 68/push 0/imm32/next
8707 51/push-ecx/var-foo
8708 89/<- %edi 4/r32/esp
8709
8710 68/push 0/imm32/next
8711 68/push 0/imm32/outputs
8712 57/push-edi/inouts
8713 68/push "increment"/imm32/operation
8714 68/push 1/imm32
8715 89/<- %esi 4/r32/esp
8716
8717 68/push Any-register/imm32
8718 68/push 0/imm32/no-stack-offset
8719 68/push 1/imm32/block-depth
8720 ff 6/subop/push *(ecx+4)
8721 68/push "dummy"/imm32
8722 89/<- %ebx 4/r32/esp
8723
8724 68/push 0/imm32/is-deref:false
8725 68/push 0/imm32/next
8726 53/push-ebx/formal-var
8727 89/<- %ebx 4/r32/esp
8728
8729 68/push 0/imm32/next
8730 68/push 0/imm32/output-is-write-only
8731 68/push 0/imm32/no-disp32
8732 68/push 0/imm32/no-imm32
8733 68/push 0/imm32/no-r32
8734 68/push 3/imm32/rm32-in-first-output
8735 68/push "ff 0/subop/increment"/imm32/subx-name
8736 53/push-ebx/outputs/formal-outputs
8737 68/push 0/imm32/inouts
8738 68/push "increment"/imm32/name
8739 89/<- %ebx 4/r32/esp
8740
8741 53/push-ebx/next
8742 68/push 0/imm32/output-is-write-only
8743 68/push 0/imm32/no-disp32
8744 68/push 0/imm32/no-imm32
8745 68/push 0/imm32/no-r32
8746 68/push 1/imm32/rm32-is-first-inout
8747 68/push "ff 0/subop/increment"/imm32/subx-name
8748 68/push 0/imm32/outputs
8749 57/push-edi/inouts/real-outputs
8750 68/push "increment"/imm32/name
8751 89/<- %ebx 4/r32/esp
8752
8753 c7 0/subop/copy *Curr-block-depth 0/imm32
8754 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
8755 (flush _test-output-buffered-file)
8756 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8762
8763 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2")
8764
8765 89/<- %esp 5/r32/ebp
8766 5d/pop-to-ebp
8767 c3/return
8768
8769 test-increment-register:
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785 55/push-ebp
8786 89/<- %ebp 4/r32/esp
8787
8788 (clear-stream _test-output-stream)
8789 (clear-stream $_test-output-buffered-file->buffer)
8790
8791 68/push 0/imm32/right/null
8792 68/push 1/imm32/left/int
8793 89/<- %ecx 4/r32/esp
8794
8795 68/push "eax"/imm32/register
8796 68/push 0/imm32/no-stack-offset
8797 68/push 1/imm32/block-depth
8798 51/push-ecx
8799 68/push "foo"/imm32
8800 89/<- %ecx 4/r32/esp
8801
8802 68/push 0/imm32/is-deref:false
8803 68/push 0/imm32/next
8804 51/push-ecx/var-foo
8805 89/<- %edi 4/r32/esp
8806
8807 68/push 0/imm32/next
8808 57/push-edi/outputs
8809 68/push 0/imm32/inouts
8810 68/push "increment"/imm32/operation
8811 68/push 1/imm32/regular-stmt
8812 89/<- %esi 4/r32/esp
8813
8814 c7 0/subop/copy *Curr-block-depth 0/imm32
8815 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
8816 (flush _test-output-buffered-file)
8817 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8823
8824 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register")
8825
8826 89/<- %esp 5/r32/ebp
8827 5d/pop-to-ebp
8828 c3/return
8829
8830 test-increment-var:
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846 55/push-ebp
8847 89/<- %ebp 4/r32/esp
8848
8849 (clear-stream _test-output-stream)
8850 (clear-stream $_test-output-buffered-file->buffer)
8851
8852 68/push 0/imm32/right/null
8853 68/push 1/imm32/left/int
8854 89/<- %ecx 4/r32/esp
8855
8856 68/push "eax"/imm32/register
8857 68/push 0/imm32/no-stack-offset
8858 68/push 1/imm32/block-depth
8859 51/push-ecx
8860 68/push "foo"/imm32
8861 89/<- %ecx 4/r32/esp
8862
8863 68/push 0/imm32/is-deref:false
8864 68/push 0/imm32/next
8865 51/push-ecx/var-foo
8866 89/<- %edi 4/r32/esp
8867
8868 68/push 0/imm32/next
8869 57/push-edi/outputs
8870 68/push 0/imm32/inouts
8871 68/push "increment"/imm32/operation
8872 68/push 1/imm32
8873 89/<- %esi 4/r32/esp
8874
8875 c7 0/subop/copy *Curr-block-depth 0/imm32
8876 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
8877 (flush _test-output-buffered-file)
8878 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8884
8885 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-var")
8886
8887 89/<- %esp 5/r32/ebp
8888 5d/pop-to-ebp
8889 c3/return
8890
8891 test-add-reg-to-reg:
8892
8893
8894
8895
8896
8897 55/push-ebp
8898 89/<- %ebp 4/r32/esp
8899
8900 (clear-stream _test-output-stream)
8901 (clear-stream $_test-output-buffered-file->buffer)
8902
8903 68/push 0/imm32/right/null
8904 68/push 1/imm32/left/int
8905 89/<- %ecx 4/r32/esp
8906
8907 68/push "eax"/imm32/register
8908 68/push 0/imm32/no-stack-offset
8909 68/push 1/imm32/block-depth
8910 51/push-ecx
8911 68/push "var1"/imm32
8912 89/<- %ecx 4/r32/esp
8913
8914 68/push "ecx"/imm32/register
8915 68/push 0/imm32/no-stack-offset
8916 68/push 1/imm32/block-depth
8917 ff 6/subop/push *(ecx+4)
8918 68/push "var2"/imm32
8919 89/<- %edx 4/r32/esp
8920
8921 68/push 0/imm32/is-deref:false
8922 68/push 0/imm32/next
8923 52/push-edx/var-var2
8924 89/<- %esi 4/r32/esp
8925
8926 68/push 0/imm32/is-deref:false
8927 68/push 0/imm32/next
8928 51/push-ecx/var-var1
8929 89/<- %edi 4/r32/esp
8930
8931 68/push 0/imm32/next
8932 57/push-edi/outputs
8933 56/push-esi/inouts
8934 68/push "add"/imm32/operation
8935 68/push 1/imm32
8936 89/<- %esi 4/r32/esp
8937
8938 c7 0/subop/copy *Curr-block-depth 0/imm32
8939 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
8940 (flush _test-output-buffered-file)
8941 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8947
8948 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg")
8949
8950 89/<- %esp 5/r32/ebp
8951 5d/pop-to-ebp
8952 c3/return
8953
8954 test-add-reg-to-mem:
8955
8956
8957
8958
8959
8960 55/push-ebp
8961 89/<- %ebp 4/r32/esp
8962
8963 (clear-stream _test-output-stream)
8964 (clear-stream $_test-output-buffered-file->buffer)
8965
8966 68/push 0/imm32/right/null
8967 68/push 1/imm32/left/int
8968 89/<- %ecx 4/r32/esp
8969
8970 68/push 0/imm32/no-register
8971 68/push 8/imm32/stack-offset
8972 68/push 1/imm32/block-depth
8973 51/push-ecx
8974 68/push "var1"/imm32
8975 89/<- %ecx 4/r32/esp
8976
8977 68/push "ecx"/imm32/register
8978 68/push 0/imm32/no-stack-offset
8979 68/push 1/imm32/block-depth
8980 ff 6/subop/push *(ecx+4)
8981 68/push "var2"/imm32
8982 89/<- %edx 4/r32/esp
8983
8984 68/push 0/imm32/is-deref:false
8985 68/push 0/imm32/next
8986 52/push-edx/var-var2
8987 89/<- %esi 4/r32/esp
8988
8989 56/push-esi/next
8990 51/push-ecx/var-var1
8991 89/<- %esi 4/r32/esp
8992
8993 68/push 0/imm32/next
8994 68/push 0/imm32/outputs
8995 56/push-esi/inouts
8996 68/push "add-to"/imm32/operation
8997 68/push 1/imm32
8998 89/<- %esi 4/r32/esp
8999
9000 c7 0/subop/copy *Curr-block-depth 0/imm32
9001 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
9002 (flush _test-output-buffered-file)
9003 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9009
9010 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem")
9011
9012 89/<- %esp 5/r32/ebp
9013 5d/pop-to-ebp
9014 c3/return
9015
9016 test-add-mem-to-reg:
9017
9018
9019
9020
9021
9022 55/push-ebp
9023 89/<- %ebp 4/r32/esp
9024
9025 (clear-stream _test-output-stream)
9026 (clear-stream $_test-output-buffered-file->buffer)
9027
9028 68/push 0/imm32/right/null
9029 68/push 1/imm32/left/int
9030 89/<- %ecx 4/r32/esp
9031
9032 68/push "eax"/imm32/register
9033 68/push 0/imm32/no-stack-offset
9034 68/push 1/imm32/block-depth
9035 51/push-ecx
9036 68/push "var1"/imm32
9037 89/<- %ecx 4/r32/esp
9038
9039 68/push 0/imm32/no-register
9040 68/push 8/imm32/stack-offset
9041 68/push 1/imm32/block-depth
9042 ff 6/subop/push *(ecx+4)
9043 68/push "var2"/imm32
9044 89/<- %edx 4/r32/esp
9045
9046 68/push 0/imm32/is-deref:false
9047 68/push 0/imm32/next
9048 52/push-edx/var-var2
9049 89/<- %esi 4/r32/esp
9050
9051 68/push 0/imm32/is-deref:false
9052 68/push 0/imm32/next
9053 51/push-ecx/var-var1
9054 89/<- %edi 4/r32/esp
9055
9056 68/push 0/imm32/next
9057 57/push-edi/outputs
9058 56/push-esi/inouts
9059 68/push "add"/imm32/operation
9060 68/push 1/imm32
9061 89/<- %esi 4/r32/esp
9062
9063 c7 0/subop/copy *Curr-block-depth 0/imm32
9064 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
9065 (flush _test-output-buffered-file)
9066 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9072
9073 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg")
9074
9075 89/<- %esp 5/r32/ebp
9076 5d/pop-to-ebp
9077 c3/return
9078
9079 test-add-literal-to-eax:
9080
9081
9082
9083
9084
9085 55/push-ebp
9086 89/<- %ebp 4/r32/esp
9087
9088 (clear-stream _test-output-stream)
9089 (clear-stream $_test-output-buffered-file->buffer)
9090
9091 68/push 0/imm32/right/null
9092 68/push 1/imm32/left/int
9093 89/<- %ecx 4/r32/esp
9094
9095 68/push "eax"/imm32/register
9096 68/push 0/imm32/no-stack-offset
9097 68/push 1/imm32/block-depth
9098 51/push-ecx
9099 68/push "var1"/imm32
9100 89/<- %ecx 4/r32/esp
9101
9102 68/push 0/imm32/right/null
9103 68/push 0/imm32/left/literal
9104 89/<- %edx 4/r32/esp
9105
9106 68/push 0/imm32/no-register
9107 68/push 0/imm32/no-stack-offset
9108 68/push 1/imm32/block-depth
9109 52/push-edx
9110 68/push "0x34"/imm32
9111 89/<- %edx 4/r32/esp
9112
9113 68/push 0/imm32/is-deref:false
9114 68/push 0/imm32/next
9115 52/push-edx/var-var2
9116 89/<- %esi 4/r32/esp
9117
9118 68/push 0/imm32/is-deref:false
9119 68/push 0/imm32/next
9120 51/push-ecx/var-var1
9121 89/<- %edi 4/r32/esp
9122
9123 68/push 0/imm32/next
9124 57/push-edi/outputs
9125 56/push-esi/inouts
9126 68/push "add"/imm32/operation
9127 68/push 1/imm32
9128 89/<- %esi 4/r32/esp
9129
9130 c7 0/subop/copy *Curr-block-depth 0/imm32
9131 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
9132 (flush _test-output-buffered-file)
9133 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9139
9140 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax")
9141
9142 89/<- %esp 5/r32/ebp
9143 5d/pop-to-ebp
9144 c3/return
9145
9146 test-add-literal-to-reg:
9147
9148
9149
9150
9151
9152 55/push-ebp
9153 89/<- %ebp 4/r32/esp
9154
9155 (clear-stream _test-output-stream)
9156 (clear-stream $_test-output-buffered-file->buffer)
9157
9158 68/push 0/imm32/right/null
9159 68/push 1/imm32/left/int
9160 89/<- %ecx 4/r32/esp
9161
9162 68/push "ecx"/imm32/register
9163 68/push 0/imm32/no-stack-offset
9164 68/push 1/imm32/block-depth
9165 51/push-ecx
9166 68/push "var1"/imm32
9167 89/<- %ecx 4/r32/esp
9168
9169 68/push 0/imm32/right/null
9170 68/push 0/imm32/left/literal
9171 89/<- %edx 4/r32/esp
9172
9173 68/push 0/imm32/no-register
9174 68/push 0/imm32/no-stack-offset
9175 68/push 1/imm32/block-depth
9176 52/push-edx
9177 68/push "0x34"/imm32
9178 89/<- %edx 4/r32/esp
9179
9180 68/push 0/imm32/is-deref:false
9181 68/push 0/imm32/next
9182 52/push-edx/var-var2
9183 89/<- %esi 4/r32/esp
9184
9185 68/push 0/imm32/is-deref:false
9186 68/push 0/imm32/next
9187 51/push-ecx/var-var1
9188 89/<- %edi 4/r32/esp
9189
9190 68/push 0/imm32/next
9191 57/push-edi/outputs
9192 56/push-esi/inouts
9193 68/push "add"/imm32/operation
9194 68/push 1/imm32
9195 89/<- %esi 4/r32/esp
9196
9197 c7 0/subop/copy *Curr-block-depth 0/imm32
9198 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
9199 (flush _test-output-buffered-file)
9200 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9206
9207 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg")
9208
9209 89/<- %esp 5/r32/ebp
9210 5d/pop-to-ebp
9211 c3/return
9212
9213 test-add-literal-to-mem:
9214
9215
9216
9217
9218
9219 55/push-ebp
9220 89/<- %ebp 4/r32/esp
9221
9222 (clear-stream _test-output-stream)
9223 (clear-stream $_test-output-buffered-file->buffer)
9224
9225 68/push 0/imm32/right/null
9226 68/push 1/imm32/left/int
9227 89/<- %ecx 4/r32/esp
9228
9229 68/push 0/imm32/no-register
9230 68/push 8/imm32/stack-offset
9231 68/push 1/imm32/block-depth
9232 51/push-ecx
9233 68/push "var1"/imm32
9234 89/<- %ecx 4/r32/esp
9235
9236 68/push 0/imm32/right/null
9237 68/push 0/imm32/left/literal
9238 89/<- %edx 4/r32/esp
9239
9240 68/push 0/imm32/no-register
9241 68/push 0/imm32/no-stack-offset
9242 68/push 1/imm32/block-depth
9243 52/push-edx
9244 68/push "0x34"/imm32
9245 89/<- %edx 4/r32/esp
9246
9247 68/push 0/imm32/is-deref:false
9248 68/push 0/imm32/next
9249 52/push-edx/var-var2
9250 89/<- %esi 4/r32/esp
9251
9252 68/push 0/imm32/is-deref:false
9253 56/push-esi/next
9254 51/push-ecx/var-var1
9255 89/<- %esi 4/r32/esp
9256
9257 68/push 0/imm32/next
9258 68/push 0/imm32/outputs
9259 56/push-esi/inouts
9260 68/push "add-to"/imm32/operation
9261 68/push 1/imm32
9262 89/<- %esi 4/r32/esp
9263
9264 c7 0/subop/copy *Curr-block-depth 0/imm32
9265 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
9266 (flush _test-output-buffered-file)
9267 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9273
9274 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem")
9275
9276 89/<- %esp 5/r32/ebp
9277 5d/pop-to-ebp
9278 c3/return
9279
9280 test-compare-mem-with-reg:
9281
9282
9283
9284
9285
9286 55/push-ebp
9287 89/<- %ebp 4/r32/esp
9288
9289 (clear-stream _test-output-stream)
9290 (clear-stream $_test-output-buffered-file->buffer)
9291
9292 68/push 0/imm32/right/null
9293 68/push 1/imm32/left/int
9294 89/<- %ecx 4/r32/esp
9295
9296 68/push "eax"/imm32/register
9297 68/push 0/imm32/no-stack-offset
9298 68/push 1/imm32/block-depth
9299 51/push-ecx
9300 68/push "var2"/imm32
9301 89/<- %ecx 4/r32/esp
9302
9303 68/push 0/imm32/no-register
9304 68/push 8/imm32/stack-offset
9305 68/push 1/imm32/block-depth
9306 ff 6/subop/push *(ecx+4)
9307 68/push "var1"/imm32
9308 89/<- %edx 4/r32/esp
9309
9310 68/push 0/imm32/is-deref:false
9311 68/push 0/imm32/next
9312 51/push-ecx/var-var2
9313 89/<- %esi 4/r32/esp
9314
9315 68/push 0/imm32/is-deref:false
9316 56/push-esi
9317 52/push-edx/var-var1
9318 89/<- %esi 4/r32/esp
9319
9320 68/push 0/imm32/next
9321 68/push 0/imm32/outputs
9322 56/push-esi/inouts
9323 68/push "compare"/imm32/operation
9324 68/push 1/imm32
9325 89/<- %esi 4/r32/esp
9326
9327 c7 0/subop/copy *Curr-block-depth 0/imm32
9328 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
9329 (flush _test-output-buffered-file)
9330 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9336
9337 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg")
9338
9339 89/<- %esp 5/r32/ebp
9340 5d/pop-to-ebp
9341 c3/return
9342
9343 test-compare-reg-with-mem:
9344
9345
9346
9347
9348
9349 55/push-ebp
9350 89/<- %ebp 4/r32/esp
9351
9352 (clear-stream _test-output-stream)
9353 (clear-stream $_test-output-buffered-file->buffer)
9354
9355 68/push 0/imm32/right/null
9356 68/push 1/imm32/left/int
9357 89/<- %ecx 4/r32/esp
9358
9359 68/push "eax"/imm32/register
9360 68/push 0/imm32/no-stack-offset
9361 68/push 1/imm32/block-depth
9362 51/push-ecx
9363 68/push "var1"/imm32
9364 89/<- %ecx 4/r32/esp
9365
9366 68/push 0/imm32/no-register
9367 68/push 8/imm32/stack-offset
9368 68/push 1/imm32/block-depth
9369 ff 6/subop/push *(ecx+4)
9370 68/push "var2"/imm32
9371 89/<- %edx 4/r32/esp
9372
9373 68/push 0/imm32/is-deref:false
9374 68/push 0/imm32/next
9375 52/push-edx/var-var2
9376 89/<- %esi 4/r32/esp
9377
9378 68/push 0/imm32/is-deref:false
9379 56/push-esi
9380 51/push-ecx/var-var1
9381 89/<- %esi 4/r32/esp
9382
9383 68/push 0/imm32/next
9384 68/push 0/imm32/outputs
9385 56/push-esi/inouts
9386 68/push "compare"/imm32/operation
9387 68/push 1/imm32
9388 89/<- %esi 4/r32/esp
9389
9390 c7 0/subop/copy *Curr-block-depth 0/imm32
9391 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
9392 (flush _test-output-buffered-file)
9393 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9399
9400 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem")
9401
9402 89/<- %esp 5/r32/ebp
9403 5d/pop-to-ebp
9404 c3/return
9405
9406 test-compare-mem-with-literal:
9407
9408
9409
9410
9411
9412 55/push-ebp
9413 89/<- %ebp 4/r32/esp
9414
9415 (clear-stream _test-output-stream)
9416 (clear-stream $_test-output-buffered-file->buffer)
9417
9418 68/push 0/imm32/right/null
9419 68/push 1/imm32/left/int
9420 89/<- %ecx 4/r32/esp
9421
9422 68/push 0/imm32/no-register
9423 68/push 8/imm32/stack-offset
9424 68/push 1/imm32/block-depth
9425 51/push-ecx
9426 68/push "var1"/imm32
9427 89/<- %ecx 4/r32/esp
9428
9429 68/push 0/imm32/right/null
9430 68/push 0/imm32/left/literal
9431 89/<- %edx 4/r32/esp
9432
9433 68/push 0/imm32/no-register
9434 68/push 0/imm32/no-stack-offset
9435 68/push 1/imm32/block-depth
9436 52/push-edx
9437 68/push "0x34"/imm32
9438 89/<- %edx 4/r32/esp
9439
9440 68/push 0/imm32/is-deref:false
9441 68/push 0/imm32/next
9442 52/push-edx/var-var2
9443 89/<- %esi 4/r32/esp
9444
9445 68/push 0/imm32/is-deref:false
9446 56/push-esi/next
9447 51/push-ecx/var-var1
9448 89/<- %esi 4/r32/esp
9449
9450 68/push 0/imm32/next
9451 68/push 0/imm32/outputs
9452 56/push-esi/inouts
9453 68/push "compare"/imm32/operation
9454 68/push 1/imm32
9455 89/<- %esi 4/r32/esp
9456
9457 c7 0/subop/copy *Curr-block-depth 0/imm32
9458 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
9459 (flush _test-output-buffered-file)
9460 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9466
9467 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal")
9468
9469 89/<- %esp 5/r32/ebp
9470 5d/pop-to-ebp
9471 c3/return
9472
9473 test-compare-eax-with-literal:
9474
9475
9476
9477
9478
9479 55/push-ebp
9480 89/<- %ebp 4/r32/esp
9481
9482 (clear-stream _test-output-stream)
9483 (clear-stream $_test-output-buffered-file->buffer)
9484
9485 68/push 0/imm32/right/null
9486 68/push 1/imm32/left/int
9487 89/<- %ecx 4/r32/esp
9488
9489 68/push "eax"/imm32/register
9490 68/push 0/imm32/no-stack-offset
9491 68/push 1/imm32/block-depth
9492 51/push-ecx
9493 68/push "var1"/imm32
9494 89/<- %ecx 4/r32/esp
9495
9496 68/push 0/imm32/right/null
9497 68/push 0/imm32/left/literal
9498 89/<- %edx 4/r32/esp
9499
9500 68/push 0/imm32/no-register
9501 68/push 0/imm32/no-stack-offset
9502 68/push 1/imm32/block-depth
9503 52/push-edx
9504 68/push "0x34"/imm32
9505 89/<- %edx 4/r32/esp
9506
9507 68/push 0/imm32/is-deref:false
9508 68/push 0/imm32/next
9509 52/push-edx/var-var2
9510 89/<- %esi 4/r32/esp
9511
9512 68/push 0/imm32/is-deref:false
9513 56/push-esi/next
9514 51/push-ecx/var-var1
9515 89/<- %esi 4/r32/esp
9516
9517 68/push 0/imm32/next
9518 68/push 0/imm32/outputs
9519 56/push-esi/inouts
9520 68/push "compare"/imm32/operation
9521 68/push 1/imm32/regular-stmt
9522 89/<- %esi 4/r32/esp
9523
9524 c7 0/subop/copy *Curr-block-depth 0/imm32
9525 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
9526 (flush _test-output-buffered-file)
9527 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9533
9534 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal")
9535
9536 89/<- %esp 5/r32/ebp
9537 5d/pop-to-ebp
9538 c3/return
9539
9540 test-compare-reg-with-literal:
9541
9542
9543
9544
9545
9546 55/push-ebp
9547 89/<- %ebp 4/r32/esp
9548
9549 (clear-stream _test-output-stream)
9550 (clear-stream $_test-output-buffered-file->buffer)
9551
9552 68/push 0/imm32/right/null
9553 68/push 1/imm32/left/int
9554 89/<- %ecx 4/r32/esp
9555
9556 68/push "ecx"/imm32/register
9557 68/push 0/imm32/no-stack-offset
9558 68/push 1/imm32/block-depth
9559 51/push-ecx
9560 68/push "var1"/imm32
9561 89/<- %ecx 4/r32/esp
9562
9563 68/push 0/imm32/right/null
9564 68/push 0/imm32/left/literal
9565 89/<- %edx 4/r32/esp
9566
9567 68/push 0/imm32/no-register
9568 68/push 0/imm32/no-stack-offset
9569 68/push 1/imm32/block-depth
9570 52/push-edx
9571 68/push "0x34"/imm32
9572 89/<- %edx 4/r32/esp
9573
9574 68/push 0/imm32/is-deref:false
9575 68/push 0/imm32/next
9576 52/push-edx/var-var2
9577 89/<- %esi 4/r32/esp
9578
9579 68/push 0/imm32/is-deref:false
9580 56/push-esi/next
9581 51/push-ecx/var-var1
9582 89/<- %esi 4/r32/esp
9583
9584 68/push 0/imm32/next
9585 68/push 0/imm32/outputs
9586 56/push-esi/inouts
9587 68/push "compare"/imm32/operation
9588 68/push 1/imm32/regular-stmt
9589 89/<- %esi 4/r32/esp
9590
9591 c7 0/subop/copy *Curr-block-depth 0/imm32
9592 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
9593 (flush _test-output-buffered-file)
9594 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9600
9601 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal")
9602
9603 89/<- %esp 5/r32/ebp
9604 5d/pop-to-ebp
9605 c3/return
9606
9607 test-emit-subx-stmt-function-call:
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628 55/push-ebp
9629 89/<- %ebp 4/r32/esp
9630
9631 (clear-stream _test-output-stream)
9632 (clear-stream $_test-output-buffered-file->buffer)
9633
9634 68/push 0/imm32/right/null
9635 68/push 1/imm32/left/int
9636 89/<- %ecx 4/r32/esp
9637
9638 68/push 0/imm32/no-register
9639 68/push -8/imm32/stack-offset
9640 68/push 0/imm32/block-depth
9641 51/push-ecx
9642 68/push "foo"/imm32
9643 89/<- %ecx 4/r32/esp
9644
9645 68/push 0/imm32/is-deref:false
9646 68/push 0/imm32/next
9647 51/push-ecx/var-foo
9648 89/<- %esi 4/r32/esp
9649
9650 68/push 0/imm32/next
9651 68/push 0/imm32/outputs
9652 56/push-esi/inouts
9653 68/push "f"/imm32/operation
9654 68/push 1/imm32
9655 89/<- %esi 4/r32/esp
9656
9657 68/push 0/imm32/next
9658 68/push 0/imm32/body
9659 68/push 0/imm32/outputs
9660 51/push-ecx/inouts
9661 68/push "f2"/imm32/subx-name
9662 68/push "f"/imm32/name
9663 89/<- %ebx 4/r32/esp
9664
9665 c7 0/subop/copy *Curr-block-depth 0/imm32
9666 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx)
9667 (flush _test-output-buffered-file)
9668 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9674
9675 (check-next-stream-line-equal _test-output-stream "(f2 *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call")
9676
9677 89/<- %esp 5/r32/ebp
9678 5d/pop-to-ebp
9679 c3/return
9680
9681 test-emit-subx-stmt-function-call-with-literal-arg:
9682
9683
9684
9685
9686
9687
9688 55/push-ebp
9689 89/<- %ebp 4/r32/esp
9690
9691 (clear-stream _test-output-stream)
9692 (clear-stream $_test-output-buffered-file->buffer)
9693
9694 68/push 0/imm32/right/null
9695 68/push 0/imm32/left/literal
9696 89/<- %ecx 4/r32/esp
9697
9698 68/push 0/imm32/no-register
9699 68/push 0/imm32/no-stack-offset
9700 68/push 0/imm32/block-depth
9701 51/push-ecx
9702 68/push "34"/imm32
9703 89/<- %ecx 4/r32/esp
9704
9705 68/push 0/imm32/is-deref:false
9706 68/push 0/imm32/next
9707 51/push-ecx/var-foo
9708 89/<- %esi 4/r32/esp
9709
9710 68/push 0/imm32/next
9711 68/push 0/imm32/outputs
9712 56/push-esi/inouts
9713 68/push "f"/imm32/operation
9714 68/push 1/imm32
9715 89/<- %esi 4/r32/esp
9716
9717 68/push 0/imm32/next
9718 68/push 0/imm32/body
9719 68/push 0/imm32/outputs
9720 51/push-ecx/inouts
9721 68/push "f2"/imm32/subx-name
9722 68/push "f"/imm32/name
9723 89/<- %ebx 4/r32/esp
9724
9725 c7 0/subop/copy *Curr-block-depth 0/imm32
9726 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx)
9727 (flush _test-output-buffered-file)
9728 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9734
9735 (check-next-stream-line-equal _test-output-stream "(f2 34)" "F - test-emit-subx-stmt-function-call-with-literal-arg")
9736
9737 89/<- %esp 5/r32/ebp
9738 5d/pop-to-ebp
9739 c3/return
9740
9741 emit-indent:
9742
9743 55/push-ebp
9744 89/<- %ebp 4/r32/esp
9745
9746 50/push-eax
9747
9748 8b/-> *(ebp+0xc) 0/r32/eax
9749 {
9750
9751 3d/compare-eax-with 0/imm32
9752 7e/jump-if-<= break/disp8
9753 (write-buffered *(ebp+8) " ")
9754 48/decrement-eax
9755 eb/jump loop/disp8
9756 }
9757 $emit-indent:end:
9758
9759 58/pop-to-eax
9760
9761 89/<- %esp 5/r32/ebp
9762 5d/pop-to-ebp
9763 c3/return
9764
9765 emit-subx-prologue:
9766
9767 55/push-ebp
9768 89/<- %ebp 4/r32/esp
9769
9770 (write-buffered *(ebp+8) " # . prologue\n")
9771 (write-buffered *(ebp+8) " 55/push-ebp\n")
9772 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n")
9773 $emit-subx-prologue:end:
9774
9775 89/<- %esp 5/r32/ebp
9776 5d/pop-to-ebp
9777 c3/return
9778
9779 emit-subx-epilogue:
9780
9781 55/push-ebp
9782 89/<- %ebp 4/r32/esp
9783
9784 (write-buffered *(ebp+8) " # . epilogue\n")
9785 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n")
9786 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n")
9787 (write-buffered *(ebp+8) " c3/return\n")
9788 $emit-subx-epilogue:end:
9789
9790 89/<- %esp 5/r32/ebp
9791 5d/pop-to-ebp
9792 c3/return