ArrayType represents a fixed array type. // array element typeLenuintptr // slice typeTypeType // alignment of variable with this type function for comparing objects of this type
(ptr to object A, ptr to object B) -> ==? // alignment of struct field with this type 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. // hash of type; avoids computation in hash tables // enumeration for C // number of (prefix) bytes in the type that can contain pointers // type for pointer to this type, may be zeroType.Size_uintptr // string form // extra type information flags Align returns the alignment of data with type t. ArrayType returns t cast to a *ArrayType, or nil if its tag does not match. ChanDir returns the direction of t if t is a channel type, otherwise InvalidDir (0).(*ArrayType) Common() *Type(*ArrayType) ExportedMethods() []Method(*ArrayType) FieldAlign() int FuncType returns t cast to a *FuncType, or nil if its tag does not match.(*ArrayType) GcSlice(begin, end uintptr) []byte(*ArrayType) HasName() bool IfaceIndir reports whether t is stored indirectly in an interface value. InterfaceType returns t cast to a *InterfaceType, or nil if its tag does not match. isDirectIface reports whether t is stored directly in an interface value.(*ArrayType) Key() *Type(*ArrayType) Kind() Kind MapType returns t cast to a *MapType, or nil if its tag does not match.(*ArrayType) NumMethod() int Pointers reports whether t contains pointers. Size returns the size of data with type t. StructType returns t cast to a *StructType, or nil if its tag does not match. Uncommon returns a pointer to T's "uncommon" data if there is any, otherwise nil
func (*Type).ArrayType() *ArrayType
ChanType represents a channel typeDirChanDirElem*TypeTypeType // alignment of variable with this type function for comparing objects of this type
(ptr to object A, ptr to object B) -> ==? // alignment of struct field with this type 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. // hash of type; avoids computation in hash tables // enumeration for C // number of (prefix) bytes in the type that can contain pointers // type for pointer to this type, may be zeroType.Size_uintptr // string form // extra type information flags Align returns the alignment of data with type t. ArrayType returns t cast to a *ArrayType, or nil if its tag does not match. ChanDir returns the direction of t if t is a channel type, otherwise InvalidDir (0).(*ChanType) Common() *Type(*ChanType) ExportedMethods() []Method(*ChanType) FieldAlign() int FuncType returns t cast to a *FuncType, or nil if its tag does not match.(*ChanType) GcSlice(begin, end uintptr) []byte(*ChanType) HasName() bool IfaceIndir reports whether t is stored indirectly in an interface value. InterfaceType returns t cast to a *InterfaceType, or nil if its tag does not match. isDirectIface reports whether t is stored directly in an interface value.(*ChanType) Key() *Type(*ChanType) Kind() Kind Len returns the length of t if t is an array type, otherwise 0 MapType returns t cast to a *MapType, or nil if its tag does not match.(*ChanType) NumMethod() int Pointers reports whether t contains pointers. Size returns the size of data with type t. StructType returns t cast to a *StructType, or nil if its tag does not match. Uncommon returns a pointer to T's "uncommon" data if there is any, otherwise nil
EmptyInterface describes the layout of a "interface{}" or a "any."
These are represented differently than non-empty interface, as the first
word always points to an abi.Type.Dataunsafe.PointerType*Type
funcType represents a function type.
A *Type for each in and out parameter is stored in an array that
directly follows the funcType (and possibly its uncommonType). So
a function type with one method, one input, and one output is:
struct {
funcType
uncommonType
[2]*rtype // [0] is in, [1] is out
}InCountuint16 // top bit is set if last input parameter is ...TypeType // alignment of variable with this type function for comparing objects of this type
(ptr to object A, ptr to object B) -> ==? // alignment of struct field with this type 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. // hash of type; avoids computation in hash tables // enumeration for C // number of (prefix) bytes in the type that can contain pointers // type for pointer to this type, may be zeroType.Size_uintptr // string form // extra type information flags Align returns the alignment of data with type t. ArrayType returns t cast to a *ArrayType, or nil if its tag does not match. ChanDir returns the direction of t if t is a channel type, otherwise InvalidDir (0).(*FuncType) Common() *Type Elem returns the element type for t if t is an array, channel, map, pointer, or slice, otherwise nil.(*FuncType) ExportedMethods() []Method(*FuncType) FieldAlign() int FuncType returns t cast to a *FuncType, or nil if its tag does not match.(*FuncType) GcSlice(begin, end uintptr) []byte(*FuncType) HasName() bool IfaceIndir reports whether t is stored indirectly in an interface value.(*FuncType) In(i int) *Type(*FuncType) InSlice() []*Type InterfaceType returns t cast to a *InterfaceType, or nil if its tag does not match. isDirectIface reports whether t is stored directly in an interface value.(*FuncType) IsVariadic() bool(*FuncType) Key() *Type(*FuncType) Kind() Kind Len returns the length of t if t is an array type, otherwise 0 MapType returns t cast to a *MapType, or nil if its tag does not match.(*FuncType) NumIn() int(*FuncType) NumMethod() int(*FuncType) NumOut() int(*FuncType) Out(i int) *Type(*FuncType) OutSlice() []*Type Pointers reports whether t contains pointers. Size returns the size of data with type t. StructType returns t cast to a *StructType, or nil if its tag does not match. Uncommon returns a pointer to T's "uncommon" data if there is any, otherwise nil
func (*Type).FuncType() *FuncType
Imethod represents a method on an interface type // name of method // .(*FuncType) underneath
IntArgRegBitmap is a bitmap large enough to hold one bit per
integer argument/return register. Get returns whether the i'th bit of the bitmap is set.
nosplit because it's called in extremely sensitive contexts, like
on the reflectcall return path. Set sets the i'th bit of the bitmap to 1.
// Mask+1 entries total // mask for index. Must be a power of 2 minus 1
case # to dispatch to itab to use for resulting case variable (a *runtime.itab) type of source value (a *Type)
// sorted by hash // import pathTypeType // alignment of variable with this type function for comparing objects of this type
(ptr to object A, ptr to object B) -> ==? // alignment of struct field with this type 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. // hash of type; avoids computation in hash tables // enumeration for C // number of (prefix) bytes in the type that can contain pointers // type for pointer to this type, may be zeroType.Size_uintptr // string form // extra type information flags Align returns the alignment of data with type t. ArrayType returns t cast to a *ArrayType, or nil if its tag does not match. ChanDir returns the direction of t if t is a channel type, otherwise InvalidDir (0).(*InterfaceType) Common() *Type Elem returns the element type for t if t is an array, channel, map, pointer, or slice, otherwise nil.(*InterfaceType) ExportedMethods() []Method(*InterfaceType) FieldAlign() int FuncType returns t cast to a *FuncType, or nil if its tag does not match.(*InterfaceType) GcSlice(begin, end uintptr) []byte(*InterfaceType) HasName() bool IfaceIndir reports whether t is stored indirectly in an interface value. InterfaceType returns t cast to a *InterfaceType, or nil if its tag does not match. isDirectIface reports whether t is stored directly in an interface value.(*InterfaceType) Key() *Type(*InterfaceType) Kind() Kind Len returns the length of t if t is an array type, otherwise 0 MapType returns t cast to a *MapType, or nil if its tag does not match. NumMethod returns the number of interface methods in the type's method set. Pointers reports whether t contains pointers. Size returns the size of data with type t. StructType returns t cast to a *StructType, or nil if its tag does not match. Uncommon returns a pointer to T's "uncommon" data if there is any, otherwise nil
func (*Type).InterfaceType() *InterfaceType
The first word of every non-empty interface type contains an *ITab.
It records the underlying concrete type (Type), the interface type it
is implementing (Inter), and some ancillary information.
allocated in non-garbage-collected memory // variable sized. fun[0]==0 means Type does not implement Inter. // copy of Type.Hash. Used for type switches.Inter*InterfaceTypeType*Type
// internal type representing a hash bucket // size of bucketElem*TypeFlagsuint32 function for hashing keys (ptr to key, seed) -> hashKey*Type // size of key slotTypeType // alignment of variable with this type function for comparing objects of this type
(ptr to object A, ptr to object B) -> ==? // alignment of struct field with this type 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. // hash of type; avoids computation in hash tables // enumeration for C // number of (prefix) bytes in the type that can contain pointers // type for pointer to this type, may be zeroType.Size_uintptr // string form // extra type information flags // size of elem slot Align returns the alignment of data with type t. ArrayType returns t cast to a *ArrayType, or nil if its tag does not match. ChanDir returns the direction of t if t is a channel type, otherwise InvalidDir (0).(*MapType) Common() *Type(*MapType) ExportedMethods() []Method(*MapType) FieldAlign() int FuncType returns t cast to a *FuncType, or nil if its tag does not match.(*MapType) GcSlice(begin, end uintptr) []byte(*MapType) HasName() bool(*MapType) HashMightPanic() bool IfaceIndir reports whether t is stored indirectly in an interface value.(*MapType) IndirectElem() bool Note: flag values must match those used in the TMAP case
in ../cmd/compile/internal/reflectdata/reflect.go:writeType. InterfaceType returns t cast to a *InterfaceType, or nil if its tag does not match. isDirectIface reports whether t is stored directly in an interface value.(*MapType) Kind() Kind Len returns the length of t if t is an array type, otherwise 0 MapType returns t cast to a *MapType, or nil if its tag does not match.(*MapType) NeedKeyUpdate() bool(*MapType) NumMethod() int Pointers reports whether t contains pointers.(*MapType) ReflexiveKey() bool Size returns the size of data with type t. StructType returns t cast to a *StructType, or nil if its tag does not match. Uncommon returns a pointer to T's "uncommon" data if there is any, otherwise nil
func (*Type).MapType() *MapType
Method on non-interface type // fn used in interface call (one-word receiver) // method type (without receiver) // name of method // fn used for normal method call
func (*Type).ExportedMethods() []Method
func (*UncommonType).ExportedMethods() []Method
func (*UncommonType).Methods() []Method
Bytes*byte Data does pointer arithmetic on n's Bytes, and that arithmetic is asserted to
be safe because the runtime made the call (other packages use DataChecked) DataChecked does pointer arithmetic on n's Bytes, and that arithmetic is asserted to
be safe for the reason in whySafe (which can appear in a backtrace, etc.) HasTag returns true iff there is tag data following this name IsBlank indicates whether n is "_". IsEmbedded returns true iff n is embedded (an anonymous field). IsExported returns "is n exported?" Name returns the tag string for n, or empty if there is none. ReadVarint parses a varint as encoded by encoding/binary.
It returns the number of encoded bytes and the encoded value. Tag returns the tag string for n, or empty if there is none.
func NewName(n, tag string, exported, embedded bool) Name
NameOff is the offset to a name from moduledata.types. See resolveNameOff in runtime.
// slice element typeTypeType // alignment of variable with this type function for comparing objects of this type
(ptr to object A, ptr to object B) -> ==? // alignment of struct field with this type 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. // hash of type; avoids computation in hash tables // enumeration for C // number of (prefix) bytes in the type that can contain pointers // type for pointer to this type, may be zeroType.Size_uintptr // string form // extra type information flags Align returns the alignment of data with type t. ArrayType returns t cast to a *ArrayType, or nil if its tag does not match. ChanDir returns the direction of t if t is a channel type, otherwise InvalidDir (0).(*PtrType) Common() *Type(*PtrType) ExportedMethods() []Method(*PtrType) FieldAlign() int FuncType returns t cast to a *FuncType, or nil if its tag does not match.(*PtrType) GcSlice(begin, end uintptr) []byte(*PtrType) HasName() bool IfaceIndir reports whether t is stored indirectly in an interface value. InterfaceType returns t cast to a *InterfaceType, or nil if its tag does not match. isDirectIface reports whether t is stored directly in an interface value.(*PtrType) Key() *Type(*PtrType) Kind() Kind Len returns the length of t if t is an array type, otherwise 0 MapType returns t cast to a *MapType, or nil if its tag does not match.(*PtrType) NumMethod() int Pointers reports whether t contains pointers. Size returns the size of data with type t. StructType returns t cast to a *StructType, or nil if its tag does not match. Uncommon returns a pointer to T's "uncommon" data if there is any, otherwise nil
RegArgs is a struct that has space for each argument
and return value register on the current architecture.
Assembly code knows the layout of the first two fields
of RegArgs.
RegArgs also contains additional space to hold pointers
when it may not be safe to keep them only in the integer
register space otherwise. // untyped float registers Values in these slots should be precisely the bit-by-bit
representation of how they would appear in a register.
This means that on big endian arches, integer values should
be in the top bits of the slot. Floats are usually just
directly represented, but some architectures treat narrow
width floating point values specially (e.g. they're promoted
first, or they need to be NaN-boxed). // untyped integer registers Ptrs is a space that duplicates Ints but with pointer type,
used to make pointers passed or returned in registers
visible to the GC by making the type unsafe.Pointer. ReturnIsPtr is a bitmap that indicates which registers
contain or will contain pointers on the return path from
a reflectcall. The i'th bit indicates whether the i'th
register contains or will contain a valid Go pointer.(*RegArgs) Dump() IntRegArgAddr returns a pointer inside of r.Ints[reg] that is appropriately
offset for an argument of size argSize.
argSize must be non-zero, fit in a register, and a power-of-two.
This method is a helper for dealing with the endianness of different CPU
architectures, since sub-word-sized arguments in big endian architectures
need to be "aligned" to the upper edge of the register to be interpreted
by the CPU correctly.
// slice element typeTypeType // alignment of variable with this type function for comparing objects of this type
(ptr to object A, ptr to object B) -> ==? // alignment of struct field with this type 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. // hash of type; avoids computation in hash tables // enumeration for C // number of (prefix) bytes in the type that can contain pointers // type for pointer to this type, may be zeroType.Size_uintptr // string form // extra type information flags Align returns the alignment of data with type t. ArrayType returns t cast to a *ArrayType, or nil if its tag does not match. ChanDir returns the direction of t if t is a channel type, otherwise InvalidDir (0).(*SliceType) Common() *Type(*SliceType) ExportedMethods() []Method(*SliceType) FieldAlign() int FuncType returns t cast to a *FuncType, or nil if its tag does not match.(*SliceType) GcSlice(begin, end uintptr) []byte(*SliceType) HasName() bool IfaceIndir reports whether t is stored indirectly in an interface value. InterfaceType returns t cast to a *InterfaceType, or nil if its tag does not match. isDirectIface reports whether t is stored directly in an interface value.(*SliceType) Key() *Type(*SliceType) Kind() Kind Len returns the length of t if t is an array type, otherwise 0 MapType returns t cast to a *MapType, or nil if its tag does not match.(*SliceType) NumMethod() int Pointers reports whether t contains pointers. Size returns the size of data with type t. StructType returns t cast to a *StructType, or nil if its tag does not match. Uncommon returns a pointer to T's "uncommon" data if there is any, otherwise nil
// name is always non-empty // byte offset of field // type of field(*StructField) Embedded() bool
Fields[]StructFieldPkgPathNameTypeType // alignment of variable with this type function for comparing objects of this type
(ptr to object A, ptr to object B) -> ==? // alignment of struct field with this type 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. // hash of type; avoids computation in hash tables // enumeration for C // number of (prefix) bytes in the type that can contain pointers // type for pointer to this type, may be zeroType.Size_uintptr // string form // extra type information flags Align returns the alignment of data with type t. ArrayType returns t cast to a *ArrayType, or nil if its tag does not match. ChanDir returns the direction of t if t is a channel type, otherwise InvalidDir (0).(*StructType) Common() *Type Elem returns the element type for t if t is an array, channel, map, pointer, or slice, otherwise nil.(*StructType) ExportedMethods() []Method(*StructType) FieldAlign() int FuncType returns t cast to a *FuncType, or nil if its tag does not match.(*StructType) GcSlice(begin, end uintptr) []byte(*StructType) HasName() bool IfaceIndir reports whether t is stored indirectly in an interface value. InterfaceType returns t cast to a *InterfaceType, or nil if its tag does not match. isDirectIface reports whether t is stored directly in an interface value.(*StructType) Key() *Type(*StructType) Kind() Kind Len returns the length of t if t is an array type, otherwise 0 MapType returns t cast to a *MapType, or nil if its tag does not match.(*StructType) NumMethod() int Pointers reports whether t contains pointers. Size returns the size of data with type t. StructType returns t cast to a *StructType, or nil if its tag does not match. Uncommon returns a pointer to T's "uncommon" data if there is any, otherwise nil
func (*Type).StructType() *StructType
TextOff is an offset from the top of a text section. See (rtype).textOff in runtime.
Type is the runtime representation of a Go type.
Be careful about accessing this type at build time, as the version
of this type in the compiler/linker may not have the same layout
as the version in the target binary, due to pointer width
differences and any experiments. Use cmd/compile/internal/rttype
or the functions in compiletype.go to access this type instead.
(TODO: this admonition applies to every type in this package.
Put it in some shared location?) // alignment of variable with this type function for comparing objects of this type
(ptr to object A, ptr to object B) -> ==? // alignment of struct field with this type 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. // hash of type; avoids computation in hash tables // enumeration for C // number of (prefix) bytes in the type that can contain pointers // type for pointer to this type, may be zeroSize_uintptr // string form // extra type information flags Align returns the alignment of data with type t. ArrayType returns t cast to a *ArrayType, or nil if its tag does not match. ChanDir returns the direction of t if t is a channel type, otherwise InvalidDir (0).(*Type) Common() *Type Elem returns the element type for t if t is an array, channel, map, pointer, or slice, otherwise nil.(*Type) ExportedMethods() []Method(*Type) FieldAlign() int FuncType returns t cast to a *FuncType, or nil if its tag does not match.(*Type) GcSlice(begin, end uintptr) []byte(*Type) HasName() bool IfaceIndir reports whether t is stored indirectly in an interface value. InterfaceType returns t cast to a *InterfaceType, or nil if its tag does not match. isDirectIface reports whether t is stored directly in an interface value.(*Type) Key() *Type(*Type) Kind() Kind Len returns the length of t if t is an array type, otherwise 0 MapType returns t cast to a *MapType, or nil if its tag does not match.(*Type) NumMethod() int Pointers reports whether t contains pointers. Size returns the size of data with type t. StructType returns t cast to a *StructType, or nil if its tag does not match. Uncommon returns a pointer to T's "uncommon" data if there is any, otherwise nil
func TypeOf(a any) *Type
func (*FuncType).In(i int) *Type
func (*FuncType).InSlice() []*Type
func (*FuncType).Out(i int) *Type
func (*FuncType).OutSlice() []*Type
func (*Type).Common() *Type
func (*Type).Elem() *Type
func (*Type).Key() *Type
itab to use for result (a *runtime.itab)
nil if CanFail is set and conversion would fail. type of source value (a *runtime._type)
TypeOff is the offset to a type from moduledata.types. See resolveTypeOff in runtime.
UncommonType is present only for defined types or types with methods
(if T is a defined type, the uncommonTypes for T and *T have methods).
Using a pointer to this struct reduces the overall size required
to describe a non-defined type with no methods. // number of methods // offset from this uncommontype to [mcount]Method // import path; empty for built-in types like int, string // number of exported methods(*UncommonType) ExportedMethods() []Method(*UncommonType) Methods() []Method
func (*Type).Uncommon() *UncommonType
Package-Level Functions (total 12)
CommonSize returns sizeof(Type) for a compilation target with a given ptrSize
Type Parameters:
T: any Escape forces any pointers in x to escape to the heap.
FuncPCABI0 returns the entry PC of the function f, which must be a
direct reference of a function defined as ABI0. Otherwise it is a
compile-time error.
Implemented as a compile intrinsic.
FuncPCABIInternal returns the entry PC of the function f. If f is a
direct reference of a function, it must be defined as ABIInternal.
Otherwise it is a compile-time error. If f is not a direct reference
of a defined function, it assumes that f is a func value. Otherwise
the behavior is undefined.
Implemented as a compile intrinsic.
ITabTypeOff returns the offset of ITab.Type for a compilation target with a given ptrSize
NoEscape hides the pointer p from escape analysis, preventing it
from escaping to the heap. It compiles down to nothing.
WARNING: This is very subtle to use correctly. The caller must
ensure that it's truly safe for p to not escape to the heap by
maintaining runtime pointer invariants (for example, that globals
and the heap may not generally point into a stack).
StructFieldSize returns sizeof(StructField) for a compilation target with a given ptrSize
TFlagOff returns the offset of Type.TFlag for a compilation target with a given ptrSize
TypeOf returns the abi.Type of some value.
UncommonSize returns sizeof(UncommonType). This currently does not depend on ptrSize.
This exported function is in an internal package, so it may change to depend on ptrSize in the future.
ArgsSizeUnknown is set in Func.argsize to mark all functions
whose argument size is unknown (C vararg functions, and
assembly code without an explicit specification).
This value is generated by the compiler, assembler, or linker.
IDs for PCDATA and FUNCDATA tables in Go binaries.
These must agree with ../../../runtime/funcdata.h.
IDs for PCDATA and FUNCDATA tables in Go binaries.
These must agree with ../../../runtime/funcdata.h.
IDs for PCDATA and FUNCDATA tables in Go binaries.
These must agree with ../../../runtime/funcdata.h.
IDs for PCDATA and FUNCDATA tables in Go binaries.
These must agree with ../../../runtime/funcdata.h.
IDs for PCDATA and FUNCDATA tables in Go binaries.
These must agree with ../../../runtime/funcdata.h.
IDs for PCDATA and FUNCDATA tables in Go binaries.
These must agree with ../../../runtime/funcdata.h.
IDs for PCDATA and FUNCDATA tables in Go binaries.
These must agree with ../../../runtime/funcdata.h.
IDs for PCDATA and FUNCDATA tables in Go binaries.
These must agree with ../../../runtime/funcdata.h.
FuncFlagAsm indicates that a function was implemented in assembly.
FuncFlagSPWrite indicates a function that writes an arbitrary value to SP
(any write other than adding or subtracting a constant amount).
The traceback routines cannot encode such changes into the
pcsp tables, so the function traceback cannot safely unwind past
SPWrite functions. Stopping at an SPWrite function is considered
to be an incomplete unwinding of the stack. In certain contexts
(in particular garbage collector stack scans) that is a fatal error.
FuncFlagTopFrame indicates a function that appears at the top of its stack.
The traceback routine stop at such a function and consider that a
successful, complete traversal of the stack.
Examples of TopFrame functions include goexit, which appears
at the top of a user goroutine stack, and mstart, which appears
at the top of a system goroutine stack.
Map constants common to several packages
runtime/runtime-gdb.py:MapTypePrinter contains its own copy
Maximum number of key/elem pairs a bucket can hold.
Map constants common to several packages
runtime/runtime-gdb.py:MapTypePrinter contains its own copy
Maximum key or elem size to keep inline (instead of mallocing per element).
Must fit in a uint8.
Note: fast map functions cannot handle big elems (bigger than MapMaxElemBytes).
MaxPtrmaskBytes is the maximum length of a GC ptrmask bitmap,
which holds 1-bit entries describing where pointers are in a given type.
Above this length, the GC information is recorded as a GC program,
which can express repetition compactly. In either form, the
information is used by the runtime to initialize the heap bitmap,
and for large types (like 128 or more words), they are roughly the
same speed. GC programs are never much larger and often more
compact. (If large arrays are involved, they can be arbitrarily
more compact.)
The cutoff must be large enough that any allocation large enough to
use a GC program is large enough that it does not share heap bitmap
bytes with any other objects, allowing the GC program execution to
assume an aligned start and not use atomic operations. In the current
runtime, this means all malloc size classes larger than the cutoff must
be multiples of four words. On 32-bit systems that's 16 bytes, and
all size classes >= 16 bytes are 16-byte aligned, so no real constraint.
On 64-bit systems, that's 32 bytes, and 32-byte alignment is guaranteed
for size classes >= 256 bytes. On a 64-bit system, 256 bytes allocated
is 32 pointers, the bits for which fit in 4 bytes. So MaxPtrmaskBytes
must be >= 4.
We used to use 16 because the GC programs do have some constant overhead
to get started, and processing 128 pointers seems to be enough to
amortize that overhead well.
To make sure that the runtime's chansend can call typeBitsBulkBarrier,
we raised the limit to 2048, so that even 32-bit systems are guaranteed to
use bitmaps for objects up to 64 kB in size.
These constants are shared between the compiler, which uses them for state functions
and panic indicators, and the runtime, which turns them into more meaningful strings
For best code generation, RF_DONE and RF_READY should be 0 and 1.
These constants are shared between the compiler, which uses them for state functions
and panic indicators, and the runtime, which turns them into more meaningful strings
For best code generation, RF_DONE and RF_READY should be 0 and 1.
These constants are shared between the compiler, which uses them for state functions
and panic indicators, and the runtime, which turns them into more meaningful strings
For best code generation, RF_DONE and RF_READY should be 0 and 1.
These constants are shared between the compiler, which uses them for state functions
and panic indicators, and the runtime, which turns them into more meaningful strings
For best code generation, RF_DONE and RF_READY should be 0 and 1.
These constants are shared between the compiler, which uses them for state functions
and panic indicators, and the runtime, which turns them into more meaningful strings
For best code generation, RF_DONE and RF_READY should be 0 and 1.
Functions that need frames <= StackBig can assume that neither
SP-framesize nor stackGuard-StackSmall will underflow, and thus use a
more efficient check. In order to ensure this, StackBig must be <= the
size of the unmapped space at zero.
StackNosplitBase is the base maximum number of bytes that a chain of
NOSPLIT functions can use.
This value must be multiplied by the stack guard multiplier, so do not
use it directly. See runtime/stack.go:stackNosplit and
cmd/internal/objabi/stack.go:StackNosplit.
After a stack split check the SP is allowed to be StackSmall bytes below
the stack guard.
Functions that need frames <= StackSmall can perform the stack check
using a single comparison directly between the stack guard and the SP
because we ensure that StackSmall bytes of stack space are available
beyond the stack guard.
TFlagExtraStar means the name in the str field has an
extraneous '*' prefix. This is because for most types T in
a program, the type *T also exists and reusing the str data
saves binary size.
TFlagNamed means the type has a name.
TFlagRegularMemory means that equal and hash functions can treat
this type as a single region of t.size bytes.
TFlagUncommon means that there is a data with a type, UncommonType,
just beyond the shared-per-type common data. That is, the data
for struct types will store their UncommonType at one offset, the
data for interface types will store their UncommonType at a different
offset. UncommonType is always accessed via a pointer that is computed
using trust-us-we-are-the-implementors pointer arithmetic.
For example, if t.Kind() == Struct and t.tflag&TFlagUncommon != 0,
then t has UncommonType data and it can be accessed as:
type structTypeUncommon struct {
structType
u UncommonType
}
u := &(*structTypeUncommon)(unsafe.Pointer(t)).u
TFlagUnrolledBitmap marks special types that are unrolled-bitmap
versions of types with GC programs.
These types need to be deallocated when the underlying object
is freed.
Populate the data.
The data is a stream of bytes, which contains the offsets and sizes of the
non-aggregate arguments or non-aggregate fields/elements of aggregate-typed
arguments, along with special "operators". Specifically,
- for each non-aggregate arg/field/element, its offset from FP (1 byte) and
size (1 byte)
- special operators:
- 0xff - end of sequence
- 0xfe - print { (at the start of an aggregate-typed argument)
- 0xfd - print } (at the end of an aggregate-typed argument)
- 0xfc - print ... (more args/fields/elements)
- 0xfb - print _ (offset too large)
Populate the data.
The data is a stream of bytes, which contains the offsets and sizes of the
non-aggregate arguments or non-aggregate fields/elements of aggregate-typed
arguments, along with special "operators". Specifically,
- for each non-aggregate arg/field/element, its offset from FP (1 byte) and
size (1 byte)
- special operators:
- 0xff - end of sequence
- 0xfe - print { (at the start of an aggregate-typed argument)
- 0xfd - print } (at the end of an aggregate-typed argument)
- 0xfc - print ... (more args/fields/elements)
- 0xfb - print _ (offset too large)
Populate the data.
The data is a stream of bytes, which contains the offsets and sizes of the
non-aggregate arguments or non-aggregate fields/elements of aggregate-typed
arguments, along with special "operators". Specifically,
- for each non-aggregate arg/field/element, its offset from FP (1 byte) and
size (1 byte)
- special operators:
- 0xff - end of sequence
- 0xfe - print { (at the start of an aggregate-typed argument)
- 0xfd - print } (at the end of an aggregate-typed argument)
- 0xfc - print ... (more args/fields/elements)
- 0xfb - print _ (offset too large)
const TraceArgsLimit = 10 // print no more than 10 args/components
maxLen is a (conservative) upper bound of the byte stream length. For
each arg/component, it has no more than 2 bytes of data (size, offset),
and no more than one {, }, ... at each level (it cannot have both the
data and ... unless it is the last one, just be conservative). Plus 1
for _endSeq.
Populate the data.
The data is a stream of bytes, which contains the offsets and sizes of the
non-aggregate arguments or non-aggregate fields/elements of aggregate-typed
arguments, along with special "operators". Specifically,
- for each non-aggregate arg/field/element, its offset from FP (1 byte) and
size (1 byte)
- special operators:
- 0xff - end of sequence
- 0xfe - print { (at the start of an aggregate-typed argument)
- 0xfd - print } (at the end of an aggregate-typed argument)
- 0xfc - print ... (more args/fields/elements)
- 0xfb - print _ (offset too large)
Populate the data.
The data is a stream of bytes, which contains the offsets and sizes of the
non-aggregate arguments or non-aggregate fields/elements of aggregate-typed
arguments, along with special "operators". Specifically,
- for each non-aggregate arg/field/element, its offset from FP (1 byte) and
size (1 byte)
- special operators:
- 0xff - end of sequence
- 0xfe - print { (at the start of an aggregate-typed argument)
- 0xfd - print } (at the end of an aggregate-typed argument)
- 0xfc - print ... (more args/fields/elements)
- 0xfb - print _ (offset too large)
Populate the data.
The data is a stream of bytes, which contains the offsets and sizes of the
non-aggregate arguments or non-aggregate fields/elements of aggregate-typed
arguments, along with special "operators". Specifically,
- for each non-aggregate arg/field/element, its offset from FP (1 byte) and
size (1 byte)
- special operators:
- 0xff - end of sequence
- 0xfe - print { (at the start of an aggregate-typed argument)
- 0xfd - print } (at the end of an aggregate-typed argument)
- 0xfc - print ... (more args/fields/elements)
- 0xfb - print _ (offset too large)
UnsafePointRestart1(2) apply on a sequence of instructions, within
which if an async preemption happens, we should back off the PC
to the start of the sequence when resuming.
We need two so we can distinguish the start/end of the sequence
in case that two sequences are next to each other.
Special values for the PCDATA_UnsafePoint table.
Like UnsafePointRestart1, but back to function entry if async preempted.
Special values for the PCDATA_UnsafePoint table.
Special values for the PCDATA_UnsafePoint table.
ZeroValSize is the size in bytes of runtime.zeroVal.
The pages are generated with Goldsv0.7.0-preview. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.