Commit 0e497971 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: update dalgsym to use obj.LSym

Passes toolstash-check.

Change-Id: I00a8200370d56772f604a099654f9d838c4f62e2
Reviewed-on: https://go-review.googlesource.com/41405
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent 2fe43cec
...@@ -788,7 +788,7 @@ func dcommontype(lsym *obj.LSym, ot int, t *types.Type) int { ...@@ -788,7 +788,7 @@ func dcommontype(lsym *obj.LSym, ot int, t *types.Type) int {
} }
dowidth(t) dowidth(t)
alg := algtype(t) alg := algtype(t)
var algsym *types.Sym var algsym *obj.LSym
if alg == ASPECIAL || alg == AMEM { if alg == ASPECIAL || alg == AMEM {
algsym = dalgsym(t) algsym = dalgsym(t)
} }
...@@ -879,7 +879,7 @@ func dcommontype(lsym *obj.LSym, ot int, t *types.Type) int { ...@@ -879,7 +879,7 @@ func dcommontype(lsym *obj.LSym, ot int, t *types.Type) int {
if algsym == nil { if algsym == nil {
ot = dsymptr(lsym, ot, algarray, int(alg)*sizeofAlg) ot = dsymptr(lsym, ot, algarray, int(alg)*sizeofAlg)
} else { } else {
ot = dsymptr(lsym, ot, algsym.Linksym(), 0) ot = dsymptr(lsym, ot, algsym, 0)
} }
ot = dsymptr(lsym, ot, gcsym, 0) // gcdata ot = dsymptr(lsym, ot, gcsym, 0) // gcdata
...@@ -1531,10 +1531,10 @@ func (a typesByString) Len() int { return len(a) } ...@@ -1531,10 +1531,10 @@ func (a typesByString) Len() int { return len(a) }
func (a typesByString) Less(i, j int) bool { return a[i].s < a[j].s } func (a typesByString) Less(i, j int) bool { return a[i].s < a[j].s }
func (a typesByString) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a typesByString) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func dalgsym(t *types.Type) *types.Sym { func dalgsym(t *types.Type) *obj.LSym {
var s *types.Sym var lsym *obj.LSym
var hashfunc *types.Sym var hashfunc *obj.LSym
var eqfunc *types.Sym var eqfunc *obj.LSym
// dalgsym is only called for a type that needs an algorithm table, // dalgsym is only called for a type that needs an algorithm table,
// which implies that the type is comparable (or else it would use ANOEQ). // which implies that the type is comparable (or else it would use ANOEQ).
...@@ -1543,10 +1543,10 @@ func dalgsym(t *types.Type) *types.Sym { ...@@ -1543,10 +1543,10 @@ 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 = types.TypePkgLookup(p) s := types.TypePkgLookup(p)
lsym = s.Linksym()
if s.AlgGen() { if s.AlgGen() {
return s return lsym
} }
s.SetAlgGen(true) s.SetAlgGen(true)
...@@ -1558,49 +1558,49 @@ func dalgsym(t *types.Type) *types.Sym { ...@@ -1558,49 +1558,49 @@ 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 = types.TypePkgLookup(p) hashfunc = types.TypePkgLookup(p).Linksym()
ot := 0 ot := 0
ot = dsymptr(hashfunc.Linksym(), ot, memhashvarlen, 0) ot = dsymptr(hashfunc, ot, memhashvarlen, 0)
ot = duintptr(hashfunc.Linksym(), ot, uint64(t.Width)) // size encoded in closure ot = duintptr(hashfunc, ot, uint64(t.Width)) // size encoded in closure
ggloblsym(hashfunc.Linksym(), int32(ot), obj.DUPOK|obj.RODATA) ggloblsym(hashfunc, int32(ot), obj.DUPOK|obj.RODATA)
// make equality closure // make equality closure
p = fmt.Sprintf(".eqfunc%d", t.Width) p = fmt.Sprintf(".eqfunc%d", t.Width)
eqfunc = types.TypePkgLookup(p) eqfunc = types.TypePkgLookup(p).Linksym()
ot = 0 ot = 0
ot = dsymptr(eqfunc.Linksym(), ot, memequalvarlen, 0) ot = dsymptr(eqfunc, ot, memequalvarlen, 0)
ot = duintptr(eqfunc.Linksym(), ot, uint64(t.Width)) ot = duintptr(eqfunc, ot, uint64(t.Width))
ggloblsym(eqfunc.Linksym(), int32(ot), obj.DUPOK|obj.RODATA) ggloblsym(eqfunc, int32(ot), obj.DUPOK|obj.RODATA)
} else { } else {
// generate an alg table specific to this type // generate an alg table specific to this type
s = typesymprefix(".alg", t) s := typesymprefix(".alg", t)
lsym = s.Linksym()
hash := typesymprefix(".hash", t) hash := typesymprefix(".hash", t)
eq := typesymprefix(".eq", t) eq := typesymprefix(".eq", t)
hashfunc = typesymprefix(".hashfunc", t) hashfunc = typesymprefix(".hashfunc", t).Linksym()
eqfunc = typesymprefix(".eqfunc", t) eqfunc = typesymprefix(".eqfunc", t).Linksym()
genhash(hash, t) genhash(hash, t)
geneq(eq, t) geneq(eq, t)
// make Go funcs (closures) for calling hash and equal from Go // make Go funcs (closures) for calling hash and equal from Go
dsymptr(hashfunc.Linksym(), 0, hash.Linksym(), 0) dsymptr(hashfunc, 0, hash.Linksym(), 0)
ggloblsym(hashfunc, int32(Widthptr), obj.DUPOK|obj.RODATA)
ggloblsym(hashfunc.Linksym(), int32(Widthptr), obj.DUPOK|obj.RODATA) dsymptr(eqfunc, 0, eq.Linksym(), 0)
dsymptr(eqfunc.Linksym(), 0, eq.Linksym(), 0) ggloblsym(eqfunc, int32(Widthptr), obj.DUPOK|obj.RODATA)
ggloblsym(eqfunc.Linksym(), int32(Widthptr), obj.DUPOK|obj.RODATA)
} }
// ../../../../runtime/alg.go:/typeAlg // ../../../../runtime/alg.go:/typeAlg
ot := 0 ot := 0
ot = dsymptr(s.Linksym(), ot, hashfunc.Linksym(), 0) ot = dsymptr(lsym, ot, hashfunc, 0)
ot = dsymptr(s.Linksym(), ot, eqfunc.Linksym(), 0) ot = dsymptr(lsym, ot, eqfunc, 0)
ggloblsym(s.Linksym(), int32(ot), obj.DUPOK|obj.RODATA) ggloblsym(lsym, int32(ot), obj.DUPOK|obj.RODATA)
return s return lsym
} }
// maxPtrmaskBytes is the maximum length of a GC ptrmask bitmap, // maxPtrmaskBytes is the maximum length of a GC ptrmask bitmap,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment