[dev.link] cmd/link/internal/loader: speed up Loader.RelocVariant

Remove some extra sanity-checking code from the loader's RelocVariant
method, since it was yielding a slowdown of 1-2% linking kubernetes
hyperkube (once again a reminder that relocation processing is a very
performance-sensitive part of the linker).

Change-Id: Ifbc0662f3f96c5f54131103ce6f7439ecfb9b9dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/227477
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
Than McIntosh 2020-04-07 08:01:24 -04:00
parent c8d89ddb18
commit 9f6a35660d

View file

@ -2593,9 +2593,6 @@ func (l *Loader) SetRelocVariant(s Sym, ri int, v sym.RelocVariant) {
// RelocVariant returns the 'variant' property of a relocation on
// some specific symbol.
func (l *Loader) RelocVariant(s Sym, ri int) sym.RelocVariant {
if relocs := l.Relocs(s); ri >= relocs.Count() {
panic("invalid relocation ID")
}
return l.relocVariant[relocId{s, ri}]
}