all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rocky Bernstein <rocky@gnu.org>
To: emacs-devel@gnu.org
Subject: Bytecode interoperability: the good and bad
Date: Fri, 22 Dec 2017 05:51:51 -0500	[thread overview]
Message-ID: <CANCp2gZi3BJNqX4xDZjVmvVhuD7ruR048NQZvPROeDoyE5ihYQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1544 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 1880 bytes --]

             reply	other threads:[~2017-12-22 10:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 10:51 Rocky Bernstein [this message]
2017-12-22 14:08 ` Bytecode interoperability: the good and bad Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2017-12-22 17:41 Rocky Bernstein
2017-12-22 20:05 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANCp2gZi3BJNqX4xDZjVmvVhuD7ruR048NQZvPROeDoyE5ihYQ@mail.gmail.com \
    --to=rocky@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.