gh-144145: Revert PR#144122 for performance and potential bugs. (GH-144391)

Revert "gh-144145: Track nullness of properties in the Tier 2 JIT optimizer (GH-144122)"

This reverts commit 1dc12b2883.
This commit is contained in:
Hai Zhu 2026-02-02 22:09:54 +08:00 committed by GitHub
parent c3b61ef73d
commit ebbb2ca81f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 902 additions and 1589 deletions

View file

@ -269,9 +269,6 @@ add_op(JitOptContext *ctx, _PyUOpInstruction *this_instr,
#define sym_is_compact_int _Py_uop_sym_is_compact_int
#define sym_new_compact_int _Py_uop_sym_new_compact_int
#define sym_new_truthiness _Py_uop_sym_new_truthiness
#define sym_new_descr_object _Py_uop_sym_new_descr_object
#define sym_get_attr _Py_uop_sym_get_attr
#define sym_set_attr _Py_uop_sym_set_attr
#define sym_new_predicate _Py_uop_sym_new_predicate
#define sym_apply_predicate_narrowing _Py_uop_sym_apply_predicate_narrowing
@ -506,6 +503,7 @@ optimize_uops(
int oparg = this_instr->oparg;
opcode = this_instr->opcode;
if (!CURRENT_FRAME_IS_INIT_SHIM()) {
stack_pointer = ctx->frame->stack_pointer;
}
@ -526,15 +524,9 @@ optimize_uops(
if (ctx->out_buffer.next == out_ptr) {
*(ctx->out_buffer.next++) = *this_instr;
}
// Track escapes - but skip when from init shim frame, since self hasn't escaped yet
bool is_init_shim = CURRENT_FRAME_IS_INIT_SHIM();
if ((_PyUop_Flags[out_ptr->opcode] & HAS_ESCAPES_FLAG) && !is_init_shim)
{
ctx->last_escape_index = uop_buffer_length(&ctx->out_buffer) - 1;
}
assert(ctx->frame != NULL);
DUMP_UOP(ctx, "out", uop_buffer_length(&ctx->out_buffer) - 1, out_ptr, stack_pointer);
if (!is_init_shim && !ctx->done) {
if (!CURRENT_FRAME_IS_INIT_SHIM() && !ctx->done) {
DPRINTF(3, " stack_level %d\n", STACK_LEVEL());
ctx->frame->stack_pointer = stack_pointer;
assert(STACK_LEVEL() >= 0);