diff options
| author | Mattias EngdegÄrd | 2022-02-26 12:49:02 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2022-03-12 17:32:31 +0100 |
| commit | fe65db05f42bcbf755f037575b3c29b74f279bdf (patch) | |
| tree | c184bf57ac6a9bc7489c9c7700dcc3bd4441083d /src/thread.c | |
| parent | 213483124b4381663efd0dd001037363223ce188 (diff) | |
| download | emacs-fe65db05f42bcbf755f037575b3c29b74f279bdf.tar.gz emacs-fe65db05f42bcbf755f037575b3c29b74f279bdf.zip | |
Maintain end of specpdl instead of size
Keep track of the end of specpdl explicitly since that is what we are
comparing against on critical code paths.
* src/eval.c (init_eval_once_for_pdumper, signal_or_quit)
(grow_specpdl_allocation):
* src/fileio.c (Fdo_auto_save):
* src/lisp.h (grow_specpdl):
* src/thread.c (run_thread, Fmake_thread):
* src/thread.h (struct thread_state):
Replace specpdl_size with specpdl_end, according to the equation
specpdl_end = specpdl + specpdl_size.
Diffstat (limited to 'src/thread.c')
| -rw-r--r-- | src/thread.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/thread.c b/src/thread.c index 4c98d590b7a..b5b7d7c0d71 100644 --- a/src/thread.c +++ b/src/thread.c | |||
| @@ -790,7 +790,7 @@ run_thread (void *state) | |||
| 790 | xfree (self->m_specpdl - 1); | 790 | xfree (self->m_specpdl - 1); |
| 791 | self->m_specpdl = NULL; | 791 | self->m_specpdl = NULL; |
| 792 | self->m_specpdl_ptr = NULL; | 792 | self->m_specpdl_ptr = NULL; |
| 793 | self->m_specpdl_size = 0; | 793 | self->m_specpdl_end = NULL; |
| 794 | 794 | ||
| 795 | { | 795 | { |
| 796 | struct handler *c, *c_next; | 796 | struct handler *c, *c_next; |
| @@ -862,11 +862,10 @@ If NAME is given, it must be a string; it names the new thread. */) | |||
| 862 | /* Perhaps copy m_last_thing_searched from parent? */ | 862 | /* Perhaps copy m_last_thing_searched from parent? */ |
| 863 | new_thread->m_current_buffer = current_thread->m_current_buffer; | 863 | new_thread->m_current_buffer = current_thread->m_current_buffer; |
| 864 | 864 | ||
| 865 | new_thread->m_specpdl_size = 50; | 865 | ptrdiff_t size = 50; |
| 866 | new_thread->m_specpdl = xmalloc ((1 + new_thread->m_specpdl_size) | 866 | union specbinding *pdlvec = xmalloc ((1 + size) * sizeof (union specbinding)); |
| 867 | * sizeof (union specbinding)); | 867 | new_thread->m_specpdl = pdlvec + 1; /* Skip the dummy entry. */ |
| 868 | /* Skip the dummy entry. */ | 868 | new_thread->m_specpdl_end = new_thread->m_specpdl + size; |
| 869 | ++new_thread->m_specpdl; | ||
| 870 | new_thread->m_specpdl_ptr = new_thread->m_specpdl; | 869 | new_thread->m_specpdl_ptr = new_thread->m_specpdl; |
| 871 | 870 | ||
| 872 | sys_cond_init (&new_thread->thread_condvar); | 871 | sys_cond_init (&new_thread->thread_condvar); |