From 7845e6bb0abb1cbbace630e405e5e2f004f73d1a Mon Sep 17 00:00:00 2001 From: Ivan Kylchik Date: Wed, 6 Sep 2023 10:33:08 +0200 Subject: [PATCH] [JVM] Drop `visitControlFlowExceptionEdge` method from `FastStackAnalyzer` There is no class that overrides this method. Also replaced `newValue` call with `newExceptionValue`. Under the hood, `newExceptionValue` still calls `newValue` if the interpreter doesn't redefine it. And it kind of makes sense to call `newExceptionValue` here because we are handling try-catch block. --- .../optimization/fixStack/FastStackAnalyzer.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/fixStack/FastStackAnalyzer.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/fixStack/FastStackAnalyzer.kt index ae53b8f7a7b..be0ab9a7d4b 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/fixStack/FastStackAnalyzer.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/fixStack/FastStackAnalyzer.kt @@ -56,8 +56,6 @@ internal open class FastStackAnalyzer>( protected open fun visitControlFlowEdge(insnNode: AbstractInsnNode, successor: Int): Boolean = true - protected open fun visitControlFlowExceptionEdge(insn: Int, successor: Int): Boolean = true - // Don't have to visit the same exception handler multiple times - we care only about stack state at TCB start. override fun useFastComputeExceptionHandlers(): Boolean = true @@ -84,12 +82,11 @@ internal open class FastStackAnalyzer>( handlers[insnIndex]?.forEach { tcb -> val exnType = Type.getObjectType(tcb.type ?: "java/lang/Throwable") val jump = tcb.handler.indexOf() - if (visitControlFlowExceptionEdge(insnIndex, jump)) { - handler.init(currentlyAnalyzing) - handler.clearStack() - handler.push(interpreter.newValue(exnType)) - mergeControlFlowEdge(jump, handler) - } + + handler.init(currentlyAnalyzing) + handler.clearStack() + handler.push(interpreter.newExceptionValue(tcb, handler, exnType)) + mergeControlFlowEdge(jump, handler) } }