[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/igc 9ecb6143b14 3/3: Create only 1 root for the dump
From: |
Gerd Moellmann |
Subject: |
scratch/igc 9ecb6143b14 3/3: Create only 1 root for the dump |
Date: |
Mon, 20 May 2024 03:38:53 -0400 (EDT) |
branch: scratch/igc
commit 9ecb6143b145cb01f6415e0c2c091ddc09fa610a
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>
Create only 1 root for the dump
---
src/igc.c | 81 ++++++++++++++++++---------------------------------------------
1 file changed, 23 insertions(+), 58 deletions(-)
diff --git a/src/igc.c b/src/igc.c
index f46657dd780..9c7fe54f23b 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -1323,6 +1323,9 @@ dflt_scan_obj (mps_ss_t ss, mps_addr_t base_start,
mps_addr_t base_limit,
case IGC_OBJ_STRING_DATA:
case IGC_OBJ_FLOAT:
+ /* Can occur in the dump. */
+ break;
+
case IGC_OBJ_LAST:
emacs_abort ();
@@ -1405,6 +1408,20 @@ dflt_scan (mps_ss_t ss, mps_addr_t base_start,
mps_addr_t base_limit)
return MPS_RES_OK;
}
+static mps_res_t
+scan_dump (mps_ss_t ss, void *start, void *end, void *closure)
+{
+ MPS_SCAN_BEGIN (ss)
+ {
+ struct pdumper_object_it it = { 0 };
+ void *base;
+ while ((base = pdumper_next_object (&it)) != NULL)
+ IGC_FIX_CALL (ss, dflt_scan_obj (ss, base, end, NULL));
+ }
+ MPS_SCAN_END (ss);
+ return MPS_RES_OK;
+}
+
static mps_res_t
fix_vectorlike (mps_ss_t ss, struct Lisp_Vector *v)
{
@@ -2125,6 +2142,12 @@ root_create_rdstack (struct igc *gc)
root_create_exact (gc, &rdstack, &rdstack + 1, scan_rdstack);
}
+void
+igc_on_pdump_loaded (void *start, void *end)
+{
+ root_create_exact (global_igc, start, end, scan_dump);
+}
+
void
igc_on_grow_specpdl (void)
{
@@ -3412,61 +3435,3 @@ be either an integer or a float. The default value is
0.05, i.e.
are handled as if they were the default value. */);
Vigc_step_interval = make_float (0.05);
}
-
-struct register_pdump_roots_ctx
-{
- void *hot_start; /* start of hot section in pdump */
- void *hot_end; /* end of hot section in pdump */
- void *root_start; /* start (or NULL) of current root */
- void *root_end; /* end (or NULL) of current root */
-};
-
-/* Try to combine adjacent objects into one root. Naively creating a
- separate root for each object seems to run into serious efficiency
- problems. */
-static void
-register_pdump_roots_1 (void *start, void *closure)
-{
- struct igc_header *h = start;
- void *end = (char *)start + to_bytes (h->nwords);
- struct register_pdump_roots_ctx *ctx = closure;
- if (start < ctx->hot_start || ctx->hot_end <= start)
- return;
- if (ctx->root_end == start) /* adjacent objects? */
- {
- ctx->root_end = end; /* combine them */
- }
- else
- {
- if (ctx->root_start != NULL)
- {
- root_create_exact (global_igc, ctx->root_start, ctx->root_end,
- dflt_scanx);
- }
- ctx->root_start = start;
- ctx->root_end = end;
- }
-}
-
-static void
-register_pdump_roots (void *start, void *end)
-{
- struct register_pdump_roots_ctx ctx = {
- .hot_start = start,
- .hot_end = end,
- .root_start = NULL,
- .root_end = NULL,
- };
- pdumper_visit_object_starts (register_pdump_roots_1, &ctx);
- if (ctx.root_start != NULL)
- {
- root_create_exact (global_igc, ctx.root_start, ctx.root_end,
- dflt_scanx);
- }
-}
-
-void
-igc_on_pdump_loaded (void *start, void *end)
-{
- register_pdump_roots (start, end);
-}