mirror of
https://github.com/golang/go
synced 2024-11-19 07:44:49 -07:00
runtime: allocate mp.cgocallers earlier
Fixes #15061. Change-Id: I71f69f398d1c5f3a884bbd044786f1a5600d0fae Reviewed-on: https://go-review.googlesource.com/21398 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
5cab01698a
commit
59fc42b230
@ -113,11 +113,6 @@ func cgocall(fn, arg unsafe.Pointer) int32 {
|
|||||||
mp.ncgo++
|
mp.ncgo++
|
||||||
defer endcgo(mp)
|
defer endcgo(mp)
|
||||||
|
|
||||||
// Allocate memory to hold a cgo traceback if the cgo call crashes.
|
|
||||||
if mp.cgoCallers == nil {
|
|
||||||
mp.cgoCallers = new(cgoCallers)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset traceback.
|
// Reset traceback.
|
||||||
mp.cgoCallers[0] = 0
|
mp.cgoCallers[0] = 0
|
||||||
|
|
||||||
|
@ -510,6 +510,11 @@ func mcommoninit(mp *m) {
|
|||||||
// so we need to publish it safely.
|
// so we need to publish it safely.
|
||||||
atomicstorep(unsafe.Pointer(&allm), unsafe.Pointer(mp))
|
atomicstorep(unsafe.Pointer(&allm), unsafe.Pointer(mp))
|
||||||
unlock(&sched.lock)
|
unlock(&sched.lock)
|
||||||
|
|
||||||
|
// Allocate memory to hold a cgo traceback if the cgo call crashes.
|
||||||
|
if iscgo || GOOS == "solaris" || GOOS == "windows" {
|
||||||
|
mp.cgoCallers = new(cgoCallers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark gp ready to run.
|
// Mark gp ready to run.
|
||||||
|
Loading…
Reference in New Issue
Block a user