shithub: mc

Download patch

ref: 5d0174129891e6b840823032e91c5edbe1cdb456
parent: a2edfce45a0f781595bb690f1765d7888e45e043
author: Ori Bernstein <[email protected]>
date: Wed Dec 25 20:07:40 EST 2013

Handle big arrays better.

    Don't generate tons of ".byte 0" directives. Use a ".fill" instead.

--- a/6/isel.c
+++ b/6/isel.c
@@ -988,10 +988,7 @@
 
 static void writepad(FILE *fd, size_t sz)
 {
-    size_t i;
-
-    for (i = 0; i < sz; i++)
-        fprintf(fd, "\t.byte 0\n");
+    fprintf(fd, "\t.fill %zd,1,0\n", sz);
 }
 
 static void writetup(FILE *fd, Htab *strtab, Node *n)
--- a/6/simp.c
+++ b/6/simp.c
@@ -302,7 +302,7 @@
         case Tyname:
             return tysize(t->sub[0]);
         case Tyarray:
-            t->asize = fold(t->asize, 0);
+            t->asize = fold(t->asize, 1);
             assert(exprop(t->asize) == Olit);
             return t->asize->expr.args[0]->lit.intval * tysize(t->sub[0]);
         case Tytuple: