GH-148960: Reduce the size of the debug stencils to less than half. (GH-150551)

For AArch64 linux, reduces the total bytes in the code bodies from 489kb to 218kb.
Reduces the size of the stencils files from 394k lines to 167k lines.
This commit is contained in:
Mark Shannon 2026-06-01 17:56:16 +01:00 committed by GitHub
parent 4996b99695
commit 633b6be8f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 1887 additions and 1860 deletions

View file

@ -997,6 +997,14 @@ _Py_assert_within_stack_bounds(
abort();
}
}
#ifdef _Py_JIT
void
_Py_jit_assert_within_stack_bounds(
_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int lineno
) {
_Py_assert_within_stack_bounds(frame, stack_pointer, "executor_cases.c.h", lineno);
}
#endif
#endif
int _Py_CheckRecursiveCallPy(

View file

@ -268,10 +268,10 @@ GETITEM(PyObject *v, Py_ssize_t i) {
#if defined(Py_DEBUG) && !defined(_Py_JIT)
// This allows temporary stack "overflows", provided it's all in the cache at any point of time.
#define WITHIN_STACK_BOUNDS_IGNORING_CACHE() \
(frame->owner == FRAME_OWNED_BY_INTERPRETER || (STACK_LEVEL() >= 0 && (STACK_LEVEL()) <= STACK_SIZE()))
#define ASSERT_WITHIN_STACK_BOUNDS_IGNORING_CACHE(F, L) \
assert(frame->owner == FRAME_OWNED_BY_INTERPRETER || (STACK_LEVEL() >= 0 && (STACK_LEVEL()) <= STACK_SIZE()))
#else
#define WITHIN_STACK_BOUNDS_IGNORING_CACHE WITHIN_STACK_BOUNDS
#define ASSERT_WITHIN_STACK_BOUNDS_IGNORING_CACHE ASSERT_WITHIN_STACK_BOUNDS
#endif
/* Data access macros */

3698
Python/executor_cases.c.h generated

File diff suppressed because it is too large Load diff

View file

@ -743,4 +743,14 @@ _PyJIT_Free(_PyExecutorObject *executor)
}
}
// Avoid excessive bloat due to asserts in stencils
int
_Py_jit_assertion_failure(int line)
{
printf("Assertion failure at line %d of executor_cases.c.h", line);
fflush(stdout);
abort();
return 0;
}
#endif // _Py_JIT