https://github.com/akkartik/mu/blob/master/subx/apps/dquotes.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 == code
18
19
20
21
22 Entry:
23
24
25
26 68/push Heap/imm32
27 68/push 0x10000/imm32/64KB
28
29 e8/call new-segment/disp32
30
31 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
32
33
34
35 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
36
37
38 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 0/disp8 1/imm32
39 7e/jump-if-lesser-or-equal $run-main/disp8
40
41
42 68/push "test"/imm32
43 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
44
45 e8/call kernel-string-equal?/disp32
46
47 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
48
49 3d/compare-EAX-and 1/imm32
50 75/jump-if-not-equal $run-main/disp8
51
52 e8/call run-tests/disp32
53 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32
54 eb/jump $main:end/disp8
55 $run-main:
56
57
58 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
59 89/copy 3/mod/direct 0/rm32/EAX . . . 4/r32/ESP . .
60
61
62 c7 0/subop/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
63
64
65 50/push-EAX/ed
66 68/push Stderr/imm32
67 68/push Stdout/imm32
68 68/push Stdin/imm32
69
70 e8/call convert/disp32
71
72 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
73
74 bb/copy-to-EBX 0/imm32
75 $main:end:
76 b8/copy-to-EAX 1/imm32/exit
77 cd/syscall 0x80/imm8
78
79
80
81
82
83 convert:
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 55/push-EBP
109 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
110
111 50/push-EAX
112 51/push-ECX
113 52/push-EDX
114 53/push-EBX
115 56/push-ESI
116 57/push-EDI
117
118 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0x200/imm32
119 68/push 0x200/imm32/length
120 68/push 0/imm32/read
121 68/push 0/imm32/write
122 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
123
124 68/push 0/imm32/end
125 68/push 0/imm32/start
126 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . .
127
128
129
130 68/push 1/imm32
131 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Segment-size/disp32
132 68/push Heap/imm32
133
134 e8/call new-stream/disp32
135
136 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
137
138 89/copy 3/mod/direct 7/rm32/EDI . . . 0/r32/EAX . .
139
140
141 68/push "== data\n"/imm32
142 57/push-EDI
143
144 e8/call write/disp32
145
146 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
147 $convert:line-loop:
148
149
150 51/push-ECX
151
152 e8/call clear-stream/disp32
153
154 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
155
156
157 51/push-ECX
158 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
159
160 e8/call read-line-buffered/disp32
161
162 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
163 $convert:check0:
164
165 81 7/subop/compare 0/mod/indirect 1/rm32/ECX . . . . . 0/imm32
166 0f 84/jump-if-equal $convert:break/disp32
167 $convert:word-loop:
168
169
170 52/push-EDX
171 51/push-ECX
172
173 e8/call next-word-or-string/disp32
174
175 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
176 $convert:check1:
177
178
179
180 52/push-EDX
181
182 e8/call slice-empty?/disp32
183
184 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
185
186 3d/compare-EAX-and 0/imm32
187 0f 85/jump-if-not-equal $convert:next-line/disp32
188 $convert:check-for-comment:
189
190
191 8b/copy 0/mod/indirect 2/rm32/EDX . . . 6/r32/ESI . .
192
193 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
194 8a/copy-byte 0/mod/indirect 6/rm32/ESI . . . 0/r32/AL . .
195
196 3d/compare-EAX-and 0x23/imm32/hash
197 74/jump-if-equal $convert:word-loop/disp8
198 $convert:check-for-string-literal:
199 3d/compare-EAX-and 0x22/imm32/hash
200 75/jump-if-not-equal $convert:regular-word/disp8
201 $convert:string-literal:
202
203
204 57/push-EDI
205 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
206 52/push-EDX
207
208 e8/call process-string-literal/disp32
209
210 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
211
212 eb/jump $convert:next-word/disp8
213 $convert:regular-word:
214
215
216 52/push-EDX
217 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
218
219 e8/call write-slice-buffered/disp32
220
221 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
222
223 $convert:next-word:
224
225
226 68/push " "/imm32
227 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
228
229 e8/call write-buffered/disp32
230
231 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
232
233 eb/jump $convert:word-loop/disp8
234 $convert:next-line:
235
236
237 68/push Newline/imm32
238 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
239
240 e8/call write-buffered/disp32
241
242 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
243
244 e9/jump $convert:line-loop/disp32
245 $convert:break:
246
247
248 57/push-EDI
249 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
250
251 e8/call write-stream-data/disp32
252
253 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
254
255
256 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
257
258 e8/call flush/disp32
259
260 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
261 $convert:end:
262
263 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x214/imm32
264
265 5f/pop-to-EDI
266 5e/pop-to-ESI
267 5b/pop-to-EBX
268 5a/pop-to-EDX
269 59/pop-to-ECX
270 58/pop-to-EAX
271
272 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
273 5d/pop-to-EBP
274 c3/return
275
276
277
278 process-string-literal:
279
280
281
282
283
284
285
286
287 55/push-EBP
288 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
289
290 51/push-ECX
291
292 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0xa/imm32
293 68/push 0xa/imm32/decimal-digits-in-32bit-number
294 68/push 0/imm32/read
295 68/push 0/imm32/write
296 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
297
298
299
300 68/push "_string"/imm32
301 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
302
303 e8/call write/disp32
304
305 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
306
307
308 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Next-string-literal/disp32
309 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
310
311 e8/call print-int32-decimal/disp32
312
313 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
314
315
316 68/push ":\n"/imm32
317 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
318
319 e8/call write/disp32
320
321 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
322
323
324 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x8/disp8 .
325 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
326
327 e8/call emit-string-literal-data/disp32
328
329 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
330
331
332 68/push Newline/imm32
333 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
334
335 e8/call write/disp32
336
337 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
338
339
340
341 68/push "_string"/imm32
342 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
343
344 e8/call write-buffered/disp32
345
346 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
347
348
349 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Next-string-literal/disp32
350 51/push-ECX
351
352 e8/call print-int32-decimal/disp32
353
354 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
355
356
357 51/push-ECX
358 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
359
360 e8/call write-stream-data/disp32
361
362 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
363
364
365 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
366 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
367
368 e8/call emit-metadata/disp32
369
370 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
371
372 ff 0/subop/increment 0/mod/indirect 5/rm32/.disp32 . . . Next-string-literal/disp32
373 $process-string-literal:end:
374
375 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x16/imm32
376
377 59/pop-to-ECX
378
379 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
380 5d/pop-to-EBP
381 c3/return
382
383 test-convert-is-idempotent-by-default:
384
385 55/push-EBP
386 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
387
388
389
390 68/push _test-input-stream/imm32
391
392 e8/call clear-stream/disp32
393
394 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
395
396
397 b8/copy-to-EAX _test-input-buffered-file/imm32
398 05/add-to-EAX 4/imm32
399 50/push-EAX
400
401 e8/call clear-stream/disp32
402
403 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
404
405
406 68/push _test-output-stream/imm32
407
408 e8/call clear-stream/disp32
409
410 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
411
412
413 b8/copy-to-EAX _test-output-buffered-file/imm32
414 05/add-to-EAX 4/imm32
415 50/push-EAX
416
417 e8/call clear-stream/disp32
418
419 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
420
421
422
423
424
425
426
427
428
429
430
431
432 68/push "# comment 1\n"/imm32
433 68/push _test-input-stream/imm32
434
435 e8/call write/disp32
436
437 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
438
439
440 68/push " # comment 2 indented\n"/imm32
441 68/push _test-input-stream/imm32
442
443 e8/call write/disp32
444
445 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
446
447
448 68/push "== code 0x1\n"/imm32
449 68/push _test-input-stream/imm32
450
451 e8/call write/disp32
452
453 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
454
455
456 68/push "# comment 3 inside a segment\n"/imm32
457 68/push _test-input-stream/imm32
458
459 e8/call write/disp32
460
461 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
462
463
464 68/push "1\n"/imm32
465 68/push _test-input-stream/imm32
466
467 e8/call write/disp32
468
469 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
470
471
472 68/push "\n"/imm32
473 68/push _test-input-stream/imm32
474
475 e8/call write/disp32
476
477 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
478
479
480 68/push "2 3 # comment 4 inline with other contents\n"/imm32
481 68/push _test-input-stream/imm32
482
483 e8/call write/disp32
484
485 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
486
487
488 68/push "== data 0x2\n"/imm32
489 68/push _test-input-stream/imm32
490
491 e8/call write/disp32
492
493 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
494
495
496 68/push "4 5/imm32\n"/imm32
497 68/push _test-input-stream/imm32
498
499 e8/call write/disp32
500
501 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
502
503
504 68/push _test-output-buffered-file/imm32
505 68/push _test-input-buffered-file/imm32
506
507 e8/call convert/disp32
508
509 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
510
511
512 68/push _test-output-buffered-file/imm32
513
514 e8/call flush/disp32
515
516 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
517
518
519
520
521
522
523
524
525
526
527
528 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
554
555
556 68/push "F - test-convert-is-idempotent-by-default/0"/imm32
557 68/push ""/imm32
558 68/push _test-output-stream/imm32
559
560 e8/call check-next-stream-line-equal/disp32
561
562 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
563
564
565 68/push "F - test-convert-is-idempotent-by-default/1"/imm32
566 68/push ""/imm32
567 68/push _test-output-stream/imm32
568
569 e8/call check-next-stream-line-equal/disp32
570
571 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
572
573
574 68/push "F - test-convert-is-idempotent-by-default/2"/imm32
575 68/push "== code 0x1 "/imm32
576 68/push _test-output-stream/imm32
577
578 e8/call check-next-stream-line-equal/disp32
579
580 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
581
582
583 68/push "F - test-convert-is-idempotent-by-default/3"/imm32
584 68/push ""/imm32
585 68/push _test-output-stream/imm32
586
587 e8/call check-next-stream-line-equal/disp32
588
589 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
590
591
592 68/push "F - test-convert-is-idempotent-by-default/4"/imm32
593 68/push "1 "/imm32
594 68/push _test-output-stream/imm32
595
596 e8/call check-next-stream-line-equal/disp32
597
598 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
599
600
601 68/push "F - test-convert-is-idempotent-by-default/5"/imm32
602 68/push ""/imm32
603 68/push _test-output-stream/imm32
604
605 e8/call check-next-stream-line-equal/disp32
606
607 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
608
609
610 68/push "F - test-convert-is-idempotent-by-default/6"/imm32
611 68/push "2 3 "/imm32
612 68/push _test-output-stream/imm32
613
614 e8/call check-next-stream-line-equal/disp32
615
616 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
617
618
619 68/push "F - test-convert-is-idempotent-by-default/7"/imm32
620 68/push "== data 0x2 "/imm32
621 68/push _test-output-stream/imm32
622
623 e8/call check-next-stream-line-equal/disp32
624
625 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
626
627
628 68/push "F - test-convert-is-idempotent-by-default/8"/imm32
629 68/push "4 5/imm32 "/imm32
630 68/push _test-output-stream/imm32
631
632 e8/call check-next-stream-line-equal/disp32
633
634 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
635
636 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
637 5d/pop-to-EBP
638 c3/return
639
640 test-convert-processes-string-literals:
641
642 55/push-EBP
643 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
644
645
646
647 68/push _test-input-stream/imm32
648
649 e8/call clear-stream/disp32
650
651 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
652
653
654 b8/copy-to-EAX _test-input-buffered-file/imm32
655 05/add-to-EAX 4/imm32
656 50/push-EAX
657
658 e8/call clear-stream/disp32
659
660 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
661
662
663 68/push _test-output-stream/imm32
664
665 e8/call clear-stream/disp32
666
667 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
668
669
670 b8/copy-to-EAX _test-output-buffered-file/imm32
671 05/add-to-EAX 4/imm32
672 50/push-EAX
673
674 e8/call clear-stream/disp32
675
676 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
677
678
679
680
681 68/push "== code 0x1\n"/imm32
682 68/push _test-input-stream/imm32
683
684 e8/call write/disp32
685
686 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
687
688
689 68/push "1 \"a\"/x\n"/imm32
690 68/push _test-input-stream/imm32
691
692 e8/call write/disp32
693
694 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
695
696
697 68/push "2 \"bc\"/y\n"/imm32
698 68/push _test-input-stream/imm32
699
700 e8/call write/disp32
701
702 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
703
704
705 68/push _test-output-buffered-file/imm32
706 68/push _test-input-buffered-file/imm32
707
708 e8/call convert/disp32
709
710 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
711
712
713 68/push _test-output-buffered-file/imm32
714
715 e8/call flush/disp32
716
717 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734 +-- 33 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
767
768
769 68/push "F - test-convert-processes-string-literals/0"/imm32
770 68/push "== code 0x1 "/imm32
771 68/push _test-output-stream/imm32
772
773 e8/call check-next-stream-line-equal/disp32
774
775 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
776
777
778 68/push "F - test-convert-processes-string-literals/1"/imm32
779 68/push "1 _string1/x "/imm32
780 68/push _test-output-stream/imm32
781
782 e8/call check-next-stream-line-equal/disp32
783
784 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
785
786
787 68/push "F - test-convert-processes-string-literals/2"/imm32
788 68/push "2 _string2/y "/imm32
789 68/push _test-output-stream/imm32
790
791 e8/call check-next-stream-line-equal/disp32
792
793 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
794
795
796 68/push "F - test-convert-processes-string-literals/3"/imm32
797 68/push "== data"/imm32
798 68/push _test-output-stream/imm32
799
800 e8/call check-next-stream-line-equal/disp32
801
802 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
803
804
805 68/push "F - test-convert-processes-string-literals/4"/imm32
806 68/push "_string1:"/imm32
807 68/push _test-output-stream/imm32
808
809 e8/call check-next-stream-line-equal/disp32
810
811 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
812
813
814 68/push "F - test-convert-processes-string-literals/5"/imm32
815 68/push "0x00000001/imm32 61/a "/imm32
816 68/push _test-output-stream/imm32
817
818 e8/call check-next-stream-line-equal/disp32
819
820 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
821
822
823 68/push "F - test-convert-processes-string-literals/6"/imm32
824 68/push "_string2:"/imm32
825 68/push _test-output-stream/imm32
826
827 e8/call check-next-stream-line-equal/disp32
828
829 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
830
831
832 68/push "F - test-convert-processes-string-literals/7"/imm32
833 68/push "0x00000002/imm32 62/b 63/c "/imm32
834 68/push _test-output-stream/imm32
835
836 e8/call check-next-stream-line-equal/disp32
837
838 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
839
840 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
841 5d/pop-to-EBP
842 c3/return
843
844
845 emit-string-literal-data:
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864 55/push-EBP
865 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
866
867 50/push-EAX
868 51/push-ECX
869 52/push-EDX
870 56/push-ESI
871
872 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 .
873
874 8b/copy 0/mod/indirect 6/rm32/ESI . . . 2/r32/EDX . .
875
876 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 6/r32/ESI 4/disp8 .
877 $emit-string-literal-data:emit-length:
878
879
880 56/push-ESI
881 52/push-EDX
882
883 e8/call string-length-at-start-of-slice/disp32
884
885 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
886
887
888
889 50/push-EAX
890 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
891
892 e8/call print-int32/disp32
893
894 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
895
896
897 68/push "/imm32 "/imm32
898 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
899
900 e8/call write/disp32
901
902 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
903 $emit-string-literal-data:loop-init:
904
905 42/increment-EDX
906
907 31/xor 3/mod/direct 1/rm32/ECX . . . 1/r32/ECX . .
908 $emit-string-literal-data:loop:
909
910 39/compare 3/mod/direct 2/rm32/EDX . . . 6/r32/ESI . .
911 73/jump-if-greater-or-equal-unsigned $emit-string-literal-data:end/disp8
912
913 8a/copy-byte 0/mod/indirect 2/rm32/EDX . . . 1/r32/CL . .
914
915 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0x22/imm32/dquote
916 74/jump-if-equal $emit-string-literal-data:end/disp8
917
918 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0x5c/imm32/backslash
919 75/jump-if-not-equal $emit-string-literal-data:emit/disp8
920
921 42/increment-EDX
922
923 39/compare 3/mod/direct 2/rm32/EDX . . . 6/r32/ESI . .
924 73/jump-if-greater-or-equal-unsigned $emit-string-literal-data:end/disp8
925
926 8a/copy-byte 0/mod/indirect 2/rm32/EDX . . . 1/r32/CL . .
927 $emit-string-literal-data:emit:
928
929
930 51/push-ECX
931 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
932
933 e8/call append-byte-hex/disp32
934
935 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
936
937
938
939 51/push-ECX
940
941 e8/call is-alphanumeric?/disp32
942
943 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
944
945 3d/compare-EAX-and 0/imm32
946 74/jump-if-equal $emit-string-literal-data:char-done/disp8
947
948
949 68/push Slash/imm32
950 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
951
952 e8/call write/disp32
953
954 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
955
956
957 51/push-ECX
958 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
959
960 e8/call append-byte/disp32
961
962 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
963 $emit-string-literal-data:char-done:
964
965
966 68/push Space/imm32
967 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
968
969 e8/call write/disp32
970
971 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
972
973 42/increment-EDX
974 eb/jump $emit-string-literal-data:loop/disp8
975 $emit-string-literal-data:end:
976
977 5e/pop-to-ESI
978 5a/pop-to-EDX
979 59/pop-to-ECX
980 58/pop-to-EAX
981
982 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
983 5d/pop-to-EBP
984 c3/return
985
986 is-alphanumeric?:
987
988 55/push-EBP
989 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
990
991 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 0/r32/EAX 8/disp8 .
992
993 3d/compare-EAX-with 0x30/imm32/0
994 7c/jump-if-lesser $is-alphanumeric?:false/disp8
995
996 3d/compare-EAX-with 0x39/imm32/9
997 7e/jump-if-lesser-or-equal $is-alphanumeric?:true/disp8
998
999 3d/compare-EAX-with 0x41/imm32/A
1000 7c/jump-if-lesser $is-alphanumeric?:false/disp8
1001
1002 3d/compare-EAX-with 0x5a/imm32/Z
1003 7e/jump-if-lesser-or-equal $is-alphanumeric?:true/disp8
1004
1005 3d/compare-EAX-with 0x61/imm32/a
1006 7c/jump-if-lesser $is-alphanumeric?:false/disp8
1007
1008 3d/compare-EAX-with 0x7a/imm32/z
1009 7e/jump-if-lesser-or-equal $is-alphanumeric?:true/disp8
1010
1011 $is-alphanumeric?:false:
1012 b8/copy-to-EAX 0/imm32/false
1013 eb/jump $is-alphanumeric?:end/disp8
1014 $is-alphanumeric?:true:
1015 b8/copy-to-EAX 1/imm32/true
1016 $is-alphanumeric?:end:
1017
1018 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1019 5d/pop-to-EBP
1020 c3/return
1021
1022 test-emit-string-literal-data:
1023
1024 55/push-EBP
1025 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1026
1027
1028
1029 68/push _test-output-stream/imm32
1030
1031 e8/call clear-stream/disp32
1032
1033 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1034
1035 68/push _test-slice-abc-limit/imm32
1036 68/push _test-slice-abc/imm32
1037 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1038
1039
1040 51/push-ECX
1041 68/push _test-output-stream/imm32
1042
1043 e8/call emit-string-literal-data/disp32
1044
1045 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1046 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1072
1073
1074 68/push "F - test-emit-string-literal-data"/imm32
1075 68/push "0x00000003/imm32 61/a 62/b 63/c "/imm32
1076 68/push _test-output-stream/imm32
1077
1078 e8/call check-stream-equal/disp32
1079
1080 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1081
1082 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1083 5d/pop-to-EBP
1084 c3/return
1085
1086 test-emit-string-literal-data-empty:
1087
1088 55/push-EBP
1089 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1090
1091
1092
1093 68/push _test-output-stream/imm32
1094
1095 e8/call clear-stream/disp32
1096
1097 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1098
1099 68/push 0/imm32/end
1100 68/push 0/imm32/start
1101 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1102
1103
1104 51/push-ECX
1105 68/push _test-output-stream/imm32
1106
1107 e8/call emit-string-literal-data/disp32
1108
1109 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1110 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1136
1137
1138 68/push "F - test-emit-string-literal-data-empty"/imm32
1139 68/push "0x00000000/imm32 "/imm32
1140 68/push _test-output-stream/imm32
1141
1142 e8/call check-stream-equal/disp32
1143
1144 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1145
1146 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1147 5d/pop-to-EBP
1148 c3/return
1149
1150
1151 test-emit-string-literal-data-no-metadata-for-non-alphanumerics:
1152
1153 55/push-EBP
1154 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1155
1156
1157
1158 68/push _test-output-stream/imm32
1159
1160 e8/call clear-stream/disp32
1161
1162 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1163
1164 68/push _test-slice-a-space-b-limit/imm32
1165 68/push _test-slice-a-space-b/imm32
1166 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1167
1168
1169 51/push-ECX
1170 68/push _test-output-stream/imm32
1171
1172 e8/call emit-string-literal-data/disp32
1173
1174 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1175 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1201
1202
1203 68/push "F - test-emit-string-literal-data-no-metadata-for-non-alphanumerics"/imm32
1204 68/push "0x00000003/imm32 61/a 20 62/b "/imm32
1205 68/push _test-output-stream/imm32
1206
1207 e8/call check-stream-equal/disp32
1208
1209 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1210
1211 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1212 5d/pop-to-EBP
1213 c3/return
1214
1215 test-emit-string-literal-data-handles-escape-sequences:
1216
1217 55/push-EBP
1218 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1219
1220
1221
1222 68/push _test-output-stream/imm32
1223
1224 e8/call clear-stream/disp32
1225
1226 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1227
1228 68/push _test-slice-a-dquote-b-limit/imm32
1229 68/push _test-slice-a-dquote-b/imm32
1230 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1231
1232
1233 51/push-ECX
1234 68/push _test-output-stream/imm32
1235
1236 e8/call emit-string-literal-data/disp32
1237
1238 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1239 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1265
1266
1267 68/push "F - test-emit-string-literal-data-handles-escape-sequences"/imm32
1268 68/push "0x00000003/imm32 61/a 22 62/b "/imm32
1269 68/push _test-output-stream/imm32
1270
1271 e8/call check-stream-equal/disp32
1272
1273 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1274
1275 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1276 5d/pop-to-EBP
1277 c3/return
1278
1279
1280 emit-metadata:
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297 55/push-EBP
1298 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1299
1300 50/push-EAX
1301 51/push-ECX
1302 52/push-EDX
1303 53/push-EBX
1304 56/push-ESI
1305
1306 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 .
1307
1308 8b/copy 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . .
1309
1310 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 2/r32/EDX 4/disp8 .
1311
1312 52/push-EDX
1313 68/push 0/imm32
1314 89/copy 3/mod/direct 3/rm32/EBX . . . 4/r32/ESP . .
1315
1316 b8/copy-to-EAX 0/imm32
1317 $emit-metadata:check-for-string-literal:
1318
1319 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
1320 3d/compare-EAX-and 0x22/imm32/dquote
1321 75/jump-if-not-equal $emit-metadata:skip-datum-loop/disp8
1322 $emit-metadata:skip-string-literal:
1323
1324
1325 52/push-EDX
1326 51/push-ECX
1327
1328 e8/call skip-string-in-slice/disp32
1329
1330 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1331
1332 89/copy 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
1333 eb/jump $emit-metadata:emit/disp8
1334 $emit-metadata:skip-datum-loop:
1335
1336
1337 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
1338 74/jump-if-equal $emit-metadata:end/disp8
1339
1340 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
1341 3d/compare-EAX-and 0x2f/imm32/slash
1342 74/jump-if-equal $emit-metadata:emit/disp8
1343
1344 41/increment-ECX
1345 eb/jump $emit-metadata:skip-datum-loop/disp8
1346 $emit-metadata:emit:
1347
1348 89/copy 0/mod/indirect 3/rm32/EBX . . . 1/r32/ECX . .
1349
1350
1351 53/push-EBX
1352 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1353
1354 e8/call write-slice-buffered/disp32
1355
1356 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . 8/imm32 .
1357 $emit-metadata:end:
1358
1359 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . 8/imm32 .
1360
1361 5e/pop-to-ESI
1362 5b/pop-to-EBX
1363 5a/pop-to-EDX
1364 59/pop-to-ECX
1365 58/pop-to-EAX
1366
1367 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1368 5d/pop-to-EBP
1369 c3/return
1370
1371 test-emit-metadata:
1372
1373 55/push-EBP
1374 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1375
1376
1377
1378 68/push _test-output-stream/imm32
1379
1380 e8/call clear-stream/disp32
1381
1382 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1383
1384
1385 b8/copy-to-EAX _test-output-buffered-file/imm32
1386 05/add-to-EAX 4/imm32
1387 50/push-EAX
1388
1389 e8/call clear-stream/disp32
1390
1391 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1392
1393 b8/copy-to-EAX "abc/def"/imm32
1394 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1395 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1396 05/add-to-EAX 4/imm32
1397
1398 51/push-ECX
1399 50/push-EAX
1400 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1401
1402
1403 51/push-ECX
1404 68/push _test-output-buffered-file/imm32
1405
1406 e8/call emit-metadata/disp32
1407
1408 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1409
1410
1411 68/push _test-output-buffered-file/imm32
1412
1413 e8/call flush/disp32
1414
1415 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1416
1417
1418 68/push "F - test-emit-metadata"/imm32
1419 68/push "/def"/imm32
1420 68/push _test-output-stream/imm32
1421
1422 e8/call check-stream-equal/disp32
1423
1424 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1425
1426 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1427 5d/pop-to-EBP
1428 c3/return
1429
1430 test-emit-metadata-none:
1431
1432 55/push-EBP
1433 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1434
1435
1436
1437 68/push _test-output-stream/imm32
1438
1439 e8/call clear-stream/disp32
1440
1441 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1442
1443
1444 b8/copy-to-EAX _test-output-buffered-file/imm32
1445 05/add-to-EAX 4/imm32
1446 50/push-EAX
1447
1448 e8/call clear-stream/disp32
1449
1450 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1451
1452 b8/copy-to-EAX "abc"/imm32
1453 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1454 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1455 05/add-to-EAX 4/imm32
1456
1457 51/push-ECX
1458 50/push-EAX
1459 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1460
1461
1462 51/push-ECX
1463 68/push _test-output-buffered-file/imm32
1464
1465 e8/call emit-metadata/disp32
1466
1467 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1468
1469
1470 68/push _test-output-buffered-file/imm32
1471
1472 e8/call flush/disp32
1473
1474 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1475
1476
1477 68/push "F - test-emit-metadata-none"/imm32
1478 68/push ""/imm32
1479 68/push _test-output-stream/imm32
1480
1481 e8/call check-stream-equal/disp32
1482
1483 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1484
1485 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1486 5d/pop-to-EBP
1487 c3/return
1488
1489 test-emit-metadata-multiple:
1490
1491 55/push-EBP
1492 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1493
1494
1495
1496 68/push _test-output-stream/imm32
1497
1498 e8/call clear-stream/disp32
1499
1500 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1501
1502
1503 b8/copy-to-EAX _test-output-buffered-file/imm32
1504 05/add-to-EAX 4/imm32
1505 50/push-EAX
1506
1507 e8/call clear-stream/disp32
1508
1509 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1510
1511 b8/copy-to-EAX "abc/def/ghi"/imm32
1512 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1513 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1514 05/add-to-EAX 4/imm32
1515
1516 51/push-ECX
1517 50/push-EAX
1518 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1519
1520
1521 51/push-ECX
1522 68/push _test-output-buffered-file/imm32
1523
1524 e8/call emit-metadata/disp32
1525
1526 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1527
1528
1529 68/push _test-output-buffered-file/imm32
1530
1531 e8/call flush/disp32
1532
1533 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1534
1535
1536 68/push "F - test-emit-metadata-multiple"/imm32
1537 68/push "/def/ghi"/imm32
1538 68/push _test-output-stream/imm32
1539
1540 e8/call check-stream-equal/disp32
1541
1542 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1543
1544 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1545 5d/pop-to-EBP
1546 c3/return
1547
1548 test-emit-metadata-when-no-datum:
1549
1550 55/push-EBP
1551 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1552
1553
1554
1555 68/push _test-output-stream/imm32
1556
1557 e8/call clear-stream/disp32
1558
1559 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1560
1561
1562 b8/copy-to-EAX _test-output-buffered-file/imm32
1563 05/add-to-EAX 4/imm32
1564 50/push-EAX
1565
1566 e8/call clear-stream/disp32
1567
1568 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1569
1570 b8/copy-to-EAX "/abc"/imm32
1571
1572 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1573 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1574 51/push-ECX
1575
1576 05/add-to-EAX 4/imm32
1577 50/push-EAX
1578
1579 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1580
1581
1582 51/push-ECX
1583 68/push _test-output-buffered-file/imm32
1584
1585 e8/call emit-metadata/disp32
1586
1587 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1588
1589
1590 68/push _test-output-buffered-file/imm32
1591
1592 e8/call flush/disp32
1593
1594 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1595
1596
1597 68/push "F - test-emit-metadata-when-no-datum"/imm32
1598 68/push "/abc"/imm32
1599 68/push _test-output-stream/imm32
1600
1601 e8/call check-stream-equal/disp32
1602
1603 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1604
1605 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1606 5d/pop-to-EBP
1607 c3/return
1608
1609 test-emit-metadata-in-string-literal:
1610
1611 55/push-EBP
1612 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1613
1614
1615
1616 68/push _test-output-stream/imm32
1617
1618 e8/call clear-stream/disp32
1619
1620 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1621
1622
1623 b8/copy-to-EAX _test-output-buffered-file/imm32
1624 05/add-to-EAX 4/imm32
1625 50/push-EAX
1626
1627 e8/call clear-stream/disp32
1628
1629 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1630
1631 68/push _test-slice-literal-string-with-limit/imm32
1632 68/push _test-slice-literal-string/imm32/start
1633 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1634
1635
1636 51/push-ECX
1637 68/push _test-output-buffered-file/imm32
1638
1639 e8/call emit-metadata/disp32
1640
1641 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1642
1643
1644 68/push _test-output-buffered-file/imm32
1645
1646 e8/call flush/disp32
1647
1648 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1649 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1675
1676
1677 68/push "F - test-emit-metadata-in-string-literal"/imm32
1678 68/push "/ghi"/imm32
1679 68/push _test-output-stream/imm32
1680
1681 e8/call check-stream-equal/disp32
1682
1683 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1684
1685 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1686 5d/pop-to-EBP
1687 c3/return
1688
1689
1690
1691 next-word-or-string:
1692
1693 55/push-EBP
1694 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1695
1696 50/push-EAX
1697 51/push-ECX
1698 56/push-ESI
1699 57/push-EDI
1700
1701 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
1702
1703 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 0xc/disp8 .
1704
1705
1706 68/push 0x20/imm32/space
1707 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1708
1709 e8/call skip-chars-matching/disp32
1710
1711 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1712 $next-word-or-string:check0:
1713
1714
1715 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
1716
1717 3b/compare 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1718 7c/jump-if-lesser $next-word-or-string:check-for-comment/disp8
1719
1720 c7 0/subop/copy 0/mod/direct 7/rm32/EDI . . . . . 0/imm32
1721 c7 0/subop/copy 1/mod/*+disp8 7/rm32/EDI . . . . 4/disp8 0/imm32
1722 eb/jump $next-word-or-string:end/disp8
1723 $next-word-or-string:check-for-comment:
1724
1725 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
1726 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/EAX 0xc/disp8 .
1727 89/copy 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
1728
1729
1730 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
1731 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xc/disp8 .
1732
1733 3d/compare-EAX-and 0x23/imm32/pound
1734 75/jump-if-not-equal $next-word-or-string:check-for-string-literal/disp8
1735 $next-word-or-string:comment:
1736
1737 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1738 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 0/index/EAX . 0/r32/EAX 0xc/disp8 .
1739 89/copy 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 .
1740
1741 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1742 89/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
1743
1744 eb/jump $next-word-or-string:end/disp8
1745 $next-word-or-string:check-for-string-literal:
1746
1747
1748 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
1749 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xc/disp8 .
1750
1751 3d/compare-EAX-and 0x22/imm32/dquote
1752 75/jump-if-not-equal $next-word-or-string:regular-word/disp8
1753 $next-word-or-string:string-literal:
1754
1755
1756 56/push-ESI
1757
1758 e8/call skip-string/disp32
1759
1760 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1761
1762 $next-word-or-string:regular-word:
1763
1764
1765 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1766
1767 e8/call skip-chars-not-matching-whitespace/disp32
1768
1769 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1770
1771 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
1772 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/EAX 0xc/disp8 .
1773 89/copy 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 .
1774 $next-word-or-string:end:
1775
1776 5f/pop-to-EDI
1777 5e/pop-to-ESI
1778 59/pop-to-ECX
1779 58/pop-to-EAX
1780
1781 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1782 5d/pop-to-EBP
1783 c3/return
1784
1785 test-next-word-or-string:
1786
1787 55/push-EBP
1788 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1789
1790
1791
1792 68/push _test-input-stream/imm32
1793
1794 e8/call clear-stream/disp32
1795
1796 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1797
1798 68/push 0/imm32/end
1799 68/push 0/imm32/start
1800 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1801
1802
1803 68/push " ab"/imm32
1804 68/push _test-input-stream/imm32
1805
1806 e8/call write/disp32
1807
1808 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1809
1810
1811 51/push-ECX
1812 68/push _test-input-stream/imm32
1813
1814 e8/call next-word-or-string/disp32
1815
1816 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1817
1818
1819 68/push "F - test-next-word-or-string/updates-stream-read-correctly"/imm32
1820 68/push 4/imm32
1821 b8/copy-to-EAX _test-input-stream/imm32
1822 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
1823
1824 e8/call check-ints-equal/disp32
1825
1826 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1827
1828
1829
1830 68/push "F - test-next-word-or-string: start"/imm32
1831 68/push 0xe/imm32
1832
1833 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
1834 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
1835 50/push-EAX
1836
1837 e8/call check-ints-equal/disp32
1838
1839 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1840
1841
1842
1843 68/push "F - test-next-word-or-string: end"/imm32
1844 68/push 0x10/imm32
1845
1846 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
1847 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
1848 50/push-EAX
1849
1850 e8/call check-ints-equal/disp32
1851
1852 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1853
1854 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1855 5d/pop-to-EBP
1856 c3/return
1857
1858 test-next-word-or-string-returns-whole-comment:
1859
1860 55/push-EBP
1861 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1862
1863
1864
1865 68/push _test-input-stream/imm32
1866
1867 e8/call clear-stream/disp32
1868
1869 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1870
1871 68/push 0/imm32/end
1872 68/push 0/imm32/start
1873 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1874
1875
1876 68/push " # a"/imm32
1877 68/push _test-input-stream/imm32
1878
1879 e8/call write/disp32
1880
1881 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1882
1883
1884 51/push-ECX
1885 68/push _test-input-stream/imm32
1886
1887 e8/call next-word-or-string/disp32
1888
1889 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1890
1891
1892 68/push "F - test-next-word-or-string-returns-whole-comment/updates-stream-read-correctly"/imm32
1893 68/push 5/imm32
1894 b8/copy-to-EAX _test-input-stream/imm32
1895 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
1896
1897 e8/call check-ints-equal/disp32
1898
1899 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1900
1901
1902
1903 68/push "F - test-next-word-or-string-returns-whole-comment: start"/imm32
1904 68/push 0xe/imm32
1905
1906 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
1907 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
1908 50/push-EAX
1909
1910 e8/call check-ints-equal/disp32
1911
1912 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1913
1914
1915
1916 68/push "F - test-next-word-or-string-returns-whole-comment: end"/imm32
1917 68/push 0x11/imm32
1918
1919 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
1920 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
1921 50/push-EAX
1922
1923 e8/call check-ints-equal/disp32
1924
1925 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1926
1927 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1928 5d/pop-to-EBP
1929 c3/return
1930
1931 test-next-word-or-string-returns-empty-string-on-eof:
1932
1933 55/push-EBP
1934 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1935
1936
1937
1938 68/push _test-input-stream/imm32
1939
1940 e8/call clear-stream/disp32
1941
1942 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1943
1944 68/push 0/imm32/end
1945 68/push 0/imm32/start
1946 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1947
1948
1949
1950 51/push-ECX
1951 68/push _test-input-stream/imm32
1952
1953 e8/call next-word-or-string/disp32
1954
1955 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1956
1957
1958 68/push "F - test-next-word-or-string-returns-empty-string-on-eof"/imm32
1959 68/push 0/imm32
1960
1961 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
1962 2b/subtract 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
1963 50/push-EAX
1964
1965 e8/call check-ints-equal/disp32
1966
1967 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1968
1969 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1970 5d/pop-to-EBP
1971 c3/return
1972
1973 test-next-word-or-string-returns-whole-string:
1974
1975 55/push-EBP
1976 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1977
1978
1979
1980 68/push _test-input-stream/imm32
1981
1982 e8/call clear-stream/disp32
1983
1984 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1985
1986 68/push 0/imm32/end
1987 68/push 0/imm32/start
1988 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1989
1990
1991 68/push " \"a b\"/imm32 "/imm32
1992 68/push _test-input-stream/imm32
1993
1994 e8/call write/disp32
1995
1996 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1997
1998
1999 51/push-ECX
2000 68/push _test-input-stream/imm32
2001
2002 e8/call next-word-or-string/disp32
2003
2004 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2005
2006
2007
2008 68/push "F - test-next-word-or-string-returns-whole-string: start"/imm32
2009 68/push 0xd/imm32
2010
2011 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
2012 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
2013 50/push-EAX
2014
2015 e8/call check-ints-equal/disp32
2016
2017 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2018
2019
2020
2021 68/push "F - test-next-word-or-string-returns-whole-string: end"/imm32
2022 68/push 0x18/imm32
2023
2024 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
2025 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
2026 50/push-EAX
2027
2028 e8/call check-ints-equal/disp32
2029
2030 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2031
2032 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2033 5d/pop-to-EBP
2034 c3/return
2035
2036 test-next-word-or-string-returns-string-with-escapes:
2037
2038 55/push-EBP
2039 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2040
2041
2042
2043 68/push _test-input-stream/imm32
2044
2045 e8/call clear-stream/disp32
2046
2047 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2048
2049 68/push 0/imm32/end
2050 68/push 0/imm32/start
2051 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2052
2053
2054 68/push " \"a\\\"b\"/x"/imm32
2055 68/push _test-input-stream/imm32
2056
2057 e8/call write/disp32
2058
2059 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2060
2061
2062 51/push-ECX
2063 68/push _test-input-stream/imm32
2064
2065 e8/call next-word-or-string/disp32
2066
2067 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2068
2069
2070
2071 68/push "F - test-next-word-or-string-returns-string-with-escapes: start"/imm32
2072 68/push 0xd/imm32
2073
2074 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
2075 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
2076 50/push-EAX
2077
2078 e8/call check-ints-equal/disp32
2079
2080 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2081
2082
2083
2084 68/push "F - test-next-word-or-string-returns-string-with-escapes: end"/imm32
2085 68/push 0x15/imm32
2086
2087 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
2088 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
2089 50/push-EAX
2090
2091 e8/call check-ints-equal/disp32
2092
2093 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2094
2095 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2096 5d/pop-to-EBP
2097 c3/return
2098
2099
2100
2101 skip-string:
2102
2103 55/push-EBP
2104 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2105
2106 50/push-EAX
2107 51/push-ECX
2108 52/push-EDX
2109
2110 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 8/disp8 .
2111
2112
2113 8b/copy 1/mod/*+disp8 1/rm32/ECX . . 2/r32/EDX 8/disp8 .
2114 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ECX 2/index/EDX . 2/r32/EDX 0xc/disp8 .
2115 52/push-EDX
2116
2117 8b/copy 1/mod/*+disp8 1/rm32/ECX . . 2/r32/EDX 4/disp8 .
2118 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ECX 2/index/EDX . 2/r32/EDX 0xc/disp8 .
2119 52/push-EDX
2120
2121 e8/call skip-string-in-slice/disp32
2122
2123 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2124
2125 29/subtract 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
2126 2d/subtract-from-EAX 0xc/imm32
2127 89/copy 1/mod/*+disp8 1/rm32/ECX . . 0/r32/EAX 4/disp8 .
2128 $skip-string:end:
2129
2130 5a/pop-to-EDX
2131 59/pop-to-ECX
2132 58/pop-to-EAX
2133
2134 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2135 5d/pop-to-EBP
2136 c3/return
2137
2138 test-skip-string:
2139
2140 55/push-EBP
2141 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2142
2143
2144
2145 68/push _test-input-stream/imm32
2146
2147 e8/call clear-stream/disp32
2148
2149 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2150
2151
2152
2153 68/push "\"abc\" def"/imm32
2154 68/push _test-input-stream/imm32
2155
2156 e8/call write/disp32
2157
2158 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2159
2160
2161 68/push "F - test-skip-string/precondition"/imm32
2162 68/push 0/imm32
2163 b8/copy-to-EAX _test-input-stream/imm32
2164 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
2165
2166 e8/call check-ints-equal/disp32
2167
2168 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2169
2170
2171 68/push _test-input-stream/imm32
2172
2173 e8/call skip-string/disp32
2174
2175 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2176
2177
2178 68/push "F - test-skip-string"/imm32
2179 68/push 5/imm32
2180 b8/copy-to-EAX _test-input-stream/imm32
2181 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
2182
2183 e8/call check-ints-equal/disp32
2184
2185 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2186
2187 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2188 5d/pop-to-EBP
2189 c3/return
2190
2191 test-skip-string-ignores-spaces:
2192
2193 55/push-EBP
2194 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2195
2196
2197
2198 68/push _test-input-stream/imm32
2199
2200 e8/call clear-stream/disp32
2201
2202 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2203
2204
2205
2206 68/push "\"a b\"/yz"/imm32
2207 68/push _test-input-stream/imm32
2208
2209 e8/call write/disp32
2210
2211 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2212
2213
2214 68/push "F - test-skip-string-ignores-spaces/precondition"/imm32
2215 68/push 0/imm32
2216 b8/copy-to-EAX _test-input-stream/imm32
2217 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
2218
2219 e8/call check-ints-equal/disp32
2220
2221 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2222
2223
2224 68/push _test-input-stream/imm32
2225
2226 e8/call skip-string/disp32
2227
2228 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2229
2230
2231 68/push "F - test-skip-string-ignores-spaces"/imm32
2232 68/push 5/imm32
2233 b8/copy-to-EAX _test-input-stream/imm32
2234 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
2235
2236 e8/call check-ints-equal/disp32
2237
2238 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2239
2240 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2241 5d/pop-to-EBP
2242 c3/return
2243
2244 test-skip-string-ignores-escapes:
2245
2246 55/push-EBP
2247 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2248
2249
2250
2251 68/push _test-input-stream/imm32
2252
2253 e8/call clear-stream/disp32
2254
2255 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2256
2257
2258
2259 68/push "\"a\\\"b\"/yz"/imm32
2260 68/push _test-input-stream/imm32
2261
2262 e8/call write/disp32
2263
2264 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2265
2266
2267 68/push "F - test-skip-string-ignores-escapes/precondition"/imm32
2268 68/push 0/imm32
2269 b8/copy-to-EAX _test-input-stream/imm32
2270 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
2271
2272 e8/call check-ints-equal/disp32
2273
2274 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2275
2276
2277 68/push _test-input-stream/imm32
2278
2279 e8/call skip-string/disp32
2280
2281 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2282
2283
2284 68/push "F - test-skip-string-ignores-escapes"/imm32
2285 68/push 6/imm32
2286 b8/copy-to-EAX _test-input-stream/imm32
2287 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
2288
2289 e8/call check-ints-equal/disp32
2290
2291 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2292
2293 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2294 5d/pop-to-EBP
2295 c3/return
2296
2297 test-skip-string-works-from-mid-stream:
2298
2299 55/push-EBP
2300 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2301
2302
2303
2304 68/push _test-input-stream/imm32
2305
2306 e8/call clear-stream/disp32
2307
2308 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2309
2310
2311
2312 68/push "0 \"a\\\"b\"/yz"/imm32
2313 68/push _test-input-stream/imm32
2314
2315 e8/call write/disp32
2316
2317 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2318
2319 c7 0/subop/copy 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 2/imm32
2320
2321
2322 68/push _test-input-stream/imm32
2323
2324 e8/call skip-string/disp32
2325
2326 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2327
2328
2329 68/push "F - test-skip-string-works-from-mid-stream"/imm32
2330 68/push 8/imm32
2331 b8/copy-to-EAX _test-input-stream/imm32
2332 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
2333
2334 e8/call check-ints-equal/disp32
2335
2336 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2337
2338 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2339 5d/pop-to-EBP
2340 c3/return
2341
2342 skip-string-in-slice:
2343
2344 55/push-EBP
2345 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2346
2347 51/push-ECX
2348 52/push-EDX
2349 53/push-EBX
2350
2351 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 8/disp8 .
2352
2353 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 2/r32/EDX 0xc/disp8 .
2354
2355 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
2356
2357 41/increment-ECX
2358 $skip-string-in-slice:loop:
2359
2360 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
2361 73/jump-if-greater-unsigned-or-equal $skip-string-in-slice:return-curr/disp8
2362
2363 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
2364 $skip-string-in-slice:dquote:
2365
2366 3d/compare-EAX-and 0x22/imm32/double-quote
2367 74/jump-if-equal $skip-string-in-slice:break/disp8
2368 $skip-string-in-slice:check-for-escape:
2369
2370 3d/compare-EAX-and 0x5c/imm32/backslash
2371 75/jump-if-not-equal $skip-string-in-slice:continue/disp8
2372 $skip-string-in-slice:escape:
2373 41/increment-ECX
2374 $skip-string-in-slice:continue:
2375
2376 41/increment-ECX
2377 eb/jump $skip-string-in-slice:loop/disp8
2378 $skip-string-in-slice:break:
2379
2380 41/increment-ECX
2381 $skip-string-in-slice:return-curr:
2382
2383 89/copy 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
2384 $skip-string-in-slice:end:
2385
2386 5b/pop-to-EBX
2387 5a/pop-to-EDX
2388 59/pop-to-ECX
2389
2390 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2391 5d/pop-to-EBP
2392 c3/return
2393
2394 test-skip-string-in-slice:
2395
2396 55/push-EBP
2397 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2398
2399 b8/copy-to-EAX "\"abc\" def"/imm32
2400 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2401 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2402 05/add-to-EAX 4/imm32
2403
2404
2405 51/push-ECX
2406 50/push-EAX
2407
2408 e8/call skip-string-in-slice/disp32
2409
2410 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2411
2412
2413 68/push "F - test-skip-string-in-slice"/imm32
2414 68/push 4/imm32
2415
2416 29/subtract 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
2417 51/push-ECX
2418
2419 e8/call check-ints-equal/disp32
2420
2421 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2422
2423 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2424 5d/pop-to-EBP
2425 c3/return
2426
2427 test-skip-string-in-slice-ignores-spaces:
2428
2429 55/push-EBP
2430 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2431
2432 b8/copy-to-EAX "\"a b\"/yz"/imm32
2433 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2434 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2435 05/add-to-EAX 4/imm32
2436
2437
2438 51/push-ECX
2439 50/push-EAX
2440
2441 e8/call skip-string-in-slice/disp32
2442
2443 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2444
2445
2446 68/push "F - test-skip-string-in-slice-ignores-spaces"/imm32
2447 68/push 3/imm32
2448
2449 29/subtract 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
2450 51/push-ECX
2451
2452 e8/call check-ints-equal/disp32
2453
2454 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2455
2456 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2457 5d/pop-to-EBP
2458 c3/return
2459
2460 test-skip-string-in-slice-ignores-escapes:
2461
2462 55/push-EBP
2463 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2464
2465 b8/copy-to-EAX "\"a\\\"b\"/yz"/imm32
2466 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2467 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2468 05/add-to-EAX 4/imm32
2469
2470
2471 51/push-ECX
2472 50/push-EAX
2473
2474 e8/call skip-string-in-slice/disp32
2475
2476 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2477
2478
2479 68/push "F - test-skip-string-in-slice-ignores-escapes"/imm32
2480 68/push 3/imm32
2481
2482 29/subtract 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
2483 51/push-ECX
2484
2485 e8/call check-ints-equal/disp32
2486
2487 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2488
2489 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2490 5d/pop-to-EBP
2491 c3/return
2492
2493 test-skip-string-in-slice-stops-at-end:
2494
2495 55/push-EBP
2496 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2497
2498 b8/copy-to-EAX "\"abc"/imm32
2499 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2500 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2501 05/add-to-EAX 4/imm32
2502
2503
2504 51/push-ECX
2505 50/push-EAX
2506
2507 e8/call skip-string-in-slice/disp32
2508
2509 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2510
2511
2512 68/push "F - test-skip-string-in-slice-stops-at-end"/imm32
2513 68/push 0/imm32
2514
2515 29/subtract 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
2516 51/push-ECX
2517
2518 e8/call check-ints-equal/disp32
2519
2520 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2521
2522 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2523 5d/pop-to-EBP
2524 c3/return
2525
2526 string-length-at-start-of-slice:
2527
2528 55/push-EBP
2529 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2530
2531 51/push-ECX
2532 52/push-EDX
2533 53/push-EBX
2534
2535 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 8/disp8 .
2536
2537 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 2/r32/EDX 0xc/disp8 .
2538
2539 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
2540
2541 31/xor 3/mod/direct 3/rm32/EBX . . . 3/r32/EBX . .
2542
2543 41/increment-ECX
2544 $string-length-at-start-of-slice:loop:
2545
2546 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
2547 73/jump-if-greater-unsigned-or-equal $string-length-at-start-of-slice:end/disp8
2548
2549 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 3/r32/BL . .
2550 $string-length-at-start-of-slice:dquote:
2551
2552 81 7/subop/compare 3/mod/direct 3/rm32/EBX . . . . . 0x22/imm32/dquote
2553 74/jump-if-equal $string-length-at-start-of-slice:end/disp8
2554 $string-length-at-start-of-slice:check-for-escape:
2555
2556 81 7/subop/compare 3/mod/direct 3/rm32/EBX . . . . . 0x5c/imm32/backslash
2557 75/jump-if-not-equal $string-length-at-start-of-slice:continue/disp8
2558 $string-length-at-start-of-slice:escape:
2559
2560 41/increment-ECX
2561 $string-length-at-start-of-slice:continue:
2562
2563 40/increment-EAX
2564
2565 41/increment-ECX
2566 eb/jump $string-length-at-start-of-slice:loop/disp8
2567 $string-length-at-start-of-slice:end:
2568
2569 5b/pop-to-EBX
2570 5a/pop-to-EDX
2571 59/pop-to-ECX
2572
2573 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2574 5d/pop-to-EBP
2575 c3/return
2576
2577 test-string-length-at-start-of-slice:
2578
2579 55/push-EBP
2580 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2581
2582 b8/copy-to-EAX "\"abc\" def"/imm32
2583 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2584 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2585 05/add-to-EAX 4/imm32
2586
2587
2588 51/push-ECX
2589 50/push-EAX
2590
2591 e8/call string-length-at-start-of-slice/disp32
2592
2593 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2594
2595
2596 68/push "F - test-string-length-at-start-of-slice"/imm32
2597 68/push 3/imm32
2598 50/push-EAX
2599
2600 e8/call check-ints-equal/disp32
2601
2602 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2603
2604 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2605 5d/pop-to-EBP
2606 c3/return
2607
2608 test-string-length-at-start-of-slice-escaped:
2609
2610 55/push-EBP
2611 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2612
2613 b8/copy-to-EAX "\"ab\\c\" def"/imm32
2614 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2615 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2616 05/add-to-EAX 4/imm32
2617
2618
2619 51/push-ECX
2620 50/push-EAX
2621
2622 e8/call string-length-at-start-of-slice/disp32
2623
2624 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2625
2626
2627 68/push "F - test-string-length-at-start-of-slice-escaped"/imm32
2628 68/push 3/imm32
2629 50/push-EAX
2630
2631 e8/call check-ints-equal/disp32
2632
2633 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2634
2635 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2636 5d/pop-to-EBP
2637 c3/return
2638
2639 == data
2640
2641 Segment-size:
2642 0x1000/imm32/4KB
2643
2644 Next-string-literal:
2645 1/imm32
2646
2647
2648 Space:
2649
2650 1/imm32
2651
2652 20/space
2653
2654
2655 Slash:
2656
2657 1/imm32
2658
2659 2f/slash
2660
2661 _test-slice-abc:
2662 22/dquote 61/a 62/b 63/c 22/dquote
2663 2f/slash 64/d
2664 _test-slice-abc-limit:
2665
2666 _test-slice-a-space-b:
2667 22/dquote 61/a 20/space 62/b 22/dquote
2668 _test-slice-a-space-b-limit:
2669
2670 _test-slice-a-dquote-b:
2671 22/dquote 61/a 5c/backslash 22/dquote 62/b 22/dquote
2672 _test-slice-a-dquote-b-limit:
2673
2674
2675 _test-slice-literal-string:
2676 22/dquote
2677 61/a 62/b 63/c
2678 2f/slash 64/d 65/e 66/f
2679 22/dquote
2680 2f/slash 67/g 68/h 69/i
2681 _test-slice-literal-string-with-limit:
2682
2683