Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
pycore_instruction_sequence.h84 linesDownload Raw Back to internal
1#ifndef Py_INTERNAL_INSTRUCTION_SEQUENCE_H2#define Py_INTERNAL_INSTRUCTION_SEQUENCE_H3 4#ifndef Py_BUILD_CORE5#  error "this header requires Py_BUILD_CORE define"6#endif7 8#include "pycore_symtable.h"9 10#ifdef __cplusplus11extern "C" {12#endif13 14 15typedef struct {16    int h_label;17    int h_startdepth;18    int h_preserve_lasti;19} _PyExceptHandlerInfo;20 21typedef struct {22    int i_opcode;23    int i_oparg;24    _Py_SourceLocation i_loc;25    _PyExceptHandlerInfo i_except_handler_info;26 27    /* Temporary fields, used by the assembler and in instr_sequence_to_cfg */28    int i_target;29    int i_offset;30} _PyInstruction;31 32typedef struct instruction_sequence {33    PyObject_HEAD34    _PyInstruction *s_instrs;35    int s_allocated;36    int s_used;37 38    int s_next_free_label; /* next free label id */39 40    /* Map of a label id to instruction offset (index into s_instrs).41     * If s_labelmap is NULL, then each label id is the offset itself.42     */43    int *s_labelmap;44    int s_labelmap_size;45 46    /* PyList of instruction sequences of nested functions */47    PyObject *s_nested;48 49    /* Code for creating annotations, spliced into the main sequence later */50    struct instruction_sequence *s_annotations_code;51} _PyInstructionSequence;52 53typedef struct {54    int id;55} _PyJumpTargetLabel;56 57#define NO_LABEL ((const _PyJumpTargetLabel){-1})58 59#define SAME_JUMP_TARGET_LABEL(L1, L2) ((L1).id == (L2).id)60#define IS_JUMP_TARGET_LABEL(L) (!SAME_JUMP_TARGET_LABEL((L), (NO_LABEL)))61 62PyAPI_FUNC(PyObject*)_PyInstructionSequence_New(void);63 64int _PyInstructionSequence_UseLabel(_PyInstructionSequence *seq, int lbl);65int _PyInstructionSequence_Addop(_PyInstructionSequence *seq,66                                 int opcode, int oparg,67                                 _Py_SourceLocation loc);68_PyJumpTargetLabel _PyInstructionSequence_NewLabel(_PyInstructionSequence *seq);69int _PyInstructionSequence_ApplyLabelMap(_PyInstructionSequence *seq);70int _PyInstructionSequence_InsertInstruction(_PyInstructionSequence *seq, int pos,71                                             int opcode, int oparg, _Py_SourceLocation loc);72int _PyInstructionSequence_SetAnnotationsCode(_PyInstructionSequence *seq,73                                              _PyInstructionSequence *annotations);74int _PyInstructionSequence_AddNested(_PyInstructionSequence *seq, _PyInstructionSequence *nested);75void PyInstructionSequence_Fini(_PyInstructionSequence *seq);76 77extern PyTypeObject _PyInstructionSequence_Type;78#define _PyInstructionSequence_Check(v) Py_IS_TYPE((v), &_PyInstructionSequence_Type)79 80#ifdef __cplusplus81}82#endif83#endif /* !Py_INTERNAL_INSTRUCTION_SEQUENCE_H */84 
codekingpro/portable-devtools · Team Ai