]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: adjust dropm for write barriers
authorRuss Cox <rsc@golang.org>
Tue, 6 Jan 2015 18:56:21 +0000 (13:56 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 6 Jan 2015 22:23:14 +0000 (22:23 +0000)
The line 'mp.schedlink = mnext' has an implicit write barrier call,
which needs a valid g. Move it above the setg(nil).

Change-Id: If3e86c948e856e10032ad89f038bf569659300e0
Reviewed-on: https://go-review.googlesource.com/2347
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/proc1.go

index 6fcbd6946af621b75b80ffb62b659b04037d4e48..22ea7a9d279666a2fd671a7672e592c332e2a32e 100644 (file)
@@ -960,12 +960,13 @@ func dropm() {
        unminit()
 
        // Clear m and g, and return m to the extra list.
-       // After the call to setmg we can only call nosplit functions.
+       // After the call to setg we can only call nosplit functions
+       // with no pointer manipulation.
        mp := getg().m
-       setg(nil)
-
        mnext := lockextra(true)
        mp.schedlink = mnext
+
+       setg(nil)
        unlockextra(mp)
 }