mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
bpo-46823: Implement LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE superinstruction (GH-31484)
This commit is contained in:
parent
4fccf91073
commit
a52d2528a4
6 changed files with 91 additions and 4 deletions
|
@ -889,6 +889,16 @@ _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, Sp
|
|||
return -1;
|
||||
}
|
||||
if (err) {
|
||||
if (_Py_OPCODE(instr[0]) == LOAD_ATTR_INSTANCE_VALUE) {
|
||||
// Note: instr[-1] exists because there's something on the stack,
|
||||
// and instr[-2] exists because there's at least a RESUME as well.
|
||||
if (_Py_OPCODE(instr[-1]) == LOAD_FAST) {
|
||||
instr[-1] = _Py_MAKECODEUNIT(LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE, _Py_OPARG(instr[-1]));
|
||||
if (_Py_OPCODE(instr[-2]) == LOAD_FAST__LOAD_FAST) {
|
||||
instr[-2] = _Py_MAKECODEUNIT(LOAD_FAST, _Py_OPARG(instr[-2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
goto success;
|
||||
}
|
||||
fail:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue