From d1f33e6cd1de382436a41ac1e99470c191d5c2d2 Mon Sep 17 00:00:00 2001 From: "thetabotmaintainer[bot]" <139346997+thetabotmaintainer[bot]@users.noreply.github.com> Date: Sun, 10 Sep 2023 15:07:55 +0200 Subject: [PATCH] Reformatted code (#204) Co-authored-by: ThetaBotMaintainer[bot] <139346997+ThetaBotMaintainer[bot]@users.noreply.github.com> --- .../hu/bme/mit/theta/xcfa/analysis/por/XcfaDporLts.kt | 11 ++++++----- .../main/java/hu/bme/mit/theta/xcfa/passes/LbePass.kt | 2 +- .../hu/bme/mit/theta/xcfa/passes/LoopUnrollPass.kt | 6 +++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/subprojects/xcfa/xcfa-analysis/src/main/java/hu/bme/mit/theta/xcfa/analysis/por/XcfaDporLts.kt b/subprojects/xcfa/xcfa-analysis/src/main/java/hu/bme/mit/theta/xcfa/analysis/por/XcfaDporLts.kt index 81ddf8de8d..8a0749a941 100644 --- a/subprojects/xcfa/xcfa-analysis/src/main/java/hu/bme/mit/theta/xcfa/analysis/por/XcfaDporLts.kt +++ b/subprojects/xcfa/xcfa-analysis/src/main/java/hu/bme/mit/theta/xcfa/analysis/por/XcfaDporLts.kt @@ -198,7 +198,8 @@ open class XcfaDporLts(private val xcfa: XCFA) : LTS { if (stack.size >= 2) { val lastButOne = stack[stack.size - 2] val mutexNeverReleased = - last.mutexLocks.containsKey("") && (last.state.mutexes.keys subtract lastButOne.state.mutexes.keys).contains( + last.mutexLocks.containsKey( + "") && (last.state.mutexes.keys subtract lastButOne.state.mutexes.keys).contains( "" ) if (last.node.explored.isEmpty() || mutexNeverReleased) { @@ -413,10 +414,10 @@ open class XcfaDporLts(private val xcfa: XCFA) : LTS { private fun notdep(start: Int, action: A): List { val e = stack[start].action return stack.slice(start + 1 until stack.size).filterIndexed { index, item -> - item.node.parent.get() == stack[start + 1 + index - 1].node && !dependent( - e, item.action - ) - }.map { it.action }.toMutableList().apply { add(action) } + item.node.parent.get() == stack[start + 1 + index - 1].node && !dependent( + e, item.action + ) + }.map { it.action }.toMutableList().apply { add(action) } } /** diff --git a/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/LbePass.kt b/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/LbePass.kt index c539affb06..96cbd7832a 100644 --- a/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/LbePass.kt +++ b/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/LbePass.kt @@ -306,7 +306,7 @@ class LbePass(val parseContext: ParseContext) : ProcedurePass { private fun isNotLocal(edge: XcfaEdge): Boolean { return !edge.getFlatLabels().all { label -> !(label is StartLabel || label is JoinLabel) && label.collectVars().all(builder.getVars()::contains) && - !(label is StmtLabel && label.stmt is AssumeStmt && label.stmt.cond is FalseExpr) + !(label is StmtLabel && label.stmt is AssumeStmt && label.stmt.cond is FalseExpr) } } } \ No newline at end of file diff --git a/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/LoopUnrollPass.kt b/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/LoopUnrollPass.kt index 9613ba5b98..c3d421bc79 100644 --- a/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/LoopUnrollPass.kt +++ b/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/passes/LoopUnrollPass.kt @@ -40,6 +40,7 @@ import java.util.* class LoopUnrollPass : ProcedurePass { companion object { + var UNROLL_LIMIT = 50 private val solver: Solver = SolverManager.resolveSolverFactory("Z3").createSolver() @@ -48,8 +49,11 @@ class LoopUnrollPass : ProcedurePass { private val testedLoops = mutableSetOf() private data class Loop( - val loopVar: VarDecl<*>, val loopVarModifiers: List, val loopVarInit: XcfaEdge, val loopCondEdge: XcfaEdge, val exitCondEdge: XcfaEdge, val loopStart: XcfaLocation, val loopLocs: List, val loopEdges: List + val loopVar: VarDecl<*>, val loopVarModifiers: List, val loopVarInit: XcfaEdge, + val loopCondEdge: XcfaEdge, val exitCondEdge: XcfaEdge, val loopStart: XcfaLocation, + val loopLocs: List, val loopEdges: List ) { + private class BasicStmtAction(private val stmt: Stmt) : StmtAction() { constructor(edge: XcfaEdge) : this(edge.label.toStmt()) constructor(edges: List) : this(SequenceLabel(edges.map { it.label }).toStmt())