Skip to content

Commit

Permalink
Merge branch 'ak/fixpointv2' into ak/fixpointv2-cdg
Browse files Browse the repository at this point in the history
  • Loading branch information
KuechA authored Jan 17, 2025
2 parents fe16288 + b52ba56 commit 71b9edb
Showing 1 changed file with 0 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ inline fun <reified V> iterateEOGClean(
(oldGlobalIt?.let { newState.lub(it) } ?: newState) as LatticeElement<V>
globalState[it] = newGlobalIt
if (it !in edgesList && (oldGlobalIt == null || newGlobalIt != oldGlobalIt)) {
newGlobalIt.checkEqualitySummary(oldGlobalIt)
edgesList.add(0, it)
}
}
Expand All @@ -64,43 +63,3 @@ inline fun <reified V> iterateEOGClean(
state?.lub(value) as LatticeElement<V>
} ?: startState
}

typealias specialLattice =
LatticeElement<
IdentityHashMap<
Node,
LatticeElement<IdentityHashMap<Node, LatticeElement<IdentitySet<Node>>>>,
>
>

fun LatticeElement<*>.checkEqualitySummary(oldGlobalIt: LatticeElement<*>?) {
(this as? specialLattice)?.checkEqualitySummary2(oldGlobalIt as? specialLattice)
// Nothing to see here.
}

fun specialLattice.checkEqualitySummary2(oldGlobalIt: specialLattice?) {
val newGlobalIt = this
oldGlobalIt ?: return

val equalKeys =
newGlobalIt.elements.keys.containsAll(oldGlobalIt.elements.keys) &&
oldGlobalIt.elements.keys.containsAll(newGlobalIt.elements.keys)
val equalValuesPerKey =
oldGlobalIt.elements.entries.map { (key, value) ->
value.elements to newGlobalIt.elements[key]!!.elements
}
val equalValuesMap =
equalValuesPerKey.map { (old, new) ->
Triple(
old != new,
old.keys.containsAll(new.keys) && new.keys.containsAll(old.keys),
old.entries
.map { (k, v) -> v.elements to new[k]?.elements }
.filter { it.first != it.second },
)
}
val shouldBeEqual =
equalValuesMap.all { it.first == true && it.second == true && it.third.isEmpty() }
print(shouldBeEqual)
newGlobalIt != oldGlobalIt
}

0 comments on commit 71b9edb

Please sign in to comment.