6627
This commit is contained in:
parent
c532373e29
commit
34dd228eb2
|
@ -28,7 +28,7 @@ Entry: # run all tests
|
|||
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx
|
||||
e8/call syscall_exit/disp32
|
||||
|
||||
kernel-string-equal?: # s: (addr kernel-string), benchmark: (addr array byte) -> eax: boolean
|
||||
kernel-string-equal?: # s: (addr kernel-string), benchmark: (addr array byte) -> result/eax: boolean
|
||||
# pseudocode:
|
||||
# n = benchmark->size
|
||||
# s1 = s
|
||||
|
|
|
@ -12,7 +12,7 @@ Entry: # run all tests
|
|||
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx
|
||||
e8/call syscall_exit/disp32
|
||||
|
||||
string-equal?: # s: (addr array byte), benchmark: (addr array byte) -> eax: boolean
|
||||
string-equal?: # s: (addr array byte), benchmark: (addr array byte) -> result/eax: boolean
|
||||
# pseudocode:
|
||||
# if (s->size != benchmark->size) return false
|
||||
# return string-starts-with?(s, benchmark)
|
||||
|
@ -54,7 +54,7 @@ $string-equal?:end:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
string-starts-with?: # s: (addr array byte), benchmark: (addr array byte) -> eax: boolean
|
||||
string-starts-with?: # s: (addr array byte), benchmark: (addr array byte) -> result/eax: boolean
|
||||
# pseudocode:
|
||||
# if (s->size < benchmark->size) return false
|
||||
# currs = s->data
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
|
||||
|
||||
# compare all the data in a stream (ignoring the read pointer)
|
||||
stream-data-equal?: # f: (addr stream byte), s: (addr array byte) -> eax: boolean
|
||||
stream-data-equal?: # f: (addr stream byte), s: (addr array byte) -> result/eax: boolean
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
@ -227,7 +227,7 @@ $check-stream-equal:end:
|
|||
# on success, set f->read to after the next newline
|
||||
# on failure, leave f->read unmodified
|
||||
# this function is usually used only in tests, so we repeatedly write f->read
|
||||
next-stream-line-equal?: # f: (addr stream byte), s: (addr array byte) -> eax: boolean
|
||||
next-stream-line-equal?: # f: (addr stream byte), s: (addr array byte) -> result/eax: boolean
|
||||
# pseudocode:
|
||||
# currf = f->read # bound: f->write
|
||||
# currs = 0 # bound: s->size
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# . op subop mod rm32 base index scale r32
|
||||
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
|
||||
|
||||
is-hex-int?: # in: (addr slice) -> eax: boolean
|
||||
is-hex-int?: # in: (addr slice) -> result/eax: boolean
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
@ -698,7 +698,7 @@ test-parse-hex-int-from-slice-negative:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
is-hex-digit?: # c: byte -> eax: boolean
|
||||
is-hex-digit?: # c: byte -> result/eax: boolean
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
|
|
@ -253,7 +253,7 @@ test-allocate-raw-success:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
lookup: # h: (handle T) -> eax: (addr T)
|
||||
lookup: # h: (handle T) -> result/eax: (addr T)
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
@ -455,7 +455,7 @@ _pending-test-lookup-failure:
|
|||
c3/return
|
||||
|
||||
# when comparing handles, just treat them as pure values
|
||||
handle-equal?: # a: handle, b: handle -> eax: boolean
|
||||
handle-equal?: # a: handle, b: handle -> result/eax: boolean
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# . op subop mod rm32 base index scale r32
|
||||
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
|
||||
|
||||
slice-empty?: # s: (addr slice) -> eax: boolean
|
||||
slice-empty?: # s: (addr slice) -> result/eax: boolean
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
@ -117,7 +117,7 @@ test-slice-empty-if-start-greater-than-end:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
slice-equal?: # s: (addr slice), p: (addr array byte) -> eax: boolean
|
||||
slice-equal?: # s: (addr slice), p: (addr array byte) -> result/eax: boolean
|
||||
# pseudocode:
|
||||
# if (p == 0) return (s == 0)
|
||||
# currs = s->start
|
||||
|
@ -484,7 +484,7 @@ test-slice-equal-with-null:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
slice-starts-with?: # s: (addr slice), head: (addr array byte) -> eax: boolean
|
||||
slice-starts-with?: # s: (addr slice), head: (addr array byte) -> result/eax: boolean
|
||||
# pseudocode
|
||||
# hsize = head->size
|
||||
# if (hsize > s->end - s->start) return false
|
||||
|
|
|
@ -303,7 +303,7 @@ test-write-int32-decimal-negative-multiple-digits:
|
|||
# . end
|
||||
c3/return
|
||||
|
||||
is-decimal-digit?: # c: byte -> eax: boolean
|
||||
is-decimal-digit?: # c: byte -> result/eax: boolean
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# . op subop mod rm32 base index scale r32
|
||||
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
|
||||
|
||||
has-metadata?: # word: (addr slice), s: (addr string) -> eax: boolean
|
||||
has-metadata?: # word: (addr slice), s: (addr string) -> result/eax: boolean
|
||||
# pseudocode:
|
||||
# var twig: &slice = next-token-from-slice(word->start, word->end, '/') # skip name
|
||||
# curr = twig->end
|
||||
|
@ -275,7 +275,7 @@ test-has-metadata-multiple-false:
|
|||
#: - if it starts with '0x' it's treated as a number. (redundant)
|
||||
#: - if it's two characters long, it can't be a name. Either it's a hex
|
||||
#: byte, or it raises an error.
|
||||
is-valid-name?: # in: (addr slice) -> eax: boolean
|
||||
is-valid-name?: # in: (addr slice) -> result/eax: boolean
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
@ -532,7 +532,7 @@ test-is-valid-name-starts-with-digit:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
is-label?: # word: (addr slice) -> eax: boolean
|
||||
is-label?: # word: (addr slice) -> result/eax: boolean
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
|
||||
|
||||
# if no row is found, abort
|
||||
get: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, abort-message-prefix: (addr array byte) -> eax: (addr T)
|
||||
get: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, abort-message-prefix: (addr array byte) -> result/eax: (addr T)
|
||||
# pseudocode:
|
||||
# curr = table->data
|
||||
# max = &table->data[table->write]
|
||||
|
@ -207,7 +207,7 @@ $test-get:end:
|
|||
c3/return
|
||||
|
||||
# if no row is found, abort
|
||||
get-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, abort-message-prefix: (addr array byte) -> eax: (addr T)
|
||||
get-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, abort-message-prefix: (addr array byte) -> result/eax: (addr T)
|
||||
# pseudocode:
|
||||
# curr = table->data
|
||||
# max = &table->data[table->write]
|
||||
|
@ -418,7 +418,7 @@ $test-get-slice:end:
|
|||
# if no row is found, save 'key' to the next available row
|
||||
# if there are no rows free, abort
|
||||
# return the address of the value
|
||||
get-or-insert: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, ad: (addr allocation-descriptor) -> eax: (addr T)
|
||||
get-or-insert: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T)
|
||||
# pseudocode:
|
||||
# curr = table->data
|
||||
# max = &table->data[table->write]
|
||||
|
@ -703,7 +703,7 @@ $test-get-or-insert:end:
|
|||
# if no row is found, save 'key' to the next available row
|
||||
# if there are no rows free, abort
|
||||
# return the address of the value
|
||||
get-or-insert-handle: # table: (addr stream {(handle array byte), T}), key: (handle array byte), row-size: int -> eax: (addr T)
|
||||
get-or-insert-handle: # table: (addr stream {(handle array byte), T}), key: (handle array byte), row-size: int -> result/eax: (addr T)
|
||||
# pseudocode:
|
||||
# var curr: (addr handle stream) = table->data
|
||||
# var max: (addr byte) = &table->data[table->write]
|
||||
|
@ -1019,7 +1019,7 @@ $test-get-or-insert-handle:end:
|
|||
|
||||
# if no row is found, save 'key' in the next available row
|
||||
# if there are no rows free, abort
|
||||
get-or-insert-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, ad: (addr allocation-descriptor) -> eax: (addr T)
|
||||
get-or-insert-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T)
|
||||
# pseudocode:
|
||||
# curr = table->data
|
||||
# max = &table->data[table->write]
|
||||
|
@ -1324,7 +1324,7 @@ $test-get-or-insert-slice:end:
|
|||
# if no row is found, stop(ed)
|
||||
get-or-stop: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int,
|
||||
# abort-message-prefix: (addr array byte), err: (addr buffered-file), ed: (addr exit-descriptor)
|
||||
# -> eax: (addr T)
|
||||
# -> result/eax: (addr T)
|
||||
# pseudocode:
|
||||
# curr = table->data
|
||||
# max = &table->data[table->write]
|
||||
|
@ -1550,7 +1550,7 @@ $test-get-or-stop:end:
|
|||
# if no row is found, stop(ed)
|
||||
get-slice-or-stop: # table: (addr stream {(handle array byte), _}), key: (addr slice), row-size: int,
|
||||
# abort-message-prefix: (addr string), err: (addr buffered-file), ed: (addr exit-descriptor)
|
||||
# -> eax: (addr _)
|
||||
# -> result/eax: (addr _)
|
||||
# pseudocode:
|
||||
# curr = table->data
|
||||
# max = &table->data[table->write]
|
||||
|
@ -1797,7 +1797,7 @@ $test-get-slice-or-stop:end:
|
|||
c3/return
|
||||
|
||||
# if no row is found, return null (0)
|
||||
maybe-get: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int -> eax: (addr T)
|
||||
maybe-get: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int -> result/eax: (addr T)
|
||||
# pseudocode:
|
||||
# curr = table->data
|
||||
# max = &table->data[table->write]
|
||||
|
@ -1962,7 +1962,7 @@ $test-maybe-get:end:
|
|||
c3/return
|
||||
|
||||
# if no row is found, return null (0)
|
||||
maybe-get-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int -> eax: (addr T)
|
||||
maybe-get-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int -> result/eax: (addr T)
|
||||
# pseudocode:
|
||||
# curr = table->data
|
||||
# max = &table->data[table->write]
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# . op subop mod rm32 base index scale r32
|
||||
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
|
||||
|
||||
compute-width: # word: (addr array byte) -> eax: int
|
||||
compute-width: # word: (addr array byte) -> result/eax: int
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
@ -42,7 +42,7 @@ $compute-width:end:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
compute-width-of-slice: # s: (addr slice) -> eax: int
|
||||
compute-width-of-slice: # s: (addr slice) -> result/eax: int
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
== code
|
||||
|
||||
array-equal?: # a: (addr array int), b: (addr array int) -> eax: boolean
|
||||
array-equal?: # a: (addr array int), b: (addr array int) -> result/eax: boolean
|
||||
# pseudocode:
|
||||
# asize = a->size
|
||||
# if (asize != b->size) return false
|
||||
|
|
|
@ -119,7 +119,7 @@ $enable-keyboard-type-mode:end:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
read-key: # -> eax: byte
|
||||
read-key: # -> result/eax: byte
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
|
|
Loading…
Reference in New Issue