[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lisp_Marker size on 32bit systems

From: Stefan Monnier
Subject: Lisp_Marker size on 32bit systems
Date: Wed, 05 Sep 2018 20:41:08 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

The new Lisp_Marker is larger than the old one on 32bit systems:

    sizeof (struct Lisp_Marker)

used to be 24 (bytes) when we used Lisp_Misc, but it is now 32 (bytes) instead!

The reason seems to be that the vectorlike_header (which contains just
a simple int) occupies 8 bytes!
So those 8 bytes, plus 20 bytes of actual real data leads to 28bytes
which are rounded up to 32 for alignment purposes.

Why does vectorlike_header occupy 8bytes?  Because we use

    union vectorlike_header
        ptrdiff_t size;
        /* Align the union so that there is no padding after it.  */
        Lisp_Object align;

where GCALIGNED_UNION forces alignment on a multiple of 8 and hence
a minimum size of 8 as well.

So, on 32bit hosts, our vectorlike_header carries 4bytes of useful info
but occupies 8bytes anyway.

This sucks.

This misfeature was introduced by the following commit:

    commit b1573a97e17b518723ab3f906eb6d521caed196d
    Author: Paul Eggert <address@hidden>
    Date:   Mon Nov 13 08:51:41 2017 -0800

        Use alignas to fix GCALIGN-related bugs

Could we get this fixed, to reduce the overhead of our vectors on 32bit
hosts (including bringing back Lisp_Marker back to 24 bytes)?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]