Skip to content

Dispatcher: cover :closure, :set_upvalue, and open-upvalue ops (B5c-v2) #272

Closed

Description

@davydog187

Tracked by plan: .agents/plans/B5c-v2-dispatcher-closures.md

The plan file is the source of truth for goal, scope, success criteria, and implementation notes. Comments here are for discussion; the plan is for execution.

Why now

The closures benchmark is the worst gap to C Lua (15.8x slower) and the inner counter function is tantalisingly close to running on the dispatcher: of its four opcodes (get_upvalue, add, set_upvalue, return_one), three are already covered. The single uncovered :set_upvalue collapses the entire prototype to the interpreter.

Coverage additions in this PR:

  • :closure — closure construction with upvalue capture
  • :set_upvalue
  • :get_open_upvalue, :set_open_upvalue — open-cell access for captures of mutable locals
  • :vararg, :return_vararg
  • :return with count > 1
  • :generic_for, :self, :tail_call

After this PR no prototype falls back to the list-of-tuples interpreter for opcode-coverage reasons.

Blocked on

When this work is picked up

  1. The branch named in the plan's frontmatter is created.
  2. A PR is opened with Closes #<this-issue> in the body.
  3. Merge closes this issue.

For strategic context, see ROADMAP.md.

Activity

  1. added this to the 1.0.0 milestone on May 28, 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

    direction:BDirection B: performance investigationkind:perfPerformance change

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions