1
0
mirror of https://github.com/golang/go synced 2024-11-23 14:40:02 -07:00

runtime: replace tls0 with m0.tls

We're allocating TLS storage for m0 anyway, so might as well use it.

Change-Id: I7dc20bbea5320c8ab8a367f18a9540706751e771
Reviewed-on: https://go-review.googlesource.com/16890
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Matthew Dempsky 2015-11-12 15:35:50 -08:00
parent 940d41e386
commit 7bb38f6e47
6 changed files with 9 additions and 13 deletions

View File

@ -83,7 +83,7 @@ needtls:
// store through it, to make sure it works
get_tls(BX)
MOVL $0x123, g(BX)
MOVL runtime·tls0(SB), AX
MOVL runtime·m0+m_tls(SB), AX
CMPL AX, $0x123
JEQ ok
MOVL AX, 0 // abort
@ -765,11 +765,11 @@ done:
RET
TEXT runtime·ldt0setup(SB),NOSPLIT,$16-0
// set up ldt 7 to point at tls0
// set up ldt 7 to point at m0.tls
// ldt 1 would be fine on Linux, but on OS X, 7 is as low as we can go.
// the entry number is just a hint. setldt will set up GS with what it used.
MOVL $7, 0(SP)
LEAL runtime·tls0(SB), AX
LEAL runtime·m0+m_tls(SB), AX
MOVL AX, 4(SP)
MOVL $32, 8(SP) // sizeof(tls array)
CALL runtime·setldt(SB)

View File

@ -104,13 +104,13 @@ needtls:
JMP ok
#endif
LEAQ runtime·tls0(SB), DI
LEAQ runtime·m0+m_tls(SB), DI
CALL runtime·settls(SB)
// store through it, to make sure it works
get_tls(BX)
MOVQ $0x123, g(BX)
MOVQ runtime·tls0(SB), AX
MOVQ runtime·m0+m_tls(SB), AX
CMPQ AX, $0x123
JEQ 2(PC)
MOVL AX, 0 // abort

View File

@ -39,13 +39,13 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0
nocpuinfo:
needtls:
LEAL runtime·tls0(SB), DI
LEAL runtime·m0+m_tls(SB), DI
CALL runtime·settls(SB)
// store through it, to make sure it works
get_tls(BX)
MOVQ $0x123, g(BX)
MOVQ runtime·tls0(SB), AX
MOVQ runtime·m0+m_tls(SB), AX
CMPQ AX, $0x123
JEQ 2(PC)
MOVL AX, 0 // abort

View File

@ -577,9 +577,6 @@ func profilem(mp *m) {
rbuf := make([]byte, unsafe.Sizeof(*r)+15)
tls := &mp.tls[0]
if mp == &m0 {
tls = &tls0[0]
}
gp := *((**g)(unsafe.Pointer(tls)))
// align Context to 16 bytes

View File

@ -1,3 +1,4 @@
#include "go_asm.h"
#include "textflag.h"
TEXT _rt0_ppc64le_linux(SB),NOSPLIT,$0
@ -22,7 +23,7 @@ TEXT _main<>(SB),NOSPLIT,$-8
// Statically linked
MOVD 0(R1), R3 // argc
ADD $8, R1, R4 // argv
MOVD $runtime·tls0(SB), R13 // TLS
MOVD $runtime·m0+m_tls(SB), R13 // TLS
ADD $0x7000, R13
dlink:

View File

@ -19,8 +19,6 @@ var ticks struct {
val uint64
}
var tls0 [8]uintptr // available storage for m0's TLS; not necessarily used; opaque to GC
// Note: Called by runtime/pprof in addition to runtime code.
func tickspersecond() int64 {
r := int64(atomic.Load64(&ticks.val))