gh-134584: Eliminate redundant refcounting from _CALL_TYPE_1 (GH-135818)

This commit is contained in:
Tomas R. 2025-12-23 18:01:10 +01:00 committed by GitHub
parent c8b80f5e23
commit 25c294b6ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 1047 additions and 819 deletions

View file

@ -533,6 +533,11 @@ dummy_func(void) {
value = PyJitRef_Borrow(sym_new_const(ctx, ptr));
}
op(_SHUFFLE_2_LOAD_CONST_INLINE_BORROW, (ptr/4, unused, unused, arg -- res, a)) {
res = PyJitRef_Borrow(sym_new_const(ctx, ptr));
a = arg;
}
op(_POP_TOP, (value -- )) {
PyTypeObject *typ = sym_get_type(value);
if (PyJitRef_IsBorrowed(value) ||
@ -981,16 +986,17 @@ dummy_func(void) {
next = sym_new_type(ctx, &PyLong_Type);
}
op(_CALL_TYPE_1, (unused, unused, arg -- res)) {
op(_CALL_TYPE_1, (unused, unused, arg -- res, a)) {
PyObject* type = (PyObject *)sym_get_type(arg);
if (type) {
res = sym_new_const(ctx, type);
REPLACE_OP(this_instr, _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW, 0,
REPLACE_OP(this_instr, _SHUFFLE_2_LOAD_CONST_INLINE_BORROW, 0,
(uintptr_t)type);
}
else {
res = sym_new_not_null(ctx);
}
a = arg;
}
op(_CALL_STR_1, (unused, unused, arg -- res, a)) {