gh-134584: Eliminate redundant refcounting from _CALL{_BUILTIN_O, _METHOD_DESCRIPTOR_O} (GH-143330)

Co-authored-by: Ken Jin <kenjin4096@gmail.com>
This commit is contained in:
Donghee Na 2026-01-02 02:25:38 +09:00 committed by GitHub
parent 422ca074bc
commit 1fb8e0eb51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 177 additions and 76 deletions

View file

@ -131,7 +131,7 @@ dummy_func(void) {
}
op(_PUSH_NULL, (-- res)) {
res = sym_new_null(ctx);
res = PyJitRef_Borrow(sym_new_null(ctx));
}
op(_GUARD_TOS_INT, (value -- value)) {
@ -1064,6 +1064,35 @@ dummy_func(void) {
none = sym_new_const(ctx, Py_None);
}
op(_CALL_BUILTIN_O, (callable, self_or_null, args[oparg] -- res, c, s)) {
res = sym_new_not_null(ctx);
c = callable;
if (sym_is_not_null(self_or_null)) {
args--;
s = args[0];
}
else if (sym_is_null(self_or_null)) {
s = args[0];
}
else {
s = sym_new_unknown(ctx);
}
}
op(_CALL_METHOD_DESCRIPTOR_O, (callable, self_or_null, args[oparg] -- res, c, s, a)) {
res = sym_new_not_null(ctx);
c = callable;
if (sym_is_not_null(self_or_null)) {
args--;
s = args[0];
a = args[1];
}
else {
s = sym_new_unknown(ctx);
a = sym_new_unknown(ctx);
}
}
op(_GUARD_IS_FALSE_POP, (flag -- )) {
if (sym_is_const(ctx, flag)) {
PyObject *value = sym_get_const(ctx, flag);