From: Helmut Eller <eller.helmut@gmail.com>
To: "Gerd Möllmann" <gerd.moellmann@gmail.com>
Cc: Emacs Devel <emacs-devel@gnu.org>, Eli Zaretskii <eliz@gnu.org>
Subject: Re: MPS: Forwording symbols
Date: Thu, 20 Jun 2024 16:18:59 +0200 [thread overview]
Message-ID: <87le2z4rzg.fsf@gmail.com> (raw)
In-Reply-To: <m21q4uja9f.fsf@pro2.fritz.box> ("Gerd Möllmann"'s message of "Tue, 18 Jun 2024 21:55:56 +0200")
[-- Attachment #1: Type: text/plain, Size: 2813 bytes --]
I added labels to some roots so that the telemetry data is easier to
interpret. When recording telemetry with
MPS_TELEMETRY_CONTROL="all" MPS_TELEMETRY_FILENAME=/tmp/mpsio.log
../src/emacs -Q --batch -l lisp/emacs-lisp/ert-tests.el --eval
'(ert-run-tests-batch-and-exit
"ert-test-\\(parse\\|plist\\|record\\|run-tests-batch-exp\\)")'
and displaying it with this SQL statement:
select root,label,avg(delta),min(delta),max(delta),count(*) as count from (select root, (select I.string from EVENT_Intern AS I, EVENT_Label AS L where I.stringId = L.stringId and R.root=L.address) as label,time, time - lag(time) over (order by time) as delta from (select root,time from EVENT_RootScan union select 'flip',time from EVENT_TraceFlipBegin) R) group by root order by avg(delta) ;
I get this:
label avg(delta) min(delta) max(delta) count
-------------- ---------------- ---------- ---------- -----
"exact-ptr 675.666666666667 462 914 3
"rdstack 987.0 903 1113 3
"xpalloc-exact 1130.33333333333 1029 1186 3
"dump-pins 1680.0 1554 1890 3
"xzalloc-ambig 2723.0 2667 2761 3
"main-thread 3940.66666666667 2656 4798 3
"pure 15088.6666666667 12800 17010 3
"exact 16992.6666666667 16527 17346 3
"terminal-list 28983.6666666667 3076 78950 3
"specpdl 41100.3333333333 11046 76744 3
"buffer 44033.3333333333 21934 87843 3
"bc-stack 139762.0 124866 155557 3
"create-thread 158259.333333333 150224 172525 3
"charset-table 179802.0 85963 320555 3
"buffer 468265.0 219009 628425 3
"staticvec 539668.333333333 69006 798409 3
"kdb-buffer 612549.0 373380 925365 3
"lispsym 1778728.33333333 230528 2853050 3
The numbers are the duration for scanning the root, in cycles; multiply
with 400 picoseconds (or whatever you think is appropriate for one
cycle) to get the time. E.g. for lispsym, the maximum was 2853050 *
400e-12 =~ 1.1 millisecond.
That's down from 10 milliseconds it used to take to scan the dump.
I expected that staticvec to be at the top, but I guess lispsym actually
makes sense. It's strange though, that the maximum and minimum for
lispsym vary so much.
I general, ert-tests.el is quite strange. To run all tests in there
with:
make lisp/emacs-lisp/ert-tests
requires almost 4GB peak, but when running
ert-test-run-tests-batch-expensive alone, it requires much less than
that.
Here are the patches for this:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Introduce-RELOC_BUFFER.patch --]
[-- Type: text/x-diff, Size: 2837 bytes --]
From b4e3eb5f8a72657cbe39dab8709fd4bf90d77129 Mon Sep 17 00:00:00 2001
From: Helmut Eller <eller.helmut@gmail.com>
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Shrink-dump_public-after-the-dump-is-initialized.patch --]
[-- Type: text/x-diff, Size: 938 bytes --]
From 492d9698b411045c757b1e1d5cac59a0e3262957 Mon Sep 17 00:00:00 2001
From: Helmut Eller <eller.helmut@gmail.com>
Date: Wed, 19 Jun 2024 10:29:46 +0200
Subject: [PATCH 2/6] Shrink dump_public after the dump is initialized
* src/pdumper.c (pdumper_load): Set dump_public to the pinned region
from cold_user_data_start to heap_end. This should reduce the
probability that pdumper_object_p is misused.
---
src/pdumper.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/pdumper.c b/src/pdumper.c
index 27717eea9c8..27b84707fcc 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -6086,6 +6086,11 @@ pdumper_load (const char *dump_filename, char *argv0)
for (int i = 0; i < nr_dump_late_hooks; ++i)
dump_late_hooks[i] ();
+#ifdef HAVE_MPS
+ dump_public.start = (uintptr_t)cold_user_data_start;
+ dump_public.end = (uintptr_t)heap_end;
+#endif
+
initialized = true;
struct timespec load_timespec =
--
2.39.2
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Minor-changes.patch --]
[-- Type: text/x-diff, Size: 2119 bytes --]
From d7c51a03896a01bcac9d846139f8529d3ac6fdc2 Mon Sep 17 00:00:00 2001
From: Helmut Eller <eller.helmut@gmail.com>
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-When-resurrecting-buffers-copy-markers-to-a-weak-vec.patch --]
[-- Type: text/x-diff, Size: 2479 bytes --]
From a1bbbc0c1328e1adda65ee7e5f074796069a2b1e Mon Sep 17 00:00:00 2001
From: Helmut Eller <eller.helmut@gmail.com>
Date: Thu, 20 Jun 2024 08:47:56 +0200
Subject: [PATCH 4/6] When resurrecting buffers, copy markers to a weak vector
* src/igc.h (igc_resurrect_markers): New.
* src/igc.c (igc_resurrect_markers): Implementation.
(weak_vector_p): New helper.
* src/pdumper.c (dump_do_dump_relocation): Use igc_resurrect_markers.
---
src/igc.c | 29 +++++++++++++++++++++++++++++
src/igc.h | 1 +
src/pdumper.c | 1 +
3 files changed, 31 insertions(+)
diff --git a/src/igc.c b/src/igc.c
index 9eb55e06000..a464aee07c2 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -3522,6 +3522,35 @@ igc_remove_all_markers (struct buffer *b)
}
}
+static bool
+weak_vector_p (Lisp_Object x)
+{
+ if (VECTORP (x))
+ {
+ struct igc *igc = global_igc;
+ mps_pool_t pool = NULL;
+ mps_addr_pool (&pool, igc->arena, XVECTOR (x));
+ return pool == igc->weak_pool;
+ }
+ else
+ return false;
+}
+
+void
+igc_resurrect_markers (struct buffer *b)
+{
+ Lisp_Object old = BUF_MARKERS (b);
+ if (NILP (old))
+ return;
+ igc_assert (!weak_vector_p (old));
+ size_t len = ASIZE (old);
+ Lisp_Object new = alloc_vector_weak (len, Qnil);
+ memcpy (XVECTOR (new)->contents, XVECTOR (old)->contents,
+ len * sizeof (Lisp_Object));
+ BUF_MARKERS (b) = new;
+ igc_assert (weak_vector_p (BUF_MARKERS (b)));
+}
+
DEFUN ("igc-make-weak-vector", Figc_make_weak_vector, Sigc_make_weak_vector, 2, 2, 0,
doc: /* Return a new weak vector of length LENGTH, with each element being INIT.
See also the function `vector'. */)
diff --git a/src/igc.h b/src/igc.h
index 55ef7d4d56c..cd782fca0ca 100644
--- a/src/igc.h
+++ b/src/igc.h
@@ -79,6 +79,7 @@ #define EMACS_IGC_H
void igc_add_marker (struct buffer *b, struct Lisp_Marker *m);
void igc_remove_marker (struct buffer *b, struct Lisp_Marker *m);
void igc_remove_all_markers (struct buffer *b);
+void igc_resurrect_markers (struct buffer *b);
Lisp_Object igc_alloc_symbol (void);
void *igc_alloc_global_ref (void);
diff --git a/src/pdumper.c b/src/pdumper.c
index 6f0ca3233bb..e69a2b56f0b 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -5776,6 +5776,7 @@ dump_do_dump_relocation (const uintptr_t dump_base,
eassert (pdumper_object_p (b->text->beg));
enlarge_buffer_text (b, 0);
eassert (!pdumper_object_p (b->text->beg));
+ igc_resurrect_markers (b);
}
break;
#endif
--
2.39.2
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-When-creating-roots-allow-to-record-a-debug-name.patch --]
[-- Type: text/x-diff, Size: 10900 bytes --]
From be160fc73f081824cea5f6ffd51d8702e0e93a72 Mon Sep 17 00:00:00 2001
From: Helmut Eller <eller.helmut@gmail.com>
Date: Thu, 20 Jun 2024 14:04:59 +0200
Subject: [PATCH 5/6] When creating roots, allow to record a debug-name
* src/igc.c (register_root): Create a telemetry label for the
debug_name.
(root_create, root_create_ambig, root_create_exact)
(igc_root_create_ambig): New debug_name argument.
(root_create_staticvec, root_create_lispsym, root_create_buffer)
(root_create_terminal_list, root_create_main_thread)
(igc_root_create_exact, igc_root_create_exact_ptr, root_create_specpdl)
(root_create_bc, root_create_charset_table, root_create_pure)
(root_create_thread, igc_grow_rdstack, root_create_exact_n)
(igc_xalloc_lisp_objs_exact, igc_xzalloc_ambig, igc_realloc_ambig)
(igc_xpalloc_ambig, igc_xpalloc_exact, igc_xnrealloc_ambig)
(igc_on_pdump_loaded): Set debug_name.
* src/igc.c (igc_root_create_ambig): New debug_name argument.
* src/keyboard.c (init_keyboard): Set debug_name.
---
src/igc.c | 82 ++++++++++++++++++++++++++++++--------------------
src/igc.h | 2 +-
src/keyboard.c | 3 +-
3 files changed, 53 insertions(+), 34 deletions(-)
diff --git a/src/igc.c b/src/igc.c
index a464aee07c2..627f88acf4d 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -581,10 +581,16 @@ arena_release (struct igc *gc)
static struct igc_root_list *
register_root (struct igc *gc, mps_root_t root, void *start, void *end,
- bool ambig)
+ bool ambig, const char *debug_name)
{
- struct igc_root r
- = { .gc = gc, .root = root, .start = start, .end = end, .ambig = ambig };
+ if (debug_name && (mps_telemetry_get () & (1 << 6)))
+ {
+ mps_label_t label = mps_telemetry_intern (debug_name);
+ mps_telemetry_label (root, label);
+ }
+ struct igc_root r = {
+ .gc = gc, .root = root, .start = start, .end = end, .ambig = ambig
+ };
return igc_root_list_push (&gc->roots, &r);
}
@@ -2101,48 +2107,52 @@ scan_cell_callback (struct igc_opaque *op, Lisp_Object *addr)
static igc_root_list *
root_create (struct igc *gc, void *start, void *end, mps_rank_t rank,
- mps_area_scan_t scan, void *closure, bool ambig)
+ mps_area_scan_t scan, void *closure, bool ambig,
+ const char *debug_name)
{
mps_root_t root;
mps_res_t res
= mps_root_create_area (&root, gc->arena, rank, 0, start, end, scan,
closure);
IGC_CHECK_RES (res);
- return register_root (gc, root, start, end, ambig);
+ return register_root (gc, root, start, end, ambig, debug_name);
}
static igc_root_list *
-root_create_ambig (struct igc *gc, void *start, void *end)
+root_create_ambig (struct igc *gc, void *start, void *end,
+ const char *debug_name)
{
return root_create (gc, start, end, mps_rank_ambig (), scan_ambig, NULL,
- true);
+ true, debug_name ? debug_name : "ambig");
}
static igc_root_list *
root_create_exact (struct igc *gc, void *start, void *end,
- mps_area_scan_t scan)
+ mps_area_scan_t scan, const char *debug_name)
{
- return root_create (gc, start, end, mps_rank_exact (), scan, NULL, false);
+ return root_create (gc, start, end, mps_rank_exact (), scan, NULL, false,
+ debug_name);
}
static void
root_create_staticvec (struct igc *gc)
{
root_create_exact (gc, staticvec, staticvec + ARRAYELTS (staticvec),
- scan_staticvec);
+ scan_staticvec, "staticvec");
}
static void
root_create_lispsym (struct igc *gc)
{
- root_create_exact (gc, lispsym, lispsym + ARRAYELTS (lispsym), scan_lispsym);
+ root_create_exact (gc, lispsym, lispsym + ARRAYELTS (lispsym),
+ scan_lispsym, "lispsym");
}
static void
root_create_buffer (struct igc *gc, struct buffer *b)
{
void *start = &b->name_, *end = &b->own_text;
- root_create_ambig (gc, start, end);
+ root_create_ambig (gc, start, end, "buffer");
}
static void
@@ -2150,7 +2160,7 @@ root_create_terminal_list (struct igc *gc)
{
void *start = &terminal_list;
void *end = (char *) start + sizeof (terminal_list);
- root_create_ambig (gc, start, end);
+ root_create_ambig (gc, start, end, "terminal-list");
}
static void
@@ -2158,19 +2168,19 @@ root_create_main_thread (struct igc *gc)
{
void *start = &main_thread;
void *end = (char *) &main_thread + sizeof (main_thread);
- root_create_exact (gc, start, end, scan_main_thread);
+ root_create_exact (gc, start, end, scan_main_thread, "main-thread");
}
void
-igc_root_create_ambig (void *start, void *end)
+igc_root_create_ambig (void *start, void *end, const char* debug_name)
{
- root_create_ambig (global_igc, start, end);
+ root_create_ambig (global_igc, start, end, debug_name);
}
void
igc_root_create_exact (Lisp_Object *start, Lisp_Object *end)
{
- root_create_exact (global_igc, start, end, scan_exact);
+ root_create_exact (global_igc, start, end, scan_exact, "exact");
}
void
@@ -2178,7 +2188,7 @@ igc_root_create_exact_ptr (void *var_addr)
{
void *start = var_addr;
void *end = (char *) start + sizeof (void *);
- root_create_exact (global_igc, start, end, scan_ptr_exact);
+ root_create_exact (global_igc, start, end, scan_ptr_exact, "exact-ptr");
}
static void
@@ -2194,7 +2204,8 @@ root_create_specpdl (struct igc_thread_list *t)
ts->m_specpdl, ts->m_specpdl_end, scan_specpdl, t);
IGC_CHECK_RES (res);
t->d.specpdl_root
- = register_root (gc, root, ts->m_specpdl, ts->m_specpdl_end, false);
+ = register_root (gc, root, ts->m_specpdl, ts->m_specpdl_end, false,
+ "specpdl");
}
static void
@@ -2208,14 +2219,16 @@ root_create_bc (struct igc_thread_list *t)
bc->stack, bc->stack_end, scan_bc, t);
IGC_CHECK_RES (res);
igc_assert (t->d.bc_root == NULL);
- t->d.bc_root = register_root (gc, root, bc->stack, bc->stack_end, true);
+ t->d.bc_root = register_root (gc, root, bc->stack, bc->stack_end, true,
+ "bc-stack");
}
static void
root_create_charset_table (struct igc *gc)
{
root_create_ambig (gc, charset_table_init,
- charset_table_init + ARRAYELTS (charset_table_init));
+ charset_table_init + ARRAYELTS (charset_table_init),
+ "charset-table");
}
#ifndef IN_MY_FORK
@@ -2224,7 +2237,8 @@ root_create_pure (struct igc *gc)
{
void *start = &pure[0];
void *end = &pure[PURESIZE];
- root_create (gc, start, end, mps_rank_ambig (), scan_pure, NULL, true);
+ root_create (gc, start, end, mps_rank_ambig (), scan_pure, NULL, true,
+ "pure");
}
#endif
@@ -2238,7 +2252,7 @@ root_create_thread (struct igc_thread_list *t)
= mps_root_create_thread_scanned (&root, gc->arena, mps_rank_ambig (), 0,
t->d.thr, scan_ambig, 0, cold);
IGC_CHECK_RES (res);
- register_root (gc, root, cold, NULL, true);
+ register_root (gc, root, cold, NULL, true, "create-thread");
}
void
@@ -2269,7 +2283,8 @@ igc_grow_rdstack (struct read_stack *rs)
for (ptrdiff_t i = old_nitems; i < rs->size; ++i)
rs->stack[i].type = RE_free;
gc->rdstack_root
- = root_create_exact (gc, rs->stack, rs->stack + rs->size, scan_rdstack);
+ = root_create_exact (gc, rs->stack, rs->stack + rs->size, scan_rdstack,
+ "rdstack");
}
}
@@ -2278,7 +2293,8 @@ root_create_exact_n (Lisp_Object *start, size_t n)
{
igc_assert (start != NULL);
igc_assert (n > 0);
- return root_create_exact (global_igc, start, start + n, scan_exact);
+ return root_create_exact (global_igc, start, start + n, scan_exact,
+ "exact-n");
}
void *
@@ -2424,7 +2440,8 @@ igc_xalloc_lisp_objs_exact (size_t n)
{
size_t size = n * sizeof (Lisp_Object);
void *p = xzalloc (size);
- root_create_exact (global_igc, p, (char *) p + size, scan_exact);
+ root_create_exact (global_igc, p, (char *) p + size, scan_exact,
+ "xalloc-exact");
return p;
}
@@ -2443,7 +2460,7 @@ igc_xzalloc_ambig (size_t size)
void *end = (char *) p + size;
if (end == p)
end = (char *) p + IGC_ALIGN_DFLT;
- root_create_ambig (global_igc, p, end);
+ root_create_ambig (global_igc, p, end, "xzalloc-ambig");
return p;
}
@@ -2459,7 +2476,7 @@ igc_realloc_ambig (void *block, size_t size)
size_t new_size = (size == 0 ? IGC_ALIGN_DFLT : size);
void *p = xrealloc (block, new_size);
void *end = (char *)p + new_size;
- root_create_ambig (global_igc, p, end);
+ root_create_ambig (global_igc, p, end, "realloc-ambig");
return p;
}
@@ -2492,7 +2509,7 @@ igc_xpalloc_ambig (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min,
}
pa = xpalloc (pa, nitems, nitems_incr_min, nitems_max, item_size);
char *end = (char *) pa + *nitems * item_size;
- root_create_ambig (global_igc, pa, end);
+ root_create_ambig (global_igc, pa, end, "xpalloc-ambig");
}
return pa;
}
@@ -2522,7 +2539,7 @@ igc_xpalloc_exact (void **pa_cell, ptrdiff_t *nitems,
pa = xpalloc (pa, nitems, nitems_incr_min, nitems_max, item_size);
char *end = (char *)pa + *nitems * item_size;
root_create (global_igc, pa, end, mps_rank_exact (),
- scan_xpalloced, scan_area, false);
+ scan_xpalloced, scan_area, false, "xpalloc-exact");
*pa_cell = pa;
}
}
@@ -2540,7 +2557,7 @@ igc_xnrealloc_ambig (void *pa, ptrdiff_t nitems, ptrdiff_t item_size)
}
pa = xnrealloc (pa, nitems, item_size);
char *end = (char *) pa + nitems * item_size;
- root_create_ambig (global_igc, pa, end);
+ root_create_ambig (global_igc, pa, end, "xnrealloc-ambig");
}
return pa;
}
@@ -3980,7 +3997,8 @@ igc_on_pdump_loaded (void *dump_base, void *hot_start, void *hot_end,
memcpy (pinned_objects_in_dump, pinned_roots, sizeof pinned_roots);
igc_root_create_ambig (pinned_objects_in_dump,
(uint8_t *)pinned_objects_in_dump
- + sizeof pinned_objects_in_dump);
+ + sizeof pinned_objects_in_dump,
+ "dump-pins");
}
void *
diff --git a/src/igc.h b/src/igc.h
index cd782fca0ca..485f23090c2 100644
--- a/src/igc.h
+++ b/src/igc.h
@@ -145,7 +145,7 @@ #define EMACS_IGC_H
void igc_on_alloc_main_thread_bc (void);
void igc_begin_collecting (void);
void igc_collect (void);
-void igc_root_create_ambig (void *start, void *end);
+void igc_root_create_ambig (void *start, void *end, const char *debug_name);
void igc_root_create_exact (Lisp_Object *start, Lisp_Object *end);
void igc_root_create_exact_ptr (void *var_addr);
void igc_root_destroy_comp_unit (struct Lisp_Native_Comp_Unit *u);
diff --git a/src/keyboard.c b/src/keyboard.c
index 21c4bbd7b2f..e40447d4b39 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -12670,7 +12670,8 @@ delete_kboard (KBOARD *kb)
init_keyboard (void)
{
#ifdef HAVE_MPS
- igc_root_create_ambig (kbd_buffer, kbd_buffer + ARRAYELTS (kbd_buffer));
+ igc_root_create_ambig (kbd_buffer, kbd_buffer + ARRAYELTS (kbd_buffer),
+ "kdb-buffer");
#endif
/* This is correct before outermost invocation of the editor loop. */
command_loop_level = -1;
--
2.39.2
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-Use-igc_assert-instead-of-eassert.patch --]
[-- Type: text/x-diff, Size: 2252 bytes --]
From d810517b678e920a45992f02138d688a7cb37df8 Mon Sep 17 00:00:00 2001
From: Helmut Eller <eller.helmut@gmail.com>
Date: Thu, 20 Jun 2024 15:08:55 +0200
Subject: [PATCH 6/6] Use igc_assert instead of eassert
* src/igc.c. (igc_on_pdump_loaded):
---
src/igc.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/igc.c b/src/igc.c
index 627f88acf4d..b8f0c020847 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -3962,24 +3962,24 @@ igc_on_pdump_loaded (void *dump_base, void *hot_start, void *hot_end,
void *cold_user_data_start, void *heap_end)
{
igc_assert (global_igc->park_count > 0);
- eassert (base_to_client (hot_start) == charset_table);
- eassert (((struct igc_header *)cold_start)->obj_type
- == IGC_OBJ_DUMPED_CODE_SPACE_MASKS);
- eassert (((struct igc_header *)cold_user_data_start)->obj_type
- == IGC_OBJ_DUMPED_BYTES);
- eassert (((struct igc_header *)heap_end)->obj_type == IGC_OBJ_DUMPED_BYTES);
-
+ igc_assert (base_to_client (hot_start) == charset_table);
+ igc_assert (((struct igc_header *)hot_start)->obj_type
+ == IGC_OBJ_DUMPED_CHARSET_TABLE);
+ igc_assert (((struct igc_header *)cold_start)->obj_type
+ == IGC_OBJ_DUMPED_CODE_SPACE_MASKS);
+ igc_assert (((struct igc_header *)cold_user_data_start)->obj_type
+ == IGC_OBJ_DUMPED_BYTES);
+ igc_assert (((struct igc_header *)heap_end)->obj_type
+ == IGC_OBJ_DUMPED_BYTES);
size_t discardable_size = (uint8_t *)cold_start - (uint8_t *)hot_end;
// size_t cold_size = (uint8_t *)cold_end - (uint8_t *)cold_start;
size_t dump_header_size = (uint8_t *)hot_start - (uint8_t *)dump_base;
size_t relocs_size = (uint8_t *)cold_end - (uint8_t *)heap_end;
struct igc_header *h = client_to_base (dump_base);
igc_assert (h->obj_type == IGC_OBJ_INVALID);
-#ifdef IGC_DEBUG
- size_t dump_size = (uint8_t *)cold_end - (uint8_t *)dump_base;
- igc_assert (obj_size (h) == sizeof *h + dump_size);
+ igc_assert (obj_size (h)
+ == sizeof *h + (uint8_t *)cold_end - (uint8_t *)dump_base);
igc_assert (discardable_size > 2 * sizeof *h);
-#endif
/* Ignore dump_header */
set_header (h, IGC_OBJ_PAD, sizeof *h + dump_header_size, 0);
/* Ignore discardable section */
--
2.39.2
next prev parent reply other threads:[~2024-06-20 14:18 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-16 9:43 MPS: Forwording symbols Gerd Möllmann
2024-06-16 10:15 ` Gerd Möllmann
2024-06-16 19:27 ` Helmut Eller
2024-06-16 19:39 ` Gerd Möllmann
2024-06-17 10:57 ` Eli Zaretskii
2024-06-17 12:15 ` Gerd Möllmann
2024-06-17 12:24 ` Eli Zaretskii
2024-06-17 12:58 ` Gerd Möllmann
2024-06-17 3:43 ` Gerd Möllmann
2024-06-17 11:47 ` Eli Zaretskii
2024-06-17 18:10 ` Helmut Eller
2024-06-17 18:39 ` Gerd Möllmann
2024-06-17 18:50 ` Gerd Möllmann
2024-06-17 19:05 ` Helmut Eller
2024-06-17 19:19 ` Gerd Möllmann
2024-06-17 19:25 ` Helmut Eller
2024-06-17 20:07 ` Gerd Möllmann
2024-06-18 6:32 ` Gerd Möllmann
2024-06-18 9:05 ` Helmut Eller
2024-06-18 9:24 ` Gerd Möllmann
2024-06-18 10:44 ` Gerd Möllmann
2024-06-18 11:55 ` Helmut Eller
2024-06-18 12:21 ` Gerd Möllmann
2024-06-18 19:36 ` Helmut Eller
2024-06-18 19:55 ` Gerd Möllmann
2024-06-20 14:18 ` Helmut Eller [this message]
2024-06-20 15:16 ` Gerd Möllmann
2024-06-20 16:17 ` Helmut Eller
2024-06-20 16:27 ` Gerd Möllmann
2024-06-18 12:05 ` Helmut Eller
2024-06-18 12:29 ` Gerd Möllmann
2024-06-18 13:08 ` Eli Zaretskii
2024-06-18 12:36 ` Eli Zaretskii
2024-06-18 16:20 ` Helmut Eller
2024-06-18 16:29 ` Eli Zaretskii
2024-06-18 16:43 ` Gerd Möllmann
2024-06-18 16:37 ` Helmut Eller
2024-06-18 17:33 ` Eli Zaretskii
2024-06-18 17:51 ` Helmut Eller
2024-06-18 18:18 ` Eli Zaretskii
2024-06-18 17:54 ` Eli Zaretskii
2024-06-18 18:11 ` Gerd Möllmann
2024-06-18 18:20 ` Eli Zaretskii
2024-06-18 18:23 ` Gerd Möllmann
2024-06-18 18:12 ` Helmut Eller
2024-06-18 18:22 ` Eli Zaretskii
2024-06-18 19:27 ` Helmut Eller
2024-06-18 19:33 ` Gerd Möllmann
2024-06-19 11:22 ` Eli Zaretskii
2024-06-17 19:06 ` Gerd Möllmann
2024-06-21 15:36 ` Helmut Eller
2024-06-21 15:41 ` Gerd Möllmann
2024-06-21 16:20 ` Gerd Möllmann
2024-06-22 18:02 ` Helmut Eller
2024-06-22 18:27 ` Gerd Möllmann
2024-06-22 18:53 ` Helmut Eller
2024-06-22 19:26 ` Gerd Möllmann
2024-06-23 3:28 ` Gerd Möllmann
2024-06-23 4:10 ` Gerd Möllmann
2024-06-23 19:59 ` Helmut Eller
2024-06-24 3:45 ` Gerd Möllmann
2024-06-24 15:13 ` Helmut Eller
2024-06-24 16:14 ` Gerd Möllmann
2024-06-24 16:32 ` Eli Zaretskii
2024-06-24 17:00 ` Gerd Möllmann
2024-06-23 15:59 ` Helmut Eller
2024-06-23 16:26 ` Gerd Möllmann
2024-06-21 16:15 ` Ihor Radchenko
2024-06-21 16:25 ` Gerd Möllmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87le2z4rzg.fsf@gmail.com \
--to=eller.helmut@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=gerd.moellmann@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).