mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
GH-125837: Split LOAD_CONST
into three. (GH-125972)
* Add LOAD_CONST_IMMORTAL opcode * Add LOAD_SMALL_INT opcode * Remove RETURN_CONST opcode
This commit is contained in:
parent
67f5c5bd6f
commit
faa3272fb8
33 changed files with 706 additions and 538 deletions
|
@ -255,10 +255,26 @@ dummy_func(
|
|||
value2 = PyStackRef_DUP(GETLOCAL(oparg2));
|
||||
}
|
||||
|
||||
family(LOAD_CONST, 0) = {
|
||||
LOAD_CONST_IMMORTAL,
|
||||
};
|
||||
|
||||
pure inst(LOAD_CONST, (-- value)) {
|
||||
value = PyStackRef_FromPyObjectNew(GETITEM(FRAME_CO_CONSTS, oparg));
|
||||
}
|
||||
|
||||
inst(LOAD_CONST_IMMORTAL, (-- value)) {
|
||||
PyObject *obj = GETITEM(FRAME_CO_CONSTS, oparg);
|
||||
assert(_Py_IsImmortal(obj));
|
||||
value = PyStackRef_FromPyObjectImmortal(obj);
|
||||
}
|
||||
|
||||
replicate(4) inst(LOAD_SMALL_INT, (-- value)) {
|
||||
assert(oparg < _PY_NSMALLPOSINTS);
|
||||
PyObject *obj = (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS + oparg];
|
||||
value = PyStackRef_FromPyObjectImmortal(obj);
|
||||
}
|
||||
|
||||
replicate(8) inst(STORE_FAST, (value --)) {
|
||||
SETLOCAL(oparg, value);
|
||||
DEAD(value);
|
||||
|
@ -979,10 +995,9 @@ dummy_func(
|
|||
return result;
|
||||
}
|
||||
|
||||
// The stack effect here is ambiguous.
|
||||
// We definitely pop the return value off the stack on entry.
|
||||
// We also push it onto the stack on exit, but that's a
|
||||
// different frame, and it's accounted for by _PUSH_FRAME.
|
||||
// The stack effect here is a bit misleading.
|
||||
// retval is popped from the stack, but res
|
||||
// is pushed to a different frame, the callers' frame.
|
||||
inst(RETURN_VALUE, (retval -- res)) {
|
||||
#if TIER_ONE
|
||||
assert(frame != &entry_frame);
|
||||
|
@ -1013,15 +1028,6 @@ dummy_func(
|
|||
_RETURN_VALUE_EVENT +
|
||||
RETURN_VALUE;
|
||||
|
||||
macro(RETURN_CONST) =
|
||||
LOAD_CONST +
|
||||
RETURN_VALUE;
|
||||
|
||||
macro(INSTRUMENTED_RETURN_CONST) =
|
||||
LOAD_CONST +
|
||||
_RETURN_VALUE_EVENT +
|
||||
RETURN_VALUE;
|
||||
|
||||
inst(GET_AITER, (obj -- iter)) {
|
||||
unaryfunc getter = NULL;
|
||||
PyObject *obj_o = PyStackRef_AsPyObjectBorrow(obj);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue