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: Mon, 01 Jul 2024 17:14:11 +0000 Message-ID: <1osQTI7Swoo72EJbCzzi4zqVXuC5hSlYEXwLtnal8_pyYL7oRCNSJg20XgBRjffZ344Wj7lwFDc9JSMsQ-3su6uXQ8hYSfYleRn-4GRrykI=@protonmail.com> References: <87v81u85hv.fsf@localhost> <7YYJyDLCuZhtkTAT_ry6S14y4KoAJtsV_2Ui8Dsy37afuN1zucoO6VPh6YAvKQCs-0OUP3-rTFogtJBLrv2wiZ9rq6lacV-p_M1qsSSgKOk=@protonmail.com> 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="17722"; 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 Mon Jul 01 19:37:21 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 1sOKxr-0004Ks-RS for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Jul 2024 19:37:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOKxV-00050h-3q; Mon, 01 Jul 2024 13:36:57 -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 1sOKbi-0005Ds-Gd for emacs-devel@gnu.org; Mon, 01 Jul 2024 13:14:27 -0400 Original-Received: from mail-40133.protonmail.ch ([185.70.40.133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOKbb-0001Qm-Te for emacs-devel@gnu.org; Mon, 01 Jul 2024 13:14:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1719854055; x=1720113255; bh=sbmH3oEhXh/A949lRg3Fm+NhjwBVilkUR/JNSCNZx/s=; 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=CMri0x4C+A+CQqsmdUD/Wc9hRhqVABoQhoMzuRDe71CkPl3J/++oTYAGGZSfBIspt OXELiHxZDBeI33IHlOtuqg3oy46PJzPh0jib3+a+BzhE05r05RV08xYP6H+bNxyU1k y4+nimPkBf3cywHPpUdvK6xu+xGYmEh19Zyx13jhXjHevc7xVoEr0J+JY0sa/vamq8 t5NmDYGmdTt99CEN6Muwtn3rbAQFZaiZ5rLRzzKYrB3QsbdpjIiGRCHhI+TCDM95Oy SsyEz9+SrB/16qGrqcoxNDldRUBK0UBC3Evmt7PKthxPO+QQRa1g6aXhXzXHhINWEd cIXlLdcRrON1w== In-Reply-To: Feedback-ID: 112775352:user:proton X-Pm-Message-ID: fc96327961f332ac52c76f8482221628bab026a8 Received-SPF: pass client-ip=185.70.40.133; envelope-from=pipcet@protonmail.com; helo=mail-40133.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: Mon, 01 Jul 2024 13:36:50 -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:321040 Archived-At: On Monday, July 1st, 2024 at 04:22, Gerd M=C3=B6llmann wrote: > Pip Cet pipcet@protonmail.com writes: >=20 > > On Sunday, June 30th, 2024 at 19:22, Gerd M=C3=B6llmann gerd.moellmann@= gmail.com wrote: > >=20 > > > Thanks! What do youo think about making a patch containing only your > > > weak hash tables, and leaving the BUF_MARKERS alone for now? > >=20 > > I think that's the best way forward. Patch attached. >=20 > Could you please send me something from git format-patch? That way I'd > have commit message and your authorship would also be clear. Or even > better, if you have the rights could you please commit to the branch? I'll do that. Please let me know what I got wrong. > > > That way > > > igc could support the existing uses of weak hash tables (I remember o= ne > > > in the CLOS department somehwere), and they would be somewhat tested. > > > Don't remember if we have unit tests for them. > >=20 > > It seems MPS isn't very eager about splatting weak references during > > ordinary automatic GC, FWIW. What I'm observing with > >=20 > > (while t > > (dotimes (i 10000) > > (puthash (cons 1 2) (cons 3 4) table)) > > (message "%S" (hash-table-count table)) > > (sit-for 0.1)) > >=20 > > is that the hash table starts out at 0, grows quickly, resets to > > count=3D0 once, then keeps growing and never splats any references afte= r > > that. It's quite possible this is a bug in my code, of course. >=20 > Yes, it's not eagerly splatting. Don't know. Which reminds me that I > wanted to look if the AWL pool maybe has some paramter that one could > set, or something else influences that, like the mortality rate of the > generation chain. Or something completely different. I debugged this a little, and it turns out that when we alternate between t= wo weak hash tables, splatting works fine. It seems that if MPS receives a = SIGSEGV in a segment belonging to a weak hash table, it scans it in "exact"= mode, not "weak" mode, in order to continue execution as soon as possible.= That's how I read this comment in mps/trace.c: * If the trace band is EXACT then we scan EXACT. This might prevent * finalisation messages and may preserve objects pointed to only by weak * references but tough luck -- the mutator wants to look. So I don't think this will be a problem in practice... Pip