type T struct {
a, b, c, d int
}
func f(p *T) {
*p = T{1, 2, 3, 4}
}
The code for f is:
(tmp1.go:8) MOVQ "".statictmp_0(SB), AX
(tmp1.go:8) MOVQ "".statictmp_0+8(SB), CX
(tmp1.go:8) MOVQ "".statictmp_0+16(SB), DX
(tmp1.go:8) MOVQ "".statictmp_0+24(SB), BX
(tmp1.go:8) MOVQ "".p+8(FP), SI
(tmp1.go:8) MOVQ AX, (SI)
(tmp1.go:8) MOVQ CX, 8(SI)
(tmp1.go:8) MOVQ DX, 16(SI)
(tmp1.go:8) MOVQ BX, 24(SI)
That's kind of dumb to copy from a statictmp. Just use MOVQ $1, (SI) and so forth.
The code for
fis:That's kind of dumb to copy from a statictmp. Just use
MOVQ $1, (SI)and so forth.