Skip to content

Convert more uops to leave their inputs on the stack to be cleaned up by _POP_TOP #145866

Description

@markshannon

Feature or enhancement

Proposal:

This is a follow up to #134584

We have, in the JIT, optimizations to eliminate many _POP_TOP operations. To take advantage of that we have converted many uops to leave their operands on the stack and added subsequent _POP_TOPs to remove them.
See #134584 for many examples of how to do this and why it works.

However, there are still a few uops yet to do. These are:

In addition, POP_ITER, END_FOR and END_SEND can be implemented as macro ops, using POP_TOP to gain the benefit of the the POP_TOP optimization.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Linked PRs

Activity

  1. added
    type-featureA feature request or enhancement
    performancePerformance or resource usage
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    3.15bugs and security fixes
    on Mar 12, 2026
  2. markshannon commented on Mar 12, 2026

    @markshannon
    MemberAuthor

    A few more:

    • UNPACK_SEQUENCE
    • UNPACK_SEQUENCE_LIST
    • UNPACK_SEQUENCE_TUPLE
  3. Fidget-Spinner commented on Mar 13, 2026

    @Fidget-Spinner
    Member

    UNPACK_SEQUENCE

    I thought we were putting those off as you mentioned in #142949 ?

  4. Sacul0457 commented on Mar 13, 2026

    @Sacul0457
    Contributor

    Could I work on CALL_INTRINSIC_1?

  5. Fidget-Spinner commented on Mar 13, 2026

    @Fidget-Spinner
    Member

    Could I work on CALL_INTRINSIC_1?

    Sure. I'll assign you on the issue.

  6. markshannon commented on Mar 13, 2026

    @markshannon
    MemberAuthor

    UNPACK_SEQUENCE

    I thought we were putting those off as you mentioned in #142949 ?

    We don't want to prevent the optimization of unpacking temporary variables, like #144300, but when the unpacking is from a local variable, then it would be good to skip the decref check.

  7. Sacul0457 commented on Mar 15, 2026

    @Sacul0457
    Contributor

    In the meantime, would it be ok if I worked on DICT_UPDATE and SET_UPDATE?

  8. added a commit that references this issue on Mar 16, 2026
  9. KevinH15291 commented on Mar 18, 2026

    @KevinH15291
    Contributor

    I'm interested in working on CALL_INTRINSIC_2.

  10. added a commit that references this issue on Mar 19, 2026
  11. added a commit that references this issue on Mar 19, 2026
  12. 38 remaining items

  13. added 3 commits that reference this issue on Apr 12, 2026
  14. added 4 commits that reference this issue on Apr 16, 2026
  15. added 8 commits that reference this issue on Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagetopic-JITtype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions