mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/link: small cleanup of loader ocache
Remove references to the loader.Loader's "ocache" field, which is no longer being used the way it was. Add in a new field for object index to the oReader type. Change-Id: Icae6c54dbbdbbfa63ab9de3e4dc09e10abd57ee3 Reviewed-on: https://go-review.googlesource.com/c/go/+/222063 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
ef44bd8413
commit
4a6c1caae2
1 changed files with 5 additions and 5 deletions
|
|
@ -61,6 +61,7 @@ type oReader struct {
|
||||||
pkgprefix string
|
pkgprefix string
|
||||||
syms []Sym // Sym's global index, indexed by local index
|
syms []Sym // Sym's global index, indexed by local index
|
||||||
ndef int // cache goobj2.Reader.NSym()
|
ndef int // cache goobj2.Reader.NSym()
|
||||||
|
objidx uint32 // index of this reader in the objs slice
|
||||||
}
|
}
|
||||||
|
|
||||||
type objIdx struct {
|
type objIdx struct {
|
||||||
|
|
@ -152,7 +153,6 @@ type Loader struct {
|
||||||
objs []objIdx // sorted by start index (i.e. objIdx.i)
|
objs []objIdx // sorted by start index (i.e. objIdx.i)
|
||||||
extStart Sym // from this index on, the symbols are externally defined
|
extStart Sym // from this index on, the symbols are externally defined
|
||||||
builtinSyms []Sym // global index of builtin symbols
|
builtinSyms []Sym // global index of builtin symbols
|
||||||
ocache int // index (into 'objs') of most recent lookup
|
|
||||||
|
|
||||||
objSyms []objSym // global index mapping to local index
|
objSyms []objSym // global index mapping to local index
|
||||||
|
|
||||||
|
|
@ -1580,7 +1580,7 @@ func (l *Loader) Preload(syms *sym.Symbols, f *bio.Reader, lib *sym.Library, uni
|
||||||
pkgprefix := objabi.PathToPrefix(lib.Pkg) + "."
|
pkgprefix := objabi.PathToPrefix(lib.Pkg) + "."
|
||||||
ndef := r.NSym()
|
ndef := r.NSym()
|
||||||
nnonpkgdef := r.NNonpkgdef()
|
nnonpkgdef := r.NNonpkgdef()
|
||||||
or := &oReader{r, unit, localSymVersion, r.Flags(), pkgprefix, make([]Sym, ndef+nnonpkgdef+r.NNonpkgref()), ndef}
|
or := &oReader{r, unit, localSymVersion, r.Flags(), pkgprefix, make([]Sym, ndef+nnonpkgdef+r.NNonpkgref()), ndef, uint32(len(l.objs))}
|
||||||
|
|
||||||
// Autolib
|
// Autolib
|
||||||
lib.ImportStrings = append(lib.ImportStrings, r.Autolib()...)
|
lib.ImportStrings = append(lib.ImportStrings, r.Autolib()...)
|
||||||
|
|
@ -2005,7 +2005,7 @@ func (l *Loader) cloneToExternal(symIdx Sym) {
|
||||||
pp.kind = skind
|
pp.kind = skind
|
||||||
pp.ver = sver
|
pp.ver = sver
|
||||||
pp.size = int64(osym.Siz)
|
pp.size = int64(osym.Siz)
|
||||||
pp.objidx = uint32(l.ocache)
|
pp.objidx = r.objidx
|
||||||
|
|
||||||
// If this is a def, then copy the guts. We expect this case
|
// If this is a def, then copy the guts. We expect this case
|
||||||
// to be very rare (one case it may come up is with -X).
|
// to be very rare (one case it may come up is with -X).
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue