From d7c51a03896a01bcac9d846139f8529d3ac6fdc2 Mon Sep 17 00:00:00 2001 From: Helmut Eller Date: Wed, 19 Jun 2024 10:53:50 +0200 Subject: [PATCH 3/6] Minor changes * src/igc.c (igc_alloc_dump): Let nbytes be the size without header. (dump_mmap_contiguous_mps): Update accordingly. (dump_field_fwd): Use &in_field->fwdptr instead of in_field. --- src/igc.c | 7 ++++--- src/pdumper.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/igc.c b/src/igc.c index 9b909310e92..9eb55e06000 100644 --- a/src/igc.c +++ b/src/igc.c @@ -3959,15 +3959,16 @@ igc_alloc_dump (size_t nbytes) { igc_assert (global_igc->park_count > 0); mps_ap_t ap = thread_ap (IGC_OBJ_CONS); + size_t block_size = igc_header_size () + nbytes; mps_addr_t block; do { - mps_res_t res = mps_reserve (&block, ap, nbytes); + mps_res_t res = mps_reserve (&block, ap, block_size); if (res != MPS_RES_OK) memory_full (0); + set_header (block, IGC_OBJ_INVALID, block_size, 0); } - while (!mps_commit (ap, block, nbytes)); - set_header (block, IGC_OBJ_INVALID, nbytes, 0); + while (!mps_commit (ap, block, block_size)); return base_to_client (block); } diff --git a/src/pdumper.c b/src/pdumper.c index 27b84707fcc..6f0ca3233bb 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -2362,7 +2362,7 @@ dump_float (struct dump_context *ctx, const struct Lisp_Float *lfloat) dump_field_fwd (struct dump_context *ctx, void *out, const void *in_start, const lispfwd *in_field) { - dump_field_emacs_ptr (ctx, out, in_start, in_field); + dump_field_emacs_ptr (ctx, out, in_start, &in_field->fwdptr); switch (XFWDTYPE (*in_field)) { case Lisp_Fwd_Int: @@ -5101,7 +5101,7 @@ dump_mmap_release_mps (struct dump_memory_map *map) dump_mmap_contiguous_mps (struct dump_memory_map *maps, int nr_maps, size_t total_size) { - uint8_t *p = igc_alloc_dump (igc_header_size () + total_size); + uint8_t *p = igc_alloc_dump (total_size); for (size_t i = 0; i < nr_maps; ++i) { struct dump_memory_map *map = &maps[i]; -- 2.39.2