1
0
mirror of https://github.com/golang/go synced 2024-11-05 14:46:11 -07:00

cmd/internal/gc: sync nowritebarrier checks and write barrier insertion

Change-Id: I348223d0336e28d95b8e68d7653aa547acc7c9c3
Reviewed-on: https://go-review.googlesource.com/10262
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Russ Cox 2015-05-19 15:15:52 -04:00
parent c735064cde
commit 9c9e36b340
2 changed files with 9 additions and 0 deletions

View File

@ -785,6 +785,9 @@ abop: // asymmetric binary
var sys_wbptr *Node var sys_wbptr *Node
func cgen_wbptr(n, res *Node) { func cgen_wbptr(n, res *Node) {
if Curfn != nil && Curfn.Func.Nowritebarrier {
Yyerror("write barrier prohibited")
}
if Debug_wb > 0 { if Debug_wb > 0 {
Warn("write barrier") Warn("write barrier")
} }
@ -828,6 +831,9 @@ func cgen_wbptr(n, res *Node) {
} }
func cgen_wbfat(n, res *Node) { func cgen_wbfat(n, res *Node) {
if Curfn != nil && Curfn.Func.Nowritebarrier {
Yyerror("write barrier prohibited")
}
if Debug_wb > 0 { if Debug_wb > 0 {
Warn("write barrier") Warn("write barrier")
} }

View File

@ -2217,6 +2217,9 @@ func applywritebarrier(n *Node, init **NodeList) *Node {
return n return n
} }
// Use slow path always for race detector. // Use slow path always for race detector.
if Curfn != nil && Curfn.Func.Nowritebarrier {
Yyerror("write barrier prohibited")
}
if Debug_wb > 0 { if Debug_wb > 0 {
Warnl(int(n.Lineno), "write barrier") Warnl(int(n.Lineno), "write barrier")
} }