mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
GH-104610: Remove the use of PREDICT
macros. (GH-104651)
This commit is contained in:
parent
d63a7c3694
commit
064de0e3fc
3 changed files with 507 additions and 551 deletions
|
@ -44,7 +44,6 @@
|
||||||
#define DEOPT_IF(cond, instname) ((void)0)
|
#define DEOPT_IF(cond, instname) ((void)0)
|
||||||
#define ERROR_IF(cond, labelname) ((void)0)
|
#define ERROR_IF(cond, labelname) ((void)0)
|
||||||
#define GO_TO_INSTRUCTION(instname) ((void)0)
|
#define GO_TO_INSTRUCTION(instname) ((void)0)
|
||||||
#define PREDICT(opname) ((void)0)
|
|
||||||
|
|
||||||
#define inst(name, ...) case name:
|
#define inst(name, ...) case name:
|
||||||
#define op(name, ...) /* NAME is ignored */
|
#define op(name, ...) /* NAME is ignored */
|
||||||
|
@ -562,14 +561,12 @@ dummy_func(
|
||||||
|
|
||||||
inst(LIST_APPEND, (list, unused[oparg-1], v -- list, unused[oparg-1])) {
|
inst(LIST_APPEND, (list, unused[oparg-1], v -- list, unused[oparg-1])) {
|
||||||
ERROR_IF(_PyList_AppendTakeRef((PyListObject *)list, v) < 0, error);
|
ERROR_IF(_PyList_AppendTakeRef((PyListObject *)list, v) < 0, error);
|
||||||
PREDICT(JUMP_BACKWARD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(SET_ADD, (set, unused[oparg-1], v -- set, unused[oparg-1])) {
|
inst(SET_ADD, (set, unused[oparg-1], v -- set, unused[oparg-1])) {
|
||||||
int err = PySet_Add(set, v);
|
int err = PySet_Add(set, v);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err, error);
|
||||||
PREDICT(JUMP_BACKWARD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
family(store_subscr, INLINE_CACHE_ENTRIES_STORE_SUBSCR) = {
|
family(store_subscr, INLINE_CACHE_ENTRIES_STORE_SUBSCR) = {
|
||||||
|
@ -824,8 +821,6 @@ dummy_func(
|
||||||
Py_DECREF(next_iter);
|
Py_DECREF(next_iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PREDICT(LOAD_CONST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(GET_AWAITABLE, (iterable -- iter)) {
|
inst(GET_AWAITABLE, (iterable -- iter)) {
|
||||||
|
@ -852,8 +847,6 @@ dummy_func(
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR_IF(iter == NULL, error);
|
ERROR_IF(iter == NULL, error);
|
||||||
|
|
||||||
PREDICT(LOAD_CONST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
family(send, INLINE_CACHE_ENTRIES_SEND) = {
|
family(send, INLINE_CACHE_ENTRIES_SEND) = {
|
||||||
|
@ -1611,7 +1604,6 @@ dummy_func(
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true, error);
|
||||||
}
|
}
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
PREDICT(CALL_FUNCTION_EX);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(MAP_ADD, (key, value --)) {
|
inst(MAP_ADD, (key, value --)) {
|
||||||
|
@ -1620,7 +1612,6 @@ dummy_func(
|
||||||
/* dict[key] = value */
|
/* dict[key] = value */
|
||||||
// Do not DECREF INPUTS because the function steals the references
|
// Do not DECREF INPUTS because the function steals the references
|
||||||
ERROR_IF(_PyDict_SetItem_Take2((PyDictObject *)dict, key, value) != 0, error);
|
ERROR_IF(_PyDict_SetItem_Take2((PyDictObject *)dict, key, value) != 0, error);
|
||||||
PREDICT(JUMP_BACKWARD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(INSTRUMENTED_LOAD_SUPER_ATTR, (unused/9, unused, unused, unused -- unused if (oparg & 1), unused)) {
|
inst(INSTRUMENTED_LOAD_SUPER_ATTR, (unused/9, unused, unused, unused -- unused if (oparg & 1), unused)) {
|
||||||
|
@ -2248,13 +2239,11 @@ dummy_func(
|
||||||
inst(MATCH_MAPPING, (subject -- subject, res)) {
|
inst(MATCH_MAPPING, (subject -- subject, res)) {
|
||||||
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING;
|
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING;
|
||||||
res = match ? Py_True : Py_False;
|
res = match ? Py_True : Py_False;
|
||||||
PREDICT(POP_JUMP_IF_FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(MATCH_SEQUENCE, (subject -- subject, res)) {
|
inst(MATCH_SEQUENCE, (subject -- subject, res)) {
|
||||||
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE;
|
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE;
|
||||||
res = match ? Py_True : Py_False;
|
res = match ? Py_True : Py_False;
|
||||||
PREDICT(POP_JUMP_IF_FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(MATCH_KEYS, (subject, keys -- subject, keys, values_or_none)) {
|
inst(MATCH_KEYS, (subject, keys -- subject, keys, values_or_none)) {
|
||||||
|
@ -2295,7 +2284,6 @@ dummy_func(
|
||||||
}
|
}
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
}
|
}
|
||||||
PREDICT(LOAD_CONST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Most members of this family are "secretly" super-instructions.
|
// Most members of this family are "secretly" super-instructions.
|
||||||
|
@ -2485,7 +2473,6 @@ dummy_func(
|
||||||
Py_DECREF(exit);
|
Py_DECREF(exit);
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true, error);
|
||||||
}
|
}
|
||||||
PREDICT(GET_AWAITABLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(BEFORE_WITH, (mgr -- exit, res)) {
|
inst(BEFORE_WITH, (mgr -- exit, res)) {
|
||||||
|
|
|
@ -174,21 +174,6 @@ GETITEM(PyObject *v, Py_ssize_t i) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PREDICT_ID(op) PRED_##op
|
#define PREDICT_ID(op) PRED_##op
|
||||||
|
|
||||||
#if USE_COMPUTED_GOTOS
|
|
||||||
#define PREDICT(op) if (0) goto PREDICT_ID(op)
|
|
||||||
#else
|
|
||||||
#define PREDICT(next_op) \
|
|
||||||
do { \
|
|
||||||
_Py_CODEUNIT word = *next_instr; \
|
|
||||||
opcode = word.op.code; \
|
|
||||||
if (opcode == next_op) { \
|
|
||||||
oparg = word.op.arg; \
|
|
||||||
INSTRUCTION_START(next_op); \
|
|
||||||
goto PREDICT_ID(next_op); \
|
|
||||||
} \
|
|
||||||
} while(0)
|
|
||||||
#endif
|
|
||||||
#define PREDICTED(op) PREDICT_ID(op):
|
#define PREDICTED(op) PREDICT_ID(op):
|
||||||
|
|
||||||
|
|
||||||
|
|
1030
Python/generated_cases.c.h
generated
1030
Python/generated_cases.c.h
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue