github.com/q45/go@v0.0.0-20151101211701-a4fb8c13db3f/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/compile/internal/ld/decodesym.go:/^func.commonsize, 12 // ../cmd/compile/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 } 31 32 type method struct { 33 name *string 34 pkgpath *string 35 mtyp *_type 36 typ *_type 37 ifn unsafe.Pointer 38 tfn unsafe.Pointer 39 } 40 41 type uncommontype struct { 42 name *string 43 pkgpath *string 44 mhdr []method 45 } 46 47 type imethod struct { 48 name *string 49 pkgpath *string 50 _type *_type 51 } 52 53 type interfacetype struct { 54 typ _type 55 mhdr []imethod 56 } 57 58 type maptype struct { 59 typ _type 60 key *_type 61 elem *_type 62 bucket *_type // internal type representing a hash bucket 63 hmap *_type // internal type representing a hmap 64 keysize uint8 // size of key slot 65 indirectkey bool // store ptr to key instead of key itself 66 valuesize uint8 // size of value slot 67 indirectvalue bool // store ptr to value instead of value itself 68 bucketsize uint16 // size of bucket 69 reflexivekey bool // true if k==k for all keys 70 needkeyupdate bool // true if we need to update key on an overwrite 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 []*_type 88 out []*_type 89 } 90 91 type ptrtype struct { 92 typ _type 93 elem *_type 94 }