github.com/eh-steve/goloader@v0.0.0-20240111193454-90ff3cfdae39/type.1.14.go (about)

     1  //go:build go1.14 && !go1.23
     2  // +build go1.14,!go1.23
     3  
     4  package goloader
     5  
     6  import (
     7  	"unsafe"
     8  )
     9  
    10  // Needs to be in sync with ../cmd/link/internal/ld/decodesym.go:/^func.commonsize,
    11  // ../cmd/compile/internal/gc/reflect.go:/^func.dcommontype and
    12  // ../reflect/type.go:/^type.rtype.
    13  // ../internal/reflectlite/type.go:/^type.rtype.
    14  type _type struct {
    15  	size       uintptr
    16  	ptrdata    uintptr // size of memory prefix holding all pointers
    17  	hash       uint32
    18  	tflag      tflag
    19  	align      uint8
    20  	fieldAlign uint8
    21  	kind       uint8
    22  	// function for comparing objects of this type
    23  	// (ptr to object A, ptr to object B) -> ==?
    24  	equal func(unsafe.Pointer, unsafe.Pointer) bool
    25  	// gcdata stores the GC type data for the garbage collector.
    26  	// If the KindGCProg bit is set in kind, gcdata is a GC program.
    27  	// Otherwise it is a ptrmask bitmap. See mbitmap.go for details.
    28  	gcdata    *byte
    29  	str       nameOff
    30  	ptrToThis typeOff
    31  }
    32  
    33  // uncommonType is present only for types with names or methods
    34  // (if T is a named type, the uncommonTypes for T and *T have methods).
    35  // Using a pointer to this struct reduces the overall size required
    36  // to describe an unnamed type with no methods.
    37  type uncommonType struct {
    38  	pkgpath nameOff
    39  	mcount  uint16 // number of methods
    40  	xcount  uint16 // number of exported methods
    41  	moff    uint32 // offset from this uncommontype to [mcount]method
    42  	_       uint32 // unused
    43  }
    44  
    45  type mapType struct {
    46  	_type
    47  	key    *_type // map key type
    48  	elem   *_type // map element (value) type
    49  	bucket *_type // internal bucket structure
    50  	// function for hashing keys (ptr to key, seed) -> hash
    51  	hasher     func(unsafe.Pointer, uintptr) uintptr
    52  	keysize    uint8  // size of key slot
    53  	valuesize  uint8  // size of value slot
    54  	bucketsize uint16 // size of bucket
    55  	flags      uint32
    56  }