From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102099 invoked by alias); 24 Jun 2015 10:13:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 102078 invoked by uid 89); 24 Jun 2015 10:13:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_05,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f53.google.com Received: from mail-la0-f53.google.com (HELO mail-la0-f53.google.com) (209.85.215.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 24 Jun 2015 10:13:13 +0000 Received: by lacny3 with SMTP id ny3so22928677lac.3 for ; Wed, 24 Jun 2015 03:13:09 -0700 (PDT) X-Received: by 10.112.24.233 with SMTP id x9mr40290387lbf.7.1435140789934; Wed, 24 Jun 2015 03:13:09 -0700 (PDT) Received: from [192.168.123.200] ([77.41.78.126]) by mx.google.com with ESMTPSA id cq1sm4053227lad.18.2015.06.24.03.13.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jun 2015 03:13:09 -0700 (PDT) Message-ID: <558A82B2.5000803@gmail.com> Date: Wed, 24 Jun 2015 10:13:00 -0000 From: Mikhail Maltsev User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Re: [06/12] Consolidate string hashers References: <87egl2bicm.fsf@e105548-lin.cambridge.arm.com> <87k2uua3a9.fsf@e105548-lin.cambridge.arm.com> In-Reply-To: <87k2uua3a9.fsf@e105548-lin.cambridge.arm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg01684.txt.bz2 On 23.06.2015 17:49, Richard Sandiford wrote: > This patch replaces various string hashers with a single copy > in hash-traits.h. (snip) > Index: gcc/config/alpha/alpha.c > =================================================================== > --- gcc/config/alpha/alpha.c 2015-06-23 15:48:30.751788389 +0100 > +++ gcc/config/alpha/alpha.c 2015-06-23 15:48:30.747788453 +0100 > @@ -4808,13 +4808,7 @@ alpha_multipass_dfa_lookahead (void) > > struct GTY(()) alpha_links; > > -struct string_traits : default_hashmap_traits > -{ > - static bool equal_keys (const char *const &a, const char *const &b) > - { > - return strcmp (a, b) == 0; > - } > -}; > +typedef simple_hashmap_traits string_traits; > I remember that when we briefly discussed unification of string traits, a looked through GCC code and this one seemed weird to me: it does not reimplement the hash function. I.e. the pointer value is used as hash. I wonder, is it intentional or not? This could actually work if strings are interned (but in that case there is no need to compare them, because comparing pointers would be enough). -- Regards, Mikhail Maltsev