Lines Matching defs:block
135 /* target block (if jump instruction) */
137 /* target block when exception is raised, should not be set by front-end. */
235 reverse order that the block are allocated. b_list points to the next
236 block, not to be confused with b_next, which is next by control flow. */
238 /* Exception stack at start of block, used by assembler to create the exception handling table */
243 block reached by normal control flow. */
249 /* Number of predecssors that a block has. */
251 /* depth of stack upon entry of block, computed by stackdepth() */
253 /* instruction offset for block, computed by assemble_jump_offsets() */
255 /* Basic block has no fall through (it ends with a return, raise or jump) */
257 /* Basic block is an exception handler that preserves lasti */
259 /* Used by compiler passes to mark whether they have visited a basic block. */
261 /* Basic block exits scope (it ends with a return or raise) */
267 /* fblockinfo tracks the current frame block.
269 A frame block is used to handle loops, try/except, and try/finally.
270 It's called a frame block to distinguish it from a basic block in the
281 /* (optional) type-specific exit or cleanup block */
297 They must be saved and restored when returning to a block.
318 Py_ssize_t u_argcount; /* number of arguments for block */
319 Py_ssize_t u_posonlyargcount; /* number of positional only arguments for block */
320 Py_ssize_t u_kwonlyargcount; /* number of keyword only arguments for block */
321 /* Pointer to the most recently allocated block. By following b_list
324 basicblock *u_curblock; /* pointer to current block */
329 int u_firstlineno; /* the first lineno of the block */
362 struct compiler_unit *u; /* compiler state for current block */
376 // i items off of the stack. The end result looks like this (with each block
693 basicblock *block;
694 for (block = u->u_blocks; block != NULL; block = block->b_list) {
695 assert(!_PyMem_IsPtrFreed(block));
696 if (block->b_instr != NULL) {
697 assert(block->b_ialloc > 0);
698 assert(block->b_iused >= 0);
699 assert(block->b_ialloc >= block->b_iused);
702 assert (block->b_iused == 0);
703 assert (block->b_ialloc == 0);
805 /* Allocate a new block and return a pointer to it.
821 /* Extend the singly linked list of blocks with new block. */
828 compiler_use_next_block(struct compiler *c, basicblock *block)
830 assert(block != NULL);
831 c->u->u_curblock->b_next = block;
832 c->u->u_curblock = block;
834 return block;
838 compiler_copy_block(struct compiler *c, basicblock *block)
840 /* Cannot copy a block if it has a fallthrough, since
841 * a block can only have one fallthrough predecessor.
843 assert(block->b_nofallthrough);
848 for (int i = 0; i < block->b_iused; i++) {
853 result->b_instr[n] = block->b_instr[i];
855 result->b_exit = block->b_exit;
860 /* Returns the offset of the next instruction in the current block's
1719 basicblock *block;
1800 block = compiler_new_block(c);
1801 if (block == NULL)
1803 c->u->u_curblock = block;
1849 /* Search if variable annotations are present statically in a block. */
1928 * Frame block handling functions
2003 /* Unwind a frame block. If preserve_tos is true, the TOS before
2039 /* Emit the finally block */
2044 /* The finally block should appear to execute after the
2078 /* The exit block should appear to execute after the
2110 /** Unwind block stack. If loop is not NULL, then stop when the first loop is encountered. */
2119 c, "'break', 'continue' and 'return' cannot appear in an except* block");
2722 /* this block represents what we do in the new scope */
3165 /* Success block for __anext__ */
3174 /* Except block for __anext__ */
3182 /* `else` block */
3330 The special instructions use the block stack. Each block
3333 block stack entry was created, and a label (here L).
3337 onto the block stack.
3339 Pops en entry from the block stack.
3341 The block stack is unwound when an exception is raised:
3345 gotten from the block stack.
3360 /* `try` block */
3376 /* `finally` block */
3412 /* `try` block */
3430 /* `finally` block */
3506 /* Runtime will push a block here, so we need to account for that */
3703 /* Runtime will push a block here, so we need to account for that */
5380 /* Runtime will push a block here, so we need to account for that */
5648 basicblock *block, *final, *exit, *cleanup;
5658 block = compiler_new_block(c);
5662 if (!block || !final || !exit || !cleanup)
5675 /* SETUP_WITH pushes a finally block. */
5676 compiler_use_next_block(c, block);
5677 if (!compiler_push_fblock(c, ASYNC_WITH, block, final, s)) {
5696 compiler_pop_fblock(c, ASYNC_WITH, block);
5754 basicblock *block, *final, *exit, *cleanup;
5759 block = compiler_new_block(c);
5763 if (!block || !final || !exit || !cleanup)
5772 /* SETUP_WITH pushes a finally block. */
5773 compiler_use_next_block(c, block);
5774 if (!compiler_push_fblock(c, WITH, block, final, s)) {
5797 compiler_pop_fblock(c, WITH, block);
6331 // Use op to jump to the correct fail_pop block.
6859 // Need to NULL this for the PyObject_Free call in the error block.
7115 /* do depth-first search of basic block graph, starting with block.
7116 post records the block indices in post-order.
7118 XXX must handle implicit jumps from one block to next
7763 /* Compute the size of each block and fixup jump args.
7764 Replace block pointer with position in bytecode. */
8161 insert_instruction(basicblock *block, int pos, struct instr *instr) {
8162 if (compiler_next_instr(block) < 0) {
8165 for (int i = block->b_iused-1; i > pos; i--) {
8166 block->b_instr[i] = block->b_instr[i-1];
8168 block->b_instr[pos] = *instr;
8355 /* Make sure every block that falls off the end returns None. */
8600 swaptimize(basicblock *block, int *ix)
8604 assert(*ix < block->b_iused);
8605 struct instr *instructions = &block->b_instr[*ix];
8612 int limit = block->b_iused - *ix;
8706 next_swappable_instruction(basicblock *block, int i, int lineno)
8708 while (++i < block->b_iused) {
8709 struct instr *instruction = &block->b_instr[i];
8730 apply_static_swaps(basicblock *block, int i)
8734 assert(i < block->b_iused);
8735 struct instr *swap = &block->b_instr[i];
8744 int j = next_swappable_instruction(block, i, -1);
8749 int lineno = block->b_instr[j].i_lineno;
8751 k = next_swappable_instruction(block, k, lineno);
8759 int store_j = STORES_TO(block->b_instr[j]);
8760 int store_k = STORES_TO(block->b_instr[k]);
8766 int store_idx = STORES_TO(block->b_instr[idx]);
8775 struct instr temp = block->b_instr[j];
8776 block->b_instr[j] = block->b_instr[k];
8777 block->b_instr[k] = temp;
8802 /* Maximum size of basic block that should be copied in optimizer */
8950 // since a block's b_next cannot point to itself:
8972 // since a block's b_next cannot point to itself:
9057 /* If this block ends with an unconditional jump to an exit block,
9058 * then remove the jump and extend this block with the target.
9240 * then copy the line number. If a successor block has no line number, and only
9325 block ends with a jump instruction, check if the next non-empty block
9399 * copy the line number from the sole predecessor block.