closes bpo-34673: Tweaks to make ceval more editable. (GH-9289)
Two major changes: - Move case statements out of the TARGET macro. - Move PREDICT macro invocations after the case label.
This commit is contained in:
parent
5cc583d940
commit
ddd1949fea
272
Python/ceval.c
272
Python/ceval.c
|
@ -629,8 +629,8 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
|
||||||
#include "opcode_targets.h"
|
#include "opcode_targets.h"
|
||||||
|
|
||||||
#define TARGET(op) \
|
#define TARGET(op) \
|
||||||
TARGET_##op: \
|
op: \
|
||||||
case op:
|
TARGET_##op
|
||||||
|
|
||||||
#define DISPATCH() \
|
#define DISPATCH() \
|
||||||
{ \
|
{ \
|
||||||
|
@ -663,8 +663,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define TARGET(op) \
|
#define TARGET(op) op
|
||||||
case op:
|
|
||||||
|
|
||||||
#define DISPATCH() continue
|
#define DISPATCH() continue
|
||||||
#define FAST_DISPATCH() goto fast_next_opcode
|
#define FAST_DISPATCH() goto fast_next_opcode
|
||||||
|
@ -1064,10 +1063,11 @@ main_loop:
|
||||||
It is essential that any operation that fails must goto error
|
It is essential that any operation that fails must goto error
|
||||||
and that all operation that succeed call [FAST_]DISPATCH() ! */
|
and that all operation that succeed call [FAST_]DISPATCH() ! */
|
||||||
|
|
||||||
TARGET(NOP)
|
case TARGET(NOP): {
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
|
}
|
||||||
|
|
||||||
TARGET(LOAD_FAST) {
|
case TARGET(LOAD_FAST): {
|
||||||
PyObject *value = GETLOCAL(oparg);
|
PyObject *value = GETLOCAL(oparg);
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
format_exc_check_arg(PyExc_UnboundLocalError,
|
format_exc_check_arg(PyExc_UnboundLocalError,
|
||||||
|
@ -1080,28 +1080,28 @@ main_loop:
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(LOAD_CONST);
|
case TARGET(LOAD_CONST): {
|
||||||
TARGET(LOAD_CONST) {
|
PREDICTED(LOAD_CONST);
|
||||||
PyObject *value = GETITEM(consts, oparg);
|
PyObject *value = GETITEM(consts, oparg);
|
||||||
Py_INCREF(value);
|
Py_INCREF(value);
|
||||||
PUSH(value);
|
PUSH(value);
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(STORE_FAST);
|
case TARGET(STORE_FAST): {
|
||||||
TARGET(STORE_FAST) {
|
PREDICTED(STORE_FAST);
|
||||||
PyObject *value = POP();
|
PyObject *value = POP();
|
||||||
SETLOCAL(oparg, value);
|
SETLOCAL(oparg, value);
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(POP_TOP) {
|
case TARGET(POP_TOP): {
|
||||||
PyObject *value = POP();
|
PyObject *value = POP();
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(ROT_TWO) {
|
case TARGET(ROT_TWO): {
|
||||||
PyObject *top = TOP();
|
PyObject *top = TOP();
|
||||||
PyObject *second = SECOND();
|
PyObject *second = SECOND();
|
||||||
SET_TOP(second);
|
SET_TOP(second);
|
||||||
|
@ -1109,7 +1109,7 @@ main_loop:
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(ROT_THREE) {
|
case TARGET(ROT_THREE): {
|
||||||
PyObject *top = TOP();
|
PyObject *top = TOP();
|
||||||
PyObject *second = SECOND();
|
PyObject *second = SECOND();
|
||||||
PyObject *third = THIRD();
|
PyObject *third = THIRD();
|
||||||
|
@ -1119,7 +1119,7 @@ main_loop:
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(ROT_FOUR) {
|
case TARGET(ROT_FOUR): {
|
||||||
PyObject *top = TOP();
|
PyObject *top = TOP();
|
||||||
PyObject *second = SECOND();
|
PyObject *second = SECOND();
|
||||||
PyObject *third = THIRD();
|
PyObject *third = THIRD();
|
||||||
|
@ -1131,14 +1131,14 @@ main_loop:
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(DUP_TOP) {
|
case TARGET(DUP_TOP): {
|
||||||
PyObject *top = TOP();
|
PyObject *top = TOP();
|
||||||
Py_INCREF(top);
|
Py_INCREF(top);
|
||||||
PUSH(top);
|
PUSH(top);
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(DUP_TOP_TWO) {
|
case TARGET(DUP_TOP_TWO): {
|
||||||
PyObject *top = TOP();
|
PyObject *top = TOP();
|
||||||
PyObject *second = SECOND();
|
PyObject *second = SECOND();
|
||||||
Py_INCREF(top);
|
Py_INCREF(top);
|
||||||
|
@ -1149,7 +1149,7 @@ main_loop:
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(UNARY_POSITIVE) {
|
case TARGET(UNARY_POSITIVE): {
|
||||||
PyObject *value = TOP();
|
PyObject *value = TOP();
|
||||||
PyObject *res = PyNumber_Positive(value);
|
PyObject *res = PyNumber_Positive(value);
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
|
@ -1159,7 +1159,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(UNARY_NEGATIVE) {
|
case TARGET(UNARY_NEGATIVE): {
|
||||||
PyObject *value = TOP();
|
PyObject *value = TOP();
|
||||||
PyObject *res = PyNumber_Negative(value);
|
PyObject *res = PyNumber_Negative(value);
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
|
@ -1169,7 +1169,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(UNARY_NOT) {
|
case TARGET(UNARY_NOT): {
|
||||||
PyObject *value = TOP();
|
PyObject *value = TOP();
|
||||||
int err = PyObject_IsTrue(value);
|
int err = PyObject_IsTrue(value);
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
|
@ -1187,7 +1187,7 @@ main_loop:
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(UNARY_INVERT) {
|
case TARGET(UNARY_INVERT): {
|
||||||
PyObject *value = TOP();
|
PyObject *value = TOP();
|
||||||
PyObject *res = PyNumber_Invert(value);
|
PyObject *res = PyNumber_Invert(value);
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
|
@ -1197,7 +1197,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_POWER) {
|
case TARGET(BINARY_POWER): {
|
||||||
PyObject *exp = POP();
|
PyObject *exp = POP();
|
||||||
PyObject *base = TOP();
|
PyObject *base = TOP();
|
||||||
PyObject *res = PyNumber_Power(base, exp, Py_None);
|
PyObject *res = PyNumber_Power(base, exp, Py_None);
|
||||||
|
@ -1209,7 +1209,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_MULTIPLY) {
|
case TARGET(BINARY_MULTIPLY): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_Multiply(left, right);
|
PyObject *res = PyNumber_Multiply(left, right);
|
||||||
|
@ -1221,7 +1221,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_MATRIX_MULTIPLY) {
|
case TARGET(BINARY_MATRIX_MULTIPLY): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_MatrixMultiply(left, right);
|
PyObject *res = PyNumber_MatrixMultiply(left, right);
|
||||||
|
@ -1233,7 +1233,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_TRUE_DIVIDE) {
|
case TARGET(BINARY_TRUE_DIVIDE): {
|
||||||
PyObject *divisor = POP();
|
PyObject *divisor = POP();
|
||||||
PyObject *dividend = TOP();
|
PyObject *dividend = TOP();
|
||||||
PyObject *quotient = PyNumber_TrueDivide(dividend, divisor);
|
PyObject *quotient = PyNumber_TrueDivide(dividend, divisor);
|
||||||
|
@ -1245,7 +1245,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_FLOOR_DIVIDE) {
|
case TARGET(BINARY_FLOOR_DIVIDE): {
|
||||||
PyObject *divisor = POP();
|
PyObject *divisor = POP();
|
||||||
PyObject *dividend = TOP();
|
PyObject *dividend = TOP();
|
||||||
PyObject *quotient = PyNumber_FloorDivide(dividend, divisor);
|
PyObject *quotient = PyNumber_FloorDivide(dividend, divisor);
|
||||||
|
@ -1257,7 +1257,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_MODULO) {
|
case TARGET(BINARY_MODULO): {
|
||||||
PyObject *divisor = POP();
|
PyObject *divisor = POP();
|
||||||
PyObject *dividend = TOP();
|
PyObject *dividend = TOP();
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
|
@ -1277,7 +1277,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_ADD) {
|
case TARGET(BINARY_ADD): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *sum;
|
PyObject *sum;
|
||||||
|
@ -1303,7 +1303,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_SUBTRACT) {
|
case TARGET(BINARY_SUBTRACT): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *diff = PyNumber_Subtract(left, right);
|
PyObject *diff = PyNumber_Subtract(left, right);
|
||||||
|
@ -1315,7 +1315,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_SUBSCR) {
|
case TARGET(BINARY_SUBSCR): {
|
||||||
PyObject *sub = POP();
|
PyObject *sub = POP();
|
||||||
PyObject *container = TOP();
|
PyObject *container = TOP();
|
||||||
PyObject *res = PyObject_GetItem(container, sub);
|
PyObject *res = PyObject_GetItem(container, sub);
|
||||||
|
@ -1327,7 +1327,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_LSHIFT) {
|
case TARGET(BINARY_LSHIFT): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_Lshift(left, right);
|
PyObject *res = PyNumber_Lshift(left, right);
|
||||||
|
@ -1339,7 +1339,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_RSHIFT) {
|
case TARGET(BINARY_RSHIFT): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_Rshift(left, right);
|
PyObject *res = PyNumber_Rshift(left, right);
|
||||||
|
@ -1351,7 +1351,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_AND) {
|
case TARGET(BINARY_AND): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_And(left, right);
|
PyObject *res = PyNumber_And(left, right);
|
||||||
|
@ -1363,7 +1363,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_XOR) {
|
case TARGET(BINARY_XOR): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_Xor(left, right);
|
PyObject *res = PyNumber_Xor(left, right);
|
||||||
|
@ -1375,7 +1375,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BINARY_OR) {
|
case TARGET(BINARY_OR): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_Or(left, right);
|
PyObject *res = PyNumber_Or(left, right);
|
||||||
|
@ -1387,7 +1387,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(LIST_APPEND) {
|
case TARGET(LIST_APPEND): {
|
||||||
PyObject *v = POP();
|
PyObject *v = POP();
|
||||||
PyObject *list = PEEK(oparg);
|
PyObject *list = PEEK(oparg);
|
||||||
int err;
|
int err;
|
||||||
|
@ -1399,7 +1399,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(SET_ADD) {
|
case TARGET(SET_ADD): {
|
||||||
PyObject *v = POP();
|
PyObject *v = POP();
|
||||||
PyObject *set = PEEK(oparg);
|
PyObject *set = PEEK(oparg);
|
||||||
int err;
|
int err;
|
||||||
|
@ -1411,7 +1411,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_POWER) {
|
case TARGET(INPLACE_POWER): {
|
||||||
PyObject *exp = POP();
|
PyObject *exp = POP();
|
||||||
PyObject *base = TOP();
|
PyObject *base = TOP();
|
||||||
PyObject *res = PyNumber_InPlacePower(base, exp, Py_None);
|
PyObject *res = PyNumber_InPlacePower(base, exp, Py_None);
|
||||||
|
@ -1423,7 +1423,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_MULTIPLY) {
|
case TARGET(INPLACE_MULTIPLY): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_InPlaceMultiply(left, right);
|
PyObject *res = PyNumber_InPlaceMultiply(left, right);
|
||||||
|
@ -1435,7 +1435,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_MATRIX_MULTIPLY) {
|
case TARGET(INPLACE_MATRIX_MULTIPLY): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_InPlaceMatrixMultiply(left, right);
|
PyObject *res = PyNumber_InPlaceMatrixMultiply(left, right);
|
||||||
|
@ -1447,7 +1447,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_TRUE_DIVIDE) {
|
case TARGET(INPLACE_TRUE_DIVIDE): {
|
||||||
PyObject *divisor = POP();
|
PyObject *divisor = POP();
|
||||||
PyObject *dividend = TOP();
|
PyObject *dividend = TOP();
|
||||||
PyObject *quotient = PyNumber_InPlaceTrueDivide(dividend, divisor);
|
PyObject *quotient = PyNumber_InPlaceTrueDivide(dividend, divisor);
|
||||||
|
@ -1459,7 +1459,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_FLOOR_DIVIDE) {
|
case TARGET(INPLACE_FLOOR_DIVIDE): {
|
||||||
PyObject *divisor = POP();
|
PyObject *divisor = POP();
|
||||||
PyObject *dividend = TOP();
|
PyObject *dividend = TOP();
|
||||||
PyObject *quotient = PyNumber_InPlaceFloorDivide(dividend, divisor);
|
PyObject *quotient = PyNumber_InPlaceFloorDivide(dividend, divisor);
|
||||||
|
@ -1471,7 +1471,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_MODULO) {
|
case TARGET(INPLACE_MODULO): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *mod = PyNumber_InPlaceRemainder(left, right);
|
PyObject *mod = PyNumber_InPlaceRemainder(left, right);
|
||||||
|
@ -1483,7 +1483,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_ADD) {
|
case TARGET(INPLACE_ADD): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *sum;
|
PyObject *sum;
|
||||||
|
@ -1502,7 +1502,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_SUBTRACT) {
|
case TARGET(INPLACE_SUBTRACT): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *diff = PyNumber_InPlaceSubtract(left, right);
|
PyObject *diff = PyNumber_InPlaceSubtract(left, right);
|
||||||
|
@ -1514,7 +1514,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_LSHIFT) {
|
case TARGET(INPLACE_LSHIFT): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_InPlaceLshift(left, right);
|
PyObject *res = PyNumber_InPlaceLshift(left, right);
|
||||||
|
@ -1526,7 +1526,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_RSHIFT) {
|
case TARGET(INPLACE_RSHIFT): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_InPlaceRshift(left, right);
|
PyObject *res = PyNumber_InPlaceRshift(left, right);
|
||||||
|
@ -1538,7 +1538,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_AND) {
|
case TARGET(INPLACE_AND): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_InPlaceAnd(left, right);
|
PyObject *res = PyNumber_InPlaceAnd(left, right);
|
||||||
|
@ -1550,7 +1550,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_XOR) {
|
case TARGET(INPLACE_XOR): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_InPlaceXor(left, right);
|
PyObject *res = PyNumber_InPlaceXor(left, right);
|
||||||
|
@ -1562,7 +1562,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INPLACE_OR) {
|
case TARGET(INPLACE_OR): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = PyNumber_InPlaceOr(left, right);
|
PyObject *res = PyNumber_InPlaceOr(left, right);
|
||||||
|
@ -1574,7 +1574,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(STORE_SUBSCR) {
|
case TARGET(STORE_SUBSCR): {
|
||||||
PyObject *sub = TOP();
|
PyObject *sub = TOP();
|
||||||
PyObject *container = SECOND();
|
PyObject *container = SECOND();
|
||||||
PyObject *v = THIRD();
|
PyObject *v = THIRD();
|
||||||
|
@ -1590,7 +1590,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(DELETE_SUBSCR) {
|
case TARGET(DELETE_SUBSCR): {
|
||||||
PyObject *sub = TOP();
|
PyObject *sub = TOP();
|
||||||
PyObject *container = SECOND();
|
PyObject *container = SECOND();
|
||||||
int err;
|
int err;
|
||||||
|
@ -1604,7 +1604,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(PRINT_EXPR) {
|
case TARGET(PRINT_EXPR): {
|
||||||
_Py_IDENTIFIER(displayhook);
|
_Py_IDENTIFIER(displayhook);
|
||||||
PyObject *value = POP();
|
PyObject *value = POP();
|
||||||
PyObject *hook = _PySys_GetObjectId(&PyId_displayhook);
|
PyObject *hook = _PySys_GetObjectId(&PyId_displayhook);
|
||||||
|
@ -1623,7 +1623,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(RAISE_VARARGS) {
|
case TARGET(RAISE_VARARGS): {
|
||||||
PyObject *cause = NULL, *exc = NULL;
|
PyObject *cause = NULL, *exc = NULL;
|
||||||
switch (oparg) {
|
switch (oparg) {
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -1645,13 +1645,13 @@ main_loop:
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(RETURN_VALUE) {
|
case TARGET(RETURN_VALUE): {
|
||||||
retval = POP();
|
retval = POP();
|
||||||
assert(f->f_iblock == 0);
|
assert(f->f_iblock == 0);
|
||||||
goto return_or_yield;
|
goto return_or_yield;
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(GET_AITER) {
|
case TARGET(GET_AITER): {
|
||||||
unaryfunc getter = NULL;
|
unaryfunc getter = NULL;
|
||||||
PyObject *iter = NULL;
|
PyObject *iter = NULL;
|
||||||
PyObject *obj = TOP();
|
PyObject *obj = TOP();
|
||||||
|
@ -1697,7 +1697,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(GET_ANEXT) {
|
case TARGET(GET_ANEXT): {
|
||||||
unaryfunc getter = NULL;
|
unaryfunc getter = NULL;
|
||||||
PyObject *next_iter = NULL;
|
PyObject *next_iter = NULL;
|
||||||
PyObject *awaitable = NULL;
|
PyObject *awaitable = NULL;
|
||||||
|
@ -1749,8 +1749,8 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(GET_AWAITABLE);
|
case TARGET(GET_AWAITABLE): {
|
||||||
TARGET(GET_AWAITABLE) {
|
PREDICTED(GET_AWAITABLE);
|
||||||
PyObject *iterable = TOP();
|
PyObject *iterable = TOP();
|
||||||
PyObject *iter = _PyCoro_GetAwaitableIter(iterable);
|
PyObject *iter = _PyCoro_GetAwaitableIter(iterable);
|
||||||
|
|
||||||
|
@ -1786,7 +1786,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(YIELD_FROM) {
|
case TARGET(YIELD_FROM): {
|
||||||
PyObject *v = POP();
|
PyObject *v = POP();
|
||||||
PyObject *receiver = TOP();
|
PyObject *receiver = TOP();
|
||||||
int err;
|
int err;
|
||||||
|
@ -1820,7 +1820,7 @@ main_loop:
|
||||||
goto return_or_yield;
|
goto return_or_yield;
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(YIELD_VALUE) {
|
case TARGET(YIELD_VALUE): {
|
||||||
retval = POP();
|
retval = POP();
|
||||||
|
|
||||||
if (co->co_flags & CO_ASYNC_GENERATOR) {
|
if (co->co_flags & CO_ASYNC_GENERATOR) {
|
||||||
|
@ -1837,7 +1837,7 @@ main_loop:
|
||||||
goto return_or_yield;
|
goto return_or_yield;
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(POP_EXCEPT) {
|
case TARGET(POP_EXCEPT): {
|
||||||
PyObject *type, *value, *traceback;
|
PyObject *type, *value, *traceback;
|
||||||
_PyErr_StackItem *exc_info;
|
_PyErr_StackItem *exc_info;
|
||||||
PyTryBlock *b = PyFrame_BlockPop(f);
|
PyTryBlock *b = PyFrame_BlockPop(f);
|
||||||
|
@ -1861,13 +1861,13 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(POP_BLOCK);
|
case TARGET(POP_BLOCK): {
|
||||||
TARGET(POP_BLOCK) {
|
PREDICTED(POP_BLOCK);
|
||||||
PyFrame_BlockPop(f);
|
PyFrame_BlockPop(f);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(POP_FINALLY) {
|
case TARGET(POP_FINALLY): {
|
||||||
/* If oparg is 0 at the top of the stack are 1 or 6 values:
|
/* If oparg is 0 at the top of the stack are 1 or 6 values:
|
||||||
Either:
|
Either:
|
||||||
- TOP = NULL or an integer
|
- TOP = NULL or an integer
|
||||||
|
@ -1918,7 +1918,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(CALL_FINALLY) {
|
case TARGET(CALL_FINALLY): {
|
||||||
PyObject *ret = PyLong_FromLong(INSTR_OFFSET());
|
PyObject *ret = PyLong_FromLong(INSTR_OFFSET());
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1928,7 +1928,7 @@ main_loop:
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BEGIN_FINALLY) {
|
case TARGET(BEGIN_FINALLY): {
|
||||||
/* Push NULL onto the stack for using it in END_FINALLY,
|
/* Push NULL onto the stack for using it in END_FINALLY,
|
||||||
POP_FINALLY, WITH_CLEANUP_START and WITH_CLEANUP_FINISH.
|
POP_FINALLY, WITH_CLEANUP_START and WITH_CLEANUP_FINISH.
|
||||||
*/
|
*/
|
||||||
|
@ -1936,8 +1936,8 @@ main_loop:
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(END_FINALLY);
|
case TARGET(END_FINALLY): {
|
||||||
TARGET(END_FINALLY) {
|
PREDICTED(END_FINALLY);
|
||||||
/* At the top of the stack are 1 or 6 values:
|
/* At the top of the stack are 1 or 6 values:
|
||||||
Either:
|
Either:
|
||||||
- TOP = NULL or an integer
|
- TOP = NULL or an integer
|
||||||
|
@ -1967,7 +1967,7 @@ main_loop:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(END_ASYNC_FOR) {
|
case TARGET(END_ASYNC_FOR): {
|
||||||
PyObject *exc = POP();
|
PyObject *exc = POP();
|
||||||
assert(PyExceptionClass_Check(exc));
|
assert(PyExceptionClass_Check(exc));
|
||||||
if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) {
|
if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) {
|
||||||
|
@ -1987,7 +1987,7 @@ main_loop:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(LOAD_BUILD_CLASS) {
|
case TARGET(LOAD_BUILD_CLASS): {
|
||||||
_Py_IDENTIFIER(__build_class__);
|
_Py_IDENTIFIER(__build_class__);
|
||||||
|
|
||||||
PyObject *bc;
|
PyObject *bc;
|
||||||
|
@ -2016,7 +2016,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(STORE_NAME) {
|
case TARGET(STORE_NAME): {
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
PyObject *v = POP();
|
PyObject *v = POP();
|
||||||
PyObject *ns = f->f_locals;
|
PyObject *ns = f->f_locals;
|
||||||
|
@ -2037,7 +2037,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(DELETE_NAME) {
|
case TARGET(DELETE_NAME): {
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
PyObject *ns = f->f_locals;
|
PyObject *ns = f->f_locals;
|
||||||
int err;
|
int err;
|
||||||
|
@ -2056,8 +2056,8 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(UNPACK_SEQUENCE);
|
case TARGET(UNPACK_SEQUENCE): {
|
||||||
TARGET(UNPACK_SEQUENCE) {
|
PREDICTED(UNPACK_SEQUENCE);
|
||||||
PyObject *seq = POP(), *item, **items;
|
PyObject *seq = POP(), *item, **items;
|
||||||
if (PyTuple_CheckExact(seq) &&
|
if (PyTuple_CheckExact(seq) &&
|
||||||
PyTuple_GET_SIZE(seq) == oparg) {
|
PyTuple_GET_SIZE(seq) == oparg) {
|
||||||
|
@ -2087,7 +2087,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(UNPACK_EX) {
|
case TARGET(UNPACK_EX): {
|
||||||
int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8);
|
int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8);
|
||||||
PyObject *seq = POP();
|
PyObject *seq = POP();
|
||||||
|
|
||||||
|
@ -2102,7 +2102,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(STORE_ATTR) {
|
case TARGET(STORE_ATTR): {
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
PyObject *owner = TOP();
|
PyObject *owner = TOP();
|
||||||
PyObject *v = SECOND();
|
PyObject *v = SECOND();
|
||||||
|
@ -2116,7 +2116,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(DELETE_ATTR) {
|
case TARGET(DELETE_ATTR): {
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
PyObject *owner = POP();
|
PyObject *owner = POP();
|
||||||
int err;
|
int err;
|
||||||
|
@ -2127,7 +2127,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(STORE_GLOBAL) {
|
case TARGET(STORE_GLOBAL): {
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
PyObject *v = POP();
|
PyObject *v = POP();
|
||||||
int err;
|
int err;
|
||||||
|
@ -2138,7 +2138,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(DELETE_GLOBAL) {
|
case TARGET(DELETE_GLOBAL): {
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
int err;
|
int err;
|
||||||
err = PyDict_DelItem(f->f_globals, name);
|
err = PyDict_DelItem(f->f_globals, name);
|
||||||
|
@ -2150,7 +2150,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(LOAD_NAME) {
|
case TARGET(LOAD_NAME): {
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
PyObject *locals = f->f_locals;
|
PyObject *locals = f->f_locals;
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
|
@ -2201,7 +2201,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(LOAD_GLOBAL) {
|
case TARGET(LOAD_GLOBAL): {
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
if (PyDict_CheckExact(f->f_globals)
|
if (PyDict_CheckExact(f->f_globals)
|
||||||
|
@ -2246,7 +2246,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(DELETE_FAST) {
|
case TARGET(DELETE_FAST): {
|
||||||
PyObject *v = GETLOCAL(oparg);
|
PyObject *v = GETLOCAL(oparg);
|
||||||
if (v != NULL) {
|
if (v != NULL) {
|
||||||
SETLOCAL(oparg, NULL);
|
SETLOCAL(oparg, NULL);
|
||||||
|
@ -2260,7 +2260,7 @@ main_loop:
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(DELETE_DEREF) {
|
case TARGET(DELETE_DEREF): {
|
||||||
PyObject *cell = freevars[oparg];
|
PyObject *cell = freevars[oparg];
|
||||||
PyObject *oldobj = PyCell_GET(cell);
|
PyObject *oldobj = PyCell_GET(cell);
|
||||||
if (oldobj != NULL) {
|
if (oldobj != NULL) {
|
||||||
|
@ -2272,14 +2272,14 @@ main_loop:
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(LOAD_CLOSURE) {
|
case TARGET(LOAD_CLOSURE): {
|
||||||
PyObject *cell = freevars[oparg];
|
PyObject *cell = freevars[oparg];
|
||||||
Py_INCREF(cell);
|
Py_INCREF(cell);
|
||||||
PUSH(cell);
|
PUSH(cell);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(LOAD_CLASSDEREF) {
|
case TARGET(LOAD_CLASSDEREF): {
|
||||||
PyObject *name, *value, *locals = f->f_locals;
|
PyObject *name, *value, *locals = f->f_locals;
|
||||||
Py_ssize_t idx;
|
Py_ssize_t idx;
|
||||||
assert(locals);
|
assert(locals);
|
||||||
|
@ -2312,7 +2312,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(LOAD_DEREF) {
|
case TARGET(LOAD_DEREF): {
|
||||||
PyObject *cell = freevars[oparg];
|
PyObject *cell = freevars[oparg];
|
||||||
PyObject *value = PyCell_GET(cell);
|
PyObject *value = PyCell_GET(cell);
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
|
@ -2324,7 +2324,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(STORE_DEREF) {
|
case TARGET(STORE_DEREF): {
|
||||||
PyObject *v = POP();
|
PyObject *v = POP();
|
||||||
PyObject *cell = freevars[oparg];
|
PyObject *cell = freevars[oparg];
|
||||||
PyObject *oldobj = PyCell_GET(cell);
|
PyObject *oldobj = PyCell_GET(cell);
|
||||||
|
@ -2333,7 +2333,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BUILD_STRING) {
|
case TARGET(BUILD_STRING): {
|
||||||
PyObject *str;
|
PyObject *str;
|
||||||
PyObject *empty = PyUnicode_New(0, 0);
|
PyObject *empty = PyUnicode_New(0, 0);
|
||||||
if (empty == NULL) {
|
if (empty == NULL) {
|
||||||
|
@ -2351,7 +2351,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BUILD_TUPLE) {
|
case TARGET(BUILD_TUPLE): {
|
||||||
PyObject *tup = PyTuple_New(oparg);
|
PyObject *tup = PyTuple_New(oparg);
|
||||||
if (tup == NULL)
|
if (tup == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -2363,7 +2363,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BUILD_LIST) {
|
case TARGET(BUILD_LIST): {
|
||||||
PyObject *list = PyList_New(oparg);
|
PyObject *list = PyList_New(oparg);
|
||||||
if (list == NULL)
|
if (list == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -2375,9 +2375,9 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BUILD_TUPLE_UNPACK_WITH_CALL)
|
case TARGET(BUILD_TUPLE_UNPACK_WITH_CALL):
|
||||||
TARGET(BUILD_TUPLE_UNPACK)
|
case TARGET(BUILD_TUPLE_UNPACK):
|
||||||
TARGET(BUILD_LIST_UNPACK) {
|
case TARGET(BUILD_LIST_UNPACK): {
|
||||||
int convert_to_tuple = opcode != BUILD_LIST_UNPACK;
|
int convert_to_tuple = opcode != BUILD_LIST_UNPACK;
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
PyObject *sum = PyList_New(0);
|
PyObject *sum = PyList_New(0);
|
||||||
|
@ -2418,7 +2418,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BUILD_SET) {
|
case TARGET(BUILD_SET): {
|
||||||
PyObject *set = PySet_New(NULL);
|
PyObject *set = PySet_New(NULL);
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int i;
|
int i;
|
||||||
|
@ -2439,7 +2439,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BUILD_SET_UNPACK) {
|
case TARGET(BUILD_SET_UNPACK): {
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
PyObject *sum = PySet_New(NULL);
|
PyObject *sum = PySet_New(NULL);
|
||||||
if (sum == NULL)
|
if (sum == NULL)
|
||||||
|
@ -2458,7 +2458,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BUILD_MAP) {
|
case TARGET(BUILD_MAP): {
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
PyObject *map = _PyDict_NewPresized((Py_ssize_t)oparg);
|
PyObject *map = _PyDict_NewPresized((Py_ssize_t)oparg);
|
||||||
if (map == NULL)
|
if (map == NULL)
|
||||||
|
@ -2482,7 +2482,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(SETUP_ANNOTATIONS) {
|
case TARGET(SETUP_ANNOTATIONS): {
|
||||||
_Py_IDENTIFIER(__annotations__);
|
_Py_IDENTIFIER(__annotations__);
|
||||||
int err;
|
int err;
|
||||||
PyObject *ann_dict;
|
PyObject *ann_dict;
|
||||||
|
@ -2538,7 +2538,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BUILD_CONST_KEY_MAP) {
|
case TARGET(BUILD_CONST_KEY_MAP): {
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
PyObject *map;
|
PyObject *map;
|
||||||
PyObject *keys = TOP();
|
PyObject *keys = TOP();
|
||||||
|
@ -2571,7 +2571,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BUILD_MAP_UNPACK) {
|
case TARGET(BUILD_MAP_UNPACK): {
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
PyObject *sum = PyDict_New();
|
PyObject *sum = PyDict_New();
|
||||||
if (sum == NULL)
|
if (sum == NULL)
|
||||||
|
@ -2596,7 +2596,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BUILD_MAP_UNPACK_WITH_CALL) {
|
case TARGET(BUILD_MAP_UNPACK_WITH_CALL): {
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
PyObject *sum = PyDict_New();
|
PyObject *sum = PyDict_New();
|
||||||
if (sum == NULL)
|
if (sum == NULL)
|
||||||
|
@ -2646,7 +2646,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(MAP_ADD) {
|
case TARGET(MAP_ADD): {
|
||||||
PyObject *key = TOP();
|
PyObject *key = TOP();
|
||||||
PyObject *value = SECOND();
|
PyObject *value = SECOND();
|
||||||
PyObject *map;
|
PyObject *map;
|
||||||
|
@ -2663,7 +2663,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(LOAD_ATTR) {
|
case TARGET(LOAD_ATTR): {
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
PyObject *owner = TOP();
|
PyObject *owner = TOP();
|
||||||
PyObject *res = PyObject_GetAttr(owner, name);
|
PyObject *res = PyObject_GetAttr(owner, name);
|
||||||
|
@ -2674,7 +2674,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(COMPARE_OP) {
|
case TARGET(COMPARE_OP): {
|
||||||
PyObject *right = POP();
|
PyObject *right = POP();
|
||||||
PyObject *left = TOP();
|
PyObject *left = TOP();
|
||||||
PyObject *res = cmp_outcome(oparg, left, right);
|
PyObject *res = cmp_outcome(oparg, left, right);
|
||||||
|
@ -2688,7 +2688,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(IMPORT_NAME) {
|
case TARGET(IMPORT_NAME): {
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
PyObject *fromlist = POP();
|
PyObject *fromlist = POP();
|
||||||
PyObject *level = TOP();
|
PyObject *level = TOP();
|
||||||
|
@ -2702,7 +2702,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(IMPORT_STAR) {
|
case TARGET(IMPORT_STAR): {
|
||||||
PyObject *from = POP(), *locals;
|
PyObject *from = POP(), *locals;
|
||||||
int err;
|
int err;
|
||||||
if (PyFrame_FastToLocalsWithError(f) < 0) {
|
if (PyFrame_FastToLocalsWithError(f) < 0) {
|
||||||
|
@ -2725,7 +2725,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(IMPORT_FROM) {
|
case TARGET(IMPORT_FROM): {
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
PyObject *from = TOP();
|
PyObject *from = TOP();
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
|
@ -2736,13 +2736,13 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(JUMP_FORWARD) {
|
case TARGET(JUMP_FORWARD): {
|
||||||
JUMPBY(oparg);
|
JUMPBY(oparg);
|
||||||
FAST_DISPATCH();
|
FAST_DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(POP_JUMP_IF_FALSE);
|
case TARGET(POP_JUMP_IF_FALSE): {
|
||||||
TARGET(POP_JUMP_IF_FALSE) {
|
PREDICTED(POP_JUMP_IF_FALSE);
|
||||||
PyObject *cond = POP();
|
PyObject *cond = POP();
|
||||||
int err;
|
int err;
|
||||||
if (cond == Py_True) {
|
if (cond == Py_True) {
|
||||||
|
@ -2765,8 +2765,8 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(POP_JUMP_IF_TRUE);
|
case TARGET(POP_JUMP_IF_TRUE): {
|
||||||
TARGET(POP_JUMP_IF_TRUE) {
|
PREDICTED(POP_JUMP_IF_TRUE);
|
||||||
PyObject *cond = POP();
|
PyObject *cond = POP();
|
||||||
int err;
|
int err;
|
||||||
if (cond == Py_False) {
|
if (cond == Py_False) {
|
||||||
|
@ -2790,7 +2790,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(JUMP_IF_FALSE_OR_POP) {
|
case TARGET(JUMP_IF_FALSE_OR_POP): {
|
||||||
PyObject *cond = TOP();
|
PyObject *cond = TOP();
|
||||||
int err;
|
int err;
|
||||||
if (cond == Py_True) {
|
if (cond == Py_True) {
|
||||||
|
@ -2814,7 +2814,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(JUMP_IF_TRUE_OR_POP) {
|
case TARGET(JUMP_IF_TRUE_OR_POP): {
|
||||||
PyObject *cond = TOP();
|
PyObject *cond = TOP();
|
||||||
int err;
|
int err;
|
||||||
if (cond == Py_False) {
|
if (cond == Py_False) {
|
||||||
|
@ -2839,8 +2839,8 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(JUMP_ABSOLUTE);
|
case TARGET(JUMP_ABSOLUTE): {
|
||||||
TARGET(JUMP_ABSOLUTE) {
|
PREDICTED(JUMP_ABSOLUTE);
|
||||||
JUMPTO(oparg);
|
JUMPTO(oparg);
|
||||||
#if FAST_LOOPS
|
#if FAST_LOOPS
|
||||||
/* Enabling this path speeds-up all while and for-loops by bypassing
|
/* Enabling this path speeds-up all while and for-loops by bypassing
|
||||||
|
@ -2856,7 +2856,7 @@ main_loop:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(GET_ITER) {
|
case TARGET(GET_ITER): {
|
||||||
/* before: [obj]; after [getiter(obj)] */
|
/* before: [obj]; after [getiter(obj)] */
|
||||||
PyObject *iterable = TOP();
|
PyObject *iterable = TOP();
|
||||||
PyObject *iter = PyObject_GetIter(iterable);
|
PyObject *iter = PyObject_GetIter(iterable);
|
||||||
|
@ -2869,7 +2869,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(GET_YIELD_FROM_ITER) {
|
case TARGET(GET_YIELD_FROM_ITER): {
|
||||||
/* before: [obj]; after [getiter(obj)] */
|
/* before: [obj]; after [getiter(obj)] */
|
||||||
PyObject *iterable = TOP();
|
PyObject *iterable = TOP();
|
||||||
PyObject *iter;
|
PyObject *iter;
|
||||||
|
@ -2898,8 +2898,8 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(FOR_ITER);
|
case TARGET(FOR_ITER): {
|
||||||
TARGET(FOR_ITER) {
|
PREDICTED(FOR_ITER);
|
||||||
/* before: [iter]; after: [iter, iter()] *or* [] */
|
/* before: [iter]; after: [iter, iter()] *or* [] */
|
||||||
PyObject *iter = TOP();
|
PyObject *iter = TOP();
|
||||||
PyObject *next = (*iter->ob_type->tp_iternext)(iter);
|
PyObject *next = (*iter->ob_type->tp_iternext)(iter);
|
||||||
|
@ -2924,7 +2924,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(SETUP_FINALLY) {
|
case TARGET(SETUP_FINALLY): {
|
||||||
/* NOTE: If you add any new block-setup opcodes that
|
/* NOTE: If you add any new block-setup opcodes that
|
||||||
are not try/except/finally handlers, you may need
|
are not try/except/finally handlers, you may need
|
||||||
to update the PyGen_NeedsFinalizing() function.
|
to update the PyGen_NeedsFinalizing() function.
|
||||||
|
@ -2935,7 +2935,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BEFORE_ASYNC_WITH) {
|
case TARGET(BEFORE_ASYNC_WITH): {
|
||||||
_Py_IDENTIFIER(__aexit__);
|
_Py_IDENTIFIER(__aexit__);
|
||||||
_Py_IDENTIFIER(__aenter__);
|
_Py_IDENTIFIER(__aenter__);
|
||||||
|
|
||||||
|
@ -2959,7 +2959,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(SETUP_ASYNC_WITH) {
|
case TARGET(SETUP_ASYNC_WITH): {
|
||||||
PyObject *res = POP();
|
PyObject *res = POP();
|
||||||
/* Setup the finally block before pushing the result
|
/* Setup the finally block before pushing the result
|
||||||
of __aenter__ on the stack. */
|
of __aenter__ on the stack. */
|
||||||
|
@ -2969,7 +2969,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(SETUP_WITH) {
|
case TARGET(SETUP_WITH): {
|
||||||
_Py_IDENTIFIER(__exit__);
|
_Py_IDENTIFIER(__exit__);
|
||||||
_Py_IDENTIFIER(__enter__);
|
_Py_IDENTIFIER(__enter__);
|
||||||
PyObject *mgr = TOP();
|
PyObject *mgr = TOP();
|
||||||
|
@ -2997,7 +2997,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(WITH_CLEANUP_START) {
|
case TARGET(WITH_CLEANUP_START): {
|
||||||
/* At the top of the stack are 1 or 6 values indicating
|
/* At the top of the stack are 1 or 6 values indicating
|
||||||
how/why we entered the finally clause:
|
how/why we entered the finally clause:
|
||||||
- TOP = NULL
|
- TOP = NULL
|
||||||
|
@ -3070,8 +3070,8 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(WITH_CLEANUP_FINISH);
|
case TARGET(WITH_CLEANUP_FINISH): {
|
||||||
TARGET(WITH_CLEANUP_FINISH) {
|
PREDICTED(WITH_CLEANUP_FINISH);
|
||||||
/* TOP = the result of calling the context.__exit__ bound method
|
/* TOP = the result of calling the context.__exit__ bound method
|
||||||
SECOND = either None or exception type
|
SECOND = either None or exception type
|
||||||
|
|
||||||
|
@ -3107,7 +3107,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(LOAD_METHOD) {
|
case TARGET(LOAD_METHOD): {
|
||||||
/* Designed to work in tamdem with CALL_METHOD. */
|
/* Designed to work in tamdem with CALL_METHOD. */
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
PyObject *obj = TOP();
|
PyObject *obj = TOP();
|
||||||
|
@ -3144,7 +3144,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(CALL_METHOD) {
|
case TARGET(CALL_METHOD): {
|
||||||
/* Designed to work in tamdem with LOAD_METHOD. */
|
/* Designed to work in tamdem with LOAD_METHOD. */
|
||||||
PyObject **sp, *res, *meth;
|
PyObject **sp, *res, *meth;
|
||||||
|
|
||||||
|
@ -3193,8 +3193,8 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICTED(CALL_FUNCTION);
|
case TARGET(CALL_FUNCTION): {
|
||||||
TARGET(CALL_FUNCTION) {
|
PREDICTED(CALL_FUNCTION);
|
||||||
PyObject **sp, *res;
|
PyObject **sp, *res;
|
||||||
sp = stack_pointer;
|
sp = stack_pointer;
|
||||||
res = call_function(&sp, oparg, NULL);
|
res = call_function(&sp, oparg, NULL);
|
||||||
|
@ -3206,7 +3206,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(CALL_FUNCTION_KW) {
|
case TARGET(CALL_FUNCTION_KW): {
|
||||||
PyObject **sp, *res, *names;
|
PyObject **sp, *res, *names;
|
||||||
|
|
||||||
names = POP();
|
names = POP();
|
||||||
|
@ -3223,7 +3223,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(CALL_FUNCTION_EX) {
|
case TARGET(CALL_FUNCTION_EX): {
|
||||||
PyObject *func, *callargs, *kwargs = NULL, *result;
|
PyObject *func, *callargs, *kwargs = NULL, *result;
|
||||||
if (oparg & 0x01) {
|
if (oparg & 0x01) {
|
||||||
kwargs = POP();
|
kwargs = POP();
|
||||||
|
@ -3276,7 +3276,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(MAKE_FUNCTION) {
|
case TARGET(MAKE_FUNCTION): {
|
||||||
PyObject *qualname = POP();
|
PyObject *qualname = POP();
|
||||||
PyObject *codeobj = POP();
|
PyObject *codeobj = POP();
|
||||||
PyFunctionObject *func = (PyFunctionObject *)
|
PyFunctionObject *func = (PyFunctionObject *)
|
||||||
|
@ -3309,7 +3309,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BUILD_SLICE) {
|
case TARGET(BUILD_SLICE): {
|
||||||
PyObject *start, *stop, *step, *slice;
|
PyObject *start, *stop, *step, *slice;
|
||||||
if (oparg == 3)
|
if (oparg == 3)
|
||||||
step = POP();
|
step = POP();
|
||||||
|
@ -3327,7 +3327,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(FORMAT_VALUE) {
|
case TARGET(FORMAT_VALUE): {
|
||||||
/* Handles f-string value formatting. */
|
/* Handles f-string value formatting. */
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
PyObject *fmt_spec;
|
PyObject *fmt_spec;
|
||||||
|
@ -3385,7 +3385,7 @@ main_loop:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(EXTENDED_ARG) {
|
case TARGET(EXTENDED_ARG): {
|
||||||
int oldoparg = oparg;
|
int oldoparg = oparg;
|
||||||
NEXTOPARG();
|
NEXTOPARG();
|
||||||
oparg |= oldoparg << 8;
|
oparg |= oldoparg << 8;
|
||||||
|
|
Loading…
Reference in New Issue