https://github.com/akkartik/mu/blob/master/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 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
25
26
27
28
29 68/push Heap/imm32
30 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Heap-size/disp32
31
32 e8/call new-segment/disp32
33
34 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
35
36
37
38 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 0/disp8 1/imm32
39 7e/jump-if-lesser-or-equal $subx-dquotes-main:interactive/disp8
40
41
42
43 68/push "test"/imm32
44 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
45
46 e8/call kernel-string-equal?/disp32
47
48 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
49
50 3d/compare-eax-and 0/imm32
51 74/jump-if-equal $subx-dquotes-main:interactive/disp8
52
53 e8/call run-tests/disp32
54
55 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32
56 eb/jump $subx-dquotes-main:end/disp8
57 $subx-dquotes-main:interactive:
58
59
60 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32
61 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . .
62
63
64 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
65
66
67 50/push-eax/ed
68 68/push Stderr/imm32
69 68/push Stdout/imm32
70 68/push Stdin/imm32
71
72 e8/call subx-dquotes/disp32
73
74 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
75
76 bb/copy-to-ebx 0/imm32
77 $subx-dquotes-main:end:
78 b8/copy-to-eax 1/imm32/exit
79 cd/syscall 0x80/imm8
80
81
82
83
84
85 subx-dquotes:
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 55/push-ebp
111 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
112
113 50/push-eax
114 51/push-ecx
115 52/push-edx
116 53/push-ebx
117 56/push-esi
118 57/push-edi
119
120 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
121 68/push 0x200/imm32/length
122 68/push 0/imm32/read
123 68/push 0/imm32/write
124 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
125
126 68/push 0/imm32/end
127 68/push 0/imm32/start
128 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
129
130
131
132 68/push 1/imm32
133 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Segment-size/disp32
134 68/push Heap/imm32
135
136 e8/call new-stream/disp32
137
138 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
139
140 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
141
142
143 68/push "== data\n"/imm32
144 57/push-edi
145
146 e8/call write/disp32
147
148 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
149 $subx-dquotes:line-loop:
150
151
152 51/push-ecx
153
154 e8/call clear-stream/disp32
155
156 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
157
158
159 51/push-ecx
160 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
161
162 e8/call read-line-buffered/disp32
163
164 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
165 $subx-dquotes:check0:
166
167 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32
168 0f 84/jump-if-equal $subx-dquotes:break/disp32
169 $subx-dquotes:word-loop:
170
171
172 52/push-edx
173 51/push-ecx
174
175 e8/call next-word-or-string/disp32
176
177 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
178 $subx-dquotes:check1:
179
180
181
182 52/push-edx
183
184 e8/call slice-empty?/disp32
185
186 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
187
188 3d/compare-eax-and 0/imm32
189 0f 85/jump-if-not-equal $subx-dquotes:next-line/disp32
190 $subx-dquotes:check-for-comment:
191
192
193 8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . .
194
195 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
196 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . .
197
198 3d/compare-eax-and 0x23/imm32/hash
199 74/jump-if-equal $subx-dquotes:word-loop/disp8
200 $subx-dquotes:check-for-string-literal:
201
202 3d/compare-eax-and 0x22/imm32/dquote
203 75/jump-if-not-equal $subx-dquotes:regular-word/disp8
204 $subx-dquotes:string-literal:
205
206
207 57/push-edi
208 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
209 52/push-edx
210
211 e8/call process-string-literal/disp32
212
213 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
214
215 eb/jump $subx-dquotes:next-word/disp8
216 $subx-dquotes:regular-word:
217
218
219 52/push-edx
220 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
221
222 e8/call write-slice-buffered/disp32
223
224 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
225
226 $subx-dquotes:next-word:
227
228
229 68/push Space/imm32
230 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
231
232 e8/call write-buffered/disp32
233
234 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
235
236 eb/jump $subx-dquotes:word-loop/disp8
237 $subx-dquotes:next-line:
238
239
240 68/push Newline/imm32
241 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
242
243 e8/call write-buffered/disp32
244
245 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
246
247 e9/jump $subx-dquotes:line-loop/disp32
248 $subx-dquotes:break:
249
250
251 57/push-edi
252 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
253
254 e8/call write-stream-data/disp32
255
256 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
257
258
259 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
260
261 e8/call flush/disp32
262
263 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
264 $subx-dquotes:end:
265
266 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x214/imm32
267
268 5f/pop-to-edi
269 5e/pop-to-esi
270 5b/pop-to-ebx
271 5a/pop-to-edx
272 59/pop-to-ecx
273 58/pop-to-eax
274
275 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
276 5d/pop-to-ebp
277 c3/return
278
279
280
281 process-string-literal:
282
283
284
285
286
287
288
289
290 55/push-ebp
291 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
292
293 51/push-ecx
294
295 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa/imm32
296 68/push 0xa/imm32/decimal-digits-in-32bit-number
297 68/push 0/imm32/read
298 68/push 0/imm32/write
299 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
300
301
302
303 68/push "_string"/imm32
304 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
305
306 e8/call write/disp32
307
308 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
309
310
311 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Next-string-literal/disp32
312 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
313
314 e8/call print-int32-decimal/disp32
315
316 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
317
318
319 68/push ":\n"/imm32
320 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
321
322 e8/call write/disp32
323
324 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
325
326
327 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
328 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
329
330 e8/call emit-string-literal-data/disp32
331
332 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
333
334
335 68/push Newline/imm32
336 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
337
338 e8/call write/disp32
339
340 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
341
342
343
344 68/push "_string"/imm32
345 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
346
347 e8/call write-buffered/disp32
348
349 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
350
351
352 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Next-string-literal/disp32
353 51/push-ecx
354
355 e8/call print-int32-decimal/disp32
356
357 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
358
359
360 51/push-ecx
361 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
362
363 e8/call write-stream-data/disp32
364
365 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
366
367
368 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
369 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
370
371 e8/call emit-metadata/disp32
372
373 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
374
375 ff 0/subop/increment 0/mod/indirect 5/rm32/.disp32 . . . Next-string-literal/disp32
376 $process-string-literal:end:
377
378 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x16/imm32
379
380 59/pop-to-ecx
381
382 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
383 5d/pop-to-ebp
384 c3/return
385
386 test-subx-dquotes-is-idempotent-by-default:
387
388 55/push-ebp
389 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
390
391
392
393 68/push _test-input-stream/imm32
394
395 e8/call clear-stream/disp32
396
397 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
398
399
400 b8/copy-to-eax _test-input-buffered-file/imm32
401 05/add-to-eax 4/imm32
402 50/push-eax
403
404 e8/call clear-stream/disp32
405
406 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
407
408
409 68/push _test-output-stream/imm32
410
411 e8/call clear-stream/disp32
412
413 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
414
415
416 b8/copy-to-eax _test-output-buffered-file/imm32
417 05/add-to-eax 4/imm32
418 50/push-eax
419
420 e8/call clear-stream/disp32
421
422 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
423
424
425
426
427
428
429
430
431
432
433
434
435 68/push "# comment 1\n"/imm32
436 68/push _test-input-stream/imm32
437
438 e8/call write/disp32
439
440 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
441
442
443 68/push " # comment 2 indented\n"/imm32
444 68/push _test-input-stream/imm32
445
446 e8/call write/disp32
447
448 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
449
450
451 68/push "== code 0x1\n"/imm32
452 68/push _test-input-stream/imm32
453
454 e8/call write/disp32
455
456 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
457
458
459 68/push "# comment 3 inside a segment\n"/imm32
460 68/push _test-input-stream/imm32
461
462 e8/call write/disp32
463
464 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
465
466
467 68/push "1\n"/imm32
468 68/push _test-input-stream/imm32
469
470 e8/call write/disp32
471
472 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
473
474
475 68/push Newline/imm32
476 68/push _test-input-stream/imm32
477
478 e8/call write/disp32
479
480 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
481
482
483 68/push "2 3 # comment 4 inline with other contents\n"/imm32
484 68/push _test-input-stream/imm32
485
486 e8/call write/disp32
487
488 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
489
490
491 68/push "== data 0x2\n"/imm32
492 68/push _test-input-stream/imm32
493
494 e8/call write/disp32
495
496 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
497
498
499 68/push "4 5/imm32\n"/imm32
500 68/push _test-input-stream/imm32
501
502 e8/call write/disp32
503
504 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
505
506
507 68/push _test-output-buffered-file/imm32
508 68/push _test-input-buffered-file/imm32
509
510 e8/call subx-dquotes/disp32
511
512 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
513
514
515 68/push _test-output-buffered-file/imm32
516
517 e8/call flush/disp32
518
519 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
520
521
522
523
524
525
526
527
528
529
530
531 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
557
558
559 68/push "F - test-subx-dquotes-is-idempotent-by-default/0"/imm32
560 68/push ""/imm32
561 68/push _test-output-stream/imm32
562
563 e8/call check-next-stream-line-equal/disp32
564
565 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
566
567
568 68/push "F - test-subx-dquotes-is-idempotent-by-default/1"/imm32
569 68/push ""/imm32
570 68/push _test-output-stream/imm32
571
572 e8/call check-next-stream-line-equal/disp32
573
574 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
575
576
577 68/push "F - test-subx-dquotes-is-idempotent-by-default/2"/imm32
578 68/push "== code 0x1 "/imm32
579 68/push _test-output-stream/imm32
580
581 e8/call check-next-stream-line-equal/disp32
582
583 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
584
585
586 68/push "F - test-subx-dquotes-is-idempotent-by-default/3"/imm32
587 68/push ""/imm32
588 68/push _test-output-stream/imm32
589
590 e8/call check-next-stream-line-equal/disp32
591
592 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
593
594
595 68/push "F - test-subx-dquotes-is-idempotent-by-default/4"/imm32
596 68/push "1 "/imm32
597 68/push _test-output-stream/imm32
598
599 e8/call check-next-stream-line-equal/disp32
600
601 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
602
603
604 68/push "F - test-subx-dquotes-is-idempotent-by-default/5"/imm32
605 68/push ""/imm32
606 68/push _test-output-stream/imm32
607
608 e8/call check-next-stream-line-equal/disp32
609
610 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
611
612
613 68/push "F - test-subx-dquotes-is-idempotent-by-default/6"/imm32
614 68/push "2 3 "/imm32
615 68/push _test-output-stream/imm32
616
617 e8/call check-next-stream-line-equal/disp32
618
619 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
620
621
622 68/push "F - test-subx-dquotes-is-idempotent-by-default/7"/imm32
623 68/push "== data 0x2 "/imm32
624 68/push _test-output-stream/imm32
625
626 e8/call check-next-stream-line-equal/disp32
627
628 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
629
630
631 68/push "F - test-subx-dquotes-is-idempotent-by-default/8"/imm32
632 68/push "4 5/imm32 "/imm32
633 68/push _test-output-stream/imm32
634
635 e8/call check-next-stream-line-equal/disp32
636
637 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
638
639 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
640 5d/pop-to-ebp
641 c3/return
642
643 test-subx-dquotes-processes-string-literals:
644
645 55/push-ebp
646 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
647
648
649
650 68/push _test-input-stream/imm32
651
652 e8/call clear-stream/disp32
653
654 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
655
656
657 b8/copy-to-eax _test-input-buffered-file/imm32
658 05/add-to-eax 4/imm32
659 50/push-eax
660
661 e8/call clear-stream/disp32
662
663 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
664
665
666 68/push _test-output-stream/imm32
667
668 e8/call clear-stream/disp32
669
670 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
671
672
673 b8/copy-to-eax _test-output-buffered-file/imm32
674 05/add-to-eax 4/imm32
675 50/push-eax
676
677 e8/call clear-stream/disp32
678
679 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
680
681
682
683
684 68/push "== code 0x1\n"/imm32
685 68/push _test-input-stream/imm32
686
687 e8/call write/disp32
688
689 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
690
691
692 68/push "1 \"a\"/x\n"/imm32
693 68/push _test-input-stream/imm32
694
695 e8/call write/disp32
696
697 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
698
699
700 68/push "2 \"bc\"/y\n"/imm32
701 68/push _test-input-stream/imm32
702
703 e8/call write/disp32
704
705 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
706
707
708 68/push _test-output-buffered-file/imm32
709 68/push _test-input-buffered-file/imm32
710
711 e8/call subx-dquotes/disp32
712
713 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
714
715
716 68/push _test-output-buffered-file/imm32
717
718 e8/call flush/disp32
719
720 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737 +-- 33 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
770
771
772 68/push "F - test-subx-dquotes-processes-string-literals/0"/imm32
773 68/push "== code 0x1 "/imm32
774 68/push _test-output-stream/imm32
775
776 e8/call check-next-stream-line-equal/disp32
777
778 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
779
780
781 68/push "F - test-subx-dquotes-processes-string-literals/1"/imm32
782 68/push "1 _string1/x "/imm32
783 68/push _test-output-stream/imm32
784
785 e8/call check-next-stream-line-equal/disp32
786
787 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
788
789
790 68/push "F - test-subx-dquotes-processes-string-literals/2"/imm32
791 68/push "2 _string2/y "/imm32
792 68/push _test-output-stream/imm32
793
794 e8/call check-next-stream-line-equal/disp32
795
796 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
797
798
799 68/push "F - test-subx-dquotes-processes-string-literals/3"/imm32
800 68/push "== data"/imm32
801 68/push _test-output-stream/imm32
802
803 e8/call check-next-stream-line-equal/disp32
804
805 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
806
807
808 68/push "F - test-subx-dquotes-processes-string-literals/4"/imm32
809 68/push "_string1:"/imm32
810 68/push _test-output-stream/imm32
811
812 e8/call check-next-stream-line-equal/disp32
813
814 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
815
816
817 68/push "F - test-subx-dquotes-processes-string-literals/5"/imm32
818 68/push "0x00000001/imm32 61/a "/imm32
819 68/push _test-output-stream/imm32
820
821 e8/call check-next-stream-line-equal/disp32
822
823 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
824
825
826 68/push "F - test-subx-dquotes-processes-string-literals/6"/imm32
827 68/push "_string2:"/imm32
828 68/push _test-output-stream/imm32
829
830 e8/call check-next-stream-line-equal/disp32
831
832 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
833
834
835 68/push "F - test-subx-dquotes-processes-string-literals/7"/imm32
836 68/push "0x00000002/imm32 62/b 63/c "/imm32
837 68/push _test-output-stream/imm32
838
839 e8/call check-next-stream-line-equal/disp32
840
841 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
842
843 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
844 5d/pop-to-ebp
845 c3/return
846
847
848 emit-string-literal-data:
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877 55/push-ebp
878 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
879
880 50/push-eax
881 51/push-ecx
882 52/push-edx
883 53/push-ebx
884 56/push-esi
885
886 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
887
888 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
889
890 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . .
891
892 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 .
893 $emit-string-literal-data:emit-length:
894
895
896 56/push-esi
897 52/push-edx
898
899 e8/call string-length-at-start-of-slice/disp32
900
901 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
902
903
904
905 50/push-eax
906 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
907
908 e8/call print-int32/disp32
909
910 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
911
912
913 68/push "/imm32 "/imm32
914 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
915
916 e8/call write/disp32
917
918 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
919 $emit-string-literal-data:loop-init:
920
921 42/increment-edx
922
923 31/xor 3/mod/direct 1/rm32/ecx . . . 1/r32/ecx . .
924 $emit-string-literal-data:loop:
925
926 39/compare 3/mod/direct 2/rm32/edx . . . 6/r32/esi . .
927 0f 83/jump-if-greater-or-equal-unsigned $emit-string-literal-data:end/disp32
928
929 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 1/r32/CL . .
930
931 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0x22/imm32/dquote
932 0f 84/jump-if-equal $emit-string-literal-data:end/disp32
933
934 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0x5c/imm32/backslash
935 75/jump-if-not-equal $emit-string-literal-data:emit/disp8
936
937 42/increment-edx
938
939 39/compare 3/mod/direct 2/rm32/edx . . . 6/r32/esi . .
940 0f 83/jump-if-greater-or-equal-unsigned $emit-string-literal-data:end/disp32
941
942 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 1/r32/CL . .
943
944 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0x6e/imm32/n
945 75/jump-if-not-equal $emit-string-literal-data:emit/disp8
946 b9/copy-to-ecx 0x0a/imm32/newline
947 $emit-string-literal-data:emit:
948
949
950 51/push-ecx
951 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
952
953 e8/call append-byte-hex/disp32
954
955 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
956
957
958
959 51/push-ecx
960
961 e8/call is-alphanumeric?/disp32
962
963 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
964
965 3d/compare-eax-and 0/imm32
966 74/jump-if-equal $emit-string-literal-data:char-done/disp8
967
968
969 68/push Slash/imm32
970 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
971
972 e8/call write/disp32
973
974 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
975
976
977 51/push-ecx
978 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
979
980 e8/call append-byte/disp32
981
982 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
983 $emit-string-literal-data:char-done:
984
985
986 68/push Space/imm32
987 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
988
989 e8/call write/disp32
990
991 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
992
993 42/increment-edx
994
995 43/increment-ebx
996
997 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x40/imm32
998 7c/jump-if-lesser $emit-string-literal-data:next-char/disp8
999
1000 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
1001
1002
1003 68/push Newline/imm32
1004 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1005
1006 e8/call write/disp32
1007
1008 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1009 $emit-string-literal-data:next-char:
1010 e9/jump $emit-string-literal-data:loop/disp32
1011 $emit-string-literal-data:end:
1012
1013 5e/pop-to-esi
1014 5b/pop-to-ebx
1015 5a/pop-to-edx
1016 59/pop-to-ecx
1017 58/pop-to-eax
1018
1019 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1020 5d/pop-to-ebp
1021 c3/return
1022
1023 is-alphanumeric?:
1024
1025 55/push-ebp
1026 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1027
1028 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 8/disp8 .
1029
1030 3d/compare-eax-with 0x30/imm32/0
1031 7c/jump-if-lesser $is-alphanumeric?:false/disp8
1032
1033 3d/compare-eax-with 0x39/imm32/9
1034 7e/jump-if-lesser-or-equal $is-alphanumeric?:true/disp8
1035
1036 3d/compare-eax-with 0x41/imm32/A
1037 7c/jump-if-lesser $is-alphanumeric?:false/disp8
1038
1039 3d/compare-eax-with 0x5a/imm32/Z
1040 7e/jump-if-lesser-or-equal $is-alphanumeric?:true/disp8
1041
1042 3d/compare-eax-with 0x61/imm32/a
1043 7c/jump-if-lesser $is-alphanumeric?:false/disp8
1044
1045 3d/compare-eax-with 0x7a/imm32/z
1046 7e/jump-if-lesser-or-equal $is-alphanumeric?:true/disp8
1047
1048 $is-alphanumeric?:false:
1049 b8/copy-to-eax 0/imm32/false
1050 eb/jump $is-alphanumeric?:end/disp8
1051 $is-alphanumeric?:true:
1052 b8/copy-to-eax 1/imm32/true
1053 $is-alphanumeric?:end:
1054
1055 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1056 5d/pop-to-ebp
1057 c3/return
1058
1059 test-emit-string-literal-data:
1060
1061 55/push-ebp
1062 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1063
1064
1065
1066 68/push _test-output-stream/imm32
1067
1068 e8/call clear-stream/disp32
1069
1070 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1071
1072 68/push _test-slice-abc-limit/imm32
1073 68/push _test-slice-abc/imm32
1074 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1075
1076
1077 51/push-ecx
1078 68/push _test-output-stream/imm32
1079
1080 e8/call emit-string-literal-data/disp32
1081
1082 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1083 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1109
1110
1111 68/push "F - test-emit-string-literal-data"/imm32
1112 68/push "0x00000003/imm32 61/a 62/b 63/c "/imm32
1113 68/push _test-output-stream/imm32
1114
1115 e8/call check-stream-equal/disp32
1116
1117 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1118
1119 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1120 5d/pop-to-ebp
1121 c3/return
1122
1123 test-emit-string-literal-data-empty:
1124
1125 55/push-ebp
1126 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1127
1128
1129
1130 68/push _test-output-stream/imm32
1131
1132 e8/call clear-stream/disp32
1133
1134 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1135
1136 68/push 0/imm32/end
1137 68/push 0/imm32/start
1138 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1139
1140
1141 51/push-ecx
1142 68/push _test-output-stream/imm32
1143
1144 e8/call emit-string-literal-data/disp32
1145
1146 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1147 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1173
1174
1175 68/push "F - test-emit-string-literal-data-empty"/imm32
1176 68/push "0x00000000/imm32 "/imm32
1177 68/push _test-output-stream/imm32
1178
1179 e8/call check-stream-equal/disp32
1180
1181 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1182
1183 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1184 5d/pop-to-ebp
1185 c3/return
1186
1187
1188 test-emit-string-literal-data-no-metadata-for-non-alphanumerics:
1189
1190 55/push-ebp
1191 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1192
1193
1194
1195 68/push _test-output-stream/imm32
1196
1197 e8/call clear-stream/disp32
1198
1199 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1200
1201 68/push _test-slice-a-space-b-limit/imm32
1202 68/push _test-slice-a-space-b/imm32
1203 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1204
1205
1206 51/push-ecx
1207 68/push _test-output-stream/imm32
1208
1209 e8/call emit-string-literal-data/disp32
1210
1211 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1212 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1238
1239
1240 68/push "F - test-emit-string-literal-data-no-metadata-for-non-alphanumerics"/imm32
1241 68/push "0x00000003/imm32 61/a 20 62/b "/imm32
1242 68/push _test-output-stream/imm32
1243
1244 e8/call check-stream-equal/disp32
1245
1246 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1247
1248 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1249 5d/pop-to-ebp
1250 c3/return
1251
1252 test-emit-string-literal-data-handles-escape-sequences:
1253
1254 55/push-ebp
1255 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1256
1257
1258
1259 68/push _test-output-stream/imm32
1260
1261 e8/call clear-stream/disp32
1262
1263 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1264
1265 68/push _test-slice-a-dquote-b-limit/imm32
1266 68/push _test-slice-a-dquote-b/imm32
1267 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1268
1269
1270 51/push-ecx
1271 68/push _test-output-stream/imm32
1272
1273 e8/call emit-string-literal-data/disp32
1274
1275 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1276 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1302
1303
1304 68/push "F - test-emit-string-literal-data-handles-escape-sequences"/imm32
1305 68/push "0x00000003/imm32 61/a 22 62/b "/imm32
1306 68/push _test-output-stream/imm32
1307
1308 e8/call check-stream-equal/disp32
1309
1310 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1311
1312 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1313 5d/pop-to-ebp
1314 c3/return
1315
1316 test-emit-string-literal-data-handles-newline-escape:
1317
1318 55/push-ebp
1319 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1320
1321
1322
1323 68/push _test-output-stream/imm32
1324
1325 e8/call clear-stream/disp32
1326
1327 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1328
1329 68/push _test-slice-a-newline-b-limit/imm32
1330 68/push _test-slice-a-newline-b/imm32
1331 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1332
1333
1334 51/push-ecx
1335 68/push _test-output-stream/imm32
1336
1337 e8/call emit-string-literal-data/disp32
1338
1339 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1340 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1366
1367
1368 68/push "F - test-emit-string-literal-data-handles-newline-escape"/imm32
1369 68/push "0x00000003/imm32 61/a 0a 62/b "/imm32
1370 68/push _test-output-stream/imm32
1371
1372 e8/call check-stream-equal/disp32
1373
1374 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1375
1376 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1377 5d/pop-to-ebp
1378 c3/return
1379
1380
1381 emit-metadata:
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398 55/push-ebp
1399 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1400
1401 50/push-eax
1402 51/push-ecx
1403 52/push-edx
1404 53/push-ebx
1405 56/push-esi
1406
1407 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
1408
1409 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
1410
1411 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 4/disp8 .
1412
1413 52/push-edx
1414 68/push 0/imm32
1415 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1416
1417 b8/copy-to-eax 0/imm32
1418 $emit-metadata:check-for-string-literal:
1419
1420 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
1421 3d/compare-eax-and 0x22/imm32/dquote
1422 75/jump-if-not-equal $emit-metadata:skip-datum-loop/disp8
1423 $emit-metadata:skip-string-literal:
1424
1425
1426 52/push-edx
1427 51/push-ecx
1428
1429 e8/call skip-string-in-slice/disp32
1430
1431 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1432
1433 89/copy 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
1434 eb/jump $emit-metadata:emit/disp8
1435 $emit-metadata:skip-datum-loop:
1436
1437
1438 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
1439 74/jump-if-equal $emit-metadata:end/disp8
1440
1441 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
1442 3d/compare-eax-and 0x2f/imm32/slash
1443 74/jump-if-equal $emit-metadata:emit/disp8
1444
1445 41/increment-ecx
1446 eb/jump $emit-metadata:skip-datum-loop/disp8
1447 $emit-metadata:emit:
1448
1449 89/copy 0/mod/indirect 3/rm32/ebx . . . 1/r32/ecx . .
1450
1451
1452 53/push-ebx
1453 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1454
1455 e8/call write-slice-buffered/disp32
1456
1457 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . 8/imm32 .
1458 $emit-metadata:end:
1459
1460 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . 8/imm32 .
1461
1462 5e/pop-to-esi
1463 5b/pop-to-ebx
1464 5a/pop-to-edx
1465 59/pop-to-ecx
1466 58/pop-to-eax
1467
1468 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1469 5d/pop-to-ebp
1470 c3/return
1471
1472 test-emit-metadata:
1473
1474 55/push-ebp
1475 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1476
1477
1478
1479 68/push _test-output-stream/imm32
1480
1481 e8/call clear-stream/disp32
1482
1483 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1484
1485
1486 b8/copy-to-eax _test-output-buffered-file/imm32
1487 05/add-to-eax 4/imm32
1488 50/push-eax
1489
1490 e8/call clear-stream/disp32
1491
1492 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1493
1494 b8/copy-to-eax "abc/def"/imm32
1495 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
1496 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
1497 05/add-to-eax 4/imm32
1498
1499 51/push-ecx
1500 50/push-eax
1501 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1502
1503
1504 51/push-ecx
1505 68/push _test-output-buffered-file/imm32
1506
1507 e8/call emit-metadata/disp32
1508
1509 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1510
1511
1512 68/push _test-output-buffered-file/imm32
1513
1514 e8/call flush/disp32
1515
1516 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1517
1518
1519 68/push "F - test-emit-metadata"/imm32
1520 68/push "/def"/imm32
1521 68/push _test-output-stream/imm32
1522
1523 e8/call check-stream-equal/disp32
1524
1525 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1526
1527 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1528 5d/pop-to-ebp
1529 c3/return
1530
1531 test-emit-metadata-none:
1532
1533 55/push-ebp
1534 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1535
1536
1537
1538 68/push _test-output-stream/imm32
1539
1540 e8/call clear-stream/disp32
1541
1542 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1543
1544
1545 b8/copy-to-eax _test-output-buffered-file/imm32
1546 05/add-to-eax 4/imm32
1547 50/push-eax
1548
1549 e8/call clear-stream/disp32
1550
1551 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1552
1553 b8/copy-to-eax "abc"/imm32
1554 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
1555 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
1556 05/add-to-eax 4/imm32
1557
1558 51/push-ecx
1559 50/push-eax
1560 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1561
1562
1563 51/push-ecx
1564 68/push _test-output-buffered-file/imm32
1565
1566 e8/call emit-metadata/disp32
1567
1568 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1569
1570
1571 68/push _test-output-buffered-file/imm32
1572
1573 e8/call flush/disp32
1574
1575 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1576
1577
1578 68/push "F - test-emit-metadata-none"/imm32
1579 68/push ""/imm32
1580 68/push _test-output-stream/imm32
1581
1582 e8/call check-stream-equal/disp32
1583
1584 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1585
1586 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1587 5d/pop-to-ebp
1588 c3/return
1589
1590 test-emit-metadata-multiple:
1591
1592 55/push-ebp
1593 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1594
1595
1596
1597 68/push _test-output-stream/imm32
1598
1599 e8/call clear-stream/disp32
1600
1601 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1602
1603
1604 b8/copy-to-eax _test-output-buffered-file/imm32
1605 05/add-to-eax 4/imm32
1606 50/push-eax
1607
1608 e8/call clear-stream/disp32
1609
1610 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1611
1612 b8/copy-to-eax "abc/def/ghi"/imm32
1613 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
1614 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
1615 05/add-to-eax 4/imm32
1616
1617 51/push-ecx
1618 50/push-eax
1619 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1620
1621
1622 51/push-ecx
1623 68/push _test-output-buffered-file/imm32
1624
1625 e8/call emit-metadata/disp32
1626
1627 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1628
1629
1630 68/push _test-output-buffered-file/imm32
1631
1632 e8/call flush/disp32
1633
1634 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1635
1636
1637 68/push "F - test-emit-metadata-multiple"/imm32
1638 68/push "/def/ghi"/imm32
1639 68/push _test-output-stream/imm32
1640
1641 e8/call check-stream-equal/disp32
1642
1643 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1644
1645 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1646 5d/pop-to-ebp
1647 c3/return
1648
1649 test-emit-metadata-when-no-datum:
1650
1651 55/push-ebp
1652 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1653
1654
1655
1656 68/push _test-output-stream/imm32
1657
1658 e8/call clear-stream/disp32
1659
1660 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1661
1662
1663 b8/copy-to-eax _test-output-buffered-file/imm32
1664 05/add-to-eax 4/imm32
1665 50/push-eax
1666
1667 e8/call clear-stream/disp32
1668
1669 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1670
1671 b8/copy-to-eax "/abc"/imm32
1672
1673 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
1674 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
1675 51/push-ecx
1676
1677 05/add-to-eax 4/imm32
1678 50/push-eax
1679
1680 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1681
1682
1683 51/push-ecx
1684 68/push _test-output-buffered-file/imm32
1685
1686 e8/call emit-metadata/disp32
1687
1688 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1689
1690
1691 68/push _test-output-buffered-file/imm32
1692
1693 e8/call flush/disp32
1694
1695 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1696
1697
1698 68/push "F - test-emit-metadata-when-no-datum"/imm32
1699 68/push "/abc"/imm32
1700 68/push _test-output-stream/imm32
1701
1702 e8/call check-stream-equal/disp32
1703
1704 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1705
1706 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1707 5d/pop-to-ebp
1708 c3/return
1709
1710 test-emit-metadata-in-string-literal:
1711
1712 55/push-ebp
1713 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1714
1715
1716
1717 68/push _test-output-stream/imm32
1718
1719 e8/call clear-stream/disp32
1720
1721 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1722
1723
1724 b8/copy-to-eax _test-output-buffered-file/imm32
1725 05/add-to-eax 4/imm32
1726 50/push-eax
1727
1728 e8/call clear-stream/disp32
1729
1730 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1731
1732 68/push _test-slice-literal-string-with-limit/imm32
1733 68/push _test-slice-literal-string/imm32/start
1734 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1735
1736
1737 51/push-ecx
1738 68/push _test-output-buffered-file/imm32
1739
1740 e8/call emit-metadata/disp32
1741
1742 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1743
1744
1745 68/push _test-output-buffered-file/imm32
1746
1747 e8/call flush/disp32
1748
1749 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1750 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1776
1777
1778 68/push "F - test-emit-metadata-in-string-literal"/imm32
1779 68/push "/ghi"/imm32
1780 68/push _test-output-stream/imm32
1781
1782 e8/call check-stream-equal/disp32
1783
1784 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1785
1786 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1787 5d/pop-to-ebp
1788 c3/return
1789
1790 string-length-at-start-of-slice:
1791
1792 55/push-ebp
1793 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1794
1795 51/push-ecx
1796 52/push-edx
1797 53/push-ebx
1798
1799 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 8/disp8 .
1800
1801 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 2/r32/edx 0xc/disp8 .
1802
1803 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
1804
1805 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
1806
1807 41/increment-ecx
1808 $string-length-at-start-of-slice:loop:
1809
1810 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
1811 73/jump-if-greater-unsigned-or-equal $string-length-at-start-of-slice:end/disp8
1812
1813 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 3/r32/BL . .
1814 $string-length-at-start-of-slice:dquote:
1815
1816 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x22/imm32/dquote
1817 74/jump-if-equal $string-length-at-start-of-slice:end/disp8
1818 $string-length-at-start-of-slice:check-for-escape:
1819
1820 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x5c/imm32/backslash
1821 75/jump-if-not-equal $string-length-at-start-of-slice:continue/disp8
1822 $string-length-at-start-of-slice:escape:
1823
1824 41/increment-ecx
1825 $string-length-at-start-of-slice:continue:
1826
1827 40/increment-eax
1828
1829 41/increment-ecx
1830 eb/jump $string-length-at-start-of-slice:loop/disp8
1831 $string-length-at-start-of-slice:end:
1832
1833 5b/pop-to-ebx
1834 5a/pop-to-edx
1835 59/pop-to-ecx
1836
1837 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1838 5d/pop-to-ebp
1839 c3/return
1840
1841 test-string-length-at-start-of-slice:
1842
1843 55/push-ebp
1844 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1845
1846 b8/copy-to-eax "\"abc\" def"/imm32
1847 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
1848 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
1849 05/add-to-eax 4/imm32
1850
1851
1852 51/push-ecx
1853 50/push-eax
1854
1855 e8/call string-length-at-start-of-slice/disp32
1856
1857 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1858
1859
1860 68/push "F - test-string-length-at-start-of-slice"/imm32
1861 68/push 3/imm32
1862 50/push-eax
1863
1864 e8/call check-ints-equal/disp32
1865
1866 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1867
1868 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1869 5d/pop-to-ebp
1870 c3/return
1871
1872 test-string-length-at-start-of-slice-escaped:
1873
1874 55/push-ebp
1875 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1876
1877 b8/copy-to-eax "\"ab\\c\" def"/imm32
1878 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
1879 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
1880 05/add-to-eax 4/imm32
1881
1882
1883 51/push-ecx
1884 50/push-eax
1885
1886 e8/call string-length-at-start-of-slice/disp32
1887
1888 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1889
1890
1891 68/push "F - test-string-length-at-start-of-slice-escaped"/imm32
1892 68/push 3/imm32
1893 50/push-eax
1894
1895 e8/call check-ints-equal/disp32
1896
1897 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1898
1899 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1900 5d/pop-to-ebp
1901 c3/return
1902
1903 == data
1904
1905 Next-string-literal:
1906 1/imm32
1907
1908 _test-slice-abc:
1909 22/dquote 61/a 62/b 63/c 22/dquote
1910 2f/slash 64/d
1911 _test-slice-abc-limit:
1912
1913 _test-slice-a-space-b:
1914 22/dquote 61/a 20/space 62/b 22/dquote
1915 _test-slice-a-space-b-limit:
1916
1917 _test-slice-a-dquote-b:
1918 22/dquote 61/a 5c/backslash 22/dquote 62/b 22/dquote
1919 _test-slice-a-dquote-b-limit:
1920
1921 _test-slice-a-newline-b:
1922 22/dquote 61/a 5c/backslash 6e/n 62/b 22/dquote
1923 _test-slice-a-newline-b-limit:
1924
1925
1926 _test-slice-literal-string:
1927 22/dquote
1928 61/a 62/b 63/c
1929 2f/slash 64/d 65/e 66/f
1930 22/dquote
1931 2f/slash 67/g 68/h 69/i
1932 _test-slice-literal-string-with-limit:
1933
1934