Subject: Re: bug#78686: feature/igc: [PATCH] Make charset_table an exact root

From: Helmut Eller <[email-masked]>
Date: Wed, 04 Jun 2025 20:55:56 +0200

On Wed, Jun 04 2025, Pip Cet wrote:

> "Helmut Eller" <[email-masked]> writes:
>
>> Here is a proposal to move charset_table out of the GC heap and make it
>> an exact root area instead.
>
>> Previously, the charset_table was located in various places:
>
>> 1. in charset_table_init during bootstrap (ambiguous root)
>> 2. on the GC heap (loaded from the dump; pinned)
>> 3. on the malloc heap when it needed to grow (ambiguous root)
>>
>> Now, the charset table is copied back to charset_table_init after
>> loading the dump and it is scanned as an exact root area.
>
> Thanks.  Seems like the wrong approach to me:
>
> This removes the case we want, which is case 2, by restoring the case we
> don't want, by adding new and larger unprotected roots.  Shouldn't we
> simply make it so if igc is in use, we only ever use case 2?

Not necessarily.  My ideal solution would be to replace the
charset.attributes field with something that doesn't need to be traced,
e.g. an index into a Lisp_Vector of attributes.

[...]
> So why not just turn IGC_OBJ_DUMPED_CHARSET_TABLE into
> IGC_OBJ_CHARSET_TABLE, remove some igc_asserts, and avoid roots
> altogether, ensuring that root_create_charset_table is called only in
> temacs, never in pdumped emacs?

First, The IGC_OBJ_DUMPED_FOO types only exist because changing the GC
heap format was easier than wrestling with the dumper.  There was the
expectation that the dumper will eventually be extended to support what
MPS actually needs: sections that correspond to MPS pools.

Second, I don't like the practice of using the GC header to create
"shadow types".  I'd prefer to make them pvec types or keep 'em out of
the GC heap.

[...]
> Are you looking at kbd_buffer next?  That's a very large ambiguous root,
> but a little tricky, not least due to the GCC bug.

Maybe, depending on how this charset table business goes.

Helmut