mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: move typepkg to package types
Response to code review feedback on CL 40693. It is now only accessible by types.TypePkgLookup. Passes toolstash-check. Change-Id: I0c422c1a271f97467ae38de53af9dc33f4b31bdb Reviewed-on: https://go-review.googlesource.com/41304 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
0d50a49f5c
commit
24c52ee570
4 changed files with 12 additions and 9 deletions
|
|
@ -114,8 +114,6 @@ var racepkg *types.Pkg // package runtime/race
|
||||||
|
|
||||||
var msanpkg *types.Pkg // package runtime/msan
|
var msanpkg *types.Pkg // package runtime/msan
|
||||||
|
|
||||||
var typepkg *types.Pkg // fake package for runtime type info (headers)
|
|
||||||
|
|
||||||
var unsafepkg *types.Pkg // package unsafe
|
var unsafepkg *types.Pkg // package unsafe
|
||||||
|
|
||||||
var trackpkg *types.Pkg // fake package for field tracking
|
var trackpkg *types.Pkg // fake package for field tracking
|
||||||
|
|
|
||||||
|
|
@ -150,8 +150,6 @@ func Main(archInit func(*Arch)) {
|
||||||
trackpkg = types.NewPkg("go.track", "go.track")
|
trackpkg = types.NewPkg("go.track", "go.track")
|
||||||
trackpkg.Prefix = "go.track" // not go%2etrack
|
trackpkg.Prefix = "go.track" // not go%2etrack
|
||||||
|
|
||||||
typepkg = types.NewPkg("type", "type")
|
|
||||||
|
|
||||||
// pseudo-package used for map zero values
|
// pseudo-package used for map zero values
|
||||||
mappkg = types.NewPkg("go.map", "go.map")
|
mappkg = types.NewPkg("go.map", "go.map")
|
||||||
mappkg.Prefix = "go.map"
|
mappkg.Prefix = "go.map"
|
||||||
|
|
|
||||||
|
|
@ -908,7 +908,7 @@ func typesymname(t *types.Type) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func typesym(t *types.Type) *types.Sym {
|
func typesym(t *types.Type) *types.Sym {
|
||||||
return typepkg.Lookup(typesymname(t))
|
return types.TypePkgLookup(typesymname(t))
|
||||||
}
|
}
|
||||||
|
|
||||||
// tracksym returns the symbol for tracking use of field/method f, assumed
|
// tracksym returns the symbol for tracking use of field/method f, assumed
|
||||||
|
|
@ -919,7 +919,7 @@ func tracksym(t *types.Type, f *types.Field) *types.Sym {
|
||||||
|
|
||||||
func typesymprefix(prefix string, t *types.Type) *types.Sym {
|
func typesymprefix(prefix string, t *types.Type) *types.Sym {
|
||||||
p := prefix + "." + t.ShortString()
|
p := prefix + "." + t.ShortString()
|
||||||
s := typepkg.Lookup(p)
|
s := types.TypePkgLookup(p)
|
||||||
|
|
||||||
//print("algsym: %s -> %+S\n", p, s);
|
//print("algsym: %s -> %+S\n", p, s);
|
||||||
|
|
||||||
|
|
@ -1561,7 +1561,7 @@ func dalgsym(t *types.Type) *types.Sym {
|
||||||
// we use one algorithm table for all AMEM types of a given size
|
// we use one algorithm table for all AMEM types of a given size
|
||||||
p := fmt.Sprintf(".alg%d", t.Width)
|
p := fmt.Sprintf(".alg%d", t.Width)
|
||||||
|
|
||||||
s = typepkg.Lookup(p)
|
s = types.TypePkgLookup(p)
|
||||||
|
|
||||||
if s.AlgGen() {
|
if s.AlgGen() {
|
||||||
return s
|
return s
|
||||||
|
|
@ -1571,7 +1571,7 @@ func dalgsym(t *types.Type) *types.Sym {
|
||||||
// make hash closure
|
// make hash closure
|
||||||
p = fmt.Sprintf(".hashfunc%d", t.Width)
|
p = fmt.Sprintf(".hashfunc%d", t.Width)
|
||||||
|
|
||||||
hashfunc = typepkg.Lookup(p)
|
hashfunc = types.TypePkgLookup(p)
|
||||||
|
|
||||||
ot := 0
|
ot := 0
|
||||||
ot = dsymptr(hashfunc, ot, Runtimepkg.Lookup("memhash_varlen"), 0)
|
ot = dsymptr(hashfunc, ot, Runtimepkg.Lookup("memhash_varlen"), 0)
|
||||||
|
|
@ -1581,7 +1581,7 @@ func dalgsym(t *types.Type) *types.Sym {
|
||||||
// make equality closure
|
// make equality closure
|
||||||
p = fmt.Sprintf(".eqfunc%d", t.Width)
|
p = fmt.Sprintf(".eqfunc%d", t.Width)
|
||||||
|
|
||||||
eqfunc = typepkg.Lookup(p)
|
eqfunc = types.TypePkgLookup(p)
|
||||||
|
|
||||||
ot = 0
|
ot = 0
|
||||||
ot = dsymptr(eqfunc, ot, Runtimepkg.Lookup("memequal_varlen"), 0)
|
ot = dsymptr(eqfunc, ot, Runtimepkg.Lookup("memequal_varlen"), 0)
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,13 @@ var nopkg = &Pkg{
|
||||||
Syms: make(map[string]*Sym),
|
Syms: make(map[string]*Sym),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fake package for runtime type info (headers)
|
||||||
|
var typepkg = NewPkg("type", "type")
|
||||||
|
|
||||||
|
func TypePkgLookup(name string) *Sym {
|
||||||
|
return typepkg.Lookup(name)
|
||||||
|
}
|
||||||
|
|
||||||
func (pkg *Pkg) Lookup(name string) *Sym {
|
func (pkg *Pkg) Lookup(name string) *Sym {
|
||||||
s, _ := pkg.LookupOK(name)
|
s, _ := pkg.LookupOK(name)
|
||||||
return s
|
return s
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue