summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2023-02-28 16:49:35 (GMT)
committerGitHub <noreply@github.com>2023-02-28 16:49:35 (GMT)
commitb5ff38243355c06d665ba8245d461a0d82504581 (patch)
tree6276cff6f7cd7ee9e79d4ddace9e4b2d27d81a22 /Python
parente1a90ec75cd0f5cab21b467a73404081eaa1077f (diff)
downloadcpython-b5ff38243355c06d665ba8245d461a0d82504581.zip
cpython-b5ff38243355c06d665ba8245d461a0d82504581.tar.gz
cpython-b5ff38243355c06d665ba8245d461a0d82504581.tar.bz2
GH-102305: Expand some macros in generated_cases.c.h (#102309)
* Emit straight stack_pointer[-i] instead of PEEK(i), POKE(i, ...) * Expand JUMPBY() and NEXTOPARG(), and fix a perf bug
Diffstat (limited to 'Python')
-rw-r--r--Python/generated_cases.c.h845
1 files changed, 420 insertions, 425 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 271ba26..f59f7c1 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -22,7 +22,7 @@
if (value == NULL) goto unbound_local_error;
Py_INCREF(value);
STACK_GROW(1);
- POKE(1, value);
+ stack_pointer[-1] = value;
DISPATCH();
}
@@ -32,7 +32,7 @@
if (value == NULL) goto unbound_local_error;
Py_INCREF(value);
STACK_GROW(1);
- POKE(1, value);
+ stack_pointer[-1] = value;
DISPATCH();
}
@@ -42,7 +42,7 @@
assert(value != NULL);
Py_INCREF(value);
STACK_GROW(1);
- POKE(1, value);
+ stack_pointer[-1] = value;
DISPATCH();
}
@@ -52,12 +52,12 @@
value = GETITEM(consts, oparg);
Py_INCREF(value);
STACK_GROW(1);
- POKE(1, value);
+ stack_pointer[-1] = value;
DISPATCH();
}
TARGET(STORE_FAST) {
- PyObject *value = PEEK(1);
+ PyObject *value = stack_pointer[-1];
SETLOCAL(oparg, value);
STACK_SHRINK(1);
DISPATCH();
@@ -73,8 +73,7 @@
Py_INCREF(value);
_tmp_2 = value;
}
- NEXTOPARG();
- JUMPBY(1);
+ oparg = (next_instr++)->op.arg;
{
PyObject *value;
value = GETLOCAL(oparg);
@@ -83,8 +82,8 @@
_tmp_1 = value;
}
STACK_GROW(2);
- POKE(1, _tmp_1);
- POKE(2, _tmp_2);
+ stack_pointer[-1] = _tmp_1;
+ stack_pointer[-2] = _tmp_2;
DISPATCH();
}
@@ -98,8 +97,7 @@
Py_INCREF(value);
_tmp_2 = value;
}
- NEXTOPARG();
- JUMPBY(1);
+ oparg = (next_instr++)->op.arg;
{
PyObject *value;
value = GETITEM(consts, oparg);
@@ -107,19 +105,18 @@
_tmp_1 = value;
}
STACK_GROW(2);
- POKE(1, _tmp_1);
- POKE(2, _tmp_2);
+ stack_pointer[-1] = _tmp_1;
+ stack_pointer[-2] = _tmp_2;
DISPATCH();
}
TARGET(STORE_FAST__LOAD_FAST) {
- PyObject *_tmp_1 = PEEK(1);
+ PyObject *_tmp_1 = stack_pointer[-1];
{
PyObject *value = _tmp_1;
SETLOCAL(oparg, value);
}
- NEXTOPARG();
- JUMPBY(1);
+ oparg = (next_instr++)->op.arg;
{
PyObject *value;
value = GETLOCAL(oparg);
@@ -127,19 +124,18 @@
Py_INCREF(value);
_tmp_1 = value;
}
- POKE(1, _tmp_1);
+ stack_pointer[-1] = _tmp_1;
DISPATCH();
}
TARGET(STORE_FAST__STORE_FAST) {
- PyObject *_tmp_1 = PEEK(1);
- PyObject *_tmp_2 = PEEK(2);
+ PyObject *_tmp_1 = stack_pointer[-1];
+ PyObject *_tmp_2 = stack_pointer[-2];
{
PyObject *value = _tmp_1;
SETLOCAL(oparg, value);
}
- NEXTOPARG();
- JUMPBY(1);
+ oparg = (next_instr++)->op.arg;
{
PyObject *value = _tmp_2;
SETLOCAL(oparg, value);
@@ -157,8 +153,7 @@
Py_INCREF(value);
_tmp_2 = value;
}
- NEXTOPARG();
- JUMPBY(1);
+ oparg = (next_instr++)->op.arg;
{
PyObject *value;
value = GETLOCAL(oparg);
@@ -167,13 +162,13 @@
_tmp_1 = value;
}
STACK_GROW(2);
- POKE(1, _tmp_1);
- POKE(2, _tmp_2);
+ stack_pointer[-1] = _tmp_1;
+ stack_pointer[-2] = _tmp_2;
DISPATCH();
}
TARGET(POP_TOP) {
- PyObject *value = PEEK(1);
+ PyObject *value = stack_pointer[-1];
Py_DECREF(value);
STACK_SHRINK(1);
DISPATCH();
@@ -183,13 +178,13 @@
PyObject *res;
res = NULL;
STACK_GROW(1);
- POKE(1, res);
+ stack_pointer[-1] = res;
DISPATCH();
}
TARGET(END_FOR) {
- PyObject *_tmp_1 = PEEK(1);
- PyObject *_tmp_2 = PEEK(2);
+ PyObject *_tmp_1 = stack_pointer[-1];
+ PyObject *_tmp_2 = stack_pointer[-2];
{
PyObject *value = _tmp_1;
Py_DECREF(value);
@@ -203,17 +198,17 @@
}
TARGET(UNARY_NEGATIVE) {
- PyObject *value = PEEK(1);
+ PyObject *value = stack_pointer[-1];
PyObject *res;
res = PyNumber_Negative(value);
Py_DECREF(value);
if (res == NULL) goto pop_1_error;
- POKE(1, res);
+ stack_pointer[-1] = res;
DISPATCH();
}
TARGET(UNARY_NOT) {
- PyObject *value = PEEK(1);
+ PyObject *value = stack_pointer[-1];
PyObject *res;
int err = PyObject_IsTrue(value);
Py_DECREF(value);
@@ -225,23 +220,23 @@
res = Py_False;
}
Py_INCREF(res);
- POKE(1, res);
+ stack_pointer[-1] = res;
DISPATCH();
}
TARGET(UNARY_INVERT) {
- PyObject *value = PEEK(1);
+ PyObject *value = stack_pointer[-1];
PyObject *res;
res = PyNumber_Invert(value);
Py_DECREF(value);
if (res == NULL) goto pop_1_error;
- POKE(1, res);
+ stack_pointer[-1] = res;
DISPATCH();
}
TARGET(BINARY_OP_MULTIPLY_INT) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
PyObject *prod;
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP);
@@ -252,14 +247,14 @@
_Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free);
if (prod == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, prod);
- JUMPBY(1);
+ stack_pointer[-1] = prod;
+ next_instr += 1;
DISPATCH();
}
TARGET(BINARY_OP_MULTIPLY_FLOAT) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
PyObject *prod;
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP);
@@ -272,14 +267,14 @@
_Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc);
if (prod == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, prod);
- JUMPBY(1);
+ stack_pointer[-1] = prod;
+ next_instr += 1;
DISPATCH();
}
TARGET(BINARY_OP_SUBTRACT_INT) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
PyObject *sub;
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP);
@@ -290,14 +285,14 @@
_Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free);
if (sub == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, sub);
- JUMPBY(1);
+ stack_pointer[-1] = sub;
+ next_instr += 1;
DISPATCH();
}
TARGET(BINARY_OP_SUBTRACT_FLOAT) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
PyObject *sub;
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP);
@@ -309,14 +304,14 @@
_Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc);
if (sub == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, sub);
- JUMPBY(1);
+ stack_pointer[-1] = sub;
+ next_instr += 1;
DISPATCH();
}
TARGET(BINARY_OP_ADD_UNICODE) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
PyObject *res;
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP);
@@ -327,14 +322,14 @@
_Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc);
if (res == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(1);
+ stack_pointer[-1] = res;
+ next_instr += 1;
DISPATCH();
}
TARGET(BINARY_OP_INPLACE_ADD_UNICODE) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP);
DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP);
@@ -367,8 +362,8 @@
}
TARGET(BINARY_OP_ADD_FLOAT) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
PyObject *sum;
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP);
@@ -381,14 +376,14 @@
_Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc);
if (sum == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, sum);
- JUMPBY(1);
+ stack_pointer[-1] = sum;
+ next_instr += 1;
DISPATCH();
}
TARGET(BINARY_OP_ADD_INT) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
PyObject *sum;
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP);
@@ -399,16 +394,16 @@
_Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free);
if (sum == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, sum);
- JUMPBY(1);
+ stack_pointer[-1] = sum;
+ next_instr += 1;
DISPATCH();
}
TARGET(BINARY_SUBSCR) {
PREDICTED(BINARY_SUBSCR);
static_assert(INLINE_CACHE_ENTRIES_BINARY_SUBSCR == 4, "incorrect cache size");
- PyObject *sub = PEEK(1);
- PyObject *container = PEEK(2);
+ PyObject *sub = stack_pointer[-1];
+ PyObject *container = stack_pointer[-2];
PyObject *res;
#if ENABLE_SPECIALIZATION
_PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr;
@@ -426,15 +421,15 @@
Py_DECREF(sub);
if (res == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
DISPATCH();
}
TARGET(BINARY_SLICE) {
- PyObject *stop = PEEK(1);
- PyObject *start = PEEK(2);
- PyObject *container = PEEK(3);
+ PyObject *stop = stack_pointer[-1];
+ PyObject *start = stack_pointer[-2];
+ PyObject *container = stack_pointer[-3];
PyObject *res;
PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop);
// Can't use ERROR_IF() here, because we haven't
@@ -449,15 +444,15 @@
Py_DECREF(container);
if (res == NULL) goto pop_3_error;
STACK_SHRINK(2);
- POKE(1, res);
+ stack_pointer[-1] = res;
DISPATCH();
}
TARGET(STORE_SLICE) {
- PyObject *stop = PEEK(1);
- PyObject *start = PEEK(2);
- PyObject *container = PEEK(3);
- PyObject *v = PEEK(4);
+ PyObject *stop = stack_pointer[-1];
+ PyObject *start = stack_pointer[-2];
+ PyObject *container = stack_pointer[-3];
+ PyObject *v = stack_pointer[-4];
PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop);
int err;
if (slice == NULL) {
@@ -475,8 +470,8 @@
}
TARGET(BINARY_SUBSCR_LIST_INT) {
- PyObject *sub = PEEK(1);
- PyObject *list = PEEK(2);
+ PyObject *sub = stack_pointer[-1];
+ PyObject *list = stack_pointer[-2];
PyObject *res;
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR);
@@ -494,14 +489,14 @@
_Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free);
Py_DECREF(list);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
DISPATCH();
}
TARGET(BINARY_SUBSCR_TUPLE_INT) {
- PyObject *sub = PEEK(1);
- PyObject *tuple = PEEK(2);
+ PyObject *sub = stack_pointer[-1];
+ PyObject *tuple = stack_pointer[-2];
PyObject *res;
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR);
@@ -519,14 +514,14 @@
_Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free);
Py_DECREF(tuple);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
DISPATCH();
}
TARGET(BINARY_SUBSCR_DICT) {
- PyObject *sub = PEEK(1);
- PyObject *dict = PEEK(2);
+ PyObject *sub = stack_pointer[-1];
+ PyObject *dict = stack_pointer[-2];
PyObject *res;
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR);
@@ -544,14 +539,14 @@
Py_DECREF(dict);
Py_DECREF(sub);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
DISPATCH();
}
TARGET(BINARY_SUBSCR_GETITEM) {
- PyObject *sub = PEEK(1);
- PyObject *container = PEEK(2);
+ PyObject *sub = stack_pointer[-1];
+ PyObject *container = stack_pointer[-2];
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t func_version = read_u16(&next_instr[3].cache);
PyTypeObject *tp = Py_TYPE(container);
@@ -575,8 +570,8 @@
}
TARGET(LIST_APPEND) {
- PyObject *v = PEEK(1);
- PyObject *list = PEEK(2 + (oparg-1));
+ PyObject *v = stack_pointer[-1];
+ PyObject *list = stack_pointer[-(2 + (oparg-1))];
if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error;
STACK_SHRINK(1);
PREDICT(JUMP_BACKWARD);
@@ -584,8 +579,8 @@
}
TARGET(SET_ADD) {
- PyObject *v = PEEK(1);
- PyObject *set = PEEK(2 + (oparg-1));
+ PyObject *v = stack_pointer[-1];
+ PyObject *set = stack_pointer[-(2 + (oparg-1))];
int err = PySet_Add(set, v);
Py_DECREF(v);
if (err) goto pop_1_error;
@@ -597,9 +592,9 @@
TARGET(STORE_SUBSCR) {
PREDICTED(STORE_SUBSCR);
static_assert(INLINE_CACHE_ENTRIES_STORE_SUBSCR == 1, "incorrect cache size");
- PyObject *sub = PEEK(1);
- PyObject *container = PEEK(2);
- PyObject *v = PEEK(3);
+ PyObject *sub = stack_pointer[-1];
+ PyObject *container = stack_pointer[-2];
+ PyObject *v = stack_pointer[-3];
uint16_t counter = read_u16(&next_instr[0].cache);
#if ENABLE_SPECIALIZATION
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
@@ -621,14 +616,14 @@
Py_DECREF(sub);
if (err) goto pop_3_error;
STACK_SHRINK(3);
- JUMPBY(1);
+ next_instr += 1;
DISPATCH();
}
TARGET(STORE_SUBSCR_LIST_INT) {
- PyObject *sub = PEEK(1);
- PyObject *list = PEEK(2);
- PyObject *value = PEEK(3);
+ PyObject *sub = stack_pointer[-1];
+ PyObject *list = stack_pointer[-2];
+ PyObject *value = stack_pointer[-3];
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR);
DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR);
@@ -647,14 +642,14 @@
_Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free);
Py_DECREF(list);
STACK_SHRINK(3);
- JUMPBY(1);
+ next_instr += 1;
DISPATCH();
}
TARGET(STORE_SUBSCR_DICT) {
- PyObject *sub = PEEK(1);
- PyObject *dict = PEEK(2);
- PyObject *value = PEEK(3);
+ PyObject *sub = stack_pointer[-1];
+ PyObject *dict = stack_pointer[-2];
+ PyObject *value = stack_pointer[-3];
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR);
STAT_INC(STORE_SUBSCR, hit);
@@ -662,13 +657,13 @@
Py_DECREF(dict);
if (err) goto pop_3_error;
STACK_SHRINK(3);
- JUMPBY(1);
+ next_instr += 1;
DISPATCH();
}
TARGET(DELETE_SUBSCR) {
- PyObject *sub = PEEK(1);
- PyObject *container = PEEK(2);
+ PyObject *sub = stack_pointer[-1];
+ PyObject *container = stack_pointer[-2];
/* del container[sub] */
int err = PyObject_DelItem(container, sub);
Py_DECREF(container);
@@ -679,19 +674,19 @@
}
TARGET(CALL_INTRINSIC_1) {
- PyObject *value = PEEK(1);
+ PyObject *value = stack_pointer[-1];
PyObject *res;
assert(oparg <= MAX_INTRINSIC_1);
res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value);
Py_DECREF(value);
if (res == NULL) goto pop_1_error;
- POKE(1, res);
+ stack_pointer[-1] = res;
DISPATCH();
}
TARGET(CALL_INTRINSIC_2) {
- PyObject *value1 = PEEK(1);
- PyObject *value2 = PEEK(2);
+ PyObject *value1 = stack_pointer[-1];
+ PyObject *value2 = stack_pointer[-2];
PyObject *res;
assert(oparg <= MAX_INTRINSIC_2);
res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1);
@@ -699,12 +694,12 @@
Py_DECREF(value1);
if (res == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, res);
+ stack_pointer[-1] = res;
DISPATCH();
}
TARGET(RAISE_VARARGS) {
- PyObject **args = &PEEK(oparg);
+ PyObject **args = (stack_pointer - oparg);
PyObject *cause = NULL, *exc = NULL;
switch (oparg) {
case 2:
@@ -725,7 +720,7 @@
}
TARGET(INTERPRETER_EXIT) {
- PyObject *retval = PEEK(1);
+ PyObject *retval = stack_pointer[-1];
assert(frame == &entry_frame);
assert(_PyFrame_IsIncomplete(frame));
STACK_SHRINK(1); // Since we're not going to DISPATCH()
@@ -740,7 +735,7 @@
}
TARGET(RETURN_VALUE) {
- PyObject *retval = PEEK(1);
+ PyObject *retval = stack_pointer[-1];
STACK_SHRINK(1);
assert(EMPTY());
_PyFrame_SetStackPointer(frame, stack_pointer);
@@ -774,7 +769,7 @@
}
TARGET(GET_AITER) {
- PyObject *obj = PEEK(1);
+ PyObject *obj = stack_pointer[-1];
PyObject *iter;
unaryfunc getter = NULL;
PyTypeObject *type = Py_TYPE(obj);
@@ -806,12 +801,12 @@
Py_DECREF(iter);
if (true) goto pop_1_error;
}
- POKE(1, iter);
+ stack_pointer[-1] = iter;
DISPATCH();
}
TARGET(GET_ANEXT) {
- PyObject *aiter = PEEK(1);
+ PyObject *aiter = stack_pointer[-1];
PyObject *awaitable;
unaryfunc getter = NULL;
PyObject *next_iter = NULL;
@@ -857,14 +852,14 @@
}
STACK_GROW(1);
- POKE(1, awaitable);
+ stack_pointer[-1] = awaitable;
PREDICT(LOAD_CONST);
DISPATCH();
}
TARGET(GET_AWAITABLE) {
PREDICTED(GET_AWAITABLE);
- PyObject *iterable = PEEK(1);
+ PyObject *iterable = stack_pointer[-1];
PyObject *iter;
iter = _PyCoro_GetAwaitableIter(iterable);
@@ -890,15 +885,15 @@
if (iter == NULL) goto pop_1_error;
- POKE(1, iter);
+ stack_pointer[-1] = iter;
PREDICT(LOAD_CONST);
DISPATCH();
}
TARGET(SEND) {
PREDICTED(SEND);
- PyObject *v = PEEK(1);
- PyObject *receiver = PEEK(2);
+ PyObject *v = stack_pointer[-1];
+ PyObject *receiver = stack_pointer[-2];
PyObject *retval;
#if ENABLE_SPECIALIZATION
_PySendCache *cache = (_PySendCache *)next_instr;
@@ -935,14 +930,14 @@
assert(retval != NULL);
}
Py_DECREF(v);
- POKE(1, retval);
- JUMPBY(1);
+ stack_pointer[-1] = retval;
+ next_instr += 1;
DISPATCH();
}
TARGET(SEND_GEN) {
- PyObject *v = PEEK(1);
- PyObject *receiver = PEEK(2);
+ PyObject *v = stack_pointer[-1];
+ PyObject *receiver = stack_pointer[-2];
assert(cframe.use_tracing == 0);
PyGenObject *gen = (PyGenObject *)receiver;
DEOPT_IF(Py_TYPE(gen) != &PyGen_Type &&
@@ -961,7 +956,7 @@
}
TARGET(YIELD_VALUE) {
- PyObject *retval = PEEK(1);
+ PyObject *retval = stack_pointer[-1];
// NOTE: It's important that YIELD_VALUE never raises an exception!
// The compiler treats any exception raised here as a failed close()
// or throw() call.
@@ -983,7 +978,7 @@
}
TARGET(POP_EXCEPT) {
- PyObject *exc_value = PEEK(1);
+ PyObject *exc_value = stack_pointer[-1];
_PyErr_StackItem *exc_info = tstate->exc_info;
Py_XSETREF(exc_info->exc_value, exc_value);
STACK_SHRINK(1);
@@ -991,8 +986,8 @@
}
TARGET(RERAISE) {
- PyObject *exc = PEEK(1);
- PyObject **values = &PEEK(1 + oparg);
+ PyObject *exc = stack_pointer[-1];
+ PyObject **values = (stack_pointer - (1 + oparg));
assert(oparg >= 0 && oparg <= 2);
if (oparg) {
PyObject *lasti = values[0];
@@ -1015,8 +1010,8 @@
}
TARGET(END_ASYNC_FOR) {
- PyObject *exc = PEEK(1);
- PyObject *awaitable = PEEK(2);
+ PyObject *exc = stack_pointer[-1];
+ PyObject *awaitable = stack_pointer[-2];
assert(exc && PyExceptionInstance_Check(exc));
if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) {
Py_DECREF(awaitable);
@@ -1034,9 +1029,9 @@
}
TARGET(CLEANUP_THROW) {
- PyObject *exc_value = PEEK(1);
- PyObject *last_sent_val = PEEK(2);
- PyObject *sub_iter = PEEK(3);
+ PyObject *exc_value = stack_pointer[-1];
+ PyObject *last_sent_val = stack_pointer[-2];
+ PyObject *sub_iter = stack_pointer[-3];
PyObject *none;
PyObject *value;
assert(throwflag);
@@ -1053,8 +1048,8 @@
goto exception_unwind;
}
STACK_SHRINK(1);
- POKE(1, value);
- POKE(2, none);
+ stack_pointer[-1] = value;
+ stack_pointer[-2] = none;
DISPATCH();
}
@@ -1062,7 +1057,7 @@
PyObject *value;
value = Py_NewRef(PyExc_AssertionError);
STACK_GROW(1);
- POKE(1, value);
+ stack_pointer[-1] = value;
DISPATCH();
}
@@ -1090,12 +1085,12 @@
}
}
STACK_GROW(1);
- POKE(1, bc);
+ stack_pointer[-1] = bc;
DISPATCH();
}
TARGET(STORE_NAME) {
- PyObject *v = PEEK(1);
+ PyObject *v = stack_pointer[-1];
PyObject *name = GETITEM(names, oparg);
PyObject *ns = LOCALS();
int err;
@@ -1138,7 +1133,7 @@
TARGET(UNPACK_SEQUENCE) {
PREDICTED(UNPACK_SEQUENCE);
static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size");
- PyObject *seq = PEEK(1);
+ PyObject *seq = stack_pointer[-1];
#if ENABLE_SPECIALIZATION
_PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -1156,12 +1151,12 @@
if (res == 0) goto pop_1_error;
STACK_SHRINK(1);
STACK_GROW(oparg);
- JUMPBY(1);
+ next_instr += 1;
DISPATCH();
}
TARGET(UNPACK_SEQUENCE_TWO_TUPLE) {
- PyObject *seq = PEEK(1);
+ PyObject *seq = stack_pointer[-1];
PyObject **values = stack_pointer - (1);
DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE);
DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE);
@@ -1172,12 +1167,12 @@
Py_DECREF(seq);
STACK_SHRINK(1);
STACK_GROW(oparg);
- JUMPBY(1);
+ next_instr += 1;
DISPATCH();
}
TARGET(UNPACK_SEQUENCE_TUPLE) {
- PyObject *seq = PEEK(1);
+ PyObject *seq = stack_pointer[-1];
PyObject **values = stack_pointer - (1);
DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE);
DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE);
@@ -1189,12 +1184,12 @@
Py_DECREF(seq);
STACK_SHRINK(1);
STACK_GROW(oparg);
- JUMPBY(1);
+ next_instr += 1;
DISPATCH();
}
TARGET(UNPACK_SEQUENCE_LIST) {
- PyObject *seq = PEEK(1);
+ PyObject *seq = stack_pointer[-1];
PyObject **values = stack_pointer - (1);
DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE);
DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE);
@@ -1206,12 +1201,12 @@
Py_DECREF(seq);
STACK_SHRINK(1);
STACK_GROW(oparg);
- JUMPBY(1);
+ next_instr += 1;
DISPATCH();
}
TARGET(UNPACK_EX) {
- PyObject *seq = PEEK(1);
+ PyObject *seq = stack_pointer[-1];
int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8);
PyObject **top = stack_pointer + totalargs - 1;
int res = unpack_iterable(tstate, seq, oparg & 0xFF, oparg >> 8, top);
@@ -1224,8 +1219,8 @@
TARGET(STORE_ATTR) {
PREDICTED(STORE_ATTR);
static_assert(INLINE_CACHE_ENTRIES_STORE_ATTR == 4, "incorrect cache size");
- PyObject *owner = PEEK(1);
- PyObject *v = PEEK(2);
+ PyObject *owner = stack_pointer[-1];
+ PyObject *v = stack_pointer[-2];
uint16_t counter = read_u16(&next_instr[0].cache);
#if ENABLE_SPECIALIZATION
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
@@ -1247,12 +1242,12 @@
Py_DECREF(owner);
if (err) goto pop_2_error;
STACK_SHRINK(2);
- JUMPBY(4);
+ next_instr += 4;
DISPATCH();
}
TARGET(DELETE_ATTR) {
- PyObject *owner = PEEK(1);
+ PyObject *owner = stack_pointer[-1];
PyObject *name = GETITEM(names, oparg);
int err = PyObject_SetAttr(owner, name, (PyObject *)NULL);
Py_DECREF(owner);
@@ -1262,7 +1257,7 @@
}
TARGET(STORE_GLOBAL) {
- PyObject *v = PEEK(1);
+ PyObject *v = stack_pointer[-1];
PyObject *name = GETITEM(names, oparg);
int err = PyDict_SetItem(GLOBALS(), name, v);
Py_DECREF(v);
@@ -1347,7 +1342,7 @@
}
}
STACK_GROW(1);
- POKE(1, v);
+ stack_pointer[-1] = v;
DISPATCH();
}
@@ -1410,9 +1405,9 @@
null = NULL;
STACK_GROW(1);
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, v);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), null); }
- JUMPBY(5);
+ stack_pointer[-1] = v;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = null; }
+ next_instr += 5;
DISPATCH();
}
@@ -1434,9 +1429,9 @@
null = NULL;
STACK_GROW(1);
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, res);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), null); }
- JUMPBY(5);
+ stack_pointer[-1] = res;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = null; }
+ next_instr += 5;
DISPATCH();
}
@@ -1462,9 +1457,9 @@
null = NULL;
STACK_GROW(1);
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, res);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), null); }
- JUMPBY(5);
+ stack_pointer[-1] = res;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = null; }
+ next_instr += 5;
DISPATCH();
}
@@ -1535,7 +1530,7 @@
Py_INCREF(value);
}
STACK_GROW(1);
- POKE(1, value);
+ stack_pointer[-1] = value;
DISPATCH();
}
@@ -1549,12 +1544,12 @@
}
Py_INCREF(value);
STACK_GROW(1);
- POKE(1, value);
+ stack_pointer[-1] = value;
DISPATCH();
}
TARGET(STORE_DEREF) {
- PyObject *v = PEEK(1);
+ PyObject *v = stack_pointer[-1];
PyObject *cell = GETLOCAL(oparg);
PyObject *oldobj = PyCell_GET(cell);
PyCell_SET(cell, v);
@@ -1578,7 +1573,7 @@
}
TARGET(BUILD_STRING) {
- PyObject **pieces = &PEEK(oparg);
+ PyObject **pieces = (stack_pointer - oparg);
PyObject *str;
str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg);
for (int i = 0; i < oparg; i++) {
@@ -1587,35 +1582,35 @@
if (str == NULL) { STACK_SHRINK(oparg); goto error; }
STACK_SHRINK(oparg);
STACK_GROW(1);
- POKE(1, str);
+ stack_pointer[-1] = str;
DISPATCH();
}
TARGET(BUILD_TUPLE) {
- PyObject **values = &PEEK(oparg);
+ PyObject **values = (stack_pointer - oparg);
PyObject *tup;
tup = _PyTuple_FromArraySteal(values, oparg);
if (tup == NULL) { STACK_SHRINK(oparg); goto error; }
STACK_SHRINK(oparg);
STACK_GROW(1);
- POKE(1, tup);
+ stack_pointer[-1] = tup;
DISPATCH();
}
TARGET(BUILD_LIST) {
- PyObject **values = &PEEK(oparg);
+ PyObject **values = (stack_pointer - oparg);
PyObject *list;
list = _PyList_FromArraySteal(values, oparg);
if (list == NULL) { STACK_SHRINK(oparg); goto error; }
STACK_SHRINK(oparg);
STACK_GROW(1);
- POKE(1, list);
+ stack_pointer[-1] = list;
DISPATCH();
}
TARGET(LIST_EXTEND) {
- PyObject *iterable = PEEK(1);
- PyObject *list = PEEK(2 + (oparg-1));
+ PyObject *iterable = stack_pointer[-1];
+ PyObject *list = stack_pointer[-(2 + (oparg-1))];
PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable);
if (none_val == NULL) {
if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) &&
@@ -1636,8 +1631,8 @@
}
TARGET(SET_UPDATE) {
- PyObject *iterable = PEEK(1);
- PyObject *set = PEEK(2 + (oparg-1));
+ PyObject *iterable = stack_pointer[-1];
+ PyObject *set = stack_pointer[-(2 + (oparg-1))];
int err = _PySet_Update(set, iterable);
Py_DECREF(iterable);
if (err < 0) goto pop_1_error;
@@ -1646,7 +1641,7 @@
}
TARGET(BUILD_SET) {
- PyObject **values = &PEEK(oparg);
+ PyObject **values = (stack_pointer - oparg);
PyObject *set;
set = PySet_New(NULL);
if (set == NULL)
@@ -1664,12 +1659,12 @@
}
STACK_SHRINK(oparg);
STACK_GROW(1);
- POKE(1, set);
+ stack_pointer[-1] = set;
DISPATCH();
}
TARGET(BUILD_MAP) {
- PyObject **values = &PEEK(oparg*2);
+ PyObject **values = (stack_pointer - oparg*2);
PyObject *map;
map = _PyDict_FromItems(
values, 2,
@@ -1685,7 +1680,7 @@
if (map == NULL) { STACK_SHRINK(oparg*2); goto error; }
STACK_SHRINK(oparg*2);
STACK_GROW(1);
- POKE(1, map);
+ stack_pointer[-1] = map;
DISPATCH();
}
@@ -1733,8 +1728,8 @@
}
TARGET(BUILD_CONST_KEY_MAP) {
- PyObject *keys = PEEK(1);
- PyObject **values = &PEEK(1 + oparg);
+ PyObject *keys = stack_pointer[-1];
+ PyObject **values = (stack_pointer - (1 + oparg));
PyObject *map;
if (!PyTuple_CheckExact(keys) ||
PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) {
@@ -1751,12 +1746,12 @@
}
if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; }
STACK_SHRINK(oparg);
- POKE(1, map);
+ stack_pointer[-1] = map;
DISPATCH();
}
TARGET(DICT_UPDATE) {
- PyObject *update = PEEK(1);
+ PyObject *update = stack_pointer[-1];
PyObject *dict = PEEK(oparg + 1); // update is still on the stack
if (PyDict_Update(dict, update) < 0) {
if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) {
@@ -1773,7 +1768,7 @@
}
TARGET(DICT_MERGE) {
- PyObject *update = PEEK(1);
+ PyObject *update = stack_pointer[-1];
PyObject *dict = PEEK(oparg + 1); // update is still on the stack
if (_PyDict_MergeEx(dict, update, 2) < 0) {
@@ -1788,8 +1783,8 @@
}
TARGET(MAP_ADD) {
- PyObject *value = PEEK(1);
- PyObject *key = PEEK(2);
+ PyObject *value = stack_pointer[-1];
+ PyObject *key = stack_pointer[-2];
PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack
assert(PyDict_CheckExact(dict));
/* dict[key] = value */
@@ -1803,7 +1798,7 @@
TARGET(LOAD_ATTR) {
PREDICTED(LOAD_ATTR);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
- PyObject *owner = PEEK(1);
+ PyObject *owner = stack_pointer[-1];
PyObject *res2 = NULL;
PyObject *res;
#if ENABLE_SPECIALIZATION
@@ -1853,14 +1848,14 @@
if (res == NULL) goto pop_1_error;
}
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, res);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), res2); }
- JUMPBY(9);
+ stack_pointer[-1] = res;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ next_instr += 9;
DISPATCH();
}
TARGET(LOAD_ATTR_INSTANCE_VALUE) {
- PyObject *owner = PEEK(1);
+ PyObject *owner = stack_pointer[-1];
PyObject *res2 = NULL;
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
@@ -1880,14 +1875,14 @@
res2 = NULL;
Py_DECREF(owner);
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, res);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), res2); }
- JUMPBY(9);
+ stack_pointer[-1] = res;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ next_instr += 9;
DISPATCH();
}
TARGET(LOAD_ATTR_MODULE) {
- PyObject *owner = PEEK(1);
+ PyObject *owner = stack_pointer[-1];
PyObject *res2 = NULL;
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
@@ -1907,14 +1902,14 @@
res2 = NULL;
Py_DECREF(owner);
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, res);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), res2); }
- JUMPBY(9);
+ stack_pointer[-1] = res;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ next_instr += 9;
DISPATCH();
}
TARGET(LOAD_ATTR_WITH_HINT) {
- PyObject *owner = PEEK(1);
+ PyObject *owner = stack_pointer[-1];
PyObject *res2 = NULL;
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
@@ -1948,14 +1943,14 @@
res2 = NULL;
Py_DECREF(owner);
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, res);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), res2); }
- JUMPBY(9);
+ stack_pointer[-1] = res;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ next_instr += 9;
DISPATCH();
}
TARGET(LOAD_ATTR_SLOT) {
- PyObject *owner = PEEK(1);
+ PyObject *owner = stack_pointer[-1];
PyObject *res2 = NULL;
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
@@ -1972,14 +1967,14 @@
res2 = NULL;
Py_DECREF(owner);
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, res);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), res2); }
- JUMPBY(9);
+ stack_pointer[-1] = res;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ next_instr += 9;
DISPATCH();
}
TARGET(LOAD_ATTR_CLASS) {
- PyObject *cls = PEEK(1);
+ PyObject *cls = stack_pointer[-1];
PyObject *res2 = NULL;
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
@@ -1998,14 +1993,14 @@
Py_INCREF(res);
Py_DECREF(cls);
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, res);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), res2); }
- JUMPBY(9);
+ stack_pointer[-1] = res;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ next_instr += 9;
DISPATCH();
}
TARGET(LOAD_ATTR_PROPERTY) {
- PyObject *owner = PEEK(1);
+ PyObject *owner = stack_pointer[-1];
uint32_t type_version = read_u32(&next_instr[1].cache);
uint32_t func_version = read_u32(&next_instr[3].cache);
PyObject *fget = read_obj(&next_instr[5].cache);
@@ -2035,7 +2030,7 @@
}
TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) {
- PyObject *owner = PEEK(1);
+ PyObject *owner = stack_pointer[-1];
uint32_t type_version = read_u32(&next_instr[1].cache);
uint32_t func_version = read_u32(&next_instr[3].cache);
PyObject *getattribute = read_obj(&next_instr[5].cache);
@@ -2067,8 +2062,8 @@
}
TARGET(STORE_ATTR_INSTANCE_VALUE) {
- PyObject *owner = PEEK(1);
- PyObject *value = PEEK(2);
+ PyObject *owner = stack_pointer[-1];
+ PyObject *value = stack_pointer[-2];
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t index = read_u16(&next_instr[3].cache);
assert(cframe.use_tracing == 0);
@@ -2090,13 +2085,13 @@
}
Py_DECREF(owner);
STACK_SHRINK(2);
- JUMPBY(4);
+ next_instr += 4;
DISPATCH();
}
TARGET(STORE_ATTR_WITH_HINT) {
- PyObject *owner = PEEK(1);
- PyObject *value = PEEK(2);
+ PyObject *owner = stack_pointer[-1];
+ PyObject *value = stack_pointer[-2];
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t hint = read_u16(&next_instr[3].cache);
assert(cframe.use_tracing == 0);
@@ -2139,13 +2134,13 @@
dict->ma_version_tag = new_version;
Py_DECREF(owner);
STACK_SHRINK(2);
- JUMPBY(4);
+ next_instr += 4;
DISPATCH();
}
TARGET(STORE_ATTR_SLOT) {
- PyObject *owner = PEEK(1);
- PyObject *value = PEEK(2);
+ PyObject *owner = stack_pointer[-1];
+ PyObject *value = stack_pointer[-2];
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t index = read_u16(&next_instr[3].cache);
assert(cframe.use_tracing == 0);
@@ -2159,13 +2154,13 @@
Py_XDECREF(old_value);
Py_DECREF(owner);
STACK_SHRINK(2);
- JUMPBY(4);
+ next_instr += 4;
DISPATCH();
}
TARGET(COMPARE_OP) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
PyObject *res;
STAT_INC(COMPARE_OP, deferred);
assert((oparg >> 4) <= Py_GE);
@@ -2174,15 +2169,15 @@
Py_DECREF(right);
if (res == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(1);
+ stack_pointer[-1] = res;
+ next_instr += 1;
DISPATCH();
}
TARGET(COMPARE_AND_BRANCH) {
PREDICTED(COMPARE_AND_BRANCH);
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
#if ENABLE_SPECIALIZATION
_PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -2210,13 +2205,13 @@
JUMPBY(offset);
}
STACK_SHRINK(2);
- JUMPBY(2);
+ next_instr += 2;
DISPATCH();
}
TARGET(COMPARE_AND_BRANCH_FLOAT) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_AND_BRANCH);
DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_AND_BRANCH);
@@ -2232,13 +2227,13 @@
JUMPBY(offset);
}
STACK_SHRINK(2);
- JUMPBY(2);
+ next_instr += 2;
DISPATCH();
}
TARGET(COMPARE_AND_BRANCH_INT) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyLong_CheckExact(left), COMPARE_AND_BRANCH);
DEOPT_IF(!PyLong_CheckExact(right), COMPARE_AND_BRANCH);
@@ -2257,13 +2252,13 @@
JUMPBY(offset);
}
STACK_SHRINK(2);
- JUMPBY(2);
+ next_instr += 2;
DISPATCH();
}
TARGET(COMPARE_AND_BRANCH_STR) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_AND_BRANCH);
DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_AND_BRANCH);
@@ -2280,26 +2275,26 @@
JUMPBY(offset);
}
STACK_SHRINK(2);
- JUMPBY(2);
+ next_instr += 2;
DISPATCH();
}
TARGET(IS_OP) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
PyObject *b;
int res = Py_Is(left, right) ^ oparg;
Py_DECREF(left);
Py_DECREF(right);
b = Py_NewRef(res ? Py_True : Py_False);
STACK_SHRINK(1);
- POKE(1, b);
+ stack_pointer[-1] = b;
DISPATCH();
}
TARGET(CONTAINS_OP) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
PyObject *b;
int res = PySequence_Contains(right, left);
Py_DECREF(left);
@@ -2307,13 +2302,13 @@
if (res < 0) goto pop_2_error;
b = Py_NewRef((res^oparg) ? Py_True : Py_False);
STACK_SHRINK(1);
- POKE(1, b);
+ stack_pointer[-1] = b;
DISPATCH();
}
TARGET(CHECK_EG_MATCH) {
- PyObject *match_type = PEEK(1);
- PyObject *exc_value = PEEK(2);
+ PyObject *match_type = stack_pointer[-1];
+ PyObject *exc_value = stack_pointer[-2];
PyObject *rest;
PyObject *match;
if (check_except_star_type_valid(tstate, match_type) < 0) {
@@ -2336,14 +2331,14 @@
if (!Py_IsNone(match)) {
PyErr_SetExcInfo(NULL, Py_NewRef(match), NULL);
}
- POKE(1, match);
- POKE(2, rest);
+ stack_pointer[-1] = match;
+ stack_pointer[-2] = rest;
DISPATCH();
}
TARGET(CHECK_EXC_MATCH) {
- PyObject *right = PEEK(1);
- PyObject *left = PEEK(2);
+ PyObject *right = stack_pointer[-1];
+ PyObject *left = stack_pointer[-2];
PyObject *b;
assert(PyExceptionInstance_Check(left));
if (check_except_type_valid(tstate, right) < 0) {
@@ -2354,13 +2349,13 @@
int res = PyErr_GivenExceptionMatches(left, right);
Py_DECREF(right);
b = Py_NewRef(res ? Py_True : Py_False);
- POKE(1, b);
+ stack_pointer[-1] = b;
DISPATCH();
}
TARGET(IMPORT_NAME) {
- PyObject *fromlist = PEEK(1);
- PyObject *level = PEEK(2);
+ PyObject *fromlist = stack_pointer[-1];
+ PyObject *level = stack_pointer[-2];
PyObject *res;
PyObject *name = GETITEM(names, oparg);
res = import_name(tstate, frame, name, fromlist, level);
@@ -2368,18 +2363,18 @@
Py_DECREF(fromlist);
if (res == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, res);
+ stack_pointer[-1] = res;
DISPATCH();
}
TARGET(IMPORT_FROM) {
- PyObject *from = PEEK(1);
+ PyObject *from = stack_pointer[-1];
PyObject *res;
PyObject *name = GETITEM(names, oparg);
res = import_from(tstate, from, name);
if (res == NULL) goto error;
STACK_GROW(1);
- POKE(1, res);
+ stack_pointer[-1] = res;
DISPATCH();
}
@@ -2398,7 +2393,7 @@
TARGET(POP_JUMP_IF_FALSE) {
PREDICTED(POP_JUMP_IF_FALSE);
- PyObject *cond = PEEK(1);
+ PyObject *cond = stack_pointer[-1];
if (Py_IsTrue(cond)) {
_Py_DECREF_NO_DEALLOC(cond);
}
@@ -2421,7 +2416,7 @@
}
TARGET(POP_JUMP_IF_TRUE) {
- PyObject *cond = PEEK(1);
+ PyObject *cond = stack_pointer[-1];
if (Py_IsFalse(cond)) {
_Py_DECREF_NO_DEALLOC(cond);
}
@@ -2444,7 +2439,7 @@
}
TARGET(POP_JUMP_IF_NOT_NONE) {
- PyObject *value = PEEK(1);
+ PyObject *value = stack_pointer[-1];
if (!Py_IsNone(value)) {
Py_DECREF(value);
JUMPBY(oparg);
@@ -2457,7 +2452,7 @@
}
TARGET(POP_JUMP_IF_NONE) {
- PyObject *value = PEEK(1);
+ PyObject *value = stack_pointer[-1];
if (Py_IsNone(value)) {
_Py_DECREF_NO_DEALLOC(value);
JUMPBY(oparg);
@@ -2470,7 +2465,7 @@
}
TARGET(JUMP_IF_FALSE_OR_POP) {
- PyObject *cond = PEEK(1);
+ PyObject *cond = stack_pointer[-1];
bool jump = false;
int err;
if (Py_IsTrue(cond)) {
@@ -2499,7 +2494,7 @@
}
TARGET(JUMP_IF_TRUE_OR_POP) {
- PyObject *cond = PEEK(1);
+ PyObject *cond = stack_pointer[-1];
bool jump = false;
int err;
if (Py_IsFalse(cond)) {
@@ -2538,7 +2533,7 @@
}
TARGET(GET_LEN) {
- PyObject *obj = PEEK(1);
+ PyObject *obj = stack_pointer[-1];
PyObject *len_o;
// PUSH(len(TOS))
Py_ssize_t len_i = PyObject_Length(obj);
@@ -2546,14 +2541,14 @@
len_o = PyLong_FromSsize_t(len_i);
if (len_o == NULL) goto error;
STACK_GROW(1);
- POKE(1, len_o);
+ stack_pointer[-1] = len_o;
DISPATCH();
}
TARGET(MATCH_CLASS) {
- PyObject *names = PEEK(1);
- PyObject *type = PEEK(2);
- PyObject *subject = PEEK(3);
+ PyObject *names = stack_pointer[-1];
+ PyObject *type = stack_pointer[-2];
+ PyObject *subject = stack_pointer[-3];
PyObject *attrs;
// Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or
// None on failure.
@@ -2570,57 +2565,57 @@
attrs = Py_NewRef(Py_None); // Failure!
}
STACK_SHRINK(2);
- POKE(1, attrs);
+ stack_pointer[-1] = attrs;
DISPATCH();
}
TARGET(MATCH_MAPPING) {
- PyObject *subject = PEEK(1);
+ PyObject *subject = stack_pointer[-1];
PyObject *res;
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING;
res = Py_NewRef(match ? Py_True : Py_False);
STACK_GROW(1);
- POKE(1, res);
+ stack_pointer[-1] = res;
PREDICT(POP_JUMP_IF_FALSE);
DISPATCH();
}
TARGET(MATCH_SEQUENCE) {
- PyObject *subject = PEEK(1);
+ PyObject *subject = stack_pointer[-1];
PyObject *res;
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE;
res = Py_NewRef(match ? Py_True : Py_False);
STACK_GROW(1);
- POKE(1, res);
+ stack_pointer[-1] = res;
PREDICT(POP_JUMP_IF_FALSE);
DISPATCH();
}
TARGET(MATCH_KEYS) {
- PyObject *keys = PEEK(1);
- PyObject *subject = PEEK(2);
+ PyObject *keys = stack_pointer[-1];
+ PyObject *subject = stack_pointer[-2];
PyObject *values_or_none;
// On successful match, PUSH(values). Otherwise, PUSH(None).
values_or_none = match_keys(tstate, subject, keys);
if (values_or_none == NULL) goto error;
STACK_GROW(1);
- POKE(1, values_or_none);
+ stack_pointer[-1] = values_or_none;
DISPATCH();
}
TARGET(GET_ITER) {
- PyObject *iterable = PEEK(1);
+ PyObject *iterable = stack_pointer[-1];
PyObject *iter;
/* before: [obj]; after [getiter(obj)] */
iter = PyObject_GetIter(iterable);
Py_DECREF(iterable);
if (iter == NULL) goto pop_1_error;
- POKE(1, iter);
+ stack_pointer[-1] = iter;
DISPATCH();
}
TARGET(GET_YIELD_FROM_ITER) {
- PyObject *iterable = PEEK(1);
+ PyObject *iterable = stack_pointer[-1];
PyObject *iter;
/* before: [obj]; after [getiter(obj)] */
if (PyCoro_CheckExact(iterable)) {
@@ -2646,7 +2641,7 @@
}
Py_DECREF(iterable);
}
- POKE(1, iter);
+ stack_pointer[-1] = iter;
PREDICT(LOAD_CONST);
DISPATCH();
}
@@ -2654,7 +2649,7 @@
TARGET(FOR_ITER) {
PREDICTED(FOR_ITER);
static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size");
- PyObject *iter = PEEK(1);
+ PyObject *iter = stack_pointer[-1];
PyObject *next;
#if ENABLE_SPECIALIZATION
_PyForIterCache *cache = (_PyForIterCache *)next_instr;
@@ -2689,13 +2684,13 @@
}
// Common case: no jump, leave it to the code generator
STACK_GROW(1);
- POKE(1, next);
- JUMPBY(1);
+ stack_pointer[-1] = next;
+ next_instr += 1;
DISPATCH();
}
TARGET(FOR_ITER_LIST) {
- PyObject *iter = PEEK(1);
+ PyObject *iter = stack_pointer[-1];
PyObject *next;
assert(cframe.use_tracing == 0);
DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER);
@@ -2718,13 +2713,13 @@
end_for_iter_list:
// Common case: no jump, leave it to the code generator
STACK_GROW(1);
- POKE(1, next);
- JUMPBY(1);
+ stack_pointer[-1] = next;
+ next_instr += 1;
DISPATCH();
}
TARGET(FOR_ITER_TUPLE) {
- PyObject *iter = PEEK(1);
+ PyObject *iter = stack_pointer[-1];
PyObject *next;
assert(cframe.use_tracing == 0);
_PyTupleIterObject *it = (_PyTupleIterObject *)iter;
@@ -2747,13 +2742,13 @@
end_for_iter_tuple:
// Common case: no jump, leave it to the code generator
STACK_GROW(1);
- POKE(1, next);
- JUMPBY(1);
+ stack_pointer[-1] = next;
+ next_instr += 1;
DISPATCH();
}
TARGET(FOR_ITER_RANGE) {
- PyObject *iter = PEEK(1);
+ PyObject *iter = stack_pointer[-1];
PyObject *next;
assert(cframe.use_tracing == 0);
_PyRangeIterObject *r = (_PyRangeIterObject *)iter;
@@ -2774,13 +2769,13 @@
goto error;
}
STACK_GROW(1);
- POKE(1, next);
- JUMPBY(1);
+ stack_pointer[-1] = next;
+ next_instr += 1;
DISPATCH();
}
TARGET(FOR_ITER_GEN) {
- PyObject *iter = PEEK(1);
+ PyObject *iter = stack_pointer[-1];
assert(cframe.use_tracing == 0);
PyGenObject *gen = (PyGenObject *)iter;
DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER);
@@ -2798,7 +2793,7 @@
}
TARGET(BEFORE_ASYNC_WITH) {
- PyObject *mgr = PEEK(1);
+ PyObject *mgr = stack_pointer[-1];
PyObject *exit;
PyObject *res;
PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__));
@@ -2831,14 +2826,14 @@
if (true) goto pop_1_error;
}
STACK_GROW(1);
- POKE(1, res);
- POKE(2, exit);
+ stack_pointer[-1] = res;
+ stack_pointer[-2] = exit;
PREDICT(GET_AWAITABLE);
DISPATCH();
}
TARGET(BEFORE_WITH) {
- PyObject *mgr = PEEK(1);
+ PyObject *mgr = stack_pointer[-1];
PyObject *exit;
PyObject *res;
/* pop the context manager, push its __exit__ and the
@@ -2874,15 +2869,15 @@
if (true) goto pop_1_error;
}
STACK_GROW(1);
- POKE(1, res);
- POKE(2, exit);
+ stack_pointer[-1] = res;
+ stack_pointer[-2] = exit;
DISPATCH();
}
TARGET(WITH_EXCEPT_START) {
- PyObject *val = PEEK(1);
- PyObject *lasti = PEEK(3);
- PyObject *exit_func = PEEK(4);
+ PyObject *val = stack_pointer[-1];
+ PyObject *lasti = stack_pointer[-3];
+ PyObject *exit_func = stack_pointer[-4];
PyObject *res;
/* At the top of the stack are 4 values:
- val: TOP = exc_info()
@@ -2905,12 +2900,12 @@
3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
if (res == NULL) goto error;
STACK_GROW(1);
- POKE(1, res);
+ stack_pointer[-1] = res;
DISPATCH();
}
TARGET(PUSH_EXC_INFO) {
- PyObject *new_exc = PEEK(1);
+ PyObject *new_exc = stack_pointer[-1];
PyObject *prev_exc;
_PyErr_StackItem *exc_info = tstate->exc_info;
if (exc_info->exc_value != NULL) {
@@ -2922,13 +2917,13 @@
assert(PyExceptionInstance_Check(new_exc));
exc_info->exc_value = Py_NewRef(new_exc);
STACK_GROW(1);
- POKE(1, new_exc);
- POKE(2, prev_exc);
+ stack_pointer[-1] = new_exc;
+ stack_pointer[-2] = prev_exc;
DISPATCH();
}
TARGET(LOAD_ATTR_METHOD_WITH_VALUES) {
- PyObject *self = PEEK(1);
+ PyObject *self = stack_pointer[-1];
PyObject *res2 = NULL;
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
@@ -2952,14 +2947,14 @@
res = self;
assert(oparg & 1);
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, res);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), res2); }
- JUMPBY(9);
+ stack_pointer[-1] = res;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ next_instr += 9;
DISPATCH();
}
TARGET(LOAD_ATTR_METHOD_NO_DICT) {
- PyObject *self = PEEK(1);
+ PyObject *self = stack_pointer[-1];
PyObject *res2 = NULL;
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
@@ -2975,14 +2970,14 @@
res = self;
assert(oparg & 1);
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, res);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), res2); }
- JUMPBY(9);
+ stack_pointer[-1] = res;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ next_instr += 9;
DISPATCH();
}
TARGET(LOAD_ATTR_METHOD_LAZY_DICT) {
- PyObject *self = PEEK(1);
+ PyObject *self = stack_pointer[-1];
PyObject *res2 = NULL;
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
@@ -3002,9 +2997,9 @@
res = self;
assert(oparg & 1);
STACK_GROW(((oparg & 1) ? 1 : 0));
- POKE(1, res);
- if (oparg & 1) { POKE(1 + ((oparg & 1) ? 1 : 0), res2); }
- JUMPBY(9);
+ stack_pointer[-1] = res;
+ if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ next_instr += 9;
DISPATCH();
}
@@ -3018,9 +3013,9 @@
TARGET(CALL) {
PREDICTED(CALL);
static_assert(INLINE_CACHE_ENTRIES_CALL == 4, "incorrect cache size");
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
int is_meth = method != NULL;
int total_args = oparg;
@@ -3095,15 +3090,15 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(CALL_BOUND_METHOD_EXACT_ARGS) {
- PyObject *callable = PEEK(1 + oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *method = stack_pointer[-(2 + oparg)];
DEOPT_IF(method != NULL, CALL);
DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL);
STAT_INC(CALL, hit);
@@ -3117,9 +3112,9 @@
TARGET(CALL_PY_EXACT_ARGS) {
PREDICTED(CALL_PY_EXACT_ARGS);
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *method = stack_pointer[-(2 + oparg)];
uint32_t func_version = read_u32(&next_instr[1].cache);
assert(kwnames == NULL);
DEOPT_IF(tstate->interp->eval_frame, CALL);
@@ -3148,9 +3143,9 @@
}
TARGET(CALL_PY_WITH_DEFAULTS) {
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *method = stack_pointer[-(2 + oparg)];
uint32_t func_version = read_u32(&next_instr[1].cache);
uint16_t min_args = read_u16(&next_instr[3].cache);
assert(kwnames == NULL);
@@ -3185,9 +3180,9 @@
}
TARGET(CALL_NO_KW_TYPE_1) {
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *null = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
assert(kwnames == NULL);
assert(cframe.use_tracing == 0);
@@ -3201,15 +3196,15 @@
Py_DECREF(&PyType_Type); // I.e., callable
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
DISPATCH();
}
TARGET(CALL_NO_KW_STR_1) {
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *null = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
assert(kwnames == NULL);
assert(cframe.use_tracing == 0);
@@ -3224,16 +3219,16 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(CALL_NO_KW_TUPLE_1) {
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *null = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
assert(kwnames == NULL);
assert(oparg == 1);
@@ -3247,16 +3242,16 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(CALL_BUILTIN_CLASS) {
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
int is_meth = method != NULL;
int total_args = oparg;
@@ -3281,16 +3276,16 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(CALL_NO_KW_BUILTIN_O) {
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
assert(cframe.use_tracing == 0);
/* Builtin METH_O functions */
@@ -3322,16 +3317,16 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(CALL_NO_KW_BUILTIN_FAST) {
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
assert(cframe.use_tracing == 0);
/* Builtin METH_FASTCALL functions, without keywords */
@@ -3367,16 +3362,16 @@
*/
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(CALL_BUILTIN_FAST_WITH_KEYWORDS) {
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
assert(cframe.use_tracing == 0);
/* Builtin METH_FASTCALL | METH_KEYWORDS functions */
@@ -3412,16 +3407,16 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(CALL_NO_KW_LEN) {
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
assert(cframe.use_tracing == 0);
assert(kwnames == NULL);
@@ -3450,15 +3445,15 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
DISPATCH();
}
TARGET(CALL_NO_KW_ISINSTANCE) {
- PyObject **args = &PEEK(oparg);
- PyObject *callable = PEEK(1 + oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *callable = stack_pointer[-(1 + oparg)];
+ PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
assert(cframe.use_tracing == 0);
assert(kwnames == NULL);
@@ -3489,15 +3484,15 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
DISPATCH();
}
TARGET(CALL_NO_KW_LIST_APPEND) {
- PyObject **args = &PEEK(oparg);
- PyObject *self = PEEK(1 + oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *self = stack_pointer[-(1 + oparg)];
+ PyObject *method = stack_pointer[-(2 + oparg)];
assert(cframe.use_tracing == 0);
assert(kwnames == NULL);
assert(oparg == 1);
@@ -3519,8 +3514,8 @@
}
TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) {
- PyObject **args = &PEEK(oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
assert(kwnames == NULL);
int is_meth = method != NULL;
@@ -3554,15 +3549,15 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS) {
- PyObject **args = &PEEK(oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
int is_meth = method != NULL;
int total_args = oparg;
@@ -3594,15 +3589,15 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS) {
- PyObject **args = &PEEK(oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
assert(kwnames == NULL);
assert(oparg == 0 || oparg == 1);
@@ -3634,15 +3629,15 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_FAST) {
- PyObject **args = &PEEK(oparg);
- PyObject *method = PEEK(2 + oparg);
+ PyObject **args = (stack_pointer - oparg);
+ PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
assert(kwnames == NULL);
int is_meth = method != NULL;
@@ -3673,17 +3668,17 @@
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
STACK_SHRINK(oparg);
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(4);
+ stack_pointer[-1] = res;
+ next_instr += 4;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(CALL_FUNCTION_EX) {
PREDICTED(CALL_FUNCTION_EX);
- PyObject *kwargs = (oparg & 1) ? PEEK(((oparg & 1) ? 1 : 0)) : NULL;
- PyObject *callargs = PEEK(1 + ((oparg & 1) ? 1 : 0));
- PyObject *func = PEEK(2 + ((oparg & 1) ? 1 : 0));
+ PyObject *kwargs = (oparg & 1) ? stack_pointer[-(((oparg & 1) ? 1 : 0))] : NULL;
+ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))];
+ PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))];
PyObject *result;
if (oparg & 1) {
// DICT_MERGE is called before this opcode if there are kwargs.
@@ -3711,17 +3706,17 @@
if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; }
STACK_SHRINK(((oparg & 1) ? 1 : 0));
STACK_SHRINK(2);
- POKE(1, result);
+ stack_pointer[-1] = result;
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(MAKE_FUNCTION) {
- PyObject *codeobj = PEEK(1);
- PyObject *closure = (oparg & 0x08) ? PEEK(1 + ((oparg & 0x08) ? 1 : 0)) : NULL;
- PyObject *annotations = (oparg & 0x04) ? PEEK(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0)) : NULL;
- PyObject *kwdefaults = (oparg & 0x02) ? PEEK(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0)) : NULL;
- PyObject *defaults = (oparg & 0x01) ? PEEK(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x01) ? 1 : 0)) : NULL;
+ PyObject *codeobj = stack_pointer[-1];
+ PyObject *closure = (oparg & 0x08) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0))] : NULL;
+ PyObject *annotations = (oparg & 0x04) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0))] : NULL;
+ PyObject *kwdefaults = (oparg & 0x02) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0))] : NULL;
+ PyObject *defaults = (oparg & 0x01) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x01) ? 1 : 0))] : NULL;
PyObject *func;
PyFunctionObject *func_obj = (PyFunctionObject *)
@@ -3752,7 +3747,7 @@
func_obj->func_version = ((PyCodeObject *)codeobj)->co_version;
func = (PyObject *)func_obj;
STACK_SHRINK(((oparg & 0x01) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x08) ? 1 : 0));
- POKE(1, func);
+ stack_pointer[-1] = func;
DISPATCH();
}
@@ -3780,9 +3775,9 @@
}
TARGET(BUILD_SLICE) {
- PyObject *step = (oparg == 3) ? PEEK(((oparg == 3) ? 1 : 0)) : NULL;
- PyObject *stop = PEEK(1 + ((oparg == 3) ? 1 : 0));
- PyObject *start = PEEK(2 + ((oparg == 3) ? 1 : 0));
+ PyObject *step = (oparg == 3) ? stack_pointer[-(((oparg == 3) ? 1 : 0))] : NULL;
+ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))];
+ PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))];
PyObject *slice;
slice = PySlice_New(start, stop, step);
Py_DECREF(start);
@@ -3791,13 +3786,13 @@
if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; }
STACK_SHRINK(((oparg == 3) ? 1 : 0));
STACK_SHRINK(1);
- POKE(1, slice);
+ stack_pointer[-1] = slice;
DISPATCH();
}
TARGET(FORMAT_VALUE) {
- PyObject *fmt_spec = ((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? PEEK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)) : NULL;
- PyObject *value = PEEK(1 + (((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0));
+ PyObject *fmt_spec = ((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? stack_pointer[-((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))] : NULL;
+ PyObject *value = stack_pointer[-(1 + (((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))];
PyObject *result;
/* Handles f-string value formatting. */
PyObject *(*conv_fn)(PyObject *);
@@ -3845,25 +3840,25 @@
if (result == NULL) { STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); goto pop_1_error; }
}
STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0));
- POKE(1, result);
+ stack_pointer[-1] = result;
DISPATCH();
}
TARGET(COPY) {
- PyObject *bottom = PEEK(1 + (oparg-1));
+ PyObject *bottom = stack_pointer[-(1 + (oparg-1))];
PyObject *top;
assert(oparg > 0);
top = Py_NewRef(bottom);
STACK_GROW(1);
- POKE(1, top);
+ stack_pointer[-1] = top;
DISPATCH();
}
TARGET(BINARY_OP) {
PREDICTED(BINARY_OP);
static_assert(INLINE_CACHE_ENTRIES_BINARY_OP == 1, "incorrect cache size");
- PyObject *rhs = PEEK(1);
- PyObject *lhs = PEEK(2);
+ PyObject *rhs = stack_pointer[-1];
+ PyObject *lhs = stack_pointer[-2];
PyObject *res;
#if ENABLE_SPECIALIZATION
_PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr;
@@ -3884,17 +3879,17 @@
Py_DECREF(rhs);
if (res == NULL) goto pop_2_error;
STACK_SHRINK(1);
- POKE(1, res);
- JUMPBY(1);
+ stack_pointer[-1] = res;
+ next_instr += 1;
DISPATCH();
}
TARGET(SWAP) {
- PyObject *top = PEEK(1);
- PyObject *bottom = PEEK(2 + (oparg-2));
+ PyObject *top = stack_pointer[-1];
+ PyObject *bottom = stack_pointer[-(2 + (oparg-2))];
assert(oparg >= 2);
- POKE(1, bottom);
- POKE(2 + (oparg-2), top);
+ stack_pointer[-1] = bottom;
+ stack_pointer[-(2 + (oparg-2))] = top;
DISPATCH();
}