#ifndef Py_BUILD_CORE_BUILTIN #define Py_BUILD_CORE_MODULE … #endif #include "Python.h" #include "compile.h" #include "opcode.h" #include "pycore_ceval.h" #include "pycore_code.h" #include "pycore_compile.h" #include "pycore_intrinsics.h" #include "pycore_optimizer.h" // _Py_GetExecutor() #include "pycore_opcode_metadata.h" // IS_VALID_OPCODE, OPCODE_HAS_*, etc #include "pycore_opcode_utils.h" /*[clinic input] module _opcode [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=117442e66eb376e6]*/ #include "clinic/_opcode.c.h" /*[clinic input] _opcode.stack_effect -> int opcode: int oparg: object = None / * jump: object = None Compute the stack effect of the opcode. [clinic start generated code]*/ static int _opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg, PyObject *jump) /*[clinic end generated code: output=64a18f2ead954dbb input=461c9d4a44851898]*/ { … } /*[clinic input] _opcode.is_valid -> bool opcode: int Return True if opcode is valid, False otherwise. [clinic start generated code]*/ static int _opcode_is_valid_impl(PyObject *module, int opcode) /*[clinic end generated code: output=b0d918ea1d073f65 input=fe23e0aa194ddae0]*/ { … } /*[clinic input] _opcode.has_arg -> bool opcode: int Return True if the opcode uses its oparg, False otherwise. [clinic start generated code]*/ static int _opcode_has_arg_impl(PyObject *module, int opcode) /*[clinic end generated code: output=7a062d3b2dcc0815 input=93d878ba6361db5f]*/ { … } /*[clinic input] _opcode.has_const -> bool opcode: int Return True if the opcode accesses a constant, False otherwise. [clinic start generated code]*/ static int _opcode_has_const_impl(PyObject *module, int opcode) /*[clinic end generated code: output=c646d5027c634120 input=a6999e4cf13f9410]*/ { … } /*[clinic input] _opcode.has_name -> bool opcode: int Return True if the opcode accesses an attribute by name, False otherwise. [clinic start generated code]*/ static int _opcode_has_name_impl(PyObject *module, int opcode) /*[clinic end generated code: output=b49a83555c2fa517 input=448aa5e4bcc947ba]*/ { … } /*[clinic input] _opcode.has_jump -> bool opcode: int Return True if the opcode has a jump target, False otherwise. [clinic start generated code]*/ static int _opcode_has_jump_impl(PyObject *module, int opcode) /*[clinic end generated code: output=e9c583c669f1c46a input=35f711274357a0c3]*/ { … } /*[clinic input] _opcode.has_free -> bool opcode: int Return True if the opcode accesses a free variable, False otherwise. Note that 'free' in this context refers to names in the current scope that are referenced by inner scopes or names in outer scopes that are referenced from this scope. It does not include references to global or builtin scopes. [clinic start generated code]*/ static int _opcode_has_free_impl(PyObject *module, int opcode) /*[clinic end generated code: output=d81ae4d79af0ee26 input=117dcd5c19c1139b]*/ { … } /*[clinic input] _opcode.has_local -> bool opcode: int Return True if the opcode accesses a local variable, False otherwise. [clinic start generated code]*/ static int _opcode_has_local_impl(PyObject *module, int opcode) /*[clinic end generated code: output=da5a8616b7a5097b input=9a798ee24aaef49d]*/ { … } /*[clinic input] _opcode.has_exc -> bool opcode: int Return True if the opcode sets an exception handler, False otherwise. [clinic start generated code]*/ static int _opcode_has_exc_impl(PyObject *module, int opcode) /*[clinic end generated code: output=41b68dff0ec82a52 input=db0e4bdb9bf13fa5]*/ { … } /*[clinic input] _opcode.get_specialization_stats Return the specialization stats [clinic start generated code]*/ static PyObject * _opcode_get_specialization_stats_impl(PyObject *module) /*[clinic end generated code: output=fcbc32fdfbec5c17 input=e1f60db68d8ce5f6]*/ { … } /*[clinic input] _opcode.get_nb_ops Return array of symbols of binary ops. Indexed by the BINARY_OP oparg value. [clinic start generated code]*/ static PyObject * _opcode_get_nb_ops_impl(PyObject *module) /*[clinic end generated code: output=d997d306cc15426f input=9462fc544c823176]*/ { … } /*[clinic input] _opcode.get_intrinsic1_descs Return a list of names of the unary intrinsics. [clinic start generated code]*/ static PyObject * _opcode_get_intrinsic1_descs_impl(PyObject *module) /*[clinic end generated code: output=bd1ddb6b4447d18b input=13b51c712618459b]*/ { … } /*[clinic input] _opcode.get_intrinsic2_descs Return a list of names of the binary intrinsics. [clinic start generated code]*/ static PyObject * _opcode_get_intrinsic2_descs_impl(PyObject *module) /*[clinic end generated code: output=40e62bc27584c8a0 input=e83068f249f5471b]*/ { … } /*[clinic input] _opcode.get_special_method_names Return a list of special method names. [clinic start generated code]*/ static PyObject * _opcode_get_special_method_names_impl(PyObject *module) /*[clinic end generated code: output=fce72614cd988d17 input=25f2115560bdf163]*/ { … } /*[clinic input] _opcode.get_executor code: object offset: int Return the executor object at offset in code if exists, None otherwise. [clinic start generated code]*/ static PyObject * _opcode_get_executor_impl(PyObject *module, PyObject *code, int offset) /*[clinic end generated code: output=c035c7a47b16648f input=85eff93ea7aac282]*/ { … } static PyMethodDef opcode_functions[] = …; static int _opcode_exec(PyObject *m) { … } static PyModuleDef_Slot module_slots[] = …; static struct PyModuleDef opcodemodule = …; PyMODINIT_FUNC PyInit__opcode(void) { … }