[JVM] Slightly rewrite mergeControlFlowEdge in FastStackAnalyzer
This change is supposed to show how similar `mergeControlFlowEdge` methods are, and maybe we should combine them.
This commit is contained in:
+9
-5
@@ -139,12 +139,16 @@ internal open class FastStackAnalyzer<V : Value, F : Frame<V>>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun mergeControlFlowEdge(dest: Int, frame: F, canReuse: Boolean) {
|
override fun mergeControlFlowEdge(dest: Int, frame: F, canReuse: Boolean) {
|
||||||
val destFrame = getFrame(dest)
|
val oldFrame = getFrame(dest)
|
||||||
if (destFrame == null) {
|
val changes = when {
|
||||||
// Don't have to visit same instruction multiple times - we care only about "initial" stack state.
|
// Don't have to visit the same instruction multiple times - we care only about "initial" stack state.
|
||||||
setFrame(dest, newFrame(frame.locals, frame.maxStackSize).apply { init(frame) })
|
oldFrame == null -> {
|
||||||
updateQueue(true, dest)
|
setFrame(dest, newFrame(frame.locals, frame.maxStackSize).apply { init(frame) })
|
||||||
|
true
|
||||||
|
}
|
||||||
|
else -> false
|
||||||
}
|
}
|
||||||
|
updateQueue(changes, dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user