mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
gh-93678: add _testinternalcapi.optimize_cfg() and test utils for compiler optimization unit tests (GH-96007)
This commit is contained in:
parent
6bda5b85b5
commit
420f39f457
9 changed files with 496 additions and 49 deletions
|
@ -14,6 +14,7 @@
|
|||
#include "Python.h"
|
||||
#include "pycore_atomic_funcs.h" // _Py_atomic_int_get()
|
||||
#include "pycore_bitutils.h" // _Py_bswap32()
|
||||
#include "pycore_compile.h" // _PyCompile_OptimizeCfg()
|
||||
#include "pycore_fileutils.h" // _Py_normpath
|
||||
#include "pycore_frame.h" // _PyInterpreterFrame
|
||||
#include "pycore_gc.h" // PyGC_Head
|
||||
|
@ -25,7 +26,12 @@
|
|||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||
#include "osdefs.h" // MAXPATHLEN
|
||||
|
||||
#include "clinic/_testinternalcapi.c.h"
|
||||
|
||||
/*[clinic input]
|
||||
module _testinternalcapi
|
||||
[clinic start generated code]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=7bb583d8c9eb9a78]*/
|
||||
static PyObject *
|
||||
get_configs(PyObject *self, PyObject *Py_UNUSED(args))
|
||||
{
|
||||
|
@ -525,6 +531,25 @@ set_eval_frame_record(PyObject *self, PyObject *list)
|
|||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
|
||||
_testinternalcapi.optimize_cfg -> object
|
||||
|
||||
instructions: object
|
||||
consts: object
|
||||
|
||||
Apply compiler optimizations to an instruction list.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_testinternalcapi_optimize_cfg_impl(PyObject *module, PyObject *instructions,
|
||||
PyObject *consts)
|
||||
/*[clinic end generated code: output=5412aeafca683c8b input=7e8a3de86ebdd0f9]*/
|
||||
{
|
||||
return _PyCompile_OptimizeCfg(instructions, consts);
|
||||
}
|
||||
|
||||
|
||||
static PyMethodDef TestMethods[] = {
|
||||
{"get_configs", get_configs, METH_NOARGS},
|
||||
{"get_recursion_depth", get_recursion_depth, METH_NOARGS},
|
||||
|
@ -543,6 +568,7 @@ static PyMethodDef TestMethods[] = {
|
|||
{"DecodeLocaleEx", decode_locale_ex, METH_VARARGS},
|
||||
{"set_eval_frame_default", set_eval_frame_default, METH_NOARGS, NULL},
|
||||
{"set_eval_frame_record", set_eval_frame_record, METH_O, NULL},
|
||||
_TESTINTERNALCAPI_OPTIMIZE_CFG_METHODDEF
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue