mirror of
https://github.com/python/cpython.git
synced 2025-09-09 02:11:51 +00:00
Fix BINARY_SUBSCR_GETITEM stats (GH-93903)
This commit is contained in:
parent
d5be9a5dff
commit
ab45c1dde0
2 changed files with 7 additions and 7 deletions
|
@ -2240,16 +2240,15 @@ handle_eval_breaker:
|
||||||
PyFunctionObject *getitem = (PyFunctionObject *)cached;
|
PyFunctionObject *getitem = (PyFunctionObject *)cached;
|
||||||
DEOPT_IF(getitem->func_version != cache->func_version, BINARY_SUBSCR);
|
DEOPT_IF(getitem->func_version != cache->func_version, BINARY_SUBSCR);
|
||||||
PyCodeObject *code = (PyCodeObject *)getitem->func_code;
|
PyCodeObject *code = (PyCodeObject *)getitem->func_code;
|
||||||
size_t size = code->co_nlocalsplus + code->co_stacksize + FRAME_SPECIALS_SIZE;
|
|
||||||
assert(code->co_argcount == 2);
|
assert(code->co_argcount == 2);
|
||||||
_PyInterpreterFrame *new_frame = _PyThreadState_BumpFramePointer(tstate, size);
|
STAT_INC(BINARY_SUBSCR, hit);
|
||||||
|
|
||||||
|
Py_INCREF(getitem);
|
||||||
|
_PyInterpreterFrame *new_frame = _PyFrame_Push(tstate, getitem);
|
||||||
if (new_frame == NULL) {
|
if (new_frame == NULL) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
CALL_STAT_INC(frames_pushed);
|
CALL_STAT_INC(inlined_py_calls);
|
||||||
Py_INCREF(getitem);
|
|
||||||
_PyFrame_InitializeSpecials(new_frame, getitem,
|
|
||||||
NULL, code->co_nlocalsplus);
|
|
||||||
STACK_SHRINK(2);
|
STACK_SHRINK(2);
|
||||||
new_frame->localsplus[0] = container;
|
new_frame->localsplus[0] = container;
|
||||||
new_frame->localsplus[1] = sub;
|
new_frame->localsplus[1] = sub;
|
||||||
|
|
|
@ -1212,7 +1212,8 @@ _Py_Specialize_BinarySubscr(
|
||||||
write_u32(cache->type_version, cls->tp_version_tag);
|
write_u32(cache->type_version, cls->tp_version_tag);
|
||||||
int version = _PyFunction_GetVersionForCurrentState(func);
|
int version = _PyFunction_GetVersionForCurrentState(func);
|
||||||
if (version == 0 || version != (uint16_t)version) {
|
if (version == 0 || version != (uint16_t)version) {
|
||||||
SPECIALIZATION_FAIL(BINARY_SUBSCR, SPEC_FAIL_OUT_OF_VERSIONS);
|
SPECIALIZATION_FAIL(BINARY_SUBSCR, version == 0 ?
|
||||||
|
SPEC_FAIL_OUT_OF_VERSIONS : SPEC_FAIL_OUT_OF_RANGE);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
cache->func_version = version;
|
cache->func_version = version;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue