[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2fb98486e1 3/5: Faster bytecode immediate argument fetching
From: |
Mattias Engdegård |
Subject: |
master 2fb98486e1 3/5: Faster bytecode immediate argument fetching |
Date: |
Sat, 12 Mar 2022 11:38:55 -0500 (EST) |
branch: master
commit 2fb98486e18f8a3275adc56d2740901ef5cb6e8b
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
Faster bytecode immediate argument fetching
* src/bytecode.c (FETCH2):
Use `|` instead of `+` to combine the bytes forming a 16-bit immediate
argument so that GCC (prior to version 12) recognises the idiom and
generates a 16-bit load. This applies for little-endian machines with
cheap unaligned accesses such as x86[-64], arm64 and power64le.
This 1-character change results in a measurable speed gain on many
kinds of Lisp code, as 16-bit immediates are used by all jump
instructions.
Clang performs this optimisation for both `+` and `|` from version 10.
---
src/bytecode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bytecode.c b/src/bytecode.c
index 96f1f90581..c5cc659012 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -291,7 +291,7 @@ enum byte_code_op
/* Fetch two bytes from the bytecode stream and make a 16-bit number
out of them. */
-#define FETCH2 (op = FETCH, op + (FETCH << 8))
+#define FETCH2 (op = FETCH, op | (FETCH << 8))
/* Push X onto the execution stack. The expression X should not
contain TOP, to avoid competing side effects. */
- master updated (6ef9dc7797 -> 2c54e9a1dd), Mattias Engdegård, 2022/03/12
- master 2c54e9a1dd 5/5: Remove never-used relative jump opcodes, Mattias Engdegård, 2022/03/12
- master 2fb98486e1 3/5: Faster bytecode immediate argument fetching,
Mattias Engdegård <=
- master fe65db05f4 2/5: Maintain end of specpdl instead of size, Mattias Engdegård, 2022/03/12
- master 213483124b 1/5: Inline record_in_backtrace, Mattias Engdegård, 2022/03/12
- master 88889212c7 4/5: Remove debug code for opcodes long gone, Mattias Engdegård, 2022/03/12
- Re: master updated (6ef9dc7797 -> 2c54e9a1dd), Lars Ingebrigtsen, 2022/03/12