emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MPS prstack


From: Eli Zaretskii
Subject: Re: MPS prstack
Date: Mon, 27 May 2024 16:12:51 +0300

> From: Helmut Eller <eller.helmut@gmail.com>
> Cc: gerd.moellmann@gmail.com,  emacs-devel@gnu.org
> Date: Mon, 27 May 2024 14:39:37 +0200
> 
> 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.

If we need to make sure that "prstack.stack[prstack.sp++] = e;" is
done atomically, maybe we can use the __atomic builtins (see the node
"__atomic Builtins" in the GCC manual).



reply via email to

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