]> Cypherpunks.ru repositories - gostls13.git/commitdiff
runtime: replace tls0 with m0.tls
authorMatthew Dempsky <mdempsky@google.com>
Thu, 12 Nov 2015 23:35:50 +0000 (15:35 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 13 Nov 2015 01:53:00 +0000 (01:53 +0000)
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>
src/runtime/asm_386.s
src/runtime/asm_amd64.s
src/runtime/asm_amd64p32.s
src/runtime/os1_windows.go
src/runtime/rt0_linux_ppc64le.s
src/runtime/runtime.go

index 8db8aa9eefb70fa5ea066935fc348059c1ff8a90..3654db4d0cb4a0a0c656ca1bdec5cc6102c5049c 100644 (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)
index 2f8940a678fbc7b1cd3f4235cca379be05f7cac2..4e5e8f75127b1908c9f40f82024e39372bc98b3c 100644 (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
index aeb9d131b28f85e07fa5f8f436187d3618087083..8119d91e1b80f8d63b1d426a060f3da8a857ecda 100644 (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
index f5301db1a44f9a0a48c76c1eecd4ae7f08b3a0a7..bd514724f18f139e236b0e75574995de5436b8d5 100644 (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
index 5616e1d5b3f032aa34f365c7dd0ab1cf439a9aa2..ac7b9225a43bef982954fd952ce639240c709f9c 100644 (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:
index 0bbe42739d0cbf17b94f901547b3047009047cd7..265edf28b3a1173454e448246f22ed10d9e8bb1e 100644 (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))