mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
gh-128954: Reorder _PyInterpreterFrame fields for reduced memory usage (#128958)
This reduces the size of _PyInterpreterFrame by 8 bytes on 64-bit platforms using the free threading build due to alignment requirements. This allows for slightly more recursive calls into the interpreter (from C), but `test_call.test_super_deep` still crashes.
This commit is contained in:
parent
8a5a18a36e
commit
a6a8c6f86e
2 changed files with 2 additions and 2 deletions
|
@ -69,11 +69,11 @@ typedef struct _PyInterpreterFrame {
|
||||||
PyObject *f_locals; /* Strong reference, may be NULL. Only valid if not on C stack */
|
PyObject *f_locals; /* Strong reference, may be NULL. Only valid if not on C stack */
|
||||||
PyFrameObject *frame_obj; /* Strong reference, may be NULL. Only valid if not on C stack */
|
PyFrameObject *frame_obj; /* Strong reference, may be NULL. Only valid if not on C stack */
|
||||||
_Py_CODEUNIT *instr_ptr; /* Instruction currently executing (or about to begin) */
|
_Py_CODEUNIT *instr_ptr; /* Instruction currently executing (or about to begin) */
|
||||||
|
_PyStackRef *stackpointer;
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
/* Index of thread-local bytecode containing instr_ptr. */
|
/* Index of thread-local bytecode containing instr_ptr. */
|
||||||
int32_t tlbc_index;
|
int32_t tlbc_index;
|
||||||
#endif
|
#endif
|
||||||
_PyStackRef *stackpointer;
|
|
||||||
uint16_t return_offset; /* Only relevant during a function call */
|
uint16_t return_offset; /* Only relevant during a function call */
|
||||||
char owner;
|
char owner;
|
||||||
#ifdef Py_DEBUG
|
#ifdef Py_DEBUG
|
||||||
|
|
|
@ -1621,7 +1621,7 @@ class SizeofTest(unittest.TestCase):
|
||||||
return sys._getframe()
|
return sys._getframe()
|
||||||
x = func()
|
x = func()
|
||||||
if support.Py_GIL_DISABLED:
|
if support.Py_GIL_DISABLED:
|
||||||
INTERPRETER_FRAME = '10PhcP'
|
INTERPRETER_FRAME = '9PihcP'
|
||||||
else:
|
else:
|
||||||
INTERPRETER_FRAME = '9PhcP'
|
INTERPRETER_FRAME = '9PhcP'
|
||||||
check(x, size('3PiccPP' + INTERPRETER_FRAME + 'P'))
|
check(x, size('3PiccPP' + INTERPRETER_FRAME + 'P'))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue