FuelLabs / FuelLabs/sway

Implement verification of the `AllocatedAbstractInstructionSet`

Open
#7,553 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
61.4k
Forks
5.4k
Avg merge
3h 33m
Merged PRs (30d)
4

Description

In `sway-core/src/asm_generation/fuel/programs/abstract.rs` implement `AllocatedAbstractInstructionSet::verify`. There is a TODO in code for that:

```
// TODO: Add verification. E.g., verify that:
// - function has exactly one CFEI/CFSI pair,
// - the stack use for each function is balanced,
// - $$locbase is only used if stack has been allocated for it.
// - etc.
// .map(AllocatedAbstractInstructionSet::verify)
```

Also, add comment why optimizing unused CFEI/CFSI in virtual abstract instr set is too early:

```
// Note that we **must not** remove CFEI/CFSI with an immediate of 0,
// as they are used later on. E.g., in case of spilling when allocating registers.
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in sway-core/src/asm_generation/fuel/programs/abstract.rs at AllocatedAbstractInstructionSet::verify and read the surrounding TODO and abstract-instruction allocation flow. Implement verification for the listed CFEI/CFSI pairing, balanced stack use, and $$locbase requirements, covering any additional invariants supported by the surrounding code. Add the requested comment explaining why zero-immediate CFEI/CFSI instructions must remain for later register spilling.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.