Subject: bug#75322: SAFE_ALLOCA assumed to root Lisp_Objects/SSDATA(string)

From: Eli Zaretskii <[email-masked]>
Date: Sun, 05 Jan 2025 13:04:37 +0200

> Date: Sun, 05 Jan 2025 09:47:06 +0000
> From: Pip Cet <[email-masked]>
> Cc: [email-masked], [email-masked]
> 
> "Eli Zaretskii" <[email-masked]> writes:
> > I don't suggest to avoid GC.  I suggest that where GC _can_ happen, we
> > must reinitialize the pointer to string data after GC.
> 
> That suggestion is incorrect.  MPS GC can and does happen while we have
> SDATA pointers on the stack, and we rely on it to keep those valid.

Since we've established that MPS works on a single thread, which is
our Lisp thread, then GC cannot happen unless we make some call that
could trigger MPS GC.  Thus, whether or not SSDATA pointers are on the
stack is not relevant to when MPS GC could happen; what matters is the
code that is executed.

> IOW, MPS treats SDATA point the same way it treats Lisp_Objects.

I don't understand what that means.  What is "SDATA point"?  What is
the meaning of "treats the same"?

> The problem is that like Lisp_Objects, SDATA pointers cannot be
> moved to xmalloc'd memory and retain their validity.

No one said they could.  This is trivial.

> As long as you think MPS requires us to avoid GC in this case (this is
> implied by "we must do this or that after GC"), your understanding of
> how scratch/igc uses MPS is fundamentally incorrect.

Maybe my understanding is incorrect, but this style of "discussion",
where you are working hard to prove at all costs that I misunderstand
the issues and to point out my mistakes, contributes nothing at all to
understanding.  It only contributes to confusion.