From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: MPS: dangling markers Date: Sun, 30 Jun 2024 09:51:48 +0000 Message-ID: <7YYJyDLCuZhtkTAT_ry6S14y4KoAJtsV_2Ui8Dsy37afuN1zucoO6VPh6YAvKQCs-0OUP3-rTFogtJBLrv2wiZ9rq6lacV-p_M1qsSSgKOk=@protonmail.com> References: <87v81u85hv.fsf@localhost> <86bk3jirx7.fsf@gnu.org> <868qynipph.fsf@gnu.org> <87wmm75xze.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17106"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Ihor Radchenko , Eli Zaretskii , monnier@iro.umontreal.ca, emacs-devel@gnu.org, eller.helmut@gmail.com To: =?utf-8?Q?Gerd_M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jun 30 12:07:40 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sNrT9-0004HK-CY for ged-emacs-devel@m.gmane-mx.org; Sun, 30 Jun 2024 12:07:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNrSn-00045P-Ll; Sun, 30 Jun 2024 06:07:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNrDw-0000WA-Jc for emacs-devel@gnu.org; Sun, 30 Jun 2024 05:51:56 -0400 Original-Received: from mail-4322.protonmail.ch ([185.70.43.22]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNrDu-0001GL-Iu; Sun, 30 Jun 2024 05:51:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1719741111; x=1720000311; bh=TWQah2FXYNLTCOWTPOuZ/W8mIx28KEqESn6kC4j8TWI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=uWpmW3tCYvcLGCHbHsxb2CX/tvMHWQmgr/h9LkE7RkwL1VY5zpQCy1bxsJ/508MMD BtW8IZBNf6ydp6HpGJcEM5rhL9wtzoUxLhJnOlsAiAlXSm0eUrjt/FB9Akk0E9Hyq3 o+HB4hIUm5G1OAsFj5HPQh8tqeFRLU1PvjfjLi27jzqghpr2XodE1k6f3m7nY71zFr Ffot/iUs2fdE1Ygag27IdbKWOBpSMnR2RKPyqzDVyECJ5OLwGYpCGC+KOSnfQM9MXx 7j9xrGRXzRk+pHD7OwB6cN18I9+radsIKQP7O2sdQQExGcfxlSTkbKQFVeZOrLaE2G rdmi7jWquQcwQ== In-Reply-To: Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 630c84613e63526c2cfceb073b1d3f05087f8ece Received-SPF: pass client-ip=185.70.43.22; envelope-from=pipcet@protonmail.com; helo=mail-4322.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 30 Jun 2024 06:07:11 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:320932 Archived-At: On Sunday, June 30th, 2024 at 04:41, Gerd M=C3=B6llmann wrote: > Pip Cet pipcet@protonmail.com writes: > > (Implementing weak hash tables with MPS seems quite difficult, though: > > you can have only one "dependent object" with strong references per > > object with weak references, >=20 > Yes, the one dependent object is somewhat limiting. I though yesterday > that using something like a weak doubly-linked list could be the > solution for the markers, but that would require 2 dependent objects, > next and prev. Anyway. I checked in the MPS source code (which, I understand, you don't want to mo= dify), and the limit appears to be something that can be raised easily... > > And since we can't resize objects that may be pinned by ambiguous > > references, well, the weak hash table implementation would look quite > > different from the strong hash tables we have). > I thought that, very roughly, the following might be doable: I'm afraid that wouldn't be doable in general, though whipping something up= for the special case of markers might be easier. If we had a recipe to mea= sure the performance problem, I could benchmark my strong hash table "solut= ion" to see whether it makes sense to pursue that further. > If we make-hash-table with weak keys and/or values, allocate the > Lisp_Hash_Table from the AWL pool using the weak_strong allocation > point. If neither keys nor values are weak, allocate the hash table from > the default pool. > Allocate the key and the value vector according to the hash table's > weakness either from the strong or weak allocation point, or from the > default pool if the table isn't weak at all. (I've split the > key_and_value vector already in two, but you probably noticed that > already.) >=20 > Dependent object of the key and value vectors could be the hash table > itself. Then we couldn't modify the value vector when the key gets splatted, or vic= e versa, so the table wouldn't be properly weak. My understanding is we mus= t allocate all strongly-referencing objects together in one object, all wea= kly-referencing objects together in another one, and make them depend on ea= ch other. And that means making the pseudovec a mere tuple of pointers to t= he strong and weak parts, because the conglomerate objects might need to be= resized... > The weak pool currently only contains the weak vectors for markers, the > markers themselves live in the default pool. Oh, sorry. You're right, of course. Pip