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 088b859bd92..21e77f02de8 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 @@ -458,7 +458,8 @@ internal abstract class FunctionGenerationContext( var returnType: LLVMTypeRef? = LLVMGetReturnType(getFunctionType(function)) val constructedClass: IrClass? get() = (irFunction as? IrConstructor)?.constructedClass - private var returnSlot: LLVMValueRef? = null + var returnSlot: LLVMValueRef? = null + private set private var slotsPhi: LLVMValueRef? = null private val frameOverlaySlotCount = (LLVMStoreSizeOfType(llvmTargetData, runtime.frameOverlayType) / runtime.pointerSize).toInt() @@ -585,10 +586,10 @@ internal abstract class FunctionGenerationContext( return result } - fun loadSlot(address: LLVMValueRef, isVar: Boolean, name: String = ""): LLVMValueRef { + fun loadSlot(address: LLVMValueRef, isVar: Boolean, resultSlot: LLVMValueRef? = null, name: String = ""): LLVMValueRef { val value = LLVMBuildLoad(builder, address, name)!! if (isObjectRef(value) && isVar) { - val slot = alloca(LLVMTypeOf(value), variableLocation = null) + val slot = resultSlot ?: alloca(LLVMTypeOf(value), variableLocation = null) storeStackRef(value, slot) } return value @@ -672,14 +673,17 @@ internal abstract class FunctionGenerationContext( fun call(llvmCallable: LlvmCallable, args: List, resultLifetime: Lifetime = Lifetime.IRRELEVANT, exceptionHandler: ExceptionHandler = ExceptionHandler.None, - verbatim: Boolean = false): LLVMValueRef = - call(llvmCallable.llvmValue, args, resultLifetime, exceptionHandler, verbatim, llvmCallable.attributeProvider) + verbatim: Boolean = false, + resultSlot: LLVMValueRef? = null, + ): LLVMValueRef = + call(llvmCallable.llvmValue, args, resultLifetime, exceptionHandler, verbatim, llvmCallable.attributeProvider, resultSlot) fun call(llvmFunction: LLVMValueRef, args: List, resultLifetime: Lifetime = Lifetime.IRRELEVANT, exceptionHandler: ExceptionHandler = ExceptionHandler.None, verbatim: Boolean = false, - attributeProvider: LlvmFunctionAttributeProvider? = null + attributeProvider: LlvmFunctionAttributeProvider? = null, + resultSlot: LLVMValueRef? = null ): LLVMValueRef { val callArgs = if (verbatim || !isObjectReturn(llvmFunction.type)) { args @@ -687,7 +691,7 @@ internal abstract class FunctionGenerationContext( // If function returns an object - create slot for the returned value or give local arena. // This allows appropriate rootset accounting by just looking at the stack slots, // along with ability to allocate in appropriate arena. - val resultSlot = when (resultLifetime.slotType) { + val realResultSlot = resultSlot ?: when (resultLifetime.slotType) { SlotType.STACK -> { localAllocs++ // Case of local call. Use memory allocated on stack. @@ -705,7 +709,7 @@ internal abstract class FunctionGenerationContext( else -> throw Error("Incorrect slot type: ${resultLifetime.slotType}") } - args + resultSlot + args + realResultSlot } return callRaw(llvmFunction, callArgs, exceptionHandler, attributeProvider) } @@ -772,29 +776,30 @@ internal abstract class FunctionGenerationContext( } } - fun allocInstance(typeInfo: LLVMValueRef, lifetime: Lifetime): LLVMValueRef = - call(context.llvm.allocInstanceFunction, listOf(typeInfo), lifetime) + fun allocInstance(typeInfo: LLVMValueRef, lifetime: Lifetime, resultSlot: LLVMValueRef?): LLVMValueRef = + call(context.llvm.allocInstanceFunction, listOf(typeInfo), lifetime, resultSlot = resultSlot) - fun allocInstance(irClass: IrClass, lifetime: Lifetime, stackLocalsManager: StackLocalsManager) = + fun allocInstance(irClass: IrClass, lifetime: Lifetime, stackLocalsManager: StackLocalsManager, resultSlot: LLVMValueRef?) = if (lifetime == Lifetime.STACK) stackLocalsManager.alloc(irClass, // In case the allocation is not from the root scope, fields must be cleaned up explicitly, // as the object might be being reused. cleanFieldsExplicitly = stackLocalsManager != this.stackLocalsManager) else - allocInstance(codegen.typeInfoForAllocation(irClass), lifetime) + allocInstance(codegen.typeInfoForAllocation(irClass), lifetime, resultSlot) fun allocArray( irClass: IrClass, count: LLVMValueRef, lifetime: Lifetime, - exceptionHandler: ExceptionHandler + exceptionHandler: ExceptionHandler, + resultSlot: LLVMValueRef? = null ): LLVMValueRef { val typeInfo = codegen.typeInfoValue(irClass) return if (lifetime == Lifetime.STACK) { stackLocalsManager.allocArray(irClass, count) } else { - call(context.llvm.allocArrayFunction, listOf(typeInfo, count), lifetime, exceptionHandler) + call(context.llvm.allocArrayFunction, listOf(typeInfo, count), lifetime, exceptionHandler, resultSlot = resultSlot) } } @@ -1235,7 +1240,8 @@ internal abstract class FunctionGenerationContext( } fun getObjectValue(irClass: IrClass, exceptionHandler: ExceptionHandler, - startLocationInfo: LocationInfo?, endLocationInfo: LocationInfo? = null + startLocationInfo: LocationInfo?, endLocationInfo: LocationInfo? = null, + resultSlot: LLVMValueRef? = null ): LLVMValueRef { // TODO: could be processed the same way as other stateless objects. if (irClass.isUnit()) { @@ -1327,7 +1333,7 @@ internal abstract class FunctionGenerationContext( context.llvm.initThreadLocalSingleton } val args = listOf(objectPtr, typeInfo, ctor) - val newValue = call(initFunction, args, Lifetime.GLOBAL, exceptionHandler) + val newValue = call(initFunction, args, Lifetime.GLOBAL, exceptionHandler, resultSlot = resultSlot) val bbInitResult = currentBlock br(bbExit) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IntrinsicGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IntrinsicGenerator.kt index 2a5002f5b53..21f6560962e 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IntrinsicGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IntrinsicGenerator.kt @@ -114,11 +114,12 @@ internal interface IntrinsicGeneratorEnvironment { fun calculateLifetime(element: IrElement): Lifetime - fun evaluateCall(function: IrFunction, args: List, resultLifetime: Lifetime, superClass: IrClass? = null): LLVMValueRef + fun evaluateCall(function: IrFunction, args: List, resultLifetime: Lifetime, + superClass: IrClass? = null, resultSlot: LLVMValueRef? = null): LLVMValueRef fun evaluateExplicitArgs(expression: IrFunctionAccessExpression): List - fun evaluateExpression(value: IrExpression): LLVMValueRef + fun evaluateExpression(value: IrExpression, resultSlot: LLVMValueRef?): LLVMValueRef } internal fun tryGetIntrinsicType(callSite: IrFunctionAccessExpression): IntrinsicType? = @@ -158,7 +159,7 @@ internal class IntrinsicGenerator(private val environment: IntrinsicGeneratorEnv * So this method looks at [callSite] and if it is call to "special" intrinsic * processes it. Otherwise it returns null. */ - fun tryEvaluateSpecialCall(callSite: IrFunctionAccessExpression): LLVMValueRef? { + fun tryEvaluateSpecialCall(callSite: IrFunctionAccessExpression, resultSlot: LLVMValueRef?): LLVMValueRef? { val function = callSite.symbol.owner if (!function.isTypedIntrinsic) { return null @@ -175,34 +176,35 @@ internal class IntrinsicGenerator(private val environment: IntrinsicGeneratorEnv } IntrinsicType.INIT_INSTANCE -> { val initializer = callSite.getValueArgument(1) as IrConstructorCall - val thiz = environment.evaluateExpression(callSite.getValueArgument(0)!!) + val thiz = environment.evaluateExpression(callSite.getValueArgument(0)!!, null) environment.evaluateCall( initializer.symbol.owner, listOf(thiz) + environment.evaluateExplicitArgs(initializer), - environment.calculateLifetime(initializer) + environment.calculateLifetime(initializer), ) codegen.theUnitInstanceRef.llvm } IntrinsicType.COROUTINE_LAUNCHPAD -> { val suspendFunctionCall = callSite.getValueArgument(0) as IrCall - val continuation = environment.evaluateExpression(callSite.getValueArgument(1)!!) + val continuation = environment.evaluateExpression(callSite.getValueArgument(1)!!, null) val suspendFunction = suspendFunctionCall.symbol.owner assert(suspendFunction.isSuspend) { "Call to a suspend function expected but was ${suspendFunction.dump()}" } environment.evaluateCall(suspendFunction, environment.evaluateExplicitArgs(suspendFunctionCall) + listOf(continuation), environment.calculateLifetime(suspendFunctionCall), - suspendFunction.parent as? IrClass // Call non-virtually. + suspendFunction.parent as? IrClass, // Call non-virtually. + resultSlot, ) } else -> null } } - fun evaluateCall(callSite: IrCall, args: List): LLVMValueRef = - environment.functionGenerationContext.evaluateCall(callSite, args) + fun evaluateCall(callSite: IrCall, args: List, resultSlot: LLVMValueRef?): LLVMValueRef = + environment.functionGenerationContext.evaluateCall(callSite, args, resultSlot) // Assuming that we checked for `TypedIntrinsic` annotation presence. - private fun FunctionGenerationContext.evaluateCall(callSite: IrCall, args: List): LLVMValueRef = + private fun FunctionGenerationContext.evaluateCall(callSite: IrCall, args: List, resultSlot: LLVMValueRef?): LLVMValueRef = when (val intrinsicType = getIntrinsicType(callSite)) { IntrinsicType.PLUS -> emitPlus(args) IntrinsicType.MINUS -> emitMinus(args) @@ -246,7 +248,7 @@ internal class IntrinsicGenerator(private val environment: IntrinsicGeneratorEnv IntrinsicType.INTEROP_READ_PRIMITIVE -> emitReadPrimitive(callSite, args) IntrinsicType.INTEROP_WRITE_PRIMITIVE -> emitWritePrimitive(callSite, args) IntrinsicType.INTEROP_GET_POINTER_SIZE -> emitGetPointerSize() - IntrinsicType.CREATE_UNINITIALIZED_INSTANCE -> emitCreateUninitializedInstance(callSite) + IntrinsicType.CREATE_UNINITIALIZED_INSTANCE -> emitCreateUninitializedInstance(callSite, resultSlot) IntrinsicType.INTEROP_NATIVE_PTR_TO_LONG -> emitNativePtrToLong(callSite, args) IntrinsicType.INTEROP_NATIVE_PTR_PLUS_LONG -> emitNativePtrPlusLong(args) IntrinsicType.INTEROP_GET_NATIVE_NULL_PTR -> emitGetNativeNullPtr() @@ -322,11 +324,11 @@ internal class IntrinsicGenerator(private val environment: IntrinsicGeneratorEnv } } - private fun FunctionGenerationContext.emitCreateUninitializedInstance(callSite: IrCall): LLVMValueRef { + private fun FunctionGenerationContext.emitCreateUninitializedInstance(callSite: IrCall, resultSlot: LLVMValueRef?): LLVMValueRef { val typeParameterT = context.ir.symbols.createUninitializedInstance.descriptor.typeParameters[0] val enumClass = callSite.getTypeArgument(typeParameterT)!! val enumIrClass = enumClass.getClass()!! - return allocInstance(enumIrClass, environment.calculateLifetime(callSite), environment.stackLocalsManager) + return allocInstance(enumIrClass, environment.calculateLifetime(callSite), environment.stackLocalsManager, resultSlot) } private fun FunctionGenerationContext.emitGetPointerSize(): LLVMValueRef = diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 15a895c39dd..b77bcf7f17a 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -135,6 +135,8 @@ private interface CodeContext { */ fun genReturn(target: IrSymbolOwner, value: LLVMValueRef?) + fun getReturnSlot(target: IrSymbolOwner) : LLVMValueRef? + fun genBreak(destination: IrBreak) fun genContinue(destination: IrContinue) @@ -159,7 +161,7 @@ private interface CodeContext { * * @return the requested value */ - fun genGetValue(value: IrValueDeclaration): LLVMValueRef + fun genGetValue(value: IrValueDeclaration, resultSlot: LLVMValueRef?): LLVMValueRef /** * Returns owning function scope. @@ -230,14 +232,14 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map, resultLifetime: Lifetime, superClass: IrClass?) = - evaluateSimpleFunctionCall(function, args, resultLifetime, superClass) + override fun evaluateCall(function: IrFunction, args: List, resultLifetime: Lifetime, superClass: IrClass?, resultSlot: LLVMValueRef?) = + evaluateSimpleFunctionCall(function, args, resultLifetime, superClass, resultSlot) override fun evaluateExplicitArgs(expression: IrFunctionAccessExpression): List = this@CodeGeneratorVisitor.evaluateExplicitArgs(expression) - override fun evaluateExpression(value: IrExpression): LLVMValueRef = - this@CodeGeneratorVisitor.evaluateExpression(value) + override fun evaluateExpression(value: IrExpression, resultSlot: LLVMValueRef?): LLVMValueRef = + this@CodeGeneratorVisitor.evaluateExpression(value, resultSlot) } private val intrinsicGenerator = IntrinsicGenerator(intrinsicGeneratorEnvironment) @@ -252,6 +254,8 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map return evaluateTypeOperator (value) - is IrCall -> return evaluateCall (value) + is IrTypeOperatorCall -> return evaluateTypeOperator (value, resultSlot) + is IrCall -> return evaluateCall (value, resultSlot) is IrDelegatingConstructorCall -> - return evaluateCall (value) - is IrConstructorCall -> return evaluateCall (value) + return evaluateCall (value, resultSlot) + is IrConstructorCall -> return evaluateCall (value, resultSlot) is IrInstanceInitializerCall -> return evaluateInstanceInitializerCall(value) - is IrGetValue -> return evaluateGetValue (value) + is IrGetValue -> return evaluateGetValue (value, resultSlot) is IrSetValue -> return evaluateSetValue (value) - is IrGetField -> return evaluateGetField (value) + is IrGetField -> return evaluateGetField (value, resultSlot) is IrSetField -> return evaluateSetField (value) is IrConst<*> -> return evaluateConst (value).llvm is IrReturn -> return evaluateReturn (value) - is IrWhen -> return evaluateWhen (value) + is IrWhen -> return evaluateWhen (value, resultSlot) is IrThrow -> return evaluateThrow (value) is IrTry -> return evaluateTry (value) - is IrReturnableBlock -> return evaluateReturnableBlock (value) - is IrContainerExpression -> return evaluateContainerExpression (value) + is IrReturnableBlock -> return evaluateReturnableBlock (value, resultSlot) + is IrContainerExpression -> return evaluateContainerExpression (value, resultSlot) is IrWhileLoop -> return evaluateWhileLoop (value) is IrDoWhileLoop -> return evaluateDoWhileLoop (value) is IrVararg -> return evaluateVararg (value) is IrBreak -> return evaluateBreak (value) is IrContinue -> return evaluateContinue (value) - is IrGetObjectValue -> return evaluateGetObjectValue (value) + is IrGetObjectValue -> return evaluateGetObjectValue (value, resultSlot) is IrFunctionReference -> return evaluateFunctionReference (value) is IrSuspendableExpression -> - return evaluateSuspendableExpression (value) + return evaluateSuspendableExpression (value, resultSlot) is IrSuspensionPoint -> return evaluateSuspensionPoint (value) is IrClassReference -> return evaluateClassReference (value) is IrConstantValue -> return evaluateConstantValue (value).llvm @@ -1022,12 +1034,13 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map evaluateCast(value) + IrTypeOperator.CAST -> evaluateCast(value, resultSlot) IrTypeOperator.IMPLICIT_INTEGER_COERCION -> evaluateIntegerCoercion(value) - IrTypeOperator.IMPLICIT_CAST -> evaluateExpression(value.argument) + IrTypeOperator.IMPLICIT_CAST -> evaluateExpression(value.argument, resultSlot) IrTypeOperator.IMPLICIT_NOTNULL -> TODO(ir2string(value)) IrTypeOperator.IMPLICIT_COERCION_TO_UNIT -> { evaluateExpression(value.argument) @@ -1530,12 +1549,12 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map delegatingConstructorCall(value.symbol.owner, args) - is IrConstructorCall -> evaluateConstructorCall(value, args) - else -> evaluateFunctionCall(value as IrCall, args, resultLifetime(value)) + is IrConstructorCall -> evaluateConstructorCall(value, args, resultSlot) + else -> evaluateFunctionCall(value as IrCall, args, resultLifetime(value), resultSlot) } } @@ -2247,7 +2275,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map, - resultLifetime: Lifetime): LLVMValueRef { + resultLifetime: Lifetime, resultSlot: LLVMValueRef?): LLVMValueRef { val function = callee.symbol.owner val argsWithContinuationIfNeeded = if (function.isSuspend) args + getContinuation() else args return when { - function.isTypedIntrinsic -> intrinsicGenerator.evaluateCall(callee, args) + function.isTypedIntrinsic -> intrinsicGenerator.evaluateCall(callee, args, resultSlot) function.isBuiltInOperator -> evaluateOperatorCall(callee, argsWithContinuationIfNeeded) function.origin == DECLARATION_ORIGIN_FILE_GLOBAL_INITIALIZER -> evaluateFileGlobalInitializerCall(function) function.origin == DECLARATION_ORIGIN_FILE_THREAD_LOCAL_INITIALIZER -> evaluateFileThreadLocalInitializerCall(function) function.origin == DECLARATION_ORIGIN_FILE_STANDALONE_THREAD_LOCAL_INITIALIZER -> evaluateFileStandaloneThreadLocalInitializerCall(function) - else -> evaluateSimpleFunctionCall(function, argsWithContinuationIfNeeded, resultLifetime, callee.superQualifierSymbol?.owner) + else -> evaluateSimpleFunctionCall(function, argsWithContinuationIfNeeded, resultLifetime, callee.superQualifierSymbol?.owner, resultSlot) } } @@ -2452,12 +2480,12 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map, - resultLifetime: Lifetime, superClass: IrClass? = null): LLVMValueRef { + resultLifetime: Lifetime, superClass: IrClass? = null, resultSlot: LLVMValueRef? = null): LLVMValueRef { //context.log{"evaluateSimpleFunctionCall : $tmpVariableName = ${ir2string(value)}"} if (superClass == null && function is IrSimpleFunction && function.isOverridable) - return callVirtual(function, args, resultLifetime) + return callVirtual(function, args, resultLifetime, resultSlot) else - return callDirect(function, args, resultLifetime) + return callDirect(function, args, resultLifetime, resultSlot) } //-------------------------------------------------------------------------// @@ -2465,7 +2493,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map): LLVMValueRef { + private fun evaluateConstructorCall(callee: IrConstructorCall, args: List, resultSlot: LLVMValueRef?): LLVMValueRef { context.log{"evaluateConstructorCall : ${ir2string(callee)}"} return memScoped { val constructedClass = callee.symbol.owner.constructedClass @@ -2473,19 +2501,19 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map { assert(args.isNotEmpty() && args[0].type == int32Type) functionGenerationContext.allocArray(constructedClass, args[0], - resultLifetime(callee), currentCodeContext.exceptionHandler) + resultLifetime(callee), currentCodeContext.exceptionHandler, resultSlot = resultSlot) } constructedClass == context.ir.symbols.string.owner -> { // TODO: consider returning the empty string literal instead. assert(args.isEmpty()) functionGenerationContext.allocArray(constructedClass, count = kImmZero, - lifetime = resultLifetime(callee), exceptionHandler = currentCodeContext.exceptionHandler) + lifetime = resultLifetime(callee), exceptionHandler = currentCodeContext.exceptionHandler, resultSlot = resultSlot) } constructedClass.isObjCClass() -> error("Call should've been lowered: ${callee.dump()}") else -> functionGenerationContext.allocInstance(constructedClass, resultLifetime(callee), - currentCodeContext.stackLocalsManager) + currentCodeContext.stackLocalsManager, resultSlot = resultSlot) } evaluateSimpleFunctionCall(callee.symbol.owner, listOf(thisValue) + args, Lifetime.IRRELEVANT /* constructor doesn't return anything */) @@ -2571,7 +2599,8 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map TODO(function.name.toString()) @@ -2583,16 +2612,16 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map, resultLifetime: Lifetime): LLVMValueRef { + fun callDirect(function: IrFunction, args: List, resultLifetime: Lifetime, resultSlot: LLVMValueRef?): LLVMValueRef { val functionDeclarations = codegen.llvmFunction(function.target) - return call(function, functionDeclarations, args, resultLifetime) + return call(function, functionDeclarations, args, resultLifetime, resultSlot) } //-------------------------------------------------------------------------// - fun callVirtual(function: IrFunction, args: List, resultLifetime: Lifetime): LLVMValueRef { + fun callVirtual(function: IrFunction, args: List, resultLifetime: Lifetime, resultSlot: LLVMValueRef?): LLVMValueRef { val functionDeclarations = functionGenerationContext.lookupVirtualImpl(args.first(), function) - return call(function, functionDeclarations, args, resultLifetime) + return call(function, functionDeclarations, args, resultLifetime, resultSlot) } //-------------------------------------------------------------------------// @@ -2610,7 +2639,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map, - resultLifetime: Lifetime): LLVMValueRef { + resultLifetime: Lifetime, resultSlot: LLVMValueRef?): LLVMValueRef { check(!function.isTypedIntrinsic) val needsNativeThreadState = function.needsNativeThreadState @@ -2627,7 +2656,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map @@ -2647,8 +2676,9 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map, resultLifetime: Lifetime = Lifetime.IRRELEVANT, exceptionHandler: ExceptionHandler = currentCodeContext.exceptionHandler, + resultSlot: LLVMValueRef? = null ): LLVMValueRef { - return functionGenerationContext.call(function, args, resultLifetime, exceptionHandler) + return functionGenerationContext.call(function, args, resultLifetime, exceptionHandler, resultSlot = resultSlot) } //-------------------------------------------------------------------------// @@ -2656,7 +2686,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map): LLVMValueRef { val constructedClass = functionGenerationContext.constructedClass!! - val thisPtr = currentCodeContext.genGetValue(constructedClass.thisReceiver!!) + val thisPtr = currentCodeContext.genGetValue(constructedClass.thisReceiver!!, null) if (constructor.constructedClass.isExternalObjCClass() || constructor.constructedClass.isAny()) { assert(args.isEmpty()) @@ -2672,7 +2702,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map