#define PY_INVALID_STACK_EFFECT INT_MAX
PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump);
-
-PyAPI_FUNC(int) PyUnstable_OpcodeIsValid(int opcode);
-PyAPI_FUNC(int) PyUnstable_OpcodeHasArg(int opcode);
-PyAPI_FUNC(int) PyUnstable_OpcodeHasConst(int opcode);
-PyAPI_FUNC(int) PyUnstable_OpcodeHasName(int opcode);
-PyAPI_FUNC(int) PyUnstable_OpcodeHasJump(int opcode);
-PyAPI_FUNC(int) PyUnstable_OpcodeHasFree(int opcode);
-PyAPI_FUNC(int) PyUnstable_OpcodeHasLocal(int opcode);
-PyAPI_FUNC(int) PyUnstable_OpcodeHasExc(int opcode);
-
-PyAPI_FUNC(PyObject*) PyUnstable_GetUnaryIntrinsicName(int index);
-PyAPI_FUNC(PyObject*) PyUnstable_GetBinaryIntrinsicName(int index);
int _PyCompile_ConstCacheMergeOne(PyObject *const_cache, PyObject **obj);
+
+// Export for '_opcode' extention module
+PyAPI_FUNC(int) _PyCompile_OpcodeIsValid(int opcode);
+PyAPI_FUNC(int) _PyCompile_OpcodeHasArg(int opcode);
+PyAPI_FUNC(int) _PyCompile_OpcodeHasConst(int opcode);
+PyAPI_FUNC(int) _PyCompile_OpcodeHasName(int opcode);
+PyAPI_FUNC(int) _PyCompile_OpcodeHasJump(int opcode);
+PyAPI_FUNC(int) _PyCompile_OpcodeHasFree(int opcode);
+PyAPI_FUNC(int) _PyCompile_OpcodeHasLocal(int opcode);
+PyAPI_FUNC(int) _PyCompile_OpcodeHasExc(int opcode);
+
+PyAPI_FUNC(PyObject*) _PyCompile_GetUnaryIntrinsicName(int index);
+PyAPI_FUNC(PyObject*) _PyCompile_GetBinaryIntrinsicName(int index);
+
/* Access compiler internals for unit testing */
// Export for '_testinternalcapi' shared extension
#include "compile.h"
#include "opcode.h"
#include "internal/pycore_code.h"
+#include "internal/pycore_compile.h"
#include "internal/pycore_intrinsics.h"
/*[clinic input]
_opcode_is_valid_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=b0d918ea1d073f65 input=fe23e0aa194ddae0]*/
{
- return PyUnstable_OpcodeIsValid(opcode);
+ return _PyCompile_OpcodeIsValid(opcode);
}
/*[clinic input]
_opcode_has_arg_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=7a062d3b2dcc0815 input=93d878ba6361db5f]*/
{
- return PyUnstable_OpcodeIsValid(opcode) &&
- PyUnstable_OpcodeHasArg(opcode);
+ return _PyCompile_OpcodeIsValid(opcode) &&
+ _PyCompile_OpcodeHasArg(opcode);
}
/*[clinic input]
_opcode_has_const_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=c646d5027c634120 input=a6999e4cf13f9410]*/
{
- return PyUnstable_OpcodeIsValid(opcode) &&
- PyUnstable_OpcodeHasConst(opcode);
+ return _PyCompile_OpcodeIsValid(opcode) &&
+ _PyCompile_OpcodeHasConst(opcode);
}
/*[clinic input]
_opcode_has_name_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=b49a83555c2fa517 input=448aa5e4bcc947ba]*/
{
- return PyUnstable_OpcodeIsValid(opcode) &&
- PyUnstable_OpcodeHasName(opcode);
+ return _PyCompile_OpcodeIsValid(opcode) &&
+ _PyCompile_OpcodeHasName(opcode);
}
/*[clinic input]
_opcode_has_jump_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=e9c583c669f1c46a input=35f711274357a0c3]*/
{
- return PyUnstable_OpcodeIsValid(opcode) &&
- PyUnstable_OpcodeHasJump(opcode);
+ return _PyCompile_OpcodeIsValid(opcode) &&
+ _PyCompile_OpcodeHasJump(opcode);
}
_opcode_has_free_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=d81ae4d79af0ee26 input=117dcd5c19c1139b]*/
{
- return PyUnstable_OpcodeIsValid(opcode) &&
- PyUnstable_OpcodeHasFree(opcode);
+ return _PyCompile_OpcodeIsValid(opcode) &&
+ _PyCompile_OpcodeHasFree(opcode);
}
_opcode_has_local_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=da5a8616b7a5097b input=9a798ee24aaef49d]*/
{
- return PyUnstable_OpcodeIsValid(opcode) &&
- PyUnstable_OpcodeHasLocal(opcode);
+ return _PyCompile_OpcodeIsValid(opcode) &&
+ _PyCompile_OpcodeHasLocal(opcode);
}
/*[clinic input]
_opcode_has_exc_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=41b68dff0ec82a52 input=db0e4bdb9bf13fa5]*/
{
- return PyUnstable_OpcodeIsValid(opcode) &&
- PyUnstable_OpcodeHasExc(opcode);
+ return _PyCompile_OpcodeIsValid(opcode) &&
+ _PyCompile_OpcodeHasExc(opcode);
}
/*[clinic input]
return NULL;
}
for (int i=0; i <= MAX_INTRINSIC_1; i++) {
- PyObject *name = PyUnstable_GetUnaryIntrinsicName(i);
+ PyObject *name = _PyCompile_GetUnaryIntrinsicName(i);
if (name == NULL) {
Py_DECREF(list);
return NULL;
return NULL;
}
for (int i=0; i <= MAX_INTRINSIC_2; i++) {
- PyObject *name = PyUnstable_GetBinaryIntrinsicName(i);
+ PyObject *name = _PyCompile_GetBinaryIntrinsicName(i);
if (name == NULL) {
Py_DECREF(list);
return NULL;
}
int
-PyUnstable_OpcodeIsValid(int opcode)
+_PyCompile_OpcodeIsValid(int opcode)
{
return IS_VALID_OPCODE(opcode);
}
int
-PyUnstable_OpcodeHasArg(int opcode)
+_PyCompile_OpcodeHasArg(int opcode)
{
return OPCODE_HAS_ARG(opcode);
}
int
-PyUnstable_OpcodeHasConst(int opcode)
+_PyCompile_OpcodeHasConst(int opcode)
{
return OPCODE_HAS_CONST(opcode);
}
int
-PyUnstable_OpcodeHasName(int opcode)
+_PyCompile_OpcodeHasName(int opcode)
{
return OPCODE_HAS_NAME(opcode);
}
int
-PyUnstable_OpcodeHasJump(int opcode)
+_PyCompile_OpcodeHasJump(int opcode)
{
return OPCODE_HAS_JUMP(opcode);
}
int
-PyUnstable_OpcodeHasFree(int opcode)
+_PyCompile_OpcodeHasFree(int opcode)
{
return OPCODE_HAS_FREE(opcode);
}
int
-PyUnstable_OpcodeHasLocal(int opcode)
+_PyCompile_OpcodeHasLocal(int opcode)
{
return OPCODE_HAS_LOCAL(opcode);
}
int
-PyUnstable_OpcodeHasExc(int opcode)
+_PyCompile_OpcodeHasExc(int opcode)
{
return IS_BLOCK_PUSH_OPCODE(opcode);
}
#include "pycore_frame.h"
#include "pycore_function.h"
#include "pycore_global_objects.h"
+#include "pycore_compile.h" // _PyCompile_GetUnaryIntrinsicName, etc
#include "pycore_intrinsics.h" // INTRINSIC_PRINT
#include "pycore_pyerrors.h" // _PyErr_SetString()
#include "pycore_runtime.h" // _Py_ID()
#undef INTRINSIC_FUNC_ENTRY
PyObject*
-PyUnstable_GetUnaryIntrinsicName(int index)
+_PyCompile_GetUnaryIntrinsicName(int index)
{
if (index < 0 || index > MAX_INTRINSIC_1) {
return NULL;
}
PyObject*
-PyUnstable_GetBinaryIntrinsicName(int index)
+_PyCompile_GetBinaryIntrinsicName(int index)
{
if (index < 0 || index > MAX_INTRINSIC_2) {
return NULL;