aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread.c
diff options
context:
space:
mode:
authorPaul Eggert2016-12-23 21:13:58 -0800
committerPaul Eggert2016-12-23 21:46:53 -0800
commita815e5f19581344af5e143636039064a7fbe83ed (patch)
treef5ed9c34657f1a86d85020d30826d07d9fa4d56b /src/thread.c
parenta43cfb1ad55cad553d54798356c69e2496a3e504 (diff)
downloademacs-a815e5f19581344af5e143636039064a7fbe83ed.tar.gz
emacs-a815e5f19581344af5e143636039064a7fbe83ed.zip
Remove interpreter’s byte stack
This improves performance overall on my benchmark on x86-64, since the interpreted program-counter resides in a machine register rather than in RAM. * etc/DEBUG, src/.gdbinit: Remove xbytecode GDB command, as there is no longer a byte stack to decode. * src/bytecode.c (struct byte_stack, byte_stack_list) (relocate_byte_stack): Remove. All uses removed. (FETCH): Simplify now that pc is now local (typically, in a register) and no longer needs to be relocated. (CHECK_RANGE): Remove. All uses now done inline, in a different way. (BYTE_CODE_QUIT): Remove; now done by op_relative_branch. (exec_byte_code): Allocate a copy of the function’s bytecode, so that there is no problem if GC moves it. * src/lisp.h (struct handler): Remove byte_stack member. All uses removed. * src/thread.c (unmark_threads): Remove. All uses removed. * src/thread.h (struct thread_state): Remove m_byte_stack_list member. All uses removed. m_stack_bottom is now the first non-Lisp field.
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/thread.c b/src/thread.c
index 0bb0b7e006a..560d2cfa74f 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -595,16 +595,6 @@ mark_threads (void)
595 flush_stack_call_func (mark_threads_callback, NULL); 595 flush_stack_call_func (mark_threads_callback, NULL);
596} 596}
597 597
598void
599unmark_threads (void)
600{
601 struct thread_state *iter;
602
603 for (iter = all_threads; iter; iter = iter->next_thread)
604 if (iter->m_byte_stack_list)
605 relocate_byte_stack (iter->m_byte_stack_list);
606}
607
608 598
609 599
610static void 600static void
@@ -716,7 +706,7 @@ If NAME is given, it must be a string; it names the new thread. */)
716 struct thread_state *new_thread; 706 struct thread_state *new_thread;
717 Lisp_Object result; 707 Lisp_Object result;
718 const char *c_name = NULL; 708 const char *c_name = NULL;
719 size_t offset = offsetof (struct thread_state, m_byte_stack_list); 709 size_t offset = offsetof (struct thread_state, m_stack_bottom);
720 710
721 /* Can't start a thread in temacs. */ 711 /* Can't start a thread in temacs. */
722 if (!initialized) 712 if (!initialized)
@@ -725,7 +715,7 @@ If NAME is given, it must be a string; it names the new thread. */)
725 if (!NILP (name)) 715 if (!NILP (name))
726 CHECK_STRING (name); 716 CHECK_STRING (name);
727 717
728 new_thread = ALLOCATE_PSEUDOVECTOR (struct thread_state, m_byte_stack_list, 718 new_thread = ALLOCATE_PSEUDOVECTOR (struct thread_state, m_stack_bottom,
729 PVEC_THREAD); 719 PVEC_THREAD);
730 memset ((char *) new_thread + offset, 0, 720 memset ((char *) new_thread + offset, 0,
731 sizeof (struct thread_state) - offset); 721 sizeof (struct thread_state) - offset);
@@ -940,7 +930,7 @@ static void
940init_primary_thread (void) 930init_primary_thread (void)
941{ 931{
942 primary_thread.header.size 932 primary_thread.header.size
943 = PSEUDOVECSIZE (struct thread_state, m_byte_stack_list); 933 = PSEUDOVECSIZE (struct thread_state, m_stack_bottom);
944 XSETPVECTYPE (&primary_thread, PVEC_THREAD); 934 XSETPVECTYPE (&primary_thread, PVEC_THREAD);
945 primary_thread.m_last_thing_searched = Qnil; 935 primary_thread.m_last_thing_searched = Qnil;
946 primary_thread.m_saved_last_thing_searched = Qnil; 936 primary_thread.m_saved_last_thing_searched = Qnil;