bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#41357: 28.0.50; GC may miss to mark calle safe register content


From: Paul Eggert
Subject: bug#41357: 28.0.50; GC may miss to mark calle safe register content
Date: Sun, 17 May 2020 12:05:25 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 5/17/20 10:24 AM, Eli Zaretskii wrote:
> I struggle to see
> how a Lisp object could appear in a register without leaving any trace
> on the stack

Quite easily. It happens all the time. If I do something like this:

    Lisp_Object a = Fcons (b, c);
    f (x, y);
    return a;

The compiler might put 'a' into a callee-save register R, which means that while
f is running there's no trace of 'a' on the stack (unless f's code itself
decides to use R for whatever reason, but let's suppose it doesn't). This
situation can persist even if f calls g which calls h which calls the garbage
collector, and the garbage collector will then think the cons is garbage even
though it's not.

The proposed fix is harmless except it may execute a handful more instructions
per GC. So the cost of applying the fix is tiny, whereas the potential
reliability benefit is large.





reply via email to

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