Commit 72bb8e9
committed
Tier 8 SECOND-PILOT Phase A: block_map_.blocks → PhxBlockMap (custom hash)
Migrates the BCOffset→BasicBlock* lookup from std::unordered_map to a
purpose-built open-addressed hash (Knuth multiplicative, linear probing,
load factor 0.7) living in PhxHirBuilderState.block_map_phx. Custom hash
chosen per spec §2.1 strict path because the D2 block-count measurement
(2026-04-24) showed re._parser:Tokenizer.__next at 294 blocks and
Tokenizer.get at 147 — PhxArray linear-scan would be O(n²) on these
real stdlib hot paths.
Net bridge delta: -1 (per Tier 8 spec §5 python#11 net-subtract).
- DELETED hir_builder_state_block_map_blocks_lookup_cpp (Phase 3 Batch 4)
- DELETED hir_builder_get_block_at_off (Tier 2 emit-conversion bridge)
- ADDED phx_hir_builder_state(builder) — canonical state-from-builder
accessor; future Phase B/C/D pilots reuse the pattern.
block_map_.bc_blocks (heavy BytecodeInstructionBlock value-type) stays
C++-side this phase; only the BCOffset→BasicBlock* lookup migrated.
HIRBuilder::getBlockAtOff body now delegates to phx_block_map_lookup;
the C++ method shell is deferred to a later phase.
12 C-side caller sites in builder_emit_c.c rewired to
phx_block_map_lookup_or_panic(&phx_hir_builder_state(builder)
->block_map_phx, off). NULL-value invariant verified pre-commit:
the sole insert site (createBlocks) takes the value from
CFG::AllocateBlock() = `new BasicBlock(id)` which never returns NULL.
Falsifiers bundled:
- test_phx_block_map.c: 8 unit tests (init/insert/resize-trigger at
cap=16/N=300/synthesized collisions/overwrite/miss/clear).
- gate_phoenix.sh: block_map_resize_chain (10-arm if/return,
~25 block_starts) added to wiring-gate force_compile fixtures so
PhxBlockMap_resize fires deterministically (testkeeper 10:29:06Z gap
flag — prior wiring fixtures were all <12 BBs).
- w45_bridge_drift_falsifier.sh: lookup_cpp fixture retargeted to
phx_hir_builder_state.
- w45_section_3_5_derivation_drift.sh: Fixture 4 retargeted to
phx_hir_builder_state return-type mutation
(PhxHirBuilderState* → int breaks the 12 caller derefs).
Auth chain: theologian patch-shape APPROVE 10:28:51Z + 10:33:54Z (β2)
+ 10:41:07Z (revisions); supervisor authorization 10:25:19Z + 10:29:05Z
+ 10:29:22Z; librarian §5 python#11 net-subtract precedent 10:30:04Z;
testkeeper pre-commit BUILD PASS + 8/8 unit PASS 10:46:46Z.1 parent 2a35849 commit 72bb8e9
11 files changed
Lines changed: 447 additions & 71 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1164 | 1164 | | |
1165 | 1165 | | |
1166 | 1166 | | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
1167 | 1173 | | |
1168 | 1174 | | |
1169 | 1175 | | |
| |||
1223 | 1229 | | |
1224 | 1230 | | |
1225 | 1231 | | |
1226 | | - | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1227 | 1237 | | |
1228 | 1238 | | |
1229 | 1239 | | |
| |||
1473 | 1483 | | |
1474 | 1484 | | |
1475 | 1485 | | |
1476 | | - | |
1477 | | - | |
1478 | | - | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
1479 | 1490 | | |
1480 | 1491 | | |
1481 | | - | |
1482 | | - | |
1483 | | - | |
1484 | | - | |
1485 | | - | |
1486 | | - | |
1487 | | - | |
1488 | | - | |
| 1492 | + | |
| 1493 | + | |
1489 | 1494 | | |
1490 | 1495 | | |
1491 | 1496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
173 | 172 | | |
174 | 173 | | |
175 | 174 | | |
176 | | - | |
177 | 175 | | |
178 | 176 | | |
179 | 177 | | |
| |||
212 | 210 | | |
213 | 211 | | |
214 | 212 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
220 | 222 | | |
221 | 223 | | |
222 | 224 | | |
| |||
575 | 577 | | |
576 | 578 | | |
577 | 579 | | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
578 | 584 | | |
579 | | - | |
580 | 585 | | |
581 | 586 | | |
582 | 587 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
537 | 538 | | |
538 | 539 | | |
539 | 540 | | |
540 | | - | |
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
| |||
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
555 | | - | |
| 555 | + | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
| 558 | + | |
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| |||
1621 | 1621 | | |
1622 | 1622 | | |
1623 | 1623 | | |
1624 | | - | |
1625 | 1624 | | |
1626 | 1625 | | |
1627 | 1626 | | |
| |||
1637 | 1636 | | |
1638 | 1637 | | |
1639 | 1638 | | |
1640 | | - | |
1641 | | - | |
| 1639 | + | |
| 1640 | + | |
1642 | 1641 | | |
1643 | 1642 | | |
1644 | 1643 | | |
| |||
1734 | 1733 | | |
1735 | 1734 | | |
1736 | 1735 | | |
1737 | | - | |
1738 | 1736 | | |
1739 | 1737 | | |
1740 | 1738 | | |
| |||
1775 | 1773 | | |
1776 | 1774 | | |
1777 | 1775 | | |
1778 | | - | |
1779 | | - | |
| 1776 | + | |
| 1777 | + | |
1780 | 1778 | | |
1781 | 1779 | | |
1782 | 1780 | | |
| |||
1903 | 1901 | | |
1904 | 1902 | | |
1905 | 1903 | | |
1906 | | - | |
1907 | | - | |
| 1904 | + | |
| 1905 | + | |
1908 | 1906 | | |
1909 | 1907 | | |
1910 | 1908 | | |
| |||
1931 | 1929 | | |
1932 | 1930 | | |
1933 | 1931 | | |
1934 | | - | |
1935 | | - | |
| 1932 | + | |
| 1933 | + | |
1936 | 1934 | | |
1937 | 1935 | | |
1938 | 1936 | | |
| |||
4224 | 4222 | | |
4225 | 4223 | | |
4226 | 4224 | | |
4227 | | - | |
4228 | 4225 | | |
4229 | 4226 | | |
4230 | 4227 | | |
| |||
4244 | 4241 | | |
4245 | 4242 | | |
4246 | 4243 | | |
4247 | | - | |
4248 | | - | |
| 4244 | + | |
| 4245 | + | |
4249 | 4246 | | |
4250 | 4247 | | |
4251 | 4248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
15 | 22 | | |
16 | 23 | | |
17 | 24 | | |
| |||
22 | 29 | | |
23 | 30 | | |
24 | 31 | | |
| 32 | + | |
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
28 | 36 | | |
| 37 | + | |
29 | 38 | | |
30 | 39 | | |
31 | 40 | | |
| |||
0 commit comments