From a518d84bf43375558fc42508347e5f604887e526 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sun, 29 Nov 2020 03:40:12 -0800 Subject: 7295 --- apps/mu.subx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'apps/mu.subx') diff --git a/apps/mu.subx b/apps/mu.subx index b71756c7..d2b89aaf 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -8258,7 +8258,7 @@ test-copy-to-non-literal-to-byte: (tailor-exit-descriptor %edx 0x10) # (write _test-input-stream "fn foo {\n") - (write _test-input-stream " var x/ecx: int <- copy 3\n") + (write _test-input-stream " var x/ecx: byte <- copy 3\n") (write _test-input-stream " var y/eax: (addr byte) <- copy 0\n") (write _test-input-stream " copy-to *y, x\n") (write _test-input-stream "}\n") @@ -22001,6 +22001,16 @@ $check-mu-copy-to-stmt:dest-is-deref2: } 89/<- %ebx 0/r32/eax } + # if dest is a byte and src is not a literal, abort + { +$check-mu-copy-to-stmt:final-check-byte: + (is-simple-mu-type? %ebx 8) # byte => eax + 3d/compare-eax-and 0/imm32/false + 74/jump-if-= break/disp8 + (is-simple-mu-type? %ecx 0) # literal => eax + 3d/compare-eax-and 0/imm32/false + 0f 84/jump-if-= $check-mu-copy-to-stmt:error-non-literal-to-byte/disp32 + } # if (src-type == dest-type) return (type-match? %ebx %ecx %edx) # => eax 3d/compare-eax-and 0/imm32 @@ -22034,17 +22044,6 @@ $check-mu-copy-to-stmt:final-check-offset: 74/jump-if-= break/disp8 e9/jump $check-mu-copy-to-stmt:end/disp32 } - # if dest is a byte, abort if src is not a literal. Otherwise return. - { -$check-mu-copy-to-stmt:final-check-byte: - (is-simple-mu-type? %ebx 8) # byte => eax - 3d/compare-eax-and 0/imm32/false - 74/jump-if-= break/disp8 - (is-simple-mu-type? %ecx 0) # literal => eax - 3d/compare-eax-and 0/imm32/false - 0f 84/jump-if-= $check-mu-copy-to-stmt:error-non-literal-to-byte/disp32 - eb/jump $check-mu-copy-to-stmt:end/disp8 - } # if dest is not number-like, abort (check-mu-numberlike-arg %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) $check-mu-copy-to-stmt:end: -- cgit 1.4.1-2-gfad0