Skip to content
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 usvm-core/src/main/kotlin/org/usvm/Machine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package org.usvm
*
* @see [run]
*/
abstract class UMachine<State : UState<*, *, *, *>, Target> {
abstract class UMachine<State : UState<*, *, *, *>, Target> : AutoCloseable {
/**
* The main entry point. Template method for running the machine on a specified [target].
*
Expand Down
6 changes: 5 additions & 1 deletion usvm-core/src/main/kotlin/org/usvm/solver/Solver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ open class UUnsatResult<Model> : USolverResult<Model>

open class UUnknownResult<Model> : USolverResult<Model>

abstract class USolver<in PathCondition, out Model> {
abstract class USolver<in PathCondition, out Model> : AutoCloseable {
abstract fun check(pc: PathCondition, useSoftConstraints: Boolean): USolverResult<Model>
}

Expand Down Expand Up @@ -135,4 +135,8 @@ open class USolverBase<Field, Type, Method>(

fun emptyModel(): UModelBase<Field, Type> =
(checkWithSoftConstraints(UPathConstraints(ctx)) as USatResult<UModelBase<Field, Type>>).model

override fun close() {
smtSolver.close()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ class SampleMachine(
private fun isInterestingState(state: SampleState): Boolean {
return state.callStack.isNotEmpty() && state.exceptionRegister == null
}

override fun close() {
solver.close()
ctx.close()
}
}