Skip to content

Reduce padding in the instruction sequence structure #160247

Description

@ashm-dev

Feature or enhancement

On an x86-64 GCC build, struct instruction_sequence in Include/internal/pycore_instruction_sequence.h occupies 72 bytes.

The following fields introduce two 4-byte alignment gaps: one before s_labelmap and another after s_labelmap_size.

int s_next_free_label;
int *s_labelmap;
int s_labelmap_size;
PyObject *s_nested;

Moving s_labelmap_size immediately before s_labelmap removes both gaps and reduces the structure to 64 bytes.

This would be an internal layout-only change, with no field type or compiler logic changes. The size reduction was verified with a standalone GCC layout check.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions