Commit 4d600b8e authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: convert dxxx to dxxxLSym

This is an automated refactoring to eliminate
all dxxx calls in gc/obj.go that accept types.Sym
instead of obj.LSym parameters.

The refactoring was of the form:

gorename -from '"cmd/compile/internal/gc".duintxx' -to Duintxx
gorename -from '"cmd/compile/internal/gc".duintxxLSym' -to DuintxxLSym
eg -t t.go -w cmd/compile/internal/gc
gofmt -r 'DuintxxLSym -> duintxxLSym' -w cmd/compile/internal/gc

where t.go looked like:

func before(s *types.Sym, off int, v uint64, wid int) int {
	return gc.Duintxx(s, off, v, wid)
}

func after(s *types.Sym, off int, v uint64, wid int) int {
	return gc.DuintxxLSym(s.Linksym(), off, v, wid)
}

The rename/gofmt shenanigans were to work around
limitations and bugs in eg and gorename.

The resulting code in reflect.go looks temporarily ugly,
but it makes refactoring and cleanup opportunities
much clearer.

Next step is to rename all the dxxx methods to rename the -LSym suffix
and clean up reflect.go.

The renaming is left for a separate CL to make the changes in
this CL more obvious, and thus hopefully easier to review.

Passes toolstash-check.

