From 0e4e400cbaffbd470dcd660a4ca6ae214fc5deda Mon Sep 17 00:00:00 2001 From: Ivan Kylchik Date: Wed, 9 Oct 2024 17:26:23 +0200 Subject: [PATCH] [Native] Always lower a function inside inline fun resolver Even if a function is partially lowered, we will not break anything if we lower it again. Later we will introduce a new lowering (the same as SaveInlineFunctionsBeforeInlining for JS) that will cache functions lowered for the inliner. #KT-67220 --- .../konan/lower/NativeInlineFunctionResolver.kt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/NativeInlineFunctionResolver.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/NativeInlineFunctionResolver.kt index 8d66ca1a82da1..8d4248b705b71 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/NativeInlineFunctionResolver.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/NativeInlineFunctionResolver.kt @@ -52,17 +52,12 @@ internal class NativeInlineFunctionResolver( val moduleDeserializer = context.irLinker.getCachedDeclarationModuleDeserializer(function) val functionIsCached = moduleDeserializer != null && function.body == null - val shouldLower = if (functionIsCached) { + if (functionIsCached) { // The function is cached, get its body from the IR linker. - val (firstAccess, _) = moduleDeserializer.deserializeInlineFunction(function) - firstAccess - } else { - true + moduleDeserializer.deserializeInlineFunction(function) } - if (shouldLower) { - lower(function, functionIsCached) - } + lower(function, functionIsCached) return function.getOrSaveLoweredInlineFunction() }