Closed
Description
What version of Go are you using (go version
)?
tip (go version devel +47d2a4dafa Mon Feb 6 07:21:14 2017 +0000 darwin/amd64
)
For this code
type T struct {
p *int
}
var t T
func f() {
t = T{}
}
the compiler does not generate write barrier.
before f
. AS l(10) tc(1)
. . NAME-main.t u(1) a(true) l(7) x(0) class(PEXTERN) tc(1) assigned main.T
. . STRUCTLIT l(10) tc(1) main.T
. . . TYPE main.T u(1) a(true) l(3) x(0) class(PEXTERN) tc(1) type=main.T main.T main.T
after walk f
. EMPTY-init
. . AS u(2) l(10) tc(1)
. . . NAME-main.t u(1) a(true) l(7) x(0) class(PEXTERN) tc(1) assigned main.T
. EMPTY u(100) l(10) tc(1)
. . NAME-main.t u(1) a(true) l(7) x(0) class(PEXTERN) tc(1) assigned main.T
00000 (x.go:9) TEXT "".f(SB)
00001 (x.go:9) FUNCDATA $0, "".gcargs·0(SB)
00002 (x.go:9) FUNCDATA $1, "".gclocals·1(SB)
v8 00003 (x.go:10) MOVQ $0, "".t(SB)
b1 00004 (x.go:11) RET
But I believe it should have write barrier for the new hybrid barrier.
cc @aclements