[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/no-purespace 892be3b3d7a 35/41: Remove check for working malloc_
From: |
Stefan Kangas |
Subject: |
scratch/no-purespace 892be3b3d7a 35/41: Remove check for working malloc_set_state |
Date: |
Thu, 12 Dec 2024 16:57:52 -0500 (EST) |
branch: scratch/no-purespace
commit 892be3b3d7a459808ee47709d0f4e7f65566a6e5
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>
Remove check for working malloc_set_state
This check was added to 'malloc_initialize_hook' in order to "insulate
Emacs better from configuration screwups" (commit b4788b9394f3). With
unexec gone, we no longer use 'malloc_set_state', and thus don't need
this check.
Note that this patch removes the last uses of the deprecated glibc
functions 'malloc_set_state' and 'malloc_get_state' from our code.
* src/alloc.c (malloc_initialize_hook) [DOUG_LEA_MALLOC]:
Remove check for working 'malloc_set_state'.
(alloc_unexec_pre) [DOUG_LEA_MALLOC]: Delete unused function.
(alloc_unexec_post) [DOUG_LEA_MALLOC]: Delete function.
(malloc_state_ptr) [DOUG_LEA_MALLOC]: Delete variable.
* configure.ac (emacs_cv_var_doug_lea_malloc): Don't check for
malloc_set_state and malloc_get_state.
---
configure.ac | 5 ++---
src/alloc.c | 29 -----------------------------
2 files changed, 2 insertions(+), 32 deletions(-)
diff --git a/configure.ac b/configure.ac
index b320c4978d6..86e2e0a9f78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3206,8 +3206,7 @@ AC_CACHE_CHECK(
[AC_LANG_PROGRAM(
[[#include <malloc.h>
static void hook (void) {}]],
- [[malloc_set_state (malloc_get_state ());
- __after_morecore_hook = hook;
+ [[__after_morecore_hook = hook;
__malloc_initialize_hook = hook;]])],
[emacs_cv_var_doug_lea_malloc=yes])
fi])
@@ -3255,7 +3254,7 @@ if test "$doug_lea_malloc" = "yes"; then
fi
AC_DEFINE([DOUG_LEA_MALLOC], [1],
[Define to 1 if the system memory allocator is Doug Lea style,
- with malloc hooks and malloc_set_state.])
+ with malloc hooks.])
## Use mmap directly for allocating larger buffers.
## FIXME this comes from src/s/{gnu,gnu-linux}.h:
diff --git a/src/alloc.c b/src/alloc.c
index e557e82883c..1e0e5f58e84 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -209,10 +209,6 @@ enum { MALLOC_ALIGNMENT = max (2 * sizeof (size_t),
alignof (long double)) };
# define MMAP_MAX_AREAS 100000000
-/* A pointer to the memory allocated that copies that static data
- inside glibc's malloc. */
-static void *malloc_state_ptr;
-
/* Restore the dumped malloc state. Because malloc can be invoked
even before main (e.g. by the dynamic linker), the dumped malloc
state must be restored as early as possible using this special hook. */
@@ -247,10 +243,6 @@ malloc_initialize_hook (void)
break;
}
}
-
- if (malloc_set_state (malloc_state_ptr) != 0)
- emacs_abort ();
- alloc_unexec_post ();
}
}
@@ -266,27 +258,6 @@ voidfuncptr __MALLOC_HOOK_VOLATILE
__malloc_initialize_hook EXTERNALLY_VISIBLE
#endif
#if defined DOUG_LEA_MALLOC
-
-/* Allocator-related actions to do just before and after unexec. */
-
-void
-alloc_unexec_pre (void)
-{
-# ifdef DOUG_LEA_MALLOC
- malloc_state_ptr = malloc_get_state ();
- if (!malloc_state_ptr)
- fatal ("malloc_get_state: %s", strerror (errno));
-# endif
-}
-
-void
-alloc_unexec_post (void)
-{
-# ifdef DOUG_LEA_MALLOC
- free (malloc_state_ptr);
-# endif
-}
-
# ifdef GNU_LINUX
/* The address where the heap starts. */
- scratch/no-purespace 28dadb6f10a 41/41: Mark pure-bytes-used as obsolete, (continued)
- scratch/no-purespace 28dadb6f10a 41/41: Mark pure-bytes-used as obsolete, Stefan Kangas, 2024/12/12
- scratch/no-purespace 0e37b11e659 16/41: Unexec removal: Documentation adjustments, Stefan Kangas, 2024/12/12
- scratch/no-purespace 5b471384d18 18/41: Purecopy removal: Lisp code, Stefan Kangas, 2024/12/12
- scratch/no-purespace 00a1152fad5 20/41: Update pdumper hashes, Stefan Kangas, 2024/12/12
- scratch/no-purespace e44b1bf5cca 27/41: Don't call purecopy in textmodes/*.el, Stefan Kangas, 2024/12/12
- scratch/no-purespace a54ff8c18fa 17/41: Unexec removal: Build system, Stefan Kangas, 2024/12/12
- scratch/no-purespace 065b6f2fa7a 28/41: Don't call purecopy in help-mode.el, Stefan Kangas, 2024/12/12
- scratch/no-purespace 833037fadd3 23/41: Don't call purecopy in international/*.el, Stefan Kangas, 2024/12/12
- scratch/no-purespace 8da7086be6d 31/41: Don't call purecopy in emacs-lisp/*.el, Stefan Kangas, 2024/12/12
- scratch/no-purespace d6aeb1a2606 33/41: Delete remaining calls to purecopy, Stefan Kangas, 2024/12/12
- scratch/no-purespace 892be3b3d7a 35/41: Remove check for working malloc_set_state,
Stefan Kangas <=
- scratch/no-purespace ad9adab0428 36/41: Remove unused function my_heap_start, Stefan Kangas, 2024/12/12
- scratch/no-purespace 52dcc032067 37/41: Delete workaround for purespace in cl-generic, Stefan Kangas, 2024/12/12
- scratch/no-purespace b299a5d1845 38/41: Delete obsolete comment about using purespace, Stefan Kangas, 2024/12/12
- scratch/no-purespace d6b05b12828 39/41: Make 'purecopy' an obsolete function alias for 'identity', Stefan Kangas, 2024/12/12