This commit is contained in:
Kartik Agaram 2020-12-28 23:30:13 -08:00
parent 286faf6f0b
commit 8836afbcbd
2 changed files with 14 additions and 10 deletions

Binary file not shown.

View File

@ -1820,6 +1820,15 @@ $emit-output:end:
5d/pop-to-ebp
c3/return
# global scratch space for emit-segments
== data
emit-segments:datum: # slice
0/imm32/start
0/imm32/end
== code
emit-segments: # in: (addr stream byte), out: (addr buffered-file), labels: (addr stream {(handle array byte), label-info})
# pseudocode:
# var offset-of-next-instruction = 0
@ -1871,7 +1880,6 @@ emit-segments: # in: (addr stream byte), out: (addr buffered-file), labels: (ad
# line: ecx
# word-slice: edx
# offset-of-next-instruction: ebx
# datum: edi
# info: esi (inner loop only)
# temporaries: eax, esi (outer loop)
#
@ -1895,10 +1903,6 @@ emit-segments: # in: (addr stream byte), out: (addr buffered-file), labels: (ad
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
# var datum/edi: slice
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 7/rm32/edi . . . 4/r32/esp . . # copy esp to edi
# offset-of-next-instruction/ebx = 0
31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . . # clear ebx
$emit-segments:line-loop:
@ -2081,9 +2085,9 @@ $emit-segments:2-character:
e9/jump $emit-segments:word-loop/disp32
$emit-segments:check-metadata:
# - if we get here, 'word-slice' must be a label to be looked up
# datum/edi = next-token-from-slice(word-slice->start, word-slice->end, "/")
# datum = next-token-from-slice(word-slice->start, word-slice->end, "/")
# . . push args
57/push-edi
68/push emit-segments:datum/imm32
68/push 0x2f/imm32/slash
ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 . # push *(edx+4)
ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . . # push *edx
@ -2102,7 +2106,7 @@ $emit-segments:check-metadata:
#? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
#? # . write-slice-buffered(Stderr, datum)
#? # . . push args
#? 57/push-edi
#? 68/push emit-segments:datum/imm32
#? 68/push Stderr/imm32
#? # . . call
#? e8/call write-slice-buffered/disp32
@ -2129,7 +2133,7 @@ $emit-segments:check-metadata:
# . . push args
68/push "label table"/imm32
68/push 0x18/imm32/row-size
57/push-edi
68/push emit-segments:datum/imm32
ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 . # push *(ebp+16)
# . . call
e8/call get-slice/disp32
@ -2334,7 +2338,7 @@ $emit-segments:next-line:
e9/jump $emit-segments:line-loop/disp32
$emit-segments:end:
# . reclaim locals
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x21c/imm32 # add to esp
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x214/imm32 # add to esp
# . restore registers
5f/pop-to-edi
5e/pop-to-esi