From 47a0bdc1bc2af5814609b7083a7549ac312cf30d Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 13 Jan 2022 15:45:18 +0300 Subject: [PATCH] Native: remove forwardingForeignExceptionsTerminatedWith It is no longer used, and was generally misdesigned. --- .../backend/konan/llvm/CodeGenerator.kt | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt index e7ebe0e3718..980395a1057 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt @@ -499,11 +499,6 @@ internal abstract class FunctionGenerationContext( private val invokeInstructions = mutableListOf() - /** - * TODO: consider merging this with [ExceptionHandler]. - */ - var forwardingForeignExceptionsTerminatedWith: LlvmCallable? = null - // Whether the generating function needs to initialize Kotlin runtime before execution. Useful for interop bridges, // for example. var needsRuntimeInit = false @@ -1481,34 +1476,6 @@ internal abstract class FunctionGenerationContext( val landingpad = gxxLandingpad(numClauses = 0) LLVMSetCleanup(landingpad, 1) - forwardingForeignExceptionsTerminatedWith?.let { terminator -> - // Catch all but Kotlin exceptions. - val clause = ConstArray(int8TypePtr, listOf(kotlinExceptionRtti)) - LLVMAddClause(landingpad, clause.llvm) - - val bbCleanup = basicBlock("forwardException", position()?.end) - val bbUnexpected = basicBlock("unexpectedException", position()?.end) - - val selector = extractValue(landingpad, 1) - condBr( - icmpLt(selector, Int32(0).llvm), - bbUnexpected, - bbCleanup - ) - - appendingTo(bbUnexpected) { - val exceptionRecord = extractValue(landingpad, 0) - - val beginCatch = context.llvm.cxaBeginCatchFunction - // So `terminator` is called from C++ catch block: - call(beginCatch, listOf(exceptionRecord)) - call(terminator, emptyList()) - unreachable() - } - - positionAtEnd(bbCleanup) - } - releaseVars() handleEpilogueExperimentalMM() LLVMBuildResume(builder, landingpad)