aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime/time.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2017-05-11 20:55:41 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-05-11 20:55:41 +0000
commit3619ab8bd4ed2ceaeb202ccaa59341c863679725 (patch)
tree1836ce9be27e6473305ed505646f84c09ff1a621 /libgo/go/runtime/time.go
parent628c06d6bc47c3a1487ecd41eb12d13a968d4480 (diff)
downloadgcc-3619ab8bd4ed2ceaeb202ccaa59341c863679725.zip
gcc-3619ab8bd4ed2ceaeb202ccaa59341c863679725.tar.gz
gcc-3619ab8bd4ed2ceaeb202ccaa59341c863679725.tar.bz2
runtime: fix isSystemGoroutine for gccgo
The gc toolchain decides whether a goroutine is a system goroutine by comparing startpc to a list of saved special PCs. In gccgo that approach does not work as startpc is often a thunk that invokes the real function with arguments, so the thunk address never matches the saved special PCs. This patch fixes gccgo's understanding of system goroutines. Since there are only a limited number of them, we simply change each one to mark itself as special. This fixes stack dumps and functions like runtime.NumGoroutine to behave more like gc. It also fixes the goprint test in the gc testsuite. Reviewed-on: https://go-review.googlesource.com/43156 From-SVN: r247931
Diffstat (limited to 'libgo/go/runtime/time.go')
-rw-r--r--libgo/go/runtime/time.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/libgo/go/runtime/time.go b/libgo/go/runtime/time.go
index 604ccde..e85fc7a5 100644
--- a/libgo/go/runtime/time.go
+++ b/libgo/go/runtime/time.go
@@ -152,6 +152,8 @@ func deltimer(t *timer) bool {
// It sleeps until the next event in the timers heap.
// If addtimer inserts a new earlier event, it wakes timerproc early.
func timerproc() {
+ setSystemGoroutine()
+
timers.gp = getg()
for {
lock(&timers.lock)