]> git.eshelyaron.com Git - emacs.git/commit
eval.c: Add new var `lisp-eval-depth-reserve`
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 27 Dec 2023 04:56:09 +0000 (23:56 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 4 Jan 2024 21:36:22 +0000 (16:36 -0500)
commit02edbc88a1210b8d5a3e62ca4f03ffd17b23cbf7
treea37f8100646efe24a7224c947c7bc66ec4683c16
parenta5dcc1abea32abc906abfb66599c280b01d6ba27
eval.c: Add new var `lisp-eval-depth-reserve`

Rather than blindly increase `max-lisp-eval-depth` when entering the
debugger or running `signal-hook-function`, use this new "reserve"
to keep track of how much we have grown the stack for "debugger"
purposes so that for example recursive calls to `signal-hook-function`
can't eat up the whole C stack.

* src/eval.c (max_ensure_room): Rewrite.
(restore_stack_limits): Move before `max_ensure_room`.  Rewrite.
(call_debugger, signal_or_quit): Adjust calls accordingly.
Also grow `max-lisp-eval-depth` for `hander-bind` handlers.
(init_eval_once): Don't initialize `max_lisp_eval_depth` here.
(syms_of_eval): Initialize it here instead.
Add new var `lisp-eval-depth-reserve`.

* doc/lispref/eval.texi (Eval): Add `lisp-eval-depth-reserve`.
doc/lispref/eval.texi
etc/NEWS
src/eval.c