diff options
Diffstat (limited to 'libgo/runtime/go-type.h')
-rw-r--r-- | libgo/runtime/go-type.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/libgo/runtime/go-type.h b/libgo/runtime/go-type.h index 2269ae6339..d769335303 100644 --- a/libgo/runtime/go-type.h +++ b/libgo/runtime/go-type.h @@ -54,12 +54,14 @@ struct String; #define GO_STRUCT 25 #define GO_UNSAFE_POINTER 26 +#define GO_DIRECT_IFACE (1 << 5) +#define GO_GC_PROG (1 << 6) #define GO_NO_POINTERS (1 << 7) -#define GO_CODE_MASK 0x7f +#define GO_CODE_MASK 0x1f /* For each Go type the compiler constructs one of these structures. - This is used for type reflectin, interfaces, maps, and reference + This is used for type reflection, interfaces, maps, and reference counting. */ struct __go_type_descriptor @@ -93,6 +95,9 @@ struct __go_type_descriptor size of this type, and returns whether the values are equal. */ _Bool (*__equalfn) (const void *, const void *, uintptr_t); + /* The garbage collection data. */ + const uintptr *__gc; + /* A string describing this type. This is only used for debugging. */ const struct String *__reflection; @@ -103,6 +108,11 @@ struct __go_type_descriptor /* The descriptor for the type which is a pointer to this type. This may be NULL. */ const struct __go_type_descriptor *__pointer_to_this; + + /* A pointer to a zero value for this type. All types will point to + the same zero value, go$zerovalue, which is a common variable so + that it will be large enough. */ + void *__zero; }; /* The information we store for each method of a type. */ @@ -297,21 +307,13 @@ struct __go_struct_type struct __go_open_array __fields; }; -/* If an empty interface has these bits set in its type pointer, it - was copied from a reflect.Value and is not a valid empty - interface. */ - -enum -{ - reflectFlags = 3, -}; - /* Whether a type descriptor is a pointer. */ static inline _Bool __go_is_pointer_type (const struct __go_type_descriptor *td) { - return td->__code == GO_PTR || td->__code == GO_UNSAFE_POINTER; + return ((td->__code & GO_CODE_MASK) == GO_PTR + || (td->__code & GO_CODE_MASK) == GO_UNSAFE_POINTER); } extern _Bool |