bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18410: Use SAFE_ALLOCA etc. to avoid unbounded stack allocation.


From: Paul Eggert
Subject: bug#18410: Use SAFE_ALLOCA etc. to avoid unbounded stack allocation.
Date: Fri, 05 Sep 2014 08:01:31 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

Dmitry Antipov wrote:
USE_SAFE_ALLOCA;                                                    |-
ptrdiff_t count = SPECPDL_INDEX ();                    |-           |
...                                                    | inner bind |
outer bind
Lisp_Object result = unbind_to (count, Fsome_func ()); |-           |
SAFE_FREE ();                                                       |-
return result;

looks suboptimal because it calls unbind_to twice.

I noticed that too, and actually coded up something along those lines, but decided to discard it as it added complexity and the patch was already pretty large. There is some virtue in having a simpler API, even if it's a tad suboptimal. Perhaps we can think of a way of combining SAFE_FREE and unbind_to so that there aren't two different ways in the source code of doing the same thing.

To be honest I've never been a fan of 'RETURN_UNGCPRO (expr);', and would rather not encourage other macros along those lines. I was hoping that we could get rid of all the GCPRO stuff, and simplify the code under the assumption that GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS.

I do like the idea about specbind returning the previous SPECPDL_INDEX, as that would simplify the code.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]