From e01850b7ee9d116e55e383ba05ddeacb765ff186 Mon Sep 17 00:00:00 2001 From: Ivan Kylchik Date: Mon, 14 Oct 2024 17:34:53 +0200 Subject: [PATCH] [Native] Evaluate `moduleDeserializer` only when the function body is null #KT-67220 --- .../backend/konan/lower/NativeInlineFunctionResolver.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 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 8d4248b705b71..59813a4f20c45 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 @@ -50,8 +50,8 @@ internal class NativeInlineFunctionResolver( function.loweredInlineFunction?.let { return it } - val moduleDeserializer = context.irLinker.getCachedDeclarationModuleDeserializer(function) - val functionIsCached = moduleDeserializer != null && function.body == null + val moduleDeserializer = if (function.body == null) context.irLinker.getCachedDeclarationModuleDeserializer(function) else null + val functionIsCached = moduleDeserializer != null if (functionIsCached) { // The function is cached, get its body from the IR linker. moduleDeserializer.deserializeInlineFunction(function)