all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@protonmail.com>
To: "Gerd Möllmann" <gerd.moellmann@gmail.com>
Cc: Ihor Radchenko <yantar92@posteo.net>,
	Eli Zaretskii <eliz@gnu.org>,
	monnier@iro.umontreal.ca, emacs-devel@gnu.org,
	eller.helmut@gmail.com
Subject: Re: MPS: dangling markers
Date: Sun, 30 Jun 2024 09:51:48 +0000	[thread overview]
Message-ID: <7YYJyDLCuZhtkTAT_ry6S14y4KoAJtsV_2Ui8Dsy37afuN1zucoO6VPh6YAvKQCs-0OUP3-rTFogtJBLrv2wiZ9rq6lacV-p_M1qsSSgKOk=@protonmail.com> (raw)
In-Reply-To: <m2sewv2gbk.fsf@pro2.fritz.box>

On Sunday, June 30th, 2024 at 04:41, Gerd Möllmann <gerd.moellmann@gmail.com> 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,
> 
> 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 modify), 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 measure the performance problem, I could benchmark my strong hash table "solution" 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.)
> 
> 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 vice versa, so the table wouldn't be properly weak. My understanding is we must allocate all strongly-referencing objects together in one object, all weakly-referencing objects together in another one, and make them depend on each other. And that means making the pseudovec a mere tuple of pointers to the 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



  parent reply	other threads:[~2024-06-30  9:51 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27 21:01 MPS: dangling markers Ihor Radchenko
2024-06-27 21:24 ` Stefan Monnier
2024-06-28  4:14   ` Gerd Möllmann
2024-06-28 16:37     ` Ihor Radchenko
2024-06-28 16:47       ` Gerd Möllmann
2024-06-28 16:52         ` Ihor Radchenko
2024-06-28 16:56           ` Gerd Möllmann
2024-06-28 17:18             ` Ihor Radchenko
2024-06-28 17:44               ` Gerd Möllmann
2024-06-29  3:57               ` Gerd Möllmann
2024-06-29 14:34                 ` Ihor Radchenko
2024-06-29 14:56                   ` Gerd Möllmann
2024-06-29 16:29                     ` Eli Zaretskii
2024-06-29 17:09                       ` Gerd Möllmann
2024-06-29 17:17                         ` Gerd Möllmann
2024-06-29 17:23                           ` Eli Zaretskii
2024-06-29 18:02                             ` Gerd Möllmann
2024-06-29 18:11                               ` Eli Zaretskii
2024-06-29 18:19                                 ` Gerd Möllmann
2024-06-29 19:51                                 ` Ihor Radchenko
2024-06-29 21:50                                   ` Gerd Möllmann
2024-06-29 22:33                                     ` Pip Cet
2024-06-30  4:41                                       ` Gerd Möllmann
2024-06-30  6:56                                         ` Gerd Möllmann
2024-06-30  9:51                                         ` Pip Cet [this message]
2024-06-30 11:02                                           ` Gerd Möllmann
2024-06-30 12:54                                             ` Pip Cet
2024-06-30 13:15                                               ` Gerd Möllmann
2024-06-30 19:02                                                 ` Pip Cet
2024-06-30 19:22                                                   ` Gerd Möllmann
2024-06-30 20:15                                                     ` Pip Cet
2024-07-01  4:22                                                       ` Gerd Möllmann
2024-07-01 17:14                                                         ` Pip Cet
2024-07-01 18:20                                                           ` Gerd Möllmann
2024-07-01 18:50                                                           ` Eli Zaretskii
2024-07-01 19:04                                                             ` Pip Cet
2024-07-01 19:07                                                               ` Eli Zaretskii
2024-07-01 19:43                                                             ` Gerd Möllmann
2024-07-01 18:56                                                           ` Eli Zaretskii
2024-07-01 21:08                                                             ` Pip Cet
2024-07-02 11:25                                                               ` Eli Zaretskii
2024-07-03 18:46                                                                 ` Pip Cet
2024-07-03 19:20                                                                   ` Eli Zaretskii
2024-06-29 22:59                                     ` Stefan Monnier
2024-06-30  5:02                                       ` Gerd Möllmann
2024-06-30  5:29                                         ` Eli Zaretskii
2024-06-30 15:04                                         ` Stefan Monnier
2024-06-30  5:11                                       ` Eli Zaretskii
2024-06-30  4:57                                     ` Eli Zaretskii
2024-06-30  5:36                                       ` Gerd Möllmann
2024-06-30 12:25                                         ` Ihor Radchenko
2024-06-29 17:19                         ` Ihor Radchenko
2024-06-29 18:05                           ` Gerd Möllmann
2024-06-29 18:10                             ` Eli Zaretskii
2024-06-29 18:17                               ` Gerd Möllmann
2024-06-29 18:28                                 ` Ihor Radchenko
2024-06-29 17:20                         ` Eli Zaretskii
2024-06-29 18:04                           ` Gerd Möllmann
2024-06-29 17:16                     ` Stefan Monnier
2024-06-29 18:12                       ` Gerd Möllmann
2024-06-29 18:30                         ` Stefan Monnier
2024-06-29 18:52                           ` Gerd Möllmann
2024-06-29 21:20                             ` Gerd Möllmann
2024-06-29 21:38                               ` Gerd Möllmann
2024-06-30  7:11                                 ` Gerd Möllmann
2024-06-30  7:27                                   ` Gerd Möllmann
2024-06-30  7:45                                     ` Ihor Radchenko
2024-06-30 10:44                                       ` Gerd Möllmann
2024-06-30 11:23                                       ` Ihor Radchenko
2024-06-30 11:25                                         ` Gerd Möllmann
2024-06-30 11:31                                           ` Ihor Radchenko
2024-06-30 12:13                                             ` Gerd Möllmann
2024-06-30 12:18                                               ` Ihor Radchenko
2024-06-30 12:17                                     ` Ihor Radchenko
2024-06-30 12:28                                       ` Gerd Möllmann
2024-06-30 12:38                                         ` Ihor Radchenko
2024-06-30 12:48                                           ` Gerd Möllmann
2024-06-30 15:21                                             ` Ihor Radchenko
2024-06-30 15:32                                               ` Gerd Möllmann
2024-06-30 12:49                                           ` Eli Zaretskii
2024-06-29 15:17   ` Ihor Radchenko
2024-06-28  4:07 ` Gerd Möllmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='7YYJyDLCuZhtkTAT_ry6S14y4KoAJtsV_2Ui8Dsy37afuN1zucoO6VPh6YAvKQCs-0OUP3-rTFogtJBLrv2wiZ9rq6lacV-p_M1qsSSgKOk=@protonmail.com' \
    --to=pipcet@protonmail.com \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.