From 552984758e4992129d791420a1f266b636b8c26e Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Tue, 24 Dec 2019 17:15:28 +0300 Subject: [PATCH] Fix local arrays type info. --- .../org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt index 07d45e5c4b0..421e37c9dd7 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt @@ -47,6 +47,7 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { fun llvmFunctionOrNull(function: IrFunction): LLVMValueRef? = function.llvmFunctionOrNull val intPtrType = LLVMIntPtrTypeInContext(llvmContext, llvmTargetData)!! internal val immOneIntPtrType = LLVMConstInt(intPtrType, 1, 1)!! + internal val immThreeIntPtrType = LLVMConstInt(intPtrType, 3, 1)!! // Keep in sync with OBJECT_TAG_MASK in C++. internal val immTypeInfoMask = LLVMConstNot(LLVMConstInt(intPtrType, 3, 0)!!)!! @@ -481,7 +482,8 @@ internal class FunctionGenerationContext(val function: LLVMValueRef, fun setTypeInfoForLocalObject(objectHeader: LLVMValueRef) { val typeInfo = structGep(objectHeader, 0, "typeInfoOrMeta_") // Set tag OBJECT_TAG_PERMANENT_CONTAINER | OBJECT_TAG_NONTRIVIAL_CONTAINER. - val typeInfoValue = intToPtr(or(ptrToInt(alloca(kTypeInfo), int32Type), Int32(3).llvm), kTypeInfoPtr) + val typeInfoValue = intToPtr(or(ptrToInt(alloca(kTypeInfo), codegen.intPtrType), + codegen.immThreeIntPtrType), kTypeInfoPtr) store(typeInfoValue, typeInfo) }