Skip to content

Refactoring to allow for new verification back ends - #1329

Merged
fpoli merged 8 commits into
viperproject:masterfrom
JakuJ:backend-minimal
Feb 27, 2023
Merged

Refactoring to allow for new verification back ends#1329
fpoli merged 8 commits into
viperproject:masterfrom
JakuJ:backend-minimal

Conversation

@JakuJ

@JakuJ JakuJ commented Feb 19, 2023

Copy link
Copy Markdown
Contributor

Related to #1321 – this PR aims to abstract away the notion of a verification back end behind an enum, in order to facilitate implementation of new back ends.

Had to make env on viper::Verifier public to do this. I cannot put the call to program.to_viper() in viper since that would be a cyclic dependency to prusti-common, and returning an AstFactory from some method would cause E0502 on call to viper.verify().

@vakaras
vakaras requested a review from fpoli February 22, 2023 14:19

@vakaras vakaras left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please move all the Java things into Backend::Viper? For example, the construction of the Viper object, build Viper program closure, etc.

@fpoli

fpoli commented Feb 22, 2023

Copy link
Copy Markdown
Member

the construction of the Viper object

We just discussed this with Vytautas: it should be enough to store Viper inside an Arc<Lazy<..>> instead of inside Arc<..> as it is now. There us no need to move the local variable somewhere else. See the Lazy documentation.

@fpoli

fpoli commented Feb 22, 2023

Copy link
Copy Markdown
Member

If you remove the verification_context: &'v VerificationContext<'t> argument and make it a field of `

enum Backend<'v> {
    Viper { verifier: viper::Verifier<'v>, verification_context: Rc<VerificationContext<'v>> }
}

then making the env field public should no longer be needed. Let us know if this suggestion causes weird lifetime errors.

@fpoli

fpoli commented Feb 22, 2023

Copy link
Copy Markdown
Member

etc

The ast_utils.with_local_frame(16, || { .. }) wrapper can be moved too inside the Backend::verify method, so that it's used only for the Viper verifiers.

@JakuJ

JakuJ commented Feb 23, 2023

Copy link
Copy Markdown
Contributor Author

I made it so that the viper object is now initialized lazily, both on the server as well as in the prusti-viper package. Reorganized code around the backend call. Let me know how it looks now.

@vakaras vakaras left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me.

@fpoli Could you please check that Lazy is used as you intended?

@fpoli fpoli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lazy is perfect, thanks! The dump disappeared and the log messages need to be updated, then it's good to be merged.

Comment thread prusti-server/src/backend.rs Outdated
Comment thread prusti-server/src/process_verification.rs
Comment thread prusti-server/src/backend.rs Outdated
Comment thread prusti-server/src/backend.rs
@JakuJ
JakuJ requested a review from fpoli February 24, 2023 20:40
Comment thread prusti-server/src/process_verification.rs Outdated
Comment thread prusti-server/src/backend.rs
@fpoli

fpoli commented Feb 27, 2023

Copy link
Copy Markdown
Member

I rebased on master.

@vakaras

vakaras commented Feb 27, 2023

Copy link
Copy Markdown
Contributor

The CI failure seems to be unrelated to this PR. @fpoli If you agree, please merge.

@fpoli
fpoli merged commit e4896c0 into viperproject:master Feb 27, 2023
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.

3 participants