[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MPS prstack
From: |
Helmut Eller |
Subject: |
Re: MPS prstack |
Date: |
Mon, 27 May 2024 11:15:35 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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.
- Re: MPS prstack, (continued)
- Re: MPS prstack, Gerd Möllmann, 2024/05/20
- Re: MPS prstack, Helmut Eller, 2024/05/22
- Re: MPS prstack, Gerd Möllmann, 2024/05/22
- Re: MPS prstack, Helmut Eller, 2024/05/24
- Re: MPS prstack, Gerd Möllmann, 2024/05/24
- Re: MPS prstack, Gerd Möllmann, 2024/05/25
- Re: MPS prstack, Helmut Eller, 2024/05/27
- Re: MPS prstack, Gerd Möllmann, 2024/05/27
- Re: MPS prstack,
Helmut Eller <=
- Re: MPS prstack, Gerd Möllmann, 2024/05/27
- Re: MPS prstack, Eli Zaretskii, 2024/05/27
- Re: MPS prstack, Helmut Eller, 2024/05/27
- Re: MPS prstack, Eli Zaretskii, 2024/05/27
- Re: MPS prstack, Helmut Eller, 2024/05/27
- Re: MPS prstack, Mattias Engdegård, 2024/05/27
- Re: MPS prstack, Helmut Eller, 2024/05/27
- Re: MPS prstack, Po Lu, 2024/05/27
- Re: MPS prstack, Helmut Eller, 2024/05/27
- Re: MPS prstack, Eli Zaretskii, 2024/05/27