emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/bytecode-speedup b43e4a184f 03/11: Inline setcar and setcdr in b


From: Mattias Engdegård
Subject: scratch/bytecode-speedup b43e4a184f 03/11: Inline setcar and setcdr in byte-code interpreter
Date: Tue, 11 Jan 2022 11:50:47 -0500 (EST)

branch: scratch/bytecode-speedup
commit b43e4a184ff35c3cc6accb769f04e3d75bcb751b
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Inline setcar and setcdr in byte-code interpreter
    
    The function call overhead is nontrivial in comparison to the actual
    code which makes this worthwhile.
    
    * src/bytecode.c (exec_byte_code):
    Inline code from Fsetcar and Fsetcdr.
---
 src/bytecode.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/bytecode.c b/src/bytecode.c
index 5d8842f40c..5e7de2725a 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -26,6 +26,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "keyboard.h"
 #include "syntax.h"
 #include "window.h"
+#include "puresize.h"
 
 /* Work around GCC bug 54561.  */
 #if GNUC_PREREQ (4, 3, 0)
@@ -1415,15 +1416,23 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object 
vector, Lisp_Object maxdepth,
 
        CASE (Bsetcar):
          {
-           Lisp_Object v1 = POP;
-           TOP = Fsetcar (TOP, v1);
+           Lisp_Object newcar = POP;
+           Lisp_Object cell = TOP;
+           CHECK_CONS (cell);
+           CHECK_IMPURE (cell, XCONS (cell));
+           XSETCAR (cell, newcar);
+           TOP = newcar;
            NEXT;
          }
 
        CASE (Bsetcdr):
          {
-           Lisp_Object v1 = POP;
-           TOP = Fsetcdr (TOP, v1);
+           Lisp_Object newcar = POP;
+           Lisp_Object cell = TOP;
+           CHECK_CONS (cell);
+           CHECK_IMPURE (cell, XCONS (cell));
+           XSETCDR (cell, newcar);
+           TOP = newcar;
            NEXT;
          }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]