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>
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)
}