type ptabEntry … var signatmu … var signatset … var signatslice … var gcsymmu … var gcsymset … type typeSig … func commonSize() int { … } func uncommonSize(t *types.Type) int { … } func makefield(name string, t *types.Type) *types.Field { … } // methods returns the methods of the non-interface type t, sorted by name. // Generates stub functions as needed. func methods(t *types.Type) []*typeSig { … } // imethods returns the methods of the interface type t, sorted by name. func imethods(t *types.Type) []*typeSig { … } func dimportpath(p *types.Pkg) { … } func dgopkgpath(c rttype.Cursor, pkg *types.Pkg) { … } // dgopkgpathOff writes an offset relocation to the pkg path symbol to c. func dgopkgpathOff(c rttype.Cursor, pkg *types.Pkg) { … } // dnameField dumps a reflect.name for a struct field. func dnameField(c rttype.Cursor, spkg *types.Pkg, ft *types.Field) { … } // dnameData writes the contents of a reflect.name into s at offset ot. func dnameData(s *obj.LSym, ot int, name, tag string, pkg *types.Pkg, exported, embedded bool) int { … } var dnameCount … // dname creates a reflect.name for a struct field or method. func dname(name, tag string, pkg *types.Pkg, exported, embedded bool) *obj.LSym { … } // dextratype dumps the fields of a runtime.uncommontype. // dataAdd is the offset in bytes after the header where the // backing array of the []method field should be written. func dextratype(lsym *obj.LSym, off int64, t *types.Type, dataAdd int) { … } func typePkg(t *types.Type) *types.Pkg { … } func dmethodptrOff(c rttype.Cursor, x *obj.LSym) { … } var kinds … var memhashvarlen … var memequalvarlen … // dcommontype dumps the contents of a reflect.rtype (runtime._type) to c. func dcommontype(c rttype.Cursor, t *types.Type) { … } // TrackSym returns the symbol for tracking use of field/method f, assumed // to be a member of struct/interface type t. func TrackSym(t *types.Type, f *types.Field) *obj.LSym { … } func TypeSymPrefix(prefix string, t *types.Type) *types.Sym { … } func TypeSym(t *types.Type) *types.Sym { … } func TypeLinksymPrefix(prefix string, t *types.Type) *obj.LSym { … } func TypeLinksymLookup(name string) *obj.LSym { … } func TypeLinksym(t *types.Type) *obj.LSym { … } // TypePtrAt returns an expression that evaluates to the // *runtime._type value for t. func TypePtrAt(pos src.XPos, t *types.Type) *ir.AddrExpr { … } // ITabLsym returns the LSym representing the itab for concrete type typ implementing // interface iface. A dummy tab will be created in the unusual case where typ doesn't // implement iface. Normally, this wouldn't happen, because the typechecker would // have reported a compile-time error. This situation can only happen when the // destination type of a type assert or a type in a type switch is parameterized, so // it may sometimes, but not always, be a type that can't implement the specified // interface. func ITabLsym(typ, iface *types.Type) *obj.LSym { … } // ITabAddrAt returns an expression that evaluates to the // *runtime.itab value for concrete type typ implementing interface // iface. func ITabAddrAt(pos src.XPos, typ, iface *types.Type) *ir.AddrExpr { … } // needkeyupdate reports whether map updates with t as a key // need the key to be updated. func needkeyupdate(t *types.Type) bool { … } // hashMightPanic reports whether the hash of a map key of type t might panic. func hashMightPanic(t *types.Type) bool { … } // formalType replaces predeclared aliases with real types. // They've been separate internally to make error messages // better, but we have to merge them in the reflect tables. func formalType(t *types.Type) *types.Type { … } func writeType(t *types.Type) *obj.LSym { … } // InterfaceMethodOffset returns the offset of the i-th method in the interface // type descriptor, ityp. func InterfaceMethodOffset(ityp *types.Type, i int64) int64 { … } // NeedRuntimeType ensures that a runtime type descriptor is emitted for t. func NeedRuntimeType(t *types.Type) { … } func WriteRuntimeTypes() { … } func WriteGCSymbols() { … } // writeITab writes the itab for concrete type typ implementing interface iface. If // allowNonImplement is true, allow the case where typ does not implement iface, and just // create a dummy itab with zeroed-out method entries. func writeITab(lsym *obj.LSym, typ, iface *types.Type, allowNonImplement bool) { … } func WritePluginTable() { … } // writtenByWriteBasicTypes reports whether typ is written by WriteBasicTypes. // WriteBasicTypes always writes pointer types; any pointer has been stripped off typ already. func writtenByWriteBasicTypes(typ *types.Type) bool { … } func WriteBasicTypes() { … } type typeAndStr … func typesStrCmp(a, b typeAndStr) int { … } // GCSym returns a data symbol containing GC information for type t, along // with a boolean reporting whether the UseGCProg bit should be set in the // type kind, and the ptrdata field to record in the reflect type information. // GCSym may be called in concurrent backend, so it does not emit the symbol // content. func GCSym(t *types.Type) (lsym *obj.LSym, useGCProg bool, ptrdata int64) { … } // dgcsym returns a data symbol containing GC information for type t, along // with a boolean reporting whether the UseGCProg bit should be set in the // type kind, and the ptrdata field to record in the reflect type information. // When write is true, it writes the symbol data. func dgcsym(t *types.Type, write bool) (lsym *obj.LSym, useGCProg bool, ptrdata int64) { … } // dgcptrmask emits and returns the symbol containing a pointer mask for type t. func dgcptrmask(t *types.Type, write bool) *obj.LSym { … } // fillptrmask fills in ptrmask with 1s corresponding to the // word offsets in t that hold pointers. // ptrmask is assumed to fit at least types.PtrDataSize(t)/PtrSize bits. func fillptrmask(t *types.Type, ptrmask []byte) { … } // dgcprog emits and returns the symbol containing a GC program for type t // along with the size of the data described by the program (in the range // [types.PtrDataSize(t), t.Width]). // In practice, the size is types.PtrDataSize(t) except for non-trivial arrays. // For non-trivial arrays, the program describes the full t.Width size. func dgcprog(t *types.Type, write bool) (*obj.LSym, int64) { … } type gcProg … func (p *gcProg) init(lsym *obj.LSym, write bool) { … } func (p *gcProg) writeByte(x byte) { … } func (p *gcProg) end() { … } func (p *gcProg) emit(t *types.Type, offset int64) { … } // ZeroAddr returns the address of a symbol with at least // size bytes of zeros. func ZeroAddr(size int64) ir.Node { … } // NeedEmit reports whether typ is a type that we need to emit code // for (e.g., runtime type descriptors, method wrappers). func NeedEmit(typ *types.Type) bool { … } // Generate a wrapper function to convert from // a receiver of type T to a receiver of type U. // That is, // // func (t T) M() { // ... // } // // already exists; this function generates // // func (u U) M() { // u.M() // } // // where the types T and U are such that u.M() is valid // and calls the T.M method. // The resulting function is for use in method tables. // // rcvr - U // method - M func (t T)(), a TFIELD type struct // // Also wraps methods on instantiated generic types for use in itab entries. // For an instantiated generic type G[int], we generate wrappers like: // G[int] pointer shaped: // // func (x G[int]) f(arg) { // .inst.G[int].f(dictionary, x, arg) // } // // G[int] not pointer shaped: // // func (x *G[int]) f(arg) { // .inst.G[int].f(dictionary, *x, arg) // } // // These wrappers are always fully stenciled. func methodWrapper(rcvr *types.Type, method *types.Field, forItab bool) *obj.LSym { … } var ZeroSize … // MarkTypeUsedInInterface marks that type t is converted to an interface. // This information is used in the linker in dead method elimination. func MarkTypeUsedInInterface(t *types.Type, from *obj.LSym) { … } func MarkTypeSymUsedInInterface(tsym *obj.LSym, from *obj.LSym) { … } // MarkUsedIfaceMethod marks that an interface method is used in the current // function. n is OCALLINTER node. func MarkUsedIfaceMethod(n *ir.CallExpr) { … } func deref(t *types.Type) *types.Type { … }