Commit b34391e0 by Ian Lance Taylor

runtime: mark dropm and callees nowritebarrierrec

    
    The CgocallbackDone function calls dropm after it calls entersyscall,
    which means that dropm must not have any write barriers. Mark it
    accordingly.
    
    Reviewed-on: https://go-review.googlesource.com/46464

From-SVN: r249577
parent f384e12a
55b2b2dee55bd495a770347daaf858634057ecb0 c5aa42107d116c9121de447d214297c88dd9f5fa
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -32,6 +32,7 @@ func minit() { ...@@ -32,6 +32,7 @@ func minit() {
// Called from dropm to undo the effect of an minit. // Called from dropm to undo the effect of an minit.
//go:nosplit //go:nosplit
//go:nowritebarrierrec
func unminit() { func unminit() {
unminitSignals() unminitSignals()
} }
......
...@@ -1447,6 +1447,9 @@ func oneNewExtraM() { ...@@ -1447,6 +1447,9 @@ func oneNewExtraM() {
// in which dropm happens on each cgo call, is still correct too. // in which dropm happens on each cgo call, is still correct too.
// We may have to keep the current version on systems with cgo // We may have to keep the current version on systems with cgo
// but without pthreads, like Windows. // but without pthreads, like Windows.
//
// CgocallBackDone calls this after releasing p, so no write barriers.
//go:nowritebarrierrec
func dropm() { func dropm() {
// 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 setg we can only call nosplit functions // After the call to setg we can only call nosplit functions
...@@ -1492,6 +1495,7 @@ var extraMWaiters uint32 ...@@ -1492,6 +1495,7 @@ var extraMWaiters uint32
// return a nil list head if that's what it finds. If nilokay is false, // return a nil list head if that's what it finds. If nilokay is false,
// lockextra will keep waiting until the list head is no longer nil. // lockextra will keep waiting until the list head is no longer nil.
//go:nosplit //go:nosplit
//go:nowritebarrierrec
func lockextra(nilokay bool) *m { func lockextra(nilokay bool) *m {
const locked = 1 const locked = 1
...@@ -1524,6 +1528,7 @@ func lockextra(nilokay bool) *m { ...@@ -1524,6 +1528,7 @@ func lockextra(nilokay bool) *m {
} }
//go:nosplit //go:nosplit
//go:nowritebarrierrec
func unlockextra(mp *m) { func unlockextra(mp *m) {
atomic.Storeuintptr(&extram, uintptr(unsafe.Pointer(mp))) atomic.Storeuintptr(&extram, uintptr(unsafe.Pointer(mp)))
} }
......
...@@ -599,6 +599,7 @@ func minitSignalMask() { ...@@ -599,6 +599,7 @@ func minitSignalMask() {
// unminitSignals is called from dropm, via unminit, to undo the // unminitSignals is called from dropm, via unminit, to undo the
// effect of calling minit on a non-Go thread. // effect of calling minit on a non-Go thread.
//go:nosplit //go:nosplit
//go:nowritebarrierrec
func unminitSignals() { func unminitSignals() {
if getg().m.newSigstack { if getg().m.newSigstack {
signalstack(nil, 0) signalstack(nil, 0)
......
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