summaryrefslogtreecommitdiffstats
path: root/Python/generated_cases.c.h
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2023-02-20 14:56:48 (GMT)
committerGitHub <noreply@github.com>2023-02-20 14:56:48 (GMT)
commita99eb5cd9947629a6745a4ad99cb07af1c287b5d (patch)
tree2d2b82cef5aa1c514eda32eaca115e2723fd7f1c /Python/generated_cases.c.h
parentc00faf79438cc7f0d98af2679c695f747e4369a3 (diff)
downloadcpython-a99eb5cd9947629a6745a4ad99cb07af1c287b5d.zip
cpython-a99eb5cd9947629a6745a4ad99cb07af1c287b5d.tar.gz
cpython-a99eb5cd9947629a6745a4ad99cb07af1c287b5d.tar.bz2
gh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (GH-101912)
* gh-101907: Removes use of non-standard C++ extension from Include/cpython/code.h * Make cases_generator correct on Windows
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r--Python/generated_cases.c.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 730dfb7..487e63d 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -339,9 +339,9 @@
DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP);
DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP);
_Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP];
- assert(_Py_OPCODE(true_next) == STORE_FAST ||
- _Py_OPCODE(true_next) == STORE_FAST__LOAD_FAST);
- PyObject **target_local = &GETLOCAL(_Py_OPARG(true_next));
+ assert(true_next.op.code == STORE_FAST ||
+ true_next.op.code == STORE_FAST__LOAD_FAST);
+ PyObject **target_local = &GETLOCAL(true_next.op.arg);
DEOPT_IF(*target_local != left, BINARY_OP);
STAT_INC(BINARY_OP, hit);
/* Handle `left = left + right` or `left += right` for str.
@@ -2199,10 +2199,10 @@
Py_DECREF(left);
Py_DECREF(right);
if (cond == NULL) goto pop_2_error;
- assert(_Py_OPCODE(next_instr[1]) == POP_JUMP_IF_FALSE ||
- _Py_OPCODE(next_instr[1]) == POP_JUMP_IF_TRUE);
- bool jump_on_true = _Py_OPCODE(next_instr[1]) == POP_JUMP_IF_TRUE;
- int offset = _Py_OPARG(next_instr[1]);
+ assert(next_instr[1].op.code == POP_JUMP_IF_FALSE ||
+ next_instr[1].op.code == POP_JUMP_IF_TRUE);
+ bool jump_on_true = next_instr[1].op.code == POP_JUMP_IF_TRUE;
+ int offset = next_instr[1].op.arg;
int err = PyObject_IsTrue(cond);
Py_DECREF(cond);
if (err < 0) {
@@ -2230,7 +2230,7 @@
_Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc);
_Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc);
if (sign_ish & oparg) {
- int offset = _Py_OPARG(next_instr[1]);
+ int offset = next_instr[1].op.arg;
JUMPBY(offset);
}
STACK_SHRINK(2);
@@ -2255,7 +2255,7 @@
_Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free);
_Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free);
if (sign_ish & oparg) {
- int offset = _Py_OPARG(next_instr[1]);
+ int offset = next_instr[1].op.arg;
JUMPBY(offset);
}
STACK_SHRINK(2);
@@ -2278,7 +2278,7 @@
assert((oparg & 0xf) == COMPARISON_NOT_EQUALS || (oparg & 0xf) == COMPARISON_EQUALS);
assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS);
if ((res + COMPARISON_NOT_EQUALS) & oparg) {
- int offset = _Py_OPARG(next_instr[1]);
+ int offset = next_instr[1].op.arg;
JUMPBY(offset);
}
STACK_SHRINK(2);
@@ -2682,7 +2682,7 @@
_PyErr_Clear(tstate);
}
/* iterator ended normally */
- assert(_Py_OPCODE(next_instr[INLINE_CACHE_ENTRIES_FOR_ITER + oparg]) == END_FOR);
+ assert(next_instr[INLINE_CACHE_ENTRIES_FOR_ITER + oparg].op.code == END_FOR);
Py_DECREF(iter);
STACK_SHRINK(1);
/* Jump forward oparg, then skip following END_FOR instruction */
@@ -2761,7 +2761,7 @@
DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER);
STAT_INC(FOR_ITER, hit);
_Py_CODEUNIT next = next_instr[INLINE_CACHE_ENTRIES_FOR_ITER];
- assert(_PyOpcode_Deopt[_Py_OPCODE(next)] == STORE_FAST);
+ assert(_PyOpcode_Deopt[next.op.code] == STORE_FAST);
if (r->len <= 0) {
STACK_SHRINK(1);
Py_DECREF(r);
@@ -2772,7 +2772,7 @@
long value = r->start;
r->start = value + r->step;
r->len--;
- if (_PyLong_AssignValue(&GETLOCAL(_Py_OPARG(next)), value) < 0) {
+ if (_PyLong_AssignValue(&GETLOCAL(next.op.arg), value) < 0) {
goto error;
}
// The STORE_FAST is already done.
@@ -2795,7 +2795,7 @@
gen->gi_exc_state.previous_item = tstate->exc_info;
tstate->exc_info = &gen->gi_exc_state;
JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg);
- assert(_Py_OPCODE(*next_instr) == END_FOR);
+ assert(next_instr->op.code == END_FOR);
DISPATCH_INLINED(gen_frame);
}
@@ -3516,7 +3516,7 @@
STACK_SHRINK(3);
// CALL + POP_TOP
JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1);
- assert(_Py_OPCODE(next_instr[-1]) == POP_TOP);
+ assert(next_instr[-1].op.code == POP_TOP);
DISPATCH();
}
@@ -3903,8 +3903,8 @@
TARGET(EXTENDED_ARG) {
assert(oparg);
assert(cframe.use_tracing == 0);
- opcode = _Py_OPCODE(*next_instr);
- oparg = oparg << 8 | _Py_OPARG(*next_instr);
+ opcode = next_instr->op.code;
+ oparg = oparg << 8 | next_instr->op.arg;
PRE_DISPATCH_GOTO();
DISPATCH_GOTO();
}