Subject: bug#69952: [PATCH] Support pdumping compiled queries by dumping their source

From: Eli Zaretskii <[email-masked]>
Date: Wed, 22 May 2024 15:55:50 +0300

> From: Yuan Fu <[email-masked]>
> Date: Tue, 21 May 2024 23:36:47 -0700
> Cc: [email-masked],
>  [email-masked],
>  [email-masked]
> 
> >>>> Yes, most likely a function-undefined signal, since all the treesit.c functions like treesit-query-capture or treesit-query-compile will be nonexistent. And usually the Lisp program trying to use the query would check for tree-sitter availability with treesit-available-p before trying to use any tree-sitter functions; so that signal will be usually avoided as well.
> >>> 
> >>> Can you suggest such an addition to the patch?
> >> 
> >> Let me take a look.
> >> 
> >> Yuan
> 
> Am I missing something? It seems the patch doesn’t include anything about loading a dumped query?

Looks like that, yes.

> I guess that’s the addition you’re talking about? If I want to add a special loader, where should I start?

I guess in dump_do_emacs_relocation and/or dump_do_dump_relocation?

Alternatively, perhaps it's better to define a hook via
pdumper_do_now_and_after_load_impl or
pdumper_do_now_and_after_late_load_impl, in which case the hook will
be run after loading the dump file.  This sounds easier if you can
access all the loaded queries one by one, instead of catching them
as they are being loaded.

Andrea, can you help Yuan here?  You have dealt with some of this when
you added dumping and restoring of native-compiled CUs, so I guess you
know your way better in pdumper.c.