This libgo patch drops unused C type reflection code. In particular, it drops __go_type_descriptors_equal, which is no longer used, and will be made obsolete by https://golang.org/cl/179598. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 271822) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -52176566485e20968394a5cb67a89ac676182594 +4150db0e4613043e38a146a971e5b0dcacad7c2a The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/Makefile.am =================================================================== --- libgo/Makefile.am (revision 271818) +++ libgo/Makefile.am (working copy) @@ -469,7 +469,6 @@ runtime_files = \ runtime/go-setenv.c \ runtime/go-signal.c \ runtime/go-strslice.c \ - runtime/go-typedesc-equal.c \ runtime/go-unsafe-pointer.c \ runtime/go-unsetenv.c \ runtime/go-unwind.c \ Index: libgo/runtime/go-type.h =================================================================== --- libgo/runtime/go-type.h (revision 271669) +++ libgo/runtime/go-type.h (working copy) @@ -153,53 +153,6 @@ struct __go_uncommon_type struct __go_open_array __methods; }; -/* The type descriptor for a fixed array type. */ - -struct __go_array_type -{ - /* Starts like all type descriptors. */ - struct __go_type_descriptor __common; - - /* 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; -}; - -/* The type descriptor for a slice. */ - -struct __go_slice_type -{ - /* Starts like all other type descriptors. */ - struct __go_type_descriptor __common; - - /* The element type. */ - struct __go_type_descriptor *__element_type; -}; - -/* The direction of a channel. */ -#define CHANNEL_RECV_DIR 1 -#define CHANNEL_SEND_DIR 2 -#define CHANNEL_BOTH_DIR (CHANNEL_RECV_DIR | CHANNEL_SEND_DIR) - -/* The type descriptor for a channel. */ - -struct __go_channel_type -{ - /* Starts like all other type descriptors. */ - struct __go_type_descriptor __common; - - /* The element type. */ - const struct __go_type_descriptor *__element_type; - - /* The direction. */ - uintptr_t __dir; -}; - /* The type descriptor for a function. */ struct __go_func_type @@ -221,34 +174,6 @@ struct __go_func_type struct __go_open_array __out; }; -/* A method on an interface type. */ - -struct __go_interface_method -{ - /* The name of the method. */ - const struct String *__name; - - /* This is NULL for an exported method, or the name of the package - where it lives. */ - const struct String *__pkg_path; - - /* The real type of the method. */ - struct __go_type_descriptor *__type; -}; - -/* An interface type. */ - -struct __go_interface_type -{ - /* Starts like all other type descriptors. */ - struct __go_type_descriptor __common; - - /* Array of __go_interface_method . The methods are sorted in the - same order that they appear in the definition of the - interface. */ - struct __go_open_array __methods; -}; - /* A map type. */ struct __go_map_type @@ -301,69 +226,4 @@ struct __go_ptr_type const struct __go_type_descriptor *__element_type; }; -/* A field in a structure. */ - -struct __go_struct_field -{ - /* The name of the field--NULL for an anonymous field. */ - const struct String *__name; - - /* This is NULL for an exported method, or the name of the package - where it lives. */ - const struct String *__pkg_path; - - /* The type of the field. */ - const struct __go_type_descriptor *__type; - - /* The field tag, or NULL. */ - const struct String *__tag; - - /* The offset of the field in the struct. */ - uintptr_t __offset; -}; - -/* A struct type. */ - -struct __go_struct_type -{ - /* Starts like all other type descriptors. */ - struct __go_type_descriptor __common; - - /* An array of struct __go_struct_field. */ - struct __go_open_array __fields; -}; - -/* Whether a type descriptor is a pointer. */ - -static inline _Bool -__go_is_pointer_type (const struct __go_type_descriptor *td) -{ - return ((td->__code & GO_CODE_MASK) == GO_PTR - || (td->__code & GO_CODE_MASK) == GO_UNSAFE_POINTER); -} - -/* Call a type hash function, given the __hashfn value. */ - -static inline uintptr_t -__go_call_hashfn (const FuncVal *hashfn, const void *p, uintptr_t seed, - uintptr_t size) -{ - uintptr_t (*h) (const void *, uintptr_t, uintptr_t) = (void *) hashfn->fn; - return __builtin_call_with_static_chain (h (p, seed, size), hashfn); -} - -/* Call a type equality function, given the __equalfn value. */ - -static inline _Bool -__go_call_equalfn (const FuncVal *equalfn, const void *p1, const void *p2, - uintptr_t size) -{ - _Bool (*e) (const void *, const void *, uintptr_t) = (void *) equalfn->fn; - return __builtin_call_with_static_chain (e (p1, p2, size), equalfn); -} - -extern _Bool -__go_type_descriptors_equal(const struct __go_type_descriptor*, - const struct __go_type_descriptor*); - #endif /* !defined(LIBGO_GO_TYPE_H) */ Index: libgo/runtime/go-typedesc-equal.c =================================================================== --- libgo/runtime/go-typedesc-equal.c (revision 271669) +++ libgo/runtime/go-typedesc-equal.c (nonexistent) @@ -1,28 +0,0 @@ -/* go-typedesc-equal.c -- return whether two type descriptors are equal. - - Copyright 2009 The Go Authors. All rights reserved. - Use of this source code is governed by a BSD-style - license that can be found in the LICENSE file. */ - -#include "runtime.h" -#include "go-string.h" -#include "go-type.h" - -/* Compare type descriptors for equality. This is necessary because - types may have different descriptors in different shared libraries. - Also, unnamed types may have multiple type descriptors even in a - single shared library. */ - -_Bool -__go_type_descriptors_equal (const struct __go_type_descriptor *td1, - const struct __go_type_descriptor *td2) -{ - if (td1 == td2) - return 1; - /* In a type switch we can get a NULL descriptor. */ - if (td1 == NULL || td2 == NULL) - return 0; - if (td1->__code != td2->__code || td1->__hash != td2->__hash) - return 0; - return __go_ptr_strings_equal (td1->__reflection, td2->__reflection); -} Index: libgo/runtime/runtime.h =================================================================== --- libgo/runtime/runtime.h (revision 271818) +++ libgo/runtime/runtime.h (working copy) @@ -78,9 +78,7 @@ typedef struct _panic Panic; typedef struct __go_ptr_type PtrType; typedef struct __go_func_type FuncType; -typedef struct __go_interface_type InterfaceType; typedef struct __go_map_type MapType; -typedef struct __go_channel_type ChanType; typedef struct tracebackg Traceback;