summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_compile.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/internal/pycore_compile.h')
-rw-r--r--Include/internal/pycore_compile.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/Include/internal/pycore_compile.h b/Include/internal/pycore_compile.h
index 6a1e02c..f85240c 100644
--- a/Include/internal/pycore_compile.h
+++ b/Include/internal/pycore_compile.h
@@ -33,6 +33,45 @@ extern int _PyAST_Optimize(
struct _arena *arena,
_PyASTOptimizeState *state);
+
+typedef struct {
+ int i_opcode;
+ int i_oparg;
+ _PyCompilerSrcLocation i_loc;
+} _PyCompilerInstruction;
+
+typedef struct {
+ _PyCompilerInstruction *s_instrs;
+ int s_allocated;
+ int s_used;
+
+ int *s_labelmap; /* label id --> instr offset */
+ int s_labelmap_size;
+ int s_next_free_label; /* next free label id */
+} _PyCompile_InstructionSequence;
+
+typedef struct {
+ PyObject *u_name;
+ PyObject *u_qualname; /* dot-separated qualified name (lazy) */
+
+ /* The following fields are dicts that map objects to
+ the index of them in co_XXX. The index is used as
+ the argument for opcodes that refer to those collections.
+ */
+ PyObject *u_consts; /* all constants */
+ PyObject *u_names; /* all names */
+ PyObject *u_varnames; /* local variables */
+ PyObject *u_cellvars; /* cell variables */
+ PyObject *u_freevars; /* free variables */
+
+ Py_ssize_t u_argcount; /* number of arguments for block */
+ Py_ssize_t u_posonlyargcount; /* number of positional only arguments for block */
+ Py_ssize_t u_kwonlyargcount; /* number of keyword only arguments for block */
+
+ int u_firstlineno; /* the first lineno of the block */
+} _PyCompile_CodeUnitMetadata;
+
+
/* Utility for a number of growing arrays used in the compiler */
int _PyCompile_EnsureArrayLargeEnough(
int idx,