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 0/imm32
245
246 Function-name:
247 0/imm32
248 Function-subx-name:
249 4/imm32
250 Function-inouts:
251 8/imm32
252 Function-outputs:
253 0xc/imm32
254 Function-body:
255 0x10/imm32
256 Function-next:
257 0x14/imm32
258 Function-size:
259 0x18/imm32/24
260
261 Primitive-name:
262 0/imm32
263 Primitive-inouts:
264 4/imm32
265 Primitive-outputs:
266 8/imm32
267 Primitive-subx-name:
268 0xc/imm32
269 Primitive-subx-rm32:
270 0x10/imm32
271 Primitive-subx-r32:
272 0x14/imm32
273 Primitive-subx-imm32:
274 0x18/imm32
275 Primitive-subx-disp32:
276 0x1c/imm32
277 Primitive-output-is-write-only:
278 0x20/imm32
279 Primitive-next:
280 0x24/imm32
281 Primitive-size:
282 0x28/imm32/36
283
284 Stmt-tag:
285 0/imm32
286
287 Block-statements:
288 4/imm32
289 Block-var:
290 8/imm32
291
292 Stmt1-operation:
293 4/imm32
294 Stmt1-inouts:
295 8/imm32
296 Stmt1-outputs:
297 0xc/imm32
298
299 Vardef-var:
300 4/imm32
301
302 Regvardef-operation:
303 4/imm32
304 Regvardef-inouts:
305 8/imm32
306 Regvardef-outputs:
307 0xc/imm32
308
309 Stmt-size:
310 0x10/imm32
311
312 Var-name:
313 0/imm32
314 Var-type:
315 4/imm32
316 Var-block-depth:
317 8/imm32
318 Var-stack-offset:
319 0xc/imm32
320 Var-register:
321 0x10/imm32
322 Var-size:
323 0x14/imm32
324
325 Any-register:
326
327 1/imm32
328
329 2a/asterisk
330
331 List-value:
332 0/imm32
333 List-next:
334 4/imm32
335 List-size:
336 8/imm32
337
338
339 Stmt-var-value:
340 0/imm32
341 Stmt-var-next:
342 4/imm32
343 Stmt-var-is-deref:
344 8/imm32
345 Stmt-var-size:
346 0xc/imm32
347
348
349
350
351
352
353
354 Tree-left:
355 0/imm32
356 Tree-right:
357 4/imm32
358 Tree-size:
359 8/imm32
360
361 Max-type-id:
362 0x10000/imm32
363
364 == code
365
366 Entry:
367
368 89/<- %ebp 4/r32/esp
369 (new-segment *Heap-size Heap)
370
371 {
372
373 81 7/subop/compare *ebp 1/imm32
374 7e/jump-if-<= break/disp8
375
376 (kernel-string-equal? *(ebp+8) "test")
377 3d/compare-eax-and 0/imm32/false
378 74/jump-if-= break/disp8
379
380 (run-tests)
381
382 8b/-> *Num-test-failures 3/r32/ebx
383 eb/jump $mu-main:end/disp8
384 }
385
386 (convert-mu Stdin Stdout)
387 (flush Stdout)
388
389 bb/copy-to-ebx 0/imm32
390 $mu-main:end:
391 b8/copy-to-eax 1/imm32/exit
392 cd/syscall 0x80/imm8
393
394 convert-mu:
395
396 55/push-ebp
397 89/<- %ebp 4/r32/esp
398
399 (parse-mu *(ebp+8))
400 (check-mu-types)
401 (emit-subx *(ebp+0xc))
402 $convert-mu:end:
403
404 89/<- %esp 5/r32/ebp
405 5d/pop-to-ebp
406 c3/return
407
408 test-convert-empty-input:
409
410
411 55/push-ebp
412 89/<- %ebp 4/r32/esp
413
414 (clear-stream _test-input-stream)
415 (clear-stream $_test-input-buffered-file->buffer)
416 (clear-stream _test-output-stream)
417 (clear-stream $_test-output-buffered-file->buffer)
418
419 (convert-mu _test-input-buffered-file _test-output-buffered-file)
420 (flush _test-output-buffered-file)
421 (check-stream-equal _test-output-stream "" "F - test-convert-empty-input")
422
423 89/<- %esp 5/r32/ebp
424 5d/pop-to-ebp
425 c3/return
426
427 test-convert-function-skeleton:
428
429 55/push-ebp
430 89/<- %ebp 4/r32/esp
431
432 (clear-stream _test-input-stream)
433 (clear-stream $_test-input-buffered-file->buffer)
434 (clear-stream _test-output-stream)
435 (clear-stream $_test-output-buffered-file->buffer)
436
437 (write _test-input-stream "fn foo {\n")
438 (write _test-input-stream "}\n")
439
440 (convert-mu _test-input-buffered-file _test-output-buffered-file)
441 (flush _test-output-buffered-file)
442 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
448
449 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0")
450 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-skeleton/1")
451 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-skeleton/2")
452 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3")
453 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-skeleton/4")
454 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5")
455 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-skeleton/6")
456 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-skeleton/7")
457
458 89/<- %esp 5/r32/ebp
459 5d/pop-to-ebp
460 c3/return
461
462 test-convert-multiple-function-skeletons:
463
464 55/push-ebp
465 89/<- %ebp 4/r32/esp
466
467 (clear-stream _test-input-stream)
468 (clear-stream $_test-input-buffered-file->buffer)
469 (clear-stream _test-output-stream)
470 (clear-stream $_test-output-buffered-file->buffer)
471
472 (write _test-input-stream "fn foo {\n")
473 (write _test-input-stream "}\n")
474 (write _test-input-stream "fn bar {\n")
475 (write _test-input-stream "}\n")
476
477 (convert-mu _test-input-buffered-file _test-output-buffered-file)
478 (flush _test-output-buffered-file)
479 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
485
486 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0")
487 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/1")
488 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/2")
489 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3")
490 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/4")
491 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5")
492 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6")
493 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/7")
494
495 (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10")
496 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/11")
497 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/12")
498 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13")
499 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/14")
500 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15")
501 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16")
502 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/17")
503
504 89/<- %esp 5/r32/ebp
505 5d/pop-to-ebp
506 c3/return
507
508 test-convert-function-with-arg:
509
510 55/push-ebp
511 89/<- %ebp 4/r32/esp
512
513 (clear-stream _test-input-stream)
514 (clear-stream $_test-input-buffered-file->buffer)
515 (clear-stream _test-output-stream)
516 (clear-stream $_test-output-buffered-file->buffer)
517
518 (write _test-input-stream "fn foo n: int {\n")
519 (write _test-input-stream "}\n")
520
521 (convert-mu _test-input-buffered-file _test-output-buffered-file)
522 (flush _test-output-buffered-file)
523 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
529
530 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0")
531 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg/1")
532 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg/2")
533 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3")
534 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg/4")
535 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5")
536 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg/6")
537 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg/7")
538
539 89/<- %esp 5/r32/ebp
540 5d/pop-to-ebp
541 c3/return
542
543 test-convert-function-with-arg-and-body:
544
545 55/push-ebp
546 89/<- %ebp 4/r32/esp
547
548 (clear-stream _test-input-stream)
549 (clear-stream $_test-input-buffered-file->buffer)
550 (clear-stream _test-output-stream)
551 (clear-stream $_test-output-buffered-file->buffer)
552 c7 0/subop/copy *Next-block-index 1/imm32
553
554 (write _test-input-stream "fn foo n: int {\n")
555 (write _test-input-stream " increment n\n")
556 (write _test-input-stream "}\n")
557
558 (convert-mu _test-input-buffered-file _test-output-buffered-file)
559 (flush _test-output-buffered-file)
560 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
566
567 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0")
568 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1")
569 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg-and-body/2")
570 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3")
571 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-arg-and-body/4")
572 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-arg-and-body/5")
573 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/6")
574 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-arg-and-body/7")
575 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-arg-and-body/8")
576 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg-and-body/9")
577 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/10")
578 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/11")
579 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg-and-body/12")
580
581 89/<- %esp 5/r32/ebp
582 5d/pop-to-ebp
583 c3/return
584
585 test-convert-function-distinguishes-args:
586
587 55/push-ebp
588 89/<- %ebp 4/r32/esp
589
590 (clear-stream _test-input-stream)
591 (clear-stream $_test-input-buffered-file->buffer)
592 (clear-stream _test-output-stream)
593 (clear-stream $_test-output-buffered-file->buffer)
594 c7 0/subop/copy *Next-block-index 1/imm32
595
596 (write _test-input-stream "fn foo a: int, b: int {\n")
597 (write _test-input-stream " increment b\n")
598 (write _test-input-stream "}\n")
599
600 (convert-mu _test-input-buffered-file _test-output-buffered-file)
601 (flush _test-output-buffered-file)
602 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
608
609 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0")
610 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-distinguishes-args/1")
611 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-distinguishes-args/2")
612 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3")
613 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-distinguishes-args/4")
614 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-distinguishes-args/5")
615 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/6")
616 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-distinguishes-args/7")
617 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-distinguishes-args/8")
618 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-distinguishes-args/9")
619 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/10")
620 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/11")
621 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-distinguishes-args/12")
622
623 89/<- %esp 5/r32/ebp
624 5d/pop-to-ebp
625 c3/return
626
627 test-convert-function-returns-result:
628
629 55/push-ebp
630 89/<- %ebp 4/r32/esp
631
632 (clear-stream _test-input-stream)
633 (clear-stream $_test-input-buffered-file->buffer)
634 (clear-stream _test-output-stream)
635 (clear-stream $_test-output-buffered-file->buffer)
636 c7 0/subop/copy *Next-block-index 1/imm32
637
638 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
639 (write _test-input-stream " result <- copy a\n")
640 (write _test-input-stream " result <- increment\n")
641 (write _test-input-stream "}\n")
642
643 (convert-mu _test-input-buffered-file _test-output-buffered-file)
644 (flush _test-output-buffered-file)
645 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
651
652 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-returns-result/0")
653 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-returns-result/1")
654 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-returns-result/2")
655 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-returns-result/3")
656 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-returns-result/4")
657 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-returns-result/5")
658 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-returns-result/6")
659 (check-next-stream-line-equal _test-output-stream " 40/increment-eax" "F - test-convert-function-returns-result/7")
660 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-returns-result/8")
661 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-returns-result/9")
662 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-returns-result/10")
663 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-returns-result/11")
664 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-returns-result/12")
665 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-returns-result/13")
666
667 89/<- %esp 5/r32/ebp
668 5d/pop-to-ebp
669 c3/return
670
671 test-convert-function-literal-arg:
672
673 55/push-ebp
674 89/<- %ebp 4/r32/esp
675
676 (clear-stream _test-input-stream)
677 (clear-stream $_test-input-buffered-file->buffer)
678 (clear-stream _test-output-stream)
679 (clear-stream $_test-output-buffered-file->buffer)
680 c7 0/subop/copy *Next-block-index 1/imm32
681
682 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
683 (write _test-input-stream " result <- copy a\n")
684 (write _test-input-stream " result <- add 1\n")
685 (write _test-input-stream "}\n")
686
687 (convert-mu _test-input-buffered-file _test-output-buffered-file)
688 (flush _test-output-buffered-file)
689 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
695
696 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-literal-arg/0")
697 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-literal-arg/1")
698 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-literal-arg/2")
699 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-literal-arg/3")
700 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-literal-arg/4")
701 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-literal-arg/5")
702 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-literal-arg/6")
703 (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-literal-arg/7")
704 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-literal-arg/8")
705 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-literal-arg/9")
706 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-literal-arg/10")
707 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-literal-arg/11")
708 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-literal-arg/12")
709 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-literal-arg/13")
710
711 89/<- %esp 5/r32/ebp
712 5d/pop-to-ebp
713 c3/return
714
715 test-convert-function-literal-arg-2:
716
717 55/push-ebp
718 89/<- %ebp 4/r32/esp
719
720 (clear-stream _test-input-stream)
721 (clear-stream $_test-input-buffered-file->buffer)
722 (clear-stream _test-output-stream)
723 (clear-stream $_test-output-buffered-file->buffer)
724 c7 0/subop/copy *Next-block-index 1/imm32
725
726 (write _test-input-stream "fn foo a: int, b: int -> result/ebx: int {\n")
727 (write _test-input-stream " result <- copy a\n")
728 (write _test-input-stream " result <- add 1\n")
729 (write _test-input-stream "}\n")
730
731 (convert-mu _test-input-buffered-file _test-output-buffered-file)
732 (flush _test-output-buffered-file)
733 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
739
740 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-literal-arg-2/0")
741 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-literal-arg-2/1")
742 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-literal-arg-2/2")
743 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-literal-arg-2/3")
744 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-literal-arg-2/4")
745 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-literal-arg-2/5")
746 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-literal-arg-2/6")
747 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-literal-arg-2/7")
748 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-literal-arg-2/8")
749 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-literal-arg-2/9")
750 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-literal-arg-2/10")
751 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-literal-arg-2/11")
752 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-literal-arg-2/12")
753 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-literal-arg-2/13")
754
755 89/<- %esp 5/r32/ebp
756 5d/pop-to-ebp
757 c3/return
758
759 test-convert-function-call-with-literal-arg:
760
761 55/push-ebp
762 89/<- %ebp 4/r32/esp
763
764 (clear-stream _test-input-stream)
765 (clear-stream $_test-input-buffered-file->buffer)
766 (clear-stream _test-output-stream)
767 (clear-stream $_test-output-buffered-file->buffer)
768 c7 0/subop/copy *Next-block-index 1/imm32
769
770 (write _test-input-stream "fn main -> result/ebx: int {\n")
771 (write _test-input-stream " result <- do-add 3 4\n")
772 (write _test-input-stream "}\n")
773 (write _test-input-stream "fn do-add a: int, b: int -> result/ebx: int {\n")
774 (write _test-input-stream " result <- copy a\n")
775 (write _test-input-stream " result <- add b\n")
776 (write _test-input-stream "}\n")
777
778 (convert-mu _test-input-buffered-file _test-output-buffered-file)
779 (flush _test-output-buffered-file)
780 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
786
787 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0")
788 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1")
789 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2")
790 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3")
791 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4")
792 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-literal-arg/5")
793 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/6")
794 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/7")
795 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-literal-arg/8")
796 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/9")
797 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/10")
798 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/11")
799 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/12")
800 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/13")
801 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/14")
802 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/15")
803 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/16")
804 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/17")
805 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:loop:" "F - test-convert-function-call-with-literal-arg/18")
806 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/19")
807 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/20")
808 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/21")
809 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:break:" "F - test-convert-function-call-with-literal-arg/22")
810 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/23")
811 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/24")
812 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/25")
813 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/26")
814
815 89/<- %esp 5/r32/ebp
816 5d/pop-to-ebp
817 c3/return
818
819 test-convert-function-with-local-var-in-mem:
820
821 55/push-ebp
822 89/<- %ebp 4/r32/esp
823
824 (clear-stream _test-input-stream)
825 (clear-stream $_test-input-buffered-file->buffer)
826 (clear-stream _test-output-stream)
827 (clear-stream $_test-output-buffered-file->buffer)
828 c7 0/subop/copy *Next-block-index 1/imm32
829
830 (write _test-input-stream "fn foo {\n")
831 (write _test-input-stream " var x: int\n")
832 (write _test-input-stream " increment x\n")
833 (write _test-input-stream "}\n")
834
835 (convert-mu _test-input-buffered-file _test-output-buffered-file)
836 (flush _test-output-buffered-file)
837 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
843
844 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0")
845 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1")
846 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2")
847 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3")
848 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4")
849 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem/5")
850 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/6")
851 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/7")
852 (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")
853 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/9")
854 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem/10")
855 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/11")
856 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/12")
857 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/13")
858 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/14")
859
860 89/<- %esp 5/r32/ebp
861 5d/pop-to-ebp
862 c3/return
863
864 test-convert-function-with-local-var-in-reg:
865
866 55/push-ebp
867 89/<- %ebp 4/r32/esp
868
869 (clear-stream _test-input-stream)
870 (clear-stream $_test-input-buffered-file->buffer)
871 (clear-stream _test-output-stream)
872 (clear-stream $_test-output-buffered-file->buffer)
873 c7 0/subop/copy *Next-block-index 1/imm32
874
875 (write _test-input-stream "fn foo {\n")
876 (write _test-input-stream " var x/ecx: int <- copy 3\n")
877 (write _test-input-stream " x <- increment\n")
878 (write _test-input-stream "}\n")
879
880 (convert-mu _test-input-buffered-file _test-output-buffered-file)
881 (flush _test-output-buffered-file)
882 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
888
889 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0")
890 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1")
891 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2")
892 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3")
893 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4")
894 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-reg/5")
895 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/6")
896 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/7")
897 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/8")
898 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/9")
899 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/10")
900 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-reg/11")
901 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/12")
902 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/13")
903 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/14")
904 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/15")
905
906 89/<- %esp 5/r32/ebp
907 5d/pop-to-ebp
908 c3/return
909
910 test-convert-function-with-local-var-dereferenced:
911
912 55/push-ebp
913 89/<- %ebp 4/r32/esp
914
915 (clear-stream _test-input-stream)
916 (clear-stream $_test-input-buffered-file->buffer)
917 (clear-stream _test-output-stream)
918 (clear-stream $_test-output-buffered-file->buffer)
919 c7 0/subop/copy *Next-block-index 1/imm32
920
921 (write _test-input-stream "fn foo {\n")
922 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n")
923 (write _test-input-stream " increment *x\n")
924 (write _test-input-stream "}\n")
925
926 (convert-mu _test-input-buffered-file _test-output-buffered-file)
927 (flush _test-output-buffered-file)
928 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
934
935 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0")
936 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1")
937 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2")
938 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3")
939 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4")
940 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5")
941 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6")
942 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7")
943 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8")
944 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9")
945 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10")
946 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11")
947 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12")
948 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13")
949 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14")
950 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15")
951
952 89/<- %esp 5/r32/ebp
953 5d/pop-to-ebp
954 c3/return
955
956 test-convert-compare-register-with-literal:
957
958 55/push-ebp
959 89/<- %ebp 4/r32/esp
960
961 (clear-stream _test-input-stream)
962 (clear-stream $_test-input-buffered-file->buffer)
963 (clear-stream _test-output-stream)
964 (clear-stream $_test-output-buffered-file->buffer)
965 c7 0/subop/copy *Next-block-index 1/imm32
966
967 (write _test-input-stream "fn foo {\n")
968 (write _test-input-stream " var x/ecx: int <- copy 0\n")
969 (write _test-input-stream " compare x, 0\n")
970 (write _test-input-stream "}\n")
971
972 (convert-mu _test-input-buffered-file _test-output-buffered-file)
973 (flush _test-output-buffered-file)
974 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
980
981 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0")
982 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1")
983 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2")
984 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3")
985 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4")
986 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5")
987 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6")
988 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7")
989 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8")
990 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9")
991 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10")
992 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11")
993 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12")
994 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13")
995 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14")
996 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15")
997
998 89/<- %esp 5/r32/ebp
999 5d/pop-to-ebp
1000 c3/return
1001
1002 test-convert-function-with-local-var-in-block:
1003
1004 55/push-ebp
1005 89/<- %ebp 4/r32/esp
1006
1007 (clear-stream _test-input-stream)
1008 (clear-stream $_test-input-buffered-file->buffer)
1009 (clear-stream _test-output-stream)
1010 (clear-stream $_test-output-buffered-file->buffer)
1011 c7 0/subop/copy *Next-block-index 1/imm32
1012
1013 (write _test-input-stream "fn foo {\n")
1014 (write _test-input-stream " {\n")
1015 (write _test-input-stream " var x: int\n")
1016 (write _test-input-stream " increment x\n")
1017 (write _test-input-stream " }\n")
1018 (write _test-input-stream "}\n")
1019
1020 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1021 (flush _test-output-buffered-file)
1022 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1028
1029 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0")
1030 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1")
1031 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2")
1032 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3")
1033 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4")
1034 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5")
1035 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6")
1036 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7")
1037 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8")
1038 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9")
1039 (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")
1040 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11")
1041 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12")
1042 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13")
1043 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14")
1044 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15")
1045 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16")
1046 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17")
1047 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18")
1048
1049 89/<- %esp 5/r32/ebp
1050 5d/pop-to-ebp
1051 c3/return
1052
1053 test-convert-function-with-local-var-in-named-block:
1054
1055 55/push-ebp
1056 89/<- %ebp 4/r32/esp
1057
1058 (clear-stream _test-input-stream)
1059 (clear-stream $_test-input-buffered-file->buffer)
1060 (clear-stream _test-output-stream)
1061 (clear-stream $_test-output-buffered-file->buffer)
1062 c7 0/subop/copy *Next-block-index 1/imm32
1063
1064 (write _test-input-stream "fn foo {\n")
1065 (write _test-input-stream " $bar: {\n")
1066 (write _test-input-stream " var x: int\n")
1067 (write _test-input-stream " increment x\n")
1068 (write _test-input-stream " }\n")
1069 (write _test-input-stream "}\n")
1070
1071 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1072 (flush _test-output-buffered-file)
1073 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1079
1080 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0")
1081 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1")
1082 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2")
1083 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3")
1084 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4")
1085 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5")
1086 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6")
1087 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7")
1088 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8")
1089 (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")
1090 (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")
1091 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11")
1092 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12")
1093 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13")
1094 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14")
1095 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15")
1096 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16")
1097 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17")
1098 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18")
1099
1100 89/<- %esp 5/r32/ebp
1101 5d/pop-to-ebp
1102 c3/return
1103
1104 test-convert-function-with-branches-in-block:
1105
1106 55/push-ebp
1107 89/<- %ebp 4/r32/esp
1108
1109 (clear-stream _test-input-stream)
1110 (clear-stream $_test-input-buffered-file->buffer)
1111 (clear-stream _test-output-stream)
1112 (clear-stream $_test-output-buffered-file->buffer)
1113 c7 0/subop/copy *Next-block-index 1/imm32
1114
1115 (write _test-input-stream "fn foo x: int {\n")
1116 (write _test-input-stream " {\n")
1117 (write _test-input-stream " break-if->=\n")
1118 (write _test-input-stream " loop-if-addr<\n")
1119 (write _test-input-stream " increment x\n")
1120 (write _test-input-stream " loop\n")
1121 (write _test-input-stream " }\n")
1122 (write _test-input-stream "}\n")
1123
1124 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1125 (flush _test-output-buffered-file)
1126 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1132
1133 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0")
1134 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1")
1135 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2")
1136 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3")
1137 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4")
1138 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5")
1139 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6")
1140 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7")
1141 (check-next-stream-line-equal _test-output-stream " 0f 8d/jump-if->= break/disp32" "F - test-convert-function-with-branches-in-block/8")
1142 (check-next-stream-line-equal _test-output-stream " 0f 82/jump-if-addr< loop/disp32" "F - test-convert-function-with-branches-in-block/9")
1143 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/10")
1144 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/11")
1145 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/12")
1146 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/13")
1147 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/14")
1148 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/15")
1149 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/16")
1150 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/17")
1151 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/18")
1152 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/19")
1153
1154 89/<- %esp 5/r32/ebp
1155 5d/pop-to-ebp
1156 c3/return
1157
1158 test-convert-function-with-branches-in-named-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 " $bar: {\n")
1171 (write _test-input-stream " break-if->= $bar\n")
1172 (write _test-input-stream " loop-if-addr< $bar\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-named-block/0")
1188 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1")
1189 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2")
1190 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3")
1191 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4")
1192 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5")
1193 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6")
1194 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7")
1195 (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")
1196 (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")
1197 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/10")
1198 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/11")
1199 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/12")
1200 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/13")
1201 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/14")
1202 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/15")
1203 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/16")
1204 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/17")
1205 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/18")
1206 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/19")
1207
1208 89/<- %esp 5/r32/ebp
1209 5d/pop-to-ebp
1210 c3/return
1211
1212 test-convert-function-with-var-in-nested-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 " {\n")
1225 (write _test-input-stream " {\n")
1226 (write _test-input-stream " var x: int\n")
1227 (write _test-input-stream " increment x\n")
1228 (write _test-input-stream " }\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-var-in-nested-block/0")
1242 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1")
1243 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2")
1244 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3")
1245 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4")
1246 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5")
1247 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6")
1248 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7")
1249 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8")
1250 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9")
1251 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10")
1252 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11")
1253 (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")
1254 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13")
1255 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14")
1256 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15")
1257 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16")
1258 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17")
1259 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18")
1260 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19")
1261 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20")
1262 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21")
1263 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22")
1264
1265 89/<- %esp 5/r32/ebp
1266 5d/pop-to-ebp
1267 c3/return
1268
1269 test-convert-function-with-multiple-vars-in-nested-blocks:
1270
1271 55/push-ebp
1272 89/<- %ebp 4/r32/esp
1273
1274 (clear-stream _test-input-stream)
1275 (clear-stream $_test-input-buffered-file->buffer)
1276 (clear-stream _test-output-stream)
1277 (clear-stream $_test-output-buffered-file->buffer)
1278 c7 0/subop/copy *Next-block-index 1/imm32
1279
1280 (write _test-input-stream "fn foo x: int {\n")
1281 (write _test-input-stream " {\n")
1282 (write _test-input-stream " var x/eax: int <- copy 0\n")
1283 (write _test-input-stream " {\n")
1284 (write _test-input-stream " var y: int\n")
1285 (write _test-input-stream " x <- add y\n")
1286 (write _test-input-stream " }\n")
1287 (write _test-input-stream " }\n")
1288 (write _test-input-stream "}\n")
1289
1290 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1291 (flush _test-output-buffered-file)
1292 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1298
1299 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0")
1300 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1")
1301 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2")
1302 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3")
1303 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4")
1304 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5")
1305 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6")
1306 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7")
1307 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8")
1308 (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")
1309 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10")
1310 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11")
1311 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12")
1312 (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")
1313 (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")
1314 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15")
1315 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16")
1316 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17")
1317 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18")
1318 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19")
1319 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20")
1320 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21")
1321 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22")
1322 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23")
1323 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24")
1324 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25")
1325
1326 89/<- %esp 5/r32/ebp
1327 5d/pop-to-ebp
1328 c3/return
1329
1330 test-convert-function-with-branches-and-local-vars:
1331
1332
1333
1334
1335 55/push-ebp
1336 89/<- %ebp 4/r32/esp
1337
1338 (clear-stream _test-input-stream)
1339 (clear-stream $_test-input-buffered-file->buffer)
1340 (clear-stream _test-output-stream)
1341 (clear-stream $_test-output-buffered-file->buffer)
1342 c7 0/subop/copy *Next-block-index 1/imm32
1343
1344 (write _test-input-stream "fn foo {\n")
1345 (write _test-input-stream " {\n")
1346 (write _test-input-stream " var x: int\n")
1347 (write _test-input-stream " break-if->=\n")
1348 (write _test-input-stream " increment x\n")
1349 (write _test-input-stream " }\n")
1350 (write _test-input-stream "}\n")
1351
1352 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1353 (flush _test-output-buffered-file)
1354 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1360
1361 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0")
1362 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1")
1363 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2")
1364 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3")
1365 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4")
1366 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5")
1367 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6")
1368 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7")
1369 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8")
1370 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9")
1371 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10")
1372 (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")
1373 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12")
1374 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13")
1375 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14")
1376 (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")
1377 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16")
1378 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17")
1379 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18")
1380 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19")
1381 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20")
1382 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21")
1383 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22")
1384 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23")
1385
1386 89/<- %esp 5/r32/ebp
1387 5d/pop-to-ebp
1388 c3/return
1389
1390 test-convert-function-with-conditional-loops-and-local-vars:
1391
1392
1393
1394
1395 55/push-ebp
1396 89/<- %ebp 4/r32/esp
1397
1398 (clear-stream _test-input-stream)
1399 (clear-stream $_test-input-buffered-file->buffer)
1400 (clear-stream _test-output-stream)
1401 (clear-stream $_test-output-buffered-file->buffer)
1402 c7 0/subop/copy *Next-block-index 1/imm32
1403
1404 (write _test-input-stream "fn foo {\n")
1405 (write _test-input-stream " {\n")
1406 (write _test-input-stream " var x: int\n")
1407 (write _test-input-stream " loop-if->=\n")
1408 (write _test-input-stream " increment x\n")
1409 (write _test-input-stream " }\n")
1410 (write _test-input-stream "}\n")
1411
1412 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1413 (flush _test-output-buffered-file)
1414 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1420
1421 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0")
1422 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1")
1423 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2")
1424 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3")
1425 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4")
1426 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5")
1427 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6")
1428 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7")
1429 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8")
1430 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9")
1431 (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")
1432 (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")
1433 (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")
1434 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13")
1435 (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")
1436 (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")
1437 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16")
1438 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17")
1439 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18")
1440 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19")
1441 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20")
1442 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21")
1443 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22")
1444 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23")
1445
1446 89/<- %esp 5/r32/ebp
1447 5d/pop-to-ebp
1448 c3/return
1449
1450 test-convert-function-with-unconditional-loops-and-local-vars:
1451
1452
1453
1454
1455 55/push-ebp
1456 89/<- %ebp 4/r32/esp
1457
1458 (clear-stream _test-input-stream)
1459 (clear-stream $_test-input-buffered-file->buffer)
1460 (clear-stream _test-output-stream)
1461 (clear-stream $_test-output-buffered-file->buffer)
1462 c7 0/subop/copy *Next-block-index 1/imm32
1463
1464 (write _test-input-stream "fn foo {\n")
1465 (write _test-input-stream " {\n")
1466 (write _test-input-stream " var x: int\n")
1467 (write _test-input-stream " loop\n")
1468 (write _test-input-stream " increment x\n")
1469 (write _test-input-stream " }\n")
1470 (write _test-input-stream "}\n")
1471
1472 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1473 (flush _test-output-buffered-file)
1474 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1480
1481 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0")
1482 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1")
1483 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2")
1484 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3")
1485 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4")
1486 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5")
1487 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6")
1488 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7")
1489 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8")
1490 (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")
1491 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10")
1492
1493 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11")
1494 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12")
1495 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13")
1496 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14")
1497 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15")
1498 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16")
1499 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17")
1500 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18")
1501
1502 89/<- %esp 5/r32/ebp
1503 5d/pop-to-ebp
1504 c3/return
1505
1506 test-convert-function-with-branches-and-loops-and-local-vars:
1507
1508 55/push-ebp
1509 89/<- %ebp 4/r32/esp
1510
1511 (clear-stream _test-input-stream)
1512 (clear-stream $_test-input-buffered-file->buffer)
1513 (clear-stream _test-output-stream)
1514 (clear-stream $_test-output-buffered-file->buffer)
1515 c7 0/subop/copy *Next-block-index 1/imm32
1516
1517 (write _test-input-stream "fn foo {\n")
1518 (write _test-input-stream " {\n")
1519 (write _test-input-stream " var x: int\n")
1520 (write _test-input-stream " break-if->=\n")
1521 (write _test-input-stream " increment x\n")
1522 (write _test-input-stream " loop\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-branches-and-loops-and-local-vars/0")
1536 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1")
1537 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2")
1538 (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")
1539 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4")
1540 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5")
1541 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6")
1542 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7")
1543 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8")
1544 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9")
1545 (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")
1546 (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")
1547 (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")
1548 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13")
1549 (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")
1550 (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")
1551 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16")
1552 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17")
1553 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18")
1554 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19")
1555 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20")
1556 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21")
1557 (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")
1558 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23")
1559 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24")
1560
1561 89/<- %esp 5/r32/ebp
1562 5d/pop-to-ebp
1563 c3/return
1564
1565 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars:
1566
1567 55/push-ebp
1568 89/<- %ebp 4/r32/esp
1569
1570 (clear-stream _test-input-stream)
1571 (clear-stream $_test-input-buffered-file->buffer)
1572 (clear-stream _test-output-stream)
1573 (clear-stream $_test-output-buffered-file->buffer)
1574 c7 0/subop/copy *Next-block-index 1/imm32
1575
1576 (write _test-input-stream "fn foo {\n")
1577 (write _test-input-stream " a: {\n")
1578 (write _test-input-stream " var x: int\n")
1579 (write _test-input-stream " {\n")
1580 (write _test-input-stream " var y: int\n")
1581 (write _test-input-stream " break-if->= a\n")
1582 (write _test-input-stream " increment x\n")
1583 (write _test-input-stream " loop\n")
1584 (write _test-input-stream " }\n")
1585 (write _test-input-stream " }\n")
1586 (write _test-input-stream "}\n")
1587
1588 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1589 (flush _test-output-buffered-file)
1590 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1596
1597 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0")
1598 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1")
1599 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2")
1600 (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")
1601 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4")
1602 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5")
1603 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6")
1604 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7")
1605 (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")
1606 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9")
1607 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10")
1608 (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")
1609 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12")
1610 (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")
1611 (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")
1612 (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")
1613 (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")
1614 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17")
1615 (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")
1616 (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")
1617 (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")
1618 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21")
1619 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22")
1620 (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")
1621 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24")
1622 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25")
1623 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26")
1624 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27")
1625 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28")
1626 (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")
1627 (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")
1628 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31")
1629
1630 89/<- %esp 5/r32/ebp
1631 5d/pop-to-ebp
1632 c3/return
1633
1634 test-convert-function-with-nonlocal-unconditional-break-and-local-vars:
1635
1636 55/push-ebp
1637 89/<- %ebp 4/r32/esp
1638
1639 (clear-stream _test-input-stream)
1640 (clear-stream $_test-input-buffered-file->buffer)
1641 (clear-stream _test-output-stream)
1642 (clear-stream $_test-output-buffered-file->buffer)
1643 c7 0/subop/copy *Next-block-index 1/imm32
1644
1645 (write _test-input-stream "fn foo {\n")
1646 (write _test-input-stream " a: {\n")
1647 (write _test-input-stream " var x: int\n")
1648 (write _test-input-stream " {\n")
1649 (write _test-input-stream " var y: int\n")
1650 (write _test-input-stream " break a\n")
1651 (write _test-input-stream " increment x\n")
1652 (write _test-input-stream " }\n")
1653 (write _test-input-stream " }\n")
1654 (write _test-input-stream "}\n")
1655
1656 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1657 (flush _test-output-buffered-file)
1658 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1664
1665 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0")
1666 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1")
1667 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2")
1668 (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")
1669 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4")
1670 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5")
1671 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6")
1672 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7")
1673 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8")
1674 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9")
1675 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10")
1676 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11")
1677 (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")
1678 (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")
1679 (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")
1680 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15")
1681 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16")
1682 (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")
1683 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18")
1684 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19")
1685 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20")
1686 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21")
1687 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22")
1688 (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")
1689 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24")
1690 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25")
1691
1692 89/<- %esp 5/r32/ebp
1693 5d/pop-to-ebp
1694 c3/return
1695
1696 test-convert-function-with-unconditional-break-and-local-vars:
1697
1698 55/push-ebp
1699 89/<- %ebp 4/r32/esp
1700
1701 (clear-stream _test-input-stream)
1702 (clear-stream $_test-input-buffered-file->buffer)
1703 (clear-stream _test-output-stream)
1704 (clear-stream $_test-output-buffered-file->buffer)
1705 c7 0/subop/copy *Next-block-index 1/imm32
1706
1707 (write _test-input-stream "fn foo {\n")
1708 (write _test-input-stream " {\n")
1709 (write _test-input-stream " var x: int\n")
1710 (write _test-input-stream " {\n")
1711 (write _test-input-stream " var y: int\n")
1712 (write _test-input-stream " break\n")
1713 (write _test-input-stream " increment x\n")
1714 (write _test-input-stream " }\n")
1715 (write _test-input-stream " }\n")
1716 (write _test-input-stream "}\n")
1717
1718 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1719 (flush _test-output-buffered-file)
1720 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1726
1727 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0")
1728 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1")
1729 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2")
1730 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3")
1731 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4")
1732 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5")
1733 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6")
1734 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7")
1735 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8")
1736 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9")
1737 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10")
1738 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11")
1739 (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")
1740 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13")
1741 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14")
1742 (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")
1743 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16")
1744 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17")
1745 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18")
1746 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19")
1747 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20")
1748 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21")
1749 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22")
1750 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23")
1751
1752 89/<- %esp 5/r32/ebp
1753 5d/pop-to-ebp
1754 c3/return
1755
1756 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars:
1757
1758 55/push-ebp
1759 89/<- %ebp 4/r32/esp
1760
1761 (clear-stream _test-input-stream)
1762 (clear-stream $_test-input-buffered-file->buffer)
1763 (clear-stream _test-output-stream)
1764 (clear-stream $_test-output-buffered-file->buffer)
1765 c7 0/subop/copy *Next-block-index 1/imm32
1766
1767 (write _test-input-stream "fn foo {\n")
1768 (write _test-input-stream " a: {\n")
1769 (write _test-input-stream " var x: int\n")
1770 (write _test-input-stream " {\n")
1771 (write _test-input-stream " var y: int\n")
1772 (write _test-input-stream " loop a\n")
1773 (write _test-input-stream " increment x\n")
1774 (write _test-input-stream " }\n")
1775 (write _test-input-stream " }\n")
1776 (write _test-input-stream "}\n")
1777
1778 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1779 (flush _test-output-buffered-file)
1780 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1786
1787 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0")
1788 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1")
1789 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2")
1790 (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")
1791 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4")
1792 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5")
1793 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6")
1794 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7")
1795 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8")
1796 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9")
1797 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10")
1798 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11")
1799 (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")
1800 (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")
1801 (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")
1802 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15")
1803 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16")
1804 (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")
1805 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18")
1806 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19")
1807 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20")
1808 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21")
1809 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22")
1810 (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")
1811 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24")
1812 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25")
1813
1814 89/<- %esp 5/r32/ebp
1815 5d/pop-to-ebp
1816 c3/return
1817
1818 test-convert-length-of-array:
1819
1820 55/push-ebp
1821 89/<- %ebp 4/r32/esp
1822
1823 (clear-stream _test-input-stream)
1824 (clear-stream $_test-input-buffered-file->buffer)
1825 (clear-stream _test-output-stream)
1826 (clear-stream $_test-output-buffered-file->buffer)
1827 c7 0/subop/copy *Next-block-index 1/imm32
1828
1829 (write _test-input-stream "fn foo a: (addr array int) {\n")
1830 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n")
1831 (write _test-input-stream " var c/eax: int <- length b\n")
1832 (write _test-input-stream "}\n")
1833
1834 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1835 (flush _test-output-buffered-file)
1836 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1842
1843 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0")
1844 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1")
1845 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2")
1846 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3")
1847 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4")
1848 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5")
1849 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6")
1850 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7")
1851 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/8")
1852 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *eax 0x00000000/r32" "F - test-convert-length-of-array/9")
1853 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/10")
1854 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/11")
1855 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/12")
1856 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/13")
1857 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/14")
1858 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/15")
1859 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/16")
1860 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/17")
1861
1862 89/<- %esp 5/r32/ebp
1863 5d/pop-to-ebp
1864 c3/return
1865
1866
1867
1868
1869
1870 parse-mu:
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896 55/push-ebp
1897 89/<- %ebp 4/r32/esp
1898
1899 50/push-eax
1900 51/push-ecx
1901 52/push-edx
1902 53/push-ebx
1903 57/push-edi
1904
1905 81 5/subop/subtract %esp 0x200/imm32
1906 68/push 0x200/imm32/length
1907 68/push 0/imm32/read
1908 68/push 0/imm32/write
1909 89/<- %ecx 4/r32/esp
1910
1911 68/push 0/imm32/end
1912 68/push 0/imm32/start
1913 89/<- %edx 4/r32/esp
1914
1915 bf/copy-to-edi Program/imm32
1916
1917 81 5/subop/subtract %esp 0x400/imm32
1918 68/push 0x400/imm32/length
1919 68/push 0/imm32/top
1920 89/<- %ebx 4/r32/esp
1921 {
1922 $parse-mu:line-loop:
1923 (clear-stream %ecx)
1924 (read-line-buffered *(ebp+8) %ecx)
1925
1926 81 7/subop/compare *ecx 0/imm32
1927 0f 84/jump-if-= break/disp32
1928 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------
1934 (next-mu-token %ecx %edx)
1935
1936 (slice-empty? %edx)
1937 3d/compare-eax-and 0/imm32/false
1938 0f 85/jump-if-!= loop/disp32
1939
1940
1941 8b/-> *edx 0/r32/eax
1942 8a/copy-byte *eax 0/r32/AL
1943 81 4/subop/and %eax 0xff/imm32
1944
1945 3d/compare-eax-and 0x23/imm32/hash
1946 0f 84/jump-if-= loop/disp32
1947
1948 {
1949 $parse-mu:fn:
1950 (slice-equal? %edx "fn")
1951 3d/compare-eax-and 0/imm32/false
1952 0f 84/jump-if-= break/disp32
1953
1954 (allocate Heap *Function-size)
1955 (zero-out %eax *Function-size)
1956 (clear-stack %ebx)
1957 (populate-mu-function-header %ecx %eax %ebx)
1958 (populate-mu-function-body *(ebp+8) %eax %ebx)
1959
1960 89/<- *edi 0/r32/eax
1961
1962 8d/address-> *(eax+0x14) 7/r32/edi
1963 e9/jump $parse-mu:line-loop/disp32
1964 }
1965
1966 e9/jump $parse-mu:error1/disp32
1967 }
1968 $parse-mu:end:
1969
1970 81 0/subop/add %esp 0x630/imm32
1971
1972 5f/pop-to-edi
1973 5b/pop-to-ebx
1974 5a/pop-to-edx
1975 59/pop-to-ecx
1976 58/pop-to-eax
1977
1978 89/<- %esp 5/r32/ebp
1979 5d/pop-to-ebp
1980 c3/return
1981
1982 $parse-mu:error1:
1983
1984 (write-buffered Stderr "unexpected top-level command: ")
1985 (write-slice-buffered Stderr %edx)
1986 (write-buffered Stderr "\n")
1987 (flush Stderr)
1988
1989 bb/copy-to-ebx 1/imm32
1990 b8/copy-to-eax 1/imm32/exit
1991 cd/syscall 0x80/imm8
1992
1993
1994 $parse-mu:error2:
1995
1996 (print-int32-buffered Stderr *ebx)
1997 (write-buffered Stderr " vars not reclaimed after fn '")
1998 (write-slice-buffered Stderr *eax)
1999 (write-buffered Stderr "'\n")
2000 (flush Stderr)
2001
2002 bb/copy-to-ebx 1/imm32
2003 b8/copy-to-eax 1/imm32/exit
2004 cd/syscall 0x80/imm8
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018 populate-mu-function-header:
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050 55/push-ebp
2051 89/<- %ebp 4/r32/esp
2052
2053 50/push-eax
2054 51/push-ecx
2055 52/push-edx
2056 53/push-ebx
2057 57/push-edi
2058
2059 8b/-> *(ebp+0xc) 7/r32/edi
2060
2061 68/push 0/imm32/end
2062 68/push 0/imm32/start
2063 89/<- %ecx 4/r32/esp
2064
2065 ba/copy-to-edx 8/imm32
2066
2067 (next-mu-token *(ebp+8) %ecx)
2068
2069
2070
2071 (slice-equal? %ecx "{")
2072 3d/compare-eax-and 0/imm32/false
2073 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2074
2075 (slice-equal? %ecx "->")
2076 3d/compare-eax-and 0/imm32/false
2077 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2078
2079 (slice-equal? %ecx "}")
2080 3d/compare-eax-and 0/imm32/false
2081 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2082
2083 (slice-to-string Heap %ecx)
2084 89/<- *edi 0/r32/eax
2085
2086 89/<- *(edi+4) 0/r32/eax
2087
2088 {
2089 $populate-mu-function-header:check-for-inout:
2090 (next-mu-token *(ebp+8) %ecx)
2091
2092 (slice-equal? %ecx "{")
2093 3d/compare-eax-and 0/imm32/false
2094 0f 85/jump-if-!= $populate-mu-function-header:done/disp32
2095
2096 (slice-equal? %ecx "->")
2097 3d/compare-eax-and 0/imm32/false
2098 0f 85/jump-if-!= break/disp32
2099
2100 (slice-equal? %ecx "}")
2101 3d/compare-eax-and 0/imm32/false
2102 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2103
2104 (parse-var-with-type %ecx *(ebp+8))
2105 89/<- %ebx 0/r32/eax
2106
2107 81 7/subop/compare *(ebx+0x10) 0/imm32
2108 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32
2109
2110 89/<- *(ebx+0xc) 2/r32/edx
2111
2112 (size-of %ebx)
2113 01/add %edx 0/r32/eax
2114
2115
2116 (append-list Heap %ebx *(edi+8))
2117 89/<- *(edi+8) 0/r32/eax
2118 (push *(ebp+0x10) %ebx)
2119
2120 e9/jump loop/disp32
2121 }
2122
2123 {
2124 $populate-mu-function-header:check-for-out:
2125 (next-mu-token *(ebp+8) %ecx)
2126
2127 (slice-equal? %ecx "{")
2128 3d/compare-eax-and 0/imm32/false
2129 0f 85/jump-if-!= break/disp32
2130
2131 (slice-equal? %ecx "->")
2132 3d/compare-eax-and 0/imm32/false
2133 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2134
2135 (slice-equal? %ecx "}")
2136 3d/compare-eax-and 0/imm32/false
2137 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
2138
2139 (parse-var-with-type %ecx *(ebp+8))
2140 89/<- %ebx 0/r32/eax
2141
2142 81 7/subop/compare *(ebx+0x10) 0/imm32
2143 0f 84/jump-if-= $populate-mu-function-header:error3/disp32
2144 (append-list Heap %ebx *(edi+0xc))
2145 89/<- *(edi+0xc) 0/r32/eax
2146 e9/jump loop/disp32
2147 }
2148 $populate-mu-function-header:done:
2149 (check-no-tokens-left *(ebp+8))
2150 $populate-mu-function-header:end:
2151
2152 81 0/subop/add %esp 8/imm32
2153
2154 5f/pop-to-edi
2155 5b/pop-to-ebx
2156 5a/pop-to-edx
2157 59/pop-to-ecx
2158 58/pop-to-eax
2159
2160 89/<- %esp 5/r32/ebp
2161 5d/pop-to-ebp
2162 c3/return
2163
2164 $populate-mu-function-header:error1:
2165
2166 (write-buffered Stderr "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '")
2167 (flush Stderr)
2168 (rewind-stream *(ebp+8))
2169 (write-stream 2 *(ebp+8))
2170 (write-buffered Stderr "'\n")
2171 (flush Stderr)
2172
2173 bb/copy-to-ebx 1/imm32
2174 b8/copy-to-eax 1/imm32/exit
2175 cd/syscall 0x80/imm8
2176
2177
2178 $populate-mu-function-header:error2:
2179
2180 (write-buffered Stderr "function input '")
2181 (write-buffered Stderr *ebx)
2182 (write-buffered Stderr "' cannot be in a register")
2183 (flush Stderr)
2184
2185 bb/copy-to-ebx 1/imm32
2186 b8/copy-to-eax 1/imm32/exit
2187 cd/syscall 0x80/imm8
2188
2189
2190 $populate-mu-function-header:error3:
2191
2192 (write-buffered Stderr "function input '")
2193 (write-buffered Stderr *eax)
2194 (write-buffered Stderr " must be in a register'")
2195 (flush Stderr)
2196 (rewind-stream *(ebp+8))
2197 (write-stream 2 *(ebp+8))
2198 (write-buffered Stderr "'\n")
2199 (flush Stderr)
2200
2201 bb/copy-to-ebx 1/imm32
2202 b8/copy-to-eax 1/imm32/exit
2203 cd/syscall 0x80/imm8
2204
2205
2206 test-function-header-with-arg:
2207
2208 55/push-ebp
2209 89/<- %ebp 4/r32/esp
2210
2211 (clear-stream _test-input-stream)
2212 (write _test-input-stream "foo n: int {\n")
2213
2214 2b/subtract-> *Function-size 4/r32/esp
2215 89/<- %ecx 4/r32/esp
2216 (zero-out %ecx *Function-size)
2217
2218 81 5/subop/subtract %esp 0x10/imm32
2219 68/push 0x10/imm32/length
2220 68/push 0/imm32/top
2221 89/<- %ebx 4/r32/esp
2222
2223 (populate-mu-function-header _test-input-stream %ecx %ebx)
2224
2225 (check-strings-equal *ecx "foo" "F - test-function-header-with-arg/name")
2226
2227 8b/-> *(ecx+8) 2/r32/edx
2228
2229 8b/-> *edx 3/r32/ebx
2230 (check-strings-equal *ebx "n" "F - test-function-header-with-arg/inout:0")
2231 8b/-> *(ebx+4) 3/r32/ebx
2232 (check-ints-equal *ebx 1 "F - test-function-header-with-arg/inout:0/type:0")
2233 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-arg/inout:0/type:1")
2234
2235 89/<- %esp 5/r32/ebp
2236 5d/pop-to-ebp
2237 c3/return
2238
2239 test-function-header-with-multiple-args:
2240
2241 55/push-ebp
2242 89/<- %ebp 4/r32/esp
2243
2244 (clear-stream _test-input-stream)
2245 (write _test-input-stream "foo a: int, b: int c: int {\n")
2246
2247 2b/subtract-> *Function-size 4/r32/esp
2248 89/<- %ecx 4/r32/esp
2249 (zero-out %ecx *Function-size)
2250
2251 81 5/subop/subtract %esp 0x10/imm32
2252 68/push 0x10/imm32/length
2253 68/push 0/imm32/top
2254 89/<- %ebx 4/r32/esp
2255
2256 (populate-mu-function-header _test-input-stream %ecx %ebx)
2257
2258 (check-strings-equal *ecx "foo")
2259
2260 8b/-> *(ecx+8) 2/r32/edx
2261 $test-function-header-with-multiple-args:inout0:
2262
2263 8b/-> *edx 3/r32/ebx
2264 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args/inout:0")
2265 8b/-> *(ebx+4) 3/r32/ebx
2266 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:0/type:0")
2267 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:0/type:1")
2268
2269 8b/-> *(edx+4) 2/r32/edx
2270 $test-function-header-with-multiple-args:inout1:
2271
2272 8b/-> *edx 3/r32/ebx
2273 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args/inout:1")
2274 8b/-> *(ebx+4) 3/r32/ebx
2275 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:1/type:0")
2276 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:1/type:1")
2277
2278 8b/-> *(edx+4) 2/r32/edx
2279 $test-function-header-with-multiple-args:inout2:
2280
2281 8b/-> *edx 3/r32/ebx
2282 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args/inout:2")
2283 8b/-> *(ebx+4) 3/r32/ebx
2284 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:2/type:0")
2285 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:2/type:1")
2286
2287 89/<- %esp 5/r32/ebp
2288 5d/pop-to-ebp
2289 c3/return
2290
2291 test-function-with-multiple-args-and-outputs:
2292
2293 55/push-ebp
2294 89/<- %ebp 4/r32/esp
2295
2296 (clear-stream _test-input-stream)
2297 (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx: int {\n")
2298
2299 2b/subtract-> *Function-size 4/r32/esp
2300 89/<- %ecx 4/r32/esp
2301 (zero-out %ecx *Function-size)
2302
2303 81 5/subop/subtract %esp 0x10/imm32
2304 68/push 0x10/imm32/length
2305 68/push 0/imm32/top
2306 89/<- %ebx 4/r32/esp
2307
2308 (populate-mu-function-header _test-input-stream %ecx %ebx)
2309
2310 (check-strings-equal *ecx "foo")
2311
2312 8b/-> *(ecx+8) 2/r32/edx
2313
2314 8b/-> *edx 3/r32/ebx
2315 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0")
2316 8b/-> *(ebx+4) 3/r32/ebx
2317 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0")
2318 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1")
2319
2320 8b/-> *(edx+4) 2/r32/edx
2321
2322 8b/-> *edx 3/r32/ebx
2323 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1")
2324 8b/-> *(ebx+4) 3/r32/ebx
2325 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0")
2326 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1")
2327
2328 8b/-> *(edx+4) 2/r32/edx
2329
2330 8b/-> *edx 3/r32/ebx
2331 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2")
2332 8b/-> *(ebx+4) 3/r32/ebx
2333 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0")
2334 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1")
2335
2336 8b/-> *(ecx+0xc) 2/r32/edx
2337
2338 8b/-> *edx 3/r32/ebx
2339 (check-strings-equal *ebx "x" "F - test-function-header-with-multiple-args-and-outputs/output:0")
2340 (check-strings-equal *(ebx+0x10) "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register")
2341 8b/-> *(ebx+4) 3/r32/ebx
2342 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1")
2343 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1")
2344
2345 8b/-> *(edx+4) 2/r32/edx
2346
2347 8b/-> *edx 3/r32/ebx
2348 (check-strings-equal *ebx "y" "F - test-function-header-with-multiple-args-and-outputs/output:1")
2349 (check-strings-equal *(ebx+0x10) "edx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register")
2350 8b/-> *(ebx+4) 3/r32/ebx
2351 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1")
2352 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1")
2353
2354 89/<- %esp 5/r32/ebp
2355 5d/pop-to-ebp
2356 c3/return
2357
2358
2359
2360
2361
2362
2363
2364
2365 parse-var-with-type:
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384 55/push-ebp
2385 89/<- %ebp 4/r32/esp
2386
2387 51/push-ecx
2388 52/push-edx
2389 53/push-ebx
2390 56/push-esi
2391 57/push-edi
2392
2393 8b/-> *(ebp+8) 6/r32/esi
2394
2395 8b/-> *(esi+4) 1/r32/ecx
2396 49/decrement-ecx
2397 8a/copy-byte *ecx 1/r32/CL
2398 81 4/subop/and %ecx 0xff/imm32
2399 81 7/subop/compare %ecx 0x3a/imm32/colon
2400 0f 85/jump-if-!= $parse-var-with-type:abort/disp32
2401
2402 ff 1/subop/decrement *(esi+4)
2403
2404 (allocate Heap *Var-size)
2405 (zero-out %eax *Var-size)
2406 89/<- %edi 0/r32/eax
2407
2408 68/push 0/imm32/end
2409 68/push 0/imm32/start
2410 89/<- %ecx 4/r32/esp
2411 $parse-var-with-type:save-name:
2412
2413 (next-token-from-slice *esi *(esi+4) 0x2f %ecx)
2414
2415 8b/-> *(ecx+4) 2/r32/edx
2416 $parse-var-with-type:write-name:
2417 (slice-to-string Heap %ecx)
2418 89/<- *edi 0/r32/eax
2419
2420 $parse-var-with-type:save-register:
2421 (next-token-from-slice %edx *(esi+4) 0x2f %ecx)
2422
2423 {
2424 $parse-var-with-type:write-register:
2425 (slice-empty? %ecx)
2426 3d/compare-eax-and 0/imm32/false
2427 75/jump-if-!= break/disp8
2428 (slice-to-string Heap %ecx)
2429 89/<- *(edi+0x10) 0/r32/eax
2430 }
2431 $parse-var-with-type:save-type:
2432 (parse-type Heap *(ebp+0xc))
2433 89/<- *(edi+4) 0/r32/eax
2434 $parse-var-with-type:end:
2435
2436 89/<- %eax 7/r32/edi
2437
2438 81 0/subop/add %esp 8/imm32
2439
2440 5f/pop-to-edi
2441 5e/pop-to-esi
2442 5b/pop-to-ebx
2443 5a/pop-to-edx
2444 59/pop-to-ecx
2445
2446 89/<- %esp 5/r32/ebp
2447 5d/pop-to-ebp
2448 c3/return
2449
2450 $parse-var-with-type:abort:
2451
2452 (write-buffered Stderr "var should have form 'name: type' in '")
2453 (flush Stderr)
2454 (rewind-stream *(ebp+0xc))
2455 (write-stream 2 *(ebp+0xc))
2456 (write-buffered Stderr "'\n")
2457 (flush Stderr)
2458
2459 bb/copy-to-ebx 1/imm32
2460 b8/copy-to-eax 1/imm32/exit
2461 cd/syscall 0x80/imm8
2462
2463
2464 parse-type:
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482 55/push-ebp
2483 89/<- %ebp 4/r32/esp
2484
2485 51/push-ecx
2486 52/push-edx
2487
2488 68/push 0/imm32
2489 68/push 0/imm32
2490 89/<- %ecx 4/r32/esp
2491
2492 (next-mu-token *(ebp+0xc) %ecx)
2493
2494
2495
2496
2497
2498 (slice-equal? %ecx "")
2499 3d/compare-eax-and 0/imm32/false
2500 0f 85/jump-if-!= $parse-type:abort/disp32
2501
2502 (slice-equal? %ecx "{")
2503 3d/compare-eax-and 0/imm32/false
2504 0f 85/jump-if-!= $parse-type:abort/disp32
2505
2506 (slice-equal? %ecx "}")
2507 3d/compare-eax-and 0/imm32/false
2508 0f 85/jump-if-!= $parse-type:abort/disp32
2509
2510 (slice-equal? %ecx "->")
2511 3d/compare-eax-and 0/imm32/false
2512 0f 85/jump-if-!= $parse-type:abort/disp32
2513
2514 (slice-equal? %ecx ")")
2515 3d/compare-eax-and 0/imm32/false
2516 b8/copy-to-eax 0/imm32
2517 0f 85/jump-if-!= $parse-type:end/disp32
2518
2519 (allocate *(ebp+8) *Tree-size)
2520 (zero-out %eax *Tree-size)
2521 89/<- %edx 0/r32/eax
2522 {
2523
2524 (slice-equal? %ecx "(")
2525 3d/compare-eax-and 0/imm32/false
2526 75/jump-if-!= break/disp8
2527
2528 (pos-slice Type-id %ecx)
2529
2530
2531
2532
2533 89/<- *edx 0/r32/eax
2534 e9/jump $parse-type:return-edx/disp32
2535 }
2536
2537
2538 (parse-type *(ebp+8) *(ebp+0xc))
2539
2540
2541 89/<- *edx 0/r32/eax
2542
2543 (parse-type-tree *(ebp+8) *(ebp+0xc))
2544
2545
2546
2547
2548 89/<- *(edx+4) 0/r32/eax
2549 $parse-type:return-edx:
2550 89/<- %eax 2/r32/edx
2551 $parse-type:end:
2552
2553 81 0/subop/add %esp 8/imm32
2554
2555 5a/pop-to-edx
2556 59/pop-to-ecx
2557
2558 89/<- %esp 5/r32/ebp
2559 5d/pop-to-ebp
2560 c3/return
2561
2562 $parse-type:abort:
2563
2564 (write-buffered Stderr "unexpected token when parsing type: '")
2565 (write-slice-buffered Stderr %ecx)
2566 (write-buffered Stderr "'\n")
2567 (flush Stderr)
2568
2569 bb/copy-to-ebx 1/imm32
2570 b8/copy-to-eax 1/imm32/exit
2571 cd/syscall 0x80/imm8
2572
2573
2574 parse-type-tree:
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585 55/push-ebp
2586 89/<- %ebp 4/r32/esp
2587
2588 51/push-ecx
2589 52/push-edx
2590
2591 (parse-type *(ebp+8) *(ebp+0xc))
2592
2593 3d/compare-eax-and 0/imm32
2594 74/jump-if-= $parse-type-tree:end/disp8
2595
2596 89/<- %ecx 0/r32/eax
2597
2598 (allocate *(ebp+8) *Tree-size)
2599 (zero-out %eax *Tree-size)
2600 89/<- %edx 0/r32/eax
2601
2602 89/<- *edx 1/r32/ecx
2603
2604 (parse-type-tree *(ebp+8) *(ebp+0xc))
2605 89/<- *(edx+4) 0/r32/eax
2606 $parse-type-tree:return-edx:
2607 89/<- %eax 2/r32/edx
2608 $parse-type-tree:end:
2609
2610 5a/pop-to-edx
2611 59/pop-to-ecx
2612
2613 89/<- %esp 5/r32/ebp
2614 5d/pop-to-ebp
2615 c3/return
2616
2617 next-mu-token:
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662 55/push-ebp
2663 89/<- %ebp 4/r32/esp
2664
2665 50/push-eax
2666 51/push-ecx
2667 56/push-esi
2668 57/push-edi
2669
2670 8b/-> *(ebp+8) 6/r32/esi
2671
2672 8b/-> *(ebp+0xc) 7/r32/edi
2673 $next-mu-token:start:
2674 (skip-chars-matching-whitespace %esi)
2675 $next-mu-token:check0:
2676
2677
2678 8b/-> *(esi+4) 1/r32/ecx
2679
2680 3b/compare 1/r32/ecx *esi
2681 c7 0/subop/copy *edi 0/imm32
2682 c7 0/subop/copy *(edi+4) 0/imm32
2683 0f 8d/jump-if->= $next-mu-token:end/disp32
2684
2685 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
2686 89/<- *edi 0/r32/eax
2687
2688 31/xor %eax 0/r32/eax
2689 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
2690 {
2691 $next-mu-token:check-for-comma:
2692
2693 3d/compare-eax-and 0x2c/imm32/comma
2694 75/jump-if-!= break/disp8
2695
2696 ff 0/subop/increment *(esi+4)
2697
2698 e9/jump $next-mu-token:start/disp32
2699 }
2700 {
2701 $next-mu-token:check-for-comment:
2702
2703 3d/compare-eax-and 0x23/imm32/pound
2704 75/jump-if-!= break/disp8
2705
2706 e9/jump $next-mu-token:done/disp32
2707 }
2708 {
2709 $next-mu-token:check-for-string-literal:
2710
2711 3d/compare-eax-and 0x22/imm32/dquote
2712 75/jump-if-!= break/disp8
2713 (skip-string %esi)
2714
2715 e9/jump $next-mu-token:done/disp32
2716 }
2717 {
2718 $next-mu-token:check-for-open-paren:
2719
2720 3d/compare-eax-and 0x28/imm32/open-paren
2721 75/jump-if-!= break/disp8
2722
2723 ff 0/subop/increment *(esi+4)
2724
2725 e9/jump $next-mu-token:done/disp32
2726 }
2727 {
2728 $next-mu-token:check-for-close-paren:
2729
2730 3d/compare-eax-and 0x29/imm32/close-paren
2731 75/jump-if-!= break/disp8
2732
2733 ff 0/subop/increment *(esi+4)
2734
2735 e9/jump $next-mu-token:done/disp32
2736 }
2737 {
2738 $next-mu-token:regular-word-without-metadata:
2739
2740
2741 8b/-> *(esi+4) 1/r32/ecx
2742
2743 3b/compare *esi 1/r32/ecx
2744 7d/jump-if->= break/disp8
2745
2746 31/xor %eax 0/r32/eax
2747 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
2748
2749 3d/compare-eax-and 0x20/imm32/space
2750 74/jump-if-= break/disp8
2751
2752 3d/compare-eax-and 0xd/imm32/carriage-return
2753 74/jump-if-= break/disp8
2754
2755 3d/compare-eax-and 0xa/imm32/newline
2756 74/jump-if-= break/disp8
2757
2758 3d/compare-eax-and 0x28/imm32/open-paren
2759 0f 84/jump-if-= break/disp32
2760
2761 3d/compare-eax-and 0x29/imm32/close-paren
2762 0f 84/jump-if-= break/disp32
2763
2764 3d/compare-eax-and 0x2c/imm32/comma
2765 0f 84/jump-if-= break/disp32
2766
2767 ff 0/subop/increment *(esi+4)
2768
2769 e9/jump loop/disp32
2770 }
2771 $next-mu-token:done:
2772
2773 8b/-> *(esi+4) 1/r32/ecx
2774 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
2775 89/<- *(edi+4) 0/r32/eax
2776 $next-mu-token:end:
2777
2778 5f/pop-to-edi
2779 5e/pop-to-esi
2780 59/pop-to-ecx
2781 58/pop-to-eax
2782
2783 89/<- %esp 5/r32/ebp
2784 5d/pop-to-ebp
2785 c3/return
2786
2787
2788
2789 pos-slice:
2790
2791 55/push-ebp
2792 89/<- %ebp 4/r32/esp
2793
2794 51/push-ecx
2795 52/push-edx
2796 53/push-ebx
2797 56/push-esi
2798
2799
2800
2801
2802
2803 8b/-> *(ebp+8) 6/r32/esi
2804
2805 b9/copy-to-ecx 0/imm32
2806
2807 8d/copy-address *(esi+0xc) 2/r32/edx
2808
2809 8b/-> *esi 3/r32/ebx
2810 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx
2811 {
2812
2813
2814
2815
2816
2817 39/compare %edx 3/r32/ebx
2818 b8/copy-to-eax -1/imm32
2819 73/jump-if-addr>= $pos-slice:end/disp8
2820
2821 (slice-equal? *(ebp+0xc) *edx)
2822 3d/compare-eax-and 0/imm32/false
2823 75/jump-if-!= break/disp8
2824
2825 41/increment-ecx
2826
2827 81 0/subop/add %edx 4/imm32
2828
2829 eb/jump loop/disp8
2830 }
2831
2832 89/<- %eax 1/r32/ecx
2833 $pos-slice:end:
2834
2835
2836
2837
2838 5e/pop-to-esi
2839 5b/pop-to-ebx
2840 5a/pop-to-edx
2841 59/pop-to-ecx
2842
2843 89/<- %esp 5/r32/ebp
2844 5d/pop-to-ebp
2845 c3/return
2846
2847 == data
2848
2849 Type-id:
2850 0x18/imm32/write
2851 0/imm32/read
2852 0x100/imm32/length
2853
2854 "literal"/imm32
2855 "int"/imm32
2856 "addr"/imm32
2857 "array"/imm32
2858 "handle"/imm32
2859 "bool"/imm32
2860 0/imm32
2861 0/imm32
2862
2863 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
2864 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
2865 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
2866 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
2867 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
2868 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
2869 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
2870
2871 == code
2872
2873 test-parse-var-with-type:
2874
2875 55/push-ebp
2876 89/<- %ebp 4/r32/esp
2877
2878 b8/copy-to-eax "x:"/imm32
2879 8b/-> *eax 1/r32/ecx
2880 8d/copy-address *(eax+ecx+4) 1/r32/ecx
2881 05/add-to-eax 4/imm32
2882
2883 51/push-ecx
2884 50/push-eax
2885 89/<- %ecx 4/r32/esp
2886
2887 (clear-stream _test-input-stream)
2888 (write _test-input-stream "int")
2889
2890 (parse-var-with-type %ecx _test-input-stream)
2891 8b/-> *eax 2/r32/edx
2892 (check-strings-equal %edx "x" "F - test-var-with-type/name")
2893 8b/-> *(eax+4) 2/r32/edx
2894 (check-ints-equal *edx 1 "F - test-var-with-type/type")
2895 (check-ints-equal *(edx+4) 0 "F - test-var-with-type/type")
2896
2897 89/<- %esp 5/r32/ebp
2898 5d/pop-to-ebp
2899 c3/return
2900
2901 test-parse-var-with-type-and-register:
2902
2903 55/push-ebp
2904 89/<- %ebp 4/r32/esp
2905
2906 b8/copy-to-eax "x/eax:"/imm32
2907 8b/-> *eax 1/r32/ecx
2908 8d/copy-address *(eax+ecx+4) 1/r32/ecx
2909 05/add-to-eax 4/imm32
2910
2911 51/push-ecx
2912 50/push-eax
2913 89/<- %ecx 4/r32/esp
2914
2915 (clear-stream _test-input-stream)
2916 (write _test-input-stream "int")
2917
2918 (parse-var-with-type %ecx _test-input-stream)
2919 8b/-> *eax 2/r32/edx
2920 (check-strings-equal %edx "x" "F - test-var-with-type-and-register/name")
2921 8b/-> *(eax+0x10) 2/r32/edx
2922 (check-strings-equal %edx "eax" "F - test-var-with-type-and-register/register")
2923 8b/-> *(eax+4) 2/r32/edx
2924 (check-ints-equal *edx 1 "F - test-var-with-type-and-register/type")
2925 (check-ints-equal *(edx+4) 0 "F - test-var-with-type-and-register/type")
2926
2927 89/<- %esp 5/r32/ebp
2928 5d/pop-to-ebp
2929 c3/return
2930
2931 test-parse-var-with-trailing-characters:
2932
2933 55/push-ebp
2934 89/<- %ebp 4/r32/esp
2935
2936 b8/copy-to-eax "x:"/imm32
2937 8b/-> *eax 1/r32/ecx
2938 8d/copy-address *(eax+ecx+4) 1/r32/ecx
2939 05/add-to-eax 4/imm32
2940
2941 51/push-ecx
2942 50/push-eax
2943 89/<- %ecx 4/r32/esp
2944
2945 (clear-stream _test-input-stream)
2946 (write _test-input-stream "int,")
2947
2948 (parse-var-with-type %ecx _test-input-stream)
2949 8b/-> *eax 2/r32/edx
2950 (check-strings-equal %edx "x" "F - test-var-with-trailing-characters/name")
2951 8b/-> *(eax+0x10) 2/r32/edx
2952 (check-ints-equal %edx 0 "F - test-var-with-trailing-characters/register")
2953 8b/-> *(eax+4) 2/r32/edx
2954 (check-ints-equal *edx 1 "F - test-var-with-trailing-characters/type")
2955 (check-ints-equal *(edx+4) 0 "F - test-var-with-trailing-characters/type")
2956
2957 89/<- %esp 5/r32/ebp
2958 5d/pop-to-ebp
2959 c3/return
2960
2961 test-parse-var-with-register-and-trailing-characters:
2962
2963 55/push-ebp
2964 89/<- %ebp 4/r32/esp
2965
2966 b8/copy-to-eax "x/eax:"/imm32
2967 8b/-> *eax 1/r32/ecx
2968 8d/copy-address *(eax+ecx+4) 1/r32/ecx
2969 05/add-to-eax 4/imm32
2970
2971 51/push-ecx
2972 50/push-eax
2973 89/<- %ecx 4/r32/esp
2974
2975 (clear-stream _test-input-stream)
2976 (write _test-input-stream "int,")
2977
2978 (parse-var-with-type %ecx _test-input-stream)
2979 8b/-> *eax 2/r32/edx
2980 (check-strings-equal %edx "x" "F - test-var-with-register-and-trailing-characters/name")
2981 8b/-> *(eax+0x10) 2/r32/edx
2982 (check-strings-equal %edx "eax" "F - test-var-with-register-and-trailing-characters/register")
2983 8b/-> *(eax+4) 2/r32/edx
2984 (check-ints-equal *edx 1 "F - test-var-with-register-and-trailing-characters/type")
2985 (check-ints-equal *(edx+4) 0 "F - test-var-with-register-and-trailing-characters/type")
2986
2987 89/<- %esp 5/r32/ebp
2988 5d/pop-to-ebp
2989 c3/return
2990
2991 test-parse-var-with-compound-type:
2992
2993 55/push-ebp
2994 89/<- %ebp 4/r32/esp
2995
2996 b8/copy-to-eax "x:"/imm32
2997 8b/-> *eax 1/r32/ecx
2998 8d/copy-address *(eax+ecx+4) 1/r32/ecx
2999 05/add-to-eax 4/imm32
3000
3001 51/push-ecx
3002 50/push-eax
3003 89/<- %ecx 4/r32/esp
3004
3005 (clear-stream _test-input-stream)
3006 (write _test-input-stream "(addr int)")
3007
3008 (parse-var-with-type %ecx _test-input-stream)
3009 8b/-> *eax 2/r32/edx
3010 (check-strings-equal %edx "x" "F - test-var-with-compound-type/name")
3011 8b/-> *(eax+0x10) 2/r32/edx
3012 (check-ints-equal %edx 0 "F - test-var-with-compound-type/register")
3013
3014 8b/-> *(eax+4) 2/r32/edx
3015
3016 8b/-> *edx 0/r32/eax
3017 (check-ints-equal *eax 2 "F - test-var-with-compound-type/type:0")
3018
3019 8b/-> *(edx+4) 2/r32/edx
3020 8b/-> *edx 0/r32/eax
3021 (check-ints-equal *eax 1 "F - test-var-with-compound-type/type:1")
3022
3023 (check-ints-equal *(edx+4) 0 "F - test-var-with-compound-type/type:2")
3024
3025 89/<- %esp 5/r32/ebp
3026 5d/pop-to-ebp
3027 c3/return
3028
3029
3030
3031
3032 is-identifier?:
3033
3034 55/push-ebp
3035 89/<- %ebp 4/r32/esp
3036
3037 (slice-empty? *(ebp+8))
3038 3d/compare-eax-and 0/imm32/false
3039 75/jump-if-!= $is-identifier?:false/disp8
3040
3041 8b/-> *(ebp+8) 0/r32/eax
3042 8b/-> *eax 0/r32/eax
3043 8a/copy-byte *eax 0/r32/AL
3044 81 4/subop/and %eax 0xff/imm32
3045
3046 3d/compare-eax-and 0x24/imm32/$
3047 74/jump-if-= $is-identifier?:true/disp8
3048
3049 3d/compare-eax-and 0x5f/imm32/_
3050 74/jump-if-= $is-identifier?:true/disp8
3051
3052 25/and-eax-with 0x5f/imm32
3053
3054 3d/compare-eax-and 0x41/imm32/A
3055 7c/jump-if-< $is-identifier?:false/disp8
3056
3057 3d/compare-eax-and 0x5a/imm32/Z
3058 7f/jump-if-> $is-identifier?:false/disp8
3059
3060 $is-identifier?:true:
3061 b8/copy-to-eax 1/imm32/true
3062 eb/jump $is-identifier?:end/disp8
3063 $is-identifier?:false:
3064 b8/copy-to-eax 0/imm32/false
3065 $is-identifier?:end:
3066
3067 89/<- %esp 5/r32/ebp
3068 5d/pop-to-ebp
3069 c3/return
3070
3071 test-is-identifier-dollar:
3072
3073 55/push-ebp
3074 89/<- %ebp 4/r32/esp
3075
3076 b8/copy-to-eax "$a"/imm32
3077 8b/-> *eax 1/r32/ecx
3078 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3079 05/add-to-eax 4/imm32
3080
3081 51/push-ecx
3082 50/push-eax
3083 89/<- %ecx 4/r32/esp
3084
3085 (is-identifier? %ecx)
3086 (check-ints-equal %eax 1 "F - test-is-identifier-dollar")
3087
3088 89/<- %esp 5/r32/ebp
3089 5d/pop-to-ebp
3090 c3/return
3091
3092 test-is-identifier-underscore:
3093
3094 55/push-ebp
3095 89/<- %ebp 4/r32/esp
3096
3097 b8/copy-to-eax "_a"/imm32
3098 8b/-> *eax 1/r32/ecx
3099 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3100 05/add-to-eax 4/imm32
3101
3102 51/push-ecx
3103 50/push-eax
3104 89/<- %ecx 4/r32/esp
3105
3106 (is-identifier? %ecx)
3107 (check-ints-equal %eax 1 "F - test-is-identifier-underscore")
3108
3109 89/<- %esp 5/r32/ebp
3110 5d/pop-to-ebp
3111 c3/return
3112
3113 test-is-identifier-a:
3114
3115 55/push-ebp
3116 89/<- %ebp 4/r32/esp
3117
3118 b8/copy-to-eax "a$"/imm32
3119 8b/-> *eax 1/r32/ecx
3120 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3121 05/add-to-eax 4/imm32
3122
3123 51/push-ecx
3124 50/push-eax
3125 89/<- %ecx 4/r32/esp
3126
3127 (is-identifier? %ecx)
3128 (check-ints-equal %eax 1 "F - test-is-identifier-a")
3129
3130 89/<- %esp 5/r32/ebp
3131 5d/pop-to-ebp
3132 c3/return
3133
3134 test-is-identifier-z:
3135
3136 55/push-ebp
3137 89/<- %ebp 4/r32/esp
3138
3139 b8/copy-to-eax "z$"/imm32
3140 8b/-> *eax 1/r32/ecx
3141 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3142 05/add-to-eax 4/imm32
3143
3144 51/push-ecx
3145 50/push-eax
3146 89/<- %ecx 4/r32/esp
3147
3148 (is-identifier? %ecx)
3149 (check-ints-equal %eax 1 "F - test-is-identifier-z")
3150
3151 89/<- %esp 5/r32/ebp
3152 5d/pop-to-ebp
3153 c3/return
3154
3155 test-is-identifier-A:
3156
3157 55/push-ebp
3158 89/<- %ebp 4/r32/esp
3159
3160 b8/copy-to-eax "A$"/imm32
3161 8b/-> *eax 1/r32/ecx
3162 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3163 05/add-to-eax 4/imm32
3164
3165 51/push-ecx
3166 50/push-eax
3167 89/<- %ecx 4/r32/esp
3168
3169 (is-identifier? %ecx)
3170 (check-ints-equal %eax 1 "F - test-is-identifier-A")
3171
3172 89/<- %esp 5/r32/ebp
3173 5d/pop-to-ebp
3174 c3/return
3175
3176 test-is-identifier-Z:
3177
3178 55/push-ebp
3179 89/<- %ebp 4/r32/esp
3180
3181 b8/copy-to-eax "Z$"/imm32
3182 8b/-> *eax 1/r32/ecx
3183 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3184 05/add-to-eax 4/imm32
3185
3186 51/push-ecx
3187 50/push-eax
3188 89/<- %ecx 4/r32/esp
3189
3190 (is-identifier? %ecx)
3191 (check-ints-equal %eax 1 "F - test-is-identifier-Z")
3192
3193 89/<- %esp 5/r32/ebp
3194 5d/pop-to-ebp
3195 c3/return
3196
3197 test-is-identifier-@:
3198
3199
3200 55/push-ebp
3201 89/<- %ebp 4/r32/esp
3202
3203 b8/copy-to-eax "@a"/imm32
3204 8b/-> *eax 1/r32/ecx
3205 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3206 05/add-to-eax 4/imm32
3207
3208 51/push-ecx
3209 50/push-eax
3210 89/<- %ecx 4/r32/esp
3211
3212 (is-identifier? %ecx)
3213 (check-ints-equal %eax 0 "F - test-is-identifier-@")
3214
3215 89/<- %esp 5/r32/ebp
3216 5d/pop-to-ebp
3217 c3/return
3218
3219 test-is-identifier-square-bracket:
3220
3221
3222 55/push-ebp
3223 89/<- %ebp 4/r32/esp
3224
3225 b8/copy-to-eax "[a"/imm32
3226 8b/-> *eax 1/r32/ecx
3227 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3228 05/add-to-eax 4/imm32
3229
3230 51/push-ecx
3231 50/push-eax
3232 89/<- %ecx 4/r32/esp
3233
3234 (is-identifier? %ecx)
3235 (check-ints-equal %eax 0 "F - test-is-identifier-@")
3236
3237 89/<- %esp 5/r32/ebp
3238 5d/pop-to-ebp
3239 c3/return
3240
3241 test-is-identifier-backtick:
3242
3243
3244 55/push-ebp
3245 89/<- %ebp 4/r32/esp
3246
3247 b8/copy-to-eax "`a"/imm32
3248 8b/-> *eax 1/r32/ecx
3249 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3250 05/add-to-eax 4/imm32
3251
3252 51/push-ecx
3253 50/push-eax
3254 89/<- %ecx 4/r32/esp
3255
3256 (is-identifier? %ecx)
3257 (check-ints-equal %eax 0 "F - test-is-identifier-backtick")
3258
3259 89/<- %esp 5/r32/ebp
3260 5d/pop-to-ebp
3261 c3/return
3262
3263 test-is-identifier-curly-brace-open:
3264
3265
3266 55/push-ebp
3267 89/<- %ebp 4/r32/esp
3268
3269 b8/copy-to-eax "{a"/imm32
3270 8b/-> *eax 1/r32/ecx
3271 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3272 05/add-to-eax 4/imm32
3273
3274 51/push-ecx
3275 50/push-eax
3276 89/<- %ecx 4/r32/esp
3277
3278 (is-identifier? %ecx)
3279 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open")
3280
3281 89/<- %esp 5/r32/ebp
3282 5d/pop-to-ebp
3283 c3/return
3284
3285 test-is-identifier-curly-brace-close:
3286
3287 55/push-ebp
3288 89/<- %ebp 4/r32/esp
3289
3290 b8/copy-to-eax "}a"/imm32
3291 8b/-> *eax 1/r32/ecx
3292 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3293 05/add-to-eax 4/imm32
3294
3295 51/push-ecx
3296 50/push-eax
3297 89/<- %ecx 4/r32/esp
3298
3299 (is-identifier? %ecx)
3300 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close")
3301
3302 89/<- %esp 5/r32/ebp
3303 5d/pop-to-ebp
3304 c3/return
3305
3306 test-is-identifier-hyphen:
3307
3308
3309 55/push-ebp
3310 89/<- %ebp 4/r32/esp
3311
3312 b8/copy-to-eax "-a"/imm32
3313 8b/-> *eax 1/r32/ecx
3314 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3315 05/add-to-eax 4/imm32
3316
3317 51/push-ecx
3318 50/push-eax
3319 89/<- %ecx 4/r32/esp
3320
3321 (is-identifier? %ecx)
3322 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen")
3323
3324 89/<- %esp 5/r32/ebp
3325 5d/pop-to-ebp
3326 c3/return
3327
3328 populate-mu-function-body:
3329
3330 55/push-ebp
3331 89/<- %ebp 4/r32/esp
3332
3333 50/push-eax
3334 56/push-esi
3335 57/push-edi
3336
3337 8b/-> *(ebp+8) 6/r32/esi
3338
3339 8b/-> *(ebp+0xc) 7/r32/edi
3340
3341 c7 0/subop/copy *Curr-block-depth 1/imm32
3342 c7 0/subop/copy *Next-local-stack-offset -4/imm32
3343
3344 (parse-mu-block %esi *(ebp+0x10) %edi)
3345
3346 89/<- *(edi+0x10) 0/r32/eax
3347 $populate-mu-function-body:end:
3348
3349 5f/pop-to-edi
3350 5e/pop-to-esi
3351 58/pop-to-eax
3352
3353 89/<- %esp 5/r32/ebp
3354 5d/pop-to-ebp
3355 c3/return
3356
3357 == data
3358
3359
3360
3361 Curr-block-depth:
3362 0/imm32
3363 Next-local-stack-offset:
3364 -4/imm32
3365
3366 Next-block-index:
3367 1/imm32
3368
3369 == code
3370
3371
3372 parse-mu-block:
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410 55/push-ebp
3411 89/<- %ebp 4/r32/esp
3412
3413 51/push-ecx
3414 52/push-edx
3415 53/push-ebx
3416 57/push-edi
3417
3418 81 5/subop/subtract %esp 0x200/imm32
3419 68/push 0x200/imm32/length
3420 68/push 0/imm32/read
3421 68/push 0/imm32/write
3422 89/<- %ecx 4/r32/esp
3423
3424 68/push 0/imm32/end
3425 68/push 0/imm32/start
3426 89/<- %edx 4/r32/esp
3427
3428 (allocate Heap *Stmt-size)
3429 (zero-out %eax *Stmt-size)
3430 89/<- %edi 0/r32/eax
3431
3432 c7 0/subop/copy *edi 0/imm32/block
3433
3434 (new-block-name *(ebp+0x10))
3435 89/<- *(edi+8) 0/r32/eax
3436
3437 (push *(ebp+0xc) %eax)
3438
3439 ff 0/subop/increment *Curr-block-depth
3440 {
3441 $parse-mu-block:line-loop:
3442
3443 (clear-stream %ecx)
3444 (read-line-buffered *(ebp+8) %ecx)
3445
3446
3447
3448
3449
3450 81 7/subop/compare *ecx 0/imm32
3451 0f 84/jump-if-= break/disp32
3452
3453 (next-mu-token %ecx %edx)
3454
3455
3456
3457
3458
3459 (slice-empty? %edx)
3460 3d/compare-eax-and 0/imm32/false
3461 0f 85/jump-if-!= loop/disp32
3462
3463
3464 8b/-> *edx 0/r32/eax
3465 8a/copy-byte *eax 0/r32/AL
3466 81 4/subop/and %eax 0xff/imm32
3467
3468 3d/compare-eax-and 0x23/imm32/hash
3469 0f 84/jump-if-= loop/disp32
3470
3471 {
3472 $parse-mu-block:check-for-block:
3473 (slice-equal? %edx "{")
3474 3d/compare-eax-and 0/imm32/false
3475 74/jump-if-= break/disp8
3476 (check-no-tokens-left %ecx)
3477
3478 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10))
3479 (append-to-block Heap %edi %eax)
3480 e9/jump $parse-mu-block:line-loop/disp32
3481 }
3482
3483 $parse-mu-block:check-for-end:
3484 (slice-equal? %edx "}")
3485 3d/compare-eax-and 0/imm32/false
3486 0f 85/jump-if-!= break/disp32
3487
3488 {
3489 $parse-mu-block:check-for-named-block:
3490
3491 8b/-> *(edx+4) 0/r32/eax
3492 48/decrement-eax
3493 8a/copy-byte *eax 0/r32/AL
3494 81 4/subop/and %eax 0xff/imm32
3495
3496 3d/compare-eax-and 0x3a/imm32/colon
3497 0f 85/jump-if-!= break/disp32
3498
3499
3500
3501 ff 1/subop/decrement *(edx+4)
3502
3503 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10))
3504 (append-to-block Heap %edi %eax)
3505 e9/jump $parse-mu-block:line-loop/disp32
3506 }
3507
3508 {
3509 $parse-mu-block:check-for-var:
3510 (slice-equal? %edx "var")
3511 3d/compare-eax-and 0/imm32/false
3512 74/jump-if-= break/disp8
3513
3514 (parse-mu-var-def %ecx *(ebp+0xc))
3515 (append-to-block Heap %edi %eax)
3516 e9/jump $parse-mu-block:line-loop/disp32
3517 }
3518 $parse-mu-block:regular-stmt:
3519
3520 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10))
3521 (append-to-block Heap %edi %eax)
3522 e9/jump loop/disp32
3523 }
3524
3525 ff 1/subop/decrement *Curr-block-depth
3526
3527 (pop *(ebp+0xc))
3528
3529 89/<- %eax 7/r32/edi
3530 $parse-mu-block:end:
3531
3532 81 0/subop/add %esp 0x214/imm32
3533
3534 5f/pop-to-edi
3535 5b/pop-to-ebx
3536 5a/pop-to-edx
3537 59/pop-to-ecx
3538
3539 89/<- %esp 5/r32/ebp
3540 5d/pop-to-ebp
3541 c3/return
3542
3543 $parse-mu-block:abort:
3544
3545 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
3546 (rewind-stream %ecx)
3547 (write-stream 2 %ecx)
3548 (write-buffered Stderr "'\n")
3549 (flush Stderr)
3550
3551 bb/copy-to-ebx 1/imm32
3552 b8/copy-to-eax 1/imm32/exit
3553 cd/syscall 0x80/imm8
3554
3555
3556 new-block-name:
3557
3558 55/push-ebp
3559 89/<- %ebp 4/r32/esp
3560
3561 51/push-ecx
3562 52/push-edx
3563
3564 8b/-> *(ebp+8) 0/r32/eax
3565 8b/-> *eax 0/r32/eax
3566 8b/-> *eax 0/r32/eax
3567 05/add-to-eax 0xd/imm32
3568 89/<- %ecx 0/r32/eax
3569
3570 29/subtract %esp 1/r32/ecx
3571 ff 6/subop/push %ecx
3572 68/push 0/imm32/read
3573 68/push 0/imm32/write
3574 89/<- %edx 4/r32/esp
3575 (clear-stream %edx)
3576
3577 8b/-> *(ebp+8) 0/r32/eax
3578 8b/-> *eax 0/r32/eax
3579
3580 (write %edx "$")
3581 (write %edx %eax)
3582 (write %edx ":")
3583 (print-int32 %edx *Next-block-index)
3584 ff 0/subop/increment *Next-block-index
3585
3586
3587 8b/-> *edx 0/r32/eax
3588
3589 8d/copy-address *(edx+0xc) 2/r32/edx
3590
3591 01/add %eax 2/r32/edx
3592
3593 ff 6/subop/push %eax
3594 ff 6/subop/push %edx
3595 89/<- %eax 4/r32/esp
3596
3597 (slice-to-string Heap %eax)
3598 89/<- %edx 0/r32/eax
3599
3600
3601 (allocate Heap *Tree-size)
3602 (zero-out %eax *Tree-size)
3603
3604 (new-var Heap %edx %eax *Curr-block-depth 0 0)
3605 $new-block-name:end:
3606
3607 81 0/subop/add %ecx 0xc/imm32
3608 81 0/subop/add %ecx 8/imm32
3609 01/add %esp 1/r32/ecx
3610
3611 5a/pop-to-edx
3612 59/pop-to-ecx
3613
3614 89/<- %esp 5/r32/ebp
3615 5d/pop-to-ebp
3616 c3/return
3617
3618 check-no-tokens-left:
3619
3620 55/push-ebp
3621 89/<- %ebp 4/r32/esp
3622
3623 50/push-eax
3624 51/push-ecx
3625
3626 68/push 0/imm32/end
3627 68/push 0/imm32/start
3628 89/<- %ecx 4/r32/esp
3629
3630 (next-mu-token *(ebp+8) %ecx)
3631
3632 (slice-empty? %ecx)
3633 3d/compare-eax-and 0/imm32/false
3634 75/jump-if-!= $check-no-tokens-left:end/disp8
3635
3636
3637 8b/-> *edx 0/r32/eax
3638 8a/copy-byte *eax 0/r32/AL
3639 81 4/subop/and %eax 0xff/imm32
3640
3641 3d/compare-eax-and 0x23/imm32/hash
3642 74/jump-if-= $check-no-tokens-left:end/disp8
3643
3644 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
3645 (rewind-stream %ecx)
3646 (write-stream 2 %ecx)
3647 (write-buffered Stderr "'\n")
3648 (flush Stderr)
3649
3650 bb/copy-to-ebx 1/imm32
3651 b8/copy-to-eax 1/imm32/exit
3652 cd/syscall 0x80/imm8
3653
3654 $check-no-tokens-left:end:
3655
3656 81 0/subop/add %esp 8/imm32
3657
3658 59/pop-to-ecx
3659 58/pop-to-eax
3660
3661 89/<- %esp 5/r32/ebp
3662 5d/pop-to-ebp
3663 c3/return
3664
3665 parse-mu-named-block:
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677 55/push-ebp
3678 89/<- %ebp 4/r32/esp
3679
3680 51/push-ecx
3681
3682 (slice-to-string Heap *(ebp+8))
3683 89/<- %ecx 0/r32/eax
3684
3685 (allocate Heap *Tree-size)
3686 (zero-out %eax *Tree-size)
3687
3688 (new-var Heap %ecx %eax *Curr-block-depth 0 0)
3689 89/<- %ecx 0/r32/eax
3690
3691 (push *(ebp+0x10) %ecx)
3692
3693 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14))
3694
3695 50/push-eax
3696 (pop *(ebp+0x10))
3697 58/pop-to-eax
3698
3699 c7 0/subop/copy *eax 0/imm32/block
3700
3701 89/<- *(eax+8) 1/r32/ecx
3702 $parse-mu-named-block:end:
3703
3704 59/pop-to-ecx
3705
3706 89/<- %esp 5/r32/ebp
3707 5d/pop-to-ebp
3708 c3/return
3709
3710 parse-mu-var-def:
3711
3712 55/push-ebp
3713 89/<- %ebp 4/r32/esp
3714
3715 51/push-ecx
3716 52/push-edx
3717
3718 68/push 0/imm32/end
3719 68/push 0/imm32/start
3720 89/<- %ecx 4/r32/esp
3721
3722 (next-mu-token *(ebp+8) %ecx)
3723 (parse-var-with-type %ecx *(ebp+8))
3724 89/<- %edx 0/r32/eax
3725
3726 8b/-> *Curr-block-depth 0/r32/eax
3727 89/<- *(edx+8) 0/r32/eax
3728
3729 (push *(ebp+0xc) %edx)
3730
3731 8b/-> *(edx+0x10) 0/r32/eax
3732 3d/compare-eax-and 0/imm32
3733 {
3734 75/jump-if-!= break/disp8
3735
3736 8b/-> *Next-local-stack-offset 0/r32/eax
3737 89/<- *(edx+0xc) 0/r32/eax
3738
3739 (new-vardef Heap %edx)
3740 eb/jump $parse-mu-var-def:end/disp8
3741 }
3742
3743 {
3744 74/jump-if-= break/disp8
3745
3746 (next-mu-token *(ebp+8) %ecx)
3747 (slice-equal? %ecx "<-")
3748 3d/compare-eax-and 0/imm32/false
3749 74/jump-if-= $parse-mu-var-def:abort/disp8
3750
3751 (new-regvardef Heap %edx)
3752 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc))
3753 }
3754 $parse-mu-var-def:end:
3755
3756 50/push-eax
3757 (size-of %edx)
3758 29/subtract-from *Next-local-stack-offset 0/r32/eax
3759 58/pop-to-eax
3760
3761 81 0/subop/add %esp 8/imm32
3762
3763 5a/pop-to-edx
3764 59/pop-to-ecx
3765
3766 89/<- %esp 5/r32/ebp
3767 5d/pop-to-ebp
3768 c3/return
3769
3770 $parse-mu-var-def:abort:
3771 (rewind-stream *(ebp+8))
3772
3773 (write-buffered Stderr "register variable requires a valid instruction to initialize but got '")
3774 (flush Stderr)
3775 (write-stream 2 *(ebp+8))
3776 (write-buffered Stderr "'\n")
3777 (flush Stderr)
3778
3779 bb/copy-to-ebx 1/imm32
3780 b8/copy-to-eax 1/imm32/exit
3781 cd/syscall 0x80/imm8
3782
3783
3784 test-parse-mu-var-def:
3785
3786
3787 55/push-ebp
3788 89/<- %ebp 4/r32/esp
3789
3790 (clear-stream _test-input-stream)
3791 (write _test-input-stream "n: int\n")
3792 c7 0/subop/copy *Curr-block-depth 1/imm32
3793 c7 0/subop/copy *Next-local-stack-offset -4/imm32
3794
3795 81 5/subop/subtract %esp 0x10/imm32
3796 68/push 0x10/imm32/length
3797 68/push 0/imm32/top
3798 89/<- %ecx 4/r32/esp
3799 (clear-stack %ecx)
3800
3801 (parse-mu-var-def _test-input-stream %ecx)
3802
3803 (check-ints-equal *eax 2 "F - test-parse-mu-var-def/tag")
3804 8b/-> *(eax+4) 0/r32/eax
3805 (check-strings-equal *eax "n" "F - test-parse-mu-var-def/var-name")
3806 (check-ints-equal *(eax+0x10) 0 "F - test-parse-mu-var-def/var-register")
3807 (check-ints-equal *(eax+8) 1 "F - test-parse-mu-reg-var-def/output-block-depth")
3808 (check-ints-equal *(eax+0xc) -4 "F - test-parse-mu-reg-var-def/output-stack-offset")
3809
3810 8b/-> *(eax+4) 0/r32/eax
3811 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0")
3812 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-var-def/var-type:0")
3813
3814 (check-ints-equal *Next-local-stack-offset -8 "F - test-parse-mu-reg-var-def/Next-local-stack-offset")
3815
3816 89/<- %esp 5/r32/ebp
3817 5d/pop-to-ebp
3818 c3/return
3819
3820 test-parse-mu-reg-var-def:
3821
3822
3823 55/push-ebp
3824 89/<- %ebp 4/r32/esp
3825
3826 (clear-stream _test-input-stream)
3827 (write _test-input-stream "n/eax: int <- copy 0\n")
3828 c7 0/subop/copy *Curr-block-depth 1/imm32
3829 c7 0/subop/copy *Next-local-stack-offset -4/imm32
3830
3831 81 5/subop/subtract %esp 0x10/imm32
3832 68/push 0x10/imm32/length
3833 68/push 0/imm32/top
3834 89/<- %ecx 4/r32/esp
3835 (clear-stack %ecx)
3836
3837 (parse-mu-var-def _test-input-stream %ecx)
3838
3839 (check-ints-equal *eax 3 "F - test-parse-mu-reg-var-def/tag")
3840 8b/-> *(eax+0xc) 0/r32/eax
3841 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-reg-var-def/single-output")
3842 8b/-> *eax 0/r32/eax
3843 (check-strings-equal *eax "n" "F - test-parse-mu-reg-var-def/output-name")
3844 (check-strings-equal *(eax+0x10) "eax" "F - test-parse-mu-reg-var-def/output-register")
3845 (check-ints-equal *(eax+8) 1 "F - test-parse-mu-reg-var-def/output-block-depth")
3846 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-reg-var-def/output-stack-offset")
3847
3848 8b/-> *(eax+4) 0/r32/eax
3849 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0")
3850 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-reg-var-def/output-type:0")
3851
3852 (check-ints-equal *Next-local-stack-offset -8 "F - test-parse-mu-reg-var-def/Next-local-stack-offset")
3853
3854 89/<- %esp 5/r32/ebp
3855 5d/pop-to-ebp
3856 c3/return
3857
3858 parse-mu-stmt:
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872 55/push-ebp
3873 89/<- %ebp 4/r32/esp
3874
3875 51/push-ecx
3876 52/push-edx
3877 57/push-edi
3878
3879 68/push 0/imm32/end
3880 68/push 0/imm32/start
3881 89/<- %ecx 4/r32/esp
3882
3883 ba/copy-to-edx 0/imm32/false
3884
3885 (allocate Heap *Stmt-size)
3886 (zero-out %eax *Stmt-size)
3887 89/<- %edi 0/r32/eax
3888
3889 c7 0/subop/copy *edi 1/imm32/stmt1
3890 {
3891 (stmt-has-outputs? *(ebp+8))
3892 3d/compare-eax-and 0/imm32/false
3893 0f 84/jump-if-= break/disp32
3894 {
3895 $parse-mu-stmt:read-outputs:
3896
3897 (next-mu-token *(ebp+8) %ecx)
3898
3899 (slice-empty? %ecx)
3900 3d/compare-eax-and 0/imm32/false
3901 0f 85/jump-if-!= break/disp32
3902
3903 (slice-equal? %ecx "<-")
3904 3d/compare-eax-and 0/imm32/false
3905 0f 85/jump-if-!= break/disp32
3906
3907 ba/copy-to-edx 0/imm32/false
3908
3909 8b/-> *ecx 0/r32/eax
3910 8a/copy-byte *eax 0/r32/AL
3911 81 4/subop/and %eax 0xff/imm32
3912 3d/compare-eax-and 0x2a/imm32/asterisk
3913 {
3914 75/jump-if-!= break/disp8
3915 ff 0/subop/increment *ecx
3916 ba/copy-to-edx 1/imm32/true
3917 }
3918
3919 (is-identifier? %ecx)
3920 3d/compare-eax-and 0/imm32/false
3921 0f 84/jump-if-= $parse-mu-stmt:abort/disp32
3922
3923 (lookup-or-define-var %ecx *(ebp+0xc) *(ebp+0x10))
3924 (append-stmt-var Heap %eax *(edi+0xc) %edx)
3925 89/<- *(edi+0xc) 0/r32/eax
3926 e9/jump loop/disp32
3927 }
3928 }
3929 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc))
3930 $parse-mu-stmt:end:
3931
3932 89/<- %eax 7/r32/edi
3933
3934 81 0/subop/add %esp 8/imm32
3935
3936 5f/pop-to-edi
3937 5a/pop-to-edx
3938 59/pop-to-ecx
3939
3940 89/<- %esp 5/r32/ebp
3941 5d/pop-to-ebp
3942 c3/return
3943
3944 $parse-mu-stmt:abort:
3945
3946 (write-buffered Stderr "invalid identifier '")
3947 (write-slice-buffered Stderr %ecx)
3948 (write-buffered Stderr "'\n")
3949 (flush Stderr)
3950
3951 bb/copy-to-ebx 1/imm32
3952 b8/copy-to-eax 1/imm32/exit
3953 cd/syscall 0x80/imm8
3954
3955
3956 add-operation-and-inputs-to-stmt:
3957
3958
3959
3960
3961
3962
3963
3964
3965 55/push-ebp
3966 89/<- %ebp 4/r32/esp
3967
3968 50/push-eax
3969 51/push-ecx
3970 52/push-edx
3971 57/push-edi
3972
3973 8b/-> *(ebp+8) 7/r32/edi
3974
3975 68/push 0/imm32/end
3976 68/push 0/imm32/start
3977 89/<- %ecx 4/r32/esp
3978
3979 ba/copy-to-edx 0/imm32/false
3980 $add-operation-and-inputs-to-stmt:read-operation:
3981 (next-mu-token *(ebp+0xc) %ecx)
3982 (slice-to-string Heap %ecx)
3983 89/<- *(edi+4) 0/r32/eax
3984 {
3985 $add-operation-and-inputs-to-stmt:read-inouts:
3986
3987 (next-mu-token *(ebp+0xc) %ecx)
3988
3989 (slice-empty? %ecx)
3990 3d/compare-eax-and 0/imm32/false
3991 0f 85/jump-if-!= break/disp32
3992
3993 (slice-equal? %ecx "<-")
3994 3d/compare-eax-and 0/imm32/false
3995 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32
3996
3997 ba/copy-to-edx 0/imm32/false
3998
3999 8b/-> *ecx 0/r32/eax
4000 8a/copy-byte *eax 0/r32/AL
4001 81 4/subop/and %eax 0xff/imm32
4002 3d/compare-eax-and 0x2a/imm32/asterisk
4003 {
4004 75/jump-if-!= break/disp8
4005 $add-operation-and-inputs-to-stmt:inout-is-deref:
4006 ff 0/subop/increment *ecx
4007 ba/copy-to-edx 1/imm32/true
4008 }
4009 (lookup-var-or-literal %ecx *(ebp+0x10))
4010 (append-stmt-var Heap %eax *(edi+8) %edx)
4011 89/<- *(edi+8) 0/r32/eax
4012 e9/jump loop/disp32
4013 }
4014 $add-operation-and-inputs-to-stmt:end:
4015
4016 81 0/subop/add %esp 8/imm32
4017
4018 5f/pop-to-edi
4019 5a/pop-to-edx
4020 59/pop-to-ecx
4021 58/pop-to-eax
4022
4023 89/<- %esp 5/r32/ebp
4024 5d/pop-to-ebp
4025 c3/return
4026
4027 $add-operation-and-inputs-to-stmt:abort:
4028
4029 (rewind-stream *(ebp+8))
4030 (write-buffered Stderr "invalid identifier '")
4031 (flush Stderr)
4032 (write-stream 2 *(ebp+8))
4033 (write-buffered Stderr "'\n")
4034 (flush Stderr)
4035
4036 bb/copy-to-ebx 1/imm32
4037 b8/copy-to-eax 1/imm32/exit
4038 cd/syscall 0x80/imm8
4039
4040
4041 stmt-has-outputs?:
4042
4043 55/push-ebp
4044 89/<- %ebp 4/r32/esp
4045
4046 51/push-ecx
4047
4048 68/push 0/imm32/end
4049 68/push 0/imm32/start
4050 89/<- %ecx 4/r32/esp
4051
4052 b8/copy-to-eax 0/imm32/false
4053 (rewind-stream *(ebp+8))
4054 {
4055 (next-mu-token *(ebp+8) %ecx)
4056
4057 (slice-empty? %ecx)
4058 3d/compare-eax-and 0/imm32/false
4059 b8/copy-to-eax 0/imm32/false/result
4060 0f 85/jump-if-!= break/disp32
4061
4062
4063 8b/-> *ecx 0/r32/eax
4064 8a/copy-byte *eax 0/r32/AL
4065 81 4/subop/and %eax 0xff/imm32
4066
4067 3d/compare-eax-and 0x23/imm32/hash
4068 b8/copy-to-eax 0/imm32/false/result
4069 0f 84/jump-if-= break/disp32
4070
4071 (slice-equal? %ecx "<-")
4072 3d/compare-eax-and 0/imm32/false
4073 74/jump-if-= loop/disp8
4074 b8/copy-to-eax 1/imm32/true
4075 }
4076 $stmt-has-outputs:end:
4077 (rewind-stream *(ebp+8))
4078
4079 81 0/subop/add %esp 8/imm32
4080
4081 59/pop-to-ecx
4082
4083 89/<- %esp 5/r32/ebp
4084 5d/pop-to-ebp
4085 c3/return
4086
4087
4088
4089 lookup-var-or-literal:
4090
4091 55/push-ebp
4092 89/<- %ebp 4/r32/esp
4093
4094 51/push-ecx
4095 56/push-esi
4096
4097 8b/-> *(ebp+8) 6/r32/esi
4098
4099 (slice-empty? %esi)
4100 3d/compare-eax-and 0/imm32/false
4101 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32
4102
4103 8b/-> *esi 1/r32/ecx
4104 8a/copy-byte *ecx 1/r32/CL
4105 81 4/subop/and %ecx 0xff/imm32
4106
4107 {
4108 (is-decimal-digit? %ecx)
4109 81 7/subop/compare %eax 0/imm32/false
4110 74/jump-if-= break/disp8
4111 (new-literal-integer Heap %esi)
4112 eb/jump $lookup-var-or-literal:end/disp8
4113 }
4114
4115 {
4116 81 7/subop/compare %ecx 0x22/imm32/dquote
4117 75/jump-if-!= break/disp8
4118 (new-literal-string Heap %esi)
4119 eb/jump $lookup-var-or-literal:end/disp8
4120 }
4121
4122 {
4123 (lookup-var %esi *(ebp+0xc))
4124 }
4125 $lookup-var-or-literal:end:
4126
4127 5e/pop-to-esi
4128 59/pop-to-ecx
4129
4130 89/<- %esp 5/r32/ebp
4131 5d/pop-to-ebp
4132 c3/return
4133
4134 $lookup-var-or-literal:abort:
4135 (write-buffered Stderr "empty variable!")
4136 (flush Stderr)
4137
4138 bb/copy-to-ebx 1/imm32
4139 b8/copy-to-eax 1/imm32/exit
4140 cd/syscall 0x80/imm8
4141
4142
4143
4144 lookup-var:
4145
4146 55/push-ebp
4147 89/<- %ebp 4/r32/esp
4148
4149 (slice-to-string Heap *(ebp+8))
4150
4151 (lookup-var-helper %eax *(ebp+0xc))
4152
4153 3d/compare-eax-and 0/imm32
4154 74/jump-if-= $lookup-var:abort/disp8
4155 $lookup-var:end:
4156
4157 89/<- %esp 5/r32/ebp
4158 5d/pop-to-ebp
4159 c3/return
4160
4161 $lookup-var:abort:
4162 (write-buffered Stderr "unknown variable '")
4163 (write-slice-buffered Stderr *(ebp+8))
4164 (write-buffered Stderr "'\n")
4165 (flush Stderr)
4166
4167 bb/copy-to-ebx 1/imm32
4168 b8/copy-to-eax 1/imm32/exit
4169 cd/syscall 0x80/imm8
4170
4171
4172
4173 lookup-var-helper:
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184 55/push-ebp
4185 89/<- %ebp 4/r32/esp
4186
4187 52/push-edx
4188 53/push-ebx
4189 56/push-esi
4190
4191 8b/-> *(ebp+0xc) 6/r32/esi
4192
4193 8b/-> *esi 3/r32/ebx
4194
4195 3b/compare 0/r32/eax *(esi+4)
4196 0f 8f/jump-if-> $lookup-var-helper:error1/disp32
4197
4198 8d/copy-address *(esi+8) 2/r32/edx
4199
4200 81 5/subop/subtract %ebx 4/imm32
4201 8d/copy-address *(esi+ebx+8) 3/r32/ebx
4202 {
4203
4204 39/compare %ebx 2/r32/edx
4205 b8/copy-to-eax 0/imm32
4206 0f 82/jump-if-addr< break/disp32
4207
4208 8b/-> *ebx 0/r32/eax
4209
4210 (string-equal? *eax *(ebp+8))
4211 3d/compare-eax-and 0/imm32/false
4212 8b/-> *ebx 0/r32/eax
4213 75/jump-if-!= break/disp8
4214
4215 81 5/subop/subtract %ebx 4/imm32
4216 e9/jump loop/disp32
4217 }
4218 $lookup-var-helper:end:
4219
4220 5e/pop-to-esi
4221 5b/pop-to-ebx
4222 5a/pop-to-edx
4223
4224 89/<- %esp 5/r32/ebp
4225 5d/pop-to-ebp
4226 c3/return
4227
4228 $lookup-var-helper:error1:
4229 (write-buffered Stderr "malformed stack when looking up '")
4230 (write-slice-buffered Stderr *(ebp+8))
4231 (write-buffered Stderr "'\n")
4232 (flush Stderr)
4233
4234 bb/copy-to-ebx 1/imm32
4235 b8/copy-to-eax 1/imm32/exit
4236 cd/syscall 0x80/imm8
4237
4238
4239
4240 lookup-or-define-var:
4241
4242 55/push-ebp
4243 89/<- %ebp 4/r32/esp
4244
4245 51/push-ecx
4246
4247 (slice-to-string Heap *(ebp+8))
4248 89/<- %ecx 0/r32/eax
4249
4250 (lookup-var-helper %ecx *(ebp+0xc))
4251 {
4252
4253 3d/compare-eax-and 0/imm32
4254 75/jump-if-!= break/disp8
4255
4256 {
4257 (find-in-function-outputs *(ebp+0x10) %ecx)
4258 3d/compare-eax-and 0/imm32
4259
4260 0f 84/jump-if-!= $lookup-var:abort/disp32
4261 }
4262 }
4263 $lookup-or-define-var:end:
4264
4265 59/pop-to-ecx
4266
4267 89/<- %esp 5/r32/ebp
4268 5d/pop-to-ebp
4269 c3/return
4270
4271 find-in-function-outputs:
4272
4273 55/push-ebp
4274 89/<- %ebp 4/r32/esp
4275
4276 51/push-ecx
4277
4278 8b/-> *(ebp+8) 1/r32/ecx
4279 8b/-> *(ecx+0xc) 1/r32/ecx
4280
4281 {
4282 81 7/subop/compare %ecx 0/imm32
4283 74/jump-if-= break/disp8
4284
4285 8b/-> *ecx 0/r32/eax
4286
4287 50/push-eax
4288 (string-equal? *eax *(ebp+0xc))
4289 3d/compare-eax-and 0/imm32/false
4290 58/pop-to-eax
4291 75/jump-if-!= $find-in-function-outputs:end/disp8
4292
4293 8b/-> *(ecx+4) 1/r32/ecx
4294 eb/jump loop/disp8
4295 }
4296 b8/copy-to-eax 0/imm32
4297 $find-in-function-outputs:end:
4298
4299 59/pop-to-ecx
4300
4301 89/<- %esp 5/r32/ebp
4302 5d/pop-to-ebp
4303 c3/return
4304
4305 test-parse-mu-stmt:
4306
4307 55/push-ebp
4308 89/<- %ebp 4/r32/esp
4309
4310 (clear-stream _test-input-stream)
4311 (write _test-input-stream "increment n\n")
4312
4313 81 5/subop/subtract %esp 0x10/imm32
4314 68/push 0x10/imm32/length
4315 68/push 0/imm32/top
4316 89/<- %ecx 4/r32/esp
4317 (clear-stack %ecx)
4318
4319 81 5/subop/subtract %esp 0x14/imm32
4320 89/<- %edx 4/r32/esp
4321 (zero-out %edx 0x14)
4322
4323 c7 0/subop/copy *edx "n"/imm32
4324
4325 (push %ecx %edx)
4326
4327 (parse-mu-stmt _test-input-stream %ecx)
4328
4329 (check-ints-equal *eax 1 "F - test-parse-mu-stmt/tag")
4330 (check-strings-equal *(eax+4) "increment" "F - test-parse-mu-stmt/name")
4331
4332 8b/-> *(eax+8) 2/r32/edx
4333
4334 8b/-> *edx 3/r32/ebx
4335 (check-strings-equal *ebx "n" "F - test-parse-mu-stmt/inout:0")
4336
4337 89/<- %esp 5/r32/ebp
4338 5d/pop-to-ebp
4339 c3/return
4340
4341 test-parse-mu-stmt-with-comma:
4342
4343 55/push-ebp
4344 89/<- %ebp 4/r32/esp
4345
4346 (clear-stream _test-input-stream)
4347 (write _test-input-stream "copy-to n, 3\n")
4348
4349 81 5/subop/subtract %esp 0x10/imm32
4350 68/push 0x10/imm32/length
4351 68/push 0/imm32/top
4352 89/<- %ecx 4/r32/esp
4353 (clear-stack %ecx)
4354
4355 81 5/subop/subtract %esp 0x14/imm32
4356 89/<- %edx 4/r32/esp
4357 (zero-out %edx 0x14)
4358
4359 c7 0/subop/copy *edx "n"/imm32
4360
4361 (push %ecx %edx)
4362
4363 (parse-mu-stmt _test-input-stream %ecx)
4364
4365 (check-ints-equal *eax 1 "F - test-parse-mu-stmt-with-comma/tag")
4366 (check-strings-equal *(eax+4) "copy-to" "F - test-parse-mu-stmt-with-comma/name")
4367
4368 8b/-> *(eax+8) 2/r32/edx
4369
4370 8b/-> *edx 3/r32/ebx
4371 (check-strings-equal *ebx "n" "F - test-parse-mu-stmt-with-comma/inout:0")
4372
4373 89/<- %esp 5/r32/ebp
4374 5d/pop-to-ebp
4375 c3/return
4376
4377 new-function:
4378
4379 55/push-ebp
4380 89/<- %ebp 4/r32/esp
4381
4382 51/push-ecx
4383
4384 (allocate *(ebp+8) *Function-size)
4385 8b/-> *(ebp+0xc) 1/r32/ecx
4386 89/<- *eax 1/r32/ecx
4387 8b/-> *(ebp+0x10) 1/r32/ecx
4388 89/<- *(eax+4) 1/r32/ecx
4389 8b/-> *(ebp+0x14) 1/r32/ecx
4390 89/<- *(eax+8) 1/r32/ecx
4391 8b/-> *(ebp+0x18) 1/r32/ecx
4392 89/<- *(eax+0xc) 1/r32/ecx
4393 8b/-> *(ebp+0x1c) 1/r32/ecx
4394 89/<- *(eax+0x10) 1/r32/ecx
4395 8b/-> *(ebp+0x20) 1/r32/ecx
4396 89/<- *(eax+0x14) 1/r32/ecx
4397 $new-function:end:
4398
4399 59/pop-to-ecx
4400
4401 89/<- %esp 5/r32/ebp
4402 5d/pop-to-ebp
4403 c3/return
4404
4405 new-var:
4406
4407 55/push-ebp
4408 89/<- %ebp 4/r32/esp
4409
4410 51/push-ecx
4411
4412 (allocate *(ebp+8) *Var-size)
4413 8b/-> *(ebp+0xc) 1/r32/ecx
4414 89/<- *eax 1/r32/ecx
4415 8b/-> *(ebp+0x10) 1/r32/ecx
4416 89/<- *(eax+4) 1/r32/ecx
4417 8b/-> *(ebp+0x14) 1/r32/ecx
4418 89/<- *(eax+8) 1/r32/ecx
4419 8b/-> *(ebp+0x18) 1/r32/ecx
4420 89/<- *(eax+0xc) 1/r32/ecx
4421 8b/-> *(ebp+0x1c) 1/r32/ecx
4422 89/<- *(eax+0x10) 1/r32/ecx
4423 $new-var:end:
4424
4425 59/pop-to-ecx
4426
4427 89/<- %esp 5/r32/ebp
4428 5d/pop-to-ebp
4429 c3/return
4430
4431 new-literal-integer:
4432
4433 55/push-ebp
4434 89/<- %ebp 4/r32/esp
4435
4436 51/push-ecx
4437
4438 (is-hex-int? *(ebp+0xc))
4439 3d/compare-eax-and 0/imm32/false
4440 0f 84/jump-if-= $new-literal-integer:abort/disp32
4441
4442 (slice-to-string Heap *(ebp+0xc))
4443 89/<- %ecx 0/r32/eax
4444
4445 (allocate *(ebp+8) *Var-size)
4446 (zero-out %eax *Var-size)
4447 89/<- *eax 1/r32/ecx
4448 89/<- %ecx 0/r32/eax
4449
4450 (allocate *(ebp+8) *Tree-size)
4451 (zero-out %eax *Tree-size)
4452 89/<- *(ecx+4) 0/r32/eax
4453
4454 89/<- %eax 1/r32/ecx
4455 $new-literal-integer:end:
4456
4457 59/pop-to-ecx
4458
4459 89/<- %esp 5/r32/ebp
4460 5d/pop-to-ebp
4461 c3/return
4462
4463 $new-literal-integer:abort:
4464 (write-buffered Stderr "variable cannot begin with a digit '")
4465 (write-slice-buffered Stderr *(ebp+0xc))
4466 (write-buffered Stderr "'\n")
4467 (flush Stderr)
4468
4469 bb/copy-to-ebx 1/imm32
4470 b8/copy-to-eax 1/imm32/exit
4471 cd/syscall 0x80/imm8
4472
4473
4474 new-literal-string:
4475
4476 55/push-ebp
4477 89/<- %ebp 4/r32/esp
4478
4479 51/push-ecx
4480
4481 (slice-to-string Heap *(ebp+0xc))
4482 89/<- %ecx 0/r32/eax
4483
4484 (allocate *(ebp+8) *Var-size)
4485 (zero-out %eax *Var-size)
4486 89/<- *eax 1/r32/ecx
4487 89/<- %ecx 0/r32/eax
4488
4489 (allocate *(ebp+8) *Tree-size)
4490 (zero-out %eax *Tree-size)
4491 89/<- *(ecx+4) 0/r32/eax
4492
4493 89/<- %eax 1/r32/ecx
4494 $new-literal-string:end:
4495
4496 59/pop-to-ecx
4497
4498 89/<- %esp 5/r32/ebp
4499 5d/pop-to-ebp
4500 c3/return
4501
4502 new-label:
4503
4504 55/push-ebp
4505 89/<- %ebp 4/r32/esp
4506
4507 51/push-ecx
4508
4509 (slice-to-string Heap *(ebp+0xc))
4510 89/<- %ecx 0/r32/eax
4511
4512 (allocate *(ebp+8) *Var-size)
4513 89/<- *eax 1/r32/ecx
4514 89/<- %ecx 0/r32/eax
4515 (allocate *(ebp+8) *Tree-size)
4516 (zero-out %eax *Tree-size)
4517 89/<- *(ecx+4) 0/r32/eax
4518 89/<- %eax 1/r32/ecx
4519 c7 0/subop/copy *(eax+8) 0/imm32
4520 c7 0/subop/copy *(eax+0xc) 0/imm32
4521 c7 0/subop/copy *(eax+0x10) 0/imm32
4522 $new-label:end:
4523
4524 59/pop-to-ecx
4525
4526 89/<- %esp 5/r32/ebp
4527 5d/pop-to-ebp
4528 c3/return
4529
4530 new-block:
4531
4532 55/push-ebp
4533 89/<- %ebp 4/r32/esp
4534
4535 51/push-ecx
4536
4537 (allocate *(ebp+8) *Stmt-size)
4538 (zero-out %eax *Stmt-size)
4539 c7 0/subop/copy *eax 0/imm32/tag/block
4540 8b/-> *(ebp+0xc) 1/r32/ecx
4541 89/<- *(eax+4) 1/r32/ecx
4542 $new-block:end:
4543
4544 59/pop-to-ecx
4545
4546 89/<- %esp 5/r32/ebp
4547 5d/pop-to-ebp
4548 c3/return
4549
4550 new-vardef:
4551
4552 55/push-ebp
4553 89/<- %ebp 4/r32/esp
4554
4555 51/push-ecx
4556
4557 (allocate *(ebp+8) *Stmt-size)
4558 (zero-out %eax *Stmt-size)
4559 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack
4560
4561 8b/-> *(ebp+0xc) 1/r32/ecx
4562 89/<- *(eax+4) 1/r32/ecx
4563 $new-vardef:end:
4564
4565 59/pop-to-ecx
4566
4567 89/<- %esp 5/r32/ebp
4568 5d/pop-to-ebp
4569 c3/return
4570
4571 new-regvardef:
4572
4573 55/push-ebp
4574 89/<- %ebp 4/r32/esp
4575
4576 51/push-ecx
4577 57/push-edi
4578
4579 8b/-> *(ebp+0xc) 1/r32/ecx
4580
4581 (allocate *(ebp+8) *Stmt-size)
4582 89/<- %edi 0/r32/eax
4583 (zero-out %edi *Stmt-size)
4584
4585 c7 0/subop/copy *edi 3/imm32/tag/var-in-register
4586
4587 (append-stmt-var Heap %ecx *(edi+0xc) 0)
4588 89/<- *(edi+0xc) 0/r32/eax
4589 $new-regvardef:end:
4590 89/<- %eax 7/r32/edi
4591
4592 5f/pop-to-edi
4593 59/pop-to-ecx
4594
4595 89/<- %esp 5/r32/ebp
4596 5d/pop-to-ebp
4597 c3/return
4598
4599 append-list:
4600
4601 55/push-ebp
4602 89/<- %ebp 4/r32/esp
4603
4604 51/push-ecx
4605
4606 (allocate *(ebp+8) *List-size)
4607 (zero-out %eax *List-size)
4608 8b/-> *(ebp+0xc) 1/r32/ecx
4609 89/<- *eax 1/r32/ecx
4610
4611 81 7/subop/compare *(ebp+0x10) 0/imm32
4612 74/jump-if-= $append-list:end/disp8
4613
4614
4615 8b/-> *(ebp+0x10) 1/r32/ecx
4616
4617 {
4618 81 7/subop/compare *(ecx+4) 0/imm32
4619 74/jump-if-= break/disp8
4620
4621 8b/-> *(ecx+4) 1/r32/ecx
4622 eb/jump loop/disp8
4623 }
4624
4625 89/<- *(ecx+4) 0/r32/eax
4626
4627 8b/-> *(ebp+0x10) 0/r32/eax
4628 $append-list:end:
4629
4630 59/pop-to-ecx
4631
4632 89/<- %esp 5/r32/ebp
4633 5d/pop-to-ebp
4634 c3/return
4635
4636 append-stmt-var:
4637
4638 55/push-ebp
4639 89/<- %ebp 4/r32/esp
4640
4641 51/push-ecx
4642
4643 (allocate *(ebp+8) *Stmt-var-size)
4644 (zero-out %eax *Stmt-var-size)
4645 8b/-> *(ebp+0xc) 1/r32/ecx
4646 89/<- *eax 1/r32/ecx
4647 8b/-> *(ebp+0x14) 1/r32/ecx
4648 89/<- *(eax+8) 1/r32/ecx
4649
4650 81 7/subop/compare *(ebp+0x10) 0/imm32
4651 74/jump-if-= $append-stmt-var:end/disp8
4652
4653
4654 8b/-> *(ebp+0x10) 1/r32/ecx
4655
4656 {
4657 81 7/subop/compare *(ecx+4) 0/imm32
4658 74/jump-if-= break/disp8
4659
4660 8b/-> *(ecx+4) 1/r32/ecx
4661 eb/jump loop/disp8
4662 }
4663
4664 89/<- *(ecx+4) 0/r32/eax
4665
4666 8b/-> *(ebp+0x10) 0/r32/eax
4667 $append-stmt-var:end:
4668
4669 59/pop-to-ecx
4670
4671 89/<- %esp 5/r32/ebp
4672 5d/pop-to-ebp
4673 c3/return
4674
4675 append-to-block:
4676
4677 55/push-ebp
4678 89/<- %ebp 4/r32/esp
4679
4680 56/push-esi
4681
4682 8b/-> *(ebp+0xc) 6/r32/esi
4683 (append-list *(ebp+8) *(ebp+0x10) *(esi+4))
4684 89/<- *(esi+4) 0/r32/eax
4685 $append-to-block:end:
4686
4687 5e/pop-to-esi
4688
4689 89/<- %esp 5/r32/ebp
4690 5d/pop-to-ebp
4691 c3/return
4692
4693
4694
4695
4696
4697 check-mu-types:
4698
4699 55/push-ebp
4700 89/<- %ebp 4/r32/esp
4701
4702 $check-mu-types:end:
4703
4704 89/<- %esp 5/r32/ebp
4705 5d/pop-to-ebp
4706 c3/return
4707
4708 size-of:
4709
4710 55/push-ebp
4711 89/<- %ebp 4/r32/esp
4712
4713 8b/-> *(ebp+8) 0/r32/eax
4714 8b/-> *(eax+4) 0/r32/eax
4715 81 7/subop/compare *eax 0/imm32
4716 b8/copy-to-eax 0/imm32
4717 74/jump-if-= $size-of:end/disp8
4718
4719 b8/copy-to-eax 4/imm32
4720 $size-of:end:
4721
4722 89/<- %esp 5/r32/ebp
4723 5d/pop-to-ebp
4724 c3/return
4725
4726 type-equal?:
4727
4728 55/push-ebp
4729 89/<- %ebp 4/r32/esp
4730
4731 51/push-ecx
4732 52/push-edx
4733
4734 8b/-> *(ebp+8) 1/r32/ecx
4735
4736 8b/-> *(ebp+0xc) 2/r32/edx
4737
4738 8b/-> %ecx 0/r32/eax
4739 39/compare %edx 0/r32/eax
4740 b8/copy-to-eax 1/imm32/true
4741 74/jump-if-= $type-equal?:end/disp8
4742
4743 81 7/subop/compare %ecx 0x10000/imm32
4744 b8/copy-to-eax 0/imm32/false
4745 72/jump-if-addr< $type-equal?:end/disp8
4746
4747 81 7/subop/compare %edx 0x10000/imm32
4748 b8/copy-to-eax 0/imm32/false
4749 72/jump-if-addr< $type-equal?:end/disp8
4750
4751 (type-equal? *ecx *edx)
4752 3d/compare-eax-and 0/imm32/false
4753 74/jump-if-= $type-equal?:end/disp8
4754
4755 (type-equal? *(ecx+4) *(edx+4))
4756 $type-equal?:end:
4757
4758 5a/pop-to-edx
4759 59/pop-to-ecx
4760
4761 89/<- %esp 5/r32/ebp
4762 5d/pop-to-ebp
4763 c3/return
4764
4765 == data
4766
4767
4768 Type-size:
4769 0x18/imm32/write
4770 0/imm32/read
4771 0x100/imm32/length
4772
4773 4/imm32
4774 4/imm32
4775 4/imm32
4776 0/imm32
4777 8/imm32
4778 4/imm32
4779 0/imm32
4780 0/imm32
4781
4782 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
4783 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
4784 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
4785 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
4786 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
4787 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
4788 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
4789
4790 == code
4791
4792
4793
4794
4795
4796 emit-subx:
4797
4798 55/push-ebp
4799 89/<- %ebp 4/r32/esp
4800
4801 50/push-eax
4802 51/push-ecx
4803 57/push-edi
4804
4805 8b/-> *(ebp+8) 7/r32/edi
4806
4807 8b/-> *Program 1/r32/ecx
4808 {
4809
4810 81 7/subop/compare %ecx 0/imm32
4811 0f 84/jump-if-= break/disp32
4812 (emit-subx-function %edi %ecx)
4813
4814 8b/-> *(ecx+0x14) 1/r32/ecx
4815 e9/jump loop/disp32
4816 }
4817 $emit-subx:end:
4818
4819 5f/pop-to-edi
4820 59/pop-to-ecx
4821 58/pop-to-eax
4822
4823 89/<- %esp 5/r32/ebp
4824 5d/pop-to-ebp
4825 c3/return
4826
4827 emit-subx-function:
4828
4829 55/push-ebp
4830 89/<- %ebp 4/r32/esp
4831
4832 50/push-eax
4833 51/push-ecx
4834 52/push-edx
4835 57/push-edi
4836
4837 8b/-> *(ebp+8) 7/r32/edi
4838
4839 8b/-> *(ebp+0xc) 1/r32/ecx
4840
4841 81 5/subop/subtract %esp 0x400/imm32
4842 68/push 0x400/imm32/length
4843 68/push 0/imm32/top
4844 89/<- %edx 4/r32/esp
4845
4846 (write-buffered %edi *ecx)
4847 (write-buffered %edi ":\n")
4848
4849
4850 c7 0/subop/copy *Curr-block-depth 1/imm32
4851 (emit-subx-prologue %edi)
4852 (emit-subx-block %edi *(ecx+0x10) %edx)
4853 (emit-subx-epilogue %edi)
4854 $emit-subx-function:end:
4855
4856 81 0/subop/add %esp 408/imm32
4857
4858 5f/pop-to-edi
4859 5a/pop-to-edx
4860 59/pop-to-ecx
4861 58/pop-to-eax
4862
4863 89/<- %esp 5/r32/ebp
4864 5d/pop-to-ebp
4865 c3/return
4866
4867 emit-subx-stmt-list:
4868
4869 55/push-ebp
4870 89/<- %ebp 4/r32/esp
4871
4872 50/push-eax
4873 51/push-ecx
4874 52/push-edx
4875 53/push-ebx
4876 56/push-esi
4877
4878 8b/-> *(ebp+0xc) 6/r32/esi
4879
4880 ba/copy-to-edx 0/imm32/false
4881
4882 {
4883 $emit-subx-stmt-list:loop:
4884 81 7/subop/compare %esi 0/imm32
4885 0f 84/jump-if-= break/disp32
4886
4887 8b/-> *esi 1/r32/ecx
4888 {
4889 $emit-subx-stmt-list:check-for-block:
4890 81 7/subop/compare *ecx 0/imm32/block
4891 75/jump-if-!= break/disp8
4892 $emit-subx-stmt-list:block:
4893 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10))
4894 }
4895 {
4896 $emit-subx-stmt-list:check-for-stmt:
4897 81 7/subop/compare *ecx 1/imm32/stmt1
4898 0f 85/jump-if-!= break/disp32
4899 $emit-subx-stmt-list:stmt1:
4900 {
4901 (is-mu-branch? %ecx)
4902 3d/compare-eax-and 0/imm32/false
4903 0f 84/jump-if-= break/disp32
4904 $emit-subx-stmt-list:branch-stmt:
4905
4906 81 7/subop/compare %edx 0/imm32/false
4907 0f 84/jump-if-= break/disp32
4908 $emit-subx-stmt-list:branch-stmt-and-var-seen:
4909 +-- 26 lines: # unconditional loops -----------------------------------------------------------------------------------------------------------------------------------------------------
4935 +-- 15 lines: # unconditional breaks ----------------------------------------------------------------------------------------------------------------------------------------------------
4950 +-- 37 lines: # simple conditional branches without a target ----------------------------------------------------------------------------------------------------------------------------
4987 +-- 19 lines: # conditional branches with an explicit target ----------------------------------------------------------------------------------------------------------------------------
5006 }
5007 $emit-subx-stmt-list:1-to-1:
5008 (emit-subx-statement *(ebp+8) %ecx Primitives *Program)
5009 }
5010 {
5011 $emit-subx-stmt-list:check-for-vardef:
5012 81 7/subop/compare *ecx 2/imm32/vardef
5013 75/jump-if-!= break/disp8
5014 $emit-subx-stmt-list:vardef:
5015 (emit-subx-var-def *(ebp+8) %ecx)
5016 (push *(ebp+0x10) *(ecx+4))
5017
5018 ba/copy-to-edx 1/imm32/true
5019 }
5020 {
5021 $emit-subx-stmt-list:check-for-regvardef:
5022 81 7/subop/compare *ecx 3/imm32/regvardef
5023 0f 85/jump-if-!= break/disp32
5024 $emit-subx-stmt-list:regvardef:
5025
5026
5027 8b/-> *(ecx+0xc) 0/r32/eax
5028 8b/-> *eax 0/r32/eax
5029
5030 81 7/subop/compare *(eax+0x10) 0/imm32
5031 0f 84/jump-if-= $emit-subx-stmt-list:abort-regvardef-without-register/disp32
5032
5033 (emit-indent *(ebp+8) *Curr-block-depth)
5034 (write-buffered *(ebp+8) "ff 6/subop/push %")
5035 (write-buffered *(ebp+8) *(eax+0x10))
5036 (write-buffered *(ebp+8) Newline)
5037
5038 (push *(ebp+0x10) %eax)
5039
5040 (emit-subx-statement *(ebp+8) %ecx Primitives *Program)
5041
5042 ba/copy-to-edx 1/imm32/true
5043 }
5044 $emit-subx-stmt-list:continue:
5045
5046 8b/-> *(esi+4) 6/r32/esi
5047 e9/jump loop/disp32
5048 }
5049 $emit-subx-stmt-list:emit-cleanup:
5050 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth)
5051 $emit-subx-stmt-list:cleanup:
5052 (clean-up-blocks *(ebp+0x10) *Curr-block-depth)
5053 $emit-subx-stmt-list:end:
5054
5055 5e/pop-to-esi
5056 5b/pop-to-ebx
5057 5a/pop-to-edx
5058 59/pop-to-ecx
5059 58/pop-to-eax
5060
5061 89/<- %esp 5/r32/ebp
5062 5d/pop-to-ebp
5063 c3/return
5064
5065 $emit-subx-stmt-list:abort-regvardef-without-register:
5066
5067 (write-buffered Stderr "var '")
5068 (write-buffered Stderr *eax)
5069 (write-buffered Stderr "' initialized from an instruction must live in a register\n")
5070 (flush Stderr)
5071
5072 bb/copy-to-ebx 1/imm32
5073 b8/copy-to-eax 1/imm32/exit
5074 cd/syscall 0x80/imm8
5075
5076
5077 emit-subx-cleanup-and-unconditional-nonlocal-branch:
5078
5079 55/push-ebp
5080 89/<- %ebp 4/r32/esp
5081
5082 50/push-eax
5083 51/push-ecx
5084 52/push-edx
5085
5086 8b/-> *(ebp+0xc) 1/r32/ecx
5087
5088 8b/-> *(ecx+8) 2/r32/edx
5089 8b/-> *edx 2/r32/edx
5090 8b/-> *edx 2/r32/edx
5091
5092 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %edx)
5093
5094 (emit-indent *(ebp+8) *Curr-block-depth)
5095 (write-buffered *(ebp+8) "e9/jump ")
5096 (write-buffered *(ebp+8) %edx)
5097 (string-starts-with? *(ecx+4) "break")
5098 3d/compare-eax-and 0/imm32/false
5099 {
5100 74/jump-if-= break/disp8
5101 (write-buffered *(ebp+8) ":break/disp32\n")
5102 }
5103 3d/compare-eax-and 0/imm32/false
5104 {
5105 75/jump-if-!= break/disp8
5106 (write-buffered *(ebp+8) ":loop/disp32\n")
5107 }
5108 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end:
5109
5110 5a/pop-to-edx
5111 59/pop-to-ecx
5112 58/pop-to-eax
5113
5114 89/<- %esp 5/r32/ebp
5115 5d/pop-to-ebp
5116 c3/return
5117
5118 is-mu-branch?:
5119
5120 55/push-ebp
5121 89/<- %ebp 4/r32/esp
5122
5123 51/push-ecx
5124
5125 8b/-> *(ebp+8) 1/r32/ecx
5126
5127 (string-starts-with? *(ecx+4) "loop")
5128 3d/compare-eax-and 0/imm32/false
5129 75/jump-if-not-equal $is-mu-branch?:end/disp8
5130
5131 (string-starts-with? *(ecx+4) "break")
5132 $is-mu-branch?:end:
5133
5134 59/pop-to-ecx
5135
5136 89/<- %esp 5/r32/ebp
5137 5d/pop-to-ebp
5138 c3/return
5139
5140 emit-reverse-break:
5141
5142 55/push-ebp
5143 89/<- %ebp 4/r32/esp
5144
5145 50/push-eax
5146
5147 8b/-> *(ebp+0xc) 0/r32/eax
5148
5149 (get Reverse-branch *(eax+4) 8 "reverse-branch: ")
5150 (emit-indent *(ebp+8) *Curr-block-depth)
5151 (write-buffered *(ebp+8) *eax)
5152 (write-buffered *(ebp+8) " break/disp32\n")
5153 $emit-reverse-break:end:
5154
5155 58/pop-to-eax
5156
5157 89/<- %esp 5/r32/ebp
5158 5d/pop-to-ebp
5159 c3/return
5160
5161 == data
5162
5163 Reverse-branch:
5164
5165 0xa0/imm32/write
5166 0/imm32/read
5167 0xa0/imm32/length
5168
5169 "break-if-="/imm32 "0f 85/jump-if-!="/imm32
5170 "loop-if-="/imm32 "0f 85/jump-if-!="/imm32
5171 "break-if-!="/imm32 "0f 84/jump-if-="/imm32
5172 "loop-if-!="/imm32 "0f 84/jump-if-="/imm32
5173 "break-if-<"/imm32 "0f 8d/jump-if->="/imm32
5174 "loop-if-<"/imm32 "0f 8d/jump-if->="/imm32
5175 "break-if->"/imm32 "0f 8e/jump-if-<="/imm32
5176 "loop-if->"/imm32 "0f 8e/jump-if-<="/imm32
5177 "break-if-<="/imm32 "0f 87/jump-if->"/imm32
5178 "loop-if-<="/imm32 "0f 87/jump-if->"/imm32
5179 "break-if->="/imm32 "0f 8c/jump-if-<"/imm32
5180 "loop-if->="/imm32 "0f 8c/jump-if-<"/imm32
5181 "break-if-addr<"/imm32 "0f 83/jump-if-addr>="/imm32
5182 "loop-if-addr<"/imm32 "0f 83/jump-if-addr>="/imm32
5183 "break-if-addr>"/imm32 "0f 86/jump-if-addr<="/imm32
5184 "loop-if-addr>"/imm32 "0f 86/jump-if-addr<="/imm32
5185 "break-if-addr<="/imm32 "0f 87/jump-if-addr>"/imm32
5186 "loop-if-addr<="/imm32 "0f 87/jump-if-addr>"/imm32
5187 "break-if-addr>="/imm32 "0f 82/jump-if-addr<"/imm32
5188 "loop-if-addr>="/imm32 "0f 82/jump-if-addr<"/imm32
5189
5190 == code
5191
5192 emit-unconditional-jump-to-depth:
5193
5194 55/push-ebp
5195 89/<- %ebp 4/r32/esp
5196
5197 50/push-eax
5198 51/push-ecx
5199 52/push-edx
5200 53/push-ebx
5201
5202 8b/-> *(ebp+0xc) 1/r32/ecx
5203
5204 8b/-> *ecx 0/r32/eax
5205
5206 81 0/subop/add %ecx 8/imm32
5207
5208 81 5/subop/subtract %eax 4/imm32
5209 8d/copy-address *(ecx+eax) 0/r32/eax
5210
5211 8b/-> *(ebp+0x10) 2/r32/edx
5212 {
5213 $emit-unconditional-jump-to-depth:loop:
5214
5215 39/compare %eax 1/r32/ecx
5216 0f 82/jump-if-addr< break/disp32
5217
5218 8b/-> *eax 3/r32/ebx
5219
5220 39/compare *(ebx+8) 2/r32/edx
5221 0f 8c/jump-if-< break/disp32
5222 {
5223 $emit-unconditional-jump-to-depth:check:
5224
5225 39/compare *(ebx+8) 2/r32/edx
5226 0f 85/jump-if-!= break/disp32
5227 $emit-unconditional-jump-to-depth:depth-found:
5228
5229
5230 50/push-eax
5231 (size-of %ebx)
5232
5233 3d/compare-eax-and 0/imm32
5234 58/pop-to-eax
5235
5236 0f 85/jump-if-!= break/disp32
5237 $emit-unconditional-jump-to-depth:label-found:
5238
5239 (emit-indent *(ebp+8) *Curr-block-depth)
5240 (write-buffered *(ebp+8) "e9/jump ")
5241 (write-buffered *(ebp+8) *ebx)
5242 (write-buffered *(ebp+8) ":")
5243 (write-buffered *(ebp+8) *(ebp+0x14))
5244 (write-buffered *(ebp+8) "/disp32\n")
5245 eb/jump $emit-unconditional-jump-to-depth:end/disp8
5246 }
5247
5248 2d/subtract-from-eax 4/imm32
5249 e9/jump loop/disp32
5250 }
5251
5252 $emit-unconditional-jump-to-depth:end:
5253
5254 5b/pop-to-ebx
5255 5a/pop-to-edx
5256 59/pop-to-ecx
5257 58/pop-to-eax
5258
5259 89/<- %esp 5/r32/ebp
5260 5d/pop-to-ebp
5261 c3/return
5262
5263
5264
5265 emit-cleanup-code-until-depth:
5266
5267 55/push-ebp
5268 89/<- %ebp 4/r32/esp
5269
5270 50/push-eax
5271 51/push-ecx
5272 52/push-edx
5273 53/push-ebx
5274
5275 8b/-> *(ebp+0xc) 1/r32/ecx
5276
5277 8b/-> *ecx 0/r32/eax
5278
5279 81 0/subop/add %ecx 8/imm32
5280
5281 81 5/subop/subtract %eax 4/imm32
5282 8d/copy-address *(ecx+eax) 0/r32/eax
5283
5284 8b/-> *(ebp+0x10) 2/r32/edx
5285 {
5286 $emit-cleanup-code-until-depth:loop:
5287
5288 39/compare %eax 1/r32/ecx
5289 0f 82/jump-if-addr< break/disp32
5290
5291 8b/-> *eax 3/r32/ebx
5292
5293 39/compare *(ebx+8) 2/r32/edx
5294 0f 8c/jump-if-< break/disp32
5295
5296 81 7/subop/compare *(ebx+0x10) 0/imm32
5297 {
5298 74/jump-if-= break/disp8
5299 $emit-cleanup-code-until-depth:reclaim-var-in-register:
5300 (emit-indent *(ebp+8) *Curr-block-depth)
5301 (write-buffered *(ebp+8) "8f 0/subop/pop %")
5302 (write-buffered *(ebp+8) *(ebx+0x10))
5303 (write-buffered *(ebp+8) Newline)
5304 }
5305
5306 {
5307 75/jump-if-!= break/disp8
5308 $emit-cleanup-code-until-depth:reclaim-var-on-stack:
5309 50/push-eax
5310 (size-of %ebx)
5311
5312 3d/compare-eax-and 0/imm32
5313 74/jump-if-= break/disp8
5314
5315 (emit-indent *(ebp+8) *Curr-block-depth)
5316 (write-buffered *(ebp+8) "81 0/subop/add %esp ")
5317 (print-int32-buffered *(ebp+8) %eax)
5318 (write-buffered *(ebp+8) "/imm32\n")
5319 58/pop-to-eax
5320 }
5321
5322 2d/subtract-from-eax 4/imm32
5323 e9/jump loop/disp32
5324 }
5325 $emit-cleanup-code-until-depth:end:
5326
5327 5b/pop-to-ebx
5328 5a/pop-to-edx
5329 59/pop-to-ecx
5330 58/pop-to-eax
5331
5332 89/<- %esp 5/r32/ebp
5333 5d/pop-to-ebp
5334 c3/return
5335
5336
5337
5338 emit-cleanup-code-until-target:
5339
5340 55/push-ebp
5341 89/<- %ebp 4/r32/esp
5342
5343 50/push-eax
5344 51/push-ecx
5345 52/push-edx
5346 53/push-ebx
5347
5348 8b/-> *(ebp+0xc) 1/r32/ecx
5349
5350 8b/-> *ecx 0/r32/eax
5351
5352 81 0/subop/add %ecx 8/imm32
5353
5354 81 5/subop/subtract %eax 4/imm32
5355 8d/copy-address *(ecx+eax) 2/r32/edx
5356 {
5357 $emit-cleanup-code-until-target:loop:
5358
5359 39/compare %edx 1/r32/ecx
5360 0f 82/jump-if-addr< break/disp32
5361
5362 8b/-> *edx 3/r32/ebx
5363
5364 (string-equal? *ebx *(ebp+0x10))
5365 3d/compare-eax-and 0/imm32/false
5366 0f 85/jump-if-!= break/disp32
5367
5368 81 7/subop/compare *(ebx+0x10) 0/imm32
5369 {
5370 74/jump-if-= break/disp8
5371 $emit-cleanup-code-until-target:reclaim-var-in-register:
5372 (emit-indent *(ebp+8) *Curr-block-depth)
5373 (write-buffered *(ebp+8) "8f 0/subop/pop %")
5374 (write-buffered *(ebp+8) *(ebx+0x10))
5375 (write-buffered *(ebp+8) Newline)
5376 }
5377
5378 {
5379 75/jump-if-!= break/disp8
5380 $emit-cleanup-code-until-target:reclaim-var-on-stack:
5381 (size-of %ebx)
5382
5383 3d/compare-eax-and 0/imm32
5384 74/jump-if-= break/disp8
5385
5386 (emit-indent *(ebp+8) *Curr-block-depth)
5387 (write-buffered *(ebp+8) "81 0/subop/add %esp ")
5388 (print-int32-buffered *(ebp+8) %eax)
5389 (write-buffered *(ebp+8) "/imm32\n")
5390 }
5391
5392 81 5/subop/subtract %edx 4/imm32
5393 e9/jump loop/disp32
5394 }
5395 $emit-cleanup-code-until-target:end:
5396
5397 5b/pop-to-ebx
5398 5a/pop-to-edx
5399 59/pop-to-ecx
5400 58/pop-to-eax
5401
5402 89/<- %esp 5/r32/ebp
5403 5d/pop-to-ebp
5404 c3/return
5405
5406
5407 clean-up-blocks:
5408
5409 55/push-ebp
5410 89/<- %ebp 4/r32/esp
5411
5412 50/push-eax
5413 51/push-ecx
5414 56/push-esi
5415
5416 8b/-> *(ebp+8) 6/r32/esi
5417
5418 8b/-> *(ebp+0xc) 1/r32/ecx
5419 {
5420 $clean-up-blocks:reclaim-loop:
5421
5422 81 7/subop/compare *esi 0/imm32
5423 7e/jump-if-<= break/disp8
5424
5425 (top %esi)
5426
5427 39/compare *(eax+8) 1/r32/ecx
5428 7c/jump-if-< break/disp8
5429
5430 81 7/subop/compare *(eax+0x10) 0/imm32
5431 {
5432 75/jump-if-!= break/disp8
5433 $clean-up-blocks:reclaim-var-on-stack:
5434 (size-of %eax)
5435 01/add *Next-local-stack-offset 0/r32/eax
5436 }
5437 (pop %esi)
5438 e9/jump loop/disp32
5439 }
5440 $clean-up-blocks:end:
5441
5442 5e/pop-to-esi
5443 59/pop-to-ecx
5444 58/pop-to-eax
5445
5446 89/<- %esp 5/r32/ebp
5447 5d/pop-to-ebp
5448 c3/return
5449
5450 emit-subx-var-def:
5451
5452 55/push-ebp
5453 89/<- %ebp 4/r32/esp
5454
5455 50/push-eax
5456 51/push-ecx
5457
5458 8b/-> *(ebp+0xc) 0/r32/eax
5459
5460 (size-of *(eax+4))
5461
5462 {
5463 3d/compare-eax-with 0/imm32
5464 7e/jump-if-<= break/disp8
5465 (emit-indent *(ebp+8) *Curr-block-depth)
5466 (write-buffered *(ebp+8) "68/push 0/imm32\n")
5467
5468 2d/subtract-from-eax 4/imm32
5469
5470 eb/jump loop/disp8
5471 }
5472 $emit-subx-var-def:end:
5473
5474 59/pop-to-ecx
5475 58/pop-to-eax
5476
5477 89/<- %esp 5/r32/ebp
5478 5d/pop-to-ebp
5479 c3/return
5480
5481 emit-subx-statement:
5482
5483 55/push-ebp
5484 89/<- %ebp 4/r32/esp
5485
5486 50/push-eax
5487 51/push-ecx
5488
5489
5490 8b/-> *(ebp+0xc) 1/r32/ecx
5491 +-- 24 lines: # array length ------------------------------------------------------------------------------------------------------------------------------------------------------------
5515 +-- 32 lines: # array index -------------------------------------------------------------------------------------------------------------------------------------------------------------
5547
5548 {
5549 $emit-subx-statement:check-for-primitive:
5550 (find-matching-primitive *(ebp+0x10) *(ebp+0xc))
5551 3d/compare-eax-and 0/imm32
5552 74/jump-if-= break/disp8
5553 $emit-subx-statement:primitive:
5554 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax)
5555 e9/jump $emit-subx-statement:end/disp32
5556 }
5557
5558 {
5559 $emit-subx-statement:check-for-call:
5560 (find-matching-function *(ebp+0x14) *(ebp+0xc))
5561 3d/compare-eax-and 0/imm32
5562 74/jump-if-= break/disp8
5563 $emit-subx-statement:call:
5564 (emit-subx-call *(ebp+8) *(ebp+0xc) %eax)
5565 e9/jump $emit-subx-statement:end/disp32
5566 }
5567
5568 (emit-hailmary-call *(ebp+8) *(ebp+0xc))
5569 $emit-subx-statement:end:
5570
5571 59/pop-to-ecx
5572 58/pop-to-eax
5573
5574 89/<- %esp 5/r32/ebp
5575 5d/pop-to-ebp
5576 c3/return
5577
5578 $emit-subx-statement:abort:
5579
5580 (write-buffered Stderr "couldn't translate an instruction with operation '")
5581 8b/-> *(ebp+0xc) 0/r32/eax
5582 (write-buffered Stderr *(eax+4))
5583 (write-buffered Stderr "'\n")
5584 (flush Stderr)
5585
5586 bb/copy-to-ebx 1/imm32
5587 b8/copy-to-eax 1/imm32/exit
5588 cd/syscall 0x80/imm8
5589
5590
5591 emit-subx-block:
5592
5593 55/push-ebp
5594 89/<- %ebp 4/r32/esp
5595
5596 50/push-eax
5597 51/push-ecx
5598 56/push-esi
5599
5600 8b/-> *(ebp+0xc) 6/r32/esi
5601
5602 8b/-> *(esi+4) 0/r32/eax
5603
5604 {
5605 $emit-subx-block:check-empty:
5606 81 7/subop/compare %eax 0/imm32
5607 0f 84/jump-if-= break/disp32
5608 (emit-indent *(ebp+8) *Curr-block-depth)
5609 (write-buffered *(ebp+8) "{\n")
5610
5611 8b/-> *(esi+8) 1/r32/ecx
5612 (write-buffered *(ebp+8) *ecx)
5613 (write-buffered *(ebp+8) ":loop:\n")
5614 ff 0/subop/increment *Curr-block-depth
5615 (push *(ebp+0x10) %ecx)
5616 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10))
5617 (pop *(ebp+0x10))
5618 ff 1/subop/decrement *Curr-block-depth
5619 (emit-indent *(ebp+8) *Curr-block-depth)
5620 (write-buffered *(ebp+8) "}\n")
5621 (write-buffered *(ebp+8) *ecx)
5622 (write-buffered *(ebp+8) ":break:\n")
5623 }
5624 $emit-subx-block:end:
5625
5626 5e/pop-to-esi
5627 59/pop-to-ecx
5628 58/pop-to-eax
5629
5630 89/<- %esp 5/r32/ebp
5631 5d/pop-to-ebp
5632 c3/return
5633
5634
5635
5636 == data
5637 Primitives:
5638
5639 _Primitive-inc-eax:
5640
5641 "increment"/imm32/name
5642 0/imm32/no-inouts
5643 Single-int-var-in-eax/imm32/outputs
5644 "40/increment-eax"/imm32/subx-name
5645 0/imm32/no-rm32
5646 0/imm32/no-r32
5647 0/imm32/no-imm32
5648 0/imm32/no-disp32
5649 0/imm32/output-is-write-only
5650 _Primitive-inc-ecx/imm32/next
5651 _Primitive-inc-ecx:
5652
5653 "increment"/imm32/name
5654 0/imm32/no-inouts
5655 Single-int-var-in-ecx/imm32/outputs
5656 "41/increment-ecx"/imm32/subx-name
5657 0/imm32/no-rm32
5658 0/imm32/no-r32
5659 0/imm32/no-imm32
5660 0/imm32/no-disp32
5661 0/imm32/output-is-write-only
5662 _Primitive-inc-edx/imm32/next
5663 _Primitive-inc-edx:
5664
5665 "increment"/imm32/name
5666 0/imm32/no-inouts
5667 Single-int-var-in-edx/imm32/outputs
5668 "42/increment-edx"/imm32/subx-name
5669 0/imm32/no-rm32
5670 0/imm32/no-r32
5671 0/imm32/no-imm32
5672 0/imm32/no-disp32
5673 0/imm32/output-is-write-only
5674 _Primitive-inc-ebx/imm32/next
5675 _Primitive-inc-ebx:
5676
5677 "increment"/imm32/name
5678 0/imm32/no-inouts
5679 Single-int-var-in-ebx/imm32/outputs
5680 "43/increment-ebx"/imm32/subx-name
5681 0/imm32/no-rm32
5682 0/imm32/no-r32
5683 0/imm32/no-imm32
5684 0/imm32/no-disp32
5685 0/imm32/output-is-write-only
5686 _Primitive-inc-esi/imm32/next
5687 _Primitive-inc-esi:
5688
5689 "increment"/imm32/name
5690 0/imm32/no-inouts
5691 Single-int-var-in-esi/imm32/outputs
5692 "46/increment-esi"/imm32/subx-name
5693 0/imm32/no-rm32
5694 0/imm32/no-r32
5695 0/imm32/no-imm32
5696 0/imm32/no-disp32
5697 0/imm32/output-is-write-only
5698 _Primitive-inc-edi/imm32/next
5699 _Primitive-inc-edi:
5700
5701 "increment"/imm32/name
5702 0/imm32/no-inouts
5703 Single-int-var-in-edi/imm32/outputs
5704 "47/increment-edi"/imm32/subx-name
5705 0/imm32/no-rm32
5706 0/imm32/no-r32
5707 0/imm32/no-imm32
5708 0/imm32/no-disp32
5709 0/imm32/output-is-write-only
5710 _Primitive-dec-eax/imm32/next
5711 _Primitive-dec-eax:
5712
5713 "decrement"/imm32/name
5714 0/imm32/no-inouts
5715 Single-int-var-in-eax/imm32/outputs
5716 "48/decrement-eax"/imm32/subx-name
5717 0/imm32/no-rm32
5718 0/imm32/no-r32
5719 0/imm32/no-imm32
5720 0/imm32/no-disp32
5721 0/imm32/output-is-write-only
5722 _Primitive-dec-ecx/imm32/next
5723 _Primitive-dec-ecx:
5724
5725 "decrement"/imm32/name
5726 0/imm32/no-inouts
5727 Single-int-var-in-ecx/imm32/outputs
5728 "49/decrement-ecx"/imm32/subx-name
5729 0/imm32/no-rm32
5730 0/imm32/no-r32
5731 0/imm32/no-imm32
5732 0/imm32/no-disp32
5733 0/imm32/output-is-write-only
5734 _Primitive-dec-edx/imm32/next
5735 _Primitive-dec-edx:
5736
5737 "decrement"/imm32/name
5738 0/imm32/no-inouts
5739 Single-int-var-in-edx/imm32/outputs
5740 "4a/decrement-edx"/imm32/subx-name
5741 0/imm32/no-rm32
5742 0/imm32/no-r32
5743 0/imm32/no-imm32
5744 0/imm32/no-disp32
5745 0/imm32/output-is-write-only
5746 _Primitive-dec-ebx/imm32/next
5747 _Primitive-dec-ebx:
5748
5749 "decrement"/imm32/name
5750 0/imm32/no-inouts
5751 Single-int-var-in-ebx/imm32/outputs
5752 "4b/decrement-ebx"/imm32/subx-name
5753 0/imm32/no-rm32
5754 0/imm32/no-r32
5755 0/imm32/no-imm32
5756 0/imm32/no-disp32
5757 0/imm32/output-is-write-only
5758 _Primitive-dec-esi/imm32/next
5759 _Primitive-dec-esi:
5760
5761 "decrement"/imm32/name
5762 0/imm32/no-inouts
5763 Single-int-var-in-esi/imm32/outputs
5764 "4e/decrement-esi"/imm32/subx-name
5765 0/imm32/no-rm32
5766 0/imm32/no-r32
5767 0/imm32/no-imm32
5768 0/imm32/no-disp32
5769 0/imm32/output-is-write-only
5770 _Primitive-dec-edi/imm32/next
5771 _Primitive-dec-edi:
5772
5773 "decrement"/imm32/name
5774 0/imm32/no-inouts
5775 Single-int-var-in-edi/imm32/outputs
5776 "4f/decrement-edi"/imm32/subx-name
5777 0/imm32/no-rm32
5778 0/imm32/no-r32
5779 0/imm32/no-imm32
5780 0/imm32/no-disp32
5781 0/imm32/output-is-write-only
5782 _Primitive-inc-mem/imm32/next
5783 _Primitive-inc-mem:
5784
5785 "increment"/imm32/name
5786 Single-int-var-in-mem/imm32/inouts
5787 0/imm32/no-outputs
5788 "ff 0/subop/increment"/imm32/subx-name
5789 1/imm32/rm32-is-first-inout
5790 0/imm32/no-r32
5791 0/imm32/no-imm32
5792 0/imm32/no-disp32
5793 0/imm32/output-is-write-only
5794 _Primitive-inc-reg/imm32/next
5795 _Primitive-inc-reg:
5796
5797 "increment"/imm32/name
5798 0/imm32/no-inouts
5799 Single-int-var-in-some-register/imm32/outputs
5800 "ff 0/subop/increment"/imm32/subx-name
5801 3/imm32/rm32-is-first-output
5802 0/imm32/no-r32
5803 0/imm32/no-imm32
5804 0/imm32/no-disp32
5805 0/imm32/output-is-write-only
5806 _Primitive-dec-mem/imm32/next
5807 _Primitive-dec-mem:
5808
5809 "decrement"/imm32/name
5810 Single-int-var-in-mem/imm32/inouts
5811 0/imm32/no-outputs
5812 "ff 1/subop/decrement"/imm32/subx-name
5813 1/imm32/rm32-is-first-inout
5814 0/imm32/no-r32
5815 0/imm32/no-imm32
5816 0/imm32/no-disp32
5817 0/imm32/output-is-write-only
5818 _Primitive-dec-reg/imm32/next
5819 _Primitive-dec-reg:
5820
5821 "decrement"/imm32/name
5822 0/imm32/no-inouts
5823 Single-int-var-in-some-register/imm32/outputs
5824 "ff 1/subop/decrement"/imm32/subx-name
5825 3/imm32/rm32-is-first-output
5826 0/imm32/no-r32
5827 0/imm32/no-imm32
5828 0/imm32/no-disp32
5829 0/imm32/output-is-write-only
5830 _Primitive-add-to-eax/imm32/next
5831
5832 _Primitive-add-to-eax:
5833
5834 "add"/imm32/name
5835 Single-lit-var/imm32/inouts
5836 Single-int-var-in-eax/imm32/outputs
5837 "05/add-to-eax"/imm32/subx-name
5838 0/imm32/no-rm32
5839 0/imm32/no-r32
5840 1/imm32/imm32-is-first-inout
5841 0/imm32/no-disp32
5842 0/imm32/output-is-write-only
5843 _Primitive-add-reg-to-reg/imm32/next
5844 _Primitive-add-reg-to-reg:
5845
5846 "add"/imm32/name
5847 Single-int-var-in-some-register/imm32/inouts
5848 Single-int-var-in-some-register/imm32/outputs
5849 "01/add-to"/imm32/subx-name
5850 3/imm32/rm32-is-first-output
5851 1/imm32/r32-is-first-inout
5852 0/imm32/no-imm32
5853 0/imm32/no-disp32
5854 0/imm32/output-is-write-only
5855 _Primitive-add-reg-to-mem/imm32/next
5856 _Primitive-add-reg-to-mem:
5857
5858 "add-to"/imm32/name
5859 Two-args-int-stack-int-reg/imm32/inouts
5860 0/imm32/outputs
5861 "01/add-to"/imm32/subx-name
5862 1/imm32/rm32-is-first-inout
5863 2/imm32/r32-is-second-inout
5864 0/imm32/no-imm32
5865 0/imm32/no-disp32
5866 0/imm32/output-is-write-only
5867 _Primitive-add-mem-to-reg/imm32/next
5868 _Primitive-add-mem-to-reg:
5869
5870 "add"/imm32/name
5871 Single-int-var-in-mem/imm32/inouts
5872 Single-int-var-in-some-register/imm32/outputs
5873 "03/add"/imm32/subx-name
5874 1/imm32/rm32-is-first-inout
5875 3/imm32/r32-is-first-output
5876 0/imm32/no-imm32
5877 0/imm32/no-disp32
5878 0/imm32/output-is-write-only
5879 _Primitive-add-lit-to-reg/imm32/next
5880 _Primitive-add-lit-to-reg:
5881
5882 "add"/imm32/name
5883 Single-lit-var/imm32/inouts
5884 Single-int-var-in-some-register/imm32/outputs
5885 "81 0/subop/add"/imm32/subx-name
5886 3/imm32/rm32-is-first-output
5887 0/imm32/no-r32
5888 1/imm32/imm32-is-first-inout
5889 0/imm32/no-disp32
5890 0/imm32/output-is-write-only
5891 _Primitive-add-lit-to-mem/imm32/next
5892 _Primitive-add-lit-to-mem:
5893
5894 "add-to"/imm32/name
5895 Int-var-and-literal/imm32/inouts
5896 0/imm32/outputs
5897 "81 0/subop/add"/imm32/subx-name
5898 1/imm32/rm32-is-first-inout
5899 0/imm32/no-r32
5900 2/imm32/imm32-is-second-inout
5901 0/imm32/no-disp32
5902 0/imm32/output-is-write-only
5903 _Primitive-subtract-from-eax/imm32/next
5904
5905 _Primitive-subtract-from-eax:
5906
5907 "subtract"/imm32/name
5908 Single-lit-var/imm32/inouts
5909 Single-int-var-in-eax/imm32/outputs
5910 "2d/subtract-from-eax"/imm32/subx-name
5911 0/imm32/no-rm32
5912 0/imm32/no-r32
5913 1/imm32/imm32-is-first-inout
5914 0/imm32/no-disp32
5915 0/imm32/output-is-write-only
5916 _Primitive-subtract-reg-from-reg/imm32/next
5917 _Primitive-subtract-reg-from-reg:
5918
5919 "subtract"/imm32/name
5920 Single-int-var-in-some-register/imm32/inouts
5921 Single-int-var-in-some-register/imm32/outputs
5922 "29/subtract-from"/imm32/subx-name
5923 3/imm32/rm32-is-first-output
5924 1/imm32/r32-is-first-inout
5925 0/imm32/no-imm32
5926 0/imm32/no-disp32
5927 0/imm32/output-is-write-only
5928 _Primitive-subtract-reg-from-mem/imm32/next
5929 _Primitive-subtract-reg-from-mem:
5930
5931 "subtract-from"/imm32/name
5932 Two-args-int-stack-int-reg/imm32/inouts
5933 0/imm32/outputs
5934 "29/subtract-from"/imm32/subx-name
5935 1/imm32/rm32-is-first-inout
5936 2/imm32/r32-is-second-inout
5937 0/imm32/no-imm32
5938 0/imm32/no-disp32
5939 0/imm32/output-is-write-only
5940 _Primitive-subtract-mem-from-reg/imm32/next
5941 _Primitive-subtract-mem-from-reg:
5942
5943 "subtract"/imm32/name
5944 Single-int-var-in-mem/imm32/inouts
5945 Single-int-var-in-some-register/imm32/outputs
5946 "2b/subtract"/imm32/subx-name
5947 1/imm32/rm32-is-first-inout
5948 3/imm32/r32-is-first-output
5949 0/imm32/no-imm32
5950 0/imm32/no-disp32
5951 0/imm32/output-is-write-only
5952 _Primitive-subtract-lit-from-reg/imm32/next
5953 _Primitive-subtract-lit-from-reg:
5954
5955 "subtract"/imm32/name
5956 Single-lit-var/imm32/inouts
5957 Single-int-var-in-some-register/imm32/outputs
5958 "81 5/subop/subtract"/imm32/subx-name
5959 3/imm32/rm32-is-first-output
5960 0/imm32/no-r32
5961 1/imm32/imm32-is-first-inout
5962 0/imm32/no-disp32
5963 0/imm32/output-is-write-only
5964 _Primitive-subtract-lit-from-mem/imm32/next
5965 _Primitive-subtract-lit-from-mem:
5966
5967 "subtract-from"/imm32/name
5968 Int-var-and-literal/imm32/inouts
5969 0/imm32/outputs
5970 "81 5/subop/subtract"/imm32/subx-name
5971 1/imm32/rm32-is-first-inout
5972 0/imm32/no-r32
5973 2/imm32/imm32-is-first-inout
5974 0/imm32/no-disp32
5975 0/imm32/output-is-write-only
5976 _Primitive-and-with-eax/imm32/next
5977
5978 _Primitive-and-with-eax:
5979
5980 "and"/imm32/name
5981 Single-lit-var/imm32/inouts
5982 Single-int-var-in-eax/imm32/outputs
5983 "25/and-with-eax"/imm32/subx-name
5984 0/imm32/no-rm32
5985 0/imm32/no-r32
5986 1/imm32/imm32-is-first-inout
5987 0/imm32/no-disp32
5988 0/imm32/output-is-write-only
5989 _Primitive-and-reg-with-reg/imm32/next
5990 _Primitive-and-reg-with-reg:
5991
5992 "and"/imm32/name
5993 Single-int-var-in-some-register/imm32/inouts
5994 Single-int-var-in-some-register/imm32/outputs
5995 "21/and-with"/imm32/subx-name
5996 3/imm32/rm32-is-first-output
5997 1/imm32/r32-is-first-inout
5998 0/imm32/no-imm32
5999 0/imm32/no-disp32
6000 0/imm32/output-is-write-only
6001 _Primitive-and-reg-with-mem/imm32/next
6002 _Primitive-and-reg-with-mem:
6003
6004 "and-with"/imm32/name
6005 Two-args-int-stack-int-reg/imm32/inouts
6006 0/imm32/outputs
6007 "21/and-with"/imm32/subx-name
6008 1/imm32/rm32-is-first-inout
6009 2/imm32/r32-is-second-inout
6010 0/imm32/no-imm32
6011 0/imm32/no-disp32
6012 0/imm32/output-is-write-only
6013 _Primitive-and-mem-with-reg/imm32/next
6014 _Primitive-and-mem-with-reg:
6015
6016 "and"/imm32/name
6017 Single-int-var-in-mem/imm32/inouts
6018 Single-int-var-in-some-register/imm32/outputs
6019 "23/and"/imm32/subx-name
6020 1/imm32/rm32-is-first-inout
6021 3/imm32/r32-is-first-output
6022 0/imm32/no-imm32
6023 0/imm32/no-disp32
6024 0/imm32/output-is-write-only
6025 _Primitive-and-lit-with-reg/imm32/next
6026 _Primitive-and-lit-with-reg:
6027
6028 "and"/imm32/name
6029 Single-lit-var/imm32/inouts
6030 Single-int-var-in-some-register/imm32/outputs
6031 "81 4/subop/and"/imm32/subx-name
6032 3/imm32/rm32-is-first-output
6033 0/imm32/no-r32
6034 1/imm32/imm32-is-first-inout
6035 0/imm32/no-disp32
6036 0/imm32/output-is-write-only
6037 _Primitive-and-lit-with-mem/imm32/next
6038 _Primitive-and-lit-with-mem:
6039
6040 "and-with"/imm32/name
6041 Int-var-and-literal/imm32/inouts
6042 0/imm32/outputs
6043 "81 4/subop/and"/imm32/subx-name
6044 1/imm32/rm32-is-first-inout
6045 0/imm32/no-r32
6046 2/imm32/imm32-is-first-inout
6047 0/imm32/no-disp32
6048 0/imm32/output-is-write-only
6049 _Primitive-or-with-eax/imm32/next
6050
6051 _Primitive-or-with-eax:
6052
6053 "or"/imm32/name
6054 Single-lit-var/imm32/inouts
6055 Single-int-var-in-eax/imm32/outputs
6056 "0d/or-with-eax"/imm32/subx-name
6057 0/imm32/no-rm32
6058 0/imm32/no-r32
6059 1/imm32/imm32-is-first-inout
6060 0/imm32/no-disp32
6061 0/imm32/output-is-write-only
6062 _Primitive-or-reg-with-reg/imm32/next
6063 _Primitive-or-reg-with-reg:
6064
6065 "or"/imm32/name
6066 Single-int-var-in-some-register/imm32/inouts
6067 Single-int-var-in-some-register/imm32/outputs
6068 "09/or-with"/imm32/subx-name
6069 3/imm32/rm32-is-first-output
6070 1/imm32/r32-is-first-inout
6071 0/imm32/no-imm32
6072 0/imm32/no-disp32
6073 0/imm32/output-is-write-only
6074 _Primitive-or-reg-with-mem/imm32/next
6075 _Primitive-or-reg-with-mem:
6076
6077 "or-with"/imm32/name
6078 Two-args-int-stack-int-reg/imm32/inouts
6079 0/imm32/outputs
6080 "09/or-with"/imm32/subx-name
6081 1/imm32/rm32-is-first-inout
6082 2/imm32/r32-is-second-inout
6083 0/imm32/no-imm32
6084 0/imm32/no-disp32
6085 0/imm32/output-is-write-only
6086 _Primitive-or-mem-with-reg/imm32/next
6087 _Primitive-or-mem-with-reg:
6088
6089 "or"/imm32/name
6090 Single-int-var-in-mem/imm32/inouts
6091 Single-int-var-in-some-register/imm32/outputs
6092 "0b/or"/imm32/subx-name
6093 1/imm32/rm32-is-first-inout
6094 3/imm32/r32-is-first-output
6095 0/imm32/no-imm32
6096 0/imm32/no-disp32
6097 0/imm32/output-is-write-only
6098 _Primitive-or-lit-with-reg/imm32/next
6099 _Primitive-or-lit-with-reg:
6100
6101 "or"/imm32/name
6102 Single-lit-var/imm32/inouts
6103 Single-int-var-in-some-register/imm32/outputs
6104 "81 1/subop/or"/imm32/subx-name
6105 3/imm32/rm32-is-first-output
6106 0/imm32/no-r32
6107 1/imm32/imm32-is-first-inout
6108 0/imm32/no-disp32
6109 0/imm32/output-is-write-only
6110 _Primitive-or-lit-with-mem/imm32/next
6111 _Primitive-or-lit-with-mem:
6112
6113 "or-with"/imm32/name
6114 Int-var-and-literal/imm32/inouts
6115 0/imm32/outputs
6116 "81 1/subop/or"/imm32/subx-name
6117 1/imm32/rm32-is-first-inout
6118 0/imm32/no-r32
6119 2/imm32/imm32-is-second-inout
6120 0/imm32/no-disp32
6121 0/imm32/output-is-write-only
6122 _Primitive-xor-with-eax/imm32/next
6123
6124 _Primitive-xor-with-eax:
6125
6126 "xor"/imm32/name
6127 Single-lit-var/imm32/inouts
6128 Single-int-var-in-eax/imm32/outputs
6129 "35/xor-with-eax"/imm32/subx-name
6130 0/imm32/no-rm32
6131 0/imm32/no-r32
6132 1/imm32/imm32-is-first-inout
6133 0/imm32/no-disp32
6134 0/imm32/output-is-write-only
6135 _Primitive-xor-reg-with-reg/imm32/next
6136 _Primitive-xor-reg-with-reg:
6137
6138 "xor"/imm32/name
6139 Single-int-var-in-some-register/imm32/inouts
6140 Single-int-var-in-some-register/imm32/outputs
6141 "31/xor-with"/imm32/subx-name
6142 3/imm32/rm32-is-first-output
6143 1/imm32/r32-is-first-inout
6144 0/imm32/no-imm32
6145 0/imm32/no-disp32
6146 0/imm32/output-is-write-only
6147 _Primitive-xor-reg-with-mem/imm32/next
6148 _Primitive-xor-reg-with-mem:
6149
6150 "xor-with"/imm32/name
6151 Two-args-int-stack-int-reg/imm32/inouts
6152 0/imm32/outputs
6153 "31/xor-with"/imm32/subx-name
6154 1/imm32/rm32-is-first-inout
6155 2/imm32/r32-is-second-inout
6156 0/imm32/no-imm32
6157 0/imm32/no-disp32
6158 0/imm32/output-is-write-only
6159 _Primitive-xor-mem-with-reg/imm32/next
6160 _Primitive-xor-mem-with-reg:
6161
6162 "xor"/imm32/name
6163 Single-int-var-in-mem/imm32/inouts
6164 Single-int-var-in-some-register/imm32/outputs
6165 "33/xor"/imm32/subx-name
6166 1/imm32/rm32-is-first-inout
6167 3/imm32/r32-is-first-output
6168 0/imm32/no-imm32
6169 0/imm32/no-disp32
6170 0/imm32/output-is-write-only
6171 _Primitive-xor-lit-with-reg/imm32/next
6172 _Primitive-xor-lit-with-reg:
6173
6174 "xor"/imm32/name
6175 Single-lit-var/imm32/inouts
6176 Single-int-var-in-some-register/imm32/outputs
6177 "81 6/subop/xor"/imm32/subx-name
6178 3/imm32/rm32-is-first-output
6179 0/imm32/no-r32
6180 1/imm32/imm32-is-first-inout
6181 0/imm32/no-disp32
6182 0/imm32/output-is-write-only
6183 _Primitive-xor-lit-with-mem/imm32/next
6184 _Primitive-xor-lit-with-mem:
6185
6186 "xor-with"/imm32/name
6187 Int-var-and-literal/imm32/inouts
6188 0/imm32/outputs
6189 "81 6/subop/xor"/imm32/subx-name
6190 1/imm32/rm32-is-first-inout
6191 0/imm32/no-r32
6192 2/imm32/imm32-is-first-inout
6193 0/imm32/no-disp32
6194 0/imm32/output-is-write-only
6195 _Primitive-copy-to-eax/imm32/next
6196
6197 _Primitive-copy-to-eax:
6198
6199 "copy"/imm32/name
6200 Single-lit-var/imm32/inouts
6201 Single-int-var-in-eax/imm32/outputs
6202 "b8/copy-to-eax"/imm32/subx-name
6203 0/imm32/no-rm32
6204 0/imm32/no-r32
6205 1/imm32/imm32-is-first-inout
6206 0/imm32/no-disp32
6207 1/imm32/output-is-write-only
6208 _Primitive-copy-to-ecx/imm32/next
6209 _Primitive-copy-to-ecx:
6210
6211 "copy"/imm32/name
6212 Single-lit-var/imm32/inouts
6213 Single-int-var-in-ecx/imm32/outputs
6214 "b9/copy-to-ecx"/imm32/subx-name
6215 0/imm32/no-rm32
6216 0/imm32/no-r32
6217 1/imm32/imm32-is-first-inout
6218 0/imm32/no-disp32
6219 1/imm32/output-is-write-only
6220 _Primitive-copy-to-edx/imm32/next
6221 _Primitive-copy-to-edx:
6222
6223 "copy"/imm32/name
6224 Single-lit-var/imm32/inouts
6225 Single-int-var-in-edx/imm32/outputs
6226 "ba/copy-to-edx"/imm32/subx-name
6227 0/imm32/no-rm32
6228 0/imm32/no-r32
6229 1/imm32/imm32-is-first-inout
6230 0/imm32/no-disp32
6231 1/imm32/output-is-write-only
6232 _Primitive-copy-to-ebx/imm32/next
6233 _Primitive-copy-to-ebx:
6234
6235 "copy"/imm32/name
6236 Single-lit-var/imm32/inouts
6237 Single-int-var-in-ebx/imm32/outputs
6238 "bb/copy-to-ebx"/imm32/subx-name
6239 0/imm32/no-rm32
6240 0/imm32/no-r32
6241 1/imm32/imm32-is-first-inout
6242 0/imm32/no-disp32
6243 1/imm32/output-is-write-only
6244 _Primitive-copy-to-esi/imm32/next
6245 _Primitive-copy-to-esi:
6246
6247 "copy"/imm32/name
6248 Single-lit-var/imm32/inouts
6249 Single-int-var-in-esi/imm32/outputs
6250 "be/copy-to-esi"/imm32/subx-name
6251 0/imm32/no-rm32
6252 0/imm32/no-r32
6253 1/imm32/imm32-is-first-inout
6254 0/imm32/no-disp32
6255 1/imm32/output-is-write-only
6256 _Primitive-copy-to-edi/imm32/next
6257 _Primitive-copy-to-edi:
6258
6259 "copy"/imm32/name
6260 Single-lit-var/imm32/inouts
6261 Single-int-var-in-edi/imm32/outputs
6262 "bf/copy-to-edi"/imm32/subx-name
6263 0/imm32/no-rm32
6264 0/imm32/no-r32
6265 1/imm32/imm32-is-first-inout
6266 0/imm32/no-disp32
6267 1/imm32/output-is-write-only
6268 _Primitive-copy-reg-to-reg/imm32/next
6269 _Primitive-copy-reg-to-reg:
6270
6271 "copy"/imm32/name
6272 Single-int-var-in-some-register/imm32/inouts
6273 Single-int-var-in-some-register/imm32/outputs
6274 "89/copy-to"/imm32/subx-name
6275 3/imm32/rm32-is-first-output
6276 1/imm32/r32-is-first-inout
6277 0/imm32/no-imm32
6278 0/imm32/no-disp32
6279 1/imm32/output-is-write-only
6280 _Primitive-copy-reg-to-mem/imm32/next
6281 _Primitive-copy-reg-to-mem:
6282
6283 "copy-to"/imm32/name
6284 Two-args-int-stack-int-reg/imm32/inouts
6285 0/imm32/outputs
6286 "89/copy-to"/imm32/subx-name
6287 1/imm32/rm32-is-first-inout
6288 2/imm32/r32-is-second-inout
6289 0/imm32/no-imm32
6290 0/imm32/no-disp32
6291 1/imm32/output-is-write-only
6292 _Primitive-copy-mem-to-reg/imm32/next
6293 _Primitive-copy-mem-to-reg:
6294
6295 "copy"/imm32/name
6296 Single-int-var-in-mem/imm32/inouts
6297 Single-int-var-in-some-register/imm32/outputs
6298 "8b/copy-from"/imm32/subx-name
6299 1/imm32/rm32-is-first-inout
6300 3/imm32/r32-is-first-output
6301 0/imm32/no-imm32
6302 0/imm32/no-disp32
6303 1/imm32/output-is-write-only
6304 _Primitive-copy-lit-to-reg/imm32/next
6305 _Primitive-copy-lit-to-reg:
6306
6307 "copy"/imm32/name
6308 Single-lit-var/imm32/inouts
6309 Single-int-var-in-some-register/imm32/outputs
6310 "c7 0/subop/copy"/imm32/subx-name
6311 3/imm32/rm32-is-first-output
6312 0/imm32/no-r32
6313 1/imm32/imm32-is-first-inout
6314 0/imm32/no-disp32
6315 1/imm32/output-is-write-only
6316 _Primitive-copy-lit-to-mem/imm32/next
6317 _Primitive-copy-lit-to-mem:
6318
6319 "copy-to"/imm32/name
6320 Int-var-and-literal/imm32/inouts
6321 0/imm32/outputs
6322 "c7 0/subop/copy"/imm32/subx-name
6323 1/imm32/rm32-is-first-inout
6324 0/imm32/no-r32
6325 2/imm32/imm32-is-first-inout
6326 0/imm32/no-disp32
6327 1/imm32/output-is-write-only
6328 _Primitive-compare-mem-with-reg/imm32/next
6329
6330 _Primitive-compare-mem-with-reg:
6331
6332 "compare"/imm32/name
6333 Two-args-int-stack-int-reg/imm32/inouts
6334 0/imm32/outputs
6335 "39/compare->"/imm32/subx-name
6336 1/imm32/rm32-is-first-inout
6337 2/imm32/r32-is-second-inout
6338 0/imm32/no-imm32
6339 0/imm32/no-disp32
6340 0/imm32/output-is-write-only
6341 _Primitive-compare-reg-with-mem/imm32/next
6342 _Primitive-compare-reg-with-mem:
6343
6344 "compare"/imm32/name
6345 Two-args-int-reg-int-stack/imm32/inouts
6346 0/imm32/outputs
6347 "3b/compare<-"/imm32/subx-name
6348 2/imm32/rm32-is-second-inout
6349 1/imm32/r32-is-first-inout
6350 0/imm32/no-imm32
6351 0/imm32/no-disp32
6352 0/imm32/output-is-write-only
6353 _Primitive-compare-eax-with-literal/imm32/next
6354 _Primitive-compare-eax-with-literal:
6355
6356 "compare"/imm32/name
6357 Two-args-int-eax-int-literal/imm32/inouts
6358 0/imm32/outputs
6359 "3d/compare-eax-with"/imm32/subx-name
6360 0/imm32/no-rm32
6361 0/imm32/no-r32
6362 2/imm32/imm32-is-second-inout
6363 0/imm32/no-disp32
6364 0/imm32/output-is-write-only
6365 _Primitive-compare-reg-with-literal/imm32/next
6366 _Primitive-compare-reg-with-literal:
6367
6368 "compare"/imm32/name
6369 Int-var-in-register-and-literal/imm32/inouts
6370 0/imm32/outputs
6371 "81 7/subop/compare"/imm32/subx-name
6372 1/imm32/rm32-is-first-inout
6373 0/imm32/no-r32
6374 2/imm32/imm32-is-second-inout
6375 0/imm32/no-disp32
6376 0/imm32/output-is-write-only
6377 _Primitive-compare-mem-with-literal/imm32/next
6378 _Primitive-compare-mem-with-literal:
6379
6380 "compare"/imm32/name
6381 Int-var-and-literal/imm32/inouts
6382 0/imm32/outputs
6383 "81 7/subop/compare"/imm32/subx-name
6384 1/imm32/rm32-is-first-inout
6385 0/imm32/no-r32
6386 2/imm32/imm32-is-second-inout
6387 0/imm32/no-disp32
6388 0/imm32/output-is-write-only
6389 _Primitive-multiply-reg-by-mem/imm32/next
6390
6391 _Primitive-multiply-reg-by-mem:
6392
6393 "multiply"/imm32/name
6394 Single-int-var-in-mem/imm32/inouts
6395 Single-int-var-in-some-register/imm32/outputs
6396 "0f af/multiply"/imm32/subx-name
6397 1/imm32/rm32-is-first-inout
6398 3/imm32/r32-is-first-output
6399 0/imm32/no-imm32
6400 0/imm32/no-disp32
6401 0/imm32/output-is-write-only
6402 _Primitive-break-if-addr</imm32/next
6403
6404 _Primitive-break-if-addr<:
6405 "break-if-addr<"/imm32/name
6406 0/imm32/inouts
6407 0/imm32/outputs
6408 "0f 82/jump-if-addr< break/disp32"/imm32/subx-name
6409 0/imm32/no-rm32
6410 0/imm32/no-r32
6411 0/imm32/no-imm32
6412 0/imm32/no-disp32
6413 0/imm32/no-output
6414 _Primitive-break-if-addr>=/imm32/next
6415 _Primitive-break-if-addr>=:
6416 "break-if-addr>="/imm32/name
6417 0/imm32/inouts
6418 0/imm32/outputs
6419 "0f 83/jump-if-addr>= break/disp32"/imm32/subx-name
6420 0/imm32/no-rm32
6421 0/imm32/no-r32
6422 0/imm32/no-imm32
6423 0/imm32/no-disp32
6424 0/imm32/no-output
6425 _Primitive-break-if-=/imm32/next
6426 _Primitive-break-if-=:
6427 "break-if-="/imm32/name
6428 0/imm32/inouts
6429 0/imm32/outputs
6430 "0f 84/jump-if-= break/disp32"/imm32/subx-name
6431 0/imm32/no-rm32
6432 0/imm32/no-r32
6433 0/imm32/no-imm32
6434 0/imm32/no-disp32
6435 0/imm32/no-output
6436 _Primitive-break-if-!=/imm32/next
6437 _Primitive-break-if-!=:
6438 "break-if-!="/imm32/name
6439 0/imm32/inouts
6440 0/imm32/outputs
6441 "0f 85/jump-if-!= break/disp32"/imm32/subx-name
6442 0/imm32/no-rm32
6443 0/imm32/no-r32
6444 0/imm32/no-imm32
6445 0/imm32/no-disp32
6446 0/imm32/no-output
6447 _Primitive-break-if-addr<=/imm32/next
6448 _Primitive-break-if-addr<=:
6449 "break-if-addr<="/imm32/name
6450 0/imm32/inouts
6451 0/imm32/outputs
6452 "0f 86/jump-if-addr<= break/disp32"/imm32/subx-name
6453 0/imm32/no-rm32
6454 0/imm32/no-r32
6455 0/imm32/no-imm32
6456 0/imm32/no-disp32
6457 0/imm32/no-output
6458 _Primitive-break-if-addr>/imm32/next
6459 _Primitive-break-if-addr>:
6460 "break-if-addr>"/imm32/name
6461 0/imm32/inouts
6462 0/imm32/outputs
6463 "0f 87/jump-if-addr> break/disp32"/imm32/subx-name
6464 0/imm32/no-rm32
6465 0/imm32/no-r32
6466 0/imm32/no-imm32
6467 0/imm32/no-disp32
6468 0/imm32/no-output
6469 _Primitive-break-if-</imm32/next
6470 _Primitive-break-if-<:
6471 "break-if-<"/imm32/name
6472 0/imm32/inouts
6473 0/imm32/outputs
6474 "0f 8c/jump-if-< break/disp32"/imm32/subx-name
6475 0/imm32/no-rm32
6476 0/imm32/no-r32
6477 0/imm32/no-imm32
6478 0/imm32/no-disp32
6479 0/imm32/no-output
6480 _Primitive-break-if->=/imm32/next
6481 _Primitive-break-if->=:
6482 "break-if->="/imm32/name
6483 0/imm32/inouts
6484 0/imm32/outputs
6485 "0f 8d/jump-if->= break/disp32"/imm32/subx-name
6486 0/imm32/no-rm32
6487 0/imm32/no-r32
6488 0/imm32/no-imm32
6489 0/imm32/no-disp32
6490 0/imm32/no-output
6491 _Primitive-break-if-<=/imm32/next
6492 _Primitive-break-if-<=:
6493 "break-if-<="/imm32/name
6494 0/imm32/inouts
6495 0/imm32/outputs
6496 "0f 8e/jump-if-<= break/disp32"/imm32/subx-name
6497 0/imm32/no-rm32
6498 0/imm32/no-r32
6499 0/imm32/no-imm32
6500 0/imm32/no-disp32
6501 0/imm32/no-output
6502 _Primitive-break-if->/imm32/next
6503 _Primitive-break-if->:
6504 "break-if->"/imm32/name
6505 0/imm32/inouts
6506 0/imm32/outputs
6507 "0f 8f/jump-if-> break/disp32"/imm32/subx-name
6508 0/imm32/no-rm32
6509 0/imm32/no-r32
6510 0/imm32/no-imm32
6511 0/imm32/no-disp32
6512 0/imm32/no-output
6513 _Primitive-break/imm32/next
6514 _Primitive-break:
6515 "break"/imm32/name
6516 0/imm32/inouts
6517 0/imm32/outputs
6518 "e9/jump break/disp32"/imm32/subx-name
6519 0/imm32/no-rm32
6520 0/imm32/no-r32
6521 0/imm32/no-imm32
6522 0/imm32/no-disp32
6523 0/imm32/no-output
6524 _Primitive-loop-if-addr</imm32/next
6525 _Primitive-loop-if-addr<:
6526 "loop-if-addr<"/imm32/name
6527 0/imm32/inouts
6528 0/imm32/outputs
6529 "0f 82/jump-if-addr< loop/disp32"/imm32/subx-name
6530 0/imm32/no-rm32
6531 0/imm32/no-r32
6532 0/imm32/no-imm32
6533 0/imm32/no-disp32
6534 0/imm32/no-output
6535 _Primitive-loop-if-addr>=/imm32/next
6536 _Primitive-loop-if-addr>=:
6537 "loop-if-addr>="/imm32/name
6538 0/imm32/inouts
6539 0/imm32/outputs
6540 "0f 83/jump-if-addr>= loop/disp32"/imm32/subx-name
6541 0/imm32/no-rm32
6542 0/imm32/no-r32
6543 0/imm32/no-imm32
6544 0/imm32/no-disp32
6545 0/imm32/no-output
6546 _Primitive-loop-if-=/imm32/next
6547 _Primitive-loop-if-=:
6548 "loop-if-="/imm32/name
6549 0/imm32/inouts
6550 0/imm32/outputs
6551 "0f 84/jump-if-= loop/disp32"/imm32/subx-name
6552 0/imm32/no-rm32
6553 0/imm32/no-r32
6554 0/imm32/no-imm32
6555 0/imm32/no-disp32
6556 0/imm32/no-output
6557 _Primitive-loop-if-!=/imm32/next
6558 _Primitive-loop-if-!=:
6559 "loop-if-!="/imm32/name
6560 0/imm32/inouts
6561 0/imm32/outputs
6562 "0f 85/jump-if-!= loop/disp32"/imm32/subx-name
6563 0/imm32/no-rm32
6564 0/imm32/no-r32
6565 0/imm32/no-imm32
6566 0/imm32/no-disp32
6567 0/imm32/no-output
6568 _Primitive-loop-if-addr<=/imm32/next
6569 _Primitive-loop-if-addr<=:
6570 "loop-if-addr<="/imm32/name
6571 0/imm32/inouts
6572 0/imm32/outputs
6573 "0f 86/jump-if-addr<= loop/disp32"/imm32/subx-name
6574 0/imm32/no-rm32
6575 0/imm32/no-r32
6576 0/imm32/no-imm32
6577 0/imm32/no-disp32
6578 0/imm32/no-output
6579 _Primitive-loop-if-addr>/imm32/next
6580 _Primitive-loop-if-addr>:
6581 "loop-if-addr>"/imm32/name
6582 0/imm32/inouts
6583 0/imm32/outputs
6584 "0f 87/jump-if-addr> loop/disp32"/imm32/subx-name
6585 0/imm32/no-rm32
6586 0/imm32/no-r32
6587 0/imm32/no-imm32
6588 0/imm32/no-disp32
6589 0/imm32/no-output
6590 _Primitive-loop-if-</imm32/next
6591 _Primitive-loop-if-<:
6592 "loop-if-<"/imm32/name
6593 0/imm32/inouts
6594 0/imm32/outputs
6595 "0f 8c/jump-if-< loop/disp32"/imm32/subx-name
6596 0/imm32/no-rm32
6597 0/imm32/no-r32
6598 0/imm32/no-imm32
6599 0/imm32/no-disp32
6600 0/imm32/no-output
6601 _Primitive-loop-if->=/imm32/next
6602 _Primitive-loop-if->=:
6603 "loop-if->="/imm32/name
6604 0/imm32/inouts
6605 0/imm32/outputs
6606 "0f 8d/jump-if->= loop/disp32"/imm32/subx-name
6607 0/imm32/no-rm32
6608 0/imm32/no-r32
6609 0/imm32/no-imm32
6610 0/imm32/no-disp32
6611 0/imm32/no-output
6612 _Primitive-loop-if-<=/imm32/next
6613 _Primitive-loop-if-<=:
6614 "loop-if-<="/imm32/name
6615 0/imm32/inouts
6616 0/imm32/outputs
6617 "0f 8e/jump-if-<= loop/disp32"/imm32/subx-name
6618 0/imm32/no-rm32
6619 0/imm32/no-r32
6620 0/imm32/no-imm32
6621 0/imm32/no-disp32
6622 0/imm32/no-output
6623 _Primitive-loop-if->/imm32/next
6624 _Primitive-loop-if->:
6625 "loop-if->"/imm32/name
6626 0/imm32/inouts
6627 0/imm32/outputs
6628 "0f 8f/jump-if-> loop/disp32"/imm32/subx-name
6629 0/imm32/no-rm32
6630 0/imm32/no-r32
6631 0/imm32/no-imm32
6632 0/imm32/no-disp32
6633 0/imm32/no-output
6634 _Primitive-loop/imm32/next
6635 _Primitive-loop:
6636 "loop"/imm32/name
6637 0/imm32/inouts
6638 0/imm32/outputs
6639 "e9/jump loop/disp32"/imm32/subx-name
6640 0/imm32/no-rm32
6641 0/imm32/no-r32
6642 0/imm32/no-imm32
6643 0/imm32/no-disp32
6644 0/imm32/no-output
6645 _Primitive-break-if-addr<-named/imm32/next
6646
6647 _Primitive-break-if-addr<-named:
6648 "break-if-addr<"/imm32/name
6649 Single-lit-var/imm32/inouts
6650 0/imm32/outputs
6651 "0f 82/jump-if-addr<"/imm32/subx-name
6652 0/imm32/no-rm32
6653 0/imm32/no-r32
6654 0/imm32/no-imm32
6655 1/imm32/disp32-is-first-inout
6656 0/imm32/no-output
6657 _Primitive-break-if-addr>=-named/imm32/next
6658 _Primitive-break-if-addr>=-named:
6659 "break-if-addr>="/imm32/name
6660 Single-lit-var/imm32/inouts
6661 0/imm32/outputs
6662 "0f 83/jump-if-addr>="/imm32/subx-name
6663 0/imm32/no-rm32
6664 0/imm32/no-r32
6665 0/imm32/no-imm32
6666 1/imm32/disp32-is-first-inout
6667 0/imm32/no-output
6668 _Primitive-break-if-=-named/imm32/next
6669 _Primitive-break-if-=-named:
6670 "break-if-="/imm32/name
6671 Single-lit-var/imm32/inouts
6672 0/imm32/outputs
6673 "0f 84/jump-if-="/imm32/subx-name
6674 0/imm32/no-rm32
6675 0/imm32/no-r32
6676 0/imm32/no-imm32
6677 1/imm32/disp32-is-first-inout
6678 0/imm32/no-output
6679 _Primitive-break-if-!=-named/imm32/next
6680 _Primitive-break-if-!=-named:
6681 "break-if-!="/imm32/name
6682 Single-lit-var/imm32/inouts
6683 0/imm32/outputs
6684 "0f 85/jump-if-!="/imm32/subx-name
6685 0/imm32/no-rm32
6686 0/imm32/no-r32
6687 0/imm32/no-imm32
6688 1/imm32/disp32-is-first-inout
6689 0/imm32/no-output
6690 _Primitive-break-if-addr<=-named/imm32/next
6691 _Primitive-break-if-addr<=-named:
6692 "break-if-addr<="/imm32/name
6693 Single-lit-var/imm32/inouts
6694 0/imm32/outputs
6695 "0f 86/jump-if-addr<="/imm32/subx-name
6696 0/imm32/no-rm32
6697 0/imm32/no-r32
6698 0/imm32/no-imm32
6699 1/imm32/disp32-is-first-inout
6700 0/imm32/no-output
6701 _Primitive-break-if-addr>-named/imm32/next
6702 _Primitive-break-if-addr>-named:
6703 "break-if-addr>"/imm32/name
6704 Single-lit-var/imm32/inouts
6705 0/imm32/outputs
6706 "0f 87/jump-if-addr>"/imm32/subx-name
6707 0/imm32/no-rm32
6708 0/imm32/no-r32
6709 0/imm32/no-imm32
6710 1/imm32/disp32-is-first-inout
6711 0/imm32/no-output
6712 _Primitive-break-if-<-named/imm32/next
6713 _Primitive-break-if-<-named:
6714 "break-if-<"/imm32/name
6715 Single-lit-var/imm32/inouts
6716 0/imm32/outputs
6717 "0f 8c/jump-if-<"/imm32/subx-name
6718 0/imm32/no-rm32
6719 0/imm32/no-r32
6720 0/imm32/no-imm32
6721 1/imm32/disp32-is-first-inout
6722 0/imm32/no-output
6723 _Primitive-break-if->=-named/imm32/next
6724 _Primitive-break-if->=-named:
6725 "break-if->="/imm32/name
6726 Single-lit-var/imm32/inouts
6727 0/imm32/outputs
6728 "0f 8d/jump-if->="/imm32/subx-name
6729 0/imm32/no-rm32
6730 0/imm32/no-r32
6731 0/imm32/no-imm32
6732 1/imm32/disp32-is-first-inout
6733 0/imm32/no-output
6734 _Primitive-break-if-<=-named/imm32/next
6735 _Primitive-break-if-<=-named:
6736 "break-if-<="/imm32/name
6737 Single-lit-var/imm32/inouts
6738 0/imm32/outputs
6739 "0f 8e/jump-if-<="/imm32/subx-name
6740 0/imm32/no-rm32
6741 0/imm32/no-r32
6742 0/imm32/no-imm32
6743 1/imm32/disp32-is-first-inout
6744 0/imm32/no-output
6745 _Primitive-break-if->-named/imm32/next
6746 _Primitive-break-if->-named:
6747 "break-if->"/imm32/name
6748 Single-lit-var/imm32/inouts
6749 0/imm32/outputs
6750 "0f 8f/jump-if->"/imm32/subx-name
6751 0/imm32/no-rm32
6752 0/imm32/no-r32
6753 0/imm32/no-imm32
6754 1/imm32/disp32-is-first-inout
6755 0/imm32/no-output
6756 _Primitive-break-named/imm32/next
6757 _Primitive-break-named:
6758 "break"/imm32/name
6759 Single-lit-var/imm32/inouts
6760 0/imm32/outputs
6761 "e9/jump"/imm32/subx-name
6762 0/imm32/no-rm32
6763 0/imm32/no-r32
6764 0/imm32/no-imm32
6765 1/imm32/disp32-is-first-inout
6766 0/imm32/no-output
6767 _Primitive-loop-if-addr<-named/imm32/next
6768 _Primitive-loop-if-addr<-named:
6769 "loop-if-addr<"/imm32/name
6770 Single-lit-var/imm32/inouts
6771 0/imm32/outputs
6772 "0f 82/jump-if-addr<"/imm32/subx-name
6773 0/imm32/no-rm32
6774 0/imm32/no-r32
6775 0/imm32/no-imm32
6776 1/imm32/disp32-is-first-inout
6777 0/imm32/no-output
6778 _Primitive-loop-if-addr>=-named/imm32/next
6779 _Primitive-loop-if-addr>=-named:
6780 "loop-if-addr>="/imm32/name
6781 Single-lit-var/imm32/inouts
6782 0/imm32/outputs
6783 "0f 83/jump-if-addr>="/imm32/subx-name
6784 0/imm32/no-rm32
6785 0/imm32/no-r32
6786 0/imm32/no-imm32
6787 1/imm32/disp32-is-first-inout
6788 0/imm32/no-output
6789 _Primitive-loop-if-=-named/imm32/next
6790 _Primitive-loop-if-=-named:
6791 "loop-if-="/imm32/name
6792 Single-lit-var/imm32/inouts
6793 0/imm32/outputs
6794 "0f 84/jump-if-="/imm32/subx-name
6795 0/imm32/no-rm32
6796 0/imm32/no-r32
6797 0/imm32/no-imm32
6798 1/imm32/disp32-is-first-inout
6799 0/imm32/no-output
6800 _Primitive-loop-if-!=-named/imm32/next
6801 _Primitive-loop-if-!=-named:
6802 "loop-if-!="/imm32/name
6803 Single-lit-var/imm32/inouts
6804 0/imm32/outputs
6805 "0f 85/jump-if-!="/imm32/subx-name
6806 0/imm32/no-rm32
6807 0/imm32/no-r32
6808 0/imm32/no-imm32
6809 1/imm32/disp32-is-first-inout
6810 0/imm32/no-output
6811 _Primitive-loop-if-addr<=-named/imm32/next
6812 _Primitive-loop-if-addr<=-named:
6813 "loop-if-addr<="/imm32/name
6814 Single-lit-var/imm32/inouts
6815 0/imm32/outputs
6816 "0f 86/jump-if-addr<="/imm32/subx-name
6817 0/imm32/no-rm32
6818 0/imm32/no-r32
6819 0/imm32/no-imm32
6820 1/imm32/disp32-is-first-inout
6821 0/imm32/no-output
6822 _Primitive-loop-if-addr>-named/imm32/next
6823 _Primitive-loop-if-addr>-named:
6824 "loop-if-addr>"/imm32/name
6825 Single-lit-var/imm32/inouts
6826 0/imm32/outputs
6827 "0f 87/jump-if-addr>"/imm32/subx-name
6828 0/imm32/no-rm32
6829 0/imm32/no-r32
6830 0/imm32/no-imm32
6831 1/imm32/disp32-is-first-inout
6832 0/imm32/no-output
6833 _Primitive-loop-if-<-named/imm32/next
6834 _Primitive-loop-if-<-named:
6835 "loop-if-<"/imm32/name
6836 Single-lit-var/imm32/inouts
6837 0/imm32/outputs
6838 "0f 8c/jump-if-<"/imm32/subx-name
6839 0/imm32/no-rm32
6840 0/imm32/no-r32
6841 0/imm32/no-imm32
6842 1/imm32/disp32-is-first-inout
6843 0/imm32/no-output
6844 _Primitive-loop-if->=-named/imm32/next
6845 _Primitive-loop-if->=-named:
6846 "loop-if->="/imm32/name
6847 Single-lit-var/imm32/inouts
6848 0/imm32/outputs
6849 "0f 8d/jump-if->="/imm32/subx-name
6850 0/imm32/no-rm32
6851 0/imm32/no-r32
6852 0/imm32/no-imm32
6853 1/imm32/disp32-is-first-inout
6854 0/imm32/no-output
6855 _Primitive-loop-if-<=-named/imm32/next
6856 _Primitive-loop-if-<=-named:
6857 "loop-if-<="/imm32/name
6858 Single-lit-var/imm32/inouts
6859 0/imm32/outputs
6860 "0f 8e/jump-if-<="/imm32/subx-name
6861 0/imm32/no-rm32
6862 0/imm32/no-r32
6863 0/imm32/no-imm32
6864 1/imm32/disp32-is-first-inout
6865 0/imm32/no-output
6866 _Primitive-loop-if->-named/imm32/next
6867 _Primitive-loop-if->-named:
6868 "loop-if->"/imm32/name
6869 Single-lit-var/imm32/inouts
6870 0/imm32/outputs
6871 "0f 8f/jump-if->"/imm32/subx-name
6872 0/imm32/no-rm32
6873 0/imm32/no-r32
6874 0/imm32/no-imm32
6875 1/imm32/disp32-is-first-inout
6876 0/imm32/no-output
6877 _Primitive-loop-named/imm32/next
6878 _Primitive-loop-named:
6879 "loop"/imm32/name
6880 Single-lit-var/imm32/inouts
6881 0/imm32/outputs
6882 "e9/jump"/imm32/subx-name
6883 0/imm32/no-rm32
6884 0/imm32/no-r32
6885 0/imm32/no-imm32
6886 1/imm32/disp32-is-first-inout
6887 0/imm32/no-output
6888 0/imm32/next
6889
6890 Single-int-var-in-mem:
6891 Int-var-in-mem/imm32
6892 0/imm32/next
6893
6894 Int-var-in-mem:
6895 "arg1"/imm32/name
6896 Type-int/imm32
6897 1/imm32/some-block-depth
6898 1/imm32/some-stack-offset
6899 0/imm32/no-register
6900
6901 Two-args-int-stack-int-reg:
6902 Int-var-in-mem/imm32
6903 Single-int-var-in-some-register/imm32/next
6904
6905 Two-args-int-reg-int-stack:
6906 Int-var-in-some-register/imm32
6907 Single-int-var-in-mem/imm32/next
6908
6909 Two-args-int-eax-int-literal:
6910 Int-var-in-eax/imm32
6911 Single-lit-var/imm32/next
6912
6913 Int-var-and-literal:
6914 Int-var-in-mem/imm32
6915 Single-lit-var/imm32/next
6916
6917 Int-var-in-register-and-literal:
6918 Int-var-in-some-register/imm32
6919 Single-lit-var/imm32/next
6920
6921 Single-int-var-in-some-register:
6922 Int-var-in-some-register/imm32
6923 0/imm32/next
6924
6925 Int-var-in-some-register:
6926 "arg1"/imm32/name
6927 Type-int/imm32
6928 1/imm32/some-block-depth
6929 0/imm32/no-stack-offset
6930 Any-register/imm32
6931
6932 Single-int-var-in-eax:
6933 Int-var-in-eax/imm32
6934 0/imm32/next
6935
6936 Int-var-in-eax:
6937 "arg1"/imm32/name
6938 Type-int/imm32
6939 1/imm32/some-block-depth
6940 0/imm32/no-stack-offset
6941 "eax"/imm32/register
6942
6943 Single-int-var-in-ecx:
6944 Int-var-in-ecx/imm32
6945 0/imm32/next
6946
6947 Int-var-in-ecx:
6948 "arg1"/imm32/name
6949 Type-int/imm32
6950 1/imm32/some-block-depth
6951 0/imm32/no-stack-offset
6952 "ecx"/imm32/register
6953
6954 Single-int-var-in-edx:
6955 Int-var-in-edx/imm32
6956 0/imm32/next
6957
6958 Int-var-in-edx:
6959 "arg1"/imm32/name
6960 Type-int/imm32
6961 1/imm32/some-block-depth
6962 0/imm32/no-stack-offset
6963 "edx"/imm32/register
6964
6965 Single-int-var-in-ebx:
6966 Int-var-in-ebx/imm32
6967 0/imm32/next
6968
6969 Int-var-in-ebx:
6970 "arg1"/imm32/name
6971 Type-int/imm32
6972 1/imm32/some-block-depth
6973 0/imm32/no-stack-offset
6974 "ebx"/imm32/register
6975
6976 Single-int-var-in-esi:
6977 Int-var-in-esi/imm32
6978 0/imm32/next
6979
6980 Int-var-in-esi:
6981 "arg1"/imm32/name
6982 Type-int/imm32
6983 1/imm32/some-block-depth
6984 0/imm32/no-stack-offset
6985 "esi"/imm32/register
6986
6987 Single-int-var-in-edi:
6988 Int-var-in-edi/imm32
6989 0/imm32/next
6990
6991 Int-var-in-edi:
6992 "arg1"/imm32/name
6993 Type-int/imm32
6994 1/imm32/some-block-depth
6995 0/imm32/no-stack-offset
6996 "edi"/imm32/register
6997
6998 Single-lit-var:
6999 Lit-var/imm32
7000 0/imm32/next
7001
7002 Lit-var:
7003 "literal"/imm32/name
7004 Type-literal/imm32
7005 1/imm32/some-block-depth
7006 0/imm32/no-stack-offset
7007 0/imm32/no-register
7008
7009 Type-int:
7010 1/imm32/left/int
7011 0/imm32/right/null
7012
7013 Type-literal:
7014 0/imm32/left/literal
7015 0/imm32/right/null
7016
7017 == code
7018 emit-subx-primitive:
7019
7020 55/push-ebp
7021 89/<- %ebp 4/r32/esp
7022
7023 50/push-eax
7024 51/push-ecx
7025
7026 8b/-> *(ebp+0x10) 1/r32/ecx
7027
7028 (emit-indent *(ebp+8) *Curr-block-depth)
7029 (write-buffered *(ebp+8) *(ecx+0xc))
7030
7031 (emit-subx-rm32 *(ebp+8) *(ecx+0x10) *(ebp+0xc))
7032
7033 (emit-subx-r32 *(ebp+8) *(ecx+0x14) *(ebp+0xc))
7034
7035 (emit-subx-imm32 *(ebp+8) *(ecx+0x18) *(ebp+0xc))
7036
7037 (emit-subx-disp32 *(ebp+8) *(ecx+0x1c) *(ebp+0xc))
7038 (write-buffered *(ebp+8) Newline)
7039 $emit-subx-primitive:end:
7040
7041 59/pop-to-ecx
7042 58/pop-to-eax
7043
7044 89/<- %esp 5/r32/ebp
7045 5d/pop-to-ebp
7046 c3/return
7047
7048 emit-subx-rm32:
7049
7050 55/push-ebp
7051 89/<- %ebp 4/r32/esp
7052
7053 50/push-eax
7054
7055 81 7/subop/compare *(ebp+0xc) 0/imm32
7056 74/jump-if-= $emit-subx-rm32:end/disp8
7057
7058 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
7059 (emit-subx-var-as-rm32 *(ebp+8) %eax)
7060 $emit-subx-rm32:end:
7061
7062 58/pop-to-eax
7063
7064 89/<- %esp 5/r32/ebp
7065 5d/pop-to-ebp
7066 c3/return
7067
7068 get-stmt-operand-from-arg-location:
7069
7070 55/push-ebp
7071 89/<- %ebp 4/r32/esp
7072
7073 51/push-ecx
7074
7075 8b/-> *(ebp+0xc) 0/r32/eax
7076
7077 8b/-> *(ebp+8) 1/r32/ecx
7078
7079 {
7080 3d/compare-eax-and 1/imm32
7081 75/jump-if-!= break/disp8
7082 $get-stmt-operand-from-arg-location:1:
7083 8b/-> *(ecx+8) 0/r32/eax
7084 eb/jump $get-stmt-operand-from-arg-location:end/disp8
7085 }
7086
7087 {
7088 3d/compare-eax-and 2/imm32
7089 75/jump-if-!= break/disp8
7090 $get-stmt-operand-from-arg-location:2:
7091 8b/-> *(ecx+8) 0/r32/eax
7092 8b/-> *(eax+4) 0/r32/eax
7093 eb/jump $get-stmt-operand-from-arg-location:end/disp8
7094 }
7095
7096 {
7097 3d/compare-eax-and 3/imm32
7098 75/jump-if-!= break/disp8
7099 $get-stmt-operand-from-arg-location:3:
7100 8b/-> *(ecx+0xc) 0/r32/eax
7101 eb/jump $get-stmt-operand-from-arg-location:end/disp8
7102 }
7103
7104 e9/jump $get-stmt-operand-from-arg-location:abort/disp32
7105 $get-stmt-operand-from-arg-location:end:
7106
7107 59/pop-to-ecx
7108
7109 89/<- %esp 5/r32/ebp
7110 5d/pop-to-ebp
7111 c3/return
7112
7113 $get-stmt-operand-from-arg-location:abort:
7114
7115 (write-buffered Stderr "invalid arg-location ")
7116 (print-int32-buffered Stderr %eax)
7117 (write-buffered Stderr Newline)
7118 (flush Stderr)
7119
7120 bb/copy-to-ebx 1/imm32
7121 b8/copy-to-eax 1/imm32/exit
7122 cd/syscall 0x80/imm8
7123
7124
7125 emit-subx-r32:
7126
7127 55/push-ebp
7128 89/<- %ebp 4/r32/esp
7129
7130 50/push-eax
7131 51/push-ecx
7132
7133 81 7/subop/compare *(ebp+0xc) 0/imm32
7134 0f 84/jump-if-= $emit-subx-r32:end/disp32
7135
7136 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
7137 8b/-> *eax 0/r32/eax
7138 (maybe-get Registers *(eax+0x10) 8)
7139 (write-buffered *(ebp+8) Space)
7140 (print-int32-buffered *(ebp+8) *eax)
7141 (write-buffered *(ebp+8) "/r32")
7142 $emit-subx-r32:end:
7143
7144 59/pop-to-ecx
7145 58/pop-to-eax
7146
7147 89/<- %esp 5/r32/ebp
7148 5d/pop-to-ebp
7149 c3/return
7150
7151 emit-subx-imm32:
7152
7153 55/push-ebp
7154 89/<- %ebp 4/r32/esp
7155
7156 50/push-eax
7157 51/push-ecx
7158
7159 81 7/subop/compare *(ebp+0xc) 0/imm32
7160 74/jump-if-= $emit-subx-imm32:end/disp8
7161
7162 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
7163 8b/-> *eax 0/r32/eax
7164 (write-buffered *(ebp+8) Space)
7165 (write-buffered *(ebp+8) *eax)
7166 (write-buffered *(ebp+8) "/imm32")
7167 $emit-subx-imm32:end:
7168
7169 59/pop-to-ecx
7170 58/pop-to-eax
7171
7172 89/<- %esp 5/r32/ebp
7173 5d/pop-to-ebp
7174 c3/return
7175
7176 emit-subx-disp32:
7177
7178 55/push-ebp
7179 89/<- %ebp 4/r32/esp
7180
7181 50/push-eax
7182 51/push-ecx
7183
7184 81 7/subop/compare *(ebp+0xc) 0/imm32
7185 0f 84/jump-if-= $emit-subx-disp32:end/disp32
7186
7187 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
7188 8b/-> *eax 0/r32/eax
7189 (write-buffered *(ebp+8) Space)
7190 (write-buffered *(ebp+8) *eax)
7191
7192
7193 8b/-> *(ebp+0x10) 0/r32/eax
7194 8b/-> *(eax+4) 1/r32/ecx
7195 {
7196 (string-starts-with? %ecx "break")
7197 3d/compare-eax-and 0/imm32/false
7198 74/jump-if-= break/disp8
7199 (write-buffered *(ebp+8) ":break")
7200 }
7201
7202 {
7203 (string-starts-with? %ecx "loop")
7204 3d/compare-eax-and 0/imm32/false
7205 74/jump-if-= break/disp8
7206 (write-buffered *(ebp+8) ":loop")
7207 }
7208 (write-buffered *(ebp+8) "/disp32")
7209 $emit-subx-disp32:end:
7210
7211 59/pop-to-ecx
7212 58/pop-to-eax
7213
7214 89/<- %esp 5/r32/ebp
7215 5d/pop-to-ebp
7216 c3/return
7217
7218 emit-subx-call:
7219
7220 55/push-ebp
7221 89/<- %ebp 4/r32/esp
7222
7223 51/push-ecx
7224
7225 (emit-indent *(ebp+8) *Curr-block-depth)
7226 (write-buffered *(ebp+8) "(")
7227
7228 8b/-> *(ebp+0x10) 1/r32/ecx
7229 (write-buffered *(ebp+8) *(ecx+4))
7230
7231
7232 8b/-> *(ebp+0xc) 1/r32/ecx
7233 8b/-> *(ecx+8) 1/r32/ecx
7234 {
7235
7236 81 7/subop/compare %ecx 0/imm32
7237 74/jump-if-= break/disp8
7238
7239 (emit-subx-call-operand *(ebp+8) %ecx)
7240
7241 8b/-> *(ecx+4) 1/r32/ecx
7242 eb/jump loop/disp8
7243 }
7244
7245 (write-buffered *(ebp+8) ")\n")
7246 $emit-subx-call:end:
7247
7248 59/pop-to-ecx
7249
7250 89/<- %esp 5/r32/ebp
7251 5d/pop-to-ebp
7252 c3/return
7253
7254
7255
7256 emit-hailmary-call:
7257
7258 55/push-ebp
7259 89/<- %ebp 4/r32/esp
7260
7261 51/push-ecx
7262
7263 (emit-indent *(ebp+8) *Curr-block-depth)
7264 (write-buffered *(ebp+8) "(")
7265
7266 8b/-> *(ebp+0xc) 1/r32/ecx
7267
7268 (write-buffered *(ebp+8) *(ecx+4))
7269
7270
7271 8b/-> *(ecx+8) 1/r32/ecx
7272 {
7273
7274 81 7/subop/compare %ecx 0/imm32
7275 74/jump-if-= break/disp8
7276
7277 (emit-subx-call-operand *(ebp+8) %ecx)
7278
7279 8b/-> *(ecx+4) 1/r32/ecx
7280 eb/jump loop/disp8
7281 }
7282
7283 (write-buffered *(ebp+8) ")\n")
7284 $emit-hailmary-call:end:
7285
7286 59/pop-to-ecx
7287
7288 89/<- %esp 5/r32/ebp
7289 5d/pop-to-ebp
7290 c3/return
7291
7292 emit-subx-call-operand:
7293
7294
7295 55/push-ebp
7296 89/<- %ebp 4/r32/esp
7297
7298 50/push-eax
7299 51/push-ecx
7300 56/push-esi
7301
7302 8b/-> *(ebp+0xc) 1/r32/ecx
7303
7304 8b/-> *ecx 6/r32/esi
7305
7306 {
7307 $emit-subx-call-operand:check-for-register-indirect:
7308 81 7/subop/compare *(esi+0x10) 0/imm32
7309 74/jump-if-= break/disp8
7310 81 7/subop/compare *(ecx+8) 0/imm32/false
7311 74/jump-if-= break/disp8
7312 $emit-subx-call-operand:register-indirect:
7313 (write-buffered *(ebp+8) " *")
7314 (write-buffered *(ebp+8) *(esi+0x10))
7315 e9/jump $emit-subx-call-operand:end/disp32
7316 }
7317
7318 {
7319 $emit-subx-call-operand:check-for-register-direct:
7320 81 7/subop/compare *(esi+0x10) 0/imm32
7321 74/jump-if-= break/disp8
7322 81 7/subop/compare *(ecx+8) 0/imm32/false
7323 75/jump-if-!= break/disp8
7324 $emit-subx-call-operand:register-direct:
7325 (write-buffered *(ebp+8) " %")
7326 (write-buffered *(ebp+8) *(esi+0x10))
7327 e9/jump $emit-subx-call-operand:end/disp32
7328 }
7329
7330 {
7331 81 7/subop/compare *(esi+0xc) 0/imm32
7332 74/jump-if-= break/disp8
7333 $emit-subx-call-operand:stack:
7334 (write-buffered *(ebp+8) Space)
7335 (write-buffered *(ebp+8) "*(ebp+")
7336 (print-int32-buffered *(ebp+8) *(esi+0xc))
7337 (write-buffered *(ebp+8) ")")
7338 e9/jump $emit-subx-call-operand:end/disp32
7339 }
7340
7341 {
7342 8b/-> *(esi+4) 0/r32/eax
7343 81 7/subop/compare *eax 0/imm32
7344 75/jump-if-!= break/disp8
7345 $emit-subx-call-operand:literal:
7346 (write-buffered *(ebp+8) Space)
7347 (write-buffered *(ebp+8) *esi)
7348 }
7349 $emit-subx-call-operand:end:
7350
7351 5e/pop-to-esi
7352 59/pop-to-ecx
7353 58/pop-to-eax
7354
7355 89/<- %esp 5/r32/ebp
7356 5d/pop-to-ebp
7357 c3/return
7358
7359 emit-subx-var-as-rm32:
7360
7361 55/push-ebp
7362 89/<- %ebp 4/r32/esp
7363
7364 50/push-eax
7365 51/push-ecx
7366 56/push-esi
7367
7368 8b/-> *(ebp+0xc) 1/r32/ecx
7369
7370 8b/-> *ecx 6/r32/esi
7371
7372 {
7373 $emit-subx-var-as-rm32:check-for-register-indirect:
7374 81 7/subop/compare *(esi+0x10) 0/imm32
7375 74/jump-if-= break/disp8
7376 81 7/subop/compare *(ecx+8) 0/imm32/false
7377 74/jump-if-= break/disp8
7378 $emit-subx-var-as-rm32:register-indirect:
7379 (write-buffered *(ebp+8) " *")
7380 (write-buffered *(ebp+8) *(esi+0x10))
7381 }
7382
7383 {
7384 $emit-subx-var-as-rm32:check-for-register-direct:
7385 81 7/subop/compare *(esi+0x10) 0/imm32
7386 74/jump-if-= break/disp8
7387 81 7/subop/compare *(ecx+8) 0/imm32/false
7388 75/jump-if-!= break/disp8
7389 $emit-subx-var-as-rm32:register-direct:
7390 (write-buffered *(ebp+8) " %")
7391 (write-buffered *(ebp+8) *(esi+0x10))
7392 }
7393
7394 {
7395 81 7/subop/compare *(esi+0xc) 0/imm32
7396 74/jump-if-= break/disp8
7397 $emit-subx-var-as-rm32:stack:
7398 (write-buffered *(ebp+8) Space)
7399 (write-buffered *(ebp+8) "*(ebp+")
7400 (print-int32-buffered *(ebp+8) *(esi+0xc))
7401 (write-buffered *(ebp+8) ")")
7402 }
7403 $emit-subx-var-as-rm32:end:
7404
7405 5e/pop-to-esi
7406 59/pop-to-ecx
7407 58/pop-to-eax
7408
7409 89/<- %esp 5/r32/ebp
7410 5d/pop-to-ebp
7411 c3/return
7412
7413 find-matching-function:
7414
7415 55/push-ebp
7416 89/<- %ebp 4/r32/esp
7417
7418 51/push-ecx
7419
7420 8b/-> *(ebp+8) 1/r32/ecx
7421 {
7422
7423 81 7/subop/compare %ecx 0/imm32
7424 74/jump-if-= break/disp8
7425
7426 {
7427 (mu-stmt-matches-function? *(ebp+0xc) %ecx)
7428 3d/compare-eax-and 0/imm32/false
7429 74/jump-if-= break/disp8
7430 89/<- %eax 1/r32/ecx
7431 eb/jump $find-matching-function:end/disp8
7432 }
7433
7434 8b/-> *(ecx+0x14) 1/r32/ecx
7435 eb/jump loop/disp8
7436 }
7437
7438 b8/copy-to-eax 0/imm32
7439 $find-matching-function:end:
7440
7441 59/pop-to-ecx
7442
7443 89/<- %esp 5/r32/ebp
7444 5d/pop-to-ebp
7445 c3/return
7446
7447 find-matching-primitive:
7448
7449 55/push-ebp
7450 89/<- %ebp 4/r32/esp
7451
7452 51/push-ecx
7453
7454 8b/-> *(ebp+8) 1/r32/ecx
7455 {
7456 $find-matching-primitive:loop:
7457
7458 81 7/subop/compare %ecx 0/imm32
7459 0f 84/jump-if-= break/disp32
7460
7461
7462
7463
7464
7465
7466
7467 {
7468 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx)
7469 3d/compare-eax-and 0/imm32/false
7470 74/jump-if-= break/disp8
7471 89/<- %eax 1/r32/ecx
7472 eb/jump $find-matching-primitive:end/disp8
7473 }
7474 $find-matching-primitive:next-primitive:
7475
7476 8b/-> *(ecx+0x24) 1/r32/ecx
7477 e9/jump loop/disp32
7478 }
7479
7480 b8/copy-to-eax 0/imm32
7481 $find-matching-primitive:end:
7482
7483 59/pop-to-ecx
7484
7485 89/<- %esp 5/r32/ebp
7486 5d/pop-to-ebp
7487 c3/return
7488
7489 mu-stmt-matches-function?:
7490
7491 55/push-ebp
7492 89/<- %ebp 4/r32/esp
7493
7494 51/push-ecx
7495
7496 8b/-> *(ebp+8) 1/r32/ecx
7497 8b/-> *(ebp+0xc) 0/r32/eax
7498 (string-equal? *(ecx+4) *eax)
7499 $mu-stmt-matches-function?:end:
7500
7501 59/pop-to-ecx
7502
7503 89/<- %esp 5/r32/ebp
7504 5d/pop-to-ebp
7505 c3/return
7506
7507 mu-stmt-matches-primitive?:
7508
7509
7510
7511
7512
7513
7514 55/push-ebp
7515 89/<- %ebp 4/r32/esp
7516
7517 51/push-ecx
7518 52/push-edx
7519 53/push-ebx
7520 56/push-esi
7521 57/push-edi
7522
7523 8b/-> *(ebp+8) 1/r32/ecx
7524
7525 8b/-> *(ebp+0xc) 2/r32/edx
7526 {
7527 $mu-stmt-matches-primitive?:check-name:
7528
7529 (string-equal? *(ecx+4) *edx)
7530 3d/compare-eax-and 0/imm32/false
7531 75/jump-if-!= break/disp8
7532 b8/copy-to-eax 0/imm32
7533 e9/jump $mu-stmt-matches-primitive?:end/disp32
7534 }
7535 $mu-stmt-matches-primitive?:check-inouts:
7536
7537 8b/-> *(ecx+8) 6/r32/esi
7538 8b/-> *(edx+4) 7/r32/edi
7539 {
7540
7541 {
7542 81 7/subop/compare %esi 0/imm32
7543 75/jump-if-!= break/disp8
7544 $mu-stmt-matches-primitive?:stmt-inout-is-null:
7545 {
7546 81 7/subop/compare %edi 0/imm32
7547 75/jump-if-!= break/disp8
7548
7549 e9/jump $mu-stmt-matches-primitive?:check-outputs/disp32
7550 }
7551
7552 b8/copy-to-eax 0/imm32/false
7553 e9/jump $mu-stmt-matches-primitive?:end/disp32
7554 }
7555
7556 {
7557 81 7/subop/compare %edi 0/imm32
7558 75/jump-if-!= break/disp8
7559 $mu-stmt-matches-primitive?:prim-inout-is-null:
7560 b8/copy-to-eax 0/imm32/false
7561 e9/jump $mu-stmt-matches-primitive?:end/disp32
7562 }
7563
7564 {
7565 (operand-matches-primitive? %esi *edi)
7566 3d/compare-eax-and 0/imm32/false
7567 75/jump-if-!= break/disp8
7568 b8/copy-to-eax 0/imm32/false
7569 e9/jump $mu-stmt-matches-primitive?:end/disp32
7570 }
7571
7572 8b/-> *(esi+4) 6/r32/esi
7573
7574 8b/-> *(edi+4) 7/r32/edi
7575 eb/jump loop/disp8
7576 }
7577 $mu-stmt-matches-primitive?:check-outputs:
7578
7579 8b/-> *(ecx+0xc) 6/r32/esi
7580 8b/-> *(edx+8) 7/r32/edi
7581 {
7582
7583 {
7584 $mu-stmt-matches-primitive?:check-output:
7585 81 7/subop/compare %esi 0/imm32
7586 75/jump-if-!= break/disp8
7587 {
7588 81 7/subop/compare %edi 0/imm32
7589 75/jump-if-!= break/disp8
7590
7591 b8/copy-to-eax 1/imm32
7592 e9/jump $mu-stmt-matches-primitive?:end/disp32
7593 }
7594
7595 b8/copy-to-eax 0/imm32
7596 e9/jump $mu-stmt-matches-primitive?:end/disp32
7597 }
7598
7599 {
7600 81 7/subop/compare %edi 0/imm32
7601 75/jump-if-!= break/disp8
7602 b8/copy-to-eax 0/imm32
7603 e9/jump $mu-stmt-matches-primitive?:end/disp32
7604 }
7605
7606 {
7607 (operand-matches-primitive? %esi *edi)
7608 3d/compare-eax-and 0/imm32/false
7609 75/jump-if-!= break/disp8
7610 b8/copy-to-eax 0/imm32
7611 e9/jump $mu-stmt-matches-primitive?:end/disp32
7612 }
7613
7614 8b/-> *(esi+4) 6/r32/esi
7615
7616 8b/-> *(edi+4) 7/r32/edi
7617 eb/jump loop/disp8
7618 }
7619 $mu-stmt-matches-primitive?:return-true:
7620 b8/copy-to-eax 1/imm32
7621 $mu-stmt-matches-primitive?:end:
7622
7623 5f/pop-to-edi
7624 5e/pop-to-esi
7625 5b/pop-to-ebx
7626 5a/pop-to-edx
7627 59/pop-to-ecx
7628
7629 89/<- %esp 5/r32/ebp
7630 5d/pop-to-ebp
7631 c3/return
7632
7633 operand-matches-primitive?:
7634
7635 55/push-ebp
7636 89/<- %ebp 4/r32/esp
7637
7638 51/push-ecx
7639 56/push-esi
7640 57/push-edi
7641
7642 8b/-> *(ebp+8) 1/r32/ecx
7643
7644 8b/-> *ecx 6/r32/esi
7645
7646 8b/-> *(ebp+0xc) 7/r32/edi
7647 $operand-matches-primitive?:check-type:
7648
7649 (subx-type-equal? *(esi+4) *(edi+4))
7650 3d/compare-eax-and 0/imm32/false
7651 b8/copy-to-eax 0/imm32/false
7652 0f 84/jump-if-= $operand-matches-primitive?:end/disp32
7653 {
7654 $operand-matches-primitive?:check-register:
7655
7656 {
7657 81 7/subop/compare *(edi+0x10) 0/imm32
7658 0f 85/jump-if-!= break/disp32
7659 81 7/subop/compare *(esi+0x10) 0/imm32
7660 74/jump-if-= break/disp8
7661 81 7/subop/compare *(ecx+8) 0/imm32/false
7662 74/jump-if-= break/disp8
7663 e9/jump $operand-matches-primitive?:return-true/disp32
7664 }
7665
7666 {
7667 81 7/subop/compare *(edi+0x10) 0/imm32
7668 0f 84/jump-if-= break/disp32
7669 81 7/subop/compare *(esi+0x10) 0/imm32
7670 0f 84/jump-if-= break/disp32
7671 81 7/subop/compare *(ecx+8) 0/imm32/false
7672 74/jump-if-= break/disp8
7673 e9/jump $operand-matches-primitive?:return-false/disp32
7674 }
7675
7676 {
7677
7678 8b/-> *(esi+0x10) 0/r32/eax
7679 39/compare *(edi+0x10) 0/r32/eax
7680 74/jump-if-= break/disp8
7681
7682 3d/compare-eax-and 0/imm32
7683 74/jump-if-= $operand-matches-primitive?:end/disp8
7684 81 7/subop/compare *(edi+0x10) 0/imm32
7685 74/jump-if-= $operand-matches-primitive?:return-false/disp8
7686
7687 (string-equal? *(edi+0x10) Any-register)
7688 3d/compare-eax-and 0/imm32/false
7689 75/jump-if-!= break/disp8
7690
7691 (string-equal? *(esi+0x10) *(edi+0x10))
7692 3d/compare-eax-and 0/imm32/false
7693 74/jump-if-= $operand-matches-primitive?:return-false/disp8
7694 }
7695 }
7696 $operand-matches-primitive?:return-true:
7697 b8/copy-to-eax 1/imm32/true
7698 eb/jump $operand-matches-primitive?:end/disp8
7699 $operand-matches-primitive?:return-false:
7700 b8/copy-to-eax 0/imm32/false
7701 $operand-matches-primitive?:end:
7702
7703 5f/pop-to-edi
7704 5e/pop-to-esi
7705 59/pop-to-ecx
7706
7707 89/<- %esp 5/r32/ebp
7708 5d/pop-to-ebp
7709 c3/return
7710
7711 subx-type-equal?:
7712
7713 55/push-ebp
7714 89/<- %ebp 4/r32/esp
7715
7716 51/push-ecx
7717
7718 (is-literal-type? *(ebp+8))
7719 89/<- %ecx 0/r32/eax
7720
7721 (is-literal-type? *(ebp+0xc))
7722
7723 39/compare %eax 1/r32/ecx
7724 74/jump-if-= $subx-type-equal?:true/disp8
7725 $subx-type-equal?:false:
7726 b8/copy-to-eax 0/imm32/false
7727 eb/jump $subx-type-equal?:end/disp8
7728 $subx-type-equal?:true:
7729 b8/copy-to-eax 1/imm32/true
7730 $subx-type-equal?:end:
7731
7732 59/pop-to-ecx
7733
7734 89/<- %esp 5/r32/ebp
7735 5d/pop-to-ebp
7736 c3/return
7737
7738 is-literal-type?:
7739
7740 55/push-ebp
7741 89/<- %ebp 4/r32/esp
7742
7743 8b/-> *(ebp+8) 0/r32/eax
7744 8b/-> *eax 0/r32/eax
7745 3d/compare-eax-and 0/imm32/false
7746 74/jump-if-equal $is-literal-type?:end/disp8
7747 b8/copy-to-eax 1/imm32/true
7748 $is-literal-type?:end:
7749
7750 89/<- %esp 5/r32/ebp
7751 5d/pop-to-ebp
7752 c3/return
7753
7754 test-emit-subx-statement-primitive:
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773 55/push-ebp
7774 89/<- %ebp 4/r32/esp
7775
7776 (clear-stream _test-output-stream)
7777 (clear-stream $_test-output-buffered-file->buffer)
7778
7779 68/push 0/imm32/right/null
7780 68/push 1/imm32/left/int
7781 89/<- %ecx 4/r32/esp
7782
7783 68/push 0/imm32/no-register
7784 68/push -8/imm32/stack-offset
7785 68/push 1/imm32/block-depth
7786 51/push-ecx
7787 68/push "foo"/imm32
7788 89/<- %ecx 4/r32/esp
7789
7790 68/push 0/imm32/is-deref:false
7791 68/push 0/imm32/next
7792 51/push-ecx/var-foo
7793 89/<- %ebx 4/r32/esp
7794
7795 68/push 0/imm32/next
7796 68/push 0/imm32/outputs
7797 53/push-ebx/operands
7798 68/push "increment"/imm32/operation
7799 68/push 1/imm32
7800 89/<- %esi 4/r32/esp
7801
7802 68/push 0/imm32/next
7803 68/push 0/imm32/output-is-write-only
7804 68/push 0/imm32/no-disp32
7805 68/push 0/imm32/no-imm32
7806 68/push 0/imm32/no-r32
7807 68/push 1/imm32/rm32-is-first-inout
7808 68/push "ff 0/subop/increment"/imm32/subx-name
7809 68/push 0/imm32/outputs
7810 53/push-ebx/inouts
7811 68/push "increment"/imm32/name
7812 89/<- %ebx 4/r32/esp
7813
7814 c7 0/subop/copy *Curr-block-depth 0/imm32
7815 (emit-subx-statement _test-output-buffered-file %esi %ebx 0)
7816 (flush _test-output-buffered-file)
7817 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
7823
7824 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-statement-primitive")
7825
7826 89/<- %esp 5/r32/ebp
7827 5d/pop-to-ebp
7828 c3/return
7829
7830 test-emit-subx-statement-primitive-register:
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849 55/push-ebp
7850 89/<- %ebp 4/r32/esp
7851
7852 (clear-stream _test-output-stream)
7853 (clear-stream $_test-output-buffered-file->buffer)
7854
7855 68/push 0/imm32/right/null
7856 68/push 1/imm32/left/int
7857 89/<- %ecx 4/r32/esp
7858
7859 68/push "eax"/imm32/register
7860 68/push 0/imm32/no-stack-offset
7861 68/push 1/imm32/block-depth
7862 51/push-ecx
7863 68/push "foo"/imm32
7864 89/<- %ecx 4/r32/esp
7865
7866 68/push 0/imm32/is-deref:false
7867 68/push 0/imm32/next
7868 51/push-ecx/var-foo
7869 89/<- %ebx 4/r32/esp
7870
7871 68/push 0/imm32/next
7872 53/push-ebx/outputs
7873 68/push 0/imm32/inouts
7874 68/push "increment"/imm32/operation
7875 68/push 1/imm32
7876 89/<- %esi 4/r32/esp
7877
7878 68/push Any-register/imm32
7879 68/push 0/imm32/no-stack-offset
7880 68/push 1/imm32/block-depth
7881 ff 6/subop/push *(ecx+4)
7882 68/push "dummy"/imm32
7883 89/<- %ebx 4/r32/esp
7884
7885 68/push 0/imm32/is-deref:false
7886 68/push 0/imm32/next
7887 53/push-ebx/formal-var
7888 89/<- %ebx 4/r32/esp
7889
7890 68/push 0/imm32/next
7891 68/push 0/imm32/output-is-write-only
7892 68/push 0/imm32/no-disp32
7893 68/push 0/imm32/no-imm32
7894 68/push 0/imm32/no-r32
7895 68/push 3/imm32/rm32-in-first-output
7896 68/push "ff 0/subop/increment"/imm32/subx-name
7897 53/push-ebx/outputs
7898 68/push 0/imm32/inouts
7899 68/push "increment"/imm32/name
7900 89/<- %ebx 4/r32/esp
7901
7902 c7 0/subop/copy *Curr-block-depth 0/imm32
7903 (emit-subx-statement _test-output-buffered-file %esi %ebx 0)
7904 (flush _test-output-buffered-file)
7905 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
7911
7912 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-statement-primitive-register")
7913
7914 89/<- %esp 5/r32/ebp
7915 5d/pop-to-ebp
7916 c3/return
7917
7918 test-emit-subx-statement-select-primitive:
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940 55/push-ebp
7941 89/<- %ebp 4/r32/esp
7942
7943 (clear-stream _test-output-stream)
7944 (clear-stream $_test-output-buffered-file->buffer)
7945
7946 68/push 0/imm32/right/null
7947 68/push 1/imm32/left/int
7948 89/<- %ecx 4/r32/esp
7949
7950 68/push "eax"/imm32/register
7951 68/push 0/imm32/no-stack-offset
7952 68/push 1/imm32/block-depth
7953 51/push-ecx
7954 68/push "foo"/imm32
7955 89/<- %ecx 4/r32/esp
7956
7957 68/push 0/imm32/is-deref:false
7958 68/push 0/imm32/next
7959 51/push-ecx/var-foo
7960 89/<- %edi 4/r32/esp
7961
7962 68/push 0/imm32/next
7963 57/push-edi/outputs
7964 68/push 0/imm32/inouts
7965 68/push "increment"/imm32/operation
7966 68/push 1/imm32
7967 89/<- %esi 4/r32/esp
7968
7969 68/push Any-register/imm32
7970 68/push 0/imm32/no-stack-offset
7971 68/push 1/imm32/block-depth
7972 ff 6/subop/push *(ecx+4)
7973 68/push "dummy"/imm32
7974 89/<- %ebx 4/r32/esp
7975
7976 68/push 0/imm32/is-deref:false
7977 68/push 0/imm32/next
7978 53/push-ebx/formal-var
7979 89/<- %ebx 4/r32/esp
7980
7981 68/push 0/imm32/next
7982 68/push 0/imm32/output-is-write-only
7983 68/push 0/imm32/no-disp32
7984 68/push 0/imm32/no-imm32
7985 68/push 0/imm32/no-r32
7986 68/push 3/imm32/rm32-in-first-output
7987 68/push "ff 0/subop/increment"/imm32/subx-name
7988 53/push-ebx/outputs/formal-outputs
7989 68/push 0/imm32/inouts
7990 68/push "increment"/imm32/name
7991 89/<- %ebx 4/r32/esp
7992
7993 53/push-ebx/next
7994 68/push 0/imm32/output-is-write-only
7995 68/push 0/imm32/no-disp32
7996 68/push 0/imm32/no-imm32
7997 68/push 0/imm32/no-r32
7998 68/push 1/imm32/rm32-is-first-inout
7999 68/push "ff 0/subop/increment"/imm32/subx-name
8000 68/push 0/imm32/outputs
8001 57/push-edi/inouts/real-outputs
8002 68/push "increment"/imm32/name
8003 89/<- %ebx 4/r32/esp
8004
8005 c7 0/subop/copy *Curr-block-depth 0/imm32
8006 (emit-subx-statement _test-output-buffered-file %esi %ebx 0)
8007 (flush _test-output-buffered-file)
8008 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8014
8015 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-statement-select-primitive")
8016
8017 89/<- %esp 5/r32/ebp
8018 5d/pop-to-ebp
8019 c3/return
8020
8021 test-emit-subx-statement-select-primitive-2:
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043 55/push-ebp
8044 89/<- %ebp 4/r32/esp
8045
8046 (clear-stream _test-output-stream)
8047 (clear-stream $_test-output-buffered-file->buffer)
8048
8049 68/push 0/imm32/right/null
8050 68/push 1/imm32/left/int
8051 89/<- %ecx 4/r32/esp
8052
8053 68/push "eax"/imm32/register
8054 68/push 0/imm32/no-stack-offset
8055 68/push 1/imm32/block-depth
8056 51/push-ecx
8057 68/push "foo"/imm32
8058 89/<- %ecx 4/r32/esp
8059
8060 68/push 0/imm32/is-deref:false
8061 68/push 0/imm32/next
8062 51/push-ecx/var-foo
8063 89/<- %edi 4/r32/esp
8064
8065 68/push 0/imm32/next
8066 68/push 0/imm32/outputs
8067 57/push-edi/inouts
8068 68/push "increment"/imm32/operation
8069 68/push 1/imm32
8070 89/<- %esi 4/r32/esp
8071
8072 68/push Any-register/imm32
8073 68/push 0/imm32/no-stack-offset
8074 68/push 1/imm32/block-depth
8075 ff 6/subop/push *(ecx+4)
8076 68/push "dummy"/imm32
8077 89/<- %ebx 4/r32/esp
8078
8079 68/push 0/imm32/is-deref:false
8080 68/push 0/imm32/next
8081 53/push-ebx/formal-var
8082 89/<- %ebx 4/r32/esp
8083
8084 68/push 0/imm32/next
8085 68/push 0/imm32/output-is-write-only
8086 68/push 0/imm32/no-disp32
8087 68/push 0/imm32/no-imm32
8088 68/push 0/imm32/no-r32
8089 68/push 3/imm32/rm32-in-first-output
8090 68/push "ff 0/subop/increment"/imm32/subx-name
8091 53/push-ebx/outputs/formal-outputs
8092 68/push 0/imm32/inouts
8093 68/push "increment"/imm32/name
8094 89/<- %ebx 4/r32/esp
8095
8096 53/push-ebx/next
8097 68/push 0/imm32/output-is-write-only
8098 68/push 0/imm32/no-disp32
8099 68/push 0/imm32/no-imm32
8100 68/push 0/imm32/no-r32
8101 68/push 1/imm32/rm32-is-first-inout
8102 68/push "ff 0/subop/increment"/imm32/subx-name
8103 68/push 0/imm32/outputs
8104 57/push-edi/inouts/real-outputs
8105 68/push "increment"/imm32/name
8106 89/<- %ebx 4/r32/esp
8107
8108 c7 0/subop/copy *Curr-block-depth 0/imm32
8109 (emit-subx-statement _test-output-buffered-file %esi %ebx 0)
8110 (flush _test-output-buffered-file)
8111 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8117
8118 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-statement-select-primitive-2")
8119
8120 89/<- %esp 5/r32/ebp
8121 5d/pop-to-ebp
8122 c3/return
8123
8124 test-increment-register:
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140 55/push-ebp
8141 89/<- %ebp 4/r32/esp
8142
8143 (clear-stream _test-output-stream)
8144 (clear-stream $_test-output-buffered-file->buffer)
8145
8146 68/push 0/imm32/right/null
8147 68/push 1/imm32/left/int
8148 89/<- %ecx 4/r32/esp
8149
8150 68/push "eax"/imm32/register
8151 68/push 0/imm32/no-stack-offset
8152 68/push 1/imm32/block-depth
8153 51/push-ecx
8154 68/push "foo"/imm32
8155 89/<- %ecx 4/r32/esp
8156
8157 68/push 0/imm32/is-deref:false
8158 68/push 0/imm32/next
8159 51/push-ecx/var-foo
8160 89/<- %edi 4/r32/esp
8161
8162 68/push 0/imm32/next
8163 57/push-edi/outputs
8164 68/push 0/imm32/inouts
8165 68/push "increment"/imm32/operation
8166 68/push 1/imm32/regular-statement
8167 89/<- %esi 4/r32/esp
8168
8169 c7 0/subop/copy *Curr-block-depth 0/imm32
8170 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8171 (flush _test-output-buffered-file)
8172 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8178
8179 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register")
8180
8181 89/<- %esp 5/r32/ebp
8182 5d/pop-to-ebp
8183 c3/return
8184
8185 test-increment-var:
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201 55/push-ebp
8202 89/<- %ebp 4/r32/esp
8203
8204 (clear-stream _test-output-stream)
8205 (clear-stream $_test-output-buffered-file->buffer)
8206
8207 68/push 0/imm32/right/null
8208 68/push 1/imm32/left/int
8209 89/<- %ecx 4/r32/esp
8210
8211 68/push "eax"/imm32/register
8212 68/push 0/imm32/no-stack-offset
8213 68/push 1/imm32/block-depth
8214 51/push-ecx
8215 68/push "foo"/imm32
8216 89/<- %ecx 4/r32/esp
8217
8218 68/push 0/imm32/is-deref:false
8219 68/push 0/imm32/next
8220 51/push-ecx/var-foo
8221 89/<- %edi 4/r32/esp
8222
8223 68/push 0/imm32/next
8224 57/push-edi/outputs
8225 68/push 0/imm32/inouts
8226 68/push "increment"/imm32/operation
8227 68/push 1/imm32
8228 89/<- %esi 4/r32/esp
8229
8230 c7 0/subop/copy *Curr-block-depth 0/imm32
8231 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8232 (flush _test-output-buffered-file)
8233 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8239
8240 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-var")
8241
8242 89/<- %esp 5/r32/ebp
8243 5d/pop-to-ebp
8244 c3/return
8245
8246 test-add-reg-to-reg:
8247
8248
8249
8250
8251
8252 55/push-ebp
8253 89/<- %ebp 4/r32/esp
8254
8255 (clear-stream _test-output-stream)
8256 (clear-stream $_test-output-buffered-file->buffer)
8257
8258 68/push 0/imm32/right/null
8259 68/push 1/imm32/left/int
8260 89/<- %ecx 4/r32/esp
8261
8262 68/push "eax"/imm32/register
8263 68/push 0/imm32/no-stack-offset
8264 68/push 1/imm32/block-depth
8265 51/push-ecx
8266 68/push "var1"/imm32
8267 89/<- %ecx 4/r32/esp
8268
8269 68/push "ecx"/imm32/register
8270 68/push 0/imm32/no-stack-offset
8271 68/push 1/imm32/block-depth
8272 ff 6/subop/push *(ecx+4)
8273 68/push "var2"/imm32
8274 89/<- %edx 4/r32/esp
8275
8276 68/push 0/imm32/is-deref:false
8277 68/push 0/imm32/next
8278 52/push-edx/var-var2
8279 89/<- %esi 4/r32/esp
8280
8281 68/push 0/imm32/is-deref:false
8282 68/push 0/imm32/next
8283 51/push-ecx/var-var1
8284 89/<- %edi 4/r32/esp
8285
8286 68/push 0/imm32/next
8287 57/push-edi/outputs
8288 56/push-esi/inouts
8289 68/push "add"/imm32/operation
8290 68/push 1/imm32
8291 89/<- %esi 4/r32/esp
8292
8293 c7 0/subop/copy *Curr-block-depth 0/imm32
8294 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8295 (flush _test-output-buffered-file)
8296 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8302
8303 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg")
8304
8305 89/<- %esp 5/r32/ebp
8306 5d/pop-to-ebp
8307 c3/return
8308
8309 test-add-reg-to-mem:
8310
8311
8312
8313
8314
8315 55/push-ebp
8316 89/<- %ebp 4/r32/esp
8317
8318 (clear-stream _test-output-stream)
8319 (clear-stream $_test-output-buffered-file->buffer)
8320
8321 68/push 0/imm32/right/null
8322 68/push 1/imm32/left/int
8323 89/<- %ecx 4/r32/esp
8324
8325 68/push 0/imm32/no-register
8326 68/push 8/imm32/stack-offset
8327 68/push 1/imm32/block-depth
8328 51/push-ecx
8329 68/push "var1"/imm32
8330 89/<- %ecx 4/r32/esp
8331
8332 68/push "ecx"/imm32/register
8333 68/push 0/imm32/no-stack-offset
8334 68/push 1/imm32/block-depth
8335 ff 6/subop/push *(ecx+4)
8336 68/push "var2"/imm32
8337 89/<- %edx 4/r32/esp
8338
8339 68/push 0/imm32/is-deref:false
8340 68/push 0/imm32/next
8341 52/push-edx/var-var2
8342 89/<- %esi 4/r32/esp
8343
8344 56/push-esi/next
8345 51/push-ecx/var-var1
8346 89/<- %esi 4/r32/esp
8347
8348 68/push 0/imm32/next
8349 68/push 0/imm32/outputs
8350 56/push-esi/inouts
8351 68/push "add-to"/imm32/operation
8352 68/push 1/imm32
8353 89/<- %esi 4/r32/esp
8354
8355 c7 0/subop/copy *Curr-block-depth 0/imm32
8356 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8357 (flush _test-output-buffered-file)
8358 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8364
8365 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem")
8366
8367 89/<- %esp 5/r32/ebp
8368 5d/pop-to-ebp
8369 c3/return
8370
8371 test-add-mem-to-reg:
8372
8373
8374
8375
8376
8377 55/push-ebp
8378 89/<- %ebp 4/r32/esp
8379
8380 (clear-stream _test-output-stream)
8381 (clear-stream $_test-output-buffered-file->buffer)
8382
8383 68/push 0/imm32/right/null
8384 68/push 1/imm32/left/int
8385 89/<- %ecx 4/r32/esp
8386
8387 68/push "eax"/imm32/register
8388 68/push 0/imm32/no-stack-offset
8389 68/push 1/imm32/block-depth
8390 51/push-ecx
8391 68/push "var1"/imm32
8392 89/<- %ecx 4/r32/esp
8393
8394 68/push 0/imm32/no-register
8395 68/push 8/imm32/stack-offset
8396 68/push 1/imm32/block-depth
8397 ff 6/subop/push *(ecx+4)
8398 68/push "var2"/imm32
8399 89/<- %edx 4/r32/esp
8400
8401 68/push 0/imm32/is-deref:false
8402 68/push 0/imm32/next
8403 52/push-edx/var-var2
8404 89/<- %esi 4/r32/esp
8405
8406 68/push 0/imm32/is-deref:false
8407 68/push 0/imm32/next
8408 51/push-ecx/var-var1
8409 89/<- %edi 4/r32/esp
8410
8411 68/push 0/imm32/next
8412 57/push-edi/outputs
8413 56/push-esi/inouts
8414 68/push "add"/imm32/operation
8415 68/push 1/imm32
8416 89/<- %esi 4/r32/esp
8417
8418 c7 0/subop/copy *Curr-block-depth 0/imm32
8419 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8420 (flush _test-output-buffered-file)
8421 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8427
8428 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg")
8429
8430 89/<- %esp 5/r32/ebp
8431 5d/pop-to-ebp
8432 c3/return
8433
8434 test-add-literal-to-eax:
8435
8436
8437
8438
8439
8440 55/push-ebp
8441 89/<- %ebp 4/r32/esp
8442
8443 (clear-stream _test-output-stream)
8444 (clear-stream $_test-output-buffered-file->buffer)
8445
8446 68/push 0/imm32/right/null
8447 68/push 1/imm32/left/int
8448 89/<- %ecx 4/r32/esp
8449
8450 68/push "eax"/imm32/register
8451 68/push 0/imm32/no-stack-offset
8452 68/push 1/imm32/block-depth
8453 51/push-ecx
8454 68/push "var1"/imm32
8455 89/<- %ecx 4/r32/esp
8456
8457 68/push 0/imm32/right/null
8458 68/push 0/imm32/left/literal
8459 89/<- %edx 4/r32/esp
8460
8461 68/push 0/imm32/no-register
8462 68/push 0/imm32/no-stack-offset
8463 68/push 1/imm32/block-depth
8464 52/push-edx
8465 68/push "0x34"/imm32
8466 89/<- %edx 4/r32/esp
8467
8468 68/push 0/imm32/is-deref:false
8469 68/push 0/imm32/next
8470 52/push-edx/var-var2
8471 89/<- %esi 4/r32/esp
8472
8473 68/push 0/imm32/is-deref:false
8474 68/push 0/imm32/next
8475 51/push-ecx/var-var1
8476 89/<- %edi 4/r32/esp
8477
8478 68/push 0/imm32/next
8479 57/push-edi/outputs
8480 56/push-esi/inouts
8481 68/push "add"/imm32/operation
8482 68/push 1/imm32
8483 89/<- %esi 4/r32/esp
8484
8485 c7 0/subop/copy *Curr-block-depth 0/imm32
8486 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8487 (flush _test-output-buffered-file)
8488 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8494
8495 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax")
8496
8497 89/<- %esp 5/r32/ebp
8498 5d/pop-to-ebp
8499 c3/return
8500
8501 test-add-literal-to-reg:
8502
8503
8504
8505
8506
8507 55/push-ebp
8508 89/<- %ebp 4/r32/esp
8509
8510 (clear-stream _test-output-stream)
8511 (clear-stream $_test-output-buffered-file->buffer)
8512
8513 68/push 0/imm32/right/null
8514 68/push 1/imm32/left/int
8515 89/<- %ecx 4/r32/esp
8516
8517 68/push "ecx"/imm32/register
8518 68/push 0/imm32/no-stack-offset
8519 68/push 1/imm32/block-depth
8520 51/push-ecx
8521 68/push "var1"/imm32
8522 89/<- %ecx 4/r32/esp
8523
8524 68/push 0/imm32/right/null
8525 68/push 0/imm32/left/literal
8526 89/<- %edx 4/r32/esp
8527
8528 68/push 0/imm32/no-register
8529 68/push 0/imm32/no-stack-offset
8530 68/push 1/imm32/block-depth
8531 52/push-edx
8532 68/push "0x34"/imm32
8533 89/<- %edx 4/r32/esp
8534
8535 68/push 0/imm32/is-deref:false
8536 68/push 0/imm32/next
8537 52/push-edx/var-var2
8538 89/<- %esi 4/r32/esp
8539
8540 68/push 0/imm32/is-deref:false
8541 68/push 0/imm32/next
8542 51/push-ecx/var-var1
8543 89/<- %edi 4/r32/esp
8544
8545 68/push 0/imm32/next
8546 57/push-edi/outputs
8547 56/push-esi/inouts
8548 68/push "add"/imm32/operation
8549 68/push 1/imm32
8550 89/<- %esi 4/r32/esp
8551
8552 c7 0/subop/copy *Curr-block-depth 0/imm32
8553 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8554 (flush _test-output-buffered-file)
8555 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8561
8562 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg")
8563
8564 89/<- %esp 5/r32/ebp
8565 5d/pop-to-ebp
8566 c3/return
8567
8568 test-add-literal-to-mem:
8569
8570
8571
8572
8573
8574 55/push-ebp
8575 89/<- %ebp 4/r32/esp
8576
8577 (clear-stream _test-output-stream)
8578 (clear-stream $_test-output-buffered-file->buffer)
8579
8580 68/push 0/imm32/right/null
8581 68/push 1/imm32/left/int
8582 89/<- %ecx 4/r32/esp
8583
8584 68/push 0/imm32/no-register
8585 68/push 8/imm32/stack-offset
8586 68/push 1/imm32/block-depth
8587 51/push-ecx
8588 68/push "var1"/imm32
8589 89/<- %ecx 4/r32/esp
8590
8591 68/push 0/imm32/right/null
8592 68/push 0/imm32/left/literal
8593 89/<- %edx 4/r32/esp
8594
8595 68/push 0/imm32/no-register
8596 68/push 0/imm32/no-stack-offset
8597 68/push 1/imm32/block-depth
8598 52/push-edx
8599 68/push "0x34"/imm32
8600 89/<- %edx 4/r32/esp
8601
8602 68/push 0/imm32/is-deref:false
8603 68/push 0/imm32/next
8604 52/push-edx/var-var2
8605 89/<- %esi 4/r32/esp
8606
8607 68/push 0/imm32/is-deref:false
8608 56/push-esi/next
8609 51/push-ecx/var-var1
8610 89/<- %esi 4/r32/esp
8611
8612 68/push 0/imm32/next
8613 68/push 0/imm32/outputs
8614 56/push-esi/inouts
8615 68/push "add-to"/imm32/operation
8616 68/push 1/imm32
8617 89/<- %esi 4/r32/esp
8618
8619 c7 0/subop/copy *Curr-block-depth 0/imm32
8620 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8621 (flush _test-output-buffered-file)
8622 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8628
8629 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem")
8630
8631 89/<- %esp 5/r32/ebp
8632 5d/pop-to-ebp
8633 c3/return
8634
8635 test-compare-mem-with-reg:
8636
8637
8638
8639
8640
8641 55/push-ebp
8642 89/<- %ebp 4/r32/esp
8643
8644 (clear-stream _test-output-stream)
8645 (clear-stream $_test-output-buffered-file->buffer)
8646
8647 68/push 0/imm32/right/null
8648 68/push 1/imm32/left/int
8649 89/<- %ecx 4/r32/esp
8650
8651 68/push "eax"/imm32/register
8652 68/push 0/imm32/no-stack-offset
8653 68/push 1/imm32/block-depth
8654 51/push-ecx
8655 68/push "var2"/imm32
8656 89/<- %ecx 4/r32/esp
8657
8658 68/push 0/imm32/no-register
8659 68/push 8/imm32/stack-offset
8660 68/push 1/imm32/block-depth
8661 ff 6/subop/push *(ecx+4)
8662 68/push "var1"/imm32
8663 89/<- %edx 4/r32/esp
8664
8665 68/push 0/imm32/is-deref:false
8666 68/push 0/imm32/next
8667 51/push-ecx/var-var2
8668 89/<- %esi 4/r32/esp
8669
8670 68/push 0/imm32/is-deref:false
8671 56/push-esi
8672 52/push-edx/var-var1
8673 89/<- %esi 4/r32/esp
8674
8675 68/push 0/imm32/next
8676 68/push 0/imm32/outputs
8677 56/push-esi/inouts
8678 68/push "compare"/imm32/operation
8679 68/push 1/imm32
8680 89/<- %esi 4/r32/esp
8681
8682 c7 0/subop/copy *Curr-block-depth 0/imm32
8683 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8684 (flush _test-output-buffered-file)
8685 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8691
8692 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg")
8693
8694 89/<- %esp 5/r32/ebp
8695 5d/pop-to-ebp
8696 c3/return
8697
8698 test-compare-reg-with-mem:
8699
8700
8701
8702
8703
8704 55/push-ebp
8705 89/<- %ebp 4/r32/esp
8706
8707 (clear-stream _test-output-stream)
8708 (clear-stream $_test-output-buffered-file->buffer)
8709
8710 68/push 0/imm32/right/null
8711 68/push 1/imm32/left/int
8712 89/<- %ecx 4/r32/esp
8713
8714 68/push "eax"/imm32/register
8715 68/push 0/imm32/no-stack-offset
8716 68/push 1/imm32/block-depth
8717 51/push-ecx
8718 68/push "var1"/imm32
8719 89/<- %ecx 4/r32/esp
8720
8721 68/push 0/imm32/no-register
8722 68/push 8/imm32/stack-offset
8723 68/push 1/imm32/block-depth
8724 ff 6/subop/push *(ecx+4)
8725 68/push "var2"/imm32
8726 89/<- %edx 4/r32/esp
8727
8728 68/push 0/imm32/is-deref:false
8729 68/push 0/imm32/next
8730 52/push-edx/var-var2
8731 89/<- %esi 4/r32/esp
8732
8733 68/push 0/imm32/is-deref:false
8734 56/push-esi
8735 51/push-ecx/var-var1
8736 89/<- %esi 4/r32/esp
8737
8738 68/push 0/imm32/next
8739 68/push 0/imm32/outputs
8740 56/push-esi/inouts
8741 68/push "compare"/imm32/operation
8742 68/push 1/imm32
8743 89/<- %esi 4/r32/esp
8744
8745 c7 0/subop/copy *Curr-block-depth 0/imm32
8746 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8747 (flush _test-output-buffered-file)
8748 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8754
8755 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem")
8756
8757 89/<- %esp 5/r32/ebp
8758 5d/pop-to-ebp
8759 c3/return
8760
8761 test-compare-mem-with-literal:
8762
8763
8764
8765
8766
8767 55/push-ebp
8768 89/<- %ebp 4/r32/esp
8769
8770 (clear-stream _test-output-stream)
8771 (clear-stream $_test-output-buffered-file->buffer)
8772
8773 68/push 0/imm32/right/null
8774 68/push 1/imm32/left/int
8775 89/<- %ecx 4/r32/esp
8776
8777 68/push 0/imm32/no-register
8778 68/push 8/imm32/stack-offset
8779 68/push 1/imm32/block-depth
8780 51/push-ecx
8781 68/push "var1"/imm32
8782 89/<- %ecx 4/r32/esp
8783
8784 68/push 0/imm32/right/null
8785 68/push 0/imm32/left/literal
8786 89/<- %edx 4/r32/esp
8787
8788 68/push 0/imm32/no-register
8789 68/push 0/imm32/no-stack-offset
8790 68/push 1/imm32/block-depth
8791 52/push-edx
8792 68/push "0x34"/imm32
8793 89/<- %edx 4/r32/esp
8794
8795 68/push 0/imm32/is-deref:false
8796 68/push 0/imm32/next
8797 52/push-edx/var-var2
8798 89/<- %esi 4/r32/esp
8799
8800 68/push 0/imm32/is-deref:false
8801 56/push-esi/next
8802 51/push-ecx/var-var1
8803 89/<- %esi 4/r32/esp
8804
8805 68/push 0/imm32/next
8806 68/push 0/imm32/outputs
8807 56/push-esi/inouts
8808 68/push "compare"/imm32/operation
8809 68/push 1/imm32
8810 89/<- %esi 4/r32/esp
8811
8812 c7 0/subop/copy *Curr-block-depth 0/imm32
8813 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8814 (flush _test-output-buffered-file)
8815 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8821
8822 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal")
8823
8824 89/<- %esp 5/r32/ebp
8825 5d/pop-to-ebp
8826 c3/return
8827
8828 test-compare-eax-with-literal:
8829
8830
8831
8832
8833
8834 55/push-ebp
8835 89/<- %ebp 4/r32/esp
8836
8837 (clear-stream _test-output-stream)
8838 (clear-stream $_test-output-buffered-file->buffer)
8839
8840 68/push 0/imm32/right/null
8841 68/push 1/imm32/left/int
8842 89/<- %ecx 4/r32/esp
8843
8844 68/push "eax"/imm32/register
8845 68/push 0/imm32/no-stack-offset
8846 68/push 1/imm32/block-depth
8847 51/push-ecx
8848 68/push "var1"/imm32
8849 89/<- %ecx 4/r32/esp
8850
8851 68/push 0/imm32/right/null
8852 68/push 0/imm32/left/literal
8853 89/<- %edx 4/r32/esp
8854
8855 68/push 0/imm32/no-register
8856 68/push 0/imm32/no-stack-offset
8857 68/push 1/imm32/block-depth
8858 52/push-edx
8859 68/push "0x34"/imm32
8860 89/<- %edx 4/r32/esp
8861
8862 68/push 0/imm32/is-deref:false
8863 68/push 0/imm32/next
8864 52/push-edx/var-var2
8865 89/<- %esi 4/r32/esp
8866
8867 68/push 0/imm32/is-deref:false
8868 56/push-esi/next
8869 51/push-ecx/var-var1
8870 89/<- %esi 4/r32/esp
8871
8872 68/push 0/imm32/next
8873 68/push 0/imm32/outputs
8874 56/push-esi/inouts
8875 68/push "compare"/imm32/operation
8876 68/push 1/imm32/regular-stmt
8877 89/<- %esi 4/r32/esp
8878
8879 c7 0/subop/copy *Curr-block-depth 0/imm32
8880 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8881 (flush _test-output-buffered-file)
8882 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8888
8889 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal")
8890
8891 89/<- %esp 5/r32/ebp
8892 5d/pop-to-ebp
8893 c3/return
8894
8895 test-compare-reg-with-literal:
8896
8897
8898
8899
8900
8901 55/push-ebp
8902 89/<- %ebp 4/r32/esp
8903
8904 (clear-stream _test-output-stream)
8905 (clear-stream $_test-output-buffered-file->buffer)
8906
8907 68/push 0/imm32/right/null
8908 68/push 1/imm32/left/int
8909 89/<- %ecx 4/r32/esp
8910
8911 68/push "ecx"/imm32/register
8912 68/push 0/imm32/no-stack-offset
8913 68/push 1/imm32/block-depth
8914 51/push-ecx
8915 68/push "var1"/imm32
8916 89/<- %ecx 4/r32/esp
8917
8918 68/push 0/imm32/right/null
8919 68/push 0/imm32/left/literal
8920 89/<- %edx 4/r32/esp
8921
8922 68/push 0/imm32/no-register
8923 68/push 0/imm32/no-stack-offset
8924 68/push 1/imm32/block-depth
8925 52/push-edx
8926 68/push "0x34"/imm32
8927 89/<- %edx 4/r32/esp
8928
8929 68/push 0/imm32/is-deref:false
8930 68/push 0/imm32/next
8931 52/push-edx/var-var2
8932 89/<- %esi 4/r32/esp
8933
8934 68/push 0/imm32/is-deref:false
8935 56/push-esi/next
8936 51/push-ecx/var-var1
8937 89/<- %esi 4/r32/esp
8938
8939 68/push 0/imm32/next
8940 68/push 0/imm32/outputs
8941 56/push-esi/inouts
8942 68/push "compare"/imm32/operation
8943 68/push 1/imm32/regular-stmt
8944 89/<- %esi 4/r32/esp
8945
8946 c7 0/subop/copy *Curr-block-depth 0/imm32
8947 (emit-subx-statement _test-output-buffered-file %esi Primitives 0)
8948 (flush _test-output-buffered-file)
8949 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
8955
8956 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal")
8957
8958 89/<- %esp 5/r32/ebp
8959 5d/pop-to-ebp
8960 c3/return
8961
8962 test-emit-subx-statement-function-call:
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983 55/push-ebp
8984 89/<- %ebp 4/r32/esp
8985
8986 (clear-stream _test-output-stream)
8987 (clear-stream $_test-output-buffered-file->buffer)
8988
8989 68/push 0/imm32/right/null
8990 68/push 1/imm32/left/int
8991 89/<- %ecx 4/r32/esp
8992
8993 68/push 0/imm32/no-register
8994 68/push -8/imm32/stack-offset
8995 68/push 0/imm32/block-depth
8996 51/push-ecx
8997 68/push "foo"/imm32
8998 89/<- %ecx 4/r32/esp
8999
9000 68/push 0/imm32/is-deref:false
9001 68/push 0/imm32/next
9002 51/push-ecx/var-foo
9003 89/<- %esi 4/r32/esp
9004
9005 68/push 0/imm32/next
9006 68/push 0/imm32/outputs
9007 56/push-esi/inouts
9008 68/push "f"/imm32/operation
9009 68/push 1/imm32
9010 89/<- %esi 4/r32/esp
9011
9012 68/push 0/imm32/next
9013 68/push 0/imm32/body
9014 68/push 0/imm32/outputs
9015 51/push-ecx/inouts
9016 68/push "f2"/imm32/subx-name
9017 68/push "f"/imm32/name
9018 89/<- %ebx 4/r32/esp
9019
9020 c7 0/subop/copy *Curr-block-depth 0/imm32
9021 (emit-subx-statement _test-output-buffered-file %esi 0 %ebx)
9022 (flush _test-output-buffered-file)
9023 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9029
9030 (check-next-stream-line-equal _test-output-stream "(f2 *(ebp+0xfffffff8))" "F - test-emit-subx-statement-function-call")
9031
9032 89/<- %esp 5/r32/ebp
9033 5d/pop-to-ebp
9034 c3/return
9035
9036 test-emit-subx-statement-function-call-with-literal-arg:
9037
9038
9039
9040
9041
9042
9043 55/push-ebp
9044 89/<- %ebp 4/r32/esp
9045
9046 (clear-stream _test-output-stream)
9047 (clear-stream $_test-output-buffered-file->buffer)
9048
9049 68/push 0/imm32/right/null
9050 68/push 0/imm32/left/literal
9051 89/<- %ecx 4/r32/esp
9052
9053 68/push 0/imm32/no-register
9054 68/push 0/imm32/no-stack-offset
9055 68/push 0/imm32/block-depth
9056 51/push-ecx
9057 68/push "34"/imm32
9058 89/<- %ecx 4/r32/esp
9059
9060 68/push 0/imm32/is-deref:false
9061 68/push 0/imm32/next
9062 51/push-ecx/var-foo
9063 89/<- %esi 4/r32/esp
9064
9065 68/push 0/imm32/next
9066 68/push 0/imm32/outputs
9067 56/push-esi/inouts
9068 68/push "f"/imm32/operation
9069 68/push 1/imm32
9070 89/<- %esi 4/r32/esp
9071
9072 68/push 0/imm32/next
9073 68/push 0/imm32/body
9074 68/push 0/imm32/outputs
9075 51/push-ecx/inouts
9076 68/push "f2"/imm32/subx-name
9077 68/push "f"/imm32/name
9078 89/<- %ebx 4/r32/esp
9079
9080 c7 0/subop/copy *Curr-block-depth 0/imm32
9081 (emit-subx-statement _test-output-buffered-file %esi 0 %ebx)
9082 (flush _test-output-buffered-file)
9083 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
9089
9090 (check-next-stream-line-equal _test-output-stream "(f2 34)" "F - test-emit-subx-statement-function-call-with-literal-arg")
9091
9092 89/<- %esp 5/r32/ebp
9093 5d/pop-to-ebp
9094 c3/return
9095
9096 emit-indent:
9097
9098 55/push-ebp
9099 89/<- %ebp 4/r32/esp
9100
9101 50/push-eax
9102
9103 8b/-> *(ebp+0xc) 0/r32/eax
9104 {
9105
9106 3d/compare-eax-with 0/imm32
9107 7e/jump-if-<= break/disp8
9108 (write-buffered *(ebp+8) " ")
9109 48/decrement-eax
9110 eb/jump loop/disp8
9111 }
9112 $emit-indent:end:
9113
9114 58/pop-to-eax
9115
9116 89/<- %esp 5/r32/ebp
9117 5d/pop-to-ebp
9118 c3/return
9119
9120 emit-subx-prologue:
9121
9122 55/push-ebp
9123 89/<- %ebp 4/r32/esp
9124
9125 (write-buffered *(ebp+8) " # . prologue\n")
9126 (write-buffered *(ebp+8) " 55/push-ebp\n")
9127 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n")
9128 $emit-subx-prologue:end:
9129
9130 89/<- %esp 5/r32/ebp
9131 5d/pop-to-ebp
9132 c3/return
9133
9134 emit-subx-epilogue:
9135
9136 55/push-ebp
9137 89/<- %ebp 4/r32/esp
9138
9139 (write-buffered *(ebp+8) " # . epilogue\n")
9140 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n")
9141 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n")
9142 (write-buffered *(ebp+8) " c3/return\n")
9143 $emit-subx-epilogue:end:
9144
9145 89/<- %esp 5/r32/ebp
9146 5d/pop-to-ebp
9147 c3/return