all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Andrea Corallo <acorallo@gnu.org>
Cc: Eli Zaretskii <eliz@gnu.org>,
	 emacs-devel@gnu.org,  Helmut Eller <eller.helmut@gmail.com>
Subject: Re: MPS: native comp
Date: Tue, 30 Apr 2024 12:27:45 +0200	[thread overview]
Message-ID: <m2ttjj402m.fsf@pro2.fritz.box> (raw)
In-Reply-To: <yp134r36vdy.fsf@fencepost.gnu.org> (Andrea Corallo's message of "Tue, 30 Apr 2024 05:40:41 -0400")

Andrea Corallo <acorallo@gnu.org> writes:

> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>
>> Andrea Corallo <acorallo@gnu.org> writes:
>>
>>> If the object was moved and the d_reloc is now updated by MPS I've a
>>> doubt:
>>>
>>> What if our object (say d_reloc[x]) is loaded in a register by the
>>> compiler?  How does the register gets updated by MPS?  In native code we
>>> do this all the time for performance reasons.
>>
>> MPS traces registers and control stacks as ambig roots, so a reference
>> from there makes the corresponding object immovable.
>
> I think I miss few bits to understand MPS:
>
> If stack and registers are scanned I guess MPS has to stop the mutator
> thread no?  

Yes.

> In the moment after the mutator restarts after the scan other ambig
> roots might appear, so how can such moving collection be done in a
> parallel fashion?

The exact algorith MPS implements I don't know either. The docs include
some design documents, but I haven't read them all, and some I didn't
understgand because there was some context missing.

A number of possible algorithms that could be used are described in the
literature, or one could glance at existing GCs for V8, for example.
Hard to read though, for me at least.

> Also if this mechanism (I don't fully understand ATM) is working the
> issue I mentioned of values being kept in registers should be a non
> issue.  Code we generate from Lisp is not very different from the one we
> compile form C (we still have registers spill/fills etc).

Yes, I think the same. It's just like some C code running.

>> Haha, I hadn't even remotely occurred to me that you would emit a
>> comment with the name :-). That makes things a lot easier. 👍
>
> To survive I had to find my way somehow :)

:-)

>
>>> I think the easiest is to to make objects loaded from native code non
>>> movable.  Is this possible with MPS? What would be the downside of this?
>>> They are very rarely collected anyway.  WDYT?
>>
>> I'd personally prefer to trace comp units in the usual way for Lisp
>> objects, i.e. the fix_comp_unit.
>>
>> Main reason is simplicity. The tracing function is super simple, we only
>> have to identify where in the comp unit data structure, or dylib,
>> references exist that have to be traced. Registers/stack are not a
>> problem (see above).
>>
>> Other reasons, not so important, but anyway, is reducing the number of
>> roots. Every root adds to what MPS has to do. And ambig roots make
>> objects immovable, which is somewhat against the spirit of a copying
>> collector.
>>
>> Just my personal opinion, of course.
>
> Well other than spirit and possibly simplicity we should evaluate if
> (and in case how much) is the cost to have this objects movable vs
> non-movable.

Sure.

For me personally the most important aspect is interactive user
experience. Let's say complaints about GC pauses are not entirelly
unheard of ;-). I even have one myself: In an Org file, with my init.el,
GC kicks in every 5 lines with C-n/C-p (something font/jit-locking
produces heaps of garbage). It's unbearable, and that's on my old
battlehorse MBPro with i7 from 2013 which I used for years for C++
development in Linux VMs just fine :-/.

> The starting point for me is that this is a very special kind of object
> class we know in advance is very rarely (if ever) collected, so would be
> a pity to not consider this in the definition of the GC strategy
> (assuming is an option).

MPS is also generational, i.e. objects eventually move to older
generations which are less frequently collected. Haven't played with
that knob though. Atm, there are 2 generations.

If the CUs are in the loaded pdump, they won't be collected anyway, of
course. How that works best I have still to figure out, but I didn't get
a chance yet :-).

