(root)/
Python-3.12.0/
Modules/
clinic/
_opcode.c.h
       1  /*[clinic input]
       2  preserve
       3  [clinic start generated code]*/
       4  
       5  #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
       6  #  include "pycore_gc.h"            // PyGC_Head
       7  #  include "pycore_runtime.h"       // _Py_ID()
       8  #endif
       9  
      10  
      11  PyDoc_STRVAR(_opcode_stack_effect__doc__,
      12  "stack_effect($module, opcode, oparg=None, /, *, jump=None)\n"
      13  "--\n"
      14  "\n"
      15  "Compute the stack effect of the opcode.");
      16  
      17  #define _OPCODE_STACK_EFFECT_METHODDEF    \
      18      {"stack_effect", _PyCFunction_CAST(_opcode_stack_effect), METH_FASTCALL|METH_KEYWORDS, _opcode_stack_effect__doc__},
      19  
      20  static int
      21  _opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg,
      22                            PyObject *jump);
      23  
      24  static PyObject *
      25  _opcode_stack_effect(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
      26  {
      27      PyObject *return_value = NULL;
      28      #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
      29  
      30      #define NUM_KEYWORDS 1
      31      static struct {
      32          PyGC_Head _this_is_not_used;
      33          PyObject_VAR_HEAD
      34          PyObject *ob_item[NUM_KEYWORDS];
      35      } _kwtuple = {
      36          .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
      37          .ob_item = { &_Py_ID(jump), },
      38      };
      39      #undef NUM_KEYWORDS
      40      #define KWTUPLE (&_kwtuple.ob_base.ob_base)
      41  
      42      #else  // !Py_BUILD_CORE
      43      #  define KWTUPLE NULL
      44      #endif  // !Py_BUILD_CORE
      45  
      46      static const char * const _keywords[] = {"", "", "jump", NULL};
      47      static _PyArg_Parser _parser = {
      48          .keywords = _keywords,
      49          .fname = "stack_effect",
      50          .kwtuple = KWTUPLE,
      51      };
      52      #undef KWTUPLE
      53      PyObject *argsbuf[3];
      54      Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
      55      int opcode;
      56      PyObject *oparg = Py_None;
      57      PyObject *jump = Py_None;
      58      int _return_value;
      59  
      60      args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
      61      if (!args) {
      62          goto exit;
      63      }
      64      opcode = _PyLong_AsInt(args[0]);
      65      if (opcode == -1 && PyErr_Occurred()) {
      66          goto exit;
      67      }
      68      if (nargs < 2) {
      69          goto skip_optional_posonly;
      70      }
      71      noptargs--;
      72      oparg = args[1];
      73  skip_optional_posonly:
      74      if (!noptargs) {
      75          goto skip_optional_kwonly;
      76      }
      77      jump = args[2];
      78  skip_optional_kwonly:
      79      _return_value = _opcode_stack_effect_impl(module, opcode, oparg, jump);
      80      if ((_return_value == -1) && PyErr_Occurred()) {
      81          goto exit;
      82      }
      83      return_value = PyLong_FromLong((long)_return_value);
      84  
      85  exit:
      86      return return_value;
      87  }
      88  
      89  PyDoc_STRVAR(_opcode_get_specialization_stats__doc__,
      90  "get_specialization_stats($module, /)\n"
      91  "--\n"
      92  "\n"
      93  "Return the specialization stats");
      94  
      95  #define _OPCODE_GET_SPECIALIZATION_STATS_METHODDEF    \
      96      {"get_specialization_stats", (PyCFunction)_opcode_get_specialization_stats, METH_NOARGS, _opcode_get_specialization_stats__doc__},
      97  
      98  static PyObject *
      99  _opcode_get_specialization_stats_impl(PyObject *module);
     100  
     101  static PyObject *
     102  _opcode_get_specialization_stats(PyObject *module, PyObject *Py_UNUSED(ignored))
     103  {
     104      return _opcode_get_specialization_stats_impl(module);
     105  }
     106  /*[clinic end generated code: output=21e3d53a659c651a input=a9049054013a1b77]*/