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

luigi scarso luigi.scarso at gmail.com
Mon Feb 7 10:06:59 CET 2022


On Mon, Feb 7, 2022 at 9:58 AM Hans Hagen <j.hagen at xs4all.nl> wrote:

> On 2/7/2022 9:15 AM, luigi scarso wrote:
> > Hi,
> > here
> > https://github.com/latex3/latex2e/issues/775
> > <https://github.com/latex3/latex2e/issues/775>
> > there is an issue about the portability of the lua bytecode .
> > Suggestions ?
> > In any case, the patches are  not for TeXLive 2022 .
> Even with a patsh (not sure which one i only see akira mentioning the
> size of a blob) it is not guaranteed to be portable and formats are
> already not portable (endian wise) so why bother ... just make a new
> format, right? We've dealt with it for > 15 years so ... anyway, Karl
> doesn't mind if nothing changes so we're not really in a hurry ...
> indeed not for upcoming.
>
> Btw, can't windows 32 be compiled with 64 bit pointers? Does the same
> issue occur with the mingw binaries?
>


Dunno... the scope of this thread is also to collect info about  the
current status of fmt portability (for luatex only).

In web2c.pdf :
4.3.3 Hardware and memory dumps
By default, memory dump files are generally sharable between architectures
of different
types; specifically, on machines of different endianness (see Section “Byte
order” in GNU
C Library). (This is a feature of the Web2c implementation, and is not true
of all TEX
implementations.) If you specify ‘--disable-dump-share’ to configure,
however, memory
dumps will be endian-dependent.
   The reason to do this is speed. To achieve endian-independence, the
reading of memory
dumps on LittleEndian architectures, such as PC’s and DEC architectures, is
somewhat
slowed (all the multibyte values have to be swapped). Usually, this is not
noticeable, and
the advantage of being able to share memory dumps across all platforms at a
site far
outweighs the speed loss. But if you’re installing Web2c for use on
LittleEndian machines
only, perhaps on a PC being used only by you, you may wish to get maximum
speed.
   TEXnically, even without ‘--disable-dump-share’, sharing of .fmt files
cannot be guar-
anteed to work. Floating-point values are always written in native format,
and hence will
generally not be readable across platforms. Fortunately, TEX uses floating
point only to
represent glue ratios, and all common formats (plain, LATEX, AMSTEX, . . .
) do not do any
glue setting at .fmt-creation time. Metafont does not use floating point in
any dumped
value at all.
   Incidentally, different memory dump files will never compare equal
byte-for-byte, because
the program always dumps the current date and time. So don’t be alarmed by
just a few
bytes difference.
   If you don’t know what endianness your machine is, and you’re curious,
here is a little C
program to tell you. (The configure script contains a similar program.)
This is from the
book C: A Reference Manual, by Samuel P. Harbison and Guy L. Steele Jr.
(see Appendix B
[References], page 55).
      main ()
      {
        /* Are we little or big endian? From Harbison&Steele.
*/
        union
        {
          long l;
          char c[sizeof (long)];
        } u;
        u.l = 1;
        if (u.c[0] == 1)
          printf ("LittleEndian\n");
        else if (u.c[sizeof (long) - 1] == 1)
          printf ("BigEndian\n");
        else
          printf ("unknownEndian");

          exit (u.c[sizeof (long) - 1] == 1);
      }


-- 
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/luatex/attachments/20220207/e1d12819/attachment.html>


More information about the luatex mailing list.