Functions
AlgType
function
#
AlgType returns the fixed-width AMEMxx variants instead of the general
AMEM kind when possible.
func AlgType(t *types.Type) types.AlgKind
AppendElemRType
function
#
AppendElemRType asserts that n is an "append" operation, and
returns an expression that yields the *runtime._type value
representing the result slice type's element type.
func AppendElemRType(pos src.XPos, n *ir.CallExpr) ir.Node
CompareRType
function
#
CompareRType asserts that n is a comparison (== or !=) operation
between expressions of interface and non-interface type, and
returns an expression that yields the *runtime._type value
representing the non-interface type.
func CompareRType(pos src.XPos, n *ir.BinaryExpr) ir.Node
ConvIfaceSrcRType
function
#
ConvIfaceSrcRType asserts that n is a conversion from
non-interface type to interface type, and
returns an expression that yields the *runtime._type for copying
the convertee value to the heap.
func ConvIfaceSrcRType(pos src.XPos, n *ir.ConvExpr) ir.Node
ConvIfaceTypeWord
function
#
ConvIfaceTypeWord asserts that n is conversion to interface type,
and returns an expression that yields the *runtime._type or
*runtime.itab value necessary for implementing the conversion.
- *runtime._type for the destination type, for I2I conversions
- *runtime.itab, for T2I conversions
- *runtime._type for the source type, for T2E conversions
func ConvIfaceTypeWord(pos src.XPos, n *ir.ConvExpr) ir.Node
CopyElemRType
function
#
CopyElemRType asserts that n is a "copy" operation, and returns an
expression that yields the *runtime._type value representing the
destination slice type's element type.
func CopyElemRType(pos src.XPos, n *ir.BinaryExpr) ir.Node
DeleteMapRType
function
#
DeleteMapRType asserts that n is a "delete" operation, and returns
an expression that yields the *runtime._type value representing the
map type.
func DeleteMapRType(pos src.XPos, n *ir.CallExpr) ir.Node
EqFor
function
#
EqFor returns ONAME node represents type t's equal function, and a boolean
to indicates whether a length needs to be passed when calling the function.
func EqFor(t *types.Type) (ir.Node, bool)
GCSym
function
#
GCSym returns a data symbol containing GC information for type t.
GC information is always a bitmask, never a gc program.
GCSym may be called in concurrent backend, so it does not emit the symbol
content.
func GCSym(t *types.Type) (lsym *obj.LSym, ptrdata int64)
ITabAddrAt
function
#
ITabAddrAt returns an expression that evaluates to the
*runtime.itab value for concrete type typ implementing interface
iface.
func ITabAddrAt(pos src.XPos, typ *types.Type, iface *types.Type) *ir.AddrExpr
ITabLsym
function
#
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 *types.Type, iface *types.Type) *obj.LSym
IndexMapRType
function
#
IndexMapRType asserts that n is a map index operation, and returns
an expression that yields the *runtime._type value representing the
map type.
func IndexMapRType(pos src.XPos, n *ir.IndexExpr) ir.Node
InterfaceMethodOffset
function
#
InterfaceMethodOffset returns the offset of the i-th method in the interface
type descriptor, ityp.
func InterfaceMethodOffset(ityp *types.Type, i int64) int64
MakeChanRType
function
#
MakeChanRType asserts that n is a "make" operation for a channel
type, and returns an expression that yields the *runtime._type
value representing that channel type.
func MakeChanRType(pos src.XPos, n *ir.MakeExpr) ir.Node
MakeMapRType
function
#
MakeMapRType asserts that n is a "make" operation for a map type,
and returns an expression that yields the *runtime._type value
representing that map type.
func MakeMapRType(pos src.XPos, n *ir.MakeExpr) ir.Node
MakeSliceElemRType
function
#
MakeSliceElemRType asserts that n is a "make" operation for a slice
type, and returns an expression that yields the *runtime._type
value representing that slice type's element type.
func MakeSliceElemRType(pos src.XPos, n *ir.MakeExpr) ir.Node
MarkTypeSymUsedInInterface
function
#
func MarkTypeSymUsedInInterface(tsym *obj.LSym, from *obj.LSym)
MarkTypeUsedInInterface
function
#
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)
MarkUsedIfaceMethod
function
#
MarkUsedIfaceMethod marks that an interface method is used in the current
function. n is OCALLINTER node.
func MarkUsedIfaceMethod(n *ir.CallExpr)
NeedEmit
function
#
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
NeedRuntimeType
function
#
NeedRuntimeType ensures that a runtime type descriptor is emitted for t.
func NeedRuntimeType(t *types.Type)
OldMapBucketType
function
#
OldMapBucketType makes the map bucket type given the type of the map.
func OldMapBucketType(t *types.Type) *types.Type
OldMapIterType
function
#
OldMapIterType returns a type interchangeable with runtime.hiter.
Make sure this stays in sync with runtime/map.go.
func OldMapIterType() *types.Type
OldMapType
function
#
OldMapType returns a type interchangeable with runtime.hmap.
Make sure this stays in sync with runtime/map.go.
func OldMapType() *types.Type
RangeMapRType
function
#
RangeMapRType asserts that n is a "range" loop over a map value,
and returns an expression that yields the *runtime._type value
representing that map type.
func RangeMapRType(pos src.XPos, n *ir.RangeStmt) ir.Node
SwissMapGroupType
function
#
SwissMapGroupType makes the map slot group type given the type of the map.
func SwissMapGroupType(t *types.Type) *types.Type
SwissMapIterType
function
#
SwissMapIterType returns a type interchangeable with runtime.hiter.
Make sure this stays in sync with runtime/map.go.
func SwissMapIterType() *types.Type
SwissMapType
function
#
SwissMapType returns a type interchangeable with internal/runtime/maps.Map.
Make sure this stays in sync with internal/runtime/maps/map.go.
func SwissMapType() *types.Type
TrackSym
function
#
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
TypeLinksym
function
#
func TypeLinksym(t *types.Type) *obj.LSym
TypeLinksymLookup
function
#
func TypeLinksymLookup(name string) *obj.LSym
TypeLinksymPrefix
function
#
func TypeLinksymPrefix(prefix string, t *types.Type) *obj.LSym
TypePtrAt
function
#
TypePtrAt returns an expression that evaluates to the
*runtime._type value for t.
func TypePtrAt(pos src.XPos, t *types.Type) *ir.AddrExpr
TypeSym
function
#
func TypeSym(t *types.Type) *types.Sym
TypeSymPrefix
function
#
func TypeSymPrefix(prefix string, t *types.Type) *types.Sym
UnsafeSliceElemRType
function
#
UnsafeSliceElemRType asserts that n is an "unsafe.Slice" operation,
and returns an expression that yields the *runtime._type value
representing the result slice type's element type.
func UnsafeSliceElemRType(pos src.XPos, n *ir.BinaryExpr) ir.Node
WriteBasicTypes
function
#
func WriteBasicTypes()
WriteGCSymbols
function
#
func WriteGCSymbols()
WritePluginTable
function
#
func WritePluginTable()
WriteRuntimeTypes
function
#
func WriteRuntimeTypes()
ZeroAddr
function
#
ZeroAddr returns the address of a symbol with at least
size bytes of zeros.
func ZeroAddr(size int64) ir.Node
anyCall
function
#
func anyCall(fn *ir.Func) bool
assertOp
function
#
assertOp asserts that n is an op.
func assertOp(n ir.Node, op ir.Op)
assertOp2
function
#
assertOp2 asserts that n is an op1 or op2.
func assertOp2(n ir.Node, op1 ir.Op, op2 ir.Op)
chanRType
function
#
chanRType asserts that typ is a map type, and returns an expression
that yields the *runtime._type value representing typ.
func chanRType(pos src.XPos, typ *types.Type) ir.Node
commonSize
function
#
func commonSize() int
concreteRType
function
#
concreteRType asserts that typ is not an interface type, and
returns an expression that yields the *runtime._type value
representing typ.
func concreteRType(pos src.XPos, typ *types.Type) ir.Node
dcommontype
function
#
dcommontype dumps the contents of a reflect.rtype (runtime._type) to c.
func dcommontype(c rttype.Cursor, t *types.Type)
deref
function
#
func deref(t *types.Type) *types.Type
dgcptrmask
function
#
dgcptrmask emits and returns the symbol containing a pointer mask for type t.
func dgcptrmask(t *types.Type, write bool) *obj.LSym
dgcptrmaskOnDemand
function
#
dgcptrmaskOnDemand emits and returns the symbol that should be referenced by
the GCData field of a type, for large types.
func dgcptrmaskOnDemand(t *types.Type, write bool) *obj.LSym
dgcsym
function
#
dgcsym returns a data symbol containing GC information for type t, along
with a boolean reporting whether the gc mask should be computed on demand
at runtime, 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, onDemandAllowed bool) (lsym *obj.LSym, onDemand bool, ptrdata int64)
dgopkgpath
function
#
func dgopkgpath(c rttype.Cursor, pkg *types.Pkg)
dgopkgpathOff
function
#
dgopkgpathOff writes an offset relocation to the pkg path symbol to c.
func dgopkgpathOff(c rttype.Cursor, pkg *types.Pkg)
dimportpath
function
#
func dimportpath(p *types.Pkg)
dmethodptrOff
function
#
func dmethodptrOff(c rttype.Cursor, x *obj.LSym)
dname
function
#
dname creates a reflect.name for a struct field or method.
func dname(name string, tag string, pkg *types.Pkg, exported bool, embedded bool) *obj.LSym
dnameData
function
#
dnameData writes the contents of a reflect.name into s at offset ot.
func dnameData(s *obj.LSym, ot int, name string, tag string, pkg *types.Pkg, exported bool, embedded bool) int
dnameField
function
#
dnameField dumps a reflect.name for a struct field.
func dnameField(c rttype.Cursor, spkg *types.Pkg, ft *types.Field)
eqFunc
function
#
func eqFunc(t *types.Type) *ir.Func
fillptrmask
function
#
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)
formalType
function
#
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
geneq
function
#
geneq returns a symbol which is the closure used to compute
equality for two objects of type t.
func geneq(t *types.Type) *obj.LSym
genhash
function
#
genhash returns a symbol which is the closure used to compute
the hash of a value of type t.
Note: the generated function must match runtime.typehash exactly.
func genhash(t *types.Type) *obj.LSym
hasRType
function
#
func hasRType(n ir.Node, rtype ir.Node, fieldName string) bool
hashFunc
function
#
func hashFunc(t *types.Type) *ir.Func
hashMightPanic
function
#
hashMightPanic reports whether the hash of a map key of type t might panic.
func hashMightPanic(t *types.Type) bool
hashfor
function
#
hashfor returns the function to compute the hash of a value of type t.
func hashfor(t *types.Type) *ir.Name
hashmem
function
#
func hashmem(t *types.Type) ir.Node
imethods
function
#
imethods returns the methods of the interface type t, sorted by name.
func imethods(t *types.Type) []*typeSig
kindRType
function
#
kindRType asserts that typ has the given kind, and returns an
expression that yields the *runtime._type value representing typ.
func kindRType(pos src.XPos, typ *types.Type, k types.Kind) ir.Node
makefield
function
#
func makefield(name string, t *types.Type) *types.Field
mapRType
function
#
mapRType asserts that typ is a map type, and returns an expression
that yields the *runtime._type value representing typ.
func mapRType(pos src.XPos, typ *types.Type) ir.Node
methodWrapper
function
#
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
methods
function
#
methods returns the methods of the non-interface type t, sorted by name.
Generates stub functions as needed.
func methods(t *types.Type) []*typeSig
needkeyupdate
function
#
needkeyupdate reports whether map updates with t as a key
need the key to be updated.
func needkeyupdate(t *types.Type) bool
runtimeHashFor
function
#
func runtimeHashFor(name string, t *types.Type) *ir.Name
sliceElemRType
function
#
sliceElemRType asserts that typ is a slice type, and returns an
expression that yields the *runtime._type value representing typ's
element type.
func sliceElemRType(pos src.XPos, typ *types.Type) ir.Node
swissTableType
function
#
swissTableType returns a type interchangeable with internal/runtime/maps.table.
Make sure this stays in sync with internal/runtime/maps/table.go.
func swissTableType() *types.Type
sysClosure
function
#
sysClosure returns a closure which will call the
given runtime function (with no closed-over variables).
func sysClosure(name string) *obj.LSym
typePkg
function
#
func typePkg(t *types.Type) *types.Pkg
typesStrCmp
function
#
func typesStrCmp(a typeAndStr, b typeAndStr) int
uncommonSize
function
#
func uncommonSize(t *types.Type) int
writeITab
function
#
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 *types.Type, iface *types.Type, allowNonImplement bool)
writeOldMapType
function
#
func writeOldMapType(t *types.Type, lsym *obj.LSym, c rttype.Cursor)
writeSwissMapType
function
#
func writeSwissMapType(t *types.Type, lsym *obj.LSym, c rttype.Cursor)
writeType
function
#
func writeType(t *types.Type) *obj.LSym
writtenByWriteBasicTypes
function
#
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