2026-02-02 16:57:04 +00:00
|
|
|
// This file is generated by Tools/cases_generator/record_function_generator.py
|
|
|
|
|
// from:
|
|
|
|
|
// Python/bytecodes.c
|
|
|
|
|
// Do not edit!
|
|
|
|
|
|
|
|
|
|
#ifdef TIER_ONE
|
|
|
|
|
#error "This file is for Tier 2 only"
|
|
|
|
|
#endif
|
|
|
|
|
void _PyOpcode_RecordFunction_TOS(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) {
|
|
|
|
|
_PyStackRef tos;
|
|
|
|
|
tos = stack_pointer[-1];
|
|
|
|
|
*recorded_value = (PyObject *)PyStackRef_AsPyObjectBorrow(tos);
|
|
|
|
|
Py_INCREF(*recorded_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _PyOpcode_RecordFunction_TOS_TYPE(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) {
|
|
|
|
|
_PyStackRef tos;
|
|
|
|
|
tos = stack_pointer[-1];
|
|
|
|
|
*recorded_value = (PyObject *)Py_TYPE(PyStackRef_AsPyObjectBorrow(tos));
|
|
|
|
|
Py_INCREF(*recorded_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _PyOpcode_RecordFunction_NOS(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) {
|
|
|
|
|
_PyStackRef nos;
|
|
|
|
|
nos = stack_pointer[-2];
|
|
|
|
|
*recorded_value = (PyObject *)PyStackRef_AsPyObjectBorrow(nos);
|
|
|
|
|
Py_INCREF(*recorded_value);
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-05 08:58:41 +00:00
|
|
|
void _PyOpcode_RecordFunction_NOS_GEN_FUNC(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) {
|
|
|
|
|
_PyStackRef nos;
|
|
|
|
|
nos = stack_pointer[-2];
|
|
|
|
|
PyObject *obj = PyStackRef_AsPyObjectBorrow(nos);
|
|
|
|
|
if (PyGen_Check(obj)) {
|
|
|
|
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
|
|
|
|
PyObject *func = (PyObject *)_PyFrame_GetFunction(&((PyGenObject *)obj)->gi_iframe);
|
|
|
|
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
|
|
|
|
*recorded_value = (PyObject *)func;
|
|
|
|
|
Py_INCREF(*recorded_value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-02 16:57:04 +00:00
|
|
|
void _PyOpcode_RecordFunction_4OS(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) {
|
|
|
|
|
_PyStackRef value;
|
|
|
|
|
value = stack_pointer[-4];
|
|
|
|
|
*recorded_value = (PyObject *)PyStackRef_AsPyObjectBorrow(value);
|
|
|
|
|
Py_INCREF(*recorded_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _PyOpcode_RecordFunction_CALLABLE(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) {
|
|
|
|
|
_PyStackRef func;
|
|
|
|
|
func = stack_pointer[-2 - oparg];
|
|
|
|
|
*recorded_value = (PyObject *)PyStackRef_AsPyObjectBorrow(func);
|
|
|
|
|
Py_INCREF(*recorded_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _PyOpcode_RecordFunction_BOUND_METHOD(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) {
|
|
|
|
|
_PyStackRef callable;
|
|
|
|
|
callable = stack_pointer[-2 - oparg];
|
|
|
|
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
|
|
|
|
|
if (Py_TYPE(callable_o) == &PyMethod_Type) {
|
|
|
|
|
PyObject *func = ((PyMethodObject *)callable_o)->im_func;
|
|
|
|
|
*recorded_value = (PyObject *)func;
|
|
|
|
|
Py_INCREF(*recorded_value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-05 08:58:41 +00:00
|
|
|
void _PyOpcode_RecordFunction_CODE(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) {
|
|
|
|
|
*recorded_value = (PyObject *)NULL;
|
|
|
|
|
Py_INCREF(*recorded_value);
|
2026-02-02 16:57:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define _RECORD_TOS_TYPE_INDEX 1
|
2026-02-05 08:58:41 +00:00
|
|
|
#define _RECORD_NOS_INDEX 2
|
|
|
|
|
#define _RECORD_NOS_GEN_FUNC_INDEX 3
|
|
|
|
|
#define _RECORD_CALLABLE_INDEX 4
|
|
|
|
|
#define _RECORD_BOUND_METHOD_INDEX 5
|
|
|
|
|
#define _RECORD_4OS_INDEX 6
|
2026-02-02 16:57:04 +00:00
|
|
|
const uint8_t _PyOpcode_RecordFunctionIndices[256] = {
|
|
|
|
|
[TO_BOOL_ALWAYS_TRUE] = _RECORD_TOS_TYPE_INDEX,
|
2026-02-05 08:58:41 +00:00
|
|
|
[BINARY_OP_SUBSCR_GETITEM] = _RECORD_NOS_INDEX,
|
|
|
|
|
[SEND_GEN] = _RECORD_NOS_GEN_FUNC_INDEX,
|
2026-02-02 16:57:04 +00:00
|
|
|
[LOAD_ATTR_INSTANCE_VALUE] = _RECORD_TOS_TYPE_INDEX,
|
|
|
|
|
[LOAD_ATTR_WITH_HINT] = _RECORD_TOS_TYPE_INDEX,
|
|
|
|
|
[LOAD_ATTR_SLOT] = _RECORD_TOS_TYPE_INDEX,
|
|
|
|
|
[LOAD_ATTR_CLASS_WITH_METACLASS_CHECK] = _RECORD_TOS_TYPE_INDEX,
|
|
|
|
|
[LOAD_ATTR_PROPERTY] = _RECORD_TOS_TYPE_INDEX,
|
|
|
|
|
[STORE_ATTR_WITH_HINT] = _RECORD_TOS_TYPE_INDEX,
|
|
|
|
|
[STORE_ATTR_SLOT] = _RECORD_TOS_TYPE_INDEX,
|
2026-02-05 08:58:41 +00:00
|
|
|
[FOR_ITER_GEN] = _RECORD_NOS_GEN_FUNC_INDEX,
|
2026-02-02 16:57:04 +00:00
|
|
|
[LOAD_ATTR_METHOD_WITH_VALUES] = _RECORD_TOS_TYPE_INDEX,
|
|
|
|
|
[LOAD_ATTR_METHOD_NO_DICT] = _RECORD_TOS_TYPE_INDEX,
|
|
|
|
|
[LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES] = _RECORD_TOS_TYPE_INDEX,
|
|
|
|
|
[LOAD_ATTR_NONDESCRIPTOR_NO_DICT] = _RECORD_TOS_TYPE_INDEX,
|
|
|
|
|
[LOAD_ATTR_METHOD_LAZY_DICT] = _RECORD_TOS_TYPE_INDEX,
|
|
|
|
|
[CALL_PY_GENERAL] = _RECORD_CALLABLE_INDEX,
|
|
|
|
|
[CALL_BOUND_METHOD_GENERAL] = _RECORD_BOUND_METHOD_INDEX,
|
|
|
|
|
[CALL_NON_PY_GENERAL] = _RECORD_CALLABLE_INDEX,
|
|
|
|
|
[CALL_BOUND_METHOD_EXACT_ARGS] = _RECORD_BOUND_METHOD_INDEX,
|
|
|
|
|
[CALL_PY_EXACT_ARGS] = _RECORD_CALLABLE_INDEX,
|
|
|
|
|
[CALL_ALLOC_AND_ENTER_INIT] = _RECORD_CALLABLE_INDEX,
|
|
|
|
|
[CALL_BUILTIN_CLASS] = _RECORD_CALLABLE_INDEX,
|
|
|
|
|
[CALL_BUILTIN_O] = _RECORD_CALLABLE_INDEX,
|
|
|
|
|
[CALL_BUILTIN_FAST] = _RECORD_CALLABLE_INDEX,
|
|
|
|
|
[CALL_BUILTIN_FAST_WITH_KEYWORDS] = _RECORD_CALLABLE_INDEX,
|
|
|
|
|
[CALL_METHOD_DESCRIPTOR_O] = _RECORD_CALLABLE_INDEX,
|
|
|
|
|
[CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = _RECORD_CALLABLE_INDEX,
|
|
|
|
|
[CALL_METHOD_DESCRIPTOR_NOARGS] = _RECORD_CALLABLE_INDEX,
|
|
|
|
|
[CALL_EX_PY] = _RECORD_4OS_INDEX,
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-05 08:58:41 +00:00
|
|
|
const _Py_RecordFuncPtr _PyOpcode_RecordFunctions[7] = {
|
2026-02-02 16:57:04 +00:00
|
|
|
[0] = NULL,
|
|
|
|
|
[_RECORD_TOS_TYPE_INDEX] = _PyOpcode_RecordFunction_TOS_TYPE,
|
|
|
|
|
[_RECORD_NOS_INDEX] = _PyOpcode_RecordFunction_NOS,
|
2026-02-05 08:58:41 +00:00
|
|
|
[_RECORD_NOS_GEN_FUNC_INDEX] = _PyOpcode_RecordFunction_NOS_GEN_FUNC,
|
2026-02-02 16:57:04 +00:00
|
|
|
[_RECORD_CALLABLE_INDEX] = _PyOpcode_RecordFunction_CALLABLE,
|
|
|
|
|
[_RECORD_BOUND_METHOD_INDEX] = _PyOpcode_RecordFunction_BOUND_METHOD,
|
|
|
|
|
[_RECORD_4OS_INDEX] = _PyOpcode_RecordFunction_4OS,
|
|
|
|
|
};
|