FIR CFA: align reading of labels with the way they're generated
UncaughtExceptionPath label out of a finally block matches every label that is not handled by another edge, and a labeled edge from the middle of a finally block aborts the jump and so should merge all available data.
This commit is contained in:
+3
-1
@@ -921,6 +921,8 @@ class ControlFlowGraphBuilder {
|
||||
val nextExitLevel = levelOfNextExceptionCatchingGraph()
|
||||
val nextFinally = finallyEnterNodes.topOrNull()?.takeIf { it.level > nextExitLevel }
|
||||
if (nextFinally != null) {
|
||||
// `PathAwareControlFlowGraphVisitor` has a special case that this path matches any label
|
||||
// that is not otherwise matched by the edges below.
|
||||
addEdge(exitNode, nextFinally, label = UncaughtExceptionPath, propagateDeadness = false)
|
||||
}
|
||||
|
||||
@@ -1289,7 +1291,7 @@ class ControlFlowGraphBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private fun addBackEdge(from: CFGNode<*>, to: CFGNode<*>, isDead: Boolean = false, label: EdgeLabel = LoopBackPath) {
|
||||
private fun addBackEdge(from: CFGNode<*>, to: CFGNode<*>, isDead: Boolean = false, label: EdgeLabel = NormalPath) {
|
||||
val kind = if (isDead || from.isDead || to.isDead) EdgeKind.DeadBackward else EdgeKind.CfgBackward
|
||||
CFGNode.addEdge(from, to, kind, propagateDeadness = false, label = label)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user