unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrea Corallo <acorallo@gnu.org>
To: "Gerd Möllmann" <gerd.moellmann@gmail.com>
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 05:40:41 -0400	[thread overview]
Message-ID: <yp134r36vdy.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <m21q6n5huo.fsf@pro2.fritz.box> ("Gerd Möllmann"'s message of "Tue, 30 Apr 2024 11:18:23 +0200")

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?  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?

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).

>>> Next strategy or tactic, I think, could be to produce a C file for
>>> macroexp.eln, and see where the symbol appears. I would imagine that I
>>> can deduce from the text representaton of the constants in C what index
>>> correspondons to the symbol, and then see if it is used in surprising
>>> ways. Maybe. WDYT?
>>
>> You'll probably see what I mentioned above.  At the beginning of the
>> compiled function we load in regular variables the lisp objects from
>> d_reloc so GCC leverage the register allocater and keep in registers.
>
> Yep, I see that.
>
>> For instance we do exactly this 'byte-compile-form-stack' and others
>> here:
> ....
>>   /* byte-compile-form-stack */
>>   slot_3 = d_reloc[(long long)1];
>
> 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.

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).

Thanks

  Andrea



  reply	other threads:[~2024-04-30  9:40 UTC|newest]

Thread overview: 84+ 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 [this message]
2024-04-30 10:27                                             ` Gerd Möllmann
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

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=yp134r36vdy.fsf@fencepost.gnu.org \
    --to=acorallo@gnu.org \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=gerd.moellmann@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).