From: Pip Cet via "Emacs development discussions." <emacs-devel@gnu.org>
To: Helmut Eller <eller.helmut@gmail.com>
Cc: Stefan Kangas <stefankangas@gmail.com>,
Stefan Monnier <monnier@iro.umontreal.ca>,
emacs-devel@gnu.org
Subject: Re: Merging scratch/no-purespace to remove unexec and purespace
Date: Wed, 18 Dec 2024 13:35:36 +0000 [thread overview]
Message-ID: <87o7199ksn.fsf@protonmail.com> (raw)
In-Reply-To: <87ed2579eg.fsf@gmail.com>
"Helmut Eller" <eller.helmut@gmail.com> writes:
> On Tue, Dec 17 2024, Stefan Kangas wrote:
>
>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
> [...]
>>> That's because the pdump already fails to take advantage of the
>>> purespace (i.e. the GC traces through the purespace like the rest of
>>> the heap).
>>
>> I'll note that the best solution to that is to have a generational GC
>> instead. Simple, right?
>
> A generational GC is definitely simpler. Whether it's the "best"
> solution is not so clear: A copying GC, like MPS, still needs to trace
> and copy pure objects whenever the oldest generation is in the condemned
> set.
> Moving pure objects to a non-moving pool might be better.
I think we should rephrase that without presupposing the existence of
"pure" objects: Hinting to MPS that an object is expected to be
immutable and have a very long lifetime may have advantages, and that's
a potential reason for introducing (and maintaining) a hinting
mechanism.
On the other hand, it's very common for objects to have those properties
without us knowing in advance that they will, so it's important MPS
works well in the absence of such hints.
>> It's not entirely unrelated though: among other things, one reason why
>> merging this would be good is that it would reportedly simplify the work
>> on the igc branch. And indeed any GC-related work now or in future.
>
> Objects in purespace are immutable and immortal. That's potentially
> useful information for the GC.
I may be misunderstanding what you mean by "immutable", but the most
important property "pure" objects had was that they only referenced
other pure objects or static objects, so GC didn't need to look at them
(but, IIUC, this optimization never worked in pdumper builds). This
required us to make such objects read-only (which caused problems) and
immortal.
Immortality was an undesirable, but necessary, side effect of the "pure"
optimization, not a feature. IMHO, so was immutability, but some people
consider it a feature not to be able to modify certain objects.
For example, on the no-purespace branch, you can execute
(aset (symbol-name nil) 0 ?N)
and rename nil to Nil, which will make the rest of your Emacs session
unusable.
On master, this code should (and did at one point, IIRC) throw a
CHECK_IMPURE exception. Right now, it segfaults, which demonstrates
that the current purespace code has suffered from some bit rot and
removing purespace will fix some bugs for that reason alone.
So the two major features of pure space are broken right now. Fixing
that is an option, and it's the only way we'd ever see a fair comparison
of purespace and no-purespace performance, but I hope it's not going to
happen.
So what's left is a weak hint to the GC that this object is likely to
remain reachable, and not to be modified, but for MPS to set up a "pure"
space of such objects based on this hint seems to me to be an
unrealistic expectation.
> Removing purespace also removes that information.
Removing purespace does leave us with very few read-only objects. We
can consider introducing a useful set of read-only objects (and agree on
what that even means) after purespace is removed.
However, I would be surprised if the lost information about whether an
object used to be pure turns out to be very useful.
> Of course, if the pdumper already throws away this
> information, then purespace just adds useless complexity.
I believe that's the case. In fact, once we remove purespace, we can
look at improving how pdumper dumps are handled during GC. Maybe we can
make it so the pdumper dump looks even more like an ordinary MPS segment
in memory, and then we don't need to treat pdumper objects specially.
Pip
next prev parent reply other threads:[~2024-12-18 13:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 10:47 Merging scratch/no-purespace to remove unexec and purespace Stefan Kangas
2024-12-17 13:12 ` Gerd Möllmann
2024-12-17 14:20 ` Gerd Möllmann
2024-12-17 14:30 ` Gerd Möllmann
2024-12-17 17:56 ` Gerd Möllmann
2024-12-17 18:50 ` Eli Zaretskii
2024-12-17 18:56 ` Gerd Möllmann
2024-12-18 12:55 ` Andrea Corallo
2024-12-18 14:03 ` Gerd Möllmann
2024-12-18 16:05 ` Pip Cet via Emacs development discussions.
2024-12-18 16:30 ` Gerd Möllmann
2024-12-18 16:25 ` Pip Cet via Emacs development discussions.
2024-12-18 0:18 ` Stefan Kangas
2024-12-17 19:30 ` Helmut Eller
2024-12-17 20:47 ` Stefan Monnier
2024-12-18 2:15 ` Stefan Kangas
2024-12-18 7:11 ` Helmut Eller
2024-12-18 13:35 ` Pip Cet via Emacs development discussions. [this message]
2024-12-18 6:56 ` Helmut Eller
2024-12-18 9:30 ` Pip Cet via Emacs development discussions.
2024-12-18 0:50 ` Po Lu
2024-12-18 2:12 ` Stefan Kangas
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=87o7199ksn.fsf@protonmail.com \
--to=emacs-devel@gnu.org \
--cc=eller.helmut@gmail.com \
--cc=monnier@iro.umontreal.ca \
--cc=pipcet@protonmail.com \
--cc=stefankangas@gmail.com \
/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).