5883 - drop the `ref` keyword
When I created it I was conflating two things: a) needing to refer to just the start, rather than the whole, and b) counting indirections. Both are kinda ill-posed. Now Mu will have just `addr` and `handle` types. Normal types will translate implicitly to `addr` types, while `handle` will always require explicit handling.
This commit is contained in:
parent
e064f1bbfd
commit
f1eade7286
|
@ -11,29 +11,6 @@ Entry: # just exit; can't test _write just yet
|
|||
b8/copy-to-eax 1/imm32/exit
|
||||
cd/syscall 0x80/imm8
|
||||
|
||||
# Since this is the first file of SubX code, a note about type comments.
|
||||
# Eventually we'll build a slightly higher-level safe language atop SubX.
|
||||
# Even though we don't have the safe language yet, we'll start thinking in
|
||||
# terms of the higher-level types in comments.
|
||||
#
|
||||
# Mu will have two kinds of addresses:
|
||||
# - 'ref' which is used to point to a unique element, because machine
|
||||
# code can't store large types in registers.
|
||||
# - 'handle' which can point to a heap allocation, different heap allocations
|
||||
# at different times, or even at times nothing at all. (Later on handles
|
||||
# will turn into fat pointers to enable safe reclamation. But in unsafe
|
||||
# levels we'll just never reclaim them, and handles will be word-sized just
|
||||
# like refs.)
|
||||
#
|
||||
# The type 'address' can be obtained from either a ref or handle, but it can
|
||||
# only be stored on the stack (say to pass objects by reference).
|
||||
# Conversely, a ref can't be copied into another ref, only to an address (which
|
||||
# by construction has a shorter lifetime).
|
||||
#
|
||||
# Beginnings of a lattice of types:
|
||||
# You can convert a ref or handle to an address, but not the other way around.
|
||||
# You can convert addresses to ints, but not the other way around.
|
||||
|
||||
_write: # fd : int, s : (addr array byte)
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
|
|
|
@ -80,7 +80,7 @@ $check-ints-equal:end:
|
|||
|
||||
# length-prefixed string containing just a single newline
|
||||
# convenient to have when printing messages and so on
|
||||
Newline: # (ref array byte)
|
||||
Newline: # (array byte)
|
||||
# size : int
|
||||
1/imm32
|
||||
# data
|
||||
|
@ -91,14 +91,14 @@ Num-test-failures: # int
|
|||
0/imm32
|
||||
|
||||
# length-prefixed string containing just a single space
|
||||
Space: # (ref array byte)
|
||||
Space: # (array byte)
|
||||
# size : int
|
||||
1/imm32
|
||||
# data
|
||||
20/space
|
||||
|
||||
# length-prefixed string containing just a single slash
|
||||
Slash: # (ref array byte)
|
||||
Slash: # (array byte)
|
||||
# size : int
|
||||
1/imm32
|
||||
# data
|
||||
|
|
|
@ -17,7 +17,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
|
||||
|
||||
Entry: # manual test
|
||||
# var ad/ecx : (ref allocation-descriptor)
|
||||
# var ad/ecx : allocation-descriptor
|
||||
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
|
||||
|
@ -38,7 +38,7 @@ Entry: # manual test
|
|||
b8/copy-to-eax 1/imm32/exit
|
||||
cd/syscall 0x80/imm8
|
||||
|
||||
new-segment: # len : int, ad : (ref allocation-descriptor)
|
||||
new-segment: # len : int, ad : allocation-descriptor
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
|
@ -72,7 +72,7 @@ $new-segment:end:
|
|||
== data
|
||||
|
||||
# various constants used here were found in the Linux sources (search for file mman-common.h)
|
||||
_mmap-new-segment: # (ref mmap_arg_struct)
|
||||
_mmap-new-segment: # mmap_arg_struct
|
||||
# addr
|
||||
0/imm32
|
||||
$_mmap-new-segment:len:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# A stream looks like this:
|
||||
# write : int # index at which writes go
|
||||
# read : int # index that we've read until
|
||||
# data : (ref array byte) # prefixed by length as usual
|
||||
# data : (array byte) # prefixed by length as usual
|
||||
#
|
||||
# some primitives for operating on streams:
|
||||
# - clear-stream (clears everything but the data length)
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
|
||||
== data
|
||||
|
||||
# Handles are addresses created on the heap.
|
||||
# In safe Mu they'll be fat pointers. But in SubX they're just addresses, since
|
||||
# SubX programs never reclaim memory.
|
||||
|
||||
Trace-stream: # (handle stream byte)
|
||||
0/imm32
|
||||
# we don't have safe handles (fat pointers) yet
|
||||
|
@ -24,7 +28,7 @@ Trace-segment:
|
|||
|
||||
# Fake trace-stream for tests.
|
||||
# Also illustrates the layout of the real trace-stream (segment).
|
||||
_test-trace-stream: # (ref stream byte)
|
||||
_test-trace-stream: # (stream byte)
|
||||
# current write index
|
||||
0/imm32
|
||||
# current read index
|
||||
|
@ -956,7 +960,7 @@ $_append-4:abort:
|
|||
|
||||
== data
|
||||
|
||||
_test-stream-line-ABABA: # (ref stream byte)
|
||||
_test-stream-line-ABABA: # (stream byte)
|
||||
# write
|
||||
8/imm32
|
||||
# read
|
||||
|
@ -966,7 +970,7 @@ _test-stream-line-ABABA: # (ref stream byte)
|
|||
# data
|
||||
41 42 41 42 41 0a 00 00 # 8 bytes
|
||||
|
||||
_test-stream-empty: # (ref stream byte)
|
||||
_test-stream-empty: # (stream byte)
|
||||
# write
|
||||
0/imm32
|
||||
# read
|
||||
|
@ -976,7 +980,7 @@ _test-stream-empty: # (ref stream byte)
|
|||
# data
|
||||
00 00 00 00 00 00 00 00 # 8 bytes
|
||||
|
||||
_test-stream-filled: # (ref stream byte)
|
||||
_test-stream-filled: # (stream byte)
|
||||
# write
|
||||
8/imm32
|
||||
# read
|
||||
|
|
|
@ -145,7 +145,7 @@ test-write-appends:
|
|||
|
||||
== data
|
||||
|
||||
_test-stream: # (ref stream byte)
|
||||
_test-stream: # (stream byte)
|
||||
# current write index
|
||||
0/imm32
|
||||
# current read index
|
||||
|
|
|
@ -123,7 +123,7 @@ test-stop-skips-returns-on-exit:
|
|||
# Make room for an exit descriptor on the stack. That's almost always the
|
||||
# right place for it, available only as long as it's legal to use. Once this
|
||||
# containing function returns we'll need a new exit descriptor.
|
||||
# var ed/eax : (ref exit-descriptor)
|
||||
# var ed/eax : exit-descriptor
|
||||
68/push 0/imm32
|
||||
68/push 0/imm32
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
|
|
|
@ -426,7 +426,7 @@ test-read-returns-0-on-end-of-file:
|
|||
|
||||
== data
|
||||
|
||||
_test-tmp-stream: # (ref stream byte)
|
||||
_test-tmp-stream: # (stream byte)
|
||||
# current write index
|
||||
0/imm32
|
||||
# current read index
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
# The buffered file for standard input. Also illustrates the layout for
|
||||
# buffered-file: a pointer to the backing store, followed by a 'buffer' stream
|
||||
Stdin: # (ref buffered-file)
|
||||
Stdin: # buffered-file
|
||||
# file descriptor or (addr stream byte)
|
||||
0/imm32 # standard input
|
||||
$Stdin->buffer:
|
||||
|
@ -271,7 +271,7 @@ test-read-byte-buffered-refills-buffer:
|
|||
== data
|
||||
|
||||
# a test buffered file for _test-stream
|
||||
_test-buffered-file: # (ref buffered-file)
|
||||
_test-buffered-file: # buffered-file
|
||||
# file descriptor or (addr stream byte)
|
||||
_test-stream/imm32
|
||||
$_test-buffered-file->buffer:
|
||||
|
@ -284,7 +284,7 @@ $_test-buffered-file->buffer:
|
|||
# data
|
||||
00 00 00 00 00 00 # 6 bytes
|
||||
|
||||
_test-input-stream: # (ref stream byte)
|
||||
_test-input-stream: # (stream byte)
|
||||
# current write index
|
||||
0/imm32
|
||||
# current read index
|
||||
|
@ -310,7 +310,7 @@ _test-input-stream: # (ref stream byte)
|
|||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
|
||||
# a test buffered file for _test-input-stream
|
||||
_test-input-buffered-file: # (ref buffered-file)
|
||||
_test-input-buffered-file: # buffered-file
|
||||
# file descriptor or (addr stream byte)
|
||||
_test-input-stream/imm32
|
||||
$_test-input-buffered-file->buffer:
|
||||
|
|
|
@ -242,7 +242,7 @@ test-write-stream-appends:
|
|||
|
||||
== data
|
||||
|
||||
_test-stream2: # (ref stream byte)
|
||||
_test-stream2: # (stream byte)
|
||||
# current write index
|
||||
4/imm32
|
||||
# current read index
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
== data
|
||||
|
||||
# The buffered file for standard output.
|
||||
Stdout: # (ref buffered-file)
|
||||
Stdout: # buffered-file
|
||||
# file descriptor or (addr stream byte)
|
||||
1/imm32 # standard output
|
||||
$Stdout->buffer:
|
||||
|
@ -283,7 +283,7 @@ test-append-byte-single:
|
|||
|
||||
== data
|
||||
|
||||
_test-output-stream: # (ref stream byte)
|
||||
_test-output-stream: # (stream byte)
|
||||
# current write index
|
||||
0/imm32
|
||||
# current read index
|
||||
|
@ -325,7 +325,7 @@ _test-output-stream: # (ref stream byte)
|
|||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
|
||||
# a test buffered file for _test-output-stream
|
||||
_test-output-buffered-file: # (ref buffered-file)
|
||||
_test-output-buffered-file: # buffered-file
|
||||
# file descriptor or (addr stream byte)
|
||||
_test-output-stream/imm32
|
||||
$_test-output-buffered-file->buffer:
|
||||
|
@ -338,7 +338,7 @@ $_test-output-buffered-file->buffer:
|
|||
# data
|
||||
00 00 00 00 00 00 # 6 bytes
|
||||
|
||||
_test-error-stream: # (ref stream byte)
|
||||
_test-error-stream: # (stream byte)
|
||||
# current write index
|
||||
0/imm32
|
||||
# current read index
|
||||
|
@ -356,7 +356,7 @@ _test-error-stream: # (ref stream byte)
|
|||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
|
||||
# a test buffered file for _test-error-stream
|
||||
_test-error-buffered-file: # (ref buffered-file)
|
||||
_test-error-buffered-file: # buffered-file
|
||||
# file descriptor or (addr stream byte)
|
||||
_test-error-stream/imm32
|
||||
$_test-error-buffered-file->buffer:
|
||||
|
|
|
@ -206,7 +206,7 @@ test-write-buffered-with-intermediate-flush:
|
|||
== data
|
||||
|
||||
# The buffered file for standard error.
|
||||
Stderr: # (ref buffered-file)
|
||||
Stderr: # buffered-file
|
||||
# file descriptor or (addr stream byte)
|
||||
2/imm32 # standard error
|
||||
$Stderr->buffer:
|
||||
|
|
|
@ -93,7 +93,7 @@ test-is-hex-int:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -127,7 +127,7 @@ test-is-hex-int-handles-letters:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -161,7 +161,7 @@ test-is-hex-int-with-trailing-char:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -195,7 +195,7 @@ test-is-hex-int-with-leading-char:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -224,7 +224,7 @@ test-is-hex-int-empty:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var slice/ecx : (ref slice) = ""
|
||||
# var slice/ecx : slice = ""
|
||||
68/push 0/imm32
|
||||
68/push 0/imm32
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -258,7 +258,7 @@ test-is-hex-int-handles-0x-prefix:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -292,7 +292,7 @@ test-is-hex-int-handles-negative:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -326,7 +326,7 @@ test-is-hex-int-handles-negative-0x-prefix:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -442,7 +442,7 @@ test-parse-hex-int-single-digit:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -476,7 +476,7 @@ test-parse-hex-int-multi-digit:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -510,7 +510,7 @@ test-parse-hex-int-0x-prefix:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -544,7 +544,7 @@ test-parse-hex-int-zero:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -578,7 +578,7 @@ test-parse-hex-int-0-prefix:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -612,7 +612,7 @@ test-parse-hex-int-negative:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
|
|
@ -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
|
||||
|
||||
#? Entry: # manual test
|
||||
#? # . var ed/eax : (ref exit-descriptor)
|
||||
#? # . var ed/eax : exit-descriptor
|
||||
#? 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
#? 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
#? # . configure ed to really exit()
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
== data
|
||||
|
||||
# A default allocation descriptor for programs to use.
|
||||
Heap: # (ref allocation-descriptor)
|
||||
Heap: # allocation-descriptor
|
||||
# curr
|
||||
0/imm32
|
||||
# limit
|
||||
0/imm32
|
||||
|
||||
# a reasonable default
|
||||
Heap-size: # (ref int)
|
||||
Heap-size: # int
|
||||
0x200000/imm32/2MB
|
||||
|
||||
== code
|
||||
|
@ -104,7 +104,7 @@ test-allocate-success:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var ad/ecx : (ref allocation-descriptor) = {11, 15}
|
||||
# var ad/ecx : allocation-descriptor = {11, 15}
|
||||
68/push 0xf/imm32/limit
|
||||
68/push 0xb/imm32/curr
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -143,7 +143,7 @@ _pending-test-allocate-failure:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var ad/ecx : (ref allocation-descriptor) = {11, 15}
|
||||
# var ad/ecx : allocation-descriptor = {11, 15}
|
||||
68/push 0xf/imm32/limit
|
||||
68/push 0xb/imm32/curr
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
|
|
@ -68,7 +68,7 @@ test-new-stream:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var heap/ecx : (ref allocation-descriptor)
|
||||
# var heap/ecx : allocation-descriptor
|
||||
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
|
||||
|
|
|
@ -34,7 +34,7 @@ test-slice-empty-true:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var slice/ecx : (ref slice) = {34, 34}
|
||||
# var slice/ecx : slice = {34, 34}
|
||||
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
|
||||
|
@ -63,7 +63,7 @@ test-slice-empty-false:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var slice/ecx : (ref slice) = {34, 23}
|
||||
# var slice/ecx : slice = {34, 23}
|
||||
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
|
||||
|
@ -187,7 +187,7 @@ test-slice-equal:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -223,7 +223,7 @@ test-slice-equal-false:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -259,7 +259,7 @@ test-slice-equal-too-long:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -295,7 +295,7 @@ test-slice-equal-too-short:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -326,7 +326,7 @@ test-slice-equal-empty:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -362,7 +362,7 @@ test-slice-equal-with-empty:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -393,7 +393,7 @@ test-slice-equal-empty-with-empty:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -429,7 +429,7 @@ test-slice-equal-with-null:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -553,7 +553,7 @@ test-slice-starts-with-single-character:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -589,7 +589,7 @@ test-slice-starts-with-empty-string:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -625,7 +625,7 @@ test-slice-starts-with-multiple-characters:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -661,7 +661,7 @@ test-slice-starts-with-entire-string:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -697,7 +697,7 @@ test-slice-starts-with-fails:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -733,7 +733,7 @@ test-slice-starts-with-fails-2:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -850,7 +850,7 @@ test-write-slice:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -978,7 +978,7 @@ test-write-slice-buffered:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -1094,7 +1094,7 @@ test-slice-to-string:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var heap/edx : (ref allocation-descriptor)
|
||||
# var heap/edx : allocation-descriptor
|
||||
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
|
||||
|
@ -1111,7 +1111,7 @@ test-slice-to-string:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
|
|
@ -66,7 +66,7 @@ test-next-token:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -130,7 +130,7 @@ test-next-token-Eof:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -216,7 +216,7 @@ test-next-token-from-slice:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 : (ref slice)
|
||||
# var out/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
|
||||
|
@ -265,7 +265,7 @@ test-next-token-from-slice-Eof:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var out/edi : (ref slice)
|
||||
# var out/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
|
||||
|
@ -306,7 +306,7 @@ test-next-token-from-slice-nothing:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 : (ref slice)
|
||||
# var out/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
|
||||
|
|
|
@ -18,7 +18,7 @@ write-stream-data: # f : (addr buffered-file), s : (addr stream byte)
|
|||
56/push-esi
|
||||
# esi = s
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi
|
||||
# var slice/ecx : (ref slice) = {s->data, &s->data[s->write]}
|
||||
# var slice/ecx : slice = {s->data, &s->data[s->write]}
|
||||
# . push &s->data[s->write]
|
||||
8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax
|
||||
8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 . # copy esi+eax+12 to eax
|
||||
|
|
|
@ -95,7 +95,7 @@ test-next-word:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -158,7 +158,7 @@ test-next-word-returns-whole-comment:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -221,7 +221,7 @@ test-next-word-returns-empty-string-on-eof:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
|
|
@ -27,7 +27,7 @@ has-metadata?: # word : (addr slice), s : (addr string) -> eax : boolean
|
|||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
|
||||
# var edx : (addr byte) = word->end
|
||||
8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 4/disp8 . # copy *(esi+4) to edx
|
||||
# var twig/edi : (ref slice)
|
||||
# var twig/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
|
||||
|
@ -101,7 +101,7 @@ test-has-metadata-true:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 in/esi : (ref slice) = {eax, ecx}
|
||||
# var in/esi : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . . # copy esp to esi
|
||||
|
@ -136,7 +136,7 @@ test-has-metadata-false:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 in/esi : (ref slice) = {eax, ecx}
|
||||
# var in/esi : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . . # copy esp to esi
|
||||
|
@ -171,7 +171,7 @@ test-has-metadata-ignore-name:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 in/esi : (ref slice) = {eax, ecx}
|
||||
# var in/esi : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . . # copy esp to esi
|
||||
|
@ -206,7 +206,7 @@ test-has-metadata-multiple-true:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 in/esi : (ref slice) = {eax, ecx}
|
||||
# var in/esi : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . . # copy esp to esi
|
||||
|
@ -241,7 +241,7 @@ test-has-metadata-multiple-false:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 in/esi : (ref slice) = {eax, ecx}
|
||||
# var in/esi : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . . # copy esp to esi
|
||||
|
@ -337,7 +337,7 @@ test-is-valid-name-digit-prefix:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -371,7 +371,7 @@ test-is-valid-name-negative-prefix:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -405,7 +405,7 @@ test-is-valid-name-0x-prefix:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -439,7 +439,7 @@ test-is-valid-name-starts-with-pre-digit:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -473,7 +473,7 @@ test-is-valid-name-starts-with-post-digit:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -507,7 +507,7 @@ test-is-valid-name-starts-with-digit:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -569,7 +569,7 @@ $test-is-label?:true:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -595,7 +595,7 @@ $test-is-label?:false:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
|
14
079emit.subx
14
079emit.subx
|
@ -17,7 +17,7 @@ emit: # out : (addr buffered-file), word : (addr slice), width : int
|
|||
57/push-edi
|
||||
# esi = word
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi
|
||||
# var datum/edi : (ref slice)
|
||||
# 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
|
||||
|
@ -120,7 +120,7 @@ test-emit-number:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -179,7 +179,7 @@ test-emit-negative-number:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -237,7 +237,7 @@ test-emit-number-with-metadata:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -296,7 +296,7 @@ test-emit-non-number:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -354,7 +354,7 @@ test-emit-non-number-with-metadata:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -412,7 +412,7 @@ test-emit-non-number-with-all-hex-digits-and-metadata:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
|
|
@ -125,7 +125,7 @@ test-get:
|
|||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# - setup: create a table with a couple of keys
|
||||
# var table/ecx : (ref stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
# var table/ecx : (stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # subtract from esp
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -306,7 +306,7 @@ test-get-slice:
|
|||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# - setup: create a table with a couple of keys
|
||||
# var table/ecx : (ref stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
# var table/ecx : (stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # subtract from esp
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -336,7 +336,7 @@ $test-get-slice:check1:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 2/r32/edx . . # copy *eax to edx
|
||||
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 2/index/edx . 2/r32/edx 4/disp8 . # copy eax+edx+4 to edx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/edx : (ref slice) = {eax, edx}
|
||||
# var slice/edx : slice = {eax, edx}
|
||||
52/push-edx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
|
@ -366,7 +366,7 @@ $test-get-slice:check2:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 2/r32/edx . . # copy *eax to edx
|
||||
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 2/index/edx . 2/r32/edx 4/disp8 . # copy eax+edx+4 to edx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/edx : (ref slice) = {eax, edx}
|
||||
# var slice/edx : slice = {eax, edx}
|
||||
52/push-edx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
|
@ -512,7 +512,7 @@ test-get-or-insert:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var table/ecx : (ref stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
# var table/ecx : (stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # subtract from esp
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -769,7 +769,7 @@ test-leaky-get-or-insert-slice:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var table/ecx : (ref stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
# var table/ecx : (stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # subtract from esp
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -780,7 +780,7 @@ test-leaky-get-or-insert-slice:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 2/r32/edx . . # copy *eax to edx
|
||||
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 2/index/edx . 2/r32/edx 4/disp8 . # copy eax+edx+4 to edx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/edx : (ref slice) = {eax, edx}
|
||||
# var slice/edx : slice = {eax, edx}
|
||||
52/push-edx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
|
@ -873,7 +873,7 @@ $test-leaky-get-or-insert-slice:third-call:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 2/r32/edx . . # copy *eax to edx
|
||||
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 2/index/edx . 2/r32/edx 4/disp8 . # copy eax+edx+4 to edx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/edx : (ref slice) = {eax, edx}
|
||||
# var slice/edx : slice = {eax, edx}
|
||||
52/push-edx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
|
@ -1051,13 +1051,13 @@ test-get-or-stop:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var table/ecx : (ref stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
# var table/ecx : (stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # subtract from esp
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var ed/edx : (ref exit-descriptor)
|
||||
# var ed/edx : exit-descriptor
|
||||
68/push 0/imm32
|
||||
68/push 0/imm32
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
|
@ -1267,17 +1267,17 @@ test-get-slice-or-stop:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var table/ecx : (ref stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
# var table/ecx : (stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # subtract from esp
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var ed/edx : (ref exit-descriptor)
|
||||
# var ed/edx : exit-descriptor
|
||||
68/push 0/imm32
|
||||
68/push 0/imm32
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
# var slice/ebx : (ref slice) = "code"
|
||||
# var slice/ebx : slice = "code"
|
||||
# . (eax..ebx) = "code"
|
||||
b8/copy-to-eax "code"/imm32
|
||||
8b/copy 0/mod/indirect 0/rm32/eax . . . 3/r32/ebx . . # copy *eax to ebx
|
||||
|
@ -1443,7 +1443,7 @@ test-maybe-get:
|
|||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# - setup: create a table with one row
|
||||
# var table/ecx : (ref stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
# var table/ecx : (stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # subtract from esp
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -1590,7 +1590,7 @@ test-maybe-get-slice:
|
|||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# - setup: create a table with one row
|
||||
# var table/ecx : (ref stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
# var table/ecx : (stream {string, number} 16) # 2 rows * 8 bytes/row
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # subtract from esp
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -1612,7 +1612,7 @@ $test-maybe-get-slice:success:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 2/r32/edx . . # copy *eax to edx
|
||||
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 2/index/edx . 2/r32/edx 4/disp8 . # copy eax+edx+4 to edx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/edx : (ref slice) = {eax, edx}
|
||||
# var slice/edx : slice = {eax, edx}
|
||||
52/push-edx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
|
@ -1662,7 +1662,7 @@ $test-maybe-get-slice:failure:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 2/r32/edx . . # copy *eax to edx
|
||||
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 2/index/edx . 2/r32/edx 4/disp8 . # copy eax+edx+4 to edx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/edx : (ref slice) = {eax, edx}
|
||||
# var slice/edx : slice = {eax, edx}
|
||||
52/push-edx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
|
|
|
@ -21,7 +21,7 @@ compute-width: # word : (addr array byte) -> eax : int
|
|||
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
|
||||
# eax = word->data
|
||||
05/add-to-eax 4/imm32
|
||||
# var in/ecx : (ref slice) = {eax, ecx}
|
||||
# var in/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
|
|
@ -71,7 +71,7 @@ test-emit-hex-array:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var arr/ecx (ref array byte) = [01, 02, 03]
|
||||
# var arr/ecx (array byte) = [01, 02, 03]
|
||||
68/push 0x00030201/imm32 # bytes 01 02 03
|
||||
68/push 3/imm32/length
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
|
|
@ -93,10 +93,10 @@ test-compare-empty-with-empty-array:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var ecx : (ref array _) = []
|
||||
# var ecx : (array _) = []
|
||||
68/push 0/imm32/size
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var edx : (ref array _) = []
|
||||
# var edx : (array _) = []
|
||||
68/push 0/imm32/size
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
# eax = array-equal?(ecx, edx)
|
||||
|
@ -125,11 +125,11 @@ test-compare-empty-with-non-empty-array: # also checks length-mismatch code pat
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var ecx : (ref array int) = [1]
|
||||
# var ecx : (array int) = [1]
|
||||
68/push 1/imm32
|
||||
68/push 4/imm32/size
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var edx : (ref array int) = []
|
||||
# var edx : (array int) = []
|
||||
68/push 0/imm32/size
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
# eax = array-equal?(ecx, edx)
|
||||
|
@ -158,13 +158,13 @@ test-compare-equal-arrays:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var ecx : (ref array int) = [1, 2, 3]
|
||||
# var ecx : (array int) = [1, 2, 3]
|
||||
68/push 3/imm32
|
||||
68/push 2/imm32
|
||||
68/push 1/imm32
|
||||
68/push 0xc/imm32/size
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var edx : (ref array int) = [1, 2, 3]
|
||||
# var edx : (array int) = [1, 2, 3]
|
||||
68/push 3/imm32
|
||||
68/push 2/imm32
|
||||
68/push 1/imm32
|
||||
|
@ -196,13 +196,13 @@ test-compare-inequal-arrays-equal-lengths:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var ecx : (ref array int) = [1, 4, 3]
|
||||
# var ecx : (array int) = [1, 4, 3]
|
||||
68/push 3/imm32
|
||||
68/push 4/imm32
|
||||
68/push 1/imm32
|
||||
68/push 0xc/imm32/size
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var edx : (ref array int) = [1, 2, 3]
|
||||
# var edx : (array int) = [1, 2, 3]
|
||||
68/push 3/imm32
|
||||
68/push 2/imm32
|
||||
68/push 1/imm32
|
||||
|
@ -243,7 +243,7 @@ parse-array-of-ints: # ad : (addr allocation-descriptor), s : (addr string) ->
|
|||
# ++size
|
||||
# result = allocate(ad, (size+1)*4)
|
||||
# result->size = (size+1)*4
|
||||
# var slice : (ref slice) = {s->data, 0}
|
||||
# var slice : slice = {s->data, 0}
|
||||
# out = result->data
|
||||
# while true
|
||||
# if (slice->start >= end) break
|
||||
|
@ -326,7 +326,7 @@ $parse-array-of-ints:break1:
|
|||
# result->size = size
|
||||
89/copy 0/mod/indirect 0/rm32/eax . . . 3/r32/ebx . . # copy ebx to *eax
|
||||
$parse-array-of-ints:pass2:
|
||||
# var slice/ecx : (ref slice) = {s->data, 0}
|
||||
# var slice/ecx : slice = {s->data, 0}
|
||||
# . push 0
|
||||
68/push 0/imm32/end
|
||||
# . push s->data
|
||||
|
@ -404,7 +404,7 @@ test-parse-array-of-ints:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var ecx : (ref array int) = [1, 2, 3]
|
||||
# var ecx : (array int) = [1, 2, 3]
|
||||
68/push 3/imm32
|
||||
68/push 2/imm32
|
||||
68/push 1/imm32
|
||||
|
@ -498,7 +498,7 @@ test-parse-array-of-ints-extra-whitespace:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var ecx : (ref array int) = [1, 2, 3]
|
||||
# var ecx : (array int) = [1, 2, 3]
|
||||
68/push 3/imm32
|
||||
68/push 2/imm32
|
||||
68/push 1/imm32
|
||||
|
@ -582,7 +582,7 @@ test-check-array-equal:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var ecx : (ref array int) = [1, 2, 3]
|
||||
# var ecx : (array int) = [1, 2, 3]
|
||||
68/push 3/imm32
|
||||
68/push 2/imm32
|
||||
68/push 1/imm32
|
||||
|
|
|
@ -111,7 +111,7 @@ test-next-word-or-string:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -184,7 +184,7 @@ test-next-word-or-string-returns-whole-comment:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -257,7 +257,7 @@ test-next-word-or-string-returns-empty-slice-on-eof:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -299,7 +299,7 @@ test-next-word-or-string-returns-string-literal:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -362,7 +362,7 @@ test-next-word-or-string-returns-string-with-escapes:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
|
|
@ -60,7 +60,7 @@ Entry: # run tests if necessary, convert stdin if not
|
|||
eb/jump $subx-assort-main:end/disp8
|
||||
$subx-assort-main:interactive:
|
||||
# - otherwise convert stdin
|
||||
# var ed/eax : (ref exit-descriptor)
|
||||
# var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# configure ed to really exit()
|
||||
|
@ -97,7 +97,7 @@ subx-assort: # in : (addr buffered-file), out : (addr buffered-file)
|
|||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# . save registers
|
||||
51/push-ecx
|
||||
# var table/ecx : (ref stream {string, (addr stream byte)} 80) # 10 rows * 8 bytes/row
|
||||
# var table/ecx : (stream {string, (addr stream byte)} 80) # 10 rows * 8 bytes/row
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x50/imm32 # subtract from esp
|
||||
68/push 0x50/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -496,13 +496,13 @@ read-segments: # in : (addr buffered-file), table : (addr stream {string_key, (
|
|||
52/push-edx
|
||||
53/push-ebx
|
||||
56/push-esi
|
||||
# var line/ecx : (ref stream byte 512)
|
||||
# var line/ecx : (stream byte 512)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp
|
||||
68/push 0x200/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var word-slice/edx : (ref slice)
|
||||
# var word-slice/edx : slice
|
||||
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
|
||||
|
|
|
@ -77,7 +77,7 @@ $subx-braces-main:end:
|
|||
|
||||
subx-braces: # in : (addr buffered-file), out : (addr buffered-file)
|
||||
# pseudocode:
|
||||
# var line : (ref stream byte 512)
|
||||
# var line : (stream byte 512)
|
||||
# var label-stack : (stack int 32) # at most 32 levels of nesting
|
||||
# var next-label-id : int = 1
|
||||
# while true
|
||||
|
@ -123,20 +123,20 @@ subx-braces: # in : (addr buffered-file), out : (addr buffered-file)
|
|||
57/push-edi
|
||||
# esi = in
|
||||
8b/-> *(ebp+8) 6/r32/esi
|
||||
# var line/ecx : (ref stream byte 512)
|
||||
# var line/ecx : (stream byte 512)
|
||||
81 5/subop/subtract %esp 0x200/imm32
|
||||
68/push 0x200/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var label-stack/edx : (ref stack int 32)
|
||||
# var label-stack/edx : (stack int 32)
|
||||
81 5/subop/subtract %esp 0x80/imm32
|
||||
68/push 0x80/imm32/length
|
||||
68/push 0/imm32/top
|
||||
89/<- %edx 4/r32/esp
|
||||
# var next-label-id/ebx : int = 1
|
||||
c7 0/subop/copy %ebx 1/imm32
|
||||
# var word-slice/edi : (ref slice)
|
||||
# var word-slice/edi : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %edi 4/r32/esp
|
||||
|
|
|
@ -77,8 +77,8 @@ $subx-calls-main:end:
|
|||
|
||||
subx-calls: # in : (addr buffered-file), out : (addr buffered-file)
|
||||
# pseudocode:
|
||||
# var line : (ref stream byte 512)
|
||||
# var words : (ref stream slice 16) # at most function name and 15 args
|
||||
# var line : (stream byte 512)
|
||||
# var words : (stream slice 16) # at most function name and 15 args
|
||||
# while true
|
||||
# clear-stream(line)
|
||||
# read-line-buffered(in, line)
|
||||
|
@ -105,13 +105,13 @@ subx-calls: # in : (addr buffered-file), out : (addr buffered-file)
|
|||
51/push-ecx
|
||||
52/push-edx
|
||||
56/push-esi
|
||||
# var line/esi : (ref stream byte 512)
|
||||
# var line/esi : (stream byte 512)
|
||||
81 5/subop/subtract %esp 0x200/imm32
|
||||
68/push 0x200/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/<- %esi 4/r32/esp
|
||||
# var words/edx : (ref stream slice 128) # 16 rows * 8 bytes/row
|
||||
# var words/edx : (stream slice 128) # 16 rows * 8 bytes/row
|
||||
81 5/subop/subtract %esp 0x80/imm32
|
||||
68/push 0x80/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -233,7 +233,7 @@ $subx-calls:end:
|
|||
|
||||
parse-line: # line : (addr stream byte), words : (addr stream slice)
|
||||
# pseudocode:
|
||||
# var word-slice : (ref slice)
|
||||
# var word-slice : slice
|
||||
# while true
|
||||
# word-slice = next-word-string-or-expression-without-metadata(line)
|
||||
# if slice-empty?(word-slice)
|
||||
|
@ -246,7 +246,7 @@ parse-line: # line : (addr stream byte), words : (addr stream slice)
|
|||
89/<- %ebp 4/r32/esp
|
||||
# . save registers
|
||||
51/push-ecx
|
||||
# var word-slice/ecx : (ref slice)
|
||||
# var word-slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1191,7 +1191,7 @@ test-next-word-string-or-expression-without-metadata:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add %esp 4/imm32
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1264,7 +1264,7 @@ test-next-word-string-or-expression-without-metadata-returns-whole-comment:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add %esp 4/imm32
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1337,7 +1337,7 @@ test-next-word-string-or-expression-without-metadata-returns-empty-slice-on-eof:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add %esp 4/imm32
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1379,7 +1379,7 @@ test-next-word-string-or-expression-without-metadata-returns-string-literal:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add %esp 4/imm32
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1442,7 +1442,7 @@ test-next-word-string-or-expression-without-metadata-returns-string-with-escapes
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add %esp 4/imm32
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1505,7 +1505,7 @@ test-next-word-string-or-expression-without-metadata-returns-whole-expression:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add %esp 4/imm32
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1568,7 +1568,7 @@ test-next-word-string-or-expression-without-metadata-returns-eol-on-trailing-clo
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add %esp 4/imm32
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1623,7 +1623,7 @@ test-next-word-string-or-expression-without-metadata-handles-comment-after-trail
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add %esp 4/imm32
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1678,7 +1678,7 @@ test-next-word-string-or-expression-without-metadata-handles-newline-after-trail
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add %esp 4/imm32
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1733,7 +1733,7 @@ test-next-word-string-or-expression-without-metadata-stops-at-close-paren:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add %esp 4/imm32
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
|
|
@ -67,7 +67,7 @@ Entry: # run tests if necessary, call 'compile' if not
|
|||
eb/jump $main:end/disp8
|
||||
$run-main:
|
||||
# - otherwise read a program from stdin and emit its translation to stdout
|
||||
# var ed/eax : (ref exit-descriptor)
|
||||
# var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# configure ed to really exit()
|
||||
|
@ -105,7 +105,7 @@ compile: # in : (addr buffered-file), out : fd or (addr stream byte), err : fd
|
|||
e8/call get-char/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var num/ecx : (ref stream byte 7)
|
||||
# var num/ecx : (stream byte 7)
|
||||
# Numbers can be 32 bits or 8 hex bytes long. One of them will be in 'Look', so we need space for 7 bytes.
|
||||
# Sizing the stream just right buys us overflow-handling for free inside 'get-num'.
|
||||
# Add 12 bytes for 'read', 'write' and 'length' fields, for a total of 19 bytes, or 0x13 in hex.
|
||||
|
@ -339,7 +339,7 @@ test-get-num-reads-single-digit:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'get-num' below
|
||||
# . var ed/eax : (ref exit-descriptor)
|
||||
# . var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# . tailor-exit-descriptor(ed, 16)
|
||||
|
@ -428,7 +428,7 @@ test-get-num-aborts-on-non-digit-in-Look:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'get-num' below
|
||||
# . var ed/eax : (ref exit-descriptor)
|
||||
# . var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# . tailor-exit-descriptor(ed, 16)
|
||||
|
|
|
@ -67,7 +67,7 @@ Entry: # run tests if necessary, call 'compile' if not
|
|||
eb/jump $main:end/disp8
|
||||
$run-main:
|
||||
# - otherwise read a program from stdin and emit its translation to stdout
|
||||
# var ed/eax : (ref exit-descriptor)
|
||||
# var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# configure ed to really exit()
|
||||
|
@ -105,7 +105,7 @@ compile: # in : (addr buffered-file), out : fd or (addr stream byte), err : fd
|
|||
e8/call get-char/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var num/ecx : (ref stream byte 7)
|
||||
# var num/ecx : (stream byte 7)
|
||||
# Numbers can be 32 bits or 8 hex bytes long. One of them will be in 'Look', so we need space for 7 bytes.
|
||||
# Sizing the stream just right buys us overflow-handling for free inside 'get-num'.
|
||||
# Add 12 bytes for 'read', 'write' and 'length' fields, for a total of 19 bytes, or 0x13 in hex.
|
||||
|
@ -355,7 +355,7 @@ test-get-num-reads-single-digit:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'get-num' below
|
||||
# . var ed/eax : (ref exit-descriptor)
|
||||
# . var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# . tailor-exit-descriptor(ed, 16)
|
||||
|
@ -444,7 +444,7 @@ test-get-num-aborts-on-non-digit-in-Look:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'get-num' below
|
||||
# . var ed/eax : (ref exit-descriptor)
|
||||
# . var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# . tailor-exit-descriptor(ed, 16)
|
||||
|
@ -527,7 +527,7 @@ test-get-num-reads-multiple-digits:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'get-num' below
|
||||
# . var ed/eax : (ref exit-descriptor)
|
||||
# . var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# . tailor-exit-descriptor(ed, 16)
|
||||
|
@ -616,7 +616,7 @@ test-get-num-reads-multiple-digits-followed-by-nondigit:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'get-num' below
|
||||
# . var ed/eax : (ref exit-descriptor)
|
||||
# . var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# . tailor-exit-descriptor(ed, 16)
|
||||
|
|
|
@ -56,7 +56,7 @@ Entry: # run tests if necessary, convert stdin if not
|
|||
eb/jump $subx-dquotes-main:end/disp8
|
||||
$subx-dquotes-main:interactive:
|
||||
# - otherwise convert stdin
|
||||
# var ed/eax : (ref exit-descriptor)
|
||||
# var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# configure ed to really exit()
|
||||
|
@ -84,7 +84,7 @@ $subx-dquotes-main:end:
|
|||
|
||||
subx-dquotes: # in : (addr buffered-file), out : (addr buffered-file)
|
||||
# pseudocode:
|
||||
# var line : (ref stream byte 512)
|
||||
# var line : (stream byte 512)
|
||||
# var new-data-segment : (handle stream byte) = new-stream(Heap, Segment-size, 1)
|
||||
#
|
||||
# write(new-data-segment, "== data\n")
|
||||
|
@ -125,13 +125,13 @@ subx-dquotes: # in : (addr buffered-file), out : (addr buffered-file)
|
|||
53/push-ebx
|
||||
56/push-esi
|
||||
57/push-edi
|
||||
# var line/ecx : (ref stream byte 512)
|
||||
# var line/ecx : (stream byte 512)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp
|
||||
68/push 0x200/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var word-slice/edx : (ref slice)
|
||||
# var word-slice/edx : slice
|
||||
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
|
||||
|
@ -300,7 +300,7 @@ process-string-literal: # string-literal : (addr slice), out : (addr buffered-f
|
|||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# . save registers
|
||||
51/push-ecx
|
||||
# var int32-stream/ecx : (ref stream byte 10) # number of decimal digits a 32-bit number can have
|
||||
# var int32-stream/ecx : (stream byte 10) # number of decimal digits a 32-bit number can have
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa/imm32 # subtract from esp
|
||||
68/push 0xa/imm32/decimal-digits-in-32bit-number
|
||||
68/push 0/imm32/read
|
||||
|
@ -1381,7 +1381,7 @@ test-emit-string-literal-data-handles-newline-escape:
|
|||
# emit everything from a word except the initial datum
|
||||
emit-metadata: # out : (addr buffered-file), word : (addr slice)
|
||||
# pseudocode
|
||||
# var slice : (ref slice) = {0, word->end}
|
||||
# var slice : slice = {0, word->end}
|
||||
# curr = word->start
|
||||
# if *curr == '"'
|
||||
# curr = skip-string-in-slice(curr, word->end)
|
||||
|
@ -1410,7 +1410,7 @@ emit-metadata: # out : (addr buffered-file), word : (addr slice)
|
|||
8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . . # copy *esi to ecx
|
||||
# var end/edx : (addr byte) = word->end
|
||||
8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 4/disp8 . # copy *(esi+4) to edx
|
||||
# var slice/ebx : (ref slice) = {0, end}
|
||||
# var slice/ebx : slice = {0, end}
|
||||
52/push-edx
|
||||
68/push 0/imm32
|
||||
89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . . # copy esp to ebx
|
||||
|
|
|
@ -96,7 +96,7 @@ test-new:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var heap/edx : (ref allocation-descriptor)
|
||||
# var heap/edx : allocation-descriptor
|
||||
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
|
||||
|
@ -110,7 +110,7 @@ test-new:
|
|||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# *Next-alloc-id = 0x34
|
||||
c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 0x34/imm32 # copy to *Next-alloc-id
|
||||
# var handle/ecx : (ref handle)
|
||||
# var handle/ecx : handle
|
||||
68/push 0/imm32/address
|
||||
68/push 0/imm32/alloc-id
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -166,7 +166,7 @@ _pending-test-new-failure:
|
|||
# . *Next-alloc-id = 0x34
|
||||
c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 0x34/imm32 # copy to *Next-alloc-id
|
||||
# define an allocation-descriptor with no space left
|
||||
# . var ad/eax : (ref allocation-descriptor) = {0x10, 0x10}
|
||||
# . var ad/eax : allocation-descriptor = {0x10, 0x10}
|
||||
68/push 0x10/imm32/limit
|
||||
68/push 0x10/imm32/curr
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
|
@ -282,7 +282,7 @@ test-lookup-success:
|
|||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# . save registers
|
||||
# var heap/ebx : (ref allocation-descriptor)
|
||||
# var heap/ebx : allocation-descriptor
|
||||
68/push 0/imm32/limit
|
||||
68/push 0/imm32/curr
|
||||
89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . . # copy esp to ebx
|
||||
|
@ -294,7 +294,7 @@ test-lookup-success:
|
|||
e8/call new-segment/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# var handle/ecx : (ref handle)
|
||||
# var handle/ecx : handle
|
||||
68/push 0/imm32/address
|
||||
68/push 0/imm32/alloc-id
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -350,7 +350,7 @@ test-lookup-failure:
|
|||
# . prologue
|
||||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# var heap/esi : (ref allocation-descriptor)
|
||||
# var heap/esi : allocation-descriptor
|
||||
68/push 0/imm32/limit
|
||||
68/push 0/imm32/curr
|
||||
89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . . # copy esp to esi
|
||||
|
@ -362,7 +362,7 @@ test-lookup-failure:
|
|||
e8/call new-segment/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# var h1/ecx : (ref handle)
|
||||
# var h1/ecx : handle
|
||||
68/push 0/imm32/address
|
||||
68/push 0/imm32/alloc-id
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
|
@ -381,7 +381,7 @@ test-lookup-failure:
|
|||
# reset heap->curr to mimic reclamation
|
||||
89/copy 0/mod/indirect 6/rm32/esi . . . 3/r32/ebx . . # copy ebx to *esi
|
||||
# second allocation that returns the same address as the first
|
||||
# var h2/edx : (ref handle)
|
||||
# var h2/edx : handle
|
||||
68/push 0/imm32/address
|
||||
68/push 0/imm32/alloc-id
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
|
|
|
@ -54,7 +54,7 @@ Entry: # run tests if necessary, convert stdin if not
|
|||
eb/jump $subx-hex-main:end/disp8
|
||||
$subx-hex-main:interactive:
|
||||
# - otherwise convert stdin
|
||||
# var ed/eax : (ref exit-descriptor)
|
||||
# var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# configure ed to really exit()
|
||||
|
@ -247,7 +247,7 @@ test-convert-next-octet:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'convert-next-octet' below
|
||||
# . var ed/ecx : (ref exit-descriptor)
|
||||
# . var ed/ecx : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . tailor-exit-descriptor(ed, 12)
|
||||
|
@ -337,7 +337,7 @@ test-convert-next-octet-handles-Eof:
|
|||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# don't initialize '_test-stream'
|
||||
# initialize exit-descriptor 'ed' for the call to 'convert-next-octet' below
|
||||
# . var ed/ecx : (ref exit-descriptor)
|
||||
# . var ed/ecx : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . tailor-exit-descriptor(ed, 12)
|
||||
|
@ -435,7 +435,7 @@ test-convert-next-octet-aborts-on-single-hex-byte:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'convert-next-octet' below
|
||||
# . var ed/ecx : (ref exit-descriptor)
|
||||
# . var ed/ecx : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . tailor-exit-descriptor(ed, 12)
|
||||
|
@ -604,7 +604,7 @@ test-scan-next-byte:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below
|
||||
# . var ed/ecx : (ref exit-descriptor)
|
||||
# . var ed/ecx : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . tailor-exit-descriptor(ed, 12)
|
||||
|
@ -702,7 +702,7 @@ test-scan-next-byte-skips-whitespace:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below
|
||||
# . var ed/ecx : (ref exit-descriptor)
|
||||
# . var ed/ecx : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . tailor-exit-descriptor(ed, 12)
|
||||
|
@ -808,7 +808,7 @@ test-scan-next-byte-skips-comment:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below
|
||||
# . var ed/ecx : (ref exit-descriptor)
|
||||
# . var ed/ecx : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . tailor-exit-descriptor(ed, 12)
|
||||
|
@ -914,7 +914,7 @@ test-scan-next-byte-skips-comment-and-whitespace:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below
|
||||
# . var ed/ecx : (ref exit-descriptor)
|
||||
# . var ed/ecx : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . tailor-exit-descriptor(ed, 12)
|
||||
|
@ -1022,7 +1022,7 @@ test-scan-next-byte-skips-whitespace-and-comment:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below
|
||||
# . var ed/ecx : (ref exit-descriptor)
|
||||
# . var ed/ecx : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . tailor-exit-descriptor(ed, 12)
|
||||
|
@ -1120,7 +1120,7 @@ test-scan-next-byte-reads-final-byte:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below
|
||||
# . var ed/ecx : (ref exit-descriptor)
|
||||
# . var ed/ecx : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . tailor-exit-descriptor(ed, 12)
|
||||
|
@ -1210,7 +1210,7 @@ test-scan-next-byte-handles-Eof:
|
|||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# leave '_test-stream' empty
|
||||
# initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below
|
||||
# . var ed/ecx : (ref exit-descriptor)
|
||||
# . var ed/ecx : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . tailor-exit-descriptor(ed, 12)
|
||||
|
@ -1308,7 +1308,7 @@ test-scan-next-byte-aborts-on-invalid-byte:
|
|||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
# initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below
|
||||
# . var ed/ecx : (ref exit-descriptor)
|
||||
# . var ed/ecx : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . tailor-exit-descriptor(ed, 12)
|
||||
|
|
224
apps/mu.subx
224
apps/mu.subx
|
@ -64,8 +64,8 @@
|
|||
# }
|
||||
#
|
||||
# - variable definitions on the stack. E.g.:
|
||||
# - var foo: (ref int)
|
||||
# - var bar: (ref array int 3)
|
||||
# - var foo: int
|
||||
# - var bar: (array int 3)
|
||||
# There's no initializer; variables are automatically initialized.
|
||||
# The type of a local variable is either word-length (4 bytes) or starts with 'ref'.
|
||||
#
|
||||
|
@ -246,7 +246,7 @@
|
|||
|
||||
== data
|
||||
|
||||
Program: # (ref (handle function))
|
||||
Program: # (handle function)
|
||||
0/imm32
|
||||
|
||||
Function-name:
|
||||
|
@ -971,8 +971,8 @@ test-convert-function-call-with-literal-arg:
|
|||
parse-mu: # in : (addr buffered-file)
|
||||
# pseudocode
|
||||
# var curr-function : (addr (handle function)) = Program
|
||||
# var line : (ref stream byte 512)
|
||||
# var word-slice : (ref slice)
|
||||
# var line : (stream byte 512)
|
||||
# var word-slice : slice
|
||||
# while true # line loop
|
||||
# clear-stream(line)
|
||||
# read-line-buffered(in, line)
|
||||
|
@ -984,7 +984,7 @@ parse-mu: # in : (addr buffered-file)
|
|||
# continue # end of line
|
||||
# else if slice-equal(word-slice, "fn")
|
||||
# var new-function : (handle function) = allocate(function)
|
||||
# var vars : (ref stack (addr var) 256)
|
||||
# var vars : (stack (addr var) 256)
|
||||
# populate-mu-function-header(in, new-function, vars)
|
||||
# populate-mu-function-body(in, new-function, vars)
|
||||
# assert(vars->top == 0)
|
||||
|
@ -1002,19 +1002,19 @@ parse-mu: # in : (addr buffered-file)
|
|||
52/push-edx
|
||||
53/push-ebx
|
||||
57/push-edi
|
||||
# var line/ecx : (ref stream byte 512)
|
||||
# var line/ecx : (stream byte 512)
|
||||
81 5/subop/subtract %esp 0x200/imm32
|
||||
68/push 0x200/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var word-slice/edx : (ref slice)
|
||||
# var word-slice/edx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %edx 4/r32/esp
|
||||
# var curr-function/edi : (addr (handle function)) = Program
|
||||
bf/copy-to-edi Program/imm32
|
||||
# var vars/ebx : (ref stack (addr var) 256)
|
||||
# var vars/ebx : (stack (addr var) 256)
|
||||
81 5/subop/subtract %esp 0x400/imm32
|
||||
68/push 0x400/imm32/length
|
||||
68/push 0/imm32/top
|
||||
|
@ -1118,7 +1118,7 @@ $parse-mu:error2:
|
|||
# ✓ fn foo x: int -> y/eax: int {
|
||||
populate-mu-function-header: # first-line : (addr stream byte), out : (handle function), vars : (addr stack (handle var))
|
||||
# pseudocode:
|
||||
# var name : (ref slice)
|
||||
# var name : slice
|
||||
# next-word(first-line, name)
|
||||
# assert(name not in '{' '}' '->')
|
||||
# out->name = slice-to-string(name)
|
||||
|
@ -1157,7 +1157,7 @@ populate-mu-function-header: # first-line : (addr stream byte), out : (handle f
|
|||
57/push-edi
|
||||
# edi = out
|
||||
8b/-> *(ebp+0xc) 7/r32/edi
|
||||
# var word-slice/ecx : (ref slice)
|
||||
# var word-slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1309,11 +1309,11 @@ test-function-header-with-arg:
|
|||
# setup
|
||||
(clear-stream _test-input-stream)
|
||||
(write _test-input-stream "foo n : int {\n")
|
||||
# result/ecx : (ref function)
|
||||
# result/ecx : function
|
||||
2b/subtract-> *Function-size 4/r32/esp
|
||||
89/<- %ecx 4/r32/esp
|
||||
(zero-out %ecx *Function-size)
|
||||
# var vars/ebx : (ref stack (addr var) 16)
|
||||
# var vars/ebx : (stack (addr var) 16)
|
||||
81 5/subop/subtract %esp 0x10/imm32
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/top
|
||||
|
@ -1345,7 +1345,7 @@ test-function-header-with-multiple-args:
|
|||
2b/subtract-> *Function-size 4/r32/esp
|
||||
89/<- %ecx 4/r32/esp
|
||||
(zero-out %ecx *Function-size)
|
||||
# var vars/ebx : (ref stack (addr var) 16)
|
||||
# var vars/ebx : (stack (addr var) 16)
|
||||
81 5/subop/subtract %esp 0x10/imm32
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/top
|
||||
|
@ -1392,7 +1392,7 @@ test-function-with-multiple-args-and-outputs:
|
|||
2b/subtract-> *Function-size 4/r32/esp
|
||||
89/<- %ecx 4/r32/esp
|
||||
(zero-out %ecx *Function-size)
|
||||
# var vars/ebx : (ref stack (addr var) 16)
|
||||
# var vars/ebx : (stack (addr var) 16)
|
||||
81 5/subop/subtract %esp 0x10/imm32
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/top
|
||||
|
@ -1446,7 +1446,7 @@ test-function-with-multiple-args-and-outputs:
|
|||
parse-var-with-type: # name: (addr slice), first-line: (addr stream byte) -> result/eax: (handle var)
|
||||
# pseudocode:
|
||||
# var v : (handle var) = allocate(Heap, Var-size)
|
||||
# var s : (ref slice)
|
||||
# var s : slice
|
||||
# next-token-from-slice(name->start, name->end, '/', s)
|
||||
# var end : (addr byte) = s->end
|
||||
# if (slice-ends-with(s, ":"))
|
||||
|
@ -1488,7 +1488,7 @@ parse-var-with-type: # name: (addr slice), first-line: (addr stream byte) -> re
|
|||
89/<- %edi 0/r32/eax
|
||||
# esi = name
|
||||
8b/-> *(ebp+8) 6/r32/esi
|
||||
# var s/ecx : (ref slice)
|
||||
# var s/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1757,7 +1757,7 @@ test-parse-var-with-type:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1784,7 +1784,7 @@ test-parse-var-with-type-and-register:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1813,7 +1813,7 @@ test-parse-var-with-trailing-characters:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1842,7 +1842,7 @@ test-parse-var-with-register-and-trailing-characters:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1913,7 +1913,7 @@ test-is-identifier-dollar:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1934,7 +1934,7 @@ test-is-identifier-underscore:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1955,7 +1955,7 @@ test-is-identifier-a:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1976,7 +1976,7 @@ test-is-identifier-z:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -1997,7 +1997,7 @@ test-is-identifier-A:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -2018,7 +2018,7 @@ test-is-identifier-Z:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -2040,7 +2040,7 @@ test-is-identifier-@:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -2062,7 +2062,7 @@ test-is-identifier-square-bracket:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -2084,7 +2084,7 @@ test-is-identifier-backtick:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -2106,7 +2106,7 @@ test-is-identifier-curly-brace-open:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -2127,7 +2127,7 @@ test-is-identifier-curly-brace-close:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -2149,7 +2149,7 @@ test-is-identifier-hyphen:
|
|||
8b/-> *eax 1/r32/ecx
|
||||
8d/copy-address *(eax+ecx+4) 1/r32/ecx
|
||||
05/add-to-eax 4/imm32
|
||||
# var slice/ecx : (ref slice) = {eax, ecx}
|
||||
# var slice/ecx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -2190,8 +2190,8 @@ $populate-mu-function-body:end:
|
|||
# parses a block, assuming that the leading '{' has already been read by the caller
|
||||
parse-mu-block: # in : (addr buffered-file), vars : (addr stack (handle var)), fn : (handle function) -> result/eax : (handle block)
|
||||
# pseudocode:
|
||||
# var line : (ref stream byte 512)
|
||||
# var word-slice : (ref slice)
|
||||
# var line : (stream byte 512)
|
||||
# var word-slice : slice
|
||||
# result/eax = allocate(Heap, Stmt-size)
|
||||
# result->tag = 0/Block
|
||||
# while true # line loop
|
||||
|
@ -2228,13 +2228,13 @@ parse-mu-block: # in : (addr buffered-file), vars : (addr stack (handle var)),
|
|||
52/push-edx
|
||||
53/push-ebx
|
||||
57/push-edi
|
||||
# var line/ecx : (ref stream byte 512)
|
||||
# var line/ecx : (stream byte 512)
|
||||
81 5/subop/subtract %esp 0x200/imm32
|
||||
68/push 0x200/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var word-slice/edx : (ref slice)
|
||||
# var word-slice/edx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %edx 4/r32/esp
|
||||
|
@ -2356,7 +2356,7 @@ check-no-tokens-left: # line : (addr stream byte)
|
|||
# . save registers
|
||||
50/push-eax
|
||||
51/push-ecx
|
||||
# var s/ecx : (ref slice)
|
||||
# var s/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -2398,8 +2398,8 @@ $check-no-tokens-left:end:
|
|||
|
||||
parse-mu-named-block: # name : (addr slice), first-line : (addr stream byte), in : (addr buffered-file), vars : (addr stack (handle var)) -> result/eax : (handle stmt)
|
||||
# pseudocode:
|
||||
# var line : (ref stream byte 512)
|
||||
# var word-slice : (ref slice)
|
||||
# var line : (stream byte 512)
|
||||
# var word-slice : slice
|
||||
# result/eax = allocate(Heap, Stmt-size)
|
||||
# result->tag = 4/Named-block
|
||||
# result->name = name
|
||||
|
@ -2457,7 +2457,7 @@ $parse-mu-var-def:end:
|
|||
|
||||
parse-mu-stmt: # line : (addr stream byte), vars : (addr stack (handle var)), fn : (handle function) -> result/eax : (handle stmt)
|
||||
# pseudocode:
|
||||
# var name : (ref slice)
|
||||
# var name : slice
|
||||
# result = allocate(Heap, Stmt-size)
|
||||
# if stmt-has-outputs?(line)
|
||||
# while true
|
||||
|
@ -2478,7 +2478,7 @@ parse-mu-stmt: # line : (addr stream byte), vars : (addr stack (handle var)), f
|
|||
# . save registers
|
||||
51/push-ecx
|
||||
57/push-edi
|
||||
# var name/ecx : (ref slice)
|
||||
# var name/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -2581,7 +2581,7 @@ stmt-has-outputs?: # line : (addr stream byte) -> result/eax : boolean
|
|||
89/<- %ebp 4/r32/esp
|
||||
# . save registers
|
||||
51/push-ecx
|
||||
# var word-slice/ecx : (ref slice)
|
||||
# var word-slice/ecx : slice
|
||||
68/push 0/imm32/end
|
||||
68/push 0/imm32/start
|
||||
89/<- %ecx 4/r32/esp
|
||||
|
@ -2840,13 +2840,13 @@ test-parse-mu-stmt:
|
|||
# setup
|
||||
(clear-stream _test-input-stream)
|
||||
(write _test-input-stream "increment n\n")
|
||||
# var vars/ecx : (ref stack (addr var) 4)
|
||||
# var vars/ecx : (stack (addr var) 4)
|
||||
81 5/subop/subtract %esp 0x10/imm32
|
||||
68/push 0x10/imm32/length
|
||||
68/push 0/imm32/top
|
||||
89/<- %ecx 4/r32/esp
|
||||
(clear-stack %ecx)
|
||||
# var v/edx : (ref var)
|
||||
# var v/edx : var
|
||||
81 5/subop/subtract %esp 0x14/imm32 # Var-size
|
||||
89/<- %edx 4/r32/esp
|
||||
(zero-out %edx 0x14)
|
||||
|
@ -4608,25 +4608,25 @@ test-emit-subx-statement-primitive:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-foo/ecx : (ref var)
|
||||
# var var-foo/ecx : var
|
||||
68/push 0/imm32/no-register
|
||||
68/push -8/imm32/stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "foo"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var operand/ebx : (ref list var)
|
||||
# var operand/ebx : (list var)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-foo
|
||||
89/<- %ebx 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/outputs
|
||||
53/push-ebx/operands
|
||||
68/push "increment"/imm32/operation
|
||||
68/push 1/imm32
|
||||
89/<- %esi 4/r32/esp
|
||||
# var primitives/ebx : (ref primitive)
|
||||
# var primitives/ebx : primitive
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/output-is-write-only
|
||||
68/push 0/imm32/no-imm32
|
||||
|
@ -4677,36 +4677,36 @@ test-emit-subx-statement-primitive-register:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-foo/ecx : (ref var) in eax
|
||||
# var var-foo/ecx : var in eax
|
||||
68/push "eax"/imm32/register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "foo"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var operand/ebx : (ref list var)
|
||||
# var operand/ebx : (list var)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-foo
|
||||
89/<- %ebx 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
53/push-ebx/outputs
|
||||
68/push 0/imm32/inouts
|
||||
68/push "increment"/imm32/operation
|
||||
68/push 1/imm32
|
||||
89/<- %esi 4/r32/esp
|
||||
# var formal-var/ebx : (ref var) in any register
|
||||
# var formal-var/ebx : var in any register
|
||||
68/push Any-register/imm32
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "dummy"/imm32
|
||||
89/<- %ebx 4/r32/esp
|
||||
# var operand/ebx : (ref list var)
|
||||
# var operand/ebx : (list var)
|
||||
68/push 0/imm32/next
|
||||
53/push-ebx/formal-var
|
||||
89/<- %ebx 4/r32/esp
|
||||
# var primitives/ebx : (ref primitive)
|
||||
# var primitives/ebx : primitive
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/output-is-write-only
|
||||
68/push 0/imm32/no-imm32
|
||||
|
@ -4760,36 +4760,36 @@ test-emit-subx-statement-select-primitive:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-foo/ecx : (ref var) in eax
|
||||
# var var-foo/ecx : var in eax
|
||||
68/push "eax"/imm32/register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "foo"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var real-outputs/edi : (ref list var)
|
||||
# var real-outputs/edi : (list var)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-foo
|
||||
89/<- %edi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
57/push-edi/outputs
|
||||
68/push 0/imm32/inouts
|
||||
68/push "increment"/imm32/operation
|
||||
68/push 1/imm32
|
||||
89/<- %esi 4/r32/esp
|
||||
# var formal-var/ebx : (ref var) in any register
|
||||
# var formal-var/ebx : var in any register
|
||||
68/push Any-register/imm32
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "dummy"/imm32
|
||||
89/<- %ebx 4/r32/esp
|
||||
# var formal-outputs/ebx : (ref list var) = {formal-var, 0}
|
||||
# var formal-outputs/ebx : (list var) = {formal-var, 0}
|
||||
68/push 0/imm32/next
|
||||
53/push-ebx/formal-var
|
||||
89/<- %ebx 4/r32/esp
|
||||
# var primitive1/ebx : (ref primitive)
|
||||
# var primitive1/ebx : primitive
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/output-is-write-only
|
||||
68/push 0/imm32/no-imm32
|
||||
|
@ -4800,7 +4800,7 @@ test-emit-subx-statement-select-primitive:
|
|||
68/push 0/imm32/inouts
|
||||
68/push "increment"/imm32/name
|
||||
89/<- %ebx 4/r32/esp
|
||||
# var primitives/ebx : (ref primitive)
|
||||
# var primitives/ebx : primitive
|
||||
53/push-ebx/next
|
||||
68/push 0/imm32/output-is-write-only
|
||||
68/push 0/imm32/no-imm32
|
||||
|
@ -4854,32 +4854,32 @@ test-emit-subx-statement-select-primitive-2:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-foo/ecx : (ref var) in eax
|
||||
# var var-foo/ecx : var in eax
|
||||
68/push "eax"/imm32/register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "foo"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var inouts/edi : (ref list var)
|
||||
# var inouts/edi : (list var)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-foo
|
||||
89/<- %edi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/outputs
|
||||
57/push-edi/inouts
|
||||
68/push "increment"/imm32/operation
|
||||
68/push 1/imm32
|
||||
89/<- %esi 4/r32/esp
|
||||
# var formal-var/ebx : (ref var) in any register
|
||||
# var formal-var/ebx : var in any register
|
||||
68/push Any-register/imm32
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "dummy"/imm32
|
||||
89/<- %ebx 4/r32/esp
|
||||
# var operand/ebx : (ref list var)
|
||||
# var operand/ebx : (list var)
|
||||
68/push 0/imm32/next
|
||||
53/push-ebx/formal-var
|
||||
89/<- %ebx 4/r32/esp
|
||||
|
@ -4894,7 +4894,7 @@ test-emit-subx-statement-select-primitive-2:
|
|||
68/push 0/imm32/inouts
|
||||
68/push "increment"/imm32/name
|
||||
89/<- %ebx 4/r32/esp
|
||||
# var primitives/ebx : (ref primitive)
|
||||
# var primitives/ebx : primitive
|
||||
53/push-ebx/next
|
||||
68/push 0/imm32/output-is-write-only
|
||||
68/push 0/imm32/no-imm32
|
||||
|
@ -4942,18 +4942,18 @@ test-increment-register:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-foo/ecx : (ref var) in eax
|
||||
# var var-foo/ecx : var in eax
|
||||
68/push "eax"/imm32/register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "foo"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var real-outputs/edi : (ref list var)
|
||||
# var real-outputs/edi : (list var)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-foo
|
||||
89/<- %edi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
57/push-edi/outputs
|
||||
68/push 0/imm32/inouts
|
||||
|
@ -4997,18 +4997,18 @@ test-increment-var:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-foo/ecx : (ref var) in eax
|
||||
# var var-foo/ecx : var in eax
|
||||
68/push "eax"/imm32/register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "foo"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var inouts/edi : (ref list var)
|
||||
# var inouts/edi : (list var)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-foo
|
||||
89/<- %edi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/outputs
|
||||
57/push-edi/inouts
|
||||
|
@ -5042,29 +5042,29 @@ test-add-reg-to-reg:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-var1/ecx : (ref var) in eax
|
||||
# var var-var1/ecx : var in eax
|
||||
68/push "eax"/imm32/register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "var1"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var var-var2/edx : (ref var) in ecx
|
||||
# var var-var2/edx : var in ecx
|
||||
68/push "ecx"/imm32/register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "var2"/imm32
|
||||
89/<- %edx 4/r32/esp
|
||||
# var inouts/esi : (ref list var2)
|
||||
# var inouts/esi : (list var2)
|
||||
68/push 0/imm32/next
|
||||
52/push-edx/var-var2
|
||||
89/<- %esi 4/r32/esp
|
||||
# var outputs/edi : (ref list var1)
|
||||
# var outputs/edi : (list var1)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-var1
|
||||
89/<- %edi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
57/push-edi/outputs
|
||||
56/push-esi/inouts
|
||||
|
@ -5098,29 +5098,29 @@ test-add-reg-to-mem:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-var1/ecx : (ref var)
|
||||
# var var-var1/ecx : var
|
||||
68/push 0/imm32/no-register
|
||||
68/push 8/imm32/stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "var1"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var var-var2/edx : (ref var) in ecx
|
||||
# var var-var2/edx : var in ecx
|
||||
68/push "ecx"/imm32/register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "var2"/imm32
|
||||
89/<- %edx 4/r32/esp
|
||||
# var inouts/esi : (ref list var2)
|
||||
# var inouts/esi : (list var2)
|
||||
68/push 0/imm32/next
|
||||
52/push-edx/var-var2
|
||||
89/<- %esi 4/r32/esp
|
||||
# var inouts = (ref list var1 var2)
|
||||
# var inouts = (list var1 var2)
|
||||
56/push-esi/next
|
||||
51/push-ecx/var-var1
|
||||
89/<- %esi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/outputs
|
||||
56/push-esi/inouts
|
||||
|
@ -5154,29 +5154,29 @@ test-add-mem-to-reg:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-var1/ecx : (ref var) in eax
|
||||
# var var-var1/ecx : var in eax
|
||||
68/push "eax"/imm32/register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "var1"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var var-var2/edx : (ref var)
|
||||
# var var-var2/edx : var
|
||||
68/push 0/imm32/no-register
|
||||
68/push 8/imm32/stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "var2"/imm32
|
||||
89/<- %edx 4/r32/esp
|
||||
# var inouts/esi : (ref list var2)
|
||||
# var inouts/esi : (list var2)
|
||||
68/push 0/imm32/next
|
||||
52/push-edx/var-var2
|
||||
89/<- %esi 4/r32/esp
|
||||
# var outputs/edi : (ref list var1)
|
||||
# var outputs/edi : (list var1)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-var1
|
||||
89/<- %edi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
57/push-edi/outputs
|
||||
56/push-esi/inouts
|
||||
|
@ -5210,29 +5210,29 @@ test-add-literal-to-eax:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-var1/ecx : (ref var) in eax
|
||||
# var var-var1/ecx : var in eax
|
||||
68/push "eax"/imm32/register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "var1"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var var-var2/edx : (ref var) literal
|
||||
# var var-var2/edx : var literal
|
||||
68/push 0/imm32/no-register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 0/imm32/type-literal
|
||||
68/push "0x34"/imm32
|
||||
89/<- %edx 4/r32/esp
|
||||
# var inouts/esi : (ref list var2)
|
||||
# var inouts/esi : (list var2)
|
||||
68/push 0/imm32/next
|
||||
52/push-edx/var-var2
|
||||
89/<- %esi 4/r32/esp
|
||||
# var outputs/edi : (ref list var1)
|
||||
# var outputs/edi : (list var1)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-var1
|
||||
89/<- %edi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
57/push-edi/outputs
|
||||
56/push-esi/inouts
|
||||
|
@ -5266,29 +5266,29 @@ test-add-literal-to-reg:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-var1/ecx : (ref var) in ecx
|
||||
# var var-var1/ecx : var in ecx
|
||||
68/push "ecx"/imm32/register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "var1"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var var-var2/edx : (ref var) literal
|
||||
# var var-var2/edx : var literal
|
||||
68/push 0/imm32/no-register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 0/imm32/type-literal
|
||||
68/push "0x34"/imm32
|
||||
89/<- %edx 4/r32/esp
|
||||
# var inouts/esi : (ref list var2)
|
||||
# var inouts/esi : (list var2)
|
||||
68/push 0/imm32/next
|
||||
52/push-edx/var-var2
|
||||
89/<- %esi 4/r32/esp
|
||||
# var outputs/edi : (ref list var1)
|
||||
# var outputs/edi : (list var1)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-var1
|
||||
89/<- %edi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
57/push-edi/outputs
|
||||
56/push-esi/inouts
|
||||
|
@ -5322,29 +5322,29 @@ test-add-literal-to-mem:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-var1/ecx : (ref var)
|
||||
# var var-var1/ecx : var
|
||||
68/push 0/imm32/no-register
|
||||
68/push 8/imm32/stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "var1"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var var-var2/edx : (ref var) literal
|
||||
# var var-var2/edx : var literal
|
||||
68/push 0/imm32/no-register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 1/imm32/block-depth
|
||||
68/push 0/imm32/type-literal
|
||||
68/push "0x34"/imm32
|
||||
89/<- %edx 4/r32/esp
|
||||
# var inouts/esi : (ref list var2)
|
||||
# var inouts/esi : (list var2)
|
||||
68/push 0/imm32/next
|
||||
52/push-edx/var-var2
|
||||
89/<- %esi 4/r32/esp
|
||||
# var inouts = (ref list var1 inouts)
|
||||
# var inouts = (list var1 inouts)
|
||||
56/push-esi/next
|
||||
51/push-ecx/var-var1
|
||||
89/<- %esi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/outputs
|
||||
56/push-esi/inouts
|
||||
|
@ -5393,25 +5393,25 @@ test-emit-subx-statement-function-call:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-foo/ecx : (ref var)
|
||||
# var var-foo/ecx : var
|
||||
68/push 0/imm32/no-register
|
||||
68/push -8/imm32/stack-offset
|
||||
68/push 0/imm32/block-depth
|
||||
68/push 1/imm32/type-int
|
||||
68/push "foo"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var operands/esi : (ref list var)
|
||||
# var operands/esi : (list var)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-foo
|
||||
89/<- %esi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/outputs
|
||||
56/push-esi/inouts
|
||||
68/push "f"/imm32/operation
|
||||
68/push 1/imm32
|
||||
89/<- %esi 4/r32/esp
|
||||
# var functions/ebx : (ref function)
|
||||
# var functions/ebx : function
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/body
|
||||
68/push 0/imm32/outputs
|
||||
|
@ -5447,25 +5447,25 @@ test-emit-subx-statement-function-call-with-literal-arg:
|
|||
# setup
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
# var var-foo/ecx : (ref var) literal
|
||||
# var var-foo/ecx : var literal
|
||||
68/push 0/imm32/no-register
|
||||
68/push 0/imm32/no-stack-offset
|
||||
68/push 0/imm32/block-depth
|
||||
68/push 0/imm32/type-literal
|
||||
68/push "34"/imm32
|
||||
89/<- %ecx 4/r32/esp
|
||||
# var operands/esi : (ref list var)
|
||||
# var operands/esi : (list var)
|
||||
68/push 0/imm32/next
|
||||
51/push-ecx/var-foo
|
||||
89/<- %esi 4/r32/esp
|
||||
# var stmt/esi : (ref statement)
|
||||
# var stmt/esi : statement
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/outputs
|
||||
56/push-esi/inouts
|
||||
68/push "f"/imm32/operation
|
||||
68/push 1/imm32
|
||||
89/<- %esi 4/r32/esp
|
||||
# var functions/ebx : (ref function)
|
||||
# var functions/ebx : function
|
||||
68/push 0/imm32/next
|
||||
68/push 0/imm32/body
|
||||
68/push 0/imm32/outputs
|
||||
|
|
|
@ -110,7 +110,7 @@ lisp-read: # in : (addr buffered-file) -> eax : (handle cell)
|
|||
89/<- %ebp 4/r32/esp
|
||||
# . save registers
|
||||
51/push-ecx
|
||||
# var s/ecx : (ref stream byte 512)
|
||||
# var s/ecx : (stream byte 512)
|
||||
81 5/subop/subtract %esp 0x200/imm32
|
||||
68/push 0x200/imm32/size
|
||||
68/push 0/imm32/read
|
||||
|
|
|
@ -55,7 +55,7 @@ Entry: # run tests if necessary, convert stdin if not
|
|||
eb/jump $subx-pack-main:end/disp8
|
||||
$subx-pack-main:interactive:
|
||||
# - otherwise convert stdin
|
||||
# var ed/eax : (ref exit-descriptor)
|
||||
# var ed/eax : exit-descriptor
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp
|
||||
89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax
|
||||
# configure ed to really exit()
|
||||
|
@ -99,7 +99,7 @@ $subx-pack-main:end:
|
|||
|
||||
subx-pack: # in : (addr buffered-file), out : (addr buffered-file)
|
||||
# pseudocode:
|
||||
# var line : (ref stream byte 512)
|
||||
# var line : (stream byte 512)
|
||||
# var in-code? = false
|
||||
# while true
|
||||
# clear-stream(line)
|
||||
|
@ -128,13 +128,13 @@ subx-pack: # in : (addr buffered-file), out : (addr buffered-file)
|
|||
51/push-ecx
|
||||
52/push-edx
|
||||
53/push-ebx
|
||||
# var line/ecx : (ref stream byte 512)
|
||||
# var line/ecx : (stream byte 512)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp
|
||||
68/push 0x200/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var word-slice/edx : (ref slice)
|
||||
# var word-slice/edx : slice
|
||||
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
|
||||
|
@ -911,7 +911,7 @@ test-subx-pack-code-and-data-segments:
|
|||
|
||||
convert-data: # line : (addr stream byte), out : (addr buffered-file)
|
||||
# pseudocode:
|
||||
# var word-slice : (ref slice)
|
||||
# var word-slice : slice
|
||||
# while true
|
||||
# word-slice = next-word(line)
|
||||
# if slice-empty?(word-slice) # end of file (maybe including trailing whitespace)
|
||||
|
@ -936,7 +936,7 @@ convert-data: # line : (addr stream byte), out : (addr buffered-file)
|
|||
50/push-eax
|
||||
51/push-ecx
|
||||
52/push-edx
|
||||
# var word-slice/ecx : (ref slice)
|
||||
# var word-slice/ecx : slice
|
||||
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
|
||||
|
@ -1837,7 +1837,7 @@ convert-instruction: # line : (addr stream byte), out : (addr buffered-file)
|
|||
50/push-eax
|
||||
51/push-ecx
|
||||
52/push-edx
|
||||
# var word-slice/ecx : (ref slice)
|
||||
# var word-slice/ecx : slice
|
||||
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
|
||||
|
@ -1994,11 +1994,11 @@ emit-opcodes: # line : (addr stream byte), out : (addr buffered-file)
|
|||
51/push-ecx
|
||||
52/push-edx
|
||||
53/push-ebx
|
||||
# var op1/ecx : (ref slice)
|
||||
# var op1/ecx : slice
|
||||
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 : (ref slice)
|
||||
# var op2/edx : slice
|
||||
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
|
||||
|
@ -2253,7 +2253,7 @@ emit-modrm: # line : (addr stream byte), out : (addr buffered-file)
|
|||
# pseudocode:
|
||||
# rewind-stream(line)
|
||||
# var has-modrm? = false, mod = 0, rm32 = 0, r32 = 0
|
||||
# var word-slice : (ref slice)
|
||||
# var word-slice : slice
|
||||
# while true
|
||||
# word-slice = next-word(line)
|
||||
# if (slice-empty?(word-slice)) break
|
||||
|
@ -2285,7 +2285,7 @@ emit-modrm: # line : (addr stream byte), out : (addr buffered-file)
|
|||
53/push-ebx
|
||||
56/push-esi
|
||||
57/push-edi
|
||||
# var word-slice/ecx : (ref slice)
|
||||
# var word-slice/ecx : slice
|
||||
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
|
||||
|
@ -2569,7 +2569,7 @@ $emit-modrm:end:
|
|||
emit-sib: # line : (addr stream byte), out : (addr buffered-file)
|
||||
# pseudocode:
|
||||
# var has-sib? = false, base = 0, index = 0, scale = 0
|
||||
# var word-slice : (ref slice)
|
||||
# var word-slice : slice
|
||||
# while true
|
||||
# word-slice = next-word(line)
|
||||
# if (slice-empty?(word-slice)) break
|
||||
|
@ -2601,7 +2601,7 @@ emit-sib: # line : (addr stream byte), out : (addr buffered-file)
|
|||
53/push-ebx
|
||||
56/push-esi
|
||||
57/push-edi
|
||||
# var word-slice/ecx : (ref slice)
|
||||
# var word-slice/ecx : slice
|
||||
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
|
||||
|
@ -2850,7 +2850,7 @@ $emit-sib:end:
|
|||
emit-disp: # line : (addr stream byte), out : (addr buffered-file)
|
||||
# pseudocode:
|
||||
# rewind-stream(line)
|
||||
# var word-slice : (ref slice)
|
||||
# var word-slice : slice
|
||||
# while true
|
||||
# word-slice = next-word(line)
|
||||
# if (slice-empty?(word-slice)) break
|
||||
|
@ -2872,7 +2872,7 @@ emit-disp: # line : (addr stream byte), out : (addr buffered-file)
|
|||
50/push-eax
|
||||
51/push-ecx
|
||||
52/push-edx
|
||||
# var word-slice/ecx : (ref slice)
|
||||
# var word-slice/ecx : slice
|
||||
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
|
||||
|
@ -3069,7 +3069,7 @@ $emit-disp:break:
|
|||
emit-imm: # line : (addr stream byte), out : (addr buffered-file)
|
||||
# pseudocode:
|
||||
# rewind-stream(line)
|
||||
# var word-slice : (ref slice)
|
||||
# var word-slice : slice
|
||||
# while true
|
||||
# word-slice = next-word(line)
|
||||
# if (slice-empty?(word-slice)) break
|
||||
|
@ -3091,7 +3091,7 @@ emit-imm: # line : (addr stream byte), out : (addr buffered-file)
|
|||
50/push-eax
|
||||
51/push-ecx
|
||||
52/push-edx
|
||||
# var word-slice/ecx : (ref slice)
|
||||
# var word-slice/ecx : slice
|
||||
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
|
||||
|
@ -5846,7 +5846,7 @@ parse-datum-of-word: # word : (addr slice) -> value/eax : int
|
|||
56/push-esi
|
||||
# esi = word
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
|
|
@ -147,7 +147,7 @@ subx-sigils: # in : (addr buffered-file), out : (addr buffered-file)
|
|||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var word-slice/edx : (ref slice)
|
||||
# var word-slice/edx : slice
|
||||
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
|
||||
|
@ -1365,7 +1365,7 @@ emit-direct-mode: # out : (addr buffered-file), word-slice : (addr slice)
|
|||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# . save registers
|
||||
50/push-eax
|
||||
# var local-slice/eax : (ref slice) = {word-slice->start, word-slice->end}
|
||||
# var local-slice/eax : slice = {word-slice->start, word-slice->end}
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 . # copy *(ebp+12) to eax
|
||||
ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4)
|
||||
ff 6/subop/push 0/mod/indirect 0/rm32/eax . . . . . . # push *eax
|
||||
|
@ -1834,7 +1834,7 @@ test-next-word-or-expression:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -1907,7 +1907,7 @@ test-next-word-or-expression-returns-whole-comment:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -1980,7 +1980,7 @@ test-next-word-or-expression-returns-empty-slice-on-eof:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -2022,7 +2022,7 @@ test-next-word-or-expression-returns-string-literal:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -2085,7 +2085,7 @@ test-next-word-or-expression-returns-string-with-escapes:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -2148,7 +2148,7 @@ test-next-word-or-expression-returns-whole-expression:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var slice/ecx : (ref slice)
|
||||
# var slice/ecx : slice
|
||||
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
|
||||
|
@ -2250,7 +2250,7 @@ parse-effective-address: # word-slice : (addr slice) -> base/eax, index/ecx, sc
|
|||
# . save registers
|
||||
56/push-esi
|
||||
57/push-edi
|
||||
# var local-slice/esi : (ref slice) = {word-slice->start, word-slice->end}
|
||||
# var local-slice/esi : slice = {word-slice->start, word-slice->end}
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
|
||||
ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 . # push *(esi+4)
|
||||
ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . . # push *esi
|
||||
|
@ -2679,7 +2679,7 @@ next-register: # in : (addr slice) -> reg/eax : int
|
|||
56/push-esi
|
||||
# esi = in
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
|
||||
# var reg-slice/ecx : (ref slice) = {in->start, in->start + 3}
|
||||
# var reg-slice/ecx : slice = {in->start, in->start + 3}
|
||||
8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax
|
||||
05/add-to-eax 3/imm32
|
||||
50/push-eax
|
||||
|
@ -3865,7 +3865,7 @@ disp32-mode?: # in : (addr slice) -> reg/eax : boolean
|
|||
# . save registers
|
||||
56/push-esi
|
||||
57/push-edi
|
||||
# var local-slice/esi : (ref slice) = {in->start, in->end}
|
||||
# var local-slice/esi : slice = {in->start, in->end}
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
|
||||
ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 . # push *(esi+4)
|
||||
ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . . # push *esi
|
||||
|
@ -3923,7 +3923,7 @@ emit-indirect-disp32: # out : (addr buffered-file), word-slice : (addr slice)
|
|||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# . save registers
|
||||
56/push-esi
|
||||
# var local-slice/esi : (ref slice) = {in->start, in->end}
|
||||
# var local-slice/esi : slice = {in->start, in->end}
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi
|
||||
ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 . # push *(esi+4)
|
||||
ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . . # push *esi
|
||||
|
|
|
@ -115,7 +115,7 @@ $subx-survey-main:end:
|
|||
|
||||
subx-survey: # infile : (addr buffered-file), out : (addr buffered-file)
|
||||
# pseudocode
|
||||
# var in : (ref stream byte 4096)
|
||||
# var in : (stream byte 4096)
|
||||
# slurp(infile, in)
|
||||
# var segments : (stream segment-info)
|
||||
# var labels : (stream label-info Max-labels)
|
||||
|
@ -131,13 +131,13 @@ subx-survey: # infile : (addr buffered-file), out : (addr buffered-file)
|
|||
51/push-ecx
|
||||
52/push-edx
|
||||
56/push-esi
|
||||
# var segments/ecx : (ref stream {string, segment-info} 160) # 10 rows * 16 bytes/row
|
||||
# var segments/ecx : (stream {string, segment-info} 160) # 10 rows * 16 bytes/row
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp
|
||||
68/push 0xa0/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var labels/edx : (ref stream label-info Max-labels*16)
|
||||
# var labels/edx : (stream label-info Max-labels*16)
|
||||
# . data
|
||||
2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Max-labels/disp32 # subtract *Max-labels from esp
|
||||
# . length
|
||||
|
@ -147,7 +147,7 @@ subx-survey: # infile : (addr buffered-file), out : (addr buffered-file)
|
|||
# . write
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
# var in/esi : (ref stream byte Input-size)
|
||||
# var in/esi : (stream byte Input-size)
|
||||
# . data
|
||||
2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Input-size/disp32 # subtract *Input-size from esp
|
||||
# . length
|
||||
|
@ -1219,13 +1219,13 @@ test-compute-offsets:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# var segments/ecx : (ref stream byte 2*16)
|
||||
# var segments/ecx : (stream byte 2*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32 # subtract from esp
|
||||
68/push 0x20/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var labels/edx : (ref stream byte 2*16)
|
||||
# var labels/edx : (stream byte 2*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32 # subtract from esp
|
||||
68/push 0x20/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -1621,13 +1621,13 @@ test-compute-addresses:
|
|||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# setup
|
||||
# . var segments/ecx : (ref stream byte 10*16)
|
||||
# . var segments/ecx : (stream byte 10*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp
|
||||
68/push 0xa0/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . var labels/edx : (ref stream byte 512*16)
|
||||
# . var labels/edx : (stream byte 512*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp
|
||||
68/push 0x2000/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -1790,13 +1790,13 @@ test-compute-addresses-large-segments:
|
|||
55/push-ebp
|
||||
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
|
||||
# setup
|
||||
# . var segments/ecx : (ref stream byte 10*16)
|
||||
# . var segments/ecx : (stream byte 10*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp
|
||||
68/push 0xa0/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . var labels/edx : (ref stream byte 512*16)
|
||||
# . var labels/edx : (stream byte 512*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp
|
||||
68/push 0x2000/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -1993,11 +1993,11 @@ emit-segments: # in : (addr stream byte), out : (addr buffered-file), segments
|
|||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var word-slice/edx : (ref slice)
|
||||
# var word-slice/edx : slice
|
||||
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 : (ref slice)
|
||||
# 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
|
||||
|
@ -2577,13 +2577,13 @@ test-emit-segments-global-variable:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# . var segments/ecx : (ref stream byte 10*16)
|
||||
# . var segments/ecx : (stream byte 10*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp
|
||||
68/push 0xa0/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . var labels/edx : (ref stream byte 512*16)
|
||||
# . var labels/edx : (stream byte 512*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp
|
||||
68/push 0x2000/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -2814,13 +2814,13 @@ test-emit-segments-code-label:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# . var segments/ecx : (ref stream byte 10*16)
|
||||
# . var segments/ecx : (stream byte 10*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp
|
||||
68/push 0xa0/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . var labels/edx : (ref stream byte 512*16)
|
||||
# . var labels/edx : (stream byte 512*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp
|
||||
68/push 0x2000/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -3016,13 +3016,13 @@ test-emit-segments-code-label-absolute:
|
|||
e8/call clear-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp
|
||||
# . var segments/ecx : (ref stream byte 10*16)
|
||||
# . var segments/ecx : (stream byte 10*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp
|
||||
68/push 0xa0/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# . var labels/edx : (ref stream byte 512*16)
|
||||
# . var labels/edx : (stream byte 512*16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp
|
||||
68/push 0x2000/imm32/length
|
||||
68/push 0/imm32/read
|
||||
|
@ -3830,7 +3830,7 @@ test-trace-slsls:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 b/ebx : (ref slice) = {eax, ecx}
|
||||
# var b/ebx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . . # copy esp to ebx
|
||||
|
@ -3839,7 +3839,7 @@ test-trace-slsls:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 d/edx : (ref slice) = {eax, ecx}
|
||||
# var d/edx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx
|
||||
|
@ -3955,7 +3955,7 @@ test-trace-slsns:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 b/ebx : (ref slice) = {eax, ecx}
|
||||
# var b/ebx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . . # copy esp to ebx
|
||||
|
@ -4071,7 +4071,7 @@ test-trace-slsss:
|
|||
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
|
||||
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 b/ebx : (ref slice) = {eax, ecx}
|
||||
# var b/ebx : slice = {eax, ecx}
|
||||
51/push-ecx
|
||||
50/push-eax
|
||||
89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . . # copy esp to ebx
|
||||
|
@ -4150,7 +4150,7 @@ num-bytes: # line : (addr stream byte) -> eax : int
|
|||
53/push-ebx
|
||||
# var result/eax = 0
|
||||
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
|
||||
# var word-slice/ecx : (ref slice)
|
||||
# var word-slice/ecx : slice
|
||||
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
|
||||
|
|
|
@ -101,13 +101,13 @@ subx-gen-run-tests: # in : (addr buffered-file), out : (addr buffered-file)
|
|||
52/push-edx
|
||||
53/push-ebx
|
||||
57/push-edi
|
||||
# var line/ecx : (ref stream byte 512)
|
||||
# var line/ecx : (stream byte 512)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp
|
||||
68/push 0x200/imm32/length
|
||||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
|
||||
# var word-slice/edx : (ref slice)
|
||||
# var word-slice/edx : slice
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue