OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / libgo / runtime / go-type.h
index b1f3285..25f096c 100644 (file)
 #define GO_STRUCT 25
 #define GO_UNSAFE_POINTER 26
 
+#define GO_NO_POINTERS (1 << 7)
+
+#define GO_CODE_MASK 0x7f
+
 /* For each Go type the compiler constructs one of these structures.
    This is used for type reflectin, interfaces, maps, and reference
    counting.  */
 
 struct __go_type_descriptor
 {
-  /* The type code for this type, a value in enum __go_type_codes.
+  /* The type code for this type, one of the type kind values above.
      This is used by unsafe.Reflect and unsafe.Typeof to determine the
      type descriptor to return for this type itself.  It is also used
      by reflect.toType when mapping to a reflect Type structure.  */
@@ -82,11 +86,11 @@ struct __go_type_descriptor
      size of this type, and returns a hash code.  We pass the size
      explicitly becaues it means that we can share a single instance
      of this function for various different types.  */
-  size_t (*__hashfn) (const void *, size_t);
+  uintptr_t (*__hashfn) (const void *, uintptr_t);
 
   /* This function takes two pointers to values of this type, and the
      size of this type, and returns whether the values are equal.  */
-  _Bool (*__equalfn) (const void *, const void *, size_t);
+  _Bool (*__equalfn) (const void *, const void *, uintptr_t);
 
   /* A string describing this type.  This is only used for
      debugging.  */
@@ -94,6 +98,10 @@ struct __go_type_descriptor
 
   /* A pointer to fields which are only used for some types.  */
   const struct __go_uncommon_type *__uncommon;
+
+  /* The descriptor for the type which is a pointer to this type.
+     This may be NULL.  */
+  const struct __go_type_descriptor *__pointer_to_this;
 };
 
 /* The information we store for each method of a type.  */
@@ -145,6 +153,9 @@ struct __go_array_type
   /* The element type.  */
   struct __go_type_descriptor *__element_type;
 
+  /* The type of a slice of the same element type.  */
+  struct __go_type_descriptor *__slice_type;
+
   /* The length of the array.  */
   uintptr_t __len;
 };
@@ -285,6 +296,15 @@ 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
@@ -297,13 +317,17 @@ extern _Bool
 __go_type_descriptors_equal(const struct __go_type_descriptor*,
                            const struct __go_type_descriptor*);
 
-extern size_t __go_type_hash_identity (const void *, size_t);
-extern _Bool __go_type_equal_identity (const void *, const void *, size_t);
-extern size_t __go_type_hash_string (const void *, size_t);
-extern _Bool __go_type_equal_string (const void *, const void *, size_t);
-extern size_t __go_type_hash_interface (const void *, size_t);
-extern _Bool __go_type_equal_interface (const void *, const void *, size_t);
-extern size_t __go_type_hash_error (const void *, size_t);
-extern _Bool __go_type_equal_error (const void *, const void *, size_t);
+extern uintptr_t __go_type_hash_identity (const void *, uintptr_t);
+extern _Bool __go_type_equal_identity (const void *, const void *, uintptr_t);
+extern uintptr_t __go_type_hash_string (const void *, uintptr_t);
+extern _Bool __go_type_equal_string (const void *, const void *, uintptr_t);
+extern uintptr_t __go_type_hash_float (const void *, uintptr_t);
+extern _Bool __go_type_equal_float (const void *, const void *, uintptr_t);
+extern uintptr_t __go_type_hash_complex (const void *, uintptr_t);
+extern _Bool __go_type_equal_complex (const void *, const void *, uintptr_t);
+extern uintptr_t __go_type_hash_interface (const void *, uintptr_t);
+extern _Bool __go_type_equal_interface (const void *, const void *, uintptr_t);
+extern uintptr_t __go_type_hash_error (const void *, uintptr_t);
+extern _Bool __go_type_equal_error (const void *, const void *, uintptr_t);
 
 #endif /* !defined(LIBGO_GO_TYPE_H) */