emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 191a556: Fix segfault in profiler after pdump load


From: Daniel Colascione
Subject: [Emacs-diffs] master 191a556: Fix segfault in profiler after pdump load
Date: Wed, 16 Jan 2019 20:26:45 -0500 (EST)

branch: master
commit 191a5568db35f3a56f26431ca4722175d38c684f
Author: Daniel Colascione <address@hidden>
Commit: Daniel Colascione <address@hidden>

    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.
---
 src/profiler.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/profiler.c b/src/profiler.c
index 7624575..a98d967 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -36,7 +36,20 @@ saturated_add (EMACS_INT a, EMACS_INT b)
 
 typedef struct Lisp_Hash_Table log_t;
 
-static struct hash_table_test hashtest_profiler;
+static bool cmpfn_profiler (
+  struct hash_table_test *, Lisp_Object, Lisp_Object);
+
+static EMACS_UINT hashfn_profiler (
+  struct hash_table_test *, Lisp_Object);
+
+static const struct hash_table_test hashtest_profiler =
+  {
+   LISPSYM_INITIALLY (Qprofiler_backtrace_equal),
+   LISPSYM_INITIALLY (Qnil) /* user_hash_function */,
+   LISPSYM_INITIALLY (Qnil) /* user_cmp_function */,
+   cmpfn_profiler,
+   hashfn_profiler,
+  };
 
 static Lisp_Object
 make_log (EMACS_INT heap_size, EMACS_INT max_stack_depth)
@@ -587,12 +600,6 @@ to make room for new entries.  */);
 
   DEFSYM (Qprofiler_backtrace_equal, "profiler-backtrace-equal");
 
-  hashtest_profiler.name = Qprofiler_backtrace_equal;
-  hashtest_profiler.user_hash_function = Qnil;
-  hashtest_profiler.user_cmp_function = Qnil;
-  hashtest_profiler.cmpfn = cmpfn_profiler;
-  hashtest_profiler.hashfn = hashfn_profiler;
-
   defsubr (&Sfunction_equal);
 
 #ifdef PROFILER_CPU_SUPPORT



reply via email to

[Prev in Thread] Current Thread [Next in Thread]