}
write_u32(cache->version, keys_version);
cache->index = (uint16_t)index;
- _py_set_opocde(instr, LOAD_ATTR_MODULE);
+ _py_set_opcode(instr, LOAD_ATTR_MODULE);
return 0;
}
}
write_u32(cache->version, type->tp_version_tag);
cache->index = (uint16_t)index;
- _py_set_opocde(instr, values_op);
+ _py_set_opcode(instr, values_op);
}
else {
PyDictObject *dict = (PyDictObject *)_PyDictOrValues_GetDict(dorv);
}
cache->index = (uint16_t)index;
write_u32(cache->version, type->tp_version_tag);
- _py_set_opocde(instr, hint_op);
+ _py_set_opcode(instr, hint_op);
}
return 1;
}
write_u32(lm_cache->type_version, type->tp_version_tag);
/* borrowed */
write_obj(lm_cache->descr, fget);
- _py_set_opocde(instr, LOAD_ATTR_PROPERTY);
+ _py_set_opcode(instr, LOAD_ATTR_PROPERTY);
goto success;
}
case OBJECT_SLOT:
assert(offset > 0);
cache->index = (uint16_t)offset;
write_u32(cache->version, type->tp_version_tag);
- _py_set_opocde(instr, LOAD_ATTR_SLOT);
+ _py_set_opcode(instr, LOAD_ATTR_SLOT);
goto success;
}
case DUNDER_CLASS:
assert(offset == (uint16_t)offset);
cache->index = (uint16_t)offset;
write_u32(cache->version, type->tp_version_tag);
- _py_set_opocde(instr, LOAD_ATTR_SLOT);
+ _py_set_opcode(instr, LOAD_ATTR_SLOT);
goto success;
}
case OTHER_SLOT:
/* borrowed */
write_obj(lm_cache->descr, descr);
write_u32(lm_cache->type_version, type->tp_version_tag);
- _py_set_opocde(instr, LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN);
+ _py_set_opcode(instr, LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN);
goto success;
}
case BUILTIN_CLASSMETHOD:
fail:
STAT_INC(LOAD_ATTR, failure);
assert(!PyErr_Occurred());
- _py_set_opocde(instr, LOAD_ATTR);
+ _py_set_opcode(instr, LOAD_ATTR);
cache->counter = adaptive_counter_backoff(cache->counter);
return;
success:
assert(offset > 0);
cache->index = (uint16_t)offset;
write_u32(cache->version, type->tp_version_tag);
- _py_set_opocde(instr, STORE_ATTR_SLOT);
+ _py_set_opcode(instr, STORE_ATTR_SLOT);
goto success;
}
case DUNDER_CLASS:
fail:
STAT_INC(STORE_ATTR, failure);
assert(!PyErr_Occurred());
- _py_set_opocde(instr, STORE_ATTR);
+ _py_set_opcode(instr, STORE_ATTR);
cache->counter = adaptive_counter_backoff(cache->counter);
return;
success:
case NON_DESCRIPTOR:
write_u32(cache->type_version, ((PyTypeObject *)owner)->tp_version_tag);
write_obj(cache->descr, descr);
- _py_set_opocde(instr, LOAD_ATTR_CLASS);
+ _py_set_opcode(instr, LOAD_ATTR_CLASS);
return 0;
#ifdef Py_STATS
case ABSENT:
}
switch(dictkind) {
case NO_DICT:
- _py_set_opocde(instr, LOAD_ATTR_METHOD_NO_DICT);
+ _py_set_opcode(instr, LOAD_ATTR_METHOD_NO_DICT);
break;
case MANAGED_VALUES:
- _py_set_opocde(instr, LOAD_ATTR_METHOD_WITH_VALUES);
+ _py_set_opcode(instr, LOAD_ATTR_METHOD_WITH_VALUES);
break;
case MANAGED_DICT:
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_HAS_MANAGED_DICT);
goto fail;
case OFFSET_DICT:
assert(owner_cls->tp_dictoffset > 0 && owner_cls->tp_dictoffset <= INT16_MAX);
- _py_set_opocde(instr, LOAD_ATTR_METHOD_WITH_DICT);
+ _py_set_opcode(instr, LOAD_ATTR_METHOD_WITH_DICT);
break;
case LAZY_DICT:
assert(owner_cls->tp_dictoffset > 0 && owner_cls->tp_dictoffset <= INT16_MAX);
- _py_set_opocde(instr, LOAD_ATTR_METHOD_LAZY_DICT);
+ _py_set_opcode(instr, LOAD_ATTR_METHOD_LAZY_DICT);
break;
}
/* `descr` is borrowed. This is safe for methods (even inherited ones from
}
cache->index = (uint16_t)index;
write_u32(cache->module_keys_version, keys_version);
- _py_set_opocde(instr, LOAD_GLOBAL_MODULE);
+ _py_set_opcode(instr, LOAD_GLOBAL_MODULE);
goto success;
}
if (!PyDict_CheckExact(builtins)) {
cache->index = (uint16_t)index;
write_u32(cache->module_keys_version, globals_version);
cache->builtin_keys_version = (uint16_t)builtins_version;
- _py_set_opocde(instr, LOAD_GLOBAL_BUILTIN);
+ _py_set_opcode(instr, LOAD_GLOBAL_BUILTIN);
goto success;
fail:
STAT_INC(LOAD_GLOBAL, failure);
assert(!PyErr_Occurred());
- _py_set_opocde(instr, LOAD_GLOBAL);
+ _py_set_opcode(instr, LOAD_GLOBAL);
cache->counter = adaptive_counter_backoff(cache->counter);
return;
success:
PyTypeObject *container_type = Py_TYPE(container);
if (container_type == &PyList_Type) {
if (PyLong_CheckExact(sub)) {
- _py_set_opocde(instr, BINARY_SUBSCR_LIST_INT);
+ _py_set_opcode(instr, BINARY_SUBSCR_LIST_INT);
goto success;
}
SPECIALIZATION_FAIL(BINARY_SUBSCR,
}
if (container_type == &PyTuple_Type) {
if (PyLong_CheckExact(sub)) {
- _py_set_opocde(instr, BINARY_SUBSCR_TUPLE_INT);
+ _py_set_opcode(instr, BINARY_SUBSCR_TUPLE_INT);
goto success;
}
SPECIALIZATION_FAIL(BINARY_SUBSCR,
goto fail;
}
if (container_type == &PyDict_Type) {
- _py_set_opocde(instr, BINARY_SUBSCR_DICT);
+ _py_set_opcode(instr, BINARY_SUBSCR_DICT);
goto success;
}
PyTypeObject *cls = Py_TYPE(container);
}
cache->func_version = version;
((PyHeapTypeObject *)container_type)->_spec_cache.getitem = descriptor;
- _py_set_opocde(instr, BINARY_SUBSCR_GETITEM);
+ _py_set_opcode(instr, BINARY_SUBSCR_GETITEM);
goto success;
}
SPECIALIZATION_FAIL(BINARY_SUBSCR,
fail:
STAT_INC(BINARY_SUBSCR, failure);
assert(!PyErr_Occurred());
- _py_set_opocde(instr, BINARY_SUBSCR);
+ _py_set_opcode(instr, BINARY_SUBSCR);
cache->counter = adaptive_counter_backoff(cache->counter);
return;
success:
if ((Py_SIZE(sub) == 0 || Py_SIZE(sub) == 1)
&& ((PyLongObject *)sub)->ob_digit[0] < (size_t)PyList_GET_SIZE(container))
{
- _py_set_opocde(instr, STORE_SUBSCR_LIST_INT);
+ _py_set_opcode(instr, STORE_SUBSCR_LIST_INT);
goto success;
}
else {
}
}
if (container_type == &PyDict_Type) {
- _py_set_opocde(instr, STORE_SUBSCR_DICT);
+ _py_set_opcode(instr, STORE_SUBSCR_DICT);
goto success;
}
#ifdef Py_STATS
fail:
STAT_INC(STORE_SUBSCR, failure);
assert(!PyErr_Occurred());
- _py_set_opocde(instr, STORE_SUBSCR);
+ _py_set_opcode(instr, STORE_SUBSCR);
cache->counter = adaptive_counter_backoff(cache->counter);
return;
success:
int oparg = _Py_OPARG(*instr);
if (nargs == 1 && kwnames == NULL && oparg == 1) {
if (tp == &PyUnicode_Type) {
- _py_set_opocde(instr, CALL_NO_KW_STR_1);
+ _py_set_opcode(instr, CALL_NO_KW_STR_1);
return 0;
}
else if (tp == &PyType_Type) {
- _py_set_opocde(instr, CALL_NO_KW_TYPE_1);
+ _py_set_opcode(instr, CALL_NO_KW_TYPE_1);
return 0;
}
else if (tp == &PyTuple_Type) {
- _py_set_opocde(instr, CALL_NO_KW_TUPLE_1);
+ _py_set_opcode(instr, CALL_NO_KW_TUPLE_1);
return 0;
}
}
if (tp->tp_vectorcall != NULL) {
- _py_set_opocde(instr, CALL_BUILTIN_CLASS);
+ _py_set_opcode(instr, CALL_BUILTIN_CLASS);
return 0;
}
SPECIALIZATION_FAIL(CALL, tp == &PyUnicode_Type ?
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_WRONG_NUMBER_ARGUMENTS);
return -1;
}
- _py_set_opocde(instr, CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS);
+ _py_set_opcode(instr, CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS);
return 0;
}
case METH_O: {
bool pop = (_Py_OPCODE(next) == POP_TOP);
int oparg = _Py_OPARG(*instr);
if ((PyObject *)descr == list_append && oparg == 1 && pop) {
- _py_set_opocde(instr, CALL_NO_KW_LIST_APPEND);
+ _py_set_opcode(instr, CALL_NO_KW_LIST_APPEND);
return 0;
}
- _py_set_opocde(instr, CALL_NO_KW_METHOD_DESCRIPTOR_O);
+ _py_set_opcode(instr, CALL_NO_KW_METHOD_DESCRIPTOR_O);
return 0;
}
case METH_FASTCALL: {
- _py_set_opocde(instr, CALL_NO_KW_METHOD_DESCRIPTOR_FAST);
+ _py_set_opcode(instr, CALL_NO_KW_METHOD_DESCRIPTOR_FAST);
return 0;
}
case METH_FASTCALL|METH_KEYWORDS: {
- _py_set_opocde(instr, CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS);
+ _py_set_opcode(instr, CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS);
return 0;
}
}
write_u32(cache->func_version, version);
cache->min_args = min_args;
if (argcount == nargs) {
- _py_set_opocde(instr, bound_method ? CALL_BOUND_METHOD_EXACT_ARGS : CALL_PY_EXACT_ARGS);
+ _py_set_opcode(instr, bound_method ? CALL_BOUND_METHOD_EXACT_ARGS : CALL_PY_EXACT_ARGS);
}
else if (bound_method) {
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_BOUND_METHOD);
return -1;
}
else {
- _py_set_opocde(instr, CALL_PY_WITH_DEFAULTS);
+ _py_set_opcode(instr, CALL_PY_WITH_DEFAULTS);
}
return 0;
}
/* len(o) */
PyInterpreterState *interp = _PyInterpreterState_GET();
if (callable == interp->callable_cache.len) {
- _py_set_opocde(instr, CALL_NO_KW_LEN);
+ _py_set_opcode(instr, CALL_NO_KW_LEN);
return 0;
}
- _py_set_opocde(instr, CALL_NO_KW_BUILTIN_O);
+ _py_set_opcode(instr, CALL_NO_KW_BUILTIN_O);
return 0;
}
case METH_FASTCALL: {
/* isinstance(o1, o2) */
PyInterpreterState *interp = _PyInterpreterState_GET();
if (callable == interp->callable_cache.isinstance) {
- _py_set_opocde(instr, CALL_NO_KW_ISINSTANCE);
+ _py_set_opcode(instr, CALL_NO_KW_ISINSTANCE);
return 0;
}
}
- _py_set_opocde(instr, CALL_NO_KW_BUILTIN_FAST);
+ _py_set_opcode(instr, CALL_NO_KW_BUILTIN_FAST);
return 0;
}
case METH_FASTCALL | METH_KEYWORDS: {
- _py_set_opocde(instr, CALL_BUILTIN_FAST_WITH_KEYWORDS);
+ _py_set_opcode(instr, CALL_BUILTIN_FAST_WITH_KEYWORDS);
return 0;
}
default:
if (fail) {
STAT_INC(CALL, failure);
assert(!PyErr_Occurred());
- _py_set_opocde(instr, CALL);
+ _py_set_opcode(instr, CALL);
cache->counter = adaptive_counter_backoff(cache->counter);
}
else {
bool to_store = (_Py_OPCODE(next) == STORE_FAST ||
_Py_OPCODE(next) == STORE_FAST__LOAD_FAST);
if (to_store && locals[_Py_OPARG(next)] == lhs) {
- _py_set_opocde(instr, BINARY_OP_INPLACE_ADD_UNICODE);
+ _py_set_opcode(instr, BINARY_OP_INPLACE_ADD_UNICODE);
goto success;
}
- _py_set_opocde(instr, BINARY_OP_ADD_UNICODE);
+ _py_set_opcode(instr, BINARY_OP_ADD_UNICODE);
goto success;
}
if (PyLong_CheckExact(lhs)) {
- _py_set_opocde(instr, BINARY_OP_ADD_INT);
+ _py_set_opcode(instr, BINARY_OP_ADD_INT);
goto success;
}
if (PyFloat_CheckExact(lhs)) {
- _py_set_opocde(instr, BINARY_OP_ADD_FLOAT);
+ _py_set_opcode(instr, BINARY_OP_ADD_FLOAT);
goto success;
}
break;
break;
}
if (PyLong_CheckExact(lhs)) {
- _py_set_opocde(instr, BINARY_OP_MULTIPLY_INT);
+ _py_set_opcode(instr, BINARY_OP_MULTIPLY_INT);
goto success;
}
if (PyFloat_CheckExact(lhs)) {
- _py_set_opocde(instr, BINARY_OP_MULTIPLY_FLOAT);
+ _py_set_opcode(instr, BINARY_OP_MULTIPLY_FLOAT);
goto success;
}
break;
break;
}
if (PyLong_CheckExact(lhs)) {
- _py_set_opocde(instr, BINARY_OP_SUBTRACT_INT);
+ _py_set_opcode(instr, BINARY_OP_SUBTRACT_INT);
goto success;
}
if (PyFloat_CheckExact(lhs)) {
- _py_set_opocde(instr, BINARY_OP_SUBTRACT_FLOAT);
+ _py_set_opcode(instr, BINARY_OP_SUBTRACT_FLOAT);
goto success;
}
break;
}
SPECIALIZATION_FAIL(BINARY_OP, binary_op_fail_kind(oparg, lhs, rhs));
STAT_INC(BINARY_OP, failure);
- _py_set_opocde(instr, BINARY_OP);
+ _py_set_opcode(instr, BINARY_OP);
cache->counter = adaptive_counter_backoff(cache->counter);
return;
success:
goto failure;
}
if (PyFloat_CheckExact(lhs)) {
- _py_set_opocde(instr, COMPARE_OP_FLOAT_JUMP);
+ _py_set_opcode(instr, COMPARE_OP_FLOAT_JUMP);
cache->mask = when_to_jump_mask;
goto success;
}
if (PyLong_CheckExact(lhs)) {
if (Py_ABS(Py_SIZE(lhs)) <= 1 && Py_ABS(Py_SIZE(rhs)) <= 1) {
- _py_set_opocde(instr, COMPARE_OP_INT_JUMP);
+ _py_set_opcode(instr, COMPARE_OP_INT_JUMP);
cache->mask = when_to_jump_mask;
goto success;
}
goto failure;
}
else {
- _py_set_opocde(instr, COMPARE_OP_STR_JUMP);
+ _py_set_opcode(instr, COMPARE_OP_STR_JUMP);
cache->mask = (when_to_jump_mask & 2) == 0;
goto success;
}
SPECIALIZATION_FAIL(COMPARE_OP, compare_op_fail_kind(lhs, rhs));
failure:
STAT_INC(COMPARE_OP, failure);
- _py_set_opocde(instr, COMPARE_OP);
+ _py_set_opcode(instr, COMPARE_OP);
cache->counter = adaptive_counter_backoff(cache->counter);
return;
success:
goto failure;
}
if (PyTuple_GET_SIZE(seq) == 2) {
- _py_set_opocde(instr, UNPACK_SEQUENCE_TWO_TUPLE);
+ _py_set_opcode(instr, UNPACK_SEQUENCE_TWO_TUPLE);
goto success;
}
- _py_set_opocde(instr, UNPACK_SEQUENCE_TUPLE);
+ _py_set_opcode(instr, UNPACK_SEQUENCE_TUPLE);
goto success;
}
if (PyList_CheckExact(seq)) {
SPECIALIZATION_FAIL(UNPACK_SEQUENCE, SPEC_FAIL_EXPECTED_ERROR);
goto failure;
}
- _py_set_opocde(instr, UNPACK_SEQUENCE_LIST);
+ _py_set_opcode(instr, UNPACK_SEQUENCE_LIST);
goto success;
}
SPECIALIZATION_FAIL(UNPACK_SEQUENCE, unpack_sequence_fail_kind(seq));
failure:
STAT_INC(UNPACK_SEQUENCE, failure);
- _py_set_opocde(instr, UNPACK_SEQUENCE);
+ _py_set_opcode(instr, UNPACK_SEQUENCE);
cache->counter = adaptive_counter_backoff(cache->counter);
return;
success:
_Py_CODEUNIT next = instr[1+INLINE_CACHE_ENTRIES_FOR_ITER];
int next_op = _PyOpcode_Deopt[_Py_OPCODE(next)];
if (tp == &PyListIter_Type) {
- _py_set_opocde(instr, FOR_ITER_LIST);
+ _py_set_opcode(instr, FOR_ITER_LIST);
goto success;
}
else if (tp == &PyTupleIter_Type) {
- _py_set_opocde(instr, FOR_ITER_TUPLE);
+ _py_set_opcode(instr, FOR_ITER_TUPLE);
goto success;
}
else if (tp == &PyRangeIter_Type && next_op == STORE_FAST) {
- _py_set_opocde(instr, FOR_ITER_RANGE);
+ _py_set_opcode(instr, FOR_ITER_RANGE);
goto success;
}
else if (tp == &PyGen_Type && oparg <= SHRT_MAX) {
assert(_Py_OPCODE(instr[oparg + INLINE_CACHE_ENTRIES_FOR_ITER + 1]) == END_FOR);
- _py_set_opocde(instr, FOR_ITER_GEN);
+ _py_set_opcode(instr, FOR_ITER_GEN);
goto success;
}
SPECIALIZATION_FAIL(FOR_ITER,
_PySpecialization_ClassifyIterator(iter));
STAT_INC(FOR_ITER, failure);
- _py_set_opocde(instr, FOR_ITER);
+ _py_set_opcode(instr, FOR_ITER);
cache->counter = adaptive_counter_backoff(cache->counter);
return;
success: