algsym = dalgsym(t)
}
+ var sptr *Sym
tptr := Ptrto(t)
if !t.IsPtr() && (t.Sym != nil || methods(tptr) != nil) {
- sptr := dtypesym(tptr)
- r := obj.Addrel(Linksym(s))
- r.Off = 0
- r.Siz = 0
- r.Sym = sptr.Lsym
- r.Type = obj.R_USETYPE
+ sptr = dtypesym(tptr)
}
gcsym, useGCProg, ptrdata := dgcsym(t)
// alg *typeAlg
// gcdata *byte
// str nameOff
- // _ int32
+ // ptrToThis typeOff
// }
ot = duintptr(s, ot, uint64(t.Width))
ot = duintptr(s, ot, uint64(ptrdata))
ot = dsymptr(s, ot, gcsym, 0) // gcdata
nsym := dname(p, "", nil, exported)
- ot = dsymptrOffLSym(Linksym(s), ot, nsym, 0)
- ot = duint32(s, ot, 0)
+ ot = dsymptrOffLSym(Linksym(s), ot, nsym, 0) // str
+ if sptr == nil {
+ ot = duint32(s, ot, 0)
+ } else {
+ ot = dsymptrOffLSym(Linksym(s), ot, Linksym(sptr), 0) // ptrToThis
+ }
return ot
}
alg *typeAlg // algorithm table
gcdata *byte // garbage collection data
str nameOff // string form
- _ int32 // unused; keeps rtype always a multiple of ptrSize
+ ptrToThis typeOff // type for pointer to this type, may be zero
}
// a copy of runtime.typeAlg
}
func (t *rtype) ptrTo() *rtype {
+ if t.ptrToThis != 0 {
+ return t.typeOff(t.ptrToThis)
+ }
+
// Check the cache.
ptrMap.RLock()
if m := ptrMap.m; m != nil {
mt.bucketsize = uint16(mt.bucket.size)
mt.reflexivekey = isReflexive(ktyp)
mt.needkeyupdate = needKeyUpdate(ktyp)
+ mt.ptrToThis = 0
return cachePut(ckey, &mt.rtype)
}
// Populate the remaining fields of ft and store in cache.
ft.str = resolveReflectName(newName(str, "", "", false))
+ ft.ptrToThis = 0
funcLookupCache.m[hash] = append(funcLookupCache.m[hash], &ft.rtype)
return &ft.rtype
slice.str = resolveReflectName(newName(s, "", "", false))
slice.hash = fnv1(typ.hash, '[')
slice.elem = typ
+ slice.ptrToThis = 0
return cachePut(ckey, &slice.rtype)
}
}
array.hash = fnv1(array.hash, ']')
array.elem = typ
+ array.ptrToThis = 0
max := ^uintptr(0) / typ.size
if uintptr(count) > max {
panic("reflect.ArrayOf: array size would exceed virtual address space")
// gcdata stores the GC type data for the garbage collector.
// If the KindGCProg bit is set in kind, gcdata is a GC program.
// Otherwise it is a ptrmask bitmap. See mbitmap.go for details.
- gcdata *byte
- str nameOff
- _ int32
+ gcdata *byte
+ str nameOff
+ ptrToThis typeOff
}
func (t *_type) string() string {