Commit 1553c14
committed
W26 fix: dispatch via PhxCallKind enum (W21 golden regression closure)
W26 Step B (95c9f9b) introduced a W21 golden HIR regression on both
arches per testkeeper L2484: attr_probe BinaryOp<Add> was not being
specialized into LongBinaryOp<Add> + GuardType in the post-W26 build.
ROOT CAUSE: my W26 added cinder_opcode.h BEFORE opcode.h in
builder_emit_c.c to make INVOKE_FUNCTION/_NATIVE/_METHOD opcode constants
available for the case labels in the new emit_any_call C body switch.
But cinder_opcode.h's cinder_opcode_ids.h sets Py_OPCODE_H header guard
which then SHADOWED Include/opcode.h, leaving BINARY_OP_ADD_INT
undefined. The BINARY_OP specialization path at builder_emit_c.c:1135
uses `#ifdef BINARY_OP_ADD_INT` to gate its GuardType + LongBinaryOp
emission — silently compiled out when BINARY_OP_ADD_INT was undefined.
attr_probe's a + b + c chain (3 LOAD_ATTR + 2 BINARY_OP_ADD_INT
specializations) lost its 4 GuardType emits + 2 LongBinaryOp specializations,
leaving only 2 generic BinaryOp<Add> ops.
W21 golden test (push 62) was added EXPLICITLY to catch HIR drift in
emit-method conversions. It fired the trip wire on the first attempt —
discipline working as intended.
FIX (PhxCallKind enum dispatch):
- C body switches on `int call_kind` (PhxCallKind enum value) instead
of on opcode constants. Constants defined as #defines in
builder_emit_c.c + matching `enum PhxCallKind` in builder.h.
- C++ stub maps opcode → PhxCallKind via a small switch (CALL_FUNCTION
→ VECTOR_CALL, CALL_KW → CALL_METHOD+is_kw_arg, etc.) before
delegation. is_kw_arg is a separate sub-flag for opcodes that need
the kwnames adjustment (CALL_FUNCTION_KW + CALL_KW).
- REVERTED the cinder_opcode.h include that broke opcode.h's #defines.
- Kept opcode_stubs.h include for YIELD_FROM (used in await-tail
JIT_CHECK_C; not in 3.12 Include/opcode.h, only in stubs).
Empirical verification:
- cmake --build target jit/phoenix_jit clean (BUILD_EXIT=0)
- ./python -m test test_phoenix_jit_loadattr_golden → PASS (was FAIL)
- ./python -m test test_phoenix_jit_inline_except_closure → 6/6 PASS
W26 Step B + this fix together: full conversion of emitAnyCall to C +
149b7e2 PartialConversion REABSORB, with W21 golden parity.1 parent 95c9f9b commit 1553c14
3 files changed
Lines changed: 84 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2913 | 2913 | | |
2914 | 2914 | | |
2915 | 2915 | | |
2916 | | - | |
2917 | | - | |
| 2916 | + | |
| 2917 | + | |
2918 | 2918 | | |
2919 | 2919 | | |
2920 | 2920 | | |
| |||
2928 | 2928 | | |
2929 | 2929 | | |
2930 | 2930 | | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
2931 | 2959 | | |
2932 | 2960 | | |
2933 | 2961 | | |
| |||
2953 | 2981 | | |
2954 | 2982 | | |
2955 | 2983 | | |
2956 | | - | |
| 2984 | + | |
2957 | 2985 | | |
2958 | 2986 | | |
2959 | 2987 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
48 | 62 | | |
49 | 63 | | |
50 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 20 | | |
25 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
26 | 34 | | |
27 | 35 | | |
28 | 36 | | |
| |||
3489 | 3497 | | |
3490 | 3498 | | |
3491 | 3499 | | |
3492 | | - | |
| 3500 | + | |
3493 | 3501 | | |
3494 | 3502 | | |
3495 | 3503 | | |
| 3504 | + | |
3496 | 3505 | | |
3497 | 3506 | | |
3498 | 3507 | | |
3499 | | - | |
| 3508 | + | |
| 3509 | + | |
| 3510 | + | |
| 3511 | + | |
| 3512 | + | |
| 3513 | + | |
3500 | 3514 | | |
3501 | 3515 | | |
3502 | 3516 | | |
3503 | | - | |
3504 | | - | |
3505 | | - | |
3506 | | - | |
| 3517 | + | |
| 3518 | + | |
| 3519 | + | |
| 3520 | + | |
| 3521 | + | |
3507 | 3522 | | |
3508 | | - | |
| 3523 | + | |
3509 | 3524 | | |
3510 | 3525 | | |
3511 | 3526 | | |
3512 | | - | |
3513 | 3527 | | |
3514 | 3528 | | |
3515 | 3529 | | |
| |||
3521 | 3535 | | |
3522 | 3536 | | |
3523 | 3537 | | |
3524 | | - | |
| 3538 | + | |
3525 | 3539 | | |
3526 | 3540 | | |
3527 | 3541 | | |
3528 | | - | |
3529 | | - | |
3530 | | - | |
| 3542 | + | |
| 3543 | + | |
| 3544 | + | |
| 3545 | + | |
3531 | 3546 | | |
3532 | 3547 | | |
3533 | | - | |
3534 | 3548 | | |
3535 | | - | |
3536 | | - | |
| 3549 | + | |
| 3550 | + | |
3537 | 3551 | | |
3538 | 3552 | | |
3539 | 3553 | | |
| |||
3566 | 3580 | | |
3567 | 3581 | | |
3568 | 3582 | | |
3569 | | - | |
| 3583 | + | |
3570 | 3584 | | |
3571 | 3585 | | |
3572 | 3586 | | |
3573 | 3587 | | |
3574 | 3588 | | |
3575 | 3589 | | |
3576 | | - | |
| 3590 | + | |
3577 | 3591 | | |
3578 | 3592 | | |
3579 | 3593 | | |
3580 | 3594 | | |
3581 | 3595 | | |
3582 | 3596 | | |
3583 | 3597 | | |
3584 | | - | |
| 3598 | + | |
3585 | 3599 | | |
3586 | 3600 | | |
3587 | 3601 | | |
3588 | 3602 | | |
3589 | 3603 | | |
3590 | 3604 | | |
3591 | 3605 | | |
3592 | | - | |
| 3606 | + | |
3593 | 3607 | | |
3594 | 3608 | | |
3595 | 3609 | | |
| |||
0 commit comments