diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2022-03-13 17:26:05 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2022-03-13 17:51:49 +0100 |
commit | 3ed79cdbf21039fa209c421f746c0b49ec33f4da (patch) | |
tree | f6d3c5dbf4f1d5ea1a413c80293b1abc52571ff3 /lisp/emacs-lisp/comp-cstr.el | |
parent | 267f41c7ce1e02f392b57aa338d387e7627df184 (diff) | |
download | emacs-3ed79cdbf21039fa209c421f746c0b49ec33f4da.tar.gz emacs-3ed79cdbf21039fa209c421f746c0b49ec33f4da.tar.bz2 emacs-3ed79cdbf21039fa209c421f746c0b49ec33f4da.zip |
Separate bytecode stack
Use a dedicated stack for bytecode, instead of using the C stack.
Stack frames are managed explicitly and we stay in the same
exec_byte_code activation throughout bytecode function calls and
returns. In other words, exec_byte_code no longer uses recursion
for calling bytecode functions.
This results in better performance, and bytecode recursion is no
longer limited by the size of the C stack. The bytecode stack is
currently of fixed size but overflow is handled gracefully by
signalling a Lisp error instead of the hard crash that we get now.
In addition, GC marking of the stack is now faster and more precise.
Full precision could be attained if desired.
* src/alloc.c (ATTRIBUTE_NO_SANITIZE_ADDRESS): Make non-static.
* src/bytecode.c (enum stack_frame_index, BC_STACK_SIZE)
(sf_get_ptr, sf_set_ptr, sf_get_lisp_ptr, sf_set_lisp_ptr)
(sf_get_saved_pc, sf_set_saved_pc, init_bc_thread, free_bc_thread)
(mark_bytecode, Finternal_stack_stats, valid_sp): New.
(exec_byte_code): Adapt to use the new bytecode stack.
(syms_of_bytecode): Add defsubr.
* src/eval.c (unwind_to_catch): Restore saved stack frame.
(push_handler_nosignal): Save stack frame.
* src/lisp.h (struct handler): Add act_rec member.
(get_act_rec, set_act_rec): New.
* src/thread.c (mark_one_thread): Call mark_bytecode.
(finalize_one_thread): Free bytecode thread state.
(Fmake_thread, init_threads): Set up bytecode thread state.
* src/thread.h (struct bc_thread_state): New.
(struct thread_state): Add bytecode thread state.
Diffstat (limited to 'lisp/emacs-lisp/comp-cstr.el')
0 files changed, 0 insertions, 0 deletions