From: Vibhav Pant <vibhavp@gmail.com>
To: Richard Copley <rcopley@gmail.com>
Cc: "Tino Calancha" <tino.calancha@gmail.com>,
"Clément Pit-Claudel" <cpitclaudel@gmail.com>,
"Emacs developers" <emacs-devel@gnu.org>,
"Eli Zaretskii" <eliz@gnu.org>,
"Stefan Monnier" <monnier@iro.umontreal.ca>
Subject: Re: Compiled code in Emacs-26 will fail in Emacs-25 if use pcase [was: Add new bytecode op `switch' for implementing branch tables.]
Date: Mon, 4 Jul 2022 17:54:58 +0530 [thread overview]
Message-ID: <CA+T2Sh3Qah30LLBtoKVDUav+O=FRvRS=Q2i3mPPU6YY6zs0=nw@mail.gmail.com> (raw)
In-Reply-To: <CAPM58oiDV6wEZC3WhTV6_v5DYHvoeK2MBW7RkdgRd=xUboXMmg@mail.gmail.com>
On Thu, Feb 23, 2017 at 2:06 PM Richard Copley <rcopley@gmail.com> wrote:
>
> On 23 February 2017 at 04:35, Tino Calancha <tino.calancha@gmail.com> wrote:
> >
> > Sorry if this is obvious, then just ignore.
> >
> > I have a custom lib using `pcase' somewhere. That lib is
> > compatible with Emacs25.
> > Usually i compile this lib against the master branch. Then, i load
> > that very same resulting .elc in Emacs-25 and runs same as in Emacs-26.
> > (Maybe this is just wrong and i must keep separated .elc)
> >
> > After the new bytecode those parts of the lib using pcase fail.
> > For instance, put the following in a file:
> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> > (defun test-case ()
> > (let ((val "foo"))
> > (pcase val
> > ("foo" "foo")
> > ("bar" "bar")
> > (_ (error "Neither 'foo' nor 'bar'")))))
> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> > I) Compile under master branch.
> > II) Load the resultant .elc with Emacs-25
> > II) M-: (test-case)
> > ;; Signal error: Invalid byte opcode: op=183, ptr=4
> >
> > So, in conclusion:
> > From now on, we need to keep two separated .elc in such custom libs, right?
>
> Yes, ideally.
>
> You need to arrange not to run byte-compiled libs in an earlier
> version of Emacs than where they were compiled. This isn't a new
> requirement. There has never been a guarantee that newer versions'
> bytecode will run on older versions, but in reality incompatible
> changes don't happen every day so at times you could get away with
> ignoring the issue.
>
> There are various options that avoid the problem.
> * keep your `load-path' entries version specific
> * don't byte compile libs that are shared between versions
> * byte compile them with the earliest Emacs you'll use
> * don't use different versions of Emacs
>
Alternatively, in this case, you could compile your code with
`byte-compile-cond-use-jump-table' to nil.
> Eli recommended the first option (the same one you suggested) to me,
> see #14513. In `emacs -Q' by default all `load-path' entries are in a
> version-specific subdirectory.
--
Vibhav Pant
vibhavp@gmail.com
GPG: 7ED1 D48C 513C A024 BE3A 785F E3FB 28CB 6AB5 9598
next prev parent reply other threads:[~2022-07-04 12:24 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 17:50 [PATCH]: Add new bytecode op `switch' for implementing branch tables Vibhav Pant
2017-02-06 18:30 ` Stefan Monnier
2017-02-07 8:45 ` Vibhav Pant
2017-02-07 14:41 ` Stefan Monnier
[not found] ` <CA+T2Sh3N09WGoHtNL3BbptsKA1ZdwWedTNDd0vmeBe0fTO5a1g@mail.gmail.com>
[not found] ` <CA+T2Sh2sa6=WOvyePzL_ACR0Nw=jTnZze_xXFcvL=22OURP=ZA@mail.gmail.com>
2017-02-07 15:21 ` Vibhav Pant
2017-02-07 13:50 ` Vibhav Pant
2017-02-07 15:56 ` Clément Pit-Claudel
2017-02-08 13:38 ` Vibhav Pant
2017-02-08 16:21 ` Vibhav Pant
2017-02-08 17:46 ` Vibhav Pant
2017-02-09 13:21 ` Stefan Monnier
2017-02-08 17:56 ` Eli Zaretskii
2017-02-23 4:35 ` Compiled code in Emacs-26 will fail in Emacs-25 if use pcase [was: Add new bytecode op `switch' for implementing branch tables.] Tino Calancha
2017-02-23 8:36 ` Richard Copley
2017-02-23 10:12 ` Tino Calancha
2022-07-04 12:24 ` Vibhav Pant [this message]
2017-02-23 13:39 ` Stefan Monnier
2017-02-23 14:33 ` Kaushal Modi
2017-02-23 15:10 ` Stefan Monnier
2022-07-02 20:31 ` Robert Weiner
2022-07-02 21:28 ` Stefan Monnier
[not found] ` <CA+T2Sh29UhuNrhRZG=PPQbYYHtONXwyb8dX4rBVLmwdORLELhg@mail.gmail.com>
2017-02-23 17:50 ` Vibhav Pant
2017-04-11 17:40 ` Compiled code in Emacs-26 will fail in Emacs-25 if use pcase Lars Brinkhoff
2017-02-23 16:15 ` Compiled code in Emacs-26 will fail in Emacs-25 if use pcase [was: Add new bytecode op `switch' for implementing branch tables.] raman
2017-02-23 17:24 ` Drew Adams
2017-02-23 17:50 ` T.V Raman
2017-02-23 18:02 ` Drew Adams
2017-02-23 18:24 ` T.V Raman
2017-02-23 19:00 ` Drew Adams
2017-02-24 2:06 ` defsubst VS defun or defmacro [was RE: Compiled code in Emacs-26 will fail in Emacs-25 if use pcase] Tino Calancha
2017-02-24 3:14 ` Eric Abrahamsen
2017-02-24 3:56 ` raman
2017-02-24 4:20 ` Eric Abrahamsen
2017-02-24 3:51 ` raman
2017-02-09 17:32 ` [PATCH]: Add new bytecode op `switch' for implementing branch tables Clément Pit-Claudel
2017-02-09 19:15 ` Clément Pit-Claudel
2017-02-10 4:12 ` Vibhav Pant
2017-02-10 4:17 ` Clément Pit-Claudel
2017-02-10 5:03 ` Vibhav Pant
2017-02-10 6:07 ` Stefan Monnier
2017-02-10 13:51 ` Vibhav Pant
2017-02-10 15:12 ` Stefan Monnier
2017-02-10 17:59 ` Vibhav Pant
2017-02-10 18:25 ` Vibhav Pant
2017-02-10 20:47 ` Paul Eggert
2017-02-10 20:58 ` Stefan Monnier
2017-02-11 15:07 ` Vibhav Pant
2017-02-12 3:10 ` Vibhav Pant
2017-02-13 7:18 ` Vibhav Pant
2017-02-09 16:37 ` Vibhav Pant
2017-02-06 19:32 ` Eli Zaretskii
2017-02-07 14:26 ` Vibhav Pant
2017-02-07 16:14 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+T2Sh3Qah30LLBtoKVDUav+O=FRvRS=Q2i3mPPU6YY6zs0=nw@mail.gmail.com' \
--to=vibhavp@gmail.com \
--cc=cpitclaudel@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=rcopley@gmail.com \
--cc=tino.calancha@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).