Remove one of the many lookup variants.
Change-Id: I4095aa030da4227540badd6724bbf50b728fbe93
Reviewed-on: https://go-review.googlesource.com/38990
Reviewed-by: Dave Cheney <dave@cheney.net>
case AMEM:
Fatalf("hashfor with AMEM type")
case AINTER:
- sym = Pkglookup("interhash", Runtimepkg)
+ sym = Runtimepkg.Lookup("interhash")
case ANILINTER:
- sym = Pkglookup("nilinterhash", Runtimepkg)
+ sym = Runtimepkg.Lookup("nilinterhash")
case ASTRING:
- sym = Pkglookup("strhash", Runtimepkg)
+ sym = Runtimepkg.Lookup("strhash")
case AFLOAT32:
- sym = Pkglookup("f32hash", Runtimepkg)
+ sym = Runtimepkg.Lookup("f32hash")
case AFLOAT64:
- sym = Pkglookup("f64hash", Runtimepkg)
+ sym = Runtimepkg.Lookup("f64hash")
case ACPLX64:
- sym = Pkglookup("c64hash", Runtimepkg)
+ sym = Runtimepkg.Lookup("c64hash")
case ACPLX128:
- sym = Pkglookup("c128hash", Runtimepkg)
+ sym = Runtimepkg.Lookup("c128hash")
default:
sym = typesymprefix(".hash", t)
}
spkg = makepartialcall_gopkg
}
- sym := Pkglookup(p, spkg)
+ sym := spkg.Lookup(p)
if sym.Uniq() {
return sym.Def
func popdcl() {
d := dclstack
for ; d != nil && d.Name != ""; d = d.Link {
- s := Pkglookup(d.Name, d.Pkg)
+ s := d.Pkg.Lookup(d.Name)
lno := s.Lastlineno
dcopy(s, d)
d.Lastlineno = lno
for d := dclstack; d != nil; d = d.Link {
fmt.Printf("%6d %p", i, d)
if d.Name != "" {
- fmt.Printf(" '%s' %v\n", d.Name, Pkglookup(d.Name, d.Pkg))
+ fmt.Printf(" '%s' %v\n", d.Name, d.Pkg.Lookup(d.Name))
} else {
fmt.Printf(" ---\n")
}
n = newname(lookup(name))
} else if s.Pkg == builtinpkg {
// The name of embedded builtins belongs to pkg.
- n = newname(Pkglookup(name, pkg))
+ n = newname(pkg.Lookup(name))
} else {
- n = newname(Pkglookup(name, s.Pkg))
+ n = newname(s.Pkg.Lookup(name))
}
n = nod(ODCLFIELD, n, oldname(s))
n.Embedded = 1
spkg = methodsym_toppkg
}
- s = Pkglookup(p, spkg)
+ s = spkg.Lookup(p)
return s
p = fmt.Sprintf("%v.%v", tsym, s)
}
- s = Pkglookup(p, tsym.Pkg)
+ s = tsym.Pkg.Lookup(p)
return s
}
)
func Sysfunc(name string) *obj.LSym {
- return Linksym(Pkglookup(name, Runtimepkg))
+ return Linksym(Runtimepkg.Lookup(name))
}
// addrescapes tags node n as having had its address taken
typs := runtimeTypes()
for _, d := range runtimeDecls {
- sym := Pkglookup(d.name, Runtimepkg)
+ sym := Runtimepkg.Lookup(d.name)
typ := typs[d.typ]
switch d.tag {
case funcTag:
externdcl = tmp
if zerosize > 0 {
- zero := Pkglookup("zero", mappkg)
+ zero := mappkg.Lookup("zero")
ggloblsym(zero, int32(zerosize), obj.DUPOK|obj.RODATA)
}
func slicebytes(nam *Node, s string, len int) {
slicebytes_gen++
symname := fmt.Sprintf(".gobytes.%d", slicebytes_gen)
- sym := Pkglookup(symname, localpkg)
+ sym := localpkg.Lookup(symname)
sym.Def = newname(sym)
off := dsname(sym, 0, s)
sizeofAlg := 2 * Widthptr
if dcommontype_algarray == nil {
- dcommontype_algarray = Pkglookup("algarray", Runtimepkg)
+ dcommontype_algarray = Runtimepkg.Lookup("algarray")
}
dowidth(t)
alg := algtype(t)
name = "noalg." + name
}
- return Pkglookup(name, typepkg)
+ return typepkg.Lookup(name)
}
// tracksym returns the symbol for tracking use of field/method f, assumed
// to be a member of struct/interface type t.
func tracksym(t *Type, f *Field) *Sym {
- return Pkglookup(t.ShortString()+"."+f.Sym.Name, trackpkg)
+ return trackpkg.Lookup(t.ShortString() + "." + f.Sym.Name)
}
func typesymprefix(prefix string, t *Type) *Sym {
p := prefix + "." + t.ShortString()
- s := Pkglookup(p, typepkg)
+ s := typepkg.Lookup(p)
//print("algsym: %s -> %+S\n", p, s);
if t == nil || (t.IsPtr() && t.Elem() == nil) || t.IsUntyped() || !itype.IsInterface() || itype.IsEmptyInterface() {
Fatalf("itabname(%v, %v)", t, itype)
}
- s := Pkglookup(t.ShortString()+","+itype.ShortString(), itabpkg)
+ s := itabpkg.Lookup(t.ShortString() + "," + itype.ShortString())
if s.Def == nil {
n := newname(s)
n.Type = Types[TUINT8]
// method functions. None are allocated on heap, so we can use obj.NOPTR.
ggloblsym(i.sym, int32(o), int16(obj.DUPOK|obj.NOPTR))
- ilink := Pkglookup(i.t.ShortString()+","+i.itype.ShortString(), itablinkpkg)
+ ilink := itablinkpkg.Lookup(i.t.ShortString() + "," + i.itype.ShortString())
dsymptr(ilink, 0, i.sym, 0)
ggloblsym(ilink, int32(Widthptr), int16(obj.DUPOK|obj.RODATA))
}
// we use one algorithm table for all AMEM types of a given size
p := fmt.Sprintf(".alg%d", t.Width)
- s = Pkglookup(p, typepkg)
+ s = typepkg.Lookup(p)
if s.AlgGen() {
return s
// make hash closure
p = fmt.Sprintf(".hashfunc%d", t.Width)
- hashfunc = Pkglookup(p, typepkg)
+ hashfunc = typepkg.Lookup(p)
ot := 0
- ot = dsymptr(hashfunc, ot, Pkglookup("memhash_varlen", Runtimepkg), 0)
+ ot = dsymptr(hashfunc, ot, Runtimepkg.Lookup("memhash_varlen"), 0)
ot = duintxx(hashfunc, ot, uint64(t.Width), Widthptr) // size encoded in closure
ggloblsym(hashfunc, int32(ot), obj.DUPOK|obj.RODATA)
// make equality closure
p = fmt.Sprintf(".eqfunc%d", t.Width)
- eqfunc = Pkglookup(p, typepkg)
+ eqfunc = typepkg.Lookup(p)
ot = 0
- ot = dsymptr(eqfunc, ot, Pkglookup("memequal_varlen", Runtimepkg), 0)
+ ot = dsymptr(eqfunc, ot, Runtimepkg.Lookup("memequal_varlen"), 0)
ot = duintxx(eqfunc, ot, uint64(t.Width), Widthptr)
ggloblsym(eqfunc, int32(ot), obj.DUPOK|obj.RODATA)
} else {
fillptrmask(t, ptrmask)
p := fmt.Sprintf("gcbits.%x", ptrmask)
- sym := Pkglookup(p, Runtimepkg)
+ sym := Runtimepkg.Lookup(p)
if !sym.Uniq() {
sym.SetUniq(true)
for i, x := range ptrmask {
if zerosize < size {
zerosize = size
}
- s := Pkglookup("zero", mappkg)
+ s := mappkg.Lookup("zero")
if s.Def == nil {
x := newname(s)
x.Type = Types[TUINT8]
return pkg.Lookup(str)
}
-func Pkglookup(name string, pkg *Pkg) *Sym {
- return pkg.Lookup(name)
-}
-
func restrictlookup(name string, pkg *Pkg) *Sym {
if !exportname(name) && pkg != localpkg {
yyerror("cannot refer to unexported name %s.%s", pkg.Name, name)
}
- return Pkglookup(name, pkg)
+ return pkg.Lookup(name)
}
// find all the exported symbols in package opkg
}
func syslook(name string) *Node {
- s := Pkglookup(name, Runtimepkg)
+ s := Runtimepkg.Lookup(name)
if s == nil || s.Def == nil {
Fatalf("syslook: can't find runtime.%s", name)
}
}
func hashmem(t *Type) *Node {
- sym := Pkglookup("memhash", Runtimepkg)
+ sym := Runtimepkg.Lookup("memhash")
n := newname(sym)
n.Class = PFUNC
if int(etype) >= len(Types) {
Fatalf("lexinit: %s bad etype", s.name)
}
- s2 := Pkglookup(s.name, builtinpkg)
+ s2 := builtinpkg.Lookup(s.name)
t := Types[etype]
if t == nil {
t = typ(etype)
for _, s := range builtinFuncs {
// TODO(marvin): Fix Node.EType type union.
- s2 := Pkglookup(s.name, builtinpkg)
+ s2 := builtinpkg.Lookup(s.name)
s2.Def = newname(s2)
s2.Def.Etype = EType(s.op)
}
for _, s := range unsafeFuncs {
- s2 := Pkglookup(s.name, unsafepkg)
+ s2 := unsafepkg.Lookup(s.name)
s2.Def = newname(s2)
s2.Def.Etype = EType(s.op)
}
idealbool = typ(TBOOL)
Types[TANY] = typ(TANY)
- s := Pkglookup("true", builtinpkg)
+ s := builtinpkg.Lookup("true")
s.Def = nodbool(true)
s.Def.Sym = lookup("true")
s.Def.Name = new(Name)
s.Def.Type = idealbool
- s = Pkglookup("false", builtinpkg)
+ s = builtinpkg.Lookup("false")
s.Def = nodbool(false)
s.Def.Sym = lookup("false")
s.Def.Name = new(Name)
s.Def.Type = Types[TBLANK]
nblank = s.Def
- s = Pkglookup("_", builtinpkg)
+ s = builtinpkg.Lookup("_")
s.Block = -100
s.Def = newname(s)
Types[TBLANK] = typ(TBLANK)
s.Def.Type = Types[TBLANK]
Types[TNIL] = typ(TNIL)
- s = Pkglookup("nil", builtinpkg)
+ s = builtinpkg.Lookup("nil")
var v Val
v.U = new(NilVal)
s.Def = nodlit(v)
s.Def.Sym = s
s.Def.Name = new(Name)
- s = Pkglookup("iota", builtinpkg)
+ s = builtinpkg.Lookup("iota")
s.Def = nod(OIOTA, nil, nil)
s.Def.Sym = s
s.Def.Name = new(Name)
t := typ(TUNSAFEPTR)
Types[TUNSAFEPTR] = t
- t.Sym = Pkglookup("Pointer", unsafepkg)
+ t.Sym = unsafepkg.Lookup("Pointer")
t.Sym.Def = typenod(t)
t.Sym.Def.Name = new(Name)
dowidth(Types[TUNSAFEPTR])
func lexinit1() {
// error type
- s := Pkglookup("error", builtinpkg)
+ s := builtinpkg.Lookup("error")
errortype = makeErrorInterface()
errortype.Sym = s
// TODO: If we can prove that it's safe to set errortype.Orig here
// type aliases, albeit at the cost of having to deal with it everywhere).
// byte alias
- s = Pkglookup("byte", builtinpkg)
+ s = builtinpkg.Lookup("byte")
bytetype = typ(TUINT8)
bytetype.Sym = s
s.Def = typenod(bytetype)
s.Def.Name = new(Name)
// rune alias
- s = Pkglookup("rune", builtinpkg)
+ s = builtinpkg.Lookup("rune")
runetype = typ(TINT32)
runetype.Sym = s
s.Def = typenod(runetype)
// backend-dependent builtin types (e.g. int).
for _, s := range typedefs {
- s1 := Pkglookup(s.name, builtinpkg)
+ s1 := builtinpkg.Lookup(s.name)
sameas := s.sameas32
if *s.width == 8 {
}
if staticbytes == nil {
- staticbytes = newname(Pkglookup("staticbytes", Runtimepkg))
+ staticbytes = newname(Runtimepkg.Lookup("staticbytes"))
staticbytes.Class = PEXTERN
staticbytes.Type = typArray(Types[TUINT8], 256)
- zerobase = newname(Pkglookup("zerobase", Runtimepkg))
+ zerobase = newname(Runtimepkg.Lookup("zerobase"))
zerobase.Class = PEXTERN
zerobase.Type = Types[TUINTPTR]
}