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: Andrea Corallo
Subject: bug#41357: 28.0.50; GC may miss to mark calle safe register content
Date: Sun, 17 May 2020 18:16:24 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Andrea Corallo <akrl@sdf.org>
>> Cc: bug-gnu-emacs@gnu.org, eggert@cs.ucla.edu
>> Date: Sun, 17 May 2020 17:45:28 +0000
>> 
>> Lisp_Object
>> foo (void)
>> {
>>   /* 'res' goes in a callee saved reg  */
>>   Lisp_Object res = build_string ("bar");
>>   [...]
>>   /* LTO inline the following as "flush_stack_call_func 
>> (mark_threads_callback, NULL);" */
>>   mark_threads ();
>>   [...]
>>   gc_sweep ();
>> 
>>   /* The string pointed by 'res' was garbage collected.  */
>>   return res;
>> }
>
> But mark_threads etc. (GC in general) isn't called from functions like
> your 'foo.  It is more like this:
>
> Lisp_Object
> foo (void)
> {
>   /* 'res' goes in a callee saved reg  */
>   Lisp_Object res = build_string ("bar");
>   [...]
>   call_something ();
>   [...]
>
> }
>
> call_something (void)
> {
>   [...]
>   garbage_collect ();
>   [...]
> }

Yes, my example was minimal your is certanly more realistic.

But also this can be critical.  We have to hope that in 'call_something'
or 'garbage_collect' there is sufficient register pressure to have the
register that is holding 'res' to be pushed.


  Andrea

-- 
akrl@sdf.org





reply via email to

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