Skip to content

Better Linear (IL) to Structured (WAT) branching conversion #1

@Tweety-Lab

Description

@Tweety-Lab

Issue

In C#, IL allows linear branching, meaning you can arbitrarily jump to any instruction. However, WAT/WASM uses structured control flow, requiring explicit block, if, loop structures to define valid jump targets. This makes compiling IL to WASM a bit tricky since we have to convert the arbitrary jumps to explicitly declared jumps.

Right now we have a barebones branching conversion system in CompilerVisitor but it's very basic and brittle. We should probably rewrite it entirely and ideally move branching logic out of the CompilerVisitor class.

Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions