mirror of
https://github.com/golang/go
synced 2024-11-12 09:20:22 -07:00
cmd/internal/gc: fix write barrier fast path on RISC architectures
They have to read the boolean into a register first and then do the comparison. Fixes #10598. Change-Id: I2b808837a8c6393e1e0778296b6592aaab2b04bf Signed-off-by: Shenghou Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/9453 Reviewed-by: Dave Cheney <dave@cheney.net>
This commit is contained in:
parent
e7dd28891e
commit
2b7505e28a
@ -803,7 +803,19 @@ func cgen_wbptr(n, res *Node) {
|
||||
Cgenr(n, &src, nil)
|
||||
}
|
||||
|
||||
Thearch.Gins(Thearch.Optoas(OCMP, Types[TUINT8]), syslook("writeBarrierEnabled", 0), Nodintconst(0))
|
||||
wbEnabled := syslook("writeBarrierEnabled", 0)
|
||||
switch Ctxt.Arch.Thechar {
|
||||
default:
|
||||
Fatal("cgen_wbptr: unknown architecture")
|
||||
case '5', '7', '9':
|
||||
var tmp Node
|
||||
Regalloc(&tmp, Types[TUINT8], nil)
|
||||
Thearch.Gmove(wbEnabled, &tmp)
|
||||
Thearch.Gins(Thearch.Optoas(OCMP, Types[TUINT8]), &tmp, Nodintconst(0))
|
||||
Regfree(&tmp)
|
||||
case '6', '8':
|
||||
Thearch.Gins(Thearch.Optoas(OCMP, Types[TUINT8]), wbEnabled, Nodintconst(0))
|
||||
}
|
||||
pbr := Gbranch(Thearch.Optoas(ONE, Types[TUINT8]), nil, -1)
|
||||
Thearch.Gins(Thearch.Optoas(OAS, Types[Tptr]), &src, &dst)
|
||||
pjmp := Gbranch(obj.AJMP, nil, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user