Src: 
https://github.com/golang/go/blob/1d4b0b6236febe0646d8d7b0103da5d169f185cc/src/cmd/compile/internal/reflectdata/reflect.go#L1568-L1594

```
func dgcptrmask(t *types.Type, write bool) *obj.LSym {
    ...
    ptrmask = make([]byte, n)
    fillptrmask(t, ptrmask)
    ...
}

func fillptrmask(t *types.Type, ptrmask []byte) {
    for i := range ptrmask {
        ptrmask[i] = 0
    }
    ...
}
```

The only caller of fillptrmask is dgcptrmask, so no need to initialize the 
ptrmask again.
And from the objdump result of the compiler binary it's not eliminated by 
DSE either.

```
➜  linux_amd64 go tool objdump -S ./compile| grep -A 30 "TEXT 
cmd/compile/internal/reflectdata.fillptrmask"
TEXT cmd/compile/internal/reflectdata.fillptrmask(SB) 
cmd/compile/internal/reflectdata/reflect.go
  0x719f40              493b6610                CMPQ SP, 0x10(R14)
  0x719f44              0f8681010000            JBE 0x71a0cb
  0x719f4a              55                      PUSHQ BP
  0x719f4b              4889e5                  MOVQ SP, BP
  0x719f4e              4883ec68                SUBQ $0x68, SP
  0x719f52              48898c2488000000        MOVQ CX, 0x88(SP)
  0x719f5a              48899c2480000000        MOVQ BX, 0x80(SP)
  0x719f62              4889442460              MOVQ AX, 0x60(SP)
  0x719f67              4885c9                  TESTQ CX, CX
  0x719f6a              7410                    JE 0x719f7c
  0x719f6c              4889d8                  MOVQ BX, AX
  0x719f6f              4889cb                  MOVQ CX, BX
  0x719f72              e8693ad6ff              CALL 
runtime.memclrNoHeapPointers(SB)
  0x719f77              488b442460              MOVQ 0x60(SP), AX
  0x719f7c              0f1f4000                NOPL 0(AX)
  0x719f80              e81b74ebff              CALL 
cmd/compile/internal/types.PtrDataSize(SB)
  0x719f85              4885c0                  TESTQ AX, AX
  0x719f88              0f8e99000000            JLE 0x71a027
  0x719f8e              488b942488000000        MOVQ 0x88(SP), DX
  0x719f96              4889d6                  MOVQ DX, SI
  0x719f99              c1e203                  SHLL $0x3, DX
  0x719f9c              8954243c                MOVL DX, 0x3c(SP)
  0x719fa0              8d7a1f                  LEAL 0x1f(DX), DI
  0x719fa3              c1ff1f                  SARL $0x1f, DI
  0x719fa6              c1ef1b                  SHRL $0x1b, DI
  0x719fa9              8d3cf7                  LEAL 0(DI)(SI*8), DI
  0x719fac              8d7f1f                  LEAL 0x1f(DI), DI
  0x719faf              c1ff05                  SARL $0x5, DI
  0x719fb2              4863cf                  MOVSXD DI, CX
  0x719fb5              48894c2450              MOVQ CX, 0x50(SP)
```





-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6590d17a-146d-4961-8644-0e6c8bd49632n%40googlegroups.com.

Reply via email to