-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring to allow for new verification back ends (#1329)
* Add Backend enum * Use the new Backend enum in prusti-server * Make clippy happy * Initialize Viper lazily * Update prusti-server/src/backend.rs Co-authored-by: Federico Poli <fpoli@users.noreply.github.com> * Address change request * Clarify log message * Fix measurement of verification time --------- Co-authored-by: Federico Poli <fpoli@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
165 additions
and
96 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use crate::dump_viper_program; | ||
use prusti_common::{ | ||
config, | ||
vir::{LoweringContext, ToViper}, | ||
Stopwatch, | ||
}; | ||
use viper::{VerificationContext, VerificationResult}; | ||
|
||
pub enum Backend<'a> { | ||
Viper(viper::Verifier<'a>, &'a VerificationContext<'a>), | ||
} | ||
|
||
impl<'a> Backend<'a> { | ||
pub fn verify(&mut self, program: &prusti_common::vir::program::Program) -> VerificationResult { | ||
match self { | ||
Backend::Viper(viper, context) => { | ||
let mut stopwatch = | ||
Stopwatch::start("prusti-server backend", "construction of JVM objects"); | ||
|
||
let ast_utils = context.new_ast_utils(); | ||
|
||
ast_utils.with_local_frame(16, || { | ||
let ast_factory = context.new_ast_factory(); | ||
let viper_program = program.to_viper(LoweringContext::default(), &ast_factory); | ||
|
||
if config::dump_viper_program() { | ||
stopwatch.start_next("dumping viper program"); | ||
dump_viper_program( | ||
&ast_utils, | ||
viper_program, | ||
&program.get_name_with_check_mode(), | ||
); | ||
} | ||
|
||
stopwatch.start_next("viper verification"); | ||
viper.verify(viper_program) | ||
}) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.