diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-04-03 12:35:53 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-04-03 12:35:53 -0700 |
commit | bfcc0f858aa324739ad645e2056d73a47ab66f82 (patch) | |
tree | 24a22e364b2c1d535013c604b7a9620a31606e71 /084emit-hex-array.subx | |
parent | f730f2f2c7934f52091a848b71f9031ea99e2377 (diff) | |
download | mu-bfcc0f858aa324739ad645e2056d73a47ab66f82.tar.gz |
6182 - start of support for safe handles
So far it's unclear how to do this in a series of small commits. Still nibbling around the edges. In this commit we standardize some terminology: The length of an array or stream is denominated in the high-level elements. The _size_ is denominated in bytes. The thing we encode into the type is always the size, not the length. There's still an open question of what to do about the Mu `length` operator. I'd like to modify it to provide the length. Currently it provides the size. If I can't fix that I'll rename it.
Diffstat (limited to '084emit-hex-array.subx')
-rw-r--r-- | 084emit-hex-array.subx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/084emit-hex-array.subx b/084emit-hex-array.subx index 5867a402..c3f74cd6 100644 --- a/084emit-hex-array.subx +++ b/084emit-hex-array.subx @@ -19,7 +19,7 @@ emit-hex-array: # out: (addr buffered-file), arr: (addr array byte) 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx # var curr/ecx: (addr byte) = arr->data 8d/copy-address 1/mod/*+disp8 2/rm32/edx . . . 1/r32/ecx 4/disp8 . # copy edx+4 to ecx - # var max/edx: (addr byte) = &arr->data[arr->length] + # var max/edx: (addr byte) = &arr->data[arr->size] 8b/copy 0/mod/indirect 2/rm32/edx . . . 2/r32/edx . . # copy *edx to edx 01/add 3/mod/direct 2/rm32/edx . . . 1/r32/ecx . . # add ecx to edx # var c/eax: byte = 0 @@ -73,7 +73,7 @@ test-emit-hex-array: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # var arr/ecx (array byte) = [01, 02, 03] 68/push 0x00030201/imm32 # bytes 01 02 03 - 68/push 3/imm32/length + 68/push 3/imm32/size 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # emit-hex-array(_test-output-buffered-file, arr) # . . push args |