mirror of
https://github.com/golang/go
synced 2024-11-18 12:44:49 -07:00
runtime: split plan9 and solaris's m fields into new embedded mOS type
Reduces the size of m by ~8% on linux/amd64 (1040 bytes -> 960 bytes). There are also windows-specific fields, but they're currently referenced in OS-independent source files (but only when GOOS=="windows"). Change-Id: I13e1471ff585ccced1271f74209f8ed6df14c202 Reviewed-on: https://go-review.googlesource.com/16173 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
029c760c7b
commit
58e3ae2fae
@ -6,6 +6,8 @@ package runtime
|
|||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
|
type mOS struct{}
|
||||||
|
|
||||||
func bsdthread_create(stk, arg unsafe.Pointer, fn uintptr) int32
|
func bsdthread_create(stk, arg unsafe.Pointer, fn uintptr) int32
|
||||||
func bsdthread_register() int32
|
func bsdthread_register() int32
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ package runtime
|
|||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
|
type mOS struct{}
|
||||||
|
|
||||||
//go:noescape
|
//go:noescape
|
||||||
func lwp_create(param *lwpparams) int32
|
func lwp_create(param *lwpparams) int32
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ package runtime
|
|||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
|
type mOS struct{}
|
||||||
|
|
||||||
//go:noescape
|
//go:noescape
|
||||||
func thr_new(param *thrparam, size int32)
|
func thr_new(param *thrparam, size int32)
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ package runtime
|
|||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
|
type mOS struct{}
|
||||||
|
|
||||||
//go:noescape
|
//go:noescape
|
||||||
func futex(addr unsafe.Pointer, op int32, val uint32, ts, addr2 unsafe.Pointer, val3 uint32) int32
|
func futex(addr unsafe.Pointer, op int32, val uint32, ts, addr2 unsafe.Pointer, val3 uint32) int32
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ package runtime
|
|||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
|
type mOS struct{}
|
||||||
|
|
||||||
func nacl_exception_stack(p uintptr, size int32) int32
|
func nacl_exception_stack(p uintptr, size int32) int32
|
||||||
func nacl_exception_handler(fn uintptr, arg unsafe.Pointer) int32
|
func nacl_exception_handler(fn uintptr, arg unsafe.Pointer) int32
|
||||||
func nacl_sem_create(flag int32) int32
|
func nacl_sem_create(flag int32) int32
|
||||||
|
@ -6,6 +6,8 @@ package runtime
|
|||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
|
type mOS struct{}
|
||||||
|
|
||||||
//go:noescape
|
//go:noescape
|
||||||
func setitimer(mode int32, new, old *itimerval)
|
func setitimer(mode int32, new, old *itimerval)
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
|
type mOS struct{}
|
||||||
|
|
||||||
//go:noescape
|
//go:noescape
|
||||||
func setitimer(mode int32, new, old *itimerval)
|
func setitimer(mode int32, new, old *itimerval)
|
||||||
|
|
||||||
|
@ -6,6 +6,11 @@ package runtime
|
|||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
|
type mOS struct {
|
||||||
|
notesig *int8
|
||||||
|
errstr *byte
|
||||||
|
}
|
||||||
|
|
||||||
func closefd(fd int32) int32
|
func closefd(fd int32) int32
|
||||||
|
|
||||||
//go:noescape
|
//go:noescape
|
||||||
|
@ -6,6 +6,24 @@ package runtime
|
|||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
|
type mts struct {
|
||||||
|
tv_sec int64
|
||||||
|
tv_nsec int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type mscratch struct {
|
||||||
|
v [6]uintptr
|
||||||
|
}
|
||||||
|
|
||||||
|
type mOS struct {
|
||||||
|
perrno *int32 // pointer to tls errno
|
||||||
|
// these are here because they are too large to be on the stack
|
||||||
|
// of low-level NOSPLIT functions.
|
||||||
|
//LibCall libcall;
|
||||||
|
ts mts
|
||||||
|
scratch mscratch
|
||||||
|
}
|
||||||
|
|
||||||
type libcFunc uintptr
|
type libcFunc uintptr
|
||||||
|
|
||||||
var asmsysvicall6 libcFunc
|
var asmsysvicall6 libcFunc
|
||||||
|
@ -6,6 +6,8 @@ package runtime
|
|||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
|
type mOS struct{}
|
||||||
|
|
||||||
type stdFunction *byte
|
type stdFunction *byte
|
||||||
|
|
||||||
//go:linkname os_sigpipe os.sigpipe
|
//go:linkname os_sigpipe os.sigpipe
|
||||||
|
@ -269,15 +269,6 @@ type g struct {
|
|||||||
gcAssistBytes int64
|
gcAssistBytes int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type mts struct {
|
|
||||||
tv_sec int64
|
|
||||||
tv_nsec int64
|
|
||||||
}
|
|
||||||
|
|
||||||
type mscratch struct {
|
|
||||||
v [6]uintptr
|
|
||||||
}
|
|
||||||
|
|
||||||
type m struct {
|
type m struct {
|
||||||
g0 *g // goroutine with scheduling stack
|
g0 *g // goroutine with scheduling stack
|
||||||
morebuf gobuf // gobuf arg to morestack
|
morebuf gobuf // gobuf arg to morestack
|
||||||
@ -343,18 +334,7 @@ type m struct {
|
|||||||
libcallg guintptr
|
libcallg guintptr
|
||||||
syscall libcall // stores syscall parameters on windows
|
syscall libcall // stores syscall parameters on windows
|
||||||
//#endif
|
//#endif
|
||||||
//#ifdef GOOS_solaris
|
mOS
|
||||||
perrno *int32 // pointer to tls errno
|
|
||||||
// these are here because they are too large to be on the stack
|
|
||||||
// of low-level NOSPLIT functions.
|
|
||||||
//LibCall libcall;
|
|
||||||
ts mts
|
|
||||||
scratch mscratch
|
|
||||||
//#endif
|
|
||||||
//#ifdef GOOS_plan9
|
|
||||||
notesig *int8
|
|
||||||
errstr *byte
|
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type p struct {
|
type p struct {
|
||||||
|
@ -238,7 +238,7 @@ TEXT runtime·errstr(SB),NOSPLIT,$8-8
|
|||||||
get_tls(AX)
|
get_tls(AX)
|
||||||
MOVL g(AX), BX
|
MOVL g(AX), BX
|
||||||
MOVL g_m(BX), BX
|
MOVL g_m(BX), BX
|
||||||
MOVL m_errstr(BX), CX
|
MOVL (m_mOS+mOS_errstr)(BX), CX
|
||||||
MOVL CX, 0(SP)
|
MOVL CX, 0(SP)
|
||||||
MOVL $ERRMAX, 4(SP)
|
MOVL $ERRMAX, 4(SP)
|
||||||
CALL errstr<>(SB)
|
CALL errstr<>(SB)
|
||||||
|
@ -243,7 +243,7 @@ TEXT runtime·errstr(SB),NOSPLIT,$16-16
|
|||||||
get_tls(AX)
|
get_tls(AX)
|
||||||
MOVQ g(AX), BX
|
MOVQ g(AX), BX
|
||||||
MOVQ g_m(BX), BX
|
MOVQ g_m(BX), BX
|
||||||
MOVQ m_errstr(BX), CX
|
MOVQ (m_mOS+mOS_errstr)(BX), CX
|
||||||
MOVQ CX, 0(SP)
|
MOVQ CX, 0(SP)
|
||||||
MOVQ $ERRMAX, 8(SP)
|
MOVQ $ERRMAX, 8(SP)
|
||||||
CALL errstr<>(SB)
|
CALL errstr<>(SB)
|
||||||
|
@ -26,7 +26,7 @@ TEXT runtime·miniterrno(SB),NOSPLIT,$0
|
|||||||
get_tls(CX)
|
get_tls(CX)
|
||||||
MOVQ g(CX), BX
|
MOVQ g(CX), BX
|
||||||
MOVQ g_m(BX), BX
|
MOVQ g_m(BX), BX
|
||||||
MOVQ AX, m_perrno(BX)
|
MOVQ AX, (m_mOS+mOS_perrno)(BX)
|
||||||
RET
|
RET
|
||||||
|
|
||||||
// int64 runtime·nanotime1(void);
|
// int64 runtime·nanotime1(void);
|
||||||
@ -81,7 +81,7 @@ TEXT runtime·asmsysvicall6(SB),NOSPLIT,$0
|
|||||||
get_tls(CX)
|
get_tls(CX)
|
||||||
MOVQ g(CX), BX
|
MOVQ g(CX), BX
|
||||||
MOVQ g_m(BX), BX
|
MOVQ g_m(BX), BX
|
||||||
MOVQ m_perrno(BX), DX
|
MOVQ (m_mOS+mOS_perrno)(BX), DX
|
||||||
CMPQ DX, $0
|
CMPQ DX, $0
|
||||||
JEQ skiperrno1
|
JEQ skiperrno1
|
||||||
MOVL $0, 0(DX)
|
MOVL $0, 0(DX)
|
||||||
@ -109,7 +109,7 @@ skipargs:
|
|||||||
get_tls(CX)
|
get_tls(CX)
|
||||||
MOVQ g(CX), BX
|
MOVQ g(CX), BX
|
||||||
MOVQ g_m(BX), BX
|
MOVQ g_m(BX), BX
|
||||||
MOVQ m_perrno(BX), AX
|
MOVQ (m_mOS+mOS_perrno)(BX), AX
|
||||||
CMPQ AX, $0
|
CMPQ AX, $0
|
||||||
JEQ skiperrno2
|
JEQ skiperrno2
|
||||||
MOVL 0(AX), AX
|
MOVL 0(AX), AX
|
||||||
@ -196,7 +196,7 @@ allgood:
|
|||||||
MOVQ R10, 176(SP)
|
MOVQ R10, 176(SP)
|
||||||
|
|
||||||
// save m->scratch
|
// save m->scratch
|
||||||
LEAQ m_scratch(BP), R11
|
LEAQ (m_mOS+mOS_scratch)(BP), R11
|
||||||
MOVQ 0(R11), R10
|
MOVQ 0(R11), R10
|
||||||
MOVQ R10, 112(SP)
|
MOVQ R10, 112(SP)
|
||||||
MOVQ 8(R11), R10
|
MOVQ 8(R11), R10
|
||||||
@ -211,7 +211,7 @@ allgood:
|
|||||||
MOVQ R10, 152(SP)
|
MOVQ R10, 152(SP)
|
||||||
|
|
||||||
// save errno, it might be EINTR; stuff we do here might reset it.
|
// save errno, it might be EINTR; stuff we do here might reset it.
|
||||||
MOVQ m_perrno(BP), R10
|
MOVQ (m_mOS+mOS_perrno)(BP), R10
|
||||||
MOVL 0(R10), R10
|
MOVL 0(R10), R10
|
||||||
MOVQ R10, 160(SP)
|
MOVQ R10, 160(SP)
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ allgood:
|
|||||||
MOVQ R10, libcall_r2(R11)
|
MOVQ R10, libcall_r2(R11)
|
||||||
|
|
||||||
// restore scratch
|
// restore scratch
|
||||||
LEAQ m_scratch(BP), R11
|
LEAQ (m_mOS+mOS_scratch)(BP), R11
|
||||||
MOVQ 112(SP), R10
|
MOVQ 112(SP), R10
|
||||||
MOVQ R10, 0(R11)
|
MOVQ R10, 0(R11)
|
||||||
MOVQ 120(SP), R10
|
MOVQ 120(SP), R10
|
||||||
@ -259,7 +259,7 @@ allgood:
|
|||||||
MOVQ R10, 40(R11)
|
MOVQ R10, 40(R11)
|
||||||
|
|
||||||
// restore errno
|
// restore errno
|
||||||
MOVQ m_perrno(BP), R11
|
MOVQ (m_mOS+mOS_perrno)(BP), R11
|
||||||
MOVQ 160(SP), R10
|
MOVQ 160(SP), R10
|
||||||
MOVL R10, 0(R11)
|
MOVL R10, 0(R11)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user