]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: bypass DATA instruction for data initialized to integer constant
authorRuss Cox <rsc@golang.org>
Fri, 20 Dec 2013 19:24:39 +0000 (14:24 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 20 Dec 2013 19:24:39 +0000 (14:24 -0500)
Eventually we will want to bypass DATA for everything,
but the relocations are not standardized well enough across
architectures to make that possible.

This did not help as much as I expected, but it is definitely better.
It shaves maybe 1-2% off all.bash depending on how much you
trust the timings of a single run:

Before: 241.139r 362.702u 112.967s
After:  234.339r 359.623u 111.045s

R=golang-codereviews, gobot, r, iant
CC=golang-codereviews
https://golang.org/cl/44650043

src/cmd/5g/gobj.c
src/cmd/6g/gobj.c
src/cmd/8g/gobj.c
src/cmd/gc/obj.c

index eaa28c111367b0765510f04f71ec9f00d08d1f0b..5e988878f7d58e4efe8f078fdbfea9be41501291 100644 (file)
@@ -223,27 +223,6 @@ dgostringptr(Sym *s, int off, char *str)
        return dgostrlitptr(s, off, lit);
 }
 
-int
-duintxx(Sym *s, int off, uint64 v, int wid)
-{
-       Prog *p;
-
-       off = rnd(off, wid);
-
-       p = gins(ADATA, N, N);
-       p->from.type = D_OREG;
-       p->from.name = D_EXTERN;
-       p->from.sym = linksym(s);
-       p->from.offset = off;
-       p->reg = wid;
-       p->to.type = D_CONST;
-       p->to.name = D_NONE;
-       p->to.offset = v;
-       off += wid;
-
-       return off;
-}
-
 int
 dsymptr(Sym *s, int off, Sym *x, int xoff)
 {
index e22defe4f1e9d42f7f4821b8f71b296228f19618..04e837b1384ac59105d6aece7123a0ca89f22529 100644 (file)
@@ -205,27 +205,6 @@ dgostringptr(Sym *s, int off, char *str)
        return dgostrlitptr(s, off, lit);
 }
 
-int
-duintxx(Sym *s, int off, uint64 v, int wid)
-{
-       Prog *p;
-
-       off = rnd(off, wid);
-
-       p = gins(ADATA, N, N);
-       p->from.type = D_EXTERN;
-       p->from.index = D_NONE;
-       p->from.sym = linksym(s);
-       p->from.offset = off;
-       p->from.scale = wid;
-       p->to.type = D_CONST;
-       p->to.index = D_NONE;
-       p->to.offset = v;
-       off += wid;
-
-       return off;
-}
-
 int
 dsymptr(Sym *s, int off, Sym *x, int xoff)
 {
index 68846ef2198399dc8d6d36ea429296253205c2ce..fa0605e6c763522f18b0feefb432799f709d1908 100644 (file)
@@ -216,28 +216,6 @@ dgostringptr(Sym *s, int off, char *str)
        return dgostrlitptr(s, off, lit);
 }
 
-
-int
-duintxx(Sym *s, int off, uint64 v, int wid)
-{
-       Prog *p;
-
-       off = rnd(off, wid);
-
-       p = gins(ADATA, N, N);
-       p->from.type = D_EXTERN;
-       p->from.index = D_NONE;
-       p->from.sym = linksym(s);
-       p->from.offset = off;
-       p->from.scale = wid;
-       p->to.type = D_CONST;
-       p->to.index = D_NONE;
-       p->to.offset = v;
-       off += wid;
-
-       return off;
-}
-
 int
 dsymptr(Sym *s, int off, Sym *x, int xoff)
 {
index 3b9a97320f845b7d1123fab615a9c7559ff41d05..c17be5c39812296735664a9633b370a25ee5b7fa 100644 (file)
@@ -160,6 +160,16 @@ linksym(Sym *s)
        return s->lsym; 
 }
 
+int
+duintxx(Sym *s, int off, uint64 v, int wid)
+{
+       // Update symbol data directly instead of generating a
+       // DATA instruction that liblink will have to interpret later.
+       // This reduces compilation time and memory usage.
+       off = rnd(off, wid);
+       return setuintxx(ctxt, linksym(s), off, v, wid);
+}
+
 int
 duint8(Sym *s, int off, uint8 v)
 {