about summary refs log tree commit diff stats
path: root/apps/mu.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-11-29 03:40:12 -0800
committerKartik Agaram <vc@akkartik.com>2020-11-29 03:40:12 -0800
commita518d84bf43375558fc42508347e5f604887e526 (patch)
tree62aa9347eb29eb2e93eb0686d17922f193488c2d /apps/mu.subx
parent8766aa12cdadb0e47bcb619b5bea308641327ce9 (diff)
downloadmu-a518d84bf43375558fc42508347e5f604887e526.tar.gz
7295
Diffstat (limited to 'apps/mu.subx')
-rw-r--r--apps/mu.subx23
1 files changed, 11 insertions, 12 deletions
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: