GNU bug report logs -
#18410
Use SAFE_ALLOCA etc. to avoid unbounded stack allocation.
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Fri, 5 Sep 2014 06:10:02 UTC
Severity: wishlist
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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.
This bug report was last modified 10 years and 259 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.