Re: Bytecode portability

  • From: Peter Cawley <corsix@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sun, 10 Jan 2021 17:00:35 +0000

If you're running from the v2.1 branch, then the v2.1 documentation
applies, which calls out the 32bit / 64bit non-portability:

<p>
The generated bytecode is portable and can be loaded on any architecture
that LuaJIT supports, independent of word size or endianess. However the
bytecode compatibility versions must match. Bytecode stays compatible
for dot releases (x.y.0 &rarr; x.y.1), but may change with major or
minor releases (2.0 &rarr; 2.1) or between any beta release. Foreign
bytecode (e.g. from Lua 5.1) is incompatible and cannot be loaded.
</p>
<p>
Note: <tt>LJ_GC64</tt> mode requires a different frame layout, which implies
a different, incompatible bytecode format for all 64 bit ports. This may be
rectified in the future.
</p>

On Sun, Jan 10, 2021 at 4:56 PM Shmuel Zeigerman <shmuz@xxxxxxxxxx> wrote:

Hello,

The documentation states that "luajit -b -t raw" generates portable
bytecode.
However when I try to run the file compiled by 32-bit luajit with 64-bit
luajit it says:
"luajit.exe: 123.raw: cannot load incompatible bytecode".

To my understanding if the bytecode is portable the compiled file should
run fine with 64-bit LuaJIT.
But it isn't the case. Could somebody explain?

(I'm using the latest (January 02) LuaJIT commit from GitHub).

--
Shmuel



Other related posts: