https://github.com/python/cpython/commit/e35424611f8195309e66adc0bc69188927527a05
commit: e35424611f8195309e66adc0bc69188927527a05
branch: main
author: Shamil <[email protected]>
committer: iritkatriel <[email protected]>
date: 2026-10-28T06:53:42Z
summary:
gh-160132: Reduce padding in _PyCfgBasicblock (#160149)
files:
A
Misc/NEWS.d/next/Core_and_Builtins/2026-10-21-23-18-38.gh-issue-160132.Nj4rQa.rst
M Python/flowgraph.c
diff --git
a/Misc/NEWS.d/next/Core_and_Builtins/2026-10-21-23-18-38.gh-issue-160132.Nj4rQa.rst
b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-21-23-18-38.gh-issue-160132.Nj4rQa.rst
new file mode 100644
index 00000000000000..156f387f7a6998
--- /dev/null
+++
b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-21-23-18-38.gh-issue-160132.Nj4rQa.rst
@@ -0,0 +1,3 @@
+Reduce memory usage during compilation by reordering the fields of the
+internal basic block structure to reduce padding.
+Patch by Shamil Abdulaev.
diff --git a/Python/flowgraph.c b/Python/flowgraph.c
index b8d57dcade32d2..7b8a3e9cf9b57b 100644
--- a/Python/flowgraph.c
+++ b/Python/flowgraph.c
@@ -47,6 +47,16 @@ typedef struct _PyCfgBasicblock {
struct _PyCfgBasicblock *b_list;
/* The label of this block if it is a jump target, -1 otherwise */
_PyJumpTargetLabel b_label;
+ /* Basic block is an exception handler that preserves lasti */
+ unsigned b_preserve_lasti : 1;
+ /* Used by compiler passes to mark whether they have visited a basic
block. */
+ unsigned b_visited : 1;
+ /* b_except_handler is used by the cold-detection algorithm to mark
exception targets */
+ unsigned b_except_handler : 1;
+ /* b_cold is true if this block is not perf critical (like an exception
handler) */
+ unsigned b_cold : 1;
+ /* b_warm is used by the cold-detection algorithm to mark blocks which are
definitely not cold */
+ unsigned b_warm : 1;
/* Exception stack at start of block, used by assembler to create the
exception handling table */
struct _PyCfgExceptStack *b_exceptstack;
/* pointer to an array of instructions, initially NULL */
@@ -64,16 +74,6 @@ typedef struct _PyCfgBasicblock {
int b_predecessors;
/* depth of stack upon entry of block, computed by stackdepth() */
int b_startdepth;
- /* Basic block is an exception handler that preserves lasti */
- unsigned b_preserve_lasti : 1;
- /* Used by compiler passes to mark whether they have visited a basic
block. */
- unsigned b_visited : 1;
- /* b_except_handler is used by the cold-detection algorithm to mark
exception targets */
- unsigned b_except_handler : 1;
- /* b_cold is true if this block is not perf critical (like an exception
handler) */
- unsigned b_cold : 1;
- /* b_warm is used by the cold-detection algorithm to mark blocks which are
definitely not cold */
- unsigned b_warm : 1;
} basicblock;
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]