GNU bug report logs -
#75754
styled_format stack usage/GC protection
Previous Next
Reported by: Pip Cet <pipcet <at> protonmail.com>
Date: Wed, 22 Jan 2025 10:20:01 UTC
Severity: normal
Done: Pip Cet <pipcet <at> protonmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Date: Fri, 24 Jan 2025 15:02:20 +0000
> From: Pip Cet <pipcet <at> protonmail.com>
> Cc: eggert <at> cs.ucla.edu, 75754 <at> debbugs.gnu.org, michael.albinus <at> gmx.de
>
> > If you mean under what circumstances some internal function calls Lisp
> > (or can otherwise GC), then no, we don't document that anywhere. I
> > just looked at the source code to answer your question.
>
> (This is an honest question: do you believe Emacs would be worse off if
> we added an ASSUME_NO_GC macro like
>
> ASSUME_NO_GC (true);
> p = SDATA (str);
>
> 532 lines of code here
>
> use p for the last time
>
> ASSUME_NO_GC (false);
No, I don't think Emacs will be worse. But I hope we will only have
to do this in not too-many places. Although I'm unsure how to find
them and how to discern between them and the rest. We'd need some
rules where to place these.
> >> >> feature/igc avoids all of these problems by keeping SDATA pointers
> >> >> valid, even when the string is resized.
> >> >
> >> > Unless the string is GC'ed, right?
> >>
> >> Even if it is GC'd.
> >>
> >> The SDATA will stay around while there are live pointers to it. The
> >> SDATA doesn't keep the string alive, but there's no way to get a
> >> reference to the now-dead Lisp_String structure from the SDATA, so this
> >> won't cause bugs.
> >
> > Even if the code modifies the string after GC?
>
> If the GC free'd the string, but not the SDATA structure, we cannot
> regenerate the string to call resize_string_data. So, no, this cannot
> happen.
>
> Note that resizing a live string while you have a live SDATA pointer to
> it might result in the SDATA pointer referring to the pre-modification
> SDATA, not the current one.
Who said anything about resizing? I thought about changing a string
with SSET, for example, or Faset.
IOW, the scenario is:
. we take a pointer to a string's SDATA
. GC happens
. we use SSET or Faset to modify the string
. we use the above pointer
With the old GC, this is a no-no, but you seem to be saying that on
the igc branch it's okay to do that?
This bug report was last modified 163 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.