Skip to content

[Wasm RyuJIT] EH & GC Design #121651

@kg

Description

@kg

We need a unified approach to both exception handling and garbage collection in the Wasm environment. There's a lot of overlap between the two problems.

Some key questions:

  • Do we use funclets for catches and finallies, or just for filters?
  • Do we duplicate finally code in various places or try to keep one copy of it that we direct control flow to in all cases?
  • How do we handle cases where the GC moves objects while we are executing? Do we rely on automatic pinning of any gc objects and byrefs on the stack while code is executing, like NAOT-LLVM?

Our exception handling and GC will both be dependent on spilling specific variables at the right points in execution, or making sure those variables always live in linear memory instead of wasm locals. Doing this ensures that they will be visible to funclets and to the GC. After spilling we may need to reload them if we are using precise GC.

Maintenance of a shadow stack is also necessary to ensure that EH unwinding can find filters and catches, and is potentially necessary to ensure that the GC knows which locations to scan.

(incomplete - work in progress)

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions