diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-08-22 14:35:44 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-08-22 14:35:44 -0700 |
commit | 15b9880136b6b4754a6e6498c81932e553246d9f (patch) | |
tree | 2ad3b055a2383ffbd980193310e0775b1d0c170c /apps | |
parent | db894e7968808512392c46d62b2bee68b891db04 (diff) | |
download | mu-15b9880136b6b4754a6e6498c81932e553246d9f.tar.gz |
6727 - bugfix in a multiply instruction
Also more error-detection for this case all across the toolchain.
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/mu | bin | 388320 -> 388322 bytes | |||
-rw-r--r-- | apps/mu.subx | 7 |
2 files changed, 4 insertions, 3 deletions
diff --git a/apps/mu b/apps/mu index 8bf88983..0dceb721 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx index c7076627..f673045a 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -14409,8 +14409,9 @@ size-of-array: # a: (addr type-tree) -> result/eax: int 8b/-> *(eax+8) 1/r32/ecx # Type-tree-value-size # return 4 + array-size * size-of(elem-type) (size-of-type-id-as-array-element %edx) # => eax - f7 4/subop/multiply-into-eax %ecx + f7 4/subop/multiply-into-edx-eax %ecx 05/add-to-eax 4/imm32 # for array size + # TODO: check edx for overflow $size-of-array:end: # . restore registers 5a/pop-to-edx @@ -16549,7 +16550,7 @@ $translate-mu-index-stmt-with-array-in-register:emit-literal-index: 89/<- %edx 0/r32/eax # offset = idx-value * array-element-size(base->type) (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax - f7 4/subop/multiply-into-eax %edx # clobbers edx + f7 4/subop/multiply-into-edx-eax %edx # clobbers edx # offset += 4 for array size 05/add-to-eax 4/imm32 # TODO: check edx for overflow @@ -16666,7 +16667,7 @@ $translate-mu-index-stmt-with-array-on-stack:emit-literal-index: 89/<- %edx 0/r32/eax # offset = idx-value * array-element-size(base) (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax - f7 4/subop/multiply-into-eax %edx # clobbers edx + f7 4/subop/multiply-into-edx-eax %edx # clobbers edx # offset += base->offset 03/add *(ecx+0x14) 0/r32/eax # Var-offset # offset += 4 for array size |