Skip to content

Commit 782d56d

Browse files
committed
Phase 3 Batch 5: static_method_stack_ Class B-kept closure (P-strict)
Rename hir_builder_static_method_stack_pop_c to hir_builder_state_static_method_stack_pop_cpp, aligning with the state-bridge _cpp suffix convention established in Batch 2 (Phase 3 exception_table_) and Batch 4 (block_map_). Decl moved from the legacy extern "C" block in builder.h to builder_state_c.h alongside other state bridges. Class B-kept disposition for static_method_stack_ (jit::Stack<Register*>) now 100% closed: - Pop side: hir_builder_state_static_method_stack_pop_cpp bridge (renamed) + 1 C-side caller in builder_emit_c.c (emitInvokeMethod static-typed branch) - Push side: stays C++-direct from C++ method context (builder.cpp:3449); no C-side push-caller materialized, push_cpp bridge deferred per as-needed discipline (theologian 00:28:34Z + supervisor 00:28:51Z, Batch 4 precedent). ZERO new bridges (pure rename). NO opaque pointer added to PhxHirBuilderState (Class B-kept per Batch 4 precedent: bridge available, struct doc-comment notes "in spirit"; subsequent Phase 3 closure amendment per pythia python#94 (3) will explicitly declare keep-bias as final HirBuilder state disposition). Numstat (vs HEAD eb3cdf3): Python/jit/hir/builder.cpp +1 -1 (extern "C" decl rename) Python/jit/hir/builder.h +1 -2 (delete legacy extern; rename friend) Python/jit/hir/builder_emit_c.c +3 -3 (extern + 1 caller + 1 doc-comment rename) Python/jit/hir/builder_state_c.h +9 -0 (NEW decl with state- bridge naming + history) scripts/w45_bridge_drift_falsifier.sh +1 -0 (1 new fixture) TOTAL: NET +9L (forecast +10L; -1L variance, ~10%, under threshold). W45 fixture: 1 new (state_static_method_stack_pop_cpp) added per shepard 22:46:33Z same-commit discipline. Dry-run: 14/14 fixtures stage cleanly. Pre-commit compile-check: testkeeper 00:33:26Z BUILD_EXIT=0, 3-test sanity green (partial_conversions + W22 + W44). W44 gate: PASS. Authorization: theologian 00:28:34Z (P-strict over P-pre-emptive per as-needed consistency) + supervisor 00:28:51Z (DISPOSITION GO P-strict).
1 parent eb3cdf3 commit 782d56d

5 files changed

Lines changed: 15 additions & 6 deletions

File tree

Python/jit/hir/builder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3494,7 +3494,7 @@ extern "C" void hir_builder_setup_static_args_c(
34943494
}
34953495
}
34963496

