aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Colascione2019-01-16 20:26:19 -0500
committerDaniel Colascione2019-01-16 20:26:19 -0500
commit191a5568db35f3a56f26431ca4722175d38c684f (patch)
tree982f88df4a7123afc6ee5502420f88ae6df1f11e /src
parent27f53bd6886c1a76ac7058ae7b90cacc317aadea (diff)
downloademacs-191a5568db35f3a56f26431ca4722175d38c684f.tar.gz
emacs-191a5568db35f3a56f26431ca4722175d38c684f.zip
Fix segfault in profiler after pdump load
Move initialization of the profiler's hash test to static initialization from the syms function so that pdumper doesn't need to bother capturing it in any special way. * src/profiler.c (cmpfn_profiler, hashfn_profiler): forward declare. (hashtest_profiler): statically initialize. (syms_of_profiler): remove dynamic initialization of hashtest_profiler.
Diffstat (limited to 'src')
-rw-r--r--src/profiler.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/profiler.c b/src/profiler.c
index 76245750ada..a98d967b2a1 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -36,7 +36,20 @@ saturated_add (EMACS_INT a, EMACS_INT b)
36 36
37typedef struct Lisp_Hash_Table log_t; 37typedef struct Lisp_Hash_Table log_t;
38 38
39static struct hash_table_test hashtest_profiler; 39static bool cmpfn_profiler (
40 struct hash_table_test *, Lisp_Object, Lisp_Object);
41
42static EMACS_UINT hashfn_profiler (
43 struct hash_table_test *, Lisp_Object);
44
45static const struct hash_table_test hashtest_profiler =
46 {
47 LISPSYM_INITIALLY (Qprofiler_backtrace_equal),
48 LISPSYM_INITIALLY (Qnil) /* user_hash_function */,
49 LISPSYM_INITIALLY (Qnil) /* user_cmp_function */,
50 cmpfn_profiler,
51 hashfn_profiler,
52 };
40 53
41static Lisp_Object 54static Lisp_Object
42make_log (EMACS_INT heap_size, EMACS_INT max_stack_depth) 55make_log (EMACS_INT heap_size, EMACS_INT max_stack_depth)
@@ -587,12 +600,6 @@ to make room for new entries. */);
587 600
588 DEFSYM (Qprofiler_backtrace_equal, "profiler-backtrace-equal"); 601 DEFSYM (Qprofiler_backtrace_equal, "profiler-backtrace-equal");
589 602
590 hashtest_profiler.name = Qprofiler_backtrace_equal;
591 hashtest_profiler.user_hash_function = Qnil;
592 hashtest_profiler.user_cmp_function = Qnil;
593 hashtest_profiler.cmpfn = cmpfn_profiler;
594 hashtest_profiler.hashfn = hashfn_profiler;
595
596 defsubr (&Sfunction_equal); 603 defsubr (&Sfunction_equal);
597 604
598#ifdef PROFILER_CPU_SUPPORT 605#ifdef PROFILER_CPU_SUPPORT