Skip to content

Commit 48805f7

Browse files
committed
Add smtperf feature
1 parent 4ead56d commit 48805f7

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

isla-lib/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ architecture specifications. This crate implements the core symbolic
1414
execution engine as a library.
1515
"""
1616

17+
[features]
18+
smtperf = []
19+
1720
[build-dependencies]
1821
lalrpop = { version = "0.20.2", features = ["lexer"] }
1922

isla-lib/src/smt.rs

+25
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,29 @@ impl<'ctx> Drop for Ast<'ctx> {
12021202
}
12031203
}
12041204

1205+
#[cfg(not(feature = "smtperf"))]
1206+
struct PerformanceInfo {}
1207+
1208+
1209+
#[cfg(feature = "smtperf")]
1210+
struct PerformanceInfo {
1211+
time_per_variable: HashMap<Sym, Duration, ahash::AHasher>,
1212+
}
1213+
1214+
impl PerformanceInfo {
1215+
#[cfg(not(feature = "smtperf"))]
1216+
fn new() -> Self {
1217+
PerformanceInfo {}
1218+
}
1219+
1220+
#[cfg(feature = "smtperf")]
1221+
fn new() -> Self {
1222+
PerformanceInfo {
1223+
time_per_variable: HashMap::default()
1224+
}
1225+
}
1226+
}
1227+
12051228
/// The Solver type handles all interaction with Z3. It mimics
12061229
/// interacting with Z3 via the subset of the SMTLIB 2.0 format we
12071230
/// care about.
@@ -1261,6 +1284,7 @@ pub struct Solver<'ctx, B> {
12611284
enums: Enums<'ctx>,
12621285
z3_solver: Z3_solver,
12631286
ctx: &'ctx Context,
1287+
performance_info: PerformanceInfo,
12641288
}
12651289

12661290
impl<'ctx, B> Drop for Solver<'ctx, B> {
@@ -1492,6 +1516,7 @@ impl<'ctx, B: BV> Solver<'ctx, B> {
14921516
decls: HashMap::new(),
14931517
func_decls: HashMap::new(),
14941518
enums: Enums::new(ctx),
1519+
performance_info: PerformanceInfo::new(),
14951520
}
14961521
}
14971522
}

0 commit comments

Comments
 (0)