aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-11-18 17:48:29 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-11-18 17:48:29 +0000
commit092dd2bc335d124bdcf6aa1a27ea3196e90cc1ba (patch)
treefb1782f935ac669d4b7a6987b556622df8aef1a6 /libgo/go
parent70e73d3c4277fa602999b3e3c104a06024932c70 (diff)
downloadgcc-092dd2bc335d124bdcf6aa1a27ea3196e90cc1ba.zip
gcc-092dd2bc335d124bdcf6aa1a27ea3196e90cc1ba.tar.gz
gcc-092dd2bc335d124bdcf6aa1a27ea3196e90cc1ba.tar.bz2
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
Diffstat (limited to 'libgo/go')
-rw-r--r--libgo/go/runtime/runtime2.go21
-rw-r--r--libgo/go/runtime/stubs.go6
2 files changed, 15 insertions, 12 deletions
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
+}