mirror of
https://github.com/golang/go
synced 2024-11-23 18:20:04 -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:
parent
940d41e386
commit
7bb38f6e47
@ -83,7 +83,7 @@ needtls:
|
|||||||
// store through it, to make sure it works
|
// store through it, to make sure it works
|
||||||
get_tls(BX)
|
get_tls(BX)
|
||||||
MOVL $0x123, g(BX)
|
MOVL $0x123, g(BX)
|
||||||
MOVL runtime·tls0(SB), AX
|
MOVL runtime·m0+m_tls(SB), AX
|
||||||
CMPL AX, $0x123
|
CMPL AX, $0x123
|
||||||
JEQ ok
|
JEQ ok
|
||||||
MOVL AX, 0 // abort
|
MOVL AX, 0 // abort
|
||||||
@ -765,11 +765,11 @@ done:
|
|||||||
RET
|
RET
|
||||||
|
|
||||||
TEXT runtime·ldt0setup(SB),NOSPLIT,$16-0
|
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.
|
// 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.
|
// the entry number is just a hint. setldt will set up GS with what it used.
|
||||||
MOVL $7, 0(SP)
|
MOVL $7, 0(SP)
|
||||||
LEAL runtime·tls0(SB), AX
|
LEAL runtime·m0+m_tls(SB), AX
|
||||||
MOVL AX, 4(SP)
|
MOVL AX, 4(SP)
|
||||||
MOVL $32, 8(SP) // sizeof(tls array)
|
MOVL $32, 8(SP) // sizeof(tls array)
|
||||||
CALL runtime·setldt(SB)
|
CALL runtime·setldt(SB)
|
||||||
|
@ -104,13 +104,13 @@ needtls:
|
|||||||
JMP ok
|
JMP ok
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LEAQ runtime·tls0(SB), DI
|
LEAQ runtime·m0+m_tls(SB), DI
|
||||||
CALL runtime·settls(SB)
|
CALL runtime·settls(SB)
|
||||||
|
|
||||||
// store through it, to make sure it works
|
// store through it, to make sure it works
|
||||||
get_tls(BX)
|
get_tls(BX)
|
||||||
MOVQ $0x123, g(BX)
|
MOVQ $0x123, g(BX)
|
||||||
MOVQ runtime·tls0(SB), AX
|
MOVQ runtime·m0+m_tls(SB), AX
|
||||||
CMPQ AX, $0x123
|
CMPQ AX, $0x123
|
||||||
JEQ 2(PC)
|
JEQ 2(PC)
|
||||||
MOVL AX, 0 // abort
|
MOVL AX, 0 // abort
|
||||||
|
@ -39,13 +39,13 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0
|
|||||||
nocpuinfo:
|
nocpuinfo:
|
||||||
|
|
||||||
needtls:
|
needtls:
|
||||||
LEAL runtime·tls0(SB), DI
|
LEAL runtime·m0+m_tls(SB), DI
|
||||||
CALL runtime·settls(SB)
|
CALL runtime·settls(SB)
|
||||||
|
|
||||||
// store through it, to make sure it works
|
// store through it, to make sure it works
|
||||||
get_tls(BX)
|
get_tls(BX)
|
||||||
MOVQ $0x123, g(BX)
|
MOVQ $0x123, g(BX)
|
||||||
MOVQ runtime·tls0(SB), AX
|
MOVQ runtime·m0+m_tls(SB), AX
|
||||||
CMPQ AX, $0x123
|
CMPQ AX, $0x123
|
||||||
JEQ 2(PC)
|
JEQ 2(PC)
|
||||||
MOVL AX, 0 // abort
|
MOVL AX, 0 // abort
|
||||||
|
@ -577,9 +577,6 @@ func profilem(mp *m) {
|
|||||||
rbuf := make([]byte, unsafe.Sizeof(*r)+15)
|
rbuf := make([]byte, unsafe.Sizeof(*r)+15)
|
||||||
|
|
||||||
tls := &mp.tls[0]
|
tls := &mp.tls[0]
|
||||||
if mp == &m0 {
|
|
||||||
tls = &tls0[0]
|
|
||||||
}
|
|
||||||
gp := *((**g)(unsafe.Pointer(tls)))
|
gp := *((**g)(unsafe.Pointer(tls)))
|
||||||
|
|
||||||
// align Context to 16 bytes
|
// align Context to 16 bytes
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "go_asm.h"
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
TEXT _rt0_ppc64le_linux(SB),NOSPLIT,$0
|
TEXT _rt0_ppc64le_linux(SB),NOSPLIT,$0
|
||||||
@ -22,7 +23,7 @@ TEXT _main<>(SB),NOSPLIT,$-8
|
|||||||
// Statically linked
|
// Statically linked
|
||||||
MOVD 0(R1), R3 // argc
|
MOVD 0(R1), R3 // argc
|
||||||
ADD $8, R1, R4 // argv
|
ADD $8, R1, R4 // argv
|
||||||
MOVD $runtime·tls0(SB), R13 // TLS
|
MOVD $runtime·m0+m_tls(SB), R13 // TLS
|
||||||
ADD $0x7000, R13
|
ADD $0x7000, R13
|
||||||
|
|
||||||
dlink:
|
dlink:
|
||||||
|
@ -19,8 +19,6 @@ var ticks struct {
|
|||||||
val uint64
|
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.
|
// Note: Called by runtime/pprof in addition to runtime code.
|
||||||
func tickspersecond() int64 {
|
func tickspersecond() int64 {
|
||||||
r := int64(atomic.Load64(&ticks.val))
|
r := int64(atomic.Load64(&ticks.val))
|
||||||
|
Loading…
Reference in New Issue
Block a user