[dev.link] cmd/{compile,link}: remove pcdata tables from pclntab_old

Move the pctables out of pclntab_old. Creates a new generator symbol,
runtime.pctab, which holds all the deduplicated pctables. Also, tightens
up some of the types in runtime.

Darwin, cmd/compile statistics:

alloc/op
Pclntab_GC                   26.4MB ± 0%    13.8MB ± 0%
allocs/op
Pclntab_GC                    89.9k ± 0%     86.4k ± 0%
liveB
Pclntab_GC                    25.5M ± 0%     24.2M ± 0%

No significant change in binary size.

Change-Id: I1560fd4421f8a210f8d4b508fbc54e1780e338f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/248332
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Jeremy Faller 2020-08-12 19:26:53 -04:00
parent 5387cdcb24
commit 26407b2212
8 changed files with 136 additions and 72 deletions

View file

@ -336,6 +336,15 @@ func (sb *SymbolBuilder) Addstring(str string) int64 {
return r
}
func (sb *SymbolBuilder) SetBytesAt(off int64, b []byte) int64 {
datLen := int64(len(b))
if off+datLen > int64(len(sb.data)) {
panic("attempt to write past end of buffer")
}
copy(sb.data[off:off+datLen], b)
return off + datLen
}
func (sb *SymbolBuilder) addSymRef(tgt Sym, add int64, typ objabi.RelocType, rsize int) int64 {
if sb.kind == 0 {
sb.kind = sym.SDATA