argotorg / argotorg/fe

Reconsider salsa recovery fn usage

Open
#939 0 comments 0 reactions 0 assignees View on GitHub
v2
Dominant language
Rust
Stars
1.7k
Forks
218
Avg merge
1d 4h
Merged PRs (30d)
8

Description

#931 introduced salsa recovery fn usage. However, the implementation of fallback in Salsa uses [std::panic::catch_unwind](https://doc.rust-lang.org/std/panic/fn.catch_unwind.html), making it unworkable in WASM. This is due to the fact that WASM is in the standardization process for exceptions and also because support for WASM native exceptions on the Rust compiler side (rustc) is limited. Please refer to `References` section for more details.

NOTE: The old salsa doesn't use `resume_unwind` for the cycle recovering purpose, so it does work. But since https://github.com/salsa-rs/salsa/pull/285 introduced `resume/catch_unwind` usage for cycle recovery, the wasm tests in the current `analyzer` will also fail when the new version that includes the PR is released.

## How to fix it
Regarding this issue, the easiest approach would likely be to build a dependency graph(for types, aliases, traits, etc) for each ingot and calculate the SCC (Strongly Connected Components). However, considering the simplicity and performance of the implementation, and taking into account that Salsa internally builds a dependency graph, it would be ideal to use Salsa's recovery fallback if possible.

(TBW)

## References
[Support for native WASM exceptions](https://github.com/rust-lang/rust/pull/111322)
[Implementation status in major browsers](https://webassembly.org/roadmap/)
[Exception Handling Proposal](https://github.com/WebAssembly/exception-handling)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the Salsa recovery-function usage introduced by #931 and the referenced catch_unwind and resume_unwind behavior. Check the analyzer's WASM tests to reproduce the failure. Done means cycle recovery works without breaking WASM compatibility, but the issue leaves the implementation approach open.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.