Commit 9b638bf1 authored by Russ Cox's avatar Russ Cox

runtime: adjust dropm for write barriers

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/2347Reviewed-by: default avatarMinux Ma <minux@golang.org>
Reviewed-by: default avatarRick Hudson <rlh@golang.org>
parent 949dd102
...@@ -960,12 +960,13 @@ func dropm() { ...@@ -960,12 +960,13 @@ func dropm() {
unminit() unminit()
// Clear m and g, and return m to the extra list. // 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 mp := getg().m
setg(nil)
mnext := lockextra(true) mnext := lockextra(true)
mp.schedlink = mnext mp.schedlink = mnext
setg(nil)
unlockextra(mp) unlockextra(mp)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment