Commit 9630005
committed
builder: emitCallExceptionHandler → C (101/144 → 102/144 = 70.8%)
Sibling of emitInlineExceptionMatch (~95% shared per theologian PTE
pre-audit chat 2026-04-22 16:53Z). Shared-helper design (option a) —
D-1774910012 PA invariant lives in EXACTLY ONE C body across both
callers, eliminating invariant-drift surface.
Python/jit/hir/builder.cpp:
emitCallExceptionHandler C++ body (160 lines) → C++ stub (~75 lines):
D1 pre-amble: setSuppressExceptionDeopt(true) + pop result
Build OpcodeArrayEntry_CXX vector (same shape as inline-match)
Call new C body via hir_builder_emit_call_exception_handler_c
Net: -167 (replaces inline body with stub call)
Python/jit/hir/builder_emit_c.c:
NEW static helper emit_except_match_body_c (~140 lines):
P2: exc_tc setup + depth-trim
P2 inv 8-13: exc_type_reg + JITRT_MatchAndClearException CallStatic + CondBranch
P3: match_tc setup + (PA D-1774910012) Py_None push + dispatch loop (10 cases + default→deopt)
P4: deopt_tc setup (origin = tc.frame per PB.b) + optional left/right re-push + Snapshot + Deopt
PE: phx_frame_state_destroy on EXACTLY 3 TCs (exc_tc, match_tc, deopt_tc)
REFACTORED hir_builder_emit_inline_exception_match_c (~30 lines):
P1 (getitem CallStatic) + ok_block alloc + CondBranch + helper-call + P5 RefineType
Passes left/right as deopt_repush args (BINARY_SUBSCR offset expects them).
NEW hir_builder_emit_call_exception_handler_c (~30 lines):
ok_block alloc + CondBranch on result + helper-call + D3 P5 RefineType + push result
Passes NULL/NULL deopt_repush args (call-result already popped on C++ side).
Net: +85 (helper extraction + new C function)
PTE-trial invariant inventory verification per theologian [chat L1899]:
29 invariants total = 26 SHARED (in helper, single-source) + 3 UNIQUE (D1/D2/D3).
PA D-1774910012: helper guarantees Py_None push + POP_EXCEPT pop, no callsite
can violate. Mutation-test sensitivity preserved (same code path as push 59).
PB pitfalls: helper enforces deopt_origin = tc (not exc_tc).
PE: helper destroys all 3 TCs unconditionally before return.
ZERO new bridges per theologian [chat L1899] gate verdict:
Reuses hir_c_create_call_static_reg, hir_c_create_load_const,
hir_c_create_cond_branch_cpp, hir_c_create_branch_cpp,
hir_c_create_snapshot, hir_c_create_deopt, hir_c_create_refine_type_reg,
hir_c_create_return, hir_builder_emit_swap_c/load_fast_c/store_fast_c/binary_op_c.
Bundled W25 metadata update per supervisor [chat L1894] decision (a):
docs/w25-typed-bridges.md §7 PARKED — Owner+Schedule+Falsification+Closure
criteria fields added per pythia python#76 python#3 fallow-workstream discipline. Theologian-
authored, gen-staged + bundled into this commit (gate-cycle efficiency).
testkeeper x86_64 compile-only PASS verified pre-commit at binary timestamp
1776877216 (chat L1900). Awaiting ARM64 pydebug --clean + 8-test gate +
push 58 baseline regression check before push.
Authorization chain:
- theologian PTE pre-audit + STRONG (a) lean: chat L1899
- emitCallExceptionHandler queue unblocked: supervisor chat L1894 (b1 outcome)
- W25 metadata bundle option (a): supervisor chat L18941 parent 68b9b86 commit 9630005
3 files changed
Lines changed: 423 additions & 176 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1423 | 1423 | | |
1424 | 1424 | | |
1425 | 1425 | | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
1426 | 1438 | | |
1427 | | - | |
| 1439 | + | |
1428 | 1440 | | |
1429 | 1441 | | |
1430 | 1442 | | |
1431 | 1443 | | |
1432 | 1444 | | |
1433 | 1445 | | |
1434 | | - | |
1435 | | - | |
1436 | | - | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
1437 | 1452 | | |
1438 | | - | |
1439 | | - | |
1440 | 1453 | | |
1441 | 1454 | | |
1442 | | - | |
1443 | | - | |
1444 | | - | |
1445 | | - | |
1446 | | - | |
1447 | | - | |
1448 | | - | |
1449 | | - | |
1450 | | - | |
1451 | | - | |
1452 | | - | |
1453 | | - | |
1454 | | - | |
1455 | | - | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
1456 | 1472 | | |
1457 | | - | |
1458 | | - | |
1459 | | - | |
1460 | | - | |
1461 | | - | |
1462 | | - | |
1463 | | - | |
1464 | | - | |
1465 | | - | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
1469 | | - | |
1470 | | - | |
1471 | | - | |
1472 | | - | |
1473 | | - | |
1474 | | - | |
1475 | | - | |
1476 | | - | |
1477 | | - | |
1478 | | - | |
1479 | | - | |
1480 | | - | |
1481 | | - | |
1482 | | - | |
1483 | | - | |
1484 | | - | |
1485 | | - | |
1486 | | - | |
1487 | | - | |
1488 | | - | |
1489 | | - | |
1490 | | - | |
1491 | | - | |
1492 | | - | |
1493 | | - | |
1494 | | - | |
1495 | | - | |
1496 | | - | |
1497 | | - | |
1498 | | - | |
1499 | | - | |
1500 | | - | |
1501 | | - | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
1505 | | - | |
1506 | | - | |
1507 | | - | |
1508 | | - | |
1509 | | - | |
1510 | | - | |
1511 | | - | |
1512 | | - | |
1513 | | - | |
1514 | | - | |
1515 | | - | |
1516 | | - | |
1517 | | - | |
1518 | | - | |
1519 | | - | |
1520 | | - | |
1521 | | - | |
1522 | | - | |
1523 | | - | |
1524 | | - | |
1525 | | - | |
1526 | | - | |
1527 | | - | |
1528 | | - | |
1529 | | - | |
1530 | | - | |
1531 | | - | |
1532 | | - | |
1533 | | - | |
1534 | | - | |
1535 | | - | |
1536 | | - | |
1537 | | - | |
1538 | | - | |
1539 | | - | |
1540 | | - | |
1541 | | - | |
1542 | | - | |
1543 | | - | |
1544 | | - | |
1545 | | - | |
1546 | | - | |
1547 | | - | |
1548 | | - | |
1549 | | - | |
1550 | | - | |
1551 | | - | |
1552 | | - | |
1553 | | - | |
1554 | | - | |
1555 | | - | |
1556 | | - | |
1557 | | - | |
1558 | | - | |
1559 | | - | |
1560 | | - | |
1561 | | - | |
1562 | | - | |
1563 | | - | |
1564 | | - | |
1565 | | - | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
1566 | 1476 | | |
1567 | | - | |
1568 | | - | |
1569 | | - | |
1570 | | - | |
1571 | | - | |
1572 | | - | |
1573 | | - | |
1574 | | - | |
1575 | | - | |
1576 | | - | |
1577 | | - | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
1578 | 1489 | | |
1579 | 1490 | | |
1580 | 1491 | | |
1581 | | - | |
1582 | | - | |
1583 | | - | |
1584 | | - | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
1585 | 1505 | | |
1586 | 1506 | | |
1587 | 1507 | | |
| |||
0 commit comments