From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: MPS: weak hash tables Date: Sun, 07 Jul 2024 21:22:35 +0300 Message-ID: <86h6d112qc.fsf@gnu.org> References: <878qyeffjh.fsf@localhost> <8734olzlws.fsf@gmail.com> <867cdx32e3.fsf@gnu.org> <864j912t0s.fsf@gnu.org> <86zfqt1cxa.fsf@gnu.org> <86y16d1aik.fsf@gnu.org> <86tth119bs.fsf@gnu.org> <86jzhx148w.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33090"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pipcet@protonmail.com, eller.helmut@gmail.com, yantar92@posteo.net, emacs-devel@gnu.org To: Gerd =?utf-8?Q?M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jul 07 20:22:56 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 1sQWXI-0008Q2-JF for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Jul 2024 20:22:56 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQWX2-00053m-Ey; Sun, 07 Jul 2024 14:22:40 -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 1sQWX1-00053Z-J6 for emacs-devel@gnu.org; Sun, 07 Jul 2024 14:22:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQWX0-0002Mz-G4; Sun, 07 Jul 2024 14:22:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=NRCwp2Y1NTQKjgpkaX+o/lJboZQ4hbd6Xpo98o/O418=; b=YOH9XZ0WZ6GmfDWOY2t0 M17oCuhjQQeQskyJAZev5D5gKBL8cpv9+eV4RyHUgUQLwBnNjF5gsbH9I2louRzcmgco6at05FSoX S+c2PX4Y7ZtgAt3UAh7vD9ihw4W74vQ9XaV+M8GrqAw1aTaBst5PJ/NOcrthHr9RUFWz6+1DwFu85 YOomN3dLNEwSbc8XF8hcP/iW/6a6GYoirL2n0AsoRK7AnYR7yRdKaFXU4KZ/zL0NbHDmBRtfBCq9O VHOvlsCQs70FxXqaptKpLQKCVNpzX8zcAMoCcwPvIkWeJleSkwweYAOU0N6jJUKX1APK7eDF6kOi4 hkaTcS01ybKTWg==; In-Reply-To: (message from Gerd =?utf-8?Q?M=C3=B6llmann?= on Sun, 07 Jul 2024 20:15:34 +0200) 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:321514 Archived-At: > From: Gerd Möllmann > Cc: pipcet@protonmail.com, eller.helmut@gmail.com, yantar92@posteo.net, > emacs-devel@gnu.org > Date: Sun, 07 Jul 2024 20:15:34 +0200 > > Eli Zaretskii writes: > > > I understand all that, but unchaining an interval involves the need to > > modify the pointers of its adjacent nodes, and how can MPS do that > > without understanding our data structures? > > Can you please show me what code you mean? This one: static void sweep_intervals (void) { struct interval_block **iprev = &interval_block; int lim = interval_block_index; object_ct num_free = 0, num_used = 0; interval_free_list = 0; for (struct interval_block *iblk; (iblk = *iprev); ) { int this_free = 0; ASAN_UNPOISON_INTERVAL_BLOCK (iblk); for (int i = 0; i < lim; i++) { if (!iblk->intervals[i].gcmarkbit) { set_interval_parent (&iblk->intervals[i], interval_free_list); interval_free_list = &iblk->intervals[i]; ASAN_POISON_INTERVAL (&iblk->intervals[i]); this_free++; } else { num_used++; iblk->intervals[i].gcmarkbit = 0; } } lim = INTERVAL_BLOCK_SIZE; /* If this block contains only free intervals and we have already seen more than two blocks worth of free intervals then deallocate this block. */ if (this_free == INTERVAL_BLOCK_SIZE && num_free > INTERVAL_BLOCK_SIZE) { *iprev = iblk->next; /* Unhook from the free list. */ ASAN_UNPOISON_INTERVAL (&iblk->intervals[0]); interval_free_list = INTERVAL_PARENT (&iblk->intervals[0]); lisp_free (iblk); } else { num_free += this_free; iprev = &iblk->next; } }