emacs-devel
[Top][All Lists]
Advanced

[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 14:39:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

On Mon, May 27 2024, Eli Zaretskii wrote:

>> 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.
>
> Why is all this order important, can you elaborate?  Neither MPS nor
> we can rely on the order in which the generated code does this stuff,
> AFAIU.

It is important because scan_prstack only scans the region
prstack.stack[0..prstack.sp] and because scan_prstack runs (potentially)
concurrent to print_stack_push.

If print_stack_push increments prstack.sp before initializing
prstack.stack[prstack.sp], then scan_prstack may read the old value out
of that slot.

That a compiler will "rewrite"

   prstack.stack[prstack.sp] = e;
   prstack.sp += 1;

to 

   prstack.sp += 1;
   prstack.stack[prstack.sp - 1] = e;

seems very unlikely the me.  But granted, compilers are known to do
unhelpful things in the name of optimization.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]