[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master d02c2f7 4/4: Speed up maybe_gc when GC is inhib
From: |
Pip Cet |
Subject: |
Re: [Emacs-diffs] master d02c2f7 4/4: Speed up maybe_gc when GC is inhibited |
Date: |
Sun, 21 Jul 2019 18:58:03 +0000 |
On Sun, Jul 21, 2019 at 6:24 PM Paul Eggert <address@hidden> wrote:
> 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;
> }
This looks unsafe to me. `consing' goes out of scope when
inhibit_garbage_collection returns, at which point the stack space for
`consing' will be reused for something else.
`allow_garbage_collection' is called later, and accesses what's
essentially random stack data.
Or am I missing something?
- Re: [Emacs-diffs] master d02c2f7 4/4: Speed up maybe_gc when GC is inhibited,
Pip Cet <=