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
This commit is contained in:
Ian Lance Taylor 2016-11-18 17:48:29 +00:00
parent 70e73d3c42
commit 092dd2bc33
4 changed files with 243 additions and 269 deletions

View file

@ -1,4 +1,4 @@
fc4ca600b2fc6de81fd3c4014542d6a50593db1a bf4762823c4543229867436399be3ae30b4d13bb
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.

View file

@ -550,9 +550,6 @@ const (
_MaxGomaxprocs = 1 << 8 _MaxGomaxprocs = 1 << 8
) )
/*
Commented out for gccgo for now.
type schedt struct { type schedt struct {
// accessed atomically. keep at top to ensure alignment on 32-bit systems. // accessed atomically. keep at top to ensure alignment on 32-bit systems.
goidgen uint64 goidgen uint64
@ -578,18 +575,17 @@ type schedt struct {
runqsize int32 runqsize int32
// Global cache of dead G's. // Global cache of dead G's.
gflock mutex gflock mutex
gfreeStack *g gfree *g
gfreeNoStack *g ngfree int32
ngfree int32
// Central cache of sudog structs. // Central cache of sudog structs.
sudoglock mutex sudoglock mutex
sudogcache *sudog sudogcache *sudog
// Central pool of available defer structs of different sizes. // Central pool of available defer structs.
deferlock mutex deferlock mutex
deferpool [5]*_defer deferpool *_defer
gcwaiting uint32 // gc is waiting to run gcwaiting uint32 // gc is waiting to run
stopwait int32 stopwait int32
@ -608,7 +604,6 @@ type schedt struct {
procresizetime int64 // nanotime() of last change to gomaxprocs procresizetime int64 // nanotime() of last change to gomaxprocs
totaltime int64 // ∫gomaxprocs dt up to procresizetime totaltime int64 // ∫gomaxprocs dt up to procresizetime
} }
*/
// The m.locked word holds two pieces of state counting active calls to LockOSThread/lockOSThread. // 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. // The low bit (LockExternal) is a boolean reporting whether any LockOSThread call is active.
@ -772,8 +767,10 @@ var (
ncpu int32 ncpu int32
// forcegc forcegcstate // forcegc forcegcstate
// sched schedt
sched schedt
// newprocs int32 // newprocs int32
// Information about what cpu features are available. // Information about what cpu features are available.

View file

@ -520,3 +520,9 @@ func dumpregs(*_siginfo_t, unsafe.Pointer)
// Temporary for gccgo until we port panic.go. // Temporary for gccgo until we port panic.go.
func startpanic() func startpanic()
// Temporary for gccgo until we port proc.go.
//go:linkname getsched runtime.getsched
func getsched() *schedt {
return &sched
}

File diff suppressed because it is too large Load diff