From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 16 13:21:03 2020 Received: (at submit) by debbugs.gnu.org; 16 Feb 2020 18:21:03 +0000 Received: from localhost ([127.0.0.1]:37651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3OXO-0003do-Ku for submit@debbugs.gnu.org; Sun, 16 Feb 2020 13:21:02 -0500 Received: from lists.gnu.org ([209.51.188.17]:36584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3OXM-0003d5-P6 for submit@debbugs.gnu.org; Sun, 16 Feb 2020 13:21:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54404) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3OXL-0005jh-ND for bug-guile@gnu.org; Sun, 16 Feb 2020 13:21:00 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=BAYES_20, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3OXK-0004qS-Kw for bug-guile@gnu.org; Sun, 16 Feb 2020 13:20:59 -0500 Received: from defaultvalue.org ([45.33.119.55]:59148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j3OXK-0004pX-EQ for bug-guile@gnu.org; Sun, 16 Feb 2020 13:20:58 -0500 Received: from trouble.defaultvalue.org (localhost [127.0.0.1]) (Authenticated sender: rlb@defaultvalue.org) by defaultvalue.org (Postfix) with ESMTPSA id 912D2200FF for ; Sun, 16 Feb 2020 12:20:57 -0600 (CST) Received: by trouble.defaultvalue.org (Postfix, from userid 1000) id CE91714E071; Sun, 16 Feb 2020 12:20:56 -0600 (CST) From: Rob Browning To: bug-guile@gnu.org Subject: All keyowrds hash to the same value Date: Sun, 16 Feb 2020 12:20:56 -0600 Message-ID: <87wo8mcs1j.fsf@trouble.defaultvalue.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 45.33.119.55 X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) --=-=-= Content-Type: text/plain (hash #:x most-postive-fixnum) hashes to the same value for all keyowrds in at least 2.2 and 3.0. Here's one potential fix for 3.0, and I'd be happy to adjust it for 2.2 if needed. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Implement-hashing-for-keywords-i.e.-hash-x.patch Content-Description: 0001-Implement-hashing-for-keywords-i.e.-hash-x.patch >From b380102564aad053f22586eb404e99c82635a3b0 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sun, 16 Feb 2020 12:12:08 -0600 Subject: [PATCH 1/1] Implement hashing for keywords, i.e. (hash #:x ...) Add keyword handling to (hash ...). Previously it would just return the same value for all keywords. * libguile/hash.c (scm_raw_ihash): Add scm_tc7_keyword case. * libguile/keywords.h (SCM_I_KEYWORD_HASH): New macro. --- libguile/hash.c | 3 +++ libguile/keywords.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/libguile/hash.c b/libguile/hash.c index d6e93dae0..c51a794c9 100644 --- a/libguile/hash.c +++ b/libguile/hash.c @@ -35,6 +35,7 @@ #include "chars.h" #include "foreign.h" #include "gsubr.h" +#include "keywords.h" #include "numbers.h" #include "pairs.h" #include "ports.h" @@ -307,6 +308,8 @@ scm_raw_ihash (SCM obj, size_t depth) return scm_i_string_hash (obj); case scm_tc7_symbol: return scm_i_symbol_hash (obj); + case scm_tc7_keyword: + return SCM_I_KEYWORD_HASH (obj); case scm_tc7_pointer: return scm_raw_ihashq ((uintptr_t) SCM_POINTER_VALUE (obj)); case scm_tc7_wvect: diff --git a/libguile/keywords.h b/libguile/keywords.h index c8f480869..cb8598d8b 100644 --- a/libguile/keywords.h +++ b/libguile/keywords.h @@ -60,6 +60,8 @@ SCM_API void scm_c_bind_keyword_arguments (const char *subr, SCM rest, scm_t_keyword_arguments_flags flags, ...); +#define SCM_I_KEYWORD_HASH(x) scm_i_symbol_hash (SCM_CELL_OBJECT_1 (x)) + SCM_INTERNAL void scm_init_keywords (void); #endif /* SCM_KEYWORDS_H */ -- 2.24.1 --=-=-= Content-Type: text/plain -- Rob Browning rlb @defaultvalue.org and @debian.org GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 20 04:49:01 2020 Received: (at control) by debbugs.gnu.org; 20 Feb 2020 09:49:01 +0000 Received: from localhost ([127.0.0.1]:43853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j4iS5-0005LR-5P for submit@debbugs.gnu.org; Thu, 20 Feb 2020 04:49:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40198) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j4iS3-0005LE-9U for control@debbugs.gnu.org; Thu, 20 Feb 2020 04:48:59 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j4iRy-0004QB-4E for control@debbugs.gnu.org; Thu, 20 Feb 2020 04:48:54 -0500 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=45966 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1j4iRx-0005jh-NI for control@debbugs.gnu.org; Thu, 20 Feb 2020 04:48:53 -0500 Date: Thu, 20 Feb 2020 10:48:52 +0100 Message-Id: <87sgj5bncr.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #39634 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) severity 39634 important quit From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 20 11:19:29 2020 Received: (at 39634) by debbugs.gnu.org; 20 Feb 2020 16:19:29 +0000 Received: from localhost ([127.0.0.1]:45685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j4oXx-0004D7-4u for submit@debbugs.gnu.org; Thu, 20 Feb 2020 11:19:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40995) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j4oXv-0004Ck-4f for 39634@debbugs.gnu.org; Thu, 20 Feb 2020 11:19:27 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j4oXp-0000Jr-H2; Thu, 20 Feb 2020 11:19:21 -0500 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=47690 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1j4oXo-0001zK-Ps; Thu, 20 Feb 2020 11:19:21 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Rob Browning Subject: Re: bug#39634: All keyowrds hash to the same value References: <87wo8mcs1j.fsf@trouble.defaultvalue.org> Date: Thu, 20 Feb 2020 17:19:18 +0100 In-Reply-To: <87wo8mcs1j.fsf@trouble.defaultvalue.org> (Rob Browning's message of "Sun, 16 Feb 2020 12:20:56 -0600") Message-ID: <875zg19qpl.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39634 Cc: 39634@debbugs.gnu.org, Andy Wingo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Rob, Rob Browning skribis: >>>From b380102564aad053f22586eb404e99c82635a3b0 Mon Sep 17 00:00:00 2001 > From: Rob Browning > Date: Sun, 16 Feb 2020 12:12:08 -0600 > Subject: [PATCH 1/1] Implement hashing for keywords, i.e. (hash #:x ...) > > Add keyword handling to (hash ...). Previously it would just return the > same value for all keywords. > > * libguile/hash.c (scm_raw_ihash): Add scm_tc7_keyword case. > > * libguile/keywords.h (SCM_I_KEYWORD_HASH): New macro. LGTM, please push! Andy and I discussed it on IRC and despite the fact that it=E2=80=99s an ABI change, we thought including the fix in 3.0.1 was probably the better option. Of all the scm_tc7_ values listed in =E2=80=98scm.h=E2=80=99, the following= are not explicitly listed (so they go to the default case that hashes the first word): variable, hashtable, fluid, stringbuf, dynamic_state, frame, atomic_box, values, program, vm_cont, bytevector, weak_set, weak_table, array, bitvector, port So for example all input file ports hash to the same value, all 3-element bytevectors hash to the same value, etc. We can probably omit stringbuf, dynamic_state, and values, but the rest should probably be fixed. WDYT, Andy? Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 25 15:57:16 2020 Received: (at 39634) by debbugs.gnu.org; 25 Feb 2020 20:57:16 +0000 Received: from localhost ([127.0.0.1]:56185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6hGW-0006QF-CQ for submit@debbugs.gnu.org; Tue, 25 Feb 2020 15:57:16 -0500 Received: from fanzine.igalia.com ([178.60.130.6]:55919) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6hGU-0006Q0-LO for 39634@debbugs.gnu.org; Tue, 25 Feb 2020 15:57:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=qoSUO4FjisvWUuXv6Dh879dpi810BTLt0B4m0sc6wIE=; b=lwf4b53qCsRn8Y4hPAM7CyHl3TuCzcaBHB32vidrbtcKjdo71wf6xut+9UGyKlfQrlynzZqfGzTRClWkzSK6gWT/J9JeJO5ipaWpbZiJyt3KtcLBf34u8WBvY2Kk8Lj7olnaVHAyaymDXtjDbUQhN8KXXC9tsu+ge5VB75GtZm+ouqqG6drlc8USSNH/HpprLpCsdAhZ0xEc+ZecCZpRKMfj486rCGaqc6yKeTp9hp9uKm5ECOWoQfSzMwgSCVxxeHxFnRDmqaleLrq8WjP0l5gQPTLF2qXIYx3WFgQp+LuCrISVmWbwtMwaaVyrQSTrANnBDcvtYOzOE/1bjB5a3A==; Received: from [88.123.12.110] (helo=sparrow) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1j6hGN-0005Sh-Ro; Tue, 25 Feb 2020 21:57:08 +0100 From: Andy Wingo To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#39634: All keyowrds hash to the same value References: <87wo8mcs1j.fsf@trouble.defaultvalue.org> <875zg19qpl.fsf@gnu.org> Date: Tue, 25 Feb 2020 21:56:56 +0100 In-Reply-To: <875zg19qpl.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 20 Feb 2020 17:19:18 +0100") Message-ID: <87h7zeo06f.fsf@igalia.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39634 Cc: 39634@debbugs.gnu.org, Rob Browning X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Thu 20 Feb 2020 17:19, Ludovic Court=C3=A8s writes: > Of all the scm_tc7_ values listed in =E2=80=98scm.h=E2=80=99, the followi= ng are not > explicitly listed (so they go to the default case that hashes the first > word): Reformatting your list so I can check one by one :) > variable, > hashtable, > fluid, > dynamic_state, > frame, > atomic_box, > program, > vm_cont, > weak_set, > weak_table, > port No equal? implementation, so should hashq() instead. > bytevector, > array, > bitvector, These have equal? implementations, and what's more, a bitvector can equal? an array... I think we have another bug! ;; Project 2d array as 1d array (scm_tc7_array) (define x (make-shared-array #2b((#t #t #t)) (lambda (i) (list 0 i)) '(0 2))) ;; scm_tc7_bitvector (define y #*111) (equal? x y) ;; =3D> #t (equal? (hash x #xffffffff) (hash y #xffffffff)) ;; =3D> #f =20=20=20=20=20=20=20=20=20=20=20=20 Similarly for 1-d scm_tc7_array versus regular vectors, bytevectors, etc. Fixing this will not be straightforward... I think basically 1d arrays need some special hashing logic so that e.g. vectors and 1d arrays hash to the same thing. > stringbuf, > values, These are never exposed to Scheme, and never compared using equal? AFAIU. No need for special cases. Basically I think the tc7 case should default to hashq, and include special cases for the ones that have equal? implementations or which have read syntax. Sound right to you? Andy From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 25 17:14:12 2020 Received: (at 39634) by debbugs.gnu.org; 25 Feb 2020 22:14:12 +0000 Received: from localhost ([127.0.0.1]:56243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6iSy-0008U8-8C for submit@debbugs.gnu.org; Tue, 25 Feb 2020 17:14:12 -0500 Received: from mta-07-4.privateemail.com ([68.65.122.27]:31634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6iSw-0008Tt-LC for 39634@debbugs.gnu.org; Tue, 25 Feb 2020 17:14:11 -0500 Received: from MTA-07.privateemail.com (localhost [127.0.0.1]) by MTA-07.privateemail.com (Postfix) with ESMTP id 9314260043; Tue, 25 Feb 2020 17:14:02 -0500 (EST) Received: from [192.168.1.105] (unknown [10.20.151.222]) by MTA-07.privateemail.com (Postfix) with ESMTPA id 919A460034; Tue, 25 Feb 2020 22:14:01 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: bug#39634: All keyowrds hash to the same value From: lloda In-Reply-To: <87h7zeo06f.fsf@igalia.com> Date: Tue, 25 Feb 2020 23:13:59 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <33B73487-1CD8-4212-8FC8-5A426D0A4F7F@sarc.name> References: <87wo8mcs1j.fsf@trouble.defaultvalue.org> <875zg19qpl.fsf@gnu.org> <87h7zeo06f.fsf@igalia.com> To: Andy Wingo X-Mailer: Apple Mail (2.3445.104.11) X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39634 Cc: 39634@debbugs.gnu.org, =?utf-8?Q?Ludovic_Court=C3=A8s?= , Rob Browning X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On 25 Feb 2020, at 21:56, Andy Wingo wrote: >=20 > On Thu 20 Feb 2020 17:19, Ludovic Court=C3=A8s writes: >=20 >> Of all the scm_tc7_ values listed in =E2=80=98scm.h=E2=80=99, the = following are not >> explicitly listed (so they go to the default case that hashes the = first >> word): >=20 > Reformatting your list so I can check one by one :) >=20 >> variable, >> hashtable, >> fluid, >> dynamic_state, >> frame, >> atomic_box, >> program, >> vm_cont, >> weak_set, >> weak_table, >> port >=20 > No equal? implementation, so should hashq() instead. >=20 >> bytevector, >> array, >> bitvector, >=20 > These have equal? implementations, and what's more, a bitvector can > equal? an array... I think we have another bug! >=20 > ;; Project 2d array as 1d array (scm_tc7_array) > (define x > (make-shared-array #2b((#t #t #t)) (lambda (i) (list 0 i)) '(0 2))) > ;; scm_tc7_bitvector > (define y #*111) >=20 > (equal? x y) ;; =3D> #t > (equal? (hash x #xffffffff) (hash y #xffffffff)) ;; =3D> #f >=20 > Similarly for 1-d scm_tc7_array versus regular vectors, bytevectors, > etc. >=20 > Fixing this will not be straightforward... I think basically 1d = arrays > need some special hashing logic so that e.g. vectors and 1d arrays = hash > to the same thing. I cannot check at the moment but I think that use of make-shared-array = is special cased to return a bitvector because the shared array and the = root happen to be equivalent. So your x isn't a scm_tc7_array but a = scm_tc7_bitvector. The same is true for the other vector types. You can = see that if you make a shared array with bounds '(0 1) instead of '(0 2) = for example, or non-unit step or non-zero lower bound or anything that = cannot be represented as a root vector. Now it is true that functionally a root vector and a 1d array with the = same bounds and the same elements are equivalent even if the array has = non-unit stride and so on, but we had that logic before were you could = use the root vector functions on arrays and it was an absolute mess. I = think there should be a logic to hash n-d arrays that extends to 1-d = arrays so there's no need to make special cases. All vectors can be = treated as 1-d arrays so that should work fine for those too. Partially related, I have a series of patches on wip-vector-cleanup to = make sure that the various vector implementations don't depend on arrays = (as they still do on some cases) but rather the other way around, = strictly. I haven't posted about it b/c it changes a few interfaces and = I haven't figured out the deprecation route. regards >=20 >> stringbuf, >> values, >=20 > These are never exposed to Scheme, and never compared using equal? > AFAIU. No need for special cases. >=20 > Basically I think the tc7 case should default to hashq, and include > special cases for the ones that have equal? implementations or which > have read syntax. >=20 > Sound right to you? >=20 > Andy >=20 >=20 >=20 From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 26 16:02:43 2020 Received: (at 39634) by debbugs.gnu.org; 26 Feb 2020 21:02:43 +0000 Received: from localhost ([127.0.0.1]:57822 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j73pL-0000Bg-6K for submit@debbugs.gnu.org; Wed, 26 Feb 2020 16:02:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j73pI-00006k-Qh for 39634@debbugs.gnu.org; Wed, 26 Feb 2020 16:02:41 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51168) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j73pC-0006aq-7o; Wed, 26 Feb 2020 16:02:34 -0500 Received: from 128.pool80-103-133.dynamic.orange.es ([80.103.133.128]:43056 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1j73pA-0007Oi-Ps; Wed, 26 Feb 2020 16:02:33 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Andy Wingo Subject: Re: bug#39634: All keyowrds hash to the same value References: <87wo8mcs1j.fsf@trouble.defaultvalue.org> <875zg19qpl.fsf@gnu.org> <87h7zeo06f.fsf@igalia.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 8 =?utf-8?Q?Vent=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Wed, 26 Feb 2020 22:02:29 +0100 In-Reply-To: <87h7zeo06f.fsf@igalia.com> (Andy Wingo's message of "Tue, 25 Feb 2020 21:56:56 +0100") Message-ID: <87zhd5awpm.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39634 Cc: 39634@debbugs.gnu.org, Rob Browning X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Andy! Andy Wingo skribis: > On Thu 20 Feb 2020 17:19, Ludovic Court=C3=A8s writes: > >> Of all the scm_tc7_ values listed in =E2=80=98scm.h=E2=80=99, the follow= ing are not >> explicitly listed (so they go to the default case that hashes the first >> word): > > Reformatting your list so I can check one by one :) > >> variable, >> hashtable, >> fluid, >> dynamic_state, >> frame, >> atomic_box, >> program, >> vm_cont, >> weak_set, >> weak_table, >> port > > No equal? implementation, so should hashq() instead. > >> bytevector, >> array, >> bitvector, > > These have equal? implementations, and what's more, a bitvector can > equal? an array... I think we have another bug! > > ;; Project 2d array as 1d array (scm_tc7_array) > (define x > (make-shared-array #2b((#t #t #t)) (lambda (i) (list 0 i)) '(0 2))) > ;; scm_tc7_bitvector > (define y #*111) > > (equal? x y) ;; =3D> #t > (equal? (hash x #xffffffff) (hash y #xffffffff)) ;; =3D> #f >=20=20=20=20=20=20=20=20=20=20=20=20=20 > Similarly for 1-d scm_tc7_array versus regular vectors, bytevectors, > etc. Oops. > Fixing this will not be straightforward... I think basically 1d arrays > need some special hashing logic so that e.g. vectors and 1d arrays hash > to the same thing. OK. >> stringbuf, >> values, > > These are never exposed to Scheme, and never compared using equal? > AFAIU. No need for special cases. Agreed. > Basically I think the tc7 case should default to hashq, and include > special cases for the ones that have equal? implementations or which > have read syntax. > > Sound right to you? It does, yes. Thanks for looking into it, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 06 09:42:32 2020 Received: (at 39634) by debbugs.gnu.org; 6 Mar 2020 14:42:32 +0000 Received: from localhost ([127.0.0.1]:44323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAEBL-0002Mw-S4 for submit@debbugs.gnu.org; Fri, 06 Mar 2020 09:42:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59303) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAEBK-0002Mg-9E for 39634@debbugs.gnu.org; Fri, 06 Mar 2020 09:42:30 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jAEBD-0000v3-GM; Fri, 06 Mar 2020 09:42:23 -0500 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=60276 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jAEBD-0004RD-0I; Fri, 06 Mar 2020 09:42:23 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Andy Wingo Subject: Re: bug#39634: All keyowrds hash to the same value References: <87wo8mcs1j.fsf@trouble.defaultvalue.org> <875zg19qpl.fsf@gnu.org> <87h7zeo06f.fsf@igalia.com> Date: Fri, 06 Mar 2020 15:42:20 +0100 In-Reply-To: <87h7zeo06f.fsf@igalia.com> (Andy Wingo's message of "Tue, 25 Feb 2020 21:56:56 +0100") Message-ID: <87sgilmto3.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39634 Cc: 39634@debbugs.gnu.org, Rob Browning X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Andy Wingo skribis: >> variable, >> hashtable, >> fluid, >> dynamic_state, >> frame, >> atomic_box, >> program, >> vm_cont, >> weak_set, >> weak_table, >> port > > No equal? implementation, so should hashq() instead. Here=E2=80=99s a patch for these, let me know what you think! (Of course longer term it=E2=80=99d be nice to have a centralized way to de= clare each tc7 with its equal and hash methods.) Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/libguile/hash.c b/libguile/hash.c index c51a794c9..9cb8fcedd 100644 --- a/libguile/hash.c +++ b/libguile/hash.c @@ -1,4 +1,4 @@ -/* Copyright 1995-1997,2000-2001,2003-2004,2006,2008-2015,2017-2018 +/* Copyright 1995-1997,2000-2001,2003-2004,2006,2008-2015,2017-2018,2020 Free Software Foundation, Inc. This file is part of Guile. @@ -331,6 +331,22 @@ scm_raw_ihash (SCM obj, size_t depth) h ^= scm_raw_ihash (scm_syntax_module (obj), depth); return h; } + + /* The following tc7s have no 'equal?' implementation. Thus, just + fall back to 'hashq'. */ + case scm_tc7_variable: + case scm_tc7_hashtable: + case scm_tc7_fluid: + case scm_tc7_dynamic_state: + case scm_tc7_frame: + case scm_tc7_atomic_box: + case scm_tc7_program: + case scm_tc7_vm_cont: + case scm_tc7_weak_set: + case scm_tc7_weak_table: + case scm_tc7_port: + return scm_raw_ihashq (SCM_UNPACK (obj)); + case scm_tcs_cons_imcar: case scm_tcs_cons_nimcar: if (depth) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 06 10:43:54 2020 Received: (at 39634) by debbugs.gnu.org; 6 Mar 2020 15:43:54 +0000 Received: from localhost ([127.0.0.1]:45749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAF8k-0008C7-5l for submit@debbugs.gnu.org; Fri, 06 Mar 2020 10:43:54 -0500 Received: from fanzine.igalia.com ([178.60.130.6]:43192) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAF8f-0008Bq-Rk for 39634@debbugs.gnu.org; Fri, 06 Mar 2020 10:43:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=TfahoCp+ZG+p4s2KpzOTEY6YAExNgvCA7X4zyj4/+5Y=; b=LvMhEKcaRpeck5VS3tNnJtwdgbzBRD1n48IDOEceawoyL3Utfi2BczQn6Gdblk8fl+qyjWT7jP8d0ojkv68R/yZYhPmrwxSF/Lxt5tFse6Pc87jJeRDtjzz0tbAkI0TcUu33Wh4xvfg3GzFQMpLvEknoiUeSvZ7TKJUDWD9QuW9+w7tC3vMjwXy/20STbX8DD2KteN8flqDI/EqiSI1abFYIYYd75IyHFLF/BelTwpSBEGEgATTRWuGtF1t9vCT65nbijB2poNKlKKYx+hmtuLGbbCc92v9fRrzzRD+36dVh25VnnkrsONbuVns4pBfhM1HrHQbFrMfJN8VkDELQ4w==; Received: from lfbn-ann-1-322-213.w86-200.abo.wanadoo.fr ([86.200.42.213] helo=milano) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1jAF8Z-0002OA-1P; Fri, 06 Mar 2020 16:43:43 +0100 From: Andy Wingo To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#39634: All keyowrds hash to the same value References: <87wo8mcs1j.fsf@trouble.defaultvalue.org> <875zg19qpl.fsf@gnu.org> <87h7zeo06f.fsf@igalia.com> <87sgilmto3.fsf@gnu.org> Date: Fri, 06 Mar 2020 16:43:33 +0100 In-Reply-To: <87sgilmto3.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Fri, 06 Mar 2020 15:42:20 +0100") Message-ID: <874kv132vu.fsf@igalia.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39634 Cc: 39634@debbugs.gnu.org, Rob Browning X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri 06 Mar 2020 15:42, Ludovic Court=C3=A8s writes: > Andy Wingo skribis: > >>> variable, >>> hashtable, >>> fluid, >>> dynamic_state, >>> frame, >>> atomic_box, >>> program, >>> vm_cont, >>> weak_set, >>> weak_table, >>> port >> >> No equal? implementation, so should hashq() instead. > > Here=E2=80=99s a patch for these, let me know what you think! LGTM! Andy From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 06 11:19:48 2020 Received: (at 39634-done) by debbugs.gnu.org; 6 Mar 2020 16:19:48 +0000 Received: from localhost ([127.0.0.1]:45798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAFhU-0000dl-JA for submit@debbugs.gnu.org; Fri, 06 Mar 2020 11:19:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAFhT-0000da-Ka for 39634-done@debbugs.gnu.org; Fri, 06 Mar 2020 11:19:47 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jAFhN-0000FM-Qw; Fri, 06 Mar 2020 11:19:41 -0500 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=60322 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jAFhN-0001Pd-A7; Fri, 06 Mar 2020 11:19:41 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Andy Wingo Subject: Re: bug#39634: All keyowrds hash to the same value References: <87wo8mcs1j.fsf@trouble.defaultvalue.org> <875zg19qpl.fsf@gnu.org> <87h7zeo06f.fsf@igalia.com> <87sgilmto3.fsf@gnu.org> <874kv132vu.fsf@igalia.com> Date: Fri, 06 Mar 2020 17:19:38 +0100 In-Reply-To: <874kv132vu.fsf@igalia.com> (Andy Wingo's message of "Fri, 06 Mar 2020 16:43:33 +0100") Message-ID: <87sgillalh.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39634-done Cc: 39634-done@debbugs.gnu.org, Rob Browning X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Andy Wingo skribis: > On Fri 06 Mar 2020 15:42, Ludovic Court=C3=A8s writes: > >> Andy Wingo skribis: >> >>>> variable, >>>> hashtable, >>>> fluid, >>>> dynamic_state, >>>> frame, >>>> atomic_box, >>>> program, >>>> vm_cont, >>>> weak_set, >>>> weak_table, >>>> port >>> >>> No equal? implementation, so should hashq() instead. >> >> Here=E2=80=99s a patch for these, let me know what you think! > > LGTM! Pushed as c5d3b45c9f903cc9726b4bd7e3c13db56bafd587, thanks! Ludo'. From unknown Sat Aug 16 18:47:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 04 Apr 2020 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator