diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2022-05-13 13:36:13 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2022-05-18 10:40:15 +0200 |
commit | 97400c4c2446f00ee0783249b9c4f1fbfaf65fb2 (patch) | |
tree | f6e0254e698e90fc007a615dc2dba6a6f7f61dff /lisp/emacs-lisp/hierarchy.el | |
parent | 24f7719cb66e8fa45f3746f22f938dceff94a576 (diff) | |
download | emacs-97400c4c2446f00ee0783249b9c4f1fbfaf65fb2.tar.gz emacs-97400c4c2446f00ee0783249b9c4f1fbfaf65fb2.tar.bz2 emacs-97400c4c2446f00ee0783249b9c4f1fbfaf65fb2.zip |
Make printing mostly non-recursive (bug#55481)
Introduce explicit stacks for traversing common data types during
printing: conses, vectors, records, byte-code, hash-tables and
char-tables, all previously traversed using recursion in C. This
greatly reduces the risk of crashing Emacs from C stack overflow
when printing deeply nested data.
* src/print.c (Fprinc, print, PRINT_CIRCLE_CANDIDATE_P):
Special-case Fprinc with a plain string argument to eliminate the need
for keeping track of print_depth during the preprocessing phase.
This also improves performance.
(struct print_pp_entry, struct print_pp_stack, ppstack)
(grow_pp_stack, pp_stack_push_value, pp_stack_push_values)
(pp_stack_empty_p, pp_stack_pop):
New stack for preprocessing.
(print_preprocess):
Make mostly nonrecursive, except for string properties.
(enum print_entry_type, struct print_stack_entry)
(struct print_stack, prstack, grow_print_stack)
(print_stack_push, print_stack_push_vector):
New stack for printing.
(print_vectorlike, print_object):
Make mostly nonrecursive, except for string properties and some less
heavily used types.
* test/src/print-tests.el (print-deeply-nested):
New test.
Diffstat (limited to 'lisp/emacs-lisp/hierarchy.el')
0 files changed, 0 insertions, 0 deletions