Skip to content

Commit

Permalink
Add smtperf feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Alasdair committed Jul 3, 2024
1 parent 4ead56d commit 48805f7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions isla-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ architecture specifications. This crate implements the core symbolic
execution engine as a library.
"""

[features]
smtperf = []

[build-dependencies]
lalrpop = { version = "0.20.2", features = ["lexer"] }

Expand Down
25 changes: 25 additions & 0 deletions isla-lib/src/smt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,29 @@ impl<'ctx> Drop for Ast<'ctx> {
}
}

#[cfg(not(feature = "smtperf"))]
struct PerformanceInfo {}


#[cfg(feature = "smtperf")]
struct PerformanceInfo {
time_per_variable: HashMap<Sym, Duration, ahash::AHasher>,
}

impl PerformanceInfo {
#[cfg(not(feature = "smtperf"))]
fn new() -> Self {
PerformanceInfo {}
}

#[cfg(feature = "smtperf")]
fn new() -> Self {
PerformanceInfo {
time_per_variable: HashMap::default()
}
}
}

/// The Solver type handles all interaction with Z3. It mimics
/// interacting with Z3 via the subset of the SMTLIB 2.0 format we
/// care about.
Expand Down Expand Up @@ -1261,6 +1284,7 @@ pub struct Solver<'ctx, B> {
enums: Enums<'ctx>,
z3_solver: Z3_solver,
ctx: &'ctx Context,
performance_info: PerformanceInfo,
}

impl<'ctx, B> Drop for Solver<'ctx, B> {
Expand Down Expand Up @@ -1492,6 +1516,7 @@ impl<'ctx, B: BV> Solver<'ctx, B> {
decls: HashMap::new(),
func_decls: HashMap::new(),
enums: Enums::new(ctx),
performance_info: PerformanceInfo::new(),
}
}
}
Expand Down

0 comments on commit 48805f7

Please sign in to comment.