3497-
extern "C" void *hir_builder_static_method_stack_pop_c(void *builder) {
3497+
extern "C" void *hir_builder_state_static_method_stack_pop_cpp(void *builder) {
34983498
auto *self = static_cast<HIRBuilder*>(builder);
34993499
return self->static_method_stack_.pop();
35003500
}

Python/jit/hir/builder.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ int hir_builder_try_emit_direct_method_call_c(
4040
void hir_builder_setup_static_args_c(
4141
void *builder, void *tc, PyObject *descr, long nargs, int statically_typed,
4242
void **out_arg_regs, size_t *out_count);
43-
void *hir_builder_static_method_stack_pop_c(void *builder);
4443

4544
/* W26 (theologian L2462+L2466): bridges for emitAnyCall full conversion +
4645
* 149b7e2d40 PartialConversion reabsorb. 4 NEW bridges: combined exception-
@@ -190,7 +189,7 @@ class HIRBuilder {
190189
void*, void*, PyObject*, long);
191190
friend void ::hir_builder_setup_static_args_c(
192191
void*, void*, PyObject*, long, int, void**, size_t*);
193-
friend void* ::hir_builder_static_method_stack_pop_c(void*);
192+
friend void* ::hir_builder_state_static_method_stack_pop_cpp(void*);
194193
// INVOKE_* Phase 2 #3 (theologian L2430): function-target variants for
195194
// emitInvokeFunction C body.
196195
friend void ::hir_builder_invoke_function_target_c(

Python/jit/hir/builder_emit_c.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2549,7 +2549,7 @@ bool hir_builder_emit_invoke_function_c(
25492549
* - hir_builder_invoke_method_target_c (InvokeTarget query)
25502550
* - hir_builder_try_emit_direct_method_call_c (path 1)
25512551
* - hir_builder_setup_static_args_c (arg_regs)
2552-
* - hir_builder_static_method_stack_pop_c (entry pop) */
2552+
* - hir_builder_state_static_method_stack_pop_cpp (entry pop) */
25532553
extern void hir_builder_invoke_method_target_c(
25542554
void *builder, PyObject *descr,
25552555
int *out_is_builtin, int *out_is_statically_typed, HirType *out_return_type);
@@ -2558,7 +2558,7 @@ extern int hir_builder_try_emit_direct_method_call_c(
25582558
extern void hir_builder_setup_static_args_c(
25592559
void *builder, void *tc, PyObject *descr, long nargs, int statically_typed,
25602560
void **out_arg_regs, size_t *out_count);
2561-
extern void *hir_builder_static_method_stack_pop_c(void *builder);
2561+
extern void *hir_builder_state_static_method_stack_pop_cpp(void *builder);
25622562

25632563
bool hir_builder_emit_invoke_method_c(
25642564
PhxTranslationContext *tc,
@@ -2589,7 +2589,7 @@ bool hir_builder_emit_invoke_method_c(
25892589
/* AllocateNonStack equivalent: hir_func_alloc_register
25902590
* (TempAllocator::AllocateNonStack just calls env->AllocateRegister). */
25912591
void *out = hir_func_alloc_register(func);
2592-
void *entry = hir_builder_static_method_stack_pop_c(builder);
2592+
void *entry = hir_builder_state_static_method_stack_pop_cpp(builder);
25932593
void *invoke = hir_c_create_call_ind_reg2(
25942594
(size_t)nargs + 1, out, "vtable invoke", return_type);
25952595
hir_c_set_operand(invoke, 0, entry);

Python/jit/hir/builder_state_c.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@ void *hir_builder_state_block_map_blocks_lookup_cpp(
9898
void *builder,
9999
int off);
100100

101+
/* Phase 3 Batch 5 (P-strict) Class B-kept disposition closure for
102+
* static_method_stack_ (jit::Stack<Register*>): pop the top entry and
103+
* return it. Renamed from hir_builder_static_method_stack_pop_c to
104+
* align with state-bridge _cpp suffix convention (Batch 2 + 4 precedent).
105+
* The push side stays C++-direct from C++ method context (1 site at
106+
* builder.cpp:3449); push_cpp bridge deferred per as-needed discipline
107+
* (theologian 00:28:34Z + supervisor 00:28:51Z). */
108+
void *hir_builder_state_static_method_stack_pop_cpp(void *builder);
109+
101110
#ifdef __cplusplus
102111
} /* extern "C" */
103112
#endif

scripts/w45_bridge_drift_falsifier.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ FIXTURES=(
100100
"hir_builder_state_exception_table_entry_cpp|Phase 3 Batch 2 exception_table entry bridge (7 args)"
101101
"hir_builder_state_find_exception_handler_c|Phase 3 Batch 2 findExceptionHandler C body (4 args)"
102102
"hir_builder_state_block_map_blocks_lookup_cpp|Phase 3 Batch 4 block_map blocks lookup bridge (2 args)"
103+
"hir_builder_state_static_method_stack_pop_cpp|Phase 3 Batch 5 static_method_stack pop bridge (1 arg)"
103104
)
104105

105106
# Mutation: append ', int phx_w45_drift' before the closing paren of the

0 commit comments

Comments
 (0)