From 8836afbcbd997a0ddcb7c6260dc8fa0dae89bf39 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 28 Dec 2020 23:30:13 -0800 Subject: 7457 --- apps/survey_elf | Bin 56298 -> 56302 bytes apps/survey_elf.subx | 24 ++++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'apps') diff --git a/apps/survey_elf b/apps/survey_elf index 6a9257c6..7af84283 100755 Binary files a/apps/survey_elf and b/apps/survey_elf differ diff --git a/apps/survey_elf.subx b/apps/survey_elf.subx index 8dd47697..2b8a47cd 100644 --- a/apps/survey_elf.subx +++ b/apps/survey_elf.subx @@ -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 -- cgit 1.4.1-2-gfad0