Lines Matching defs:Chunk
277 # Opcodes that unconditionally end the code chunk.
283 # Opcodes that unconditionally begin a new code chunk. By starting new chunks
409 """Split the code object into a list of `Chunk` objects.
411 Each chunk is only entered at its first instruction, though there can
412 be many exits from a chunk.
414 Returns a list of `Chunk` objects.
420 chunk = None
436 # Maybe have to start a new chunk
438 # Start a new chunk for each source line number.
439 if chunk:
440 chunk.exits.add(bc.offset)
441 chunk = Chunk(bc.offset, bytes_lines_map[bc.offset])
442 chunks.append(chunk)
444 # Jumps deserve their own unnumbered chunk. This fixes
446 if chunk:
447 chunk.exits.add(bc.offset)
448 chunk = Chunk(bc.offset)
449 chunks.append(chunk)
451 if not chunk:
452 chunk = Chunk(bc.offset)
453 chunks.append(chunk)
461 # The opcode has a jump, it's an exit for this chunk.
462 chunk.exits.add(bc.jump_to)
466 chunk.exits.add(-self.code.co_firstlineno)
474 # This opcode forces the end of the chunk.
478 chunk.exits.add(block_stack[-1][1])
479 chunk = None
484 chunk.exits.add(block_stack[-1][1])
489 chunk.exits.add(block_stack[iblock][1])
508 # would be a last chunk all by itself.
511 # Split the last chunk
515 chunk = Chunk(penult.offset)
516 chunk.exits.add(ex)
517 chunks.append(chunk)
548 # Which lines does this chunk lead to?
557 # Find chunk for byte
565 # No chunk for this byte!
566 raise Exception("Couldn't find chunk @ %d" % byte)
582 # Figure out for each chunk where the exits go.
584 for chunk in chunks:
585 if chunk.line:
586 for ex in chunk.exits:
592 if chunk.line != exit_line:
593 arcs.add((chunk.line, exit_line))
600 """Returns a list of `Chunk` objects for this code and its children.
624 class Chunk(object):
632 to have many exits from a chunk, and "basic block" is a more cumbersome
637 An exit < 0 means the chunk can leave the code (return). The exit is