Skip to content

Commit 0209271

Browse files
committed
fix ownership inheritance
1 parent 0c31856 commit 0209271

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

usvm-core/src/main/kotlin/org/usvm/constraints/PathConstraints.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import org.usvm.uctx
2424
*/
2525
open class UPathConstraints<Type>(
2626
protected val ctx: UContext<*>,
27-
private var ownership: MutabilityOwnership,
27+
protected open var ownership: MutabilityOwnership,
2828
protected val logicalConstraints: ULogicalConstraints = ULogicalConstraints.empty(),
2929
/**
3030
* Specially represented equalities and disequalities between objects, used in various part of constraints management.
@@ -52,7 +52,7 @@ open class UPathConstraints<Type>(
5252
/**
5353
* Recursively changes ownership for all nested data structures that use persistent maps.
5454
*/
55-
fun setOwnership(ownership: MutabilityOwnership) {
55+
fun changeOwnership(ownership: MutabilityOwnership) {
5656
this.ownership = ownership
5757
numericConstraints.ownership = ownership
5858
equalityConstraints.ownership = ownership

usvm-jvm/src/main/kotlin/org/usvm/machine/state/JcState.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class JcState(
4242
val newThisOwnership = MutabilityOwnership()
4343
val cloneOwnership = MutabilityOwnership()
4444
val clonedConstraints = newConstraints?.also {
45-
this.pathConstraints.setOwnership(newThisOwnership)
46-
it.setOwnership(cloneOwnership)
45+
this.pathConstraints.changeOwnership(newThisOwnership)
46+
it.changeOwnership(cloneOwnership)
4747
} ?: pathConstraints.clone(newThisOwnership, cloneOwnership)
4848
this.ownership = newThisOwnership
4949
return JcState(

usvm-python/usvm-python-main/src/main/kotlin/org/usvm/machine/PyPathConstraints.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import org.usvm.machine.types.PythonType
1515

1616
class PyPathConstraints(
1717
ctx: UContext<*>,
18-
private var ownership: MutabilityOwnership,
18+
override var ownership: MutabilityOwnership,
1919
logicalConstraints: ULogicalConstraints = ULogicalConstraints.empty(),
2020
equalityConstraints: UEqualityConstraints = UEqualityConstraints(ctx, ownership),
2121
typeConstraints: UTypeConstraints<PythonType> = UTypeConstraints(

usvm-python/usvm-python-main/src/main/kotlin/org/usvm/machine/PyState.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class PyState(
6666
val newThisOwnership = MutabilityOwnership()
6767
val cloneOwnership = MutabilityOwnership()
6868
val newPathConstraints = newConstraints?.also {
69-
this.pathConstraints.setOwnership(newThisOwnership)
70-
it.setOwnership(cloneOwnership)
69+
this.pathConstraints.changeOwnership(newThisOwnership)
70+
it.changeOwnership(cloneOwnership)
7171
} ?: pathConstraints.clone(newThisOwnership, cloneOwnership)
7272
val newMemory = memory.clone(newPathConstraints.typeConstraints, newThisOwnership, cloneOwnership)
7373
return PyState(

usvm-sample-language/src/main/kotlin/org/usvm/machine/SampleState.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class SampleState(
4747
val newThisOwnership = MutabilityOwnership()
4848
val cloneOwnership = MutabilityOwnership()
4949
val clonedConstraints = newConstraints?.also {
50-
this.pathConstraints.setOwnership(newThisOwnership)
51-
it.setOwnership(cloneOwnership)
50+
this.pathConstraints.changeOwnership(newThisOwnership)
51+
it.changeOwnership(cloneOwnership)
5252
} ?: pathConstraints.clone(newThisOwnership, cloneOwnership)
5353
return SampleState(
5454
ctx,

usvm-ts/src/main/kotlin/org/usvm/state/TSState.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class TSState(
4141
val newThisOwnership = MutabilityOwnership()
4242
val cloneOwnership = MutabilityOwnership()
4343
val clonedConstraints = newConstraints?.also {
44-
this.pathConstraints.setOwnership(newThisOwnership)
45-
it.setOwnership(cloneOwnership)
44+
this.pathConstraints.changeOwnership(newThisOwnership)
45+
it.changeOwnership(cloneOwnership)
4646
} ?: pathConstraints.clone(newThisOwnership, cloneOwnership)
4747
this.ownership = newThisOwnership
4848

usvm-util/src/main/kotlin/org/usvm/collections/immutable/extensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public fun <K, V> UPersistentHashMap<out K, V>.putAll(map: Map<out K, V>): UPers
4545
*
4646
* Entries of the map are iterated in the order they were specified.
4747
*/
48-
// public fun <K, V> persistentMapOf(ownership: MutabilityOwnership, vararg pairs: Pair<K, V>): UPersistentHashMap<K, V> =
48+
// public fun <K, V> persistentMapOf(ownership: MutabilityOwnership, vararg pairs: Pair<K, V>): UPersistentHashMap<K, V> =
4949
// persistentMapBuilderOf(ownership, *pairs).build()
5050

5151
/**

usvm-util/src/main/kotlin/org/usvm/collections/immutable/implementations/immutableMap/TrieNode.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ class TrieNode<K, V>(
432432
if (nodeMap == 0) return buffer.size / ENTRY_SIZE
433433
val numValues = dataMap.countOneBits()
434434
var result = numValues
435-
for(i in (numValues * ENTRY_SIZE) until buffer.size) {
435+
for (i in (numValues * ENTRY_SIZE) until buffer.size) {
436436
result += nodeAtIndex(i).calculateSize()
437437
}
438438
return result

usvm-util/src/main/kotlin/org/usvm/collections/immutable/implementations/immutableSet/TrieNode.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class TrieNode<E>(
216216
private fun mutableCollisionRemove(element: E, owner: MutabilityOwnership): TrieNode<E> {
217217
val index = buffer.indexOf(element)
218218
if (index != -1) {
219-
mutableRemovesCount++;
219+
mutableRemovesCount++
220220
return collisionRemoveElementAtIndex(index, owner)
221221
}
222222
return this

0 commit comments

Comments
 (0)