Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions Include/internal/pycore_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,6 @@ int _PyCompile_ConstCacheMergeOne(PyObject *const_cache, PyObject **obj);


// Export for '_opcode' extension 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);

Expand Down
1 change: 1 addition & 0 deletions Modules/Setup.bootstrap.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ _weakref _weakref.c
_abc _abc.c
_functools _functoolsmodule.c
_locale _localemodule.c
_opcode _opcode.c
_operator _operator.c
_stat _stat.c
_symtable symtablemodule.c
Expand Down
1 change: 0 additions & 1 deletion Modules/Setup.stdlib.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
@MODULE__HEAPQ_TRUE@_heapq _heapqmodule.c
@MODULE__JSON_TRUE@_json _json.c
@MODULE__LSPROF_TRUE@_lsprof _lsprof.c rotatingtree.c
@MODULE__OPCODE_TRUE@_opcode _opcode.c
@MODULE__PICKLE_TRUE@_pickle _pickle.c
@MODULE__QUEUE_TRUE@_queue _queuemodule.c
@MODULE__RANDOM_TRUE@_random _randommodule.c
Expand Down
29 changes: 11 additions & 18 deletions Modules/_opcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#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
Expand Down Expand Up @@ -81,7 +83,7 @@ static int
_opcode_is_valid_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=b0d918ea1d073f65 input=fe23e0aa194ddae0]*/
{
return _PyCompile_OpcodeIsValid(opcode);
return IS_VALID_OPCODE(opcode);
}

/*[clinic input]
Expand All @@ -97,8 +99,7 @@ static int
_opcode_has_arg_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=7a062d3b2dcc0815 input=93d878ba6361db5f]*/
{
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasArg(opcode);
return IS_VALID_OPCODE(opcode) && OPCODE_HAS_ARG(opcode);
}

/*[clinic input]
Expand All @@ -114,8 +115,7 @@ static int
_opcode_has_const_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=c646d5027c634120 input=a6999e4cf13f9410]*/
{
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasConst(opcode);
return IS_VALID_OPCODE(opcode) && OPCODE_HAS_CONST(opcode);
}

/*[clinic input]
Expand All @@ -131,8 +131,7 @@ static int
_opcode_has_name_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=b49a83555c2fa517 input=448aa5e4bcc947ba]*/
{
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasName(opcode);
return IS_VALID_OPCODE(opcode) && OPCODE_HAS_NAME(opcode);
}

/*[clinic input]
Expand All @@ -148,9 +147,7 @@ static int
_opcode_has_jump_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=e9c583c669f1c46a input=35f711274357a0c3]*/
{
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasJump(opcode);

return IS_VALID_OPCODE(opcode) && OPCODE_HAS_JUMP(opcode);
}

/*[clinic input]
Expand All @@ -171,9 +168,7 @@ static int
_opcode_has_free_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=d81ae4d79af0ee26 input=117dcd5c19c1139b]*/
{
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasFree(opcode);

return IS_VALID_OPCODE(opcode) && OPCODE_HAS_FREE(opcode);
}

/*[clinic input]
Expand All @@ -189,8 +184,7 @@ static int
_opcode_has_local_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=da5a8616b7a5097b input=9a798ee24aaef49d]*/
{
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasLocal(opcode);
return IS_VALID_OPCODE(opcode) && OPCODE_HAS_LOCAL(opcode);
}

/*[clinic input]
Expand All @@ -206,8 +200,7 @@ static int
_opcode_has_exc_impl(PyObject *module, int opcode)
/*[clinic end generated code: output=41b68dff0ec82a52 input=db0e4bdb9bf13fa5]*/
{
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasExc(opcode);
return IS_VALID_OPCODE(opcode) && IS_BLOCK_PUSH_OPCODE(opcode);
}

/*[clinic input]
Expand Down Expand Up @@ -424,7 +417,7 @@ opcode_functions[] = {
{NULL, NULL, 0, NULL}
};

int
static int
_opcode_exec(PyObject *m) {
if (PyModule_AddIntMacro(m, ENABLE_SPECIALIZATION) < 0) {
return -1;
Expand Down
48 changes: 0 additions & 48 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,54 +659,6 @@ compiler_set_qualname(struct compiler *c)
return SUCCESS;
}

int
_PyCompile_OpcodeIsValid(int opcode)
{
return IS_VALID_OPCODE(opcode);
}

int
_PyCompile_OpcodeHasArg(int opcode)
{
return OPCODE_HAS_ARG(opcode);
}

int
_PyCompile_OpcodeHasConst(int opcode)
{
return OPCODE_HAS_CONST(opcode);
}

int
_PyCompile_OpcodeHasName(int opcode)
{
return OPCODE_HAS_NAME(opcode);
}

int
_PyCompile_OpcodeHasJump(int opcode)
{
return OPCODE_HAS_JUMP(opcode);
}

int
_PyCompile_OpcodeHasFree(int opcode)
{
return OPCODE_HAS_FREE(opcode);
}

int
_PyCompile_OpcodeHasLocal(int opcode)
{
return OPCODE_HAS_LOCAL(opcode);
}

int
_PyCompile_OpcodeHasExc(int opcode)
{
return IS_BLOCK_PUSH_OPCODE(opcode);
}

static int
codegen_addop_noarg(instr_sequence *seq, int opcode, location loc)
{
Expand Down
28 changes: 0 additions & 28 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7689,7 +7689,6 @@ PY_STDLIB_MOD_SIMPLE([_csv])
PY_STDLIB_MOD_SIMPLE([_heapq])
PY_STDLIB_MOD_SIMPLE([_json])
PY_STDLIB_MOD_SIMPLE([_lsprof])
PY_STDLIB_MOD_SIMPLE([_opcode])
PY_STDLIB_MOD_SIMPLE([_pickle])
PY_STDLIB_MOD_SIMPLE([_posixsubprocess])
PY_STDLIB_MOD_SIMPLE([_queue])
Expand Down