Skip to content

Commit 256984d

Browse files
committed
hir_instr_c.h: 4 inline opcode predicates for BLME C-port (Phase 4.A batch 1)
Header-only change — 4 trivial static-inline opcode predicates needed for builtin_load_method_elimination's pure-C port. Added next to the existing hir_c_is_* family (after hir_c_is_replayable): - hir_c_is_call_method (HIR_OP_CallMethod) - hir_c_is_load_method_super (HIR_OP_LoadMethodSuper) - hir_c_is_get_second_output (HIR_OP_GetSecondOutput) - hir_c_is_load_method_base (3-way disjunction over LoadMethod / LoadMethodCached / LoadModuleMethodCached; C-side mirror of jit::hir::isLoadMethodBase at hir.cpp:725) No .c/.cpp changes; no behavior change. Phase 4.A pilot (theologian invariant pre-audit 08:10:43Z + supervisor 08:14:58Z PROCEED on header-only step). Build: scripts/build_phoenix.sh --clean PASS (testkeeper 08:18:43Z + 08:20:37Z clarification — only this hir_instr_c.h delta in WT during build; 4 unrelated mods stashed for isolation; clean ThinLTO; included by 10+ jit/hir/*.c TUs which all compiled under C with the new predicates in scope).
1 parent e5f3412 commit 256984d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Python/jit/hir/hir_instr_c.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,25 @@ static inline int hir_c_is_deopt_base(const void *instr) {
15171517
static inline int hir_c_is_replayable(const void *instr) {
15181518
return hir_instr_info_is_replayable(hir_c_opcode(instr));
15191519
}
1520+
static inline int hir_c_is_call_method(const void *instr) {
1521+
return hir_c_opcode(instr) == HIR_OP_CallMethod;
1522+
}
1523+
static inline int hir_c_is_load_method_super(const void *instr) {
1524+
return hir_c_opcode(instr) == HIR_OP_LoadMethodSuper;
1525+
}
1526+
static inline int hir_c_is_get_second_output(const void *instr) {
1527+
return hir_c_opcode(instr) == HIR_OP_GetSecondOutput;
1528+
}
1529+
/* C-side mirror of jit::hir::isLoadMethodBase (hir.cpp:725): returns
1530+
* true for LoadMethod, LoadMethodCached, LoadModuleMethodCached. Used
1531+
* by builtin_load_method_elimination to filter the LoadMethod-class
1532+
* dispatch heads it can rewrite. */
1533+
static inline int hir_c_is_load_method_base(const void *instr) {
1534+
int op = hir_c_opcode(instr);
1535+
return op == HIR_OP_LoadMethod ||
1536+
op == HIR_OP_LoadMethodCached ||
1537+
op == HIR_OP_LoadModuleMethodCached;
1538+
}
15201539

15211540
/* ==== Phi query functions (no BasicBlock dependency) ==== */
15221541

0 commit comments

Comments
 (0)