◐ Shell
clean mode source ↗

[3.6] fix minor bug in pymalloc. (#335) by Mariatta · Pull Request #476 · python/cpython

SonicField added a commit to SonicField/cpython that referenced this pull request

@SonicField

… sites)

P2 per-site attribution substrate per sup 22:10:51Z PICK (α) +
theologian 22:00:54Z + 22:09:00Z per-site disposition framework +
testkeeper 22:08:07Z (P1) empirical validation. Three per-site
extern counters for M1 inliner.cpp sites (excess_args / to_delete /
ends), bumped at each site after capacity-change detection at the
push call. Distinguishes which specific M1 site fired vs the global
phx_ptr_array_resize_count.

Pythia python#476 + shepard 21:48:50Z attribution-gap empirically closed:
testkeeper 22:08:07Z (P1) controlled-revert revealed only Site C
(ends, delta=15 of baseline 10 on Step 2.5) contributes; Sites A
(excess_args) + B (to_delete) contribute 0 on the fixture. Step 3
JIT suite measurement (testkeeper 21:59:22Z+22:08:07Z) confirmed Site
A delta=0 even across 1001-test suite — real coverage gap per
theologian 22:09:00Z disposition.

Three changes:
1. phx_ptr_array.h: extern decl for 3 per-site counters (substrate-
   M1-only scope per testkeeper 22:10:23Z; M2 sites add own externs
   incrementally per-commit).
2. builder.cpp: single-def for 3 per-site counters alongside existing
   global phx_ptr_array_resize_count + phx_framestate_parent_resize_count.
3. inliner.cpp: capacity-before/after detection at each of 3 M1 push
   sites (excess_args inside *args branch, to_delete inside
   tryEliminateBeginEnd with 3 push locations all instrumented, ends
   inside BeginInlinedFunctionElimination::Run). Pattern: read .capacity
   before push, compare after, bump per-site counter on change.
4. gate_phoenix.sh Step 2.5: extend ctypes probe to read all 3 per-site
   counters pre/post; print per-site deltas alongside global counter.

Forward use per theologian 22:09:00Z M2 protocol:
- M2 builder.cpp 7-site cascade adds own per-site externs per commit
- Each commit measures under Step 3 JIT suite + categorizes per site:
  delta>0 (covered, proceed) / delta=0 + structurally bounded ≤ initial-cap
  (Site B class accept-with-rationale) / delta=0 + unbounded (Site A class
  real gap, need test)
- Per-site instrumentation pattern from this commit is reusable template

Site A test addition + Site B accept-with-rationale comment in follow-up
per testkeeper bandwidth (testkeeper 22:09:32Z + sup 22:10:51Z
sequence step 2).

numstat:
 Python/jit/hir/builder.cpp     +10/-0 (3 per-site single-defs + comment)
 Python/jit/hir/inliner.cpp     +24/-0 (capacity-detect at 6 push call-sites:
                                       1 excess_args + 4 to_delete + 1 ends)
 Python/jit/hir/phx_ptr_array.h +11/-0 (3 extern decls + comment)
 scripts/gate_phoenix.sh        +22/-7 (per-site counter probe + delta report)