Skip to content

Scoped branch labels: remove the OP_NOOP padding and the global open-reference slot #15

Description

@kameronbrooks

Plan item #25. The compiler's open-reference label model relies on a single global "open reference" slot, which forces two sites to emit an OP_NOOP purely to flush a pending label (with comments reading "I have no idea why"). The real issue is that getOrOpen() can reuse a label that a different construct opened.

Fix: make labels explicitly named and scoped per construct ($loop3_cond, $if7_else) instead of the global slot. This removes the padding instructions and the whole class of adjacent-construct bugs — the original "Branch target not found: $0" bug (issue #4) was this class.

Also unblocks the OP_NOOP-elimination optimiser pass (plan #24).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions