aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode.c
diff options
context:
space:
mode:
authorMattias EngdegÄrd2024-01-30 17:55:19 +0100
committerMattias EngdegÄrd2024-01-31 17:12:25 +0100
commit9bcc9690a8076a22398c27a7ccf836ee95eb16a2 (patch)
tree8cc52b73bc6428f74da2c94c83990b01ce7032be /src/bytecode.c
parent7e85311a9113a4720ec9d7b06188646fc7bdae0b (diff)
downloademacs-9bcc9690a8076a22398c27a7ccf836ee95eb16a2.tar.gz
emacs-9bcc9690a8076a22398c27a7ccf836ee95eb16a2.zip
Eliminate lazy bytecode loading
The obsolete lazy-loaded bytecode feature, enabled by `byte-compile-dynamic`, slows down Lisp execution even when not in use because every call to a bytecode function has to check that function for laziness. This change forces up-front loading of all lazy bytecode so that we can remove all those checks. (Dynamically loaded doc strings are not affected.) There is no point in generating lazy bytecode any more so we stop doing that; this simplifies the compiler. `byte-compile-dynamic` now has no effect. This is a fully compatible change; the few remaining users of `byte-compile-dynamic` should not notice any difference. * src/lread.c (bytecode_from_rev_list): Force eager loading of lazy bytecode. * src/bytecode.c (exec_byte_code): Remove lazy bytecode checks. * src/eval.c (fetch_and_exec_byte_code, Ffetch_bytecode): Remove. (funcall_lambda): Call exec_byte_code directly, avoiding checks. * lisp/subr.el (fetch-bytecode): New definition, obsolete no-op. * lisp/emacs-lisp/disass.el (disassemble-1): * lisp/emacs-lisp/bytecomp.el (byte-compile-unfold-bcf): Remove calls to fetch-bytecode. (byte-compile-dynamic): Update doc string. (byte-compile-close-variables, byte-compile-from-buffer) (byte-compile-insert-header, byte-compile-output-file-form) (byte-compile--output-docform-recurse, byte-compile-output-docform) (byte-compile-file-form-defmumble): Remove effects of byte-compile-dynamic. * doc/lispref/compile.texi (Dynamic Loading): Remove node now that the entire `byte-compile-dynamic` facility has been rendered inert. * etc/NEWS: Announce changes.
Diffstat (limited to 'src/bytecode.c')
-rw-r--r--src/bytecode.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index ed6e2b34e77..def20b232c6 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -792,22 +792,19 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
792 Lisp_Object original_fun = call_fun; 792 Lisp_Object original_fun = call_fun;
793 if (SYMBOLP (call_fun)) 793 if (SYMBOLP (call_fun))
794 call_fun = XSYMBOL (call_fun)->u.s.function; 794 call_fun = XSYMBOL (call_fun)->u.s.function;
795 Lisp_Object template; 795 if (COMPILEDP (call_fun))
796 Lisp_Object bytecode;
797 if (COMPILEDP (call_fun)
798 /* Lexical binding only. */
799 && (template = AREF (call_fun, COMPILED_ARGLIST),
800 FIXNUMP (template))
801 /* No autoloads. */
802 && (bytecode = AREF (call_fun, COMPILED_BYTECODE),
803 !CONSP (bytecode)))
804 { 796 {
805 fun = call_fun; 797 Lisp_Object template = AREF (call_fun, COMPILED_ARGLIST);
806 bytestr = bytecode; 798 if (FIXNUMP (template))
807 args_template = XFIXNUM (template); 799 {
808 nargs = call_nargs; 800 /* Fast path for lexbound functions. */
809 args = call_args; 801 fun = call_fun;
810 goto setup_frame; 802 bytestr = AREF (call_fun, COMPILED_BYTECODE),
803 args_template = XFIXNUM (template);
804 nargs = call_nargs;
805 args = call_args;
806 goto setup_frame;
807 }
811 } 808 }
812 809
813 Lisp_Object val; 810 Lisp_Object val;