GNU bug report logs - #41357
28.0.50; GC may miss to mark calle safe register content

Previous Next

Package: emacs;

Reported by: Andrea Corallo <akrl <at> sdf.org>

Date: Sun, 17 May 2020 12:43:02 UTC

Severity: normal

Found in version 28.0.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andrea Corallo <akrl <at> sdf.org>
Cc: 41357 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: bug#41357: 28.0.50; GC may miss to mark calle safe register content
Date: Sun, 17 May 2020 20:57:28 +0300
> From: Andrea Corallo <akrl <at> sdf.org>
> Cc: bug-gnu-emacs <at> gnu.org, eggert <at> 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 ();
  [...]
}

Which is quite different, AFAIU, wrt stack usage.

Or maybe I don't understand how "callee saved registers" work.




This bug report was last modified 5 years and 75 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.