diff options
| author | Mattias EngdegÄrd | 2022-09-19 10:55:09 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2022-09-19 19:30:03 +0200 |
| commit | 60102016e416e5c19fa5945aeb80693dac7ff2e6 (patch) | |
| tree | 69979ff773d7031634e7bc4f4388abc4ae104717 /doc | |
| parent | a7c65fc6660878e244432a5b25fb3a4ff20e8604 (diff) | |
| download | emacs-60102016e416e5c19fa5945aeb80693dac7ff2e6.tar.gz emacs-60102016e416e5c19fa5945aeb80693dac7ff2e6.zip | |
Abolish max-specpdl-size (bug#57911)
The max-lisp-eval-depth limit is sufficient to prevent unbounded stack
growth including the specbind stack; simplify matters for the user by
not having them to worry about two different limits. This change
turns max-specpdl-size into a harmless variable with no effects,
to keep existing code happy.
* lisp/subr.el (max-specpdl-size):
Define as an ordinary (but obsolete) dynamic variable.
* admin/grammars/Makefile.in:
* doc/lispintro/emacs-lisp-intro.texi (Loops & Recursion):
* doc/lispref/control.texi (Cleanups):
* doc/lispref/edebug.texi (Checking Whether to Stop):
* doc/lispref/eval.texi (Eval):
* doc/lispref/variables.texi (Local Variables):
* doc/misc/calc.texi (Recursion Depth):
Update documentation.
* etc/NEWS: Announce.
* src/eval.c
(FletX): Use safe iteration to guard against circular bindings list.
(syms_of_eval): Remove old max-specpdl-size definition.
(init_eval_once, restore_stack_limits, call_debugger)
(signal_or_quit, grow_specpdl_allocation):
* leim/Makefile.in:
* lisp/Makefile.in:
* lisp/calc/calc-stuff.el (calc-more-recursion-depth)
(calc-less-recursion-depth):
* lisp/calc/calc.el (calc-do):
* lisp/cedet/semantic/ede-grammar.el (ede-proj-makefile-insert-rules):
* lisp/cedet/semantic/grammar.el (semantic-grammar-batch-build-one-package):
* lisp/cus-start.el (standard):
* lisp/emacs-lisp/comp.el (comp--native-compile):
* lisp/emacs-lisp/edebug.el (edebug-max-depth):
(edebug-read-and-maybe-wrap-form, edebug-default-enter):
* lisp/emacs-lisp/regexp-opt.el (regexp-opt):
* lisp/eshell/esh-mode.el (eshell-mode):
* lisp/loadup.el (max-specpdl-size):
* lisp/mh-e/mh-e.el (mh-invisible-headers):
* lisp/net/shr.el (shr-insert-document, shr-descend):
* lisp/play/hanoi.el (hanoi-internal):
* lisp/progmodes/cperl-mode.el:
* src/fileio.c (Fdo_auto_save):
Remove references to and modifications of max-specpdl-size.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispintro/emacs-lisp-intro.texi | 5 | ||||
| -rw-r--r-- | doc/lispref/control.texi | 5 | ||||
| -rw-r--r-- | doc/lispref/edebug.texi | 5 | ||||
| -rw-r--r-- | doc/lispref/eval.texi | 5 | ||||
| -rw-r--r-- | doc/lispref/variables.texi | 21 | ||||
| -rw-r--r-- | doc/misc/calc.texi | 4 |
6 files changed, 5 insertions, 40 deletions
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 47a5a870fde..df8fa2f8e79 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi | |||
| @@ -10100,9 +10100,8 @@ resources; as it happens, methods that people find easy---that are | |||
| 10100 | frugal of mental resources---sometimes use considerable computer | 10100 | frugal of mental resources---sometimes use considerable computer |
| 10101 | resources. Emacs was designed to run on machines that we now consider | 10101 | resources. Emacs was designed to run on machines that we now consider |
| 10102 | limited and its default settings are conservative. You may want to | 10102 | limited and its default settings are conservative. You may want to |
| 10103 | increase the values of @code{max-specpdl-size} and | 10103 | increase the value of @code{max-lisp-eval-depth}. In my @file{.emacs} |
| 10104 | @code{max-lisp-eval-depth}. In my @file{.emacs} file, I set them to | 10104 | file, I set it to 30 times its default value.}. |
| 10105 | 15 and 30 times their default value.}. | ||
| 10106 | 10105 | ||
| 10107 | @menu | 10106 | @menu |
| 10108 | * while:: Causing a stretch of code to repeat. | 10107 | * while:: Causing a stretch of code to repeat. |
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index d4520ebdee5..ee2acdb002b 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi | |||
| @@ -2366,11 +2366,6 @@ of the @var{cleanup-forms} themselves exits nonlocally (via a | |||
| 2366 | guaranteed to evaluate the rest of them. If the failure of one of the | 2366 | guaranteed to evaluate the rest of them. If the failure of one of the |
| 2367 | @var{cleanup-forms} has the potential to cause trouble, then protect | 2367 | @var{cleanup-forms} has the potential to cause trouble, then protect |
| 2368 | it with another @code{unwind-protect} around that form. | 2368 | it with another @code{unwind-protect} around that form. |
| 2369 | |||
| 2370 | The number of currently active @code{unwind-protect} forms counts, | ||
| 2371 | together with the number of local variable bindings, against the limit | ||
| 2372 | @code{max-specpdl-size} (@pxref{Definition of max-specpdl-size,, Local | ||
| 2373 | Variables}). | ||
| 2374 | @end defspec | 2369 | @end defspec |
| 2375 | 2370 | ||
| 2376 | For example, here we make an invisible buffer for temporary use, and | 2371 | For example, here we make an invisible buffer for temporary use, and |
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi index 56f7b7bdfad..6a51489d8a4 100644 --- a/doc/lispref/edebug.texi +++ b/doc/lispref/edebug.texi | |||
| @@ -1032,9 +1032,8 @@ program. | |||
| 1032 | @itemize @bullet | 1032 | @itemize @bullet |
| 1033 | @item | 1033 | @item |
| 1034 | @vindex edebug-max-depth | 1034 | @vindex edebug-max-depth |
| 1035 | @code{max-lisp-eval-depth} (@pxref{Eval}) and @code{max-specpdl-size} | 1035 | @code{max-lisp-eval-depth} (@pxref{Eval}) is increased to reduce Edebug's |
| 1036 | (@pxref{Local Variables}) are both increased to reduce Edebug's impact | 1036 | impact on the stack. You could, however, still run out of stack space when |
| 1037 | on the stack. You could, however, still run out of stack space when | ||
| 1038 | using Edebug. You can also enlarge the value of | 1037 | using Edebug. You can also enlarge the value of |
| 1039 | @code{edebug-max-depth} if Edebug reaches the limit of recursion depth | 1038 | @code{edebug-max-depth} if Edebug reaches the limit of recursion depth |
| 1040 | instrumenting code that contains very large quoted lists. | 1039 | instrumenting code that contains very large quoted lists. |
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi index 6e29a5403f1..11c321b32ed 100644 --- a/doc/lispref/eval.texi +++ b/doc/lispref/eval.texi | |||
| @@ -830,7 +830,7 @@ This variable defines the maximum depth allowed in calls to @code{eval}, | |||
| 830 | @code{apply}, and @code{funcall} before an error is signaled (with error | 830 | @code{apply}, and @code{funcall} before an error is signaled (with error |
| 831 | message @code{"Lisp nesting exceeds max-lisp-eval-depth"}). | 831 | message @code{"Lisp nesting exceeds max-lisp-eval-depth"}). |
| 832 | 832 | ||
| 833 | This limit, with the associated error when it is exceeded, is one way | 833 | This limit, with the associated error when it is exceeded, is how |
| 834 | Emacs Lisp avoids infinite recursion on an ill-defined function. If | 834 | Emacs Lisp avoids infinite recursion on an ill-defined function. If |
| 835 | you increase the value of @code{max-lisp-eval-depth} too much, such | 835 | you increase the value of @code{max-lisp-eval-depth} too much, such |
| 836 | code can cause stack overflow instead. On some systems, this overflow | 836 | code can cause stack overflow instead. On some systems, this overflow |
| @@ -851,9 +851,6 @@ less than 100, Lisp will reset it to 100 if the given value is | |||
| 851 | reached. Entry to the Lisp debugger increases the value, if there is | 851 | reached. Entry to the Lisp debugger increases the value, if there is |
| 852 | little room left, to make sure the debugger itself has room to | 852 | little room left, to make sure the debugger itself has room to |
| 853 | execute. | 853 | execute. |
| 854 | |||
| 855 | @code{max-specpdl-size} provides another limit on nesting. | ||
| 856 | @xref{Definition of max-specpdl-size,, Local Variables}. | ||
| 857 | @end defopt | 854 | @end defopt |
| 858 | 855 | ||
| 859 | @defvar values | 856 | @defvar values |
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 975e945b343..ccd19630bf7 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi | |||
| @@ -358,27 +358,6 @@ Variables}); a few variables have terminal-local bindings | |||
| 358 | like ordinary local bindings, but they are localized depending on | 358 | like ordinary local bindings, but they are localized depending on |
| 359 | where you are in Emacs. | 359 | where you are in Emacs. |
| 360 | 360 | ||
| 361 | @defopt max-specpdl-size | ||
| 362 | @anchor{Definition of max-specpdl-size} | ||
| 363 | @cindex variable limit error | ||
| 364 | @cindex evaluation error | ||
| 365 | @cindex infinite recursion | ||
| 366 | This variable defines the limit on the total number of local variable | ||
| 367 | bindings and @code{unwind-protect} cleanups (@pxref{Cleanups,, | ||
| 368 | Cleaning Up from Nonlocal Exits}) that are allowed before Emacs | ||
| 369 | signals an error (with data @code{"Variable binding depth exceeds | ||
| 370 | max-specpdl-size"}). | ||
| 371 | |||
| 372 | This limit, with the associated error when it is exceeded, is one way | ||
| 373 | that Lisp avoids infinite recursion on an ill-defined function. | ||
| 374 | @code{max-lisp-eval-depth} provides another limit on depth of nesting. | ||
| 375 | @xref{Definition of max-lisp-eval-depth,, Eval}. | ||
| 376 | |||
| 377 | The default value is 2500. Entry to the Lisp debugger increases the | ||
| 378 | value, if there is little room left, to make sure the debugger itself | ||
| 379 | has room to execute. | ||
| 380 | @end defopt | ||
| 381 | |||
| 382 | @node Void Variables | 361 | @node Void Variables |
| 383 | @section When a Variable is Void | 362 | @section When a Variable is Void |
| 384 | @cindex @code{void-variable} error | 363 | @cindex @code{void-variable} error |
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 98f59b89c01..89a340e7343 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi | |||
| @@ -10392,7 +10392,6 @@ memory than it would otherwise, but it's guaranteed to fix the problem. | |||
| 10392 | @cindex Recursion depth | 10392 | @cindex Recursion depth |
| 10393 | @cindex ``Computation got stuck'' message | 10393 | @cindex ``Computation got stuck'' message |
| 10394 | @cindex @code{max-lisp-eval-depth} | 10394 | @cindex @code{max-lisp-eval-depth} |
| 10395 | @cindex @code{max-specpdl-size} | ||
| 10396 | Calc uses recursion in many of its calculations. Emacs Lisp keeps a | 10395 | Calc uses recursion in many of its calculations. Emacs Lisp keeps a |
| 10397 | variable @code{max-lisp-eval-depth} which limits the amount of recursion | 10396 | variable @code{max-lisp-eval-depth} which limits the amount of recursion |
| 10398 | possible in an attempt to recover from program bugs. If a calculation | 10397 | possible in an attempt to recover from program bugs. If a calculation |
| @@ -10406,9 +10405,6 @@ is also an @kbd{I M} (@code{calc-less-recursion-depth}) command which | |||
| 10406 | decreases this limit by a factor of two, down to a minimum value of 200. | 10405 | decreases this limit by a factor of two, down to a minimum value of 200. |
| 10407 | The default value is 1000. | 10406 | The default value is 1000. |
| 10408 | 10407 | ||
| 10409 | These commands also double or halve @code{max-specpdl-size}, another | ||
| 10410 | internal Lisp recursion limit. The minimum value for this limit is 600. | ||
| 10411 | |||
| 10412 | @node Caches | 10408 | @node Caches |
| 10413 | @subsection Caches | 10409 | @subsection Caches |
| 10414 | 10410 | ||