Skip to content

Avoid BUILD_TUPLE followed by RETURN_VALUE if UNPACK_SEQUENCE is right after CALL #509

@lpereira

Description

@lpereira

This should avoid an unnecessary round-trip to the allocator in what I believe to be a very common case.

The way I see this being implemented is:

  • Two new superinstructions: BUILD_TUPLE__RETURN_VALUE and CALL__UNPACK_SEQUENCE
  • CALL__UNPACK_SEQUENCE sets a flag in the call frame
  • BUILD_TUPLE__RETURN_VALUE sees if the flag is set:
    • If it's set, then it'll return from the function, leaving the stack in the way that UNPACK_SEQUENCE would have left it
    • If it's not set, would behave like the individual instructions

Thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions