Repository navigation
Commit e56b679
committed
Phase 4.X-full X3a (Batch 95): NEW PhxPtrMap substrate + phx_threaded_ref bridges + verifier
Per supervisor 04:04:50Z X3 disposition (Q-X3-1..5) + theologian
docs/tier7-phase4x-x3-preanalysis-2026-05-01.md §2-§6. X3a is
substrate-only authoring (no migration this batch); X3b/X3c will
consume PhxPtrMap + bridges for E-1+E-2+E-3 Environment + E-6
BlockCanonicalizer migrations.
Pre-author substrate-grep per supervisor instruction: confirmed ZERO
existing PhxPtrMap/phx_ptr_map tokens in Python/jit/hir/. ZERO existing
phx_threaded_incref/decref bridges. ThreadedRef class lives at
threaded_compile.h:224 with static incref/decref template methods at
:307+:337.
Pre-commit chat-recheck applied per discipline.
NEW files (+340 LOC across 3 NEW + 1 modified):
(1) phx_ptr_map.h (190 LOC): PhxPtrMap generic void*-keyed open-address
hash map with void* values.
- typedef struct PhxPtrMapEntry { void *key; void *value }
- typedef struct PhxPtrMap { PhxPtrMapEntry *entries; size_t count; capacity }
- 11 static-inline ops: init/destroy/clear/lookup/contains/insert/
insert_raw/resize + slot/size/capacity/at_key/at_value
- Open-addressed hash with linear probing (mirrors PhxPtrSet)
- Power-of-2 capacity; PHX_PTR_MAP_INITIAL_CAP=16u; load 0.7
triggers resize doubling
- Knuth multiplicative hash on uintptr_t (64-bit constant)
- Empty-slot sentinel: entries[i].key == NULL
- NULL-key invariant (cannot store NULL as key); NULL VALUE permitted
with contains-vs-NULL-value disambiguation via separate
phx_ptr_map_contains accessor
- Allocator: plain calloc/realloc/free; JIT_CHECK_C(new_entries
!= NULL) loud-fail post-calloc per forward stance python#4 (X1a
0bac3bc precedent)
- Q-X3-2 void*-VALUE only (YAGNI-bounded); specialize at E-9 if
typed-value variant needed
- Q-X3-5 E-9 forward-prep tag in header block-comment (audit-trail
amortization signal; no speculative E-9 surface added)
(2) phx_threaded_ref.h (32 LOC): extern "C" declarations for
phx_threaded_incref / phx_threaded_decref. Both NULL-safe and
immortal-safe (mirror ThreadedRef::incref/decref short-circuits).
Uses Python.h opaque PyObject for C ABI. Per Q-X-full-5 supervisor
03:17:18Z: substrates stay in Python/jit/hir/ namespace.
(3) phx_threaded_ref.cpp (18 LOC): extern "C" implementations.
Thin wrappers calling jit::ThreadedRef<>::incref(obj) and
::decref(obj) static template methods. Auto-globbed by
Python/jit_build/CMakeLists.txt:123 GLOB_RECURSE pattern; no
build config change needed.
(4) hir_instr_c_verify.cpp (+98 LOC): batch95 7-section coverage:
(a) empty: lookup NULL, contains 0, size 0
(b) single insert: returns 1 / size 1 / lookup correct value
(c) duplicate-key update: insert returns 0 (overwrite), size unchanged,
lookup returns NEW value
(d) multi insert + lookup across 4 distinct keys
(e) contains-vs-NULL-value disambiguation: NULL value permitted;
contains true; lookup returns NULL; absent-key contains false
(f) iter raw slots: walk capacity collecting all 5 inserted keys
(g) clear + reuse: count resets, lookup NULL; post-clear insert works;
destroy resets all fields
Substrate ready for X3b E-1+E-2+E-3 Environment migration + X3c E-6
BlockCanonicalizer migration. Header-only zero-cost abstractions for
PhxPtrMap; thin extern 'C' bridge layer for ThreadedRef.
Falsifier (V5): batch95 7-section verifier exercises empty/single/
duplicate-update/multi/NULL-value/iteration/clear semantics. Compile
proves bridge linkage; phx_threaded_incref/decref delegate to
ThreadedRef::incref/decref which has its own GIL-disabled atomic-counter
+ standard refcount paths.
Cumulative-drift watch counter: 15/5+. Mostly header-only static-inline
+ thin C/C++ bridge .cpp; release-codegen IDENTICAL modulo new
symbols (PhxPtrMap header-only; bridge .cpp adds 2 entries).
Phase 4.X-full progress: 2.1 / 2.7 / 2.4 / 2.2 — all 4 substrate
classes initiated. X3 cluster will discharge 4-of-7 remaining stay-C++
exceptions on full close (X3b/X3c migrations). Q-X3-4 phase-stop
accepted post-X3; E-7 residual + E-9 cluster → next session(s).
Per supervisor M-slate dispatch D-1777572112 + Phase 4.X-full ENTRY +
X3a dispatch (LEAD: generalist, STRUCT substrate-authoring tier per
supervisor 04:04:50Z).1 parent 287c8f8 commit e56b679
4 files changed
Lines changed: 349 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
4396 | 4397 | | |
4397 | 4398 | | |
4398 | 4399 | | |
| 4400 | + | |
| 4401 | + | |
| 4402 | + | |
| 4403 | + | |
| 4404 | + | |
| 4405 | + | |
| 4406 | + | |
| 4407 | + | |
| 4408 | + | |
| 4409 | + | |
| 4410 | + | |
| 4411 | + | |
| 4412 | + | |
| 4413 | + | |
| 4414 | + | |
| 4415 | + | |
| 4416 | + | |
| 4417 | + | |
| 4418 | + | |
| 4419 | + | |
| 4420 | + | |
| 4421 | + | |
| 4422 | + | |
| 4423 | + | |
| 4424 | + | |
| 4425 | + | |
| 4426 | + | |
| 4427 | + | |
| 4428 | + | |
| 4429 | + | |
| 4430 | + | |
| 4431 | + | |
| 4432 | + | |
| 4433 | + | |
| 4434 | + | |
| 4435 | + | |
| 4436 | + | |
| 4437 | + | |
| 4438 | + | |
| 4439 | + | |
| 4440 | + | |
| 4441 | + | |
| 4442 | + | |
| 4443 | + | |
| 4444 | + | |
| 4445 | + | |
| 4446 | + | |
| 4447 | + | |
| 4448 | + | |
| 4449 | + | |
| 4450 | + | |
| 4451 | + | |
| 4452 | + | |
| 4453 | + | |
| 4454 | + | |
| 4455 | + | |
| 4456 | + | |
| 4457 | + | |
| 4458 | + | |
| 4459 | + | |
| 4460 | + | |
| 4461 | + | |
| 4462 | + | |
| 4463 | + | |
| 4464 | + | |
| 4465 | + | |
| 4466 | + | |
| 4467 | + | |
| 4468 | + | |
| 4469 | + | |
| 4470 | + | |
| 4471 | + | |
| 4472 | + | |
| 4473 | + | |
| 4474 | + | |
| 4475 | + | |
| 4476 | + | |
| 4477 | + | |
| 4478 | + | |
| 4479 | + | |
| 4480 | + | |
| 4481 | + | |
| 4482 | + | |
| 4483 | + | |
| 4484 | + | |
| 4485 | + | |
| 4486 | + | |
| 4487 | + | |
| 4488 | + | |
| 4489 | + | |
| 4490 | + | |
| 4491 | + | |
| 4492 | + | |
| 4493 | + | |
| 4494 | + | |
| 4495 | + | |
4399 | 4496 | | |
4400 | 4497 | | |
4401 | 4498 | | |
| |||
4469 | 4566 | | |
4470 | 4567 | | |
4471 | 4568 | | |
| 4569 | + | |
4472 | 4570 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments