summaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2019-04-05 12:18:53 +0000
committerAlan Mackenzie <acm@muc.de>2019-04-05 12:18:53 +0000
commitb071398ba3e8031fe8284f2aed95d714cd3c92af (patch)
treed27dd7d78dfff9a8b28778bee260dbbdf6c10e1d /src/alloc.c
parent8a23e8717008d31b4648c999c7a417f4729d239f (diff)
downloademacs-scratch/accurate-warning-pos.tar.gz
Enhance struct Lisp_Subr to hold the alternative "BC_" function.scratch/accurate-warning-pos
Also fix a GC bug, where symbols with position were not being disabled. * src/lisp.h (union Lisp_Function): New type. (struct Lisp_Subr): Add fields normal_function, BC_function, and next. (DEFUN): Setup all three function fields to the subr (BC_function is still a dummy), set field next to NULL. * src/alloc.c (Fgarbage_collect): Move the binding of Qsymbols_with_pos_enabled to garbage_collect_1 so that it gets bound when GC is invoked via garbage_collect. * src/lread.c (subr_ptr, using_BC_subrs): New static variables. (Fswitch_to_BC_subrs, Fswitch_to_normal_subrs): New defuns. (defsubr): Chain new subr to previous using field next and variable subr_ptr. (init_lread): Initialise subr_ptr to NULL. (syms_of_lread): Create subrs Sswitch_to_BC_subrs and Sswitch_to_normal_subrs. * src/pdumper.c (dump_subr): Enhance to dump struct Lisp_Subr's new fields. Update the expected value of HASH_Lisp_Subr_xxxxxxxxxx. (dump_vectorlike): Also dump PVEC_SYMBOL_WITH_POSes.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 035b45864d9..e14b0d577a8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6053,12 +6053,17 @@ garbage_collect_1 (struct gcstat *gcst)
struct timespec start;
byte_ct tot_before = 0;
+ specbind (Qsymbols_with_pos_enabled, Qnil);
+
eassert (weak_hash_tables == NULL);
/* Can't GC if pure storage overflowed because we can't determine
if something is a pure object or not. */
if (pure_bytes_used_before_overflow)
- return false;
+ {
+ unbind_to (count, Qnil);
+ return false;
+ }
/* Record this function, so it appears on the profiler's backtraces. */
record_in_backtrace (QAutomatic_GC, 0, 0);
@@ -6249,6 +6254,7 @@ garbage_collect_1 (struct gcstat *gcst)
malloc_probe (min (swept, SIZE_MAX));
}
+ unbind_to (count, Qnil);
return true;
}
@@ -6276,11 +6282,9 @@ returns nil, because real GC can't be done.
See Info node `(elisp)Garbage Collection'. */)
(void)
{
- ptrdiff_t count = SPECPDL_INDEX ();
struct gcstat gcst;
- specbind (Qsymbols_with_pos_enabled, Qnil);
if (!garbage_collect_1 (&gcst))
- return unbind_to (count, Qnil);
+ return Qnil;
Lisp_Object total[] = {
list4 (Qconses, make_fixnum (sizeof (struct Lisp_Cons)),
@@ -6315,7 +6319,7 @@ See Info node `(elisp)Garbage Collection'. */)
make_int ((mallinfo ().fordblks + 1023) >> 10)),
#endif
};
- return unbind_to (count, CALLMANY (Flist, total));
+ return CALLMANY (Flist, total);
}
/* Mark Lisp objects in glyph matrix MATRIX. Currently the