Be more consistent about names of ends of a slice.
This commit is contained in:
Kartik Agaram 2019-07-08 01:05:23 -07:00
parent e5cffe30ed
commit 925fc490d2
9 changed files with 80 additions and 80 deletions

View File

@ -20,7 +20,7 @@ Trace-stream:
Trace-segment:
0/imm32/curr
0/imm32/end
0/imm32/limit
# Fake trace-stream for tests.
# Also illustrates the layout of the real trace-stream (segment).

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/end
68/push 34/imm32/start
68/push 34/imm32/limit
68/push 34/imm32/curr
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/end
68/push 34/imm32/start
68/push 23/imm32/limit
68/push 34/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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

@ -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/end
68/push 0/imm32/limit
# . 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

View File

@ -485,7 +485,7 @@ 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/end
68/push 0/imm32/limit
68/push 0/imm32/curr
89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . . # copy ESP to EDX
$read-segments:loop:

View File

@ -121,7 +121,7 @@ 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/end
68/push 0/imm32/limit
68/push 0/imm32/curr
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)
@ -1032,7 +1032,7 @@ test-emit-string-literal-data:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = '"abc"/d'
68/push _test-slice-abc-end/imm32
68/push _test-slice-abc-limit/imm32
68/push _test-slice-abc/imm32
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# emit-string-literal-data(_test-output-stream, slice)
@ -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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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
@ -1161,7 +1161,7 @@ test-emit-string-literal-data-no-metadata-for-non-alphanumerics:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = '"a b"'
68/push _test-slice-a-space-b-end/imm32
68/push _test-slice-a-space-b-limit/imm32
68/push _test-slice-a-space-b/imm32
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# emit-string-literal-data(_test-output-stream, slice)
@ -1225,7 +1225,7 @@ test-emit-string-literal-data-handles-escape-sequences:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# var slice/ECX = '"a\"b"'
68/push _test-slice-a-dquote-b-end/imm32
68/push _test-slice-a-dquote-b-limit/imm32
68/push _test-slice-a-dquote-b/imm32
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# emit-string-literal-data(_test-output-stream, slice)
@ -1628,8 +1628,8 @@ test-emit-metadata-in-string-literal:
# . . discard args
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-end/imm32
68/push _test-slice-literal-string/imm32/start
68/push _test-slice-literal-string-with-limit/imm32
68/push _test-slice-literal-string/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# write(_test-input-stream, " \"a\\\"b\"/x")
# . . push args
@ -2661,15 +2661,15 @@ Slash:
_test-slice-abc:
22/dquote 61/a 62/b 63/c 22/dquote # "abc"
2f/slash 64/d
_test-slice-abc-end:
_test-slice-abc-limit:
_test-slice-a-space-b:
22/dquote 61/a 20/space 62/b 22/dquote # "a b"
_test-slice-a-space-b-end:
_test-slice-a-space-b-limit:
_test-slice-a-dquote-b:
22/dquote 61/a 5c/backslash 22/dquote 62/b 22/dquote # "a\"b"
_test-slice-a-dquote-b-end:
_test-slice-a-dquote-b-limit:
# "abc/def"/ghi
_test-slice-literal-string:
@ -2678,6 +2678,6 @@ _test-slice-literal-string:
2f/slash 64/d 65/e 66/f # /def
22/dquote
2f/slash 67/g 68/h 69/i # /ghi
_test-slice-literal-string-with-end:
_test-slice-literal-string-with-limit:
# . . vim:nowrap:textwidth=0

View File

@ -132,7 +132,7 @@ 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/end
68/push 0/imm32/limit
68/push 0/imm32/curr
89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . . # copy ESP to EDX
# var in-code?/EBX = false
@ -960,8 +960,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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
#? # dump line {{{
#? # . write(2/stderr, "LL: ")
@ -1873,8 +1873,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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# next-word(line, word-slice)
# . . push args
@ -2030,12 +2030,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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# var op2/EDX = {0, 0}
68/push 0/imm32/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . . # copy ESP to EDX
# rewind-stream(line)
# . . push args
@ -2321,8 +2321,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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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
@ -2632,8 +2632,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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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
@ -2905,8 +2905,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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# rewind-stream(line)
# . . push args
@ -3126,8 +3126,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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
# rewind-stream(line)
# . . push args
@ -5850,8 +5850,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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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
@ -6835,8 +6835,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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
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

View File

@ -2124,8 +2124,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/end
68/push 0/imm32/start
68/push 0/imm32/limit
68/push 0/imm32/curr
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
#? # dump line {{{
#? # . write(2/stderr, "LL: ")
@ -2698,13 +2698,13 @@ $p_align:
# compute the starting address for each segment
0x1000/imm32
compute-offsets:curr-segment-name: 0/imm32/start
compute-offsets:curr-segment-name:end: 0/imm32/end
compute-offsets:curr-segment-name: 0/imm32/curr
compute-offsets:curr-segment-name:end: 0/imm32/limit
compute-offsets:file-offset: 0/imm32
compute-offsets:segment-offset: 0/imm32
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
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
# . . vim:nowrap:textwidth=0