From: Pip Cet <pipcet@protonmail.com>
To: Helmut Eller <eller.helmut@gmail.com>
Cc: "Gerd Möllmann" <gerd@gnu.org>,
"Stefan Monnier" <monnier@iro.umontreal.ca>,
"Ihor Radchenko" <yantar92@posteo.net>,
emacs-devel@gnu.org
Subject: Re: MPS: marker-vector
Date: Tue, 06 Aug 2024 14:36:56 +0000 [thread overview]
Message-ID: <87zfppu397.fsf@protonmail.com> (raw)
In-Reply-To: <87v80e2mia.fsf@gmail.com>
"Helmut Eller" <eller.helmut@gmail.com> 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
next prev parent reply other threads:[~2024-08-06 14:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-04 4:59 Markers in a gap array Stefan Monnier
2024-07-04 10:24 ` Ihor Radchenko
2024-07-04 13:16 ` Stefan Monnier
2024-07-04 14:30 ` Ihor Radchenko
2024-07-04 20:11 ` Stefan Monnier
2024-07-04 20:34 ` Pip Cet
2024-07-04 20:42 ` Stefan Monnier
2024-07-17 16:48 ` Helmut Eller
2024-07-18 20:46 ` Stefan Monnier
2024-07-26 19:48 ` Helmut Eller
2024-08-05 19:54 ` MPS: marker-vector (was: Markers in a gap array) Helmut Eller
2024-08-05 21:14 ` MPS: marker-vector Pip Cet
2024-08-06 6:28 ` Helmut Eller
2024-08-06 6:51 ` Gerd Möllmann
2024-08-06 14:36 ` Pip Cet [this message]
2024-08-06 16:15 ` Helmut Eller
2024-08-06 3:59 ` Gerd Möllmann
2024-08-06 6:02 ` Helmut Eller
2024-07-04 22:24 ` Markers in a gap array Stefan Monnier
2024-07-07 12:31 ` Ihor Radchenko
2024-07-07 13:09 ` Konstantin Kharlamov
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zfppu397.fsf@protonmail.com \
--to=pipcet@protonmail.com \
--cc=eller.helmut@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=gerd@gnu.org \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).