From 15b9880136b6b4754a6e6498c81932e553246d9f Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 22 Aug 2020 14:35:44 -0700 Subject: 6727 - bugfix in a multiply instruction Also more error-detection for this case all across the toolchain. --- apps/mu | Bin 388320 -> 388322 bytes apps/mu.subx | 7 ++++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'apps') diff --git a/apps/mu b/apps/mu index 8bf88983..0dceb721 100755 Binary files a/apps/mu and b/apps/mu differ diff --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 -- cgit 1.4.1-2-gfad0