And the pdump is also an aspect all in in itself...
And in general, lots of things could be tried...



  reply	other threads:[~2024-04-30 10:27 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29  5:35 MPS: native comp Gerd Möllmann
2024-04-29  7:29 ` Andrea Corallo
2024-04-29  8:02   ` Gerd Möllmann
2024-04-29  7:52 ` Eli Zaretskii
2024-04-29  8:12   ` Gerd Möllmann
2024-04-29  8:31     ` Gerd Möllmann
2024-04-29  8:40       ` Gerd Möllmann
2024-04-29  8:59         ` Andrea Corallo
2024-04-29  9:09           ` Gerd Möllmann
2024-04-29  9:16             ` Gerd Möllmann
2024-04-29  9:24             ` Andrea Corallo
2024-04-29  9:36               ` Gerd Möllmann
2024-04-29  9:45                 ` Andrea Corallo
2024-04-29  9:53                   ` Gerd Möllmann
2024-04-29 10:08                     ` Andrea Corallo
2024-04-29 10:29                       ` Gerd Möllmann
2024-04-29 11:03                         ` Andrea Corallo
2024-04-29 11:15                           ` Gerd Möllmann
2024-04-30  4:39                             ` Gerd Möllmann
2024-04-30  4:58                               ` Gerd Möllmann
2024-04-30  5:30                                 ` Gerd Möllmann
2024-04-30  7:40                                   ` Andrea Corallo
2024-04-30  8:08                                     ` Gerd Möllmann
2024-04-30  8:34                                       ` Gerd Möllmann
2024-04-30  8:57                                         ` Andrea Corallo
2024-04-30  8:54                                       ` Andrea Corallo
2024-04-30  9:05                                         ` Andrea Corallo
2024-04-30  9:18                                         ` Gerd Möllmann
2024-04-30  9:40                                           ` Andrea Corallo
2024-04-30 10:27                                             ` Gerd Möllmann [this message]
2024-04-30 10:52                                               ` Andrea Corallo
2024-04-30 11:54                                                 ` Gerd Möllmann
2024-04-30 12:44                                                   ` Eli Zaretskii
2024-04-30 13:05                                                     ` Andrea Corallo
2024-04-30 13:11                                                       ` Gerd Möllmann
2024-04-30 13:26                                                         ` MPS compilation (was Re: MPS: native comp) Andrea Corallo
2024-04-30 13:35                                                           ` Gerd Möllmann
2024-04-30 14:18                                                             ` Andrea Corallo
2024-04-30 13:26                                                       ` MPS: native comp Eli Zaretskii
2024-04-30 13:45                                                         ` Visuwesh
2024-04-30 14:31                                                         ` Helmut Eller
2024-04-30 12:59                                                   ` Andrea Corallo
2024-04-30 13:06                                                     ` Gerd Möllmann
2024-04-30 14:29                                                 ` Peter Hull
2024-04-30 14:51                                                   ` Gerd Möllmann
2024-04-30 14:02                                             ` Gerd Möllmann
2024-04-30 17:35                                               ` Gerd Möllmann
2024-05-01  5:05                                                 ` Gerd Möllmann
2024-05-02  6:39                                                   ` Gerd Möllmann
2024-05-02  8:56                                                     ` Gerd Möllmann
2024-05-02 14:08                                                       ` Gerd Möllmann
2024-05-02 15:04                                                         ` Eli Zaretskii
2024-05-02 15:56                                                           ` Gerd Möllmann
2024-05-02 16:46                                                             ` Eli Zaretskii
2024-05-02 15:14                                                       ` Helmut Eller
2024-05-02 15:58                                                         ` Gerd Möllmann
2024-05-02 16:37                                                           ` Helmut Eller
2024-05-02 19:49                                                             ` Gerd Möllmann
2024-05-03  5:56                                                               ` Helmut Eller
2024-05-03  6:29                                                                 ` Gerd Möllmann
2024-05-03 13:38                                                                 ` Andrea Corallo
2024-05-03 13:52                                                                   ` Helmut Eller
2024-05-03 16:12                                                                     ` Andrea Corallo
2024-05-02 10:29                                                     ` Andrea Corallo
2024-05-02 10:51                                                       ` Gerd Möllmann
2024-05-02 10:24                                                 ` Andrea Corallo
2024-05-02 10:49                                                   ` Gerd Möllmann
2024-05-02 21:04                                                     ` Andrea Corallo
2024-05-03  5:35                                                       ` Gerd Möllmann
2024-05-03 13:35                                                         ` Andrea Corallo
2024-05-03 14:19                                                           ` Gerd Möllmann
2024-05-07  8:40                                                             ` Gerd Möllmann
2024-05-07 10:00                                                               ` Andrea Corallo
2024-05-07 12:29                                                                 ` Gerd Möllmann
2024-05-08  8:47                                                                   ` Gerd Möllmann
2024-05-08  9:12                                                                     ` Gerd Möllmann
2024-05-08 15:39                                                                       ` Andrea Corallo
2024-05-08 16:11                                                                         ` Gerd Möllmann
2024-05-09  6:15                                                                           ` Gerd Möllmann
2024-05-09  9:12                                                                             ` Gerd Möllmann
2024-05-10  6:37                                                                           ` Andrea Corallo
2024-05-10  6:41                                                                             ` Gerd Möllmann
2024-04-30  7:36                               ` Andrea Corallo
2024-04-30  7:56                                 ` Gerd Möllmann
  -- strict thread matches above, loose matches on Subject: below --
2024-06-27 14:25 Gerd Möllmann
2024-06-27 14:34 ` Andrea Corallo
2024-06-27 14:36   ` Gerd Möllmann
2024-06-27 15:05     ` Andrea Corallo
2024-06-27 16:39       ` Gerd Möllmann
2024-06-27 16:53         ` Gerd Möllmann
2024-06-27 19:01         ` Andrea Corallo
2024-06-27 19:18           ` 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=m2ttjj402m.fsf@pro2.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=acorallo@gnu.org \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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.