diff options
| author | Mattias EngdegÄrd | 2022-03-13 17:26:05 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2022-03-13 17:51:49 +0100 |
| commit | 3ed79cdbf21039fa209c421f746c0b49ec33f4da (patch) | |
| tree | f6d3c5dbf4f1d5ea1a413c80293b1abc52571ff3 /src/alloc.c | |
| parent | 267f41c7ce1e02f392b57aa338d387e7627df184 (diff) | |
| download | emacs-3ed79cdbf21039fa209c421f746c0b49ec33f4da.tar.gz 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 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/alloc.c b/src/alloc.c index 9ed94dc8a1e..c19e3dabb6e 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -4928,7 +4928,7 @@ mark_maybe_pointer (void *p, bool symbol_only) | |||
| 4928 | /* Mark Lisp objects referenced from the address range START..END | 4928 | /* Mark Lisp objects referenced from the address range START..END |
| 4929 | or END..START. */ | 4929 | or END..START. */ |
| 4930 | 4930 | ||
| 4931 | static void ATTRIBUTE_NO_SANITIZE_ADDRESS | 4931 | void ATTRIBUTE_NO_SANITIZE_ADDRESS |
| 4932 | mark_memory (void const *start, void const *end) | 4932 | mark_memory (void const *start, void const *end) |
| 4933 | { | 4933 | { |
| 4934 | char const *pp; | 4934 | char const *pp; |