Skip to content

Make all jumps relative #336

@iritkatriel

Description

@iritkatriel

Our stats show that most of the absolute jumps that need EXTENDED_ARGs would not need them if we turn them into relative jumps. To do this we would need a backward jump version for each jump opcode (where the oparg is taken as the absolute value of a negative delta).

Furthermore, there is currently some unnecessary complexity in the compiler because (1) codegen specifies whether jumps are forward or backwards (using absolute for backwards jumps) but this information is not trusted by the assembler, which looks at the target of each jump and corrects the opcode if necessary (this is in compile.c, in normalize_jumps). We might as well emit a virtual jump instruction and let the assembler replace that with an actual jump opcode.

PR 32115: JUMP_ABSOLUTE--> JUMP_BACKWARD

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions