aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorMattias EngdegÄrd2022-01-01 22:39:17 +0100
committerMattias EngdegÄrd2022-01-24 11:41:46 +0100
commitb3377e67a7b20a9a53aa2129b2c3951be67ad102 (patch)
treee2e4f16271cb8fe3cb5a695282c76bc5914e5ab4 /src/eval.c
parentd05f387407858672ff0d10b963dbdeaf2a9163e0 (diff)
downloademacs-b3377e67a7b20a9a53aa2129b2c3951be67ad102.tar.gz
emacs-b3377e67a7b20a9a53aa2129b2c3951be67ad102.zip
Remove nil check in exec_byte_code
Since we pass no arguments to a non-lexbind bytecode function, we can specify its arity as 0 instead of nil and save a test and branch. * src/bytecode.c (Fbyte_code, exec_byte_code): * src/eval.c (fetch_and_exec_byte_code, funcall_lambda): * src/lisp.h: Change the args_template parameter type to ptrdiff_t, since it is now always a small integer, in exec_byte_code and fetch_and_exec_byte_code, all callers adjusted.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/eval.c b/src/eval.c
index 8912e285252..910777e23d5 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3222,15 +3222,16 @@ funcall_subr (struct Lisp_Subr *subr, ptrdiff_t numargs, Lisp_Object *args)
3222 bytecode string and constants vector, fetch them from the file first. */ 3222 bytecode string and constants vector, fetch them from the file first. */
3223 3223
3224static Lisp_Object 3224static Lisp_Object
3225fetch_and_exec_byte_code (Lisp_Object fun, Lisp_Object syms_left, 3225fetch_and_exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
3226 ptrdiff_t nargs, Lisp_Object *args) 3226 ptrdiff_t nargs, Lisp_Object *args)
3227{ 3227{
3228 if (CONSP (AREF (fun, COMPILED_BYTECODE))) 3228 if (CONSP (AREF (fun, COMPILED_BYTECODE)))
3229 Ffetch_bytecode (fun); 3229 Ffetch_bytecode (fun);
3230
3230 return exec_byte_code (AREF (fun, COMPILED_BYTECODE), 3231 return exec_byte_code (AREF (fun, COMPILED_BYTECODE),
3231 AREF (fun, COMPILED_CONSTANTS), 3232 AREF (fun, COMPILED_CONSTANTS),
3232 AREF (fun, COMPILED_STACK_DEPTH), 3233 AREF (fun, COMPILED_STACK_DEPTH),
3233 syms_left, nargs, args); 3234 args_template, nargs, args);
3234} 3235}
3235 3236
3236static Lisp_Object 3237static Lisp_Object
@@ -3308,7 +3309,8 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
3308 argument-binding code below instead (as do all interpreted 3309 argument-binding code below instead (as do all interpreted
3309 functions, even lexically bound ones). */ 3310 functions, even lexically bound ones). */
3310 { 3311 {
3311 return fetch_and_exec_byte_code (fun, syms_left, nargs, arg_vector); 3312 return fetch_and_exec_byte_code (fun, XFIXNUM (syms_left),
3313 nargs, arg_vector);
3312 } 3314 }
3313 lexenv = Qnil; 3315 lexenv = Qnil;
3314 } 3316 }
@@ -3394,7 +3396,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
3394 val = XSUBR (fun)->function.a0 (); 3396 val = XSUBR (fun)->function.a0 ();
3395 } 3397 }
3396 else 3398 else
3397 val = fetch_and_exec_byte_code (fun, Qnil, 0, NULL); 3399 val = fetch_and_exec_byte_code (fun, 0, 0, NULL);
3398 3400
3399 return unbind_to (count, val); 3401 return unbind_to (count, val);
3400} 3402}