diff options
| author | Russ Cox <rsc@golang.org> | 2014-06-26 11:54:39 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-06-26 11:54:39 -0400 |
| commit | 89f185fe8a036b0fabce30b20c480cf1c832bdd7 (patch) | |
| tree | cd8c84fca5164747bebd852da7edfed132ce4e70 /src/cmd/ld/data.c | |
| parent | 2565b5c06086488b2b23d48929803c8c3cec4400 (diff) | |
| download | go-89f185fe8a036b0fabce30b20c480cf1c832bdd7.tar.xz | |
all: remove 'extern register M *m' from runtime
The runtime has historically held two dedicated values g (current goroutine)
and m (current thread) in 'extern register' slots (TLS on x86, real registers
backed by TLS on ARM).
This CL removes the extern register m; code now uses g->m.
On ARM, this frees up the register that formerly held m (R9).
This is important for NaCl, because NaCl ARM code cannot use R9 at all.
The Go 1 macrobenchmarks (those with per-op times >= 10 µs) are unaffected:
BenchmarkBinaryTree17 5491374955 5471024381 -0.37%
BenchmarkFannkuch11 4357101311 4275174828 -1.88%
BenchmarkGobDecode 11029957 11364184 +3.03%
BenchmarkGobEncode 6852205 6784822 -0.98%
BenchmarkGzip 650795967 650152275 -0.10%
BenchmarkGunzip 140962363 141041670 +0.06%
BenchmarkHTTPClientServer 71581 73081 +2.10%
BenchmarkJSONEncode 31928079 31913356 -0.05%
BenchmarkJSONDecode 117470065 113689916 -3.22%
BenchmarkMandelbrot200 6008923 5998712 -0.17%
BenchmarkGoParse 6310917 6327487 +0.26%
BenchmarkRegexpMatchMedium_1K 114568 114763 +0.17%
BenchmarkRegexpMatchHard_1K 168977 169244 +0.16%
BenchmarkRevcomp 935294971 914060918 -2.27%
BenchmarkTemplate 145917123 148186096 +1.55%
Minux previous reported larger variations, but these were caused by
run-to-run noise, not repeatable slowdowns.
Actual code changes by Minux.
I only did the docs and the benchmarking.
LGTM=dvyukov, iant, minux
R=minux, josharian, iant, dave, bradfitz, dvyukov
CC=golang-codereviews
https://golang.org/cl/109050043
Diffstat (limited to 'src/cmd/ld/data.c')
| -rw-r--r-- | src/cmd/ld/data.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/ld/data.c b/src/cmd/ld/data.c index 55d020710e..03b93c77ce 100644 --- a/src/cmd/ld/data.c +++ b/src/cmd/ld/data.c @@ -186,8 +186,8 @@ relocsym(LSym *s) case R_TLS_LE: if(linkmode == LinkExternal && iself && HEADTYPE != Hopenbsd) { r->done = 0; - r->sym = ctxt->gmsym; - r->xsym = ctxt->gmsym; + r->sym = ctxt->tlsg; + r->xsym = ctxt->tlsg; r->xadd = r->add; o = 0; if(thechar != '6') @@ -200,8 +200,8 @@ relocsym(LSym *s) case R_TLS_IE: if(linkmode == LinkExternal && iself && HEADTYPE != Hopenbsd) { r->done = 0; - r->sym = ctxt->gmsym; - r->xsym = ctxt->gmsym; + r->sym = ctxt->tlsg; + r->xsym = ctxt->tlsg; r->xadd = r->add; o = 0; if(thechar != '6') @@ -951,9 +951,9 @@ dodata(void) sect->len = datsize; } else { // Might be internal linking but still using cgo. - // In that case, the only possible STLSBSS symbol is tlsgm. + // In that case, the only possible STLSBSS symbol is runtime.tlsg. // Give it offset 0, because it's the only thing here. - if(s != nil && s->type == STLSBSS && strcmp(s->name, "runtime.tlsgm") == 0) { + if(s != nil && s->type == STLSBSS && strcmp(s->name, "runtime.tlsg") == 0) { s->value = 0; s = s->next; } |
