From 092dd2bc335d124bdcf6aa1a27ea3196e90cc1ba Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 18 Nov 2016 17:48:29 +0000 Subject: runtime: move schedt type and sched var from C to Go This doesn't change any actual code, it just starts using the Go definition of the schedt type and the sched variable rather than the C definitions. The schedt type is tweaked slightly for gccgo. We aren't going to release goroutine stacks, so we don't need separate gfreeStack and gfreeNostack lists. We only have one size of defer function, so we don't need a list of 5 different pools. Reviewed-on: https://go-review.googlesource.com/33364 From-SVN: r242600 --- libgo/go/runtime/runtime2.go | 21 +++++++++------------ libgo/go/runtime/stubs.go | 6 ++++++ 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'libgo/go') diff --git a/libgo/go/runtime/runtime2.go b/libgo/go/runtime/runtime2.go index f3bbb58..7a0cc43 100644 --- a/libgo/go/runtime/runtime2.go +++ b/libgo/go/runtime/runtime2.go @@ -550,9 +550,6 @@ const ( _MaxGomaxprocs = 1 << 8 ) -/* -Commented out for gccgo for now. - type schedt struct { // accessed atomically. keep at top to ensure alignment on 32-bit systems. goidgen uint64 @@ -578,18 +575,17 @@ type schedt struct { runqsize int32 // Global cache of dead G's. - gflock mutex - gfreeStack *g - gfreeNoStack *g - ngfree int32 + gflock mutex + gfree *g + ngfree int32 // Central cache of sudog structs. sudoglock mutex sudogcache *sudog - // Central pool of available defer structs of different sizes. + // Central pool of available defer structs. deferlock mutex - deferpool [5]*_defer + deferpool *_defer gcwaiting uint32 // gc is waiting to run stopwait int32 @@ -608,7 +604,6 @@ type schedt struct { procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime } -*/ // The m.locked word holds two pieces of state counting active calls to LockOSThread/lockOSThread. // The low bit (LockExternal) is a boolean reporting whether any LockOSThread call is active. @@ -772,8 +767,10 @@ var ( ncpu int32 -// forcegc forcegcstate -// sched schedt + // forcegc forcegcstate + + sched schedt + // newprocs int32 // Information about what cpu features are available. diff --git a/libgo/go/runtime/stubs.go b/libgo/go/runtime/stubs.go index 8d90cd6..b01bc7c 100644 --- a/libgo/go/runtime/stubs.go +++ b/libgo/go/runtime/stubs.go @@ -520,3 +520,9 @@ func dumpregs(*_siginfo_t, unsafe.Pointer) // Temporary for gccgo until we port panic.go. func startpanic() + +// Temporary for gccgo until we port proc.go. +//go:linkname getsched runtime.getsched +func getsched() *schedt { + return &sched +} -- cgit v1.1