Skip to content

Terminator operators that imply "end" #778

@AndrewScheidecker

Description

@AndrewScheidecker

WebAssembly has several operators that imply that any code following them until the next end or else operator will never be executed: ret, br, br_table, unreachable.

I propose that these operators act as implicit end/else operators. This would imply that they may only occur at the end of a control flow block. The end operator would still be useful as a special-case br operator that targets a fixed depth of 0.

This also makes it clear that else can be eliminated, and that an if operator just needs to be followed by two terminator instructions.

I believe this simplifies code generation, since you don't need to worry about the stack having the right type going into an unreachable end operator. I believe it also simplifies the spec and validation, since it completely avoids the question of how to handle code between these operators and the next end.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions