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: marker-vector Date: Tue, 06 Aug 2024 14:36:56 +0000 Message-ID: <87zfppu397.fsf@protonmail.com> References: <87v81455iw.fsf@gmail.com> <87jzh8djdt.fsf@gmail.com> <87a5hqsq2l.fsf_-_@gmail.com> <87bk26vfj1.fsf@protonmail.com> <87v80e2mia.fsf@gmail.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="29980"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?Q?Gerd_M=C3=B6llmann?= , Stefan Monnier , Ihor Radchenko , emacs-devel@gnu.org To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 06 17:40:23 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 1sbMIR-0007ZZ-P2 for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Aug 2024 17:40:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbMHq-0006JB-LR; Tue, 06 Aug 2024 11:39:46 -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 1sbMF0-0005sR-B9 for emacs-devel@gnu.org; Tue, 06 Aug 2024 11:36:50 -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 1sbMEy-0007Jr-55; Tue, 06 Aug 2024 11:36:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1722958605; x=1723217805; bh=qQp/Vh7tRlrAW4kYzaIsfnjNnLKJWFGr73IIIoKy8Ao=; 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=iBmFl1xQasZOMDgLKnmvB3TJvq+Kn4uk0Owciao1XoTwuO40U1EyOG+7TNuRm0P5x 4gwvlcyQXLebjylsZ1rxu5jALsVM8NbNqQPRH2Y26iYlLiESrZ7JI8JAyZaomzv+Ss 4WMmfuqWgjDHSXJi9tWabjDyhjjeZvhRtfn3bWcqepmZ+GRkA/m8FGxur052TZfu8o zL5pbnehjw8XxPDSnt26prQWs+HK3XVdedBwfbrhnVEBflm9cpmSS+bvlYcmJkobBZ EVtkY/189605IizBPZiPIbMLzqli+L2od4FC+KxCEjKAYkuoOeg1ftDtTVwCSlqzKv AUgAoo+Us5ySg== In-Reply-To: <87v80e2mia.fsf@gmail.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 4e7778df4499866fbd0ad9f85a66a7ef35890829 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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: Tue, 06 Aug 2024 11:39:42 -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:322448 Archived-At: "Helmut Eller" writes: > On Mon, Aug 05 2024, Pip Cet wrote: >> I see one somewhat theoretical problem with this patch: if a marker is >> simultaneously kept in a weak hash table, it's possible for it to be >> splatted from the marker vector while remaining in the weak hash table >> (there's no guarantee all references will be splatted at the same time); >> if it is then retrieved from the weak hash table and made to point >> nowhere, we will try to remove it from the marker vector, and hit the >> igc_assert. > > Never thought about this. Hm. I think MPS could easily guarantee that > all references are splatted at the same time: we could think of > splatting a reference like moving an object to address zero. MPS > certainly guarantees that all references to a moved object are updated > before they are seen by user code. MPS could do the same for splatted > references. I don't know MPS internals very well, but IIRC weak objects can be scanned with or without splatting depending on whether the program hit a barrier or a regular GC opportunity. I don't know why that is, though. It may be related to the unfortunate emulated-single-access-on-IA32 thing. >> The rest of my comments are tiny nits, really: >> >> - capacity isn't redundant on 32-bit systems > > Not sure what you mean. Certainly igc_header_nwords works on 32-bit > systems too; and igc_header_nwords is pretty much the same as capacity. Except it's rounded up to multiples of 64 bits on 32 bit systems, making it impossible to represent a vector of odd length. Of course that doesn't happen in the code you posted (which starts with 2 entries and doubles the vector size when a larger vector is needed, resulting in an even number of entries at all times), so I apologize for not seeing that right away. >> I wonder whether it wouldn't be faster, upon encountering a marker that >> has been splatted, to fix the entire array all at once. That would >> ensure that creation order is respected, and splatting is relatively >> rare (and, when splatted, we can expect most of the array to have been >> splatted; indeed, I suspect it'd be best to give up on the marker vector >> and build a new one so the old one can be collected and we don't have to >> worry about never shrinking it). > > Possibly. But I also decided to ignore the issue and happily let > somebody else come up with a benchmark that shows that any of this > matters. Okay, let's stay with the current code for now and revisit the issue when the time comes? Pip