From 1a8fef7a0add1c962187bd0f9255ee65f4ec0f3c Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Tue, 12 Mar 2024 17:17:28 +0100 Subject: [PATCH] Feedback --- src/coreclr/jit/importercalls.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/coreclr/jit/importercalls.cpp b/src/coreclr/jit/importercalls.cpp index bc5fabbfe43e6..7796f2f9700f1 100644 --- a/src/coreclr/jit/importercalls.cpp +++ b/src/coreclr/jit/importercalls.cpp @@ -2061,22 +2061,22 @@ void Compiler::impPopArgsForSwiftCall(GenTreeCall* call, CORINFO_SIG_INFO* sig, { // This is a struct type. Check if it needs to be lowered. // TODO-Bug: SIMD types are not handled correctly by this. - CORINFO_SWIFT_LOWERING lowering; - info.compCompHnd->getSwiftLowering(argClass, &lowering); - if (lowering.byReference) + CORINFO_SWIFT_LOWERING* lowering = new (this, CMK_CallArgs) CORINFO_SWIFT_LOWERING; + lowerings[argIndex] = lowering; + info.compCompHnd->getSwiftLowering(argClass, lowering); + if (lowering->byReference) { JITDUMP(" Argument %d of type %s must be passed by reference\n", argIndex, typGetObjLayout(argClass)->GetClassName()); } else { - lowerings[argIndex] = new (this, CMK_CallArgs) CORINFO_SWIFT_LOWERING(lowering); JITDUMP(" Argument %d of type %s must be passed as %d primitive(s)\n", argIndex, - typGetObjLayout(argClass)->GetClassName(), lowering.numLoweredElements); - for (size_t i = 0; i < lowering.numLoweredElements; i++) + typGetObjLayout(argClass)->GetClassName(), lowering->numLoweredElements); + for (size_t i = 0; i < lowering->numLoweredElements; i++) { - JITDUMP(" [%zu] @ +%02u: %s\n", i, lowering.offsets[i], - varTypeName(JitType2PreciseVarType(lowering.loweredElements[i]))); + JITDUMP(" [%zu] @ +%02u: %s\n", i, lowering->offsets[i], + varTypeName(JitType2PreciseVarType(lowering->loweredElements[i]))); } } } @@ -2145,8 +2145,9 @@ void Compiler::impPopArgsForSwiftCall(GenTreeCall* call, CORINFO_SIG_INFO* sig, else { CORINFO_SWIFT_LOWERING* lowering = lowerings[argIndex]; + assert(lowering != nullptr); - if (lowering == nullptr) + if (lowering->byReference) { GenTree* addrNode = gtNewLclAddrNode(structVal->GetLclNum(), structVal->GetLclOffs()); JITDUMP(" Passing by reference\n");