QTimerInfo: re-pack the members

0148c6925e added support for qint64
intervals in the abstract dispatcher. Changing the `int` interval
to `qint64` causes padding in the QTimerInfo struct.

On X86-64:

    struct TimerInfo {
	    int                        id;                   /*     0     4 */

	    /* XXX 4 bytes hole, try to pack */

	    qint64                     interval;             /*     8     8 */
	    enum TimerType             timerType;            /*    16     4 */

	    /* XXX 4 bytes hole, try to pack */

	    struct timespec            timeout;              /*    24    16 */
	    class QObject *            obj;                  /*    40     8 */
	    class QTimerInfo * *       activateRef;          /*    48     8 */

	    /* size: 56, cachelines: 1, members: 6 */
	    /* sum members: 48, holes: 2, sum holes: 8 */
	    /* last cacheline: 56 bytes */
    };

On ARM32:

    struct TimerInfo {
	    int                        id;                   /*     0     4 */

	    /* XXX 4 bytes hole, try to pack */

	    qint64                     interval;             /*     8     8 */
	    enum TimerType             timerType;            /*    16     4 */
	    struct timespec            timeout;              /*    20     8 */
	    class QObject *            obj;                  /*    28     4 */
	    class QTimerInfo * *       activateRef;          /*    32     4 */

	    /* size: 40, cachelines: 1, members: 6 */
	    /* sum members: 32, holes: 1, sum holes: 4 */
	    /* padding: 4 */
	    /* last cacheline: 40 bytes */
    };

Change the order of the members, so we remove the padding:

    struct TimerInfo {
	    int                        id;                   /*     0     4 */
	    enum TimerType             timerType;            /*     4     4 */
	    qint64                     interval;             /*     8     8 */
	    struct timespec            timeout;              /*    16    16 */
	    class QObject *            obj;                  /*    32     8 */
	    class QTimerInfo * *       activateRef;          /*    40     8 */

	    /* size: 48, cachelines: 1, members: 6 */
	    /* last cacheline: 48 bytes */
    };

Pick-to: 6.5
Change-Id: Ia1cc56e497f87611fa411a19361f8ebb13ff1f67
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2023-01-10 11:30:45 +01:00 committed by Volker Hilsheimer
parent df030e06a8
commit 7f1d3c09c9

View File

@ -28,8 +28,8 @@ QT_BEGIN_NAMESPACE
// internal timer info
struct QTimerInfo {
int id; // - timer identifier
qint64 interval; // - timer interval in milliseconds
Qt::TimerType timerType; // - timer type
qint64 interval; // - timer interval in milliseconds
timespec timeout; // - when to actually fire
QObject *obj; // - object to receive event
QTimerInfo **activateRef; // - ref from activateTimers