about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-06-21 16:53:44 -0700
committerKartik Agaram <vc@akkartik.com>2020-06-21 16:53:44 -0700
commit6883b8d1c71a939b1378422f4c0f66982698d725 (patch)
tree3caba56224119afd2f1102e7f366d0b7f98ba3dc
parentc50303cc631a081ef33fe265df2c40916ed2f869 (diff)
downloadmu-6883b8d1c71a939b1378422f4c0f66982698d725.tar.gz
6569 - correct the second failing test
-rw-r--r--apps/mu.subx65
1 files changed, 31 insertions, 34 deletions
diff --git a/apps/mu.subx b/apps/mu.subx
index f286a3a8..f6d48793 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -2476,37 +2476,25 @@ test-fn-output-written-in-inner-block:
     (clear-stream $_test-input-buffered-file->buffer)
     (clear-stream _test-output-stream)
     (clear-stream $_test-output-buffered-file->buffer)
-    (clear-stream _test-error-stream)
-    (clear-stream $_test-error-buffered-file->buffer)
-    # var ed/edx: exit-descriptor = tailor-exit-descriptor(16)
-    68/push 0/imm32
-    68/push 0/imm32
-    89/<- %edx 4/r32/esp
-    (tailor-exit-descriptor %edx 0x10)
     #
-    (write _test-input-stream "fn foo -> out/ecx: int {\n")
-    (write _test-input-stream "  var a/ecx: int <- copy 3\n")  # define outer local
-    (write _test-input-stream "  {\n")
-    (write _test-input-stream "    var b/eax: int <- copy 4\n")  # shadow outer local
-    (write _test-input-stream "    out <- copy b\n")  # write to fn output
+    (write _test-input-stream "fn foo -> out/edi: int {\n")
+    (write _test-input-stream "  var a/eax: int <- copy 3\n")  # define outer local
     (write _test-input-stream "  {\n")
+    (write _test-input-stream "    var a/ecx: int <- copy 4\n")  # shadow outer local
+    (write _test-input-stream "    out <- copy a\n")  # write to fn output
+    (write _test-input-stream "  }\n")
     (write _test-input-stream "  compare a, 0\n")  # use outer local
     (write _test-input-stream "}\n")
     # convert
-    (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx)
-    # registers except esp clobbered at this point
-    # restore ed
-    89/<- %edx 4/r32/esp
+    (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0)
     (flush _test-output-buffered-file)
-    (flush _test-error-buffered-file)
-#?     # dump _test-output-stream {{{
-#?     (write 2 "^")
-#?     (write-stream 2 _test-output-stream)
-#?     (write 2 "$\n")
-#?     (rewind-stream _test-output-stream)
-#?     # }}}
+    # dump _test-output-stream {{{
+    (write 2 "^")
+    (write-stream 2 _test-output-stream)
+    (write 2 "$\n")
+    (rewind-stream _test-output-stream)
+    # }}}
     # no error; defining 'out' didn't interfere with the reclamation of 'b'
-    (check-stream-equal _test-error-stream  ""  "F - test-fn-output-written-in-inner-block: error stream should be empty")
     # check output
     (check-next-stream-line-equal _test-output-stream "foo:"                    "F - test-fn-output-written-in-inner-block/0")
     (check-next-stream-line-equal _test-output-stream "  # . prologue"          "F - test-fn-output-written-in-inner-block/1")
@@ -2514,17 +2502,26 @@ test-fn-output-written-in-inner-block:
     (check-next-stream-line-equal _test-output-stream "  89/<- %ebp 4/r32/esp"  "F - test-fn-output-written-in-inner-block/3")
     (check-next-stream-line-equal _test-output-stream "  {"                     "F - test-fn-output-written-in-inner-block/4")
     (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:"   "F - test-fn-output-written-in-inner-block/5")
-    (check-next-stream-line-equal _test-output-stream "    b9/copy-to-ecx 4/imm32"  "F - test-fn-output-written-in-inner-block/6")  # no push because it's an output reg
-    (check-next-stream-line-equal _test-output-stream "    89/<- %ecx 0x00000001/r32"  "F - test-fn-output-written-in-inner-block/7")
-    (check-next-stream-line-equal _test-output-stream "  }"                     "F - test-fn-output-written-in-inner-block/8")
-    (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:"  "F - test-fn-output-written-in-inner-block/9")
-    (check-next-stream-line-equal _test-output-stream "  # . epilogue"          "F - test-fn-output-written-in-inner-block/10")
-    (check-next-stream-line-equal _test-output-stream "  89/<- %esp 5/r32/ebp"  "F - test-fn-output-written-in-inner-block/11")
-    (check-next-stream-line-equal _test-output-stream "  5d/pop-to-ebp"         "F - test-fn-output-written-in-inner-block/12")
-    (check-next-stream-line-equal _test-output-stream "  c3/return"             "F - test-fn-output-written-in-inner-block/13")
-    # don't restore from ebp
-    81 0/subop/add %esp 8/imm32
+    (check-next-stream-line-equal _test-output-stream "    ff 6/subop/push %eax"  "F - test-fn-output-written-in-inner-block/6")
+    (check-next-stream-line-equal _test-output-stream "    b8/copy-to-eax 3/imm32"  "F - test-fn-output-written-in-inner-block/7")
+    (check-next-stream-line-equal _test-output-stream "    {"                   "F - test-fn-output-written-in-inner-block/8")
+    (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:"   "F - test-fn-output-written-in-inner-block/9")
+    (check-next-stream-line-equal _test-output-stream "      ff 6/subop/push %ecx"  "F - test-fn-output-written-in-inner-block/10")
+    (check-next-stream-line-equal _test-output-stream "      b9/copy-to-ecx 4/imm32"  "F - test-fn-output-written-in-inner-block/10")
+    (check-next-stream-line-equal _test-output-stream "      89/<- %edi 0x00000001/r32"  "F - test-fn-output-written-in-inner-block/11")
+    (check-next-stream-line-equal _test-output-stream "      8f 0/subop/pop %ecx"  "F - test-fn-output-written-in-inner-block/12")
+    (check-next-stream-line-equal _test-output-stream "    }"                   "F - test-fn-output-written-in-inner-block/13")
+    (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:"  "F - test-fn-output-written-in-inner-block/14")
+    (check-next-stream-line-equal _test-output-stream "    3d/compare-eax-with 0/imm32"  "F - test-fn-output-written-in-inner-block/15")
+    (check-next-stream-line-equal _test-output-stream "    8f 0/subop/pop %eax" "F - test-fn-output-written-in-inner-block/16")
+    (check-next-stream-line-equal _test-output-stream "  }"                     "F - test-fn-output-written-in-inner-block/17")
+    (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:"  "F - test-fn-output-written-in-inner-block/18")
+    (check-next-stream-line-equal _test-output-stream "  # . epilogue"          "F - test-fn-output-written-in-inner-block/19")
+    (check-next-stream-line-equal _test-output-stream "  89/<- %esp 5/r32/ebp"  "F - test-fn-output-written-in-inner-block/20")
+    (check-next-stream-line-equal _test-output-stream "  5d/pop-to-ebp"         "F - test-fn-output-written-in-inner-block/21")
+    (check-next-stream-line-equal _test-output-stream "  c3/return"             "F - test-fn-output-written-in-inner-block/22")
     # . epilogue
+    89/<- %esp 5/r32/ebp
     5d/pop-to-ebp
     c3/return