A complete XQVM program. Attributes: instructions: List of instructions to execute name: Optional program name for debugging jump_targets: Maps sequential TARGET id to instruction index; pre-built at construction time so the executor skips the per-run pr
| 45 | |
| 46 | @dataclass |
| 47 | class Program: |
| 48 | """ |
| 49 | A complete XQVM program. |
| 50 | |
| 51 | Attributes: |
| 52 | instructions: List of instructions to execute |
| 53 | name: Optional program name for debugging |
| 54 | jump_targets: Maps sequential TARGET id to instruction index; pre-built |
| 55 | at construction time so the executor skips the per-run pre-scan. |
| 56 | """ |
| 57 | |
| 58 | instructions: list[Instruction] = field(default_factory=list) |
| 59 | name: str = "" |
| 60 | jump_targets: dict[int, int] = field(default_factory=dict) |
| 61 | |
| 62 | def __len__(self) -> int: |
| 63 | return len(self.instructions) |
| 64 | |
| 65 | def __getitem__(self, index: int) -> Instruction: |
| 66 | return self.instructions[index] |
| 67 | |
| 68 | |
| 69 | def _build_jump_targets(instructions: list[Instruction]) -> dict[int, int]: |
no outgoing calls