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