emacs-devel
[Top][All Lists]
Advanced

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

Bytecode interoperability: the good and bad


From: Rocky Bernstein
Subject: Bytecode interoperability: the good and bad
Date: Fri, 22 Dec 2017 05:51:51 -0500

In documenting the ELisp Bytcode format and the compilation process, I have a question.

In what I am calling a "Bytecode Function Literal" -- the vector of 4-6 objects that contains the parameter list, bytecode instructions, max stack, constants vector, docstring , and interactive specification -  there is no notion of what bytecode version is in effect.

(Is there a better term for Bytecode Function Literal?)

 The next larger kind of grouping of code is a bytecode file. A bytecode file does contain a comment indicating the version of Emacs that was used in compilation is recorded. However I am not sure that fact is made use of such as to decide if a bytecode file can be run or not.

I have been able to run bytecode compiled in Emacs 25 on Emacs 24 and vice versa, I think using load-file.

Is there a determination made in advance of whether a bytecode file  compatible with the current version of Emacs in effect? If so, how is that done?

This is probably obvious, but I'll mention it anyway. The good side of allowing bytecode across different releases of Emacs is that it allows one to run bytecode from older and newer versions interoperably - when it works. And that's the rub. Unless there is some check made, you don't know if it will work. The program could crash, or worse do something unintended.

In other kinds of bytecode such as the one for C Python, a bytecode version number is stored in the bytecode file. When there is a change to the bytecode, that number is changed.

How does this work in Emacs Lisp?

Thanks.



reply via email to

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