mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: special case nowritebarrierrec for allocm
allocm is a very unusual function: it is specifically designed to allocate in contexts where m.p is nil by temporarily taking over a P. Since allocm is used in many contexts where it would make sense to use nowritebarrierrec, this commit teaches the nowritebarrierrec analysis to stop at allocm. Updates #10600. Change-Id: I8499629461d4fe25712d861720dfe438df7ada9b Reviewed-on: https://go-review.googlesource.com/17005 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
c84ae1c499
commit
402e37d4a9
2 changed files with 6 additions and 0 deletions
|
|
@ -1182,6 +1182,9 @@ type cgothreadstart struct {
|
|||
// Allocate a new m unassociated with any thread.
|
||||
// Can use p for allocation context if needed.
|
||||
// fn is recorded as the new m's m.mstartfn.
|
||||
//
|
||||
// This function it known to the compiler to inhibit the
|
||||
// go:nowritebarrierrec annotation because it uses P for allocation.
|
||||
func allocm(_p_ *p, fn func()) *m {
|
||||
_g_ := getg()
|
||||
_g_.m.locks++ // disable GC because it can be called from sysmon
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue