Repository navigation
Commit 1fc473a
committed
Phase 5.B c14-followup-A: static_assert guard for jit::FrameHeader sizeof
Closes c14 latent silent-break gap per supervisor 00:51:18Z (A) +
pythia python#368 missing-validation flag.
c14 (0703dba) phx_frame_header_size hardcodes sizeof(void*) for the
FrameHeader argument to jit_frame_header_size, matching C++ frameHeaderSize
semantics (frame_header.h:67). The hardcoded value is documented as "On
3.12+, FrameHeader = union { PyFunctionObject*; uintptr_t rtfs; } =
sizeof(void*)" — comment-derived, NOT static_asserted.
If the FrameHeader union grows in a future Python version (or even on
3.12.X minor revisions adding fields), the hardcoded sizeof(void*)
silently produces wrong offsets at runtime, re-creating the c14 SIGSEGV
class with no compile-time signal.
This commit adds a static_assert guard in hir_instr_c_verify.cpp:
#if PY_VERSION_HEX >= 0x030C0000
static_assert(sizeof(jit::FrameHeader) == sizeof(void*), "...");
#endif
Files:
M Python/jit/hir/hir_instr_c_verify.cpp (+15 LOC: include + 5-line
static_assert with explanatory comment)
Net delta: +15 LOC.
Defensive-infra-class commit per docs/methodology/synthetic_falsifier_at_gate.md
(1546c43). Synthetic falsifier OPTIONAL given trivial scope (5-LOC
static_assert + include) per supervisor 00:51:18Z (A) — would-be falsifier
test (intentionally redefining FrameHeader to 16 bytes; verifying static
assert FIRES) is symbolic since the FrameHeader struct is defined upstream.
PRE-COMMIT BUILD VERIFIED via pre-commit hook a2e8808 — hook
re-globs .cpp file via cmake configure, compiles with new static_assert,
PASS = current FrameHeader is sizeof(void*) on this build target.1 parent 0703dba commit 1fc473a
1 file changed
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
30 | 47 | | |
31 | 48 | | |
32 | 49 | | |
| |||
0 commit comments