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 39 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ccc157d
Hacks
CaelmBleidd May 29, 2025
78a7f34
More hacks
CaelmBleidd May 29, 2025
bde9520
Some more fixes
CaelmBleidd May 30, 2025
4d0cf6b
Tmp commit
CaelmBleidd May 30, 2025
a4954f9
Input arrays support
CaelmBleidd Jun 6, 2025
5d4dc68
Format
Lipen Jun 9, 2025
7cf9061
Operators implementation
CaelmBleidd Jun 10, 2025
2a07286
Some hacks
CaelmBleidd Jun 10, 2025
8c9e9f4
Fix a class signature lookup
CaelmBleidd Jun 11, 2025
689a902
Support simple casts
CaelmBleidd Jun 11, 2025
760624b
Clear logs
CaelmBleidd Jun 11, 2025
4bd35ba
Add todo
CaelmBleidd Jun 11, 2025
ada1c48
Rebase fix
CaelmBleidd Jun 18, 2025
0dda9c0
Tmp changes
CaelmBleidd Jun 19, 2025
78a134d
Some fixes
CaelmBleidd Jun 20, 2025
0a79a2f
Fix mocker return value
CaelmBleidd Jun 20, 2025
9049cfc
Resolve external locals
Lipen Jun 25, 2025
399dd4d
Rename 'expr' arg in observer
Lipen Jun 25, 2025
0312be1
Format
Lipen Jun 25, 2025
e72ec32
Add special case for "Aux[length] is a supertype of Array"
Lipen Jun 25, 2025
09e8cb8
Handle EtsArrayType in 'classesForType'
Lipen Jun 25, 2025
733c861
Expand and re-construct ITE with fake branches
Lipen Jun 25, 2025
8c37276
Handle ptr call
Lipen Jun 25, 2025
336c4b2
Remove unnecessary doWithState
Lipen Jun 25, 2025
a63c041
USE CALLEE INSTEAD OF METHOD
Lipen Jun 25, 2025
5ce84c9
Do not warn about unresolved 'then' method
Lipen Jun 25, 2025
d863419
Cherry-pick main
Lipen Jun 25, 2025
3b09c31
Fix printing of exceptions
Lipen Jun 25, 2025
226cc5d
Support 'toString'
Lipen Jun 25, 2025
5a71b32
Format
Lipen Jun 25, 2025
e17b09e
Handle fake objects and ITE with fake branches
Lipen Jun 25, 2025
f0fd064
Fix virtual invokes
CaelmBleidd Jun 26, 2025
e1dbb62
Small dot modification
CaelmBleidd Jun 26, 2025
9990ff5
Add visualization
CaelmBleidd Jun 27, 2025
4a3fcc3
Add visualization
CaelmBleidd Jun 27, 2025
281a96c
Visualization
CaelmBleidd Jun 30, 2025
a577095
Visualization
CaelmBleidd Jun 30, 2025
e7e3757
Move test
CaelmBleidd Jun 30, 2025
63caf79
Fix arrays
CaelmBleidd Jun 30, 2025
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 @@ -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 = "5889d3c784"
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 @@ -76,7 +78,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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface TsInterpreterObserver : UInterpreterObserver {

fun onCallWithUnresolvedArguments(
simpleValueResolver: TsSimpleValueResolver,
stmt: EtsCallExpr,
expr: EtsCallExpr,
scope: TsStepScope,
) {
// default empty implementation
Expand Down
40 changes: 31 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,7 +26,9 @@
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.TsStateVisualizer
import org.usvm.util.humanReadableSignature
import kotlin.time.Duration.Companion.seconds

Expand Down Expand Up @@ -79,7 +81,7 @@
timeStatistics = timeStatistics,
coverageStatisticsFactory = { coverageStatistics },
cfgStatisticsFactory = { cfgStatistics },
callGraphStatisticsFactory = { callGraphStatistics },
callGraphStatisticsFactory = { callGraphStatistics }
)

val statesCollector =
Expand All @@ -95,20 +97,40 @@
val observers = mutableListOf<UMachineObserver<TsState>>(coverageStatistics)
observers.add(statesCollector)

if (tsOptions.enableVisualization) {
observers += TsStateVisualizer()
}

if (options.useSoftConstraints) {
observers.add(SoftConstraintsObserver())
}

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
1 change: 1 addition & 0 deletions usvm-ts/src/main/kotlin/org/usvm/machine/TsOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ package org.usvm.machine

data class TsOptions(
val interproceduralAnalysis: Boolean = true,
val enableVisualization: Boolean = false,
)
Loading
Loading