From: Sergey Vinokurov Date: Sun, 6 Aug 2023 15:24:29 +0000 (+0100) Subject: Support compiled queries in pdump by dumping source (bug#69952) X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=972c17bfff47c4d4a067a9ed7c0d6b24d5cb4416;p=emacs.git Support compiled queries in pdump by dumping source (bug#69952) * src/pdumper.c (dump_vectorlike): Dump compiled queries. * src/pdumper.c (dump_treesit_compiled_query): New function. (cherry picked from commit 1eca867e1b60acef7f4343bc5c70340de58f1079) --- diff --git a/src/pdumper.c b/src/pdumper.c index bc5748c8c47..07fb1d569da 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -44,6 +44,7 @@ along with GNU Emacs. If not, see . */ #include "systime.h" #include "thread.h" #include "bignum.h" +#include "treesit.h" #ifdef CHECK_STRUCTS # include "dmpstruct.h" @@ -2214,6 +2215,21 @@ dump_finalizer (struct dump_context *ctx, return finish_dump_pvec (ctx, &out->header); } +#ifdef HAVE_TREE_SITTER +static dump_off +dump_treesit_compiled_query (struct dump_context *ctx, + struct Lisp_TS_Query *query) +{ + START_DUMP_PVEC (ctx, &query->header, struct Lisp_TS_Query, out); + dump_field_lv (ctx, &out->language, query, &query->language, WEIGHT_STRONG); + dump_field_lv (ctx, &out->source, query, &query->source, WEIGHT_STRONG); + /* Recompile these after load */ + out->query = NULL; + out->cursor = NULL; + return finish_dump_pvec (ctx, &out->header); +} +#endif + struct bignum_reload_info { dump_off data_location; @@ -3107,6 +3123,12 @@ dump_vectorlike (struct dump_context *ctx, return DUMP_OBJECT_IS_RUNTIME_MAGIC; } break; +#ifdef HAVE_TREE_SITTER + case PVEC_TS_COMPILED_QUERY: + return dump_treesit_compiled_query (ctx, XTS_COMPILED_QUERY (lv)); +#else + case PVEC_TS_COMPILED_QUERY: +#endif case PVEC_WINDOW_CONFIGURATION: case PVEC_OTHER: case PVEC_XWIDGET: @@ -3121,7 +3143,6 @@ dump_vectorlike (struct dump_context *ctx, case PVEC_FREE: case PVEC_TS_PARSER: case PVEC_TS_NODE: - case PVEC_TS_COMPILED_QUERY: break; } char msg[60];