summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-04-29 11:06:04 (GMT)
committerGitHub <noreply@github.com>2023-04-29 11:06:04 (GMT)
commitfbf3596c3edadd03b5a8c659e9f27a09e5d1a051 (patch)
tree80af952c9f42e6552669ba6a342fa041570d638c /Include
parent84e7d0f0c7f9a44d81be2d705ed4d401a6505356 (diff)
downloadcpython-fbf3596c3edadd03b5a8c659e9f27a09e5d1a051.zip
cpython-fbf3596c3edadd03b5a8c659e9f27a09e5d1a051.tar.gz
cpython-fbf3596c3edadd03b5a8c659e9f27a09e5d1a051.tar.bz2
gh-87092: change assembler to use instruction sequence instead of CFG (#103933)
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_compile.h13
-rw-r--r--Include/internal/pycore_flowgraph.h4
2 files changed, 12 insertions, 5 deletions
diff --git a/Include/internal/pycore_compile.h b/Include/internal/pycore_compile.h
index f85240c..1a032f6 100644
--- a/Include/internal/pycore_compile.h
+++ b/Include/internal/pycore_compile.h
@@ -19,6 +19,7 @@ PyAPI_FUNC(PyCodeObject*) _PyAST_Compile(
int optimize,
struct _arena *arena);
+static const _PyCompilerSrcLocation NO_LOCATION = {-1, -1, -1, -1};
typedef struct {
int optimize;
@@ -33,15 +34,21 @@ extern int _PyAST_Optimize(
struct _arena *arena,
_PyASTOptimizeState *state);
+typedef struct {
+ int h_offset;
+ int h_startdepth;
+ int h_preserve_lasti;
+} _PyCompile_ExceptHandlerInfo;
typedef struct {
int i_opcode;
int i_oparg;
_PyCompilerSrcLocation i_loc;
-} _PyCompilerInstruction;
+ _PyCompile_ExceptHandlerInfo i_except_handler_info;
+} _PyCompile_Instruction;
typedef struct {
- _PyCompilerInstruction *s_instrs;
+ _PyCompile_Instruction *s_instrs;
int s_allocated;
int s_used;
@@ -82,6 +89,8 @@ int _PyCompile_EnsureArrayLargeEnough(
int _PyCompile_ConstCacheMergeOne(PyObject *const_cache, PyObject **obj);
+int _PyCompile_InstrSize(int opcode, int oparg);
+
/* Access compiler internals for unit testing */
PyAPI_FUNC(PyObject*) _PyCompile_CodeGen(
diff --git a/Include/internal/pycore_flowgraph.h b/Include/internal/pycore_flowgraph.h
index f470dad..883334f 100644
--- a/Include/internal/pycore_flowgraph.h
+++ b/Include/internal/pycore_flowgraph.h
@@ -11,7 +11,6 @@ extern "C" {
#include "pycore_opcode_utils.h"
#include "pycore_compile.h"
-static const _PyCompilerSrcLocation NO_LOCATION = {-1, -1, -1, -1};
typedef struct {
int i_opcode;
@@ -97,7 +96,6 @@ int _PyCfg_OptimizeCodeUnit(_PyCfgBuilder *g, PyObject *consts, PyObject *const_
int _PyCfg_Stackdepth(_PyCfgBasicblock *entryblock, int code_flags);
void _PyCfg_ConvertExceptionHandlersToNops(_PyCfgBasicblock *entryblock);
int _PyCfg_ResolveJumps(_PyCfgBuilder *g);
-int _PyCfg_InstrSize(_PyCfgInstruction *instruction);
static inline int
@@ -113,7 +111,7 @@ basicblock_nofallthrough(const _PyCfgBasicblock *b) {
PyCodeObject *
_PyAssemble_MakeCodeObject(_PyCompile_CodeUnitMetadata *u, PyObject *const_cache,
- PyObject *consts, int maxdepth, _PyCfgBasicblock *entryblock,
+ PyObject *consts, int maxdepth, _PyCompile_InstructionSequence *instrs,
int nlocalsplus, int code_flags, PyObject *filename);
#ifdef __cplusplus