Skip to content

Remove irregular stack effects #105678

Closed
Closed
@markshannon

Description

@markshannon

As we move towards generating more components from the instruction definition file (bytecodes.c), it helps if the instructions have regular formats and stack effects.
Currently the stack effects can be simple, variable, conditional or complex.

  • Simple: Does not depend on the operand (oparg)
  • Variable: Either pops or pushes oparg * k items.
  • Conditional: Pushes a value conditional on oparg & 1
  • Complex: The stack effect depends on a set of flags embedded in oparg.

We can easily get rid of the complex case. There are only two cases, MAKE_FUNCTION and FORMAT_VALUE. Both can easily broken down into simple (and faster) parts.

We might want to get rid of condition stack effects, as it would simplify things, but performance may suffer as both LOAD_GLOBAL and LOAD_ATTR are conditional and they are performance critical.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance or resource usage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions