Skip to content

Commit

Permalink
cmd/internal/gc: sync nowritebarrier checks and write barrier insertion
Browse files Browse the repository at this point in the history
Change-Id: I348223d0336e28d95b8e68d7653aa547acc7c9c3
Reviewed-on: https://go-review.googlesource.com/10262
Reviewed-by: Austin Clements <[email protected]>
  • Loading branch information
rsc committed May 19, 2015
1 parent c735064 commit 9c9e36b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cmd/internal/gc/cgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,9 @@ abop: // asymmetric binary
var sys_wbptr *Node

func cgen_wbptr(n, res *Node) {
if Curfn != nil && Curfn.Func.Nowritebarrier {
Yyerror("write barrier prohibited")
}
if Debug_wb > 0 {
Warn("write barrier")
}
Expand Down Expand Up @@ -828,6 +831,9 @@ func cgen_wbptr(n, res *Node) {
}

func cgen_wbfat(n, res *Node) {
if Curfn != nil && Curfn.Func.Nowritebarrier {
Yyerror("write barrier prohibited")
}
if Debug_wb > 0 {
Warn("write barrier")
}
Expand Down
3 changes: 3 additions & 0 deletions src/cmd/internal/gc/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,9 @@ func applywritebarrier(n *Node, init **NodeList) *Node {
return n
}
// Use slow path always for race detector.
if Curfn != nil && Curfn.Func.Nowritebarrier {
Yyerror("write barrier prohibited")
}
if Debug_wb > 0 {
Warnl(int(n.Lineno), "write barrier")
}
Expand Down

0 comments on commit 9c9e36b

Please sign in to comment.