gh-134584: JIT: Remove redundant refcount for _BINARY_OP_SUBSCR_DICT (GH-143724)

This commit is contained in:
Cajetan Rodrigues 2026-01-12 15:13:55 +01:00 committed by GitHub
parent 42f7c2dfba
commit 054a565c64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 83 additions and 44 deletions

View file

@ -1056,9 +1056,9 @@ dummy_func(
}
macro(BINARY_OP_SUBSCR_DICT) =
_GUARD_NOS_DICT + unused/5 + _BINARY_OP_SUBSCR_DICT;
_GUARD_NOS_DICT + unused/5 + _BINARY_OP_SUBSCR_DICT + POP_TOP + POP_TOP;
op(_BINARY_OP_SUBSCR_DICT, (dict_st, sub_st -- res)) {
op(_BINARY_OP_SUBSCR_DICT, (dict_st, sub_st -- res, ds, ss)) {
PyObject *sub = PyStackRef_AsPyObjectBorrow(sub_st);
PyObject *dict = PyStackRef_AsPyObjectBorrow(dict_st);
@ -1069,9 +1069,13 @@ dummy_func(
if (rc == 0) {
_PyErr_SetKeyError(sub);
}
DECREF_INPUTS();
ERROR_IF(rc <= 0); // not found or error
if (rc <= 0) {
ERROR_NO_POP();
}
res = PyStackRef_FromPyObjectSteal(res_o);
ds = dict_st;
ss = sub_st;
INPUTS_DEAD();
}
op(_BINARY_OP_SUBSCR_CHECK_FUNC, (container, unused -- container, unused, getitem)) {