Commit e78fb24
feat(jit): substrate ops inline + HBit β-divergence + Nop compaction
JIT scalar lowerer (lib.rs):
- Add `module` field to FunctionLowerer so it can look up registered externs
- Wire Op::Fold1 → omc_fold, Op::IsFibonacci → omc_is_attractor,
Op::Fibonacci → omc_nth_fibonacci (already registered), plus
Op::Resonance → omc_resonance_bits, Op::HimScore → omc_him_score_bits
(new shims added this session) via emit_unary_extern_call helper
- Functions using substrate ops are now JIT-eligible without falling to
the "Session B doesn't yet lower" error arm
HBit dual-band lowerer (dual_band.rs):
- PhiShadow step: every StoreVar/AssignVar now re-derives β = fold(α)
so the β band tracks the nearest Fibonacci attractor of the live value
rather than being a stale splatted copy from function entry
- Adds phi_shadow_store() helper using omc_fold via module.get_function
Bytecode optimizer (bytecode_opt.rs):
- New compact_nops() pass removes Op::Nop holes after the peephole
fixpoint and rewrites all Jump/JumpIfFalse/JumpIfTrue offsets
- Adds nops_compacted field to OptStats; compact_nops runs once at the
end of optimize_function (not inside the loop)
- 5 new tests: direct Nop removal, branch/loop jump bounds, integration
with constant-folding pipeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent c2d6432 commit e78fb24
3 files changed
Lines changed: 322 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
319 | 324 | | |
320 | 325 | | |
321 | | - | |
| 326 | + | |
322 | 327 | | |
323 | 328 | | |
324 | 329 | | |
| |||
1329 | 1334 | | |
1330 | 1335 | | |
1331 | 1336 | | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
1332 | 1385 | | |
1333 | 1386 | | |
1334 | 1387 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
275 | 291 | | |
276 | 292 | | |
277 | 293 | | |
| |||
641 | 657 | | |
642 | 658 | | |
643 | 659 | | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
644 | 663 | | |
645 | 664 | | |
646 | 665 | | |
| |||
1030 | 1049 | | |
1031 | 1050 | | |
1032 | 1051 | | |
| 1052 | + | |
1033 | 1053 | | |
1034 | 1054 | | |
1035 | 1055 | | |
| |||
1066 | 1086 | | |
1067 | 1087 | | |
1068 | 1088 | | |
| 1089 | + | |
1069 | 1090 | | |
1070 | 1091 | | |
1071 | 1092 | | |
| |||
1524 | 1545 | | |
1525 | 1546 | | |
1526 | 1547 | | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
1527 | 1585 | | |
1528 | 1586 | | |
1529 | 1587 | | |
| |||
1701 | 1759 | | |
1702 | 1760 | | |
1703 | 1761 | | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
1704 | 1789 | | |
1705 | 1790 | | |
1706 | 1791 | | |
| |||
0 commit comments