From b4e3eb5f8a72657cbe39dab8709fd4bf90d77129 Mon Sep 17 00:00:00 2001 From: Helmut Eller Date: Wed, 19 Jun 2024 10:20:26 +0200 Subject: [PATCH 1/6] Introduce RELOC_BUFFER Use the dump_relocs mechanism instead of relying on Vbuffer_alist to find all existing buffers. * src/pdumper.c (dump_buffer, dump_do_dump_relocation): Create a RELOC_BUFFER. * src/igc.c (igc_on_pdump_loaded): Remove the buffer related code. --- src/igc.c | 9 --------- src/pdumper.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/igc.c b/src/igc.c index 4c688aa5ddb..9b909310e92 100644 --- a/src/igc.c +++ b/src/igc.c @@ -3952,15 +3952,6 @@ igc_on_pdump_loaded (void *dump_base, void *hot_start, void *hot_end, igc_root_create_ambig (pinned_objects_in_dump, (uint8_t *)pinned_objects_in_dump + sizeof pinned_objects_in_dump); - - /* Copy to buffer text to out of pdump */ - for (Lisp_Object l = Vbuffer_alist; !NILP (l); l = XCDR (l)) - { - struct buffer *buf = XBUFFER (XCDR (XCAR (l))); - eassert (pdumper_object_p (buf->text->beg)); - enlarge_buffer_text (buf, 0); - eassert (!pdumper_object_p (buf->text->beg)); - } } void * diff --git a/src/pdumper.c b/src/pdumper.c index e0ff395fd94..27717eea9c8 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -181,6 +181,9 @@ #define dump_offsetof(type, member) \ RELOC_NATIVE_COMP_UNIT, RELOC_NATIVE_SUBR, RELOC_BIGNUM, +#ifdef HAVE_MPS + RELOC_BUFFER, +#endif /* dump_lv = make_lisp_ptr (dump_lv + dump_base, type - RELOC_DUMP_TO_DUMP_LV) (Special case for symbols: make_lisp_symbol) @@ -2870,6 +2873,11 @@ dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer) dump_remember_cold_op (ctx, COLD_OP_BUFFER, make_lisp_ptr ((void *) in_buffer, Lisp_Vectorlike)); +#ifdef HAVE_MPS + dump_push (&ctx->dump_relocs[LATE_RELOCS], + list2 (make_fixnum (RELOC_BUFFER), + dump_off_to_lisp (ctx->obj_offset))); +#endif } else eassert (buffer->own_text.beg == NULL); @@ -5759,6 +5767,18 @@ dump_do_dump_relocation (const uintptr_t dump_base, mpz_roinit_n (bignum->value, limbs, reload_info.nlimbs); break; } +#ifdef HAVE_MPS + case RELOC_BUFFER: + { + /* When resurrecting, copy the text out of the dump so that we + can collect the dumped text. */ + struct buffer *b = dump_ptr (dump_base, reloc_offset); + eassert (pdumper_object_p (b->text->beg)); + enlarge_buffer_text (b, 0); + eassert (!pdumper_object_p (b->text->beg)); + } + break; +#endif default: /* Lisp_Object in the dump; precise type in reloc.type */ { Lisp_Object lv = dump_make_lv_from_reloc (dump_base, reloc); -- 2.39.2