Change-Id: Ib31a2b6fd146ed03a855d20ecb0433f0f74e2f10
Reviewed-on: https://go-review.googlesource.com/41396
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent a5096213
...@@ -222,7 +222,7 @@ func dumpglobls() { ...@@ -222,7 +222,7 @@ func dumpglobls() {
for _, s := range funcsyms { for _, s := range funcsyms {
sf := s.Pkg.Lookup(funcsymname(s)) sf := s.Pkg.Lookup(funcsymname(s))
dsymptr(sf, 0, s, 0) dsymptrLSym(sf.Linksym(), 0, s.Linksym(), 0)
ggloblsym(sf, int32(Widthptr), obj.DUPOK|obj.RODATA) ggloblsym(sf, int32(Widthptr), obj.DUPOK|obj.RODATA)
} }
...@@ -251,10 +251,6 @@ func addGCLocals() { ...@@ -251,10 +251,6 @@ func addGCLocals() {
} }
} }
func duintxx(s *types.Sym, off int, v uint64, wid int) int {
return duintxxLSym(s.Linksym(), off, v, wid)
}
func duintxxLSym(s *obj.LSym, off int, v uint64, wid int) int { func duintxxLSym(s *obj.LSym, off int, v uint64, wid int) int {
if s.Type == 0 { if s.Type == 0 {
// TODO(josharian): Do this in obj.prepwrite instead. // TODO(josharian): Do this in obj.prepwrite instead.
...@@ -267,30 +263,22 @@ func duintxxLSym(s *obj.LSym, off int, v uint64, wid int) int { ...@@ -267,30 +263,22 @@ func duintxxLSym(s *obj.LSym, off int, v uint64, wid int) int {
return off + wid return off + wid
} }
func duint8(s *types.Sym, off int, v uint8) int {
return duintxx(s, off, uint64(v), 1)
}
func duint16(s *types.Sym, off int, v uint16) int {
return duintxx(s, off, uint64(v), 2)
}
func duint32(s *types.Sym, off int, v uint32) int {
return duintxx(s, off, uint64(v), 4)
}
func duintptr(s *types.Sym, off int, v uint64) int {
return duintxx(s, off, v, Widthptr)
}
func duint8LSym(s *obj.LSym, off int, v uint8) int { func duint8LSym(s *obj.LSym, off int, v uint8) int {
return duintxxLSym(s, off, uint64(v), 1) return duintxxLSym(s, off, uint64(v), 1)
} }
func duint16LSym(s *obj.LSym, off int, v uint16) int {
return duintxxLSym(s, off, uint64(v), 2)
}
func duint32LSym(s *obj.LSym, off int, v uint32) int { func duint32LSym(s *obj.LSym, off int, v uint32) int {
return duintxxLSym(s, off, uint64(v), 4) return duintxxLSym(s, off, uint64(v), 4)
} }
func duintptrLSym(s *obj.LSym, off int, v uint64) int {
return duintxxLSym(s, off, v, Widthptr)
}
func dbvecLSym(s *obj.LSym, off int, bv bvec) int { func dbvecLSym(s *obj.LSym, off int, bv bvec) int {
// Runtime reads the bitmaps as byte arrays. Oblige. // Runtime reads the bitmaps as byte arrays. Oblige.
for j := 0; int32(j) < bv.n; j += 8 { for j := 0; int32(j) < bv.n; j += 8 {
...@@ -336,20 +324,16 @@ func slicebytes(nam *Node, s string, len int) { ...@@ -336,20 +324,16 @@ func slicebytes(nam *Node, s string, len int) {
sym := localpkg.Lookup(symname) sym := localpkg.Lookup(symname)
sym.Def = asTypesNode(newname(sym)) sym.Def = asTypesNode(newname(sym))
off := dsname(sym, 0, s) off := dsnameLSym(sym.Linksym(), 0, s)
ggloblsym(sym, int32(off), obj.NOPTR|obj.LOCAL) ggloblsym(sym, int32(off), obj.NOPTR|obj.LOCAL)
if nam.Op != ONAME { if nam.Op != ONAME {
Fatalf("slicebytes %v", nam) Fatalf("slicebytes %v", nam)
} }
off = int(nam.Xoffset) off = int(nam.Xoffset)
off = dsymptr(nam.Sym, off, sym, 0) off = dsymptrLSym(nam.Sym.Linksym(), off, sym.Linksym(), 0)
off = duintxx(nam.Sym, off, uint64(len), Widthint) off = duintxxLSym(nam.Sym.Linksym(), off, uint64(len), Widthint)
duintxx(nam.Sym, off, uint64(len), Widthint) duintxxLSym(nam.Sym.Linksym(), off, uint64(len), Widthint)
}
func dsname(s *types.Sym, off int, t string) int {
return dsnameLSym(s.Linksym(), off, t)
} }
func dsnameLSym(s *obj.LSym, off int, t string) int { func dsnameLSym(s *obj.LSym, off int, t string) int {
...@@ -357,10 +341,6 @@ func dsnameLSym(s *obj.LSym, off int, t string) int { ...@@ -357,10 +341,6 @@ func dsnameLSym(s *obj.LSym, off int, t string) int {
return off + len(t) return off + len(t)
} }
func dsymptr(s *types.Sym, off int, x *types.Sym, xoff int) int {
return dsymptrLSym(s.Linksym(), off, x.Linksym(), xoff)
}
func dsymptrLSym(s *obj.LSym, off int, x *obj.LSym, xoff int) int { func dsymptrLSym(s *obj.LSym, off int, x *obj.LSym, xoff int) int {
off = int(Rnd(int64(off), int64(Widthptr))) off = int(Rnd(int64(off), int64(Widthptr)))
s.WriteAddr(Ctxt, int64(off), Widthptr, x, int64(xoff)) s.WriteAddr(Ctxt, int64(off), Widthptr, x, int64(xoff))
......
...@@ -628,10 +628,10 @@ func dextratype(s *types.Sym, ot int, t *types.Type, dataAdd int) int { ...@@ -628,10 +628,10 @@ func dextratype(s *types.Sym, ot int, t *types.Type, dataAdd int) int {
Fatalf("methods are too far away on %v: %d", t, dataAdd) Fatalf("methods are too far away on %v: %d", t, dataAdd)
} }
ot = duint16(s, ot, uint16(mcount)) ot = duint16LSym(s.Linksym(), ot, uint16(mcount))
ot = duint16(s, ot, 0) ot = duint16LSym(s.Linksym(), ot, 0)
ot = duint32(s, ot, uint32(dataAdd)) ot = duint32LSym(s.Linksym(), ot, uint32(dataAdd))
ot = duint32(s, ot, 0) ot = duint32LSym(s.Linksym(), ot, 0)
return ot return ot
} }
...@@ -820,10 +820,10 @@ func dcommontype(s *types.Sym, ot int, t *types.Type) int { ...@@ -820,10 +820,10 @@ func dcommontype(s *types.Sym, ot int, t *types.Type) int {
// str nameOff // str nameOff
// ptrToThis typeOff // ptrToThis typeOff
// } // }
ot = duintptr(s, ot, uint64(t.Width)) ot = duintptrLSym(s.Linksym(), ot, uint64(t.Width))
ot = duintptr(s, ot, uint64(ptrdata)) ot = duintptrLSym(s.Linksym(), ot, uint64(ptrdata))
ot = duint32(s, ot, typehash(t)) ot = duint32LSym(s.Linksym(), ot, typehash(t))
var tflag uint8 var tflag uint8
if uncommonSize(t) != 0 { if uncommonSize(t) != 0 {
...@@ -852,7 +852,7 @@ func dcommontype(s *types.Sym, ot int, t *types.Type) int { ...@@ -852,7 +852,7 @@ func dcommontype(s *types.Sym, ot int, t *types.Type) int {
} }
} }
ot = duint8(s, ot, tflag) ot = duint8LSym(s.Linksym(), ot, tflag)
// runtime (and common sense) expects alignment to be a power of two. // runtime (and common sense) expects alignment to be a power of two.
i := int(t.Align) i := int(t.Align)
...@@ -863,8 +863,8 @@ func dcommontype(s *types.Sym, ot int, t *types.Type) int { ...@@ -863,8 +863,8 @@ func dcommontype(s *types.Sym, ot int, t *types.Type) int {
if i&(i-1) != 0 { if i&(i-1) != 0 {
Fatalf("invalid alignment %d for %v", t.Align, t) Fatalf("invalid alignment %d for %v", t.Align, t)
} }
ot = duint8(s, ot, t.Align) // align ot = duint8LSym(s.Linksym(), ot, t.Align) // align
ot = duint8(s, ot, t.Align) // fieldAlign ot = duint8LSym(s.Linksym(), ot, t.Align) // fieldAlign
i = kinds[t.Etype] i = kinds[t.Etype]
if !types.Haspointers(t) { if !types.Haspointers(t) {
...@@ -876,19 +876,19 @@ func dcommontype(s *types.Sym, ot int, t *types.Type) int { ...@@ -876,19 +876,19 @@ func dcommontype(s *types.Sym, ot int, t *types.Type) int {
if useGCProg { if useGCProg {
i |= objabi.KindGCProg i |= objabi.KindGCProg
} }
ot = duint8(s, ot, uint8(i)) // kind ot = duint8LSym(s.Linksym(), ot, uint8(i)) // kind
if algsym == nil { if algsym == nil {
ot = dsymptr(s, ot, dcommontype_algarray, int(alg)*sizeofAlg) ot = dsymptrLSym(s.Linksym(), ot, dcommontype_algarray.Linksym(), int(alg)*sizeofAlg)
} else { } else {
ot = dsymptr(s, ot, algsym, 0) ot = dsymptrLSym(s.Linksym(), ot, algsym.Linksym(), 0)
} }
ot = dsymptr(s, ot, gcsym, 0) // gcdata ot = dsymptrLSym(s.Linksym(), ot, gcsym.Linksym(), 0) // gcdata
nsym := dname(p, "", nil, exported) nsym := dname(p, "", nil, exported)
ot = dsymptrOffLSym(s.Linksym(), ot, nsym, 0) // str ot = dsymptrOffLSym(s.Linksym(), ot, nsym, 0) // str
// ptrToThis // ptrToThis
if sptr == nil { if sptr == nil {
ot = duint32(s, ot, 0) ot = duint32LSym(s.Linksym(), ot, 0)
} else if sptrWeak { } else if sptrWeak {
ot = dsymptrWeakOffLSym(s.Linksym(), ot, sptr.Linksym()) ot = dsymptrWeakOffLSym(s.Linksym(), ot, sptr.Linksym())
} else { } else {
...@@ -1128,24 +1128,24 @@ ok: ...@@ -1128,24 +1128,24 @@ ok:
t2 := types.NewSlice(t.Elem()) t2 := types.NewSlice(t.Elem())
s2 := dtypesym(t2) s2 := dtypesym(t2)
ot = dcommontype(s, ot, t) ot = dcommontype(s, ot, t)
ot = dsymptr(s, ot, s1, 0) ot = dsymptrLSym(s.Linksym(), ot, s1.Linksym(), 0)
ot = dsymptr(s, ot, s2, 0) ot = dsymptrLSym(s.Linksym(), ot, s2.Linksym(), 0)
ot = duintptr(s, ot, uint64(t.NumElem())) ot = duintptrLSym(s.Linksym(), ot, uint64(t.NumElem()))
ot = dextratype(s, ot, t, 0) ot = dextratype(s, ot, t, 0)
case TSLICE: case TSLICE:
// ../../../../runtime/type.go:/sliceType // ../../../../runtime/type.go:/sliceType
s1 := dtypesym(t.Elem()) s1 := dtypesym(t.Elem())
ot = dcommontype(s, ot, t) ot = dcommontype(s, ot, t)
ot = dsymptr(s, ot, s1, 0) ot = dsymptrLSym(s.Linksym(), ot, s1.Linksym(), 0)
ot = dextratype(s, ot, t, 0) ot = dextratype(s, ot, t, 0)
case TCHAN: case TCHAN:
// ../../../../runtime/type.go:/chanType // ../../../../runtime/type.go:/chanType
s1 := dtypesym(t.Elem()) s1 := dtypesym(t.Elem())
ot = dcommontype(s, ot, t) ot = dcommontype(s, ot, t)
ot = dsymptr(s, ot, s1, 0) ot = dsymptrLSym(s.Linksym(), ot, s1.Linksym(), 0)
ot = duintptr(s, ot, uint64(t.ChanDir())) ot = duintptrLSym(s.Linksym(), ot, uint64(t.ChanDir()))
ot = dextratype(s, ot, t, 0) ot = dextratype(s, ot, t, 0)
case TFUNC: case TFUNC:
...@@ -1167,8 +1167,8 @@ ok: ...@@ -1167,8 +1167,8 @@ ok:
if isddd { if isddd {
outCount |= 1 << 15 outCount |= 1 << 15
} }
ot = duint16(s, ot, uint16(inCount)) ot = duint16LSym(s.Linksym(), ot, uint16(inCount))
ot = duint16(s, ot, uint16(outCount)) ot = duint16LSym(s.Linksym(), ot, uint16(outCount))
if Widthptr == 8 { if Widthptr == 8 {
ot += 4 // align for *rtype ot += 4 // align for *rtype
} }
...@@ -1178,13 +1178,13 @@ ok: ...@@ -1178,13 +1178,13 @@ ok:
// Array of rtype pointers follows funcType. // Array of rtype pointers follows funcType.
for _, t1 := range t.Recvs().Fields().Slice() { for _, t1 := range t.Recvs().Fields().Slice() {
ot = dsymptr(s, ot, dtypesym(t1.Type), 0) ot = dsymptrLSym(s.Linksym(), ot, dtypesym(t1.Type).Linksym(), 0)
} }
for _, t1 := range t.Params().Fields().Slice() { for _, t1 := range t.Params().Fields().Slice() {
ot = dsymptr(s, ot, dtypesym(t1.Type), 0) ot = dsymptrLSym(s.Linksym(), ot, dtypesym(t1.Type).Linksym(), 0)
} }
for _, t1 := range t.Results().Fields().Slice() { for _, t1 := range t.Results().Fields().Slice() {
ot = dsymptr(s, ot, dtypesym(t1.Type), 0) ot = dsymptrLSym(s.Linksym(), ot, dtypesym(t1.Type).Linksym(), 0)
} }
case TINTER: case TINTER:
...@@ -1203,9 +1203,9 @@ ok: ...@@ -1203,9 +1203,9 @@ ok:
} }
ot = dgopkgpath(s, ot, tpkg) ot = dgopkgpath(s, ot, tpkg)
ot = dsymptr(s, ot, s, ot+Widthptr+2*Widthint+uncommonSize(t)) ot = dsymptrLSym(s.Linksym(), ot, s.Linksym(), ot+Widthptr+2*Widthint+uncommonSize(t))
ot = duintxx(s, ot, uint64(n), Widthint) ot = duintxxLSym(s.Linksym(), ot, uint64(n), Widthint)
ot = duintxx(s, ot, uint64(n), Widthint) ot = duintxxLSym(s.Linksym(), ot, uint64(n), Widthint)
dataAdd := imethodSize() * n dataAdd := imethodSize() * n
ot = dextratype(s, ot, t, dataAdd) ot = dextratype(s, ot, t, dataAdd)
...@@ -1230,29 +1230,29 @@ ok: ...@@ -1230,29 +1230,29 @@ ok:
s3 := dtypesym(mapbucket(t)) s3 := dtypesym(mapbucket(t))
s4 := dtypesym(hmap(t)) s4 := dtypesym(hmap(t))
ot = dcommontype(s, ot, t) ot = dcommontype(s, ot, t)
ot = dsymptr(s, ot, s1, 0) ot = dsymptrLSym(s.Linksym(), ot, s1.Linksym(), 0)
ot = dsymptr(s, ot, s2, 0) ot = dsymptrLSym(s.Linksym(), ot, s2.Linksym(), 0)
ot = dsymptr(s, ot, s3, 0) ot = dsymptrLSym(s.Linksym(), ot, s3.Linksym(), 0)
ot = dsymptr(s, ot, s4, 0) ot = dsymptrLSym(s.Linksym(), ot, s4.Linksym(), 0)
if t.Key().Width > MAXKEYSIZE { if t.Key().Width > MAXKEYSIZE {
ot = duint8(s, ot, uint8(Widthptr)) ot = duint8LSym(s.Linksym(), ot, uint8(Widthptr))
ot = duint8(s, ot, 1) // indirect ot = duint8LSym(s.Linksym(), ot, 1) // indirect
} else { } else {
ot = duint8(s, ot, uint8(t.Key().Width)) ot = duint8LSym(s.Linksym(), ot, uint8(t.Key().Width))
ot = duint8(s, ot, 0) // not indirect ot = duint8LSym(s.Linksym(), ot, 0) // not indirect
} }
if t.Val().Width > MAXVALSIZE { if t.Val().Width > MAXVALSIZE {
ot = duint8(s, ot, uint8(Widthptr)) ot = duint8LSym(s.Linksym(), ot, uint8(Widthptr))
ot = duint8(s, ot, 1) // indirect ot = duint8LSym(s.Linksym(), ot, 1) // indirect
} else { } else {
ot = duint8(s, ot, uint8(t.Val().Width)) ot = duint8LSym(s.Linksym(), ot, uint8(t.Val().Width))
ot = duint8(s, ot, 0) // not indirect ot = duint8LSym(s.Linksym(), ot, 0) // not indirect
} }
ot = duint16(s, ot, uint16(mapbucket(t).Width)) ot = duint16LSym(s.Linksym(), ot, uint16(mapbucket(t).Width))
ot = duint8(s, ot, uint8(obj.Bool2int(isreflexive(t.Key())))) ot = duint8LSym(s.Linksym(), ot, uint8(obj.Bool2int(isreflexive(t.Key()))))
ot = duint8(s, ot, uint8(obj.Bool2int(needkeyupdate(t.Key())))) ot = duint8LSym(s.Linksym(), ot, uint8(obj.Bool2int(needkeyupdate(t.Key()))))
ot = dextratype(s, ot, t, 0) ot = dextratype(s, ot, t, 0)
case TPTR32, TPTR64: case TPTR32, TPTR64:
...@@ -1268,7 +1268,7 @@ ok: ...@@ -1268,7 +1268,7 @@ ok:
s1 := dtypesym(t.Elem()) s1 := dtypesym(t.Elem())
ot = dcommontype(s, ot, t) ot = dcommontype(s, ot, t)
ot = dsymptr(s, ot, s1, 0) ot = dsymptrLSym(s.Linksym(), ot, s1.Linksym(), 0)
ot = dextratype(s, ot, t, 0) ot = dextratype(s, ot, t, 0)
// ../../../../runtime/type.go:/structType // ../../../../runtime/type.go:/structType
...@@ -1296,9 +1296,9 @@ ok: ...@@ -1296,9 +1296,9 @@ ok:
} }
} }
ot = dgopkgpath(s, ot, pkg) ot = dgopkgpath(s, ot, pkg)
ot = dsymptr(s, ot, s, ot+Widthptr+2*Widthint+uncommonSize(t)) ot = dsymptrLSym(s.Linksym(), ot, s.Linksym(), ot+Widthptr+2*Widthint+uncommonSize(t))
ot = duintxx(s, ot, uint64(n), Widthint) ot = duintxxLSym(s.Linksym(), ot, uint64(n), Widthint)
ot = duintxx(s, ot, uint64(n), Widthint) ot = duintxxLSym(s.Linksym(), ot, uint64(n), Widthint)
dataAdd := n * structfieldSize() dataAdd := n * structfieldSize()
ot = dextratype(s, ot, t, dataAdd) ot = dextratype(s, ot, t, dataAdd)
...@@ -1306,7 +1306,7 @@ ok: ...@@ -1306,7 +1306,7 @@ ok:
for _, f := range t.Fields().Slice() { for _, f := range t.Fields().Slice() {
// ../../../../runtime/type.go:/structField // ../../../../runtime/type.go:/structField
ot = dnameField(s, ot, pkg, f) ot = dnameField(s, ot, pkg, f)
ot = dsymptr(s, ot, dtypesym(f.Type), 0) ot = dsymptrLSym(s.Linksym(), ot, dtypesym(f.Type).Linksym(), 0)
offsetAnon := uint64(f.Offset) << 1 offsetAnon := uint64(f.Offset) << 1
if offsetAnon>>1 != uint64(f.Offset) { if offsetAnon>>1 != uint64(f.Offset) {
Fatalf("%v: bad field offset for %s", t, f.Sym.Name) Fatalf("%v: bad field offset for %s", t, f.Sym.Name)
...@@ -1314,7 +1314,7 @@ ok: ...@@ -1314,7 +1314,7 @@ ok:
if f.Embedded != 0 { if f.Embedded != 0 {
offsetAnon |= 1 offsetAnon |= 1
} }
ot = duintptr(s, ot, offsetAnon) ot = duintptrLSym(s.Linksym(), ot, offsetAnon)
} }
} }
...@@ -1461,10 +1461,10 @@ func dumptypestructs() { ...@@ -1461,10 +1461,10 @@ func dumptypestructs() {
// unused [2]byte // unused [2]byte
// fun [1]uintptr // variable sized // fun [1]uintptr // variable sized
// } // }
o := dsymptr(i.sym, 0, dtypesym(i.itype), 0) o := dsymptrLSym(i.sym.Linksym(), 0, dtypesym(i.itype).Linksym(), 0)
o = dsymptr(i.sym, o, dtypesym(i.t), 0) o = dsymptrLSym(i.sym.Linksym(), o, dtypesym(i.t).Linksym(), 0)
o += Widthptr // skip link field o += Widthptr // skip link field
o = duint32(i.sym, o, typehash(i.t)) // copy of type hash o = duint32LSym(i.sym.Linksym(), o, typehash(i.t)) // copy of type hash
o += 4 // skip bad/inhash/unused fields o += 4 // skip bad/inhash/unused fields
o += len(imethods(i.itype)) * Widthptr // skip fun method pointers o += len(imethods(i.itype)) * Widthptr // skip fun method pointers
// at runtime the itab will contain pointers to types, other itabs and // at runtime the itab will contain pointers to types, other itabs and
...@@ -1472,7 +1472,7 @@ func dumptypestructs() { ...@@ -1472,7 +1472,7 @@ func dumptypestructs() {
ggloblsym(i.sym, int32(o), int16(obj.DUPOK|obj.NOPTR)) ggloblsym(i.sym, int32(o), int16(obj.DUPOK|obj.NOPTR))
ilink := itablinkpkg.Lookup(i.t.ShortString() + "," + i.itype.ShortString()) ilink := itablinkpkg.Lookup(i.t.ShortString() + "," + i.itype.ShortString())
dsymptr(ilink, 0, i.sym, 0) dsymptrLSym(ilink.Linksym(), 0, i.sym.Linksym(), 0)
ggloblsym(ilink, int32(Widthptr), int16(obj.DUPOK|obj.RODATA)) ggloblsym(ilink, int32(Widthptr), int16(obj.DUPOK|obj.RODATA))
} }
...@@ -1574,8 +1574,8 @@ func dalgsym(t *types.Type) *types.Sym { ...@@ -1574,8 +1574,8 @@ func dalgsym(t *types.Type) *types.Sym {
hashfunc = types.TypePkgLookup(p) hashfunc = types.TypePkgLookup(p)
ot := 0 ot := 0
ot = dsymptr(hashfunc, ot, Runtimepkg.Lookup("memhash_varlen"), 0) ot = dsymptrLSym(hashfunc.Linksym(), ot, Runtimepkg.Lookup("memhash_varlen").Linksym(), 0)
ot = duintxx(hashfunc, ot, uint64(t.Width), Widthptr) // size encoded in closure ot = duintxxLSym(hashfunc.Linksym(), ot, uint64(t.Width), Widthptr) // size encoded in closure
ggloblsym(hashfunc, int32(ot), obj.DUPOK|obj.RODATA) ggloblsym(hashfunc, int32(ot), obj.DUPOK|obj.RODATA)
// make equality closure // make equality closure
...@@ -1584,8 +1584,8 @@ func dalgsym(t *types.Type) *types.Sym { ...@@ -1584,8 +1584,8 @@ func dalgsym(t *types.Type) *types.Sym {
eqfunc = types.TypePkgLookup(p) eqfunc = types.TypePkgLookup(p)
ot = 0 ot = 0
ot = dsymptr(eqfunc, ot, Runtimepkg.Lookup("memequal_varlen"), 0) ot = dsymptrLSym(eqfunc.Linksym(), ot, Runtimepkg.Lookup("memequal_varlen").Linksym(), 0)
ot = duintxx(eqfunc, ot, uint64(t.Width), Widthptr) ot = duintxxLSym(eqfunc.Linksym(), ot, uint64(t.Width), Widthptr)
ggloblsym(eqfunc, 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
...@@ -1600,18 +1600,18 @@ func dalgsym(t *types.Type) *types.Sym { ...@@ -1600,18 +1600,18 @@ func dalgsym(t *types.Type) *types.Sym {
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, 0, hash, 0) dsymptrLSym(hashfunc.Linksym(), 0, hash.Linksym(), 0)
ggloblsym(hashfunc, int32(Widthptr), obj.DUPOK|obj.RODATA) ggloblsym(hashfunc, int32(Widthptr), obj.DUPOK|obj.RODATA)
dsymptr(eqfunc, 0, eq, 0) dsymptrLSym(eqfunc.Linksym(), 0, eq.Linksym(), 0)
ggloblsym(eqfunc, int32(Widthptr), obj.DUPOK|obj.RODATA) ggloblsym(eqfunc, int32(Widthptr), obj.DUPOK|obj.RODATA)
} }
// ../../../../runtime/alg.go:/typeAlg // ../../../../runtime/alg.go:/typeAlg
ot := 0 ot := 0
ot = dsymptr(s, ot, hashfunc, 0) ot = dsymptrLSym(s.Linksym(), ot, hashfunc.Linksym(), 0)
ot = dsymptr(s, ot, eqfunc, 0) ot = dsymptrLSym(s.Linksym(), ot, eqfunc.Linksym(), 0)
ggloblsym(s, int32(ot), obj.DUPOK|obj.RODATA) ggloblsym(s, int32(ot), obj.DUPOK|obj.RODATA)
return s return s
} }
...@@ -1675,7 +1675,7 @@ func dgcptrmask(t *types.Type) *types.Sym { ...@@ -1675,7 +1675,7 @@ func dgcptrmask(t *types.Type) *types.Sym {
if !sym.Uniq() { if !sym.Uniq() {
sym.SetUniq(true) sym.SetUniq(true)
for i, x := range ptrmask { for i, x := range ptrmask {
duint8(sym, i, x) duint8LSym(sym.Linksym(), i, x)
} }
ggloblsym(sym, int32(len(ptrmask)), obj.DUPOK|obj.RODATA|obj.LOCAL) ggloblsym(sym, int32(len(ptrmask)), obj.DUPOK|obj.RODATA|obj.LOCAL)
} }
...@@ -1745,12 +1745,12 @@ func (p *GCProg) init(sym *types.Sym) { ...@@ -1745,12 +1745,12 @@ func (p *GCProg) init(sym *types.Sym) {
} }
func (p *GCProg) writeByte(x byte) { func (p *GCProg) writeByte(x byte) {
p.symoff = duint8(p.sym, p.symoff, x) p.symoff = duint8LSym(p.sym.Linksym(), p.symoff, x)
} }
func (p *GCProg) end() { func (p *GCProg) end() {
p.w.End() p.w.End()
duint32(p.sym, 0, uint32(p.symoff-4)) duint32LSym(p.sym.Linksym(), 0, uint32(p.symoff-4))
ggloblsym(p.sym, int32(p.symoff), obj.DUPOK|obj.RODATA|obj.LOCAL) ggloblsym(p.sym, int32(p.symoff), obj.DUPOK|obj.RODATA|obj.LOCAL)
if Debug_gcprog > 0 { if Debug_gcprog > 0 {
fmt.Fprintf(os.Stderr, "compile: end GCProg for %v\n", p.sym) fmt.Fprintf(os.Stderr, "compile: end GCProg for %v\n", p.sym)
......
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