Skip to content

More fixes for real applications #283

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

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object Versions {
const val clikt = "5.0.0"
const val detekt = "1.23.7"
const val ini4j = "0.5.4"
const val jacodb = "4ff7243d3a"
const val jacodb = "77b83e4127"
const val juliet = "1.3.2"
const val junit = "5.9.3"
const val kotlin = "2.1.0"
Expand Down
4 changes: 3 additions & 1 deletion usvm-core/src/main/kotlin/org/usvm/StepScope.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ class StepScope<T : UState<Type, *, Statement, Context, *, T>, Type, Statement,
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
check(canProcessFurtherOnCurrentStep) { "Caller should check before processing the current hop further" }
check(canProcessFurtherOnCurrentStep) {
"Caller should check before processing the current hop further"
}
return originalState.block()
}

Expand Down
14 changes: 13 additions & 1 deletion usvm-ts/src/main/kotlin/org/usvm/machine/TsContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import org.jacodb.ets.model.EtsAliasType
import org.jacodb.ets.model.EtsAnyType
import org.jacodb.ets.model.EtsArrayType
import org.jacodb.ets.model.EtsBooleanType
import org.jacodb.ets.model.EtsEnumValueType
import org.jacodb.ets.model.EtsGenericType
import org.jacodb.ets.model.EtsNullType
import org.jacodb.ets.model.EtsNumberType
import org.jacodb.ets.model.EtsRefType
Expand Down Expand Up @@ -73,7 +75,17 @@ class TsContext(
is EtsAnyType -> unresolvedSort
is EtsUnknownType -> unresolvedSort
is EtsAliasType -> typeToSort(type.originalType)
else -> TODO("${type::class.simpleName} is not yet supported: $type")
is EtsGenericType -> {
if (type.constraint == null && type.defaultType == null) {
unresolvedSort
} else {
TODO("Not yet implemented")
}
}
is EtsEnumValueType -> unresolvedSort
else -> {
TODO("${type::class.simpleName} is not yet supported: $type")
}
}

fun arrayDescriptorOf(type: EtsArrayType): EtsType {
Expand Down
35 changes: 26 additions & 9 deletions usvm-ts/src/main/kotlin/org/usvm/machine/TsMachine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.usvm.statistics.constraints.SoftConstraintsObserver
import org.usvm.statistics.distances.CfgStatisticsImpl
import org.usvm.statistics.distances.PlainCallGraphStatistics
import org.usvm.stopstrategies.StopStrategy
import org.usvm.stopstrategies.createStopStrategy
import org.usvm.util.humanReadableSignature
import kotlin.time.Duration.Companion.seconds
Expand Down Expand Up @@ -79,7 +80,7 @@
timeStatistics = timeStatistics,
coverageStatisticsFactory = { coverageStatistics },
cfgStatisticsFactory = { cfgStatistics },
callGraphStatisticsFactory = { callGraphStatistics },
callGraphStatisticsFactory = { callGraphStatistics }
)

val statesCollector =
Expand All @@ -101,14 +102,30 @@

val stepsStatistics = StepsStatistics<EtsMethod, TsState>()

val stopStrategy = createStopStrategy(
options,
targets,
timeStatisticsFactory = { timeStatistics },
stepsStatisticsFactory = { stepsStatistics },
coverageStatisticsFactory = { coverageStatistics },
getCollectedStatesCount = { statesCollector.collectedStates.size }
)
val stopStrategy = object : StopStrategy {
val strategy = createStopStrategy(
options,
targets,
timeStatisticsFactory =
{ timeStatistics },

Check warning

Code scanning / detekt

Reports mis-indented code Warning

Unexpected indentation (20) (should be 16)
stepsStatisticsFactory =
{ stepsStatistics },

Check warning

Code scanning / detekt

Reports mis-indented code Warning

Unexpected indentation (20) (should be 16)
coverageStatisticsFactory =
{ coverageStatistics },

Check warning

Code scanning / detekt

Reports mis-indented code Warning

Unexpected indentation (20) (should be 16)
getCollectedStatesCount =
{ statesCollector.collectedStates.size }

Check warning

Code scanning / detekt

Reports mis-indented code Warning

Unexpected indentation (20) (should be 16)
)

override fun shouldStop(): Boolean {
val result = strategy.shouldStop()

if (result) {
logger.warn { "Stop strategy finished execution $strategy" }
}

return result
}
}

observers.add(timeStatistics)
observers.add(stepsStatistics)
Expand Down
Loading
Loading