Make regalloc2 panic-clean: always return errors when impossible constraints occur

Open
#2 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
compilers

Research direction

Start by tracing the allocator's handling of impossible constraints, especially when two operands are required to share a PReg, and identify the panic!() or assert!() paths involved. Follow the allocator's public error-returning path so these cases become returned errors, then add coverage for the conflicting-PReg constraint and verify that allocation no longer panics.

Written by the indexing model from the issue text.

Description

Right now, the allocator can panic if the client provides impossible constraints, such as requiring two different operands to be placed in the same PReg.

While this represents a programming error in the client and shouldn't arise from an invalid input program, it is always better to bubble up errors; we should reserve panic!() and assert!() for conditions that can only be violated due to errors in regalloc2 itself.

Dominant language
Rust
Stars
266
Forks
54
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bytecodealliance/regalloc2

All issues in bytecodealliance/regalloc2

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.