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
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)
{
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)
{
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)
{
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)
{