github.com/c0deoo1/golang1.5@v0.0.0-20220525150107-c87c805d4593/src/runtime/type.go (about) 1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Runtime type representation. 6 7 package runtime 8 9 import "unsafe" 10 11 // Needs to be in sync with ../cmd/internal/ld/decodesym.go:/^func.commonsize, 12 // ../cmd/internal/gc/reflect.go:/^func.dcommontype and 13 // ../reflect/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 _unused uint8 19 align uint8 20 fieldalign uint8 21 kind uint8 22 alg *typeAlg 23 // gcdata stores the GC type data for the garbage collector. 24 // If the KindGCProg bit is set in kind, gcdata is a GC program. 25 // Otherwise it is a ptrmask bitmap. See mbitmap.go for details. 26 gcdata *byte 27 _string *string 28 x *uncommontype 29 ptrto *_type 30 zero *byte // ptr to the zero value for this type 31 } 32 33 type method struct { 34 name *string 35 pkgpath *string 36 mtyp *_type 37 typ *_type 38 ifn unsafe.Pointer 39 tfn unsafe.Pointer 40 } 41 42 type uncommontype struct { 43 name *string 44 pkgpath *string 45 mhdr []method 46 } 47 48 type imethod struct { 49 name *string 50 pkgpath *string 51 _type *_type 52 } 53 54 type interfacetype struct { 55 typ _type 56 mhdr []imethod 57 } 58 59 type maptype struct { 60 typ _type 61 key *_type 62 elem *_type 63 bucket *_type // internal type representing a hash bucket 64 hmap *_type // internal type representing a hmap 65 keysize uint8 // size of key slot 66 indirectkey bool // store ptr to key instead of key itself 67 valuesize uint8 // size of value slot 68 indirectvalue bool // store ptr to value instead of value itself 69 bucketsize uint16 // size of bucket 70 reflexivekey bool // true if k==k for all keys 71 } 72 73 type chantype struct { 74 typ _type 75 elem *_type 76 dir uintptr 77 } 78 79 type slicetype struct { 80 typ _type 81 elem *_type 82 } 83 84 type functype struct { 85 typ _type 86 dotdotdot bool 87 in slice 88 out slice 89 } 90 91 type ptrtype struct { 92 typ _type 93 elem *_type 94 }