summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2024-01-03 05:11:10 +0100
committerStefan Kangas <stefankangas@gmail.com>2024-01-03 05:11:10 +0100
commit5a1cd1bb98f74710d3b2a227755c5627a256dafb (patch)
tree2cb470c1497dbd71a438bf1755865e6415448008
parent91bc775b0c60342f118640001d2ce293d4f1f7ef (diff)
downloademacs-5a1cd1bb98f74710d3b2a227755c5627a256dafb.tar.gz
Delete obsolete GC debugging code
This code was introduced in 2014 to catch a GC bug that, according to Paul Eggert in 2019, "seems to have been fixed" (see 2b552f34892 2019-08-21 "Don’t debug fset by default"). It has been marked obsolete since that time, and no one has mentioned it on our mailing lists since. Let's just get rid of it. * src/alloc.c (SUSPICIOUS_OBJECT_CHECKING) [ENABLE_CHECKING]: Don't define. (suspicious_free_record, suspicious_objects, suspicious_object_index) (suspicious_free_history, suspicious_free_history_index) (note_suspicious_free) [SUSPICIOUS_OBJECT_CHECKING]: Delete. (find_suspicious_object_in_range) (detect_suspicious_free): Delete functions. (cleanup_vector) (allocate_vectorlike): Don't call above deleted functions. (Fsuspicious_object): Delete DEFUN. (syms_of_alloc) <Ssuspicious_object>: Delete defsubr.
-rw-r--r--src/alloc.c102
1 files changed, 0 insertions, 102 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 3e29c61f1ff..53ba85d88b7 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -412,31 +412,6 @@ static EMACS_INT gc_threshold;
const char *pending_malloc_warning;
-/* Pointer sanity only on request. FIXME: Code depending on
- SUSPICIOUS_OBJECT_CHECKING is obsolete; remove it entirely. */
-#ifdef ENABLE_CHECKING
-#define SUSPICIOUS_OBJECT_CHECKING 1
-#endif
-
-#ifdef SUSPICIOUS_OBJECT_CHECKING
-struct suspicious_free_record
-{
- void *suspicious_object;
- void *backtrace[128];
-};
-static void *suspicious_objects[32];
-static int suspicious_object_index;
-struct suspicious_free_record suspicious_free_history[64] EXTERNALLY_VISIBLE;
-static int suspicious_free_history_index;
-/* Find the first currently-monitored suspicious pointer in range
- [begin,end) or NULL if no such pointer exists. */
-static void *find_suspicious_object_in_range (void *begin, void *end);
-static void detect_suspicious_free (void *ptr);
-#else
-# define find_suspicious_object_in_range(begin, end) ((void *) NULL)
-# define detect_suspicious_free(ptr) ((void) 0)
-#endif
-
/* Maximum amount of C stack to save when a GC happens. */
#ifndef MAX_SAVE_STACK
@@ -3351,7 +3326,6 @@ vectorlike_nbytes (const union vectorlike_header *hdr)
static void
cleanup_vector (struct Lisp_Vector *vector)
{
- detect_suspicious_free (vector);
if ((vector->header.size & PSEUDOVECTOR_FLAG) == 0)
return; /* nothing more to do for plain vectors */
switch (PSEUDOVECTOR_TYPE (vector))
@@ -3629,9 +3603,6 @@ allocate_vectorlike (ptrdiff_t len, bool clearit)
mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
#endif
- if (find_suspicious_object_in_range (p, (char *) p + nbytes))
- emacs_abort ();
-
tally_consing (nbytes);
vector_cells_consed += len;
@@ -8019,78 +7990,6 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
return unbind_to (gc_count, found);
}
-#ifdef SUSPICIOUS_OBJECT_CHECKING
-
-static void *
-find_suspicious_object_in_range (void *begin, void *end)
-{
- char *begin_a = begin;
- char *end_a = end;
- int i;
-
- for (i = 0; i < ARRAYELTS (suspicious_objects); ++i)
- {
- char *suspicious_object = suspicious_objects[i];
- if (begin_a <= suspicious_object && suspicious_object < end_a)
- return suspicious_object;
- }
-
- return NULL;
-}
-
-static void
-note_suspicious_free (void *ptr)
-{
- struct suspicious_free_record *rec;
-
- rec = &suspicious_free_history[suspicious_free_history_index++];
- if (suspicious_free_history_index ==
- ARRAYELTS (suspicious_free_history))
- {
- suspicious_free_history_index = 0;
- }
-
- memset (rec, 0, sizeof (*rec));
- rec->suspicious_object = ptr;
- backtrace (&rec->backtrace[0], ARRAYELTS (rec->backtrace));
-}
-
-static void
-detect_suspicious_free (void *ptr)
-{
- int i;
-
- eassert (ptr != NULL);
-
- for (i = 0; i < ARRAYELTS (suspicious_objects); ++i)
- if (suspicious_objects[i] == ptr)
- {
- note_suspicious_free (ptr);
- suspicious_objects[i] = NULL;
- }
-}
-
-#endif /* SUSPICIOUS_OBJECT_CHECKING */
-
-DEFUN ("suspicious-object", Fsuspicious_object, Ssuspicious_object, 1, 1, 0,
- doc: /* Return OBJ, maybe marking it for extra scrutiny.
-If Emacs is compiled with suspicious object checking, capture
-a stack trace when OBJ is freed in order to help track down
-garbage collection bugs. Otherwise, do nothing and return OBJ. */)
- (Lisp_Object obj)
-{
-#ifdef SUSPICIOUS_OBJECT_CHECKING
- /* Right now, we care only about vectors. */
- if (VECTORLIKEP (obj))
- {
- suspicious_objects[suspicious_object_index++] = XVECTOR (obj);
- if (suspicious_object_index == ARRAYELTS (suspicious_objects))
- suspicious_object_index = 0;
- }
-#endif
- return obj;
-}
-
#ifdef ENABLE_CHECKING
bool suppress_checking;
@@ -8322,7 +8221,6 @@ N should be nonnegative. */);
#ifdef HAVE_MALLOC_TRIM
defsubr (&Smalloc_trim);
#endif
- defsubr (&Ssuspicious_object);
Lisp_Object watcher;