Skip to content

Bytecode compatibility - Normalize Loop/Branch Jump Semantics #20

@youknowone

Description

@youknowone

Summary

Background:
There are many mismatches involving jumps and stack effects (e.g., LOAD_CONST/
JUMP_BACKWARD, JUMP_BACKWARD/JUMP_FORWARD, POP_TOP/CALL, POP_EXC/CALL patterns),
suggesting CPython/jump normalization drift.

Task:

  • Audit RustPython compiler code generation for branch target calculation and jump
    lowering.
  • Ensure jump target normalization matches CPython offset-to-index expectations in dis
    output.
  • Verify POP_TOP/JUMP pairing and loop backedge generation around FOR_ITER/while/for
    comprehensions.
  • Re-run comparisons focused on core modules and remove false positives caused by
    different normalization if safe.

Acceptance criteria:

  • Diff counts for major jump-related pairs decrease substantially.
  • Critical loop-heavy modules (html/entities.py, inspect.py) show improved
    instruction alignment.

Details

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions