From patchwork Fri May 31 21:32:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 1108587 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-502123-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=golang.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ZgMQErmk"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=golang-org.20150623.gappssmtp.com header.i=@golang-org.20150623.gappssmtp.com header.b="nbpCY5zr"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45FyP34M45z9sNR for ; Sat, 1 Jun 2019 07:33:22 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=cT1AN8DWtmU5VpM62mHmC0vcdCXMzDxbXGiCZ5n6ZJfOGD aQZQgdtc3lbgR4yx/usOslNt/aIiGmkfdjFjiP2jlAiYlsL7koC8cJkunMxkIFae Lny3Mhzxvos8T0gEaad8MK5dHp6d4Omu5uJE/5MQ3QwxC23Tmgn2ADCg1loJc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=W1hRceUmA+eOlyvpWsWDc/Ru520=; b=ZgMQErmkGdycUBgOMi6Z mJexoi99Vqg17eXT7/odE8fnbkAR4Ys5L2Oq9WgRGeAtg3I9vaaoDWO+m3j/VdtL EEDWAIVhJwnK6QH4q77aIlSfZvmF5LKw/yH5ZdOQAjIJaK/vFQ+whGIMvwNDUC+K QUS4rDOZLBdadXktdeuerj0= Received: (qmail 17410 invoked by alias); 31 May 2019 21:33:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 17402 invoked by uid 89); 31 May 2019 21:33:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=1746, rights X-HELO: mail-lf1-f41.google.com Received: from mail-lf1-f41.google.com (HELO mail-lf1-f41.google.com) (209.85.167.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 31 May 2019 21:33:12 +0000 Received: by mail-lf1-f41.google.com with SMTP id q26so9073229lfc.3 for ; Fri, 31 May 2019 14:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=5OvFpBnKYKnkWM2NwhKpAtwyiqguyG2pnGy+oU5HkHM=; b=nbpCY5zrc1q6OvySPj+epLK2wmTOj3XJ4zOO7o7g9FvjThiYYjfddXf7cMjvoDGLr3 nzNHzzadp1J+3LNMvChV1u4XGvdpX0NdMDmpOYNH5qv00Yep0Yju5QSw3YJGfzFpj7Gs RHTWNjJqHx8wEMq911UYtLQgmQuPTk6Nf4f2gbzHRnTFWMSU3vP/pf0aZsAAwzapas4l pPeJ51HFPOUPY9UtSXP1FUM6S2vUyYWYzA2csi73lyQ8xPx54QtoCTPRvNhYnDKe3s3X JB4gDk4kXiWL+9H+lR/x5ROf5Ak2UI09iBGqB3KpRVNrp5s84sj82OXrEkGdeGr/1Rjc HJlA== MIME-Version: 1.0 From: Ian Lance Taylor Date: Fri, 31 May 2019 14:32:58 -0700 Message-ID: Subject: libgo patch committed: Drop unused C type reflection code To: gcc-patches , gofrontend-dev 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;