Be more consistent about names of ends of a slice.
(In the opposite direction compared to last night's 925fc490d2ce8b8d411de87bd0af5b3a8a704213.)
This commit is contained in:
Kartik Agaram 2019-07-08 17:02:09 -07:00
parent fe77a29e6a
commit 476049a09d
8 changed files with 88 additions and 88 deletions

View File

@ -35,8 +35,8 @@ test-slice-empty-true:
55/push-EBP
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
# var slice/ECX = {34, 34}
68/push 34/imm32/limit
68/push 34/imm32/curr
68/push 34/imm32/end
68/push 34/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# slice-empty?(slice)
# . . push args
@ -64,8 +64,8 @@ test-slice-empty-false:
55/push-EBP
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
# var slice/ECX = {34, 23}
68/push 23/imm32/limit
68/push 34/imm32/curr
68/push 23/imm32/end
68/push 34/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# slice-empty?(slice)
# . . push args
@ -326,8 +326,8 @@ test-slice-equal-empty:
55/push-EBP
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
# var slice/ECX
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# EAX = slice-equal?(ECX, "Abc")
# . . push args
@ -393,8 +393,8 @@ test-slice-equal-empty-with-empty:
55/push-EBP
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
# var slice/ECX
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# EAX = slice-equal?(ECX, "")
# . . push args

View File

@ -67,8 +67,8 @@ test-next-token:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# write(_test-stream, " ab")
# . . push args
@ -131,8 +131,8 @@ test-next-token-Eof:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# write nothing to _test-stream
# next-token(_test-stream, 0x20/space, slice)
@ -217,8 +217,8 @@ test-next-token-from-slice:
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX
05/add-to-EAX 4/imm32
# var out/EDI : (address slice) = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
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
# next-token-from-slice(EAX, ECX, 0x20/space, out)
# . . push args
@ -266,8 +266,8 @@ test-next-token-from-slice-Eof:
55/push-EBP
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
# var out/EDI : (address slice) = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
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
# next-token-from-slice(0, 0, 0x20/space, out)
# . . push args
@ -307,8 +307,8 @@ test-next-token-from-slice-nothing:
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX
05/add-to-EAX 4/imm32
# var out/EDI : (address slice) = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
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
# next-token-from-slice(in, 0x20/space, out)
# . . push args

View File

@ -262,13 +262,13 @@ parse-array-of-ints: # ad : (address allocation-descriptor), s : (address strin
# var slice = {s->data, 0}
# out = result->data
# while true
# if (slice->curr >= end) break
# slice->curr = skip-chars-matching-in-slice(slice->curr, end, ' ')
# if (slice->curr >= end) break
# slice->end = skip-chars-not-matching-in-slice(slice->curr, end, ' ')
# if (slice->start >= end) break
# slice->start = skip-chars-matching-in-slice(slice->start, end, ' ')
# if (slice->start >= end) break
# slice->end = skip-chars-not-matching-in-slice(slice->start, end, ' ')
# *out = parse-hex-int(slice)
# out += 4
# slice->curr = slice->end
# slice->start = slice->end
# return result
#
# . prolog
@ -344,7 +344,7 @@ $parse-array-of-ints:break1:
$parse-array-of-ints:pass2:
# var slice/ECX = {s->data, 0}
# . push 0
68/push 0/imm32/limit
68/push 0/imm32/end
# . push s->data
8d/copy-address 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 . # copy ESI+4 to ECX
51/push-ECX
@ -353,11 +353,11 @@ $parse-array-of-ints:pass2:
# out/EBX = result->data
8d/copy-address 1/mod/*+disp8 0/rm32/EAX . . . 3/r32/EBX 4/disp8 . # copy EAX+4 to EBX
$parse-array-of-ints:loop2:
# if (slice->curr >= end) break
# if (slice->start >= end) break
39/compare 0/mod/indirect 1/rm32/ECX . . . 2/r32/EDX . . # compare *ECX with EDX
73/jump-if-greater-or-equal-unsigned $parse-array-of-ints:end/disp8
# slice->curr = skip-chars-matching-in-slice(slice->curr, end, ' ')
# . EAX = skip-chars-matching-in-slice(slice->curr, end, ' ')
# slice->start = skip-chars-matching-in-slice(slice->start, end, ' ')
# . EAX = skip-chars-matching-in-slice(slice->start, end, ' ')
# . . push args
68/push 0x20/imm32/space
52/push-EDX
@ -366,12 +366,12 @@ $parse-array-of-ints:loop2:
e8/call skip-chars-matching-in-slice/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP
# . slice->curr = EAX
# . slice->start = EAX
89/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . . # copy EAX to *ECX
# if (slice->curr >= end) break
# if (slice->start >= end) break
39/compare 0/mod/indirect 1/rm32/ECX . . . 2/r32/EDX . . # compare *ECX with EDX
73/jump-if-greater-or-equal-unsigned $parse-array-of-ints:end/disp8
# slice->end = skip-chars-not-matching-in-slice(slice->curr, end, ' ')
# slice->end = skip-chars-not-matching-in-slice(slice->start, end, ' ')
# . EAX = skip-chars-not-matching-in-slice(curr, end, ' ')
# . . push args
68/push 0x20/imm32/space
@ -395,7 +395,7 @@ $parse-array-of-ints:loop2:
89/copy 0/mod/indirect 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to *EBX
# out += 4
81 0/subop/add 3/mod/direct 3/rm32/EBX . . . . . 4/imm32 # add to EBX
# slice->curr = slice->end
# slice->start = slice->end
8b/copy 1/mod/direct 1/rm32/ECX . . . 0/r32/EAX 4/disp8 . # copy *(ECX+4) to EAX
89/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . . # copy EAX to *ECX
81 0/subop/add 3/mod/direct 1/rm32/ECX . . . . . 4/imm32 # add to ECX

View File

@ -485,8 +485,8 @@ read-segments: # in : (address buffered-file), table : (address stream {string,
68/push 0/imm32/write
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# var word-slice/EDX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
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
$read-segments:loop:
# clear-stream(line)

View File

@ -121,8 +121,8 @@ convert: # in : (address buffered-file), out : (address buffered-file) -> <void
68/push 0/imm32/write
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# var word-slice/EDX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
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
# new-data-segment/EDI = new-stream(Heap, Segment-size, 1)
# . EAX = new-stream(Heap, Segment-size, 1)
@ -1096,8 +1096,8 @@ test-emit-string-literal-data-empty:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = '""'
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# emit-string-literal-data(_test-output-stream, slice)
# . . push args
@ -1290,7 +1290,7 @@ emit-metadata: # out : (address buffered-file), word : (address slice)
# if *curr == '/'
# break
# ++curr
# slice->curr = curr
# slice->start = curr
# write-slice-buffered(out, slice)
#
# . prolog
@ -1344,7 +1344,7 @@ $emit-metadata:skip-datum-loop:
41/increment-ECX
eb/jump $emit-metadata:skip-datum-loop/disp8
$emit-metadata:emit:
# slice->curr = ECX
# slice->start = ECX
89/copy 0/mod/indirect 3/rm32/EBX . . . 1/r32/ECX . . # copy ECX to *EBX
# write-slice-buffered(out, slice)
# . . push args
@ -1629,7 +1629,7 @@ test-emit-metadata-in-string-literal:
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = "\"abc/def\"/ghi"
68/push _test-slice-literal-string-with-limit/imm32
68/push _test-slice-literal-string/imm32/curr
68/push _test-slice-literal-string/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# emit-metadata(_test-output-buffered-file, slice)
# . . push args
@ -1795,8 +1795,8 @@ test-next-word-or-string:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# write(_test-input-stream, " ab")
# . . push args
@ -1868,8 +1868,8 @@ test-next-word-or-string-returns-whole-comment:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# write(_test-input-stream, " # a")
# . . push args
@ -1941,8 +1941,8 @@ test-next-word-or-string-returns-empty-string-on-eof:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# write nothing to _test-input-stream
# next-word-or-string(_test-input-stream, slice)
@ -1983,8 +1983,8 @@ test-next-word-or-string-returns-whole-string:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# write(_test-input-stream, " \"a b\"/imm32 ")
# . . push args
@ -2046,8 +2046,8 @@ test-next-word-or-string-returns-string-with-escapes:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# write(_test-input-stream, " \"a\\\"b\"/x")
# . . push args

View File

@ -132,8 +132,8 @@ convert: # in : (address buffered-file), out : (address buffered-file) -> <void
68/push 0/imm32/write
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# var word-slice/EDX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
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 in-code?/EBX = false
31/xor 3/mod/direct 3/rm32/EBX . . . 3/r32/EBX . . # clear EBX
@ -957,8 +957,8 @@ convert-data: # line : (address stream byte), out : (address buffered-file) ->
51/push-ECX
52/push-EDX
# var word-slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
#? # dump line {{{
#? # . write(2/stderr, "LL: ")
@ -1870,8 +1870,8 @@ convert-instruction: # line : (address stream byte), out : (address buffered-fi
51/push-ECX
52/push-EDX
# var word-slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# next-word(line, word-slice)
# . . push args
@ -2027,12 +2027,12 @@ emit-opcodes: # line : (address stream byte), out : (address buffered-file) ->
52/push-EDX
53/push-EBX
# var op1/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# var op2/EDX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
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
# rewind-stream(line)
# . . push args
@ -2318,8 +2318,8 @@ emit-modrm: # line : (address stream byte), out : (address buffered-file) -> <v
56/push-ESI
57/push-EDI
# var word-slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# var has-modrm?/EDX = false
31/xor 3/mod/direct 2/rm32/EDX . . . 2/r32/EDX . . # clear EDX
@ -2629,8 +2629,8 @@ emit-sib: # line : (address stream byte), out : (address buffered-file) -> <voi
56/push-ESI
57/push-EDI
# var word-slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# var has-sib?/EDX = false
31/xor 3/mod/direct 2/rm32/EDX . . . 2/r32/EDX . . # clear EDX
@ -2902,8 +2902,8 @@ emit-disp: # line : (address stream byte), out : (address buffered-file) -> <vo
51/push-ECX
52/push-EDX
# var word-slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# rewind-stream(line)
# . . push args
@ -3123,8 +3123,8 @@ emit-imm: # line : (address stream byte), out : (address buffered-file) -> <voi
51/push-ECX
52/push-EDX
# var word-slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# rewind-stream(line)
# . . push args
@ -5843,8 +5843,8 @@ parse-datum-of-word: # word : (address slice) -> value/EAX
# ESI = word
8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 . # copy *(EBP+8) to ESI
# var slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# slice = next-token-from-slice(word->start, word->end, '/')
# . . push args

View File

@ -612,8 +612,8 @@ test-next-word:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# write(_test-stream, " ab")
# . . push args
@ -675,8 +675,8 @@ test-next-word-returns-whole-comment:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# write(_test-stream, " # a")
# . . push args
@ -738,8 +738,8 @@ test-next-word-returns-empty-string-on-eof:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# write nothing to _test-stream
# next-word(_test-stream, slice)
@ -902,8 +902,8 @@ has-metadata?: # word : (address slice), s : (address string) -> EAX : boolean
# EDX = word->end
8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 2/r32/EDX 4/disp8 . # copy *(ESI+4) to EDX
# var twig/EDI : (address slice) = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
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
# next-token-from-slice(word->start, word->end, '/', twig)
# . . push args
@ -1162,8 +1162,8 @@ emit: # out : (address buffered-file), word : (address slice), width : int -> <
# ESI = word
8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 . # copy *(EBP+12) to ESI
# var name/EDI : (address slice) = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
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
# datum = next-token-from-slice(word->start, word->end, '/')
# . . push args

View File

@ -320,14 +320,14 @@ test-convert-computes-addresses:
# global scratch space for compute-offsets in the data segment
== data
compute-offsets:curr-segment-name: 0/imm32/curr
compute-offsets:curr-segment-name:end: 0/imm32/limit
compute-offsets:curr-segment-name: 0/imm32/start
compute-offsets:curr-segment-name:end: 0/imm32/end
compute-offsets:file-offset: 0/imm32
compute-offsets:segment-offset: 0/imm32
compute-offsets:word-slice: 0/imm32/curr
compute-offsets:word-slice:end: 0/imm32/limit
compute-offsets:heap: 0/imm32/curr
compute-offsets:heap:end: 0/imm32/limit
compute-offsets:word-slice: 0/imm32/start
compute-offsets:word-slice:end: 0/imm32/end
compute-offsets:heap: 0/imm32/start
compute-offsets:heap:end: 0/imm32/end
== code
@ -2137,8 +2137,8 @@ num-bytes: # line : (address stream) -> EAX : int
# var result/EAX = 0
31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . . # clear EAX
# var word-slice/ECX = {0, 0}
68/push 0/imm32/limit
68/push 0/imm32/curr
68/push 0/imm32/end
68/push 0/imm32/start
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
#? # dump line {{{
#? # . write(2/stderr, "LL: ")