Commit d02c2f7f authored by Paul Eggert's avatar Paul Eggert

Speed up maybe_gc when GC is inhibited

* src/alloc.c (allow_garbage_collection)
(inhibit_garbage_collection): Temporarily bump
consing_until_gc, to improve performance of maybe_gc while
garbage collection is inhibited.  Suggested by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00511.html
parent c72e6328
Pipeline #2512 passed with stage
in 52 minutes and 23 seconds
......@@ -5501,11 +5501,14 @@ staticpro (Lisp_Object const *varaddress)
Protection from GC
***********************************************************************/
/* Temporarily prevent garbage collection. */
/* Temporarily prevent garbage collection. Temporarily bump
consing_until_gc to speed up maybe_gc when GC is inhibited. */
static void
allow_garbage_collection (void)
allow_garbage_collection (void *ptr)
{
object_ct *p = ptr;
consing_until_gc = *p;
garbage_collection_inhibited--;
}
......@@ -5513,9 +5516,10 @@ ptrdiff_t
inhibit_garbage_collection (void)
{
ptrdiff_t count = SPECPDL_INDEX ();
record_unwind_protect_void (allow_garbage_collection);
object_ct consing = consing_until_gc;
record_unwind_protect_ptr (allow_garbage_collection, &consing);
garbage_collection_inhibited++;
consing_until_gc = OBJECT_CT_MAX;
return count;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment