Commit 223be22
committed
Phase 4.X-full X2b (Batch 92): NEW PhxPtrSet open-address hash substrate + verifier
Per supervisor 03:17:18Z next-up dispatch + theologian
docs/tier7-phase4x-full-entry-preanalysis-2026-05-01.md §2.4. X2b is
substrate-only authoring (no migration this batch); X2c will replace
std::unordered_set<BasicBlock*> processed/loop_headers at builder.cpp:
840-841 (translate() loop) → discharges E-7 substrate dependency.
Pre-author substrate-grep per supervisor instruction: confirmed ZERO
existing PhxPtrSet/PhxBlockPtrSet/phx_ptr_set tokens in Python/jit/hir/.
Existing PhxBlockSet at licm_c.c:20-40 is dense bit-array indexed by
block ID — different impl-class (use-class requires known max block ID
upfront); cannot be reused for translate() pointer-keyed set semantic.
Pre-commit chat-recheck applied per discipline (latest fixup checkpoint,
no disposition reversal).
NEW phx_ptr_set.h (137 LOC):
- typedef struct PhxPtrSet { void **entries; size_t count; size_t capacity }
- 7 static-inline ops: init/destroy/clear/contains/insert/insert_raw/resize
+ slot/size helpers
- Open-addressed hash with linear probing
- Power-of-2 capacity; PHX_PTR_SET_INITIAL_CAP=16u; load factor 0.7 triggers
resize doubling
- Knuth multiplicative hash on uintptr_t (64-bit constant 11400714819323198485)
- Empty-slot sentinel: entries[i] == NULL
- NULL-key invariant: cannot store NULL as a member (sentinel collision);
callers must guard NULL-pointer insertion if NULL is a possible key
- Allocator: plain calloc/realloc/free (matches phx_ptr_array.h sibling
pattern; calloc zero-inits new entries to NULL sentinel)
- Forward stance python#4: JIT_CHECK_C(new_entries != NULL, ...) loud-fail
post-calloc per X1a 0bac3bc precedent
Verifier (hir_instr_c_verify.cpp +90 LOC, batch92 6-section coverage):
- (a) empty: contains 0, size 0, lazy-alloc invariant
- (b) single insert + contains: returns 1 / size 1 / contains 1
- (c) duplicate insert: returns 0, size unchanged
- (d) multi insert + contains across 3 keys + non-inserted-not-contained
- (e) resize past initial cap (16): 20 distinct-key inserts; size 23
(3 prior + 20); capacity grew past 16; ALL pre-resize + post-resize
keys still contained (validates rehash correctness)
- (f) clear + reuse: count resets, contains returns 0; subsequent insert
works without re-init; destroy resets all fields
Substrate ready for X2c E-7 translate() std::unordered_set→PhxPtrSet
migration. Header-only zero-cost abstraction; release-codegen IDENTICAL
modulo new symbols.
Phase 4.X-full progress: 2.1 ThreadedCompileSerialize DONE / 2.7
PhxBCOffsetSet (X1a-X1b, E-8 DISCHARGED) / 2.4 PhxPtrQueue (X2a) +
PhxPtrSet (this) — all 4 substrate classes initiated. Phase 4.X-full
inventory unchanged at 8 stay-C++ exceptions; X2c migration discharges
E-7, X2d migration discharges E-5.
Cumulative-drift watch counter: 12/5+. Header-only structural no-op
(X2a precedent — substrate-only authoring is empirically variance-class);
gatekeeper cap-check eligibility decision (13/20 since D3a reset).
Per supervisor M-slate dispatch D-1777572112 + Phase 4.X-full ENTRY +
X2b dispatch (LEAD: generalist, medium-STRUCT tier per pre-analysis §5).1 parent f0673cf commit 223be22
2 files changed
Lines changed: 226 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
4237 | 4238 | | |
4238 | 4239 | | |
4239 | 4240 | | |
| 4241 | + | |
| 4242 | + | |
| 4243 | + | |
| 4244 | + | |
| 4245 | + | |
| 4246 | + | |
| 4247 | + | |
| 4248 | + | |
| 4249 | + | |
| 4250 | + | |
| 4251 | + | |
| 4252 | + | |
| 4253 | + | |
| 4254 | + | |
| 4255 | + | |
| 4256 | + | |
| 4257 | + | |
| 4258 | + | |
| 4259 | + | |
| 4260 | + | |
| 4261 | + | |
| 4262 | + | |
| 4263 | + | |
| 4264 | + | |
| 4265 | + | |
| 4266 | + | |
| 4267 | + | |
| 4268 | + | |
| 4269 | + | |
| 4270 | + | |
| 4271 | + | |
| 4272 | + | |
| 4273 | + | |
| 4274 | + | |
| 4275 | + | |
| 4276 | + | |
| 4277 | + | |
| 4278 | + | |
| 4279 | + | |
| 4280 | + | |
| 4281 | + | |
| 4282 | + | |
| 4283 | + | |
| 4284 | + | |
| 4285 | + | |
| 4286 | + | |
| 4287 | + | |
| 4288 | + | |
| 4289 | + | |
| 4290 | + | |
| 4291 | + | |
| 4292 | + | |
| 4293 | + | |
| 4294 | + | |
| 4295 | + | |
| 4296 | + | |
| 4297 | + | |
| 4298 | + | |
| 4299 | + | |
| 4300 | + | |
| 4301 | + | |
| 4302 | + | |
| 4303 | + | |
| 4304 | + | |
| 4305 | + | |
| 4306 | + | |
| 4307 | + | |
| 4308 | + | |
| 4309 | + | |
| 4310 | + | |
| 4311 | + | |
| 4312 | + | |
| 4313 | + | |
| 4314 | + | |
| 4315 | + | |
| 4316 | + | |
| 4317 | + | |
| 4318 | + | |
| 4319 | + | |
| 4320 | + | |
| 4321 | + | |
| 4322 | + | |
| 4323 | + | |
| 4324 | + | |
| 4325 | + | |
| 4326 | + | |
| 4327 | + | |
| 4328 | + | |
4240 | 4329 | | |
4241 | 4330 | | |
4242 | 4331 | | |
| |||
4308 | 4397 | | |
4309 | 4398 | | |
4310 | 4399 | | |
| 4400 | + | |
4311 | 4401 | | |
| 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 | + | |
0 commit comments