mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
GH-98831: Auto-generate PREDICTED() macro calls (#99102)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
This commit is contained in:
parent
e99380cc39
commit
c885623e9f
2 changed files with 7 additions and 16 deletions
|
@ -112,7 +112,6 @@ dummy_func(
|
|||
|
||||
// stack effect: ( -- __0)
|
||||
inst(LOAD_CONST) {
|
||||
PREDICTED(LOAD_CONST);
|
||||
PyObject *value = GETITEM(consts, oparg);
|
||||
Py_INCREF(value);
|
||||
PUSH(value);
|
||||
|
@ -431,7 +430,6 @@ dummy_func(
|
|||
|
||||
// stack effect: (__0 -- )
|
||||
inst(BINARY_SUBSCR) {
|
||||
PREDICTED(BINARY_SUBSCR);
|
||||
PyObject *sub = POP();
|
||||
PyObject *container = TOP();
|
||||
PyObject *res = PyObject_GetItem(container, sub);
|
||||
|
@ -631,7 +629,6 @@ dummy_func(
|
|||
|
||||
// stack effect: (__0, __1, __2 -- )
|
||||
inst(STORE_SUBSCR) {
|
||||
PREDICTED(STORE_SUBSCR);
|
||||
PyObject *sub = TOP();
|
||||
PyObject *container = SECOND();
|
||||
PyObject *v = THIRD();
|
||||
|
@ -884,7 +881,6 @@ dummy_func(
|
|||
|
||||
// stack effect: ( -- )
|
||||
inst(GET_AWAITABLE) {
|
||||
PREDICTED(GET_AWAITABLE);
|
||||
PyObject *iterable = TOP();
|
||||
PyObject *iter = _PyCoro_GetAwaitableIter(iterable);
|
||||
|
||||
|
@ -1204,7 +1200,6 @@ dummy_func(
|
|||
|
||||
// stack effect: (__0 -- __array[oparg])
|
||||
inst(UNPACK_SEQUENCE) {
|
||||
PREDICTED(UNPACK_SEQUENCE);
|
||||
PyObject *seq = POP();
|
||||
PyObject **top = stack_pointer + oparg;
|
||||
if (!unpack_iterable(tstate, seq, oparg, -1, top)) {
|
||||
|
@ -1290,7 +1285,6 @@ dummy_func(
|
|||
|
||||
// stack effect: (__0, __1 -- )
|
||||
inst(STORE_ATTR) {
|
||||
PREDICTED(STORE_ATTR);
|
||||
PyObject *name = GETITEM(names, oparg);
|
||||
PyObject *owner = TOP();
|
||||
PyObject *v = SECOND();
|
||||
|
@ -1407,7 +1401,6 @@ dummy_func(
|
|||
|
||||
// error: LOAD_GLOBAL has irregular stack effect
|
||||
inst(LOAD_GLOBAL) {
|
||||
PREDICTED(LOAD_GLOBAL);
|
||||
int push_null = oparg & 1;
|
||||
PEEK(0) = NULL;
|
||||
PyObject *name = GETITEM(names, oparg>>1);
|
||||
|
@ -1871,7 +1864,6 @@ dummy_func(
|
|||
|
||||
// error: LOAD_ATTR has irregular stack effect
|
||||
inst(LOAD_ATTR) {
|
||||
PREDICTED(LOAD_ATTR);
|
||||
PyObject *name = GETITEM(names, oparg >> 1);
|
||||
PyObject *owner = TOP();
|
||||
if (oparg & 1) {
|
||||
|
@ -2276,7 +2268,6 @@ dummy_func(
|
|||
|
||||
// stack effect: (__0 -- )
|
||||
inst(COMPARE_OP) {
|
||||
PREDICTED(COMPARE_OP);
|
||||
assert(oparg <= Py_GE);
|
||||
PyObject *right = POP();
|
||||
PyObject *left = TOP();
|
||||
|
@ -2539,7 +2530,6 @@ dummy_func(
|
|||
|
||||
// stack effect: ( -- )
|
||||
inst(JUMP_BACKWARD) {
|
||||
PREDICTED(JUMP_BACKWARD);
|
||||
assert(oparg < INSTR_OFFSET());
|
||||
JUMPBY(-oparg);
|
||||
CHECK_EVAL_BREAKER();
|
||||
|
@ -2547,7 +2537,6 @@ dummy_func(
|
|||
|
||||
// stack effect: (__0 -- )
|
||||
inst(POP_JUMP_IF_FALSE) {
|
||||
PREDICTED(POP_JUMP_IF_FALSE);
|
||||
PyObject *cond = POP();
|
||||
if (Py_IsTrue(cond)) {
|
||||
_Py_DECREF_NO_DEALLOC(cond);
|
||||
|
@ -2788,7 +2777,6 @@ dummy_func(
|
|||
|
||||
// stack effect: ( -- __0)
|
||||
inst(FOR_ITER) {
|
||||
PREDICTED(FOR_ITER);
|
||||
/* before: [iter]; after: [iter, iter()] *or* [] */
|
||||
PyObject *iter = TOP();
|
||||
PyObject *next = (*Py_TYPE(iter)->tp_iternext)(iter);
|
||||
|
@ -3118,7 +3106,6 @@ dummy_func(
|
|||
|
||||
// stack effect: (__0, __array[oparg] -- )
|
||||
inst(CALL) {
|
||||
PREDICTED(CALL);
|
||||
int total_args, is_meth;
|
||||
is_meth = is_method(stack_pointer, oparg);
|
||||
PyObject *function = PEEK(oparg + 1);
|
||||
|
@ -3216,7 +3203,6 @@ dummy_func(
|
|||
|
||||
// stack effect: (__0, __array[oparg] -- )
|
||||
inst(CALL_PY_EXACT_ARGS) {
|
||||
PREDICTED(CALL_PY_EXACT_ARGS);
|
||||
assert(call_shape.kwnames == NULL);
|
||||
DEOPT_IF(tstate->interp->eval_frame, CALL);
|
||||
_PyCallCache *cache = (_PyCallCache *)next_instr;
|
||||
|
@ -3721,7 +3707,6 @@ dummy_func(
|
|||
|
||||
// error: CALL_FUNCTION_EX has irregular stack effect
|
||||
inst(CALL_FUNCTION_EX) {
|
||||
PREDICTED(CALL_FUNCTION_EX);
|
||||
PyObject *func, *callargs, *kwargs = NULL, *result;
|
||||
if (oparg & 0x01) {
|
||||
kwargs = POP();
|
||||
|
@ -3913,7 +3898,6 @@ dummy_func(
|
|||
|
||||
// stack effect: (__0 -- )
|
||||
inst(BINARY_OP) {
|
||||
PREDICTED(BINARY_OP);
|
||||
PyObject *rhs = POP();
|
||||
PyObject *lhs = TOP();
|
||||
assert(0 <= oparg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue