Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verification pass #73

Merged
merged 8 commits into from
Oct 17, 2024
Merged

Verification pass #73

merged 8 commits into from
Oct 17, 2024

Conversation

emhane
Copy link
Contributor

@emhane emhane commented Oct 10, 2024

Defines VerificationPass and VerificationCtx

Copy link
Collaborator

@Y-Nak Y-Nak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall design intent of this PR is unclear. Specifically, it's not clear how the actual passes will be managed, what granularity of parallelization is being considered, or how flexible you intend the verification pass system to be (e.g., will users be able to inject their own passes?).

Could you provide more details on your design approach so I can better understand your intentions?

crates/verifier/src/ctx.rs Outdated Show resolved Hide resolved
crates/verifier/src/pass.rs Outdated Show resolved Hide resolved
crates/verifier/src/pass.rs Outdated Show resolved Hide resolved
@emhane
Copy link
Contributor Author

emhane commented Oct 12, 2024

The overall design intent of this PR is unclear. Specifically, it's not clear how the actual passes will be managed, what granularity of parallelization is being considered, or how flexible you intend the verification pass system to be (e.g., will users be able to inject their own passes?).

no parallelisation is being considered for starters, aiming to get the base in, and have a very simple verifier working first of all, then add complexity from there as next milestones.

can remove the RwLock around error stack in verification context for now, since parallelisation is out of scope.

Could you provide more details on your design approach so I can better understand your intentions?

the verifier passes will be implemented on a function basis, not module basis, to start with. just like was done for graphviz, which is yet to be implemented on a module basis (should open issue for this).

@emhane emhane requested a review from Y-Nak October 12, 2024 16:37
@Y-Nak
Copy link
Collaborator

Y-Nak commented Oct 12, 2024

The main part that makes VerificationCtx complex more than necessary would be PrimaryMap<PassRef, FuncRef>.
I still think this is a misusage of PrimaryMap. If the pass needs to obtain the Function definition, it's enough that the pass takes FuncRef and asks it by calling VerificationCtx::func_data.
Why do you need to define PassRef? I don't see any advantage to using it from the current implementation/design.

@emhane
Copy link
Contributor Author

emhane commented Oct 12, 2024

The main part that makes VerificationCtx complex more than necessary would be PrimaryMap<PassRef, FuncRef>. I still think this is a misusage of PrimaryMap. If the pass needs to obtain the Function definition, it's enough that the pass takes FuncRef and asks it by calling VerificationCtx::func_data. Why do you need to define PassRef? I don't see any advantage to using it from the current implementation/design.

agreed, I have shrunk the scope to better fit the function-basis passes that I will implement to start with (except FunctionIsNullReference when verifying a call instruction, because it will require the module)

#[derive(Debug, Clone, Copy)]
pub enum ErrorKind {
// Function errors
PhiInEntryBlock(Insn),
// Block errors
EmptyBlock(Block),
TerminatorBeforeEnd(Insn),
NotEndedByTerminator(Insn),
InstructionMapMismatched(Insn),
BranchBrokenLink(Insn),
// Instruction errors
ValueIsNullReference(Value),
BlockIsNullReference(Block),
FunctionIsNullReference(FuncRef),
BranchToEntryBlock(Block),
// SSA form errors
ValueLeak(Value),
// Type errors
InsnArgWrongType(Type),
InsnResultWrongType(Type),
CalleeArgWrongType(Type),
CalleeResultWrongType(Type),
CompoundTypeIsNullReference(Type),
}

@emhane
Copy link
Contributor Author

emhane commented Oct 13, 2024

blocked by #69

@Y-Nak
Copy link
Collaborator

Y-Nak commented Oct 16, 2024

@emhane Would you rebase to the master? Sorry for the inconvenience.

@emhane emhane force-pushed the verification-pass branch from 64a294e to 8c0a56e Compare October 16, 2024 18:03
@emhane
Copy link
Contributor Author

emhane commented Oct 16, 2024

@emhane Would you rebase to the master? Sorry for the inconvenience.

done @Y-Nak

Copy link
Collaborator

@Y-Nak Y-Nak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Y-Nak Y-Nak merged commit c6a9dc2 into fe-lang:main Oct 17, 2024
10 checks passed
@emhane emhane deleted the verification-pass branch October 18, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants