[luatex] portable fmt between 32-bit/64-bit machines

Michal Vlasák lahcim8 at gmail.com
Tue Feb 8 20:52:49 CET 2022


On Tue Feb 8, 2022 at 8:05 AM CET, luigi scarso wrote:
> Can you post a patch using the current luatex experimental repo at
> https://serveur-svn.lri.fr/svn/modhel/luatex/branches/experimental/
> (see http://www.luatex.org/download.html ) ?

Attached.

I don't know how basing one patch on top of another works with TLpatches
and its .original files. I don't even even know if its manual or not, I
constructed the TLpatch file manually.

>From the version I shared last time there are three changes:

 - byte swapping when loaded byte code has different byte order
 - for simplicity I am wasting 8 bytes in each bytecode for detecting
   byte order and actually verify that integers dump correctly
 - I changed the "version" byte from 0 to 'T' so that it is explicit
   that other Lua 5.3.6 bytecodes are incompatible with LuaTeX

Neither the variable length encoding, neither byte swapping are compile
time options. I don't really want to get into preprocessor macros. This
seemed the simplest thing to work and shouldn't have much runtime cost
for most runs.

Just for record, I am not a proponent of these changes, it's a
demonstration that it can and has to be done on the Lua level and that
it seemingly works.

Also, LuaJIT bytecode is portable across all its architectures AFAIK, so
no problem with LuaJITTeX.

Sorry, I also didn't test the LuaTeX repository build, it's hard for me
to cross compile and run binaries that excersise byte order issues
and/or 16/32/64 bit architectures problems.

Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Make-Lua-bytecode-more-portable.patch
Type: text/x-patch
Size: 14445 bytes
Desc: not available
URL: <https://tug.org/pipermail/luatex/attachments/20220208/99985f02/attachment.bin>


More information about the luatex mailing list.