shithub: mc

Download patch

ref: a88cc14b9fc6b01e1ae6a31080f8b148b237d438
parent: af80a22d3c4d5345af67f749aee6008ae6d2e92f
author: Ori Bernstein <[email protected]>
date: Tue Jun 19 09:54:11 EDT 2012

Call functions with large args correctly.

--- a/8/isel.c
+++ b/8/isel.c
@@ -353,11 +353,11 @@
 
 static Loc *gencall(Isel *s, Node *n)
 {
-    int argsz, argoff;
-    size_t i;
+    Loc *src, *dst, *arg, *fn;   /* values we reduced */
     Loc *eax, *esp;       /* hard-coded registers */
     Loc *stkbump;        /* calculated stack offset */
-    Loc *dst, *arg, *fn;   /* values we reduced */
+    int argsz, argoff;
+    size_t i;
 
     esp = locphysreg(Resp);
     eax = locphysreg(Reax);
@@ -380,7 +380,9 @@
         arg = selexpr(s, n->expr.args[i]);
         if (size(n->expr.args[i]) > 4) {
             dst = locreg(ModeL);
-            blit(s, esp, arg, argoff, 0, size(n->expr.args[i]));
+            src = locreg(ModeL);
+            g(s, Ilea, arg, src, NULL);
+            blit(s, esp, src, argoff, 0, size(n->expr.args[i]));
         } else {
             dst = locmem(argoff, esp, NULL, arg->mode);
             arg = inri(s, arg);
@@ -819,4 +821,3 @@
         writeasm(stdout, &is, fn);
     writeasm(fd, &is, fn);
 }
-