about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-05-24 20:54:12 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-24 20:54:12 -0700
commitd1179723a9bc8e02a91d740040bbcf86bff384e1 (patch)
tree01a3051dd22f271270e628e555255bcef83a66f1
parent4d14c3fefd8362512e8e75d5051f7a7b709b483f (diff)
downloadmu-d1179723a9bc8e02a91d740040bbcf86bff384e1.tar.gz
6394 - a catastrophic bug
How did new-literal ever work?! Somehow we had eax silently being clobbered
without affecting behavior over like 5 apps. Unsafe languages suck.

Anyways, factorial.mu is now part of CI.
-rwxr-xr-xapps/mubin254249 -> 254249 bytes
-rw-r--r--apps/mu.subx2
-rwxr-xr-xtest_apps13
3 files changed, 14 insertions, 1 deletions
diff --git a/apps/mu b/apps/mu
index 9cb68c00..8db63c71 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx
index 4127b572..2e657c89 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -6532,7 +6532,7 @@ new-literal:  # ad: (addr allocation-descriptor), name: (addr slice), out: (addr
     # var s/ecx: (handle array byte)
     68/push 0/imm32
     68/push 0/imm32
-    89/<- %ecx 0/r32/eax
+    89/<- %ecx 4/r32/esp
     # s = slice-to-string(name)
     (slice-to-string Heap *(ebp+0xc) %ecx)
     # allocate to out
diff --git a/test_apps b/test_apps
index b2d10472..c6b1f3f2 100755
--- a/test_apps
+++ b/test_apps
@@ -395,4 +395,17 @@ test $NATIVE  &&  {
   test $ret -eq 55
 }
 
+echo factorial.mu
+./translate_mu apps/factorial.mu
+test $EMULATED  &&  {
+  ./bootstrap run a.elf  ||  ret=$?
+  test $ret -eq 120
+  ./bootstrap run a.elf test
+}
+test $NATIVE  &&  {
+  ./a.elf  ||  ret=$?
+  test $ret -eq 120
+  ./a.elf test
+}
+
 exit 0