all messages for Emacs-related lists mirrored at yhetil.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:05:06 -0400	[thread overview]
Message-ID: <yp17cgf6x19.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <yp1frv36xig.fsf@fencepost.gnu.org> (Andrea Corallo's message of "Tue, 30 Apr 2024 04:54:47 -0400")

Andrea Corallo <acorallo@gnu.org> writes:

> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>
>> Andrea Corallo <acorallo@gnu.org> writes:
>>
>>> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>>>
>>>> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>>>>
>>>>> That promises to become fun :-/
>>>>
>>>> Sometimes one needs a bit of luck. Another try landed me in an abort in
>>>> set_internal, and I could see that we have another case of a symbol
>>>> pointing to a tombstone. So, we have another reference in the
>>>> compilation unit that we don't trace.
>>>
>>> Maybe you can make it more reproducible building at -J1?
>>
>> I meanwhile suspect it's ASLR. When I run things under LLDB, ASLR is off
>> (LLDB does that). When I gmake (with -j1), ASLR on.
>
> Yep that makes sense
>
>>>> @Andrea: Any intuition where else references could lurk, perhaps? I'm
>>>> currently doing this:
>>>>
>>>> static mps_res_t
>>>> fix_comp_unit (mps_ss_t ss, struct Lisp_Native_Comp_Unit *u)
>>>> {
>>>>   MPS_SCAN_BEGIN (ss)
>>>>   {
>>>>     IGC_FIX_CALL_FN (ss, struct Lisp_Vector, u, fix_vectorlike);
>>>>     if (u->data_imp_relocs)
>>>>       {
>>>> 	size_t n = ASIZE (u->data_impure_vec);
>>>> 	IGC_FIX12_NOBJS (ss, u->data_imp_relocs, n);
>>>>       }
>>>>     if (u->data_relocs)
>>>>       {
>>>> 	size_t n = ASIZE (u->data_vec);
>>>> 	IGC_FIX12_NOBJS (ss, u->data_relocs, n);
>>>>       }
>>>>   }
>>>>   MPS_SCAN_END (ss);
>>>>   return MPS_RES_OK;
>>>> }
>>>>
>>>> Maybe there's something wrong with that (the ASIZEs maybe?)
>>>
>>> I think the size should be fine,
>>
>> Thanks.
>>
>>> it would be very interesting to know which one is the symbol that was
>>> actually killed by the GC. This would give us strong indications.
>>> Maybe we can use the watchpoint strategy to identify it?
>>
>> It's the symbol that leads to the setting-constant error in the eager
>> macro expansion error. You can see that in the debug org file I attached
>> to another mail.
>>
>>       data = 0x000000010f0eb008 "byte-compile-form-stack"
>>
>> The problem is apparently similar to what we had before: The symbol has
>> been moved in memory (not freed), and a reference to the symbol was not
>> updated because we don't trace it. So a watchpoint won't help - the
>> problem is that nothing changes :-).
>
> 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.
>
>> 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.
>
> For instance we do exactly this 'byte-compile-form-stack' and others
> here:
>
> macroexp-1776619e-76691d27.c ======================
> extern struct Lisp_X *
> F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_0 (long long nargs, struct Lisp_X * * args)
> {
>   struct freloc_link_table * freloc;
>   struct Lisp_X * slot_0;
>   struct Lisp_X * slot_1;
>   struct Lisp_X * slot_2;
>   struct Lisp_X * slot_3;
>   struct Lisp_X * slot_4;
>   struct Lisp_X * slot_5;
>   struct Lisp_X * slot_6;
>   struct comp_handler * c;
>
> entry:
>   freloc = freloc_link_table;
>   /* Lisp function: nil */
>   slot_0 = *args;
>   /* ptr_arithmetic */
>   args = (struct Lisp_X * *)bitcast((unsigned long long)((unsigned long long)bitcast((void *)args, unsigned long long) + (unsigned long long)8 * (unsigned long long)(long long)1)\
> , void *);
>   goto entry_rest_args;
>
> entry_rest_args:
>   /* calling subr: list */
>   slot_1 = freloc->R6c697374_list_0 ((nargs - (long long)1), args);
>   goto bb_0;
>
> bb_0:
>   /* let */
>   slot_2 = d_reloc[(long long)0];
>   /* byte-compile-form-stack */
>   slot_3 = d_reloc[(long long)1];
>   /* cons */
>   slot_4 = d_reloc[(long long)2];
>
> [...]
> ======================
>
> Where we load it in 'slot_3'.
>
> 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?
>
> Thanks
>
>   Andrea

BTW we should be able to prove this is the issue compiling at with
native-comp-speed 0.

  Andrea



  reply	other threads:[~2024-04-30  9:05 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 [this message]
2024-04-30  9:18                                         ` Gerd Möllmann
2024-04-30  9:40                                           ` Andrea Corallo
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
  -- 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=yp17cgf6x19.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 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.