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: Helmut Eller <eller.helmut@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,  Emacs Devel <emacs-devel@gnu.org>
Subject: Re: MPS prstack
Date: Mon, 27 May 2024 11:47:03 +0200	[thread overview]
Message-ID: <m2ttijwprc.fsf@pro2.fritz.box> (raw)
In-Reply-To: <87a5kbobt4.fsf@gmail.com> (Helmut Eller's message of "Mon, 27 May 2024 11:15:35 +0200")

Helmut Eller <eller.helmut@gmail.com> writes:

> On Mon, May 27 2024, Gerd Möllmann wrote:
>
>>>   prstack.stack[prstack.sp++] = e;
>>
>> Hm. No idea when the increment is sequenced. The side effect of postfix
>> ++ could be applied anywhere before the next sequence point. But where
>> is that sequence point? There is one at the end of the whole expression
>> I think.
>
> The generated code with O0 looks like this:
>
>    ...
>    0x000055555587fcb1 <+28>:    call   0x55555587fbd0 <grow_print_stack>
>    0x000055555587fcb6 <+33>:    mov    0x8845c3(%rip),%rcx        # 0x555556104280 <prstack>
>    0x000055555587fcbd <+40>:    mov    0x8845cc(%rip),%rax        # 0x555556104290 <prstack+16>
>    0x000055555587fcc4 <+47>:    lea    0x1(%rax),%rdx
>    0x000055555587fcc8 <+51>:    mov    %rdx,0x8845c1(%rip)        # 0x555556104290 <prstack+16>
>    0x000055555587fccf <+58>:    mov    %rax,%rdx
>    0x000055555587fcd2 <+61>:    mov    %rdx,%rax
>    0x000055555587fcd5 <+64>:    shl    $0x3,%rax
>    0x000055555587fcd9 <+68>:    sub    %rdx,%rax
>    0x000055555587fcdc <+71>:    shl    $0x3,%rax
>    0x000055555587fce0 <+75>:    add    %rcx,%rax
>    0x000055555587fce3 <+78>:    mov    0x10(%rbp),%rcx
>    0x000055555587fce7 <+82>:    mov    0x18(%rbp),%rbx
>    ...
>
> So it looks like prstack.sp is updated with the move at +51, i.e. before
> the stack slot is initialized.
>
> We could write
>
>   prstack.stack[prstack.sp] = e;
>   prstack.sp += 1;
>
> Not sure how we then guarantee that e still in a register or the control
> stack at the second line.
>
> But my question was more whether MPS actually does call scan_prstack at
> "any moment" or if this is just a theoretical possibility for some
> possible future version of MPS.

I think it is "at any moment". At least I can't find anything in the
docs hinting at something else.

Which probably means that we can't wholy trust stack points. They may be
off.



  reply	other threads:[~2024-05-27  9:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 17:54 MPS prstack Helmut Eller
2024-05-20 18:21 ` Gerd Möllmann
2024-05-20 18:32   ` Helmut Eller
2024-05-21  3:30     ` Gerd Möllmann
2024-05-22 16:27 ` Helmut Eller
2024-05-22 17:55   ` Gerd Möllmann
2024-05-24 14:17   ` Helmut Eller
2024-05-24 14:27     ` Gerd Möllmann
2024-05-25 13:45       ` Gerd Möllmann
2024-05-27  7:27         ` Helmut Eller
2024-05-27  8:43           ` Gerd Möllmann
2024-05-27  9:15             ` Helmut Eller
2024-05-27  9:47               ` Gerd Möllmann [this message]
2024-05-27 11:45               ` Eli Zaretskii
2024-05-27 12:39                 ` Helmut Eller
2024-05-27 13:12                   ` Eli Zaretskii
2024-05-27 14:15                     ` Helmut Eller
2024-05-27 14:37                       ` Mattias Engdegård
2024-05-27 14:54                         ` Helmut Eller
2024-05-27 14:43                       ` Po Lu
2024-05-27 15:08                         ` Helmut Eller
2024-05-27 11:34           ` Eli Zaretskii

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=m2ttijwprc.fsf@pro2.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --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.