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

Upgrade KSMT and add solver theory specialization for jvm #218

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object Versions {
const val kotlinx_collections = "0.3.5"
const val kotlinx_coroutines = "1.6.4"
const val kotlinx_serialization = "1.4.1"
const val ksmt = "0.5.21"
const val ksmt = "0.5.26"
const val logback = "1.4.8"
const val mockk = "1.13.4"
const val rd = "2023.2.0"
Expand Down
29 changes: 25 additions & 4 deletions usvm-jvm/src/main/kotlin/org/usvm/machine/JcSolverFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.usvm.machine
import io.ksmt.KContext
import io.ksmt.solver.KSolver
import io.ksmt.solver.KSolverConfiguration
import io.ksmt.solver.KTheory
import io.ksmt.solver.runner.KSolverRunnerManager
import io.ksmt.solver.yices.KYicesSolver
import io.ksmt.solver.yices.KYicesSolverConfiguration
Expand Down Expand Up @@ -30,8 +31,18 @@ private object SameProcessSolverFactory : SolverFactory {
solverType: SolverType
): KSolver<out KSolverConfiguration> = when (solverType) {
// Yices with Fp support via SymFpu
SolverType.YICES -> KSymFpuSolver(KYicesSolver(ctx), ctx)
SolverType.Z3 -> KZ3Solver(ctx)
SolverType.YICES -> KSymFpuSolver(KYicesSolver(ctx), ctx).apply {
configure {
// Fp theory is handled by the SymFpu
optimizeForTheories(setOf(KTheory.Array, KTheory.BV, KTheory.UF))
}
}

SolverType.Z3 -> KZ3Solver(ctx).apply {
configure {
optimizeForTheories(setOf(KTheory.Array, KTheory.BV, KTheory.UF, KTheory.FP))
}
}
}

override fun close() {
Expand All @@ -52,8 +63,18 @@ private class AnotherProcessSolverFactory : SolverFactory {
solverType: SolverType
): KSolver<out KSolverConfiguration> = when (solverType) {
// Yices with Fp support via SymFpu
SolverType.YICES -> solverManager.createSolver(ctx, YicesWithSymFpu::class)
SolverType.Z3 -> solverManager.createSolver(ctx, KZ3Solver::class)
SolverType.YICES -> solverManager.createSolver(ctx, YicesWithSymFpu::class).apply {
configure {
// Fp theory is handled by the SymFpu
optimizeForTheories(setOf(KTheory.Array, KTheory.BV, KTheory.UF))
}
}

SolverType.Z3 -> solverManager.createSolver(ctx, KZ3Solver::class).apply {
configure {
optimizeForTheories(setOf(KTheory.Array, KTheory.BV, KTheory.UF, KTheory.FP))
}
}
}

override fun close() {
Expand Down
Loading